chris 1 жил өмнө
parent
commit
800a60942c

+ 22 - 8
src/views/modules/production/scheduling.vue

@@ -1,7 +1,7 @@
 <!-- 任务处理中心 -->
 <template>
   <div class="production">
-    <template v-if="!detailsVisible && !outsourceVisible && !checkVisible && !preCheckVisible">
+    <template v-if="!detailsVisible && !outsourceVisible && !checkVisible && !preCheckVisible && !purchaseVisible">
       <el-header style="font-size: large;text-align: center">任务处理中心</el-header>
       <el-table
         :data="dataList"
@@ -128,8 +128,8 @@
           label="操作">
           <template slot-scope="scope">
             <el-button type="text" size="small" @click="check(scope.row)">核料</el-button>
-            <el-button type="text" size="small" @click="check(scope.row.id)">转采购</el-button>
-            <el-button type="text" size="small" @click="outsourceHandle(scope.row.id)">转委外</el-button>
+            <el-button type="text" size="small" @click="purchaseHandle(scope.row)">转采购</el-button>
+            <el-button type="text" size="small" @click="outsourceHandle(scope.row)">转委外</el-button>
             <el-button type="text" size="small" @click="preCheck(scope.row.id)">试制前检查</el-button>
             <el-button v-if="isAuth('prod:production:plan')" type="text" size="small" @click="detail(scope.row.id, true)">排产</el-button>
 <!--            <el-button v-if="isAuth('pur:commDetail:save') && Number(scope.row.outsourcing) === 0" type="text" size="small" @click="outsourceHandle(scope.row.id)">委外生产</el-button>-->
@@ -150,6 +150,8 @@
     <detail v-if="detailsVisible" ref="details" @close="closeDialogEvent" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 委外 -->
     <outsource v-if="outsourceVisible" ref="outsource" @refreshDataList="getDataList" @onChose="onChose"/>
+    <!-- 采购 -->
+    <purchase-add-or-update v-if="purchaseVisible" ref="purchase" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 核料 -->
     <scheduling-check v-if="checkVisible" ref="check" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 试制前检查 -->
@@ -159,19 +161,21 @@
 
 <script>
   import Detail from './scheduling-details'
-  import Outsource from './scheduling-outsource'
+  import Outsource from '@/views/modules/sale/outsource-add-or-update'
   import { getSchedulingList } from '@/api/production'
   import SchedulingCheck from '@/views/modules/production/scheduling-check'
   import SchedulingPreCheck from '@/views/modules/production/scheduling-pre-check'
+  import PurchaseAddOrUpdate from '@/views/modules/sale/purchase-add-or-update'
   export default {
     name: 'scheduling',
-    components: {SchedulingPreCheck, SchedulingCheck, Detail, Outsource},
+    components: {PurchaseAddOrUpdate, SchedulingPreCheck, SchedulingCheck, Detail, Outsource},
     data () {
       return {
         detailsVisible: false,
         outsourceVisible: false,
         checkVisible: false,
         preCheckVisible: false,
+        purchaseVisible: false,
         dataForm: {},
         dataList: [],
         pageIndex: 1,
@@ -241,6 +245,7 @@
         this.outsourceVisible = false
         this.checkVisible = false
         this.preCheckVisible = false
+        this.purchaseVisible = false
       },
       // 查询
       queryPage () {
@@ -315,12 +320,21 @@
         this.detailsVisible = false
       },
       // 委外生产
-      outsourceHandle (id) {
+      outsourceHandle (row) {
         this.outsourceVisible = true
         let ids = []
-        ids.push(id)
+        ids.push(row.productId)
         this.$nextTick(() => {
-          this.$refs.outsource.init(id, ids)
+          this.$refs.outsource.init(null, ids, row.id)
+        })
+      },
+      // 采购
+      purchaseHandle (row) {
+        this.purchaseVisible = true
+        let ids = []
+        ids.push(row.productId)
+        this.$nextTick(() => {
+          this.$refs.purchase.init(null, row.id)
         })
       },
       // 核料

+ 10 - 4
src/views/modules/sale/outsource-add-or-update.vue

@@ -242,7 +242,7 @@ export default {
       onChose () {
         this.$emit('onChose')
       },
-      async init (id, prodProductionIds) {
+      async init (id, prodProductionIds, tableId) {
         if (prodProductionIds) {
           this.prodProductionIds = prodProductionIds
         }
@@ -251,10 +251,17 @@ export default {
           payType: '1'
         }
         this.id = id || 0
+        if (tableId) {
+          this.dataForm.tableId = tableId
+          this.dataForm.type = 1
+        } else {
+          // 来源:0:自己/1:排产
+          this.dataForm.type = 0
+        }
         // 获取委外类别列表
         this.getType()
         // 详情
-        if (!id) return
+        if (!id && !tableId) return
         if (this.prodProductionIds.length > 0) {
           await getOutsourceDetailByScheduleId({'prodProductionIds': this.prodProductionIds}).then(({data}) => {
             if (data && data.code === '200' && data.data) {
@@ -311,8 +318,7 @@ export default {
                 ...this.dataForm,
                 purCommissionDetails: this.productDetails,
                 applierId: this.$store.state.user.id,
-                orgId: this.$store.state.user.orgId,
-                type: 0
+                orgId: this.$store.state.user.orgId
               })
             }).then(({data}) => {
               if (data && data.code === '200') {

+ 18 - 2
src/views/modules/sale/purchase-add-or-update.vue

@@ -145,6 +145,7 @@
   import { getPurchaseDetail } from '@/api/sale'
   import { dealStepData, dealStepLogs } from '@/api/util'
   import UserComponent from '../common/user-component'
+  import {getDictList} from '@/api/dict'
   export default {
     name: 'purchase-add-or-update',
     props: {
@@ -178,13 +179,20 @@
       onChose () {
         this.$emit('onChose')
       },
-      async init (id) {
+      async init (id, tableId) {
         this.materialDetails = []
         this.dataForm = {
           payType: '0'
         }
         this.visible = true
         this.id = id || 0
+        if (tableId) {
+          this.dataForm.tableId = tableId
+          this.dataForm.type = 1
+        } else {
+          // 来源:0:自己/1:排产
+          this.dataForm.type = 0
+        }
         // 获取采购类别字典
         if (!id) {
           this.getTypeList()
@@ -219,7 +227,7 @@
           if (valid) {
             // 添加采购物品明细
             this.dataForm.purchaseDetails = this.materialDetails
-            this.dataForm.type = 0
+            this.dataForm.type = 0  // 来源:0:自己/1:排产
             this.$http({
               url: this.$http.adornUrl(`/biz-service/purchaseDetail/${!this.id ? 'save' : 'update'}`),
               method: 'post',
@@ -280,6 +288,14 @@
         if (!row.purchaseType || !this.optionsType) return ''
         const item1 = this.optionsType.find((item) => item.code === row.purchaseType.toString())
         return item1 ? item1.value : ''
+      },
+      // 获取采购类别字典
+      getTypeList () {
+        getDictList({type: 'purchase_type'}).then(({data}) => {
+          if (data) {
+            this.optionsType = data
+          }
+        })
       }
     }
   }