Ver código fonte

Merge branch 'dev' into 'historical_route'

Dev

See merge request new-business/drp-web!491
黄梓星 1 ano atrás
pai
commit
2ba5de309e

+ 1 - 0
package.json

@@ -47,6 +47,7 @@
     "echarts": "^5.4.0",
     "el-table-horizontal-scroll": "^1.2.5",
     "el-table-infinite-scroll": "^2.0.0",
+    "el-table-virtual-scroll": "^1.0.20",
     "element-ui": "2.15.12",
     "file-saver": "2.0.5",
     "fuse.js": "6.4.3",

+ 1 - 1
src/components/Refers/treeRefer.vue

@@ -10,7 +10,7 @@
                 <el-input placeholder="输入关键字进行过滤" size="small" v-model="filterText" style="margin-bottom: 16px">
                 </el-input>
 
-                <el-tree class="filter-tree" :data="threedata" :props="defaultProps" show-checkbox check-strictly accordion node-key="id"
+                <el-tree class="filter-tree" :data="threedata" :props="defaultProps" show-checkbox accordion node-key="id"
                   highlight-current @check="clickTree" :filter-node-method="filterNode" ref="tree">
                   <span slot-scope="{ node, data }">
                     {{ data.code }}{{ data.name }}

+ 8 - 3
src/components/popover-select/index.vue

@@ -128,8 +128,10 @@ export default {
     },
     // open dialog
     async open() {
-      this.visible = true;
-      await this.useReset();
+      if(!this.disabled){
+        this.visible = true;
+        await this.useReset();
+      }
     },
     // hide dialog
     async hide() {
@@ -283,14 +285,16 @@ export default {
   <div class="popover-select">
     <el-autocomplete
       clearable
+      
       v-bind="$attrs"
       v-model="innerValue"
       :value-key="valueKey"
       :fetch-suggestions="useAutocomplete"
       @select="useConfirm([$event])"
+      :disabled="disabled"
       style="width: 100%"
     >
-      <i class="el-icon-search" slot="suffix" @click="open"> </i>
+      <i :size="size" class="el-icon-search" slot="suffix" @click="open"> </i>
       <template slot-scope="{ item }">
         <p
           style="
@@ -347,6 +351,7 @@ export default {
       >
         <el-form-item prop="search">
           <el-input
+            :size="size"
             v-model="model.search"
             @change="useQuery"
             @keydown.enter="useQuery"

+ 1 - 0
src/views/material/changeApply/add/column.js

@@ -226,6 +226,7 @@ export default function useColumns(){
           },
 
         },
+       
         {
           item:{
             key:'factoryName',

+ 1 - 1
src/views/material/requisition/index.vue

@@ -484,7 +484,7 @@
               return item.label == "物料申请单"
             }).value,
             fdId: row.oaId,
-            billCode: row.code,
+            billCode: row.billCode,
             billMaker: row.createBy
           });
           if (code === 200) {

+ 103 - 101
src/views/purchase/DemandSummary/index-bak.vue

@@ -14,7 +14,7 @@
             </el-col>
             <el-col :span="1.5">
               <el-form-item label="采购员">
-                <el-select clearable size="mini" v-model="queryParams.buyer" @focus="chooseRefer('CONTACTS_PARAM', true, '采购员')" style="width: 200px">
+                <el-select clearable size="mini" v-model="queryParams.buyer" @clear="cleanBuyer" @focus="chooseRefer('CONTACTS_PARAM', true, '采购员')" style="width: 200px">
                   <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
                 </el-select>
               </el-form-item>
@@ -24,6 +24,8 @@
                 <el-select
                 v-model="queryParams.materialClassifyFour"
                 size="mini"
+                multiple
+                collapse-tags
                 clearable
                 @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
                 style="width: 200px"
@@ -232,145 +234,142 @@
 
           <!-- <el-button type="primary" size="mini">转请购</el-button> -->
         </div>
-        <vxe-table
+        <el-table
           v-loading="loading"
           :data="tableList" 
           :cell-style="{ borderColor: '#c0c0c0' }"
           :header-cell-style="{ borderColor: '#c0c0c0' }"
           class="exporttable"
           border
-          resizable
-          show-overflow
           show-summary
           :summary-method="getSummaries"
           highlight-current-row
-          height="355"
-          max-height="355"
+          max-height="620"
           style="font-size: 12px;"
           :cell-class-name="cellClassName"
-          @checkbox-change="handleSelectionChange"
+          @selection-change="handleSelectionChange"
           @row-click="rowSelect"
           @row-dblclick="doubleClick"
           ref="table"
         >
-          <vxe-column type="checkbox" width="60" fixed="left"/>
-          <vxe-column  title="序号" type="seq" align="center" width="50px" fixed="left"/>
-          <!-- <vxe-column show-header-overflow v-if="showColumn.status" title="行号" align="center" field="rowNo"/> -->
-          <vxe-column show-header-overflow v-if="showColumn.status" title="行状态" align="center" field="status" width="100px" :formatter="hangStatus"/>
-          <vxe-column show-header-overflow v-if="showColumn.materialClassifyOneName" title="一级品类" align="center" field="materialClassifyOneName" width="80"/>
-          <vxe-column show-header-overflow v-if="showColumn.materialCode" title="物料编码" align="center" field="materialCode" width="150px"/>
-          <vxe-column show-header-overflow v-if="showColumn.materialName" title="品名" align="center" field="materialName" width="150px"/>
-          <vxe-column show-header-overflow v-if="showColumn.specification" title="规格" align="center" field="specification" width="100px"/>
-          <vxe-column show-header-overflow v-if="showColumn.unit" title="单位" align="center" field="unit"/>
-          <vxe-column show-header-overflow v-if="showColumn.manufacturer" title="生产厂家/代理人" align="center" field="manufacturer" width="150px"/>
-          <vxe-column show-header-overflow v-if="showColumn.demandNum" title="需求单位数" align="center" field="demandNum" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.evensalesforyear" title="近1月月均需求" align="center" field="evensalesforyear" width="80px">
+          <el-table-column type="selection" width="60" fixed="left"/>
+          <el-table-column show-overflow-tooltip  label="序号" type="index" align="center" width="50px" fixed="left"/>
+          <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="行号" align="center" prop="rowNo"/> -->
+          <el-table-column show-overflow-tooltip v-if="showColumn.status" label="行状态" align="center" prop="status" width="50px" :formatter="hangStatus"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.finalBuyQty" label="最终采购量" align="center" prop="finalBuyQty" width="80px">
             <template slot-scope="scope">
-              {{scope.row.evensalesforyear ? parseFloat(scope.row.evensalesforyear).toFixed(2) : '0.00'}}
+                <el-input size="mini" :disabled="scope.row.status !== '1' || lineDisable" v-model="scope.row.finalBuyQty" @change="jilu(scope.$index)"/>
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.evensalesforthrmonth" title="近3月月均需求" align="center" field="evensalesforthrmonth" width="80px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.artificialAdjust" label="人工调整数" align="center" prop="artificialAdjust" width="50px">
             <template slot-scope="scope">
-              {{scope.row.evensalesforthrmonth ? parseFloat(scope.row.evensalesforthrmonth).toFixed(2) : '0.00'}}
+              {{scope.row.artificialAdjust = scope.row.finalBuyQty - scope.row.suggestionPurchase}}
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.netDemandNum" title="总最终净需求量" align="center" field="netDemandNum" width="80px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyOneName" label="一级品类" align="center" prop="materialClassifyOneName" width="50"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.materialCode" label="物料编码" align="center" prop="materialCode" width="50px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.materialName" label="品名" align="center" prop="materialName" width="50px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.specification" label="规格" align="center" prop="specification" width="50px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.unit" label="单位" align="center" prop="unit" width="50"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.manufacturer" label="生产厂家/代理人" align="center" prop="manufacturer" width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.demandNum" label="需求单位数" align="center" prop="demandNum" width="50px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.netDemandNum" label="总最终净需求量" align="center" prop="netDemandNum" width="80px">
             <template slot-scope="scope">
               {{scope.row.netDemandNum ? parseFloat(scope.row.netDemandNum).toFixed(2) : '0.00'}}
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.totalMonthlySales" title="总月销量" align="center" field="totalMonthlySales" width="80px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.evensalesforyear" label="近1月月均需求" align="center" prop="evensalesforyear" width="50">
             <template slot-scope="scope">
-              {{scope.row.totalMonthlySales ? parseFloat(scope.row.totalMonthlySales).toFixed(2) : '0.00'}}
+              {{scope.row.evensalesforyear ? parseFloat(scope.row.evensalesforyear).toFixed(2) : '0.00'}}
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.demandCycle" title="需求可用周期" align="center" field="demandCycle" width="80px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.evensalesforthrmonth" label="近3月月均需求" align="center" prop="evensalesforthrmonth" width="50">
             <template slot-scope="scope">
-              {{scope.row.demandCycle ? parseFloat(scope.row.demandCycle).toFixed(1) : '0.0'}}
+              {{scope.row.evensalesforthrmonth ? parseFloat(scope.row.evensalesforthrmonth).toFixed(2) : '0.00'}}
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.dullQut" title="呆滞量" align="center" field="dullQut" width="80px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.totalMonthlySales" label="总月销量" align="center" prop="totalMonthlySales" width="50">
             <template slot-scope="scope">
-              {{parseFloat(scope.row.dullQut).toFixed(2)}}
+              {{scope.row.totalMonthlySales ? parseFloat(scope.row.totalMonthlySales).toFixed(2) : '0.00'}}
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.buyPeriod" title="采购周期" align="center" field="buyPeriod" width="80px" />
-          <vxe-column show-header-overflow v-if="showColumn.centralPublicStock" title="中心公共库存" align="center" field="centralPublicStock" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.centralWarehouse" title="中心仓专属货位" align="center" field="centralWarehouse" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.regionPublicStock" title="区域分仓公共库存" align="center" field="regionPublicStock" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.eachWarehouseStock" title="各项目仓库存" align="center" field="eachWarehouseStock" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.commerceWarehouse" title="电商仓库" align="center" field="commerceWarehouse"  width="80px" />
-          <vxe-column show-header-overflow v-if="showColumn.buyTransit" title="采购在途" align="center" field="buyTransit"  width="80px" />
-          <vxe-column show-header-overflow v-if="showColumn.lendTransit" title="借出在途" align="center" field="lendTransit"  width="80px" />
-          <vxe-column show-header-overflow v-if="showColumn.transferTransit" title="调拨在途" align="center" field="transferTransit"  width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.stockTotal" title="库存总计" align="center" field="stockTotal" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.minPackage" title="最小包装量" align="center" field="minPackage"  width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.minOrder" title="最小订货量" align="center" field="minOrder"  width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.minBatch" title="最小批量" align="center" field="minBatch"  width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.artificialAdjust" title="人工调整数" align="center" field="artificialAdjust" width="80px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.demandCycle" label="需求可用周期" align="center" prop="demandCycle" width="50px">
             <template slot-scope="scope">
-              {{scope.row.artificialAdjust = scope.row.finalBuyQty - scope.row.suggestionPurchase}}
+              {{scope.row.demandCycle ? parseFloat(scope.row.demandCycle).toFixed(1) : '-'}}
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.modifyReason" title="修改原因" align="center" field="modifyReason" width="150px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.dullQut" label="呆滞量" align="center" prop="dullQut" width="50px">
             <template slot-scope="scope">
-                <el-input size="mini" :disabled="scope.row.status !== '1'|| lineDisable || scope.row.artificialAdjust == '0'" v-model="scope.row.modifyReason" @change="jilu(scope.$rowIndex)"/>
+              {{parseFloat(scope.row.dullQut).toFixed(2)}}
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.suggestionPurchase" title="建议采购量" align="center" field="suggestionPurchase"  width="80px"/>
-          <!-- <vxe-column show-header-overflow v-if="showColumn.status" title="建议净采购量" align="center" field="suggestBuyQty" width="100px"/> -->
-          <vxe-column show-header-overflow v-if="showColumn.finalBuyQty" title="最终采购量" align="center" field="finalBuyQty" width="80px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.buyPeriod" label="采购周期" align="center" prop="buyPeriod" width="50px" />
+          <el-table-column show-overflow-tooltip v-if="showColumn.centralPublicStock" label="中心公共库存" align="center" prop="centralPublicStock" width="50"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.centralWarehouse" label="中心仓专属货位" align="center" prop="centralWarehouse" width="50"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.eachWarehouseStock" label="各项目仓库存" align="center" prop="eachWarehouseStock" width="50"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.commerceWarehouse" label="电商仓库" align="center" prop="commerceWarehouse"  width="50" />
+          <el-table-column show-overflow-tooltip v-if="showColumn.regionPublicStock" label="区域分仓公共库存" align="center" prop="regionPublicStock" width="50"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.buyTransit" label="采购在途" align="center" prop="buyTransit"  width="80px" />
+          <el-table-column show-overflow-tooltip v-if="showColumn.lendTransit" label="借出在途" align="center" prop="lendTransit"  width="80px" />
+          <el-table-column show-overflow-tooltip v-if="showColumn.transferTransit" label="调拨在途" align="center" prop="transferTransit"  width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.stockTotal" label="库存总计" align="center" prop="stockTotal" width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.minPackage" label="最小包装量" align="center" prop="minPackage"  width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.minOrder" label="最小订货量" align="center" prop="minOrder"  width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.minBatch" label="最小批量" align="center" prop="minBatch"  width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.modifyReason" label="修改原因" align="center" prop="modifyReason" width="150px">
             <template slot-scope="scope">
-                <el-input size="mini" :disabled="scope.row.status !== '1' || lineDisable" v-model="scope.row.finalBuyQty" @change="jilu(scope.$rowIndex)"/>
+                <el-input size="mini" :disabled="scope.row.status !== '1'|| lineDisable || scope.row.artificialAdjust == '0'" v-model="scope.row.modifyReason" @change="jilu(scope.$index)"/>
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.materialClassifyTwoName" title="二级品类" align="center" field="materialClassifyTwoName" width="120px"/>
-          <vxe-column show-header-overflow v-if="showColumn.materialClassifyThreeName" title="三级品类" align="center" field="materialClassifyThreeName" width="120px"/>
-          <vxe-column show-header-overflow v-if="showColumn.materialClassifyFourName" title="四级品类" align="center" field="materialClassifyFourName" width="120px"/>
-          <vxe-column show-header-overflow v-if="showColumn.buyerName" title="采购员" align="center" field="buyerName" width="150px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.suggestionPurchase" label="建议采购量" align="center" prop="suggestionPurchase"  width="80px"/>
+          <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="建议净采购量" align="center" prop="suggestBuyQty" width="100px"/> -->
+          <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyTwoName" label="二级品类" align="center" prop="materialClassifyTwoName" width="120px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyThreeName" label="三级品类" align="center" prop="materialClassifyThreeName" width="120px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyFourName" label="四级品类" align="center" prop="materialClassifyFourName" width="120px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.buyerName" label="采购员" align="center" prop="buyerName" width="150px">
             <template slot-scope="scope">
                 <el-input readonly :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.buyerName">
-                  <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$rowIndex, 'CONTACTS_PARAM', true, '明细采购员')"></el-button>
+                  <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'CONTACTS_PARAM', true, '明细采购员')"></el-button>
                 </el-input>
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.purchaseOrgName" title="默认采购组织" align="center" field="purchaseOrgName" width="150px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.purchaseOrgName" label="默认采购组织" align="center" prop="purchaseOrgName" width="150px">
             <!-- <template slot-scope="scope">
                 <el-input readonly :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.purchaseOrgName">
                   <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'ORG_PARAM', true, '明细默认采购组织')"></el-button>
                 </el-input>
             </template> -->
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.validityPeriod" title="有效期" align="center" field="validityPeriod"/>
-          <vxe-column show-header-overflow v-if="showColumn.validityPeriodUnit" title="有效期单位" align="center" field="validityPeriodUnit" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.businessType" title="业务类型" align="center" field="businessType" :formatter="formatterBusinessType"/>
-          <vxe-column show-header-overflow v-if="showColumn.safetyStock" title="安全库存量" align="center" field="safetyStock" width="80px">
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.validityPeriod" label="有效期" align="center" prop="validityPeriod"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.validityPeriodUnit" label="有效期单位" align="center" prop="validityPeriodUnit" width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.businessType" label="业务类型" align="center" prop="businessType" :formatter="formatterBusinessType"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.safetyStock" label="安全库存量" align="center" prop="safetyStock" width="80px">
             <template slot-scope="scope">
               {{scope.row.safetyStock ? parseFloat(scope.row.safetyStock).toFixed(2) : '0.00'}}
             </template>
