|
@@ -14,21 +14,21 @@ const createEmptyMain = (): InspectRecordMain => ({
|
|
|
bdbh: 'RS/IV-7.4-32',
|
|
bdbh: 'RS/IV-7.4-32',
|
|
|
bbh: '1.2',
|
|
bbh: '1.2',
|
|
|
sxrq: '2022.04.01',
|
|
sxrq: '2022.04.01',
|
|
|
- djbh: '',
|
|
|
|
|
- cplx: '',
|
|
|
|
|
- scph: '',
|
|
|
|
|
- wlbm: '',
|
|
|
|
|
- wlmc: '',
|
|
|
|
|
- gxbm: '',
|
|
|
|
|
- gxmc: '',
|
|
|
|
|
- sczyry: '',
|
|
|
|
|
- lydjbh: '',
|
|
|
|
|
- jyrq: '',
|
|
|
|
|
- jyr: '',
|
|
|
|
|
- jysl: undefined,
|
|
|
|
|
|
|
+ djbh: 'IPQC001',
|
|
|
|
|
+ cplx: '剪头垫',
|
|
|
|
|
+ scph: 'LOT-001',
|
|
|
|
|
+ wlbm: 'MAT-001',
|
|
|
|
|
+ wlmc: '电池模组',
|
|
|
|
|
+ gxbm: 'GX-001',
|
|
|
|
|
+ gxmc: '焊接/点焊',
|
|
|
|
|
+ sczyry: '芋道源码',
|
|
|
|
|
+ lydjbh: 'WO-202401-001',
|
|
|
|
|
+ jyrq: '2026-01-24 00:00:00',
|
|
|
|
|
+ jyr: '芋道源码',
|
|
|
|
|
+ jyr1: '张三',
|
|
|
|
|
+ jysl: 100,
|
|
|
jyhgsl: undefined,
|
|
jyhgsl: undefined,
|
|
|
jybhgsl: undefined,
|
|
jybhgsl: undefined,
|
|
|
- clfs: '',
|
|
|
|
|
lysl: undefined,
|
|
lysl: undefined,
|
|
|
phsl: undefined,
|
|
phsl: undefined,
|
|
|
pd: undefined,
|
|
pd: undefined,
|
|
@@ -39,7 +39,28 @@ const createEmptyMain = (): InspectRecordMain => ({
|
|
|
status: ''
|
|
status: ''
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const createEmptyRow = (): IpqcInspectRecordDetailRespVO => {
|
|
|
|
|
|
|
+const DEFAULT_DETAIL_ITEMS: Array<{ jyxm: string; jybz: string }> = [
|
|
|
|
|
+ { jyxm: '尺寸A', jybz: '1.1±0.05' },
|
|
|
|
|
+ { jyxm: '尺寸B', jybz: '77.55 +0.3/-0.1' },
|
|
|
|
|
+ { jyxm: '尺寸C', jybz: '1.9 +0.05/0' },
|
|
|
|
|
+ { jyxm: '尺寸D', jybz: '0.39±0.04' },
|
|
|
|
|
+ { jyxm: '尺寸E', jybz: '3.1+0.15/-0.1' },
|
|
|
|
|
+ { jyxm: '尺寸F', jybz: '22.24+0.09/-0.05' },
|
|
|
|
|
+ { jyxm: '尺寸G', jybz: '56±0.05' },
|
|
|
|
|
+ { jyxm: '尺寸J', jybz: '0.75±0.05' },
|
|
|
|
|
+ { jyxm: '尺寸K', jybz: '3.8±0.05' },
|
|
|
|
|
+ { jyxm: '尺寸L', jybz: '11.6±0.15' },
|
|
|
|
|
+ { jyxm: '尺寸M', jybz: '1.175±0.05' },
|
|
|
|
|
+ { jyxm: '尺寸N', jybz: '2.35±0.05' },
|
|
|
|
|
+ { jyxm: '硬度', jybz: '抵钉座:HV130-180;抵钉座上盖:HRC41-45' },
|
|
|
|
|
+ { jyxm: '材质', jybz: '供方提供材质证明,化学成分符合以下要求。;抵钉座上盖30Cr13:;0.26≤C≤0.35;Si≤1;Mn≤1;P≤0.04;S≤0.03;Ni≤0.6;12≤Cr≤14。;抵钉座06Cr17Ni12Mo2:;C≤0.08;Si≤1;Mn≤2;P≤0.045;S≤0.03;10≤Ni≤14;16≤Cr≤18;2≤Mo≤3' },
|
|
|
|
|
+ { jyxm: '外观', jybz: '零件外观无破损、裂纹、氧化、严重碰伤,夹杂物及毛刺,重要型面无碰伤,无多余焊料、漏焊;打标清晰' },
|
|
|
|
|
+ { jyxm: '镀层', jybz: '厚度:0.003-0.005mm 材质:镍特氟龙3400A+plus' },
|
|
|
|
|
+ { jyxm: '粗糙度', jybz: '表面粗糙度Ra≤0.8μm' },
|
|
|
|
|
+ { jyxm: '耐腐蚀性', jybz: '符合YY/T 0149沸水实验法,试验后零件表面不低于b级规定。' }
|
|
|
|
|
+]
|
|
|
|
|
+
|
|
|
|
|
+const createEmptyRow = (preset?: Partial<IpqcInspectRecordDetailRespVO>): IpqcInspectRecordDetailRespVO => {
|
|
|
const row: IpqcInspectRecordDetailRespVO = {
|
|
const row: IpqcInspectRecordDetailRespVO = {
|
|
|
jyxm: '',
|
|
jyxm: '',
|
|
|
jybz: '',
|
|
jybz: '',
|
|
@@ -52,10 +73,34 @@ const createEmptyRow = (): IpqcInspectRecordDetailRespVO => {
|
|
|
for (let i = 1; i <= 20; i += 1) {
|
|
for (let i = 1; i <= 20; i += 1) {
|
|
|
;(row as any)[`j${i}`] = ''
|
|
;(row as any)[`j${i}`] = ''
|
|
|
}
|
|
}
|
|
|
- return row
|
|
|
|
|
|
|
+ return { ...row, ...(preset || {}) }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const unwrapResult = <T>(result: any): T => (result && result.data !== undefined ? result.data : result)
|
|
const unwrapResult = <T>(result: any): T => (result && result.data !== undefined ? result.data : result)
|
|
|
|
|
+const normalizeDisplayValue = (value: any) => {
|
|
|
|
|
+ if (value === '-' || value === '自动生成') return undefined
|
|
|
|
|
+ return value
|
|
|
|
|
+}
|
|
|
|
|
+const isMeaningfulValue = (value: unknown) => {
|
|
|
|
|
+ if (value === undefined || value === null) return false
|
|
|
|
|
+ if (typeof value === 'string') {
|
|
|
|
|
+ const trimmed = value.trim()
|
|
|
|
|
+ if (!trimmed) return false
|
|
|
|
|
+ if (trimmed === '-' || trimmed === '自动生成') return false
|
|
|
|
|
+ }
|
|
|
|
|
+ return true
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const mergeWithDefaults = (defaults: InspectRecordMain, main: Partial<InspectRecordMain>) => {
|
|
|
|
|
+ const merged: InspectRecordMain = { ...defaults }
|
|
|
|
|
+ Object.keys(main || {}).forEach((key) => {
|
|
|
|
|
+ const value = (main as any)[key]
|
|
|
|
|
+ if (isMeaningfulValue(value)) {
|
|
|
|
|
+ ;(merged as any)[key] = value
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ return merged
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
export const useIpqcInspectRecordStore = defineStore('ipqcInspectRecord', {
|
|
export const useIpqcInspectRecordStore = defineStore('ipqcInspectRecord', {
|
|
|
state: () => ({
|
|
state: () => ({
|
|
@@ -66,7 +111,7 @@ export const useIpqcInspectRecordStore = defineStore('ipqcInspectRecord', {
|
|
|
if (!this.drafts[taskId]) {
|
|
if (!this.drafts[taskId]) {
|
|
|
this.drafts[taskId] = {
|
|
this.drafts[taskId] = {
|
|
|
main: createEmptyMain(),
|
|
main: createEmptyMain(),
|
|
|
- details: [createEmptyRow()]
|
|
|
|
|
|
|
+ details: DEFAULT_DETAIL_ITEMS.map((item) => createEmptyRow({ jyxm: item.jyxm, jybz: item.jybz }))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return this.drafts[taskId]
|
|
return this.drafts[taskId]
|
|
@@ -98,11 +143,10 @@ export const useIpqcInspectRecordStore = defineStore('ipqcInspectRecord', {
|
|
|
])
|
|
])
|
|
|
const main = unwrapResult<IpqcInspectRecordMainRespVO>(mainResult) || {}
|
|
const main = unwrapResult<IpqcInspectRecordMainRespVO>(mainResult) || {}
|
|
|
const details = unwrapResult<IpqcInspectRecordDetailRespVO[]>(detailResult) || []
|
|
const details = unwrapResult<IpqcInspectRecordDetailRespVO[]>(detailResult) || []
|
|
|
- draft.main = {
|
|
|
|
|
- ...createEmptyMain(),
|
|
|
|
|
- ...main
|
|
|
|
|
- }
|
|
|
|
|
- draft.details = Array.isArray(details) && details.length ? details : [createEmptyRow()]
|
|
|
|
|
|
|
+ draft.main = mergeWithDefaults(createEmptyMain(), main)
|
|
|
|
|
+ draft.details = Array.isArray(details) && details.length
|
|
|
|
|
+ ? details
|
|
|
|
|
+ : DEFAULT_DETAIL_ITEMS.map((item) => createEmptyRow({ jyxm: item.jyxm, jybz: item.jybz }))
|
|
|
return draft
|
|
return draft
|
|
|
},
|
|
},
|
|
|
async save(taskId: string) {
|
|
async save(taskId: string) {
|
|
@@ -110,24 +154,24 @@ export const useIpqcInspectRecordStore = defineStore('ipqcInspectRecord', {
|
|
|
const payload: IpqcInspectRecordSaveReqVO = {
|
|
const payload: IpqcInspectRecordSaveReqVO = {
|
|
|
taskId,
|
|
taskId,
|
|
|
id: draft.main.id,
|
|
id: draft.main.id,
|
|
|
- bdbh: draft.main.bdbh,
|
|
|
|
|
- bbh: draft.main.bbh,
|
|
|
|
|
- sxrq: draft.main.sxrq,
|
|
|
|
|
- djbh: draft.main.djbh,
|
|
|
|
|
- cplx: draft.main.cplx,
|
|
|
|
|
- scph: draft.main.scph,
|
|
|
|
|
- wlbm: draft.main.wlbm,
|
|
|
|
|
- wlmc: draft.main.wlmc,
|
|
|
|
|
- gxbm: draft.main.gxbm,
|
|
|
|
|
- gxmc: draft.main.gxmc,
|
|
|
|
|
- sczyry: draft.main.sczyry,
|
|
|
|
|
- lydjbh: draft.main.lydjbh,
|
|
|
|
|
|
|
+ bdbh: normalizeDisplayValue(draft.main.bdbh),
|
|
|
|
|
+ bbh: normalizeDisplayValue(draft.main.bbh),
|
|
|
|
|
+ sxrq: normalizeDisplayValue(draft.main.sxrq),
|
|
|
|
|
+ djbh: normalizeDisplayValue(draft.main.djbh),
|
|
|
|
|
+ cplx: normalizeDisplayValue(draft.main.cplx),
|
|
|
|
|
+ scph: normalizeDisplayValue(draft.main.scph),
|
|
|
|
|
+ wlbm: normalizeDisplayValue(draft.main.wlbm),
|
|
|
|
|
+ wlmc: normalizeDisplayValue(draft.main.wlmc),
|
|
|
|
|
+ gxbm: normalizeDisplayValue(draft.main.gxbm),
|
|
|
|
|
+ gxmc: normalizeDisplayValue(draft.main.gxmc),
|
|
|
|
|
+ sczyry: normalizeDisplayValue(draft.main.sczyry),
|
|
|
|
|
+ lydjbh: normalizeDisplayValue(draft.main.lydjbh),
|
|
|
jyrq: draft.main.jyrq,
|
|
jyrq: draft.main.jyrq,
|
|
|
jyr: draft.main.jyr,
|
|
jyr: draft.main.jyr,
|
|
|
|
|
+ jyr1: draft.main.jyr1,
|
|
|
jysl: draft.main.jysl,
|
|
jysl: draft.main.jysl,
|
|
|
jyhgsl: draft.main.jyhgsl,
|
|
jyhgsl: draft.main.jyhgsl,
|
|
|
jybhgsl: draft.main.jybhgsl,
|
|
jybhgsl: draft.main.jybhgsl,
|
|
|
- clfs: draft.main.clfs,
|
|
|
|
|
lysl: draft.main.lysl,
|
|
lysl: draft.main.lysl,
|
|
|
phsl: draft.main.phsl,
|
|
phsl: draft.main.phsl,
|
|
|
pd: draft.main.pd,
|
|
pd: draft.main.pd,
|