12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <template>
- <a-table :columns="columns" :data-source="data" bordered :pagination="ipagination2" rowKey="id">
- </a-table>
- </template>
- <script>
- const columns = [
- {
- title: '物资编码',
- align:"center",
- dataIndex: 'wlbm',
- key: 'wlbm',
- customRender:function (t,r,index) {
- return {children: t,attrs: {rowSpan:r.rowSpan}};
- },
- },
- {
- title: '任务号',
- align:"center",
- dataIndex: 'rwh',
- key: 'rwh',
- },
- {
- title: '总数量',
- align:"center",
- dataIndex: 'zsl',
- key: 'zsl',
- },
- {
- title: '总金额',
- align:"center",
- key: 'zje',
- dataIndex: 'zje',
- // scopedSlots: { customRender: 'tags' },
- },
- ];
- const data = [];
- export default {
- props: {
- // 对比表格数据
- duibiclList: {
- type: Array,
- default: ()=>{},
- required: false
- }
- },
- data() {
- return {
- data,
- columns,
- /* 分页参数 */
- ipagination2:{
- current: 1,
- pageSize: 10,
- pageSizeOptions: ['10', '20', '30'],
- showTotal: (total, range) => {
- return range[0] + "-" + range[1] + " 共" + total + "条"
- },
- showQuickJumper: true,
- showSizeChanger: true,
- total: 0
- },
- };
- },
- created(){
- this.data = this.duibiclList
- this.getHebing()
- },
- methods: {
- getHebing(){
- let that = this
- let rowSpan = 0
- let wlbm = ''
- for (let i = that.data.length-1; i >= 0; i--) {
- // 任务号合并
- if (wlbm == '') {
- that.data[i].rowSpan = 0
- wlbm = that.data[i].wlbm
- rowSpan++
- } else {
- if(wlbm == that.data[i].wlbm){
- that.data[i].rowSpan = 0
- rowSpan++
- }else{
- that.data[i+1].rowSpan = rowSpan
- that.data[i].rowSpan = 0
- rowSpan = 1
- wlbm = that.data[i].wlbm
- }
- }
- }
- that.data[0].rowSpan = rowSpan
- }
- }
- };
- </script>
|