sen
5 小时以前 e919f906b27ce1c790ea789cd26051195cd2338d
修改调度单
1个文件已修改
79 ■■■■ 已修改文件
ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ui/admin-ui3/src/views/tms/tmsDispatchOrder/index.vue
@@ -202,7 +202,7 @@
             
          </el-link>
        </el-tooltip>
        <!--
        <!--
        <el-tooltip content="完成行程" placement="top">
          <el-link size="small" type="primary" v-if="[2].includes(row.status)" @click="handleOk(row)" class="link-btn"
            v-hasPermi="['tms:tmsDispatchOrder:okOrder']" underline="never" icon="el-icon-circle-check">
@@ -319,7 +319,7 @@
      </div>
      <div v-if="optionType == 'loading'">
            <el-descriptions v-if="optionNum == 'radio'" style="margin-bottom: 20px" :column="2" border>
        <el-descriptions v-if="optionNum == 'radio'" style="margin-bottom: 20px" :column="2" border>
          <el-descriptions-item label="调度单号">{{ form.dispatchNo }}</el-descriptions-item>
          <el-descriptions-item label="客户">{{ form.customerName }}</el-descriptions-item>
          <el-descriptions-item label="项目名称">{{ form.projectName }}</el-descriptions-item>
@@ -728,6 +728,7 @@
const boxFormRef = ref();
const goodsCrudRef = ref();
const actualFormRef = ref();
const isAutoSettingVehicle = ref(false);
/**
 * 字典公共转换函数
 */
@@ -1356,38 +1357,52 @@
              message: "主驾驶员不能为空", trigger: "change"
            }
          ],
          change: (val: any) => {
            // 防止重复执行
          // 在 mainDriverId 的 change 事件中
          change: async (val: any) => {
            if (data.isChanging) return;
            data.isChanging = true;
            isAutoSettingVehicle.value = true;
            const table = crudRef.value?.getPropRef?.('mainDriverId')?.$refs?.temp;
            if (!table) {
              data.isChanging = false;
              isAutoSettingVehicle.value = false;
              return;
            }
            let active = table.active;
            if (Array.isArray(active)) active = active[0];
               console.log('自动填充成功:', active);
            if (active && active.driverName) {
              try {
            if (active) {
              Object.assign(form.value, {
                mainDriverId: active.id,
                mainDriverName: active.driverName,
              });
                await nextTick(); // 等待清空生效
                const res = await getLastLicensePlate(active.driverName);
              // 获取车牌号并赋值
              getLastLicensePlate(active.driverName).then(res => {
                if (res.code == 200) {
                  form.value.licensePlate = res.data.licensePlate;
                  form.value.vehicleId = res.data.vehicleId
                  form.value.actualVehicleType = res.data.vehicleType;
                if (res.code === 200 && res.data) {
                  const vehicleData = res.data;
                  nextTick(() => {
                    Object.assign(form.value, {
                      licensePlate: vehicleData.licensePlate,
                      vehicleId: vehicleData.vehicleId,
                      actualVehicleType: vehicleData.actualVehicleType,
                      driverName: vehicleData.driverName,
                    });
                  })
                  await nextTick();
                  console.log('自动填充成功:', form.value);
                }
              }).finally(() => {
              } catch (e) {
                console.error("自动获取车牌失败", e);
              } finally {
                data.isChanging = false;
              });
                setTimeout(() => {
                  // isAutoSettingVehicle.value = false;
                }, 500); // 稍微延长一点时间,防止 vehicleId 的 change 事件误触
              }
            } else {
              data.isChanging = false;
              // isAutoSettingVehicle.value = false;
            }
          },
          // change: (val: any) => {
@@ -1403,7 +1418,7 @@
          //       mainDriverName: active.driverName,
          //     });
          //     console.log(active.driverName,'44');
          //     getLastLicensePlate(active.driverName).then(res => {
          //     getLastLicensePlate(active.driverName).then(res => {
          //       console.log(res);
          //     })
@@ -1415,7 +1430,7 @@
            searchMenuSpan: 5,
            column: {
              vehicleProviderName: {
                label: '车辆服务商1', minWidth: 130,
                label: '车辆服务商', minWidth: 130,
                search: true,
              },
              driverName: {
@@ -1506,6 +1521,8 @@
              if (Array.isArray(value)) {
                id = value[0]
              }
              console.log(98521);
              getTmsDriver(id).then(res => {
                return callback(res.data || {})
              })
@@ -1534,11 +1551,19 @@
              message: "车牌号不能为空", trigger: "change"
            }
          ],
          // vehicleId 配置中的 change
          change: (val: any) => {
            // 如果是自动填充触发的,直接返回,不执行后续逻辑
            if (isAutoSettingVehicle.value) {
              return;
            }
            const table = crudRef.value?.getPropRef?.('vehicleId')?.$refs?.temp;
            if (!table) return;
            let active = table.active;
            if (Array.isArray(active)) active = active[0];
            console.log(9852);
            if (active) {
              Object.assign(form.value, {
                vehicleId: active.id,
@@ -1592,10 +1617,14 @@
              if (Array.isArray(value)) {
                id = value[0]
              }
              console.log(555, 'xq1');
              getTmsVehicle(id).then(res => {
                return callback(res.data || {})
              })
            } else {
              console.log(444, 'xq1');
              listTmsVehicle({
                pageSize: page.pageSize,
                pageNum: page.currentPage, ...data,
@@ -2615,10 +2644,14 @@
          if (Array.isArray(value)) {
            id = value[0]
          }
          console.log(998, 'xq1');
          getTmsVehicle(id).then(res => {
            return callback(res.data || {})
          })
        } else {
          console.log(669, 'xq2');
          listTmsVehicle({ pageSize: page.pageSize, pageNum: page.currentPage, ...data }).then(res => {
            return callback({
              total: res.total,
@@ -3563,7 +3596,7 @@
          customsServiceProviderName: form.value.customsServiceProviderName
        };
      });
    }else if (optionNum.value == 'radio') {
    } else if (optionNum.value == 'radio') {
      result = [{
        id: form.value.id,
        customsServiceProviderId: form.value.customsServiceProviderId,
@@ -3583,7 +3616,7 @@
    })
  } else if (optionType.value === 'loading') {
       let result = <any>[];
    let result = <any>[];
    if (optionNum.value == 'checkbox') {
      result = clearanceList.value.map(item => {
        return {
@@ -3592,7 +3625,7 @@
          loadingServiceProviderName: form.value.loadingServiceProviderName
        };
      });
    }else if (optionNum.value == 'radio') {
    } else if (optionNum.value == 'radio') {
      result = [{
        id: form.value.id,
        loadingServiceProviderId: form.value.loadingServiceProviderId,
@@ -4247,7 +4280,7 @@
const handleCustomsAdd = (row) => {
  title.value = '补充委托装卸信息';
   clearanceList.value = [];
  clearanceList.value = [];
  // 2. 清除表格视觉上的选中状态
  if (crudRef.value) {
    crudRef.value.clearSelection();