|
@@ -1,29 +1,33 @@
|
|
<template>
|
|
<template>
|
|
<mx-table ref="table" :prop-defines="resolvedTable.columns" :rows="resolvedTable.rows" border>
|
|
<mx-table ref="table" :prop-defines="resolvedTable.columns" :rows="resolvedTable.rows" border>
|
|
- <template #elective-cell="{value}">
|
|
|
|
- {{ value && value.value }}
|
|
|
|
|
|
+ <template #elective-cell="{value, label}">
|
|
|
|
+ <el-popover trigger="hover" placement="right" :disabled="value&&value.disabled"
|
|
|
|
+ popper-class="zero-padding-popover">
|
|
|
|
+ <div class="fx-column">
|
|
|
|
+ <el-button plain type="text" @click="goDetails(value, label)">查看名单</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <div slot="reference" :style="getCellStyles(value)">
|
|
|
|
+ <span v-if="value.star">*</span>
|
|
|
|
+ <span>{{ value && value.value }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ </el-popover>
|
|
</template>
|
|
</template>
|
|
</mx-table>
|
|
</mx-table>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import MxGroupTranslateMixin from '@/components/Cache/modules/mx-select-translate-mixin'
|
|
|
|
|
|
+import config from '@/common/mx-config'
|
|
|
|
+import MxTransferMixin from '@/components/mx-transfer-mixin'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- mixins: [MxGroupTranslateMixin],
|
|
|
|
|
|
+ mixins: [MxTransferMixin],
|
|
name: 'elective-generation-table',
|
|
name: 'elective-generation-table',
|
|
props: ['chartBinding'],
|
|
props: ['chartBinding'],
|
|
computed: {
|
|
computed: {
|
|
resolvedTable() {
|
|
resolvedTable() {
|
|
- console.log('resolvedTable called', this.listGroupsOptions, this.chartBinding)
|
|
|
|
- if (!this.listGroupsOptions.length) return {}
|
|
|
|
// setting data
|
|
// setting data
|
|
const columns = { groupName: { label: '组合', fixed: true }, expectedCount: { label: '设置人数', fixed: true } }
|
|
const columns = { groupName: { label: '组合', fixed: true }, expectedCount: { label: '设置人数', fixed: true } }
|
|
- const rows = this.chartBinding.generation.status.roundGroups.map(rg => ({
|
|
|
|
- groupId: rg.groupId,
|
|
|
|
- groupName: this.translateGroup(rg.groupId),
|
|
|
|
- expectedCount: rg.personCount
|
|
|
|
- }))
|
|
|
|
|
|
+ const rows = this.deepClone(this.chartBinding.generation.roundGroups) // TODO: need clone?
|
|
// generation data
|
|
// generation data
|
|
const mergedColumns = []
|
|
const mergedColumns = []
|
|
this.chartBinding.tableData.forEach(item => {
|
|
this.chartBinding.tableData.forEach(item => {
|
|
@@ -53,16 +57,16 @@ export default {
|
|
})
|
|
})
|
|
// accumulate data
|
|
// accumulate data
|
|
if (this.chartBinding.generation.active > this.chartBinding.generation.options.primaryDM.value
|
|
if (this.chartBinding.generation.active > this.chartBinding.generation.options.primaryDM.value
|
|
- && this.chartBinding.chartData?.length) {
|
|
|
|
|
|
+ && this.chartBinding.chartData?.accumulates?.length) {
|
|
const prefix = 'accumulate_'
|
|
const prefix = 'accumulate_'
|
|
const ext = {
|
|
const ext = {
|
|
roundId: this.chartBinding.generation.status.roundId,
|
|
roundId: this.chartBinding.generation.status.roundId,
|
|
- generation: this.chartBinding.generation.current
|
|
|
|
|
|
+ generation: -1 // for detail page special display
|
|
}
|
|
}
|
|
- this.chartBinding.chartData.forEach(acc => this.resolveTableGeneration(ext, acc, columns, rows, mergedColumns, prefix, true))
|
|
|
|
|
|
+ this.chartBinding.chartData.accumulates.forEach(acc => this.resolveTableGeneration(ext, acc, columns, rows, mergedColumns, prefix, true))
|
|
}
|
|
}
|
|
// completed
|
|
// completed
|
|
- this.$refs.table.scrollToRight()
|
|
|
|
|
|
+ this.$refs.table?.scrollToRight()
|
|
return {
|
|
return {
|
|
mergedColumns,
|
|
mergedColumns,
|
|
columns,
|
|
columns,
|
|
@@ -91,7 +95,7 @@ export default {
|
|
data.values.forEach(val => {
|
|
data.values.forEach(val => {
|
|
const row = rowsRef.find(row => row.groupId == val.groupId)
|
|
const row = rowsRef.find(row => row.groupId == val.groupId)
|
|
if (row) {
|
|
if (row) {
|
|
- row[prop] = val
|
|
|
|
|
|
+ row[prop] = { ...ext, ...val }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
@@ -101,13 +105,40 @@ export default {
|
|
// keep value in display row
|
|
// keep value in display row
|
|
const val = data.values.first()
|
|
const val = data.values.first()
|
|
const row = rowsRef.first()
|
|
const row = rowsRef.first()
|
|
- row[prop] = val
|
|
|
|
|
|
+ row[prop] = { ...ext, ...val }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mergeTable({ row, column, rowIndex }) {
|
|
mergeTable({ row, column, rowIndex }) {
|
|
if (this.resolvedTable.mergedColumns.includes(column.property)) {
|
|
if (this.resolvedTable.mergedColumns.includes(column.property)) {
|
|
return rowIndex === 0 ? [this.resolvedTable.rows.length, 1] : [0, 0]
|
|
return rowIndex === 0 ? [this.resolvedTable.rows.length, 1] : [0, 0]
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ getCellStyles(option) {
|
|
|
|
+ const styles = {}
|
|
|
|
+ if (option.color) {
|
|
|
|
+ const map = {
|
|
|
|
+ R: config.color.error,
|
|
|
|
+ r: config.color.error,
|
|
|
|
+ G: config.color.yellow_up,
|
|
|
|
+ g: config.color.yellow_up,
|
|
|
|
+ B: config.color.blue_up,
|
|
|
|
+ b: config.color.blue_up
|
|
|
|
+ }
|
|
|
|
+ styles.color = map[option.color] || option.color
|
|
|
|
+ }
|
|
|
|
+ return styles
|
|
|
|
+ },
|
|
|
|
+ goDetails(option, label) {
|
|
|
|
+ const path = '/elective/generation/detail'
|
|
|
|
+ const nextData = {
|
|
|
|
+ year: this.chartBinding.generation.status.year,
|
|
|
|
+ roundId: this.chartBinding.generation.status.roundId,
|
|
|
|
+ roundName: this.chartBinding.generation.status.roundName,
|
|
|
|
+ queryLabel: label,
|
|
|
|
+ queryGeneration: option.generation,
|
|
|
|
+ queryCode: option.queryCode
|
|
|
|
+ }
|
|
|
|
+ this.transferTo(path, nextData)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|