From 0a4c701d01da57ff628fe4d7d608d67d0b0f2f9c Mon Sep 17 00:00:00 2001 From: wanggongfeng <1305282856@qq.com> Date: Tue, 8 Dec 2020 10:47:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BD=91=E6=A0=BC=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E5=8C=96=E8=BF=90=E4=BD=9C=E6=8F=90=E6=8A=A5=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E3=80=91=E8=80=83=E6=A0=B8=E9=A1=B9=E9=85=8D=E7=BD=AE=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2-=E7=8E=8B=E5=85=AC=E5=B3=B0-2020-12-08?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kpi/subcheckdictionary-add-or-update.vue | 221 ++++++++++++------ src/views/modules/kpi/subcheckdictionary.vue | 65 ++---- .../modules/sys/resource-add-or-update.vue | 1 + 3 files changed, 171 insertions(+), 116 deletions(-) diff --git a/src/views/modules/kpi/subcheckdictionary-add-or-update.vue b/src/views/modules/kpi/subcheckdictionary-add-or-update.vue index dbfa6277..0e38ce86 100644 --- a/src/views/modules/kpi/subcheckdictionary-add-or-update.vue +++ b/src/views/modules/kpi/subcheckdictionary-add-or-update.vue @@ -1,49 +1,42 @@ @@ -57,19 +50,17 @@ export default { dataForm: { id: '', pid: '', + parentName: '', checkType: '', checkCode: '', checkLabel: '', - showFlag: '', + showFlag: '1', checkDescribe: '', - sort: '', - delFlag: '', - revision: '', - createdBy: '', - createdTime: '', - updatedBy: '', - updatedTime: '' - } + sort: '0' + }, + resourceListVisible: false, + resourceList: [], + isAble: false } }, computed: { @@ -90,29 +81,8 @@ export default { showFlag: [ { required: true, message: this.$t('validate.required'), trigger: 'blur' } ], - checkDescribe: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } - ], sort: [ { required: true, message: this.$t('validate.required'), trigger: 'blur' } - ], - delFlag: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } - ], - revision: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } - ], - createdBy: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } - ], - createdTime: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } - ], - updatedBy: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } - ], - updatedTime: [ - { required: true, message: this.$t('validate.required'), trigger: 'blur' } ] } } @@ -120,16 +90,33 @@ export default { methods: { init () { this.visible = true + this.isAble = false this.$nextTick(() => { this.$refs['dataForm'].resetFields() - if (this.dataForm.id) { - this.getInfo() - } + this.dataForm.parentName = '一级资源' + this.dataForm.pid = '0' + this.dataForm.resourceList = [] + this.getResourceList().then(() => { + if (this.dataForm.id) { + this.getInfo() + } + }) }) }, + // 获取菜单列表 + getResourceList () { + return this.$http.get('/kpi/subcheckdictionary/list') + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.resourceList = res.data + }) + .catch(() => {}) + }, // 获取信息 getInfo () { - this.$http.get(`/news/subcheckdictionary/${this.dataForm.id}`).then(({ data: res }) => { + this.$http.get(`/kpi/subcheckdictionary/${this.dataForm.id}`).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) } @@ -137,16 +124,34 @@ export default { ...this.dataForm, ...res.data } + if (this.dataForm.pid === '0' || this.dataForm.pid === 0) { + return this.deptListTreeSetDefaultHandle() + } + this.$refs.resourceListTree.setCurrentKey(this.dataForm.pid) + this.dataForm.parentName = this.$refs.resourceListTree.getCurrentNode().checkLabel }).catch(() => {}) }, + // 上级菜单树, 设置默认值 + deptListTreeSetDefaultHandle () { + this.dataForm.pid = '0' + this.dataForm.parentName = '一级资源' + }, + // 上级菜单树, 选中 + resourceListTreeCurrentChangeHandle (data) { + this.dataForm.pid = data.id + this.dataForm.parentName = data.checkLabel + this.resourceListVisible = false + }, // 表单提交 dataFormSubmitHandle: debounce(function () { this.$refs['dataForm'].validate((valid) => { if (!valid) { return false } - this.$http[!this.dataForm.id ? 'post' : 'put']('/news/subcheckdictionary/', this.dataForm).then(({ data: res }) => { + this.isAble = true + this.$http[!this.dataForm.id ? 'post' : 'put']('/kpi/subcheckdictionary/', this.dataForm).then(({ data: res }) => { if (res.code !== 0) { + this.isAble = false return this.$message.error(res.msg) } this.$message({ @@ -164,3 +169,69 @@ export default { } } + diff --git a/src/views/modules/kpi/subcheckdictionary.vue b/src/views/modules/kpi/subcheckdictionary.vue index 6cc22fc1..8e21f235 100644 --- a/src/views/modules/kpi/subcheckdictionary.vue +++ b/src/views/modules/kpi/subcheckdictionary.vue @@ -1,52 +1,25 @@