黄梓星 1 рік тому
батько
коміт
1ba4eecc21
1 змінених файлів з 31 додано та 6 видалено
  1. 31 6
      src/views/purchase/PurchaseDemandList/add.vue

+ 31 - 6
src/views/purchase/PurchaseDemandList/add.vue

@@ -327,7 +327,7 @@
           <el-table-column show-overflow-tooltip label="补单供应商" align="center"  prop="additionalSupplierName" width="200px" :render-header="anotherRedStar">
             <template slot-scope="scope">
               <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'additionalSupplierName'" :rules="{ required: isBDXQ, message: '请选择补单供应商', trigger: 'blur' }">
-                <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.$index, '选择补单供应商')" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
+                <el-input clearable :disabled="sonDisable || BDZT" size="mini" v-model="scope.row.additionalSupplierName" @clear="clearHang(scope.$index, '选择补单供应商')" @paste.native="pasteMe($event, scope, scope.$index)">
                   <el-button size="mini" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
                 </el-input>
               </el-form-item>
@@ -1285,14 +1285,39 @@ export default {
             this.$refs.table.doLayout()
             this.$modal.closeLoading();
           } else {
-            this.basicForm.puDemandItemList.forEach(item => {
-              for (let i = 0; i<rows.length; i++) {
-                item.qty = rows[i]
-              }
-            })
+            for(let i = index , j = 0; i < this.basicForm.puDemandItemList.length; i++, j++) {
+              this.basicForm.puDemandItemList[i].qty = rows[j]
+            }
             this.$refs.table.doLayout()
             this.$modal.closeLoading();
           }
+
+        }else if(scope.column.property == 'additionalSupplierName') {
+          await getRefer({ type: 'SUPPLIER_PARAM', searchList: rows }).then(res => {
+            this.$modal.closeLoading();
+            if (res.code === 200) {
+              let rowList = res.rows
+              let newLine = []
+              for (let i = 0; i<rowList.length; i++) {
+                let line = {...this.sonModel}
+                line.isUrgency = (this.basicForm.billType == 'JJXQ' ? 'Y' : 'N')
+                line.isReplenishment = (this.basicForm.billType == 'BDXQ' ? 'Y' : 'N')
+                line.demandCustomer = this.basicForm.customer
+                line.demandCustomerName = this.basicForm.customerName
+                line.additionalSupplier = rowList[i].id
+                line.additionalSupplierName = rowList[i].name
+                newLine.push(line)
+                console.log('临时数组', newLine)
+              }
+              // 删除指定下标
+              this.basicForm.puDemandItemList.splice(index,this.basicForm.puDemandItemList.length - index,...newLine)
+              this.$modal.notifySuccess("共粘贴" + rowList.length + '条数据');
+            }
+          }).then(() => {
+            this.$refs.table.doLayout()
+          }).catch(err => {
+            this.$modal.closeLoading();
+          })
         }