diff --git a/src/views/modules/sys/app-menu-add-or-update.vue b/src/views/modules/sys/app-menu-add-or-update.vue index ca62ff28..947cd427 100644 --- a/src/views/modules/sys/app-menu-add-or-update.vue +++ b/src/views/modules/sys/app-menu-add-or-update.vue @@ -1,148 +1,196 @@ @@ -167,11 +215,11 @@ export default { pid: '0', parentName: '', url: '', - resourceList: [], - permissions: '', sort: 0, icon: '', menuCode: '', + className: '', + remark: '', templateId: '' }, uploadUrl: '', @@ -182,10 +230,18 @@ export default { dataRule () { return { name: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } + { + required: true, + message: this.$t('validate.required'), + trigger: 'blur' + } ], parentName: [ - { required: true, message: this.$t('validate.required'), trigger: 'change' } + { + required: true, + message: this.$t('validate.required'), + trigger: 'change' + } ] } } @@ -198,7 +254,9 @@ export default { methods: { init () { this.visible = true - this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}` + this.uploadUrl = `${ + window.SITE_CONFIG['apiURL'] + }/oss/file/upload?token=${Cookies.get('token')}` this.$nextTick(() => { this.$refs['dataForm'].resetFields() this.iconList = getIconList() @@ -214,37 +272,46 @@ export default { }, // 获取菜单列表 getMenuList () { - return this.$http.get('/sys/appmenu/list?type=0').then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } - this.menuList = res.data - }).catch(() => { }) + return this.$http + .get('/sys/appmenu/list?type=0') + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.menuList = res.data + }) + .catch(() => {}) }, // 获取子菜单模板列表 getTemplateList () { - this.$http.get('/sys/appmenutemplate/list').then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } - this.templates = res.data - }).catch(() => { }) + this.$http + .get('/sys/appmenutemplate/list') + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.templates = res.data + }) + .catch(() => {}) }, // 获取信息 getInfo () { - this.$http.get(`/sys/appmenu/${this.dataForm.id}`).then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } - this.dataForm = { - ...this.dataForm, - ...res.data - } - if (this.dataForm.pid === '0') { - return this.deptListTreeSetDefaultHandle() - } - this.$refs.menuListTree.setCurrentKey(this.dataForm.pid) - }).catch(() => { }) + this.$http + .get(`/sys/appmenu/${this.dataForm.id}`) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.dataForm = { + ...this.dataForm, + ...res.data + } + if (this.dataForm.pid === '0') { + return this.deptListTreeSetDefaultHandle() + } + this.$refs.menuListTree.setCurrentKey(this.dataForm.pid) + }) + .catch(() => {}) }, // 上级菜单树, 设置默认值 deptListTreeSetDefaultHandle () { @@ -272,30 +339,41 @@ export default { }, // 菜单资源, 删除 resourceDeleteHandle (resource) { - this.dataForm.resourceList = this.dataForm.resourceList.filter(item => item.key !== resource.key) + this.dataForm.resourceList = this.dataForm.resourceList.filter( + item => item.key !== resource.key + ) }, // 表单提交 - dataFormSubmitHandle: debounce(function () { - this.$refs['dataForm'].validate((valid) => { - if (!valid) { - return false - } - this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/appmenu', this.dataForm).then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) + dataFormSubmitHandle: debounce( + function () { + this.$refs['dataForm'].validate(valid => { + if (!valid) { + return false } - this.$message({ - message: this.$t('prompt.success'), - type: 'success', - duration: 500, - onClose: () => { - this.visible = false - this.$emit('refreshDataList') - } - }) - }).catch(() => { }) - }) - }, 1000, { 'leading': true, 'trailing': false }), + this.$http[!this.dataForm.id ? 'post' : 'put']( + '/sys/appmenu', + this.dataForm + ) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.$message({ + message: this.$t('prompt.success'), + type: 'success', + duration: 500, + onClose: () => { + this.visible = false + this.$emit('refreshDataList') + } + }) + }) + .catch(() => {}) + }) + }, + 1000, + { leading: true, trailing: false } + ), // 上传图片 handleAvatarSuccess (res, file) { this.loading = false diff --git a/src/views/modules/sys/app-menu.vue b/src/views/modules/sys/app-menu.vue index 97af6ce8..926fab24 100644 --- a/src/views/modules/sys/app-menu.vue +++ b/src/views/modules/sys/app-menu.vue @@ -1,83 +1,94 @@ diff --git a/src/views/modules/sys/appmenutemplate-add-or-update.vue b/src/views/modules/sys/appmenutemplate-add-or-update.vue index fe9d4e99..6e9080ac 100644 --- a/src/views/modules/sys/appmenutemplate-add-or-update.vue +++ b/src/views/modules/sys/appmenutemplate-add-or-update.vue @@ -1,62 +1,59 @@ @@ -69,74 +66,93 @@ export default { visible: false, dataForm: { id: '', - gradationFlag: '', backgroundColor: '', - startColor: '', - endColor: '', - lableColor: '', templateCode: '', templateName: '', - revision: '', - createdBy: '', + className: '', + spareClassName: '', + columnAmount: 0, createdTime: '', - updatedBy: '', updatedTime: '' - }, - gradationFlagOptions: [{ id: '1', name: '是' }, { id: '0', name: '否' }], - categoryVisible: true + } } }, computed: { dataRule () { return { - gradationFlag: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } - ], backgroundColor: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } + { + required: false, + message: this.$t('validate.required'), + trigger: 'blur' + } ], startColor: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } + { + required: false, + message: this.$t('validate.required'), + trigger: 'blur' + } ], endColor: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } - ], - lableColor: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } + { + required: false, + message: this.$t('validate.required'), + trigger: 'blur' + } ], templateCode: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } + { + required: true, + message: this.$t('validate.required'), + trigger: 'blur' + } ], templateName: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } + { + required: true, + message: this.$t('validate.required'), + trigger: 'blur' + } ], revision: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } + { + required: false, + message: this.$t('validate.required'), + trigger: 'blur' + } ], createdBy: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } + { + required: false, + message: this.$t('validate.required'), + trigger: 'blur' + } ], createdTime: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } + { + required: false, + message: this.$t('validate.required'), + trigger: 'blur' + } ], updatedBy: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } + { + required: false, + message: this.$t('validate.required'), + trigger: 'blur' + } ], updatedTime: [ - { required: false, message: this.$t('validate.required'), trigger: 'blur' } + { + required: false, + message: this.$t('validate.required'), + trigger: 'blur' + } ] } } }, - watch: { - 'dataForm.gradationFlag': function (val) { - if (val === '0') { - this.categoryVisible = false - } else { - this.categoryVisible = true - } - } - }, methods: { init () { this.visible = true @@ -149,38 +165,50 @@ export default { }, // 获取信息 getInfo () { - this.$http.get(`/sys/appmenutemplate/${this.dataForm.id}`).then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } - this.dataForm = { - ...this.dataForm, - ...res.data - } - }).catch(() => { }) - }, - // 表单提交 - dataFormSubmitHandle: debounce(function () { - this.$refs['dataForm'].validate((valid) => { - if (!valid) { - return false - } - this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/appmenutemplate/', this.dataForm).then(({ data: res }) => { + this.$http + .get(`/sys/appmenutemplate/${this.dataForm.id}`) + .then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } - this.$message({ - message: this.$t('prompt.success'), - type: 'success', - duration: 500, - onClose: () => { - this.visible = false - this.$emit('refreshDataList') - } - }) - }).catch(() => { }) - }) - }, 1000, { 'leading': true, 'trailing': false }) + this.dataForm = { + ...this.dataForm, + ...res.data + } + }) + .catch(() => {}) + }, + // 表单提交 + dataFormSubmitHandle: debounce( + function () { + this.$refs['dataForm'].validate(valid => { + if (!valid) { + return false + } + this.$http[!this.dataForm.id ? 'post' : 'put']( + '/sys/appmenutemplate/', + this.dataForm + ) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.$message({ + message: this.$t('prompt.success'), + type: 'success', + duration: 500, + onClose: () => { + this.visible = false + this.$emit('refreshDataList') + } + }) + }) + .catch(() => {}) + }) + }, + 1000, + { leading: true, trailing: false } + ) } } diff --git a/src/views/modules/sys/appmenutemplate.vue b/src/views/modules/sys/appmenutemplate.vue index aef0a5ec..064a7460 100644 --- a/src/views/modules/sys/appmenutemplate.vue +++ b/src/views/modules/sys/appmenutemplate.vue @@ -1,96 +1,122 @@ @@ -119,7 +145,11 @@ export default { }, methods: { formatGradationFlag: function (row, column) { - return row.gradationFlag === '1' ? '是' : row.state === '0' ? '未知' : '否' + return row.gradationFlag === '1' + ? '是' + : row.state === '0' + ? '未知' + : '否' } } }