liyg 2 tahun lalu
induk
melakukan
dc6eb8a202

+ 113 - 1
src/views/statisticalReport/components/salesLogisticsStatistics/saleSteelReports.vue

@@ -154,6 +154,16 @@
             操作日志
           </el-button>
         </el-form-item>
+        <el-form-item v-if="isShowOperate">
+          <el-button
+            type="primary"
+            @click="showBatchCapacity()"
+            v-if="!notRoutList.includes('batchCapacity')"
+          >
+            <i class="el-icon-edit"></i>
+            批量改车
+          </el-button>
+        </el-form-item>
         <el-form-item>
           <label
             class="el-form-item__label"
@@ -1378,6 +1388,23 @@
         <dil-table v-bind.sync="optionSaleLog"></dil-table>
       </el-dialog>
     </div>
+    <el-dialog :visible.sync="batchCapacityVisible" width="30%" center>
+      <div>批量修改车牌号</div>
+      <el-form>
+        <el-form-item>
+          <el-autocomplete
+            style="width:250px"
+            v-model="capacityNo"
+            :fetch-suggestions="querySearch"
+            placeholder="请输入车牌号"
+            @select="batchCapacitySelect"
+          >
+          </el-autocomplete>
+        </el-form-item>
+      </el-form>
+      <el-button @click="batchCapacityVisible = false">取 消</el-button>
+      <el-button type="primary" @click="batchEditCapacity">确 定</el-button>
+    </el-dialog>
   </div>
 </template>
 
@@ -1394,6 +1421,10 @@ export default {
   },
   data() {
     return {
+      capacityNo:null,
+      capacityId:null,
+      batchCapacityList:[],
+      batchCapacityVisible:false,
       isShowSaleLog: false,
       optionSaleLog: {
         maxHeight: 400,
@@ -1737,7 +1768,8 @@ export default {
         'select',
         'exceptionHandle',
         'mergeSplit',
-        'saleLog'
+        'saleLog',
+        'batchCapacity'
       ]
       this.noticeInterval = setInterval(() => {
         this.getinformation()
@@ -1851,6 +1883,86 @@ export default {
   },
   computed: {},
   methods: {
+    showBatchCapacity(){
+      this.capacityNo=null;
+      this.capacityId=null;
+      this.batchCapacityList=[];
+      console.log(this.$refs.tableRef.selection);
+      //按照saleOrderMaterialId查询物资数量
+      this.$refs.tableRef.selection.forEach(item1=>{
+        item1.size=this.visibleList.filter(item2=>{
+          return item1.saleOrderMaterialId==item2.saleOrderMaterialId
+        }).length;
+      });
+      this.batchCapacityList = this.$refs.tableRef.selection;
+      console.log(this.batchCapacityList);
+      if (this.batchCapacityList.length > 0) {
+        this.batchCapacityVisible = true
+      } else {
+        this.$message({
+          type: 'warning',
+          message: '请选择要批量更改车牌号的订单',
+          offset: '250',
+          duration: '2500'
+        })
+      }
+    },
+    batchCapacitySelect(selection){
+      console.log(selection);
+      this.capacityNo=selection.capacityNumber;
+      this.capacityId=selection.capacityId;
+    },
+    batchEditCapacity(){
+      if(this.capacityId && this.capacityNo){
+        if(!( 
+          isVehicleNumber(this.capacityNo) ||this.capacityNo == '取消' ||
+          this.capacityNo == '待定' || this.capacityNo == '空白'
+          )
+        ){
+            this.$message.error('请输入正确格式的车牌号!')
+            return
+        }
+        this.batchCapacityList.forEach(row=>{
+            row.capacityId = this.capacityId; 
+            row.capacityNumber = this.capacityNo;
+            //是否校验GPS
+            row.isCheckGPS = this.isCheckGPS;
+            row.userId = getCookie('userId')
+            if (row.capacityIds != 0) {
+              this.axios
+                .post('/api/v1/ams/updateCapacityNumberInFactory', row)
+                .then(res => {
+                  if (res.data.code == 200) {
+                    console.log(res.data)
+                  } else {
+                     this.$message.error(res.data.data)
+                  }
+                })
+            } else {
+              if (row.carrierIds == 0) {
+                this.$message.error('请先授权承运商!')
+                return
+              }
+              row.lineId = this.lineSpelling[row.size]
+              let arr = []
+              arr.push(row)
+              this.axios
+                .post('/api/v1/ams/dispatchSteelOrder', arr)
+                .then(res => {
+                  if (res.data.code == '200') {
+                    this.$message.success('派车成功!')
+                  }else{
+                    this.$message.error(res.data.data)
+                  }
+                })
+            }
+        });
+        this.batchCapacityVisible=false;
+        this.getSteelReport()
+      }else{
+        this.$message.warning('请先注册车牌号或者选中弹出后再提交!')
+      }
+    },
     showSaleLog() {
       this.isShowSaleLog = true
       if (this.steelMap) {