yuhan 1 gadu atpakaļ
vecāks
revīzija
53e7a73849

+ 50 - 34
src/views/module_kzks/projectContrastList/wuliaoList.vue

@@ -21,6 +21,39 @@ import { mixinDevice } from '@/utils/mixin'
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import { getDbClList } from '@/api/kzksApi.js'
 
+var columns = [
+  {
+    title: '序号',
+    dataIndex: '',
+    key:'rowIndex',
+    width:60,
+    align:"center",
+    customRender:function (t,r,index) {
+      return parseInt(index)+1;
+    },
+    fixed:"left",
+  },
+  {
+    title: '规格型号',
+    dataIndex: 'ggxh',
+    width: 100,
+    align: 'center',
+    fixed:"left",
+  },
+  {
+    title: '物料编码',
+    dataIndex: 'wlbm',
+    // width: 100,
+    align: 'center',
+  },
+  {
+    title: '物料名称',
+    dataIndex: 'wlmc',
+    // width: 100,
+    align: 'center'
+  },
+]
+
 export default {
   mixins:[JeecgListMixin, mixinDevice],
   // props: {
@@ -45,53 +78,24 @@ export default {
       name: '',
       dataSource: [],
       // 表头
-      columns: [
-        {
-          title: '序号',
-          dataIndex: '',
-          key:'rowIndex',
-          width:60,
-          align:"center",
-          customRender:function (t,r,index) {
-            return parseInt(index)+1;
-          },
-          fixed:"left",
-        },
-        {
-          title: '规格型号',
-          dataIndex: 'ggxh',
-          width: 100,
-          align: 'center',
-          fixed:"left",
-        },
-        {
-          title: '物料编码',
-          dataIndex: 'wlbm',
-          // width: 100,
-          align: 'center',
-        },
-        {
-          title: '物料名称',
-          dataIndex: 'wlmc',
-          // width: 100,
-          align: 'center'
-        },
-      ],
+      columns: []
     };
   },
   created(){
   },
   methods: {
     // 数据处理
-    loadData(){
+    loadData(arg){
       // console.log(this.duibiTasknos)
+      this.dataSource = []
       var params = {
         tasknos: this.duibiTasknos,
         pageNo: this.ipagination.current,
         pageSize: this.ipagination.pageSize,
       }
       getDbClList(params).then((res) => {
-        console.log(res)
+        // console.log(res)
+        // console.log(this.columns)
         if(res.success){
           // 分页
           if(res.result.total) {
@@ -102,6 +106,7 @@ export default {
           // 处理数据
           var arrList = res.result.records
           // 头部
+          this.columns = [...columns]
           arrList[0].taskVoList.forEach(item => {
             this.columns.push({
               title: item.taskno,
@@ -153,6 +158,17 @@ export default {
         this.loading = false
       })
     },
+    // handleTableChange(pagination, filters, sorter) {
+    //   //分页、排序、筛选变化时触发
+    //   //TODO 筛选
+    //   console.log(pagination)
+    //   if (Object.keys(sorter).length > 0) {
+    //     this.isorter.column = sorter.field;
+    //     this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
+    //   }
+    //   this.ipagination = pagination;
+    //   this.loadData(2);
+    // },
     setCustomCell(record, index){
       // console.log(record, index)
       // var arr = []

+ 21 - 8
src/views/module_kzks/projectCostList/ProjectCostList.vue

@@ -979,7 +979,7 @@ import { number } from 'echarts';
       },
       // 比对
       batchDuiBi(){
-        console.log(this.selectedRowKeys,this.selectionRows)
+        // console.log(this.selectedRowKeys,this.selectionRows)
         // console.log(JSON.stringify(this.selectedRowKeys))
 
         var selectTasknos = this.selectionRows.map( res => {
@@ -1091,13 +1091,26 @@ import { number } from 'echarts';
       },
       // 比对禁选判断
       onSelectChange(selectedRowKeys, selectionRows) {
+        console.log(selectedRowKeys, selectionRows)
+        // this.selectedRowKeys = selectedRowKeys;
+        // this.selectionRows = selectionRows;
+        // 解决分页后selectionRows只获取本页面勾选的问题
+        for (let val of selectionRows) {
+          if (!this.selectionRows.find((item) => item.id === val.id)) {
+            this.selectionRows.push(val);
+          }
+        }
         this.selectedRowKeys = selectedRowKeys;
-        this.selectionRows = selectionRows;
+        this.selectionRows = this.selectionRows.filter((item) =>
+          this.selectedRowKeys.includes(item.id)
+        );
+
       },
       onSelect(record, selected, selectedRows, nativeEvent){
         console.log(record, selected, selectedRows, nativeEvent)
+        console.log(this.selectionRows)
         if(selected) {
-          if (selectedRows.length == 1) {
+          if (this.selectionRows.length == 1) {
             this.chooseRowType = record.ji
             this.chooseStatus = true
           } else {
@@ -1108,8 +1121,8 @@ import { number } from 'echarts';
               this.$message.error("请选择同级项进行比对");
             } else{
               // this.chooseStatus = false
-              for (let i = 0; i < selectedRows.length; i++) {
-                const element = selectedRows[i].ji;
+              for (let i = 0; i < this.selectionRows.length; i++) {
+                const element = this.selectionRows[i].ji;
                 console.log(888,this.chooseRowType,element)
                 if (this.chooseRowType != element) {
                   this.chooseStatus = true
@@ -1120,13 +1133,13 @@ import { number } from 'echarts';
             }
           }
         } else{
-          if (selectedRows.length == 1) {
+          if (this.selectionRows.length == 1) {
             console.log(777,this.selectionRows[0].ji)
             this.chooseRowType = this.selectionRows[0].ji
             this.chooseStatus = true
           } else {
-            for (let i = 0; i < selectedRows.length; i++) {
-              const element = selectedRows[i].ji;
+            for (let i = 0; i < this.selectionRows.length; i++) {
+              const element = this.selectionRows[i].ji;
               console.log(888,this.chooseRowType,element)
               if (this.chooseRowType != element) {
                 this.chooseStatus = true