-          </vxe-column>
-          <vxe-column show-header-overflow v-if="showColumn.billSource" title="单据来源" align="center" field="billSource" :formatter="formatterSource"/>
-          <vxe-column show-header-overflow v-if="showColumn.registrant" title="注册人" align="center" field="registrant" width="120px"/>
-          <!-- <vxe-column title="可用量" align="center" field="qty"/> -->
-          <vxe-column show-header-overflow v-if="showColumn.buyDiscrepancy" title="总需与终采差异" align="center" field="buyDiscrepancy" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.forecastClassification" title="集团预测分类" align="center" field="forecastClassification" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.centerBinPossession" title="中心仓占有量" align="center" field="centerBinPossession" width="80px"/>
-          <vxe-column show-header-overflow v-if="showColumn.centralWarehouseAvailable" title="中心仓可用量" align="center" field="centralWarehouseAvailable" width="80px"/>
-          <!-- <vxe-column title="物料类别" align="center" field="materialCategory" width="150px"/> -->
-          <!-- <vxe-column title="业务部门" align="center" field="departmentName" width="150px"/> -->
-          <!-- <vxe-column show-header-overflow v-if="showColumn.status" title="需求单位" align="center" field="demandUnit"/> -->
-          <vxe-column show-header-overflow v-if="showColumn.puManagerAuditor" title="采购经理审核人" align="center" field="puManagerAuditor" width="120px"/>
-          <vxe-column
+          </el-table-column>
+          <el-table-column show-overflow-tooltip v-if="showColumn.billSource" label="单据来源" align="center" prop="billSource" :formatter="formatterSource"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.registrant" label="注册人" align="center" prop="registrant" width="120px"/>
+          <!-- <el-table-column label="可用量" align="center" prop="qty"/> -->
+          <el-table-column show-overflow-tooltip v-if="showColumn.buyDiscrepancy" label="总需与终采差异" align="center" prop="buyDiscrepancy" width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.forecastClassification" label="集团预测分类" align="center" prop="forecastClassification" width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.centerBinPossession" label="中心仓占有量" align="center" prop="centerBinPossession" width="80px"/>
+          <el-table-column show-overflow-tooltip v-if="showColumn.centralWarehouseAvailable" label="中心仓可用量" align="center" prop="centralWarehouseAvailable" width="80px"/>
+          <!-- <el-table-column label="物料类别" align="center" prop="materialCategory" width="150px"/> -->
+          <!-- <el-table-column label="业务部门" align="center" prop="departmentName" width="150px"/> -->
+          <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="需求单位" align="center" prop="demandUnit"/> -->
+          <el-table-column show-overflow-tooltip v-if="showColumn.puManagerAuditor" label="采购经理审核人" align="center" prop="puManagerAuditor" width="120px"/>
+          <el-table-column
           fixed="right"
-          title="操作"
+          label="操作"
           align="center"
           width="100"
           >
           <template slot-scope="scope">
             <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
           </template>
-        </vxe-column>
-        </vxe-table>
+        </el-table-column>
+        </el-table>
 
         <el-button size="mini" style="position: absolute;left: 20px;bottom: 20px;" @click="tols.open = true">隐藏列</el-button>
 
@@ -382,7 +381,7 @@
           @current-change="handleCurrentChange"
           :current-page="queryParams.pageNum"
           :page-sizes="[10, 20, 50, 100, 200, 500]"
-          :page-size="10"
+          :page-size="50"
           layout="total, sizes, prev, pager, next, jumper"
           :total=total>
         </el-pagination>
