Эх сурвалжийг харах

Merge branch 'dev' of http://172.16.100.139/new-business/drp-web into dev

DongZ 1 жил өмнө
parent
commit
3598f4307d

+ 37 - 0
src/api/monitor/system.js

@@ -0,0 +1,37 @@
+import request from '@/utils/request'
+
+//查询服务列表
+export function list(query) {
+  return request({
+    url: '/pu/monitor/list',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 重新获取问题数据
+export function getDatas() {
+  return request({
+    url: '/pu/monitor/refreshDatas/',
+    method: 'post'
+  })
+}
+
+
+//查询服务详情
+export function detail(id) {
+  return request({
+    url: '/pu/monitor/detail/' + id,
+    method: 'get'
+  })
+}
+
+//处理问题数据
+export function disposeData(data) {
+  return request({
+    url: '/pu/monitor/disposeData/',
+    data: data,
+    method: 'post'
+  })
+}

+ 3 - 3
src/components/super-ux-table/index.vue

@@ -196,13 +196,12 @@ export default {
       }
     },
     // 宽度
-    onWidth(newProp, oldProp, column) {
-      console.log(column,'column');
+    onWidth({ column}) {
       this.innerColumns = this.innerColumns.map(({ item, attr }) => ({
         attr,
         item: {
           ...item,
-          width: item.key === column.property ? newProp : item.width,
+          width: item.key === column.property ? column.resizeWidth : item.width,
         },
       }));
       if (this.$props.storageKey) {
@@ -355,6 +354,7 @@ export default {
       :summary-method="getSummaries"
       highlight-current-row
       @row-click="onRowClick"
+      @header-dragend="onWidth"
       @selection-change="onSelectionChange"
       :header-row-style="{
         color: '#515a6e' ,

+ 175 - 0
src/views/monitor/system/index.vue

@@ -0,0 +1,175 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="OA对应单据信息" prop="oaIdentity">
+        <el-input
+          v-model="queryParams.oaIdentity"
+          placeholder="请输入OA对应单据信息"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="来源系统">
+        <el-select clearable v-model="queryParams.busDomain" size="mini" style="width: 200px"
+                   @keyup.enter.native="handleQuery" clearable>
+          <el-option v-for="dict in dict.type.oa_busdomian_desc" :key="dict.value" :label="dict.label"
+                     :value="dict.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery" plain>搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" type="info" @click="resetQuery" plain>重置</el-button>
+        <el-button icon="el-icon-video-play" size="mini" type="success" @click="getDatas" plain>更新数据</el-button>
+      </el-form-item>
+
+    </el-form>
+    <el-table v-loading="loading" :data="serviceList">
+      <el-table-column label="业务域" min-width="120" align="center" prop="busDomain" :formatter="formatterBusDomain"/>
+      <el-table-column label="业务类型" min-width="120" align="center" prop="monitorType">
+        <template slot-scope="scope">
+          <span v-if="scope.row.monitorType == 'flow'">流程</span>
+          <span v-if="scope.row.monitorType == 'todo'">待办</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="OA单据信息" min-width="80" align="center" prop="oaIdentity"/>
+      <el-table-column label="业务域单据信息" min-width="120" align="center" prop="docIdentity"
+                       :show-overflow-tooltip="true"/>
+      <el-table-column label="所属模块" min-width="80" align="center" prop="busModule" :show-overflow-tooltip="true"/>
+      <el-table-column label="状态释意" min-width="80" align="center" prop="busStatusName"/>
+      <el-table-column label="问题原因" min-width="150" align="center" prop="errorMsg"/>
+      <el-table-column label="创建时间" min-width="120" align="center" prop="createTime" :show-overflow-tooltip="true"/>
+      <el-table-column
+        fixed="right"
+        label="操作"
+        align="center"
+        width="180"
+      >
+        <template slot-scope="scope">
+          <el-button type="text" size="mini" @click="disposeData(scope.row)">处理</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+  import {list, getDatas, detail, disposeData} from "@/api/monitor/system";
+
+  export default {
+    dicts: ['oa_todo_type', 'oa_nc_bill_type', 'oa_flow_status', 'oa_busdomian_desc'],
+    data() {
+      return {
+        //遮罩层
+        loading: true,
+        //服务数据表
+        serviceList: [],
+        //显示搜索条件
+        showSearch: true,
+        //总条数
+        total: 0,
+        //查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          busDomain: '',
+          oaIdentity: ''
+        }
+      }
+    },
+    mounted() {
+      this.getList()
+    },
+    methods: {
+      //获取数据列表
+      getList() {
+        this.loading = true;
+        list(this.queryParams).then(res => {
+          this.serviceList = res.rows;
+          this.total = res.total;
+          this.loading = false;
+        });
+      },
+      //刷新数据
+      getDatas() {
+        this.loading = true;
+        getDatas().then(res => {
+          if (res.code === 200) {
+            this.loading = false
+            this.$message.success(res.msg);
+            this.getList();
+          } else {
+            this.$message.error(res.msg)
+          }
+        }).then(() => {
+          this.loading = false
+        }).catch(err => {
+          this.loading = false
+          this.$message.error(err.message)
+        })
+      },
+      //处理数据
+      disposeData(row) {
+        this.loading = true;
+        const data = {'id': row.id};
+        disposeData(data).then(res => {
+          if (res.code === 200) {
+            this.loading = false
+            this.$message.success(res.msg);
+            // this.getDatas();
+          } else {
+            this.$message.error(res.msg)
+          }
+        }).then(() => {
+          this.loading = false
+        }).catch(err => {
+          this.loading = false
+          this.$message.error(err.message)
+        })
+      },
+      formatterBusDomain(row) {
+        switch (row.busDomain) {
+          case 'NC_MOBLIE_APPROVE':
+            return 'NC-移动审批'
+          case 'NC_PAY_ORDER':
+            return 'NC-付款申请单'
+          case 'BIP_CONTRACT':
+            return '中台-采购合同'
+          case 'DRP':
+            return 'DRP-采购协同子系统'
+          case 'EHR':
+            return 'EHR-人力资源管理系统'
+          case 'OA':
+            return 'OA-办公管理系统'
+        }
+      },
+      //tab页签点击事件
+      handleClick(tab, event) {
+        console.log(tab, event);
+      },
+      //查询
+      handleQuery() {
+        this.queryParams.pageNum = 1;
+        this.getList();
+      },
+      //重置
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      }
+    }
+  }
+</script>
+
+<style>
+
+</style>

+ 5 - 2
src/views/purchase/apply/add/columns.js

@@ -82,7 +82,7 @@ export default function useColumns() {
       attr: { is: "el-input", disabled: true, readonly: true },
     },
     {
-      item: { key: "file", title: "附件", required: true, span: 24 },
+      item: { key: "file", title: "附件", span: 24 },
       attr: { is: "el-file-upload" },
     },
     {
@@ -138,7 +138,10 @@ export default function useColumns() {
         },
         {
           item: { key: "materialCode", title: "物料编码", required: true },
-          attr: {},
+          attr: {
+            is: "el-input",
+            clearable: true,
+          }, 
         },
         { item: { key: "manufacturerName", title: "生产厂家" }, attr: {} },
         { item: { key: "specification", title: "规格" }, attr: {} },

+ 488 - 3
src/views/purchase/apply/add/index.vue

@@ -3,6 +3,8 @@
   import {EXIST} from "@/api/business/purchase/catalogue";
   import {SAVE} from "@/api/business/purchase/apply";
   import {tax, unit, currency} from "@/components/popover-select-v2/fetch";
+  // 用于回显参照框数据
+  import {getRefer} from '@/api/purchase/basic.js'
 
   const fetchExist = async (prop) => {
     try {
@@ -52,6 +54,7 @@
         tabName: tabName,
         TabColumns: TabColumns,
         TableColumns: TableColumns,
+        delDemandItemList: [],
       };
     },
     computed: {},
@@ -191,8 +194,17 @@
       },
       //
       async onRowRemove(prop, scope) {
-        const {$index} = scope;
-        this.params[prop].splice($index, 1);
+        // const {$index} = scope;
+        // this.params[prop].splice($index, 1);
+        scope.row.delFlag = '2'
+        let delList = []
+        delList = this.params[prop].filter(item => {
+          return item.delFlag == '2'
+        })
+        this.params[prop] = this.params[prop].filter(item => {
+          return item.delFlag == '0'
+        })
+        this.delDemandItemList.push(...delList)
       },
       //
       async useSubmit(prop) {
@@ -200,11 +212,21 @@
           if (valid) {
             try {
               this.loading = true;
-              const {msg, code} = await SAVE(this.params);
+              let list = []
+              list.push(...this.params.priceApplyItems, ...this.delDemandItemList)
+              this.params.priceApplyItems = this.params.priceApplyItems.filter(
+                (item) => item.materialName
+              );
+              // 深拷贝一下参数对象
+              let param = JSON.parse(JSON.stringify(this.params))
+              console.log('深拷贝对象',param);
+              param.priceApplyItems = list
+              const {msg, code} = await SAVE(param);
               if (code === 200) {
                 this.onHide();
                 this.$emit("success");
                 this.$notify.success(msg);
+                this.delDemandItemList = []
               }
             } catch (err) {
               // catch
@@ -218,6 +240,359 @@
           }
         });
       },
+      // 粘贴
+      async pasteMe(e, scope, index, prop) {
+        this.$modal.loading("正在处理数据...");
+        e.preventDefault() //阻止默认粘贴事件
+        let source = e.clipboardData.getData("Text");
+        console.log('scope', scope.column.property)
+        console.log('index', index)
+        // 首先对源头进行解析
+        let rows = source.split("\r\n"); // 拆成一个数组
+        // 数组去除空字符串
+        rows = rows.filter(item => {
+          return item && item.trim()
+        })
+        if (rows.length < 100) {
+          if(scope.column.property == 'materialCode') {
+            let rowList = []
+            let newLine = []
+            await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
+              if (res.code === 200) {
+                rowList = res.rows
+              }
+            })
+            const {
+              puOrg,
+              customer,
+              customerName,
+              supplier,
+              currency,
+              currencyCode,
+              currencyName,
+            } = this.params;
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            // console.log('kk', TableColumns)
+            // console.log('this.$init.params(TableColumns)', this.$init.params(TableColumns))
+            for (let i = 0; i<rowList.length; i++) {
+              let line = {...this.$init.params(TableColumns)}
+              console.log('line',line)
+              const {nickName: createByName} = this.$store.state.user;
+              const {ntaxrate} = await tax(rowList[i].materialRateName);
+              // task 2
+              const {
+                id: puUnit,
+                code: puUnitCode,
+                name: puUnitName,
+              } = await unit(rowList[i].unitIdName);
+              // task 3
+              const {
+                recentlyPrice = "0",
+                isApprovalFirst = "N",
+                purchasequantity,
+                recentlyPriceDate
+              } = await fetchExist({puOrg, customer, supplier, materialCode: rowList[i].code, customerName: "", priceType: line.priceType});
+              line.delFlag = '0'
+              line.materialCode = rowList[i].code
+              line.material = rowList[i].id
+              line.materialName = rowList[i].name
+              line.specification = rowList[i].specification
+              line.model = rowList[i].model
+              line.manufacturerName = rowList[i].manufacturerIdName
+              line.unit = puUnit,
+              line.unitCode = puUnitCode,
+              line.unitName = puUnitName,
+              line.puUnit  = puUnit,
+              line.puUnitCode = puUnitCode,
+              line.puUnitName = puUnitName,
+              line.recentlyPrice = recentlyPrice
+              line.isApprovalFirst = isApprovalFirst
+              line.recentlyPriceDate = recentlyPriceDate,
+              line.yPurchaseQuantity = purchasequantity,
+              line.tax = Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
+              line.createByName = createByName,
+              line.updateByName = createByName,
+              line.currency = currency
+              line.currencyCode = currencyCode
+              line.currencyName = currencyName
+              newLine.push(line)
+              console.log('临时数组', newLine)
+            }
+            // 删除指定下标
+            this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+            this.$modal.closeLoading();
+            this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
+
+          } else if(scope.column.property == 'taxPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.taxPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].taxPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } 
+
+        } else {
+          this.$modal.notifyWarning("复制长度不能超过100!");
+          this.$modal.closeLoading();
+        }
+      },
     },
     created() {
     },
@@ -292,6 +667,116 @@
                 >
                 </component>
               </template>
+              <template slot="materialCode" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="taxPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
               <template slot="customerName" slot-scope="scope">
                 <component
                   v-bind="scope.attr"

+ 5 - 2
src/views/purchase/apply/copy/columns.js

@@ -82,7 +82,7 @@ export default function useColumns() {
       attr: { is: "el-input", disabled: true, readonly: true },
     },
     {
-      item: { key: "file", title: "附件", required: true, span: 24 },
+      item: { key: "file", title: "附件", span: 24 },
       attr: { is: "el-file-upload" },
     },
     {
@@ -138,7 +138,10 @@ export default function useColumns() {
         },
         {
           item: { key: "materialCode", title: "物料编码", required: true },
-          attr: {},
+          attr: {
+            is: "el-input",
+            clearable: true,
+          },
         },
         { item: { key: "manufacturerName", title: "生产厂家" }, attr: {} },
         { item: { key: "specification", title: "规格" }, attr: {} },

+ 488 - 4
src/views/purchase/apply/copy/index.vue

@@ -3,6 +3,8 @@
   import {EXIST} from "@/api/business/purchase/catalogue";
   import {ITEM, SAVE} from "@/api/business/purchase/apply";
   import {tax, unit, currency} from "@/components/popover-select-v2/fetch";
+  // 用于回显参照框数据
+  import {getRefer} from '@/api/purchase/basic.js'
 
   const fetchExist = async (prop) => {
     try {
@@ -56,6 +58,7 @@
         tabName: tabName,
         TabColumns: TabColumns,
         TableColumns: TableColumns,
+        delDemandItemList: [],
       };
     },
     computed: {
@@ -236,8 +239,17 @@
       },
       //
       async onRowRemove(prop, scope) {
-        const {$index} = scope;
-        this.params[prop].splice($index, 1);
+        // const {$index} = scope;
+        // this.params[prop].splice($index, 1);
+        scope.row.delFlag = '2'
+        let delList = []
+        delList = this.params[prop].filter(item => {
+          return item.delFlag == '2'
+        })
+        this.params[prop] = this.params[prop].filter(item => {
+          return item.delFlag == '0'
+        })
+        this.delDemandItemList.push(...delList)
       },
       //
       async useSubmit(prop) {
@@ -246,12 +258,21 @@
           if (valid) {
             try {
               this.loading = true;
-              this.params.priceApplyOrgs = [];
-              const {msg, code} = await SAVE(this.params);
+              let list = []
+              list.push(...this.params.priceApplyItems, ...this.delDemandItemList)
+              this.params.priceApplyItems = this.params.priceApplyItems.filter(
+                (item) => item.materialName
+              );
+              // 深拷贝一下参数对象
+              let param = JSON.parse(JSON.stringify(this.params))
+              console.log('深拷贝对象',param);
+              param.priceApplyItems = list
+              const {msg, code} = await SAVE(param);
               if (code === 200) {
                 this.onHide();
                 this.$emit("success");
                 this.$notify.success(msg);
+                this.delDemandItemList = []
               }
             } catch (err) {
               // catch
@@ -265,6 +286,359 @@
           }
         });
       },
+      // 粘贴
+      async pasteMe(e, scope, index, prop) {
+        this.$modal.loading("正在处理数据...");
+        e.preventDefault() //阻止默认粘贴事件
+        let source = e.clipboardData.getData("Text");
+        console.log('scope', scope.column.property)
+        console.log('index', index)
+        // 首先对源头进行解析
+        let rows = source.split("\r\n"); // 拆成一个数组
+        // 数组去除空字符串
+        rows = rows.filter(item => {
+          return item && item.trim()
+        })
+        if (rows.length < 100) {
+          if(scope.column.property == 'materialCode') {
+            let rowList = []
+            let newLine = []
+            await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
+              if (res.code === 200) {
+                rowList = res.rows
+              }
+            })
+            const {
+              puOrg,
+              customer,
+              customerName,
+              supplier,
+              currency,
+              currencyCode,
+              currencyName,
+            } = this.params;
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            // console.log('kk', TableColumns)
+            // console.log('this.$init.params(TableColumns)', this.$init.params(TableColumns))
+            for (let i = 0; i<rowList.length; i++) {
+              let line = {...this.$init.params(TableColumns)}
+              console.log('line',line)
+              const {nickName: createByName} = this.$store.state.user;
+              const {ntaxrate} = await tax(rowList[i].materialRateName);
+              // task 2
+              const {
+                id: puUnit,
+                code: puUnitCode,
+                name: puUnitName,
+              } = await unit(rowList[i].unitIdName);
+              // task 3
+              const {
+                recentlyPrice = "0",
+                isApprovalFirst = "N",
+                purchasequantity,
+                recentlyPriceDate
+              } = await fetchExist({puOrg, customer, supplier, materialCode: rowList[i].code, customerName: "", priceType: line.priceType});
+              line.delFlag = '0'
+              line.materialCode = rowList[i].code
+              line.material = rowList[i].id
+              line.materialName = rowList[i].name
+              line.specification = rowList[i].specification
+              line.model = rowList[i].model
+              line.manufacturerName = rowList[i].manufacturerIdName
+              line.unit = puUnit,
+              line.unitCode = puUnitCode,
+              line.unitName = puUnitName,
+              line.puUnit  = puUnit,
+              line.puUnitCode = puUnitCode,
+              line.puUnitName = puUnitName,
+              line.recentlyPrice = recentlyPrice
+              line.isApprovalFirst = isApprovalFirst
+              line.recentlyPriceDate = recentlyPriceDate,
+              line.yPurchaseQuantity = purchasequantity,
+              line.tax = Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
+              line.createByName = createByName,
+              line.updateByName = createByName,
+              line.currency = currency
+              line.currencyCode = currencyCode
+              line.currencyName = currencyName
+              newLine.push(line)
+              console.log('临时数组', newLine)
+            }
+            // 删除指定下标
+            this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+            this.$modal.closeLoading();
+            this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
+
+          } else if(scope.column.property == 'taxPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.taxPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].taxPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } 
+
+        } else {
+          this.$modal.notifyWarning("复制长度不能超过100!");
+          this.$modal.closeLoading();
+        }
+      },
     },
     created() {
     },
