diff --git a/src/views/system/commandDictionary/copyParam.vue b/src/views/system/commandDictionary/copyParam.vue index 5b873a6f2..d6ab4c118 100644 --- a/src/views/system/commandDictionary/copyParam.vue +++ b/src/views/system/commandDictionary/copyParam.vue @@ -43,7 +43,6 @@ export default { const form = { labelWidth: '100px', items: [ - // type: 'text', disabled: true { prop: 'fromCode', label: '源线路', type: 'select', options: this.originList, change:true, onChange:this.originChange}, { prop: 'targetIds', label:'拷贝线路', type: 'select', options: this.targetList, multiple: true, deviceChange: this.targetChange }, { prop: 'deviceType', label: '操作对象', type: 'select', options: this.deviceTypeList, multiple: true } diff --git a/src/views/system/configLine/config.vue b/src/views/system/configLine/config.vue index cabcd67ce..1c4f1d42a 100644 --- a/src/views/system/configLine/config.vue +++ b/src/views/system/configLine/config.vue @@ -59,9 +59,6 @@ import { getRealLineConfigList, putRealLineConfig } from '@/api/management/mapline'; export default { name: 'Config', - components: { - // EditConfig - }, props: { type: { type: String, @@ -146,21 +143,21 @@ export default { let rangeStart = 0; let rangeEnd = 0; let options = []; - if (this.booleanList.indexOf(key) >= 0) { + if (this.booleanList.includes(key)) { type = 'boolean'; - } else if (this.selectList.indexOf(key) >= 0) { + } else if (this.selectList.includes(key)) { type = 'select'; options = this.optionsMap[key]; - } else if (this.numberList.indexOf(key) >= 0) { + } else if (this.numberList.includes(key)) { type = 'number'; - } else if (this.rangeList.indexOf(key) >= 0) { + } else if (this.rangeList.includes(key)) { type = 'range'; if (res.data[key]) { const ranges = res.data[key].split('-'); rangeStart = ranges[0]; rangeEnd = ranges[1]; } - } else if (this.speedList.indexOf(key) >= 0) { + } else if (this.speedList.includes(key)) { type = 'speed'; } else { type = 'input'; @@ -195,13 +192,6 @@ export default { this.dialogVisible = false; } }, - addModel() { - this.$refs.addConfig.show(); - }, - editModel(item, index) { - this.$refs.editConfig.show(item); - this.index = index; - }, save() { const param = {}; this.generalData.forEach(item => { diff --git a/src/views/system/configLine/edit.vue b/src/views/system/configLine/edit.vue index 39bc23891..9b13195b2 100644 --- a/src/views/system/configLine/edit.vue +++ b/src/views/system/configLine/edit.vue @@ -12,12 +12,6 @@ import { addSkinCode, updateSkinCode } from '@/api/management/mapline'; export default { name: 'DictionaryEdit', - props: { - type: { - type: String, - required: true - } - }, data() { return { dialogVisible: false, @@ -27,20 +21,21 @@ export default { name: '', origin: { x: 0, y: 0 }, scaling: 1 - } + }, + isAdd:false, + title:'' }; }, computed: { form() { - const isAdd = this.type === 'ADD'; const form = { labelWidth: '100px', items: [ - { prop: 'code', label: this.$t('system.code'), type: 'text', disabled: !isAdd }, + { prop: 'code', label: this.$t('system.code'), type: 'text', disabled: !this.isAdd }, { prop: 'name', label: this.$t('system.name'), type: 'text' }, { prop: 'origin', label: '坐标:', type: 'coordinate', children: [ - { prop: 'origin.x', firstLevel: 'origin', secondLevel: 'x', label: 'x', type: 'number', labelWidth: '20px'}, - { prop: 'origin.y', firstLevel: 'origin', secondLevel: 'y', label: 'y', type: 'number', labelWidth: '20px'} + { prop: 'origin.x', firstLevel: 'origin', secondLevel: 'x', label: 'x', type: 'number', labelWidth: '30px'}, + { prop: 'origin.y', firstLevel: 'origin', secondLevel: 'y', label: 'y', type: 'number', labelWidth: '30px'} ] }, { prop: 'scaling', label: '缩放比例:', type: 'number', min: 0.4, max: 8, step: 0.2 } ] @@ -49,6 +44,9 @@ export default { }, rules() { const crules = { + code: [ + { required: true, message: this.$t('rules.pleaseInputCode'), trigger: 'blur' } + ], name: [ { required: true, message: this.$t('rules.pleaseInputName'), trigger: 'blur' } ], @@ -65,27 +63,11 @@ export default { { required: true, message: '请输入缩放比例', trigger: 'blur' } ] }; - if (this.type === 'ADD') { - return Object.assign(crules, { - code: [ - { required: true, message: this.$t('rules.pleaseInputCode'), trigger: 'blur' } - ] - }); - } else { - return crules; - } - }, - title() { - if (this.type === 'ADD') { - return this.$t('system.createDirectory'); - } else { - return this.$t('system.editDictionary'); - } + return crules; } }, methods: { show(row) { - this.dialogVisible = true; if (row && row.id) { this.formModel = { id: row.id, @@ -94,12 +76,18 @@ export default { origin: row.origin, scaling: row.scaling }; + this.isAdd = false; + this.title = this.$t('system.editDictionary'); + } else { + this.isAdd = true; + this.title = this.$t('system.createDirectory'); } + this.dialogVisible = true; }, doSave() { const self = this; this.$refs.dataform.validateForm(() => { - if (self.type === 'ADD') { + if (this.isAdd === 'ADD') { self.create(); } else { self.update(); diff --git a/src/views/system/configLine/editConfig.vue b/src/views/system/configLine/editConfig.vue deleted file mode 100644 index 755a2ba95..000000000 --- a/src/views/system/configLine/editConfig.vue +++ /dev/null @@ -1,119 +0,0 @@ - - - - diff --git a/src/views/system/configLine/index.vue b/src/views/system/configLine/index.vue index 8d862a96f..8d84c632c 100644 --- a/src/views/system/configLine/index.vue +++ b/src/views/system/configLine/index.vue @@ -1,8 +1,7 @@ @@ -106,7 +105,8 @@ export default { }, // 新增指令 handleAdd() { - this.$refs.create.show(); + this.$refs.edit.show(); + // this.$refs.create.show(); }, handleDelete(index, row) { this.$confirm(this.$t('system.wellDelType'), this.$t('global.tips'), {