ソースを参照

采购列表-批量采购

damon227 11 ヶ月 前
コミット
f6e9ac13ff

+ 9 - 0
src/api/sale.js

@@ -154,6 +154,15 @@ export function updatePurCommissionDetail (data) {
   })
 }
 
+// 批量委外操作
+export function updatePurCommissionDetailBatch (data) {
+  return request({
+    url: request.adornUrl(`/biz-service/purCommDetail/batch/updatePurCommissionDetail`),
+    method: 'post',
+    data
+  })
+}
+
 // 供应商列表
 export function getSupplierList (params) {
   return request({

+ 3 - 2
src/utils/httpRequest.js

@@ -56,7 +56,8 @@ http.adornParams = (params = {}, openDefultParams = true) => {
   var defaults = {
     't': new Date().getTime()
   }
-  return openDefultParams ? merge(defaults, params) : params
+  // return openDefultParams ? merge(defaults, params) : params
+  return params
 }
 
 /**
@@ -71,7 +72,7 @@ http.adornData = (data = {}, openDefultdata = true, contentType = 'json') => {
   var defaults = {
     't': new Date().getTime()
   }
-  data = openDefultdata ? merge(defaults, data) : data
+  // data = openDefultdata ? merge(defaults, data) : data
   return contentType === 'json' ? JSON.stringify(data) : qs.stringify(data)
 }
 

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

@@ -67,7 +67,7 @@
 </template>
 
 <script>
-  import { updatePurCommissionDetail } from '@/api/sale'
+  import { updatePurCommissionDetailBatch } from '@/api/sale'
   import SupplierComponent from '../common/supplier-component'
 
 export default {
@@ -139,7 +139,7 @@ export default {
       dataFormSubmit () {
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
-            updatePurCommissionDetail(this.dataForm).then(({data}) => {
+            updatePurCommissionDetailBatch(this.dataForm.list).then(({data}) => {
               if (data && data.code === '200') {
                 this.$message({
                   message: '操作成功',

+ 36 - 26
src/views/modules/sale/purchase-operate.vue

@@ -97,7 +97,8 @@
     data () {
       let validateSupplier = (rule, value, callback) => {
         if (!this.dataForm.supplierId && !this.dataForm.supplierOther) {
-          callback(new Error('请至少填写一项供应商信息'))
+          //callback(new Error('请至少填写一项供应商信息'))
+          callback()
         } else {
           // 任意值被填写,清除验证提示
           if (!this.dataForm.supplierId || !this.dataForm.supplierOther) {
@@ -158,32 +159,41 @@
       dataFormSubmit () {
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
-            console.log(1111)
-            // // 检查供应商
-            // if (!this.dataForm.supplierId && !this.dataForm.supplierOther) {
-            //   this.$message.error('请填写供应商')
-            //   return
-            // }
+            // 检查供应商
+            let param = {};
+            for(let index=0; index < this.dataForm.list.length; index++){
+              let item = this.dataForm.list[index]
+              if (!item.supplierId && !item.supplierOther) {
+                this.$message.error('请填写供应商')
+                return
+              }
+
+              item.purComDetailId = item.purchaseDetailId
+
+              param[index] = item
+            }
+
+            console.log("param", param)
 
-            // this.$http({
-            //   url: this.$http.adornUrl(`/biz-service/purchaseDetail/updatePurchaseDetail`),
-            //   method: 'post',
-            //   data: this.$http.adornData({...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)
-            //   }
-            // })
+            this.$http({
+              url: this.$http.adornUrl(`/biz-service/purchaseDetail/batch/updatePurchaseDetail`),
+              method: 'post',
+              data: this.$http.adornData(param)
+            }).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)
+              }
+            })
           }
         })
       }