gjy 3 年之前
父节点
当前提交
1e4199dbd9

+ 3 - 1
src/api/V2/transport/index.js

@@ -53,8 +53,10 @@ export const API_GET_TRANPROCESSINFO = '/tranProcessInfo/getThreeTranProcess'
 export const API_POST_TRANPROCESSINFO = '/tranProcessInfo/api/addTranCar'
 //状态
 export const API_POST_AUTOMOBILE_ALSOSTATE = '/tranProcessInfo/editStatus'
-//运输价格
+//运输价格
 export const API_POST_AUTOMOBILE_TRANPRICE = '/tranProcessInfo/api/setUpTranPrice'
+//运输价格车
+export const API_POST_AUTOMOBILE_TRANPRICE_CAR  = '/tranProcessInfo/api/setUpTranPriceCar'
 // 删除运输车辆
 export const API_POST_DEL_HAULAGE_STAGE= '/tranCarInfo/api/deleteTranCar'
 // 导入

+ 5 - 2
src/model/transport/index.js

@@ -32,7 +32,8 @@ import {
     API_POST_AUTOMOBILE_STATEREC,
     API_GET_IMPORT,
     API_GET_TRANPROCESSINFO,
-    API_POST_TRANPROCESSINFO
+    API_POST_TRANPROCESSINFO,
+    API_POST_AUTOMOBILE_TRANPRICE_CAR
 } from '@/api/V2/transport'
 // 司机列表
 export const selectDriver = appRx.get(API_GET_TRAN_DRIVERINFO, errorCatcher, errorHandle, filter)
