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/modeling/versioning/index.vue | 492 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 489 insertions(+), 3 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 a042dbb..431e01c 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,13 +1,499 @@ <template> - <p>鐗堟湰绠$悊</p> + <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 v-if="permissionList.addBtn" class="button-custom-icon" plain size="small" type="primary" + @click="addClickHandler"> + <icon-show :name="permissionList.addBtn.source"></icon-show> + 鍒涘缓 + </el-button> + <el-button v-if="permissionList.viewTheScopeBtn" class="button-custom-icon" plain size="small" type="primary" + @click="checkViewClickHandler"> + <icon-show :name="permissionList.viewTheScopeBtn.source"></icon-show> + 鏌ョ湅浣跨敤鑼冨洿 + </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 slot="menu" slot-scope="{row,index}"> + <el-button v-if="permissionList.editBtn" size="small" type="text" + @click="editClickHandler(row)"> + <icon-show :name="permissionList.editBtn.source"></icon-show> + 缂栬緫 + </el-button> + <el-button v-if="permissionList.delBtn" size="small" type="text" @click="delClickHandler(row)"> + <icon-show :name="permissionList.delBtn.source"></icon-show> + 鍒犻櫎 + </el-button> + </template> + </avue-crud> + <!-- 鏂板 淇敼 --> + <el-dialog + v-dialogDrag + :title="dialogTitle === 'add' ? '鍒涘缓' : '淇敼'" + :visible.sync="visible" + append-to-body="true" + class="avue-dialog" + width="800px" + @close="visibleCloseHandler" + > + <el-form ref="form" :model="form" :rules="rules" label-width="95px" size="small"> + <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="12"> + <el-form-item label="鏍囩锛�" prop="name"> + <el-input v-model="form.name"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="璺宠穬瀛楃锛�" prop="jumpCharacter"> + <el-input v-model="form.jumpCharacter"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍒濆鍊硷細" prop="initialValue"> + <el-input v-model="form.initialValue"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="姝ラ暱锛�" prop="stepLength"> + <el-input-number v-model="form.stepLength" :max="9" :min="1" label="鎻忚堪鏂囧瓧"></el-input-number> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍓嶇紑锛�" prop="prefixion"> + <el-input v-model="form.prefixion"></el-input> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="鍚庣紑锛�" prop="suffix"> + <el-input v-model="form.suffix"></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 size="small" type="primary" @click="addSaveHandler">纭� 瀹�</el-button> + <el-button size="small" @click="visibleCloseHandler">鍙� 娑�</el-button> + </span> + </el-dialog> + + <!-- 瀵煎叆 --> + <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆" + @updata="getTableList"></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> + </basic-container> </template> <script> +import { + getVersionRuleAllList, + addVersionRule, + updateVersionRule, + deleteVersionRule, + exportVersionRule, + getUsedVersionRuleList +} from "@/api/modeling/version/api"; +import func from "@/util/func"; +import basicOption from "@/util/basic-option"; +import {mapGetters} from "vuex"; + export default { - name: "index" + 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: [], + checkViewLoading: false, + checkViewOption: { + ...basicOption, + addBtn: false, + menu: false, + searchMenuSpan: 8, + refreshBtn: false, + selection: false, + header: false, + column: [ + { + label: '鍚嶇О', + prop: 'versionRuleName', + sortable: true, + }, + { + label: '鏉ユ簮', + prop: 'source', + sortable: true, + search: true + }, + { + label: '璇存槑', + prop: 'description', + } + ] + }, + tipList: [ + "鍚嶇О涓嶈兘涓虹┖涓斿彧鑳借緭鍏ヨ嫳鏂囧瓧绗�", + "璺宠穬瀛楃鍙兘杈撳叆鏁板瓧鎴栧瓧姣嶏紝骞朵笖浠ヨ嫳鏂囬�楀彿鍒嗛殧", + "鍒濆鍊煎彧鑳借緭鍏ユ暟瀛椼�佸瓧姣嶆垨鑻辨枃绗﹀彿", + "姝ラ暱涓嶈兘涓虹┖涓斿繀椤讳负1-9鐨勬暣鏁�", + ], + upFileType: ['xls', 'xlsx'], + fileUrl: 'api/revisionRuleController/importVersionRules', + rules: { + id: [ + {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'}, + {pattern: /^[a-zA-Z]+$/, message: '鍙兘杈撳叆鑻辨枃瀛楃', trigger: 'blur'} + ], + initialValue: [ + {required: true, message: '璇疯緭鍏ュ垵濮嬪��', trigger: 'blur'}, + {pattern: /^[a-zA-Z0-9!@#$%^&*()_+{}\[\]:;"'<>,.?/\\|-]*$/, message: '鍙兘杈撳叆鏁板瓧銆佸瓧姣嶆垨鑻辨枃绗﹀彿', trigger: 'blur'} + ], + jumpCharacter: [ + {required: true, message: '璇疯緭鍏ヨ烦璺冨瓧绗�', trigger: 'blur'}, + {pattern: /^[a-zA-Z0-9]+(?:,[a-zA-Z0-9]+)*$/, message: '鍙兘杈撳叆鏁板瓧鎴栧瓧姣嶏紝骞朵笖浠ラ�楀彿鍒嗛殧', trigger: 'blur'} + ] + }, + form: { + id: '', + name: '', + jumpCharacter: '', + initialValue: '', + stepLength: 1, + prefixion: '', + suffix: '', + description: '' + }, + visible: false, + dialogTitle: '', + nodeRow: {}, + treeData: [], + treeOption: { + height: 'auto', + defaultExpandAll: false, + menu: false, + addBtn: false, + props: { + label: 'id', + value: 'id', + children: 'children' + } + }, + 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', + jump: 'el-icon-mouse', + init: 'el-icon-s-promotion', + length: 'el-icon-collection-tag', + left: 'el-icon-caret-left', + right: 'el-icon-caret-right', + desc: 'el-icon-chat-line-square' + }, + selectList: [], + lastIndex: null, + } + }, + computed: { + ...mapGetters(["permission"]), + permissionList() { + return { + addBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false), + delBtn: this.vaildData(this.permission[this.$route.query.id].DELETE, false), + 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), + viewTheScopeBtn: this.vaildData(this.permission[this.$route.query.id].SEARCH, false), + }; + }, + }, + created() { + this.getTableList(); + }, + methods: { + // 宸︿晶鏍戞煡璇� + getTableList() { + this.loading = true; + getVersionRuleAllList().then(res => { + const data = res.data.data; + this.data = data; + this.loading = false; + }).catch(err => { + this.$message.error(err) + }); + }, + + // 鍒涘缓鎸夐挳 + addClickHandler() { + this.dialogTitle = 'add'; + this.visible = true; + }, + + // 淇敼鎸夐挳 + editClickHandler(row) { + this.form = {...row}; + this.visible = true; + this.dialogTitle = 'edit'; + }, + + // 鏂板淇敼瀵硅瘽妗嗗叧闂� + visibleCloseHandler() { + const form = { + id: '', + name: '', + jumpCharacter: '', + initialValue: '', + stepLength: 1, + prefixion: '', + suffix: '', + description: '' + } + this.form = form; + this.visible = false; + this.$refs.form.clearValidate(); + }, + + // 鏂板 缂栬緫 淇濆瓨 + addSaveHandler() { + const saveFunction = this.dialogTitle === 'add' ? addVersionRule : updateVersionRule; + this.$refs.form.validate((valid) => { + if (valid) { + saveFunction(this.form).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTableList(); + this.visible = false; + } else { + this.$message.error(res.data.obj); + } + }).catch(error => { + this.$message.error(error); + }); + } else { + return false; + } + }); + }, + + // 鍒犻櫎鎸夐挳 + delClickHandler(row) { + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + const list = [row]; + deleteVersionRule(list).then(res => { + if (res.data.code === 200) { + this.$message.success(res.data.obj); + this.getTableList(); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + + // 瀵煎嚭 + exportClickHandler() { + if (this.selectList.length <= 0) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + + 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 => { + this.$message.error(err); + }) + }, + + // 瀵煎叆 + uploadClickHandler() { + this.$refs.upload.visible = true; + }, + + // 鏌ョ湅浣跨敤鑼冨洿 + checkViewClickHandler() { + if (this.selectList.length <= 0) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒'); + return; + } + + 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; + this.checkViewData = res.data.data; + this.checkViewDataSearch = res.data.data; + } + }) + }, + + // 鏌ョ湅浣跨敤鑼冨洿鏌ヨ + checkHandleSearch(params, done) { + const {source} = params; + + if (!params.source) { + this.checkViewData = this.checkViewDataSearch; + return done(); + } + + this.checkViewData = this.checkViewDataSearch.filter(item => { + return item.source && item.source.includes(source); + }); + + done(); + + }, + + // 鏌ョ湅浣跨敤鑼冨洿閲嶇疆 + 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 = [row]; + } + ); + }, + + } } </script> -<style scoped> +<style lang="scss" scoped> +::v-deep { + .el-scrollbar__wrap { + overflow: auto !important; + } + .el-input-number--small { + width: 100%; + } +} </style> -- Gitblit v1.9.3