@@ -344,6 +718,116 @@
                 >
                 </component>
               </template>
+              <template slot="materialCode" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="taxPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
               <template slot="customerName" slot-scope="scope">
                 <component
                   v-bind="scope.attr"

+ 5 - 2
src/views/purchase/apply/edit/columns.js

@@ -82,7 +82,7 @@ export default function useColumns() {
       attr: { is: "el-input", disabled: true, readonly: true },
     },
     {
-      item: { key: "file", title: "附件", required: true, span: 24 },
+      item: { key: "file", title: "附件", span: 24 },
       attr: { is: "el-file-upload" },
     },
     {
@@ -138,7 +138,10 @@ export default function useColumns() {
         },
         {
           item: { key: "materialCode", title: "物料编码", required: true },
-          attr: {},
+          attr: {
+            is: "el-input",
+            clearable: true,
+          },
         },
         { item: { key: "manufacturerName", title: "生产厂家" }, attr: {} },
         { item: { key: "specification", title: "规格" }, attr: {} },

+ 494 - 8
src/views/purchase/apply/edit/index.vue

@@ -3,6 +3,8 @@
   import {EXIST} from "@/api/business/purchase/catalogue";
   import {ITEM, SAVE} from "@/api/business/purchase/apply";
   import {tax, unit, currency} from "@/components/popover-select-v2/fetch";
+  // 用于回显参照框数据
+  import {getRefer} from '@/api/purchase/basic.js'
 
   const fetchExist = async (prop) => {
     try {
@@ -56,6 +58,7 @@
         tabName: tabName,
         TabColumns: TabColumns,
         TableColumns: TableColumns,
+        delDemandItemList: [],
       };
     },
     computed: {
@@ -246,13 +249,26 @@
       },
       //
       async onRowRemove(prop, scope) {
-        const {
-          row: {$index},
-        } = scope;
-        this.params[prop] = this.params[prop].map((item, index) => ({
-          ...item,
-          delFlag: index === $index ? "2" : item.delFlag,
-        }));
+        console.log('prop', prop)
+        console.log('scope', scope)
+        // const {
+        //   row: {$index},
+        // } = scope;
+        // this.params[prop] = this.params[prop].map((item, index) => ({
+        //   ...item,
+        //   delFlag: index === $index ? "2" : item.delFlag,
+        // }));
+        scope.row.delFlag = '2'
+        let delList = []
+        delList = this.params[prop].filter(item => {
+          return item.delFlag == '2'
+        })
+        this.params[prop] = this.params[prop].filter(item => {
+          return item.delFlag == '0'
+        })
+        this.delDemandItemList.push(...delList)
+        console.log('删除的数组',this.delDemandItemList)
+        console.log('this.params[prop]', this.params[prop])
       },
       //
       async useSubmit(prop) {
@@ -261,14 +277,21 @@
           if (valid) {
             try {
               this.loading = true;
+              let list = []
+              list.push(...this.params.priceApplyItems, ...this.delDemandItemList)
               this.params.priceApplyItems = this.params.priceApplyItems.filter(
                 (item) => item.materialName
               );
-              const {msg, code} = await SAVE(this.params);
+              // 深拷贝一下参数对象
+              let param = JSON.parse(JSON.stringify(this.params))
+              console.log('深拷贝对象',param);
+              param.priceApplyItems = list
+              const {msg, code} = await SAVE(param);
               if (code === 200) {
                 this.onHide();
                 this.$emit("success");
                 this.$notify.success(msg);
+                this.delDemandItemList = []
               }
             } catch (err) {
               // catch
@@ -282,6 +305,359 @@
           }
         });
       },
