Parcourir la source

调整添加商品

qymljy il y a 3 ans
Parent
commit
4be1f72395

+ 1 - 1
src/HDrpManagement/ProductGroupMag/modules/add.vue

@@ -33,7 +33,7 @@
             </el-col>
             <el-col :span="24">
               <p class="normal-title normal-margin">
-                添加产品 
+                添加产品
                 <el-button v-if="col === 0" type="text" size="mini" @click="col = 12">选择商品</el-button>
                 <el-button v-else type="text" size="mini" @click="col = 0">关闭选择</el-button>
               </p>

+ 111 - 5
src/HDrpManagement/ProductGroupMag/modules/addGroupDetail.vue

@@ -1,6 +1,20 @@
 <template>
   <div>
-    <add-btn ref="add" :rowData="rowData" v-if="tool.checkAuth($route.name,'insert')" :disabled="disabled" @onSuccess="getDetail" style="margin-bottom:16px" />
+<!--    <add-btn ref="add" :rowData="rowData" v-if="tool.checkAuth($route.name,'insert')" :disabled="disabled" @onSuccess="getDetail" style="margin-bottom:16px" />-->
+    <addProduct class="inline-16"     ref="addProduct" v-if="tool.checkAuth($route.name,'insert') && !disabled"
+                :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添 加"
+                @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="getDetail"
+    ></addProduct>
+    <uploadAllData
+        class="inline-16"
+        v-if="tool.checkAuth($route.name,'insert') && !disabled"
+        :total="total"
+        @onSuccess="listData()"
+        @handlePullApi="handlePullApi"
+        @handleDelApi="handleDelApi"
+        idName="sa_itemgroupmxid"
+        type="del"
+    ></uploadAllData>
     <!-- <tableLayout :layout="tablecols" :data="list" :opwidth="200" :custom="true" height="40vh" fixedName="operation">
       <template v-slot:customcol="scope">
           <span v-if="scope.column.data[scope.column.columnname]">{{scope.column.data[scope.column.columnname]}}</span>
@@ -34,6 +48,8 @@ import AddBtn from './addGroupDetailBtn'
 import editBtn from './editGroupDetailBtn'
 import Table from './table.vue'
 import Del from './delete'
+import addProduct from '@/template/addProduct/index'
+import uploadAllData from '@/components/uploadAllData/index'
 
 export default {
   data () {
@@ -52,21 +68,35 @@ export default {
         "id": "20220923101603",
         "version":1,
         "content": {
-          "sa_itemgroupid":"",
+          "sa_itemgroupid":this.$route.query.id,
           "pageNumber":1,
           "pageSize":20
         }
       },
+      paramsAdd:{
+        "id": 20220923112503,
+        "content": {
+          "nocache":true,
+          "pageNumber": 1,
+          "pageSize": 100,
+          "sa_itemgroupid":this.$route.query.id,
+          "where": {
+            "condition": ''
+          }
+        }
+      },
+      tablecolsAdd:[],
       total:0
     }
   },
   props:['rowData','disabled'],
