| | |
| | | @selection-change="handleSelectionChange" |
| | | :header-cell-style="{ background: '#ECF4FF', color: '#666' }" |
| | | > |
| | | <el-table-column type="selection" width="40"> </el-table-column> |
| | | <el-table-column v-if="selectBox" type="selection" width="40"> </el-table-column> |
| | | |
| | | <el-table-column |
| | | v-for="(item, i) in tableList.tableColumn" |
| | | :key="i" |
| | |
| | | :label="item.label" |
| | | :width="item.width" |
| | | :min-width="item.min" |
| | | show-overflow-tooltip="true" |
| | | sortable |
| | | show-overflow-tooltip |
| | | :sortable="item.sortable" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span v-if="item.price">{{ "¥" + number_format(scope.row[item.prop], 2, ".", ",") }}</span> |
| | | <span v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</span> |
| | | <div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div> |
| | | <span v-else>{{ scope.row[item.prop] }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <slot name="tableButton" /> |
| | | <div slot="empty"> |
| | | <el-empty description="暂无数据"></el-empty> |
| | | </div> |
| | | </el-table> |
| | | </div> |
| | | </template> |
| | |
| | | export default { |
| | | name: "TableCommonView", |
| | | props: { |
| | | selectBox: { |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | |
| | | tableList: { |
| | | type: Object, |
| | | default: () => { |
| | | return { |
| | | selectBox: true, |
| | | tableInfomation: [], // 接口返回数据 |
| | | tableColumn: [ |
| | | // table表单 |
| | |
| | | sums[index] = "本页总计" |
| | | } |
| | | const values = data.map((item) => Number(item[column.property])) |
| | | // if (column.property === this.showSummary.sumProp) { |
| | | if (this.showSummary.sumProp.includes(column.property)) { |
| | | sums[index + 1] = values.reduce((prev, curr) => { |
| | | const value = Number(curr) |
| | | if (!isNaN(value)) { |
| | | return this.number_format(prev + curr, 2, ".", ",") |
| | | return prev + curr |
| | | } else { |
| | | return this.number_format(prev, 2, ".", ",") |
| | | return prev |
| | | } |
| | | }, 0) |
| | | sums[index + 1] |
| | | } |
| | | }) |
| | | console.log(sums) |
| | | return sums |
| | | } |
| | | }, |
| | |
| | | margin-right: 10px; |
| | | margin-bottom: 40px; |
| | | .blue { |
| | | padding: 10px; |
| | | width: 70px; |
| | | text-align: center; |
| | | color: #fff; |
| | | background-color: blue; |
| | | background-color: $color-primary; |
| | | border-radius: 4px; |
| | | } |
| | | } |