Răsfoiți Sursa

feat: 新增危险危物处置及车辆地图功能

- 新增危险危物处置委外来源类型及合同分类
- 委外发货单新增运输清单页签及相关校验
- 新增车辆位置API及地图追踪页面
- 修复采购订单来源合同金额计算逻辑
- 格式化合同管理代码
yusheng 1 lună în urmă
părinte
comite
3bf68811b8

+ 18 - 0
src/api/transportManager/carBook/index.js

@@ -57,3 +57,21 @@ export async function carSubmit(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+// 批量获取车辆位置
+export async function carCurrentAll(data) {
+  const res = await request.post('/eom/logistictrakledger/batch/current', data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取车辆最新位置
+export async function carCurrent(data) {
+  const res = await request.post('/eom/logistictrakledger/current', data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

BIN
src/assets/car.png


+ 1 - 0
src/enum/dict.js

@@ -388,6 +388,7 @@ export const requirementSourceType = [
   { value: '7', label: '外协客供料采购' },
   { value: '8', label: '退货委外' },
   { value: '9', label: '委外返修' },
+  { value: '10', label: '危险危物处置委外' },
   { value: '99', label: '其他' }
 ];
 //商品级别

+ 188 - 89
src/views/contractManage/contractBook/components/addDialog.vue

@@ -215,7 +215,7 @@
           <el-form-item prop="contractFile" label="合同附件">
             <fileMain v-model="form.fileId"></fileMain>
           </el-form-item>
-          
+
           <!-- <el-form-item prop="productionRequirements" label="生产要求">
             <el-input
               clearable
@@ -301,7 +301,7 @@
               @selfChange="salesmanChange"
               :init="false"
             />
-          </el-form-item> 
+          </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="交易方式" prop="transactionMode">
@@ -320,7 +320,10 @@
               </el-option>
             </el-select>
           </el-form-item>
-          <el-form-item :label="form.type == 2 ? '收货模式' : '发货模式'" prop="deliveryMode">
+          <el-form-item
+            :label="form.type == 2 ? '收货模式' : '发货模式'"
+            prop="deliveryMode"
+          >
             <el-select
               v-model="form.deliveryMode"
               placeholder="请选择"
@@ -347,7 +350,11 @@
             >
             </DictSelection>
           </el-form-item>
-          <el-form-item v-if="form.settlementMode == 1" label="结算日期范围" prop="settlementDate">
+          <el-form-item
+            v-if="form.settlementMode == 1"
+            label="结算日期范围"
+            prop="settlementDate"
+          >
             <!-- <el-date-picker
               v-model="form.contractStartDate"
               @change="setDeliveryDays"
@@ -365,11 +372,16 @@
               range-separator="至"
               start-placeholder="开始日期"
               end-placeholder="结束日期"
-              @change="settlementDateChange">
+              @change="settlementDateChange"
+            >
             </el-date-picker>
           </el-form-item>
 
-          <el-form-item v-if="form.settlementMode == 2" label="结算月份范围" prop="settlementDate">
+          <el-form-item
+            v-if="form.settlementMode == 2"
+            label="结算月份范围"
+            prop="settlementDate"
+          >
             <!-- <el-date-picker
               v-model="form.contractEndDate"
               type="date"
@@ -390,17 +402,30 @@
             >
             </el-date-picker>
           </el-form-item>
-          <el-form-item  v-if="form.settlementMode == 2" label="收款日期" prop="receiptDate">
-            <el-input type="number" :min="1" :max="31" placeholder="请输入" v-model="form.receiptDate" @input="receiptDateChange">
+          <el-form-item
+            v-if="form.settlementMode == 2"
+            label="收款日期"
+            prop="receiptDate"
+          >
+            <el-input
+              type="number"
+              :min="1"
+              :max="31"
+              placeholder="请输入"
+              v-model="form.receiptDate"
+              @input="receiptDateChange"
+            >
               <template slot="prepend">每月</template>
               <template slot="append">日</template>
             </el-input>
           </el-form-item>
-          <el-form-item
-            label="期数"
-            prop="issueNumber"
-          >
-            <el-input type="number" :min="1" v-model="form.issueNumber" @input="issueNumberChange">
+          <el-form-item label="期数" prop="issueNumber">
+            <el-input
+              type="number"
+              :min="1"
+              v-model="form.issueNumber"
+              @input="issueNumberChange"
+            >
               <template slot="append">
                 <span>期</span>
               </template>
@@ -698,7 +723,7 @@
         style="margin-top: 30px"
       ></headerTitle>
       <!-- <paymentList ref="paymentListTable" /> -->
-       <PaymentCollectionPlan
+      <PaymentCollectionPlan
         ref="paymentCollectionPlanRef"
         :menu="form.type == '2' ? 'purchase' : 'sale'"
         :info="form"
@@ -829,8 +854,12 @@
   import { listCode, getCode } from '@/components/addDoc/api/index.js';
   import saleOrderListDialog from '@/views/saleManage/saleOrder/invoice/components/orderListDialog.vue'; //销售订单
   import { getSaleOrderDetail } from '@/api/saleManage/saleorder';
-  import PaymentCollectionPlan from '@/BIZComponents/paymentCollectionPlan/Index.vue'
-  import { shippingModeOp, shippingModePurchaseOp, transactionMethodsOp } from '@/enum/dict.js';
+  import PaymentCollectionPlan from '@/BIZComponents/paymentCollectionPlan/Index.vue';
+  import {
+    shippingModeOp,
+    shippingModePurchaseOp,
+    transactionMethodsOp
+  } from '@/enum/dict.js';
   import { parameterGetByCode } from '@/api/main/index.js';
 
   export default {
@@ -1002,6 +1031,11 @@
             code: 7,
             name: '销售订单',
             parentId: '1'
+          },
+          {
+            code: 8,
+            name: '危险危物处置单',
+            parentId: '2'
           }
         ],
         categoryList: [],
@@ -1041,7 +1075,7 @@
         // 组织机构平铺数据
         groupData: [],
         companyInfo: {},
-        defaultTransactionMode: 1,
+        defaultTransactionMode: 1
       };
     },
     computed: {
@@ -1126,11 +1160,19 @@
             { validator: this.validateEndDate, trigger: 'blur' }
           ],
           businessDeptId: [
-            { required: this.form.type == 1 ? true : false, message: '请选择', trigger: 'change' }
+            {
+              required: this.form.type == 1 ? true : false,
+              message: '请选择',
+              trigger: 'change'
+            }
           ],
           businessUserId: [
-            { required: this.form.type == 1 ? true : false, message: '请选择', trigger: 'change' }
-          ],
+            {
+              required: this.form.type == 1 ? true : false,
+              message: '请选择',
+              trigger: 'change'
+            }
+          ]
         };
       }
     },
