Bläddra i källkod

待排产列表-批量转采购

damon227 10 månader sedan
förälder
incheckning
1f235dc56d

+ 38 - 6
src/views/modules/production/scheduling.vue

@@ -1,7 +1,7 @@
 <!-- 任务处理中心 -->
 <template>
   <div class="production">
-    <template v-if="!detailsVisible && !outsourceVisible && !checkVisible && !preCheckVisible && !purchaseVisible && !printLabelVisible">
+    <template v-if="!detailsVisible && !outsourceVisible && !checkVisible && !preCheckVisible && !purchaseVisible && !printLabelVisible && !addOrUpdateVisible">
       <el-header style="font-size: large;text-align: center">任务处理中心</el-header>
       <el-form>
         <el-form-item>
@@ -210,6 +210,8 @@
     <crafts-detail v-if="craftsVisible" ref="craftsDetail"/>
     <!-- 打印标签 -->
     <print-label v-if="printLabelVisible" ref="printLabel" @onChose="onChose" @addOne="addOneClick"/>
+    <!-- 弹窗, 新增 / 修改 -->
+    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :options-type="optionsType" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
   </div>
 </template>
 
@@ -223,8 +225,10 @@
   import SchedulingPurchase from '@/views/modules/production/scheduling-purchase'
   import SchedulingCommission from '@/views/modules/production/scheduling-commission'
   import CraftsDetail from '@/views/modules/tech/crafts-detail-dialog'
-import {downloadUrl} from '@/api/file'
+  import {downloadUrl} from '@/api/file'
   import PrintLabel from '@/views/modules/production/components/print-label.vue'
+  import AddOrUpdate from '@/views/modules/sale/purchase-add-or-update'
+  import { getDictList } from '@/api/dict'
 export default {
     name: 'scheduling',
     components: {
@@ -235,7 +239,8 @@ export default {
       PurchaseAddOrUpdate,
       SchedulingPreCheck,
       SchedulingCheck,
-      Detail
+      Detail,
+      AddOrUpdate
       // Outsource
     },
     data () {
@@ -247,6 +252,7 @@ export default {
         purchaseVisible: false,
         craftsVisible: false,
         printLabelVisible: false,
+        addOrUpdateVisible: false,
         dataForm: {},
         dataList: [],
         pageIndex: 1,
@@ -303,10 +309,12 @@ export default {
         multipleSelection: [],
         selectedRows:[],
         batchIncomeBtnDisabled: false,
-        batchBtnDisabled: false
+        batchBtnDisabled: false,
+        optionsType: [],
       }
     },
     created () {
+      this.getTypeList()
       this.getDataList()
     },
     methods: {
@@ -321,6 +329,15 @@ export default {
         this.selectedRows = []
         this.batchIncomeBtnDisabled = false
         this.batchBtnDisabled = false
+        this.addOrUpdateVisible = false
+      },
+       // 获取采购类别字典
+      getTypeList () {
+        getDictList({type: 'purchase_type'}).then(({data}) => {
+          if (data) {
+            this.optionsType = data
+          }
+        })
       },
       // 查询
       queryPage () {
@@ -502,9 +519,24 @@ export default {
            return
         }
 
-        this.purchaseVisible = true
+        let list = []
+        this.selectedRows.forEach(item => {
+          list.push({
+            detailId:Math.round(Math.random() * 1000000),
+            materialName: item.materialName,
+            specification:item.productSpec,
+            purchaseType: '',
+            cnt:item.cnt,
+            unitName:'',
+            deadline:'',
+            batchNumber:item.batchNumber,
+            notes:''
+          })
+        })
+
+        this.addOrUpdateVisible = true
         this.$nextTick(() => {
-          this.$refs.purchase.init(this.selectedRows)
+          this.$refs.addOrUpdate.init(0, null, null, list)
         })
       },
       //批量转委外

+ 6 - 1
src/views/modules/sale/purchase-add-or-update.vue

@@ -182,11 +182,14 @@
       onChose () {
         this.$emit('onChose')
       },
-      async init (id, scheduleIds, tableId) {
+      async init (id, scheduleIds, tableId, materialDetails) {
         if (scheduleIds) {
           this.prodProductionIds = scheduleIds
         }
         this.materialDetails = []
+        if(materialDetails){
+          this.materialDetails = materialDetails
+        }
         this.dataForm = {
           payType: '0'
         }
@@ -290,6 +293,7 @@
         // this.calTotal()
       },
       addMaterialCallback (data) {
+        console.log("1111",data)
         if (!data) return
         this.addMaterialVisible = false
         let i = this.materialDetails.findIndex((item) => item.detailId === data.detailId)
@@ -297,6 +301,7 @@
           this.materialDetails.splice(i, 1)
         }
         this.materialDetails.push(data)
+        console.log("222",this.materialDetails)
         // this.calTotal()
       },
       // 百分比