Browse Source

feat: 自定义显示列支持设置固定列尾

old
PBK-B 4 years ago
parent
commit
954ccf07b4
  1. 40
      src/views/form/statistics/list.vue

40
src/views/form/statistics/list.vue

@ -47,6 +47,7 @@
{{ scope.row[col] }} {{ scope.row[col] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-for="col in otherCustomColumns" v-for="col in otherCustomColumns"
:key="col" :label="projectItemColumns[col]" :key="col" :label="projectItemColumns[col]"
@ -56,6 +57,16 @@
{{ scope.row['processData'][col] }} {{ scope.row['processData'][col] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
v-for="col in fixedFormTailColumns" :key="`t${col}`"
:label="fixedDefaultLabelFormTailColumn[col]"
>
<template slot-scope="scope">
{{ scope.row[col] }}
</template>
</el-table-column>
<el-table-column <el-table-column
:render-header="renderHeader" :render-header="renderHeader"
fixed="right" fixed="right"
@ -123,6 +134,14 @@
</el-col> </el-col>
</el-row> </el-row>
</el-checkbox-group> </el-checkbox-group>
<el-divider />
<el-checkbox-group v-model="checkedFixedTailCustomColumns">
<el-row>
<el-col v-for="(val, key) in fixedDefaultLabelFormTailColumn" :key="key" :span="4">
<el-checkbox :label="key">{{ val }}</el-checkbox>
</el-col>
</el-row>
</el-checkbox-group>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="customColumnDialogVisible = false"> </el-button> <el-button @click="customColumnDialogVisible = false"> </el-button>
<el-button type="primary" @click="saveStatisticsCheckedColumns"> </el-button> <el-button type="primary" @click="saveStatisticsCheckedColumns"> </el-button>
@ -139,8 +158,12 @@ import ResultItem from './item'
import DataFilter from './filter' import DataFilter from './filter'
import {getCheckedColumn, saveCheckedColumn} from '@/utils/db' import {getCheckedColumn, saveCheckedColumn} from '@/utils/db'
const fixedDefaultFormColumn = ['serialNumber', 'submitAddress', 'createTime'] //
const fixedDefaultLabelFormColumn = {serialNumber: '提交序号', submitAddress: '提交地址', createTime: '提交时间'} const fixedDefaultFormColumn = ['serialNumber']
const fixedDefaultLabelFormColumn = {serialNumber: '提交序号'}
//
const fixedDefaultFormTailColumn = ['submitAddress', 'createTime']
const fixedDefaultLabelFormTailColumn = { submitAddress: '提交地址', createTime: '提交时间'}
export default { export default {
name: 'ProjectStatisticsList', name: 'ProjectStatisticsList',
@ -156,9 +179,12 @@ export default {
checkedFilterColumns: [], checkedFilterColumns: [],
// //
fixedCustomColumns: fixedDefaultFormColumn, fixedCustomColumns: fixedDefaultFormColumn,
fixedFormTailColumns: fixedDefaultFormTailColumn,
// //
checkedFixedCustomColumns: fixedDefaultFormColumn, checkedFixedCustomColumns: fixedDefaultFormColumn,
fixedDefaultLabelFormColumn: fixedDefaultLabelFormColumn, fixedDefaultLabelFormColumn: fixedDefaultLabelFormColumn,
checkedFixedTailCustomColumns: fixedDefaultFormTailColumn,
fixedDefaultLabelFormTailColumn: fixedDefaultLabelFormTailColumn,
// //
checkOtherCustomColumns: [], checkOtherCustomColumns: [],
otherCustomColumns: [], otherCustomColumns: [],
@ -223,9 +249,11 @@ export default {
this.customColumnDialogVisible = false this.customColumnDialogVisible = false
this.fixedCustomColumns = this.checkedFixedCustomColumns this.fixedCustomColumns = this.checkedFixedCustomColumns
this.otherCustomColumns = this.checkOtherCustomColumns this.otherCustomColumns = this.checkOtherCustomColumns
this.fixedFormTailColumns = this.checkedFixedTailCustomColumns
saveCheckedColumn(this.projectKey, { saveCheckedColumn(this.projectKey, {
fixedCustomColumns: this.fixedCustomColumns, fixedCustomColumns: this.fixedCustomColumns,
otherCustomColumns: this.otherCustomColumns otherCustomColumns: this.otherCustomColumns,
fixedCustomTailColumns: this.fixedFormTailColumns
}) })
}, },
getDbCheckedColumns() { getDbCheckedColumns() {
@ -233,7 +261,7 @@ export default {
if (!checkedColumn) { if (!checkedColumn) {
return return
} }
let {fixedCustomColumns, otherCustomColumns} = checkedColumn let {fixedCustomColumns, otherCustomColumns, fixedCustomTailColumns} = checkedColumn
if (fixedCustomColumns) { if (fixedCustomColumns) {
this.fixedCustomColumns = fixedCustomColumns this.fixedCustomColumns = fixedCustomColumns
this.checkedFixedCustomColumns = fixedCustomColumns this.checkedFixedCustomColumns = fixedCustomColumns
@ -242,6 +270,10 @@ export default {
this.otherCustomColumns = otherCustomColumns this.otherCustomColumns = otherCustomColumns
this.checkOtherCustomColumns = otherCustomColumns this.checkOtherCustomColumns = otherCustomColumns
} }
if (fixedCustomTailColumns) {
this.fixedCustomTailColumns = fixedCustomTailColumns
this.checkedFixedTailCustomColumns = fixedCustomTailColumns
}
}, },
downloadProjectResultFile() { downloadProjectResultFile() {
if (!this.total) { if (!this.total) {

Loading…
Cancel
Save