zhangback
2025-11-14 c2e20ac680e03cb26cf7c00f573f0cb917afaece
ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
@@ -21,21 +21,21 @@
        @on-load="onLoad"
    >
      <template #menu-left>
        <el-button
            type="success"
            icon="Edit"
            :disabled="pageF.single"
            v-hasPermi="['tms:tmsDispatchOrder:edit']"
            @click="handleUpdate">修改
        </el-button>
        <el-button
            type="danger"
            icon="Delete"
            :disabled="pageF.multiple"
            @click="handleDelete"
            v-hasPermi="['tms:tmsDispatchOrder:remove']"
        >删除
        </el-button>
<!--        <el-button-->
<!--            type="success"-->
<!--            icon="Edit"-->
<!--            :disabled="pageF.single"-->
<!--            v-hasPermi="['tms:tmsDispatchOrder:edit']"-->
<!--            @click="handleUpdate">修改-->
<!--        </el-button>-->
<!--        <el-button-->
<!--            type="danger"-->
<!--            icon="Delete"-->
<!--            :disabled="pageF.multiple"-->
<!--            @click="handleDelete"-->
<!--            v-hasPermi="['tms:tmsDispatchOrder:remove']"-->
<!--        >删除-->
<!--        </el-button>-->
        <el-button
            type="warning"
            plain
@@ -44,9 +44,67 @@
            v-hasPermi="['tms:tmsDispatchOrder:export']"
        >导出
        </el-button>
      </template>
        <el-button
            type="success"
            icon="Delete"
            :disabled="pageF.multiple"
            @click="handleGenerate"
            v-hasPermi="['tms:tmsDispatchOrder:generate']"
        >生成应收应付费用
        </el-button>
      </template>
      <template #menu-before="{row}">
        <el-link size="small" type="primary" v-if="row.status == 0" @click="handleConfirm(row)" class="link-btn"
                 :underline="false" icon="el-icon-pointer">确定
        </el-link>
        <el-link size="small" type="primary" @click="handleCopy(row)" class="link-btn" :underline="false"
                 icon="el-icon-connection">复制
        </el-link>
        <el-link size="small" type="primary" v-if="[1,2].includes(row.status)" @click="handleUploadItinerary(row)"
                 class="link-btn" :underline="false" icon="el-icon-upload">上传行程
        </el-link>
        <el-link size="small" type="primary" v-if="![0,1].includes(row.status)" @click="handleLogItinerary(row)"
                 class="link-btn" :underline="false" icon="el-icon-view">查看行程
        </el-link>
        <el-link size="small" type="primary" v-if="[2].includes(row.status)" @click="handleOk(row)" class="link-btn"
                 :underline="false" icon="el-icon-circle-check">完成行程
        </el-link>
        <el-link size="small" type="primary" v-if="[2,3].includes(row.status)" @click="handleAddFinance(row)" class="link-btn"
                 :underline="false" icon="el-icon-edit-pen">费用登记
        </el-link>
      </template>
      <template #menu="{row}">
        <el-link size="small" type="primary" @click="handleLog(row)" class="link-btn" :underline="false"
                 icon="el-icon-tickets">日志
        </el-link>
      </template>
    </avue-crud>
    <el-dialog :title="pageF.title" v-model="pageF.open" class="avue-dialog avue-dialog--top" width="80%">
      <avue-form v-if="optionType == 'addItinerary' || optionType == 'addFinance'" v-model="boxForm" ref="boxFormRef" :option="boxFormOption">
      </avue-form>
      <avue-crud
          :option="boxTableOption"
          :data="boxTableData"
      >
      </avue-crud>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" v-if="optionType == 'addItinerary' || optionType == 'addFinance'" :loading="pageF.isUploading" @click="submitForm">
            {{ pageF.isUploading ? '提交中' : '确 定' }}
          </el-button>
          <el-button type="primary" v-if="optionType == 'generate' " :loading="pageF.isUploading" @click="submitGenerate">
            {{ pageF.isUploading ? '生成中' : '生成费用' }}
          </el-button>
          <el-button @click="cancelBox">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </basicContainer>
