曹睿
2025-04-23 f825462aead9ccfaedbc2b822d0114a807b7fe43
src/pages/production/twist/receive/steelCore/form.vue
@@ -2,36 +2,28 @@
  <wd-form ref="form" :model="model" class="relative form_box">
    <wd-cell-group :border="true">
      <wd-input
        v-model="model.steelCoreName"
        label="钢芯名称"
        v-model="model.model"
        label="规格型号"
        label-width="100px"
        prop="steelCoreName"
        prop="model"
        clearable
        placeholder="请输入钢芯名称"
        placeholder="请输入规格型号"
      />
      <wd-input
        v-model="model.plateNo"
        label="盘号"
        v-model="model.monofilamentNumber"
        label="样品编号"
        label-width="100px"
        prop="plateNo"
        prop="monofilamentNumber"
        clearable
        placeholder="请输入盘号"
      />
      <wd-input
        v-model="model.length"
        label="长度"
        v-model="model.amount"
        label="数量"
        label-width="100px"
        prop="length"
        prop="amount"
        clearable
        placeholder="请输入长度"
      />
      <wd-input
        v-model="model.weight"
        label="重量"
        label-width="100px"
        prop="weight"
        clearable
        placeholder="请输入重量"
      />
      <wd-input
        v-model="model.manufacturers"
@@ -47,13 +39,40 @@
<script lang="ts" setup>
import useFormData from "@/hooks/useFormData";
import TwistApi from "@/api/product/twist";
import { useToast } from "wot-design-uni";
const emits = defineEmits(["refresh"]);
const paramsId = ref();
const toast = useToast();
const { form: model } = useFormData({
  steelCoreName: undefined, // 钢芯名称
  plateNo: undefined, // 盘号
  length: undefined, // 长度
  weight: undefined, // 重量
  model: undefined, // 规格型号
  monofilamentNumber: undefined, // 样品编号
  amount: undefined, // 数量
  manufacturers: undefined, // 厂家
  type: "钢芯",
});
const submit = async () => {
  const { code } = await TwistApi.addStrandedWireDish([
    {
      wireId: paramsId.value,
      ...model,
    },
  ]);
  if (code == 200) {
    toast.success("新增成功");
    emits("refresh");
    return true;
  }
};
onLoad((options: any) => {
  paramsId.value = options.id;
});
defineExpose({
  submit,
});
</script>