@@ -88,8 +89,10 @@ export const gettranprocessinfo = appRx.get(API_GET_TRANPROCESSINFO, errorCatche
 export const posttranprocessinfo = appRx.post(API_POST_TRANPROCESSINFO, errorCatcher, errorHandle, filter)
 //状态
 export const alsostate = appRx.post(API_POST_AUTOMOBILE_ALSOSTATE, errorCatcher, errorHandle, filter)
-//设置运输价格
+//设置运输价格
 export const setUpTranPrice = appRx.post(API_POST_AUTOMOBILE_TRANPRICE, errorCatcher, errorHandle, filter)
+//设置运输价格车
+export const setUpTranPriceCar = appRx.post(API_POST_AUTOMOBILE_TRANPRICE_CAR, errorCatcher, errorHandle, filter)
 //删除车辆
 export const delhaulagestage = appRx.post(API_POST_DEL_HAULAGE_STAGE, errorCatcher, errorHandle, filter)
 // 导入

+ 202 - 35
src/views/tranManagement/tranManagementVehicleDispatching.vue

@@ -84,27 +84,47 @@
               </el-form-item>
             </el-col>
           </el-row>
-          <div class="small-title" style="font-size: 16px">派车</div>
+          <div class="small-title" style="font-size: 16px">派车
+            <el-radio-group @change='pricetypechange' v-model="pricetype">
+              <el-radio label="1">元/吨计费</el-radio>
+              <el-radio label="2">元/车计费</el-radio>
+            </el-radio-group></div>
+          
           <div class="myTest">
-            <el-form-item label="当前运输单价(元/吨):" prop="tranPrice" label-width="150px" class="input-item-margin">
+            
+            <el-form-item v-if='pricetype==1' label="当前运输单价(元/吨):" prop="tranPrice" label-width="150px" class="input-item-margin">
               <el-input v-model="deptBudgetList.tranPrice" maxlength="70" disabled />
             </el-form-item>
-            <el-form-item label="审核中的运输总价(元/吨):" prop="tranPriceIng" label-width="180px" class="input-item-margin">
+            <el-form-item v-else label="当前运输单价(元/车):" prop="tranPrice" label-width="150px" class="input-item-margin">
+              <el-input v-model="deptBudgetList.tranPriceCar" maxlength="70" disabled />
+            </el-form-item>
+            <el-form-item v-if='pricetype==1' label="审核中的运输总价(元/吨):" prop="tranPriceIng" label-width="180px" class="input-item-margin">
               <el-input v-if="deptBudgetList.priceStatus=='审核中'" :disabled="readonly"
                 v-model="deptBudgetList.tranPriceIng" maxlength="70" />
               <el-input v-else v-model="deptBudgetList.tranPriceIng" maxlength="70" />
             </el-form-item>
+            <el-form-item v-else label="审核中的运输总价(元/车):" prop="tranPriceIng" label-width="180px" class="input-item-margin">
+              <el-input v-if="deptBudgetList.priceStatusCar=='审核中'" :disabled="readonly"
+                v-model="deptBudgetList.tranPriceIngCar" maxlength="70" />
+              <el-input v-else v-model="deptBudgetList.tranPriceIngCar" maxlength="70" />
+            </el-form-item>
             <div class="input-item-margin">
-              <div v-if="deptBudgetList.priceStatus=='审核中'">
+              <div v-if="deptBudgetList.priceStatus=='审核中'&&pricetype==1">
+                <el-button type="primary" v-hasPermission="`tranManager.vehicleDispatching.reprice`" size="small"
+                  @click="examine()">审核中
+                </el-button>
+              </div>
+              <el-button v-if="deptBudgetList.priceStatus!='审核中'&&pricetype==1" type="primary" @click="priceSubmit()">提交</el-button>
+              <div v-if="deptBudgetList.priceStatusCar=='审核中'&&pricetype==2">
                 <el-button type="primary" v-hasPermission="`tranManager.vehicleDispatching.reprice`" size="small"
                   @click="examine()">审核中
                 </el-button>
               </div>
-              <el-button v-else type="primary" @click="priceSubmit()">提交</el-button>
+              <el-button v-if="deptBudgetList.priceStatusCar!='审核中'&&pricetype==2" type="primary" @click="priceSubmit()">提交</el-button>
             </div>
           </div>
           <div class="content3" v-for="(item, index) in deptBudgetList.tranCarInfoList" :key="index">
-            <div class="content3-item1">
+            <div v-if='item.fleetFlag==0' class="content3-item1">
 
               <div class="">
                 <span style="margin-left: 30px;font-weight: 600;">司机-{{ index + 1 }}</span>
@@ -196,12 +216,38 @@
                 </el-form-item>
               </el-col>
               <el-col :span="8">
-                <el-form-item label="运输单价(元/吨):" span="1" prop="carModel" label-width="125px">
+                <el-form-item v-if='item.billingMethod==1' label="运输单价(元/吨):" span="1" prop="carModel" label-width="125px">
                   <el-input :disabled="readonly" v-model="item.tranPrice" size="small" />
                 </el-form-item>
+                <el-form-item v-else label="运输单价(元/车):" span="1" prop="carModel" label-width="125px">
+                  <el-input :disabled="readonly" v-model="item.tranPriceCar" size="small" />
+                </el-form-item>
               </el-col>
               <span v-if="item.status == '未装车'||item.temporaryDriverFlag!=0" width="22" height="22" class="del"
-                @click="del(index, item)" src="../../../public/img/del.png" alt="">×</span>
+                @click="del(index, item,0)" src="../../../public/img/del.png" alt="">×</span>
+            </div>
+
+
+          </div>
+          <div class="contentitem" v-for="(item, index) in teamlist" :key="'team'+index">
+            <div class="content3-item1">
+              <el-col :span="8">
+                <!-- <span style="margin-left: 30px;font-weight: 600;">车队-{{ index + 1 }}</span> -->
+                 <el-form-item  :label="'车队-'+(index + 1 )" span="1" prop="carModel" label-width="125px">
+                  <el-input :disabled="item.id?true:false" v-model="item.fleetName" size="small" />
+                </el-form-item>
+              </el-col>
+              
+              <el-col :span="8">
+                <el-form-item v-if='item.billingMethod==1' label="运输单价(元/吨):" span="1" prop="carModel" label-width="125px">
+                  <el-input :disabled="readonly" v-model="item.tranPrice" size="small" />
+                </el-form-item>
+                <el-form-item v-else label="运输单价(元/车):" span="1" prop="carModel" label-width="125px">
+                  <el-input :disabled="readonly" v-model="item.tranPriceCar" size="small" />
+                </el-form-item>
+              </el-col>
+              <span v-if="!item.id" width="22" height="22" class="del"
+                @click="del(index, item,1)" src="../../../public/img/del.png" alt="">×</span>
             </div>
 
 
@@ -213,6 +259,10 @@
             <!-- <img width="22" height="22" src="../../../public/img/add.png" alt="" /> -->
             <div class="spans">添加司机</div>
           </el-button>
+          <el-button class="add" type="primary" size="small" @click="addteam()">
+            <!-- <img width="22" height="22" src="../../../public/img/add.png" alt="" /> -->
+            <div class="spans">添加车队</div>
+          </el-button>
           <div style="text-align: right; padding: 10px">
             <el-button class="bg-bottom-up" type="primary" size="small" @click="submit()">提交</el-button>
           </div>
@@ -230,7 +280,8 @@
     arrange,
     dispatchCat,
     delhaulagestage,
-    setUpTranPrice
+    setUpTranPrice,
+    setUpTranPriceCar
   } from '@/model/transport/index'
   // import { dayjs, fmoney, EventBus } from 'base-core-lib'
   import {
@@ -260,6 +311,7 @@
         deptBudgetTotal: 0,
         currentPage: 1,
         pageSize: 10,
+        pricetype:'1',
         searchType: 1,
         startDate: null,
         endDate: null,
@@ -293,15 +345,44 @@
         if (this.deptBudgetList.tranCarInfoList.length > 0) {
           var maxStorage = 0
           for (var i = 0; i < this.deptBudgetList.tranCarInfoList.length; i++) {
-            maxStorage += Number(
-              this.deptBudgetList.tranCarInfoList[i].loadWeight
-            )
+            if(this.deptBudgetList.tranCarInfoList[i].loadWeight){
+              maxStorage += Number(
+                this.deptBudgetList.tranCarInfoList[i].loadWeight
+              )
+            }
+            
           }
           return maxStorage
         }
       },
