From 1c407a93546036bc0438fbe019aeaf03f6ef1805 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期三, 05 七月 2023 19:15:38 +0800 Subject: [PATCH] 提交代码 --- Source/UBCS-WEB/src/components/Tree/attrCrud.vue | 303 ++++++++++++++++++++++++++++++++++++------------- 1 files changed, 221 insertions(+), 82 deletions(-) diff --git a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue index 99a82dc..ea33289 100644 --- a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue +++ b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue @@ -1,34 +1,34 @@ <template> <div> <div style="display: flex;flex-wrap: wrap;" v-if="this.crudArrayFlag"> + <el-button-group> <!--鏂板--> - <el-button v-if="attrEditVisible == false && attrFlagChiledren==false" size="small" type="primary" - @click="busineHandle">锛� 娣诲姞 {{ msg }} - </el-button> + <el-button v-if="attrEditVisible == false && attrFlagChiledren==false" size="small" type="primary" icon="el-icon-plus" @click="busineHandle">娣诲姞 {{ msg }}</el-button> <!-- 鍏ㄥ睆缂栬緫--> - <el-button v-if=" attrEditVisible == false && attrFlagChiledren==false" size="small" @click="fullscreenHandle"> - 鍏ㄥ睆缂栬緫 - </el-button> - <!-- 缁勫悎瑙勫垯--> - <el-button size="small" @click="isShowHandler">缁勫悎瑙勫垯</el-button> + <el-button v-if=" attrEditVisible == false && attrFlagChiledren==false" size="small" @click="fullscreenHandle" icon="el-icon-full-screen">鍏ㄥ睆缂栬緫</el-button> <!-- 楠岃瘉瑙勫垯--> <el-button icon="el-icon-info" size="small" @click="rulesVisible=true">楠岃瘉瑙勫垯</el-button> <!-- 灞炴�у垎缁�--> <el-button icon="el-icon-menu" size="small" @click="attrVisibleHandle">灞炴�у垎缁�</el-button> - <!-- 鍒嗙被娉ㄥ叆--> - <el-button icon="el-icon-magic-stick" size="small" @click="injectBtn">鍒嗙被娉ㄥ叆</el-button> - <!-- 鏋氫妇娉ㄥ叆--> - <el-button size="small" @click="enmuVisHandle">鏋氫妇娉ㄥ叆</el-button> - <!-- 绾ц仈灞炴��--> - <el-button size="small" @click="CascadeHandle">绾ц仈灞炴��</el-button> - <!-- 棰勮鎺掑簭--> - <el-button size="small">棰勮鎺掑簭</el-button> + </el-button-group> + <el-button-group> + <!-- 鍒嗙被娉ㄥ叆--> + <el-button icon="el-icon-magic-stick" size="small" @click="injectBtn">鍒嗙被娉ㄥ叆</el-button> + <!-- 缁勫悎瑙勫垯--> + <el-button size="small" @click="isShowHandler">缁勫悎瑙勫垯</el-button> + <!-- 鏋氫妇娉ㄥ叆--> + <el-button size="small" @click="enmuVisHandle">鏋氫妇娉ㄥ叆</el-button> + <!-- 绾ц仈灞炴��--> + <el-button size="small" @click="CascadeHandle">绾ц仈灞炴��</el-button> + <!-- 棰勮鎺掑簭--> + <el-button size="small" icon="el-icon-arrow-down">棰勮鎺掑簭</el-button> + </el-button-group> <!-- 淇濆瓨--> - <el-button size="small" @click="addsHandler">淇濆瓨</el-button> + <el-button size="small" @click="addsHandler" icon="el-icon-check">淇濆瓨</el-button> <!-- 鍒犻櫎--> - <el-button size="small" @click="CrudRemove">鍒犻櫎</el-button> + <el-button size="small" @click="CrudRemove" icon="el-icon-delete">鍒犻櫎</el-button> <!-- 閲嶇疆--> - <el-button size="small" @click="reset">閲嶇疆</el-button> + <el-button size="small" @click="reset" icon="el-icon-refresh-right">閲嶇疆</el-button> <!-- 鍚屾鍒板叾浠栨ā鏉�--> <el-button size="small" @click="syncHandle">鍚屾鍒板叾浠栨ā鏉�</el-button> <!-- 缂栫爜鐢宠棰勮--> @@ -92,7 +92,7 @@ </el-table-column> <el-table-column fixed="right" label="鎿嶄綔" width="120"> <template slot-scope="scope"> - <el-button size="small" type="text" @click.native.prevent="enumDeleteRow(scope.$index, tableData)"> + <el-button size="small" type="text" plain @click="enumDeleteRow"> 绉婚櫎 </el-button> </template> @@ -209,7 +209,7 @@ ></formula-editor> <!-- 鏂板 --> <el-dialog :visible.sync="addVisible" append-to-body title="浠庝笟鍔$被鍨嬩腑閫夋嫨灞炴��"> - <avue-crud :data="businessData" :option="businessOption" @select="businessSelect"> + <avue-crud :data="businessData" :option="businessOption" @selection-change="businessSelect"> <template slot="menuLeft"> <div style="display: flex;"> <el-select> @@ -224,7 +224,7 @@ </avue-crud> <div style="display: flex;justify-content: flex-end;margin-top: 15px"> <el-button size="small" type="primary" @click="busineAddHandle">淇濆瓨</el-button> - <el-button size="small" type="primary">鍙栨秷</el-button> + <el-button size="small" type="primary" @click="addVisible=false">鍙栨秷</el-button> </div> </el-dialog> </div> @@ -232,28 +232,30 @@ style="width: 100%" @cell-click="handleCellClicks" @select="selectHandle" + @selection-change="selectionChange" v-if="this.crudArrayFlag" > <el-table-column type="selection" width="55"> </el-table-column> - <el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column> + <!--<el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column>--> <el-table-column v-for="item in this.option.column" :key="item.id" :label="item.label" :prop="item.prop" :formatter="formAttr" - :width="item.label.length >=4 ?'150':item.label.length==3 ?'120':'90'" + :width="item.width||(item.label.length >=4 ?'150':item.label.length==3 ?'120':'90')" :show-overflow-tooltip="true" align="center" > <template slot-scope="{ row }"> - <el-input v-if="editingRows === row && editShows== item.prop" v-model="row[item.prop]" + <el-input v-if="editingRows === row && editShows== item.prop && (item.edit == 'text' || item.edit == 'select' ||item.edit == 'refer')" v-model="row[item.prop]" @blur="saveRows"></el-input> + <el-input-number controls-position="right" v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]" + @blur="saveRows"></el-input-number> <el-switch - v-if="item.label === 'true' || item.label === 'false'" - active-color="#13ce66" - inactive-color="#ff4949"> + v-if="item.edit === 'switch'" v-model="row[item.prop]" active-value="true" + inactive-value="false"> </el-switch> <span v-else>{{ row[item.prop] }}</span> </template> @@ -335,14 +337,14 @@ }, // 缂栫爜鐢宠棰勮data applicationData: [], - //涓氬姟绫诲瀷鍗曢�夋暟缁� + //涓氬姟绫诲瀷閫夋嫨鏁扮粍 busineSelectList: [], //涓氬姟绫诲瀷娣诲姞鏁版嵁 busineAddList: {}, //琛ㄦ牸鍗曢�夋暟缁� - CrudSelect: [], + attrSelectList: [], //琛ㄦ牸oid - CrudOid: "", + attrOid: "", //鍦烘櫙鍙橀噺 thisSceneTableData: [ { @@ -900,11 +902,27 @@ }, { label: "鏁版嵁绫诲瀷", - prop: "attrDataType" + prop: "attrDataType", + formatter:function(row,column){ + let vciFieldTypeMap = { + VTBoolean: "甯冨皵鍨�", + VTClob: "闀挎枃鏈�", + VTDate: "鏃ユ湡", + VTDateTime: "鏃ユ湡鏃堕棿", + VTTime: "鏃堕棿", + VTLong: "闀挎暣鍨�", + VTDouble: "閲戦/鍙岀簿搴�", + VTInteger: "鏁村舰", + VTFilePath: "鏂囦欢", + VTString: "瀛楃涓�" + } + return vciFieldTypeMap[row.attrDataType]; + } }, { label: "鍙┖", - prop: "nullableFlag" + prop: "nullableFlag", + formatter:function(row,column){return row.nullableFlag=='true' || row.nullableFlag=='1'?'鏄�':'鍚�'} }, { label: "榛樿鍊�", @@ -924,11 +942,25 @@ }, { label: "鍙傜収", - prop: "referFlag" + prop: "referFlag", + formatter: function (d) { + if (!d.referFlag) { + return ''; + } else { + return d.referBtmTypeId + } + } }, { label: "鏋氫妇", - prop: "enumFlag" + prop: "enumFlag", + formatter: function (d) { + if (!d.enumFlag) { + return ''; + } else { + return d.enumId + } + } }, ] }, @@ -940,7 +972,7 @@ rowCellList: [], List: [], option: { - index: true, + index: false, border: true, editBtn: false, selection: true, @@ -953,8 +985,14 @@ prop: 'name', order: 'descending' }, - column: [ - { + column: [{ + prop: 'orderNum', + label: '鎺掑簭鍙�', + sortable: true, + edit: 'number', + width: 70, + fixed: true + }, { label: "灞炴�ц嫳鏂囩紪鍙�", prop: "id", fixed: true, @@ -969,6 +1007,7 @@ fixed: true, cell: false, width: 125, + edit: 'text', sortable: true }, { @@ -976,6 +1015,7 @@ prop: "attributeGroup", cell: false, sortable: true, + edit: 'text', width: 125, }, { @@ -990,78 +1030,90 @@ cell: false, sortable: true, width: 105, + edit: 'number' }, { label: "鍏抽敭灞炴��", prop: "keyAttrFlag", cell: false, - type: "switch", + edit: "switch" }, { label: "鏌ヨ灞炴��", prop: "queryAttrFlag", cell: false, + edit: "switch" }, { label: "楂樼骇鏌ヨ灞炴��", prop: "seniorQueryAttrFlag", - width: 95, + width: 110, cell: false, + edit: "switch" }, { - label: "鐩镐技鏌ヨ灞炴��", + label: "鐩镐技鏌ラ噸灞炴��", prop: "sameRepeatAttrFlag", - width: 95, + width: 110, cell: false, + edit: "switch" }, { label: "蹇呰緭", prop: "requireFlag", cell: false, + edit: "switch" }, { label: "琛ㄥ崟鏄剧ず", prop: "formDisplayFlag", cell: false, + edit: "switch" }, { label: "鍒楄〃鏄剧ず", prop: "tableDisplayFlag", cell: false, + edit: "switch" }, { label: "鍙", prop: "readonlyFlag", cell: false, + edit: "switch" }, { label: "鍒楄〃鎺掑簭", prop: "sortAttrFlag", cell: false, + edit: "switch" }, - { label: "澶氳鏂囨湰", prop: "textareaFlag", cell: false, + edit: "switch" }, { label: "榛樿鍊�", prop: "defaultValue", sortable: true, cell: false, + edit: 'text', width: 95, }, { label: "鍓嶇紑", prop: "prefixValue", sortable: true, + edit: 'select', cell: false, }, { label: "鍚庣紑", prop: "suffixValue", sortable: true, + edit: 'select', cell: false, }, { @@ -1069,6 +1121,7 @@ prop: "componentRule", sortable: true, cell: false, + edit: 'refer', width: 105, }, { @@ -1076,6 +1129,7 @@ prop: "verifyRule", sortable: true, cell: false, + edit: 'refer', width: 105, }, { @@ -1083,84 +1137,97 @@ prop: "codeDateFormat", sortable: true, width: 105, + edit: 'select', cell: false, }, { label: "鍒嗙被娉ㄥ叆", prop: "classifyInvokeLevel", cell: false, + edit: 'refer' }, { label: "鏋氫妇娉ㄥ叆", prop: "enumString", cell: false, + edit: 'refer' }, { label: "绾ц仈灞炴��", prop: "parentCode", cell: false, + edit: 'refer' }, { label: "鍙傜収閰嶇疆", prop: "referConfig", cell: false, + edit: 'refer' }, { label: "绾ц仈鏌ヨ灞炴��", prop: "parentQueryAttr", width: 105, cell: false, + edit: 'text' }, { label: "閫夋嫨搴撴爣璇�", prop: "libraryIdentification", width: 105, cell: false, + edit: 'text' }, { label: "濉啓鎻愮ず", prop: "explain", cell: false, + edit: 'text' }, { label: "琛ㄥ崟鏄剧ず鏍峰紡", prop: "formDisplayStyle", width: 105, cell: false, + edit: 'text' }, { label: "琛ㄦ牸鏄剧ず鏍峰紡", prop: "tableDisplayStyle", width: 105, cell: false, + edit: 'text' }, { label: "琛ㄥ崟瓒呴摼鎺�", prop: "formHref", width: 95, cell: false, + edit: 'text' }, { label: "琛ㄦ牸瓒呴摼鎺�", prop: "tableHref", width: 95, cell: false, + edit: 'text' }, { label: "琛ㄦ牸鏄剧ずjs", prop: "tableDisplayJs", width: 95, cell: false, + edit: 'text' }, { label: "闀垮害", prop: "controlLength", - cell: false, + cell: false }, { label: "灏忔暟绮惧害", prop: "precisionLength", - cell: false, + cell: false }, { label: "鍙栧�艰寖鍥�", @@ -1168,10 +1235,39 @@ sortable: true, cell: false, width: 105, + edit: 'text' }, ], List: [] + }, + vciFieldTypeMap : { + VTBoolean: "甯冨皵鍨�", + VTClob: "闀挎枃鏈�", + VTDate: "鏃ユ湡", + VTDateTime: "鏃ユ湡鏃堕棿", + VTTime: "鏃堕棿", + VTLong: "闀挎暣鍨�", + VTDouble: "閲戦/鍙岀簿搴�", + VTInteger: "鏁村舰", + VTFilePath: "鏂囦欢", + VTString: "瀛楃涓�" } + } + }, + computed:{ + attrOids() { + let oids = []; + this.attrSelectList.forEach(ele => { + oids.push(ele.oid); + }); + return oids.join(","); + }, + busineOids() { + let oids = []; + this.busineSelectList.forEach(ele => { + oids.push(ele.oid); + }); + return oids.join(","); } }, mounted() { @@ -1185,11 +1281,12 @@ }, //灞炴�у垎缁勬寜閽� attrVisibleHandle() { - if (this.CrudSelect.length > 1) { + + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect < 1) { + } else if (this.attrSelectList < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.attrVisible = true; } }, @@ -1215,34 +1312,71 @@ }, //涓氬姟绫诲瀷淇濆瓨 busineAddHandle() { - this.$set(this.busineAddList, 'classifytemplateoid', this.crudOid) - this.$set(this.busineAddList, 'oid', '') - this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList))) + if (this.busineSelectList.length == 0) { + this.$message.warning('璇烽�夋嫨灞炴�ч泦'); + return false; + } + let ordernum = this.ProData.length; + this.busineSelectList.forEach((citem) => { + let isCopy = false; + this.ProData.forEach((item) => { + if (citem.id == item.id) { + isCopy = true; + return false; + } + }) + if (!isCopy) { + citem.oid = '' + this.busineAddList=Object.assign(citem, { + orderNum: ++ordernum, + attributedatatype: citem.attrDataType, + attributeDataTypeText: this.vciFieldTypeMap[citem.attrDataType], + controlLength: citem.attributeLength, + valueArea: citem.range, + referbtmid: citem.referBtmTypeId, + referbtmname: citem.referBtmTypeName, + referConfig: '', + enumid: citem.enumId, + precisionLength: (citem.precisionLength ? citem.precisionLength : '') + (citem.scaleLength ? '(' + citem.scaleLength + ')' : ''), + classifyTemplateOid: this.crudOid, + classifytemplateoid: this.crudOid, + formDisplayFlag: true, + tableDisplayFlag: true, + sortAttrFlag: false, + queryAttrFlag: true, + seniorQueryAttrFlag: true, + attrTableWidth: 120 + }) + this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList))) + } + }) this.addVisible = false; + }, - //涓氬姟绫诲瀷鍗曢�� + //涓氬姟绫诲瀷閫夋嫨 businessSelect(selection, row) { this.busineSelectList = selection - this.busineAddList = row }, - // 浠庝笟鍔$被鍨嬩腑閫夋嫨鏁版嵁 + // 浠庝笟鍔$被鍨嬩腑閫夋嫨鏁版嵁寮圭獥 busineHandle() { - this.addVisible = true; - AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => { - this.businessData = res.data.data; - }) + this.addVisible = true; + this.busineSelectList = [] + this.busineAddList = []; + AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => { + this.businessData = res.data.data; + }) }, // 绾ц仈灞炴�ф寜閽� CascadeHandle() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect.length < 1) { + } else if (this.attrSelectList.length < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.CascadeVisible = true; gridCodeClassifyTemplateAttr({ 'conditionMap[classifyTemplateOid]': this.Formlist[0].oid, - 'conditionMap[oid_notequal]': this.CrudOid + 'conditionMap[oid_notequal]': this.attrOid }).then(res => { this.CascadeData = res.data.data; }) @@ -1250,10 +1384,12 @@ }, //琛ㄦ牸鍗曢�� selectHandle(selection, row) { - this.CrudOid = row.oid; - this.CrudSelect = selection; + this.attrOid = row.oid; this.attrRow = row; - console.log('123',row,selection) + }, + //琛ㄦ牸閫夋嫨 + selectionChange(list) { + this.attrSelectList = list; }, //淇濆瓨 addsHandler() { @@ -1278,9 +1414,9 @@ }, //琛ㄦ牸琛岀紪杈� handleCellClicks(row, column) { - this.editingRows = row; - this.editShows = column.property; - this.rowOid = row.oid; + this.editingRows = row; + this.editShows = column.property; + this.rowOid = row.oid; }, saveRows() { this.editingRows = null; @@ -1299,15 +1435,15 @@ }, //鏋氫妇娉ㄥ叆鍒犻櫎 enumDeleteRow(row) { - this.tableData.splice(row, 1) + this.tableData.splice(row.$index, 1) }, //鏋氫妇娉ㄥ叆鎸夐挳 enmuVisHandle() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect < 1) { + } else if (this.attrSelectList < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.enumVisible = true; } }, @@ -1349,11 +1485,11 @@ }, //鐐瑰嚮鍒嗙被娉ㄥ叆鎸夐挳 injectBtn() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉挎暟鎹�') - } else if (this.CrudSelect.length < 1) { + } else if (this.attrSelectList.length < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉挎暟鎹�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.injectVisible = true } }, @@ -1406,7 +1542,10 @@ }, //琛ㄦ牸鍒犻櫎 CrudRemove() { - this.ProData.splice(this.attrRow.$index, 1) + this.attrSelectList.forEach((item)=>{ + this.ProData.splice(item.$index, 1) + }) + }, //琛ㄦ牸閲嶇疆 reset() { @@ -1414,11 +1553,11 @@ }, //鍚屾鍒板叾浠栨ā鏉� syncHandle() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�') - } else if (this.CrudSelect.length < 1) { + } else if (this.attrSelectList.length < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { copyto({oid: this.attrRow.oid}).then(res => { this.$message.success('鍚屾鎴愬姛') }) @@ -1430,11 +1569,11 @@ }, //缁勫悎瑙勫垯 isShowHandler() { - if (this.CrudSelect.length > 1) { + if (this.attrSelectList.length > 1) { this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�') - } else if (this.CrudSelect.length < 1) { + } else if (this.attrSelectList.length < 1) { this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�') - } else if (this.CrudSelect.length === 1) { + } else if (this.attrSelectList.length === 1) { this.isShowformulaEdit = true; } }, -- Gitblit v1.9.3