Commit 37a856f5 by yancanhua

feat: 自测问题调整

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