Commit 37a856f5 by yancanhua

feat: 自测问题调整

1 parent ad64fdaa
......@@ -176,3 +176,7 @@ export interface DetailRes {
export function detail(recordId: number) {
return get<DetailRes>(`/rest/inspectionRecord/${recordId}/detail`);
}
export function getCarTypeList(csId: number) {
return get<DetailRes>(`/rest/ropApi/getCarTypeList?csId=${csId}`);
}
......@@ -9,6 +9,8 @@ import radioSelect from "@/components/CustomizeForm/radioSelect.vue";
import customizeUploadFile from "@/components/CustomizeForm/customizeUploadFile.vue";
import buttonSelectAndImageUpload from "@/components/CustomizeForm/buttonSelectAndImageUpload.vue";
import { getCarTypeList } from "@/api/modules/inspect-report";
// 获取父组件传递数据
const props = withDefaults(
......@@ -49,6 +51,7 @@ watch(() => props.leafNodes, (nodes) => {
value: getValueText(item),
})) as InspectionColumnRow[];
console.log('watchLeafNodes', columnsList.value);
getCarTypeListData();
setTimeout(() => {
pageLoading.value = false;
}, 1200);
......@@ -194,21 +197,25 @@ async function validate(): Promise<CustomizeFormValidateResult> {
}
});
return {
const returnData = {
data: nodesData,
message: message || "操作成功",
success: success,
};
}
console.log('validate', returnData);
return returnData;
}
/** 与 `validate` 相同返回结构,不校验必填,用于静默保存 / 上一步等场景 */
async function saveData(): Promise<CustomizeFormValidateResult> {
const nodesData = setSubmitData();
return {
const returnData = {
data: nodesData,
message: "操作成功",
success: true,
};
}
console.log('saveData', returnData);
return returnData;
}
function getValidationRules(item: any) {
......@@ -226,6 +233,20 @@ function setImgWidth(item: any) {
return resultStatus
}
const carTypeList = ref([]);
async function getCarTypeListData() {
const templateDefaultData = props?.templateDefaultData || {};
if (templateDefaultData.carSeriesId) {
const res = await getCarTypeList(templateDefaultData.carSeriesId);
carTypeList.value = (res?.data?.carinfos || []).map(item => ({
text: item.name || '',
value: String(item.id) || '',
}));
}
}
defineExpose({
validate,
saveData,
......@@ -291,7 +312,8 @@ defineExpose({
<!-- 下拉选择器 -->
<div v-if="item.interactionType == 'dropdown'">
<selectDropdown :item="item" :value="item.value" @update="item.value = $event" />
<selectDropdown :item="item" :carTypeList="carTypeList" :value="item.value"
@update="item.value = $event" />
</div>
<!-- 按钮选择器 -->
......
......@@ -6,6 +6,10 @@ const props = defineProps({
type: Object,
default: () => { },
},
carTypeList: {
type: Array,
default: () => { },
},
});
const emit = defineEmits(["update"]);
......@@ -43,7 +47,6 @@ function initData() {
}
}
onConfirm();
console.log('pickerValue.value2222222222222222222', pickerValue.value);
}
// 计算属性
......@@ -55,9 +58,11 @@ const columnsList = computed(() => {
value: valueList[0] || "",
};
});
return optionsList;
return props.item.nodeName === "车型" ? props.carTypeList : optionsList;
});
function onConfirm() {
const picker = pickerValue.value && pickerValue.value.length > 0 ? pickerValue.value[0] : "";
showPicker.value = false;
......
......@@ -188,7 +188,8 @@ async function handleResponse<T>(
}
showToast(errMsg);
throw new ApiHandledError(errMsg);
// 后端调整后修改放开注释
//throw new ApiHandledError(errMsg);
}
// 非标准结构,直接返回 data
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!