@@ -1285,7 +1327,9 @@
         this.loading = true;
         const data = await getDetail(id);
         let { contractVO } = data;
-        contractVO.settlementDate = contractVO.startSettlementDate ? [contractVO.startSettlementDate, contractVO.endSettlementDate] : [];
+        contractVO.settlementDate = contractVO.startSettlementDate
+          ? [contractVO.startSettlementDate, contractVO.endSettlementDate]
+          : [];
         this.form = contractVO;
 
         this.loading = false;
@@ -1311,12 +1355,13 @@
             //   this.$refs.paymentListTable.setDiscountAmount(
             //     contractVO.discountTotalPrice
             //   );
-            
+
             const receiptData = {
               receiptPaymentList: data.receiptPaymentList,
               payAmount: contractVO.discountTotalPrice
-            }
-            this.$refs.paymentCollectionPlanRef && this.$refs.paymentCollectionPlanRef.putTableValue(receiptData);
+            };
+            this.$refs.paymentCollectionPlanRef &&
+              this.$refs.paymentCollectionPlanRef.putTableValue(receiptData);
             this.$refs.rawDetailListRef &&
               this.$refs.rawDetailListRef.putTableValueNew(contractVO.rawList); //原料
             this.$refs.outputDetailListRef &&
@@ -1397,8 +1442,10 @@
           categoryId: '',
           businessDeptId: this.form.type == 2 ? this.companyInfo.groupId : '',
           businessDeptName: this.form.type == 2 ? this.companyInfo.name : '',
-          businessUserId: this.form.type == 2 ? this.$store.state.user.info?.id : '',
-          businessUserName: this.form.type == 2 ? this.$store.state.user.info?.name : '',
+          businessUserId:
+            this.form.type == 2 ? this.$store.state.user.info?.id : '',
+          businessUserName:
+            this.form.type == 2 ? this.$store.state.user.info?.name : '',
           transactionMode: this.defaultTransactionMode,
           settlementDate: [],
           issueNumber: 1,
@@ -1408,9 +1455,9 @@
           startSettlementDate: ''
         });
         this.$nextTick(() => {
-          this.getBusinessUser(this.form.businessDeptId)
-        })
-        
+          this.getBusinessUser(this.form.businessDeptId);
+        });
+
         console.log('form~~~', this.form);
         this.getEnterprise();
         this.changePersonel();
