From 247aa6397ebdb5249a1213af11aaaf560568b0c3 Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期五, 02 八月 2024 15:43:50 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/statusPool/index.vue | 311 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 298 insertions(+), 13 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 e1499f1..424bdb9 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 @@ -5,24 +5,25 @@ <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">鍒涘缓 + <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">淇敼 + <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">鍒犻櫎 + <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">瀵煎嚭 + <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">瀵煎叆 + <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">鏌ョ湅 + <el-button plain size="small" style="width: 100px;text-align: center" 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> + <span style="font-size: 15px"> <i class="el-icon-s-promotion"></i> {{ (node || {}).label }} </span> @@ -35,21 +36,153 @@ <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> </basic-container> </el-main> + + <!-- 鏂板 淇敼 --> + <el-dialog + v-dialogDrag + :title="dialogTitle === 'add' ? '鍒涘缓' : '淇敼'" + :visible.sync="visible" + append-to-body="true" + class="avue-dialog" + width="40%" + @close="visibleCloseHandler" + > + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <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="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 @click="visibleCloseHandler">鍙� 娑�</el-button> + <el-button type="primary" @click="addSaveHandler">纭� 瀹�</el-button> + </span> + </el-dialog> + + <!-- 瀵煎叆 --> + <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆" + @updata="getTreeList"></upload-file> + + <!-- 鏌ョ湅浣跨敤鑼冨洿 --> + <el-dialog + v-dialogDrag + :visible.sync="checkViewVisible" + append-to-body="true" + class="avue-dialog" + title="鏌ョ湅浣跨敤鑼冨洿" + width="60%" + > + <avue-crud + ref="checkViewCrud" + :data="checkViewData" + :option="checkViewOption" + :table-loading="checkViewLoading" + @search-change="checkHandleSearch" + @search-reset="checkHandleReset" + > + </avue-crud> + </el-dialog> </el-container> </template> <script> -import {gridStatus} from "@/api/modeling/statusPool/api"; +import {gridStatus, addSave, editSave, deleteStatus, exportStatus, listUsed} from "@/api/modeling/statusPool/api"; +import func from "@/util/func"; +import basicOption from "@/util/basic-option"; export default { name: "index", data() { return { + checkViewVisible: false, + checkViewData: [], + checkViewDataSearch: [], + checkViewLoading: false, + checkViewOption: { + ...basicOption, + addBtn: false, + menu: false, + searchMenuSpan: 8, + refreshBtn: false, + selection: false, + column: [ + { + label: '鍚嶇О', + prop: 'TreeId', + sortable: true, + }, + { + label: '鏉ユ簮', + prop: 'name', + sortable: true, + search: true + }, + { + label: '璇存槑', + prop: 'description', + } + ] + }, + tipList: [ + "璇锋敞鎰忓悕绉颁笉鑳戒负绌�", + ], + upFileType: ['xls', 'xlsx'], + fileUrl: 'api/statusController/importStatus', + dialogTitle: '', + form: { + id: "", + name: "", + description: "" + }, + rules: { + id: [ + {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'}, + ] + }, + visible: false, treeOption: { height: 'auto', defaultExpandAll: false, @@ -62,25 +195,173 @@ } }, treeData: [], - nodeRow:{} + 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' + }, } }, created() { this.getTreeList(); }, methods: { + // 宸︿晶鏍戣姹� getTreeList() { - gridStatus().then(res => { + gridStatus({page: 1, limit: -1}).then(res => { const data = res.data.data; this.treeData = data; - this.tableLoading = false; }).catch(err => { this.$message.error(err) }); }, + + // 鏍戣妭鐐圭偣鍑讳簨浠� nodeClick(row) { this.nodeRow = row; - } + }, + + // 鍒涘缓鎸夐挳 + addClickHandler() { + this.visible = true; + this.dialogTitle = 'add'; + }, + + // 缂栬緫鎸夐挳 + editClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + this.visible = true; + this.dialogTitle = 'edit'; + this.form = this.nodeRow; + }, + + // 鍒犻櫎 + delClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const list = [this.nodeRow]; + deleteStatus(list).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTreeList(); + this.nodeRow = {}; + } + }) + }).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; + + saveFunction(this.form).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTreeList(); + this.visible = false; + } else { + this.$message.error(res.data.obj); + } + }).catch(error => { + this.$message.error(error); + }); + }, + + // 瀵煎嚭 + exportClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + + exportStatus({statusOids: this.nodeRow.oid}).then(res => { + func.downloadFileByBlobHandler(res); + this.$message.success('瀵煎嚭鎴愬姛'); + }).catch(err => { + this.$message.error(err); + }) + }, + + // 瀵煎叆 + uploadClickHandler() { + this.$refs.upload.visible = true; + }, + + // 鏌ョ湅浣跨敤鑼冨洿 + checkViewClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + listUsed({oid: this.nodeRow.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; + }) + this.checkViewData = res.data.data; + this.checkViewDataSearch = res.data.data; + } + }) + }, + // 鏌ョ湅浣跨敤鑼冨洿鏌ヨ + checkHandleSearch(params, done) { + const {name} = params; + + if (!params.name) { + this.checkViewData = this.checkViewDataSearch; + return done(); + } + ; + + this.checkViewData = this.checkViewData.filter(item => { + return item.name && item.name.includes(name); + }); + + done(); + + }, + + // 鏌ョ湅浣跨敤鑼冨洿閲嶇疆 + checkHandleReset() { + this.checkViewData = this.checkViewDataSearch; + }, + } } </script> @@ -113,4 +394,8 @@ .headerCon > .el-button:nth-child(7) { margin-left: 0; } + +.upload-demo { + margin-left: 20px; +} </style> -- Gitblit v1.9.3