From 556a06bbd866af3ef2dde46dce3f587ec58c3ca9 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期二, 26 十一月 2024 12:09:25 +0800 Subject: [PATCH] 流程类型管理 --- src/views/projectEngineering/projectLibrary/index.vue | 146 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 100 insertions(+), 46 deletions(-) diff --git a/src/views/projectEngineering/projectLibrary/index.vue b/src/views/projectEngineering/projectLibrary/index.vue index 96a5ae0..ccce580 100644 --- a/src/views/projectEngineering/projectLibrary/index.vue +++ b/src/views/projectEngineering/projectLibrary/index.vue @@ -166,75 +166,76 @@ <svg-icon icon-class="exportIcon" style="margin-right: 8px"/> 瀵煎嚭鏁版嵁 </el-button> - <el-button :disabled="isReserve" @click="handleImport" size="small"> + <el-button :disabled="!isReserve" @click="handleImport" size="small"> <svg-icon icon-class="importIcon" style="margin-right: 8px"/> 瀵煎叆鏁版嵁 </el-button> </div> <div class="add-btn"> <el-tooltip content="鏂板" effect="dark" placement="top"> - <el-button :disabled="isReserve" circle icon="el-icon-plus" @click="add()" size="small"/> + <el-button :disabled="!isReserve" circle icon="el-icon-plus" @click="add()" size="small"/> </el-tooltip> </div> <VisibilityToolbar v-model:showSearch="showSearch" - :columns="columns" + :columns="defaultColumns" @queryTable="handleQuery" + @update:sort="handleUpdateSort" + @update:columns="handleUpdateColumns" + @update:resetSort="handleResetSort" ></VisibilityToolbar> - <!-- @update:columns="handleUpdateColumns"--> - <!-- @update:sort="handleUpdateSort"--> - <!-- @update:resetSort="handleResetSort"--> </div> </div> </el-form> <el-table + :key="tableKey" + ref="elTable" style="margin-top: 20px" v-loading="loading" :data="projectInfoList" @selection-change="handleSelectionChange" height="60vh" + sortable="custom" :show-overflow-tooltip="true"> <el-table-column type="selection" width="55" align="center"/> - <!-- 鍔ㄦ�佸垪 --> - <template v-for="item in columns"> - <el-table-column - v-if="item.visible" - :prop="item.id" - :label="item.label" - v-bind="item" - :min-width="item.minWidth" - > - <template slot-scope="scope"> - <!-- 浣跨敤鍏峰悕鎻掓Ы --> - <template v-if="item.slotName"> - <!-- projectStatus鎻掓Ы --> - <template v-if="item.slotName === 'projectStatus'"> - <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text> - </template> - <!-- projectColorCode鎻掓Ы --> - <template v-if="item.slotName === 'projectColorCode'"> - <el-text class="mx-1 has-dot">{{ '鑷畾涔夋牱寮�' }}<span class="dot" style="margin-left: 5px"></span></el-text> - </template> - <!-- projectType鎻掓Ы --> - <template v-if="item.slotName === 'projectType'"> - <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text> - </template> - <!-- investType鎻掓Ы --> - <template v-if="item.slotName === 'investType'"> - <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text> - </template> - <!-- planStartTime鎻掓Ы --> - <template v-if="item.slotName === 'planStartTime'"> - {{ '鑷畾涔夋牱寮�' }} - </template> + <el-table-column + v-for="item in columns" + :key="item.id" + v-if="item.visible" + :prop="item.id" + :label="item.label" + :min-width="item.minWidth" + > + <template slot-scope="scope"> + <!-- 浣跨敤鍏峰悕鎻掓Ы --> + <template v-if="item.slotName"> + <!-- projectStatus鎻掓Ы --> + <template v-if="item.slotName === 'projectStatus'"> + <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text> </template> - <!-- 榛樿鏄剧ず --> - <span v-else>{{ scope.row[item.id] }}</span> + <!-- projectColorCode鎻掓Ы --> + <template v-if="item.slotName === 'projectColorCode'"> + <el-text class="mx-1 has-dot">{{ '鑷畾涔夋牱寮�' }}<span class="dot" style="margin-left: 5px"></span></el-text> + </template> + <!-- projectType鎻掓Ы --> + <template v-if="item.slotName === 'projectType'"> + <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text> + </template> + <!-- investType鎻掓Ы --> + <template v-if="item.slotName === 'investType'"> + <el-text class="mx-1">{{ '鑷畾涔夋牱寮�' }}</el-text> + </template> + <!-- planStartTime鎻掓Ы --> + <template v-if="item.slotName === 'planStartTime'"> + {{ '鑷畾涔夋牱寮�' }} + </template> </template> - </el-table-column> - </template> + <!-- 榛樿鏄剧ず --> + <span v-else>{{ scope.row[item.id] }}</span> + </template> + </el-table-column> <!-- 鎿嶄綔鍒� --> <el-table-column label="鎿嶄綔" width="140" align="center" > @@ -247,6 +248,7 @@ > </el-button> <el-button + v-if="isReserve" size="medium" type="text" icon="el-icon-edit" @@ -254,6 +256,7 @@ > </el-button> <el-button + v-if="isReserve" size="medium" type="text" icon="el-icon-delete" @@ -283,7 +286,7 @@ <script> import {listInfo, getInfo, delInfo, addInfo, updateInfo} from "@/api/projectInfo"; -import {current} from './list'; +import {current, currentRest} from './list'; import FileDialog from '../component/FileDialog'; export default { @@ -297,8 +300,11 @@ fileDialogVisible: false, //鏄惁闇�瑕佹柊澧炴寜閽�(鍌ㄨ搫椤圭洰闇�瑕�) isReserve: false, + //椤圭洰鐘舵�佺瓫閫夋潯浠� + isProjectCategory: false, //琛ㄥご columns: [], + defaultColumns: [], //鎺у埗鏇村绛涢�夋樉闅� popoverValue: false, // 閬僵灞� @@ -318,6 +324,7 @@ // 寮瑰嚭灞傛爣棰� title: "", // 鏄惁鏄剧ず寮瑰嚭灞� + tableKey: 0, open: false, timeRange: [], // 鏌ヨ鍙傛暟 @@ -347,21 +354,69 @@ {required: true, message: "椤圭洰鍚嶇О涓嶈兘涓虹┖", trigger: "blur"} ], projectStatus: [ - {required: true, message: "椤圭洰鐘舵�� (0鏈紑宸ワ紝1宸插紑宸ワ紝2宸茬宸ワ紝3鏆傚仠)涓嶈兘涓虹┖", trigger: "change"} + {required: true, message: "椤圭洰鐘舵�佷笉鑳戒负绌�", trigger: "change"} ], } }; }, created() { - this.columns = current.map((item, index) => { + const projectCategory = this.$route.query.projectCategory; + if(!projectCategory || projectCategory === '1'){ + this.isReserve = true; + } + if(projectCategory){ + this.isProjectCategory = true; + } + const columns = current.map((item, index) => { item.index = index + 1; item.key = index; item.serialNumber = index + 1; return item; }); + this.columns = columns; + this.defaultColumns = JSON.parse(JSON.stringify(columns)); this.getList(); }, methods: { + // 閲嶇疆鎺掑簭鐨勬柟娉� + handleResetSort() { + this.defaultColumns = currentRest.map((item, index) => { + item.index = index + 1; + item.key = index; + item.serialNumber = index + 1 + return item; + }); + this.columns = currentRest.map((item, index) => { + item.index = index + 1; + item.key = index; + item.serialNumber = index + 1 + return item; + }); + }, + // 鏇存柊鍒楃殑鏂规硶 + handleUpdateColumns(row) { + // this.currentColumns = row; + this.columns = this.columns.map(item => { + if (item.key === row.key) { + return row; + } + return item; + }); + }, + handleUpdateSort(row) { + console.log( this.columns, '鎺掑簭鍓嶇殑鍒�'); + this.columns = this.columns.map(item => { + if (item.key === row.key) { + return row; + } + return item; + }); + this.defaultColumns = JSON.parse(JSON.stringify(this.columns)).sort((a, b) => a.index - b.index); + this.columns.sort((a, b) => a.serialNumber - b.serialNumber); + //寮哄埗table娓叉煋 + this.tableKey = this.tableKey +1; + console.log( this.columns, '鎺掑簭鍚庣殑鍒�'); + }, // 鍏抽棴鏂囦欢澶勭悊寮规鐨勬柟娉� fileDialogCancel() { this.tableLoading = true; @@ -379,7 +434,6 @@ /** 鏌ヨ椤圭洰绠$悊鍩虹淇℃伅鍒楄〃 */ getList() { this.loading = true; - console.log("鏌ヨ") listInfo(this.queryParams).then(response => { this.projectInfoList = response.data; this.total = response.total; -- Gitblit v1.8.0