From cd5e923c5257e2647ca63a66785a589e417ac1d4 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 26 Dec 2019 16:32:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=AE=9E=E8=AE=AD=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=EF=BC=8C=E7=94=A8=E6=88=B7=E4=BB=BF=E7=9C=9F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=20=E4=BA=A7=E5=93=81=E7=B1=BB=E5=9E=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/userSimulation/add.vue | 19 +- src/views/system/userSimulation/index.vue | 15 +- src/views/system/userTraining/edit.vue | 180 ++++++++-------- src/views/system/userTraining/index.vue | 248 +++++++++++----------- 4 files changed, 216 insertions(+), 246 deletions(-) diff --git a/src/views/system/userSimulation/add.vue b/src/views/system/userSimulation/add.vue index 4c89872a7..943ca8271 100644 --- a/src/views/system/userSimulation/add.vue +++ b/src/views/system/userSimulation/add.vue @@ -14,7 +14,6 @@ import ConstConfig from '@/scripts/ConstConfig'; import { postSimulationStats } from '@/api/simulation'; import { getDimUserList } from '@/api/management/user'; import { getPublishMapList } from '@/api/jmap/map'; -import { getCommodityMapProduct } from '@/api/management/mapprd'; export default { name: 'UsersTrainingAdd', @@ -35,7 +34,6 @@ export default { duration: '' }, LessonList: [], - mapPrdList: [], UserList: [], UserLoading: false }; @@ -51,7 +49,7 @@ export default { const form = { labelWidth: '120px', items: [ - { prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, change: true, onChange: this.mapChange, placeholder: this.$t('rules.mapInput') }, + { prop: 'mapId', label: this.$t('system.mapName'), type: 'select', required: true, options: this.LessonList, placeholder: this.$t('rules.mapInput') }, { prop: 'prdType', label: this.$t('system.productType'), type: 'select', required: true, options: this.prdTypeList, placeholder: this.$t('rules.productTypeInput') }, { prop: 'userName', label: this.$t('system.userName'), type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: this.$t('system.pleaseInputNames') }, { prop: 'duration', label: this.$t('system.trainingUseTime'), type: 'text', rightWidth: true, required: true, message: 's' } @@ -131,21 +129,6 @@ export default { prdSelect(item) { this.formModel.userId = item.id; }, - async mapChange(val) { - this.mapPrdList = []; - this.formModel.prdType = ''; - try { - const res = await getCommodityMapProduct(val); - const data = res.data; - if (data && data.length) { - data.forEach(elem => { - this.mapPrdList.push({ value: elem.id, label: elem.name }); - }); - } - } catch (error) { - console.error(error); - } - }, show(data) { this.dialogVisible = true; }, diff --git a/src/views/system/userSimulation/index.vue b/src/views/system/userSimulation/index.vue index a0368408e..a523ebaf1 100644 --- a/src/views/system/userSimulation/index.vue +++ b/src/views/system/userSimulation/index.vue @@ -8,7 +8,6 @@ diff --git a/src/views/system/userTraining/index.vue b/src/views/system/userTraining/index.vue index d0d5af0ee..727a9443b 100644 --- a/src/views/system/userTraining/index.vue +++ b/src/views/system/userTraining/index.vue @@ -11,134 +11,134 @@ import { getTrainingList, deleteUserTraining } from '@/api/jmap/training'; import UsersTrainingEdit from './edit'; import UsersTrainingAdd from './add'; export default { - name: 'UserTrainingEdit', - components: { - UsersTrainingEdit, - UsersTrainingAdd - }, - data() { - return { - examResultList: [], - pagerConfig: { - pageSize: 'pageSize', - pageIndex: 'pageNum' - }, - queryForm: { - labelWidth: '120px', - reset: true, - queryObject: { - trainingName: { - type: 'text', - label: this.$t('system.trainingName') - }, - userName: { - type: 'text', - label: this.$t('system.userName') - } - } + name: 'UserTrainingEdit', + components: { + UsersTrainingEdit, + UsersTrainingAdd + }, + data() { + return { + examResultList: [], + pagerConfig: { + pageSize: 'pageSize', + pageIndex: 'pageNum' + }, + queryForm: { + labelWidth: '120px', + reset: true, + queryObject: { + trainingName: { + type: 'text', + label: this.$t('system.trainingName') + }, + userName: { + type: 'text', + label: this.$t('system.userName') + } + } - }, - queryList: { - query: getTrainingList, - selectCheckShow: false, - indexShow: true, - columns: [ - { - title: this.$t('system.userName'), - prop: 'userName' - }, - { - title: this.$t('global.mobile'), - prop: 'userMobile' - }, - { - title: this.$t('system.lessonName'), - prop: 'lessonName' - }, - { - title: this.$t('system.trainingUseTime'), - prop: 'duration', - type: 'tag', - columnValue: (row) => { return this.computation(row.duration); }, - tagType: (row) => { return 'success'; } - }, - { - title: this.$t('system.trainingName'), - prop: 'trainingName' - }, - { - type: 'button', - title: this.$t('global.operate'), - width: '250', - buttons: [ - { - name: this.$t('global.edit'), - handleClick: this.edit, - showControl: (row) => { return row.fake != '0'; } - }, - { - name: this.$t('global.delete'), - handleClick: this.handleDelete, - type: 'danger', - showControl: (row) => { return row.fake != '0'; } - } - ] - } - ], - actions: [ - { text: this.$t('global.add'), handler: this.createTraining } - ] - }, - currentModel: {} - }; - }, - created() { - this.loadInitData(); - }, - methods: { - loadInitData() { + }, + queryList: { + query: getTrainingList, + selectCheckShow: false, + indexShow: true, + columns: [ + { + title: this.$t('system.userName'), + prop: 'userName' + }, + { + title: this.$t('global.mobile'), + prop: 'userMobile' + }, + { + title: this.$t('system.lessonName'), + prop: 'lessonName' + }, + { + title: this.$t('system.trainingUseTime'), + prop: 'duration', + type: 'tag', + columnValue: (row) => { return this.computation(row.duration); }, + tagType: (row) => { return 'success'; } + }, + { + title: this.$t('system.trainingName'), + prop: 'trainingName' + }, + { + type: 'button', + title: this.$t('global.operate'), + width: '250', + buttons: [ + { + name: this.$t('global.edit'), + handleClick: this.edit, + showControl: (row) => { return row.fake != '0'; } + }, + { + name: this.$t('global.delete'), + handleClick: this.handleDelete, + type: 'danger', + showControl: (row) => { return row.fake != '0'; } + } + ] + } + ], + actions: [ + { text: this.$t('global.add'), handler: this.createTraining } + ] + }, + currentModel: {} + }; + }, + created() { + this.loadInitData(); + }, + methods: { + loadInitData() { - }, - createTraining() { - this.$refs.add.show(); - }, - computation(fieldValue) { - if (fieldValue) { - const f = parseInt(fieldValue / 60); - const s = fieldValue % 60; - if (f > 0) { - return `${f} ${this.$t('system.minute')} ${s} ${this.$t('system.second')}`; - } else { - return `${s} ${this.$t('system.second')}`; - } - } - }, + }, + createTraining() { + this.$refs.add.show(); + }, + computation(fieldValue) { + if (fieldValue) { + const f = parseInt(fieldValue / 60); + const s = fieldValue % 60; + if (f > 0) { + return `${f} ${this.$t('system.minute')} ${s} ${this.$t('system.second')}`; + } else { + return `${s} ${this.$t('system.second')}`; + } + } + }, - // 编辑 - edit(index, row) { - this.$refs.edit.show(row); - }, + // 编辑 + edit(index, row) { + this.$refs.edit.show(row); + }, - // 删除 - handleDelete(index, row) { - this.$confirm(this.$t('system.wellDelExamResult'), this.$t('global.tips'), { - confirmButtonText: this.$t('global.confirm'), - cancelButtonText: this.$t('global.cancel'), - type: 'warning' - }).then(() => { - deleteUserTraining(row.id).then(response => { - this.$message.success(this.$t('system.deleteSuccess')); - this.reloadTable(); - }).catch(() => { - this.reloadTable(); - this.$messageBox(this.$t('error.deleteFailed')); - }); - }); - }, + // 删除 + handleDelete(index, row) { + this.$confirm(this.$t('system.wellDelExamResult'), this.$t('global.tips'), { + confirmButtonText: this.$t('global.confirm'), + cancelButtonText: this.$t('global.cancel'), + type: 'warning' + }).then(() => { + deleteUserTraining(row.id).then(response => { + this.$message.success(this.$t('system.deleteSuccess')); + this.reloadTable(); + }).catch(() => { + this.reloadTable(); + this.$messageBox(this.$t('error.deleteFailed')); + }); + }); + }, - reloadTable() { - this.queryList.reload(); - } - } + reloadTable() { + this.queryList.reload(); + } + } };