浏览代码

2023-3-14

codeMan 2 年之前
父节点
当前提交
4d925c2398

+ 6 - 5
src/HDrpManagement/contractManage/components/productDetailList/addProduct.vue

@@ -6,7 +6,9 @@
         <p class="normal-title normal-margin">产品清单</p>
         <div style="display:flex;justify-content:space-between;align-items:center">
           <el-input size="small" style="width:200px;margin-bottom:10px" v-model="params.content.where.condition" placeholder="输入搜索内容" @clear="getProductList(params.content.pageNumber = 1)" @keyup.native.enter="getProductList(params.content.pageNumber = 1)" clearable></el-input>
-          <el-button type="primary" size="small" :disabled="selectProductLength == 0" @click="onSumit">批 量 添 加</el-button>
+          <div>
+            <el-button type="primary" size="small" :disabled="selectProductLength == 0" @click="onSumit($refs.table.tableSelectData)">批 量 添 加</el-button>
+          </div>
         </div>
         <Table @selectArr="selectArr" ref="table" v-model="itemno" :layout="tablecols" :data="productList" :custom="true" height="400px"  @upDateData="upDateData" @selection="selectArr" @onSelect="addProduct">
         </Table>
@@ -113,9 +115,8 @@ export default {
         this.$emit('onSuccess')
       })
     },