-  components:{AddBtn,Del,Table},
+  components:{AddBtn,Del,Table,addProduct,uploadAllData},
 
   watch: {
   },
   created() {
     this.getDetail()
+    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProduct.tablecols
   },
   methods: {
     async getDetail() {
@@ -95,13 +125,89 @@ export default {
         "id": "20220923105103",
         "content": {
           "sa_itemgroupid": this.$route.query.id,
-          "sa_itemgroupmxid": row.sa_itemgroupmxid
+          "sa_itemgroupmxids": [row.sa_itemgroupmxid]
         }
       })
       this.tool.showMessage(res,()=>{
         this.getDetail()
       })
-    }
+    },
+    /*批量添加商品*/
+    async addProducts(data){
+      let items = data.map(item => {
+        return {
+          sa_itemgroupmxid:0,
+          itemno:item.itemno,
+          itemid:item.itemid
+        }
+      })
+      const res = await this.$api.requested({
+        "id": 20220923110303,
+        "content": {
+          "sa_itemgroupid": this.$route.query.id,
+          "itemclassinfos": items
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.getDetail()
+        this.$refs.addProduct.listData()
+      })
+    },
+    /*单个添加商品*/
+    async addProduct(data){
+      let res = await this.$api.requested({
+        "id": 20220923110303,
+        "content": {
+          "sa_itemgroupid": this.$route.query.id,
+          "itemclassinfos": [
+            {
+              sa_itemgroupmxid:0,
+              itemno:data.itemno,
+              itemid:data.itemid
+            }
+          ]
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.getDetail()
+        this.$refs.addProduct.listData()
+      })
+    },
+    /*一键添加*/
+    uploadData(uploadApi,data){
+      uploadApi.id = 20220923110303
+      uploadApi.content = {
+        "sa_itemgroupid": this.$route.query.id,
+        "itemclassinfos": data.map(e=>{
+          return {
+            sa_itemgroupmxid:0,
+            itemno:e.itemno,
+            itemid:e.itemid
+          }
+        })
+      }
+      this.getDetail()
+      this.$refs.addProduct.listData()
+    },
+    handlePullApi (pullApi) {
+      pullApi.content = {
+        "sa_itemgroupid": 0, //订单ID
+        "pageNumber": 1,
+        "pageSize": 20,
+        "where": {
+          "condition": ""
+        }
+      }
+      pullApi.id = 20220923101603
+      pullApi.content.sa_itemgroupid = this.$route.query.id
+    },
+    handleDelApi (delApi,data) {
+      delApi.id = 20220923105103
+      delApi.content = {
+        "sa_itemgroupid": this.$route.query.id,
+        "sa_itemgroupmxids": data
+      }
+    },
   }
 }
 

+ 0 - 1
src/HDrpManagement/contractManage/modules/detail.vue