@@ -1490,13 +1537,9 @@
       },
 
       // 交易方式改变
-      transactionModeChange(v) {
-
-      }, 
+      transactionModeChange(v) {},
       // 配送方式改变
-      deliveryModeChange(v) {
-
-      }, 
+      deliveryModeChange(v) {},
 
       // 结算方式改变
       settlementModeChange(v) {
@@ -1505,13 +1548,16 @@
         // this.$set(this.form, 'issueNumber', 1);
         this.$set(this.form, 'settlementDate', []);
         this.$set(this.form, 'receiptDate', 1);
-        
-        if(v.dictCode == 3) {
+
+        if (v.dictCode == 3) {
           this.$set(this.form, 'issueNumber', 2);
         } else {
           this.$set(this.form, 'issueNumber', 1);
         }
-        this.$refs.paymentCollectionPlanRef.defaultList(v.dictCode, this.form.issueNumber);
+        this.$refs.paymentCollectionPlanRef.defaultList(
+          v.dictCode,
+          this.form.issueNumber
+        );
       },
 
       //选择合同分类
@@ -1645,7 +1691,7 @@
       },
 
       async open(type, row, create = false, source) {
-        console.log('row~~~', row)
+        console.log('row~~~', row);
         this.title = type === 'add' ? '新增' : '修改';
         this.activeName = '1';
         this.row = row;
@@ -1653,9 +1699,12 @@
         this.create = create;
         this.source = source;
         this.contractBookTypeList = copyObj(this.categoryTreeList[0].children);
-        console.log('contractBookTypeList!!!', this.contractBookTypeList)
+        console.log('contractBookTypeList!!!', this.contractBookTypeList);
         if (type == 'add') {
-          console.log('this.defaultTransactionMode!!!', this.defaultTransactionMode)
+          console.log(
+            'this.defaultTransactionMode!!!',
+            this.defaultTransactionMode
+          );
           let userInfo = this.$store.getters.user.info;
           this.form.transactionMode = this.defaultTransactionMode;
           this.isUpdate = false;
@@ -1679,13 +1728,13 @@
           }
 
           // this.$nextTick(() => {
-            // this.$refs.paymentListTable.defaultList();
+          // this.$refs.paymentListTable.defaultList();
           this.$nextTick(() => {
             this.issueNumberChange(this.form.issueNumber);
-          })
+          });
           // });
           if (this.curNodeData?.id) {
-            console.log('44444444', this.curNodeData)
+            console.log('44444444', this.curNodeData);
             this.form.type =
               this.curNodeData.parentCode || this.curNodeData.code;
             this.dictChange(this.form.type);
@@ -1722,7 +1771,6 @@
                 );
               }
               if (source == 'quotation') {
-                
                 //报价单是否生成过合同
                 let res = await BJisHasGeneratedContractAPI(
                   row.contractVO.sourceId
@@ -1748,13 +1796,16 @@
           contractEndDate:
             contractVO.contractEndDate || this.form.contractEndDate,
           pricingWay: 1,
-          transactionMode: contractVO.transactionMode || this.form.transactionMode,
+          transactionMode:
+            contractVO.transactionMode || this.form.transactionMode,
           settlementDate: contractVO.settlementDate || this.form.settlementDate,
           issueNumber: contractVO.issueNumber || this.form.issueNumber,
           deliveryMode: contractVO.deliveryMode || this.form.deliveryMode,
           receiptDate: contractVO.receiptDate || this.form.receiptDate,
-          endSettlementDate: contractVO.endSettlementDate || this.form.endSettlementDate,
-          startSettlementDate: contractVO.startSettlementDate || this.form.startSettlementDate
+          endSettlementDate:
+            contractVO.endSettlementDate || this.form.endSettlementDate,
+          startSettlementDate:
+            contractVO.startSettlementDate || this.form.startSettlementDate
         };
 
         row.productList = row.productList.map((item) => {
@@ -1776,7 +1827,7 @@
 
         this.form = contractVO;
         this.form.HJQD = this.form.partbName;
-        this.issueNumberChange(this.form.issueNumber)
+        this.issueNumberChange(this.form.issueNumber);
         this.$refs.inventoryTable &&
           this.$refs.inventoryTable.putTableValue(row);
         // const receiptData = {
@@ -1949,41 +2000,67 @@
             {
               contract: {
                 ...this.form,
-                endSettlementDate: this.form.settlementDate.length ?this.form.settlementDate[1] : '',
-                startSettlementDate: this.form.settlementDate.length ? this.form.settlementDate[0] : ''
+                endSettlementDate: this.form.settlementDate.length
+                  ? this.form.settlementDate[1]
+                  : '',
+                startSettlementDate: this.form.settlementDate.length
+                  ? this.form.settlementDate[0]
+                  : ''
               },
               productList: [
                 ...this.$refs.inventoryTable.getTableValue(),
                 ...rawDetailList,
                 ...outputDetailList
               ],
-              receiptPaymentList: this.$refs.paymentCollectionPlanRef.getTableValue()
+              receiptPaymentList:
+                this.$refs.paymentCollectionPlanRef.getTableValue()
             }
           );
 
-          const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);
-          if(+ratioSum != 100){
+          const ratioSum = commitData.receiptPaymentList.reduce(
+            (acc, cur) => acc + +cur.ratio,
+            0
+          );
+          if (+ratioSum != 100) {
             this.$message.error('比例合计必须为100%');
             return;
           }
 
           // 使用分进行计算,避免浮点数精度问题
-          let receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 100), 0) / 100;
+          let receiptPaymentListSum =
+            commitData.receiptPaymentList.reduce(
+              (acc, cur) => acc + Math.round(+cur.price * 100),
+              0
+            ) / 100;
           const payAmount = +commitData.payAmount;
