zhangwencui
昨天 044596092e1ac5dd03cdbfe6af3e87de9c2da0ee
问题修改
已修改2个文件
129 ■■■■ 文件已修改
src/views/basicData/product/index.vue 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionPlan/productionPlan/index.vue 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/product/index.vue
@@ -77,7 +77,7 @@
      </div>
    </div>
    <div class="right">
      <div style="margin-bottom: 10px"
      <div style="margin-bottom: 10px; display: flex; align-items: center; gap: 10px"
           v-if="isShowButton">
        <el-button type="primary"
                   @click="openModelDia('add')">
@@ -85,9 +85,18 @@
        </el-button>
        <ImportExcel :product-id="currentId"
                     @uploadSuccess="getModelList" />
        <el-input v-model="specification"
                  placeholder="规格型号"
                  style="width: 150px"
                  clearable
                  @change="getModelList" />
        <el-input v-model="materialCode"
                  placeholder="物料编号"
                  style="width: 150px"
                  clearable
                  @change="getModelList" />
        <el-button type="danger"
                   @click="handleDelete"
                   style="margin-left: 10px"
                   plain>
          删除
        </el-button>
@@ -95,10 +104,11 @@
      <PIMTable rowKey="id"
                :column="tableColumn"
                :tableData="tableData"
                :page="page"
                :isSelection="true"
                :isShowPagination="false"
                @selection-change="handleSelectionChange"
                :tableLoading="tableLoading"></PIMTable>
                :tableLoading="tableLoading"
                @pagination="pagination"></PIMTable>
    </div>
    <el-dialog v-model="productDia"
               title="产品"
@@ -129,6 +139,7 @@
              <el-select v-model="form.inventoryCategoryId"
                         placeholder="请选择存货类别"
                         clearable
                         filterable
                         style="width: 100%">
                <el-option v-for="item in inventoryCategoryList"
                           :key="item.id"
@@ -145,6 +156,7 @@
              <el-select v-model="form.materialTypeId"
                         placeholder="请选择物料类型"
                         clearable
                         filterable
                         style="width: 100%">
                <el-option v-for="item in materialTypeList"
                           :key="item.id"
@@ -206,6 +218,15 @@
                        @keydown.enter.prevent />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="物料编码:"
                          prop="materialCode">
              <el-input v-model="modelForm.materialCode"
                        placeholder="请输入物料编码"
                        clearable
                        @keydown.enter.prevent />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
@@ -214,6 +235,7 @@
              <el-select v-model="modelForm.supplyType"
                         placeholder="请选择供应方式"
                         clearable
                         filterable
                         style="width: 100%">
                <el-option label="自制"
                           value="自制" />
@@ -305,6 +327,8 @@
  const expandedKeys = ref([]);
  const inventoryCategoryList = ref([]);
  const materialTypeList = ref([]);
  const specification = ref("");
  const materialCode = ref("");
  const getloadData = () => {
    loadData()
@@ -357,6 +381,10 @@
      prop: "specification",
    },
    {
      label: "物料编码",
      prop: "materialCode",
    },
    {
      label: "单位",
      prop: "baseUnit",
    },
