From f73b93ad250ca4387b16aae224abc2c4c083f84f Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 21 十一月 2024 21:59:55 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue | 4 Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-form.vue | 2 Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue | 42 ++-- Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-table.vue | 2 Source/plt-web/plt-web-ui/src/router/avue-router.js | 2 Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue | 2 Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue | 96 ++++++----- Source/plt-web/plt-web-ui/src/views/wel/homeConfig.vue | 293 ++++++++++++++++++++++++++++++++++++ Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue | 20 +- Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue | 3 10 files changed, 385 insertions(+), 81 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-form.vue b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-form.vue index 613a9a8..efa800f 100644 --- a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-form.vue +++ b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-form.vue @@ -132,7 +132,7 @@ if (Object.keys(this.paramVOS).length > 0) { for (let j in this.paramVOS) { if (this.paramVOS[j] && this.paramVOS[j].constructor === Object) continue; - if (['type', 'context', 'content', "getdataurl", "getdatamethod", "url", "method", "uploadfileurl", "title", 'querytemplate', 'querytype', 'usesourcedata'].includes(j)) continue; + if (['type', 'context', 'content', "getdataurl", "getdatamethod", "url", "method", "uploadfileurl", "title", 'querytemplate', 'querytype', 'usesourcedata','component'].includes(j)) continue; sourceDataMap['sourceData["' + j + '"]'] = this.paramVOS[j] } } diff --git a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-table.vue b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-table.vue index b8ecc68..d964c82 100644 --- a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-table.vue +++ b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-table.vue @@ -311,7 +311,7 @@ if (Object.keys(this.paramVOS).length>0) { for (let j in this.paramVOS) { if (this.paramVOS[j] && this.paramVOS[j].constructor === Object) continue; - if (['type', 'context', 'content', "getdataurl", "getdatamethod", "url", "method", "uploadfileurl", "title", 'querytemplate', 'querytype', 'usesourcedata'].includes(j)) continue; + if (['type', 'context', 'content', "getdataurl", "getdatamethod", "url", "method", "uploadfileurl", "title", 'querytemplate', 'querytype', 'usesourcedata','component'].includes(j)) continue; sourceDataMap['sourceData["' + j + '"]'] = this.paramVOS[j] } } diff --git a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue index 8f9991f..8db65f5 100644 --- a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue +++ b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-tree.vue @@ -188,7 +188,7 @@ if (Object.keys(this.paramVOS).length > 0) { for (let j in this.paramVOS) { if (this.paramVOS[j] && this.paramVOS[j].constructor === Object) continue; - if (['type', 'context', 'content', "getdataurl", "getdatamethod", "url", "method", "uploadfileurl", "title", 'querytemplate', 'querytype', 'usesourcedata'].includes(j)) continue; + if (['type', 'context', 'content', "getdataurl", "getdatamethod", "url", "method", "uploadfileurl", "title", 'querytemplate', 'querytype', 'usesourcedata','component'].includes(j)) continue; sourceDataMap['sourceData["' + j + '"]'] = this.paramVOS[j] } } @@ -257,7 +257,7 @@ } } getTree(parentOid, parentBtmName, params,url).then(res => { - resolve(res.data.treeData ) + resolve(res.data.treeData || res.data.obj || []) this.$nextTick(()=>{ if (this.isRefresh) { this.$refs.tree.setCurrentKey(this.currentClickNode.data.oid); diff --git a/Source/plt-web/plt-web-ui/src/router/avue-router.js b/Source/plt-web/plt-web-ui/src/router/avue-router.js index a18ad96..d1d798e 100644 --- a/Source/plt-web/plt-web-ui/src/router/avue-router.js +++ b/Source/plt-web/plt-web-ui/src/router/avue-router.js @@ -182,7 +182,7 @@ meta: meta, redirect: (() => { // 绗竴娆¤繘鏉ヤ絾鏄病鏈夊瓙璺敱鐨� 闇�瑕佹坊鍔爎edirect - if (!isChild && first && !isURL(path)) return `${path}/index` + if (!isChild && first && !isURL(path)) return `/${code}/index` else return ''; })(), // 鏁寸悊瀛愯矾鐢辩殑route 閰嶇疆 diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue index 8faee80..7a7bc2e 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue @@ -85,7 +85,7 @@ <!-- 瀵煎叆 --> <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆" - @updata="getTreeList"></upload-file> + @updata="getList"></upload-file> <!-- 鏌ョ湅浣跨敤鑼冨洿 --> <el-dialog @@ -107,7 +107,6 @@ </avue-crud> </el-dialog> </basic-container> - </template> <script> @@ -208,11 +207,10 @@ } }, created() { - this.getTreeList(); + this.getList(); }, methods: { - // 宸︿晶鏍戣姹� - getTreeList() { + getList() { gridStatus(this.page.currentPage, this.page.pageSize).then(res => { const data = res.data.data; this.data = data; @@ -225,7 +223,7 @@ // 琛ㄦ牸鍒锋柊 handleRefresh() { - this.getTreeList(); + this.getList(); }, // 琛ㄦ牸澶氶�� @@ -236,13 +234,13 @@ // 鏉℃暟 sizeChange(val) { this.page.pageSize = val; - this.getTreeList(); + this.getList(); }, // 椤电爜 currentChange(val) { this.page.currentPage = val; - this.getTreeList(); + this.getList(); }, // 琛屽崟閫� @@ -288,7 +286,7 @@ deleteStatus(this.selectList).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); - this.getTreeList(); + this.getList(); } }) }).catch(() => { @@ -311,7 +309,7 @@ deleteStatus(list).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); - this.getTreeList(); + this.getList(); } }) }).catch(() => { @@ -344,7 +342,7 @@ if (res.data.code === 200) { this.$message.success(res.data.obj); this.loading = true; - this.getTreeList(); + this.getList(); this.visible = false; } else { this.$message.error(res.data.obj); diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue index c1411cc..eae35e2 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/formDialog.vue @@ -195,7 +195,7 @@ queryTemplate:{} }, //宸叉湁鎺掑簭鍒楄〃閰嶇疆 - crudOption: { + crudOption: { ...basicOption, addBtn: false, editBtn: false, diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue index a8dd219..73aa2b8 100644 --- a/Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/systemModel/businessModel/index.vue @@ -3,7 +3,8 @@ <el-aside> <basic-container> <div style="max-height: calc(100vh - 150px);overflow: auto"> - <avue-tree :key="refresh" node-key="id" ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick"> + <avue-tree :key="refresh" ref="tree" :data="treeData" :option="treeOption" node-key="id" + @node-click="nodeClick"> <span slot-scope="{ node, data }" class="el-tree-node__label"> <span style="font-size: 15px"> <i :class="data.icon"></i> @@ -17,8 +18,10 @@ <el-main> <basic-container> - <div v-if="(form.childType || form.childType === 0) && !addStatus && !editStatus && form.category !== 1" class="btnBox"> - <el-button :disabled="(mangeShowBtn || form.childType === 0) ? false : !childTypeBtn" icon="el-icon-plus" plain + <div v-if="(form.childType || form.childType === 0) && !addStatus && !editStatus && form.category !== 1" + class="btnBox"> + <el-button :disabled="(mangeShowBtn || form.childType === 0) ? false : !childTypeBtn" icon="el-icon-plus" + plain size="small" type="primary" @click="addClickHandler">澧炲姞 </el-button> @@ -56,8 +59,8 @@ <el-button v-if="editStatus" icon="el-icon-check" plain size="small" type="success" @click="editSaveClickHandler">淇濆瓨 </el-button> - <el-button icon="el-icon-close" plain size="small" - type="danger" @click="addStatus=false;editStatus=false;">鍙栨秷 + <el-button icon="el-icon-close" plain size="small" + type="danger" @click="addStatus=false;editStatus=false;">鍙栨秷 </el-button> </div> <div v-if="form.category === 1" class="btnBox"> @@ -208,7 +211,7 @@ addBtn: false, menu: false, height: 500, - header:false, + header: false, column: [ { label: '鎿嶄綔鍒嗙被', @@ -224,7 +227,7 @@ addStatus: false, editStatus: false, nodeRow: {}, - currentClickNode:null, + currentClickNode: null, form: {}, treeData: [], treeOption: { @@ -250,7 +253,7 @@ id: item.id, name: item.name, leaf: !item.hasChildren, - icon: item.source || 'iconfont iconicon_work' + icon: item.source || 'el-icon-s-home' } })) }) @@ -280,10 +283,10 @@ }, methods: { // 鏍戣鐐瑰嚮 - nodeClick(row,node) { + nodeClick(row, node) { this.form = {...row}; this.nodeRow = {...row}; - this.currentClickNode=node; + this.currentClickNode = node; this.addStatus = false; this.editStatus = false; }, @@ -294,7 +297,7 @@ this.defalutName.forEach(key => { this.form[key] = null; }) - this.form.isValid = false; + this.form.isValid = true; this.addStatus = true; this.editStatus = false; }, @@ -426,12 +429,12 @@ addMethodsClickHandler() { this.methodsLoading = true; getSysModelTreeMenuByPID({parentId: 'operateNode'}).then(res => { - if (res.data.code === 200 && res.data.data.length>0) { + if (res.data.code === 200 && res.data.data.length > 0) { this.methodsVisble = true; const data = res.data.data; this.methodsData = data; this.methodsLoading = false; - }else { + } else { this.$message.error('鏈壘鍒板彲澧炲姞鐨勬搷浣滅被鍨�'); } }) @@ -531,19 +534,20 @@ upLoadClickHandler() { this.$refs.upload.visible = true; }, + handleRefreshTree(type) { //type:add\edit\del - if(type=="del"){ + if (type == "del") { this.$refs.tree.remove(this.currentClickNode); - this.currentClickNode=null; - this.form={}; - }else{ + this.currentClickNode = null; + this.form = {}; + } else { if (this.currentClickNode) { let node = this.currentClickNode.parent; node.loaded = false; node.expand(); this.$refs.tree.setCurrentNode(this.currentClickNode); - }else { + } else { this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍� } } @@ -561,7 +565,7 @@ .btnBox { display: flex; - justify-content:left; + justify-content: left; margin-bottom: 15px; } </style> diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue index e0c2963..614abf6 100644 --- a/Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/systemModel/mangeModel/index.vue @@ -253,7 +253,7 @@ id: item.id, name: item.name, leaf: !item.hasChildren, - icon: item.source || 'iconfont iconicon_work' + icon: item.source || 'el-icon-s-home' } })) }) @@ -524,6 +524,7 @@ upLoadClickHandler() { this.$refs.upload.visible = true; }, + handleRefreshTree(type) { //type:add\edit\del if (type == "del") { diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue index 6af6e5f..62e26a7 100644 --- a/Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/systemModel/operateType/index.vue @@ -3,7 +3,8 @@ <el-aside> <basic-container> <div style="max-height: calc(100vh - 150px);overflow: auto"> - <avue-tree :key="refresh" node-key="id" ref="tree" :data="treeData" :option="treeOption" @node-click="nodeClick"> + <avue-tree :key="refresh" ref="tree" :data="treeData" :option="treeOption" node-key="id" + @node-click="nodeClick"> <span slot-scope="{ node, data }" class="el-tree-node__label"> <span style="font-size: 15px"> <i class="el-icon-s-promotion"></i> @@ -25,19 +26,22 @@ <el-button v-if="addStatus" icon="el-icon-check" plain size="small" type="success" @click="addSaveClickHandler">淇濆瓨 </el-button> - <el-button v-if="!addStatus && !editStatus" :disabled="nodeRow.childType === -1" icon="el-icon-edit" plain size="small" type="primary" + <el-button v-if="!addStatus && !editStatus" :disabled="nodeRow.childType === -1" icon="el-icon-edit" plain + size="small" type="primary" @click="editClickHandler">淇敼 </el-button> <el-button v-if="editStatus" icon="el-icon-check" plain size="small" type="success" @click="editSaveClickHandler">淇濆瓨 </el-button> - <el-button v-if="addStatus || editStatus" icon="el-icon-close" plain size="small" - type="danger" @click="addStatus=false;editStatus=false;">鍙栨秷 + <el-button v-if="addStatus || editStatus" icon="el-icon-close" plain size="small" + type="danger" @click="addStatus=false;editStatus=false;">鍙栨秷 </el-button> - <el-button v-if="!addStatus && !editStatus" :disabled="nodeRow.childType === -1" icon="el-icon-close" plain size="small" type="danger" + <el-button v-if="!addStatus && !editStatus" :disabled="nodeRow.childType === -1" icon="el-icon-close" plain + size="small" type="danger" @click="delClickHandler">鍒犻櫎 </el-button> - <el-button v-if="!addStatus && !editStatus" icon="el-icon-upload2" plain size="small" type="primary" @click="sqlClickExportClick">瀵煎嚭sql + <el-button v-if="!addStatus && !editStatus" icon="el-icon-upload2" plain size="small" type="primary" + @click="sqlClickExportClick">瀵煎嚭sql </el-button> </div> <el-form ref="form" :model="form" label-width="85px" style="max-height: calc(100vh - 180px);overflow: auto;"> @@ -51,7 +55,8 @@ <el-input v-model="form.alias" :disabled="!editStatus && !addStatus" placeholder="璇疯緭鍏ュ埆鍚�"></el-input> </el-form-item> <el-form-item label="椤哄簭锛�"> - <el-input-number v-model="form.sort" :disabled="!editStatus && !addStatus" :min="0" :max="9999" label="椤哄簭"></el-input-number> + <el-input-number v-model="form.sort" :disabled="!editStatus && !addStatus" :max="9999" :min="0" + label="椤哄簭"></el-input-number> </el-form-item> <el-form-item label="鎻忚堪锛�"> <el-input v-model="form.remark" :disabled="!editStatus && !addStatus" placeholder="璇疯緭鍏ユ弿杩�"></el-input> @@ -65,18 +70,18 @@ <script> //绠$悊鍔熻兘妯″潡 import {exportFunctionSql, getSysModelTreeMenuByPID} from "@/api/systemModel/mangeModel/api" -import {addOperationType,updateOperationType,delOperationType} from "@/api/systemModel/operateType/api" +import {addOperationType, updateOperationType, delOperationType} from "@/api/systemModel/operateType/api" import func from "@/util/func"; export default { name: "index", data() { return { - refresh:Math.random(), - editStatus:false, + refresh: Math.random(), + editStatus: false, addStatus: false, nodeRow: {}, - currentClickNode:null, + currentClickNode: {}, form: {}, treeData: [], treeOption: { @@ -111,15 +116,13 @@ }, created() { }, - computed: { - }, + computed: {}, methods: { // 鏍戣鐐瑰嚮 - nodeClick(row,node) { - console.log(row); + nodeClick(row, node) { this.form = {...row}; this.nodeRow = {...row}; - this.currentClickNode=node; + this.currentClickNode = node; this.addStatus = false; this.editStatus = false; }, @@ -169,29 +172,29 @@ } this.form.parentId = this.nodeRow.id; const params = { - name:this.form.name, - identify:this.form.code, - alias:this.form.alias, - desc:this.form.remark, - seq:this.form.sort + name: this.form.name, + identify: this.form.code, + alias: this.form.alias, + desc: this.form.remark, + seq: this.form.sort } addOperationType(params).then(res => { - if(res.data.code === 200){ + if (res.data.code === 200) { this.$message.success(res.data.msg); - this.handleRefreshTree('add') + this.handleRefreshTree('add'); this.addStatus = false; } }) }, // 淇敼鎸夐挳 - editClickHandler(){ + editClickHandler() { this.addStatus = false; this.editStatus = true; }, // 淇敼淇濆瓨 - editSaveClickHandler(){ + editSaveClickHandler() { console.log(this.form); if (!this.form.name) { this.$message.error('鍚嶇О涓嶈兘涓虹┖'); @@ -205,9 +208,9 @@ this.$message.error('鍒悕涓嶈兘涓虹┖'); return } - if (!this.form.sort) { + if (this.form.sort == null || this.form.sort === '' || this.form.sort === undefined) { this.$message.error('椤哄簭涓嶈兘涓虹┖'); - return + return; } if (this.form.name.length > 128) { this.$message.error('鍚嶇О闀垮害涓嶈兘瓒呰繃128锛�'); @@ -220,26 +223,27 @@ if (this.form.alias && this.form.alias.length > 255) { this.$message.error('鍒悕闀垮害涓嶈兘瓒呰繃255锛�'); return - }; + } + ; const params = { - id:this.form.id, - name:this.form.name, - identify:this.form.code, - alias:this.form.alias, - desc:this.form.remark, - seq:this.form.sort + id: this.form.id, + name: this.form.name, + identify: this.form.code, + alias: this.form.alias, + desc: this.form.remark, + seq: this.form.sort } updateOperationType(params).then(res => { - if(res.data.code === 200){ + if (res.data.code === 200) { this.$message.success(res.data.msg); - this.handleRefreshTree('edit') + this.handleRefreshTree('edit'); this.editStatus = false; } }) }, // 鍒犻櫎 - delClickHandler(){ + delClickHandler() { this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', @@ -271,17 +275,21 @@ }, handleRefreshTree(type) { //type:add\edit\del - if(type=="del"){ + if (type == "del") { this.$refs.tree.remove(this.currentClickNode); - this.currentClickNode=null; - this.form={}; - }else{ + this.currentClickNode = null; + this.form = {}; + } else { if (this.currentClickNode) { let node = this.currentClickNode.parent; node.loaded = false; node.expand(); - this.$refs.tree.setCurrentNode(this.currentClickNode); - }else { + if (type === 'edit') { + this.$refs.tree.setCurrentKey(null); + } else { + this.$refs.tree.setCurrentNode(this.nodeRow); + } + } else { this.refresh = Math.random(); // 鍒锋柊宸︿晶鏍� } } @@ -299,7 +307,7 @@ .btnBox { display: flex; - justify-content:left; + justify-content: left; margin-bottom: 15px; } </style> diff --git a/Source/plt-web/plt-web-ui/src/views/wel/homeConfig.vue b/Source/plt-web/plt-web-ui/src/views/wel/homeConfig.vue new file mode 100644 index 0000000..d7efc03 --- /dev/null +++ b/Source/plt-web/plt-web-ui/src/views/wel/homeConfig.vue @@ -0,0 +1,293 @@ +<template> + <basic-container> + <avue-crud + ref="useCrud" + :data="data" + :option="option" + :page.sync="page" + :table-loading="loading" + @selection-change="selectChange" + @row-click="rowClickHandler" + @refresh-change="handleRefresh" + @size-change="sizeChange" + @current-change="currentChange" + > + <template slot="menuLeft"> + <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓 + </el-button> + <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎 + </el-button> + </template> + + <template slot="menu" slot-scope="{row,index}"> + <el-button icon="el-icon-edit" plain size="small" type="text" @click="editClickHandler(row)">淇敼 + </el-button> + <el-button icon="el-icon-delete" plain size="small" type="text" @click="delRowClickHandler(row)">鍒犻櫎 + </el-button> + </template> + </avue-crud> + + <!-- 鏂板 淇敼 --> + <el-dialog + v-dialogDrag + :title="dialogTitle === 'add' ? '鍒涘缓' : '淇敼'" + :visible.sync="visible" + append-to-body="true" + class="avue-dialog" + width="500px" + @close="visibleCloseHandler" + > + <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small"> + <el-row> + <el-col :span="24"> + <el-form-item label="鍚嶇О锛�" prop="id"> + <el-input v-model="form.id"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鏍囩锛�" prop="name"> + <el-input v-model="form.name"></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鍥炬爣锛�" prop="icon"> + <avue-input-icon v-model="form.icon" :icon-list="iconList" placeholder="璇烽�夋嫨鍥炬爣"> + </avue-input-icon> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鎻忚堪锛�" prop="description"> + <el-input v-model="form.description" :rows="2" type="textarea"></el-input> + </el-form-item> + </el-col> + </el-row> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button> + <el-button @click="visibleCloseHandler">鍙� 娑�</el-button> + </span> + </el-dialog> + </basic-container> +</template> + +<script> +import iconList from "@/config/iconList"; +import basicOption from "@/util/basic-option"; +import {addSave, deleteStatus, editSave, gridStatus} from "@/api/modeling/statusPool/api"; +import func from "@/util/func"; + +export default { + name: "homeConfig", + data() { + return { + iconList: iconList, + loading: false, + data: [], + option: { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + calcHeight: -60, + column: [ + { + label: '鍚嶇О', + prop: 'id', + sortable: true, + }, + { + label: '鍥炬爣', + prop: 'icon' + }, + { + label: '鏍囩', + prop: 'name', + sortable: true, + }, + { + label: '鎻忚堪', + prop: 'description', + }, + ] + }, + dialogTitle: '', + form: { + id: "", + name: "", + description: "" + }, + rules: { + id: [ + {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'}, + ] + }, + visible: false, + selectList: [], + lastIndex: null, + page: { + currentPage: 1, + pageSize: 15, + total: 0, + pageSizes: [15, 30, 50, 100], + }, + } + }, + created() { + this.getList(); + }, + methods: { + getList() { + gridStatus(this.page.currentPage, this.page.pageSize).then(res => { + const data = res.data.data; + this.data = data; + this.page.total = res.data.total; + this.loading = false; + }).catch(err => { + this.$message.error(err); + }); + }, + + // 琛ㄦ牸鍒锋柊 + handleRefresh() { + this.getList(); + }, + + // 琛ㄦ牸澶氶�� + selectChange(row) { + this.selectList = row; + }, + + // 鏉℃暟 + sizeChange(val) { + this.page.pageSize = val; + this.getList(); + }, + + // 椤电爜 + currentChange(val) { + this.page.currentPage = val; + this.getList(); + }, + + // 琛屽崟閫� + rowClickHandler(row) { + func.rowClickHandler( + row, + this.$refs.useCrud, + this.lastIndex, + (newIndex) => { + this.lastIndex = newIndex; + }, + () => { + this.selectList = []; + } + ); + }, + + // 鍒涘缓鎸夐挳 + addClickHandler() { + this.visible = true; + this.dialogTitle = 'add'; + }, + + // 缂栬緫鎸夐挳 + editClickHandler(row) { + this.visible = true; + this.dialogTitle = 'edit'; + this.form = {...row}; + }, + + // 鍒犻櫎 + delClickHandler() { + if (this.selectList.length <= 0) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.loading = true; + deleteStatus(this.selectList).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getList(); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + + // 琛屽崟涓垹闄� + delRowClickHandler(row) { + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const list = [row]; + this.loading = true; + deleteStatus(list).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getList(); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + + // 鍏抽棴瀵硅瘽妗� + visibleCloseHandler() { + const form = { + id: "", + name: "", + imagePath: "", + description: "" + } + this.form = form; + this.visible = false; + this.$refs.form.clearValidate(); + }, + + // 鍒涘缓鎴栫紪杈戜繚瀛� + addSaveHandler() { + const saveFunction = this.dialogTitle === 'add' ? addSave : editSave; + this.$refs.form.validate((valid) => { + if (valid) { + saveFunction(this.form).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.loading = true; + this.getList(); + this.visible = false; + } else { + this.$message.error(res.data.obj); + } + }) + } else { + return false; + } + }); + }, + } +} +</script> + +<style lang="scss" scoped> +::v-deep { + .el-scrollbar__wrap { + overflow: auto !important; + } + +} +</style> -- Gitblit v1.9.3