Преглед изворни кода

采购管理-委外列表-批量

damon227 пре 11 месеци
родитељ
комит
095fecac1a

+ 9 - 2
src/views/modules/sale/outsource-pop.vue

@@ -23,7 +23,7 @@
             </el-col>
             <el-col :span="6">
               <el-form-item label="图号">
-                <span>{{item.batchNumber}}</span>
+                <span>{{item.mapNumber}}</span>
               </el-form-item>
             </el-col>
           </el-row>
@@ -109,6 +109,10 @@ export default {
           this.dataForm.list = []
           let list = rows.map(item => {
             return {
+              productName: item.productName,
+              productSpec: item.productSpec,
+              mapNumber: item.mapNumber,
+              supplierId: '',
               purComDetailId:item.purComDetailId, 
               cnt:item.cnt,
               price:1,
@@ -122,6 +126,10 @@ export default {
           this.subTitle = '委外'
           this.dataForm.list = [
             {
+              productName: item.productName,
+              productSpec: item.productSpec,
+              mapNumber: item.mapNumber,
+              supplierId: '',
               purComDetailId:rows.id, 
               cnt:rows.cnt,
               price:1,
@@ -130,7 +138,6 @@ export default {
             }
             ]
         }
-        console.log('dataForm',this.dataForm)
       },
       validateField (type) {
         this.$refs.dataForm.validateField(type)

+ 93 - 2
src/views/modules/sale/outsource.vue

@@ -47,7 +47,8 @@
           <el-button v-if="isAuth('pur:commDetail:save')" type="primary" @click="addOrUpdateHandle()">新增委外</el-button>
           <el-button v-if="isAuth('pur:commDetail:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">工作提示通知设置</el-button>
           <el-button v-if="isAuth('pur:commDetail:priceConfig')" type="primary" @click="setAmountMaskHandel()">委外金额屏蔽设置</el-button>
-          <el-button v-if="isAuth('pur:commDetail:save')" type="primary" @click="batchHandle()">批量委外</el-button>
+          <el-button v-if="isAuth('pur:commDetail:updatePurCommissionDetail')" type="primary" @click="batchHandle()" :disabled="batchBtnDisabled">批量委外</el-button>
+          <el-button v-if="isAuth('pur:commDetail:infoPutIn')" type="primary" @click="batchIncomeHandle()" :disabled="batchIncomeBtnDisabled">批量入库</el-button>
         </el-form-item>
       </el-form>
       <el-table
@@ -83,6 +84,27 @@
           :show-tooltip-when-overflow="true"
           label="物料名称">
         </el-table-column>
+        <el-table-column
+          prop="mapNumber"
+          header-align="center"
+          align="center"
+          min-width="140"
+          :show-tooltip-when-overflow="true"
+          label="图号">
+        </el-table-column>
+        <el-table-column
+          prop="simplePic"
+          header-align="center"
+          align="center"
+          min-width="120"
+          label="简图">
+          <template slot-scope="scope">
+            <el-popover placement="right" title="" trigger="hover">
+              <img :src="scope.row.simplePic" style="height: 400px;width: 500px">
+              <img slot="reference" :src="scope.row.simplePic" :alt="scope.row.simplePic" style="max-height: 50px;max-width: 130px">
+            </el-popover>
+          </template>
+        </el-table-column>
         <el-table-column
           prop="productNumber"
           header-align="center"
@@ -274,6 +296,7 @@ import { getDictList } from '@/api/dict'
 import StockOrderInbound from '../warehouse/stock-order-inbound'
 import OutsourcePop from './outsource-pop'
 import AmountMaskSetting from './outsource-amount-mask-setting'
+import { downloadUrl } from '@/api/file'
 
 export default {
   name: 'outsource',
@@ -317,7 +340,9 @@ export default {
       ],
       // 审批状态
       optionsState: [],
-      selectedRows:[]
+      selectedRows:[],
+      batchBtnDisabled: false,
+      batchIncomeBtnDisabled: false
     }
   },
   created () {
@@ -336,6 +361,9 @@ export default {
       this.inboundVisible = false
       this.outsourceVisible = false
       this.amountMaskSettingVisible = false
+      this.selectedRows = []
+      this.batchBtnDisabled = false
+      this.batchIncomeBtnDisabled = false
     },
     // 查询
     search () {
@@ -352,6 +380,10 @@ export default {
     },
     // 获取数据列表
     getDataList () {
+      this.selectedRows = []
+      this.batchBtnDisabled = false
+      this.batchIncomeBtnDisabled = false
+
       this.dataListLoading = true
       let params = {
         'current': this.pageIndex,
@@ -366,6 +398,15 @@ export default {
         if (data && data.code === '200' && data.data) {
           this.dataList = data.data.records
           this.totalPage = Number(data.data.total)
+
+          // 简图格式调整
+          this.dataList.forEach(item => {
+            if (item.attachList2 && item.attachList2.length > 0) {
+              item.simplePic = downloadUrl + item.attachList2[0].url
+            } else {
+              item.simplePic = ''
+            }
+          })
         } else {
           this.dataList = []
           this.totalPage = 0
@@ -524,13 +565,63 @@ export default {
     //监听批量选择的行
     handleSelectionChange(rows){
       this.selectedRows = rows
+      this.batchBtnDisabled = false
+      this.batchIncomeBtnDisabled = false
+      //(Number(scope.row.approvalState) === 3) && (Number(scope.row.purchaseState) === 1)
+      //控制批量操作按钮
+       
+      for(let index=0;index<this.selectedRows.length;index++){
+        let item = this.selectedRows[index]
+        if(Number(item.approvalState) === 3  && Number(item.purchaseState) === 1){
+        
+        } else {
+          this.batchBtnDisabled = true
+        }
+
+        if(Number(item.approvalState) === 3  && (Number(item.purchaseState) === 2 || Number(item.purchaseState) === 5)){
+        
+        } else {
+          this.batchIncomeBtnDisabled = true
+        }
+      }
     },
     //批量委外
     batchHandle(){
+      if(this.selectedRows.length == 0){
+           this.$message.error("请先勾选数据")
+           return
+      }
+
       this.outsourceVisible = true
       this.$nextTick(() => {
         this.$refs.refOutsource.init(this.selectedRows)
       })
+    },
+    //批量入库
+    batchIncomeHandle(){
+      if(this.selectedRows.length == 0){
+           this.$message.error("请先勾选数据")
+           return
+      }
+
+      let list = []
+      for(let index=0;index<this.selectedRows.length;index++){
+        let item = this.selectedRows[index]
+        let dataForm = {
+          ...item,
+          buttonType: '1',
+          sourceCategory: '3', // 入库依据类别
+          materialName: item.productName,
+          tableId: item.purComDetailId, // 主表ID
+          specifications: item.specificationExplian
+        }
+        list.push(dataForm)
+      }
+
+      this.inboundVisible = true
+      this.$nextTick(() => {
+        this.$refs.inbound.init(0, false, list)
+      })
     }
   }
 }

+ 0 - 1
src/views/modules/sale/purchase.vue

@@ -494,7 +494,6 @@
       },
       //批量采购
       batchBuyHandel(){
-        console.log(this.selectedRows)
         if(this.selectedRows.length == 0){
            this.$message.error("请先勾选数据")
            return

+ 5 - 0
src/views/modules/warehouse/stock-order-inbound.vue

@@ -262,11 +262,16 @@
       },
       // 表单提交
       dataFormSubmit () {
+        console.log()
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
             let postData = []
             // 数据校验
             for (let i = 0; i < this.dataList.length; i++) {
+              if (!this.dataList[i].materialTypeId) {
+                this.$message.warning('类别不能为空')
+                return
+              }
               if (!this.dataList[i].batchNumber) {
                 this.$message.warning('批次号不能为空')
                 return