| | |
| | | {{ formatValue(recordData.fixedInfo?.tensionSetting, "N/m") }} |
| | | </wd-form-item> |
| | | <!-- 绞制外径(可编辑) --> |
| | | <wd-form-item label="绞合外径" prop="twistedOuterDiameter" required> |
| | | <wd-form-item :label="getDiameterTypeLabel()" prop="twistedOuterDiameter" required> |
| | | <template v-if="isEdit"> |
| | | <wd-input |
| | | v-model="formData.twistedOuterDiameter" |
| | | placeholder="请输入绞合外径(mm)" |
| | | type="number" |
| | | /> |
| | | <view style="display: flex; flex-direction: column; gap: 8px"> |
| | | <wd-select-picker |
| | | v-model="formData.diameterType" |
| | | :columns="diameterTypeColumns" |
| | | type="radio" |
| | | placeholder="请选择类型" |
| | | :clearable="false" |
| | | @change="handleDiameterTypeChange" |
| | | /> |
| | | <wd-input |
| | | v-model="formData.twistedOuterDiameter" |
| | | :placeholder="`请输入${getDiameterTypeLabel()}`" |
| | | type="number" |
| | | /> |
| | | </view> |
| | | </template> |
| | | <template v-else> |
| | | {{ formatValue(formData.twistedOuterDiameter, "mm") }} |
| | |
| | | </wd-col> |
| | | </wd-row> |
| | | |
| | | <!-- 自检记录详情模块 --> |
| | | <!-- 工艺记录详情模块 --> |
| | | <wd-row> |
| | | <view style="margin: 10rpx"> |
| | | <text class="title">{{ "自检记录详情" }}</text> |
| | | <text class="title">{{ "工艺记录详情" }}</text> |
| | | </view> |
| | | <wd-col :span="24"> |
| | | <wd-form-item label="记录位置" prop="recordPosition"> |
| | |
| | | </div> |
| | | </wd-popup> |
| | | <wd-toast /> |
| | | <!-- 扫码组件 --> |
| | | <Scan ref="scanRef" emit-name="scanJX" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import AttachmentUpload from "../upload.vue"; |
| | | import { useUserStore } from "@/store/modules/user"; |
| | | import { useScanCode } from "@/composables/useScanCode"; |
| | | import Scan from "@/components/scan/index.vue"; |
| | | |
| | | const paramsType = ref(""); |
| | | const paramsId = ref(""); |
| | |
| | | const attachmentRef = ref<any>(null); |
| | | const detailData = reactive<any>({}); |
| | | const detailDataLoaded = ref(false); |
| | | const scanRef = ref(); // 扫码组件引用 |
| | | |
| | | // 获取当前登录用户信息 |
| | | const userStore = useUserStore(); |
| | |
| | | |
| | | const formData = reactive({ |
| | | twistedOuterDiameter: "", // 绞制外径 |
| | | diameterType: "绞合外径(mm)", // 外径类型 |
| | | structureFormula: "", // 成品结构 |
| | | structureItems: [], // 结构标准值和实测 |
| | | inspectTwist: [], // 绞线工艺质量控制 |
| | |
| | | { label: "否", value: "否" }, |
| | | ]; |
| | | |
| | | // 外径类型选项 |
| | | const diameterTypeColumns = [ |
| | | { label: "绞合外径(mm)", value: "绞合外径(mm)" }, |
| | | { label: "扇高/扇宽", value: "扇高/扇宽" }, |
| | | { label: "T形等效截面", value: "T形等效截面" }, |
| | | ]; |
| | | |
| | | // 获取外径类型标签 |
| | | const getDiameterTypeLabel = () => { |
| | | return formData.diameterType || "绞合外径(mm)"; |
| | | }; |
| | | |
| | | // 处理外径类型变化 |
| | | const handleDiameterTypeChange = () => { |
| | | // 类型变化时可以清空输入值或保留,根据需求决定 |
| | | // formData.twistedOuterDiameter = ""; |
| | | }; |
| | | |
| | | const initFormData = () => { |
| | | const structureResult = recordData.value.structureInfo?.structureRecordResult || {}; |
| | | const inspectionResult = recordData.value.inspectionResult || {}; |
| | | |
| | | formData.twistedOuterDiameter = |
| | | recordData.value.structureInfo.structureRecordResult.twistedOuterDiameter || ""; |
| | | formData.diameterType = |
| | | recordData.value.structureInfo.structureRecordResult.diameterType || "绞合外径(mm)"; |
| | | formData.structureFormula = structureResult.inspectStructure?.structureFormula || ""; |
| | | formData.isFully = inspectionResult.isFully || ""; |
| | | formData.conclusion = structureResult.conclusion || ""; |
| | |
| | | const saveList = async () => { |
| | | // 1. 基础字段校验 |
| | | if (!formData.structureFormula) return uni.showToast({ title: "成品结构为必填项", icon: "none" }); |
| | | if (!formData.twistedOuterDiameter) |
| | | return uni.showToast({ title: "绞制外径为必填项", icon: "none" }); |
| | | if (!formData.twistedOuterDiameter) { |
| | | const label = getDiameterTypeLabel(); |
| | | return uni.showToast({ title: `${label}为必填项`, icon: "none" }); |
| | | } |
| | | if (!formData.productAppearance.length) |
| | | return uni.showToast({ title: "产品外观为必填项", icon: "none" }); |
| | | if (!formData.conclusion) return uni.showToast({ title: "结论为必填项", icon: "none" }); |
| | |
| | | id: paramsId.value, |
| | | inspectionResult: { |
| | | twistedOuterDiameter: formData.twistedOuterDiameter, |
| | | structureFormula: formData.structureFormula, |
| | | structureItems: formData.structureItems, |
| | | diameterType: formData.diameterType || "绞合外径(mm)", |
| | | inspectStructure: { |
| | | structureFormula: formData.structureFormula, |
| | | structureItems: formData.structureItems, |
| | | }, |
| | | inspectTwist: formData.inspectTwist, |
| | | productAppearance: formData.productAppearance, |
| | | conclusion: formData.conclusion, |
| | |
| | | }; |
| | | |
| | | const openScan = () => { |
| | | console.log("indexJX - 点击扫码按钮(全局扫码模式,无需手动触发)"); |
| | | // 全局扫码模式下,硬件扫码会自动触发,无需手动调用 |
| | | uni.showToast({ |
| | | title: "请使用扫码枪扫描", |
| | | icon: "none", |
| | | }); |
| | | console.log("indexJX - 点击扫码按钮,触发扫码"); |
| | | // 触发扫码 |
| | | if (scanRef.value) { |
| | | scanRef.value.triggerScan(); |
| | | } else { |
| | | uni.showToast({ |
| | | title: "扫码组件未初始化", |
| | | icon: "none", |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 页面显示时的处理 |
| | |
| | | if (!cachedData || !cachedData.uid) { |
| | | console.log("⚠️ 未检测到扫码缓存,用户需要扫描设备二维码"); |
| | | // 在编辑模式下才提示 |
| | | if (isEdit.value) { |
| | | setTimeout(() => { |
| | | uni.showToast({ |
| | | title: "请扫描设备二维码后再保存", |
| | | icon: "none", |
| | | duration: 2000, |
| | | }); |
| | | }, 500); |
| | | } |
| | | // if (isEdit.value) { |
| | | // setTimeout(() => { |
| | | // uni.showToast({ |
| | | // title: "请扫描设备二维码后再保存", |
| | | // icon: "none", |
| | | // duration: 2000, |
| | | // }); |
| | | // }, 500); |
| | | // } |
| | | } |
| | | }); |
| | | </script> |