-          
-          if(+ratioSum == 100) {
+
+          if (+ratioSum == 100) {
             // 使用分进行计算,避免浮点数精度问题
-            const difference = Math.round((payAmount - receiptPaymentListSum) * 100) / 100;
-            if (Math.abs(difference) >= 0.01 && commitData.receiptPaymentList.length > 0) {
+            const difference =
+              Math.round((payAmount - receiptPaymentListSum) * 100) / 100;
+            if (
+              Math.abs(difference) >= 0.01 &&
+              commitData.receiptPaymentList.length > 0
+            ) {
               const lastIndex = commitData.receiptPaymentList.length - 1;
               // 使用分进行计算,避免浮点数精度问题
-              const newPrice = Math.round((+commitData.receiptPaymentList[lastIndex].price + difference) * 100) / 100;
-              commitData.receiptPaymentList[lastIndex].price = newPrice.toFixed(2);
-              receiptPaymentListSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + Math.round(+cur.price * 100), 0) / 100;
+              const newPrice =
+                Math.round(
+                  (+commitData.receiptPaymentList[lastIndex].price +
+                    difference) *
+                    100
+                ) / 100;
+              commitData.receiptPaymentList[lastIndex].price =
+                newPrice.toFixed(2);
+              receiptPaymentListSum =
+                commitData.receiptPaymentList.reduce(
+                  (acc, cur) => acc + Math.round(+cur.price * 100),
+                  0
+                ) / 100;
             }
           }
 
-          if(Math.abs(+receiptPaymentListSum - payAmount) > 0.01){
+          if (Math.abs(+receiptPaymentListSum - payAmount) > 0.01) {
             this.$message.error('计划收款金额合计与优惠后金额不一致');
             return;
           }
@@ -2277,7 +2354,7 @@
           contractVO: {
             ...this.form,
             ...data,
-            hasGeneratedOrder:1,
+            hasGeneratedOrder: 1,
             totalPrice: data.totalAmount,
             discountTotalPrice: data.payAmount
           },
@@ -2369,65 +2446,85 @@
       settlementDateChange(val) {
         console.log(val, this.form.settlementDate);
         let dateRange = [];
-        if(this.form.settlementMode == 1) {
-        //   // this.transformDays(val)
+        if (this.form.settlementMode == 1) {
+          //   // this.transformDays(val)
           dateRange = this.transformDaysFun(val);
         }
-        if(this.form.settlementMode == 2) {
-        //   // this.transformMonth(val)
+        if (this.form.settlementMode == 2) {
+          //   // this.transformMonth(val)
           dateRange = this.transformMonthFun(val, this.form.receiptDate);
         }
         // console.log('dateRange~~~', dateRange);
         this.$set(this.form, 'issueNumber', dateRange.length);
         // this.setDefaultList(dateRange)
-        this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);
+        this.$refs.paymentCollectionPlanRef.defaultList(
+          this.form.settlementMode,
+          this.form.issueNumber,
+          dateRange
+        );
       },
       // 收款日变化
       receiptDateChange(v) {
         console.log('v~~~', v, this.form.settlementDate, this.form.issueNumber);
         // this.transformMonth(this.form.settlementDate)
-        if(this.form.settlementDate.length > 0 && this.form.issueNumber) {
+        if (this.form.settlementDate.length > 0 && this.form.issueNumber) {
           const dateRange = this.transformMonthFun(this.form.settlementDate, v);
-          this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, this.form.issueNumber, dateRange);
+          this.$refs.paymentCollectionPlanRef.defaultList(
+            this.form.settlementMode,
+            this.form.issueNumber,
+            dateRange
+          );
         }
       },
       // 期数变化
       issueNumberChange(v) {
         let dateRange = [];
-        if(this.form.settlementMode == 1) {
+        if (this.form.settlementMode == 1) {
           dateRange = this.transformDaysFun(this.form.settlementDate, v);
-          this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v, dateRange); 
-        } else if(this.form.settlementMode == 2) {
+          this.$refs.paymentCollectionPlanRef.defaultList(
+            this.form.settlementMode,
+            v,
+            dateRange
+          );
+        } else if (this.form.settlementMode == 2) {
           dateRange = this.transformMonthFun(this.form.settlementDate, v);
-          this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v, dateRange);
+          this.$refs.paymentCollectionPlanRef.defaultList(
+            this.form.settlementMode,
+            v,
+            dateRange
+          );
         } else {
-          this.$refs.paymentCollectionPlanRef.defaultList(this.form.settlementMode, v);
+          this.$refs.paymentCollectionPlanRef.defaultList(
+            this.form.settlementMode,
+            v
+          );
         }
       },
       transformDaysFun(date) {
         const startDate = new Date(date[0]);
         const endDate = new Date(date[1]);
         // 计算毫秒差并转换为天数,使用Math.ceil确保结果为整数
-        const days = Math.ceil((endDate - startDate) / (1000 * 60 * 60 * 24)) + 1;
+        const days =
+          Math.ceil((endDate - startDate) / (1000 * 60 * 60 * 24)) + 1;
         console.log('包含两头的天数:', days);
 
         // 生成包括头尾在内的所有日期
         const allDates = [];
         const current = new Date(startDate);
-        
+
         // 遍历从开始日期到结束日期的所有天数
         while (current <= endDate) {
           // 格式化日期为YYYY-MM-dd
           const year = current.getFullYear();
           const month = current.getMonth() + 1; // 月份从0开始,需要+1
           const day = current.getDate();
-          
+
           const formattedMonth = String(month).padStart(2, '0');
           const formattedDay = String(day).padStart(2, '0');
           const formattedDateStr = `${year}-${formattedMonth}-${formattedDay}`;
-          
+
           allDates.push(formattedDateStr);
-          
+
           // 移动到下一天
           current.setDate(current.getDate() + 1);
         }
@@ -2439,32 +2536,34 @@
         const parseMonthDate = (dateStr) => {
           return dateStr instanceof Date ? dateStr : new Date(dateStr + '-01');
         };
-        
+
         const start = parseMonthDate(date[0]);
         const end = parseMonthDate(date[1]);
-        
+
         // 先生成所有月份的日期数组
         const allMonthDates = [];
         const currentDate = new Date(start);
-        
+
         // 遍历从开始月份到结束月份的所有月份
         while (currentDate <= end) {
           const year = currentDate.getFullYear();
           const month = currentDate.getMonth() + 1; // 月份从0开始,需要+1
           const receiptDate = day;
-          
+
           // 格式化日期为YYYY-MM-dd
           const formattedMonth = String(month).padStart(2, '0');
           const formattedDate = String(receiptDate).padStart(2, '0');
-          const deadLine = receiptDate ? `${year}-${formattedMonth}-${formattedDate}` : '';
-          
+          const deadLine = receiptDate
+            ? `${year}-${formattedMonth}-${formattedDate}`
+            : '';
+
           allMonthDates.push(deadLine);
-          
+
           // 使用Date对象的setMonth方法正确移动到下一个月(自动处理年份变化)
           currentDate.setMonth(currentDate.getMonth() + 1);
         }
         return allMonthDates;
-      },
+      }
     }
   };
 </script>

