From cf69d448332932a66b75298e46033546e7cb1804 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 4 Nov 2019 14:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86=E7=94=A8=E6=88=B7=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/orderauthor/author/index.vue | 2 +- src/views/orderauthor/rules/detail.vue | 19 +- src/views/orderauthor/rules/index.vue | 2 +- src/views/planMonitor/detail.vue | 5 +- src/views/system/systemGenerate/index.vue | 359 +++++++++--------- src/views/system/userTraining/add.vue | 309 +++++++-------- src/views/system/userTraining/addTraining.vue | 121 +++--- 7 files changed, 401 insertions(+), 416 deletions(-) diff --git a/src/views/orderauthor/author/index.vue b/src/views/orderauthor/author/index.vue index 9d518eaeb..5ff15b558 100644 --- a/src/views/orderauthor/author/index.vue +++ b/src/views/orderauthor/author/index.vue @@ -3,7 +3,7 @@ - + diff --git a/src/views/orderauthor/rules/detail.vue b/src/views/orderauthor/rules/detail.vue index d15b22c86..c449a1958 100644 --- a/src/views/orderauthor/rules/detail.vue +++ b/src/views/orderauthor/rules/detail.vue @@ -16,11 +16,16 @@ export default { name: 'Author', components: { }, + props:{ + permissionTypeList:{ + required:true, + type:Array + } + }, data() { return { dialogShow: false, id: '', - PermissionTypeList: [], pagerConfig: { pageSize: 'pageSize', pageIndex: 'pageNum' @@ -45,7 +50,7 @@ export default { title: this.$t('orderAuthor.permissionType'), prop: 'type', type: 'tag', - columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); }, + columnValue: (row) => { return this.$convertField(row.type, this.permissionTypeList, ['value', 'label']); }, tagType: (row) => { return ''; } } ], @@ -54,17 +59,7 @@ export default { } }; }, - mounted() { - this.loadInitData(); - }, methods: { - loadInitData() { - this.$Dictionary.permissionType().then(list => { - this.$convertList(list, this.PermissionTypeList, elem => { - return true; - }); - }); - }, doShow(id) { this.id = id; this.dialogShow = true; diff --git a/src/views/orderauthor/rules/index.vue b/src/views/orderauthor/rules/index.vue index 3b84d5e2b..f01d1ab53 100644 --- a/src/views/orderauthor/rules/index.vue +++ b/src/views/orderauthor/rules/index.vue @@ -1,7 +1,7 @@ diff --git a/src/views/planMonitor/detail.vue b/src/views/planMonitor/detail.vue index 947c71a46..e5387f859 100644 --- a/src/views/planMonitor/detail.vue +++ b/src/views/planMonitor/detail.vue @@ -50,7 +50,6 @@ import CreateEmptyPlan from './editTool/menus/createEmptyPlan'; import { getRpListByUserMapId, publishRunPlan, releaseOrCancelRunPlan, previewRunPlan} from '@/api/designPlatform'; import { getRpListByMapId, deleteRunPlan } from '@/api/runplan'; import { launchFullscreen } from '@/utils/screen'; -import { UrlConfig } from '@/router/index'; export default { name: 'UserRunPlanList', components: { @@ -156,9 +155,9 @@ export default { } else { const query = { skinCode: skinCode, mapId: this.$route.params.mapId, planId: planId, planName: planName }; if (/^\/design\/userlist/.test(this.$route.fullPath)) { - this.$router.push({ path: `${UrlConfig.plan.usertool}`, query: query }); + this.$router.push({ path: `/plan/usertool`, query: query }); } else { - this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query }); + this.$router.push({ path: `/plan/tool`, query: query }); } } }, diff --git a/src/views/system/systemGenerate/index.vue b/src/views/system/systemGenerate/index.vue index cc2aa999a..7089ba203 100644 --- a/src/views/system/systemGenerate/index.vue +++ b/src/views/system/systemGenerate/index.vue @@ -16,185 +16,186 @@ import OnceGenerate from './generate'; import createMapSystem from './create'; export default { - name: 'SystemGenerate', - components: { - OnceGenerate, - createMapSystem - }, - data() { - return { - prdTypeList: [], - mapId: '', - pagerConfig: { - pageSize: 'pageSize', - pageIndex: 'pageNum' - }, - queryForm: { - labelWidth: '100px', - reset: true, - queryObject: { - mapId: { - type: 'select', - label: this.$t('systemGenerate.map'), - config: { - data: [] - } - }, - 'name': { - type: 'text', - label: this.$t('systemGenerate.name') - }, - 'type': { - type: 'select', - label: this.$t('systemGenerate.type'), - config: { - data: [] - } - } - } - }, - queryList: { - query: this.queryFunction, - selectCheckShow: false, - indexShow: true, - columns: [ - { - title: this.$t('systemGenerate.name'), - prop: 'name' - }, - { - title: this.$t('systemGenerate.type'), - type: 'tag', - prop: 'type', - columnValue: (row) => { return this.$convertField(row.type, this.prdTypeList, ['value', 'label']); }, - tagType: (row) => { return ''; } - }, - { - title: this.$t('systemGenerate.mapName'), - type: 'tag', - prop: 'mapName', - columnValue: (row) => { return row.mapName; }, - tagType: (row) => { return ''; } - }, - { - title: this.$t('systemGenerate.prdName'), - prop: 'prdName' - }, - { - type: 'button', - title: this.$t('global.operate'), - width: '400', - buttons: [ - { - name: this.$t('systemGenerate.updateData'), - handleClick: this.updateData, - type: '' - }, - { - name: this.$t('systemGenerate.deleteData'), - handleClick: this.deleteData, - type: 'danger', - showControl: (row) => { return Boolean(row.customized); } - } - ] - } - ], - actions: [ - { text: this.$t('systemGenerate.commission'), handler: this.handleAdd }, - { text: this.$t('systemGenerate.generate'), handler: this.generate } - ] - } + name: 'SystemGenerate', + components: { + OnceGenerate, + createMapSystem + }, + data() { + return { + prdTypeList: [], + mapList:[], + mapId: '', + pagerConfig: { + pageSize: 'pageSize', + pageIndex: 'pageNum' + }, + queryForm: { + labelWidth: '100px', + reset: true, + queryObject: { + mapId: { + type: 'select', + label: this.$t('systemGenerate.map'), + config: { + data: [] + } + }, + 'name': { + type: 'text', + label: this.$t('systemGenerate.name') + }, + 'type': { + type: 'select', + label: this.$t('systemGenerate.type'), + config: { + data: [] + } + } + } + }, + queryList: { + query: this.queryFunction, + selectCheckShow: false, + indexShow: true, + columns: [ + { + title: this.$t('systemGenerate.name'), + prop: 'name' + }, + { + title: this.$t('systemGenerate.type'), + type: 'tag', + prop: 'type', + columnValue: (row) => { return this.$convertField(row.type, this.prdTypeList, ['value', 'label']); }, + tagType: (row) => { return ''; } + }, + { + title: this.$t('systemGenerate.mapName'), + type: 'tag', + prop: 'mapName', + columnValue: (row) => { return row.mapName; }, + tagType: (row) => { return ''; } + }, + { + title: this.$t('systemGenerate.prdName'), + prop: 'prdName' + }, + { + type: 'button', + title: this.$t('global.operate'), + width: '400', + buttons: [ + { + name: this.$t('systemGenerate.updateData'), + handleClick: this.updateData, + type: '' + }, + { + name: this.$t('systemGenerate.deleteData'), + handleClick: this.deleteData, + type: 'danger', + showControl: (row) => { return Boolean(row.customized); } + } + ] + } + ], + actions: [ + { text: this.$t('systemGenerate.commission'), handler: this.handleAdd }, + { text: this.$t('systemGenerate.generate'), handler: this.generate } + ] + } - }; - }, - computed: { - height() { - return this.$store.state.app.height - 50; - } - }, - mounted() { - this.loadInitData(); - }, - methods: { - updateData(index, row) { - getSubSystemInfo(row.id).then(response => { - this.$refs.modifyMapSystem.doShow(response.data); - }).catch(() => { - this.$messageBox(this.$t('systemGenerate.getSubSystemInfoFail')); - }); - }, - deleteData(index, row) { - this.$confirm(this.$t('systemGenerate.deleteMapSystemTip'), this.$t('global.tips'), { - confirmButtonText: this.$t('global.confirm'), - cancelButtonText: this.$t('global.cancel'), - type: 'warning' - }).then(() => { - deleteSubSystem(row.id).then(response => { - this.$message.success(this.$t('systemGenerate.deleteMapSystemSuccess')); - this.reloadTable(); - }).catch(() => { - this.$messageBox(this.$t('systemGenerate.deleteMapSystemFail')); - }); - }).catch(() => { }); - }, - handleCreate(data) { - delete data.id; - createMapSubSystem(data).then(response => { - this.$message.success(this.$t('systemGenerate.createMapSystemSuccess')); - this.reloadTable(); - }).catch(() => { - this.$messageBox(this.$t('systemGenerate.createMapSystemFail')); - }); - }, - handleModify(data) { - const datainfo={'name': data.name}; - updateSubSystem(data.id, datainfo).then(response => { - this.$message.success(this.$t('systemGenerate.updateMapSystemSuccess')); - this.reloadTable(); - }).catch(() => { - this.$messageBox(this.$t('systemGenerate.updateMapSystemFail')); - }); - }, - handleAdd() { - this.$refs.createMapSystem.doShow(); - }, - reloadTable() { - if (this.queryList && this.queryList.reload) { - this.queryList.reload(); - } - }, - async loadInitData() { - try { - // 获取地图 - this.mapList = []; - const res = await listPublishMap(); - this.allMapList=res.data; - res.data.forEach(elem => { - this.queryForm.queryObject.mapId.config.data.push({ value: elem.id, label: elem.name }); - }); - const productTypeList=ConstConfig.ConstSelect.productType; - this.prdTypeList=Cookies.get('user_lang')=='en' - ?productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; }) - :productTypeList.map(elem => { return { value: elem.value, label: elem.label }; }); - this.queryForm.queryObject.type.config.data=this.prdTypeList; - } catch (error) { - console.error(error, '获取发布地图'); - } - }, - generate() { - this.$refs.generate.doShow(); - }, - generateMapSystem(data) { - generateMapSystem(data.mapId).then(response => { - this.reloadTable(); - this.$message.success(this.$t('systemGenerate.generateSuccess')); - }).catch(() => { - this.$messageBox(this.$t('systemGenerate.generateFail')); - }); - }, - queryFunction(params) { - return getMapSystemPageList(params); - } - } + }; + }, + computed: { + height() { + return this.$store.state.app.height - 50; + } + }, + mounted() { + this.loadInitData(); + }, + methods: { + updateData(index, row) { + getSubSystemInfo(row.id).then(response => { + this.$refs.modifyMapSystem.doShow(response.data); + }).catch(() => { + this.$messageBox(this.$t('systemGenerate.getSubSystemInfoFail')); + }); + }, + deleteData(index, row) { + this.$confirm(this.$t('systemGenerate.deleteMapSystemTip'), this.$t('global.tips'), { + confirmButtonText: this.$t('global.confirm'), + cancelButtonText: this.$t('global.cancel'), + type: 'warning' + }).then(() => { + deleteSubSystem(row.id).then(response => { + this.$message.success(this.$t('systemGenerate.deleteMapSystemSuccess')); + this.reloadTable(); + }).catch(() => { + this.$messageBox(this.$t('systemGenerate.deleteMapSystemFail')); + }); + }).catch(() => { }); + }, + handleCreate(data) { + delete data.id; + createMapSubSystem(data).then(response => { + this.$message.success(this.$t('systemGenerate.createMapSystemSuccess')); + this.reloadTable(); + }).catch(() => { + this.$messageBox(this.$t('systemGenerate.createMapSystemFail')); + }); + }, + handleModify(data) { + const datainfo = {'name': data.name}; + updateSubSystem(data.id, datainfo).then(response => { + this.$message.success(this.$t('systemGenerate.updateMapSystemSuccess')); + this.reloadTable(); + }).catch(() => { + this.$messageBox(this.$t('systemGenerate.updateMapSystemFail')); + }); + }, + handleAdd() { + this.$refs.createMapSystem.doShow(); + }, + reloadTable() { + if (this.queryList && this.queryList.reload) { + this.queryList.reload(); + } + }, + async loadInitData() { + try { + // 获取地图 + this.mapList = []; + const res = await listPublishMap(); + this.allMapList = res.data; + res.data.forEach(elem => { + this.queryForm.queryObject.mapId.config.data.push({ value: elem.id, label: elem.name }); + }); + const productTypeList = ConstConfig.ConstSelect.productType; + this.prdTypeList = Cookies.get('user_lang') == 'en' + ? productTypeList.map(elem => { return { value: elem.value, label: elem.enlabel }; }) + : productTypeList.map(elem => { return { value: elem.value, label: elem.label }; }); + this.queryForm.queryObject.type.config.data = this.prdTypeList; + } catch (error) { + console.error(error, '获取发布地图'); + } + }, + generate() { + this.$refs.generate.doShow(); + }, + generateMapSystem(data) { + generateMapSystem(data.mapId).then(response => { + this.reloadTable(); + this.$message.success(this.$t('systemGenerate.generateSuccess')); + }).catch(() => { + this.$messageBox(this.$t('systemGenerate.generateFail')); + }); + }, + queryFunction(params) { + return getMapSystemPageList(params); + } + } }; diff --git a/src/views/system/userTraining/add.vue b/src/views/system/userTraining/add.vue index 72addf576..0809a1676 100644 --- a/src/views/system/userTraining/add.vue +++ b/src/views/system/userTraining/add.vue @@ -18,159 +18,160 @@ import { getDimUserList } from '@/api/management/user'; import AddTraining from './addTraining'; export default { - name: 'UsersTrainingAdd', - components: { - AddTraining - }, - props: { - type: { - type: String, - required: true - } - }, - data() { - return { - dialogVisible: false, - formModel: { - lessonId: '', - trainingId: '', - trainingName: '', - userId: '', - userName: '', - duration: '' - }, - LessonList: [], - UserList: [], - UserLoading: false - }; - }, - computed: { - form() { - this.type === 'ADD'; - const form = { - labelWidth: '150px', - items: [ - { prop: 'lessonId', label: this.$t('system.lessonName'), type: 'select', required: true, options: this.LessonList }, - { prop: 'trainingName', label: this.$t('system.trainingName'), type: 'text', required: true, rightWidth: true, disabled: true, buttontip: this.$t('system.selectTraining'), buttonClick: this.buttonClick, placeholder: this.$t('rules.pleaseSelectTraining') }, - { 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.trainingTime'), type: 'text', required: true, rightWidth: true, message: 's' } - ] - }; - return form; - }, - rules() { - const crules = { - lessonId: [ - { required: true, message: this.$t('rules.pleaseInputLessonName'), trigger: 'change' } - ], - trainingName: [ - { required: true, message: this.$t('rules.pleaseSelectTraining'), trigger: 'change' } - ], - userName: [ - { required: true, message: this.$t('rules.userNameInput'), trigger: 'change' } - ], - duration: [ - { required: true, message: this.$t('rules.timeInput'), trigger: 'blur' } - ] - }; - return crules; - }, - title() { - return this.$t('system.createUserTraining'); - } - }, - mounted() { - this.initLoadPage(); - }, - methods: { - initLoadPage() { - // 加载发布课程列表 - this.LessonList.length = 0; - this.UserList.length = 0; - getPublishLessonList().then(response => { - const data = response.data; - if (data && data.length) { - data.forEach(elem => { - this.LessonList.push({ value: elem.id, label: elem.name }); - }); - } - }); - }, - // 搜索查询input - async querySearchAsync(queryString, cb) { - // 根据queryString 查询用户 并显示 - const results = []; - if (queryString) { - try { - const params = { - fuzzyParam: queryString - }; - const res = await getDimUserList(params); - const list = res.data; - list.forEach(item => { - const value = { - id: item.id, - value: `${item.nickname}(${item.name})${item.mobile}` - }; - results.push(value); - }); - cb(results); - } catch (error) { - console.error(error, '查询用户list'); - cb(results); - } - } else { - cb(results); - } - }, - prdSelect(item) { - this.formModel.userId = item.id; - }, - selectTrain(data) { - this.formModel.trainingId = data.id; - this.formModel.trainingName = data.name; - }, - buttonClick() { - if (this.formModel.lessonId) { - this.$refs.addTraining.show(this.formModel.lessonId); - } else { - this.$message.error(this.$t('rules.selectTheCourseNameFirst')); - } - }, - show(data) { - this.dialogVisible = true; - }, - doSave() { - const self = this; - this.$refs.dataform.validateForm(() => { - self.save(); - }); - }, - save() { - const self = this; - if (this.formModel.userId) { - addUserTraining(this.formModel).then(response => { - self.$message.success(this.$t('system.addSuccess')); - self.handleClose(); - self.$emit('reloadTable'); - }).catch(error => { - self.$message.error(this.$t('error.addFailed') + error.message); - }); - } else { - self.$message.error(this.$t('rules.chooseUser')); - } - }, - handleClose(done) { - this.formModel = { - lessonId: '', - trainingId: '', - trainingName: '', - userId: '', - userName: '', - duration: '' - }; - this.dialogVisible = false; - } - } + name: 'UsersTrainingAdd', + components: { + AddTraining + }, + props: { + type: { + type: String, + required: true + } + }, + data() { + return { + dialogVisible: false, + formModel: { + lessonId: '', + trainingId: '', + trainingName: '', + userId: '', + userName: '', + duration: '' + }, + LessonList: [], + UserList: [], + UserLoading: false + }; + }, + computed: { + form() { + this.type === 'ADD'; + const form = { + labelWidth: '150px', + items: [ + { prop: 'lessonId', label: this.$t('system.lessonName'), type: 'select', required: true, options: this.LessonList }, + { prop: 'trainingName', label: this.$t('system.trainingName'), type: 'text', required: true, rightWidth: true, disabled: true, buttontip: this.$t('system.selectTraining'), buttonClick: this.buttonClick, placeholder: this.$t('rules.pleaseSelectTraining') }, + { 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.trainingTime'), type: 'text', required: true, rightWidth: true, message: 's' } + ] + }; + return form; + }, + rules() { + const crules = { + lessonId: [ + { required: true, message: this.$t('rules.pleaseInputLessonName'), trigger: 'change' } + ], + trainingName: [ + { required: true, message: this.$t('rules.pleaseSelectTraining'), trigger: 'change' } + ], + userName: [ + { required: true, message: this.$t('rules.userNameInput'), trigger: 'change' } + ], + duration: [ + { required: true, message: this.$t('rules.timeInput'), trigger: 'blur' } + ] + }; + return crules; + }, + title() { + return this.$t('system.createUserTraining'); + } + }, + mounted() { + this.initLoadPage(); + }, + methods: { + initLoadPage() { + // 加载发布课程列表 + this.LessonList.length = 0; + this.UserList.length = 0; + getPublishLessonList().then(response => { + const data = response.data; + if (data && data.length) { + data.forEach(elem => { + this.LessonList.push({ value: elem.id, label: elem.name }); + }); + } + }); + }, + // 搜索查询input + async querySearchAsync(queryString, cb) { + // 根据queryString 查询用户 并显示 + const results = []; + if (queryString) { + try { + const params = { + fuzzyParam: queryString + }; + const res = await getDimUserList(params); + const list = res.data; + list.forEach(item => { + const value = { + id: item.id, + value: `${item.nickname}(${item.name})${item.mobile}` + }; + results.push(value); + }); + cb(results); + } catch (error) { + console.error(error, '查询用户list'); + cb(results); + } + } else { + cb(results); + } + }, + prdSelect(item) { + this.formModel.userId = item.id; + }, + selectTrain(data) { + this.formModel.trainingId = data.id; + this.formModel.trainingName = data.name; + }, + buttonClick() { + if (this.formModel.lessonId) { + this.$refs.addTraining.show(this.formModel.lessonId); + } else { + this.$message.error(this.$t('rules.selectTheCourseNameFirst')); + } + }, + show(data) { + this.dialogVisible = true; + }, + doSave() { + const self = this; + this.$refs.dataform.validateForm(() => { + self.save(); + }); + }, + save() { + const self = this; + if (this.formModel.userId) { + addUserTraining(this.formModel).then(response => { + self.$message.success(this.$t('system.addSuccess')); + self.handleClose(); + self.$emit('reloadTable'); + }).catch(error => { + self.$message.error(this.$t('error.addFailed') + error.message); + }); + } else { + self.$message.error(this.$t('rules.chooseUser')); + } + }, + handleClose(done) { + this.formModel = { + lessonId: '', + trainingId: '', + trainingName: '', + userId: '', + userName: '', + duration: '' + }; + this.$refs.dataform.resetForm(); + this.dialogVisible = false; + } + } }; diff --git a/src/views/system/userTraining/addTraining.vue b/src/views/system/userTraining/addTraining.vue index d5ea1b432..5b182dbe2 100644 --- a/src/views/system/userTraining/addTraining.vue +++ b/src/views/system/userTraining/addTraining.vue @@ -24,75 +24,64 @@