Parcourir la source

外协价格库手动去重功能优化

yuhan il y a 1 an
Parent
commit
b002c8ea29

+ 9 - 1
src/views/module_kzks/costModelWxPrice/CostModelWxPriceList.vue

@@ -147,7 +147,8 @@
       switchFullscreen
       @ok="handleOk"
       @cancel="handleCancel"
-      cancelText="关闭">
+      cancelText="关闭"
+      class="repeat-model">
       <!-- :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" -->
       <cost-model-wx-repeat-list ref="wxRepeatRef" @ok="handleSure"></cost-model-wx-repeat-list>
     </j-modal>
@@ -383,4 +384,11 @@ import { getAction } from '@/api/manage'
 </script>
 <style scoped>
   @import '~@assets/less/common.less';
+</style>
+<style lang="less" scoped>
+.repeat-model{
+  /deep/ .ant-modal-body{
+    padding: 0;
+  }
+}
 </style>

+ 32 - 5
src/views/module_kzks/costModelWxRepeat/CostModelWxRepeatList.vue

@@ -52,9 +52,9 @@
         <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
       </a-dropdown>
     </div> -->
-    <span style="color: #ffa11e;margin-bottom: 12px;">※上一次导入的文件中存在外协项目、外协单位、计量单位相同,但价格不同的项,请选择需要保留的项※</span>
+    <span style="color: #ffa11e;">※导入的文件中存在外协项目、外协单位、计量单位相同,但价格不同的项,请选择需要保留的项※</span>
     <!-- table区域-begin -->
-    <div>
+    <div style="margin-top: 10px;">
       <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
         <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
         <a style="margin-left: 24px" @click="onClearSelected">清空</a>
@@ -70,10 +70,9 @@
         :dataSource="dataSource"
         :pagination="ipagination"
         :loading="loading"
-        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+        :rowSelection="rowSelection"
         class="j-table-force-nowrap"
         @change="handleTableChange">
-
         <template slot="htmlSlot" slot-scope="text">
           <div v-html="text"></div>
         </template>
@@ -197,14 +196,42 @@
       }
     },
     created() {
-    this.getSuperFieldList();
+      this.getSuperFieldList();
     },
     computed: {
       importExcelUrl: function(){
         return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
       },
+      rowSelection: function(){
+        return {
+          selectedRowKeys: this.selectedRowKeys,
+          onSelect: this.onSelect,
+          onChange: this.onSelectChange,
+          columnTitle: ' ', // 去掉全选框
+          getCheckboxProps: (record) => ({
+            props: {
+              // 动态设置不可选
+              disabled: record.disabled
+            },
+          }),
+        }
+      }
     },
     methods: {
+      // 重复项表格多选确定方法
+      onSelect(record, selected, selectedRows, nativeEvent){
+        // console.log(record, selected, selectedRows, nativeEvent)
+        for (let i = 0; i < this.dataSource.length; i++) {
+          const element = this.dataSource[i];
+          var panduan = element.wxProject === record.wxProject && element.wxCompany === record.wxCompany && element.unit === record.unit && element.id !== record.id
+          if(panduan){
+            element.disabled = !element.disabled
+          }
+        }
+        // 这一步重新赋值才能实现动态改变disabled
+        this.dataSource = [...this.dataSource]
+        // console.log(this.dataSource)
+      },
       initDictConfig(){
       },
       handleRepeat() {