From c8005d3f303be7241f5acdc10ad679e1bf8cd602 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期二, 24 十月 2023 11:16:29 +0800 Subject: [PATCH] 横向滚动条固定列bug --- Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue | 283 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 163 insertions(+), 120 deletions(-) diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue index 9237072..e0702b5 100644 --- a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue +++ b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue @@ -23,7 +23,8 @@ </el-button-group> <el-button-group> <!-- 淇濆瓨--> - <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-check" plain size="small" + <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && editOpenFlag" icon="el-icon-check" plain + size="small" type="success" @click.prevent="addsHandler">淇濆瓨 </el-button> <!-- 棰勮鎺掑簭--> @@ -67,23 +68,26 @@ </el-button-group> <!-- 鏄惁寮�鍚紪杈� --> <el-button-group> - <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && !editOpenFlag && attrEditVisible == false && attrFlagChiledren==false" icon="el-icon-view" plain - size="small" - @click="editOpen">寮�鍚紪杈� + <el-button + v-if="(!checkStatus|| crudLCStatus=='Editing') && !editOpenFlag && attrEditVisible == false && attrFlagChiledren==false" + icon="el-icon-view" plain + size="small" + @click="editOpen">寮�鍚紪杈� </el-button> + <el-select v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" v-model="selectvalue" + placeholder="璇烽�夋嫨" + size="small"> + <el-option + v-for="item in selectoptions" + :key="item.value" + :label="item.label" + :value="item.value"> + </el-option> + </el-select> + <el-switch v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" v-model="switchvalue" + active-value="true" style="margin:6px 0 0 10px" @change="batchSetFlag"> + </el-switch> </el-button-group> - <el-select v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" v-model="selectvalue" placeholder="璇烽�夋嫨" - size="small"> - <el-option - v-for="item in selectoptions" - :key="item.value" - :label="item.label" - :value="item.value"> - </el-option> - </el-select> - <el-switch v-if="(!checkStatus || crudLCStatus=='Editing') && editOpenFlag" v-model="switchvalue" - active-value="true" style="margin:6px 0 0 10px" @change="batchSetFlag"> - </el-switch> </div> <!-- 寮圭獥--> <div> @@ -300,8 +304,9 @@ <el-table v-if="this.crudArrayFlag" ref="referAttrCrud" v-loading="loading" + border :data="ProData" - :height="this.editStyleFlag? 800 : 343" + :height="this.tableHeight" style="width: 100%" @select="selectHandle" @cell-click="handleCellClicks" @@ -325,18 +330,20 @@ align="center" > <template slot-scope="{ row }"> - <el-input v-if="editingRows === row && editShows== item.prop && item.prop != 'codeDateFormat' && (item.edit == 'text' ||item.edit == 'refer' )" - ref="inputRef" - :id="'inputRef' + row.oid" - v-show="!AddCellFlag" - v-model="row[item.prop]" - @blur="saveRows" - autofocus></el-input> - <el-input-number v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]" + <el-input + v-if="editingRows === row && editShows== item.prop && item.prop != 'codeDateFormat' && (item.edit == 'text' ||item.edit == 'refer' )" + v-show="!AddCellFlag" + :ref="'input' + row.oid" + v-model="row[item.prop]" + @blur="saveRows(row)" + ></el-input> + <el-input-number v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" + v-model="row[item.prop]" :style="{width:(item.width-10)+'px'}" controls-position="right" size="small" @blur="saveRows"></el-input-number> - <el-select v-if="editingRows === row && editShows== item.prop && item.edit == 'select' " slot="prepend" v-model="row[item.prop]" allow-create default-first-option + <el-select v-if="editingRows === row && editShows== item.prop && item.edit == 'select' " slot="prepend" + v-model="row[item.prop]" allow-create default-first-option filterable @blur="selectChangeHandler(item.editConfig,index)"> <el-option @@ -432,7 +439,7 @@ }, crudArrayFlag: { handler(newval, oldval) { - console.log('crudArrayFlag', newval) + // console.log('crudArrayFlag', newval) } }, crudArray: { @@ -476,7 +483,7 @@ }, editOpenFlag: { handler(newval, oldval) { - console.log('editOpenFlag', newval) + // console.log('editOpenFlag', newval) }, deep: true, immediate: true @@ -485,8 +492,10 @@ }, data() { return { + //琛ㄦ牸楂樺害 + dynamicHeight: '', // 淇濆瓨鍗曞厓鏍肩姸鎬� - AddCellFlag:false, + AddCellFlag: false, //鍏ㄥ睆缂栬緫楂樺害鐘舵�� editStyleFlag: false, loading: false, @@ -633,6 +642,7 @@ addBtn: false, header: false, align: 'center', + columnBtn:false, menuAlign: 'center', column: [{ label: '', @@ -847,6 +857,7 @@ { label: "鍙傜収閰嶇疆", prop: "referConfig", + width: 105 }, { label: "绾ц仈鏌ヨ灞炴��", @@ -891,7 +902,7 @@ { label: "鍙栧�艰寖鍥�", prop: "valueArea", - }, + } ] }, // 瀛樺偍琛ㄦ牸鏁版嵁 @@ -1082,12 +1093,12 @@ { label: "灞炴�ц嫳鏂囧悕绉�", prop: "id", - width:100, + width: 100, }, { label: "灞炴�т腑鏂囧悕绉�", prop: "name", - width:100, + width: 100, }, { label: "闀垮害", @@ -1168,6 +1179,7 @@ List: [], option: { index: false, + columnBtn:false, border: true, editBtn: false, selection: true, @@ -1532,6 +1544,13 @@ }); return oids.join(","); }, + tableHeight() { + if (this.editStyleFlag) { + return '800px' + } else { + return 'calc(100vh - 595px)' + } + } }, mounted() { }, @@ -1745,11 +1764,9 @@ addsHandler(event) { this.$refs.referAttrCrud.sort("orderNum"); var ischeck = true; - console.log('ProData',this.ProData) this.ProData.forEach((item, index) => { if ((item.requireFlag && item.requireFlag.toString() == 'true') && (item.readOnlyFlag && item.readOnlyFlag.toString() == 'true')) { this.$message.warning(item.name + "(" + item.id + ")蹇呰緭鐨勫睘鎬т笉鑳芥槸鍙"); - console.log(item) ischeck = false; return; } @@ -1757,29 +1774,23 @@ if (item.componentRule) { //缁勫悎瑙勫垯 num++ - console.log('componentRule', num) } if (item.enumString || item.enumId) { //鏋氫妇 num++ - console.log('enumString', num) } if (item.referConfig || item.referBtmId) { //鍙傜収 num++ - console.log('referConfig', num) } if (item.codeDateFormat) { //鏃堕棿鏍煎紡 num++ - console.log('codeDateFormat', num) } //濡傛灉绌哄悗鍙拌繑鍥瀗one if (item.classifyInvokeLevel && item.classifyInvokeLevel != 'none') { //鍒嗙被娉ㄥ叆 num++ - console.log('classifyInvokeLevel', num) - console.log(item.classifyInvokeLevel) } if (num > 1 && ischeck) { this.$message({ @@ -1801,7 +1812,7 @@ this.editOpenFlag = false; // 璋冪敤鐖剁粍浠朵慨鏀规寜閽姸鎬� this.$emit('editCloseChildren') - this.AddCellFlag=true; + this.AddCellFlag = true; }).catch(() => { this.$message.warning('淇濆瓨澶辫触锛岃鏌ョ湅鎺у埗鍙拌緭鍑猴紒') }); @@ -1816,74 +1827,82 @@ this.editShows = column.property; this.rowOid = row.oid; this.CurrentCell = row; - if(this.editingRows){ - const inputElement = document.querySelector(`#inputRef${row.oid}`); - if (inputElement) { - inputElement.focus(); - }; - } - if (column.property == 'referConfig') { - this.referConfigVisble = true; - this.referConfigOption = { - referConfig: this.CurrentCell.referConfig || '', + this.$nextTick(() => { + const inputs = this.$refs['input' + row.oid]; + const input = inputs && inputs.length > 0 ? inputs[0].$el : null; + if (input) { + input.focus(); } - if (this.CurrentCell.referConfig == '') { + }); + const columnActions = { + referConfig: () => { + this.referConfigVisble = true; this.referConfigOption = { - referConfig: '', + referConfig: this.CurrentCell.referConfig || '', + } + if (this.CurrentCell.referConfig == '') { + this.referConfigOption = { + referConfig: '', + } + } + }, + classifyInvokeText: () => { + this.injectVisible = true; + if (this.CurrentCell.classifyInvokeAttr != '') { + this.injectOption = { + classifyInvokeAttr: this.CurrentCell.classifyInvokeAttr, + classifyInvokeAttrName: this.CurrentCell.classifyInvokeAttrName, + classifyInvokeEditFlag: this.CurrentCell.classifyInvokeEditFlag, + classifyInvokeLevel: this.CurrentCell.classifyInvokeLevel == 'min' ? 'min' : 'max', + classifyNumber: this.CurrentCell.classifyInvokeLevel == 'min' ? '' : this.CurrentCell.classifyInvokeLevel + }; + } + }, + componentRule: () => { + this.isShowformulaEdit = true; + }, + enumString: () => { + this.enumVisible = true; + this.tableData = []; + if (this.CurrentCell.enumString != "") { + this.tableData = JSON.parse(this.CurrentCell.enumString) + return; + } + }, + parentCode: () => { + gridCodeClassifyTemplateAttr({ + 'conditionMap[classifyTemplateOid]': this.Formlist[0].oid, + 'conditionMap[oid_notequal]': this.CurrentCell.oid, + limit: -1 + }).then(res => { + this.CascadeData = res.data.data; + }) + this.CascadeVisible = true; + }, + verifyRule: () => { + this.RulesForm.expressionTextt = this.CurrentCell.verifyRule; + this.rulesVisible = true; + }, + attributeGroup: () => { + this.attrVisible = true; + if (this.CurrentCell.attributeGroup !== '') { + this.attrModel = this.CurrentCell.attributeGroup } } - // this.$refs.referConfigFormDialog.onloadAttrData(); - } else if (column.property == 'classifyInvokeText') { - this.injectVisible = true; - if (this.CurrentCell.classifyInvokeAttr != '') { - this.injectOption = { - classifyInvokeAttr: this.CurrentCell.classifyInvokeAttr, - classifyInvokeAttrName: this.CurrentCell.classifyInvokeAttrName, - classifyInvokeEditFlag: this.CurrentCell.classifyInvokeEditFlag, - classifyInvokeLevel: this.CurrentCell.classifyInvokeLevel == 'min' ? 'min' : 'max', - classifyNumber: this.CurrentCell.classifyInvokeLevel == 'min' ? '' : this.CurrentCell.classifyInvokeLevel - }; - } else { - // this.injectHandleReset(); - } - } else if (column.property == 'componentRule') { - if (this.CurrentCell) { - // this.CurrentCell.componentRule = this.componentRuleText; - } - this.isShowformulaEdit = true; - } else if (column.property == 'enumString') { - this.enumVisible = true; - if (this.attrSelectList[0].enumString != "") { - this.tableData = JSON.parse(this.attrSelectList[0].enumString) - return - } - } else if (column.property == 'parentCode') { - gridCodeClassifyTemplateAttr({ - 'conditionMap[classifyTemplateOid]': this.Formlist[0].oid, - 'conditionMap[oid_notequal]': this.CurrentCell.oid, - limit: -1 - }).then(res => { - this.CascadeData = res.data.data; - }) - this.CascadeVisible = true; - } else if (column.property == 'verifyRule') { - this.RulesForm.expressionTextt = this.CurrentCell.verifyRule; - this.rulesVisible = true; - } else if (column.property == 'attributeGroup') { - this.attrVisible = true; - if (this.CurrentCell.attributeGroup !== '') { - this.attrModel = this.CurrentCell.attributeGroup - } + }; + + if (column.property in columnActions) { + columnActions[column.property](); } } }, saveRows() { this.editingRows = null; this.editShows = null; - const inputElement = document.querySelector(`#inputRef${this.CurrentCell.oid}`); - if (inputElement) { - inputElement.blur(); - } + // const inputElement = document.querySelector(`#inputRef${this.CurrentCell.oid}`); + // if (inputElement) { + // inputElement.blur(); + // } }, // 鏋氫妇娉ㄥ叆娣诲姞涓�琛岀┖鏁版嵁 addRow() { @@ -2015,32 +2034,35 @@ }, //鍒嗙被娉ㄥ叆淇濆瓨 injectAddHandle() { - // 瀹氫箟灞曠ず绫诲瀷 - let data = { - "娉ㄥ叆绫诲瀷": this.injectOption.classifyInvokeAttr, - "娉ㄥ叆绫诲瀷鍚嶇О": this.injectOption.classifyInvokeAttrName, - "灞傜骇璁剧疆": this.injectOption.classifyInvokeLevel == 'max' ? this.injectOption.classifyNumber : 'min', - "鏄惁鍙慨鏀�": this.injectOption.classifyInvokeEditFlag - } - //鍕鹃�夋搷浣� + const { + classifyInvokeAttr, + classifyInvokeAttrName, + classifyInvokeLevel, + classifyInvokeEditFlag, + classifyNumber + } = this.injectOption; + + const data = { + "娉ㄥ叆绫诲瀷": classifyInvokeAttr, + "娉ㄥ叆绫诲瀷鍚嶇О": classifyInvokeAttrName, + "灞傜骇璁剧疆": classifyInvokeLevel === 'max' ? classifyNumber : 'min', + "鏄惁鍙慨鏀�": classifyInvokeEditFlag + }; for (const key in this.injectOption) { this.attrSelectList[0][key] = this.injectOption[key]; - //濡傛灉鏄寚瀹氬眰璧嬪�间负鏁板瓧 - if (this.injectOption.classifyInvokeLevel !== 'min') { - this.attrSelectList[0].classifyInvokeLevel = this.injectOption.classifyNumber + if (classifyInvokeLevel !== 'min') { + this.attrSelectList[0].classifyInvokeLevel = classifyNumber; } else { - this.attrSelectList[0].classifyInvokeLevel = 'min' + this.attrSelectList[0].classifyInvokeLevel = 'min'; } - this.$set(this.attrSelectList[0], 'classifyInvokeText', data) + this.$set(this.attrSelectList[0], 'classifyInvokeText', data); } - // this.injectHandleReset() - if (this.injectOption.classifyInvokeLevel !== 'min') { - this.injectOption.classifyInvokeLevel = this.injectOption.classifyNumber; + if (classifyInvokeLevel !== 'min') { + this.injectOption.classifyInvokeLevel = classifyNumber; } else { this.injectOption.classifyNumber = 0; } this.injectVisible = false; - }, //鍒嗙被娉ㄥ叆娓呯┖ injectHandleReset() { @@ -2106,7 +2128,7 @@ this.editStyleFlag = true; this.attrEditVisible = true; this.attrFlag = true; - this.AddCellFlag=true; + this.AddCellFlag = true; } }, @@ -2120,7 +2142,7 @@ updataFormlaContent(val) { if (this.CurrentCell) { this.$set(this.CurrentCell, 'componentRule', val.replace(/"/g, '')) - this.componentRuleText= this.CurrentCell.componentRule + this.componentRuleText = this.CurrentCell.componentRule } else { this.$set(this.attrRow, 'componentRule', val.replace(/"/g, '')) } @@ -2137,12 +2159,12 @@ }, // 鎺掑簭 this.AddCellFlag=false; sortChange(val) { - console.log(val) + // console.log(val) }, //寮�鍚紪杈� editOpen() { this.editOpenFlag = true; - this.AddCellFlag=false; + this.AddCellFlag = false; }, //瀹氫箟涓�涓叧闂紪杈戠殑鏂规硶渚涘瓙缁勪欢浣跨敤 editClose() { @@ -2159,6 +2181,27 @@ </script> <style lang="scss" scoped> +//鍥哄畾鍒楅珮搴� +/deep/ .el-table__fixed { + height: calc(100vh - 612px)!important; +} + +// 婊氬姩鏉℃牱寮忎慨鏀� +// 婊氬姩鏉$殑瀹藉害 +/deep/ .el-table__body-wrapper::-webkit-scrollbar { + height: 15px; // 绾靛悜婊氬姩鏉� 蹇呭啓 + background: white; + border: white; + width: 10px; + +} +// 婊氬姩鏉$殑婊戝潡 +/deep/ .el-table__body-wrapper::-webkit-scrollbar-thumb { + background-color: #ececec; + border-radius: 20px; + border: #ececec; +} + .app { /deep/ .el-button { //margin: 0 10px 10px 0; -- Gitblit v1.9.3