接口调整
This commit is contained in:
parent
2d8547182b
commit
de76904dfc
@ -90,9 +90,9 @@ export function deleteOperateStepData(id) {
|
||||
/**
|
||||
* 批量生成操作列表
|
||||
*/
|
||||
export function addTrainingRulesList(skinCode, data) {
|
||||
export function addTrainingRulesList(mapId, data) {
|
||||
return request({
|
||||
url: `/api/operate/${skinCode}/generate`,
|
||||
url: `/api/operate/${mapId}/generate`,
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
|
@ -54,6 +54,7 @@ export default {
|
||||
paperHasUseNotDel: 'The paper has been used and cannot be deleted',
|
||||
batchCreateFailed: 'Batch build operation definition failed',
|
||||
createOperateRuleFailed: 'Failed to create operation definition',
|
||||
updateOperateRuleFailed:'Failed to update operation definition',
|
||||
createOperateStepFailed: 'The create action step failed',
|
||||
updateOperateStepFailed: 'The update action step failed',
|
||||
packagePermissionFailed: 'Packaging authority failed',
|
||||
|
@ -54,6 +54,7 @@ export default {
|
||||
paperHasUseNotDel: '该试卷已被使用,不能删除',
|
||||
batchCreateFailed: '批量生成操作定义失败',
|
||||
createOperateRuleFailed: '创建操作定义失败',
|
||||
updateOperateRuleFailed:'更新操作定义失败',
|
||||
createOperateStepFailed: '创建操作步骤失败',
|
||||
updateOperateStepFailed: '更新操作步骤失败',
|
||||
packagePermissionFailed: '打包权限失败',
|
||||
|
@ -43,7 +43,7 @@ export default {
|
||||
wellClearOperate: '此操作将清空改皮肤下所有操作定义, 是否继续?',
|
||||
batchCreateSuccess: '批量生成操作定义成功',
|
||||
createOperateSuccess: '创建操作定义成功',
|
||||
updateOperateSuccess: '更新操作步骤成功',
|
||||
updateOperateSuccess: '更新操作定义成功',
|
||||
wellDelOperate: '此操作将删除此实训步骤, 是否继续?',
|
||||
operateCode: '操作码',
|
||||
stepReturn: '步骤返回值',
|
||||
|
@ -27,7 +27,7 @@ export default {
|
||||
loading: false,
|
||||
dialogVisible: false,
|
||||
formModel: {
|
||||
skinCode: this.$route.query.skinCode
|
||||
skinCode: this.$route.query.mapId
|
||||
},
|
||||
skinCodeList: [],
|
||||
isShow: false
|
||||
@ -117,8 +117,8 @@ export default {
|
||||
const self = this;
|
||||
this.loading = true;
|
||||
addTrainingRulesList(
|
||||
this.formModel.skinCode,
|
||||
OperationList[this.formModel.skinCode].list
|
||||
this.formModel.mapId,
|
||||
OperationList[this.formModel.mapId].list
|
||||
)
|
||||
.then(response => {
|
||||
self.loading = false;
|
||||
@ -135,7 +135,7 @@ export default {
|
||||
},
|
||||
handleClose() {
|
||||
this.formModel = {
|
||||
skinCode: this.$route.query.skinCode
|
||||
skinCode: this.$route.query.mapId
|
||||
};
|
||||
this.$refs.dataform.resetForm();
|
||||
this.isShow = false;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<script>
|
||||
import { postTrainingRulesData, putTrainingRulesData, getPlaceholderList } from '@/api/management/operation';
|
||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||
import { listPublishMap } from '@/api/jmap/map';
|
||||
|
||||
export default {
|
||||
name: 'TrainingEdit',
|
||||
@ -28,13 +28,13 @@ export default {
|
||||
trainingName: '',
|
||||
trainingType: '',
|
||||
operateType: '',
|
||||
skinCode: '',
|
||||
mapId: '',
|
||||
minDuration: '',
|
||||
maxDuration: '',
|
||||
trainingRemark: '',
|
||||
productTypes: []
|
||||
},
|
||||
skinCodeList: [],
|
||||
mapIdList: [],
|
||||
trainingTypeList: [],
|
||||
trainingOperateTypeMap: {},
|
||||
placeholderList: []
|
||||
@ -46,13 +46,13 @@ export default {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items: [
|
||||
{ prop: 'skinCode', label: this.$t('lesson.skinType'), type: 'select', required: true, options: this.skinCodeList, disabled: true },
|
||||
{ prop: 'mapId', label: this.$t('lesson.mapName'), type: 'select', required: true, options: this.mapIdList, disabled: true },
|
||||
{ prop: 'trainingType', label: this.$t('lesson.trainingType'), type: 'select', required: true, options: this.trainingTypeList, disabled: !isAdd, change: true, onChange: this.changeList },
|
||||
{ prop: 'operateType', label: this.$t('lesson.operationType'), type: 'select', required: true, options: this.trainingOperateTypeMap[this.formModel.trainingType], disabled: !isAdd },
|
||||
{ label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainName },
|
||||
{ prop: 'trainingName', label: this.$t('lesson.trainingName'), type: 'text', required: true, rightWidth: true, tooltip: true, info: this.$t('lesson.tipNamePlaceholderInfo') },
|
||||
{ prop: 'minDuration', label: this.$t('lesson.minDuration'), type: 'text', required: true },
|
||||
{ prop: 'maxDuration', label: this.$t('lesson.maxDuration'), type: 'text', required: true },
|
||||
{ prop: 'minDuration', label: this.$t('lesson.minDuration'), type: 'number', required: true, min:1},
|
||||
{ prop: 'maxDuration', label: this.$t('lesson.maxDuration'), type: 'number', required: true, min:1},
|
||||
{ label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainRemark },
|
||||
{ prop: 'trainingRemark', label: this.$t('lesson.trainingRemark'), type: 'textarea', required: true, tooltip: true, info: this.$t('lesson.tipExplainPlaceholderInfo') }
|
||||
]
|
||||
@ -70,8 +70,8 @@ export default {
|
||||
operateType: [
|
||||
{ required: true, message: this.$t('rules.inputOperationType'), trigger: 'change' }
|
||||
],
|
||||
skinCode: [
|
||||
{ required: true, message: this.$t('rules.inputSkinType'), trigger: 'change' }
|
||||
mapId: [
|
||||
{ required: true, message: this.$t('rules.selectMapName'), trigger: 'change' }
|
||||
],
|
||||
minDuration: [
|
||||
{ required: true, message: this.$t('rules.inputMinDuration'), trigger: 'blur' }
|
||||
@ -98,13 +98,13 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
// 获取皮肤列表
|
||||
this.skinCodeList = [];
|
||||
getSkinCodeList().then(response => {
|
||||
this.skinCodeList = response.data.map(item => {
|
||||
// 获取地图列表
|
||||
this.mapIdList = [];
|
||||
listPublishMap().then(response => {
|
||||
this.mapIdList = response.data.map(item => {
|
||||
const params = {};
|
||||
params.label = item.name;
|
||||
params.value = item.code;
|
||||
params.value = item.id;
|
||||
return params;
|
||||
});
|
||||
});
|
||||
@ -184,7 +184,7 @@ export default {
|
||||
this.dialogVisible = true;
|
||||
if (data && data.id) {
|
||||
// 获取操作占位列表
|
||||
const res = await getPlaceholderList({ trainingType: data.trainingType, skinCode: data.skinCode });
|
||||
const res = await getPlaceholderList({ trainingType: data.trainingType });
|
||||
this.placeholderList = res.data;
|
||||
this.formModel = {
|
||||
id: data.id,
|
||||
@ -192,14 +192,14 @@ export default {
|
||||
trainingType: data.trainingType,
|
||||
operateType: data.operateType,
|
||||
productTypes: data.productTypes,
|
||||
skinCode: data.skinCode,
|
||||
mapId: data.mapId,
|
||||
minDuration: data.minDuration,
|
||||
maxDuration: data.maxDuration,
|
||||
trainingRemark: this.repliceName(data.trainingRemark, this.placeholderList)
|
||||
};
|
||||
} else {
|
||||
this.formModel = {
|
||||
skinCode: this.$route.query.skinCode
|
||||
mapId: this.$route.query.mapId
|
||||
};
|
||||
}
|
||||
},
|
||||
@ -215,7 +215,7 @@ export default {
|
||||
},
|
||||
changeList(val) {
|
||||
// 获取操作占位列表
|
||||
getPlaceholderList({ trainingType: val, skinCode: '02' }).then(res => {
|
||||
getPlaceholderList({ trainingType: val}).then(res => {
|
||||
this.placeholderList = res.data;
|
||||
});
|
||||
},
|
||||
@ -275,12 +275,12 @@ export default {
|
||||
this.loading = true;
|
||||
putTrainingRulesData(this.formModel).then(response => {
|
||||
self.loading = false;
|
||||
self.$message.success(this.$t('lesson.createOperateSuccess'));
|
||||
self.$message.success(this.$t('lesson.updateOperateSuccess'));
|
||||
self.handleClose();
|
||||
self.$emit('reloadTable');
|
||||
}).catch(error => {
|
||||
self.loading = false;
|
||||
self.$message.error(`${this.$t('error.createOperateRuleFailed')}:${error.message}`);
|
||||
self.$message.error(`${this.$t('error.updateOperateRuleFailed')}:${error.message}`);
|
||||
});
|
||||
},
|
||||
handleClose() {
|
||||
@ -288,7 +288,7 @@ export default {
|
||||
trainingName: '',
|
||||
trainingType: '',
|
||||
operateType: '',
|
||||
skinCode: '',
|
||||
mapId: '',
|
||||
minDuration: '',
|
||||
maxDuration: '',
|
||||
trainingRemark: ''
|
||||
|
@ -83,7 +83,7 @@ export default {
|
||||
methods: {
|
||||
async show(data) {
|
||||
this.dialogVisible = true;
|
||||
const res = await getPlaceholderList({ trainingType: this.$route.query.type, skinCode: this.$route.query.skinCode });
|
||||
const res = await getPlaceholderList({ trainingType: this.$route.query.type });
|
||||
this.placeholderList = res.data;
|
||||
if (data && data.operateCode) {
|
||||
// 获取操作占位列表
|
||||
|
@ -112,7 +112,7 @@ export default {
|
||||
|
||||
methods: {
|
||||
async init() {
|
||||
const res = await getPlaceholderList({ trainingType: this.$route.query.type, skinCode: this.$route.query.skinCode });
|
||||
const res = await getPlaceholderList({ trainingType: this.$route.query.type });
|
||||
this.placeholderList = res.data;
|
||||
},
|
||||
repliceName(fieldValue, enumList) {
|
||||
|
@ -19,7 +19,6 @@ import {
|
||||
deleteTrainingRulesData,
|
||||
getPlaceholderList
|
||||
} from '@/api/management/operation';
|
||||
import { listPublishMap } from '@/api/jmap/map';
|
||||
import TrainingEdit from './addEdit';
|
||||
import AddBatch from './addBatch';
|
||||
import SaveAs from './saveAs.vue';
|
||||
@ -37,7 +36,6 @@ export default {
|
||||
placeholderMap: {},
|
||||
trainingOperateTypeMap: {},
|
||||
trainingTypeList: [],
|
||||
mapIdList: [],
|
||||
totals: '',
|
||||
pagerConfig: {
|
||||
pageSize: 'pageSize',
|
||||
@ -76,20 +74,6 @@ export default {
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('lesson.mapName'),
|
||||
prop: 'mapId',
|
||||
type: 'tag',
|
||||
columnValue: row => {
|
||||
return this.$convertField(row.id, this.mapIdList, [
|
||||
'id',
|
||||
'name'
|
||||
]);
|
||||
},
|
||||
tagType: row => {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('lesson.trainingType'),
|
||||
prop: 'trainingType',
|
||||
@ -163,7 +147,7 @@ export default {
|
||||
],
|
||||
actions: [
|
||||
{ text: this.$t('global.add'), handler: this.handleAdd },
|
||||
{ text: this.$t('lesson.generation'), handler: this.handleBatchAdd },
|
||||
// { text: this.$t('lesson.generation'), handler: this.handleBatchAdd},
|
||||
{ text: this.$t('lesson.saveAs'), handler: this.handleSaveAs }
|
||||
]
|
||||
},
|
||||
@ -201,7 +185,7 @@ export default {
|
||||
this.trainingOperateTypeMap['08'] = list; // 限速实训
|
||||
});
|
||||
this.placeholderMap = {};
|
||||
getPlaceholderList({ skinCode: '', trainingType: '' }).then(res => {
|
||||
getPlaceholderList({ trainingType: '' }).then(res => {
|
||||
res.data.forEach(item => {
|
||||
if (!this.placeholderMap[item.trainingType]) {
|
||||
this.placeholderMap[item.trainingType] = [];
|
||||
@ -210,12 +194,6 @@ export default {
|
||||
});
|
||||
});
|
||||
|
||||
// 获取地图列表
|
||||
this.mapIdList = [];
|
||||
listPublishMap().then(response => {
|
||||
this.mapIdList = response.data;
|
||||
});
|
||||
|
||||
// 获取实训类型
|
||||
this.trainingTypeList = [];
|
||||
this.$Dictionary.trainingType().then(list => {
|
||||
|
@ -5,12 +5,12 @@
|
||||
<el-input v-model="operateModel.name" style="width: 300px" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('lesson.mapName') + ':'" prop="mapId">
|
||||
<el-select v-model="operateModel.skinCode" style="width: 300px" :disabled="this.disable" @change="skinCodeChoose">
|
||||
<el-select v-model="operateModel.mapId" style="width: 300px" :disabled="this.disable" @change="mapIdChoose">
|
||||
<el-option
|
||||
v-for="option in mapIdList"
|
||||
:key="option.code"
|
||||
:label="option.name"
|
||||
:value="option.code"
|
||||
:value="option.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -146,7 +146,7 @@ export default {
|
||||
operateModel: {
|
||||
name: '',
|
||||
type: '',
|
||||
skinCode: this.$route.params.skinCode,
|
||||
mapId: this.$route.query.mapId,
|
||||
prdCode: '',
|
||||
operateType: [],
|
||||
maxDuration: 0,
|
||||
@ -164,7 +164,7 @@ export default {
|
||||
name: [
|
||||
{ required: true, validator: checkName, trigger: 'blur'}
|
||||
],
|
||||
skinCode: [
|
||||
mapId: [
|
||||
{ required: true, message: this.$t('rules.pleaseEnterMapName'), trigger: 'change' }
|
||||
],
|
||||
prdCode: [
|
||||
@ -225,10 +225,9 @@ export default {
|
||||
this.trainingTypeMap = {};
|
||||
this.operateModel.operateType = [];
|
||||
|
||||
debugger;
|
||||
const skinCodeObj = this.mapIdList.find(elem => { return elem.code === this.operateModel.skinCode; }) || {};
|
||||
const mapIdObj = this.mapIdList.find(elem => { return elem.id === this.operateModel.mapId; }) || {};
|
||||
const prdTypeObj = this.productList.find(elem => { return elem.code === prdCode; }) || {};
|
||||
const res = await getOperateTrainingList({ skinCode: skinCodeObj.mapId, productType: prdTypeObj.prdType });
|
||||
const res = await getOperateTrainingList({ mapId: mapIdObj.id, productType: prdTypeObj.prdType });
|
||||
if (res && res.code == 200) {
|
||||
this.trainingTypeLists = res.data;
|
||||
this.trainingTypeList.forEach(elem => {
|
||||
@ -279,7 +278,7 @@ export default {
|
||||
if (this.operation.event == '01') { // add
|
||||
// 创建实训
|
||||
const data = {
|
||||
skinCode: this.operateModel.skinCode,
|
||||
mapId: this.operateModel.mapId,
|
||||
name: this.operateModel.name,
|
||||
prdCode: this.operateModel.prdCode,
|
||||
trainingType: this.operateModel.type,
|
||||
@ -288,6 +287,7 @@ export default {
|
||||
|
||||
addAutoTraining(data).then(response => {
|
||||
this.$message.success(this.$t('tip.automaticGenerationTrainingSuccess'));
|
||||
debugger;
|
||||
this.$emit('refresh');
|
||||
this.close();
|
||||
}).catch(() => {
|
||||
@ -297,7 +297,7 @@ export default {
|
||||
} else if (this.operation.event == '02') { // edit
|
||||
// 更新实训
|
||||
const data = {
|
||||
skinCode: this.operateModel.skinCode,
|
||||
mapId: this.operateModel.mapId,
|
||||
name: this.operateModel.name,
|
||||
prdCode: this.operateModel.prdCode,
|
||||
trainingType: this.operateModel.type,
|
||||
@ -318,7 +318,7 @@ export default {
|
||||
} else if (this.operation.event == '03') { // delete
|
||||
// 删除实训
|
||||
const data = {
|
||||
skinCode: this.operateModel.skinCode,
|
||||
mapId: this.operateModel.mapId,
|
||||
name: this.operateModel.name,
|
||||
prdCode: this.operateModel.prdCode,
|
||||
trainingType: `${this.operateModel.type}`,
|
||||
@ -338,7 +338,7 @@ export default {
|
||||
name: this.operateModel.name,
|
||||
type: this.operateModel.type,
|
||||
prdCode: this.operateModel.prdCode,
|
||||
skinCode: this.operateModel.skinCode,
|
||||
mapId: this.operateModel.mapId,
|
||||
operateType: this.operateModel.operateType[0],
|
||||
minDuration: this.operateModel.minDuration,
|
||||
maxDuration: this.operateModel.maxDuration,
|
||||
|
@ -89,13 +89,6 @@ export default {
|
||||
title: this.$t('lesson.trainingName'),
|
||||
prop: 'name'
|
||||
},
|
||||
{
|
||||
title: this.$t('lesson.skinType'),
|
||||
prop: 'skinCode',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']); },
|
||||
tagType: (row) => { return ''; }
|
||||
},
|
||||
{
|
||||
title: this.$t('lesson.product'),
|
||||
prop: 'prdCode',
|
||||
|
Loading…
Reference in New Issue
Block a user