|
@@ -12,7 +12,7 @@
|
|
|
filterable
|
|
|
:placeholder="`请选择${item.label}`"
|
|
|
@clear="toClear(item.model)"
|
|
|
- @change="(data) => filterReturn(data, item)"
|
|
|
+ @change="data => filterReturn(data, item)"
|
|
|
>
|
|
|
<slot name="options" v-bind="{ item }"></slot>
|
|
|
</el-select>
|
|
@@ -63,7 +63,14 @@
|
|
|
<template v-for="(item, index) in fields">
|
|
|
<template v-if="!item.notable">
|
|
|
<template v-if="item.custom">
|
|
|
- <el-table-column :key="index" align="center" :label="item.label" v-bind="item.options" :show-overflow-tooltip="item.showTip || true">
|
|
|
+ <el-table-column
|
|
|
+ :key="index"
|
|
|
+ align="center"
|
|
|
+ :label="item.label"
|
|
|
+ v-bind="item.options"
|
|
|
+ :show-overflow-tooltip="item.showTip || true"
|
|
|
+ :width="item.width"
|
|
|
+ >
|
|
|
<template v-slot="{ row }">
|
|
|
<slot name="custom" v-bind="{ item, row }"></slot>
|
|
|
</template>
|
|
@@ -75,6 +82,7 @@
|
|
|
align="center"
|
|
|
:label="item.label"
|
|
|
:prop="item.model"
|
|
|
+ :width="item.width"
|
|
|
:formatter="toFormatter"
|
|
|
:sortable="isMobile"
|
|
|
v-bind="item.options"
|
|
@@ -173,7 +181,7 @@ export default {
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
toFormatter(row, column, cellValue, index) {
|
|
|
- let this_fields = this.fields.filter((fil) => fil.model === column.property);
|
|
|
+ let this_fields = this.fields.filter(fil => fil.model === column.property);
|
|
|
if (this_fields.length > 0) {
|
|
|
let format = _.get(this_fields[0], `format`, false);
|
|
|
if (format) {
|
|
@@ -217,8 +225,8 @@ export default {
|
|
|
// console.log(row);
|
|
|
//根据row是否再pageSelected中,判断是添加还是删除
|
|
|
let res = [];
|
|
|
- if (this.pageSelected.find((i) => i.id === row.id)) {
|
|
|
- res = this.pageSelected.filter((f) => f.id !== row.id);
|
|
|
+ if (this.pageSelected.find(i => i.id === row.id)) {
|
|
|
+ res = this.pageSelected.filter(f => f.id !== row.id);
|
|
|
} else {
|
|
|
this.pageSelected.push(row);
|
|
|
res = this.pageSelected;
|
|
@@ -243,8 +251,8 @@ export default {
|
|
|
initSelection() {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.table.clearSelection();
|
|
|
- this.selected.forEach((info) => {
|
|
|
- let d = this.data.filter((p) => p.id === info.id);
|
|
|
+ this.selected.forEach(info => {
|
|
|
+ let d = this.data.filter(p => p.id === info.id);
|
|
|
if (d.length > 0) this.$refs.table.toggleRowSelection(d[0]);
|
|
|
});
|
|
|
});
|
|
@@ -270,9 +278,9 @@ export default {
|
|
|
this.$emit('query', { skip: 0, limit: this.limit, ...this.searchInfo });
|
|
|
},
|
|
|
getFilterList() {
|
|
|
- let res = this.fields.filter((f) => _.get(f, 'filter', false));
|
|
|
+ let res = this.fields.filter(f => _.get(f, 'filter', false));
|
|
|
this.$set(this, `useFilter`, res.length > 0);
|
|
|
- res.map((i) => {
|
|
|
+ res.map(i => {
|
|
|
if (i.filter === 'date' && this.searchInfo[i.porp] === undefined) this.$set(this.searchInfo, i.model, []);
|
|
|
});
|
|
|
res = [...res, ...this.filter];
|
|
@@ -281,7 +289,7 @@ export default {
|
|
|
filterSearch() {
|
|
|
this.currentPage = 1;
|
|
|
const query = _.cloneDeep(this.searchInfo);
|
|
|
- const dateType = this.fields.filter((f) => f.filter === 'date');
|
|
|
+ const dateType = this.fields.filter(f => f.filter === 'date');
|
|
|
if (dateType.length > 0) {
|
|
|
for (const i of dateType) {
|
|
|
const { model } = i;
|
|
@@ -318,14 +326,14 @@ export default {
|
|
|
continue;
|
|
|
}
|
|
|
// 判断是否需要计算
|
|
|
- const inlist = this.sumcol.find((f) => f == model);
|
|
|
+ const inlist = this.sumcol.find(f => f == model);
|
|
|
if (!inlist) {
|
|
|
result.push('');
|
|
|
continue;
|
|
|
}
|
|
|
let res = 0;
|
|
|
// 整理出要计算的属性(只取出数字或者可以为数字的值)
|
|
|
- const resetList = data.map((i) => {
|
|
|
+ const resetList = data.map(i => {
|
|
|
const d = _.get(i, model);
|
|
|
const res = reg.test(d);
|
|
|
if (res) return d * 1;
|