打开实训录制按钮
This commit is contained in:
parent
911b8a9057
commit
b23bff36f0
@ -27,10 +27,10 @@ export default {
|
||||
wellDelTrainingRule: '此操作将删除此实训规则, 是否继续?',
|
||||
stepDetail: '步骤明细',
|
||||
generation: '自动生成',
|
||||
saveAs: '另存为',
|
||||
skinTypeFrom: '从',
|
||||
skinTypeTo: '到',
|
||||
copyLesson: '复制课程定义',
|
||||
saveAs: '另存为',
|
||||
skinTypeFrom: '从',
|
||||
skinTypeTo: '到',
|
||||
copyLesson: '复制课程定义',
|
||||
skinType: '皮肤类型',
|
||||
minDuration: '最佳用时',
|
||||
maxDuration: '最大用时',
|
||||
@ -101,21 +101,21 @@ export default {
|
||||
train: '列车',
|
||||
station: '车站',
|
||||
trainWindow: '车次窗',
|
||||
countSkinCode: '复制皮肤与被复制皮肤类型不能一样',
|
||||
trainingRecord: '实训录制',
|
||||
lesson: '课程',
|
||||
taskManage: '任务管理',
|
||||
trainingRule: '操作定义',
|
||||
trainingManage: '实训管理',
|
||||
newConstruction: '新建',
|
||||
applicationForRelease: '申请发布',
|
||||
rejectReason: '驳回原因',
|
||||
withdraw: '撤销',
|
||||
notRelease: '未发布',
|
||||
pendingReview: '待审核',
|
||||
published: '已发布',
|
||||
rejected: '已驳回',
|
||||
review: '查看'
|
||||
countSkinCode: '复制皮肤与被复制皮肤类型不能一样',
|
||||
trainingRecord: '实训录制',
|
||||
lesson: '课程',
|
||||
taskManage: '任务管理',
|
||||
trainingRule: '操作定义',
|
||||
trainingManage: '实训管理',
|
||||
newConstruction: '新建',
|
||||
applicationForRelease: '申请发布',
|
||||
rejectReason: '驳回原因',
|
||||
withdraw: '撤销',
|
||||
notRelease: '未发布',
|
||||
pendingReview: '待审核',
|
||||
published: '已发布',
|
||||
rejected: '已驳回',
|
||||
review: '查看'
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,308 +0,0 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="operation.title" :visible.sync="dialogShow" width="30%" :before-close="close">
|
||||
<el-form ref="form" :model="operateModel" label-width="120px" :rules="rules" size="mini">
|
||||
<el-form-item :label="this.$t('lesson.trainingName')+':'" prop="name">
|
||||
<el-input v-model="operateModel.name" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('lesson.productType')" prop="prdCode">
|
||||
<el-select v-model="operateModel.prdCode" placeholder="" :disabled="true">
|
||||
<el-option
|
||||
v-for="option in productTypesList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('lesson.trainingType')+':'" prop="type">
|
||||
<el-select v-model="operateModel.type" placeholder="" :disabled="true">
|
||||
<el-option
|
||||
v-for="option in trainTypesList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('lesson.operationType')+':'">
|
||||
<el-select v-model="operateModel.operateType">
|
||||
<el-option
|
||||
v-for="(option, index) in operationList"
|
||||
:key="index"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('lesson.minTime')" prop="minDuration">
|
||||
<el-input-number v-model="operateModel.minDuration" :min="0" :max="10000" />s
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('lesson.maxTime')" prop="maxDuration">
|
||||
<el-input-number v-model="operateModel.maxDuration" :min="0" :max="10000" />s
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('lesson.trainingDescription')" prop="remarks">
|
||||
<el-input
|
||||
v-model="operateModel.remarks"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 4, maxRows: 4}"
|
||||
:placeholder="this.$t('rules.pleaseEnterContent')"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleClose">{{$t('global.cancel')}}</el-button>
|
||||
<el-button type="primary" @click="handleDeal">{{$t('global.confirm')}}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { addTraining, updateTraining, getTrainingDetail } from '@/api/jmap/training';
|
||||
import localStore from 'storejs';
|
||||
|
||||
export default {
|
||||
name: 'TreeDraft',
|
||||
props: {
|
||||
node: {
|
||||
type: Object,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
var minDurations = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('rules.enterStandardTime')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number.isInteger(value)) {
|
||||
callback(new Error(this.$t('rules.enterNumericValue')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
var maxDurations = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error(this.$t('rules.enterStandardTime')));
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!Number.isInteger(value)) {
|
||||
callback(new Error(this.$t('rules.enterNumericValue')));
|
||||
} else {
|
||||
if (value < this.operateModel.minDuration) {
|
||||
callback(new Error(this.$t('rules.greaterThanMinTime')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
return {
|
||||
dialogShow: false,
|
||||
productTypesList: [],
|
||||
trainTypesList: [],
|
||||
operationList: [],
|
||||
trainingOperateTypeMap: {},
|
||||
operation: {
|
||||
title: '',
|
||||
event: ''
|
||||
},
|
||||
operateModel: {
|
||||
id: '',
|
||||
name: '',
|
||||
type: '',
|
||||
prdCode: '',
|
||||
skinCode: '',
|
||||
operateType: '',
|
||||
maxDuration: 0,
|
||||
minDuration: 0,
|
||||
remarks: ''
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: this.$t('rules.inputTrainingName'), trigger: 'change' }
|
||||
],
|
||||
minDuration: [
|
||||
{ required: true, validator: minDurations, trigger: 'blur' }
|
||||
],
|
||||
maxDuration: [
|
||||
{ required: true, validator: maxDurations, trigger: 'blur' }
|
||||
],
|
||||
remarks: [
|
||||
{ required: true, message: this.$t('rules.inputTrainingRemark'), trigger: 'change' }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
watch: {
|
||||
node: function (val, old) {
|
||||
this.initLoadData();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$Dictionary.trainingType().then(list => {
|
||||
this.trainTypesList = list;
|
||||
});
|
||||
this.operationList = [];
|
||||
this.$Dictionary.stationControl().then(list => {
|
||||
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||
});
|
||||
this.$Dictionary.signalOperation().then(list => {
|
||||
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||
});
|
||||
this.$Dictionary.switchOperation().then(list => {
|
||||
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||
});
|
||||
this.$Dictionary.sectionOperation().then(list => {
|
||||
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||
});
|
||||
this.$Dictionary.stationStandOperation().then(list => {
|
||||
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||
});
|
||||
this.$Dictionary.trainPlanOperation().then(list => {
|
||||
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||
});
|
||||
this.$Dictionary.trainOperation().then(list => {
|
||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
initLoadData() {
|
||||
const node = this.node;
|
||||
if (this.$refs && this.$refs.form) {
|
||||
this.$refs['form'].resetFields();
|
||||
}
|
||||
// if (node && node.data) {
|
||||
// switch (node.data.type) {
|
||||
// case 'trainingType':
|
||||
// if (node.parent) {
|
||||
// this.operateModel.type = node.data.id;
|
||||
// this.operateModel.prdCode = node.parent.data.id;
|
||||
// this.operateModel.skinCode = node.parent.parent.data.id;
|
||||
// this.productTypesList = [{
|
||||
// code: node.parent.data.id,
|
||||
// name: node.parent.data.name
|
||||
// }];
|
||||
//
|
||||
// }
|
||||
//
|
||||
// this.operateModel.id = '';
|
||||
// this.operateModel.name = '';
|
||||
// this.operateModel.minDuration = '';
|
||||
// this.operateModel.maxDuration = '';
|
||||
// this.operateModel.remarks = '';
|
||||
// this.operateModel.operateType = '';
|
||||
// this.operationList = this.trainingOperateTypeMap[node.data.id] || [];
|
||||
// break;
|
||||
// case 'training':
|
||||
// if (node.parent && node.parent.parent) {
|
||||
// this.operateModel.type = node.parent.data.id;
|
||||
// this.operateModel.prdCode = node.parent.parent.data.id;
|
||||
// this.operateModel.skinCode = node.parent.parent.parent.data.id;
|
||||
// this.operationList = this.trainingOperateTypeMap[node.parent.data.id] || [];
|
||||
// this.productTypesList = [{
|
||||
// code: node.parent.parent.data.id,
|
||||
// name: node.parent.parent.data.name
|
||||
// }];
|
||||
// }
|
||||
//
|
||||
// this.operateModel.id = node.data.id;
|
||||
// this.operateModel.name = node.data.name;
|
||||
// getTrainingDetail(node.data.id).then(response => {
|
||||
// this.operateModel.minDuration = response.data.minDuration;
|
||||
// this.operateModel.maxDuration = response.data.maxDuration;
|
||||
// this.operateModel.operateType = response.data.operateType;
|
||||
// this.operateModel.remarks = response.data.remarks;
|
||||
// }).catch(() => {
|
||||
// this.$messageBox(this.$t('error.obtainStepDataFailed'));
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
},
|
||||
show(data) {
|
||||
this.operation = data;
|
||||
this.initLoadData();
|
||||
this.dialogShow = true;
|
||||
},
|
||||
close() {
|
||||
this.dialogShow = false;
|
||||
},
|
||||
handleDeal() {
|
||||
const operation = this.operation;
|
||||
if (operation) {
|
||||
const event = operation.event;
|
||||
switch (event) {
|
||||
case '01': this.addTraining(); break;
|
||||
case '02': this.edtTraining(); break;
|
||||
}
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.dialogShow = false;
|
||||
this.operateModel = {
|
||||
id: '',
|
||||
name: '',
|
||||
type: '',
|
||||
prdCode: '',
|
||||
skinCode: '',
|
||||
operateType: '',
|
||||
maxDuration: 0,
|
||||
minDuration: 0,
|
||||
remarks: ''
|
||||
};
|
||||
this.$refs['form'].resetFields();
|
||||
},
|
||||
addTraining() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
name: this.operateModel.name,
|
||||
type: this.operateModel.type,
|
||||
prdCode: this.operateModel.prdCode,
|
||||
skinCode: this.operateModel.skinCode,
|
||||
operateType: this.operateModel.operateType,
|
||||
minDuration: this.operateModel.minDuration,
|
||||
maxDuration: this.operateModel.maxDuration,
|
||||
remarks: this.operateModel.remarks
|
||||
};
|
||||
addTraining(data).then(response => {
|
||||
this.$emit('refresh', [localStore.get('cityCode') || '', localStore.get('skinCode') || '']);
|
||||
this.close();
|
||||
this.$message.success(this.$t('tip.addTrainingSuccessfully'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.addTrainingFailed'));
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
edtTraining() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
id: this.operateModel.id,
|
||||
name: this.operateModel.name,
|
||||
type: this.operateModel.type,
|
||||
prdCode: this.operateModel.prdCode,
|
||||
skinCode: this.operateModel.skinCode,
|
||||
operateType: this.operateModel.operateType,
|
||||
minDuration: this.operateModel.minDuration,
|
||||
maxDuration: this.operateModel.maxDuration,
|
||||
remarks: this.operateModel.remarks
|
||||
};
|
||||
updateTraining(data).then(response => {
|
||||
this.$emit('refresh', [localStore.get('cityCode') || '', localStore.get('skinCode') || '']);
|
||||
this.close();
|
||||
this.$message.success(this.$t('tip.updateTrainingSuccessfully'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('tip.updateTrainingFailed'));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
@ -138,11 +138,11 @@ export default {
|
||||
name: this.$t('lesson.demonstration'),
|
||||
handleClick: this.demoDisplay,
|
||||
type: ''
|
||||
// },
|
||||
// {
|
||||
// name: '实训录制',
|
||||
// handleClick: this.trainingRecord,
|
||||
// type: ''
|
||||
},
|
||||
{
|
||||
name: '实训录制',
|
||||
handleClick: this.trainingRecord,
|
||||
type: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user