| | |
| | | <view class="form-section"> |
| | | <template v-for="(item, index) in localMaterialData" :key="index"> |
| | | <view v-if="index > 0" class="mt-4 pt-4 border-t border-gray-100"></view> |
| | | <wd-form> |
| | | <wd-form-item label="规格型号" prop="spec" required> |
| | | <wd-form :model="item"> |
| | | <wd-form-item label="规格型号" prop="model" required> |
| | | <wd-input v-model="item.model" :disabled="false" placeholder="请输入"></wd-input> |
| | | </wd-form-item> |
| | | <wd-form-item label="外观质量" prop="appearanceQuality" required> |
| | |
| | | <view class="form-section"> |
| | | <template v-for="(item, index) in localSteelData" :key="index"> |
| | | <view v-if="index > 0" class="mt-4 pt-4 border-t border-gray-100"></view> |
| | | <wd-form> |
| | | <wd-form-item label="规格型号" prop="spec" required> |
| | | <wd-form :model="item"> |
| | | <wd-form-item label="规格型号" prop="model" required> |
| | | <wd-input v-model="item.model" :disabled="false" placeholder="请输入"></wd-input> |
| | | </wd-form-item> |
| | | <wd-form-item label="绞向" prop="twistedDirection" required> |
| | |
| | | </wd-tab> |
| | | <wd-tab title="盘具领用" name="reel"> |
| | | <view class="form-section"> |
| | | <wd-form> |
| | | <wd-form :model="localReelData"> |
| | | <wd-form-item label="螺母是否固定" prop="nutFixed" required> |
| | | <wd-picker |
| | | v-model="localReelData.nutFixed" |
| | |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | <script setup lang="ts"> |
| | | import { ref, watch } from "vue"; |
| | | import { useToast } from "wot-design-uni"; |
| | | import TwistApi from "@/api/product/twist"; |
| | | import ManageApi from "@/api/product/manage"; |
| | | |
| | | // 定义TypeScript接口 |
| | | interface MaterialData { |
| | | model: string; |
| | | appearanceQuality: string; |
| | | dia: string; |
| | | length: string; |
| | | windingTightness: string; |
| | | arrangement: string; |
| | | edgeDistance: string; |
| | | } |
| | | |
| | | interface SteelData { |
| | | model: string; |
| | | twistedDirection: string; |
| | | outerDiameter: string; |
| | | scratch: string; |
| | | oilStain: string; |
| | | } |
| | | |
| | | interface ReelData { |
| | | nutFixed: string; |
| | | sidePlateFlat: string; |
| | | centerPlateFlat: string; |
| | | paintQuality: string; |
| | | burrCrack: string; |
| | | edgeBlunt: string; |
| | | woodMold: string; |
| | | weldQuality: string; |
| | | } |
| | | |
| | | // 定义组件的props |
| | | const props = defineProps({ |
| | | singleRegulationInfoArray: { |
| | | type: Array, |
| | | default: () => [], |
| | | }, |
| | | steelRegulationInfoArray: { |
| | | type: Array, |
| | | default: () => [], |
| | | }, |
| | | reelToolingInfo: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | wireId: { |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | }); |
| | | const props = defineProps<{ |
| | | singleRegulationInfoArray: MaterialData[]; |
| | | steelRegulationInfoArray: SteelData[]; |
| | | reelToolingInfo: ReelData; |
| | | wireId: string; |
| | | }>(); |
| | | |
| | | const appearanceQualityOptions = [ |
| | | { |
| | | label: "有划伤", |
| | | value: "有划伤", |
| | | }, |
| | | { |
| | | label: "有竹节", |
| | | value: "有竹节", |
| | | }, |
| | | { |
| | | label: "有黑色油污", |
| | | value: "有黑色油污", |
| | | }, |
| | | { |
| | | label: "无", |
| | | value: "无", |
| | | }, |
| | | ]; |
| | | const paintQualityOptions = [ |
| | | { |
| | | label: "完好", |
| | | value: "完好", |
| | | }, |
| | | { |
| | | label: "破损", |
| | | value: "破损", |
| | | }, |
| | | ]; |
| | | const weldQualityOptions = [ |
| | | { |
| | | label: "已磨光", |
| | | value: "已磨光", |
| | | }, |
| | | { |
| | | label: "已磨皮", |
| | | value: "已磨皮", |
| | | }, |
| | | ]; |
| | | const appearanceQualityOptions = ref<Array<{ label: string; value: string | number }>>([]); |
| | | const paintQualityOptions = ref<Array<{ label: string; value: string | number }>>([]); |
| | | const weldQualityOptions = ref<Array<{ label: string; value: string | number }>>([]); |
| | | |
| | | // 从数据字典中加载数据 |
| | | const loadDictData = async () => { |
| | | try { |
| | | // 分别调用dictAPI获取各个字典数据 |
| | | const paintQualityRes = await ManageApi.dictAPI("draw_paint_quality"); |
| | | const weldQualityRes = await ManageApi.dictAPI("draw_welding_quality"); |
| | | const qualityRes = await ManageApi.dictAPI("draw_appearance_quality"); |
| | | |
| | | // 处理返回数据,转换为组件所需的格式 {label: string, value: string} |
| | | if (paintQualityRes.data && Array.isArray(paintQualityRes.data)) { |
| | | paintQualityOptions.value = paintQualityRes.data.map((item) => ({ |
| | | label: item.dictLabel || "", |
| | | value: item.dictValue || "", |
| | | })); |
| | | } |
| | | if (weldQualityRes.data && Array.isArray(weldQualityRes.data)) { |
| | | weldQualityOptions.value = weldQualityRes.data.map((item) => ({ |
| | | label: item.dictLabel || "", |
| | | value: item.dictValue || "", |
| | | })); |
| | | } |
| | | if (qualityRes.data && Array.isArray(qualityRes.data)) { |
| | | appearanceQualityOptions.value = qualityRes.data.map((item) => ({ |
| | | label: item.dictLabel || "", |
| | | value: item.dictValue || "", |
| | | })); |
| | | } |
| | | } catch (error) { |
| | | console.error("加载数据字典失败:", error); |
| | | } |
| | | }; |
| | | const haveOrNotOptions = [ |
| | | { |
| | | label: "有", |
| | |
| | | ]; |
| | | // 定义组件的emits |
| | | const emit = defineEmits(["close"]); |
| | | const activeTab = ref("material"); |
| | | const activeTab = ref<string>("material"); |
| | | const toast = useToast(); |
| | | |
| | | // 本地响应式数据,用于存储用户输入 |
| | | const localMaterialData = ref([]); |
| | | const localSteelData = ref([]); |
| | | const localReelData = ref({}); |
| | | const localMaterialData = ref<MaterialData[]>([]); |
| | | const localSteelData = ref<SteelData[]>([]); |
| | | const localReelData = ref<ReelData>({ |
| | | nutFixed: "", |
| | | sidePlateFlat: "", |
| | | centerPlateFlat: "", |
| | | paintQuality: "", |
| | | burrCrack: "", |
| | | edgeBlunt: "", |
| | | woodMold: "", |
| | | weldQuality: "", |
| | | }); |
| | | |
| | | // 初始化本地数据 |
| | | const initializeData = () => { |
| | |
| | | watch(() => props.steelRegulationInfoArray, initializeData, { deep: true }); |
| | | watch(() => props.reelToolingInfo, initializeData, { deep: true }); |
| | | |
| | | const handleTabChange = (tabName) => { |
| | | const handleTabChange = (tabName: string) => { |
| | | activeTab.value = tabName; |
| | | }; |
| | | |
| | |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | // 在组件挂载时异步加载数据字典 |
| | | onMounted(async () => { |
| | | await loadDictData(); |
| | | }); |
| | | watch( |
| | | () => [props.singleRegulationInfoArray, props.steelRegulationInfoArray, props.reelToolingInfo], |
| | | () => { |