</template>
@@ -58,7 +116,8 @@
  exportTmsDispatchOrder,
  getTmsDispatchOrder,
  listTmsDispatchOrder,
  updateTmsDispatchOrder
  updateTmsDispatchOrder,
  confirmOrder, copyOrder, okOrder
} from "@/api/tms/tmsDispatchOrder";
import useCurrentInstance from "@/utils/useCurrentInstance";
import {computed, onMounted, reactive, ref, toRefs, watch} from "vue";
@@ -74,19 +133,28 @@
import {getTmsContainer, listTmsContainer} from "@/api/tms/tmsContainer";
import {getTmsShelf, listTmsShelf} from "@/api/tms/tmsShelf";
import {getTmsConsignor, listTmsConsignor} from "@/api/tms/tmsConsignor";
import {ElMessage, ElMessageBox} from "element-plus";
import {addTmsTrip, listTmsTrip} from "@/api/tms/tmsTrip";
import {addTmsFinanceDetail, listTmsFinanceDetail} from "@/api/tms/tmsFinanceDetail";
const {proxy} = useCurrentInstance();
const crudRef = ref();
const boxFormRef = ref();
const permissionList = computed(() => {
  return {
    addBtn: hasPermission(["tms:tmsDispatchOrder:add"]),
    delBtn: hasPermission(["tms:tmsDispatchOrder:remove"]),
    editBtn: hasPermission(["tms:tmsDispatchOrder:edit"]),
    viewBtn: hasPermission(["tms:tmsDispatchOrder:query"]),
const permissionList = (key: any, row: any, index: any) => {
  if (key == 'addBtn') {
    return hasPermission(["tms:tmsDispatchOrder:add"])
  } else if (key == 'delBtn') {
    return hasPermission(["tms:tmsDispatchOrder:remove"]) && row?.status == 0
  } else if (key == 'editBtn') {
    return hasPermission(["tms:tmsDispatchOrder:edit"]) && [0,1].includes(row?.status)
  } else if (key == 'viewBtn') {
    return hasPermission(["tms:tmsDispatchOrder:query"])
  } else {
    return true;
  }
})
console.log()
};
const data = reactive({
  form: <TmsDispatchOrderI>{},
  queryParams: <TmsDispatchOrderI & PageQueryInterface>{},
@@ -96,19 +164,27 @@
    currentPage: 1,
  },
  selectionList: [],
  optionType: '',
  boxTableData: <any>[],
  boxForm: <any>{},
  boxFormOption: <any>{},
  boxTableOption: <any>{}
})
const {queryParams, form, page, selectionList} = toRefs(data);
const {queryParams, form, page, selectionList,
  boxTableData, optionType,
  boxFormOption,boxForm,boxTableOption
} = toRefs(data);
const option = ref({
  pageKey: 'TmsDispatchOrder',
  rowKey: 'id',
  labelWidth:130,
  searchSpan:6,
  searchLabelWidth:150,
  group:[
  labelWidth: 130,
  searchSpan: 6,
  searchLabelWidth: 150,
  group: [
    {
      label: '基本信息',
      prop: 'jbxx',
      column:{
      column: {
        projectId: {
          label: '关联项目',
          display: true,
@@ -124,44 +200,44 @@
            let active = table.active;
            if (Array.isArray(active)) active = active[0];
            if (active) {
                  Object.assign(form.value, {
                    projectId: active.id,
                    projectName: active.projectName,
                    customerId: active.relatedCustomerId,
                    customerName: active.relatedCustomerName,
                    contractId: active.relatedContractId,
                    contractName: active.relatedContractName,
                  });
              Object.assign(form.value, {
                projectId: active.id,
                projectName: active.projectName,
                customerId: active.relatedCustomerId,
                customerName: active.relatedCustomerName,
                contractId: active.relatedContractId,
                contractName: active.relatedContractName,
              });
            }
          },
          type: 'table',suffixIcon:'search',
          children:{
          type: 'table', suffixIcon: 'search',
          children: {
            border: true,
            searchMenuSpan: 5,
            column:{
            column: {
              projectName: {
                label: '项目名称', minWidth: 130,
                search: true,
              },
              projectCode: {
                label: '项目编号',minWidth: 120,
                label: '项目编号', minWidth: 120,
                search: true,
              },
              relatedContractName: {
                label: '关联合同',
                display: false,minWidth: 150,
                display: false, minWidth: 150,
                search: true,
              },
              relatedCustomerName: {
                label: '关联客户',
                display: false,minWidth: 150,
                display: false, minWidth: 150,
                search: true,
              },
              status: {
                label: '状态',dataType: 'string',
                label: '状态', dataType: 'string',
                type: 'radio', dicUrl: '/system/dict/data/type/data_status',
                addDisplay: false,minWidth: 150,
                addDisplay: false, minWidth: 150,
                editDisplay: false,
                viewDisplay: true,
                hide: false,
@@ -176,24 +252,24 @@
            },
          },
          props:{
          props: {
            label: 'projectName',
            value: 'id'
          },
          onLoad: ({ page, value, data }: { page: any, value: any, data: any }, callback:any) => {
            if (value){
          onLoad: ({page, value, data}: { page: any, value: any, data: any }, callback: any) => {
            if (value) {
              let id = value;
              if (Array.isArray(value)){
              if (Array.isArray(value)) {
                id = value[0]
              }
              getTmsProject(id).then(res=>{
                return callback(res.data||{})
              getTmsProject(id).then(res => {
                return callback(res.data || {})
              })
            }else{
              listTmsProject({pageSize:page.pageSize,pageNum:page.currentPage,...data}).then(res=>{
            } else {
              listTmsProject({pageSize: page.pageSize, pageNum: page.currentPage, ...data}).then(res => {
                return callback({
                  total: res.total,
                  data: res.rows||[],
                  data: res.rows || [],
                })
              })
            }
@@ -203,7 +279,7 @@
        },
        customerName: {
          label: '客户名称',
          display: true,disabled:true
          display: true, disabled: true
        },
        // customerCode: {
        //   label: '客户编码',
@@ -211,7 +287,7 @@
        // },
        contractName: {
          label: '关联合同名称',
          display: true,disabled:true
          display: true, disabled: true
        },
        orderType: {
@@ -506,45 +582,45 @@
              });
            }
          },
          type: 'table',suffixIcon:'search',
          children:{
          type: 'table', suffixIcon: 'search',
          children: {
            border: true,
            searchMenuSpan: 5,
            column:{
            column: {
              vehicleProviderName: {
                label: '车辆服务商', minWidth: 130,
                search: true,
              },
              driverName: {
                label: '驾驶员姓名',minWidth: 120,
                label: '驾驶员姓名', minWidth: 120,
                search: true,
              },
              licenseType: {
                label: '准驾车型',minWidth: 120,
                label: '准驾车型', minWidth: 120,
                type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/license_type',
                search: true,
              },
            },
          },
          props:{
          props: {
            label: 'driverName',
            value: 'id'
          },
          onLoad: ({ page, value, data }: { page: any, value: any, data: any }, callback:any) => {
            if (value){
          onLoad: ({page, value, data}: { page: any, value: any, data: any }, callback: any) => {
            if (value) {
              let id = value;
              if (Array.isArray(value)){
              if (Array.isArray(value)) {
                id = value[0]
              }
              getTmsDriver(id).then(res=>{
                return callback(res.data||{})
              getTmsDriver(id).then(res => {
                return callback(res.data || {})
              })
            }else{
              listTmsDriver({pageSize:page.pageSize,pageNum:page.currentPage,...data}).then(res=>{
            } else {
              listTmsDriver({pageSize: page.pageSize, pageNum: page.currentPage, ...data}).then(res => {
                return callback({
                  total: res.total,
                  data: res.rows||[],
                  data: res.rows || [],
                })
              })
            }
@@ -569,44 +645,44 @@
            }
          },
          type: 'table', suffixIcon: 'search',
          children:{
          children: {
            border: true,
            searchMenuSpan: 5,
            column:{
            column: {
              vehicleProviderName: {
                label: '车辆服务商', minWidth: 130,
                search: true,
              },
              driverName: {
                label: '驾驶员姓名',minWidth: 120,
                label: '驾驶员姓名', minWidth: 120,
                search: true,
              },
              licenseType: {
                label: '准驾车型',minWidth: 120,
                label: '准驾车型', minWidth: 120,
                type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/license_type',
                search: true,
              },
            },
          },
          props:{
          props: {
            label: 'driverName',
            value: 'id'
          },
          onLoad: ({ page, value, data }: { page: any, value: any, data: any }, callback:any) => {
            if (value){
          onLoad: ({page, value, data}: { page: any, value: any, data: any }, callback: any) => {
            if (value) {
              let id = value;
              if (Array.isArray(value)){
              if (Array.isArray(value)) {
                id = value[0]
              }
              getTmsDriver(id).then(res=>{
                return callback(res.data||{})
              getTmsDriver(id).then(res => {
                return callback(res.data || {})
              })
            }else{
              listTmsDriver({pageSize:page.pageSize,pageNum:page.currentPage,...data}).then(res=>{
            } else {
              listTmsDriver({pageSize: page.pageSize, pageNum: page.currentPage, ...data}).then(res => {
                return callback({
                  total: res.total,
                  data: res.rows||[],
                  data: res.rows || [],
                })
              })
            }
@@ -615,7 +691,7 @@
        },
        requiredVehicleTypes: {
          label: '要求车型',multiple:true,
          label: '要求车型', multiple: true,
          display: true, type: 'select', dicUrl: '/system/dict/data/type/license_type', dataType: 'string',
          rules: [
            {
@@ -741,7 +817,7 @@
                label: '箱型',
                type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/container_type',
                display: false,
                hide: false,minWidth:150,
                hide: false, minWidth: 150,
                search: true,
              },
            },
@@ -839,7 +915,7 @@
    {
      label: '收发货人信息',
      prop: 'shffxrxx',
      column:{
      column: {
        shipperId: {
          label: '发货人',
          display: true,
@@ -850,14 +926,14 @@
            if (Array.isArray(active)) active = active[0];
            if (active) {
              Object.assign(form.value, {
                      shipperId: active.id,
                      shipperName: active.consignorName,
                      shipperRegionCode: active.regionLabel,
                      shipperAddress: active.addressDetail,
                      shipperMobile: active.contactPhone,
                shipperId: active.id,
                shipperName: active.consignorName,
                shipperRegionCode: active.regionLabel,
                shipperAddress: active.addressDetail,
                shipperMobile: active.contactPhone,
              });
              form.value.transportLine = form.value.shipperRegionCode
                    +(form.value.receiverRegionCode? '>' + form.value.receiverRegionCode : '') ;
                  + (form.value.receiverRegionCode ? '>' + form.value.receiverRegionCode : '');
            }
          },
          rules: [
@@ -881,26 +957,26 @@
                search: true,
              },
              consignorType: {
                label: '收发货人类型',minWidth: 80,
                label: '收发货人类型', minWidth: 80,
                type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/consignor_type',
                display: false,
                hide: false,
                search: true,
              },
              contactName: {
                label: '联系人姓名',minWidth: 110,
                label: '联系人姓名', minWidth: 110,
                display: false,
                hide: false,
                search: true,
              },
              contactPhone: {
                label: '联系人电话',minWidth: 110,
                label: '联系人电话', minWidth: 110,
                display: false,
                hide: false,
                search: true,
              },
              regionLabel: {
                label: '行政区域',minWidth: 180,
                label: '行政区域', minWidth: 180,
                display: false,
                hide: false,
                search: true,
@@ -935,16 +1011,16 @@
        },
        shipperRegionCode: {
          label: '发货人行政区域',
          display: true,disabled:true
          display: true, disabled: true
        },
        shipperAddress: {
          label: '发货人详细地址',
          display: true,disabled:true
          display: true, disabled: true
        },
        shipperMobile: {
          label: '发货人联系方式',
          display: true,disabled:true
          display: true, disabled: true
        },
        receiverId: {
          label: '收货人',
@@ -962,14 +1038,14 @@
            if (Array.isArray(active)) active = active[0];
            if (active) {
              Object.assign(form.value, {
                      receiverId: active.id,
                      receiverName: active.consignorName,
                      receiverRegionCode: active.regionLabel,
                      receiverAddress: active.addressDetail,
                      receiverMobile: active.contactPhone,
                receiverId: active.id,
                receiverName: active.consignorName,
                receiverRegionCode: active.regionLabel,
                receiverAddress: active.addressDetail,
                receiverMobile: active.contactPhone,
              });
                  form.value.transportLine =
                      (form.value.shipperRegionCode? form.value.shipperRegionCode + '>': '') +form.value.receiverRegionCode;
              form.value.transportLine =
                  (form.value.shipperRegionCode ? form.value.shipperRegionCode + '>' : '') + form.value.receiverRegionCode;
            }
          },
@@ -988,26 +1064,26 @@
                search: true,
              },
              consignorType: {
                label: '收发货人类型',minWidth: 80,
                label: '收发货人类型', minWidth: 80,
                type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/consignor_type',
                display: false,
                hide: false,
                search: true,
              },
              contactName: {
                label: '联系人姓名',minWidth: 110,
                label: '联系人姓名', minWidth: 110,
                display: false,
                hide: false,
                search: true,
              },
              contactPhone: {
                label: '联系人电话',minWidth: 110,
                label: '联系人电话', minWidth: 110,
                display: false,
                hide: false,
                search: true,
              },
              regionLabel: {
                label: '行政区域',minWidth: 180,
                label: '行政区域', minWidth: 180,
                display: false,
                hide: false,
                search: true,
@@ -1042,26 +1118,26 @@
        },
        receiverRegionCode: {
          label: '收货人行政区域',
          display: true,disabled:true
          display: true, disabled: true
        },
        receiverAddress: {
          label: '收货人详细地址',
          display: true,disabled:true
          display: true, disabled: true
        },
        receiverMobile: {
          label: '收货人联系方式',
          display: true,disabled:true
          display: true, disabled: true
        },
        transportLine: {
          label: '运输线路',span:24,
          display: true,disabled:true
          label: '运输线路', span: 24,
          display: true, disabled: true
        },
      }
    },
    {
      label: '运输要求信息',
      prop: 'ysyqxx',
      column:{
      column: {
        earliestDeparture: {
          label: '要求最早出发时间',
          type: 'date', valueFormat: 'YYYY-MM-DD',
@@ -1087,21 +1163,21 @@
    {
      label: '车辆信息',
      prop: 'clxx',
      column:{
      column: {
        emptyMileage: {
          label: '空载里程',append:'Km',
          label: '空载里程', append: 'Km',
          display: true,
        },
        emptyFuel: {
          label: '空载油耗',append:'L',
          label: '空载油耗', append: 'L',
          display: true,
        },
        loadedMileage: {
          label: '重载里程',append:'Km',
          label: '重载里程', append: 'Km',
          display: true,
        },
        loadedFuel: {
          label: '重载油耗',append:'L',
          label: '重载油耗', append: 'L',
          display: true,
        },
      }
@@ -1109,7 +1185,7 @@
    {
      label: '其他信息',
      prop: 'qtyxx',
      column:{
      column: {
        shiftNo: {
          label: '班次号',
          display: true,
@@ -1119,7 +1195,7 @@
          display: true,
        },
        remark: {
          label: '备注',span:24,
          label: '备注', span: 24,
          type: 'textarea', minRows: 3, maxRows: 5,
          display: true,
        },
@@ -1135,31 +1211,31 @@
    },
    customerName: {
      label: '客户',
      display: false,minWidth: 120,
      display: false, minWidth: 120,
      search: true,
    },
    projectName: {
      label: '项目名称',
      display: false,minWidth: 120,
      display: false, minWidth: 120,
      search: true,
    },
    contractName: {
      label: '关联合同名称',minWidth: 120,
      label: '关联合同名称', minWidth: 120,
      display: false,
      search: true,
    },
    orderType: {
      label: '订单类型',
      display: false,
      search: true,minWidth: 120,
      search: true, minWidth: 120,
      type: 'select', dataType: 'string',
      dicUrl: '/system/dict/data/type/order_type',
    },
    signType: {
      label: '订单类型',
      display: false,
      search: true,minWidth: 120,
      search: true, minWidth: 120,
      type: 'select', dataType: 'string',
      dicUrl: '/system/dict/data/type/order_type',
    },
@@ -1167,36 +1243,36 @@
    transportLine: {
      label: '运输线路',
      display: false,
      search: true,minWidth: 180, overHidden:true
      search: true, minWidth: 180, overHidden: true
    },
    vehicleProviderName: {
      label: '车辆服务商名称',minWidth: 150,
      label: '车辆服务商名称', minWidth: 150,
      display: false,
      search: true,
    },
    loadingServiceProviderName: {
      label: '装货服务商名称',minWidth: 150,
      label: '装货服务商名称', minWidth: 150,
      display: false,
      search: true,
    },
    customsServiceProviderName: {
      label: '报关服务商名称',minWidth: 150,
      label: '报关服务商名称', minWidth: 150,
      display: false,
      search: true,
    },
    isUrgent: {
      label: '是否紧急否',
      display: false,minWidth: 100,
      display: false, minWidth: 100,
      search: true,
      type: 'select', dicUrl: '/system/dict/data/type/sys_number_is', dataType: 'string',
    },
    mainDriverName: {
      label: '主驾驶员',
      display: false,minWidth: 120,
      display: false, minWidth: 120,
      search: true,
    },
@@ -1206,31 +1282,31 @@
    //   search: true,
    // },
    actualVehicleType: {
      label: '实际运输工具类型',minWidth: 130,
      label: '实际运输工具类型', minWidth: 130,
      display: false,
      search: true,
     type: 'select', dicUrl: '/system/dict/data/type/license_type', dataType: 'string',
      type: 'select', dicUrl: '/system/dict/data/type/license_type', dataType: 'string',
    },
    licensePlate: {
      label: '车牌号',minWidth: 120,
      label: '车牌号', minWidth: 120,
      display: false,
      search: true,
    },
    shipperName: {
      label: '发货人名称',
      display: false,minWidth: 120,
      display: false, minWidth: 120,
      search: true,
    },
    receiverName: {
      label: '收货人名称',minWidth: 120,
      label: '收货人名称', minWidth: 120,
      display: false,
      search: true,
    },
    accountsReceivableStatus: {
      label: '应收费用生成状态',minWidth: 160,
      label: '应收费用生成状态', minWidth: 160,
      display: false,
      hide: false,
      search: true,
@@ -1242,7 +1318,7 @@
      ],
    },
    accountsPayableStatus: {
      label: '应付费用生成状态',minWidth: 160,
      label: '应付费用生成状态', minWidth: 160,
      display: false,
      hide: false,
      search: true,
@@ -1255,10 +1331,10 @@
    },
    status: {
      label: '状态',minWidth: 120,
      label: '状态', minWidth: 150,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/tms_dispatch_order_status',
      display: false,
      hide: false,
      hide: false, fixed: 'right',
      search: true,
      rules: [
        {
@@ -1269,7 +1345,7 @@
    },
    updateBy: {
      label: '更新人',minWidth: 150,
      label: '更新人', minWidth: 150,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
@@ -1277,7 +1353,7 @@
      search: false,
    },
    updateTime: {
      label: '更新时间',minWidth: 180,
      label: '更新时间', minWidth: 180,
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
@@ -1288,6 +1364,273 @@
  }
})
const itineraryOption = ref({
  menuBtn: false,
  labelWidth: 120,
  column: {
    driverName: {
      label: '主驾驶员名称',
      display: true, disabled: true,
    },
    vehicleNumber: {
      label: '车牌号码',
      display: true, disabled: true,
    },
    tripType: {
      label: '行程类型',
      display: true,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/trip_type',
      rules: [
        {
          required: true,
          message: "行程类型不能为空", trigger: "change"
        }
      ],
    },
    tripTime: {
      label: '时间',
      type: 'datetime', valueFormat: 'YYYY-MM-DD HH:mm:ss',
      display: true,
      rules: [
        {
          required: true,
          message: "时间不能为空", trigger: "change"
        }
      ],
    },
    odometer: {
      label: '仪表里程',
      display: true,
      rules: [
        {
          required: true,
          message: "仪表里程不能为空", trigger: "change"
        }
      ],
    },
    address: {
      label: '具体地址',
      display: true,
      rules: [
        {
          required: true,
          message: "具体地址不能为空", trigger: "change"
        }
      ],
    },
    voucherUrl: {
      label: '行程凭证',
      display: true,
      type: 'upload',
      multiple: true,
      span: 24,
      propsHttp: {
        url: 'url',
        name: 'name',
        res: 'data'
      },
    },
    dataSource: {
      label: '数据来源',
      display: false,
      value: 0
    },
  }
})
const itineraryTableOption = ref({
  menu: false,
  addBtn: false,
  header: false, selection: false,
  title: '历史行程',
  column: {
    dataSource: {
      label: '数据来源',
      display: false,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/data_source',
    },
    driverName: {
      label: '主驾驶员名称',
      display: true, disabled: true,
    },
    vehicleNumber: {
      label: '车牌号码',
      display: true, disabled: true,
    },
    tripType: {
      label: '行程类型',
      display: true,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/trip_type',
    },
    tripTime: {
      label: '时间',
      type: 'date', valueFormat: 'YYYY-MM-DD',
      display: true,
    },
    odometer: {
      label: '仪表里程',
      display: true,
    },
    address: {
      label: '具体地址',
      display: true,
    },
    voucherUrl: {
      label: '行程凭证',
      display: true,
    },
  }
})
const financeOption = ref({
  menuBtn: false,
  labelWidth: 120,
  column: {
    feeType: {
      label: '费用类型',
      display: true,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/fee_type',
      rules: [
        {
          required: true,
          message: "费用类型不能为空", trigger: "change"
        }
      ],
    },
    actualFeeAmount: {
      label: '费用金额',
      type: 'number',
      display: true,
      rules: [
        {
          required: true,
          message: "费用金额不能为空", trigger: "change"
        }
      ],
    },
    voucherUrl: {
      label: '行程凭证',
      display: true,
      type: 'upload',
      multiple: true,
      span: 24,
      propsHttp: {
        url: 'url',
        name: 'name',
        res: 'data'
      },
    },
    dataSource: {
      label: '数据来源',
      display: false,
      value: 0
    },
  }
})
const financeTableOption = ref({
  menu: false,
  addBtn: false,
  header: false, selection: false,
  title: '历史垫付费用',
  column: {
    dataSource: {
      label: '数据来源',
      display: false,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/data_source',
    },
    createBy: {
      label: '添加人',
      display: true, disabled: true,
    },
    feeCreateTime: {
      label: '上传时间',
      display: true, disabled: true,
    },
    feeType: {
      label: '费用类型',
      display: true,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/fee_type',
    },
    actualFeeAmount: {
      label: '金额',
      display: true,
    },
    feeVoucherUrl: {
      label: '费用凭证',
      display: true,
    },
  }
})
const generateTableOption = ref({
  menu: false,
  addBtn: false,
  header: false, selection: false,
  column: {
    accountsReceivableName: {
      label: '匹配应收方案名称', minWidth: 160,
    },
    accountsPayableName: {
      label: '匹配应付方案名称', minWidth: 160,
    },
    accountsReceivableStatus: {
      label: '应收费用生成状态', minWidth: 160,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/tms_dispatch_order_status',
    },
    accountsPayableStatus: {
      label: '应付费用生成状态', minWidth: 160,
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/tms_dispatch_order_status',
    },
    dispatchNo: {
      label: '调度单号', minWidth: 120,
      display: false,
    },
    customerName: {
      label: '客户',
      display: false, minWidth: 120,
    },
    vehicleProviderName: {
      label: '车辆服务商名称', minWidth: 150,
      display: false,
    },
    shipperName: {
      label: '发货人名称',
      display: false, minWidth: 120,
    },
    receiverName: {
      label: '收货人名称', minWidth: 120,
      display: false,
    },
    transportLine: {
      label: '运输线路',
      display: false,minWidth: 180, overHidden: true
    },
    actualVehicleType: {
      label: '车型', minWidth: 130,
      display: false,
      type: 'select', dicUrl: '/system/dict/data/type/license_type', dataType: 'string',
    },
    licensePlate: {
      label: '车牌号', minWidth: 120,
      display: false,
    },
  }
})
const {
  tableData,
@@ -1325,6 +1668,157 @@
    selectionList.value = selection;
  }
})
const handleConfirm = (row: any) => {
  ElMessageBox.confirm("是否对调度单号" + row.dispatchNo + "确定 ?", '系统提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    return confirmOrder(row.id);
  }).then(() => {
    onLoad(page.value);
    ElMessage({
      message: "操作成功!",
      type: 'success'
    })
  });
}
const handleCopy = (row: any) => {
  ElMessageBox.confirm("是否对调度单号" + row.dispatchNo + "复制 ?", '系统提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    return copyOrder(row.id);
  }).then(() => {
    onLoad(page.value);
    ElMessage({
      message: "操作成功!",
      type: 'success'
    })
  });
}
const handleOk = (row: any) => {
  ElMessageBox.confirm("是否确认完成调度单号:" + row.dispatchNo + " 的行程 ?", '系统提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    return okOrder(row.id);
  }).then(() => {
    onLoad(page.value);
    ElMessage({
      message: "操作成功!",
      type: 'success'
    })
  });
}
/**
 * 上传行程
 */
const handleUploadItinerary = (row: any) => {
  optionType.value = 'addItinerary';
  boxFormOption.value = itineraryOption.value;
  boxTableOption.value = itineraryTableOption.value;
  listTmsTrip({dispatchOrderId: row.id, pageNum: 1, pageSize: 999}).then(res => {
    boxTableData.value = res.rows || [];
    pageF.open = true;
    pageF.title = '上传行程';
    boxForm.value = {
      dispatchOrderId: row.id,
      dataSource: 0,
      driverId: row.mainDriverId,
      driverName: row.mainDriverName,
      vehicleNumber: row.licensePlate,
      vehicleId: row.vehicleId,
    }
  })
}
const cancelBox = () => {
  if (optionType.value === 'addItinerary' || optionType.value === 'addFinance') {
    boxForm.value = {};
    boxFormRef.value.resetFields();
  }
  pageF.open = false;
}
const submitForm = () => {
  if (optionType.value === 'addItinerary'){
    if (Array.isArray(boxForm.value.voucherUrl)) {
      boxForm.value.voucherUrl = boxForm.value.voucherUrl.toString();
    }
    addTmsTrip(boxForm.value).then(res => {
      ElMessage({
        message: "操作成功!",
        type: 'success'
      })
      cancelBox();
      onLoad(page.value);
    })
  }else if (optionType.value === 'addFinance'){
    if (Array.isArray(boxForm.value.feeVoucherUrl)) {
      boxForm.value.feeVoucherUrl = boxForm.value.feeVoucherUrl.toString();
    }
    addTmsFinanceDetail(boxForm.value).then(res=>{
      ElMessage({
        message: "操作成功!",
        type: 'success'
      })
      cancelBox();
      onLoad(page.value);
    })
  }
}
const handleLog = (row: any) => {
}
const handleLogItinerary = (row: any) => {
  optionType.value = 'view';
  boxTableOption.value = itineraryTableOption.value;
  listTmsTrip({dispatchOrderId: row.id, pageNum: 1, pageSize: 999}).then(res => {
    boxTableData.value = res.rows || [];
    pageF.open = true;
    pageF.title = '查看行程';
    boxFormOption.value.title = '';
  })
}
const handleAddFinance = (row:any)=>{
  optionType.value = 'addFinance';
  boxFormOption.value = financeOption.value;
  boxTableOption.value = financeTableOption.value;
  listTmsFinanceDetail({
    dispatchOrderId: row.id,financeType:2,
    pageNum: 1, pageSize: 999}).then(res => {
    boxTableData.value = res.rows || [];
    pageF.open = true;
    pageF.title = '费用登记';
    boxForm.value = {
      dispatchOrderId: row.id,
      dataSource: 0,
      financeType:2,
    }
  })
}
const handleGenerate = () => {
  optionType.value = 'generate';
  pageF.open = true;
  pageF.title = '生成应收应付费用数据';
  boxTableOption.value = generateTableOption.value;
}
const submitGenerate = () => {
}
onMounted(() => {