+      // 粘贴
+      async pasteMe(e, scope, index, prop) {
+        this.$modal.loading("正在处理数据...");
+        e.preventDefault() //阻止默认粘贴事件
+        let source = e.clipboardData.getData("Text");
+        console.log('scope', scope.column.property)
+        console.log('index', index)
+        // 首先对源头进行解析
+        let rows = source.split("\r\n"); // 拆成一个数组
+        // 数组去除空字符串
+        rows = rows.filter(item => {
+          return item && item.trim()
+        })
+        if (rows.length < 100) {
+          if(scope.column.property == 'materialCode') {
+            let rowList = []
+            let newLine = []
+            await getRefer({ type: 'MATERIAL_PARAM', materialCodeList: rows }).then(res => {
+              if (res.code === 200) {
+                rowList = res.rows
+              }
+            })
+            const {
+              puOrg,
+              customer,
+              customerName,
+              supplier,
+              currency,
+              currencyCode,
+              currencyName,
+            } = this.params;
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            // console.log('kk', TableColumns)
+            // console.log('this.$init.params(TableColumns)', this.$init.params(TableColumns))
+            for (let i = 0; i<rowList.length; i++) {
+              let line = {...this.$init.params(TableColumns)}
+              console.log('line',line)
+              const {nickName: createByName} = this.$store.state.user;
+              const {ntaxrate} = await tax(rowList[i].materialRateName);
+              // task 2
+              const {
+                id: puUnit,
+                code: puUnitCode,
+                name: puUnitName,
+              } = await unit(rowList[i].unitIdName);
+              // task 3
+              const {
+                recentlyPrice = "0",
+                isApprovalFirst = "N",
+                purchasequantity,
+                recentlyPriceDate
+              } = await fetchExist({puOrg, customer, supplier, materialCode: rowList[i].code, customerName: "", priceType: line.priceType});
+              line.delFlag = '0'
+              line.materialCode = rowList[i].code
+              line.material = rowList[i].id
+              line.materialName = rowList[i].name
+              line.specification = rowList[i].specification
+              line.model = rowList[i].model
+              line.manufacturerName = rowList[i].manufacturerIdName
+              line.unit = puUnit,
+              line.unitCode = puUnitCode,
+              line.unitName = puUnitName,
+              line.puUnit  = puUnit,
+              line.puUnitCode = puUnitCode,
+              line.puUnitName = puUnitName,
+              line.recentlyPrice = recentlyPrice
+              line.isApprovalFirst = isApprovalFirst
+              line.recentlyPriceDate = recentlyPriceDate,
+              line.yPurchaseQuantity = purchasequantity,
+              line.tax = Number(ntaxrate === "0E-8" ? 0 : ntaxrate),
+              line.createByName = createByName,
+              line.updateByName = createByName,
+              line.currency = currency
+              line.currencyCode = currencyCode
+              line.currencyName = currencyName
+              newLine.push(line)
+              console.log('临时数组', newLine)
+            }
+            // 删除指定下标
+            this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+            this.$modal.closeLoading();
+            this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
+
+          } else if(scope.column.property == 'taxPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.taxPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].taxPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice1') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice1 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice1 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'supplierName2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.supplierName2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].supplierName2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'bidPrice2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.bidPrice2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].bidPrice2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } else if(scope.column.property == 'unitPrice2') {
+            console.log('复制内容:', rows)
+            let newLine = []
+            const {TabColumns} = this;
+            const {TableColumns} = TabColumns.find(
+              ({item: {key}}) => key === prop
+            );
+            if(this.params[prop].length <= 1) {
+              for (let i = 0; i<rows.length; i++) {
+                let line = {...this.$init.params(TableColumns)}
+                line.unitPrice2 = rows[i]
+                newLine.push(line)
+              }
+              // 删除指定下标
+              this.params[prop].splice(index,this.params[prop].length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rows.length + '条数据');
+              // this.$refs.table.doLayout()
+              this.$modal.closeLoading();
+            } else {
+              for(let i = index , j = 0; i < this.params[prop].length; i++, j++) {
+                this.params[prop][i].unitPrice2 = rows[j]
+              }
+              // this.$refs.table.doLayout()
+              console.log(this.params[prop])
+              this.$modal.closeLoading();
+            }
+          } 
+
+        } else {
+          this.$modal.notifyWarning("复制长度不能超过100!");
+          this.$modal.closeLoading();
+        }
+      },
     },
     created() {
     },
