From c65bef88b478c0ddb8ee4e7ee60d1aa15789aca2 Mon Sep 17 00:00:00 2001 From: linfso Date: Tue, 6 Aug 2024 13:51:10 +0800 Subject: [PATCH] md --- src/components/XdTable/index.vue | 97 +++++++++++-------- .../SubBillConfirmByMoneyList.vue | 4 +- .../emis/emisWaybill/sendWaybillList.vue | 12 ++- .../emis/emisWaybill/sendWaybillListNew.vue | 9 +- 4 files changed, 73 insertions(+), 49 deletions(-) diff --git a/src/components/XdTable/index.vue b/src/components/XdTable/index.vue index 2469fe7b..f3bc1c82 100644 --- a/src/components/XdTable/index.vue +++ b/src/components/XdTable/index.vue @@ -60,7 +60,7 @@
保存 - +
@@ -651,7 +651,7 @@ export default { }, }, mounted() { - // // console.log("===>xdtabe mounted==111->"); + // console.log("===>xdtabe mounted==111->"); if(this.saveStorageName&&this.saveStorageName!=undefined&&this.saveStorageName!=''){ this.isNeedDbSaveTpl=true; }else{ @@ -737,21 +737,11 @@ export default { // // console.log("===>changeTbShowTpl==111->",tplItem); this.form=Object.assign({},tplItem); if(this.form.tplData){ - this.storageList=JSON.parse(this.form.tplData); - - // 必须在节点数组存在的才有意义 - let list = this.storageList.filter(item => this.$vnode.componentOptions.children.find(n => { - return n.componentOptions && item.prop === n.componentOptions.propsData.prop - })) - - // // console.log("===>changeTbShowTpl==222->",tplItem); - this.storageList = list; + let tplColList=JSON.parse(this.form.tplData); // 保存模版数据到本地 - this.storeTplToLocal(); - // // console.log("===>changeTbShowTpl==444->",tplItem); - - this.updateTable() - // // console.log("===>changeTbShowTpl==555->",tplItem); + this.storeTplToLocal(tplColList); + this.initStorage(); + this.updateTable(); } } }else{ @@ -765,7 +755,7 @@ export default { tplData: null, } window.localStorage.removeItem('tableStorage'); - this.reload(); + this.reInitList(); } }, async initDefaultTplList() { @@ -836,10 +826,10 @@ export default { this.$modal.confirm('是否确认删除').then(function() { return delSysCustomizeTpl(ids); }).then(() => { + this.curentTbShowTpl=null; this.initDefaultTplList(); this.openTbShowTplDlg=false; this.changeTbShowTpl(null); - this.$modal.msgSuccess("删除成功"); }).catch(() => {}); }, @@ -1056,15 +1046,33 @@ export default { data1.factor === data2.factor ); }, + // 重新初始化 + reInitList() { + let list=[]; + this.$vnode.componentOptions.children.forEach(node => { + // 以prop为准,因为可能会改文本 + if (!(!node.componentOptions || node.componentOptions.propsData.type) && list.findIndex(i => i.prop === node.componentOptions.propsData.prop) < 0) { + // 非插槽且 不是特殊类型的 找不到就加上 + const propsData = JSON.parse(JSON.stringify(node.componentOptions.propsData)) + if (propsData.fixed === undefined || propsData.fixed === false) { + propsData.fixed = false + } else { + propsData.fixed = propsData.fixed ? propsData.fixed : 'left' + } + list.push({ + fixed: false, // 默认新增的都是不固定 + show: true, // 默认新增的都是显示的 + ...propsData + }) + } + }) - // 动态列渲染表格时,需要在列渲染完成后重新渲染一下表格 - reload() { - this.$nextTick(() => { + this.storeTplToLocal(list) this.initStorage() this.updateTable() this.initSort(); - }) }, + download(){ this.$emit("download"); }, @@ -1097,21 +1105,10 @@ export default { const storage = window.localStorage.getItem('tableStorage') ? JSON.parse(window.localStorage.getItem('tableStorage')) : {} storage[this.saveStorageName] = [] window.localStorage.setItem('tableStorage', JSON.stringify(storage)) - location.reload() - }) - }, - delAllStorage() { - this.$confirm('重置将清除系统设置并刷新页面是否继续?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - window.localStorage.removeItem('tableStorage') - location.reload() - }) - // window.localStorage.removeItem('tableStorage'); - // this.reload(); + this.changeSaveTbShowTpl(null); + this.reInitList(); + }) }, handleCheckAllChange(isCheckAll){ if(isCheckAll){ @@ -1169,13 +1166,14 @@ export default { this.storageList = [] let list = []; const storage = window.localStorage.getItem('tableStorage') ? JSON.parse(window.localStorage.getItem('tableStorage')) : {} - // 不管是否初次还是要做一下处理,万一页面有修改,做一下更新,以最新的node节点数组为准 + if(this.showCustomizeTpl && this.saveStorageName!=undefined && this.saveStorageName!=''){ list = storage[this.saveStorageName] ? storage[this.saveStorageName] : [] } + // 不管是否初次还是要做一下处理,万一页面有修改,做一下更新,以最新的node节点数组为准 this.$vnode.componentOptions.children.forEach(node => { - // 以label为准,因为可能会改文本 + // 以prop为准,因为可能会改文本 if (!(!node.componentOptions || node.componentOptions.propsData.type) && list.findIndex(i => i.prop === node.componentOptions.propsData.prop) < 0) { // 非插槽且 不是特殊类型的 找不到就加上 const propsData = JSON.parse(JSON.stringify(node.componentOptions.propsData)) @@ -1191,15 +1189,28 @@ export default { }) } }) + // 必须在节点数组存在的才有意义 list = list.filter(item => this.$vnode.componentOptions.children.find(n => { - return n.componentOptions && item.prop === n.componentOptions.propsData.prop + return n.componentOptions && n.componentOptions.propsData.label && item.prop === n.componentOptions.propsData.prop })) - this.storageList = list + // 去除重复数据 + let map = new Map(); + let list2 = []; // 数组用于返回结果 + for (let i = 0; i < list.length; i++) { + if(map.has(list[i].prop)) { // 如果有该key值 + map.set(list[i].prop, true); + } else { + map.set(list[i].prop, false); // 如果没有该key值 + list2.push(list[i]); + } + } + list=list2; + + this.storageList = list2 }, // 根据缓存的数组进行渲染表格 updateTable() { - // 特殊类型 const childrenNodes = this.$vnode.componentOptions.children.filter(node => node.componentOptions && node.componentOptions.propsData.type) this.storageList.forEach(item => { @@ -1221,9 +1232,9 @@ export default { this.config.listeners = this.$listeners; // 通过key值触发表格刷新,避免拖拽由于数组长度一致导致diff算法无法识别 - this.config.key = Math.random() + '' + // this.config.key = Math.random() + '' // 控制下表格重新刷新 - // this.getInstance()?.doLayout() + this.getInstance()?.doLayout() if(this.showCustomizeTpl){ this.storeTplToLocal(this.storageList); }else{ diff --git a/src/views/emis/emisSettleSubBill/SubBillConfirmByMoneyList.vue b/src/views/emis/emisSettleSubBill/SubBillConfirmByMoneyList.vue index 0cae7129..4b0a3c7c 100644 --- a/src/views/emis/emisSettleSubBill/SubBillConfirmByMoneyList.vue +++ b/src/views/emis/emisSettleSubBill/SubBillConfirmByMoneyList.vue @@ -177,7 +177,7 @@ v-hasPermi="['emis:emisSettleSubBill:confirmNoBillByCenter']" >确认不出账 - + - + @@ -907,6 +909,12 @@ export default { }, /** 搜索按钮操作 */ handleQuery() { + + // 清除已选择 + if(this.ids&&this.ids.length>0){ + this.$refs.refTable.clearSelection(); + } + this.queryParams.pageNum = 1; this.getList(); }, diff --git a/src/views/emis/emisWaybill/sendWaybillListNew.vue b/src/views/emis/emisWaybill/sendWaybillListNew.vue index 944b7745..a854a3fb 100644 --- a/src/views/emis/emisWaybill/sendWaybillListNew.vue +++ b/src/views/emis/emisWaybill/sendWaybillListNew.vue @@ -504,12 +504,12 @@ - + @@ -957,6 +957,11 @@ export default { }, /** 搜索按钮操作 */ handleQuery() { + // 清除已选择 + if(this.ids&&this.ids.length>0){ + this.$refs.refTable.clearSelection(); + } + this.queryParams.pageNum = 1; this.getList(); },