| | |
| | | </template> |
| | | </view> |
| | | </wd-tab> |
| | | <wd-tab title="芯线领用自检" name="steel"> |
| | | <view class="form-section"> |
| | | <wd-form :model="localSteelData"> |
| | | <wd-form-item label="规格型号" prop="model" required> |
| | | <wd-input |
| | | v-model="localSteelData.model" |
| | | :disabled="false" |
| | | placeholder="请输入" |
| | | ></wd-input> |
| | | </wd-form-item> |
| | | <wd-form-item label="绞向" prop="twistedDirection" required> |
| | | <wd-input |
| | | v-model="localSteelData.twistedDirection" |
| | | :disabled="false" |
| | | placeholder="请输入" |
| | | ></wd-input> |
| | | </wd-form-item> |
| | | <wd-form-item label="外径" prop="outerDiameter" required> |
| | | <wd-input |
| | | v-model="localSteelData.outerDiameter" |
| | | :disabled="false" |
| | | placeholder="请输入" |
| | | ></wd-input> |
| | | </wd-form-item> |
| | | <wd-form-item label="划伤" prop="scratch" required> |
| | | <wd-radio-group v-model="localSteelData.scratch" cell shape="dot"> |
| | | <wd-radio value="是">是</wd-radio> |
| | | <wd-radio value="否">否</wd-radio> |
| | | </wd-radio-group> |
| | | </wd-form-item> |
| | | <wd-form-item label="油污" prop="oilStain" required> |
| | | <wd-radio-group v-model="localSteelData.oilStain" cell shape="dot"> |
| | | <wd-radio value="是">是</wd-radio> |
| | | <wd-radio value="否">否</wd-radio> |
| | | </wd-radio-group> |
| | | </wd-form-item> |
| | | </wd-form> |
| | | </view> |
| | | </wd-tab> |
| | | <wd-tab title="盘具领用自检" name="reel"> |
| | | <view class="form-section"> |
| | | <wd-form :model="localReelData"> |
| | |
| | | :key="option.value" |
| | | :modelValue=" |
| | | Array.isArray(localReelData.weldQuality) |
| | | ? localReelData.weldQuality.includes(String(option.value)) |
| | | ? localReelData.weldQuality |
| | | .map((v) => String(v)) |
| | | .includes(String(option.value)) |
| | | : false |
| | | " |
| | | shape="square" |
| | |
| | | {{ option.label }} |
| | | </wd-checkbox> |
| | | </view> |
| | | </wd-form-item> |
| | | </wd-form> |
| | | </view> |
| | | </wd-tab> |
| | | <wd-tab title="芯线领用自检" name="steel"> |
| | | <view class="form-section"> |
| | | <wd-form :model="localSteelData"> |
| | | <wd-form-item label="规格型号" prop="model" required> |
| | | <wd-input |
| | | v-model="localSteelData.model" |
| | | :disabled="false" |
| | | placeholder="请输入" |
| | | ></wd-input> |
| | | </wd-form-item> |
| | | <wd-form-item label="绞向" prop="twistedDirection" required> |
| | | <wd-input |
| | | v-model="localSteelData.twistedDirection" |
| | | :disabled="false" |
| | | placeholder="请输入" |
| | | ></wd-input> |
| | | </wd-form-item> |
| | | <wd-form-item label="外径" prop="outerDiameter" required> |
| | | <wd-input |
| | | v-model="localSteelData.outerDiameter" |
| | | :disabled="false" |
| | | placeholder="请输入" |
| | | ></wd-input> |
| | | </wd-form-item> |
| | | <wd-form-item label="划伤" prop="scratch" required> |
| | | <wd-radio-group v-model="localSteelData.scratch" cell shape="dot"> |
| | | <wd-radio value="是">是</wd-radio> |
| | | <wd-radio value="否">否</wd-radio> |
| | | </wd-radio-group> |
| | | </wd-form-item> |
| | | <wd-form-item label="油污" prop="oilStain" required> |
| | | <wd-radio-group v-model="localSteelData.oilStain" cell shape="dot"> |
| | | <wd-radio value="是">是</wd-radio> |
| | | <wd-radio value="否">否</wd-radio> |
| | | </wd-radio-group> |
| | | </wd-form-item> |
| | | </wd-form> |
| | | </view> |
| | |
| | | }; |
| | | |
| | | // 处理焊接质量复选框的change事件 |
| | | const handleWeldQualityCheckbox = (optionValue: string, checked: boolean) => { |
| | | const currentValues = Array.isArray(localReelData.value.weldQuality) |
| | | ? localReelData.value.weldQuality |
| | | : []; |
| | | |
| | | let newValues: string[]; |
| | | if (checked) { |
| | | // 选中 |
| | | newValues = [...currentValues, optionValue]; |
| | | } else { |
| | | // 取消选中 |
| | | newValues = currentValues.filter((v) => v !== optionValue); |
| | | const handleWeldQualityCheckbox = (optionValue: string, checked: any) => { |
| | | // 确保 weldQuality 是数组 |
| | | if (!Array.isArray(localReelData.value.weldQuality)) { |
| | | localReelData.value.weldQuality = []; |
| | | } |
| | | |
| | | // 更新值 |
| | | const currentValues = [...localReelData.value.weldQuality.map((v) => String(v))]; |
| | | const optionValueStr = String(optionValue); |
| | | |
| | | // 判断当前是否已选中 |
| | | const isCurrentlyChecked = currentValues.includes(optionValueStr); |
| | | |
| | | // 根据当前状态切换:如果当前已选中,则取消选中;如果当前未选中,则选中 |
| | | let newValues: string[]; |
| | | if (isCurrentlyChecked) { |
| | | // 当前已选中,取消选中 |
| | | newValues = currentValues.filter((v) => v !== optionValueStr); |
| | | } else { |
| | | // 当前未选中,选中 |
| | | newValues = [...currentValues, optionValueStr]; |
| | | } |
| | | |
| | | // 直接更新值 |
| | | localReelData.value.weldQuality = newValues; |
| | | }; |
| | | |
| | |
| | | length: item.length || "", |
| | | windingTightness: item.windingTightness || "是", |
| | | arrangement: item.arrangement || "是", |
| | | edgeDistance: item.edgeDistance || "", |
| | | edgeDistance: item.edgeDistance || "25", |
| | | }; |
| | | }) |
| | | : [ |
| | |
| | | length: "", |
| | | windingTightness: "是", |
| | | arrangement: "是", |
| | | edgeDistance: "", |
| | | edgeDistance: "25", |
| | | }, |
| | | ]; |
| | | |
| | |
| | | weldQualityValue = [props.reelToolingInfo.weldQuality as string]; |
| | | } else { |
| | | // 默认选择"已磨光"和"已修平" |
| | | weldQualityValue = ["已磨光", "已修平"]; |
| | | // 如果字典数据已加载,使用字典中的实际值;否则使用字符串 |
| | | if (weldQualityOptions.value.length > 0) { |
| | | const defaultOptions = weldQualityOptions.value.filter( |
| | | (opt) => opt.label === "已磨光" || opt.label === "已修平" |
| | | ); |
| | | weldQualityValue = defaultOptions.map((opt) => String(opt.value)); |
| | | } else { |
| | | // 字典未加载时,使用字符串作为临时值,后续会在字典加载后重新初始化 |
| | | weldQualityValue = ["已磨光", "已修平"]; |
| | | } |
| | | } |
| | | |
| | | localReelData.value = { |
| | |
| | | { deep: true } |
| | | ); |
| | | watch(() => props.steelRegulationInfo, initializeData, { deep: true }); |
| | | watch(() => props.reelToolingInfo, initializeData, { deep: true }); |
| | | // 注意:不监听 props.reelToolingInfo 的变化,避免覆盖用户的操作 |
| | | // watch(() => props.reelToolingInfo, initializeData, { deep: true }); |
| | | |
| | | const handleTabChange = (tabName: string) => { |
| | | activeTab.value = tabName; |
| | |
| | | // 在组件挂载时异步加载数据字典 |
| | | onMounted(async () => { |
| | | await loadDictData(); |
| | | // 字典数据加载完成后,重新初始化数据,确保默认值能正确匹配 |
| | | // 但只初始化 weldQuality 如果它还是空数组或默认值 |
| | | if ( |
| | | !Array.isArray(localReelData.value.weldQuality) || |
| | | localReelData.value.weldQuality.length === 0 || |
| | | (localReelData.value.weldQuality.length === 2 && |
| | | localReelData.value.weldQuality.includes("已磨光") && |
| | | localReelData.value.weldQuality.includes("已修平")) |
| | | ) { |
| | | // 只有在是默认值或空数组时才重新初始化 |
| | | const defaultOptions = weldQualityOptions.value.filter( |
| | | (opt) => opt.label === "已磨光" || opt.label === "已修平" |
| | | ); |
| | | if (defaultOptions.length > 0) { |
| | | localReelData.value.weldQuality = defaultOptions.map((opt) => String(opt.value)); |
| | | } |
| | | } |
| | | }); |
| | | watch( |
| | | () => [props.singleRegulationInfoArray, props.steelRegulationInfo, props.reelToolingInfo], |