Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly1
This commit is contained in:
commit
4323ed274e
@ -57,7 +57,7 @@ class ESwLocal extends Group {
|
||||
}
|
||||
|
||||
addHover(style) {
|
||||
this.__zr && this.__zr.addHover(this.locShelter, style)
|
||||
this.__zr && this.__zr.addHover(this.locShelter, style);
|
||||
}
|
||||
|
||||
removeHover() {
|
||||
|
44
src/jmapNew/theme/components/menus/driverAtsWorMenu.vue
Normal file
44
src/jmapNew/theme/components/menus/driverAtsWorMenu.vue
Normal file
@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<div class="menus">
|
||||
<menu-train ref="menuTrain" :selected="selected" :work="'driverAtsWork'" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import MenuTrain from './menuTrain';
|
||||
export default {
|
||||
name: 'DriverAtsWorkMenuBar',
|
||||
components: {
|
||||
MenuTrain
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.$store.dispatch('config/updateMenuBar');
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.menus .pop-menu {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
.menus .pop-menu span {
|
||||
color: #000;
|
||||
}
|
||||
.menus .pop-menu .is-disabled span {
|
||||
color: #B4B3B8;
|
||||
}
|
||||
</style>
|
103
src/jmapNew/theme/components/menus/menuTrain.vue
Normal file
103
src/jmapNew/theme/components/menus/menuTrain.vue
Normal file
@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<div>
|
||||
<pop-menu ref="popMenu" :menu="menu" />
|
||||
<set-fault ref="setFault" pop-class="fuzhou-01__systerm" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import PopMenu from '@/components/PopMenu';
|
||||
import { menuOperate, commitOperate } from '@/jmapNew/theme/components/utils/menuOperate';
|
||||
import SetFault from '@/jmapNew/theme/components/menus/dialog/setFault';
|
||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||
export default {
|
||||
name: 'MenuTrain',
|
||||
components: {
|
||||
PopMenu,
|
||||
SetFault
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
work: {
|
||||
type: String,
|
||||
default() {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menu:[],
|
||||
menuNormal: [
|
||||
{
|
||||
label: '换端',
|
||||
handler: this.handleTurnDirection
|
||||
},
|
||||
{
|
||||
label: '驾驶',
|
||||
handler: this.handleDriveTo
|
||||
},
|
||||
{
|
||||
label: '回库',
|
||||
handler: this.setInbound
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.menuOperation.menuCount': function () {
|
||||
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.Train) && !this.buttonOperation) {
|
||||
this.doShow(this.$store.state.menuOperation.menuPosition);
|
||||
} else {
|
||||
this.doClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initMenu() {
|
||||
// 编辑模式菜单列表
|
||||
this.menu = [...this.menuNormal];
|
||||
},
|
||||
// 换端
|
||||
handleTurnDirection() {
|
||||
commitOperate(menuOperate.Train.turnDirection, { groupNumber: this.selected.code }, 3).then(({valid, operate}) => {
|
||||
}).catch((error)=> {
|
||||
console.error(error);
|
||||
this.$refs.noticeInfo.doShow();
|
||||
});
|
||||
},
|
||||
// 回库
|
||||
setInbound() {
|
||||
commitOperate(menuOperate.Driver.inbound, { groupNumber: this.selected.code }, 3).then(({valid, operate}) => {
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
this.$refs.noticeInfo.doShow();
|
||||
});
|
||||
},
|
||||
// 驾驶(托管)
|
||||
handleDriveTo() {
|
||||
commitOperate(menuOperate.Common.collocation, { code: this.selected.code }, 0).then(({valid, operate})=>{
|
||||
if (valid) {
|
||||
this.$refs.setFault.doShow(menuOperate.Common.collocation, this.selected, true);
|
||||
}
|
||||
});
|
||||
},
|
||||
doShow(point) {
|
||||
this.initMenu();
|
||||
if (this.$refs && this.$refs.popMenu && this.menu && this.menu.length) {
|
||||
this.$refs.popMenu.resetShowPosition(point);
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
if (this.$refs && this.$refs.popMenu) {
|
||||
this.$refs.popMenu.close();
|
||||
// this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -114,6 +114,10 @@ class Theme {
|
||||
loadLocalWorkMenuComponent(code) {
|
||||
return Object.assign({}, require(`./${this._mapMenu[code || this._code]}/menus/localWorkMenu`).default);
|
||||
}
|
||||
// 加载司机ats工作站菜单组件
|
||||
loadDriverAtsWorkMenuComponent(code) {
|
||||
return Object.assign({}, require(`./components/menus/driverAtsWorMenu`).default);
|
||||
}
|
||||
loadCtcWorkMenuComponent(code) {
|
||||
if (code == '16') {
|
||||
return Object.assign({}, require(`./${this._mapMenu[code || this._code]}/menus/ctcWorkMenu`).default);
|
||||
|
@ -62,6 +62,7 @@ export default {
|
||||
{ label: '通号', value: 'MAINTAINER', enLabel: 'Repairman ' },
|
||||
{ label: '车辆段/停车场调度', value: 'DEPOT_DISPATCHER', enLabel: 'Depot dispatcher ' },
|
||||
{ label: '电力调度', value: 'ELECTRIC_DISPATCHER', enLabel: 'Electric dispatcher' },
|
||||
{ label: '电力工务', value: 'STATION_ELECTRIC_WORKER', enLabel: 'Station Electric dispatcher' },
|
||||
{ label: '行调', value: 'DISPATCHER', enLabel: 'Dispatcher ' },
|
||||
{ label: '上级部门', value: 'PARENT_DEPARTMENT', enLabel: 'Parent department' },
|
||||
{ label: '车辆段/停车场信号楼', value: 'SIGNAL_BUILDING', enLabel: 'Signal Building' },
|
||||
|
@ -276,6 +276,7 @@ export default {
|
||||
if (valid) {
|
||||
sendCommandNew(this.group, 'KEY_LINK_CONTROL_INFO_SAVE', obj).then((res) => {
|
||||
console.log(res, '---res');
|
||||
this.$message.success('提交成功!');
|
||||
this.initFormData();
|
||||
}).catch(error => {
|
||||
this.$messageBox('提交失败:' + error.message);
|
||||
|
@ -45,7 +45,7 @@ export default {
|
||||
},
|
||||
boxHeight() {
|
||||
const allH = this.$store.state.app.height;
|
||||
let h = allH - 103 - 39 - 30 - 41 - 15;
|
||||
let h = allH - 63 - 39 - 30 - 41 - 15 - 20;
|
||||
h = h > 0 ? h : 0;
|
||||
return h;
|
||||
}
|
||||
|
65
src/views/newMap/display/terminals/driverAtsWork.vue
Normal file
65
src/views/newMap/display/terminals/driverAtsWork.vue
Normal file
@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div>
|
||||
<component :is="menus" :selected="selected" />
|
||||
<station-diagram ref="stationDiagram" @setSelected="setSelected" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import StationDiagram from '../stationDiagram/index';
|
||||
// import {mapGetters} from 'vuex';
|
||||
import { clearSubscribe, getTopic} from '@/utils/stomp';
|
||||
export default {
|
||||
name: 'DriverAtsWork',
|
||||
components: {
|
||||
StationDiagram
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menus: null,
|
||||
selected: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
mapData() {
|
||||
return this.$store.state.map.map;
|
||||
},
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
},
|
||||
mapDevice() {
|
||||
return this.$store.state.map.mapDevice;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 地图数据加载完毕
|
||||
'$store.state.map.mapDataLoadedCount': function () {
|
||||
const lineCode = this.$jlmap.lineCode;
|
||||
if (lineCode) {
|
||||
this.menus = this.$theme.loadDriverAtsWorkMenuComponent(lineCode);
|
||||
}
|
||||
},
|
||||
'$store.state.map.initJlmapLoadedCount': function (val) {
|
||||
this.handleDispatchWorkData();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearSubscribe(getTopic('ATS_STATUS', this.group));
|
||||
},
|
||||
methods: {
|
||||
setSelected(val) {
|
||||
this.selected = val;
|
||||
},
|
||||
handleDispatchWorkData() {
|
||||
const logicData = {routeData:this.$store.state.map.routeData, autoReentryData: this.$store.state.map.autoReentryData};
|
||||
const repaint = this.$store.state.map.initJlmapLoadedCount === 1;
|
||||
const width = this.$store.state.app.width;
|
||||
const height = this.$store.state.app.height;
|
||||
this.$store.dispatch('config/resize', { width, height });
|
||||
this.$jlmap.resize({ width, height });
|
||||
this.$nextTick(()=>{
|
||||
this.$jlmap.setMap(this.mapData, this.mapDevice, logicData, repaint);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -6,6 +6,7 @@
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width:100%"
|
||||
:height="tableHeight"
|
||||
>
|
||||
<el-table-column label="请求施工(慢行及封锁)登记">
|
||||
<el-table-column prop="no" label="本月施工编号" width="120">
|
||||
@ -87,7 +88,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
|
||||
import { sendCommandNew } from '@/api/jmap/training';
|
||||
export default {
|
||||
name:'EquipmentConstructionTable',
|
||||
data() {
|
||||
@ -99,11 +100,20 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
},
|
||||
constructionFill() {
|
||||
return OperationEvent.RailCommand.equipmentConstructionFill;
|
||||
},
|
||||
constructionFillIn() {
|
||||
return OperationEvent.RailCommand.equipmentConstructionFill.menu;
|
||||
},
|
||||
tableHeight() {
|
||||
const allH = this.$store.state.app.height;
|
||||
let h = allH - 63 - 39 - 30 - 42;
|
||||
h = h > 0 ? h : 0;
|
||||
return h;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -111,12 +121,12 @@ export default {
|
||||
},
|
||||
methods:{
|
||||
add() {
|
||||
if (!this.isEditing) {
|
||||
const operate = {
|
||||
start: true,
|
||||
operation: this.constructionFill.constructionInput.operation
|
||||
};
|
||||
this.$store.dispatch('trainingNew/next', operate).then(resp => {
|
||||
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
|
||||
if (!this.isEditing) {
|
||||
|
||||
const data = {
|
||||
no: '', // 本月施工编号
|
||||
@ -134,14 +144,13 @@ export default {
|
||||
this.tableData.push(data);
|
||||
this.isEditing = true;
|
||||
this.isAdd = true;
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
queryData() {
|
||||
const params = { stationCode: this.$store.state.training.roleDeviceCode};
|
||||
commitOperate(menuOperate.Rail.equipmentConstructionQuery, params, 3).then(({valid, operate, response})=>{
|
||||
this.tableData = response.data;
|
||||
sendCommandNew(this.group, 'EQUIPMENT_CONSTRUCTION_INFO_QUERY', params).then((res) => {
|
||||
this.tableData = res.data;
|
||||
this.dataIndex = null;
|
||||
}).catch(() => {
|
||||
this.$message.error('查询行车设备施工登记簿失败!');
|
||||
@ -220,13 +229,22 @@ export default {
|
||||
saveData(data, index) {
|
||||
// if (this.isAdd) {
|
||||
const params = Object.assign({stationCode:this.$store.state.training.roleDeviceCode}, data);
|
||||
commitOperate(menuOperate.Rail.equipmentConstructionFill, params, 3).then(({valid, operate})=>{
|
||||
const operate = {
|
||||
operation: this.constructionFillIn.operation,
|
||||
param: params
|
||||
};
|
||||
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
sendCommandNew(this.group, 'EQUIPMENT_CONSTRUCTION_INFO_SAVE', params).then((res) => {
|
||||
this.$message.success('保存成功!');
|
||||
this.queryData();
|
||||
this.isEditing = false;
|
||||
this.isAdd = false;
|
||||
}).catch(() => {
|
||||
this.$message.error('保存行车设备施工登记簿失败!');
|
||||
});
|
||||
}
|
||||
});
|
||||
// }
|
||||
// }else{
|
||||
|
||||
|
@ -274,6 +274,7 @@ export default {
|
||||
if (valid) {
|
||||
sendCommandNew(this.group, 'CONTROL_FLOOD_SIGN_SAVE', obj).then((res) => {
|
||||
console.log(res, '---res');
|
||||
this.$message.success('提交成功!');
|
||||
this.initFormData();
|
||||
}).catch(error => {
|
||||
this.$messageBox('提交失败:' + error.message);
|
||||
@ -291,6 +292,7 @@ export default {
|
||||
if (valid) {
|
||||
sendCommandNew(this.group, 'CONTROL_FLOOD_SIGN_UPDATE', obj).then((res) => {
|
||||
console.log(res, '---res');
|
||||
this.$message.success('更新成功!');
|
||||
this.isEdit = false;
|
||||
}).catch(error => {
|
||||
this.$messageBox('更新失败:' + error.message);
|
||||
|
@ -45,7 +45,7 @@ export default {
|
||||
},
|
||||
boxHeight() {
|
||||
const allH = this.$store.state.app.height;
|
||||
let h = allH - 103 - 39 - 30 - 41 - 15;
|
||||
let h = allH - 63 - 39 - 30 - 41 - 15 - 20;
|
||||
h = h > 0 ? h : 0;
|
||||
return h;
|
||||
}
|
||||
|
@ -34,6 +34,8 @@
|
||||
<interlock-work v-if="picture=='interlockWork'" ref="interlockWork" :centralized-station-map="centralizedStationMap" />
|
||||
|
||||
<test-runplan v-if="picture=='testRunplan'" ref="testRunplan" :plan-id="loadPlanId" @pictureChange="pictureChangeAndPlan" />
|
||||
<driver-ats-work v-if="picture=='driverAtsWork'" ref="driverAtsWork" />
|
||||
<!-- driverAtsWork -->
|
||||
|
||||
<terminal-menu
|
||||
v-if="menuShow"
|
||||
@ -82,6 +84,7 @@ import DisplayBaSiDi from './displayBaSiDi/index';
|
||||
import TroWork from './troWork';
|
||||
import TroDetailWork from './troDetailWork';
|
||||
import TestRunplan from './testRunplan';
|
||||
import DriverAtsWork from './driverAtsWork';
|
||||
|
||||
export default {
|
||||
name: 'Index',
|
||||
@ -117,7 +120,8 @@ export default {
|
||||
DisplayBaSiDi,
|
||||
TroDetailWork,
|
||||
Jl3dMaintainerSelect,
|
||||
TestRunplan
|
||||
TestRunplan,
|
||||
DriverAtsWork
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -9,6 +9,7 @@
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%"
|
||||
:height="tableHeight"
|
||||
>
|
||||
<el-table-column prop="date" label="月 日" width="95">
|
||||
<template slot-scope="scope">
|
||||
@ -109,13 +110,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {menuOperate, commitOperate} from '@/jmapNew/theme/components/utils/menuOperate';
|
||||
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import FloodControlSafetyTable from './floodControlSafetyTable/index';
|
||||
import EquipmentConstructionTable from './equipmentConstructionTable';
|
||||
import AbnormalTrain from './abnormalTrain/index';
|
||||
import CMD from '@/scripts/cmdPlugin/CommandEnum';
|
||||
import { sendCommandNew } from '@/api/jmap/training';
|
||||
|
||||
// key-link-control-table
|
||||
export default {
|
||||
name: 'Index',
|
||||
@ -133,14 +133,24 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
},
|
||||
registerInput() {
|
||||
return OperationEvent.TicketOrRegister.registerInput;
|
||||
},
|
||||
railFillInRegister() {
|
||||
return OperationEvent.RailCommand.railFillInRegister.menu;
|
||||
},
|
||||
tableHeight() {
|
||||
const allH = this.$store.state.app.height;
|
||||
let h = allH - 63 - 39 - 30 - 42;
|
||||
h = h > 0 ? h : 0;
|
||||
return h;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
this.queryData();
|
||||
},
|
||||
methods: {
|
||||
@ -158,7 +168,8 @@ export default {
|
||||
this.queryData();
|
||||
},
|
||||
queryData() {
|
||||
sendCommandNew(this.$route.query.group, CMD.RAIL.CMD_RAIL_QUERY_REGISTER.value, { stationCode: this.$store.state.training.roleDeviceCode}).then(response => {
|
||||
const params = { stationCode: this.$store.state.training.roleDeviceCode};
|
||||
sendCommandNew(this.group, 'RAIL_QUERY_REGISTER', params).then((response) => {
|
||||
this.tableData = response.data ? response.data.lines : [];
|
||||
this.dataIndex = null;
|
||||
}).catch(() => {
|
||||
@ -167,11 +178,20 @@ export default {
|
||||
},
|
||||
saveData(data) {
|
||||
const params = { stationCode: this.$store.state.training.roleDeviceCode, line: data };
|
||||
commitOperate(menuOperate.Rail.railFillInRegister, params, 3).then(({valid, operate})=>{
|
||||
const operate = {
|
||||
operation: this.railFillInRegister.operation,
|
||||
param: params
|
||||
};
|
||||
this.$store.dispatch('trainingNew/next', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
sendCommandNew(this.group, 'RAIL_FILL_IN_REGISTER', params).then((res) => {
|
||||
this.$message.success('保存成功!');
|
||||
this.queryData();
|
||||
}).catch(() => {
|
||||
this.$message.error('保存簿册失败!');
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
add() {
|
||||
const operate = {
|
||||
|
@ -96,6 +96,13 @@ export default {
|
||||
isShow: () => this.$route.query.simType === 'METRO',
|
||||
click: this.changePictureShow
|
||||
},
|
||||
{
|
||||
name: '司机ATS工作站',
|
||||
code: 'driverAtsWork',
|
||||
roleList: ['DRIVER'],
|
||||
isShow: () => this.$route.query.simType === 'METRO',
|
||||
click: this.changePictureShow
|
||||
},
|
||||
{
|
||||
name: '运行图预览',
|
||||
code: 'diagramPreview',
|
||||
@ -297,7 +304,7 @@ export default {
|
||||
this.changePictureShow('maintainerSelect');
|
||||
} else if (this.roles === 'DRIVER') {
|
||||
// 司机模拟
|
||||
this.changePictureShow('drivingPlan');
|
||||
this.changePictureShow('driverAtsWork');
|
||||
}
|
||||
},
|
||||
changePictureShow(code) {
|
||||
|
@ -52,6 +52,7 @@
|
||||
<div style="width: 100px;margin-left: 40px;">更新时间:</div>
|
||||
<div>{{ bgSceneObj.systemTime || '' }}</div>
|
||||
</div>
|
||||
<div v-if="!isScene">
|
||||
<el-divider content-position="center">实训定位</el-divider>
|
||||
<el-button class="text-button-position" type="text" @click="updateMapLocation">定位</el-button>
|
||||
<div style="display: flex;font-size: 14px;text-align: left;">
|
||||
@ -66,6 +67,7 @@
|
||||
<div style="width: 100px;margin-left: 40px;">缩放:</div>
|
||||
<div>{{ mapLocationObj.scale || '' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-divider content-position="center">实训步骤</el-divider>
|
||||
<div class="text-button-position">
|
||||
<el-button type="text" @click="addStep">新增步骤</el-button>
|
||||
@ -157,6 +159,13 @@ export default {
|
||||
},
|
||||
trainingSwitch() {
|
||||
return this.$store.state.trainingNew.trainingSwitch;
|
||||
},
|
||||
isScene() {
|
||||
let s = false;
|
||||
if (this.editData && this.editData.type == 'SCENE') {
|
||||
s = true;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -170,7 +179,7 @@ export default {
|
||||
},
|
||||
editData() {
|
||||
this.mapLocationObj = {};
|
||||
if (this.editData['mapLocationJson']) {
|
||||
if (this.editData['mapLocationJson'] && !this.isScene) {
|
||||
this.mapLocationObj = JSON.parse(this.editData['mapLocationJson']);
|
||||
}
|
||||
this.bgSceneObj = {};
|
||||
|
@ -39,7 +39,7 @@ export default {
|
||||
this.scoringRuleList = this.$store.state.trainingNew.scoringRules.find(rule => rule.memberId == MyMemberId );
|
||||
console.log(this.scoringRuleList, this.$store.state.trainingNew.scoringRules);
|
||||
this.stepList = this.$store.state.trainingNew.stepList;
|
||||
this.scoringRuleList.details.forEach(item => {
|
||||
this.scoringRuleList && this.scoringRuleList.details.forEach(item => {
|
||||
const desc = this.handleStepInfo(item.elementId);
|
||||
const score = this.handleScore(item.elementId);
|
||||
this.tableData.push({ desc: desc, score: score, totalScore: item.score });
|
||||
|
@ -1,12 +1,19 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogShow" width="400px" :before-close="doClose">
|
||||
<el-form ref="form111" :model="studentModel" :rules="rules" label-width="120px" size="mini">
|
||||
<el-form-item label="学生姓名:" prop="name">
|
||||
<el-form-item v-if="title === '新建学生'" label="类型:">
|
||||
<el-radio v-model="isAccount" :label="true">学号</el-radio>
|
||||
<el-radio v-model="isAccount" :label="false">手机号</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isAccount" label="学生姓名:" prop="name">
|
||||
<el-input v-model="studentModel.name" style="width: 220px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学号:" prop="account">
|
||||
<el-form-item v-if="isAccount" label="学号:" prop="account">
|
||||
<el-input v-model="studentModel.account" style="width: 220px;" :disabled="title==='修改学生'" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!isAccount" label="手机号:" prop="mobile">
|
||||
<el-input v-model="studentModel.mobile" style="width: 220px;" :disabled="title==='修改学生'" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
|
||||
@ -23,11 +30,13 @@ export default {
|
||||
name: 'CreateClass',
|
||||
data() {
|
||||
return {
|
||||
isAccount: true,
|
||||
dialogShow: false,
|
||||
loading: false,
|
||||
studentModel: {
|
||||
name: '',
|
||||
account: ''
|
||||
account: '',
|
||||
mobile: ''
|
||||
},
|
||||
title: '新建学生'
|
||||
};
|
||||
@ -40,6 +49,9 @@ export default {
|
||||
],
|
||||
account: [
|
||||
{ required: true, message: '请输入学生学号', trigger: 'blur' }
|
||||
],
|
||||
mobile: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' }
|
||||
]
|
||||
};
|
||||
return baseRules;
|
||||
@ -52,6 +64,8 @@ export default {
|
||||
if (row) {
|
||||
this.studentModel.name = row.name;
|
||||
this.studentModel.account = row.account;
|
||||
this.studentModel.mobile = row.mobile || '';
|
||||
this.isAccount = true;
|
||||
this.title = '修改学生';
|
||||
} else {
|
||||
this.title = '新建学生';
|
||||
@ -62,10 +76,15 @@ export default {
|
||||
create() {
|
||||
this.$refs.form111.validate((valid) => {
|
||||
if (valid) {
|
||||
const model = {
|
||||
let model = {
|
||||
account: this.studentModel.account,
|
||||
name: this.studentModel.name
|
||||
};
|
||||
if (!this.isAccount) {
|
||||
model = {
|
||||
mobile: this.studentModel.mobile
|
||||
};
|
||||
}
|
||||
createStudent( this.$route.query.classId, model).then(response => {
|
||||
this.$emit('refresh');
|
||||
this.doClose();
|
||||
|
Loading…
Reference in New Issue
Block a user