|
|
|
|
@ -99,6 +99,7 @@
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { MoldRepairApi, MoldRepairVO } from '@/api/mold/moldrepair'
|
|
|
|
|
import { MoldRepairItemsApi } from '@/api/mold/moldRepairItems'
|
|
|
|
|
import MoldRepairLineForm from './components/MoldRepairLineForm.vue'
|
|
|
|
|
import { MoldBrandApi, MoldVO } from '@/api/erp/mold'
|
|
|
|
|
import { getSimpleUserList, UserVO } from '@/api/system/user'
|
|
|
|
|
@ -208,6 +209,8 @@ watch(
|
|
|
|
|
formData.value.machinerySpec = raw?.moldType ?? raw?.spec ?? raw?.moldSpec
|
|
|
|
|
formData.value.machineryBrand = raw?.brandName ?? raw?.brand ?? raw?.moldBrand
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await prefillLinesByMold(moldId as number)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
@ -223,6 +226,40 @@ const setLineRows = (rows: any[]) => {
|
|
|
|
|
moldRepairLineFormRef.value?.setData(rows)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const normalizeMoldRepairItemList = (data: any) => {
|
|
|
|
|
const rows = (Array.isArray(data) ? data : data?.list ?? data?.data ?? []) as any[]
|
|
|
|
|
return rows
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const toMoldRepairLineRow = (item: any) => {
|
|
|
|
|
const subjectId = item?.subjectId ?? item?.id
|
|
|
|
|
return {
|
|
|
|
|
id: undefined,
|
|
|
|
|
repairId: formData.value.id,
|
|
|
|
|
subjectId,
|
|
|
|
|
subjectCode: item?.subjectCode ?? item?.subject_code ?? item?.code,
|
|
|
|
|
subjectName: item?.subjectName ?? item?.subject_name ?? item?.name,
|
|
|
|
|
subjectType: item?.subjectType ?? item?.subject_type ?? item?.type,
|
|
|
|
|
subjectContent: item?.subjectContent ?? item?.projectContent ?? item?.subject_content,
|
|
|
|
|
subjectStandard: item?.subjectStandard ?? item?.judgmentCriteria ?? item?.subject_standard,
|
|
|
|
|
malfunction: undefined,
|
|
|
|
|
malfunctionUrl: undefined,
|
|
|
|
|
repairDes: undefined,
|
|
|
|
|
remark: undefined,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const prefillLinesByMold = async (moldId: number | undefined) => {
|
|
|
|
|
if (formType.value !== 'create') return
|
|
|
|
|
if (typeof moldId !== 'number') {
|
|
|
|
|
setLineRows([])
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const data = await MoldRepairItemsApi.getRepairItemsPage({ pageNo: 1, pageSize: 100, moldId })
|
|
|
|
|
const list = normalizeMoldRepairItemList(data)
|
|
|
|
|
setLineRows(list.map(toMoldRepairLineRow))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let openRequestId = 0
|
|
|
|
|
|
|
|
|
|
const open = async (type: string, id?: number) => {
|
|
|
|
|
|