Răsfoiți Sursa

采购需求单修改清空预留周期

黄梓星 1 an în urmă
părinte
comite
9dc98e0b50
1 a modificat fișierele cu 159 adăugiri și 10 ștergeri
  1. 159 10
      src/views/purchase/PurchaseDemandList/add.vue

+ 159 - 10
src/views/purchase/PurchaseDemandList/add.vue

@@ -246,7 +246,7 @@
             <el-table-column show-overflow-tooltip label="预留比例" align="center" prop="reservedProportion" width="150px">
               <template slot-scope="scope">
                 <el-form-item class="hang">
-                  <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @change="getYLSL(scope)" @clear="scope.row.reservedQty = ''">
+                  <el-select clearable :disabled="sonDisable" size="mini" v-model="scope.row.reservedProportion" @change="getYLSL(scope)" @clear="cleanYLSL(scope)">
                     <el-option v-for=" dict in dict.type.sys_reserve_ratio" :key="dict.value" :label="dict.label" :value="dict.value">
                     </el-option>
                   </el-select>
@@ -738,6 +738,11 @@ export default {
       //   this.isYl = false
       // }
     },
+    // 清空
+    cleanYLSL(scope) {
+      scope.row.reservedQty = ''
+      scope.row.reservedPeriod = ''
+    },
     copy() {
       this.$modal.msgSuccess("复制成功");
       this.sonPageStu = 'add'
@@ -1178,23 +1183,167 @@ export default {
       }
     },
     // 粘贴来的数据
