Browse Source

任务单转采购、转委外

chrislee 2 years ago
parent
commit
97916779ae

+ 18 - 0
src/api/production.js

@@ -26,6 +26,24 @@ export function batchPlan (data) {
   })
 }
 
+// 采购
+export function purchase (data) {
+  return request({
+    url: request.adornUrl(`/biz-service/ProdProduction/purchase`),
+    method: 'post',
+    data
+  })
+}
+
+// 委外
+export function commission (data) {
+  return request({
+    url: request.adornUrl(`/biz-service/ProdProduction/commission`),
+    method: 'post',
+    data
+  })
+}
+
 // 获取生产监控列表信息
 export function getMonitoringList (params) {
   return request({

+ 128 - 0
src/views/modules/production/scheduling-commission.vue

@@ -0,0 +1,128 @@
+<!-- 委外 -->
+<template>
+    <div>
+        <div class="my-title">委外</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-col :span="8">
+              <el-form-item label="类别" prop="commissionType">
+                <el-select
+                  v-model="dataForm.commissionType"
+                  remote
+                  placeholder="请选择">
+                  <el-option
+                    v-for="item in optionsType"
+                    :key="item.code"
+                    :label="item.value"
+                    :value="item.code">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="16">
+              <el-form-item label="要求说明" prop="specificationExplian">
+                <el-input v-model="dataForm.specificationExplian" placeholder="要求说明"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row class="my-row">
+            <el-col :span="8">
+              <el-form-item label="委外数量" prop="cnt">
+                <el-input-number v-model="dataForm.cnt" :step="1" :min="0"></el-input-number>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="单位" prop="unitName">
+                <el-input v-model="dataForm.unitName" placeholder="单位单位"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row class="my-row">
+            <el-col :span="16">
+              <el-form-item label="备注" prop="notes">
+                <el-input type="textarea" v-model="dataForm.notes"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="onChose">取消</el-button>
+          <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+        </span>
+    </div>
+</template>
+
+<script>
+import {commission} from '@/api/production'
+import MaterialComponent from '@/views/modules/common/material-component'
+import {getDictList} from '@/api/dict'
+
+export default {
+  name: 'scheduling-commission',
+  components: {
+    MaterialComponent
+  },
+  data () {
+    return {
+      id: 0,
+      dataForm: {},
+      optionsType: [], // 类别
+      dataRule: {
+        cnt: [{ required: true, message: '请输入数量', trigger: 'change' }],
+        unitName: [{ required: true, message: '请输入单位', trigger: 'blur' }],
+        commissionType: [{ required: true, message: '请选择类别', trigger: 'change' }],
+        specificationExplian: [{ required: true, message: '请输入要求说明', trigger: 'blur' }]
+      }
+    }
+  },
+  created () {
+    this.getType()
+  },
+  methods: {
+    onChose () {
+      this.$emit('onChose')
+    },
+    async init (row) {
+      this.dataForm.id = row.id
+    },
+    validateField (type) {
+      this.$refs.dataForm.validateField(type)
+    },
+      // 表单提交
+    dataFormSubmit () {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          commission(this.dataForm).then(({data}) => {
+            if (data && data.code === '200') {
+              this.$message({
+                message: '操作成功',
+                type: 'success',
+                duration: 1500,
+                onClose: () => {
+                  this.onChose()
+                  this.$emit('refreshDataList')
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+        }
+      })
+    },
+    // 获取类别
+    getType () {
+      getDictList({type: 'commission_type'}).then(({data}) => {
+        if (data) {
+          this.optionsType = data
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 91 - 0
src/views/modules/production/scheduling-purchase.vue

@@ -0,0 +1,91 @@
+<!-- 采购 -->
+<template>
+    <div>
+        <div class="my-title">采购</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-col :span="8">
+              <el-form-item label="采购数量" prop="cnt">
+                <el-input-number v-model="dataForm.cnt" :step="1" :min="0"></el-input-number>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="单位" prop="unitName">
+                <el-input v-model="dataForm.unitName" placeholder="单位单位"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row class="my-row">
+            <el-col :span="16">
+              <el-form-item label="备注" prop="notes">
+                <el-input type="textarea" v-model="dataForm.notes"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="onChose">取消</el-button>
+          <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+        </span>
+    </div>
+</template>
+
+<script>
+import {purchase} from '@/api/production'
+import MaterialComponent from '@/views/modules/common/material-component'
+
+export default {
+  name: 'scheduling-purchase',
+  components: {
+    MaterialComponent
+  },
+  data () {
+    return {
+      id: 0,
+      dataForm: {},
+      dataRule: {
+        cnt: [{ required: true, message: '请输入数量', trigger: 'change' }],
+        unitName: [{ required: true, message: '请输入单位', trigger: 'blur' }]
+      }
+    }
+  },
+  methods: {
+    onChose () {
+      this.$emit('onChose')
+    },
+    async init (row) {
+      this.dataForm.id = row.id
+    },
+    validateField (type) {
+      this.$refs.dataForm.validateField(type)
+    },
+      // 表单提交
+    dataFormSubmit () {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          purchase(this.dataForm).then(({data}) => {
+            if (data && data.code === '200') {
+              this.$message({
+                message: '操作成功',
+                type: 'success',
+                duration: 1500,
+                onClose: () => {
+                  this.onChose()
+                  this.$emit('refreshDataList')
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 15 - 10
src/views/modules/production/scheduling.vue

@@ -149,9 +149,9 @@
     <!-- 弹窗, 新增 / 修改 -->
     <detail v-if="detailsVisible" ref="details" @close="closeDialogEvent" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 委外 -->
-    <outsource v-if="outsourceVisible" ref="outsource" @refreshDataList="getDataList" @onChose="onChose"/>
+    <scheduling-commission v-if="outsourceVisible" ref="outsource" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 采购 -->
-    <purchase-add-or-update v-if="purchaseVisible" ref="purchase" @refreshDataList="getDataList" @onChose="onChose"/>
+    <scheduling-purchase v-if="purchaseVisible" ref="purchase" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 核料 -->
     <scheduling-check v-if="checkVisible" ref="check" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 试制前检查 -->
@@ -166,9 +166,18 @@
   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 {
+  import SchedulingPurchase from '@/views/modules/production/scheduling-purchase'
+  import SchedulingCommission from '@/views/modules/production/scheduling-commission'
+export default {
     name: 'scheduling',
-    components: {PurchaseAddOrUpdate, SchedulingPreCheck, SchedulingCheck, Detail, Outsource},
+    components: {
+      SchedulingCommission,
+      SchedulingPurchase,
+      PurchaseAddOrUpdate,
+      SchedulingPreCheck,
+      SchedulingCheck,
+      Detail,
+      Outsource},
     data () {
       return {
         detailsVisible: false,
@@ -322,19 +331,15 @@
       // 委外生产
       outsourceHandle (row) {
         this.outsourceVisible = true
-        let ids = []
-        ids.push(row.id)
         this.$nextTick(() => {
-          this.$refs.outsource.init(null, ids, row.id)
+          this.$refs.outsource.init(row)
         })
       },
       // 采购
       purchaseHandle (row) {
         this.purchaseVisible = true
-        let ids = []
-        ids.push(row.id)
         this.$nextTick(() => {
-          this.$refs.purchase.init(null, ids, row.id)
+          this.$refs.purchase.init(row)
         })
       },
       // 核料