-    async onSumit () {
-      console.log(this.$refs.table.tableSelectData);
-      let item = this.$refs.table.tableSelectData.map(item => {
+    async onSumit (data) {
+      let item = data.map(item => {
         return {
           "itemid": item.itemid,
           "price": item.marketprice,
@@ -133,7 +134,7 @@ export default {
       })
       this.tool.showMessage(res,() => {
         this.$emit('onSuccess')
-        this.$refs.table.tableSelectData = []
+        data = []
         this.getProductList()
 
       })

+ 7 - 4
src/HDrpManagement/contractManage/components/productList/addProduct.vue

@@ -68,7 +68,9 @@
           <div style="display:flex;align-items:center">
             <el-input size="small" style="width:200px" v-model="params.content.where.condition" placeholder="输入搜索内容" @clear="getProductList(params.content.pageNumber = 1)" @keyup.native.enter="getProductList(params.content.pageNumber = 1)" clearable></el-input>
           </div>
-          <el-button type="primary" size="small" :disabled="selectProductLength == 0" @click="queryProuctAdds">批 量 添 加</el-button>
+          <div>
+            <el-button type="primary" size="small" :disabled="selectProductLength == 0" @click="queryProuctAdds($refs.table.tableSelectData)">批 量 添 加</el-button>
+          </div>
         </div>
         <Table  ref="table" fixedName="operation" v-model="itemno"  :data="productList" :custom="true" height="500px"   @selection="selectArr" @onSelect="queryProuctAdd">
         </Table>
@@ -95,6 +97,7 @@
 // import Table from '@/HDrpManagement/ProductGroupMag/modules/table'
 import Table from '@/components/productTable/indexQty'
 import previewImage from '@/components/previewImage/index'
+import { log } from '@antv/g2plot/lib/utils';
 export default {
   props:['disabled','data'],
   name: '',
@@ -256,12 +259,12 @@ export default {
       this.tool.showMessage(res,() => {
         this.$emit('onSuccess')
         this.$refs.table.tableSelectData = []
-        this.getProductList()
+        this.productList = []
       })
     },
     /*查询商品是否已添加*/
-    async queryProuctAdds(){
-      let item = this.$refs.table.tableSelectData.map(item => {
+    async queryProuctAdds(data){
+      let item = data.map(item => {
         return {
           "itemid": item.itemid,
           "price": item.price,

+ 7 - 6
src/HDrpManagement/contractManage/components/toolList/addTool.vue

@@ -6,7 +6,9 @@
         <p class="normal-title normal-margin">工具清单</p>
         <div style="display:flex;justify-content:space-between;align-items:center">
           <el-input size="small" style="width:200px;margin-bottom:10px" v-model="params.content.where.condition" placeholder="输入搜索内容" @clear="getProductList(params.content.pageNumber = 1)" @keyup.native.enter="getProductList(params.content.pageNumber = 1)" clearable></el-input>
-          <el-button type="primary" size="small" :disabled="selectProductLength == 0" @click="batchSelects">批 量 添 加</el-button>
+          <div>
+            <el-button type="primary" size="small" :disabled="selectProductLength == 0" @click="batchSelects">批 量 添 加</el-button>
+          </div>
         </div>
         <Table  ref="table" v-model="itemno" :layout="tablecols" :data="productList" :custom="true" height="500px"  @upDateData="upDateData" @selection="selectArr" @onSelect="batchSelect">
         </Table>
@@ -113,7 +115,7 @@ export default {
     },
     batchSelects(){
       this.debounce(() =>{
-        this.onSumit()
+        this.onSumit($refs.table.tableSelectData)
       },300)()
     },
     async addProduct (data) {
@@ -137,9 +139,8 @@ export default {
         this.$emit('onSuccess')
       })
     },
-    async onSumit () {
-      console.log(this.$refs.table.tableSelectData);
-      let item = this.$refs.table.tableSelectData.map(item => {
+    async onSumit (data) {
+      let item = data.map(item => {
         return {
           "itemid": item.itemid,
           "price": item.marketprice,
@@ -156,7 +157,7 @@ export default {
         },
       })
       this.tool.showMessage(res,() => {
-        this.$refs.table.tableSelectData = []
+        data = []
         this.getProductList()
         this.$emit('onSuccess')
       })

+ 55 - 4
src/HDrpManagement/orderManage/details/tabs/addProduct.vue

@@ -1,7 +1,16 @@
 <template>
 <div>
   <div class="flex-align-center flex-between mt-10">
-    <el-input style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>
+    <div>
+      <el-input class="inline-16" style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>
+      <uploadAllData 
+        class="inline-16"
+        :total="total" 
+        @handlePullApi="handlePullApi"
+        @handleUploadApi="handleUploadApi"
+        @onSuccess="onSuccess"
+      ></uploadAllData>
+    </div>
     <el-button type="primary" size="small" :disabled="tableSelectData.length === 0" @click="onConfirm">添加选中商品</el-button>
   </div>
   <div>
@@ -116,6 +125,7 @@
 <script>
 import uploadFile from '@/components/upload/hw_obs_upload'
 import previewImage from '@/components/previewImage/index'
+import uploadAllData from '@/components/uploadAllData/index'
 
 export default {
   props:['data','drawer'],
@@ -135,12 +145,17 @@ export default {
       tableSelectData:[],
       tableData: [],
       total:0,
-      currentPage:0
+      currentPage:0,
+      totalPage:0,
+      progress:0,
+      progressVisible:false,
+      dataSize:200,
     }
   },
   components:{
     uploadFile,
-    previewImage
+    previewImage,
+    uploadAllData
   },
   methods:{
     async listData () {
@@ -168,6 +183,34 @@ export default {
       this.currentPage = res.pageNumber
       console.log(res,'mx')
     },
+    handlePullApi (pullApi) {
+      pullApi.content = JSON.parse(JSON.stringify(this.params.content))
+      pullApi.id = JSON.parse(JSON.stringify(this.params.id))
+      pullApi.content.sa_orderid = this.$route.query.id
+    },
+    handleUploadApi (uploadApi,data) {
+      uploadApi.id = 20221109093602
+      uploadApi.content = {
+        "sa_orderid": this.$route.query.id, //订单ID
+        "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+        "type": this.data.type, //订单类型
+        "items": data.map(e=>{
+          return {
+            sa_orderitemsid:0,
+            itemid:e.itemid,
+            qty:e.orderminqty,
+            needdate:e.deliverydate
+          }
+        })
+      }
+    },
+    handleDelApi (delApi,data) {
+      delApi.id = 20221109093702
+      delApi.content = {
+        "sa_orderid":this.$route.query.id,
+        "sa_orderitemsids": data
+      }
+    },
     handleSizeChange(val) {
       // console.log(`每页 ${val} 条`);
       this.params.content.pageSize = val
@@ -183,11 +226,16 @@ export default {
     },
     onConfirm () {
       this.params.content.where.condition = ''
-      this.$emit('onConfirm',this.tableSelectData)
+      this.$emit('onConfirm',this.tableSelectData,true)
       this.tableSelectData.forEach(v => {
         this.tableData.splice(this.tableData.findIndex(j => j.itemid == v.itemid),1)
       })
     },
+    onSuccess () {
+      this.tableData=[];
+      this.$emit('onConfirm','1',false)
+      this.total = 0
+    },
     clearSelection () {
       this.$refs.multipleTable.clearSelection();
     }
@@ -222,4 +270,7 @@ export default {
 .el-table__fixed, .el-table__fixed-right{
 height: calc(100% - 20px) !important;
 }
+/deep/.el-dialog__header {
+  display: none !important;
+}
 </style>

+ 116 - 26
src/HDrpManagement/orderManage/details/tabs/productlist.vue

@@ -5,6 +5,16 @@
         <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>
         <excel style="margin:0 0 10px 10px" :tablecols="columnTitle" :param="param" :total="total" :excelTitle="excelTitle"></excel>
+        <uploadAllData 
+          style="margin:0 0 10px 10px"
+          :total="total" 
+          @onSuccess="listData()"
+          @handlePullApi="handlePullApi"
+          @handleDelApi="handleDelApi"
+          idName="sa_orderitemsid"
+          type="del"
+        ></uploadAllData>
+        <!-- <el-button type="primary" size="small" style="margin:0 0 10px 10px" @click="allProduct">一 键 删 除</el-button> -->
       </div>
       <p class="normal-margin" style="font-size: 13px !important;color:red;font-weight: normal" v-if="data.status === '新建'">{{checkFreefreightamount}}</p>
       <el-table
@@ -326,17 +336,27 @@
           </div>
       </el-drawer>
     </el-col>
+    <el-dialog
+      title=""
+      :visible.sync="progressVisible"
+      :show-close="false"
+      append-to-body
+      width="500px">
+      <el-progress v-if="totalPage" :percentage="Math.floor(progress / totalPage * 100)"></el-progress>
+    </el-dialog>
   </el-row>
 </template>
 
 <script>
 import addProduct from './addProduct.vue'
 import excel from '../export_excel.vue'
+import uploadAllData from '@/components/uploadAllData/index'
 export default {
   props:['data','type'],
   components:{
     excel,
-    addProduct
+    addProduct,
+    uploadAllData
   },
   computed: {
     checkNB () {
@@ -378,7 +398,7 @@ export default {
         "content": {
           "sa_orderid": 0, //订单ID
           "pageNumber": 1,
-          "pageSize": 10000,
+          "pageSize": 20,
           "where": {
             "condition": ""
           }
@@ -398,7 +418,11 @@ export default {
       currentPage:0,
       time: null,
       value2:'',
-      stockOptions:[]
+      stockOptions:[],
+      totalPage:0,
+      progress:0,
+      progressVisible:false,
+      deleteIds:[]
     }
   },
   methods:{
@@ -407,9 +431,75 @@ export default {
       const res = await this.$api.requested(this.param)
       this.tableData = res.data
       this.total = res.total
+      this.totalPage = Math.ceil(this.total /200)
       this.currentPage = res.pageNumber
       this.queryBasicInfo()
     },
+    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
+      }
+    },
+    /* 一键选择所有商品 */
+    async allProduct () {
+      if (this.total > 200) {
+        this.$confirm(`总共删除${this.total}个商品,时间较长,是否继续`,'提示',{
+          confirmButtonText:'确定',
+          cancelButtonText:'取消',
+          type:'warning'
+        }).then(async () => {
+          this.progressVisible = true
+          let totalPage = Math.ceil(this.total / 200)
+          for (let index = 1; index <= totalPage; index++) {
+            this.pullData(index)
+          }
+          // this.$emit('onConfirm',res.data)
+        })
+      } else {
+        this.$confirm('是否删除所有数据?','提示',{
+          confirmButtonText:'确定',
+          cancelButtonText:'取消',
+          type:'warning'
+        }).then(async () => {
+          this.param.content.sa_orderid = this.$route.query.id
+          this.param.content.pageNumber = 1
+          this.param.content.pageSize = 200
+          const res = await this.$api.requested(this.param)
+          this.deleteIds.push(...res.data.map(item => item.sa_orderitemsid))
+          this.deleteOrderProduct(this.deleteIds)
+        })
+        
+      }
+    },
+    /* 拉取数据 */
+    async pullData (page) {
+      this.param.content.sa_orderid = this.$route.query.id
+      this.param.content.pageNumber = page
+      this.param.content.pageSize = 200
+      const res = await this.$api.requested(this.param)
+      this.progress++
+      this.deleteIds.push(...res.data.map(item => item.sa_orderitemsid))
+      if (this.progress >= this.totalPage) {
+        this.deleteOrderProduct(this.deleteIds)
+        this.progressVisible = false
+        this.progress = 0
+        this.param.content.pageSize = 20
+      }
+    },  
     handleSizeChange(val) {
       // console.log(`每页 ${val} 条`);
       this.params.content.pageSize = val
@@ -425,12 +515,13 @@ export default {
         "id": 20221109093702,
         "content": {
           "sa_orderid":this.$route.query.id,
-          "sa_orderitemsids": [row.sa_orderitemsid]
+          "sa_orderitemsids": Object.prototype.toString.call(row).indexOf('Array') != -1 ? row : [row.sa_orderitemsid]
         },
       })
       this.tool.showMessage(res,()=>{
         this.listData()
         this.$emit('onSuccess')
+        this.deleteIds = []
       })
     },
     stockChange (item,row,index) {
@@ -542,28 +633,27 @@ export default {
       this.$emit('select',selection)
     },
     // 订单添加商品
-    async onConfirm (data) {
-      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": data.map(e=>{
-            return {
-              sa_orderitemsid:0,
-              itemid:e.itemid,
-              qty:e.orderminqty,
-              needdate:e.deliverydate
-            }
-          })
-        },
-      })
-      this.tool.showMessage(res,()=>{
-        this.drawer = false
-        this.listData()
-        this.$emit('onSuccess')
-      })
+    async onConfirm (data,isupload) {
+      if (isupload) {
+        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": data.map(e=>{
+              return {
+                sa_orderitemsid:0,
+                itemid:e.itemid,
+                qty:e.orderminqty,
+                needdate:e.deliverydate
+              }
+            })
+          },
+        })
+      }
+      this.listData()
+      this.$emit('onSuccess')
     },
     async queryStock (val) {
       const res = await this.$api.requested({

+ 8 - 5
src/HDrpManagement/projectChange/modules/modules/productSet/add.vue

@@ -15,7 +15,9 @@
             <el-input size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>&nbsp;
           </div>
           <div style="margin-top:-10px;margin-bottom: 10px;float: right">
-            <el-button style="float: right" type="primary" size="mini" @click="onSubmit" :disabled="tableSelectData.length === 0 ">批量添加</el-button>
+            <div>
+            <el-button style="float: right" type="primary" size="mini" @click="onSubmit(tableSelectData)" :disabled="tableSelectData.length === 0 ">批量添加</el-button>
+            </div>
           </div>
         </div>
         <div class="container">
@@ -260,12 +262,12 @@ export default {
   },
 
   methods:{
-    async onSubmit(){
+    async onSubmit(data){
       const res = await this.$api.requested({
         "id": 20221021145502,
         "content": {
           "sa_projectid": this.$route.query.id,
-          "items": this.tableSelectData
+          "items": data
         },
       })
      this.tool.showMessage(res,()=>{
@@ -294,7 +296,7 @@ export default {
       this.tableSelectData = []
       this.tableSelectData[0] = val
       console.log(this.tableSelectData)
-      this.onSubmit()
+      this.onSubmit(this.tableSelectData)
     },
     onClose(){
       this.dialogFormVisible = false
@@ -322,7 +324,8 @@ export default {
       console.log(this.params,"params")
       this.params.content.sa_projectid = this.$route.query.id
       const res = await this.$api.requested(this.params)
-
+      console.log(res,'数据');
+      
       this.tableData = res.data.map((item,index)=>{
         item.qty = 1
         item.price = Math.round((item.marketprice * (this.discountrate / 100) ) *100)/100

+ 6 - 4
src/SDrpManagement/QuotedPrice/components/productTable.vue

@@ -16,7 +16,9 @@
             <el-input size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="搜索" @keyup.enter.native="productData(params.content.pageNumber = 1)" @clear="productData(params.content.pageNumber = 1)" clearable></el-input>&nbsp;
           </div>
           <div style="margin-top:-10px;margin-bottom: 10px;float: right">
+            <div>
             <el-button style="float: right" type="primary" size="mini" @click="batchSelect" :disabled="tableSelectData.length === 0 ">批量添加</el-button>
+            </div>
           </div>
         </div>
         <div class="container">
@@ -254,12 +256,12 @@ export default {
       this.$refs.classShow.queryBrands()
       this.$refs.classShow.queryAgentiInfo()
     },
-    async onSubmit(){
+    async onSubmit(data){
       const res = await this.$api.requested({
         "id": 20221021095403,
         "content": {
           "sa_quotedpriceid":this.$route.query.id,     //sat_notice_classid<=0时 为新增
-          "items":this.selectData
+          "items":data
         }
       })
       this.tool.showMessage(res,()=>{
@@ -288,10 +290,10 @@ export default {
       /*this.$nextTick(()=>{
         this.onSubmit()
       })*/
-      this.debounce(this.onSubmit,300)()
+      this.debounce(this.onSubmit(this.selectData),300)()
     },
     batchSelect(){
-      this.debounce(this.onSubmit,300)()
+      this.debounce(this.onSubmit(this.selectData),300)()
     },
     debounce (fn, wait) {
       let that = this

+ 7 - 5
src/SDrpManagement/QuotedPrice/components/productTableProject.vue

@@ -16,7 +16,9 @@
             <el-input size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="搜索" @keyup.enter.native="productData(params.content.pageNumber = 1)" @clear="productData(params.content.pageNumber = 1)" clearable></el-input>&nbsp;
           </div>
           <div style="margin-top:-10px;margin-bottom: 10px;float: right">
-            <el-button style="float: right" type="primary" size="mini" @click="batchSelect" :disabled="tableSelectData.length === 0 ">批量添加</el-button>
+            <div>
+              <el-button style="float: right" type="primary" size="mini" @click="batchSelect" :disabled="tableSelectData.length === 0 ">批量添加</el-button>
+            </div>
           </div>
         </div>
         <div class="container">
@@ -254,13 +256,13 @@ export default {
       this.$refs.classShow.queryAgentiInfo()
 
     },
-    async onSubmit(){
+    async onSubmit(data){
       console.log(this.selectData,"添加选择的商品")
       const res = await this.$api.requested({
         "id": 20221021095403,
         "content": {
           "sa_quotedpriceid":this.$route.query.id,     //sat_notice_classid<=0时 为新增
-          "items":this.selectData
+          "items":data
         }
       })
       this.tool.showMessage(res,()=>{
@@ -272,7 +274,7 @@ export default {
       })
     },
     batchSelect(){
-      this.debounce(this.onSubmit,300)()
+      this.debounce(this.onSubmit(this.selectData),300)()
     },
     onSelect(val){
       console.log(val,"选择的商品")
@@ -293,7 +295,7 @@ export default {
       /*this.$nextTick(()=>{
         this.onSubmit()
       })*/
-      this.debounce(this.onSubmit,300)()
+      this.debounce(this.onSubmit(this.selectData),300)()
     },
     debounce (fn, wait) {
       let that = this

+ 24 - 25
src/SDrpManagement/agentOrder/modules/productlist.vue

@@ -197,7 +197,7 @@
         width="300"
         fixed="right">
         <template slot-scope="scope">
-          <el-input type="textarea" :disabled="data.status != '新建'" @blur="onConfirm([scope.row],true)" size="small" v-model="scope.row.remarks" placeholder="请输入备注"></el-input>
+          <el-input type="textarea" :disabled="data.status != '新建'" @blur="onConfirm([scope.row],true,true)" size="small" v-model="scope.row.remarks" placeholder="请输入备注"></el-input>
         </template>
       </el-table-column>
        <el-table-column v-if="data.status === '新建'" width="90" fixed="right">
@@ -253,7 +253,7 @@ export default {
         "content": {
           "sa_orderid": 0, //订单ID
           "pageNumber": 1,
-          "pageSize": 9999,
+          "pageSize": 20,
           "where": {
             "condition": ""
           }
@@ -403,29 +403,28 @@ export default {
       }
     },
     // 订单添加商品
-    async onConfirm (data,edit) {
-      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": data.map(e=>{
-            return {
-              sa_orderitemsid:edit?e.sa_orderitemsid : 0,
-              itemid:e.itemid,
-              qty:e.orderminqty,
-              needdate:e.deliverydate,
-              remarks:e.remarks
-            }
-          })
-        },
-      })
-      this.tool.showMessage(res,()=>{
-        this.drawer = false
-        this.listData()
-        this.$emit('onSuccess')
-      })
+    async onConfirm (data,edit,isupload) {
+      if (isupload) {
+        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": data.map(e=>{
+              return {
+                sa_orderitemsid:edit?e.sa_orderitemsid : 0,
+                itemid:e.itemid,
+                qty:e.orderminqty,
+                needdate:e.deliverydate,
+                remarks:e.remarks
+              }
+            })
+          },
+        })
+      }
+      this.listData()
+      this.$emit('onSuccess')
     },
     async queryBasicInfo () {
       const res = await this.$api.requested({

+ 28 - 27
src/SDrpManagement/salerOrder/modules/productlist.vue

@@ -213,7 +213,7 @@
         width="300"
         fixed="right">
         <template slot-scope="scope">
-          <el-input  type="textarea"  :disabled="data.status != '新建'" @blur="onConfirm([scope.row],true)" size="small" v-model="scope.row.remarks" placeholder="请输入备注"></el-input>
+          <el-input  type="textarea"  :disabled="data.status != '新建'" @blur="onConfirm([scope.row],true,true)" size="small" v-model="scope.row.remarks" placeholder="请输入备注"></el-input>
         </template>
       </el-table-column>
       <el-table-column v-if="data.status === '新建'" width="90" fixed="right">
@@ -269,7 +269,7 @@ export default {
         "content": {
           "sa_orderid": 0, //订单ID
           "pageNumber": 1,
-          "pageSize": 9999,
+          "pageSize": 20,
           "where": {
             "condition": ""
           }
@@ -323,16 +323,18 @@ export default {
       this.tableData = res.data
       this.total = res.total
       this.currentPage = res.pageNumber
+      console.log('成功',res.data);
+      
       this.queryBasicInfo()
     },
     handleSizeChange(val) {
       // console.log(`每页 ${val} 条`);
-      this.params.content.pageSize = val
+      this.param.content.pageSize = val
       this.listData()
     },
     handleCurrentChange(val) {
       // console.log(`当前页: ${val}`);
-      this.params.content.pageNumber = val
+      this.param.content.pageNumber = val
       this.listData()
     },
     async deleteOrderProduct (row) {
@@ -426,29 +428,28 @@ export default {
       }
     },
     // 订单添加商品
-    async onConfirm (data,edit) {
-      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": data.map(e=>{
-            return {
-              sa_orderitemsid:edit?e.sa_orderitemsid : 0,
-              itemid:e.itemid,
-              qty:e.orderminqty,
-              needdate:e.deliverydate,
-              remarks:e.remarks
-            }
-          })
-        },
-      })
-      this.tool.showMessage(res,()=>{
-        this.drawer = false
-        this.listData()
-        this.$emit('onSuccess')
-      })
+    async onConfirm (data,edit,isupload) {
+      if (isupload) {
+        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": data.map(e=>{
+              return {
+                sa_orderitemsid:edit?e.sa_orderitemsid : 0,
+                itemid:e.itemid,
+                qty:e.orderminqty,
+                needdate:e.deliverydate,
+                remarks:e.remarks
+              }
+            })
+          },
+        })
+      }
+      this.listData()
+      this.$emit('onSuccess')
     },
     inputChange (row,index) {
       this.updateOrder({

+ 165 - 0
src/components/uploadAllData/index.vue

@@ -0,0 +1,165 @@
+<template>
+  <div>
+    <el-button type="primary" size="small" class="inline-16" @click="allProduct" v-if="type=='upload'">一 键 选 择</el-button>
+    <el-button type="primary" size="small" class="inline-16" @click="allProduct" v-else>一 键 删 除</el-button>
+    <el-dialog
+      title=""
+      :visible.sync="progressVisible"
+      :show-close="false"
+      append-to-body
+      width="500px">
+      <el-progress v-if="totalPage" :percentage="Math.floor(progress / totalPage * 100)"></el-progress>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: '',
+  data() {
+    return {
+      totalPage:0,
+      progress:0,
+      progressVisible:false,
+      deleteIds:[]
+    };
+  },
+  props: {
+    dataSize: {
+      type:[Number,String],
+      default:() => 200
+    },
+    total: {
+      type:[Number,String],
+      default:() => 0
+    },
+    type: {
+      type:String,
+      default:() => 'upload'
+    },
+    idName: {
+      type: [Number,String]
+    }
+  },
+  computed:{
+  },
+  watch:{
+  },
+  methods: {
+    /* 一键选择所有商品 */
+    allProduct () {
+      if (this.total > this.dataSize) {
+        this.$confirm(`总共有${this.total}个商品,提交时间较长,是否继续`,'提示',{
+          confirmButtonText:'确定',
+          cancelButtonText:'取消',
+          type:'warning'
+        }).then(async () => {
+          this.progressVisible = true
+          this.type == 'upload' ? this.totalPage = Math.ceil(this.total / this.dataSize) * 2 : this.totalPage = Math.ceil(this.total / this.dataSize)
+          let totalPage = Math.ceil(this.total / this.dataSize)
+          for (let index = 1; index <= totalPage; index++) {
+            this.pullData(index)
+          }
+        })
+      } else {
+        this.$confirm(`总共有${this.total}个商品,是否继续`,'提示',{
+          confirmButtonText:'确定',
+          cancelButtonText:'取消',
+          type:'warning'
+        }).then(async () => {
+          if (!this.total) return
+          
+          let pullApi = {}
+          /**
+           * 暴露出去操作 修改拉取请求  
+           * @param pullApi - 拉取数据的请求接口
+          */
+          this.$emit('handlePullApi',pullApi)
+          pullApi.content.pageNumber = 1
+          pullApi.content.pageSize = this.dataSize
+
+          const res = await this.$api.requested(pullApi)
+
+          if (this.type == 'upload') {
+            let uploadApi = {}
+            /**
+             * 暴露出去操作 修改上传请求
+             * @param1 uploadApi - 上传接口
+             * @param2 res.data - 拉取的上传数据
+             */
+            this.$emit('handleUploadApi',uploadApi,res.data)
+
+            const res2 = await this.$api.requested(uploadApi)
+            this.tool.showMessage(res2,() => {
+              this.$emit('onSuccess',res2.data)
+            })
+          } else {
+            this.deleteIds.push(...res.data.map(item => item[this.idName]))
+            this.deleteOrderProduct(this.deleteIds)
+          }
+        })
+      }
+    },
+    /* 拉取数据 */
+    async pullData (page) {
+      let pullApi = {}
+      /**
+       * 暴露出去操作 修改拉取请求  
+       * @param pullApi - 拉取数据的请求接口
+      */
+      this.$emit('handlePullApi',pullApi)
+      pullApi.content.pageNumber = page
+      pullApi.content.pageSize = this.dataSize
+      const res = await this.$api.requested(pullApi)
+      this.progress++
+      if (this.type == 'upload') {
+        this.uploadData(res.data)
+        if (this.progress >= this.totalPage) {
+          this.$emit('onSuccess')
+          this.progressVisible = false
+          this.progress = 0
+        }
+      } else {
+        this.deleteIds.push(...res.data.map(item => item[this.idName]))
+        if (this.progress >= this.totalPage) {
+          this.deleteOrderProduct(this.deleteIds)
+          this.progressVisible = false
+        }
+      }
+      
+      
+    },  
+    /* 添加数据 */
+    async uploadData (data) {
+      let uploadApi = {}
+      /**
+       * 暴露出去操作 修改上传请求
+       * @param1 uploadApi - 上传接口
+       * @param2 res.data - 拉取的上传数据
+       */
+      this.$emit('handleUploadApi',uploadApi,data)
+      const res = await this.$api.requested(uploadApi)
+      this.progress++
+      if (this.progress >= this.totalPage) {
+        this.$emit('onSuccess')
+        this.progressVisible = false
+        this.progress = 0
+      }
+    },
+    /* 删除数据 */
+    async deleteOrderProduct (row) {
+      let delApi = {}
+      this.$emit('handleDelApi',delApi,row)
+      const res = await this.$api.requested(delApi)
+      this.tool.showMessage(res,()=>{
+        this.$emit('onSuccess')
+        this.deleteIds = []
+      })
+    },
+  },
+};
+</script>
+
+<style scoped>
+
+</style>

+ 5 - 4
src/template/orderCanUseProduct/index.vue

@@ -1,7 +1,9 @@
 <template>
 <div>
   <div class="flex-align-center flex-between mt-10">
-    <el-input style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>
+    <div>
+      <el-input class="inline-16" style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>
+    </div>
     <el-button type="primary" size="small" :disabled="tableSelectData.length === 0" @click="onConfirm">添加选中商品</el-button>
   </div>
   <div>
@@ -118,7 +120,7 @@ export default {
       tableSelectData:[],
       tableData: [],
       total:0,
-      currentPage:0
+      currentPage:0,
     }
   },
   components:{
@@ -166,8 +168,7 @@ export default {
     },
     onConfirm () {
       this.params.content.where.condition = ''
-      console.log(this.params.content.where.condition)
-      this.$emit('onConfirm',this.tableSelectData)
+      this.$emit('onConfirm',this.tableSelectData,false,true)
       this.tableSelectData.forEach(v => {
         this.tableData.splice(this.tableData.findIndex(j => j.itemid == v.itemid),1)
       })

+ 2 - 1
vue.config.js

@@ -15,7 +15,8 @@ module.exports = {
       proxy: {
         '/apis': {
           // target: 'http://61.164.207.46:8000',  // target host*/
-          target: 'https://oms.idcgroup.com.cn:8079/',  // target host
+          target: 'http://192.168.3.9:8080',  // target host*/
+          // target: 'https://oms.idcgroup.com.cn:8079/',  // target host
           // target: 'localhost:8080',  // target host
           ws: true,  // proxy websockets 
           changeOrigin: true,  // needed for virtual hosted sites