+      teamlist: function() {
+        if (this.deptBudgetList.tranCarInfoList.length > 0) {
+          var arr = []
+          for (var i = 0; i < this.deptBudgetList.tranCarInfoList.length; i++) {
+            if(this.deptBudgetList.tranCarInfoList[i].fleetFlag==1){
+              arr.push(this.deptBudgetList.tranCarInfoList[i])
+            }
+          }
+          return arr
+        }
+      },
     },
     methods: {
+      pricetypechange(e){
+        this.deptBudgetList.billingMethod=e
+        if (this.deptBudgetList.tranCarInfoList.length > 0) {
+          for (var i = 0; i < this.deptBudgetList.tranCarInfoList.length; i++) {
+           if(!this.deptBudgetList.tranCarInfoList[i].id){
+             this.deptBudgetList.tranCarInfoList[i].billingMethod=e
+             if(e==1){
+               this.deptBudgetList.tranCarInfoList[i].tranPrice=this.deptBudgetList.tranPrice
+             }else{
+               this.deptBudgetList.tranCarInfoList[i].tranPriceCar=this.deptBudgetList.tranPriceCar
+             }
+           }
+          }
+        }
+      },
       clearBlur(e) {
         let k = this.$refs.driverSelect
         if (!e) {
@@ -314,21 +395,35 @@
       revert() {
         this.$router.go(-1)
       },
-      del(index, row) {
+      del(index, row,status) {
         if (row.status == null) {
-          if (this.deptBudgetList.tranCarInfoList.length > 1) {
-            this.deptBudgetList.tranCarInfoList.splice(index, 1)
-            for (let i = index; i < this.deptBudgetList.tranCarInfoList.length; i++) {
-              let number = Number(this.deptBudgetList.tranCarInfoList[i].tranCarNo.split('C')[1]) - 1
-              if (number < 10) {
-                this.deptBudgetList.tranCarInfoList[i].tranCarNo = "C00" + number
-              } else if (number < 100) {
-                this.deptBudgetList.tranCarInfoList[i].tranCarNo = "C0" + number
-              } else {
-                this.deptBudgetList.tranCarInfoList[i].tranCarNo = "C" + number
+          if(status==1){
+            if (this.deptBudgetList.tranCarInfoList.length > 1) {
+              for (let i = 0; i < this.deptBudgetList.tranCarInfoList.length; i++) {
+                console.log(this.deptBudgetList.tranCarInfoList[i])
+                if(this.deptBudgetList.tranCarInfoList[i].index){
+                  if(this.deptBudgetList.tranCarInfoList[i].index==row.index){
+                    this.deptBudgetList.tranCarInfoList.splice(i, 1)
+                  }
+                }
+              }
+            }
+          }else{
+            if (this.deptBudgetList.tranCarInfoList.length > 1) {
+              this.deptBudgetList.tranCarInfoList.splice(index, 1)
+              for (let i = index; i < this.deptBudgetList.tranCarInfoList.length; i++) {
+                let number = Number(this.deptBudgetList.tranCarInfoList[i].tranCarNo.split('C')[1]) - 1
+                if (number < 10) {
+                  this.deptBudgetList.tranCarInfoList[i].tranCarNo = "C00" + number
+                } else if (number < 100) {
+                  this.deptBudgetList.tranCarInfoList[i].tranCarNo = "C0" + number
+                } else {
+                  this.deptBudgetList.tranCarInfoList[i].tranCarNo = "C" + number
+                }
               }
             }
           }
+          
         } else {
           this.$confirm('派车信息删除后不可恢复,是否确定删除?', '提示', {
             confirmButtonText: '确定',
@@ -349,6 +444,25 @@
           })
         }
       },
+      addteam(){
+         if (!this.deptBudgetList.tranPrice) {
+          this.$message({
+            message: '请设置运输单价!',
+            type: 'warning',
+          })
+        } else {
+            this.deptBudgetList.tranCarInfoList.push({
+              fleetName:'',
+              fleetFlag:1,
+              index:this.deptBudgetList.tranCarInfoList.length,
+              billingMethod:this.pricetype,
+              tranPrice: this.deptBudgetList.tranPrice,
+              tranPriceCar:this.deptBudgetList.tranPriceCar,
+              tranType: '1',
+            })
+         
+        }
+      },
       add() {
         if (!this.deptBudgetList.tranPrice) {
           this.$message({
@@ -370,6 +484,9 @@
               carNumber: '',
               disabled: false,
               tranType: '1',
+              fleetFlag:0,
+              tranPriceCar:this.deptBudgetList.tranPriceCar,
+              billingMethod:this.pricetype,
               // tranCarNo: tmp1+(this.deptBudgetList.count),
               tranCarNo: "C00" + (this.deptBudgetList.tranCarInfoList.length + 1),
               tranPrice: this.deptBudgetList.tranPrice
@@ -388,7 +505,10 @@
               carModelKey: '',
               carNumber: '',
               disabled: false,
+              fleetFlag:0,
               tranType: '1',
+              tranPriceCar:this.deptBudgetList.tranPriceCar,
+              billingMethod:this.pricetype,
               // tranCarNo: tmp1+(this.deptBudgetList.count),
               tranCarNo: "C0" + (this.deptBudgetList.tranCarInfoList.length + 1),
               tranPrice: this.deptBudgetList.tranPrice
@@ -407,7 +527,10 @@
               carModelKey: '',
               carNumber: '',
               disabled: false,
+              fleetFlag:0,
               tranType: '1',
+              billingMethod:this.pricetype,
+              tranPriceCar:this.deptBudgetList.tranPriceCar,
               // tranCarNo: tmp1+(this.deptBudgetList.count),
               tranCarNo: "C" + (this.deptBudgetList.tranCarInfoList.length + 1),
               tranPrice: this.deptBudgetList.tranPrice
@@ -420,7 +543,7 @@
         this.$prompt('运输单价审核', {
           cancelButtonText: '取消',
           confirmButtonText: '确定',
-          inputValue: this.deptBudgetList.tranPriceIng
+          inputValue: this.deptBudgetList.billingMethod==1?this.deptBudgetList.tranPriceIng:this.deptBudgetList.tranPriceIngCar
         }).then(({
           value
         }) => {
@@ -429,14 +552,25 @@
             localStorage.getItem('ws-pf_staffName')
           tranProcessInfo.id = this.deptBudgetList.id
           tranProcessInfo.flag = "2"
-          tranProcessInfo.tranPriceIng = value
           tranProcessInfo.tranTypeKey = 1
-          setUpTranPrice(tranProcessInfo)
-            .toPromise()
-            .then((response) => {
-              this.$message.success('审核成功')
-              this.getList()
-            });
+          tranProcessInfo.billingMethod= this.deptBudgetList.billingMethod
+          if(this.deptBudgetList.billingMethod==2){
+             tranProcessInfo.tranPriceIngCar=value
+              setUpTranPriceCar(tranProcessInfo)
+              .toPromise()
+              .then((response) => {
+                this.$message.success('提交成功')
+                this.getList()
+              })
+            }else{
+              tranProcessInfo.tranPriceIng = value
+              setUpTranPrice(tranProcessInfo)
+                .toPromise()
+                .then((response) => {
+                  this.$message.success('审核成功')
+                  this.getList()
+                });
+            }
         }).catch(() => {
           this.$message.warning(
             '取消审核'
@@ -455,12 +589,24 @@
             tranProcessInfo.flag = "1"
             tranProcessInfo.tranTypeKey = 1
             tranProcessInfo.tranPriceIng = this.deptBudgetList.tranPriceIng
-            setUpTranPrice(tranProcessInfo)
+            tranProcessInfo.billingMethod= this.deptBudgetList.billingMethod
+            tranProcessInfo.tranPriceIngCar = this.deptBudgetList.tranPriceIngCar
+            if(this.deptBudgetList.billingMethod==2){
+              setUpTranPriceCar(tranProcessInfo)
               .toPromise()
               .then((response) => {
                 this.$message.success('提交成功')
                 this.getList()
               })
+            }else{
+              setUpTranPrice(tranProcessInfo)
+              .toPromise()
+              .then((response) => {
+                this.$message.success('提交成功')
+                this.getList()
+              })
+            }
+            
           })
           .catch(() => {
             return false
@@ -475,13 +621,27 @@
           })
         } else {
           for (var i = this.index; i < this.deptBudgetList.tranCarInfoList.length; i++) {
-            if (!this.deptBudgetList.tranCarInfoList[i].driver) {
+            if (!this.deptBudgetList.tranCarInfoList[i].driver&&this.deptBudgetList.tranCarInfoList[i].fleetFlag==0) {
               this.$message({
                 message: '姓名不能为空!',
                 type: 'warning',
               })
               return
             }
+            if (!this.deptBudgetList.tranCarInfoList[i].fleetName&&this.deptBudgetList.tranCarInfoList[i].fleetFlag==1) {
+              this.$message({
+                message: '车队名称不能为空!',
+                type: 'warning',
+              })
+              return
+            }
+            if (this.deptBudgetList.tranCarInfoList[i].fleetName&&this.deptBudgetList.tranCarInfoList[i].fleetName.length<1&&this.deptBudgetList.tranCarInfoList[i].fleetFlag==1||this.deptBudgetList.tranCarInfoList[i].fleetName&&this.deptBudgetList.tranCarInfoList[i].fleetName.length>10&&this.deptBudgetList.tranCarInfoList[i].fleetFlag==1) {
+              this.$message({
+                message: '车队名称1-10个字!',
+                type: 'warning',
+              })
+              return
+            }
             for (var j = 0; j < this.carList.length; j++) {
               if (this.carList[j].driverName == this.deptBudgetList.tranCarInfoList[i].driver && this.carList[j]
                 .disableStatusFlag == 1) {
@@ -545,6 +705,7 @@
             }
 
             this.deptBudgetList = response
+            console.log(this.deptBudgetList)
             this.fhaddress = response.sendPrivate + response.sendCity + response.sendArea + response
               .sendDetailedAddress
             this.shaddress = response.receivePrivate + response.receiveCity + response.receiveArea + response
@@ -563,8 +724,10 @@
                 carModelKey: '',
                 carNumber: '',
                 disabled: false,
+                fleetFlag:0,
                 tranType: '1',
                 tranCarNo: 'C001',
+                billingMethod:1,
                 tranPrice: this.deptBudgetList.tranPrice
               }, ]
             }
@@ -949,7 +1112,7 @@
     width: 33.333%;
   }
 
-  .content3 {
+  .content3 ,.contentitem{
     width: calc(100% + 20px);
 
     .content3-item1 {
@@ -963,7 +1126,11 @@
       margin-top: 20px;
     }
   }
-
+.contentitem{
+    .content3-item1 {
+      height: 90px;
+    }
+}
   .content4 {
     background: #F5F7FA;
     display: flex;

+ 32 - 0
src/views/tranManagement/tranManagementVehicleLook.vue

@@ -247,6 +247,25 @@
           ></ws-form-item> -->
         </ws-info-table>
       </div>
+       <div
+        style="width: 100%"
+        class="driver"
+        v-for="(item, index) in teamlist"
+        :key="'team'+index"
+      >
+        <ws-info-table>
+          <el-form-item  :label="'车队-'+(index + 1 )" span="1" prop="carModel" label-width="125px">
+            <el-input :disabled="item.id?true:false" v-model="item.fleetName" size="small" />
+          </el-form-item>
+          <el-form-item v-if='item.billingMethod==1' label="运输单价(元/吨):" span="1" prop="carModel" label-width="125px">
+            <el-input :disabled="readonly" v-model="item.tranPrice" size="small" />
+          </el-form-item>
+          <el-form-item v-else label="运输单价(元/车):" span="1" prop="carModel" label-width="125px">
+            <el-input :disabled="readonly" v-model="item.tranPrice" size="small" />
+          </el-form-item>
+        </ws-info-table>
+      </div>
+
     </ws-form>
     <div style="text-align: right; padding: 10px">
       <el-button
@@ -331,6 +350,19 @@ export default {
   activated() {
     this.getList()
   },
+  computed: {
+      teamlist: function() {
+        if (this.deptBudgetList.tranCarInfoList.length > 0) {
+          var arr = []
+          for (var i = 0; i < this.deptBudgetList.tranCarInfoList.length; i++) {
+            if(this.deptBudgetList.tranCarInfoList[i].fleetFlag==1){
+              arr.push(this.deptBudgetList.tranCarInfoList[i])
+            }
+          }
+          return arr
+        }
+      },
+    },
   methods: {
     //返回按钮
     revert() {