湟水峡
1.销售订单可绑定多条生产订单
2.生产订单页面展示销售订单优化
已修改3个文件
121 ■■■■■ 文件已修改
src/api/productionManagement/productionOrder.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/index.vue 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/productionManagement/productionOrder.js
@@ -18,6 +18,15 @@
  });
}
// 根据产品型号ID查询生产订单列表
export function listByProductModelId(data) {
  return request({
    url: "/productOrder/listByProductModelId",
    method: "post",
    data,
  });
}
// 生产订单-按产品型号查询可用工艺路线列表
export function listProcessRoute(query) {
  return request({
src/views/productionManagement/productionOrder/index.vue
@@ -71,6 +71,20 @@
            :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''"
          />
        </template>
        <template #salesContractNo="{ row }">
          <template v-if="row.salesContractNos && row.salesContractNos.length > 0">
            <el-tag v-for="(no, idx) in row.salesContractNos" :key="idx" size="small" style="margin: 2px;">{{ no }}</el-tag>
          </template>
          <span v-else-if="row.salesContractNo">{{ row.salesContractNo }}</span>
          <span v-else>-</span>
        </template>
        <template #customerName="{ row }">
          <template v-if="row.customerNames && row.customerNames.length > 0">
            <el-tag v-for="(name, idx) in row.customerNames" :key="idx" size="small" style="margin: 2px;">{{ name }}</el-tag>
          </template>
          <span v-else-if="row.customerName">{{ row.customerName }}</span>
          <span v-else>-</span>
        </template>
      </PIMTable>
    </div>
    <el-dialog v-model="bindRouteDialogVisible"
@@ -148,11 +162,15 @@
      label: "销售合同号",
      prop: "salesContractNo",
      width: '150px',
      dataType: "slot",
      slot: "salesContractNo",
    },
    {
      label: "客户名称",
      prop: "customerName",
      width: '200px',
      dataType: "slot",
      slot: "customerName",
    },
    {
      label: "产品名称",
@@ -196,12 +214,12 @@
      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
      width: 120,
    },
    {
      label: "交付日期",
      prop: "deliveryDate",
      formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
      width: 120,
    },
    // {
    //   label: "交付日期",
    //   prop: "deliveryDate",
    //   formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
    //   width: 120,
    // },
    {
      dataType: "action",
      label: "操作",
@@ -400,7 +418,12 @@
    productOrderListPage(params)
      .then(res => {
        tableLoading.value = false;
        tableData.value = res.data.records;
        const records = res.data.records || [];
        records.forEach(row => {
          row.salesContractNos = row.salesContractNo ? row.salesContractNo.split(',').filter(Boolean) : [];
          row.customerNames = row.customerName ? row.customerName.split(',').filter(Boolean) : [];
        });
        tableData.value = records;
        page.total = res.data.total;
      })
      .catch(() => {
src/views/salesManagement/salesLedger/index.vue
@@ -123,6 +123,14 @@
        <el-table-column label="录入人" prop="entryPersonName" width="100" show-overflow-tooltip />
        <el-table-column label="录入日期" prop="entryDate" width="120" show-overflow-tooltip />
        <el-table-column label="签订日期" prop="executionDate" width="120" show-overflow-tooltip />
        <el-table-column label="生产订单号" min-width="180" show-overflow-tooltip>
          <template #default="scope">
            <template v-if="scope.row.productionOrders && scope.row.productionOrders.length > 0">
              <el-tag v-for="order in scope.row.productionOrders" :key="order.id" size="small" style="margin: 2px;">{{ order.npsNo }}</el-tag>
            </template>
            <span v-else>-</span>
          </template>
        </el-table-column>
        <el-table-column fixed="right" label="操作" min-width="140" align="center">
          <template #default="scope">
            <el-button link type="primary" @click="openForm('edit', scope.row)" :disabled="!scope.row.isEdit || scope.row.hasProductionRecord">编辑</el-button>
@@ -208,6 +216,30 @@
          <el-col :span="12">
            <el-form-item label="付款方式">
              <el-input v-model="form.paymentMethod" placeholder="请输入" clearable :disabled="operationType === 'view'" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="生产订单:">
              <el-select
                v-model="form.productionOrderIds"
                multiple
                filterable
                remote
                :remote-method="getProductOrderOptions"
                :loading="productOrderLoading"
                placeholder="请选择生产订单"
                clearable
                collapse-tags
                collapse-tags-tooltip
                :disabled="operationType === 'view'"
              >
                <el-option
                  v-for="item in productOrderOptions"
                  :key="item.id"
                  :label="item.npsNo + (item.productCategory ? ' - ' + item.productCategory : '') + (item.specificationModel ? ' - ' + item.specificationModel : '')"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
@@ -631,6 +663,7 @@
} from "@/api/salesManagement/salesLedger.js";
import { getQuotationDetail } from "@/api/salesManagement/salesQuotation.js";
import { modelList, productTreeList } from "@/api/basicData/product.js";
import { productOrderListPage, listByProductModelId } from "@/api/productionManagement/productionOrder.js";
import useFormData from "@/hooks/useFormData.js";
import dayjs from "dayjs";
import { getCurrentDate } from "@/utils/index.js";
@@ -646,6 +679,8 @@
const customerOption = ref([]);
const productOptions = ref([]);
const modelOptions = ref([]);
const productOrderOptions = ref([]);
const productOrderLoading = ref(false);
const tableLoading = ref(false);
const page = reactive({
  current: 1,
@@ -686,6 +721,7 @@
    productData: [],
    executionDate: "",
    paymentMethod: "",
    productionOrderIds: [],
  },
  rules: {
    salesman: [{ required: true, message: "请选择", trigger: "change" }],
@@ -830,6 +866,24 @@
    productOptions.value = convertIdToValue(list);
    return productOptions.value;
  });
};
// 获取生产订单列表
const getProductOrderOptions = (query) => {
  productOrderLoading.value = true;
  const productModelIds = productData.value
    .map(item => item.productModelId)
    .filter(id => id != null);
  if (productModelIds.length > 0) {
    listByProductModelId(productModelIds)
      .then((res) => {
        productOrderOptions.value = res?.data?.records || res?.data || res || [];
      })
      .finally(() => {
        productOrderLoading.value = false;
      });
    return;
  }
  productOrderLoading.value = false;
};
const formattedNumber = (row, column, cellValue) => {
  return parseFloat(cellValue).toFixed(2);
@@ -1000,6 +1054,9 @@
    // 新增时重置审批人节点
    approverNodes.value = [{ id: 1, userId: null }];
    nextApproverId = 2;
    form.value.productionOrderIds = [];
    // 新增时直接加载生产订单列表
    getProductOrderOptions();
  } else {
    currentId.value = row.id;
    getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
@@ -1007,6 +1064,23 @@
      form.value.entryPerson = Number(res.entryPerson);
      productData.value = form.value.productData;
      fileList.value = form.value.salesLedgerFiles;
      // 回显生产订单
      if (res.productionOrders && res.productionOrders.length > 0) {
        form.value.productionOrderIds = res.productionOrders.map(order => order.id);
        productOrderOptions.value = res.productionOrders;
      } else if (res.productOrderIds) {
        if (Array.isArray(res.productOrderIds)) {
          form.value.productionOrderIds = res.productOrderIds.map(id => Number(id));
        } else if (typeof res.productOrderIds === "string") {
          form.value.productionOrderIds = res.productOrderIds.split(",").filter(id => id).map(id => Number(id));
        } else {
          form.value.productionOrderIds = [];
        }
      } else {
        form.value.productionOrderIds = [];
      }
      // 编辑时根据产品型号ID加载生产订单列表
      getProductOrderOptions();
      // 回显审批人节点
      if (res.approveUserIds) {
        const userIds = res.approveUserIds.split(",").filter(id => id);
@@ -1204,6 +1278,7 @@
const closeDia = () => {
  proxy.resetForm("formRef");
  dialogFormVisible.value = false;
  productOrderOptions.value = [];
  // 重置审批人节点
  approverNodes.value = [{ id: 1, userId: null }];
  nextApproverId = 2;