This commit is contained in:
linfso 2024-08-06 13:51:10 +08:00
parent 02daee2ffa
commit c65bef88b4
4 changed files with 73 additions and 49 deletions

View File

@ -60,7 +60,7 @@
<div style="text-align: right;width: 45%;line-height: 30px;display:inline-flex"> <div style="text-align: right;width: 45%;line-height: 30px;display:inline-flex">
<el-button type="text" size="mini" style="padding: 7px 5px;" @click="savaTbShowTpl" :disabled="!isNeedDbSaveTpl">保存</el-button> <el-button type="text" size="mini" style="padding: 7px 5px;" @click="savaTbShowTpl" :disabled="!isNeedDbSaveTpl">保存</el-button>
<el-button type="text" size="mini" style="padding: 7px 5px;" icon="el-icon-refresh" @click="delStorage" ></el-button> <!-- <el-button type="text" size="mini" style="padding: 7px 5px;" icon="el-icon-refresh" @click="delStorage" ></el-button> -->
<el-button type="text" size="mini" style="padding: 7px 5px;" icon="el-icon-setting" @click="setTbShowTpl" :disabled="!isNeedDbSaveTpl"></el-button> <el-button type="text" size="mini" style="padding: 7px 5px;" icon="el-icon-setting" @click="setTbShowTpl" :disabled="!isNeedDbSaveTpl"></el-button>
</div> </div>
</div> </div>
@ -651,7 +651,7 @@ export default {
}, },
}, },
mounted() { mounted() {
// // console.log("===>xdtabe mounted==111->"); // console.log("===>xdtabe mounted==111->");
if(this.saveStorageName&&this.saveStorageName!=undefined&&this.saveStorageName!=''){ if(this.saveStorageName&&this.saveStorageName!=undefined&&this.saveStorageName!=''){
this.isNeedDbSaveTpl=true; this.isNeedDbSaveTpl=true;
}else{ }else{
@ -737,21 +737,11 @@ export default {
// // console.log("===>changeTbShowTpl==111->",tplItem); // // console.log("===>changeTbShowTpl==111->",tplItem);
this.form=Object.assign({},tplItem); this.form=Object.assign({},tplItem);
if(this.form.tplData){ if(this.form.tplData){
this.storageList=JSON.parse(this.form.tplData); let tplColList=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;
// 保存模版数据到本地 // 保存模版数据到本地
this.storeTplToLocal(); this.storeTplToLocal(tplColList);
// // console.log("===>changeTbShowTpl==444->",tplItem); this.initStorage();
this.updateTable();
this.updateTable()
// // console.log("===>changeTbShowTpl==555->",tplItem);
} }
} }
}else{ }else{
@ -765,7 +755,7 @@ export default {
tplData: null, tplData: null,
} }
window.localStorage.removeItem('tableStorage'); window.localStorage.removeItem('tableStorage');
this.reload(); this.reInitList();
} }
}, },
async initDefaultTplList() { async initDefaultTplList() {
@ -836,10 +826,10 @@ export default {
this.$modal.confirm('是否确认删除').then(function() { this.$modal.confirm('是否确认删除').then(function() {
return delSysCustomizeTpl(ids); return delSysCustomizeTpl(ids);
}).then(() => { }).then(() => {
this.curentTbShowTpl=null;
this.initDefaultTplList(); this.initDefaultTplList();
this.openTbShowTplDlg=false; this.openTbShowTplDlg=false;
this.changeTbShowTpl(null); this.changeTbShowTpl(null);
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
@ -1056,15 +1046,33 @@ export default {
data1.factor === data2.factor 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
})
}
})
// 动态列渲染表格时,需要在列渲染完成后重新渲染一下表格 this.storeTplToLocal(list)
reload() {
this.$nextTick(() => {
this.initStorage() this.initStorage()
this.updateTable() this.updateTable()
this.initSort(); this.initSort();
})
}, },
download(){ download(){
this.$emit("download"); this.$emit("download");
}, },
@ -1097,21 +1105,10 @@ export default {
const storage = window.localStorage.getItem('tableStorage') ? JSON.parse(window.localStorage.getItem('tableStorage')) : {} const storage = window.localStorage.getItem('tableStorage') ? JSON.parse(window.localStorage.getItem('tableStorage')) : {}
storage[this.saveStorageName] = [] storage[this.saveStorageName] = []
window.localStorage.setItem('tableStorage', JSON.stringify(storage)) window.localStorage.setItem('tableStorage', JSON.stringify(storage))
location.reload() this.changeSaveTbShowTpl(null);
}) this.reInitList();
},
delAllStorage() {
this.$confirm('重置将清除系统设置并刷新页面是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
window.localStorage.removeItem('tableStorage')
location.reload()
})
// window.localStorage.removeItem('tableStorage');
// this.reload();
})
}, },
handleCheckAllChange(isCheckAll){ handleCheckAllChange(isCheckAll){
if(isCheckAll){ if(isCheckAll){
@ -1169,13 +1166,14 @@ export default {
this.storageList = [] this.storageList = []
let list = []; let list = [];
const storage = window.localStorage.getItem('tableStorage') ? JSON.parse(window.localStorage.getItem('tableStorage')) : {} const storage = window.localStorage.getItem('tableStorage') ? JSON.parse(window.localStorage.getItem('tableStorage')) : {}
// 不管是否初次还是要做一下处理,万一页面有修改,做一下更新,以最新的node节点数组为准
if(this.showCustomizeTpl && this.saveStorageName!=undefined && this.saveStorageName!=''){ if(this.showCustomizeTpl && this.saveStorageName!=undefined && this.saveStorageName!=''){
list = storage[this.saveStorageName] ? storage[this.saveStorageName] : [] list = storage[this.saveStorageName] ? storage[this.saveStorageName] : []
} }
// 不管是否初次还是要做一下处理,万一页面有修改,做一下更新,以最新的node节点数组为准
this.$vnode.componentOptions.children.forEach(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) { 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)) 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 => { 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() { updateTable() {
// 特殊类型 // 特殊类型
const childrenNodes = this.$vnode.componentOptions.children.filter(node => node.componentOptions && node.componentOptions.propsData.type) const childrenNodes = this.$vnode.componentOptions.children.filter(node => node.componentOptions && node.componentOptions.propsData.type)
this.storageList.forEach(item => { this.storageList.forEach(item => {
@ -1221,9 +1232,9 @@ export default {
this.config.listeners = this.$listeners; this.config.listeners = this.$listeners;
// 通过key值触发表格刷新,避免拖拽由于数组长度一致导致diff算法无法识别 // 通过key值触发表格刷新,避免拖拽由于数组长度一致导致diff算法无法识别
this.config.key = Math.random() + '' // this.config.key = Math.random() + ''
// 控制下表格重新刷新 // 控制下表格重新刷新
// this.getInstance()?.doLayout() this.getInstance()?.doLayout()
if(this.showCustomizeTpl){ if(this.showCustomizeTpl){
this.storeTplToLocal(this.storageList); this.storeTplToLocal(this.storageList);
}else{ }else{

View File

@ -177,7 +177,7 @@
v-hasPermi="['emis:emisSettleSubBill:confirmNoBillByCenter']" v-hasPermi="['emis:emisSettleSubBill:confirmNoBillByCenter']"
>确认不出账</el-button> >确认不出账</el-button>
</el-col> </el-col>
<el-col :span="1.5" v-if="activeTab=='waitConfirm'"> <!-- <el-col :span="1.5" v-if="activeTab=='waitConfirm'">
<el-button <el-button
type="primary" type="primary"
plain plain
@ -186,7 +186,7 @@
@click="handleSetBillErrorByCenter" @click="handleSetBillErrorByCenter"
v-hasPermi="['emis:emisSettleSubBill:setBillErrorByCenter']" v-hasPermi="['emis:emisSettleSubBill:setBillErrorByCenter']"
>置账单异常</el-button> >置账单异常</el-button>
</el-col> </el-col> -->
<el-col :span="1.5" v-if="activeTab!='waitConfirm'"> <el-col :span="1.5" v-if="activeTab!='waitConfirm'">
<el-button <el-button
type="danger" type="danger"

View File

@ -271,6 +271,8 @@
ref="refTable" ref="refTable"
:row-key="rowKey" :row-key="rowKey"
storageName="sendWaybillList_main_240702" storageName="sendWaybillList_main_240702"
v-loading="loading" v-loading="loading"
border border
@ -490,12 +492,12 @@
<dict-tag :options="dict.type.emis_payment_type" :value="scope.row.paymentType"/> <dict-tag :options="dict.type.emis_payment_type" :value="scope.row.paymentType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('到付款')" align="center" prop="freight" min-width="80" > <!-- <el-table-column :label="$t('到付款')" align="center" prop="freight" min-width="80" >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.paymentType==3">{{scope.row.freight}}</span> <span v-if="scope.row.paymentType==3">{{scope.row.freight}}</span>
<span v-else>0</span> <span v-else>0</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column :label="$t('运费')" align="center" prop="freight" min-width="80" /> <el-table-column :label="$t('运费')" align="center" prop="freight" min-width="80" />
<el-table-column :label="$t('保价金额')" align="center" prop="insureValue" min-width="80" :show-overflow-tooltip="true"/> <el-table-column :label="$t('保价金额')" align="center" prop="insureValue" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('保费')" align="center" prop="insureFee" min-width="80" :show-overflow-tooltip="true"/> <el-table-column :label="$t('保费')" align="center" prop="insureFee" min-width="80" :show-overflow-tooltip="true"/>
@ -907,6 +909,12 @@ export default {
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
// 清除已选择
if(this.ids&&this.ids.length>0){
this.$refs.refTable.clearSelection();
}
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },

View File

@ -504,12 +504,12 @@
<dict-tag :options="dict.type.emis_payment_type" :value="scope.row.paymentType"/> <dict-tag :options="dict.type.emis_payment_type" :value="scope.row.paymentType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('到付款')" align="center" prop="freight" min-width="80" > <!-- <el-table-column :label="$t('到付款')" align="center" prop="freight" min-width="80" >
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.paymentType==3">{{scope.row.freight}}</span> <span v-if="scope.row.paymentType==3">{{scope.row.freight}}</span>
<span v-else>0</span> <span v-else>0</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column :label="$t('运费')" align="center" prop="freight" min-width="80" /> <el-table-column :label="$t('运费')" align="center" prop="freight" min-width="80" />
<el-table-column :label="$t('保价金额')" align="center" prop="insureValue" min-width="80" :show-overflow-tooltip="true"/> <el-table-column :label="$t('保价金额')" align="center" prop="insureValue" min-width="80" :show-overflow-tooltip="true"/>
<el-table-column :label="$t('保费')" align="center" prop="insureFee" min-width="80" :show-overflow-tooltip="true"/> <el-table-column :label="$t('保费')" align="center" prop="insureFee" min-width="80" :show-overflow-tooltip="true"/>
@ -957,6 +957,11 @@ export default {
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
// 清除已选择
if(this.ids&&this.ids.length>0){
this.$refs.refTable.clearSelection();
}
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },