chris 3 tahun lalu
induk
melakukan
f948926932

+ 10 - 1
src/api/sale.js

@@ -123,7 +123,7 @@ export function getOutsourceDetail (id) {
 // 委外详情(按产品ID查询)
 export function getOutsourceDetailByProId (id) {
   return request({
-    url: request.adornUrl(`/biz-service/purCommDetail/infoProduction/${id}`),
+    url: request.adornUrl(`/biz-service/purCommDetail/info/${id}`),
     method: 'get'
   })
 }
@@ -136,6 +136,15 @@ export function getPurCommInfo (id) {
   })
 }
 
+// 委外操作
+export function updatePurCommissionDetail (data) {
+  return request({
+    url: request.adornUrl(`/biz-service/purCommDetail/updatePurCommissionDetail`),
+    method: 'post',
+    data
+  })
+}
+
 // 供应商列表
 export function getSupplierList (params) {
   return request({

+ 30 - 46
src/views/modules/sale/outsource-add-or-update.vue

@@ -6,14 +6,25 @@
         <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="contractCode">
-                <el-input v-model="dataForm.contractCode" disabled placeholder="合同编码由系统生成"></el-input>
+              <el-form-item label="委外编码" prop="purchaseCode">
+                <el-input v-model="dataForm.purchaseCode" disabled placeholder="委外编码由系统生成"></el-input>
               </el-form-item>
             </el-col>
+            <el-col :span="16">
+              <el-form-item label="付款方式" prop="payType">
+                <el-radio-group v-model="dataForm.payType">
+                  <el-radio :label='"1"'>对公转账</el-radio>
+                  <el-radio :label='"2"'>先行垫付</el-radio>
+                  <el-radio :label='"3"'>财务预支</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row class="my-row">
             <el-col :span="8">
-              <el-form-item label="合同类别" prop="contractType">
+              <el-form-item label="委外类别" prop="commissionType">
                 <el-select
-                  v-model="dataForm.contractType"
+                  v-model="dataForm.commissionType"
                   remote
                   placeholder="请选择">
                   <el-option
@@ -25,31 +36,6 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
-              <el-form-item label="采购/委外单据" prop="contractNumber">
-                <el-input v-model="dataForm.contractNumber" placeholder="合同号"></el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row class="my-row">
-            <el-col :span="8">
-              <el-form-item label="合同号" prop="contractNumber">
-                <el-input v-model="dataForm.contractNumber" placeholder="合同号"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="合同金额" prop="actualDeliveryTime">
-                <el-input-number v-model="dataForm.actualDeliveryTime" :step="1" :min="0" :precision="1"></el-input-number>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row class="my-row" style="margin-top: 20px">
-            <el-form-item label="备注" prop="notes">
-              <el-input type="textarea" v-model="dataForm.notes"></el-input>
-            </el-form-item>
-          </el-row>
-          <el-row class="my-row">
-            <upload-component :title="'附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
           </el-row>
         </el-form>
         <span slot="footer" class="dialog-footer">
@@ -62,9 +48,10 @@
 <script>
   import UploadComponent from '../common/upload-component'
   import { getOutsourceDetail, getOutsourceDetailByProId } from '@/api/sale'
+  import { getDictList } from '@/api/dict'
 
 export default {
-    name: 'contract-add-or-update',
+    name: 'outsource-add-or-update',
     components: {
       UploadComponent
     },
@@ -96,6 +83,8 @@ export default {
         this.fileList = []
         this.dataForm = {}
         this.id = id || 0
+        // 获取委外类别列表
+        this.getType()
         // 详情
         if (!id) return
         await (this.idType === 1 ? getOutsourceDetail(this.id) : getOutsourceDetailByProId(this.id)).then(({data}) => {
@@ -114,6 +103,14 @@ export default {
           }
         })
       },
+      // 获取类别
+      getType () {
+        getDictList({type: 'commission_type'}).then(({data}) => {
+          if (data) {
+            this.optionsType = data
+          }
+        })
+      },
       uploadSuccess (fileList) {
         this.fileList = fileList
       },
@@ -124,25 +121,12 @@ export default {
       dataFormSubmit () {
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
-            // 附件
-            let fList = this.fileList
-            if (fList.length > 0) {
-              this.dataForm.attachList = []
-              for (let i = 0; i < fList.length; i++) {
-                this.dataForm.attachList.push({
-                  fileName: fList[i].name,
-                  url: fList[i].url
-                })
-              }
-            } else {
-              this.$message.error('请上传文件')
-              return
-            }
             // 产品明细
+            //
             this.$http({
-              url: this.$http.adornUrl(`/biz-service/purPurchaseContract/${!this.id ? 'save' : 'update'}`),
+              url: this.$http.adornUrl(`/biz-service/purCommDetail/${!this.id ? 'save' : 'update'}`),
               method: 'post',
-              data: this.$http.adornData({...this.dataForm, orgId: this.orgId})
+              data: this.$http.adornData({...this.dataForm, applierId: this.$store.state.user.id, orgId: this.$store.state.user.orgId})
             }).then(({data}) => {
               if (data && data.code === '200') {
                 this.$message({

+ 6 - 6
src/views/modules/sale/outsource-detail.vue

@@ -32,7 +32,7 @@
           </el-checkbox-group>
         </e-desc-item>
 
-        <e-desc-item label="委外类别">{{dataForm.commissionTypeName}}</e-desc-item>
+        <e-desc-item label="委外类别">{{dataForm.commissionType}}</e-desc-item>
         <e-desc-item label="申请人">{{dataForm.applier}}</e-desc-item>
         <e-desc-item label="申请部门">{{dataForm.orgName}}</e-desc-item>
 
@@ -40,7 +40,7 @@
       </e-desc>
       <e-desc title="委外产品明细">
         <el-table
-          :data="dataForm.purCommissionDetails"
+          :data="dataForm.purCommissionDetailVos"
           border
           style="width: 100%;">
           <el-table-column
@@ -94,7 +94,7 @@
             prop="deadline"
             header-align="center"
             align="center"
-            min-width="140"
+            min-width="160"
             :show-tooltip-when-overflow="true"
             label="委外期限">
           </el-table-column>
@@ -107,7 +107,7 @@
             label="批次号">
           </el-table-column>
           <el-table-column
-            prop="specificationExplian"
+            prop="notes"
             header-align="center"
             align="center"
             min-width="140"
@@ -200,7 +200,7 @@
   import EDesc from '../common/e-desc'
   import EDescItem from '../common/e-desc-item'
   import { dealStepData, dealStepLogs } from '@/api/util'
-  import { getOutsourceDetail } from '@/api/sale'
+  import { getOutsourceDetailByProId } from '@/api/sale'
   import ApproveComponent from '../common/approve-component'
   import AttachDetail from '../common/attach-detail'
   export default {
@@ -246,7 +246,7 @@
         this.getDetails(businessType)
       },
       getDetails (businessType) {
-        getOutsourceDetail(this.id).then(({data}) => {
+        getOutsourceDetailByProId(this.id).then(({data}) => {
           if (data && data.code === '200' && data.data) {
             this.dataForm = data.data
             // 流程图展示

+ 95 - 0
src/views/modules/sale/outsource-pop.vue

@@ -0,0 +1,95 @@
+<!-- 委外 -->
+<template>
+    <div>
+        <div class="my-title">委外</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-form-item label="供应商" prop="supplierId">
+            <supplier-component v-model="dataForm.supplierId" :supplier-id.sync="dataForm.supplierId"></supplier-component>
+          </el-form-item>
+          <el-form-item label="不含税单价" prop="price">
+            <el-input-number v-model="dataForm.price" :step="1" :min="0" :precision="1"></el-input-number>
+          </el-form-item>
+          <el-form-item label="含税单价" prop="taxPrice">
+            <el-input-number v-model="dataForm.taxPrice" :step="1" :min="0" :precision="1"></el-input-number>
+          </el-form-item>
+          <el-form-item label="含税总价" prop="taxAmount">
+            <el-input-number v-model="dataForm.taxAmount" :step="1" :min="0" :precision="1"></el-input-number>
+          </el-form-item>
+          <el-form-item label="税率" prop="taxRate">
+            <el-input-number style="width: 160px" v-model="dataForm.taxRate" :step="1" :precision="1"/>&nbsp;%
+          </el-form-item>
+        </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 { updatePurCommissionDetail } from '@/api/sale'
+  import SupplierComponent from '../common/supplier-component'
+
+export default {
+    name: 'outsource-pop',
+    components: {
+      SupplierComponent
+    },
+    computed: {
+      orgId: {
+        get () { return this.$store.state.user.orgId }
+      }
+    },
+    data () {
+      return {
+        id: 0,
+        dataForm: {},
+        dataRule: {
+          supplierId: [{ required: true, message: '请选择供应商', trigger: 'change' }],
+          price: [{ required: true, message: '不含税单价不能为空', trigger: 'blur' }],
+          taxPrice: [{ required: true, message: '含税单价不能为空', trigger: 'blur' }],
+          taxAmount: [{ required: true, message: '含税总价不能为空', trigger: 'blur' }],
+          taxRate: [{ required: true, message: '税率不能为空', trigger: 'blur' }]
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init (id) {
+        this.dataForm.purComDetailId = id
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            updatePurCommissionDetail(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>

+ 27 - 14
src/views/modules/sale/outsource.vue

@@ -1,7 +1,7 @@
 <!-- 委外列表 -->
 <template>
   <div class="sale">
-    <template v-if="!detailVisible && !addOrUpdateVisible && !changeFormVisible &&!changeAttachVisible && !attachVisible && !noticeChangeAttachVisible && !inboundVisible">
+    <template v-if="!detailVisible && !addOrUpdateVisible && !changeFormVisible &&!changeAttachVisible && !attachVisible && !noticeChangeAttachVisible && !inboundVisible && !outsourceVisible">
       <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
         <el-form-item label="类别">
           <el-select
@@ -123,7 +123,7 @@
           prop="deadline"
           header-align="center"
           align="center"
-          min-width="140"
+          min-width="160"
           :show-tooltip-when-overflow="true"
           label="采购期限">
         </el-table-column>
@@ -131,7 +131,7 @@
           prop="arrivedTime"
           header-align="center"
           align="center"
-          min-width="140"
+          min-width="160"
           :show-tooltip-when-overflow="true"
           label="到料时间">
         </el-table-column>
@@ -220,13 +220,14 @@
           fixed="right"
           header-align="center"
           align="center"
-          width="180"
+          width="150"
           label="操作">
           <template slot-scope="scope">
-            <el-button v-if="isAuth('pur:commDetail:info')" type="text" size="small" @click="detailHandle(scope.row.purchaseCommission.purchaseId)">查看</el-button>
+            <el-button v-if="isAuth('pur:commDetail:info')" type="text" size="small" @click="detailHandle(scope.row.purchaseId)">查看</el-button>
             <el-button v-if="isAuth('pur:commDetail:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.purComDetailId)">编辑</el-button>
-            <el-button v-if="isAuth('pur:commDetail:save')" type="text" size="small" @click="addOrUpdateHandle(scope.row.purComDetailId)">委外</el-button>
-            <el-button v-if="isAuth('wh:in:inbound')" type="text" size="small" @click="inBound(scope.row.purComDetailId, false)">入库</el-button>
+            <el-button v-if="isAuth('pur:commDetail:updatePurCommissionDetail') && (Number(scope.row.purchaseState) === 1)" type="text" size="small" @click="outsourceHandle(scope.row.purComDetailId)">委外</el-button>
+            <el-button v-if="isAuth('pur:commDetail:infoPutIn') && (Number(scope.row.purchaseState) === 2)" type="text" size="small" @click="inBound(scope.row.purComDetailId, false)">入库</el-button>
+            <el-button v-if="isAuth('pur:commDetail:infoPutInAgain') && (Number(scope.row.purchaseState) === 5)" type="text" size="small" @click="inBound(scope.row.purComDetailId, false)">再次入库</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -247,13 +248,14 @@
     <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
     <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
     <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/>
-    <!--    入库-->
+    <!-- 入库 -->
     <stock-order-inbound v-if="inboundVisible" ref="inbound" @refreshDataList="getDataList" @onChose="onChose"/>
+    <outsource-pop v-if="outsourceVisible" ref="refOutsource" @refreshDataList="getDataList" @onChose="onChose"/>
   </div>
 </template>
 
 <script>
-import AddOrUpdate from '../cus/contract-record-add-or-update'
+import AddOrUpdate from './outsource-add-or-update'
 import Detail from './outsource-detail'
 import { getOutsourceList } from '@/api/sale'
 import AttachDetail from '../common/attach-detail'
@@ -261,9 +263,11 @@ import NoticeChangeSetting from '../cus/contract-record-notice-change-setting'
 import ChangeForm from '../cus/contract-record-change'
 import { getDictList } from '@/api/dict'
 import StockOrderInbound from '../warehouse/stock-order-inbound'
+import OutsourcePop from './outsource-pop'
 export default {
   name: 'outsource',
   components: {
+    OutsourcePop,
     AttachDetail,
     AddOrUpdate,
     Detail,
@@ -280,6 +284,7 @@ export default {
       noticeChangeAttachVisible: false,
       changeFormVisible: false,
       inboundVisible: false, // 入库申请
+      outsourceVisible: false, // 委外
       dataForm: {},
       dataList: [],
       pageIndex: 1,
@@ -294,23 +299,23 @@ export default {
           value: '全部'
         },
         {
-          code: '0',
+          code: '1',
           value: '待委外'
         },
         {
-          code: '1',
+          code: '2',
           value: '委外中'
         },
         {
-          code: '2',
+          code: '3',
           value: '已入库'
         },
         {
-          code: '3',
+          code: '4',
           value: '入库中'
         },
         {
-          code: '4',
+          code: '5',
           value: '入库异常'
         }
       ], // 委外状态
@@ -331,6 +336,7 @@ export default {
       this.changeFormVisible = false
       this.changeAttachVisible = false
       this.inboundVisible = false
+      this.outsourceVisible = false
     },
     // 查询
     search () {
@@ -486,6 +492,13 @@ export default {
       this.$nextTick(() => {
         this.$refs.inbound.init(id, display)
       })
+    },
+    // 委外
+    outsourceHandle (id) {
+      this.outsourceVisible = true
+      this.$nextTick(() => {
+        this.$refs.refOutsource.init(id)
+      })
     }
   }
 }