@@ -361,6 +737,116 @@
                 >
                 </component>
               </template>
+              <template slot="materialCode" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="taxPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice1" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="supplierName2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="bidPrice2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
+              <template slot="unitPrice2" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @paste.native="pasteMe($event, scope, scope.rowIndex, tabName)"
+                >
+                </component>
+              </template>
               <template slot="customerName" slot-scope="scope">
                 <component
                   v-bind="scope.attr"

+ 4 - 4
src/views/purchase/purchase-order/edit/initColumn.js

@@ -66,13 +66,13 @@ export const forbidden = (isEdit,source) => {
   else{  
 
     console.log('修订');
-    // 修订
+    // 修订 || item.key === 'warehouseName'|| item.key === 'goodsAllocationName'
     updateColumns.forEach(item => {
 
       if (item.key == 'buyerName' || item.key == 'puDeptName'
-      || item.key === 'goodsAllocationName' || item.key === 'goodsWarehouseName' 
-      || item.key === 'warehouseName' || item.key == 'deductionMoney' 
-      || item.key == 'rebateMoney' ||item.key == 'remark' ) {
+       || item.key === 'goodsWarehouseName' 
+       || item.key == 'deductionMoney' 
+       || item.key == 'rebateMoney' ||item.key == 'remark' ) {
         item.disabled = false;
         item.readonly = false;
       } else {