gaoluyang
6 天以前 8d36dd0ec84133585443750e2001147d5bc127c8
新疆-融邦
1.油品出库要绑定销售订单
已修改3个文件
96 ■■■■■ 文件已修改
src/views/inventoryManagement/dispatchLog/Record.vue 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/stockManagement/OilStockOutDialog.vue 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inventoryManagement/dispatchLog/Record.vue
@@ -307,11 +307,19 @@
                         width="110"
                         align="center">
          <template #default="scope">
            <el-button v-if="isSalesOutRecord(scope.row)"
                       link
            <!-- 审批通过才能录入残油;未通过时置灰并提示原因 -->
            <el-tooltip v-if="isSalesOutRecord(scope.row)"
                        :disabled="isApprovedApproval(scope.row.approvalStatus)"
                        content="审批通过后才能录入残油"
                        placement="top">
              <span>
                <el-button link
                       type="primary"
                           :disabled="!isApprovedApproval(scope.row.approvalStatus)"
                       @click="openResidualOil(scope.row)">录入残油
            </el-button>
              </span>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
@@ -477,15 +485,16 @@
    return approvalStatusLabelMap[status] || "待审批";
  };
  // 通过/驳回固定色;其余(含待审批、空值、未映射但文案为待审批)统一用 warning 预警色
  const getApprovalStatusTagType = status => {
    if (
  // 审批通过判定:数字/字符串/英文枚举三种写法后端都出现过,统一在这里兜住
  const isApprovedApproval = status =>
      status === 1 ||
      status === "1" ||
      status === "approved" ||
      status === "APPROVED"
    )
      return "success";
    status === "APPROVED";
  // 通过/驳回固定色;其余(含待审批、空值、未映射但文案为待审批)统一用 warning 预警色
  const getApprovalStatusTagType = status => {
    if (isApprovedApproval(status)) return "success";
    if (
      status === 2 ||
      status === "2" ||
@@ -602,6 +611,11 @@
  const isSalesOutRecord = row => row?.outCategory === "销售";
  const openResidualOil = row => {
    // 按钮已置灰,这里再兜一层,防止其它入口绕过
    if (!isApprovedApproval(row?.approvalStatus)) {
      proxy.$modal.msgWarning("审批通过后才能录入残油");
      return;
    }
    residualForm.value = {
      id: row.id,
      outboundBatches: row.outboundBatches || "",
src/views/inventoryManagement/stockManagement/OilStockOutDialog.vue
@@ -500,7 +500,7 @@
  import { allOilDepot } from "@/api/basicData/oilDepot.js";
  import { allTankInfo } from "@/api/basicData/tankInfo.js";
  import { allVehicle } from "@/api/basicData/vehicle.js";
  import { listCustomer } from "@/api/basicData/customer.js";
  import { listCustomer, getCustomer } from "@/api/basicData/customer.js";
  const props = defineProps({
    visible: {
@@ -728,6 +728,30 @@
    }
  };
  // 台账带回的客户:customerChange 只是 el-select 的 @change,值由 v-model 写,这里要显式赋值
  const applyLedgerCustomer = row => {
    formState.value.customerId = row.customerId;
    const customer = customerList.value.find(item => item.id === row.customerId);
    if (customer) {
      customerChange(customer.id);
      return;
    }
    formState.value.customerName = row.customerName || "";
    if (!row.customerId) return;
    // 客户档案下拉里没有这条(不在私海或超出加载条数):回查详情补一个候选,否则下拉框显示空白
    getCustomer(row.customerId)
      .then(res => {
        const detail = res?.data;
        if (!detail) return;
        customerList.value = [detail, ...customerList.value];
        formState.value.customerName =
          formState.value.customerName || detail.customerName || "";
        formState.value.contactPerson = detail.contactPerson || "";
        formState.value.contactPhone = detail.contactPhone || "";
      })
      .catch(() => {});
  };
  // 车辆选择改变:车牌号、车挂牌号与司机信息由车辆主数据带出,出库时司机可手动覆盖
  const vehicleChange = id => {
    const vehicle = vehicleList.value.find(item => item.id === id);
@@ -873,9 +897,7 @@
    }
    // 出库类别与客户以台账为准(后端也会强制覆盖),前端同步展示并置灰
    formState.value.outCategory = row.ledgerType === "代储" ? "代储" : "销售";
    customerChange(row.customerId);
    formState.value.customerName =
      row.customerName || formState.value.customerName || "";
    applyLedgerCustomer(row);
    if (row.ledgerType === "代储") {
      formState.value.oilDepotId = row.oilDepotId;
      formState.value.oilDepotName = row.oilDepotName || "";
@@ -899,11 +921,15 @@
        formState.value.netWeight = netWeight.value;
        formState.value.lossQuantity = lossQuantity.value;
        formState.value.actualVolume = actualVolume.value;
        // 照片转 JSON 字符串提交(后端字段为文本存储)
        formState.value.loadingPhotos = JSON.stringify(formState.value.loadingPhotos || []);
        formState.value.poundPhotos = JSON.stringify(formState.value.poundPhotos || []);
        // 照片转 JSON 字符串提交(后端字段为文本存储);不能直接改 formState,
        // 否则提交失败时绑定在同一字段上的 ImageUpload 会拿到字符串、图片全丢
        const payload = {
          ...formState.value,
          loadingPhotos: JSON.stringify(formState.value.loadingPhotos || []),
          poundPhotos: JSON.stringify(formState.value.poundPhotos || []),
        };
        addOilOutRecordOnly(formState.value).then(res => {
        addOilOutRecordOnly(payload).then(res => {
          proxy.$modal.msgSuccess("提交成功");
          closeModal();
          emit("completed");
src/views/salesManagement/salesLedger/index.vue
@@ -193,18 +193,18 @@
                :formatter="sensitiveAmountFormatter"
              />
              <!--操作-->
              <el-table-column Width="60px" label="操作" align="center">
                <template #default="scope">
                  <el-button
                    link
                    type="primary"
                    :disabled="!canShip(scope.row)"
                    @click="openDeliveryForm(scope.row)"
                  >
                    发货
                  </el-button>
                </template>
              </el-table-column>
<!--              <el-table-column Width="60px" label="操作" align="center">-->
<!--                <template #default="scope">-->
<!--                  <el-button-->
<!--                    link-->
<!--                    type="primary"-->
<!--                    :disabled="!canShip(scope.row)"-->
<!--                    @click="openDeliveryForm(scope.row)"-->
<!--                  >-->
<!--                    发货-->
<!--                  </el-button>-->
<!--                </template>-->
<!--              </el-table-column>-->
            </el-table>
          </template>
        </el-table-column>