fix: 绞线报工的盘具领用和芯线领用的厂家字段使用字典维护做下拉框
已修改4个文件
129 ■■■■■ 文件已修改
src/pages/production/twist/receive/plate/form.vue 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/twist/receive/plate/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/twist/receive/steelCore/form.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/twist/report/draw.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/production/twist/receive/plate/form.vue
@@ -27,13 +27,25 @@
        clearable
        placeholder="请输入数量"
      />
      <wd-input
      <wd-picker
        v-model="model.unit"
        :columns="unitOptions"
        label="单位"
        label-width="100px"
        prop="unit"
        placeholder="请选择单位"
        clearable
        @confirm="handleUnitChange"
      />
      <wd-picker
        v-model="model.supplier"
        :columns="supplierOptions"
        label="厂家"
        label-width="100px"
        prop="supplier"
        placeholder="请选择厂家"
        clearable
        placeholder="请输入厂家"
        @confirm="handleSupplierChange"
      />
    </wd-cell-group>
    <wd-toast />
@@ -41,6 +53,7 @@
</template>
<script setup lang="ts">
import { onMounted, watch } from "vue";
import useFormData from "@/hooks/useFormData";
import TwistApi from "@/api/product/twist";
import ManageApi from "@/api/product/manage";
@@ -64,6 +77,7 @@
  diskMaterial: undefined, // 盘具类型
  model: undefined, // 尺寸
  amount: undefined, // 数量
  unit: "只", // 单位,默认值为"只"
  supplier: undefined,
  type: "盘具",
});
@@ -75,6 +89,12 @@
// 盘具类型字典数据
const diskMaterialOptions = ref<Array<{ label: string; value: string }>>([]);
const diskMaterialValue = ref("");
// 单位字典数据
const unitOptions = ref<Array<{ label: string; value: string }>>([]);
// 厂家字典数据
const supplierOptions = ref<Array<{ label: string; value: string }>>([]);
// 加载盘具类型字典数据
const loadDiskMaterialDict = async () => {
@@ -91,9 +111,56 @@
  }
};
// 加载单位字典数据
const loadUnitDict = async () => {
  try {
    const res = await ManageApi.dictAPI("technical_weight_unit");
    if (res.data && Array.isArray(res.data)) {
      unitOptions.value = res.data.map((item: any) => ({
        label: item.dictLabel || "",
        value: item.dictValue || "",
      }));
      // 设置默认值为"只",如果字典中有"只"选项
      const defaultOption = unitOptions.value.find(
        (item) => item.label === "只" || item.value === "只"
      );
      if (defaultOption && !model.unit) {
        model.unit = defaultOption.value;
      }
    }
  } catch (error) {
    // 加载字典失败,静默处理
  }
};
// 加载厂家字典数据
const loadSupplierDict = async () => {
  try {
    const res = await ManageApi.dictAPI("factory");
    if (res.data && Array.isArray(res.data)) {
      supplierOptions.value = res.data.map((item: any) => ({
        label: item.dictLabel || "",
        value: item.dictValue || "",
      }));
    }
  } catch (error) {
    // 加载字典失败,静默处理
  }
};
// 处理盘具类型选择
const handleDiskMaterialChange = (val: any) => {
  model.diskMaterial = val.value;
};
// 处理单位选择
const handleUnitChange = (val: any) => {
  model.unit = val.value;
};
// 处理厂家选择
const handleSupplierChange = (val: any) => {
  model.supplier = val.value;
};
// 监听 model.diskMaterial 变化,同步选择器显示
@@ -139,6 +206,7 @@
        diskMaterial: model.diskMaterial,
        model: model.model,
        amount: model.amount,
        unit: model.unit,
        supplier: model.supplier,
        type: model.type,
      };
@@ -175,6 +243,7 @@
    model.diskMaterial = currentItem.diskMaterial;
    model.model = currentItem.model;
    model.amount = currentItem.amount;
    model.unit = currentItem.unit || "只";
    model.supplier = currentItem.supplier;
    model.type = currentItem.type || "盘具";
    // 设置盘具类型的回显值
