# Conflicts:
#	src/router/index_Common.js
修改冲突
This commit is contained in:
lVAL 2020-10-15 18:55:07 +08:00
commit 4e6d4e6a73
19 changed files with 710 additions and 34 deletions

47
src/api/company.js Normal file
View File

@ -0,0 +1,47 @@
import request from '@/utils/request';
/** 获取公司列表 */
export function getCompanyList() {
return request({
url: '/api/company',
method: 'get'
});
}
/** 添加公司信息 */
export function addCompany(data) {
return request({
url: '/api/company',
method: 'post',
data: data
});
}
/** 删除公司信息 */
export function deleteCompany(id) {
return request({
url: `/api/company/${id}`,
method: 'delete'
});
}
/** 根据id查询公司信心 */
export function getCompanyById(id) {
return request({
url: `/api/company/${id}`,
method: 'get'
});
}
/** 更新公司信息 */
export function updateCompany(id, data) {
return request({
url: `/api/company/${id}`,
method: 'put',
data
});
}
/** 分页查询公司列表 */
export function getCompanyListPaging(params) {
return request({
url: `/api/company/paging`,
method: 'get',
params
});
}

47
src/api/questionsRule.js Normal file
View File

@ -0,0 +1,47 @@
import request from '@/utils/request';
/** 获取出题规则列表 */
export function getQuestionRuleList() {
return request({
url: `/api/questionsRule`,
method: 'get'
});
}
/** 添加出题规则 */
export function addQuestionRule(data) {
return request({
url: `/api/questionsRule`,
method: 'post',
data
});
}
/** 分页获取规则列表 */
export function getQustionRuleListPage(params) {
return request({
url: `/api/questionsRule/paging`,
method: 'get',
params
});
}
/** 删除出题规则 */
export function deleteQuestionRule(id) {
return request({
url: `/api/questionsRule/${id}`,
method: 'delete'
});
}
/** 查询单个出题规则 */
export function selectedQuestionRule(id) {
return request({
url: `/api/questionsRule/${id}`,
method: 'get'
});
}
/** 更改出题规则内容 */
export function updateQuestionRule(id, data) {
return request({
url: `/api/questionsRule/${id}`,
method: 'put',
data: data
});
}

View File

@ -81,5 +81,6 @@ export default {
raceManage: 'Race manage',
practiceManage:'Practice manage',
bankManage: 'Bank manage',
sceneManage:'Scene manage'
sceneManage:'Scene manage',
companyManage: 'Company manage'
};

View File

@ -86,5 +86,6 @@ export default {
recaList: '报名列表',
bankManage: '题库列表',
practiceManage:'实操列表',
sceneManage:'场景列表'
sceneManage:'场景列表',
companyManage: '单位管理'
};

View File

@ -437,7 +437,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
rails = loadrails;
console.log(trainlisttest.group.children[0]);
trainlisttest.group.children[0].getObjectByName("c1").add(cameracctv);
trainlisttest.group.children[0].getObjectByName("c3").add(cameracctv);
}
this.eventon = function() {

View File

@ -306,15 +306,19 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
if(event.data.type == "topTrain"){
if(trainControl.toptrain.status != 1){
if(event.data.offset>=0.0360){
trainControl.toptrain.position.copy(trainControl.toptrain.curve.getPointAt(event.data.offset));
}
}
}
if(event.data.type == "downTrain"){
if(trainControl.downtrain.status != 1){
if(event.data.offset<=0.965){
trainControl.downtrain.position.copy(trainControl.downtrain.curve.getPointAt(event.data.offset));
}
}
}
//上行列车车门控制
if(event.data.type == "topTrainDoor"){
@ -322,6 +326,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
trainControl.closetraindoor(trainControl.toptrain,event.data.doorCode,positionStatus,"top");
// trainLeaveStation("top");
}else{
trainControl.toptrain.position.copy(trainControl.toptrain.curve.getPointAt(0.0365));
trainControl.opentraindoor(trainControl.toptrain,event.data.doorCode,"top");
trainControl.toptrain.status = 1;
}
@ -333,6 +338,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
trainControl.closetraindoor(trainControl.downtrain,event.data.doorCode,positionStatus,"down");
// trainLeaveStation("down");
}else{
trainControl.downtrain.position.copy(trainControl.downtrain.curve.getPointAt(0.961));
trainControl.opentraindoor(trainControl.downtrain,event.data.doorCode,"down");
trainControl.downtrain.status = 1;
}

