Browse Source

计划单

zhouhao 2 years ago
parent
commit
a4fb67973b
1 changed files with 46 additions and 7 deletions
  1. 46 7
      src/views/supply/engin/components/home_form.vue

+ 46 - 7
src/views/supply/engin/components/home_form.vue

@@ -213,6 +213,15 @@
             />
           </el-form-item>
         </el-col>
+        <el-col :span="24" :sm="12" :lg="8">
+          <el-form-item label="计划单" prop="isPlanOrder">
+            <el-radio-group v-model="mainForm.isPlanOrder">
+              <el-radio :label="true">是</el-radio>
+              <el-radio :label="false">否</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+
         <el-col v-if="mainForm.examineRemark" :xs="24" :sm="24" :lg="24">
           <el-form-item label="审批说明" prop="examineRemark">
             <el-input v-model="mainForm.examineRemark" placeholder="请输入审批说明" disabled />
@@ -224,7 +233,9 @@
     <div class="main-title">
       <div class="title">货品信息</div>
       <div>
-        <el-select v-model="warehouseValue" placeholder="请选择发货仓库" size="small" style="margin-right: 10px">
+        <el-select v-model="warehouseValue" placeholder="请选择发货仓库" @change="handleWarehouseValue"
+                   size="small" style="margin-right: 10px"
+        >
           <el-option v-for="(item, index) in warehouseList" :key="index" :label="item.name" :value="item.id" />
         </el-select>
         <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
@@ -409,6 +420,7 @@
           </template>
         </el-table-column> -->
         <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
+        <el-table-column align="left" label="仓库" prop="correspondName" min-width="150" show-overflow-tooltip />
 
         <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
           <template slot-scope="scope">
@@ -785,7 +797,8 @@ export default {
         examineStatus: '',
         refBuyUnitName: '',
         refPromiseProvide: '',
-        refOtherAnnexIdea: ''
+        refOtherAnnexIdea: '',
+        isPlanOrder: true
       },
       mainFormRules: {
         // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
@@ -805,7 +818,8 @@ export default {
       // typeList: [],
       stockList: [],
       goodsList: [],
-
+      correspondName: '',
+      correspondId: '',
       isShowDialog: false, // 工程登录列表 - 弹窗
       screenForm: {
         loginNum: '',
@@ -884,6 +898,10 @@ export default {
       handler(newValue, oldValue) {
         if (newValue && newValue.length) {
           newValue.forEach((item, index) => {
+            if (this.correspondId) {
+              this.goodsList[index].correspondName = this.correspondName
+              this.goodsList[index].correspondId = this.correspondId
+            }
             this.goodsList[index].compute_sfAmount =
               (item.price * item.qty * 100 -
                 ((item.price * item.qty * (item.rebateRate * 100)) / 100) * 100 -
@@ -1010,7 +1028,7 @@ export default {
         projectName: this.screenForm.enginName,
         useUnit: this.screenForm.company,
         refEnginRecordNo: this.mainForm.loginNum,
-        examineStatus: 'OK',
+        examineStatus: 'OK'
       }).then(res => {
         this.dialogTable_dataList = res.data.records
         this.dialogTable_listTotal = res.data.total
@@ -1150,7 +1168,19 @@ export default {
         this.goodsList[index].serviceName = ''
       }
     },
-
+    handleWarehouseValue(e) {
+      this.correspondName = this.warehouseList.find(k => {
+        return k.id === e
+      }).name
+      this.correspondId = e
+      if (!this.goodsList.length) return
+
+      this.goodsList.forEach(k => {
+        this.$set(k, 'correspondName', this.correspondName)
+        this.$set(k, 'correspondId', this.correspondId)
+      })
+      console.log(this.goodsList)
+    },
     // 获取详情
     getDetail() {
       getOrderDetail({ id: this.editId }).then(res => {
@@ -1189,8 +1219,11 @@ export default {
         this.mainForm.examineStatus = data.examineStatus
         this.mainForm.refBuyUnitName = data.refBuyUnitName
         this.mainForm.refPromiseProvide = data.refPromiseProvide
-
+        this.correspondName = data.correspondName
+        this.warehouseValue = data.correspondId
         data.items.forEach(item => {
+          item.correspondName = data.correspondName
+          item.warehouseValue = data.correspondId
           item.status1 = ''
           item.status2 = ''
           item.rebateWallets = item.customerWalletList.filter(item => {
@@ -1473,7 +1506,10 @@ export default {
               return
             }
           }
-
+          if (!this.mainForm.isPlanOrder && !this.correspondId) {
+            this.$errorMsg(`仓库必选`)
+            return
+          }
           const goodsList = JSON.parse(JSON.stringify(this.goodsList))
 
           goodsList.forEach(item => {
@@ -1486,6 +1522,9 @@ export default {
             ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan)
             : ''
           const params = {
+            isPlanOrder: this.mainForm.isPlanOrder,
+            correspondName: this.correspondName,
+            correspondId: this.correspondId,
             enginOrderId: this.mainForm.orderNum,
             loginUserId: this.mainForm.loginUserId,
             refEnginRecordNo: this.mainForm.loginNum || '',