@@ -188,6 +257,8 @@
onMounted(async () => {
  await loadDiskMaterialDict();
  await loadUnitDict();
  await loadSupplierDict();
});
// 监听编辑数据变化,自动回显
@@ -198,6 +269,7 @@
      model.diskMaterial = newData.diskMaterial || "";
      model.model = newData.model || "";
      model.amount = newData.amount || "";
      model.unit = newData.unit || "只";
      model.supplier = newData.supplier || "";
      model.type = newData.type || "盘具";
      diskMaterialValue.value = newData.diskMaterial || "";
@@ -211,6 +283,7 @@
  model.diskMaterial = undefined;
  model.model = undefined;
  model.amount = undefined;
  model.unit = "只";
  model.supplier = undefined;
  model.type = "盘具";
  diskMaterialValue.value = "";
src/pages/production/twist/receive/plate/index.vue
@@ -85,6 +85,10 @@
    prop: "amount",
  },
  {
    label: "单位",
    prop: "unit",
  },
  {
    label: "厂家",
    prop: "supplier",
    span: 14,
src/pages/production/twist/receive/steelCore/form.vue
@@ -43,19 +43,22 @@
        clearable
        placeholder="请输入重量"
      />
      <wd-input
      <wd-picker
        v-model="model.supplier"
        :columns="supplierOptions"
        label="厂家"
        label-width="100px"
        prop="supplier"
        placeholder="请选择厂家"
        clearable
        placeholder="请输入厂家"
        @confirm="handleSupplierChange"
      />
    </wd-cell-group>
  </wd-form>
</template>
<script lang="ts" setup>
import { onMounted, watch } from "vue";
import useFormData from "@/hooks/useFormData";
import TwistApi from "@/api/product/twist";
import ManageApi from "@/api/product/manage";
@@ -95,6 +98,9 @@
const diskMaterialOptions = ref<Array<{ label: string; value: string }>>([]);
const diskMaterialValue = ref("");
// 厂家字典数据
const supplierOptions = ref<Array<{ label: string; value: string }>>([]);
// 加载芯线类型字典数据
const loadDiskMaterialDict = async () => {
  try {
@@ -110,9 +116,29 @@
  }
};
// 加载厂家字典数据
const loadSupplierDict = async () => {
  try {
    const res = await ManageApi.dictAPI("factory");
    if (res.data && Array.isArray(res.data)) {
      supplierOptions.value = res.data.map((item: any) => ({
        label: item.dictLabel || "",
        value: item.dictValue || "",
      }));
    }
  } catch (error) {
    // 加载字典失败,静默处理
  }
};
// 处理芯线类型选择
const handleDiskMaterialChange = (val: any) => {
  model.diskMaterial = val.value;
};
// 处理厂家选择
const handleSupplierChange = (val: any) => {
  model.supplier = val.value;
};
// 监听 model.diskMaterial 变化,同步选择器显示
@@ -256,6 +282,7 @@
onMounted(async () => {
  await loadDiskMaterialDict();
  await loadSupplierDict();
});
defineExpose({
src/pages/production/twist/report/draw.vue
@@ -161,11 +161,14 @@
                ></wd-input>
              </wd-form-item>
              <wd-form-item label="绞向" prop="twistedDirection" required>
                <wd-input
                <wd-select-picker
                  v-model="localSteelData.twistedDirection"
                  :columns="twistDirectionColumns"
                  type="radio"
                  placeholder="请选择绞向"
                  :clearable="false"
                  :disabled="false"
                  placeholder="请输入"
                ></wd-input>
                />
              </wd-form-item>
              <wd-form-item label="外径" prop="outerDiameter" required>
                <wd-input
@@ -199,7 +202,7 @@
</template>
<script setup lang="ts">
import { ref, watch, nextTick } from "vue";
import { ref, watch, nextTick, onMounted } from "vue";
import { useToast } from "wot-design-uni";
import TwistApi from "@/api/product/twist";
import ManageApi from "@/api/product/manage";
@@ -246,6 +249,12 @@
const paintQualityOptions = ref<Array<{ label: string; value: string | number }>>([]);
const weldQualityOptions = ref<Array<{ label: string; value: string | number }>>([]);
// 绞向选项
const twistDirectionColumns = [
  { label: "左向", value: "左向" },
  { label: "右向", value: "右向" },
];
// 从数据字典中加载数据
const loadDictData = async () => {
  try {