From 322b236f53f9aa8e12c6e019c861e2ea1bc4ab16 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 27 九月 2024 11:27:05 +0800 Subject: [PATCH] 整合代码 --- Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue | 261 +++++++++++++++++++++++++-------------------------- 1 files changed, 127 insertions(+), 134 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue index 5e6ad14..cfbe5d6 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/versioning/index.vue @@ -1,109 +1,30 @@ <template> - <el-container> - <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 - 260px);"> - <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> - - <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.jump"></i> - 璺宠穬瀛楃 - </template> - <el-tag v-if="nodeRow.jumpCharacter">{{ nodeRow.jumpCharacter }}</el-tag> - </el-descriptions-item> - <el-descriptions-item :contentStyle="descriptionOption.contentStyle" - :labelStyle="descriptionOption.labelStyle"> - <template slot="label"> - <i :class="icons.init"></i> - 鍒濆鍊� - </template> - <el-tag v-if="nodeRow.initialValue">{{ nodeRow.initialValue }}</el-tag> - </el-descriptions-item> - <el-descriptions-item :contentStyle="descriptionOption.contentStyle" - :labelStyle="descriptionOption.labelStyle"> - <template slot="label"> - <i :class="icons.length"></i> - 姝ラ暱 - </template> - <el-tag v-if="nodeRow.stepLength">{{ nodeRow.stepLength }}</el-tag> - </el-descriptions-item> - <el-descriptions-item :contentStyle="descriptionOption.contentStyle" - :labelStyle="descriptionOption.labelStyle"> - <template slot="label"> - <i :class="icons.left"></i> - 鍓嶇紑 - </template> - <el-tag v-if="nodeRow.prefixion">{{ nodeRow.prefixion }}</el-tag> - </el-descriptions-item> - <el-descriptions-item :contentStyle="descriptionOption.contentStyle" - :labelStyle="descriptionOption.labelStyle"> - <template slot="label"> - <i :class="icons.right"></i> - 鍚庣紑 - </template> - <el-tag v-if="nodeRow.suffix">{{ nodeRow.suffix }}</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> - </basic-container> - </el-main> - + <basic-container> + <avue-crud + ref="crud" + :data="data" + :option="option" + :table-loading="loading" + @refresh-change="getTableList" + @selection-change="selectChange" + @row-click="rowClickHandler"> + <template slot="menuLeft" slot-scope="scope"> + <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓</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-view" plain size="small" type="primary" + @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿 + </el-button> + </template> + <template slot="menu" slot-scope="scope"> + <el-button icon="el-icon-edit" size="small" type="text" @click="editClickHandler(scope.row)">缂栬緫 + </el-button> + <el-button icon="el-icon-delete" size="small" type="text" @click="delClickHandler(scope.row)">鍒犻櫎 + </el-button> + </template> + </avue-crud> <!-- 鏂板 淇敼 --> <el-dialog v-dialogDrag @@ -166,7 +87,7 @@ <!-- 瀵煎叆 --> <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆" - @updata="getTreeList"></upload-file> + @updata="getTableList"></upload-file> <!-- 鏌ョ湅浣跨敤鑼冨洿 --> <el-dialog @@ -187,7 +108,7 @@ > </avue-crud> </el-dialog> - </el-container> + </basic-container> </template> <script> @@ -206,6 +127,57 @@ name: "index", data() { return { + loading: false, + data: [], + option: { + ...basicOption, + addBtn: false, + editBtn: false, + delBtn: false, + calcHeight: -30, + column: [ + { + label: '鍚嶇О', + prop: 'id', + sortable: true, + }, + { + label: '鏍囩', + prop: 'name', + sortable: true, + }, + { + label: '璺宠穬瀛楃', + prop: 'jumpCharacter', + sortable: true, + }, + { + label: '鍒濆鍊�', + prop: 'initialValue', + sortable: true, + }, + { + label: '姝ラ暱', + prop: 'stepLength', + sortable: true, + }, + { + label: '鍓嶇紑', + prop: 'prefixion', + sortable: true, + }, + { + label: '鍚庣紑', + prop: 'suffix', + sortable: true, + }, + { + label: '鎻忚堪', + prop: 'description', + sortable: true, + }, + ] + }, checkViewVisible: false, checkViewData: [], checkViewDataSearch: [], @@ -296,25 +268,24 @@ right: 'el-icon-caret-right', desc: 'el-icon-chat-line-square' }, + selectList: [], + lastIndex: null, } }, created() { - this.getTreeList(); + this.getTableList(); }, methods: { // 宸︿晶鏍戞煡璇� - getTreeList() { + getTableList() { + this.loading = true; getVersionRuleAllList().then(res => { const data = res.data.data; - this.treeData = data; + this.data = data; + this.loading = false; }).catch(err => { this.$message.error(err) }); - }, - - // 宸︿晶鏍戣鐐瑰嚮 - nodeClick(row) { - this.nodeRow = row; }, // 鍒涘缓鎸夐挳 @@ -324,14 +295,10 @@ }, // 淇敼鎸夐挳 - editClickHandler() { - if (func.isEmptyObject(this.nodeRow)) { - this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); - return; - } + editClickHandler(row) { + this.form = {...row}; this.visible = true; this.dialogTitle = 'edit'; - this.form = this.nodeRow; }, // 鏂板淇敼瀵硅瘽妗嗗叧闂� @@ -359,7 +326,7 @@ saveFunction(this.form).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); - this.getTreeList(); + this.getTableList(); this.visible = false; } else { this.$message.error(res.data.obj); @@ -374,22 +341,17 @@ }, // 鍒犻櫎鎸夐挳 - delClickHandler() { - if (func.isEmptyObject(this.nodeRow)) { - this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); - return; - } + delClickHandler(row) { this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - const list = [this.nodeRow]; + const list = [row]; deleteVersionRule(list).then(res => { if (res.data.code === 200) { this.$message.success(res.data.obj); - this.getTreeList(); - this.nodeRow = {}; + this.getTableList(); } }) }).catch(() => { @@ -402,12 +364,17 @@ // 瀵煎嚭 exportClickHandler() { - if (func.isEmptyObject(this.nodeRow)) { + if (this.selectList.length <= 0) { this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); return; } - exportVersionRule({vrNames: this.nodeRow.id}).then(res => { + if (this.selectList.length > 1) { + this.$message.error('鍙兘閫夋嫨涓�鏉℃暟鎹紒'); + return; + } + + exportVersionRule({vrNames: this.selectList[0].id}).then(res => { func.downloadFileByBlobHandler(res); this.$message.success('瀵煎嚭鎴愬姛'); }).catch(err => { @@ -422,11 +389,16 @@ // 鏌ョ湅浣跨敤鑼冨洿 checkViewClickHandler() { - if (func.isEmptyObject(this.nodeRow)) { + if (this.selectList.length <= 0) { this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); return; } - getUsedVersionRuleList({vrName: this.nodeRow.id}).then(res => { + + if (this.selectList.length > 1) { + this.$message.error('鍙兘閫夋嫨涓�鏉℃暟鎹紒'); + return; + } + getUsedVersionRuleList({vrName: this.selectList[0].id}).then(res => { if (res.data.code === 200) { this.checkViewVisible = true; const data = res.data.data; @@ -458,6 +430,27 @@ checkHandleReset() { this.checkViewData = this.checkViewDataSearch; }, + + // 閫夋嫨妗� + selectChange(row) { + this.selectList = row; + }, + + // 鐐瑰嚮琛� + rowClickHandler(row) { + func.rowClickHandler( + row, + this.$refs.crud, + this.lastIndex, + (newIndex) => { + this.lastIndex = newIndex; + }, + () => { + this.selectList = []; + } + ); + }, + } } </script> -- Gitblit v1.9.3