This commit is contained in:
linfso 2025-03-13 21:24:05 +08:00
parent d35aa6049a
commit 20c2d47c32
2 changed files with 37 additions and 14 deletions

View File

@ -300,7 +300,7 @@ export default {
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.emisSettleSubBillList = this.emisSettleSubBillList.sort(
this.emisCreditCustomerList = this.emisCreditCustomerList.sort(
this.sortFun(column.prop, column.order === 'ascending')
);
},
@ -349,12 +349,7 @@ export default {
this.selectionList=selection;
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {
this.currentId=null;

View File

@ -124,7 +124,7 @@
{{ scope.row.useMoney }}
</template>
</el-table-column>
<el-table-column :label="$t('剩余比例(%)')" align="center" prop="curMoneyRate" min-width="130" >
<el-table-column :label="$t('剩余比例(%)')" align="center" prop="curMoneyRate" min-width="130" :sortable="true">
<template slot-scope="scope">
{{ ( ((scope.row.creditMoney - scope.row.useMoney)/scope.row.creditMoney)*100 ).toFixed(2) }}%
</template>
@ -232,6 +232,40 @@ export default {
this.getList();
},
methods: {
getProperty(obj, str) {
str = str.replace(/\[(\w+)\]/g, ".$1"); // 处理数组下标
let arr = str.split(".");
for (let i in arr) {
obj = obj[arr[i]] || "";
}
return obj;
},
sortFun: function (attr, rev) {
//第一个参数传入info里的prop表示排的是哪一列,第二个参数是升还是降排序
if (rev == undefined||rev==null) {
rev = 1;
} else {
rev = (rev) ? 1 : -1;
}
let that=this;
return function (a, b) {
a = that.getProperty(a,attr);
b = that.getProperty(b,attr);
if (a < b) {
return rev * -1;
}
if (a > b) {
return rev * 1;
}
return 0;
}
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.emisCreditSalesmenList = this.emisCreditSalesmenList.sort(
this.sortFun(column.prop, column.order === 'ascending')
);
},
/** 查询销售信用额度列表 */
getList() {
this.loading = true;
@ -285,12 +319,6 @@ export default {
this.single = selection.length!==1
this.multiple = !selection.length
},
// 排序 查询字段是表格中字段名字 动态取值排序顺序
handleSortChange(column) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
/** 新增按钮操作 */
handleAdd(row) {
this.currentId=null;