@@ -379,6 +407,11 @@
  const tableLoading = ref(false);
  const isShowButton = ref(false);
  const selectedRows = ref([]);
  const page = reactive({
    current: 1,
    size: 10,
    total: 0,
  });
  const data = reactive({
    form: {
@@ -401,11 +434,13 @@
    modelForm: {
      specification: "",
      supplyType: "",
      materialCode: "",
      id: null,
    },
    modelRules: {
      specification: [{ required: true, message: "请输入", trigger: "blur" }],
      supplyType: [{ required: true, message: "请选择", trigger: "change" }],
      materialCode: [{ required: true, message: "请输入", trigger: "blur" }],
    },
    configForm: {
      configName: "",
@@ -508,12 +543,14 @@
    modelForm.value.specification = "";
    modelForm.value.supplyType = "";
    modelForm.value.id = null;
    modelForm.value.materialCode = null;
    if (type === "edit" && data) {
      // 编辑模式,回填数据
      modelForm.value.specification = data.specification || "";
      modelForm.value.supplyType = data.supplyType || "";
      modelForm.value.id = data.skuId || null;
      modelForm.value.materialCode = data.materialCode || null;
    }
  };
  // 提交产品名称修改
@@ -667,6 +704,7 @@
        const params = {
          materialId: currentId.value,
          specification: modelForm.value.specification,
          materialCode: modelForm.value.materialCode,
          supplyType: modelForm.value.supplyType,
        };
        if (modelOperationType.value === "add") {
@@ -699,6 +737,11 @@
  };
  // 查询规格型号
  const pagination = obj => {
    page.current = obj.page;
    page.size = obj.limit;
    getModelList();
  };
  const getModelList = () => {
    if (!currentId.value) {
      return;
@@ -706,9 +749,14 @@
    tableLoading.value = true;
    modelListPage({
      materialId: currentId.value,
      current: page.current,
      size: page.size,
      specification: specification.value,
      materialCode: materialCode.value,
    }).then(res => {
      console.log("res", res);
      tableData.value = res.data;
      tableData.value = res.data.records || [];
      page.total = res.data.total;
      tableLoading.value = false;
    });
  };
src/views/productionPlan/productionPlan/index.vue
@@ -248,6 +248,7 @@
                      prop="productMaterialSkuId">
          <el-select v-model="form.productMaterialSkuId"
                     @change="handleChangeSpecification"
                     filterable
                     placeholder="请选择">
            <el-option v-for="item in specificationOptions"
                       :key="item.skuId"
@@ -301,8 +302,14 @@
        </el-form-item>
        <el-form-item label="强度"
                      prop="strength">
          <el-input v-model="form.strength"
                    placeholder="请输入强度" />
          <el-select v-model="form.strength"
                     placeholder="请选择强度"
                     style="width: 100%">
            <el-option label="A3.5"
                       value="A3.5" />
            <el-option label="A5.0"
                       value="A5.0" />
          </el-select>
        </el-form-item>
        <el-form-item label="备注 1"
                      prop="remarkOne">
@@ -387,40 +394,46 @@
      label: "块数",
      prop: "quantity",
      className: "quantity-cell",
      formatData: cell => (cell ? `${cell}块` : ""),
    },
    {
      label: "方数",
      prop: "volume",
      width: "150px",
      className: "volume-cell",
      formatData: cell => (cell ? `${cell}方` : ""),
    },
    {
      label: "已下发方数",
      prop: "assignedQuantity",
      width: "150px",
      className: "spec-cell",
      formatData: cell => (cell ? `${cell}方` : ""),
    },
    {
      label: "长",
      prop: "length",
      className: "dimension-cell",
      formatData: cell => (cell ? `${cell}mm` : ""),
    },
    {
      label: "宽",
      prop: "width",
      className: "dimension-cell",
      formatData: cell => (cell ? `${cell}mm` : ""),
    },
    {
      label: "高",
      prop: "height",
      className: "dimension-cell",
      formatData: cell => (cell ? `${cell}mm` : ""),
    },
    {
      label: "流水号",
      prop: "serialNo",
      width: "150px",
      className: "code-cell",
    },
    // {
    //   label: "流水号",
    //   prop: "serialNo",
    //   width: "150px",
    //   className: "code-cell",
    // },
    {
      label: "计划开始日期",
      prop: "startDate",
@@ -439,12 +452,12 @@
      label: "强度",
      prop: "strength",
    },
    // {
    //   label: "数据来源",
    //   width: "100px",
    //   prop: "dataSourceType",
    //   formatData: cell => (cell == 1 ? "同步" : "手动"),
    // },
    {
      label: "数据来源",
      width: "100px",
      prop: "dataSourceType",
      formatData: cell => (cell == 1 ? "同步" : "手动"),
    },
    {
      label: "备注 1",
      prop: "remarkOne",
@@ -465,6 +478,9 @@
          name: "编辑",
          type: "primary",
          link: true,
          showHide: row => {
            return row.status == 0;
          },
          clickFun: row => {
            handleEdit(row);
          },
@@ -473,6 +489,9 @@
          name: "删除",
          type: "danger",
          link: true,
          showHide: row => {
            return row.status == 0;
          },
          clickFun: row => {
            handleDelete(row);
          },
@@ -480,12 +499,12 @@
        {
          name: "下发",
          type: "text",
          disabled: row => {
          showHide: row => {
            // 计算剩余方数
            const remainingVolume =
              (row.volume || 0) - (row.assignedQuantity || 0);
            // 如果剩余方数小于等于0,禁止选择
            return remainingVolume <= 0;
            return remainingVolume > 0;
          },
          clickFun: row => {
            // 单独下发操作
@@ -658,19 +677,31 @@
  const fetchSpecificationOptions = materialId => {
    specificationOptions.value = [];
    if (materialId) {
      modelListPage({ materialId: materialId }).then(res => {
        specificationOptions.value = res.data;
      });
      modelListPage({ materialId: materialId, size: -1, current: -1 }).then(
        res => {
          specificationOptions.value = res.data.records;
        }
      );
    }
  };
  const handleChangeSpecification = value => {
    form.materialCode = undefined;
    const selectedModel = specificationOptions.value.find(
      item => item.id === value
      item => item.skuId === value
    );
    if (selectedModel) {
      form.materialCode = selectedModel.materialCode;
      // 解析规格字符串获取长宽高
      const specification = selectedModel.specification;
      if (specification) {
        const dimensions = specification.match(/^(\d+)\*(\d+)\*(\d+)$/);
        if (dimensions && dimensions.length === 4) {
          form.length = parseInt(dimensions[1]);
          form.width = parseInt(dimensions[2]);
          form.height = parseInt(dimensions[3]);
        }
      }
    }
  };