From 8bc25357d5742f07710baa7a6f1d6ac4023da3ac Mon Sep 17 00:00:00 2001 From: wangting <wangting@vci-tech.com> Date: 星期三, 25 十二月 2024 12:00:55 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue | 221 +++++++++++++++++++++++++++++------------------------- 1 files changed, 119 insertions(+), 102 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue index 5a5c1e1..fdf5ef9 100644 --- a/Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/systemModel/systemConfig/index.vue @@ -1,11 +1,11 @@ -<template> + <template> <el-container> <el-aside> <basic-container> - <div style="max-height: calc(100vh - 170px);overflow: auto"> + <div style="max-height: calc(100vh - 150px);overflow: auto"> <avue-tree :key="refresh" ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick"> <span slot-scope="{ node, data }" class="el-tree-node__label"> - <span style="font-size: 15px"> + <span> <i class="el-icon-s-promotion"></i> {{ (node || {}).label }} </span> @@ -16,7 +16,6 @@ </el-aside> <el-main> <basic-container> - <avue-crud ref="crud" :data="configData" @@ -47,25 +46,25 @@ :visible.sync="addVisible" append-to-body="true" class="avue-dialog" - width="50%" + width="600px" @close="addVisibleClose"> - <el-form ref="form" :model="form" label-width="80px"> - <el-form-item label="鍚嶇О锛�"> - <el-input v-model="form.name"></el-input> + <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small"> + <el-form-item label="鍚嶇О锛�" prop="name"> + <el-input v-model="form.name" ></el-input> </el-form-item> - <el-form-item v-if="nodeRow.id !== 'firstNode'" label="key锛�"> + <el-form-item v-if="nodeRow.id !== 'firstNode'" label="key锛�" prop="key"> <el-input v-model="form.key"></el-input> </el-form-item> - <el-form-item v-if="nodeRow.id !== 'firstNode'" label="value锛�"> + <el-form-item v-if="nodeRow.id !== 'firstNode'" label="鍊硷細" prop="value"> <el-input v-model="form.value"></el-input> </el-form-item> <el-form-item label="鎻忚堪锛�"> - <el-input v-model="form.desc" type="textarea"></el-input> + <el-input v-model="form.desc" type="textarea" prop="desc"></el-input> </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> - <el-button size="small" @click="addVisibleClose">鍙� 娑�</el-button> <el-button size="small" type="primary" @click="addSaveClickHandler">纭� 瀹�</el-button> + <el-button size="small" @click="addVisibleClose">鍙� 娑�</el-button> </span> </el-dialog> @@ -83,6 +82,7 @@ getAppConfigDetailsByID, addAppConf, updateAppConf, + delAppConf, exportSysConf } from "@/api/systemModel/systemConfig/api" import basicOption from "@/util/basic-option"; @@ -103,7 +103,16 @@ editStatus: false, form: { name: "", + key:"", + value:"", desc: "" + }, + rules: { + name: [ + {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'} + ], + key: [{required: true, message: '璇疯緭鍏ey', trigger: 'blur'}], + value: [{required: true, message: '璇疯緭鍏ュ��', trigger: 'blur'}] }, addVisible: false, nodeRow: {}, @@ -114,6 +123,7 @@ addBtn: false, editBtn: false, delBtn: false, + calcHeight: -50, column: [ { label: '鍚嶇О', @@ -126,7 +136,7 @@ sortable: true }, { - label: 'value', + label: '鍊�', prop: 'value', overHidden: true, sortable: true @@ -230,67 +240,52 @@ this.form[key] = ""; }) this.addVisible = false; + this.$refs.form.clearValidate(); }, // 淇濆瓨 addSaveClickHandler() { - if (this.nodeRow.id === 'firstNode') { - if (!this.form.name) { - this.$message.error('鍚嶇О涓嶈兘涓虹┖锛�'); - return; - } - } else { - if (!this.form.name) { - this.$message.error('鍚嶇О涓嶈兘涓虹┖锛�'); - return; - } - if (!this.form.key) { - this.$message.error('key鍊间笉鑳戒负绌猴紒'); - return; - } - if (!this.form.value) { - this.$message.error('value鍊间笉鑳戒负绌猴紒'); - return; - } - } - - const params = this.nodeRow.id === 'firstNode' ? { - appConfigDetailInfo: { - name: this.form.name, - desc: this.form.desc, - id: this.editStatus ? this.form.id : null - }, - isConfCategorys: true //true琛ㄧず缁欓《灞傛坊鍔犻厤缃」鍒嗙被 - } : { - appConfigDetailInfo: { - categoryId: this.nodeRow.id, - name: this.form.name, - desc: this.form.desc, - key: this.form.key, - value: this.form.value, - id: this.editStatus ? this.form.id : null - }, - isConfCategorys: false //true琛ㄧず缁欓《灞傛坊鍔犻厤缃」鍒嗙被 - } - const saveApi = this.editStatus ? updateAppConf : addAppConf; - saveApi(params).then(res => { - if (res.data.code === 200) { - this.$message.success(res.data.obj); - this.addVisibleClose(); - if (this.nodeRow.id === 'firstNode') { - this.getTreeList('save'); - } else { - this.configLoading = true; - getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => { - if (res.data.code === 200) { - const data = res.data.data; - this.configData = data; - this.configLoading = false; - } - }) + this.$refs.form.validate((valid) => { + if (valid) { + const params = this.nodeRow.id === 'firstNode' ? { + appConfigDetailInfo: { + name: this.form.name, + desc: this.form.desc, + id: this.editStatus ? this.form.id : null + }, + isConfCategorys: true //true琛ㄧず缁欓《灞傛坊鍔犻厤缃」鍒嗙被 + } : { + appConfigDetailInfo: { + categoryId: this.nodeRow.id, + name: this.form.name, + desc: this.form.desc, + key: this.form.key, + value: this.form.value, + id: this.editStatus ? this.form.id : null + }, + isConfCategorys: false //true琛ㄧず缁欓《灞傛坊鍔犻厤缃」鍒嗙被 } + const saveApi = this.editStatus ? updateAppConf : addAppConf; + saveApi(params).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.addVisibleClose(); + if (this.nodeRow.id === 'firstNode') { + this.getTreeList('save'); + } else { + this.configLoading = true; + getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => { + if (res.data.code === 200) { + const data = res.data.data; + this.configData = data; + this.configLoading = false; + } + }) + } + } + }) } - }) + }); }, // 缂栬緫鎸夐挳 @@ -306,24 +301,34 @@ ids: row.id, isConfCategorys: this.nodeRow.id === 'firstNode' ? true : false } - getAppConfigCategoryInfo(params).then(res => { - console.log(res) - if (res.data.code === 200) { - this.$message.success('鍒犻櫎鎴愬姛'); - if (this.nodeRow.id === 'firstNode') { - this.getTreeList('save'); - } else { - this.configLoading = true; - getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => { - if (res.data.code === 200) { - const data = res.data.data; - this.configData = data; - this.configLoading = false; - } - }) + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎褰撳墠鏁版嵁鍚楋紵', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + delAppConf(params).then(res => { + if (res.data.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛'); + if (this.nodeRow.id === 'firstNode') { + this.getTreeList('save'); + } else { + this.configLoading = true; + getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => { + if (res.data.code === 200) { + const data = res.data.data; + this.configData = data; + this.configLoading = false; + } + }) + } } - } - }) + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); }, // 閫夋嫨妗� @@ -352,30 +357,42 @@ this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); return; } + const params = { ids: this.selectList.map(item => { return item.id }).join(','), isConfCategorys: this.nodeRow.id === 'firstNode' ? true : false } - getAppConfigCategoryInfo(params).then(res => { - console.log(res) - if (res.data.code === 200) { - this.$message.success('鍒犻櫎鎴愬姛'); - if (this.nodeRow.id === 'firstNode') { - this.getTreeList('save'); - } else { - this.configLoading = true; - getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => { - if (res.data.code === 200) { - const data = res.data.data; - this.configData = data; - this.configLoading = false; - } - }) + + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎褰撳墠鏁版嵁鍚楋紵', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + delAppConf(params).then(res => { + if (res.data.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛'); + if (this.nodeRow.id === 'firstNode') { + this.getTreeList('save'); + } else { + this.configLoading = true; + getAppConfigDetailsByID({clsId: this.nodeRow.id}).then(res => { + if (res.data.code === 200) { + const data = res.data.data; + this.configData = data; + this.configLoading = false; + } + }) + } } - } - }) + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); }, // 瀵煎嚭鎸夐挳 -- Gitblit v1.9.3