+ 5 - 0
src/views/contractManage/contractBook/components/detailDialog.vue

@@ -451,6 +451,11 @@
             code: 7,
             name: '销售订单',
             parentId: '1'
+          },
+          {
+            code: 8,
+            name: '危险危物处置单',
+            parentId: '2'
           }
         ],
         shippingModeOp, 

+ 3 - 3
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -2134,9 +2134,9 @@
           if (!this.isUpdate) {
             delete this.form.id;
           }
-          if (!this.form.contractId) {
-            this.form.totalAmount = this.allcountAmount;
-          }
+    // if (!this.form.contractId) { //如果来源是合同 金额不变这个逻辑有问题 先注释
+          //   this.form.totalAmount = this.allcountAmount;
+          // }
           const rawDetailList =
             (this.$refs.rawDetailListRef &&
               this.$refs.rawDetailListRef.getTableValue()) ||

+ 2 - 2
src/views/purchasingManage/purchaseOrder/index.vue

@@ -164,7 +164,7 @@
                     icon="el-icon-plus"
                     @click="handleCommand('outsourceSend', row)"
                     v-if="
-                      ['3', '4', '5', '6', '8', '9'].includes(row.sourceType) &&
+                      ['3', '4', '5', '6', '8', '9','10'].includes(row.sourceType) &&
                       [2].includes(row.orderStatus) &&
                       row.progress < 200
                     "
