接口调整

This commit is contained in:
joylink_cuiweidong 2019-10-30 19:36:29 +08:00
parent 2d8547182b
commit de76904dfc
11 changed files with 250 additions and 277 deletions

View File

@ -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
});

View File

@ -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',

View File

@ -54,6 +54,7 @@ export default {
paperHasUseNotDel: '该试卷已被使用,不能删除',
batchCreateFailed: '批量生成操作定义失败',
createOperateRuleFailed: '创建操作定义失败',
updateOperateRuleFailed:'更新操作定义失败',
createOperateStepFailed: '创建操作步骤失败',
updateOperateStepFailed: '更新操作步骤失败',
packagePermissionFailed: '打包权限失败',

View File

@ -43,7 +43,7 @@ export default {
wellClearOperate: '此操作将清空改皮肤下所有操作定义, 是否继续?',
batchCreateSuccess: '批量生成操作定义成功',
createOperateSuccess: '创建操作定义成功',
updateOperateSuccess: '更新操作步骤成功',
updateOperateSuccess: '更新操作定义成功',
wellDelOperate: '此操作将删除此实训步骤, 是否继续?',
operateCode: '操作码',
stepReturn: '步骤返回值',

View File

@ -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;

View File

@ -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: ''

View File

@ -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) {
//

View File

@ -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) {

View File

@ -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 => {

View File

@ -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,

View File

@ -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',