@@ -429,8 +428,7 @@ export default {
         open: false
       },
       hangStatus(row) {
-        console.log('行状态', row)
-        switch (row.row.status) {
+        switch (row.status) {
           case '0':
             return '需补货'
           case '1':
@@ -446,7 +444,7 @@ export default {
         }
       },
       formatterBusinessType(row) {
-        switch (row.row.businessType) {
+        switch (row.businessType) {
           case 'ZQBH':
             return '周期备货'
           case 'FXXQ':
@@ -464,7 +462,7 @@ export default {
         }
       },
       formatterSource(row) {
-        switch (row.row.billSource) {
+        switch (row.billSource) {
           case '1':
             return '手工导入'
           case '2':
@@ -484,7 +482,7 @@ export default {
         rowStatus: ['1'],
         buyer: '',
         buyerName: '',
-        materialClassifyFour: '',
+        materialClassifyFour: [],
         manufacturer: '',
         forecastClassification: '',
         periodUnit: '',
@@ -506,7 +504,7 @@ export default {
         isCustomerSpecified: '',
         isUrgency: '',
         pageNum: 1,
-        pageSize: 10
+        pageSize: 50
       },
       personOptions: [],
       classOptions: [],
@@ -549,7 +547,7 @@ export default {
   },
   methods: {
     reDraw() {
-      // this.$refs.table.doLayout();
+      this.$refs.table.doLayout();
     },
     // 单元格标红
     cellClassName({row, column, rowIndex, columnIndex}) {
@@ -591,7 +589,7 @@ export default {
         rowStatus: ['1'],
         buyer: '',
         buyerName: '',
-        materialClassifyFour: '',
+        materialClassifyFour: [],
         manufacturer: '',
         forecastClassification: '',
         periodUnit: '',
@@ -613,7 +611,7 @@ export default {
         isCustomerSpecified: '',
         isUrgency: '',
         pageNum: 1,
-        pageSize: 10
+        pageSize: 50
       }
       this.getList(this.queryParams)
     },
@@ -636,7 +634,7 @@ export default {
         }
       }).then(() => {
         // 合计不显示重绘
-        // this.$refs.table.doLayout()
+        this.$refs.table.doLayout()
         this.loading = false
       }).catch(err => {
         this.loading = false
@@ -863,8 +861,8 @@ export default {
       this.$refs.tree.init(this.referCondition)
     },
     selectionsToInput2(selection) {
-      this.classOptions.push(selection)
-      this.queryParams.materialClassifyFour = selection.id
+      this.classOptions = selection
+      this.queryParams.materialClassifyFour = selection.map(item => {return item.id})
     },
     // 搜索区物料编码
     chooseMaterial() {
@@ -929,9 +927,13 @@ export default {
       this.$refs.refer.init(this.referCondition)
     },
     jilu(index) {
-      console.log('记录index', index)
       this.record.push(index)
     },
+    // 清空搜索区采购员
+    cleanBuyer() {
+      this.queryParams.buyer = ''
+      this.queryParams.buyerName = ''
+    }
   }
 }
 </script>

+ 135 - 93
src/views/purchase/DemandSummary/index.vue

@@ -14,7 +14,7 @@
             </el-col>
             <el-col :span="1.5">
               <el-form-item label="采购员">
-                <el-select clearable size="mini" v-model="queryParams.buyer" @focus="chooseRefer('CONTACTS_PARAM', true, '采购员')" style="width: 200px">
+                <el-select clearable size="mini" v-model="queryParams.buyer" @clear="cleanBuyer" @focus="chooseRefer('CONTACTS_PARAM', true, '采购员')" style="width: 200px">
                   <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
                 </el-select>
               </el-form-item>
@@ -25,6 +25,7 @@
                 v-model="queryParams.materialClassifyFour"
                 size="mini"
                 multiple
+                collapse-tags
                 clearable
                 @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
                 style="width: 200px"
@@ -131,7 +132,7 @@
                 <el-form-item label="物料编码">
                   <el-popover
                     placement="top-start"
-                    width="200"
+                    width="500"
                     trigger="hover"
                     :content="queryParams.names">
                   <el-input slot="reference" clearable size="mini" v-model="queryParams.names" @clear="clearMaterial" style="width: 200px" @paste.native="pasteMe($event)">
@@ -233,7 +234,13 @@
 
           <!-- <el-button type="primary" size="mini">转请购</el-button> -->
         </div>
-        <el-table
+        <vxe-toolbar ref="xToolbar1" custom>
+        </vxe-toolbar>
+
+        <vxe-table
+          id="toolbar_demo5"
+          :custom-config="{storage: true, checkMethod: checkColumnMethod}"
+          @resizable-change="resizableChangeEvent"
           v-loading="loading"
           :data="tableList" 
           :cell-style="{ borderColor: '#c0c0c0' }"
@@ -246,131 +253,133 @@
           max-height="620"
           style="font-size: 12px;"
           :cell-class-name="cellClassName"
-          @selection-change="handleSelectionChange"
-          @row-click="rowSelect"
-          @row-dblclick="doubleClick"
+          @checkbox-all="selectAllEvent"
+          @checkbox-change="handleSelectionChange"
+          @cell-dblclick="doubleClick"
           ref="table"
+          :checkbox-config="{trigger:'row', highlight: true, range: true}"
+          :column-config="{resizable: true}"
         >
-          <el-table-column type="selection" width="60" fixed="left"/>
-          <el-table-column show-overflow-tooltip  label="序号" type="index" align="center" width="50px" fixed="left"/>
-          <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="行号" align="center" prop="rowNo"/> -->
-          <el-table-column show-overflow-tooltip v-if="showColumn.status" label="行状态" align="center" prop="status" width="50px" :formatter="hangStatus"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.finalBuyQty" label="最终采购量" align="center" prop="finalBuyQty" width="80px">
+          <vxe-column type="checkbox" width="40" fixed="left"/>
+          <vxe-column show-header-overflow show-overflow  title="序号" type="seq" align="center" width="50px" fixed="left"/>
+          <!-- <vxe-column show-header-overflow show-overflow v-if="showColumn.status" title="行号" align="center" field="rowNo"/> -->
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.status" title="行状态" align="center" field="status" width="50px" :formatter="hangStatus"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.finalBuyQty" title="最终采购量" align="center" field="finalBuyQty" width="80px">
             <template slot-scope="scope">
-                <el-input size="mini" :disabled="scope.row.status !== '1' || lineDisable" v-model="scope.row.finalBuyQty" @change="jilu(scope.$index)"/>
+                <el-input size="mini" :disabled="scope.row.status !== '1' || lineDisable" v-model="scope.row.finalBuyQty" @change="jilu(scope.$rowIndex)"/>
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.artificialAdjust" label="人工调整数" align="center" prop="artificialAdjust" width="50px">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.artificialAdjust" title="人工调整数" align="center" field="artificialAdjust" width="50px">
             <template slot-scope="scope">
               {{scope.row.artificialAdjust = scope.row.finalBuyQty - scope.row.suggestionPurchase}}
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyOneName" label="一级品类" align="center" prop="materialClassifyOneName" width="50"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.materialCode" label="物料编码" align="center" prop="materialCode" width="50px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.materialName" label="品名" align="center" prop="materialName" width="50px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.specification" label="规格" align="center" prop="specification" width="50px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.unit" label="单位" align="center" prop="unit" width="50"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.manufacturer" label="生产厂家/代理人" align="center" prop="manufacturer" width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.demandNum" label="需求单位数" align="center" prop="demandNum" width="50px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.netDemandNum" label="总最终净需求量" align="center" prop="netDemandNum" width="80px">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.materialClassifyOneName" title="一级品类" align="center" field="materialClassifyOneName" width="80"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.materialCode" title="物料编码" align="center" field="materialCode" width="100px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.materialName" title="品名" align="center" field="materialName" width="100px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.specification" title="规格" align="center" field="specification" width="100px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.unit" title="单位" align="center" field="unit" width="50"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.manufacturer" title="生产厂家/代理人" align="center" field="manufacturer" width="100px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.demandNum" title="需求单位数" align="center" field="demandNum" width="50px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.netDemandNum" title="总最终净需求量" align="center" field="netDemandNum" width="80px">
             <template slot-scope="scope">
               {{scope.row.netDemandNum ? parseFloat(scope.row.netDemandNum).toFixed(2) : '0.00'}}
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.evensalesforyear" label="近1月月均需求" align="center" prop="evensalesforyear" width="50">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.evensalesforyear" title="近1月月均需求" align="center" field="evensalesforyear" width="50">
             <template slot-scope="scope">
               {{scope.row.evensalesforyear ? parseFloat(scope.row.evensalesforyear).toFixed(2) : '0.00'}}
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.evensalesforthrmonth" label="近3月月均需求" align="center" prop="evensalesforthrmonth" width="50">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.evensalesforthrmonth" title="近3月月均需求" align="center" field="evensalesforthrmonth" width="50">
             <template slot-scope="scope">
               {{scope.row.evensalesforthrmonth ? parseFloat(scope.row.evensalesforthrmonth).toFixed(2) : '0.00'}}
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.totalMonthlySales" label="总月销量" align="center" prop="totalMonthlySales" width="50">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.totalMonthlySales" title="总月销量" align="center" field="totalMonthlySales" width="50">
             <template slot-scope="scope">
               {{scope.row.totalMonthlySales ? parseFloat(scope.row.totalMonthlySales).toFixed(2) : '0.00'}}
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.demandCycle" label="需求可用周期" align="center" prop="demandCycle" width="50px">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.demandCycle" title="需求可用周期" align="center" field="demandCycle" width="50px">
             <template slot-scope="scope">
               {{scope.row.demandCycle ? parseFloat(scope.row.demandCycle).toFixed(1) : '-'}}
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.dullQut" label="呆滞量" align="center" prop="dullQut" width="50px">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.dullQut" title="呆滞量" align="center" field="dullQut" width="50px">
             <template slot-scope="scope">
               {{parseFloat(scope.row.dullQut).toFixed(2)}}
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.buyPeriod" label="采购周期" align="center" prop="buyPeriod" width="50px" />
-          <el-table-column show-overflow-tooltip v-if="showColumn.centralPublicStock" label="中心公共库存" align="center" prop="centralPublicStock" width="50"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.centralWarehouse" label="中心仓专属货位" align="center" prop="centralWarehouse" width="50"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.eachWarehouseStock" label="各项目仓库存" align="center" prop="eachWarehouseStock" width="50"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.commerceWarehouse" label="电商仓库" align="center" prop="commerceWarehouse"  width="50" />
-          <el-table-column show-overflow-tooltip v-if="showColumn.regionPublicStock" label="区域分仓公共库存" align="center" prop="regionPublicStock" width="50"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.buyTransit" label="采购在途" align="center" prop="buyTransit"  width="80px" />
-          <el-table-column show-overflow-tooltip v-if="showColumn.lendTransit" label="借出在途" align="center" prop="lendTransit"  width="80px" />
-          <el-table-column show-overflow-tooltip v-if="showColumn.transferTransit" label="调拨在途" align="center" prop="transferTransit"  width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.stockTotal" label="库存总计" align="center" prop="stockTotal" width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.minPackage" label="最小包装量" align="center" prop="minPackage"  width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.minOrder" label="最小订货量" align="center" prop="minOrder"  width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.minBatch" label="最小批量" align="center" prop="minBatch"  width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.modifyReason" label="修改原因" align="center" prop="modifyReason" width="150px">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.buyPeriod" title="采购周期" align="center" field="buyPeriod" width="50px" />
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.centralPublicStock" title="中心公共库存" align="center" field="centralPublicStock" width="50"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.centralWarehouse" title="中心仓专属货位" align="center" field="centralWarehouse" width="50"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.eachWarehouseStock" title="各项目仓库存" align="center" field="eachWarehouseStock" width="50"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.commerceWarehouse" title="电商仓库" align="center" field="commerceWarehouse"  width="50" />
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.regionPublicStock" title="区域分仓公共库存" align="center" field="regionPublicStock" width="50"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.buyTransit" title="采购在途" align="center" field="buyTransit"  width="80px" />
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.lendTransit" title="借出在途" align="center" field="lendTransit"  width="80px" />
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.transferTransit" title="调拨在途" align="center" field="transferTransit"  width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.stockTotal" title="库存总计" align="center" field="stockTotal" width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.minPackage" title="最小包装量" align="center" field="minPackage"  width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.minOrder" title="最小订货量" align="center" field="minOrder"  width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.minBatch" title="最小批量" align="center" field="minBatch"  width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.modifyReason" title="修改原因" align="center" field="modifyReason" width="150px">
             <template slot-scope="scope">
-                <el-input size="mini" :disabled="scope.row.status !== '1'|| lineDisable || scope.row.artificialAdjust == '0'" v-model="scope.row.modifyReason" @change="jilu(scope.$index)"/>
+                <el-input size="mini" :disabled="scope.row.status !== '1'|| lineDisable || scope.row.artificialAdjust == '0'" v-model="scope.row.modifyReason" @change="jilu(scope.$rowIndex)"/>
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.suggestionPurchase" label="建议采购量" align="center" prop="suggestionPurchase"  width="80px"/>
-          <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="建议净采购量" align="center" prop="suggestBuyQty" width="100px"/> -->
-          <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyTwoName" label="二级品类" align="center" prop="materialClassifyTwoName" width="120px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyThreeName" label="三级品类" align="center" prop="materialClassifyThreeName" width="120px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.materialClassifyFourName" label="四级品类" align="center" prop="materialClassifyFourName" width="120px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.buyerName" label="采购员" align="center" prop="buyerName" width="150px">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.suggestionPurchase" title="建议采购量" align="center" field="suggestionPurchase"  width="80px"/>
+          <!-- <vxe-column show-header-overflow show-overflow v-if="showColumn.status" title="建议净采购量" align="center" field="suggestBuyQty" width="100px"/> -->
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.materialClassifyTwoName" title="二级品类" align="center" field="materialClassifyTwoName" width="120px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.materialClassifyThreeName" title="三级品类" align="center" field="materialClassifyThreeName" width="120px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.materialClassifyFourName" title="四级品类" align="center" field="materialClassifyFourName" width="120px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.buyerName" title="采购员" align="center" field="buyerName" width="150px">
             <template slot-scope="scope">
                 <el-input readonly :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.buyerName">
-                  <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'CONTACTS_PARAM', true, '明细采购员')"></el-button>
+                  <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$rowIndex, 'CONTACTS_PARAM', true, '明细采购员')"></el-button>
                 </el-input>
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.purchaseOrgName" label="默认采购组织" align="center" prop="purchaseOrgName" width="150px">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.purchaseOrgName" title="默认采购组织" align="center" field="purchaseOrgName" width="150px">
             <!-- <template slot-scope="scope">
                 <el-input readonly :disabled="scope.row.status !== '1' || lineDisable" size="mini" v-model="scope.row.purchaseOrgName">
                   <el-button size="mini" :disabled="scope.row.status !== '1' || lineDisable" slot="append" icon="el-icon-more" @click="chooseSon(scope.$index, 'ORG_PARAM', true, '明细默认采购组织')"></el-button>
                 </el-input>
             </template> -->
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.validityPeriod" label="有效期" align="center" prop="validityPeriod"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.validityPeriodUnit" label="有效期单位" align="center" prop="validityPeriodUnit" width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.businessType" label="业务类型" align="center" prop="businessType" :formatter="formatterBusinessType"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.safetyStock" label="安全库存量" align="center" prop="safetyStock" width="80px">
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.validityPeriod" title="有效期" align="center" field="validityPeriod"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.validityPeriodUnit" title="有效期单位" align="center" field="validityPeriodUnit" width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.businessType" title="业务类型" align="center" field="businessType" :formatter="formatterBusinessType"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.safetyStock" title="安全库存量" align="center" field="safetyStock" width="80px">
             <template slot-scope="scope">
               {{scope.row.safetyStock ? parseFloat(scope.row.safetyStock).toFixed(2) : '0.00'}}
             </template>
-          </el-table-column>
-          <el-table-column show-overflow-tooltip v-if="showColumn.billSource" label="单据来源" align="center" prop="billSource" :formatter="formatterSource"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.registrant" label="注册人" align="center" prop="registrant" width="120px"/>
-          <!-- <el-table-column label="可用量" align="center" prop="qty"/> -->
-          <el-table-column show-overflow-tooltip v-if="showColumn.buyDiscrepancy" label="总需与终采差异" align="center" prop="buyDiscrepancy" width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.forecastClassification" label="集团预测分类" align="center" prop="forecastClassification" width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.centerBinPossession" label="中心仓占有量" align="center" prop="centerBinPossession" width="80px"/>
-          <el-table-column show-overflow-tooltip v-if="showColumn.centralWarehouseAvailable" label="中心仓可用量" align="center" prop="centralWarehouseAvailable" width="80px"/>
-          <!-- <el-table-column label="物料类别" align="center" prop="materialCategory" width="150px"/> -->
-          <!-- <el-table-column label="业务部门" align="center" prop="departmentName" width="150px"/> -->
-          <!-- <el-table-column show-overflow-tooltip v-if="showColumn.status" label="需求单位" align="center" prop="demandUnit"/> -->
-          <el-table-column show-overflow-tooltip v-if="showColumn.puManagerAuditor" label="采购经理审核人" align="center" prop="puManagerAuditor" width="120px"/>
-          <el-table-column
+          </vxe-column>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.billSource" title="单据来源" align="center" field="billSource" :formatter="formatterSource"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.registrant" title="注册人" align="center" field="registrant" width="120px"/>
+          <!-- <vxe-column title="可用量" align="center" field="qty"/> -->
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.buyDiscrepancy" title="总需与终采差异" align="center" field="buyDiscrepancy" width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.forecastClassification" title="集团预测分类" align="center" field="forecastClassification" width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.centerBinPossession" title="中心仓占有量" align="center" field="centerBinPossession" width="80px"/>
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.centralWarehouseAvailable" title="中心仓可用量" align="center" field="centralWarehouseAvailable" width="80px"/>
+          <!-- <vxe-column title="物料类别" align="center" field="materialCategory" width="150px"/> -->
+          <!-- <vxe-column title="业务部门" align="center" field="departmentName" width="150px"/> -->
+          <!-- <vxe-column show-header-overflow show-overflow v-if="showColumn.status" title="需求单位" align="center" field="demandUnit"/> -->
+          <vxe-column show-header-overflow show-overflow v-if="showColumn.puManagerAuditor" title="采购经理审核人" align="center" field="puManagerAuditor" width="120px"/>
+          <vxe-column
           fixed="right"
-          label="操作"
+          title="操作"
           align="center"
-          width="100"
+          width="50"
           >
           <template slot-scope="scope">
             <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
           </template>
-        </el-table-column>
-        </el-table>
+        </vxe-column>
+        </vxe-table>
 
-        <el-button size="mini" style="position: absolute;left: 20px;bottom: 20px;" @click="tols.open = true">隐藏列</el-button>
+        <!-- <el-button size="mini" style="position: absolute;left: 20px;bottom: 20px;" @click="tols.open = true">隐藏列</el-button> -->
 
         <colTol :isVisible.sync="tols.open" @reDraw="reDraw" :showColumn.sync="showColumn" :arrs.sync="arrs"/>
 
@@ -427,7 +436,7 @@ export default {
         open: false
       },
       hangStatus(row) {
-        switch (row.status) {
+        switch (row.row.status) {
           case '0':
             return '需补货'
           case '1':
@@ -443,7 +452,7 @@ export default {
         }
       },
       formatterBusinessType(row) {
-        switch (row.businessType) {
+        switch (row.row.businessType) {
           case 'ZQBH':
             return '周期备货'
           case 'FXXQ':
@@ -461,7 +470,7 @@ export default {
         }
       },
       formatterSource(row) {
-        switch (row.billSource) {
+        switch (row.row.billSource) {
           case '1':
             return '手工导入'
           case '2':
@@ -542,15 +551,34 @@ export default {
     }
   },
   created() {
-    this.getList(this.queryParams)
+    this.$nextTick(() => {
+      // 手动将表格和工具栏进行关联
+      this.$refs.table.connect(this.$refs.xToolbar1)
+      this.getList(this.queryParams)
+    })
   },
   methods: {
+    checkColumnMethod ({ column }) {
+      if (column.property === 'role') {
+        return false
+      }
+      return true
+    },
+    resizableChangeEvent () {
+      const columns = this.$refs.table.getColumns()
+      const customData = columns.map(column => {
+        return {
+          width: column.renderWidth
+        }
+      })
+      console.log(customData)
+    },
     reDraw() {
-      this.$refs.table.doLayout();
+      // this.$refs.table.doLayout();
     },
     // 单元格标红
     cellClassName({row, column, rowIndex, columnIndex}) {
-      if(column.label == "需求可用周期" && Number(row.demandCycle) > 1.5 ) {
+      if(column.title == "需求可用周期" && Number(row.demandCycle) > 1.5 ) {
         return 'success-row';
       }
     },
@@ -639,7 +667,15 @@ export default {
         this.loading = false
       })
     },
-    handleSelectionChange(selection) {
+    selectAllEvent({checked}) {
+      const selection = this.$refs.table.getCheckboxRecords()
+      console.log('选中', selection)
+      this.allSelection = selection
+      this.ids = selection.map(item => item.demandItemId)
+      console.log('选中数组', this.ids.join())
+    },
+    handleSelectionChange({checked}) {
+      const selection = this.$refs.table.getCheckboxRecords()
       console.log('选中', selection)
       this.allSelection = selection
       this.ids = selection.map(item => item.demandItemId)
@@ -673,7 +709,7 @@ export default {
       this.rowDetail = row
       this.disable = true
     },
-    doubleClick(row) {
+    doubleClick({row}) {
       this.isList = false
       this.page = 'check'
       this.rowDetail = row
@@ -681,7 +717,8 @@ export default {
     },
     // 表格选中数据
     rowSelect(row) {
-      this.$refs.table.toggleRowSelection(row);
+      // console.log(row)
+      this.$refs.table.toggleCheckboxRow(row.row);
     },
     handleSizeChange(val) {
       console.log(`每页 ${val} 条`);
@@ -928,6 +965,11 @@ export default {
     jilu(index) {
       this.record.push(index)
     },
+    // 清空搜索区采购员
+    cleanBuyer() {
+      this.queryParams.buyer = ''
+      this.queryParams.buyerName = ''
+    }
   }
 }
 </script>
@@ -956,13 +998,13 @@ export default {
   margin-top: 10px;
   text-align: right;
 }
-::v-deep .el-table__row > td {
+::v-deep .vxe-body--row > td {
   border-right: none;
 }
  ::v-deep .el-card .el-form-item {
   margin-bottom: 3px;
 }
-::v-deep .el-table__row .success-row {
+::v-deep .vxe-body--row .success-row {
   background-color: #ff8a8a!important;
 }
 </style>

+ 93 - 32
src/views/purchase/PurchaseDemandList/add.vue

@@ -184,6 +184,8 @@
           show-overflow="tooltip"
           keep-source
           beautifyTable
+          show-summary
+          @summary-method="jisuan"
           :checkbox-config="{highlight: true, trigger: 'row'}"
           :edit-config="{trigger: 'click', mode: 'row'}"
           :validConfig="{autoPos: true}">
@@ -425,6 +427,14 @@
     <!-- 批量调整参数 -->
     <el-dialog title="批量调整" :visible.sync="adjust.open" @close="closeEvent" width="38%">
       <el-row style="margin-bottom: 10px;">
+        <el-col :span="6" class="pltzTxt">默认采购组织</el-col>
+        <el-col :span="14">
+        <el-input class="pltzIpt" clearable size="mini" v-model="adjust.purOrgName" @focus="chooseOrg('ORG_PARAM', true, '采购组织')">
+          <el-button size="mini" slot="append" icon="el-icon-more" @click="chooseOrg('ORG_PARAM', true, '采购组织')"></el-button>
+        </el-input>
+        </el-col>
+      </el-row>
+      <el-row style="margin-bottom: 10px;">
         <el-col :span="6" class="pltzTxt">价格类型</el-col>
         <el-col :span="14">
         <el-select class="pltzIpt" clearable size="mini" v-model="adjust.priceType">
@@ -458,6 +468,14 @@
         </el-col>
       </el-row>
       <el-row style="margin-bottom: 10px;">
+        <el-col :span="6" class="pltzTxt">补单供应商</el-col>
+        <el-col :span="14">
+        <el-input class="pltzIpt" clearable :disabled="sonDisable || BDZT" size="mini" v-model="adjust.additionalSupplierName" @focus="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')">
+          <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseOrg('SUPPLIER_PARAM', true, '补单供应商')"></el-button>
+        </el-input>
+        </el-col>
+      </el-row>
+      <el-row style="margin-bottom: 10px;">
         <el-col :span="6" class="pltzTxt">业务备注</el-col>
         <el-col :span="14">
           <el-input class="pltzIpt" clearable size="mini" v-model="adjust.remark"/>
@@ -600,13 +618,18 @@ export default {
       // 批量调整参数
       adjust: {
         open: false,
+        puOrg: '',
+        purOrgName: '',
         priceType: '',
         purchaseMan: '',
         purchaseManName: '',
         warehouse: '',
         warehouseName: '',
+        csFlag: '',
         allocation: '',
         allocationName: '',
+        additionalSupplier: '',
+        additionalSupplierName: '',
         remark:'',
         deliveryAddress: '',
         deliveryAddressName: '',
@@ -1282,14 +1305,23 @@ export default {
         this.basicForm.demandPersonal = selection[0].code
         this.basicForm.demandPersonalName = selection[0].name
       }
+      if(this.referCondition.type == 'ORG_PARAM' && this.referCondition.title == '采购组织') {
+        this.adjust.puOrg = selection[0].id
+        this.adjust.purOrgName = selection[0].name
+      }
       if(this.referCondition.type == 'CONTACTS_PARAM' && this.referCondition.title == '采购员') {
         this.purchaseManOptions = selection
         this.adjust.purchaseMan = selection[0].code
         this.adjust.purchaseManName = selection[0].name
       }
+      if(this.referCondition.type == 'SUPPLIER_PARAM' && this.referCondition.title == '补单供应商') {
+        this.adjust.additionalSupplier = selection[0].id
+        this.adjust.additionalSupplierName = selection[0].name
+      }
       if(this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '收货仓库') {
         this.adjust.warehouse = selection[0].id
         this.adjust.warehouseName = selection[0].name
+        this.adjust.csFlag = selection[0].csFlag
         this.adjust.allocation = ''
         this.adjust.allocationName = ''
       }
@@ -1748,40 +1780,61 @@ export default {
     // 批量调整确认
     confirmAdjust() {
       console.log('data', this.adjust)
-      this.basicForm.puDemandItemList.forEach(item => {
-        this.ids.some(val => {
-          if(val == item.id) {
-            if(this.adjust.purchaseMan) {
-              item.buyer = this.adjust.purchaseMan
-              item.buyerName = this.adjust.purchaseManName
-            }
-            if(this.adjust.priceType) {
-              item.priceType = this.adjust.priceType
-            }
-            if(this.adjust.warehouseName) {
-              item.deliveryWarehouse = this.adjust.warehouse
-              item.deliveryWarehouseName = this.adjust.warehouseName
-              item.deliveryAllocation = this.adjust.allocation
-              item.deliveryAllocationName = this.adjust.allocationName
-            }
-            // if(this.adjust.allocationName) {
-            //   item.deliveryAllocation = this.adjust.allocation
-            //   item.deliveryAllocationName = this.adjust.allocationName
-            // }
-            if(this.adjust.remark) {
-              item.remark = this.adjust.remark
-            }
-            if(this.adjust.deliveryAddressName) {
-              item.deliveryAddressName = this.adjust.deliveryAddressName
-              item.deliveryAddress = this.adjust.deliveryAddress
-              item.contacts = this.adjust.contacts
-              item.contactsPhone = this.adjust.contactsPhone
-              item.address = this.adjust.address
+      if (this.adjust.csFlag == 'N' || this.adjust.csFlag == '' || this.adjust.allocationName) {
+        this.basicForm.puDemandItemList.forEach(item => {
+          this.ids.some(val => {
+            if(val == item.id) {
+              if(this.adjust.purchaseMan) {
+                item.buyer = this.adjust.purchaseMan
+                item.buyerName = this.adjust.purchaseManName
+              }
+              if(this.adjust.priceType) {
+                item.priceType = this.adjust.priceType
+              }
+              if(this.adjust.additionalSupplierName) {
+                item.additionalSupplier = this.adjust.additionalSupplier
+                item.additionalSupplierName = this.adjust.additionalSupplierName
+              }
+              if(this.adjust.purOrgName) {
+                item.purOrgName = this.adjust.purOrgName
+                item.puOrg = this.adjust.puOrg
+                item.deliveryWarehouse = this.adjust.warehouse
+                item.deliveryWarehouseName = this.adjust.warehouseName
+                item.deliveryAllocation = this.adjust.allocation
+                item.deliveryAllocationName = this.adjust.allocationName
+                item.deliveryAddressName = this.adjust.deliveryAddressName
+                item.deliveryAddress = this.adjust.deliveryAddress
+                item.contacts = this.adjust.contacts
+                item.contactsPhone = this.adjust.contactsPhone
+                item.address = this.adjust.address
+              }
+              if(this.adjust.warehouseName) {
+                item.deliveryWarehouse = this.adjust.warehouse
+                item.deliveryWarehouseName = this.adjust.warehouseName
+                item.deliveryAllocation = this.adjust.allocation
+                item.deliveryAllocationName = this.adjust.allocationName
+              }
+              // if(this.adjust.allocationName) {
+              //   item.deliveryAllocation = this.adjust.allocation
+              //   item.deliveryAllocationName = this.adjust.allocationName
+              // }
+              if(this.adjust.remark) {
+                item.remark = this.adjust.remark
+              }
+              if(this.adjust.deliveryAddressName) {
+                item.deliveryAddressName = this.adjust.deliveryAddressName
+                item.deliveryAddress = this.adjust.deliveryAddress
+                item.contacts = this.adjust.contacts
+                item.contactsPhone = this.adjust.contactsPhone
+                item.address = this.adjust.address
+              }
             }
-          }
-          this.adjust.open = false
+            this.adjust.open = false
+          })
         })
-      })
+      } else {
+        this.$modal.notifyWarning('收货仓库存在收货货位,请填写!')
+      }
     },
     // 批量调整选择货位
     adjustHuoWei(type, isPage, title, stordocId) {
@@ -1800,13 +1853,18 @@ export default {
     closeEvent() {
       this.adjust =  {
         open: false,
+        puOrg: '',
+        purOrgName: '',
         priceType: '',
         purchaseMan: '',
         purchaseManName: '',
         warehouse: '',
         warehouseName: '',
+        csFlag: '',
         allocation: '',
         allocationName: '',
+        additionalSupplier: '',
+        additionalSupplierName: '',
         remark: '',
         deliveryAddress: '',
         deliveryAddressName: '',
@@ -1843,6 +1901,9 @@ export default {
         }
       })
     },
+    jisuan({columns, data}) {
+      console.log('生效了吗', {columns, data})
+    }
   }
 }
 </script>

+ 26 - 24
src/views/purchase/purchase-order/add/column.js

@@ -73,6 +73,7 @@ const PurColumns =[
     referName: "SUPPLIER_PARAM",
     dataMapping: {
       supplier: "id",
+      supplierCode:'code',
       supplierName: "name",
       paymentAgreement: 'paymentId',
       paymentAgreementName: 'paymentName',
@@ -156,15 +157,15 @@ const PurColumns =[
     disabled:true,
   },
   { 
-    key: "address",
-    title: "收货地址",
+    key: "goodsWarehouseName",
+    title: "收货仓库",
     inputType: "PopoverSelect",
-    valueKey: "address",
+    valueKey: "name",
     referName: "ADDRESS_PARAM",
-    require: true,
     isShow:true,
+    require: true,
     dataMapping: {
-      // address: 'address',
+      address: 'address',
       // addressName: '',
       goodsWarehouse:'id',
       goodsWarehouseName:'name',
@@ -172,8 +173,8 @@ const PurColumns =[
       contactsPhone:'contactsPhone'
     },
     queryParams: () => ({}),
-    width: 180
   },
+  
  
   { 
     key: "originalMoney", 
@@ -217,12 +218,13 @@ const PurColumns =[
     require: true,
   },
   { 
-    key: "goodsWarehouseName",
-    title: "收货仓库",
+    key: "address",
+    title: "收货地址",
     inputType: "Input",
-    isShow:true,
-    disabled:true,
     require: true,
+    disabled:true,
+    isShow:true,
+    width: 180
   },
   
   { 
@@ -768,6 +770,7 @@ const CauseColumns =[
     referName: "SUPPLIER_PARAM",
     dataMapping: {
       supplier: "id",
+      supplierCode:'code',
       supplierName: "name",
       paymentAgreement: 'paymentId',
       paymentAgreementName: 'paymentName',
@@ -873,7 +876,6 @@ const CauseColumns =[
     controlsPosition: "right",
     // precision:2,
     isShow:true, 
-    require: true,
   },
   { 
     key: "deductionMoney", 
@@ -882,7 +884,6 @@ const CauseColumns =[
     controlsPosition: "right",
     // precision:2,
     isShow:true, 
-    require: true,
   },
   {
     key: "warehouseName",
@@ -935,31 +936,32 @@ const CauseColumns =[
   },
   
   // { key: "place", title: "收货地点", inputType: "Input", width: 180 },
-  { 
-    key: "address",
-    title: "收货地址",
+  {
+    key: "goodsWarehouseName",
+    title: "收货仓库", 
     inputType: "PopoverSelect",
-    valueKey: "address",
+    valueKey: "name",
     referName: "ADDRESS_PARAM",
-    width: 180,
+    width: 200,
     isShow:true,
     dataMapping:{
-      // address: 'address',
-      // addressName: '',
+      address: 'address',
       goodsWarehouse:'id',
       goodsWarehouseName:'name',
       contacts:'contactsName',
       contactsPhone:'contactsPhone'
     }
   },
-  {
-    key: "goodsWarehouseName",
-    title: "收货仓库", 
+  { 
+    key: "address",
+    title: "收货地址",
     inputType: "Input",
-    width: 200,
-    disabled:true,
+    width: 180,
     isShow:true,
+    disabled:true,
+   
   },
+  
   { 
     key: "contacts", 
     title: "收货联系人", 

+ 1036 - 0
src/views/purchase/purchase-order/add/index copy.vue

@@ -0,0 +1,1036 @@
+<script>
+import orderApi from "@/api/business/purchase/purchase-order";
+import { initColumns, initDicts, initRules, initParams } from "@/utils/init/index.js";
+// import { Columns, TabColumns } from "./column";
+import judgeColumns from "./column";
+import { tax, currency } from "@/components/popover-select-v2/fetch";
+import VirtualScroll from 'el-table-virtual-scroll';
+import { VirtualColumn } from 'el-table-virtual-scroll';
+
+const {Columns,TabColumns} = judgeColumns();
+    
+const NewColumns = initColumns(Columns);
+const NewTabColumns = TabColumns.map((element) => ({
+  ...element,
+  tableColumns: initColumns(element.tableColumns),
+}));
+
+const SelectColumns = NewColumns.filter(
+  (column) => column.inputType === "Select"
+);
+NewTabColumns.forEach((column) => {
+  SelectColumns.push(
+    ...column.tableColumns.filter((cColumn) => cColumn.inputType === "Select")
+  );
+});
+
+export default {
+  name: "AddPurchaseOrderDrawer",
+  props:{
+    // roles:{
+    //   type:[Array,String,Object],
+    //   require:true,
+    // }
+  },
+  dicts: initDicts(SelectColumns),
+  components: {
+    'virtual-scroll':VirtualScroll,VirtualColumn,
+    FileUploadCenter: () => import("../components/FileUploadCenter/index.vue"),
+    popDialog: () => import("@/components/PopDialog/index.vue"),
+    BatchImport: () => import("@/components/BatchImport/index.vue"),
+  },
+  
+
+  data() {
+
+    return {
+      visible: false,
+      loading:false,
+      tabLoading:false,
+      columns: NewColumns,
+      rules: initRules(NewColumns),
+      count:0,
+      params: {
+        ...initParams(NewColumns),
+        puOrderItemList: [],
+        puOrderExecuteList: [],
+      },
+      tabColumns: NewTabColumns,
+      tabName: "puOrderItemList",
+      isCopy:false,
+      tableData:[],  //虚拟滚动加载显示的数据
+    };
+  },
+  computed: {
+    role:{
+      get(){
+        let {roles} = this.$store.state.user;
+        return roles.find(item => item === "syfz-purchaseorder") || "procurementManager";
+        
+      },
+      set(){}
+    }
+  },
+  watch: {
+    "params.puOrderItemList": {
+      handler(nVal, oVal) {
+        this.visible &&  
+          this.handleSynchronousMaterial(
+            "puOrderItemList",
+            "puOrderExecuteList"
+          );
+      },
+      deep: true,
+    },
+    "params.puOrderExecuteList": {
+      handler(nVal, oVal) {
+        this.visible &&
+          this.handleSynchronousMaterial(
+            "puOrderExecuteList",
+            "puOrderItemList"
+          );
+      },
+      deep: true,
+    },
+    "params.billType":{
+      handler(nVal, oVal){
+
+        let billList = ['21-Cxx-02','21-Cxx-04','21-Cxx-10','21-Cxx-14','21-Cxx-09','21-Cxx-17','21-Cxx-18'];
+        
+        if(billList.find(item => item === nVal)){
+          this.rules.warehouseName = [
+            { required: true, message: "WMS入库仓库不能为空", trigger: "change" },
+          ];
+        }else{
+          this.rules.warehouseName = null;
+        }
+
+        this.count++;
+      }
+    }
+  },
+  methods: {
+    beforeOpen() {
+      if(!this.isCopy){
+
+        const { deptName, deptId, name, nickName, orgName, orgId } = this.$store.state.user;
+        this.params.puOrg = orgId;
+        this.params.puOrgName = orgName;
+        this.params.buyer = name;
+        this.params.buyerName = nickName;
+        this.params.puDept = deptId;
+        this.params.puDeptName = deptName;
+        this.params.billDate = new Date().Format('yyyy-MM-dd');
+        this.params.createTime = new Date().Format('yyyy-MM-dd HH:mm:ss');
+        console.log(this.params,'this.params');
+        // this.addTableRow();
+      }
+    },
+    setVisible(prop,iscopy) {
+      this.visible = prop;
+
+      this.isCopy = iscopy;
+
+      if(!this.visible){
+        this.$refs['orderAddForm'].clearValidate();
+      }
+    },
+    // 复制赋值
+    async setCopyParams(id) {
+
+      try {
+        this.loading = true;
+        const { code, msg, data } = await orderApi.details(id);
+
+        if (code === 200) {
+
+          this.params = {
+            ...data,
+            id: "",
+            code: "",
+            isEnd:'N',
+            status: "0",
+            source: "3",
+            isClose:'N',
+            billDate: new Date().Format('yyyy-MM-dd'),
+            createTime : new Date().Format('yyyy-MM-dd HH:mm:ss'),
+            closeTime:'',
+            oaDemandNo:'',
+            isInvoice:'N',
+            isSendWms:'N',
+            rebateMoney:'',
+            invoiceMoney:'',
+            paymentMoney:'',
+            applyPaymentMoney:'',
+            erpOrderCode:'',
+
+          };
+
+          try {
+            const { code, rows} = await orderApi.REFER(
+              {
+                type:'WAREHOUSE_PARAM',
+                search:  this.params.warehouseName,
+                isPage: true,
+              }, {pageNum: 1 , pageSize: 10} );
+
+              if(code ==200){
+                this.judgeGoodsAllocation(rows[0].csFlag);
+              }
+
+
+          } catch (error) {
+            
+          }
+
+          for (const key in this.params) {
+            // if (Array.isArray(this.params[key])) {
+            if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
+              this.params[key].forEach((v) => {
+                v.id = "";
+                v.demandCode = "";
+                v['isInvoice'] && (v['isInvoice'] = 'N');
+                v['isStorage'] && (v['isStorage'] = 'N');
+                v['isArrival'] && (v['isArrival'] = 'N');
+                v['isPayment'] && (v['isPayment'] = 'N');
+              });
+
+            }
+          }
+          // 清空   累计本币开票金额、
+          // 累计付款金额、累计付款申请金额、累计开票主数量、最终关闭时间
+          // 、最终关闭、已同步WMS 、订单抵扣余额金额、订单使用返利金额、 发票标识
+          
+
+        }
+      } catch (err) {
+        //
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 增行
+    addTableRow(prop) {
+      for (const key in this.params) {
+
+        // if (Array.isArray(this.params[key])) {
+        if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
+
+          const arr = this.tabColumns.find(
+
+            (element) => element.key === key
+
+          ).tableColumns;
+
+          let rowData = initParams(arr, "key", "value");
+         
+
+          "rowno" in rowData &&
+            (rowData["rowno"] = this.params[key].length ? 
+              this.params[key][this.params[key].length - 1]['rowno'] +1 :
+               this.params[key].length + 1
+            );
+
+            // 物料
+            if("rowNo" in rowData){
+              
+              rowData["rowNo"] = this.params[key].length ? 
+              this.params[key][this.params[key].length - 1]['rowNo'] +1 :
+               this.params[key].length + 1;
+              // 扣税类别
+              rowData["taxDeductClassify"] = '1';
+              // 折本汇率
+              rowData["exchangeRate"] = '1';
+              // 价格类型
+              rowData["priceType"] = 'order';
+              // 币种
+              rowData["currency"] = '1002Z0100000000001K1';
+              rowData["currencyName"] = '人民币';
+            }
+          
+
+          // 是否完成询价,新增明细行需默认明细为false
+          // rowData["whetherCompleteInquiry"] = false;
+          this.params[key].push(rowData);
+        }
+      }
+
+      // const arr = this.tabColumns.find(
+      //   (element) => element.key === this.tabName
+      // ).tableColumns;
+      // prop.push(initParams(arr, "key", "value"));
+    },
+    // 删行
+    async delTableRow(prop, index) {
+
+     
+      for (const key in this.params) {
+        // if (Array.isArray(this.params[key])) {
+        if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
+          this.params[key].splice(index, 1);
+        }
+      }
+
+      await this.handleGetPrice();
+      // prop.splice(index, 1);
+    },
+    // 同步子表物料
+    handleSynchronousMaterial(tableOne, tableTwo) {
+      let _this = this;
+      // this.params[tableOne]-- -> this.params[tableTwo]
+      this.params[tableOne] &&
+
+        this.params[tableOne].forEach((item, index) => {
+
+          for (const key in item) {
+
+            if(!_this.params[tableTwo][index]){
+
+               const arr = _this.tabColumns.find(
+                  (element) => element.key === tableTwo
+                ).tableColumns;
+
+                _this.params[tableTwo].push(initParams(arr, "key", "value"));
+            }
+            
+            if (key in _this.params[tableTwo][index]) {
+
+              _this.params[tableTwo][index].material = item.material;
+
+              key !== 'id' && ( _this.params[tableTwo][index][key] = item[key]);
+
+            }
+          }
+        });
+    },
+    // 取消
+    handleCancel() {
+      this.params = {
+        ...initParams(this.columns),
+        puOrderItemList: [],
+        puOrderExecuteList: [],
+      };
+      this.setVisible(false);
+    },
+    // 判断保存条件
+    judgeSaveCondition(cb){
+      this.$refs['orderAddForm'].validate(async (valid) => {
+        if (valid) {
+
+          if(!this.params['puOrderItemList'].length || !this.params['puOrderExecuteList'].length){
+            this.$notify.error({
+              title: '错误',
+              message: '请填写订单行!'
+            });
+            return false;
+          }
+
+          // puOrderItemList
+        //  let isPrice =  this.params.puOrderItemList.filter(item => !item.whetherCompleteInquiry);
+
+         
+
+        //  if(isPrice.length && this.role === 'procurementManager'){
+
+        //     this.$notify.error({
+        //       title: '错误',
+        //       message: '询价失败!'
+        //     });
+        //     return false
+
+        //  }
+        //  console.log(isPrice,'isPrice');
+          cb();
+        } else {
+          this.$notify.error({
+              title: '错误',
+              message: '存在必填项未填写'
+            });
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    // 保存
+     handleSava() {
+     console.log(this.params,'this.params---------');
+      this.judgeSaveCondition(async()=>{
+        try {
+            this.loading = true;
+            const { code, msg } = await orderApi.create(this.params);
+            if (code === 200) {
+              this.handleCancel();
+            }
+          } catch (err) {
+            //
+          } finally {
+            this.loading = false;
+          }
+      })
+    },
+    judgeGoodsAllocation(porp){
+      if(porp === 'Y'){
+        this.rules.goodsAllocationName = [
+          { required: true, message: "货位不能为空", trigger: "change" },
+        ];
+      } else{ 
+        this.rules.goodsAllocationName = null;
+      }
+      this.count++;
+   },
+    // 主表参照改变之后
+   async handleReferChange(val, type, source){
+     let page = { pageNum: 1 , pageSize: 10 };
+      // 供应商选择  
+      if( type === 'SUPPLIER_PARAM' ){
+
+
+        let relevanceRefer = [
+          {
+            // 供应商联系人
+            key:'supplierContacts',
+            params:{
+              type:'SUPPLIERCONTACTS_PARAM',
+              supplierId:val.id,
+            }
+          },
+          {
+            // 供应商业务员
+            key:'supplierPersonal',
+            params:{
+              type:'PSNLICENSE_PARAM',
+              supplierId:val.id,
+              pkOrg: source.puOrg,
+            }
+          }
+        ]
+        
+        try {
+
+          let promiseArr =  relevanceRefer.map( (refer) =>{
+
+            return new Promise((resolve,reject)=>{
+
+               orderApi.REFER(
+                {
+                  ...refer.params,
+                  search: "",
+                  isPage: true,
+                }, page ).then(res=>{
+
+                  let {code,rows} = res;
+                  if (code === 200) {
+                    
+                    source[refer.key] = rows[0]? rows[0].id :'';
+                    
+                    source[`${refer.key}Name`] = rows[0] ? rows[0].name :'';
+                    
+                    resolve();
+                  }
+              })
+            })
+          })
+
+          Promise.all(promiseArr).then(async()=>{
+            // 明细不为空的情况下进行询价
+            let detailList = this.params['puOrderItemList'].filter(item => (
+                item.material && item.material != '' 
+              ))
+              
+              if(detailList.length){
+
+                await this.handleGetPrice();
+              }
+          })
+        } catch (error) {}
+      }
+
+      // 组织
+      if(type === 'ORG_PARAM'){
+
+          for (const key in this.params) {
+
+            // if (Array.isArray(this.params[key])) {
+            if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
+
+              this.params[key] = [];
+
+            }
+            else if(key === 'sysFileRecordList'){
+              this.params[key] = [];
+            }
+             else if (
+              key != "puOrg" &&
+              key != "puOrgName" &&
+              key != "buyer" &&
+              key != "buyerName" &&
+              key != "puDept" &&
+              key != "puDeptName" &&
+              key != "status" &&
+              key != "billDate" &&
+              key != "createTime" 
+            ) {
+              this.params[key] = "";
+            } else {
+            }
+          }
+        
+
+      }
+
+      // WMS仓库
+      if(type === 'WAREHOUSE_PARAM'){
+        this.judgeGoodsAllocation(val.csFlag);
+        source.goodsAllocation = ''
+        source.goodsAllocationName = ''
+        // this.count++
+      }
+    },
+
+    // 下拉框选择改变
+    handleSelectChange(val,typeName){
+
+      if(val === 'billType'){
+
+      this.params['billTypeName'] = this.dict.type[typeName].find(item => item.value == this.params[val]).label;
+
+      }
+
+    },
+
+
+    // 子表参照改变之后
+   async handleTabReferChange(val,  type, source) {
+
+      // 触发物料参照询价 
+      if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
+
+        source['qty'] = 0;
+
+        // source['whetherCompleteInquiry'] = false;
+
+        source['taxPrice'] = 0;
+
+        source['money'] = 0;
+
+        source['taxDeductMoneya'] = 0;
+
+        source['price'] = 0;
+        
+        source['notaxMoney'] = 0;
+
+        source['tax'] = 0;
+
+        this.params['qty'] = 0;
+        this.params['originalQty'] = 0;
+        this.params['money'] = 0;
+        this.params['originalMoney'] = 0;
+        this.params['notaxMoney'] = 0;
+        source.isDrug = val.materialMedcine.isDrug  == '0' ? 'Y' : 'N';
+
+        // await this.handleGetPrice();
+
+      }
+
+      // 物料触发税率
+      if( type == "MATERIAL_PARAM"){
+        let {rateCode} = source;
+        try {
+          // try
+          this.loading = true;
+          const { ntaxrate } = await tax(rateCode);
+          source.tax = ntaxrate === "0E-8" ? 0 : ntaxrate;
+        } catch (err) {
+          // catch
+          console.error(err);
+        } finally {
+          // finally
+          this.loading = false;
+        }
+      }
+
+    },
+
+    // 子表下拉框改变
+    async handleTabSelectChange(type,row){
+     
+      if(type == 'priceType' && row.material && row.qty && row.qty != ""){
+
+        // row['whetherCompleteInquiry'] = false;
+
+        await this.handleGetPrice();
+      }
+    },
+
+    // 子表inputNumber
+    handleInputChange(row, type) {
+      // 物料数量变化----询价
+      if ((type == "qty" || type == "taxPrice" || type == 'taxDeductMoneya')&& row.material) {
+
+        // row['whetherCompleteInquiry'] = false;
+
+        
+       this.handleGetPrice();
+
+      }
+
+      // if(this.role === 'syfz-purchaseorder' && row.material && (type == "qty" ||type === "taxPrice" )){
+
+      //   row.money = row.qty * row.taxPrice;
+      // }
+
+    },
+
+    // 子表多选框改变
+    handleTabCheckbox(type,source){
+
+      // 勾选赠品,价税合计更新为0,含税单价、无税单价更新为0
+      if(type === 'isGift' && source.material && source.qty && source.qty != ""){
+
+        // source['whetherCompleteInquiry'] = false;
+
+        this.handleGetPrice()
+      }
+
+    },
+    // 询价 getPrice
+    async handleGetPrice() {
+
+        try {
+          
+          // action:insert(新增)、revise(修订)、update(编辑)
+          let { code, data } = await orderApi.getPrice({ ...this.params,action: 'insert' });
+  
+          if (code == 200) {
+  
+            this.params = data;
+  
+          }
+  
+        } catch (error) {} 
+      
+
+    
+    },
+
+    async handelImport(fileList){
+
+      try {
+
+        let formData = new FormData();
+
+        formData.append('file',fileList[0].raw);
+
+        this.$modal.loading("正在上传文件,请稍候...");
+
+        let {code,data} = await orderApi.orderImport(formData);
+
+        if(code == 200) {
+          this.tabLoading = true;
+          // puOrderExecuteList puOrderItemList
+
+          // let size = 20;
+          // let num = 1;
+          // let total = Math.ceil(data['puOrderItemList'].length / size);
+
+          // let resultData = {...data};
+          
+          // let intervalPush = setInterval(()=>{
+
+          //   if(num > total){
+              
+          //     clearInterval(intervalPush);
+
+          //     this.tabLoading = false;
+            
+          //     this.handleGetPrice();
+          //   } 
+    
+          //   for (const key in resultData) {
+
+          //     resultData[key].slice(size*(num-1), (size*num) ).forEach(item =>{
+            
+
+          //       this.params[key].push(item);
+
+          //     })
+
+          //   }
+
+          //   num++;
+
+          // },200);
+
+          for (const key in data) {
+
+            this.params[key].push(...data[key]);
+
+          }
+
+          
+          let {setVisible} =  this.$refs.batchImport;
+          
+          setVisible(false);
+          
+            
+          
+        }
+        
+      } catch (error) {
+        
+      }finally{
+        this.$modal.closeLoading();
+        
+      }
+      
+    },
+    
+    async handleTemDownload(){
+
+      this.download('/pu/order/downloadFailData',{}, `采购订单物料信息模板${new Date().getTime()}.xlsx`);
+    },
+
+    // judgeRole(){
+    //   let {roles} = this.$store.state.user;
+    //   let role =  roles.find(item => item === "syfz-purchaseorder") || "procurementManager";
+    //   return role;
+    // },
+
+
+  },
+  created() {
+    console.log("ADD CREATED", this.params);
+  },
+  mounted() {},
+  destroyed() {},
+};
+</script>
+<template>
+  <el-drawer
+    direction="btt"
+    size="100%"
+    :with-header="false"
+    :visible.sync="visible"
+    @open="beforeOpen"
+    @close="$emit('close')"
+    v-loading="loading"
+  >
+    <el-form
+      size="mini"
+      label-position="right"
+      ref="orderAddForm"
+      label-width="140px"
+      :model="params"
+      :rules="rules"
+      :key="count"
+    >
+      <el-card
+        :body-style="{
+          padding: '20px',
+          display: 'flex',
+          'flex-wrap': 'wrap',
+        }"
+        style="margin: 10px"
+      >
+        <div
+          slot="header"
+          style="
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+          "
+        >
+          <h3>新增</h3>
+          <div style="text-align: right">
+            <el-button 
+              size="mini" 
+              type="primary"
+              @click="handleSava"
+            >保存</el-button>
+            <el-button size="mini" @click="handleCancel">取消</el-button>
+          </div>
+        </div>
+        <el-row style="display: flex; flex-wrap: wrap">
+          <el-col
+            v-for="(column, index) in columns"
+            :key="index"
+            :span="column.span || 6"
+          >
+            <el-form-item
+              :prop="column.key"
+              :label="column.title"
+              v-if="column.isShow"
+            >
+              <el-input
+                v-if="column.inputType === 'Input'"
+                v-model="params[column.key]"
+                :placeholder="column.placeholder"
+                :clearable="column.clearable"
+                :disabled="column.disabled"
+                style="width: 100%;"
+              >
+              </el-input>
+              <dr-popover-select
+                v-if="column.inputType === 'PopoverSelect'"
+                v-model="params[column.key]"
+                :value-key="column.valueKey"
+                :source.sync="params"
+                :title="column.title"
+                :type="column.referName"
+                :disabled="column.disabled"
+                :multiple="column.multiple"
+                :placeholder="column.placeholder"
+                :data-mapping="column.dataMapping"
+                :query-params="column.queryParams"
+                @change="handleReferChange"
+              ></dr-popover-select>
+
+              <el-input
+                v-if="column.inputType === 'Textarea'"
+                v-model="params[column.key]"
+                type="textarea"
+                :placeholder="column.placeholder"
+                :clearable="column.clearable"
+                :disabled="column.disabled"
+                style="width: 100%"
+              ></el-input>
+
+              <el-input-number
+                v-if="column.inputType === 'InputNumber'"
+                v-model="params[column.key]"
+                :precision="column.precision"
+                :controls-position="column.controlsPosition"
+                :placeholder="column.placeholder"
+                :clearable="column.clearable"
+                :disabled="column.disabled"
+                style="width: 100%"
+              >
+              </el-input-number>
+              <el-select
+                v-if="column.inputType === 'Select'"
+                v-model="params[column.key]"
+                :disabled="column.disabled"
+                :clearable="column.clearable"
+                :placeholder="column.placeholder"
+                style="width: 100%"
+                filterable
+                @change="handleSelectChange(column.key,column.referName)"
+              >
+                <el-option
+                  v-for="item in dict.type[column.referName]"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+              <el-select
+                v-if="column.inputType === 'TagSelect'"
+                v-model="params[column.key]"
+                multiple
+                clearable
+                collapse-tags
+                :placeholder="column.placeholder"
+                :clearable="column.clearable"
+                :disabled="column.disabled"
+                style="width: 100%"
+              >
+                <template #prefix>
+                  <el-icon
+                    class="el-icon-view"
+                    style="cursor: pointer"
+                    @click.stop="$message.info(234)"
+                  >
+                  </el-icon>
+                </template>
+                <el-option
+                  v-for="item in options"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                ></el-option>
+              </el-select>
+              <el-date-picker
+                v-if="column.inputType === 'DatePicker'"
+                v-model="params[column.key]"
+                :type="column.type"
+                :placeholder="column.placeholder"
+                :clearable="column.clearable"
+                :disabled="column.disabled"
+                :picker-options="column.pickerOptions"
+                style="width: 100%"
+              ></el-date-picker>
+              <el-checkbox
+                v-if="column.inputType === 'Checkbox'"
+                v-model="params[column.key]"
+                :disabled="column.disabled"
+                true-label="Y"
+                false-label="N"
+              ></el-checkbox>
+              <file-upload-center
+                v-if="column.inputType === 'Upload'"
+                v-model="params[column.key]"
+                :file-type="column.fileType"
+              ></file-upload-center>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-card>
+
+      <el-card
+        :body-style="{
+          padding: '20px',
+          display: 'flex',
+          'flex-wrap': 'wrap',
+          position: 'relative',
+        }"
+        style="margin: 10px"
+      >
+        <el-tabs v-model="tabName" style="width: 100%" v-loading="tabLoading">
+          <el-tab-pane
+            v-for="(column, index) in tabColumns"
+            :key="index"
+            :label="column.title"
+            :name="column.key"
+          >
+
+          <virtual-scroll :data="resultData" 
+                    :item-size="53" 
+                    key-prop="id" 
+                    @change="(virtualList) => tableData = virtualList" 
+                    :virtualized="true" @selection-change="handleSelectionChange">
+      <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
+          </virtual-scroll>
+
+
+            <el-table 
+              :data="params[column.key]" 
+              style="width: 100%"
+              :height="params[column.key].length ? 300 : 100"
+              border
+            >
+              <el-table-column
+                v-for="(cColumn, cIndex) in column.tableColumns"
+                :key="cIndex"
+                :label="cColumn.title"
+                :width="cColumn.width || 80"
+              >
+              <template slot="header" slot-scope="scope">
+                <span v-if="cColumn.require" style="color: #ff4949">*</span>
+                <span>
+                  {{ cColumn.title }}
+                </span>
+              </template>
+                <template slot-scope="scope">
+                  <el-form-item 
+                    label-width="0" 
+                    :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
+                    :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }"
+                  >
+                    <el-tag v-if="cColumn.key === 'index'" >
+                      {{ scope.$index + 1 }}
+                    </el-tag>
+                    <el-input
+                      v-if="cColumn.inputType === 'Input'"
+                      v-model="scope.row[cColumn.key]"
+                      :placeholder="cColumn.placeholder"
+                      :clearable="cColumn.clearable"
+                      :disabled="cColumn.disabled"
+                      size="mini"
+                      style="width: 100%"
+                    ></el-input>
+
+                    <!--  -->
+                    <dr-popover-select
+                      v-if="cColumn.inputType === 'PopoverSelect'"
+                      v-model="scope.row[cColumn.key]"
+                      :source.sync="scope.row"
+                      :title="cColumn.title"
+                      :value-key="cColumn.valueKey"
+                      :type="cColumn.referName"
+                      :disabled="cColumn.disabled"
+                      :multiple="cColumn.multiple"
+                      :placeholder="cColumn.placeholder"
+                      :data-mapping="cColumn.dataMapping"
+                      :query-params="cColumn.queryParams"
+                      @change="handleTabReferChange"
+                      size="mini"
+                    >
+                    </dr-popover-select>
+
+                    <el-input-number
+                      v-if="cColumn.inputType === 'InputNumber'"
+                      v-model="scope.row[cColumn.key]"
+                      :precision="cColumn.precision"
+                      :controls-position="cColumn.controlsPosition"
+                      :placeholder="cColumn.placeholder"
+                      @change="handleInputChange(scope.row, cColumn.key)"
+                      :clearable="cColumn.clearable"
+                      :disabled="cColumn.disabled"
+                      :min="cColumn.key === 'reservedQty' ? 0 : -Infinity"
+                      size="mini"
+                      style="width: 100%"
+                    ></el-input-number>
+
+                    <el-select
+                      v-if="cColumn.inputType === 'Select'"
+                      v-model="scope.row[cColumn.key]"
+                      filterable
+                      size="mini"
+                      :disabled="cColumn.disabled"
+                      :clearable="cColumn.clearable"
+                      :placeholder="cColumn.placeholder"
+                      style="width: 100%"
+                      @change="handleTabSelectChange(cColumn.key,scope.row)"
+                    >
+                      <el-option
+                        v-for="item in dict.type[cColumn.referName]"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value"
+                      ></el-option>
+                    </el-select>
+
+                    <el-checkbox
+                      v-if="cColumn.inputType === 'Checkbox'"
+                      v-model="scope.row[cColumn.key]"
+                      :disabled="cColumn.disabled"
+                      true-label="Y"
+                      false-label="N"
+                      @change="handleTabCheckbox(cColumn.key,scope.row)"
+                    ></el-checkbox>
+                  </el-form-item>
+                </template>
+              </el-table-column>
+
+              <el-table-column fixed="right" label="操作" width="80">
+                <template slot-scope="scope">
+                  <el-button
+                    @click.native.prevent="
+                      delTableRow(params[tabName], scope.$index)
+                    "
+                    type="text"
+                    size="small"
+                  >
+                    删行
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-tab-pane>
+        </el-tabs>
+        <el-row style="position: absolute; top: 20px; right: 20px">
+          <el-button size="mini" @click="addTableRow(params[tabName])"
+            >增行</el-button>
+         
+            <!-- v-if="role === 'procurementManager'" -->
+          <BatchImport
+            ref="batchImport"
+            @import="handelImport"
+            @temDownload="handleTemDownload"
+          ></BatchImport>
+        </el-row>
+      </el-card>
+    </el-form>
+  </el-drawer>
+</template>
+

+ 62 - 27
src/views/purchase/purchase-order/add/index.vue

@@ -4,6 +4,8 @@ import { initColumns, initDicts, initRules, initParams } from "@/utils/init/inde
 // import { Columns, TabColumns } from "./column";
 import judgeColumns from "./column";
 import { tax, currency } from "@/components/popover-select-v2/fetch";
+import VirtualScroll from 'el-table-virtual-scroll';
+import { VirtualColumn } from 'el-table-virtual-scroll';
 
 const {Columns,TabColumns} = judgeColumns();
     
@@ -32,6 +34,7 @@ export default {
   },
   dicts: initDicts(SelectColumns),
   components: {
+    'virtual-scroll':VirtualScroll,VirtualColumn,
     FileUploadCenter: () => import("../components/FileUploadCenter/index.vue"),
     popDialog: () => import("@/components/PopDialog/index.vue"),
     BatchImport: () => import("@/components/BatchImport/index.vue"),
@@ -55,6 +58,7 @@ export default {
       tabColumns: NewTabColumns,
       tabName: "puOrderItemList",
       isCopy:false,
+      tableData:[],  //虚拟滚动加载显示的数据
     };
   },
   computed: {
@@ -65,7 +69,16 @@ export default {
         
       },
       set(){}
-    }
+    },
+    tabHeight:{
+      get(){
+        return `${this.params['puOrderItemList'].length ? 
+                  (this.params['puOrderItemList'].length > 8 ? 500 :
+                   (this.params['puOrderItemList'].length *60) +100)
+                : 120}px`
+      },
+      set(){}
+    },
   },
   watch: {
     "params.puOrderItemList": {
@@ -243,6 +256,7 @@ export default {
               rowData["currency"] = '1002Z0100000000001K1';
               rowData["currencyName"] = '人民币';
             }
+            rowData['insertId'] = new Date().getTime();
           
 
           // 是否完成询价,新增明细行需默认明细为false
@@ -622,51 +636,53 @@ export default {
         let {code,data} = await orderApi.orderImport(formData);
 
         if(code == 200) {
-          this.tabLoading = true;
+          // this.tabLoading = true;
           // puOrderExecuteList puOrderItemList
 
-          let size = 20;
-          let num = 1;
-          let total = Math.ceil(data['puOrderItemList'].length / size);
+          // let size = 20;
+          // let num = 1;
+          // let total = Math.ceil(data['puOrderItemList'].length / size);
 
-          let resultData = {...data};
+          // let resultData = {...data};
           
-          let intervalPush = setInterval(()=>{
+          // let intervalPush = setInterval(()=>{
 
-            if(num > total){
+          //   if(num > total){
               
-              clearInterval(intervalPush);
+          //     clearInterval(intervalPush);
 
-              this.tabLoading = false;
+          //     this.tabLoading = false;
             
-              this.handleGetPrice();
-            } 
+          //     this.handleGetPrice();
+          //   } 
     
-            for (const key in resultData) {
+          //   for (const key in resultData) {
 
-              resultData[key].slice(size*(num-1), (size*num) ).forEach(item =>{
+          //     resultData[key].slice(size*(num-1), (size*num) ).forEach(item =>{
             
 
-                this.params[key].push(item);
+          //       this.params[key].push(item);
 
-              })
+          //     })
 
-            }
+          //   }
 
-            num++;
+          //   num++;
 
-          },200);
+          // },200);
 
-          // for (const key in data) {
+          for (const key in data) {
 
-          //   this.params[key].push(...data[key]);
+            this.params[key].push(...data[key]);
 
-          // }
+          }
 
           
           let {setVisible} =  this.$refs.batchImport;
           
           setVisible(false);
+
+          this.handleGetPrice();
           
             
           
@@ -888,12 +904,26 @@ export default {
             :label="column.title"
             :name="column.key"
           >
+
+          <virtual-scroll 
+            :data="params[column.key]" 
+            :item-size="53" 
+            :key-prop="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" 
+            @change="(virtualList) => tableData = virtualList" 
+            :virtualized="true"
+          >
+      <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
+          
             <el-table 
-              :data="params[column.key]" 
+              :row-key="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" 
+              :data="tableData" 
               style="width: 100%"
-              :height="params[column.key].length ? 300 : 100"
+              :height="tabHeight"
               border
             >
+              <template slot="empty">
+                <el-empty description="暂无数据"></el-empty>
+              </template>
               <el-table-column
                 v-for="(cColumn, cIndex) in column.tableColumns"
                 :key="cIndex"
@@ -906,12 +936,13 @@ export default {
                   {{ cColumn.title }}
                 </span>
               </template>
+
                 <template slot-scope="scope">
                   <el-form-item 
                     label-width="0" 
-                    :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
-                    :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }"
-                  >
+                    >
+                    <!-- :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
+                    :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }" -->
                     <el-tag v-if="cColumn.key === 'index'" >
                       {{ scope.$index + 1 }}
                     </el-tag>
@@ -1002,6 +1033,10 @@ export default {
                 </template>
               </el-table-column>
             </el-table>
+          </virtual-scroll>
+
+
+            
           </el-tab-pane>
         </el-tabs>
         <el-row style="position: absolute; top: 20px; right: 20px">

+ 1 - 1
src/views/purchase/purchase-order/column.js

@@ -340,7 +340,7 @@ export const TableColumns = [
     },
   },
   { 
-    item:{ key: "contacts", title: "收联系人" ,},
+    item:{ key: "contacts", title: "收联系人" ,},
     attr:{
       isHidden:true,
     },

+ 82 - 51
src/views/purchase/purchase-order/edit/index.vue

@@ -3,11 +3,14 @@ import { editColumns, editTabColumns, forbidden, SelectColumns } from "./initCol
 import orderApi from "@/api/business/purchase/purchase-order";
 import {  initDicts, initRules, initParams } from "@/utils/init/index.js";
 import { tax, currency } from "@/components/popover-select-v2/fetch";
+import VirtualScroll from 'el-table-virtual-scroll';
+import { VirtualColumn } from 'el-table-virtual-scroll';
 
 export default {
   name: "EditPurchaseOrderDrawer",
   dicts: initDicts(SelectColumns),
   components: {
+    'virtual-scroll':VirtualScroll,VirtualColumn,
     FileUploadCenter: () => import('../components/FileUploadCenter/index.vue'),
     BatchImport: () => import("@/components/BatchImport/index.vue"),
   },
@@ -27,7 +30,8 @@ export default {
 
       tabColumns: editTabColumns,
       tabName: "puOrderItemList",
-      count:1
+      count:1,
+      tableData:[],  //虚拟滚动加载显示的数据
     };
   },
   computed: {
@@ -38,7 +42,17 @@ export default {
         
       },
       set(){}
-    }
+    },
+    tabHeight:{
+      get(){
+        let length = this.params['puOrderItemList'].filter(item => item.delFlag === '0').length;
+        return `${length ? 
+                  (length > 8 ? 500 :
+                   (length *60) +100)
+                : 120}px`
+      },
+      set(){}
+    },
   },
   watch: {
     "params.contractType": function (newProp) {
@@ -112,6 +126,7 @@ export default {
                 key !== 'id' && ( _this.params[tableTwo][index][key] = item[key]);
 
             }
+
           }
         });
     },
@@ -208,8 +223,10 @@ export default {
       // prop.push(initParams(arr, "key", "value"));
     },
     // 删除行
-    async delTableRow(prop, row) {
-      console.log(row,'row---------------');
+    async delTableRow(prop, row, name) {
+
+      let delNo = name  === 'puOrderItemList' ? 'rowNo' :'rowno';
+
       if(prop.length === 1){
         this.$alert('订单行不允许为空', '提示', {
           confirmButtonText: '确定',
@@ -221,28 +238,28 @@ export default {
           }
         });
       }else{
-
-        // prop.splice(index, 1);
         for (const key in this.params) {
-  
-          // if (Array.isArray(this.params[key])) {
-            // params[column.key].filter(item => item.delFlag === '0')
+        
+
           if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
 
-            this.params[key] = this.params[key].map(item =>{
-              if(item.id && item.id === row.id){
-                console.log('删除已有ID的');
-                item['delFlag'] = '2';
-                return item;
-              }else if(item.insertId && item.insertId === row.insertId){
-                console.log('新增的');
-                return ;
-              }else{
-                return item;
+            this.params[key].forEach((item,index) =>{
+
+              let flag = key === 'puOrderItemList' ? 'rowNo' :'rowno';
+
+              // if(item.id && item.id === row.id){
+              //   console.log('删除已有ID的');
+              //   item['delFlag'] = '2';
+              // }
+
+              if(item[flag] && item[flag] === row[delNo]){
+
+                item.id ? (item['delFlag'] = '2'):
+                this.params[key].splice(index, 1);
               }
-            }).filter(item2 => item2 !== undefined)
-           
-            // console.log(this.params[key]);
+
+            })
+
             // this.params[key][index].id ? 
             //   (this.params[key][index]['delFlag'] = '2') :
             //   this.params[key].splice(index, 1);
@@ -250,6 +267,7 @@ export default {
              
           }
         }
+
   
         await this.handleGetPrice();
       }
@@ -638,51 +656,53 @@ export default {
         let {code,data} = await orderApi.orderImport(formData);
 
         if(code == 200) {
-          this.tabLoading = true;
-          // puOrderExecuteList puOrderItemList
 
-          let size = 20;
-          let num = 1;
-          let total = Math.ceil(data['puOrderItemList'].length / size);
+          // this.tabLoading = true;
+          // // puOrderExecuteList puOrderItemList
 
-          let resultData = {...data};
+          // let size = 20;
+          // let num = 1;
+          // let total = Math.ceil(data['puOrderItemList'].length / size);
+
+          // let resultData = {...data};
           
-          let intervalPush = setInterval(()=>{
+          // let intervalPush = setInterval(()=>{
 
-            if(num > total){
+          //   if(num > total){
               
-              clearInterval(intervalPush);
+          //     clearInterval(intervalPush);
 
-              this.tabLoading = false;
+          //     this.tabLoading = false;
             
-              this.handleGetPrice();
-            } 
+          //     this.handleGetPrice();
+          //   } 
 
-            for (const key in resultData) {
+          //   for (const key in resultData) {
 
-              resultData[key].slice(size*(num-1), (size*num) ).forEach(item =>{
+          //     resultData[key].slice(size*(num-1), (size*num) ).forEach(item =>{
 
-                this.params[key].push(item);
+          //       this.params[key].push(item);
 
-              })
+          //     })
               
-            }
+          //   }
 
-            num++;
+          //   num++;
 
-          },200);
+          // },200);
 
-          // for (const key in data) {
+          for (const key in data) {
 
-          //   this.params[key].push(...data[key]);
+            this.params[key].push(...data[key]);
 
-          // }
+          }
           
           let {setVisible} =  this.$refs.batchImport;
           
           setVisible(false);
           
-          if(num > total) this.handleGetPrice();
+          // if(num > total)
+           this.handleGetPrice();
           
         }
         
@@ -861,11 +881,20 @@ export default {
             :label="column.title" 
             :name="column.key"
             >
+
+            <virtual-scroll 
+              :data="params[column.key].filter(item => item.delFlag === '0')" 
+              :item-size="53" 
+              :key-prop="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" 
+              @change="(virtualList) => tableData = virtualList" 
+              :virtualized="true"
+            >
+            <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
             <el-table 
               border
-              :data="params[column.key].filter(item => item.delFlag === '0')" 
+              :data="tableData" 
               style="width: 100%"
-              :height="params[column.key].filter(item => item.delFlag === '0').length ? 300 : 100"
+              :height="tabHeight"
             >
               <el-table-column label="序号">
                 <template slot-scope="scope">
@@ -889,9 +918,9 @@ export default {
 
                   <el-form-item 
                     label-width="0" 
-                    :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
-                    :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }"
-                  >
+                    >
+                    <!-- :prop="`${column.key}.${scope.$index}.${[cColumn.key]}`"
+                    :rules="{ required: cColumn.require || false, message: `${cColumn.title}不能为空`, trigger: 'change' }" -->
 
                   <span v-if="!cColumn.inputType">
                     {{ scope.row[cColumn.key] }}
@@ -975,7 +1004,7 @@ export default {
               >
               <!-- v-if="!handleIsRevise()"  -->
                   <el-button 
-                    @click.native.prevent="delTableRow(params[tabName], scope.row)" 
+                    @click.native.prevent="delTableRow(params[tabName], scope.row,tabName)" 
                     type="text" 
                     size="small"
                     > 删行
@@ -983,6 +1012,8 @@ export default {
                 </template>
               </el-table-column>
             </el-table>
+          </virtual-scroll>
+           
           </el-tab-pane>
         </el-tabs>
         <el-row style="position: absolute; top: 20px; right: 20px">

+ 110 - 62
src/views/purchase/purchase-order/see/index.vue

@@ -10,6 +10,8 @@ import {
 import orderApi from "@/api/business/purchase/purchase-order";
 import { PRINT } from "@/api/business/purchase/task";
 import judgeColumns from "../add/column";
+import VirtualScroll from 'el-table-virtual-scroll';
+import { VirtualColumn } from 'el-table-virtual-scroll';
 
 const { Columns, TabColumns } = judgeColumns();
 
@@ -29,6 +31,7 @@ export default {
   name: "SeePurchaseOrderDrawer",
   dicts: initDicts(SelectColumns),
   components: {
+    'virtual-scroll':VirtualScroll,VirtualColumn,
     FileUploadCenter: () => import('../components/FileUploadCenter/index.vue'),
     FilePrint:() => import('../print/index.vue'),
   },
@@ -47,9 +50,21 @@ export default {
 
       tabColumns: NewTabColumns,
       tabName: "puOrderItemList",
+      tableData:[],  //虚拟滚动加载显示的数据
     };
   },
-  computed: {},
+  computed: {
+    tabHeight:{
+      get(){
+        let length = this.params['puOrderItemList'].filter(item => item.delFlag === '0').length;
+        return `${length ? 
+                  (length > 8 ? 500 :
+                   (length *60) +100)
+                : 120}px`
+      },
+      set(){}
+    },
+  },
   watch: {},
   methods: {
     
@@ -93,7 +108,12 @@ export default {
     },
     // 取 消
     handleCancel() {
-      this.params = initParams(Columns);
+      // this.params = initParams(Columns);
+      this.params = {
+        ...initParams(this.columns),
+        puOrderItemList: [],
+        puOrderExecuteList: [],
+      }
       this.setVisible(false);
     },
     handleRefresh(){
@@ -322,13 +342,32 @@ export default {
             :label="column.title" 
             :name="column.key"
           >
-            <el-table :data="params[column.key]" style="width: 100%"  border>
+
+            <virtual-scroll 
+              :data="params[column.key].filter(item => item.delFlag === '0')" 
+              :item-size="53" 
+              :key-prop="column.key === 'puOrderItemList' ? 'rowNo' :'rowno'" 
+              @change="(virtualList) => tableData = virtualList" 
+              :virtualized="true"
+            >
+            <!-- row-key绑定列唯一值,height一定要设置否则会滚动条滚动位置不对且数据滚动全部加载完后会出现白板-->
+            <el-table 
+              :data="tableData" 
+              style="width: 100%"  
+              :height="tabHeight"
+              border
+            >
+              <el-table-column label="序号">
+                <template slot-scope="scope">
+                  {{ scope.$index + 1 }}
+                </template>
+              </el-table-column>
               <el-table-column 
                 v-for="(cColumn, cIndex) in column.tableColumns" 
                 :key="cIndex" 
                 :prop="cColumn.key"
                 :label="cColumn.title" 
-                :width="cColumn.width || 80"
+                :width="cColumn.width"
               >
                 <template slot="header" slot-scope="scope">
                   <span v-if="cColumn.require" style="color: #ff4949">*</span>
@@ -337,68 +376,77 @@ export default {
                   </span>
                 </template>
                 <template slot-scope="scope">
-                  <el-tag v-if="cColumn.key === 'index'">
-                    {{ scope.$index + 1 }}
-                  </el-tag>
-                  <el-input v-if="cColumn.inputType === 'Input'" 
-                    v-model="scope.row[cColumn.key]"
-                    :placeholder="cColumn.placeholder" 
-                    :clearable="cColumn.clearable" 
-                    readonly 
-                    size="mini"
-                    style="width: 100%"
-                  ></el-input>
-
-                  <!--  -->
-                  <dr-popover-select v-if="cColumn.inputType === 'PopoverSelect'"
-                    v-model="scope.row[cColumn.key]"
-                    :source.sync="scope.row" 
-                    :title="cColumn.title" 
-                    :value-key="cColumn.valueKey" 
-                    disabled
-                    :type="cColumn.referName" 
-                    :multiple="cColumn.multiple" 
-                    :placeholder="cColumn.placeholder"
-                    :data-mapping="cColumn.dataMapping" 
-                    :query-params="cColumn.queryParams" 
-                  ></dr-popover-select>
-
-                  <el-input-number v-if="cColumn.inputType === 'InputNumber'" 
-                    v-model="scope.row[cColumn.key]"
-                    :precision="cColumn.precision"
-                    :controls-position="cColumn.controlsPosition" 
-                    :placeholder="cColumn.placeholder"
-                    :clearable="cColumn.clearable" 
-                    disabled 
-                    size="mini" 
-                    style="width: 100%"
-                  ></el-input-number>
-
-                  <el-select v-if="cColumn.inputType === 'Select'" 
-                    v-model="scope.row[cColumn.key]" 
-                    disabled 
-                    size="mini"
-                    :clearable="cColumn.clearable" 
-                    :placeholder="cColumn.placeholder" 
-                    style="width: 100%">
-                    <el-option 
-                      v-for="item in dict.type[cColumn.referName]" 
-                      :key="item.value" 
-                      :label="item.label"
-                      :value="item.value"
-                    ></el-option>
-                  </el-select>
-
-                  <el-checkbox v-if="cColumn.inputType === 'Checkbox'" 
-                    v-model="scope.row[cColumn.key]" 
-                    disabled
-                    true-label="Y" 
-                    false-label="N"
-                  ></el-checkbox>
+                  <el-form-item  label-width="0">
+                    <span v-if="!cColumn.inputType">
+                      {{ scope.row[cColumn.key] }}
+                    </span>
+                    
+                    <el-input v-if="cColumn.inputType === 'Input'" 
+                      v-model="scope.row[cColumn.key]"
+                      :placeholder="cColumn.placeholder" 
+                      :clearable="cColumn.clearable" 
+                      readonly 
+                      size="mini"
+                      style="width: 100%"
+                    ></el-input>
+
+                    <!--  -->
+                    <dr-popover-select v-if="cColumn.inputType === 'PopoverSelect'"
+                      v-model="scope.row[cColumn.key]"
+                      :source.sync="scope.row" 
+                      :title="cColumn.title" 
+                      :value-key="cColumn.valueKey" 
+                      disabled
+                      :type="cColumn.referName" 
+                      :multiple="cColumn.multiple" 
+                      :placeholder="cColumn.placeholder"
+                      :data-mapping="cColumn.dataMapping" 
+                      :query-params="cColumn.queryParams" 
+                      size="mini" 
+                    ></dr-popover-select>
+
+                    <el-input-number v-if="cColumn.inputType === 'InputNumber'" 
+                      v-model="scope.row[cColumn.key]"
+                      :precision="cColumn.precision"
+                      :controls-position="cColumn.controlsPosition" 
+                      :placeholder="cColumn.placeholder"
+                      :clearable="cColumn.clearable" 
+                      disabled 
+                      size="mini" 
+                      style="width: 100%"
+                    ></el-input-number>
 
+                    <el-select v-if="cColumn.inputType === 'Select'" 
+                      v-model="scope.row[cColumn.key]" 
+                      disabled 
+                      size="mini"
+                      :clearable="cColumn.clearable" 
+                      :placeholder="cColumn.placeholder" 
+                      style="width: 100%">
+                      <el-option 
+                        v-for="item in dict.type[cColumn.referName]" 
+                        :key="item.value" 
+                        :label="item.label"
+                        :value="item.value"
+                      ></el-option>
+                    </el-select>
+
+                    <el-checkbox v-if="cColumn.inputType === 'Checkbox'" 
+                      v-model="scope.row[cColumn.key]" 
+                      disabled
+                      true-label="Y" 
+                      false-label="N"
+                    ></el-checkbox>
+
+
+                  </el-form-item>
+                  
                 </template>
               </el-table-column>
             </el-table>
+          
+          </virtual-scroll>
+            
           </el-tab-pane>
         </el-tabs>
       </el-card>

+ 1 - 0
src/views/purchase/task/columns.js

@@ -42,6 +42,7 @@ export default function useColumns() {
       attr: { is: "el-dict-tag", dictName: "sys_price_type" },
     },
     { item: { key: "puUnitName", title: "采购单位",width :100 }, attr: {} },
+    { item: { key: "specification", title: "规格",width :100 }, attr: {} },
     { item: { key: "buyerName", title: "采购员",width :100 }, attr: {} },
     {
       item: { key: "supplierName", title: "建议供应商",width :100 },

+ 7 - 0
src/views/purchase/transferOrder/add.vue

@@ -1554,6 +1554,13 @@ export default {
     } else if (this.pageStu == "add") {
       this.basicForm.rate = 1;
       this.basicForm.billDate = new Date();
+      let currency = {
+        id: '1002Z0100000000001K1',
+        name: '人民币',
+      }
+      this.basicForm.currency = currency.id;
+      this.basicForm.currencyName = currency.name;
+      this.currencyOptions = [currency];
       this.loading = false
     }
   },