-    pasteMe(e, scope, index) {
+    async pasteMe(e, scope, index) {
       e.preventDefault() //阻止默认粘贴事件
       let source = e.clipboardData.getData("Text");
       console.log('scope', scope.column.property)
       console.log('eee:', source)
       // 首先对源头进行解析
       let rows = source.split("\r\n"); // 拆成一个数组
-      // rows.pop()
+      // 数组去除空字符串
+      rows = rows.filter(item => {
+        return item && item.trim()
+      })
       console.log('复制的数组',rows);
       console.log('列表的数组',this.basicForm.puDemandItemList)
-      rows.forEach(item => {
-        console.log('items',item)
-        // getRefer({ type: 'MATERIAL_PARAM', code: item }).then(res => {
-
-        // })
-        this.basicForm.puDemandItemList.push(this.basicForm.puDemandItemList[scope.$index])
-      })
+      let linArr = []
+      for (let i = 0; i<rows.length; i++) {
+        console.log('items',rows[i])
+        await getRefer({ type: 'MATERIAL_PARAM', code: rows[i] }).then(res => {
+          if (res.code === 200) {
+            let line = {
+              contacts: null,
+              id: null,
+              demandId: null,
+              status: null,
+              businessDept: null,
+              businessDeptName: null,
+              materialCategory: null,
+              buyer: null,
+              buyerName: null,
+              mateiralClassifyOne: null,
+              materialClassifyOneName: null,
+              materialClassifyTwo: null,
+              materialClassifyTwoName: null,
+              materialClassifyThree: null,
+              materialClassifyThreeName: null,
+              materialClassifyFour: null,
+              materialClassifyFourName: null,
+              materialCode: null,
+              material: null,
+              materialName: null,
+              classifyId: null,
+              specification: null,
+              unit: null,
+              unitName: null,
+              manufacturerName: null,
+              registrant: null,
+              puPeriod: null,
+              expiryUnit: null,
+              expiry: null,
+              minPackage: null,
+              minOrderQty: null,
+              minBatch: null,
+              safeStock: null,
+              averageQtyMonth: null,
+              qty: null,
+              adjustmentPersonal: null,
+              adjustmentTime: null,
+              manualRegulation: null,
+              updateCause: null,
+              reservedProportion: null,
+              reservedPeriod: null,
+              reservedQty: null,
+              demandPeriod: null,
+              forecastClassify: null,
+              onemonthAvgVolume: null,
+              threemonthAvgVolume: null,
+              deliveryDate: null,
+              isUrgency: this.basicForm.billType == 'JJXQ' ? 'Y' : 'N',
+              isReplenishment: this.basicForm.billType == 'BDXQ' ? 'Y' : 'N',
+              isBatchLock: 'N',
+              remark: null,
+              puRemark: null,
+              lastWarehouseQty: null,
+              resDemandQty: null,
+              lastWarehouse: null,
+              lastWarehouseName: null,
+              deliveryWarehouse: null,
+              deliveryWarehouseName: null,
+              lastAllocation: null,
+              lastAllocationName: null,
+              deliveryAllocation: null,
+              deliveryAllocationName: null,
+              passageOn: null,
+              puOrg: null,
+              purOrgName: null,
+              lastStockQty: null,
+              superiorCenterQty: null,
+              superiorAllotQty: null,
+              availableQty: null,
+              statusAllot: 'N',
+              additionalSupplier: null,
+              additionalSupplierName: null,
+              periodUnit: null,
+              demandCustomer: this.basicForm.customer,
+              demandCustomerName: this.basicForm.customerName,
+              businessDept: this.basicForm.demandDept,
+              businessDeptName: null,
+              lastStockOrg: null,
+              lastStockOrgName: null,
+              superiorStockOrg: null,
+              superiorStockOrgName: null,
+              allotCode: null,
+              deliveryAddress: null,
+              deliveryAddressName: null,
+              contacts: null,
+              contactsPhone: null,
+              address: null,
+              source: null,
+              priceType: 'order',
+              puManagerApprover: null,
+              puManagerApproverName: null,
+              processTime: null,
+              affirmer: null,
+              tenantId: null,
+              revision: null,
+              createBy: null,
+              createByName: null,
+              createTime: null,
+              updateBy: null,
+              updateByName: null,
+              updateTime: null,
+              delFlag: 0,
+              // 新增字段
+              model: null,
+              storageCondition: null,
+              transportationCondition: null,
+            }
+            line.businessDept = res.rows[0].businessDepartment
+            line.businessDeptName = res.rows[0].businessDepartmentName
+            line.materialCode = res.rows[0].code
+            line.material = res.rows[0].id
+            line.materialName = res.rows[0].name
+            line.classifyId = res.rows[0].classifyId
+            line.materialClassifyOneName = res.rows[0].oneClass
+            line.materialClassifyTwoName = res.rows[0].twoClass
+            line.materialClassifyThreeName = res.rows[0].threeClass
+            line.materialClassifyFourName = res.rows[0].fourClass
+            line.specification = res.rows[0].specification
+            line.model = res.rows[0].model
+            line.unit = res.rows[0].unitId
+            line.unitName = res.rows[0].unitIdName
+            line.registrant = res.rows[0].registrant
+            line.manufacturerName = res.rows[0].manufacturerIdName
+            line.puPeriod = res.rows[0].deliveryPeriod
+            line.expiry = res.rows[0].usefulLife
+            line.expiryUnit = res.rows[0].expiryUnitIdName
+            // line.minPackage = res.rows[0].usefulLife
+            line.minPackage = res.rows[0].minPackQty
+            line.minOrderQty = res.rows[0].minOrderQty
+            line.minBatch = res.rows[0].minBatchQty
+            line.safeStock = res.rows[0].safeStock
+            line.purOrgName = res.rows[0].purchasingOrganizationName
+            line.puOrg = res.rows[0].purchasingOrganization
+            // 物料存储条件和运输条件
+            line.transportationCondition = res.rows[0].transportationCondition
+            line.storageCondition = res.rows[0].storageCondition
+            linArr[i] = line
+          }
+        })
+        console.log('临时数组', linArr)
+      }
+      this.basicForm.puDemandItemList.push(...linArr)
       console.log('列表', this.basicForm.puDemandItemList)
       // this.basicForm.puDemandItemList.forEach(e => {
       //   rows.forEach(d => {