From 39a6e2d4cbbc789955400ffd2352514a8fe4c188 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期一, 19 八月 2024 14:05:18 +0800 Subject: [PATCH] 整合代码 --- Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue | 995 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 963 insertions(+), 32 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue index 80ea9f4..48bc0df 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/linkType/index.vue @@ -1,33 +1,34 @@ <template> - <el-container> + <el-container v-loading="createViewLoading"> <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">鍒涘缓 + <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="deleteClickHandler">鍒犻櫎 </el-button> <el-button icon="el-icon-view" plain size="small" type="primary">鏌ョ湅 </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-circle-plus-outline" plain size="small" - type="primary">鍒涘缓瑙嗗浘 + <el-button class="smallBtn" icon="el-icon-circle-plus-outline" plain size="small" + style="padding-left: 7px !important;" + type="primary" @click="createViewClickHandler">鍒涘缓瑙嗗浘 </el-button> - <el-button icon="el-icon-menu" plain size="small" - type="primary">涓�鑷存�ф鏌� + <el-button class="smallBtn" icon="el-icon-menu" plain size="small" style="padding-left: 1px" + type="primary" @click="checkClickHandler">涓�鑷存�ф鏌� </el-button> </div> - <!-- 宸︿晶鏍� --> + <!-- 宸︿晶鏍� --> <div style="height: calc(100vh - 300px);"> <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> @@ -40,7 +41,7 @@ <el-main> <basic-container> - <div> + <div style="height: 380px"> <el-descriptions :column="2" border class="margin-top" size="medium"> <el-descriptions-item :contentStyle="descriptionOption.contentStyle" :labelStyle="descriptionOption.labelStyle"> @@ -72,7 +73,7 @@ <i :class="icons.domain"></i> 褰㈢姸 </template> - <el-tag v-if="nodeRow.shape" size="small"> + <el-tag v-if="nodeRow.shape"> {{ nodeRow.shape }} </el-tag> </el-descriptions-item> @@ -93,11 +94,13 @@ <i :class="icons.from"></i> From绔被鍨� </template> - <span v-for="item in nodeRow.btmItemsFrom" style="margin-left:2px;"> - <el-tag effect="plain" size="small" style="margin-top: 2px;"> + <div style="height: 60px;overflow-y: auto;display: flex;flex-wrap: wrap"> + <span v-for="item in nodeRow.btmItemsFrom" style="margin-left:3px;"> + <el-tag effect="plain" style="margin-top: 3px;"> {{ item }} </el-tag> - </span> + </span> + </div> </el-descriptions-item> <el-descriptions-item :contentStyle="descriptionOption.contentStyle" :labelStyle="descriptionOption.labelStyle"> @@ -105,7 +108,7 @@ <i :class="icons.from"></i> Form绔富绫诲瀷 </template> - <el-tag v-if="nodeRow.primitivesFrom" effect="plain" size="small"> + <el-tag v-if="nodeRow.primitivesFrom" effect="plain"> {{ nodeRow.primitivesFrom === '璇烽�夋嫨' ? nodeRow.btmItemsFrom[0] : nodeRow.primitivesFrom }} </el-tag> </el-descriptions-item> @@ -115,7 +118,7 @@ <i :class="icons.from"></i> From绔搴斿叧绯� </template> - <el-tag v-if="nodeRow.relationFrom" effect="plain" size="small">{{ nodeRow.relationFrom }}</el-tag> + <el-tag v-if="nodeRow.relationFrom" effect="plain">{{ nodeRow.relationFrom }}</el-tag> </el-descriptions-item> </el-descriptions> @@ -127,11 +130,13 @@ <i :class="icons.to"></i> To绔被鍨� </template> - <span v-for="item in nodeRow.btmItemsTo" style="margin-left:2px;"> - <el-tag effect="plain" size="small" style="margin-top: 2px;"> + <div style="height: 60px;overflow-y: auto;display: flex;flex-wrap: wrap"> + <span v-for="item in nodeRow.btmItemsTo" style="margin-left:2px;"> + <el-tag effect="plain" style="margin-top: 2px;"> {{ item }} - </el-tag> - </span> + </el-tag> + </span> + </div> </el-descriptions-item> <el-descriptions-item :contentStyle="descriptionOption.contentStyle" :labelStyle="descriptionOption.labelStyle"> @@ -139,7 +144,7 @@ <i :class="icons.to"></i> To绔富绫诲瀷 </template> - <el-tag v-if="nodeRow.primitivesTo" effect="plain" size="small"> + <el-tag v-if="nodeRow.primitivesTo" effect="plain"> {{ nodeRow.primitivesTo === '璇烽�夋嫨' ? nodeRow.btmItemsTo[0] : nodeRow.primitivesTo }} </el-tag> </el-descriptions-item> @@ -149,12 +154,12 @@ <i :class="icons.to"></i> To绔搴斿叧绯� </template> - <el-tag v-if="nodeRow.relationTo" effect="plain" size="small">{{ nodeRow.relationTo }}</el-tag> + <el-tag v-if="nodeRow.relationTo" effect="plain">{{ nodeRow.relationTo }}</el-tag> </el-descriptions-item> </el-descriptions> </div> - <div style="margin-top: 20px"> + <div style="margin-top: 30px"> <h3>灞炴�ф睜鍒楄〃</h3> <avue-crud :data="tableData" @@ -163,17 +168,442 @@ </div> </basic-container> </el-main> + + <!-- 鍒涘缓 && 缂栬緫 --> + <el-dialog + v-dialogDrag + :title="title === 'add' ? '鍒涘缓' : '淇敼'" + :visible.sync="visible" + append-to-body="true" + class="avue-dialog" + width="70%" + @close="addDialogClose" + > + <el-form ref="form" :model="form" :rules="rules" label-width="90px"> + <div class="dialogForm"> + <div class="leftForm"> + <el-form-item label="鍚嶇О锛�" prop="name"> + <el-input v-model="form.name" :readOnly="title === 'edit'"></el-input> + </el-form-item> + <el-form-item label="鏍囩锛�"> + <el-input v-model="form.tag"></el-input> + </el-form-item> + <el-form-item label="瀹炵幇绫伙細"> + <el-input v-model="form.implClass"></el-input> + </el-form-item> + <el-form-item label="褰㈢姸"> + <el-input v-model="form.shape"></el-input> + </el-form-item> + <el-form-item label="鎻忚堪"> + <el-input v-model="form.description" :rows="2" type="textarea"></el-input> + </el-form-item> + </div> + + <div class="centerForm"> + <el-form-item label="Form绔被鍨嬶細" label-width="110px"> + <div style="display: flex; align-items: center"> + <div style="height: 200px; width: 280px; border: 1px solid #bdbbbb;overflow-y: auto"> + <!-- 鍐呭 --> + <el-table + :data="bizFormData" + :show-header="false" + style="width: 100%"> + <el-table-column + align="center" + prop="name"> + </el-table-column> + <el-table-column + fixed="right" + label="鎿嶄綔" + width="60"> + <template slot-scope="scope"> + <el-button + size="small" + style="color:#F56C6C;" + type="text" + @click.native.prevent="bizTypeDeleteRow('form',scope.$index)"> + 绉婚櫎 + </el-button> + </template> + </el-table-column> + </el-table> + </div> + <el-button plain size="mini" style="margin-left: 5px" type="success" + @click="FormItemReferChange('form')">娣诲姞 + </el-button> + + </div> + </el-form-item> + <el-form-item label="瀵瑰簲鍏崇郴锛�" label-width="110px"> + <el-select v-model="form.relationFrom"> + <el-option label="N" value="N"></el-option> + <el-option label="1" value="1"></el-option> + </el-select> + </el-form-item> + <el-form-item label="涓荤被鍨嬶細" label-width="110px"> + <el-select v-model="form.primitivesFrom"> + <el-option v-for="(item,index) in bizFormData" :key="index" :label="item.name" + :value="item.name"></el-option> + </el-select> + </el-form-item> + </div> + + <div class="rightForm"> + <el-form-item label="To绔被鍨嬶細" label-width="110px"> + <div style="display: flex; align-items: center"> + <div style="height: 200px; width: 280px; border: 1px solid #bdbbbb;overflow-y: auto"> + <!-- 鍐呭 --> + <el-table + :data="bizToData" + :show-header="false" + style="width: 100%"> + <el-table-column + align="center" + prop="name"> + </el-table-column> + <el-table-column + fixed="right" + label="鎿嶄綔" + width="60"> + <template slot-scope="scope"> + <el-button + size="small" + style="color:#F56C6C;" + type="text" + @click.native.prevent="bizTypeDeleteRow('to',scope.$index)"> + 绉婚櫎 + </el-button> + </template> + </el-table-column> + </el-table> + </div> + <el-button plain size="mini" style="margin-left: 5px" type="success" + @click="FormItemReferChange('to')">娣诲姞 + </el-button> + + </div> + </el-form-item> + <el-form-item label="瀵瑰簲鍏崇郴锛�" label-width="110px"> + <el-select v-model="form.relationTo"> + <el-option label="N" value="N"></el-option> + <el-option label="1" value="1"></el-option> + </el-select> + </el-form-item> + <el-form-item label="涓荤被鍨嬶細" label-width="110px"> + <el-select v-model="form.primitivesTo"> + <el-option v-for="(item,index) in bizToData" :key="index" :label="item.name" + :value="item.name"></el-option> + </el-select> + </el-form-item> + </div> + </div> + </el-form> + + <div class="bottomForm"> + <h3>灞炴�ф睜鍒楄〃</h3> + <avue-crud + :data="dialogBottomData" + :option="dialogBottomOption" + @row-del="dialogBottomAttrDel" + > + <template slot="menuLeft" slot-scope="scope"> + <el-button icon="el-icon-plus" plain size="small" type="primary" @click="dialogAddClickHandler">澧� 鍔� + </el-button> + </template> + </avue-crud> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="addDialogClose">鍙� 娑�</el-button> + <el-button type="primary" @click="addDialogSavaHandler">纭� 瀹�</el-button> + </span> + + <!-- 灞炴�ф睜鍒楄〃 --> + <el-dialog + v-dialogDrag + :visible.sync="attrPollDialogVisible" + append-to-body="true" + class="avue-dialog" + title="灞炴�ф睜" + width="60%" + @close="dialogAttrClose" + > + <avue-crud + :key="dialogAttrReload" + ref="dialogAttrCrud" + :data="dialogAttrData" + :option="dialogAttrOption" + :page.sync="attrPage" + :table-loading="dialogAttrLoading" + @selection-change="dialogAttrSelectChange" + @row-click="dialogAttrRowClickHandler" + @size-change="attrSizeChange" + @current-change="attrCurrentChange" + @search-change="attrHandleSearch" + @search-reset="attrHandleReset" + > + </avue-crud> + <span slot="footer" class="dialog-footer"> + <el-button @click="dialogAttrClose">鍙� 娑�</el-button> + <el-button type="primary" @click="dialogAttrAddClickHandler">纭� 瀹�</el-button> + </span> + </el-dialog> + </el-dialog> + + <!-- 涓�鑷存�ф鏌� --> + <el-dialog + v-dialogDrag + :visible.sync="conCheckVisible" + append-to-body="true" + class="avue-dialog" + title="涓�鑷存�ф鏌�" + width="60%" + > + <avue-crud + :data="conCheckData" + :option="conCheckOption" + :table-loading="conCheckLoading"> + </avue-crud> + <span slot="footer" class="dialog-footer"> + <el-button @click="conCheckVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="repairClickHandler">淇� 澶�</el-button> + </span> + </el-dialog> + + <!-- form to 绔被鍨嬪璇濇琛ㄦ牸 --> + <el-dialog + v-dialogDrag + :title="bizTypeTitle === 'form' ? 'Form绔被鍨�' : 'To绔被鍨�'" + :visible.sync="bizTypeVisible" + append-to-body="true" + class="avue-dialog" + width="70%" + > + <avue-crud + :key="bizTypeReload" + ref="bizTypeCrud" + :data="bizTypeData" + :option="bizTypeOption" + :table-loading="bizTypeLoading" + @search-change="bizTypeHandleSearch" + @search-reset="bizTypeHandleReset" + @selection-change="bizTypeSelection" + @row-click="bizTypeRowClick"> + </avue-crud> + + <span slot="footer" class="dialog-footer"> + <el-button @click="bizTypeVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="bizTypeAddHandler">纭� 瀹�</el-button> + </span> + </el-dialog> + + <!-- 瀵煎叆 --> + <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆" + @updata="getTreeList"></upload-file> </el-container> </template> <script> -import {gridLink} from "@/api/modeling/linkType/api"; +import { + gridLink, + getByAttributeNames, + checkLinkType, + createView, + getBizTypes, + addAndEditLink, + expData, + repairTable, + deleteLink +} from "@/api/modeling/linkType/api"; import basicOption from '@/util/basic-option' +import {gridAttribute} from "@/api/modeling/attributePool/api"; +import func from "@/util/func"; export default { name: "index", data() { return { + tipList: [ + "瀵煎叆閾炬帴鍚嶇О涓嶅彲涓虹┖涓旈摼鎺ョ被鍨嬪悕绉板彧鑳戒负鑻辨枃瀛楁瘝", + "瀵煎叆鐨勬枃浠跺寘鎷睘鎬с�佷笟鍔$被鍨嬨�佺敓鍛藉懆鏈熺瓑鏂囦欢", + "涓婁紶鐨勬枃浠朵负鍘嬬缉鏂囦欢锛屼笖鍘嬬缉鏍煎紡浠呰兘涓簔ip鏍煎紡" + ], + upFileType: ['zip'], + fileUrl: 'api/linkTypeController/impData', + title: '', + bizTypeReload: null, + bizToData: [], + bizFormData: [], + bizTypeList: [], + bizTypeLoading: false, + bizTypeData: [], + bizTypeOption: { + ...basicOption, + menu: false, + addBtn: false, + index: false, + refreshBtn: false, + highlightCurrentRow: true, + searchMenuSpan: 8, + searchLabelWidth: 100, + calcHeight: 30, + column: [ + { + label: '涓氬姟绫诲瀷鍚�', + prop: 'name', + sortable: true, + search: true, + }, + { + label: '鏍囩', + prop: 'label', + sortable: true, + }, + { + label: '鐖剁被', + prop: 'fName', + sortable: true, + }, + { + label: '鐗堟湰瑙勫垯', + prop: 'revRuleName', + sortable: true, + }, + { + label: '鐢熷懡鍛ㄦ湡', + prop: 'lifeCycle', + sortable: true, + }, + ] + }, + bizTypeVisible: false, + bizTypeTitle: "", + conDefaultCheckData: [], // 淇濈暀涓婁釜鎺ュ彛杩斿洖鐨勬暟鎹� + conCheckLoading: false, + conCheckOption: { + ...basicOption, + menu: false, + addBtn: false, + index: false, + selection: false, + refreshBtn: false, + column: [ + { + label: '绫诲瀷鍚�', + prop: 'id', + }, + { + label: '鎿嶄綔', + prop: 'methods', + }, + { + label: '鐘舵��', + prop: 'status', + } + ] + }, + conCheckData: [], + conCheckVisible: false, + attrPage: { + currentPage: 1, + pageSize: 30, + total: 0, + pageSizes: [30, 50, 100, 200], + }, + searchAttrParams: {}, + dialogAttrReload: Math.random(), + dialogAttrSelectList: [], + dialogAttrLoading: false, + dialogAttrData: [], // 灞炴�ф睜鏂板琛ㄦ牸 + dialogAttrOption: { + ...basicOption, + calcHeight: -60, + addBtn: false, + menu: false, + refreshBtn: false, + index: false, + highlightCurrentRow: true, + height: 450, + searchMenuSpan: 8, + column: [ + { + label: '灞炴�у悕', + prop: 'id', + sortable: true, + search: true, + }, + { + label: '灞炴�х被鍨�', + prop: 'attributeDataType', + sortable: true, + }, + { + label: '鍒濆鍊�', + prop: 'defaultValue', + sortable: true, + }, + { + label: '璇存槑', + prop: 'description', + sortable: true, + overHidden: true + } + ] + }, + attrPollDialogVisible: false, // 瀵硅瘽妗� 灞炴�ф睜鍒楄〃visible + createViewLoading: false, // 鍒涘缓瑙嗗浘 + checkVisible: false, + rules: { + name: [ + {required: true, message: '璇疯緭鍏ュ悕绉�', trigger: 'blur'}, + ], + }, + form: { + name: '', // 鍚嶇О + tag: '', // 鏍囩 + implClass: '', // 瀹炵幇绫� + shape: '', // 褰㈢姸 + description: '', // 鎻忚堪 + btmItemsFrom: '', // From绔被鍨嬪垪琛� + relationFrom: 'N', // form绔搴斿叧绯� + primitivesFrom: '', // form绔富绫诲瀷 + btmItemsTo: '', // to绔被鍨嬪垪琛� + relationTo: 'N', // to绔搴斿叧绯� + primitivesTo: '', // to绔富绫诲瀷, + attributes: [] + }, + dialogBottomOption: { + ...basicOption, + editBtn: false, + refreshBtn: false, + selection: false, + height: 200, + addBtn: false, + // index:false, + column: [ + { + label: '灞炴�у悕', + prop: 'id', + sortable: true, + }, + { + label: '灞炴�х被鍨�', + prop: 'attributeDataType', + sortable: true, + }, + { + label: '鍒濆鍊�', + prop: 'defaultValue', + sortable: true, + }, + { + label: '璇存槑', + prop: 'description', + overHidden: true + } + ] + }, + dialogBottomData: [], + visible: false, treeOption: { height: 'auto', defaultExpandAll: false, @@ -193,25 +623,29 @@ refreshBtn: false, selection: false, // index:false, + addBtn: false, + menu: false, + calcHeight: -40, column: [ { label: '灞炴�у悕', - prop: 'attributeName', + prop: 'id', sortable: true, }, { label: '灞炴�х被鍨�', - prop: 'source', + prop: 'attributeDataType', sortable: true, }, { label: '鍒濆鍊�', - prop: 'source', + prop: 'defaultValue', sortable: true, }, { label: '璇存槑', - prop: 'desc', + prop: 'description', + overHidden: true } ] }, @@ -230,6 +664,8 @@ main: 'el-icon-warning-outline', desc: 'el-icon-chat-line-square' }, + bizLastIndex: null, + attrLastIndex: null } }, created() { @@ -246,14 +682,476 @@ this.treeData = data; this.tableLoading = false; }).catch(err => { - this.$message.error(err) + this.$message.error(err); }); + }, + + // 瀵煎叆 + upLoadClickHandler() { + this.$refs.upload.visible = true; }, // 鏍戠偣鍑讳簨浠� nodeClick(row) { console.log(row); this.nodeRow = row; + this.getAttrPollData(row); // 鑾峰彇灞炴�ф睜鍒楄〃 + }, + + // 鑾峰彇灞炴�ф睜鍒楄〃 + getAttrPollData(row) { + let value = row.attributes.join(','); + getByAttributeNames({attrNames: value}).then(res => { + if (res.data.code === 200) { + this.tableData = res.data.data; + } + }) + }, + + // 鍒犻櫎鎸夐挳 + deleteClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); + return; + } + ; + this.$confirm('鎮ㄧ‘瀹氳鍒犻櫎鎵�閫夋嫨鐨勬暟鎹悧锛�', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + deleteLink(this.nodeRow).then(res => { + if (res.data.code === 200) { + this.$message.success('鍒犻櫎鎴愬姛'); + this.getTreeList(); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }); + }); + }, + + // 鍒涘缓鎸夐挳 + addClickHandler() { + this.visible = true; + this.title = 'add'; + }, + + // 缂栬緫鎸夐挳 + editClickHandler() { + this.title = 'edit'; + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); + return; + } + this.form = {...this.nodeRow}; // 娴呮嫹璐� 瑙e喅寮曠敤澶嶅埗 + console.log(this.nodeRow); + this.bizFormData = this.form.btmItemsFrom.length > 0 && this.form.btmItemsFrom.map(item => { + return { + name: item + }; + }); + + this.bizToData = this.form.btmItemsTo.length > 0 && this.form.btmItemsTo.map(item => { + return { + name: item + }; + }); + + if (this.form.attributes.length > 0) { + let value = this.form.attributes.join(','); + getByAttributeNames({attrNames: value}).then(res => { + if (res.data.code === 200) { + this.dialogBottomData = res.data.data; + } + }) + } + this.visible = true; + }, + + // 涓�鑷存�ф鏌� + checkClickHandler() { + checkLinkType().then(res => { + if (res && res.data && res.data.data) { + this.conCheckVisible = true; + this.conCheckLoading = true; + if (res.data.code === 200) { + const data = res.data.data; + this.conDefaultCheckData = data; // 淇濈暀涓�浠藉師濮嬫暟鎹� + this.conCheckLoading = false; + + const outputData = []; + + data.forEach(item => { + Object.entries(item.btmCheckMap).forEach(([id, methodsArray]) => { + methodsArray.forEach(methods => { + // 鍒ゆ柇鍓嶇紑 + const action = methods.startsWith('F_') ? '绉婚櫎form绔笟鍔$被鍨�' : '绉婚櫎to绔笟鍔$被鍨�'; + const detail = methods.split('_')[1]; // 鑾峰彇 _ 鍚庨潰鐨勫唴瀹� + outputData.push({ + id: id, + methods: `${action}:${detail}`, + status: '鏈慨澶�' + }); + }); + }); + + // 澶勭悊 dbCheckMap + Object.entries(item.dbCheckMap).forEach(([id, methods]) => { + const splitMethods = methods.split('('); + // 鍒ゆ柇绗竴涓鍙峰墠闈㈢殑鍊� + if (splitMethods[0].startsWith('_ADD')) { + outputData.push({ + id: id, + methods: '澧炲姞鍒�(' + splitMethods[0].slice(0, -1) + ')', // 缁撴潫浣嶇疆鍑忓幓)鐨勫瓧绗� + status: '鏈慨澶�' + }); + } else if (splitMethods[0].startsWith('_CREATE')) { + outputData.push({ + id: id, + methods: '鍒涘缓琛�(' + splitMethods[0].slice(0, -1) + ')', + status: '鏈慨澶�' + }); + } else if (splitMethods[0].startsWith('_DROP')) { + outputData.push({ + id: id, + methods: '绉婚櫎鍒�(' + splitMethods[0].slice(0, -1) + ')', + status: '鏈慨澶�' + }); + } else { + this.$message.error("涓嶆敮鎸佺殑 dbCheckMap 绫诲瀷锛� " + methods) + } + }); + }); + this.conCheckData = outputData; + } + } else { + this.$message.success(res.data.msg); + } + }).catch(err => { + this.$message.error(err); + }) + }, + + // 淇涓�鑷存�ф鏌� + repairClickHandler() { + const params = this.conDefaultCheckData[0]; + repairTable(params).then(res => { + if (func.isEmptyObject(res.data.obj[0])) { + this.$message.success('淇鎴愬姛'); + this.conCheckData = []; + } else { + this.$message.error('淇澶辫触锛岃閲嶆柊灏濊瘯锛�'); + } + this.conCheckVisible = false; + }) + }, + + // 鍒涘缓瑙嗗浘 + createViewClickHandler() { + this.createViewLoading = true; + createView().then(res => { + if (res.data.code === 200) { + this.createViewLoading = false; + this.$message.success(res.data.obj); + } + }).catch(err => { + this.createViewLoading = false; + }) + }, + + // 瀵硅瘽妗� 灞炴�ф睜鍒楄〃澧炲姞鎸夐挳 + dialogAddClickHandler() { + this.dialogAttrLoading = true; + this.attrPollDialogVisible = true; + this.dialogAttrReload = Math.random(); // 寮哄埗鍒锋柊琛ㄦ牸 瑙e喅琛ㄦ牸閿欒 + this.getAttrDialogDta(); + }, + + // 鏌ヨ灞炴�ф睜鍒楄〃鏁版嵁 + getAttrDialogDta() { + gridAttribute(this.attrPage.currentPage, this.attrPage.pageSize, this.searchAttrParams).then(res => { + const data = res.data.data; + this.dialogAttrData = data; + this.attrPage.total = res.data.total; + this.dialogAttrLoading = false; + }).catch(err => { + this.$message.error(err); + }); + }, + + // 娣诲姞灞炴�ф睜琛ㄦ牸閫夋嫨妗� + dialogAttrSelectChange(row) { + this.dialogAttrSelectList = row; + }, + + // 娣诲姞灞炴�ф睜 琛岀偣鍑� + dialogAttrRowClickHandler(row) { + + func.rowClickHandler( + row, + this.$refs.dialogAttrCrud, + this.attrLastIndex, + (newIndex) => { + this.attrLastIndex = newIndex; + }, + () => { + this.selectList = []; + } + ); + }, + + // 娣诲姞灞炴�ф睜 鍏抽棴瀵硅瘽妗� + dialogAttrClose() { + this.attrPollDialogVisible = false; + this.searchAttrParams = {}; + }, + + // 娓呯┖form琛ㄥ崟 + resetForm() { + const form = { + name: '', // 鍚嶇О + tag: '', // 鏍囩 + implClass: '', // 瀹炵幇绫� + shape: '', // 褰㈢姸 + description: '', // 鎻忚堪 + btmItemsFrom: '', // From绔被鍨嬪垪琛� + relationFrom: 'N', // form绔搴斿叧绯� + primitivesFrom: '', // form绔富绫诲瀷 + btmItemsTo: '', // to绔被鍨嬪垪琛� + relationTo: 'N', // to绔搴斿叧绯� + primitivesTo: '', // to绔富绫诲瀷 + }; + this.form = form; + this.$refs.form.resetFields(); + this.bizFormData = []; + this.bizToData = []; + this.dialogBottomData = []; + }, + + // 娣诲姞灞炴�ф睜 淇濆瓨 + dialogAttrAddClickHandler() { + let hasDuplicate = false; + + // 鍏堝垱寤轰竴涓复鏃舵暟缁勬潵瀛樺偍涓嶉噸澶嶇殑椤� + const newItems = []; + + this.dialogAttrSelectList.forEach(item => { + const exists = this.dialogBottomData.some(existingItem => existingItem.id === item.id); + + if (exists) { + hasDuplicate = true; + return; + } + + // 濡傛灉娌℃湁閲嶅椤癸紝鍒欏皢璇ラ」娣诲姞鍒颁复鏃舵暟缁勪腑 + newItems.push({ + id: item.id, + attributeDataType: item.attributeDataType, + defaultValue: item.defaultValue, + description: item.description + }); + }); + + if (hasDuplicate) { + this.$message.error('璇锋鏌ユ槸鍚︽湁娣诲姞閲嶅椤癸紒'); + } else { + // 濡傛灉娌℃湁閲嶅椤癸紝灏嗘柊椤规坊鍔犲埌 dialogBottomData + this.dialogBottomData.push(...newItems); + this.attrPollDialogVisible = false; + } + }, + + //娣诲姞灞炴�ф睜 鏉℃暟 + attrSizeChange(val) { + this.attrPage.pageSize = val; + this.getAttrDialogDta() + }, + + //娣诲姞灞炴�ф睜 椤电爜 + attrCurrentChange(val) { + this.attrPage.currentPage = val; + this.getAttrDialogDta(); + }, + + //娣诲姞灞炴�ф睜 鎼滅储 + attrHandleSearch(params, done) { + if (func.isEmptyObject(params)) { + this.searchAttrParams = {}; + } else { + this.searchAttrParams = { + "conditionMap[id]": "*" + params.id + "*" + }; + } + this.getAttrDialogDta(); + done(); + }, + + //娣诲姞灞炴�ф睜 娓呯┖鎼滅储 + attrHandleReset() { + this.searchAttrParams = {}; + this.getAttrDialogDta(); + }, + + // 灞炴�ф睜鍒犻櫎 + dialogBottomAttrDel(form, index) { + this.dialogBottomData.splice(index, 1); + }, + + // 鍒涘缓 缂栬緫 瀵硅瘽妗嗗叧闂� + addDialogClose() { + this.visible = false; + this.dialogBottomData = []; + this.resetForm(); + }, + + // form to 绫诲瀷blur鍙傜収瀵硅瘽妗� + FormItemReferChange(val) { + this.bizTypeTitle = val; + this.bizTypeLoading = true; + this.getBizTypeHandler(); + this.bizTypeVisible = true; + this.bizTypeReload = Math.random(); // 寮哄埗鍒锋柊琛ㄦ牸 瑙e喅琛ㄦ牸閿欒 + }, + + // form to 绫诲瀷琛ㄦ牸鏌ヨ + getBizTypeHandler(params) { + getBizTypes(params).then(res => { + if (res.data.code === 200) { + const data = res.data.data; + this.bizTypeData = data; + this.bizTypeLoading = false; + } + }) + }, + + // form to 绫诲瀷閫夋嫨妗� + bizTypeSelection(row) { + this.bizTypeList = row; + }, + + // form to 绫诲瀷琛岀偣鍑� + bizTypeRowClick(row) { + func.rowClickHandler( + row, + this.$refs.bizTypeCrud, + this.bizLastIndex, + (newIndex) => { + this.bizLastIndex = newIndex; + }, + () => { + this.selectList = []; + } + ); + }, + + // form to 绫诲瀷淇濆瓨 + bizTypeAddHandler() { + if (this.bizTypeList.length === 0) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); + return; + } + + const data = this.bizTypeList.map(item => ({name: item.name})); + + const dataName = this.bizTypeTitle === 'form' ? 'bizFormData' : 'bizToData'; + + let hasDuplicate = false; + // 鍏堝垱寤轰竴涓复鏃舵暟缁勬潵瀛樺偍涓嶉噸澶嶇殑椤� + const newItems = []; + this.bizTypeList.forEach(item => { + const exists = this[dataName].some(existingItem => existingItem.name === item.name); + + if (exists) { + hasDuplicate = true; + return; + } + + // 濡傛灉娌℃湁閲嶅椤癸紝鍒欏皢璇ラ」娣诲姞鍒颁复鏃舵暟缁勪腑 + newItems.push({ + name: item.name, + }); + }); + + if (hasDuplicate) { + this.$message.error('璇锋鏌ユ槸鍚︽湁娣诲姞閲嶅椤癸紒'); + } else { + // 濡傛灉娌℃湁閲嶅椤癸紝灏嗘柊椤规坊鍔犲埌 dialogBottomData + this[dataName].push(...newItems); + this.bizTypeVisible = false; + } + }, + + // form to 绫诲瀷鎼滅储 + bizTypeHandleSearch(params, done) { + console.log(params); + let obj = { + btmName: params.name + }; + this.getBizTypeHandler(obj); + + done(); + }, + + // form to 绫诲瀷閲嶇疆 + bizTypeHandleReset() { + this.getBizTypeHandler(); + }, + + // form to 绔〃鏍肩Щ闄� + bizTypeDeleteRow(val, index) { + const dataName = val === 'form' ? 'bizFormData' : 'bizToData'; + const primitivesName = val === 'form' ? 'primitivesFrom' : 'primitivesTo'; + + this[dataName].splice(index, 1); + + if (this[dataName].length === 0) { + this.form[primitivesName] = ""; + } + }, + + // 鍒涘缓缂栬緫 淇濆瓨 + addDialogSavaHandler() { + if (this.bizFormData.length <= 0 || this.bizToData.length <= 0) { + this.$message.error('form绔笟鍔$被鍨嬪拰to绔被鍨嬪潎涓嶈兘涓虹┖锛�') + return; + } + this.$refs.form.validate((valid) => { + if (valid) { + this.form.btmItemsFrom = this.bizFormData.map(item => item.name); + this.form.btmItemsTo = this.bizToData.map(item => item.name); + this.form.attributes = this.dialogBottomData.map(item => item.id); + let flag = this.title === 'add' ? true : false; + addAndEditLink(flag, this.form).then(res => { + if (res.data.code === 200) { + this.visible = false; + this.$message.success(res.data.msg); + this.resetForm(); + this.getTreeList(); + } + }); + } else { + return false; + } + }); + }, + + // 瀵煎嚭 + exportClickHandler() { + if (func.isEmptyObject(this.nodeRow)) { + this.$message.error('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�'); + return; + } + let name = this.nodeRow.name; + expData({name: name}).then(res => { + func.downloadFileByBlobHandler(res); + this.$message.success('瀵煎嚭鎴愬姛'); + }).catch(err => { + this.$message.error(err); + }); } } } @@ -263,6 +1161,16 @@ ::v-deep { .el-scrollbar__wrap { overflow: auto !important; + } + + .el-form-item .el-select { + width: 100%; + } + + .headerCon { + .el-button { + width: 82px; + } } } @@ -287,4 +1195,27 @@ .headerCon > .el-button:nth-child(7) { margin-left: 0; } + +.dialogForm { + display: flex; + justify-content: space-around; +} + +.dialogForm > div { + width: 34%; + border: 1px solid #eee; + padding: 25px 20px 5px 10px; /* 涓� 鍙� 涓� 宸� */ + box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2); /* 娣诲姞闃村奖鏁堟灉 */ +} + +.leftForm { + width: 19% !important; + padding: 25px 20px 5px 0px !important; +} + +.smallBtn { + width: 82px !important; + text-align: center !important; + padding-left: 0px !important; +} </style> -- Gitblit v1.9.3