曹睿
4 天以前 665c18b68a5dedba63e00f89f763539967fb7f08
src/pages/production/wire/report/wireForm.vue
@@ -6,9 +6,12 @@
        label="领用杆号"
        label-width="100px"
        prop="poleNumber"
        clearable
        placeholder="请输入领用杆号"
      />
      >
        <template #suffix>
          <wd-icon name="scan" @click="openScan" />
        </template>
      </wd-input>
      <wd-input
        v-model="model.poleWeight"
        label="杆重"
@@ -18,12 +21,12 @@
        placeholder="请输入杆重"
      />
      <wd-input
        v-model="model.monofilamentNumber"
        label="单丝盘号"
        v-model="model.poleModel"
        label="杆型号"
        label-width="100px"
        prop="monofilamentNumber"
        prop="poleModel"
        clearable
        placeholder="请输入机台"
        placeholder="请输入杆型号"
      />
      <wd-input
        v-model="model.model"
@@ -34,31 +37,60 @@
        placeholder="请输入规格型号"
      />
      <wd-input
        v-model="model.ontLength"
        label="盘长"
        v-model="model.oneLength"
        label="盘长(m)"
        label-width="100px"
        prop="ontLength"
        prop="oneLength"
        clearable
        placeholder="请输入盘长"
      />
      <wd-input
        v-model="model.theoryWeight"
        label="理论重量"
        v-model="model.polePackageNumber"
        label-width="100px"
        prop="theoryWeight"
        prop="polePackageNumber"
        clearable
        placeholder="请输入理论重量"
      />
        placeholder="请输入杆包号"
      >
          <template #label>
            <span style="color: #F56C6C">杆包号</span>
          </template>
      </wd-input>
      <wd-input
        v-model="model.dishModel"
        label-width="100px"
        prop="dishModel"
        clearable
        placeholder="请输入盘型号"
      >
          <template #label>
            <span style="color: #F56C6C">盘型号</span>
          </template>
      </wd-input>
      <wd-input
        v-model="model.actuallyLength"
        label-width="100px"
        prop="actuallyLength"
        clearable
        placeholder="请输入实际长度"
      >
          <template #label>
            <span style="color: #F56C6C">实际长度(m)</span>
          </template>
      </wd-input>
      <wd-input
        v-model="model.actuallyWeight"
        label="实际重量"
        label-width="100px"
        prop="actuallyWeight"
        clearable
        placeholder="请输入实际重量"
      />
      >
          <template #label>
            <span style="color: #F56C6C">实际重量(kg)</span>
          </template>
      </wd-input>
    </wd-cell-group>
    <wd-toast />
    <Scan ref="scanRef" />
  </wd-form>
</template>
@@ -66,16 +98,21 @@
import useFormData from "@/hooks/useFormData";
import { useToast } from "wot-design-uni";
import WireApi from "@/api/product/wire";
import Scan from "@/components/scan/index.vue";
const paramsId = ref();
const scanRef = ref();
const toast = useToast();
const { form: model } = useFormData({
const { form: model, resetForm } = useFormData({
  poleNumber: undefined, // 领用杆号
  poleWeight: undefined, // 客户名称
  monofilamentNumber: undefined, // 单丝盘号
  poleWeight: undefined, // 杆重
  poleModel: undefined, // 杆型号
  model: undefined, // 规格型号
  polePackageNumber: undefined, // 杆包号
  dishModel: undefined, // 盘型号
  oneLength: undefined, // 盘长
  singleDisc: undefined, // 单丝盘长
  actuallyLength: undefined, // 实际长度
  actuallyWeight: undefined, // 实际重量
});
const submit = async () => {
@@ -86,6 +123,7 @@
  });
  if (code == 200) {
    toast.success("提交成功");
    resetForm()
    return true;
  } else {
    toast.error("提交失败");
@@ -93,8 +131,32 @@
  }
};
const openScan = () => {
  scanRef.value.triggerScan();
};
//  监听扫码
const getScanCode = (code: any) => {
  console.log("自定义扫描的结果回调函数:", code.code);
  // console.log("自定义扫描的结果回调函数", JSON.parse(code));
  const arr = code.code.split(",");
  model.poleNumber = arr[3]; //  领用杆号
  model.poleWeight = arr[4]; //  杆重
  model.poleModel = 'Φ' + arr[1].slice(2); //  杆型号
};
onLoad((options: any) => {
  paramsId.value = options.id;
  model.model = options.model;
  console.log("options", options);
  model.oneLength = options.oneLength;
  // 开启广播监听事件
  uni.$on("scan", getScanCode);
});
onUnload(() => {
  // 开启广播监听事件
  uni.$off("scan", getScanCode);
});
defineExpose({
@@ -103,8 +165,6 @@
</script>
<style lang="scss" scoped>
.form_box {
}
.submit_btn {
  position: absolute;
  bottom: 0;