View File

@ -147,6 +147,7 @@ const JsxtApply = () => import('@/views/jsxt/apply/index');
const RefereeList = () => import('@/views/jsxt/refereeList/index');
const RefereeDisplay = () => import('@/views/jsxt/refereeList/display');
const Approval = () => import('@/views/approval/index');
const CompanyManage = () => import('@/views/system/companyManage/index');
import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth';
@ -796,6 +797,15 @@ export const asyncRouter = [
i18n: 'router.userManage'
}
},
{
// 单位管理
path: 'companyManage',
hidden: true,
component: CompanyManage,
meta: {
i18n: 'router.companyManage'
}
},
{
// 缓存管理
path: 'cache',

View File

@ -2,6 +2,19 @@
<div v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.6)" style="width:100%;height:100%;">
<div class="Substation" :style="{'background':bacground}">
<div class="Substation_header">{{ title }}</div>
<div v-if="mode.includes('environmentFive')" class="environmentFive-box">
<div class="button_box" :class="{'active': mode == 'environmentFive01'}" @click="handleButton('01', mode == 'environmentFive01')">小系统1模式</div>
<div class="button_box" :class="{'active': mode == 'environmentFive02'}" @click="handleButton('02', mode == 'environmentFive02')">小系统2模式</div>
<div class="button_box" :class="{'active': mode == 'environmentFive03'}" @click="handleButton('03', mode == 'environmentFive03')">小系统3模式</div>
</div>
<div v-if="mode.includes('environmentNine')" class="environmentFive-box">
<div class="button_box" :class="{'active': mode == 'environmentNine01'}" @click="handleIllumination('01', mode == 'environmentNine01')">照明系统</div>
<div class="button_box" :class="{'active': mode == 'environmentNine02'}" @click="handleIllumination('02', mode == 'environmentNine02')">照明系统监测</div>
</div>
<div v-if="mode.includes('environmentEleven') || mode.includes('environmentTwelve')" class="environmentFive-box">
<div class="button_box" :class="{'active': mode == 'environmentEleven'}" @click="handleEnvironment('environmentEleven', mode == 'environmentEleven', '人防门')">人防门</div>
<div class="button_box" :class="{'active': mode == 'environmentTwelve'}" @click="handleEnvironment('environmentTwelve', mode == 'environmentTwelve', '防淹门系统')">防淹门</div>
</div>
<div>
<iscsSystem ref="iscsPlate" />
</div>
@ -27,7 +40,9 @@ export default {
loading: false,
width: window.innerWidth,
scaleRate: window.innerWidth / 1920,
height:1000
height: 1000,
mode: '',
system: ''
};
},
computed:{
@ -36,21 +51,47 @@ export default {
},
stationId() {
return this.$route.query.stationId;
},
mode() {
return this.$route.params.mode;
}
},
watch:{
$route() {
this.mode = this.$route.params.mode;
this.getInitData();
}
},
created() {
this.mode = this.$route.params.mode;
},
mounted() {
this.getInitData();
},
methods:{
handleButton(type, judge) {
if (!judge) {
this.mode = `environmentFive${type}`;
this.system = 'environmentFive';
this.title = `${this.stationName} 小系统${Number(type)}原理图`;
this.getDetail();
}
},
handleIllumination(type, judge) {
if (!judge) {
this.mode = `environmentNine${type}`;
this.system = 'environmentNine';
this.title = `${this.stationName} 照明系统`;
this.getDetail();
}
},
handleEnvironment(type, judge, name) {
if (!judge) {
this.mode = type;
this.title = `${this.stationName} ${name}`;
this.getDetail();
}
},
getInitData() {
this.system = 'environment';
if (this.mode == 'environmentThree') {
this.title = this.stationName + ' 隧道通风系统';
this.scaleRate = window.innerWidth / 2000;
@ -60,6 +101,12 @@ export default {
this.title = this.stationName + ' 大系统';
this.scaleRate = window.innerWidth / 2000;
this.height = 900;
} else if (this.mode == 'environmentFive') {
this.mode = 'environmentFive01';
this.system = 'environmentFive';
this.title = this.stationName + ' 小系统1原理图';
this.scaleRate = window.innerWidth / 2000;
this.height = 800;
} else if (this.mode == 'environmentSix') {
this.title = this.stationName + ' 冷水系统 原理图';
this.scaleRate = window.innerWidth / 2000;
@ -73,9 +120,11 @@ export default {
this.scaleRate = window.innerWidth / 1920;
this.height = 900;
} else if (this.mode == 'environmentNine') {
this.system = 'environmentNine';
this.mode = 'environmentNine01';
this.title = this.stationName + ' 照明系统';
this.scaleRate = window.innerWidth / 1920;
this.height = 900;
this.height = 800;
} else if (this.mode == 'environmentTen') {
this.title = this.stationName + ' 自动扶梯系统';
this.scaleRate = window.innerWidth / 1920;
@ -84,10 +133,21 @@ export default {
this.title = this.stationName + ' 传感器';
this.scaleRate = window.innerWidth / 1920;
this.height = 1000;
} else if (this.mode == 'environmentEleven') {
this.title = this.stationName + ' 人防门';
this.scaleRate = window.innerWidth / 1920;
this.height = 900;
} else if (this.mode == 'environmentTwelve') {
this.title = this.stationName + ' 防淹门系统';
this.scaleRate = window.innerWidth / 1920;
this.height = 900;
}
this.getDetail();
},
getDetail() {
const params = {
lineCode: this.$route.query.lineCode,
system: 'environment',
system: this.system,
totalSystem :'environment02',
userInterface : this.mode
};
@ -122,4 +182,21 @@ export default {
.SubstationIn{
display: inline-block;
}
.environmentFive-box{
position: absolute;
right: 60px;
top: 68px;
z-index: 100;
.button_box{
background: #D1C1C4;
border: 1px solid #fff;
float: left;
padding: 8px 10px;
cursor: pointer;
font-size: 14px;
&.active{
color: #939393;
}
}
}
</style>

View File

@ -5,12 +5,15 @@
<normal v-else-if="mode=='environmentThree'" />
<normal v-else-if="mode=='environmentFour'" />
<normal v-else-if="mode=='environmentFive'" />
<normal v-else-if="mode=='environmentSix'" />
<normal v-else-if="mode=='environmentSeven'" />
<normal v-else-if="mode=='environmentEight'" />
<normal v-else-if="mode=='environmentNine'" />
<normal v-else-if="mode=='environmentTen'" />
<normal v-else-if="mode=='environmentThirteen'" />
<normal v-else-if="mode=='environmentEleven'" />
<normal v-else-if="mode=='environmentTwelve'" />
<!-- -->
</div>

View File

@ -90,7 +90,7 @@ export default {
this.title = this.stationName + ' 降压变电所主接线图';
params.userInterface = 'stepDown';
}
this.scaleRate = window.innerWidth / 2200;
this.scaleRate = window.innerWidth / 2000;
this.bacground = 'rgba(0,0,0,0)';
}

View File

@ -10,7 +10,7 @@
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
<div class="userMessage">
<!-- <span class="el-icon-video-play playicon" /> -->
<img :src="yuyin" alt="playicon1">
<img :src="yuyin" class="playicon1">
<!-- <span class="messageText">{{ chatContent.content }}</span> -->
</div>
</div>

View File

@ -75,6 +75,8 @@
<operational-statistic ref="operationalStatistic" @finishTraining="finishTraining" />
<test-result ref="testResult" />
</div>
</template>
@ -106,6 +108,7 @@ import { launchFullscreen } from '@/utils/screen';
import { EventBus } from '@/scripts/event-bus';
import { createSimulationNew } from '@/api/simulation';
import OperationalStatistic from './operationalStatistic.vue';
import TestResult from './testResult.vue';
import Vue from 'vue';
export default {
@ -119,6 +122,7 @@ export default {
TheoryExamSelect,
TheoryExam,
OperationalStatistic,
TestResult,
// TheoryQuiz,
// ThroryResult,
SelectRole
@ -166,6 +170,7 @@ export default {
scriptMode: ScriptMode.TEACH,
mapLocation:{},
playerList:[],
actionList:[],
currentPlayList:[],
// formatUsedTime:'',
formatScore:0,
@ -449,11 +454,12 @@ export default {
// this.$refs.menuScript.initLoadPage();
// }
},
selectScript({playerList, mapLocation}) {
selectScript({playerList, mapLocation, actionList}) {
this.changeScriptMode(this.scriptMode);
this.isScriptLoad = true;
this.playerList = playerList;
this.mapLocation = mapLocation;
this.actionList = actionList;
this.userRole = 'AUDIENCE';
this.$store.dispatch('training/setRoles', 'AUDIENCE');
},
@ -463,15 +469,21 @@ export default {
(this.$store.state.training.memberData[role.id] || {}).disabled = true;
this.runScriptMode(memberId);
},
finishTraining() {
finishTraining(data) {
this.isScriptRun = false;
this.showResultData(data);
},
showResultData(data) {
this.$refs.testResult.doShow({data:data, actionList:this.actionList});
},
endTraining() {
competitionPracticalSceneFinish(this.group, {operationStatisticVO:{}}).then(res=>{
this.isScriptRun = false;
// if (this.scriptMode == ScriptMode.TEST) {
this.formatScore = res.data;
this.$messageBox('得分:' + this.formatScore);
// this.formatScore = res.data;
// this.
this.showResultData(res.data);
// this.$messageBox('' + this.formatScore);
// }
// this.userRole = 'AUDIENCE';
// this.$store.dispatch('training/setRoles', 'AUDIENCE');

View File

@ -78,9 +78,9 @@ export default {
} else {
competitionPracticalSceneFinish(this.$route.query.group, this.resultData).then(res=>{
this.$message.success('运营统计数据提交成功');
this.formatScore = res.data;
this.$messageBox('得分:' + this.formatScore);
this.$emit('finishTraining');
// this.formatScore = res.data;
// this.$messageBox('' + this.formatScore);
this.$emit('finishTraining', res.data);
this.$store.dispatch('scriptRecord/updateOperationalItemVOs', this.resultData.itemVOS);
this.dialogShow = false;
}).catch(error=>{

View File

@ -120,6 +120,7 @@ export default {
const playerList = [];
EventBus.$emit('clearRunSeries');
EventBus.$emit('loadScene');
const actionList = {};
if (res.data.memberList && res.data.memberList.length > 0) {
this.form.type = '';
res.data.memberList.sort((a, b) => {
@ -128,6 +129,7 @@ export default {
this.$store.dispatch('training/setMemberList', {memberList:res.data.memberList, userId:this.$store.state.user.id});
const activeMemberList = [];
res.data.actionList.forEach((activeMember)=>{
actionList[activeMember.id] = activeMember;
if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) {
activeMemberList.push(activeMember.memberId);
}
@ -177,14 +179,14 @@ export default {
if (res.data.mapLocation) {
this.mapLocation = res.data.mapLocation;
}
this.confirm(playerList);
this.confirm(playerList, actionList);
}
}
},
confirm(playerList) {
confirm(playerList, actionList) {
// this.$store.dispatch('training/setScriptOperationType', this.operationType);
// operationType:ScriptMode[this.operationType]
this.$emit('selectScript', {playerList:playerList, mapLocation:this.mapLocation});
this.$emit('selectScript', {playerList:playerList, mapLocation:this.mapLocation, actionList:actionList});
this.doClose();
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {

View File

@ -0,0 +1,263 @@
<template>
<el-dialog
title="竞赛结果详情"
:visible.sync="dialogShow"
top="50px"
width="900px"
:before-do-close="doClose"
class="OSResult"
:close-on-click-modal="false"
>
<div class="operationStatisticResult">
<div class="OSTcompleted">
<span>竞赛{{ completed?'已完成':'未完成' }}</span>
<span style="margin-left:20px;">竞赛总分{{ totalScore }} </span>
<span style="margin-left:20px;">用户得分{{ userScore }} </span>
</div>
<div class="OSTitle">关键步骤信息</div>
<el-table :data="commandPublishStatisticVO" border class="OSTTable3" height="400">
<el-table-column prop="actionId" label="步骤描述" width="200">
<template slot-scope="scope">
{{ covert(scope.row.actionId) }}
</template>
</el-table-column>
<el-table-column prop="keyWords" label="关键字" width="200">
<template slot-scope="scope">
<el-tag v-for="(tag,index) in scope.row.keyWords" :key="index" class="eachTag">{{ tag }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="timeConsumed" label="用时" width="100" />
<el-table-column prop="timeOut" label="超时时间" width="100">
<template slot-scope="scope">
{{ scope.row.timeOut?scope.row.timeOut+'s':'' }}
</template>
</el-table-column>
<el-table-column prop="score" label="步骤总分" width="100" />
<el-table-column prop="finalPointsDeducted" label="用户扣分" width="100" />
</el-table>
<div class="OSTitle">运营统计信息</div>
<el-table :data="operationStaticItemVOs" border class="OSTTable">
<el-table-column prop="description" label="数据名称" width="200" />
<el-table-column label="正确答案" width="150">
<template slot-scope="scope">
<div v-if="scope.row.type=='Time'">{{ scope.row.time }}</div>
<div v-else-if="scope.row.type=='Non_Time'">{{ scope.row.standardAnswer }}</div>
</template>
</el-table-column>
<el-table-column label="用户填写" width="150">
<template slot-scope="scope">
<div v-if="scope.row.type=='Time'">{{ scope.row.timeFilledInByUser }}</div>
<div v-else-if="scope.row.type=='Non_Time'">{{ scope.row.userAnswer }}</div>
</template>
</el-table-column>
<el-table-column prop="finalPointsDeducted" label="扣分" />
</el-table>
<div class="OSTSignInfo">运营指标信息</div>
<div v-if="!completed" class="OSTSignInfoTips">
<span class="el-icon-info" style="font-size: 16px;" /> 因竞赛未完成运营指标不得分
</div>
<div class="OSTSignInfoTips">晚点列车信息</div>
<el-table :data="finalLateStatistics" border class="OSTTable1">
<el-table-column prop="groupNumber" label="车组号" width="299" />
<el-table-column prop="dt" label="晚点时间" width="300">
<template slot-scope="scope">
{{ scope.row.dt }} s
</template>
</el-table-column>
</el-table>
<div class="OSTSignInfoTips">区间停车信息</div>
<el-table :data="finalStopInSectionStatistics" border class="OSTTable2">
<el-table-column prop="groupNumber" label="车组号" width="299" />
<el-table-column prop="duration" label="停车时长" width="300">
<template slot-scope="scope">
{{ scope.row.duration }} s
</template>
</el-table-column>
</el-table>
<div class="OSTSignInfoTips">
运营指标总扣分{{ finalPointsDeducted4OperationIndex }}
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doClose">{{ $t('global.confirm') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import {covertOperate} from '@/views/newMap/displayNew/scriptDisplay/component/covertOperation';
export default {
name:'TestResult',
data() {
return {
dialogShow:false,
operationStaticItemVOs:[],
finalLateStatistics:[],
finalStopInSectionStatistics:[],
commandPublishStatisticVO:[],
completed:false,
totalScore:'',
userScore:'',
actionList:[],
finalPointsDeducted4OperationIndex:0
};
},
methods:{
doShow({data, actionList}) {
this.dialogShow = true;
this.completed = data.completed;
this.operationStaticItemVOs = data.operationStatisticVO.itemVOS;
this.finalLateStatistics = data.operationIndexStatisticVO.finalLateStatistics;
this.finalStopInSectionStatistics = data.operationIndexStatisticVO.finalStopInSectionStatistics;
this.commandPublishStatisticVO = data.commandPublishStatisticVO;
this.actionList = actionList;
this.totalScore = data.totalScore;
this.userScore = data.userScore;
this.finalPointsDeducted4OperationIndex = data.finalPointsDeducted4OperationIndex;
},
doClose() {
this.dialogShow = false;
},
covert(actionId) {
// return actionId;
const element = this.actionList[actionId];
// this.$store.state.training.memberData[memberId]
const member = this.$store.state.training.memberData[element.memberId];
let resultData = '';
if (element.type == 'Accept_Conversation_Invitation') {
resultData = member.label + '请接受会话邀请';
} else if (element.type == 'Conversation') {
resultData = member.label + '说:' + element.content;
} else if (element.type == 'Operation') {
resultData = covertOperate(element.operationType, element.operationParamMap);
resultData = resultData.replace('请', member.label);
// this.scriptTipMessage = '' + deviceName + '' + operateName.label + '';
} else if (element.type == 'Exit_Conversation') {
resultData = member.label + '结束当前会话';
} else if (element.type == 'Start_Conversation' ) {
const inviteMember = [];
// this.$emit('allowCreatCoversition');
if (element.communicationObject) {
if (element.communicationObject == 'ALL_STATION') {
inviteMember.push('所有车站');
} else if (element.communicationObject == 'ALL_TRAIN') {
inviteMember.push('所有司机');
}
} else {
element.conversationMemberIds.forEach(id=>{
if (element.memberId != id) {
inviteMember.push((this.memberList[id] || {label: ''}).label);
}
});
}
resultData = member.label + '创建会话,选择' + inviteMember.toString();
} else if (element.type == 'Command') {
const targetName = this.memberList[element.commandInitiateVO.targetMemberId];
const CommandList = {
Drive_Ahead:'确认运行至前方站',
Route_Block_Drive:'进路闭塞法行车',
Drive_Through_The_Guide_Signal:'越引导信号行驶',
Drive_Through_The_Red_Light:'越红灯行驶',
Drive_In_Urm_Mode:'URM模式驾驶',
Set_Speed_Limit:'设置限速',
Open_Or_Close_Door:'开关门',
Switch_Hook_Lock: '道岔钩锁'
};
resultData = member.label + '对【' + targetName.label + '】下达【' + CommandList[element.commandInitiateVO.commandType] + '】指令';
} else if (element.type == 'Drive') {
if (element.targetSectionCode) {
const section = this.$store.getters['map/getDeviceByCode'](element.targetSectionCode);
if (section && section.name) {
resultData = member.label + '把车开到区段' + section.name;
}
}
}
return resultData;
}
}
};
</script>
<style lang="scss" scoped>
.operationStatisticResult{
height: 500px;
overflow: auto;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
.OSTTable3{
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
.OSTitle{
padding: 10px 5px;
font-size: 15px;
font-weight: bold;
}
.OSTTable{
width:600px;
}
.OSTTable1,.OSTTable2{
width:600px;
}
.OSTTable3{
width:802px;
}
.OSTcompleted{
padding: 5px 5px;
font-size: 15px;
}
.OSTSignInfo{
padding: 15px 5px 10px 5px;
font-size: 15px;
font-weight: bold;
}
.OSTSignInfoTips{
padding: 10px 5px;
font-size: 15px;
}
.eachTag{
margin-left:10px;
}
</style>
<style lang="scss">
.OSResult .el-dialog__body{
padding: 10px 20px;
}
.OSTTable3 .el-table__body-wrapper.is-scrolling-none {
&::-webkit-scrollbar{
width: 4px !important;
}
&::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #c3c3c3;
}
&::-webkit-scrollbar-track {
border-radius: 0;
background: #f0f0f0;
}
}
</style>

View File

@ -0,0 +1,106 @@
<template>
<el-dialog v-dialogDrag title="添加单位" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center :close-on-click-modal="false">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ update? '修改' : $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { addCompany, updateCompany } from '@/api/company';
export default {
name: 'Add',
data() {
return {
dialogVisible: false,
formModel: {
address: '',
name: '',
phone: '',
id: ''
},
update: false
};
},
computed:{
form() {
const form = {
labelWidth: '100px',
items: [
{ prop: 'name', label: '昵称', type: 'text' },
{ prop: 'phone', label: '电话', type: 'text' },
{ prop: 'address', label: '地址', type: 'text' }
]
};
return form;
},
rules() {
const crules = {
name: [
{ required: true, message: '请输入单位名称', trigger: 'blur' },
{ min: 1, max: 25, message: this.$t('rules.strLength1To25'), trigger: 'blur' }
],
phone: [
{ required: true, message: '请输入公司电话', trigger: 'blur' }
],
address:[
{ required: true, message: '请输入公司地址', trigger: 'blur'}
]
};
return crules;
}
},
methods: {
doShow(data) {
this.dialogVisible = true;
this.update = false;
if (data) {
this.update = true;
this.formModel = {
id: data.id,
name: data.name,
phone: data.phone,
address: data.address
};
} else {
this.formModel = {
address: '',
name: '',
phone: '',
id: ''
};
}
},
handleClose() {
this.dialogVisible = false;
},
doSave() {
this.$refs.dataform.validateForm(() => {
if (this.update) {
updateCompany(this.formModel.id, this.formModel).then(resp => {
this.$message.success('更新单位信息成功!');
this.dialogVisible = false;
this.$emit('reloadTable');
}).catch(e => {
this.$message.error('更新单位信息失败!');
});
} else {
addCompany(this.formModel).then(resp => {
this.$message.success('添加单位信息成功!');
this.dialogVisible = false;
this.$emit('reloadTable');
}).catch(e => {
this.$message.error('添加单位信息失败!');
});
}
});
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,97 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-company ref="editCompany" @reloadTable="reloadTable" />
</div>
</template>
<script>
import { getCompanyListPaging, deleteCompany } from '@/api/company';
import EditCompany from './add';
export default {
name: 'CompanyManage',
components: {
EditCompany
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '80px',
reset: true,
queryObject: {
}
},
queryList: {
query: getCompanyListPaging,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '公司名称',
prop: 'name'
},
{
title: '公司电话',
prop: 'phone'
},
{
title: '公司地址',
prop: 'address'
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('global.edit'),
handleClick: this.handleUpdate
},
{
name: '删除',
handleClick: this.handleDeleteCompany,
type: 'danger'
}
]
}
],
actions: [
{ text: '添加', btnCode: 'employee_auto', handler: this.handlerAddCompany },
{ text: '返回', btnCode: 'employee_auto', handler: this.handlerBack}
]
},
currentModel: {}
};
},
methods: {
handlerAddCompany() {
this.$refs.editCompany.doShow();
},
handleDeleteCompany(index, row) {
deleteCompany(row.id).then(resp => {
this.$message.success('删除单位信息成功!');
this.reloadTable();
}).catch(() => {
this.$message.error('删除单位信息失败!');
});
},
handleUpdate(index, row) {
this.$refs.editCompany.doShow(row);
},
reloadTable() {
this.queryList.reload();
},
handlerBack() {
this.$router.go(-1);
}
}
};
</script>
<style scoped>
</style>

View File

@ -90,7 +90,8 @@ export default {
}
],
actions: [
{ text: '创建本地用户', btnCode: 'employee_auto', handler: this.createLocalUsers }
{ text: '创建本地用户', btnCode: 'employee_auto', handler: this.createLocalUsers },
{ text: '单位管理', btnCode: 'company_manage', handler: this.companyManage }
]
},
currentModel: {}
@ -132,6 +133,9 @@ export default {
},
createLocalUsers() {
this.$refs.createUser.doShow();
},
companyManage() {
this.$router.push({ path: `/system/companyManage`});
}
}
};

Binary file not shown.