From 404966637eda6881a0f17683c5aacc7c1c34aed8 Mon Sep 17 00:00:00 2001 From: 田源 <tianyuan@vci-tech.com> Date: 星期四, 16 一月 2025 16:18:34 +0800 Subject: [PATCH] 增加操作类型 --- Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/Aciton/index.vue | 209 +++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 151 insertions(+), 58 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/Aciton/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/Aciton/index.vue index 19d7f72..712d6a3 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/Aciton/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/Aciton/index.vue @@ -12,7 +12,7 @@ @node-click="nodeClick"> <span slot-scope="{ node, data }" class="el-tree-node__label"> <span style="display: flex"> - <icon-show :name="data.icon"></icon-show> + <icon-show v-if="data.icon" :name="data.icon"></icon-show> {{ (node || {}).label }} </span> </span> @@ -22,33 +22,59 @@ </el-aside> <el-main> - <basic-container v-if="treeNodeRow.id === 'root' "> - <div class="headerCon"> - <el-button v-if="permissionList.addBtn" icon="el-icon-plus" plain size="small" type="primary" @click="addTreeClickHandler">鍒涘缓 - </el-button> - <!--<el-button v-if="permissionList.editBtn" icon="el-icon-edit" plain size="small" type="primary" @click="editTreeClickHandler">淇敼 - </el-button> - <el-button v-if="permissionList.delBtn" icon="el-icon-delete" plain size="small" type="danger" @click="delTreeClickHandler">鍒犻櫎 - </el-button>--> - <el-button v-if="permissionList.importBtn" icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆 - </el-button> - <el-button v-if="permissionList.exportBtn" icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭 - </el-button> - </div> + <basic-container v-show="treeNodeRow.id === 'root' "> <div> <avue-crud ref="treeCrud" v-model="treeForm" - :data="treeData[0].childs" + :data="treeData[0].children" :option="treeCrudOption" @row-del="rowTreeDelHandler" @row-save="rowTreeSaveHandler" @row-update="rowTreeUpdataHandler" @refresh-change="handleRefresh"> + <template slot="menuLeft"> + <el-button v-if="permissionList.addBtn" class="button-custom-icon" plain size="small" type="primary" + @click="addTreeClickHandler(treeNodeRow)"> + <icon-show :name="permissionList.addBtn.source"></icon-show> + 鍒涘缓 + </el-button> + <!--<el-button v-if="permissionList.editBtn" icon="el-icon-edit" plain size="small" type="primary" @click="editTreeClickHandler">淇敼 + </el-button> + <el-button v-if="permissionList.delBtn" icon="el-icon-delete" plain size="small" type="danger" @click="delTreeClickHandler">鍒犻櫎 + </el-button>--> + <el-button v-if="permissionList.importBtn" class="button-custom-icon" plain size="small" type="primary" @click="uploadClickHandler"> + <icon-show :name="permissionList.importBtn.source"></icon-show> + 瀵煎叆 + </el-button> + <el-button v-if="permissionList.exportBtn" class="button-custom-icon" plain size="small" type="primary" @click="exportClickHandler"> + <icon-show :name="permissionList.exportBtn.source"></icon-show> + 瀵煎嚭 + </el-button> + </template> + <template #menu="{ row, index, size }"> + <el-button v-if="permissionList.editBtn" size="small" type="text" + @click="$refs.treeCrud.rowEdit(row, index)"> + <icon-show :name="permissionList.editBtn.source"></icon-show> + 缂栬緫 + </el-button> + <el-button v-if="permissionList.delBtn" size="small" type="text" + @click.stop="rowTreeDelHandler(row,index)"> + <icon-show :name="permissionList.delBtn.source"></icon-show> + 鍒犻櫎 + </el-button> + <el-button v-if="permissionList.addBtn" :size="size" + text + type="text" + @click="addTreeClickHandler(row)"> + <icon-show :name="permissionList.addBtn.source"></icon-show> + 鏂板瀛愮骇 + </el-button> + </template> </avue-crud> </div> </basic-container> - <basic-container v-else> + <basic-container v-show="treeNodeRow.id !== 'root'"> <div> <avue-crud ref="crud" @@ -65,16 +91,40 @@ @refresh-change="handleRefresh" @selection-change="selectChangeHandler" @row-click="rowClickHandler"> + <template slot="plImage" slot-scope="{row}"> + <span class="avue-icon"> + <icon-show :name="row.plImage"></icon-show> + </span> + </template> + <template slot-scope="{type,disabled}" slot="plImageForm"> + <input-icon :disabled="disabled" v-model="form.plImage"></input-icon> + </template> <template slot="plTypeType" slot-scope="{row}"> <el-tag :type="row.plTypeType === 'business' ? '' : 'success'"> {{ row.plTypeType === 'business' ? '涓氬姟绫诲瀷' : '閾炬帴绫诲瀷' }} </el-tag> </template> <template slot="menuLeft" slot-scope="scope"> - <el-button v-if="treeNodeRow.id !== 'root' && permissionList.actionTopAddBtn" icon="el-icon-plus" plain size="small" type="primary" - @click="addClickHandler">澧炲姞 + <el-button v-if="treeNodeRow.id !== 'root' && permissionList.actionTopAddBtn" class="button-custom-icon" plain size="small" type="primary" + @click="addClickHandler"> + <icon-show :name="permissionList.actionTopAddBtn.source"></icon-show> + 澧炲姞 </el-button> - <el-button v-if="permissionList.actionTopExportBtn" icon="el-icon-download" plain size="small" type="success" @click="downLoadHandler">瀵煎嚭 + <el-button v-if="permissionList.actionTopExportBtn" class="button-custom-icon" plain size="small" type="success" @click="downLoadHandler"> + <icon-show :name="permissionList.actionTopExportBtn.source"></icon-show> + 瀵煎嚭 + </el-button> + </template> + <template #menu="{row,index,size}"> + <el-button v-if="permissionList.actionTopEditBtn" size="small" type="text" + @click="$refs.crud.rowEdit(row, index)"> + <icon-show :name="permissionList.actionTopEditBtn.source"></icon-show> + 缂栬緫 + </el-button> + <el-button v-if="permissionList.actionTopDelBtn" size="small" type="text" + @click.stop="rowDelHandler(row,index)"> + <icon-show :name="permissionList.actionTopDelBtn.source"></icon-show> + 鍒犻櫎 </el-button> </template> </avue-crud> @@ -92,7 +142,21 @@ @row-del="BottomRowDelHandler" > <template slot="menuLeft" slot-scope="scope"> - <el-button v-if="permissionList.actionBottomAddBtn" icon="el-icon-plus" plain size="small" type="primary" @click="bottomAddClickHandler">澧炲姞 + <el-button v-if="permissionList.actionBottomAddBtn" class="button-custom-icon" plain size="small" type="primary" @click="bottomAddClickHandler"> + <icon-show :name="permissionList.actionBottomAddBtn.source"></icon-show> + 澧炲姞 + </el-button> + </template> + <template #menu="{row,index,size}"> + <el-button v-if="permissionList.actionBottomEditBtn" size="small" type="text" + @click="$refs.BottomCrud.rowEdit(row, index)"> + <icon-show :name="permissionList.actionBottomEditBtn.source"></icon-show> + 缂栬緫 + </el-button> + <el-button v-if="permissionList.actionBottomDelBtn" size="small" type="text" + @click.stop="BottomRowDelHandler(row,index)"> + <icon-show :name="permissionList.actionBottomDelBtn.source"></icon-show> + 鍒犻櫎 </el-button> </template> <template slot="menuForm" slot-scope="scope"> @@ -174,7 +238,7 @@ props: { label: 'name', value: 'id', - children: 'childs' + children: 'children' } }, treeData: [] @@ -189,27 +253,30 @@ editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false), exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false), importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false), - actionTopAddBtn: this.vaildData(this.permission[this.$route.query.id].actionTopAdd, false), - actionTopDelBtn: this.vaildData(this.permission[this.$route.query.id].actionTopDel, false), - actionTopEditBtn: this.vaildData(this.permission[this.$route.query.id].actionTopEdit, false), - actionTopExportBtn: this.vaildData(this.permission[this.$route.query.id].actionTopExport, false), - actionBottomAddBtn: this.vaildData(this.permission[this.$route.query.id].actionBottomAdd, false), - actionBottomDelBtn: this.vaildData(this.permission[this.$route.query.id].actionBottomDel, false), - actionBottomEditBtn: this.vaildData(this.permission[this.$route.query.id].actionBottomEdit, false), + actionTopAddBtn: this.vaildData(this.permission[this.$route.query.id].ADD2, false), + actionTopDelBtn: this.vaildData(this.permission[this.$route.query.id].DELETE2, false), + actionTopEditBtn: this.vaildData(this.permission[this.$route.query.id].EDIT2, false), + actionTopExportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT2, false), + actionBottomAddBtn: this.vaildData(this.permission[this.$route.query.id].ADD3, false), + actionBottomDelBtn: this.vaildData(this.permission[this.$route.query.id].DELETE3, false), + actionBottomEditBtn: this.vaildData(this.permission[this.$route.query.id].EDIT3, false), }; }, treeCrudOption(){ return { ...basicOption, - editBtn: this.permissionList.editBtn, - delBtn: this.permissionList.delBtn, + editBtn: false, + delBtn: false, addBtn: false, calcHeight: -50, highlightCurrentRow: true, - menuWidth: 160, + rowKey: 'id', + rowParentKey: 'pid', + menuWidth: 300, span: 24, labelWidth: 100, dialogWidth: '800', + align:'left', column: [{ label: '鍒嗙被鍚嶇О', prop: 'name', @@ -229,11 +296,6 @@ }, { label: '鐖朵富绫�', prop: 'pidName', - formatter:function(row){ - if(row.pid=='root'){ - return 'Action鍒嗙被' - } - }, disabled: true, span: 24 }, { @@ -247,8 +309,8 @@ option() { return { ...basicOption, - editBtn:this.permissionList.actionTopEditBtn, - delBtn:this.permissionList.actionTopDelBtn, + editBtn:false, + delBtn:false, addBtn: false, height: 350, highlightCurrentRow: true, @@ -260,6 +322,7 @@ { label: '缂栧彿', prop: 'plCode', + width: 220, overHidden: true, search: true, rules: [ @@ -284,14 +347,26 @@ ] }, { + label: '鍥炬爣', + prop: 'plImage', + width: 80, + rules: [ + { + required: true, + message: '璇烽�夋嫨鍥炬爣', + trigger: 'submit' + } + ] + }, + { label: '鍒嗙被', prop: 'plActionCls', type: 'tree', - hide: true, + defaultExpandedKeys:['root'], props: { label: 'name', value: 'id', - children: 'childs' + children: 'children' }, rules: [ { @@ -302,13 +377,13 @@ ], dicData: [] }, - { + /*{ label: 'C/S绫昏矾寰�', prop: 'plCSClass', - search: true, + hide:true, searchLabelWidth:120, overHidden: true, - }, + },*/ { label: 'B/S閾炬帴鍦板潃', prop: 'plBSUrl', @@ -351,8 +426,8 @@ return { ...basicOption, addBtn: false, - editBtn:this.permissionList.actionBottomEditBtn, - delBtn:this.permissionList.actionBottomDelBtn, + editBtn:false, + delBtn:false, calcHeight: -20, selection: false, refreshBtn: false, @@ -396,19 +471,34 @@ } getActionTree(params).then(res => { const data = res.data.obj; - this.treeData = [data]; + this.treeData = this.treeDataFormAtter([data],'Action鍒嗙被'); const selectTreeData = this.option.column.find(item => item.prop === 'plActionCls'); // 鎵惧埌action娣诲姞鍒嗙被鏍� - const dicData=[data]; - dicData[0].disabled=true;//鏍硅妭鐐逛笉鑳介�� + const dicData=this.treeData; + dicData[0].disabled=true;//鍒嗙被鏍硅妭鐐逛笉鑳介�� selectTreeData.dicData = dicData; + selectTreeData.hide=true;//闅愯棌鍒嗙被鍒椼�備笉鑳界洿鎺ュ湪option璁剧疆锛屼細瀵煎嚭dicData鍔犺浇涓嶅嚭 }) + }, + + treeDataFormAtter(items,pidName) { + return items.map(item => { + // 杞崲褰撳墠鑺傜偣鐨勫睘鎬� + const formList = { + ...item, + pidName:pidName, + children: item.childs && item.childs.length > 0 ? this.treeDataFormAtter(item.childs,item.name) : undefined + }; + return formList; + }); }, // 宸︿晶鏍戣鐐瑰嚮 nodeClick(row) { this.treeNodeRow = row; - this.getRightTableList(row); - this.bottomData = []; + if(this.treeNodeRow.id !== 'root'){ + this.getRightTableList(row); + this.bottomData = []; + } }, // 澶撮儴鍒锋柊鎸夐挳 @@ -448,7 +538,7 @@ this.lastIndex = newIndex; }, () => { - this.selectList = []; + this.selectList = [row]; } ); @@ -488,13 +578,12 @@ beforeOpen(done, type, loading) { if ([ 'edit'].includes(type)) { // 缂栬緫閫昏緫 - this.$set(this.option.column[2],'disabled',false); + this.$set(this.option.column[3],'disabled',false); } else { // 鏂板閫昏緫 - this.$set(this.option.column[2],'disabled',true); + this.$set(this.option.column[3],'disabled',true); } done(); - console.log(this.option.column) }, // action鍒楄〃澧炲姞 addClickHandler() { @@ -675,16 +764,20 @@ }, // 宸︿晶鏍戝垱寤� - addTreeClickHandler() { - if (func.isEmptyObject(this.treeNodeRow)) { + addTreeClickHandler(row) { + let parentRow=row; + if(!row || !row.id){ + parentRow=this.treeNodeRow + } + if (func.isEmptyObject(parentRow)) { this.$message.error('璇烽�夋嫨涓�鏉″垎绫昏繘琛屾坊鍔�'); return; } - if (!this.treeNodeRow.id && this.treeNodeRow.name=='鏈垎绫�') { + if (!parentRow.id && parentRow.name=='鏈垎绫�') { this.$message.error('鏈垎绫讳笅涓嶈兘鍒涘缓瀛愬垎绫�'); return; } - const {createTime, creator, name, id, description} = this.treeNodeRow; + const {createTime, creator, name, id, description} = parentRow; this.$set(this.treeForm, 'createTime', func.formattedDate(createTime)); this.$set(this.treeForm, 'creator', creator); this.$set(this.treeForm, 'pid', id); -- Gitblit v1.9.3