@@ -181,7 +181,6 @@ export default {
     SubmitCheck,
     editBtn,
     productBillno,
-    addProductTeamp,
     addProduct,
     productDetailList,
     addProductDetail,

+ 75 - 6
src/HDrpManagement/orderManage/details/tabs/productlist.vue

@@ -4,11 +4,13 @@
       <div class="flex-align-center">
         <slot name="operation"></slot>
 <!--        <el-button style="margin:0 0 10px 10px" size="small" type="primary" :disabled="data.status !== '新建'" v-if="type !== 'confirmdate'" @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>-->
-        <addProduct style="margin:0 0 10px 10px" v-if="type !== 'confirmdate' && data.status === '新建' " :drawer="drawer" :data="data" @onConfirm="onConfirm" ref="addpro"
-                    :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添 加"
+        <addProduct style="margin:0 0 10px 10px" v-if="type !== 'confirmdate' && data.status === '新建' " :drawer="drawer" :data="data"  ref="addProduct"
+                    :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添 加" :tradefield="data.tradefield"
+                    @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="listData"
         ></addProduct>
         <excel style="margin:0 0 10px 10px" :tablecols="columnTitle" :param="param" :total="total" :excelTitle="excelTitle"></excel>
-        <!-- <uploadAllData 
+         <uploadAllData
+         v-if="type !== 'confirmdate' && data.status === '新建' "
           style="margin:0 0 10px 10px"
           :total="total" 
           @onSuccess="listData()"
@@ -16,7 +18,7 @@
           @handleDelApi="handleDelApi"
           idName="sa_orderitemsid"
           type="del"
-        ></uploadAllData> -->
+        ></uploadAllData>
       </div>
       <p class="normal-margin" style="font-size: 13px !important;color:red;font-weight: normal" v-if="data.status === '新建'">{{checkFreefreightamount}}</p>
       <el-table
@@ -433,7 +435,7 @@ export default {
         "content": {
           "sa_orderid": this.$route.query.id, //订单ID
           "pageNumber": 1,
-          "pageSize": 20,
+          "pageSize": 100,
           "where": {
             "condition": ""
           }
@@ -644,7 +646,74 @@ export default {
         },
       })
       this.freefreightamount = res.data.freefreightamount?res.data.freefreightamount:0
-    }
+    },
+    /*批量添加商品*/
+    async addProducts(data){
+      let items = data.map(item => {
+        return {
+          sa_orderitemsid:0,
+          itemid:item.itemid,
+          qty:item.orderminqty,
+          needdate:item.deliverydate
+        }
+      })
+      const res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": this.data.type, //订单类型
+          "items": items
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$refs.addProduct.list = []
+      })
+    },
+    /*单个添加商品*/
+    async addProduct(data){
+      let res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id,
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": this.data.type, //订单类型
+          "items": [
+            {
+              "sa_orderitemsid": 0,
+              "needdate": data.deliverydate,
+              "qty": data.orderminqty,
+              'itemid':data.itemid,
+            }
+          ]
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.listData()
+        this.$refs.addProduct.list = []
+      })
+    },
+    /*一键添加*/
+    uploadData(uploadApi,data){
+      uploadApi.id = 20221109093602
+      uploadApi.content = {
+        "sa_orderid": this.$route.query.id,
+        "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+        "type": this.data.type, //订单类型
+        "items": data.map(e=>{
+          return {
+            "sa_orderitemsid": 0,
+            "needdate": e.deliverydate,
+            "qty": e.orderminqty,
+            'itemid':e.itemid,
+          }
+        })
+      }
+      this.listData()
+      this.$refs.addProduct.list = []
+    },
+
   },
   mounted () {
     this.listData()

+ 1 - 0
src/HDrpManagement/projectChange/modules/modules/productSet/index.vue

@@ -8,6 +8,7 @@
                   @addSuccess="addProducts" :discountrate="discountrate" @addProduct="addProduct" :tablecolsAdd="tablecolsAdd"
       ></addProduct>
       <uploadAllData
+          v-if="tool.checkAuth($route.name,'productSetManage') && data.disabled"
           class="inline-16"
           :total="total"
           @onSuccess="listData()"

+ 1 - 0
src/SDrpManagement/QuotedPrice/detail/modules/productInventory/index.vue

@@ -14,6 +14,7 @@
       </el-input>&nbsp;
 <!--      <product_table style="float: right" :data="data"  ref="quoterPrice" @productAdd="productInitialization" ></product_table>-->
       <uploadAllData
+          v-if="tool.checkAuth($route.name,'productDetails') && data.status === '新建' && disabled"
           class="inline-16"
           :total="total"
           @onSuccess="productData()"

+ 123 - 7
src/SDrpManagement/agentOrder/modules/productlist.vue

@@ -3,8 +3,21 @@
   <el-col :span="setcol">
     <div  class="flex-align-center normal-margin">
       <slot name="operation"></slot>
-      <el-button v-if="data.status === '新建'" class="inline-16" :disabled="data.type === '特殊订单'" size="small" type="primary"  @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>
+<!--      <el-button v-if="data.status === '新建'" class="inline-16" :disabled="data.type === '特殊订单'" size="small" type="primary"  @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>-->
+      <addProduct  class="inline-16" v-if="type !== 'confirmdate' && data.status === '新建' && data.type !== '特殊订单' " :drawer="drawer" :data="data"  ref="addProduct"
+                  :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添 加" :tradefield="data.tradefield"
+                  @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="listData"
+      ></addProduct>
       <excel class="inline-16" :tablecols="columnTitle" :param="param" :total="total" :excelTitle="excelTitle"></excel>
+      <uploadAllData
+          v-if="type !== 'confirmdate' && data.status === '新建' && data.type !== '特殊订单' "
+          :total="total"
+          @onSuccess="listData()"
+          @handlePullApi="handlePullApi"
+          @handleDelApi="handleDelApi"
+          idName="sa_orderitemsid"
+          type="del"
+      ></uploadAllData>
     </div>
     <p v-if="data.status === '新建'" class="normal-margin" style="font-size: 13px !important;color:red;font-weight: normal">{{checkFreefreightamount}}</p>
     <el-table
@@ -235,8 +248,9 @@
 </template>
 
 <script>
-import addProduct from '@/template/orderCanUseProduct/index.vue'
-
+// import addProduct from '@/template/orderCanUseProduct/index.vue'
+import addProduct from '@/template/addProduct/index'
+import uploadAllData from '@/components/uploadAllData/index'
 export default {
   props:['data','type'],
   data () {
@@ -251,7 +265,7 @@ export default {
       param:{
         "id": 20221109093902,
         "content": {
-          "sa_orderid": 0, //订单ID
+          "sa_orderid": this.$route.query.id, //订单ID
           "pageNumber": 1,
           "pageSize": 20,
           "where": {
@@ -267,7 +281,19 @@ export default {
       total:0,
       currentPage:0,
       time: null,
-      value2:''
+      value2:'',
+      paramsAdd:{
+        "id": null,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": ""
+          }
+        },
+      },
+      tablecolsAdd:[]
     }
   },
   computed:{
@@ -290,7 +316,8 @@ export default {
   components:{
     /*excel:() =>  import('../export_excel'),*/
     excel:() => import('../details/export_excel'),
-    addProduct
+    addProduct,
+    uploadAllData
   },
   methods:{
 
@@ -433,7 +460,93 @@ export default {
         },
       })
       this.freefreightamount = res.data.freefreightamount?res.data.freefreightamount:0
-    }
+    },
+    /*批量添加商品*/
+    async addProducts(data){
+      let items = data.map(item => {
+        return {
+          sa_orderitemsid:0,
+          itemid:item.itemid,
+          qty:item.orderminqty,
+          needdate:item.deliverydate
+        }
+      })
+      const res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": this.data.type, //订单类型
+          "items": items
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$refs.addProduct.list = []
+      })
+    },
+    /*单个添加商品*/
+    async addProduct(data){
+      let res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id,
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": this.data.type, //订单类型
+          "items": [
+            {
+              "sa_orderitemsid": 0,
+              "needdate": data.deliverydate,
+              "qty": data.orderminqty,
+              'itemid':data.itemid,
+            }
+          ]
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.listData()
+        this.$refs.addProduct.listData()
+      })
+    },
+    /*一键添加*/
+    uploadData(uploadApi,data){
+      uploadApi.id = 20221109093602
+      uploadApi.content = {
+        "sa_orderid": this.$route.query.id,
+        "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+        "type": this.data.type, //订单类型
+        "items": data.map(e=>{
+          return {
+            "sa_orderitemsid": 0,
+            "needdate": e.deliverydate,
+            "qty": e.orderminqty,
+            'itemid':e.itemid,
+          }
+        })
+      }
+      this.listData()
+      this.$refs.addProduct.list = []
+    },
+
+    handlePullApi (pullApi) {
+      pullApi.content = {
+        "sa_orderid": 0, //订单ID
+        "pageNumber": 1,
+        "pageSize": 20,
+        "where": {
+          "condition": ""
+        }
+      }
+      pullApi.id = 20221109093902
+      pullApi.content.sa_orderid = this.$route.query.id
+    },
+    handleDelApi (delApi,data) {
+      delApi.id = 20221109093702
+      delApi.content = {
+        "sa_orderid":this.$route.query.id,
+        "sa_orderitemsids": data
+      }
+    },
   },
   mounted () {
     this.listData()
@@ -448,6 +561,9 @@ export default {
     })
     // console.log(this.columnTitle)
   },