@@ -177,7 +177,7 @@
                     icon="el-icon-plus"
                     @click="handleCommand('invoice', row)"
                     v-if="
-                      !['3', '4', '5', '6', '8', '9'].includes(row.sourceType) &&
+                      !['3', '4', '5', '6', '8', '9','10'].includes(row.sourceType) &&
                       [2].includes(row.orderStatus) &&
                       row.progress < 200 && row.isShowReceiptButton == 1
                     "

+ 37 - 16
src/views/purchasingManage/purchaseOrder/outSourceSend/components/addOrEditDialog.vue

@@ -94,14 +94,23 @@
         <el-col :span="12"> </el-col>
       </el-row>
     </el-form>
+    <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
+      <el-tab-pane label="物品清单" name="first">
+        <inventoryTable
+          :pricingWay="form.pricingWay"
+          ref="inventoryTableref"
+          :orderId="form.orderId"
+          :productType="1"
+        ></inventoryTable>
+      </el-tab-pane>
 
-    <headerTitle title="物品清单" style="margin-top: 30px"></headerTitle>
-    <inventoryTable
-      :pricingWay="form.pricingWay"
-      ref="inventoryTableref"
-      :orderId="form.orderId"
-      :productType="1"
-    ></inventoryTable>
+      <el-tab-pane label="运输清单" name="fourth">
+        <taskInfoTable
+          ref="taskInfoTableRef"
+          :taskType="'2'"
+        ></taskInfoTable>
+      </el-tab-pane>
+    </el-tabs>
 
     <div slot="footer" class="footer">
       <el-button type="primary" @click="save" v-click-once>保存</el-button>
@@ -128,7 +137,6 @@
 </template>
 
 <script>
-  import fileUpload from '@/components/upload/fileUpload';
   import dictMixins from '@/mixins/dictMixins';
   import {
     savePurchaseOutSourceSendAPI,
@@ -136,15 +144,12 @@
     getPurchaseOutSourceSendDetailAPI,
     submit
   } from '@/api/purchasingManage/outSourceSend';
-  import { getcontactlink } from '@/api/saleManage/businessFollow';
   import inventoryTable from './inventoryTable.vue';
   import orderListDialog from '../../invoice/components/orderListDialog.vue';
-  import { copyObj } from '@/utils/util';
   import { getByIdCondition } from '@/api/purchasingManage/purchaseOrder';
