瀏覽代碼

对比优化

wyh 1 年之前
父節點
當前提交
1274c8d5e4
共有 2 個文件被更改,包括 79 次插入24 次删除
  1. 3 0
      src/api/kzksApi.js
  2. 76 24
      src/views/module_kzks/projectCostList/ProjectCostList.vue

+ 3 - 0
src/api/kzksApi.js

@@ -19,6 +19,8 @@ const proCostYSKdetail = (params)=>getAction("/xmcbDetail/comContractInfoExchang
 
 // 项目成本对比————总体对比
 const getDbList = (params)=>getAction("/projectCost/projectCost/compareList", params);
+// 项目汇集对比————总体对比
+const getHjList = (params)=>getAction("/projectCostHuiji/projectCostHuiji/compareList", params);
 // 项目成本对比————材料费对比
 const getDbClList = (params)=>getAction("wzOutboundOrder/wzOutboundOrderH/compareCLFDetailList", params);
 
@@ -30,6 +32,7 @@ export {
   proCostContractdetail,
   proCostYSKdetail,
   getDbList,
+  getHjList,
   getDbClList
 }
 

+ 76 - 24
src/views/module_kzks/projectCostList/ProjectCostList.vue

@@ -268,7 +268,7 @@
 
 <script>
   import Vue from 'vue'
-  import { columnsSelect, columnsEdit, proCostYSKdetail, proCostContractdetail, getDbList, getDbClList } from '@/api/kzksApi.js'
+  import { columnsSelect, columnsEdit, proCostYSKdetail, proCostContractdetail, getDbList, getHjList, getDbClList } from '@/api/kzksApi.js'
 
   import '@/assets/less/TableExpand.less'
   import { mixinDevice } from '@/utils/mixin'
@@ -788,22 +788,49 @@ import ProjectImportListModal from '../projectImportList/modules/ProjectImportLi
       batchDuiBi(){
         console.log(this.selectedRowKeys,this.selectionRows)
         // console.log(JSON.stringify(this.selectedRowKeys))
-        var a = this.selectedRowKeys
-        var ids = a.toString()
-        getDbList({ids: ids}).then((res) => {
-          console.log(res)
-          this.duibiList = res
-        })
-        var selectTasknos = this.selectionRows.map( res => {
-          return res.taskno
-        })
-        var tasknos = selectTasknos.toString()
-        console.log(tasknos)
-        getDbClList({tasknos: tasknos}).then((res) => {
-          console.log(res)
-          this.duibiclList = res
-          this.duiBi = true
-        })
+        if (this.chooseRowType == 1) {
+          var a = this.selectedRowKeys
+          var ids = a.toString()
+          getHjList({ids: ids}).then((res) => {
+            console.log(res)
+            this.duibiList = res
+            this.duibiclList = []
+            this.duiBi = true
+          })
+        } else {
+          var a = this.selectedRowKeys
+          var ids = a.toString()
+          getDbList({ids: ids}).then((res) => {
+            console.log(res)
+            this.duibiList = res
+          })
+          var selectTasknos = this.selectionRows.map( res => {
+            return res.taskno
+          })
+          var tasknos = selectTasknos.toString()
+          console.log(tasknos)
+          getDbClList({tasknos: tasknos}).then((res) => {
+            console.log(res)
+            this.duibiclList = res
+            this.duiBi = true
+          })
+        }
+        // var a = this.selectedRowKeys
+        // var ids = a.toString()
+        // getDbList({ids: ids}).then((res) => {
+        //   console.log(res)
+        //   this.duibiList = res
+        // })
+        // var selectTasknos = this.selectionRows.map( res => {
+        //   return res.taskno
+        // })
+        // var tasknos = selectTasknos.toString()
+        // console.log(tasknos)
+        // getDbClList({tasknos: tasknos}).then((res) => {
+        //   console.log(res)
+        //   this.duibiclList = res
+        //   this.duiBi = true
+        // })
       },
       // 关闭对比弹框
       handleGb(){
@@ -843,16 +870,41 @@ import ProjectImportListModal from '../projectImportList/modules/ProjectImportLi
         this.$refs.xushi.open(record)
       },
       // 对比禁选判断
+      onSelectChange(selectedRowKeys, selectionRows) {
+        this.selectedRowKeys = selectedRowKeys;
+        this.selectionRows = selectionRows;
+      },
       onSelect(record, selected, selectedRows, nativeEvent){
         console.log(record, selected, selectedRows, nativeEvent)
-        console.log(record.ji)
-        if (record.ji == '2') {
-          // 选中二级,一级禁选
-          this.chooseRowType == 'chengben'
-        } else {
-          // 选中一级,二级禁选
-          this.chooseRowType == 'huiji'
+        if(selected) {
+          if (selectedRows.length == 1) {
+            this.chooseRowType = record.ji
+          } else {
+            console.log(this.chooseRowType,record.ji)
+            if (this.chooseRowType != record.ji) {
+              this.chooseRowType = this.chooseRowType
+              this.$message.error("请选择同级项进行对比");
+            }
+          }
+        } else{
+          if (selectedRows.length == 1) {
+            console.log(777,this.selectionRows[0].ji)
+            this.chooseRowType = this.selectionRows[0].ji
+          } else {
+            if (this.chooseRowType != record.ji) {
+              this.chooseRowType = this.chooseRowType
+              this.$message.error("请选择同级项进行对比");
+            }
+          }
         }
+        // console.log(record.ji)
+        // if (record.ji == '2') {
+        //   // 选中二级,一级禁选
+        //   this.chooseRowType == 'chengben'
+        // } else {
+        //   // 选中一级,二级禁选
+        //   this.chooseRowType == 'huiji'
+        // }
       }
 
     }