+  created() {
+    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
+  },
   watch:{
     value2 (val) {
       console.log(val)

+ 122 - 6
src/SDrpManagement/salerOrder/modules/productlist.vue

@@ -3,8 +3,21 @@
   <el-col :span="setcol">
     <div  class="flex-align-center normal-margin">
       <slot name="operation"></slot>
-      <el-button :disabled="data.type === '特殊订单'"  v-if="data.status === '新建'" class="inline-16" size="small" type="primary" @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>
+<!--      <el-button :disabled="data.type === '特殊订单'"  v-if="data.status === '新建'" class="inline-16" size="small" type="primary" @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>-->
+      <addProduct class="inline-16"  v-if="type !== 'confirmdate' && data.status === '新建' && data.type !== '特殊订单' " :drawer="drawer" :data="data"  ref="addProduct"
+                  :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添 加" :tradefield="data.tradefield"
+                  @addSuccess="addProducts" @addProduct="addProduct" @uploadData="uploadData" @closeDrawer="listData"
+      ></addProduct>
       <excel class="inline-16" :tablecols="columnTitle" :param="param" :total="total" :excelTitle="excelTitle"></excel>
+      <uploadAllData
+          v-if="type !== 'confirmdate' && data.status === '新建' && data.type !== '特殊订单' "
+          :total="total"
+          @onSuccess="listData()"
+          @handlePullApi="handlePullApi"
+          @handleDelApi="handleDelApi"
+          idName="sa_orderitemsid"
+          type="del"
+      ></uploadAllData>
     </div>
     <p v-if="data.status === '新建'" class="normal-margin" style="font-size: 13px !important;color:red;font-weight: normal">{{checkFreefreightamount}}</p>
     <el-table
@@ -251,8 +264,9 @@
 </template>
 
 <script>
-import addProduct from '@/template/orderCanUseProduct/index.vue'
-
+/*import addProduct from '@/template/orderCanUseProduct/index.vue'*/
+import addProduct from '@/template/addProduct/index'
+import uploadAllData from '@/components/uploadAllData/index'
 export default {
   props:['data','type'],
   data () {
@@ -283,7 +297,19 @@ export default {
       total:0,
       currentPage:0,
       time: null,
-      value2:''
+      value2:'',
+      paramsAdd:{
+        "id": null,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": ""
+          }
+        },
+      },
+      tablecolsAdd:[]
     }
   },
   computed:{
@@ -314,7 +340,8 @@ export default {
   },
   components:{
     excel:() =>  import('../details/export_excel'),
-    addProduct
+    addProduct,
+    uploadAllData
   },
   methods:{
     async listData () {
@@ -469,7 +496,93 @@ export default {
         },
       })
       this.freefreightamount = res.data.freefreightamount?res.data.freefreightamount:0
-    }
+    },
+    /*批量添加商品*/
+    async addProducts(data){
+      let items = data.map(item => {
+        return {
+          sa_orderitemsid:0,
+          itemid:item.itemid,
+          qty:item.orderminqty,
+          needdate:item.deliverydate
+        }
+      })
+      const res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": this.data.type, //订单类型
+          "items": items
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.listData()
+        this.$refs.addProduct.list = []
+      })
+    },
+    /*单个添加商品*/
+    async addProduct(data){
+      let res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id,
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": this.data.type, //订单类型
+          "items": [
+            {
+              "sa_orderitemsid": 0,
+              "needdate": data.deliverydate,
+              "qty": data.orderminqty,
+              'itemid':data.itemid,
+            }
+          ]
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.listData()
+        this.$refs.addProduct.list = []
+      })
+    },
+    /*一键添加*/
+    uploadData(uploadApi,data){
+      uploadApi.id = 20221109093602
+      uploadApi.content = {
+        "sa_orderid": this.$route.query.id,
+        "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+        "type": this.data.type, //订单类型
+        "items": data.map(e=>{
+          return {
+            "sa_orderitemsid": 0,
+            "needdate": e.deliverydate,
+            "qty": e.orderminqty,
+            'itemid':e.itemid,
+          }
+        })
+      }
+      this.listData()
+      this.$refs.addProduct.list = []
+    },
+    handlePullApi (pullApi) {
+      pullApi.content = {
+        "sa_orderid": 0, //订单ID
+        "pageNumber": 1,
+        "pageSize": 20,
+        "where": {
+          "condition": ""
+        }
+      }
+      pullApi.id = 20221109093902
+      pullApi.content.sa_orderid = this.$route.query.id
+    },
+    /*一键删除*/
+    handleDelApi (delApi,data) {
+      delApi.id = 20221109093702
+      delApi.content = {
+        "sa_orderid":this.$route.query.id,
+        "sa_orderitemsids": data
+      }
+    },
   },
   mounted () {
     this.listData()
@@ -484,6 +597,9 @@ export default {
     })
     // console.log(this.columnTitle)
   },
+  created() {
+    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addProductTable.tablecols
+  },
   watch:{
     value2 (val) {
       console.log(val)

+ 19 - 16
src/template/addProduct/index.vue

@@ -130,23 +130,26 @@ export default {
     /*可添加商品*/
     async listData(){
       console.log(this.tradefield,'领域')
-      switch (this.data.type) {
-        case '标准订单':
-          this.params.id = 20221109153502
-          break;
-        case '项目订单':
-          this.params.id = 20230103155002
-          break;
-        case '促销订单':
-          this.params.id = 20230107182302
-          break;
-        case '工具订单':
-          this.params.id = 20221109153502
-          break;
-        default:
-          this.params.id = 20221109153502
-          break;
+      if (this.data){
+        switch (this.data.type) {
+          case '标准订单':
+            this.params.id = 20221109153502
+            break;
+          case '项目订单':
+            this.params.id = 20230103155002
+            break;
+          case '促销订单':
+            this.params.id = 20230107182302
+            break;
+          case '工具订单':
+            this.params.id = 20221109153502
+            break;
+          default:
+            this.params.id = 20221109153502
+            break;
+        }
       }
+
       this.params.content.where.tradefield = this.tradefield
       const res = await this.$api.requested(this.params)
       this.list = res.data