-  // import fileMain from '@/components/addDoc/index.vue';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
-
+  import taskInfoTable from '@/views/saleManage/saleOrder/invoice/components/taskInfoTable.vue';
   export default {
     props: {
       addOrEditDialogFlag: Boolean
@@ -152,8 +157,7 @@
     mixins: [dictMixins],
     components: {
       processSubmitDialog,
-      // fileMain,
-      fileUpload,
+      taskInfoTable,
       inventoryTable,
       orderListDialog
     },
@@ -162,6 +166,7 @@
         orderSearchParams: {
           sourceType: '3,4,5,6,7'
         },
+        activeName: 'first',
         detailData: {},
         payWayOptions: [],
         delDetailIds: [],
@@ -215,6 +220,7 @@
     methods: {
       //打开新增编辑弹框
       async open(type, row, orderId) {
+        this.activeName = 'first';
         this.title = type === 'add' ? '新增委外发货单' : '修改';
         this.row = row;
         if (orderId) {
@@ -303,8 +309,11 @@
         const data = await getPurchaseOutSourceSendDetailAPI(id);
         this.loading = false;
         if (data) {
+          this.form = data;
+
           this.$nextTick(() => {
-            this.form = data;
+            this.$refs.taskInfoTableRef &&
+              this.$refs.taskInfoTableRef.putTableValue(data.trakNoteList);
             this.$refs.inventoryTableref &&
               this.$refs.inventoryTableref.putTableValue(data.productList);
           });
@@ -326,6 +335,17 @@
             this.$refs.inventoryTableref.validateForm((valid) => {
               if (!valid) {
                 reject(false);
+                this.activeName = 'first';
+              } else {
+                resolve(true);
+              }
+            });
+          }),
+          new Promise((resolve, reject) => {
+            this.$refs.taskInfoTableRef.getTableValidate((valid) => {
+              if (!valid) {
+                reject(false);
+                this.activeName = 'fourth';
               } else {
                 resolve(true);
               }
@@ -358,7 +378,8 @@
           }
           // this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
           let commitData = Object.assign({}, this.form, {
-            productList: this.$refs.inventoryTableref.getTableValue()
+            productList: this.$refs.inventoryTableref.getTableValue(),
+            trakNoteList: this.$refs.taskInfoTableRef.getTableValue()
           });
           const API = this.isUpdate
             ? updatePurchaseOutSourceSendAPI

+ 5 - 1
src/views/saleManage/saleOrder/invoice/components/taskInfoTable.vue

@@ -275,6 +275,10 @@
       dialogType: {
         type: String,
         default: ''
+      },
+      taskType: {
+        type: String,
+        default: '1'
       }
     },
     data() {
@@ -434,7 +438,7 @@
           trakId: '',
           trakNumber: '',
           taskId: '',
-          taskType: '1',
+          taskType: this.taskType,
           taskCode: ''
         });
         this.$emit('setAddress');

+ 247 - 0
src/views/transportManager/carBook/map.vue

@@ -0,0 +1,247 @@
+<template>
+  <div class="energy-trend">
+    <el-card shadow="never" class="trend-card">
+      <!-- 主内容区 -->
+      <ele-split-layout
+        width="220px"
+        allow-collapse
+        style="height: calc(100vh - 130px)"
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <!-- 左侧树形菜单 -->
+        <div class="left-sidebar">
+          <el-tree
+            :data="carList"
+            :props="treeProps"
+            node-key="id"
+            highlight-current
+            ref="treeRef"
+          ></el-tree>
+        </div>
+
+        <!-- 右侧内容区 -->
+        <template v-slot:content>
+          <div class="right-content">
+            <!-- 搜索区域 -->
+            <!-- <div class="search-area">
+              <el-form :model="searchForm" label-width="80px" :inline="true">
+                <el-form-item label="" style="margin-left: 15px">
+                  <el-button type="primary" @click="handleSearch"
+                    >查询</el-button
+                  >
+                  <el-button @click="reloadMap" style="margin-left: 10px"
+                    >重置</el-button
+                  >
+                </el-form-item>
+              </el-form>
+            </div> -->
+
+            <div class="map" id="container"></div>
+          </div>
+        </template>
+      </ele-split-layout>
+    </el-card>
+  </div>
+</template>
+<script>
+  import AMapLoader from '@amap/amap-jsapi-loader';
+  import carIcon from '@/assets/car.png';
+  import {
+    carBookPageListAPI,
+    carCurrentAll,
+    carCurrent
+  } from '@/api/transportManager/carBook';
+
+  export default {
+    props: {
+      mapHeight: {
+        type: Number,
+        default: 650
+      }
+    },
+    data() {
+      return {
+        AMap: null,
+        mapInstance: null,
+        treeProps: {
+          children: 'children',
+          label: 'trakNumber'
+        },
+        carList: [],
+        markers: [
+          {
+            position: [112.889159, 28.213475],
+            name: '湘A12345',
+            url: '/monitor/centerctl/smartSubctrl'
+          },
+          {
+            position: [112.88, 28.21],
+            name: '湘A19645',
+            url: '/monitor/centerctl/smartSubctrl'
+          }
+        ]
+      };
+    },
+    watch: {
+      mapHeight(v) {
+        console.log(v, 'dsds');
+        this.$nextTick(() => {
+          this.reloadMap();
+        });
+      }
+    },
+    methods: {
+      /* 表格数据源 */
+      getList() {
+        return carBookPageListAPI({
+          pageNum: 1,
+          size: 999
+        }).then((res) => {
+          console.log(res, 'res');
+          this.carList = res;
+        });
+      },
+      // 方法一:使用本地 PNG 图片(推荐)
+      createPNGIcon(AMap) {
+        return new AMap.Icon({
+          size: new AMap.Size(42, 48), // 图标尺寸
+          image: carIcon, // 使用 import 导入的本地图片
+          imageSize: new AMap.Size(42, 48) // 图片显示大小
+        });
+      },
+      reloadMap() {
+        console.log('Reloading map...');
+        if (this.mapInstance) {
+          this.mapInstance.destroy();
+          this.mapInstance = null;
+          const container = document.getElementById('container');
+          if (container) {
+            container.innerHTML = '';
+          }
+        }
+        this.mapInit();
+      },
+      mapInit() {
+        const container = document.getElementById('container');
+        if (!container) return;
+
+        window._AMapSecurityConfig = {
+          securityJsCode: 'd60df9c6f47866f10b465156ca098ca4'
+        };
+        AMapLoader.load({
+          key: '66b29845a1829ca42a1945bdb5893c87', //申请好的 Web 端开发者 Key,首次调用 load 时必填
+          version: '2.0', //指定要加载的 JS API 的版本,缺省时默认为 1.4.15
+          plugins: ['AMap.Scale'] //需要使用的的插件列表,如比例尺'AMap.Scale',支持添加多个如:['AMap.Scale','...','...']
+        })
+          .then(async (AMap) => {
+            this.AMap = AMap;
+            var map = new AMap.Map('container', {
+              pitch: 0, //地图俯仰角度,有效范围 0 度- 83 度
+              viewMode: '3D', //地图模式
+              rotateEnable: true, //是否开启地图旋转交互 鼠标右键 + 鼠标画圈移动 或 键盘Ctrl + 鼠标左键画圈移动
+              pitchEnable: true, //是否开启地图倾斜交互 鼠标右键 + 鼠标上下移动或键盘Ctrl + 鼠标左键上下移动
+              zoom: 15, //初始化地图层级
+              rotation: 0, //初始地图顺时针旋转的角度
+              zooms: [2, 20], //地图显示的缩放级别范围
+              center: [112.889159, 28.213475] //初始地图中心经纬度
+            }); //"container"为 <div> 容器的 id
+            this.mapInstance = map;
+            const customIcon = this.createPNGIcon(AMap);
+            // 使用 map.setFitView() 或让地图自动适应容器大小
+            // 开启卫星图模式
+            // let layers = new AMap.TileLayer.Satellite({ map: map });
+            // layers && layers.show();
+            // 开启地图旋转和缩放组件
+            AMap.plugin(['AMap.ControlBar', 'AMap.ToolBar'], function () {
+              //异步加载插件
+              var controlBar = new AMap.ControlBar({
+                //控制地图旋转插件
+                position: {
+                  right: '10px',
+                  top: '10px'
+                }
+              });
+              map.addControl(controlBar);
+              var toolBar = new AMap.ToolBar({
+                //地图缩放插件
+                position: {
+                  right: '40px',
+                  top: '110px'
+                }
+              });
+              map.addControl(toolBar);
+            });
+            await this.getList();
+            const carPosition= await carCurrentAll(this.carList.map(item=>item.id))
+            console.log(carPosition,'carPosition')
+            this.carList.forEach((item, index) => {
+              console.log(28.18 + (index + 1) / 100, 'dsd');
+
+              const marker = new AMap.Marker({
+                position: [112.88, 28.18 + (index + 1) / 100],
+                title: item.trakNumber,
+                icon: customIcon
+              });
+
+              map.add(marker);
+
+              const infoWindow = new AMap.InfoWindow({
+                content: `<div style="padding: 5px;">${item.trakNumber}</div>`,
+                offset: new AMap.Pixel(0, -30)
+              });
+
+              marker.on('mouseover', () => {
+                infoWindow.open(map, marker.getPosition());
+              });
+
+              marker.on('click', () => {
+                // console.log(map, marker.getPosition());
+                //   router.push({ path: item.url });
+              });
+
+              marker.on('mouseout', () => {
+                infoWindow.close();
+              });
+            });
+
+            var disProvince = new AMap.DistrictLayer.Country({
+              zIndex: 10,
+              code: '100000', //地址码
+              depth: 1,
+              styles: {
+                fill: 'rgba(255,255,255,0)', //设置背景颜色
+                'province-stroke': '#2cf6f7', //边界线颜色
+                'nation-stroke': '#2cf6f7',
+                'stroke-width': 2
+                // 'city-stroke': 'red', //当depth>0时,设置市级边界线
+              }
+            });
+            disProvince.setMap(map);
+          })
+          .catch((e) => {
+            console.log(e, 'dasdasd');
+          });
+      }
+    },
+    mounted() {
+      setTimeout(() => {
+        this.$nextTick(() => {
+          this.mapInit();
+        });
+      }, 300);
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .map {
+    width: 100%;
+    height: calc(100vh - 130px);
+
+    background: #fff;
+    position: absolute;
+  }
+  :deep(.ele-split-panel-side){
+    border:solid 1px #f1f1f1;
+  }
+</style>