|
@@ -1,77 +1,56 @@
|
|
|
<template>
|
|
|
- <a-table :columns="columns" :data-source="data" bordered :pagination="ipagination">
|
|
|
+ <a-table :columns="columns" :data-source="data" bordered :pagination="ipagination2" rowKey="id">
|
|
|
</a-table>
|
|
|
</template>
|
|
|
<script>
|
|
|
const columns = [
|
|
|
{
|
|
|
- title: '任务号',
|
|
|
+ title: '物资编码',
|
|
|
align:"center",
|
|
|
- dataIndex: 'name',
|
|
|
- key: 'name',
|
|
|
+ dataIndex: 'wlbm',
|
|
|
+ key: 'wlbm',
|
|
|
customRender:function (t,r,index) {
|
|
|
return {children: t,attrs: {rowSpan:r.rowSpan}};
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- title: '物资编码',
|
|
|
+ title: '任务号',
|
|
|
align:"center",
|
|
|
- dataIndex: 'age',
|
|
|
- key: 'age',
|
|
|
+ dataIndex: 'rwh',
|
|
|
+ key: 'rwh',
|
|
|
},
|
|
|
{
|
|
|
title: '总数量',
|
|
|
align:"center",
|
|
|
- dataIndex: 'address',
|
|
|
- key: 'address',
|
|
|
+ dataIndex: 'zsl',
|
|
|
+ key: 'zsl',
|
|
|
},
|
|
|
{
|
|
|
title: '总金额',
|
|
|
align:"center",
|
|
|
- key: 'tags',
|
|
|
- dataIndex: 'tags',
|
|
|
+ key: 'zje',
|
|
|
+ dataIndex: 'zje',
|
|
|
// scopedSlots: { customRender: 'tags' },
|
|
|
},
|
|
|
];
|
|
|
|
|
|
-const data = [
|
|
|
- {
|
|
|
- key: '1',
|
|
|
- name: 'John Brown',
|
|
|
- age: 32,
|
|
|
- address: 'New York No. 1 Lake Park',
|
|
|
- tags: ['nice', 'developer'],
|
|
|
- },
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- name: 'Jim Green',
|
|
|
- age: 42,
|
|
|
- address: 'London No. 1 Lake Park',
|
|
|
- tags: ['loser'],
|
|
|
- },
|
|
|
- {
|
|
|
- key: '3',
|
|
|
- name: 'Joe Black',
|
|
|
- age: 32,
|
|
|
- address: 'Sidney No. 1 Lake Park',
|
|
|
- tags: ['cool', 'teacher'],
|
|
|
- },
|
|
|
- {
|
|
|
- key: '4',
|
|
|
- name: 'Joe Black',
|
|
|
- age: 32,
|
|
|
- address: 'Sidney No. 1 Lake Park',
|
|
|
- tags: ['cool', 'teacher'],
|
|
|
- },
|
|
|
-];
|
|
|
+const data = [];
|
|
|
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ // 对比表格数据
|
|
|
+ duibiclList: {
|
|
|
+ type: Array,
|
|
|
+ default: ()=>{},
|
|
|
+ required: false
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
data,
|
|
|
columns,
|
|
|
/* 分页参数 */
|
|
|
- ipagination:{
|
|
|
+ ipagination2:{
|
|
|
current: 1,
|
|
|
pageSize: 10,
|
|
|
pageSizeOptions: ['10', '20', '30'],
|
|
@@ -85,28 +64,29 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
created(){
|
|
|
+ this.data = this.duibiclList
|
|
|
this.getHebing()
|
|
|
},
|
|
|
methods: {
|
|
|
getHebing(){
|
|
|
let that = this
|
|
|
let rowSpan = 0
|
|
|
- let name = ''
|
|
|
+ let wlbm = ''
|
|
|
for (let i = that.data.length-1; i >= 0; i--) {
|
|
|
// 任务号合并
|
|
|
- if (name == '') {
|
|
|
+ if (wlbm == '') {
|
|
|
that.data[i].rowSpan = 0
|
|
|
- name = that.data[i].name
|
|
|
+ wlbm = that.data[i].wlbm
|
|
|
rowSpan++
|
|
|
} else {
|
|
|
- if(name == that.data[i].name){
|
|
|
+ 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
|
|
|
- name = that.data[i].name
|
|
|
+ wlbm = that.data[i].wlbm
|
|
|
}
|
|
|
}
|
|
|
}
|