|
@@ -55,37 +55,47 @@ const templateData = ref<any>({})
|
|
|
|
|
|
|
|
let templateId: string = ''
|
|
let templateId: string = ''
|
|
|
let orderId: string = ''
|
|
let orderId: string = ''
|
|
|
|
|
+let mode: 'edit' | 'create' = 'edit'
|
|
|
|
|
+let securityCheckId: string = ''
|
|
|
|
|
|
|
|
onLoad((options: any) => {
|
|
onLoad((options: any) => {
|
|
|
templateId = options.templateId
|
|
templateId = options.templateId
|
|
|
orderId = options.orderId
|
|
orderId = options.orderId
|
|
|
|
|
+ mode = options.mode || 'edit'
|
|
|
|
|
+ securityCheckId = options.securityCheckId || ''
|
|
|
init()
|
|
init()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const instId = ref<string>('')
|
|
const instId = ref<string>('')
|
|
|
|
|
+const refId = ref<string>('')
|
|
|
const init = async () => {
|
|
const init = async () => {
|
|
|
if (!templateId) {
|
|
if (!templateId) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- const createResp = await securityCheckRequestFunc(
|
|
|
|
|
- SecurityCheckFuncName.createSecurityCheckItem,
|
|
|
|
|
- equipType,
|
|
|
|
|
- {
|
|
|
|
|
- businessType: 300,
|
|
|
|
|
- conclusion: '',
|
|
|
|
|
- date: null,
|
|
|
|
|
- name: '进入现场(设备)前安全检查记录',
|
|
|
|
|
- orderId,
|
|
|
|
|
- templateId,
|
|
|
|
|
- },
|
|
|
|
|
- )
|
|
|
|
|
- const refId = createResp.data
|
|
|
|
|
|
|
+ refId.value = null
|
|
|
|
|
+ if (mode === 'create') {
|
|
|
|
|
+ const createResp = await securityCheckRequestFunc(
|
|
|
|
|
+ SecurityCheckFuncName.createSecurityCheckItem,
|
|
|
|
|
+ equipType,
|
|
|
|
|
+ {
|
|
|
|
|
+ businessType: 300,
|
|
|
|
|
+ conclusion: '',
|
|
|
|
|
+ date: null,
|
|
|
|
|
+ name: '进入现场(设备)前安全检查记录',
|
|
|
|
|
+ orderId,
|
|
|
|
|
+ templateId,
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ refId.value = createResp.data
|
|
|
|
|
+ } else {
|
|
|
|
|
+ refId.value = securityCheckId
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
const res = await getStandardTemplate({ id: templateId })
|
|
const res = await getStandardTemplate({ id: templateId })
|
|
|
const resData = (res as any).data
|
|
const resData = (res as any).data
|
|
|
const dataMap: any = {}
|
|
const dataMap: any = {}
|
|
|
|
|
|
|
|
- const dynamicTbValResp = await getDynamicTbVal({ refId })
|
|
|
|
|
|
|
+ const dynamicTbValResp = await getDynamicTbVal({ refId: refId.value })
|
|
|
const dynamicTb: any = dynamicTbValResp.data
|
|
const dynamicTb: any = dynamicTbValResp.data
|
|
|
instId.value = dynamicTb?.dynamicTbInsRespVO?.id || ''
|
|
instId.value = dynamicTb?.dynamicTbInsRespVO?.id || ''
|
|
|
for (let i = 0; i < dynamicTb.dynamicTbValRespVOList.length; i++) {
|
|
for (let i = 0; i < dynamicTb.dynamicTbValRespVOList.length; i++) {
|
|
@@ -145,6 +155,14 @@ const handleSave = async (data: any) => {
|
|
|
const msg = result?.msg || '保存失败'
|
|
const msg = result?.msg || '保存失败'
|
|
|
uni.showToast({ title: msg, icon: 'error' })
|
|
uni.showToast({ title: msg, icon: 'error' })
|
|
|
}
|
|
}
|
|
|
|
|
+ const updateResp = await securityCheckRequestFunc(
|
|
|
|
|
+ SecurityCheckFuncName.updateSecurityCheckItem,
|
|
|
|
|
+ equipType,
|
|
|
|
|
+ {
|
|
|
|
|
+ id: refId.value,
|
|
|
|
|
+ jsonData: JSON.stringify(data.dataJSON),
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleCancel = () => {
|
|
const handleCancel = () => {
|