|
@@ -65,6 +65,25 @@
|
|
|
</div>
|
|
|
</a-card>
|
|
|
<a-card size="small" :bordered="false" class="conFrontModal-wrap">
|
|
|
+ <div class="action-bar">
|
|
|
+ 列显示
|
|
|
+ <a-popover title="勾选显示列" trigger="click">
|
|
|
+ <template slot="content">
|
|
|
+ <div style="width:150px;">
|
|
|
+ <a-checkbox-group v-model="showCols">
|
|
|
+ <a-row>
|
|
|
+ <a-col :span="24" v-for="item in showColsOptions" :key="item.value">
|
|
|
+ <a-checkbox v-show="item.show" :value="item.value">{{ item.label }}</a-checkbox>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-checkbox-group>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <a-button type="link" size="small">
|
|
|
+ 设置 <a-icon type="setting" />
|
|
|
+ </a-button>
|
|
|
+ </a-popover>
|
|
|
+ </div>
|
|
|
<!-- 列表 -->
|
|
|
<s-table
|
|
|
class="sTable"
|
|
@@ -172,10 +191,28 @@ export default {
|
|
|
detailData: null,
|
|
|
dealear: null,
|
|
|
verifyAccountBillSn: undefined,
|
|
|
- orderType: 0
|
|
|
+ orderType: 0,
|
|
|
+ showCols: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ showColsOptions () {
|
|
|
+ return [
|
|
|
+ { label: '序号', value: 'no', show: false },
|
|
|
+ { label: '年', value: 'year', show: false },
|
|
|
+ { label: '月', value: 'month', show: false },
|
|
|
+ { label: '日', value: 'day', show: false },
|
|
|
+ { label: '业务单号', value: 'bizNo', show: false },
|
|
|
+ { label: '业务类型', value: 'bizTypeDictValue', show: false },
|
|
|
+ { label: '费用/调拨类型', value: 'expenseAllocateType', show: true },
|
|
|
+ { label: '摘要', value: 'digestInfo', show: true },
|
|
|
+ { label: '客诉索赔编码', value: 'productCode', show: true },
|
|
|
+ { label: '借方金额', value: 'debitAmount', show: false },
|
|
|
+ { label: '贷方金额', value: 'creditorAmount', show: false },
|
|
|
+ { label: '余额', value: 'totalAmount', show: true },
|
|
|
+ { label: '备注', value: 'remarks', show: true }
|
|
|
+ ]
|
|
|
+ },
|
|
|
columns () {
|
|
|
const renderContent = (value, row, index) => {
|
|
|
const obj = {
|
|
@@ -204,7 +241,7 @@ export default {
|
|
|
{ title: '月', dataIndex: 'month', width: '4%', align: 'center', customRender: renderContent },
|
|
|
{ title: '日', dataIndex: 'day', width: '4%', align: 'center', customRender: renderContent },
|
|
|
{ title: '业务单号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: renderContent }
|
|
|
- ]
|
|
|
+ ].filter(item => this.showCols.includes(item.dataIndex))
|
|
|
}
|
|
|
]
|
|
|
},
|
|
@@ -221,7 +258,7 @@ export default {
|
|
|
align: 'center',
|
|
|
customRender: renderContent
|
|
|
}
|
|
|
- ]
|
|
|
+ ].filter(item => this.showCols.includes(item.dataIndex))
|
|
|
}
|
|
|
]
|
|
|
},
|
|
@@ -234,7 +271,7 @@ export default {
|
|
|
{ title: '摘要', dataIndex: 'digestInfo', width: '10%', align: 'center', customRender: renderContent },
|
|
|
{ title: '客诉索赔编码', dataIndex: 'productCode', width: '8%', align: 'center', customRender: renderContent },
|
|
|
{ title: '借方', dataIndex: 'debitAmount', width: '6%', align: 'right', customRender: renderContent }
|
|
|
- ]
|
|
|
+ ].filter(item => this.showCols.includes(item.dataIndex))
|
|
|
}
|
|
|
]
|
|
|
},
|
|
@@ -247,7 +284,7 @@ export default {
|
|
|
{ title: '贷方', dataIndex: 'creditorAmount', width: '6%', align: 'right', customRender: renderContent },
|
|
|
{ title: '余额', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: renderContent },
|
|
|
{ title: '备注', dataIndex: 'remarks', width: '15%', align: 'center', customRender: renderContent }
|
|
|
- ]
|
|
|
+ ].filter(item => this.showCols.includes(item.dataIndex))
|
|
|
}
|
|
|
]
|
|
|
}
|
|
@@ -290,23 +327,25 @@ export default {
|
|
|
this.$emit('cancel')
|
|
|
},
|
|
|
appendSplitMergedRow (ws, firstValue, secondValue) {
|
|
|
+ const colsLen = this.showCols.length
|
|
|
+ const s = Math.floor((colsLen % 2 == 0) ? (colsLen / 2) : ((colsLen - 1) / 2))
|
|
|
// 1. 获取当前数据范围
|
|
|
const range = XLSX.utils.decode_range(ws['!ref'])
|
|
|
const newRowNum = range.e.r + 1
|
|
|
|
|
|
// 2. 填充基础数据(仅设置有效单元格)
|
|
|
ws[XLSX.utils.encode_cell({ r: newRowNum, c: 0 })] = { v: firstValue, t: 's' } // 前7列合并值
|
|
|
- ws[XLSX.utils.encode_cell({ r: newRowNum, c: 7 })] = { v: secondValue, t: 's' } // 后6列合并值
|
|
|
+ ws[XLSX.utils.encode_cell({ r: newRowNum, c: s + 1 })] = { v: secondValue, t: 's' } // 后6列合并值
|
|
|
|
|
|
// 3. 设置合并区域
|
|
|
if (!ws['!merges']) ws['!merges'] = []
|
|
|
// 前7列合并(0-6列)
|
|
|
ws['!merges'].push(XLSX.utils.decode_range(
|
|
|
- `${XLSX.utils.encode_cell({ r: newRowNum, c: 0 })}:${XLSX.utils.encode_cell({ r: newRowNum, c: 6 })}`
|
|
|
+ `${XLSX.utils.encode_cell({ r: newRowNum, c: 0 })}:${XLSX.utils.encode_cell({ r: newRowNum, c: s })}`
|
|
|
))
|
|
|
// 后6列合并(7-12列)
|
|
|
ws['!merges'].push(XLSX.utils.decode_range(
|
|
|
- `${XLSX.utils.encode_cell({ r: newRowNum, c: 7 })}:${XLSX.utils.encode_cell({ r: newRowNum, c: 12 })}`
|
|
|
+ `${XLSX.utils.encode_cell({ r: newRowNum, c: s + 1 })}:${XLSX.utils.encode_cell({ r: newRowNum, c: colsLen - 1 })}`
|
|
|
))
|
|
|
|
|
|
// 4. 更新数据范围
|
|
@@ -320,7 +359,8 @@ export default {
|
|
|
// console.log(ws)
|
|
|
|
|
|
// 4. 设置列宽
|
|
|
- ws['!cols'] = Array(13).fill().map((item, index) => ({ wch: index < 4 ? 6 : 20 }))
|
|
|
+ const colsLen = this.showCols.length
|
|
|
+ ws['!cols'] = Array(colsLen).fill().map((item, index) => ({ wch: index < 4 ? 6 : 20 }))
|
|
|
|
|
|
// 追加备注
|
|
|
const range = XLSX.utils.decode_range(ws['!ref'])
|
|
@@ -328,7 +368,7 @@ export default {
|
|
|
|
|
|
// 填充数据(首列填值,其余留空)
|
|
|
const mergedValue = '备注:' + this.detailData.remarks
|
|
|
- for (let col = 0; col < 13; col++) {
|
|
|
+ for (let col = 0; col < colsLen; col++) {
|
|
|
const cellRef = XLSX.utils.encode_cell({ r: newRowNum, c: col })
|
|
|
ws[cellRef] = { v: col === 0 ? mergedValue : '', t: 's' }
|
|
|
}
|
|
@@ -336,7 +376,7 @@ export default {
|
|
|
// 设置全列合并(0-12列)
|
|
|
if (!ws['!merges']) ws['!merges'] = []
|
|
|
ws['!merges'].push(XLSX.utils.decode_range(
|
|
|
- `${XLSX.utils.encode_cell({ r: newRowNum, c: 0 })}:${XLSX.utils.encode_cell({ r: newRowNum, c: 12 })}`
|
|
|
+ `${XLSX.utils.encode_cell({ r: newRowNum, c: 0 })}:${XLSX.utils.encode_cell({ r: newRowNum, c: colsLen - 1 })}`
|
|
|
))
|
|
|
|
|
|
// 4. 更新数据范围
|
|
@@ -417,6 +457,9 @@ export default {
|
|
|
watch: {
|
|
|
show (newValue, oldValue) {
|
|
|
this.opened = newValue
|
|
|
+ if (newValue) {
|
|
|
+ this.showCols = ['no', 'year', 'month', 'day', 'bizNo', 'bizTypeDictValue', 'expenseAllocateType', 'digestInfo', 'productCode', 'debitAmount', 'creditorAmount', 'totalAmount', 'remarks']
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -428,6 +471,9 @@ export default {
|
|
|
text-align: center;
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
+ .action-bar{
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
.conFrontModal-flex{
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|