From c7f555bb017d2c011c6cbe688208a82acaed3fa9 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期一, 12 八月 2024 14:52:39 +0800 Subject: [PATCH] 状态池修改为表格展示 --- Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue | 282 +++++++++++++++++++++++++++---------------------------- 1 files changed, 139 insertions(+), 143 deletions(-) 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 c1405f9..2e39321 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 @@ -1,73 +1,40 @@ <template> - <el-container> + <basic-container> + <avue-crud + ref="useCrud" + :table-loading="loading" + :data="data" + :option="option" + :page.sync="page" + @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> + <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭 + </el-button> + <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆 + </el-button> + <el-button icon="el-icon-check" plain size="small" type="primary" + @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿 + </el-button> + </template> - <el-aside> - <basic-container> - <div ref="TreeBox" style="height: calc(100vh - 144px);!important;"> - <div class="headerCon"> - <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓 - </el-button> - <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼 - </el-button> - <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎 - </el-button> - <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭 - </el-button> - <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆 - </el-button> - <el-button class="smallBtn" plain size="small" type="primary" - @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿 - </el-button> - </div> - <!-- 宸︿晶鏍� --> - <div style="height: calc(100vh - 280px);"> - <avue-tree :data="treeData" :option="treeOption" @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> - {{ (node || {}).label }} - </span> - </span> - </avue-tree> - </div> - </div> - </basic-container> - </el-aside> + <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> - <el-main> - <basic-container> - <el-descriptions :column="1" border class="margin-top" size="medium" title="灞炴�т俊鎭�"> - <el-descriptions-item :contentStyle="descriptionOption.contentStyle" - :labelStyle="descriptionOption.labelStyle"> - <template slot="label"> - <i :class="icons.id"></i> - 鍚嶇О - </template> - <el-tag v-if="nodeRow.id">{{ nodeRow.id }}</el-tag> - </el-descriptions-item> - <el-descriptions-item :contentStyle="descriptionOption.contentStyle" - :labelStyle="descriptionOption.labelStyle"> - <template slot="label"> - <i :class="icons.name"></i> - 鏍囩 - </template> - <el-tag v-if="nodeRow.name">{{ nodeRow.name }}</el-tag> - </el-descriptions-item> - <el-descriptions-item :contentStyle="descriptionOption.contentStyle" - :labelStyle="descriptionOption.labelStyle"> - <template slot="label"> - <i :class="icons.desc"></i> - 鎻忚堪 - </template> - <el-tag v-if="nodeRow.description">{{ nodeRow.description }}</el-tag> - </el-descriptions-item> - </el-descriptions> -<!-- <avue-crud>--> -<!-- :data="data"--> -<!-- :option="option"--> -<!-- </avue-crud>--> - </basic-container> - </el-main> + + </avue-crud> <!-- 鏂板 淇敼 --> <el-dialog @@ -127,8 +94,7 @@ > </avue-crud> </el-dialog> - - </el-container> + </basic-container> </template> @@ -141,9 +107,30 @@ name: "index", data() { return { - data:[], - option:{ - ...basicOption + loading:false, + data: [], + option: { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + calcHeight: -60, + column: [ + { + label: '鍚嶇О', + prop: 'id', + sortable: true, + }, + { + label: '鏍囩', + prop: 'name', + sortable: true, + }, + { + label: '鎻忚堪', + prop: 'description', + }, + ] }, checkViewVisible: false, checkViewData: [], @@ -191,27 +178,13 @@ ] }, visible: false, - treeOption: { - height: 'auto', - defaultExpandAll: false, - menu: false, - addBtn: false, - props: { - label: 'id', - value: 'id', - children: 'children' - } - }, - treeData: [], - nodeRow: {}, - descriptionOption: { - labelStyle: 'text-align:center;width:120px', - contentStyle: 'width:240px;text-align:center;word-break;break-all;' - }, - icons: { - id: 'el-icon-finished', - name: 'el-icon-tickets', - desc: 'el-icon-chat-line-square' + selectList:[], + lastIndex:null, + page: { + currentPage: 1, + pageSize: 15, + total: 0, + pageSizes: [15, 30, 50, 100], }, } }, @@ -221,17 +194,47 @@ methods: { // 宸︿晶鏍戣姹� getTreeList() { - gridStatus({page: 1, limit: -1}).then(res => { + gridStatus(this.page.currentPage, this.page.pageSize).then(res => { const data = res.data.data; - this.treeData = data; + this.data = data; + this.page.total = res.data.total; + this.loading = false; }).catch(err => { this.$message.error(err) }); }, - // 鏍戣妭鐐圭偣鍑讳簨浠� - nodeClick(row) { - this.nodeRow = row; + // 琛ㄦ牸鍒锋柊 + handleRefresh(){ + this.getTreeList(); + }, + + // 琛ㄦ牸澶氶�� + selectChange(row){ + this.selectList = row; + }, + + // 鏉℃暟 + sizeChange(val) { + this.page.pageSize = val; + this.getTreeList(); + }, + + // 椤电爜 + currentChange(val) { + this.page.currentPage = val; + this.getTreeList(); + }, + + // 琛屽崟閫� + rowClickHandler(row) { + func.rowClickHandler( + row, + this.$refs.useCrud, + this.lastIndex, + (newIndex) => { this.lastIndex = newIndex; }, + () => { this.selectList = []; } + ); }, // 鍒涘缓鎸夐挳 @@ -241,19 +244,15 @@ }, // 缂栬緫鎸夐挳 - editClickHandler() { - if (func.isEmptyObject(this.nodeRow)) { - this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); - return; - } + editClickHandler(row) { this.visible = true; this.dialogTitle = 'edit'; - this.form = this.nodeRow; + this.form = {...row}; }, // 鍒犻櫎 delClickHandler() { - if (func.isEmptyObject(this.nodeRow)) { + if (this.selectList.length <= 0) { this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); return; } @@ -262,12 +261,34 @@ cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - const list = [this.nodeRow]; + this.loading = true; + deleteStatus(this.selectList).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTreeList(); + } + }) + }).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.getTreeList(); - this.nodeRow = {}; } }) }).catch(() => { @@ -298,6 +319,7 @@ saveFunction(this.form).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); + this.loading = true; this.getTreeList(); this.visible = false; } else { @@ -310,12 +332,12 @@ // 瀵煎嚭 exportClickHandler() { - if (func.isEmptyObject(this.nodeRow)) { + if (this.selectList.length <= 0) { this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); return; } - exportStatus({statusOids: this.nodeRow.oid}).then(res => { + exportStatus({statusOids: this.selectList.map(item => item.oid).join(',')}).then(res => { func.downloadFileByBlobHandler(res); this.$message.success('瀵煎嚭鎴愬姛'); }).catch(err => { @@ -330,17 +352,22 @@ // 鏌ョ湅浣跨敤鑼冨洿 checkViewClickHandler() { - if (func.isEmptyObject(this.nodeRow)) { + if (this.selectList.length <= 0) { this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); return; } - listUsed({oid: this.nodeRow.oid}).then(res => { + + if (this.selectList.length > 1) { + this.$message.error('鍙兘閫夋嫨涓�鏉℃暟鎹紒'); + return; + } + listUsed({oid: this.selectList[0].oid}).then(res => { if (res.data.code === 200) { this.checkViewVisible = true; const data = res.data.data; data.forEach(item => { item.name = item.id + `( ${item.name} )`; - item.TreeId = this.nodeRow.id; + item.TreeId = this.selectList[0].oid; }) this.checkViewData = res.data.data; this.checkViewDataSearch = res.data.data; @@ -379,42 +406,11 @@ .el-scrollbar__wrap { overflow: auto !important; } - .headerCon{ - .el-button{ - width: 82px; - } - } -} -.headerCon { - display: flex; - flex-wrap: wrap; - margin-bottom: 5px; - - .el-button + .el-button { - margin-left: 5px; - } - - .el-button { - margin-top: 5px; - } -} - -.headerCon > .el-button:nth-child(4) { - margin-left: 0; -} - -.headerCon > .el-button:nth-child(7) { - margin-left: 0; } .upload-demo { margin-left: 20px; } -.smallBtn { - width: 82px; - text-align: center; - padding-left: 4.5px; -} </style> -- Gitblit v1.9.3