|
|
@ -42,6 +42,13 @@ |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="formsSuccess" |
|
|
|
:sumFormDataByForm ="(formRef,formModel)=>{ |
|
|
|
console.log(formModel) |
|
|
|
const {videoAddress} = formModel |
|
|
|
formRef.value.setValues({ |
|
|
|
installPackageUrl:videoAddress |
|
|
|
}) |
|
|
|
}" |
|
|
|
:rules="InspectionMethodRules" |
|
|
|
:formAllSchemas="InspectionMethod.allSchemas" |
|
|
|
:apiUpdate="InspectionMethodApi.updateInspectionMethod" |
|
|
@ -149,26 +156,86 @@ const buttonTableClick = async (val, row) => { |
|
|
|
/** 添加/修改操作 */ |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
// debugger |
|
|
|
console.log(row) |
|
|
|
if(row && row.videoAddress.trim()){ |
|
|
|
row.filePathList = row.videoAddress.split(',') |
|
|
|
} |
|
|
|
|
|
|
|
if (row && row.filePathList && row.filePathList.length > 0) { |
|
|
|
row.filePathListView = row.filePathList.map((item) => { |
|
|
|
return { |
|
|
|
name: item, |
|
|
|
url: item |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if(type=='create'){ |
|
|
|
const currentTime = new Date().getTime() |
|
|
|
const fileId = InspectionMethod.allSchemas.formSchema.find(item=>item.field=='fileId') |
|
|
|
const uploadFile = InspectionMethod.allSchemas.formSchema.find(item=>item.field=='videoAddress') |
|
|
|
if(fileId){ |
|
|
|
fileId['value'] = currentTime |
|
|
|
} |
|
|
|
if(uploadFile){ |
|
|
|
uploadFile['componentProps']['upData']['tableId'] = currentTime |
|
|
|
uploadFile['componentProps']['modelValue']= [] |
|
|
|
} |
|
|
|
}else if(type=='update'){ |
|
|
|
const uploadFile = InspectionMethod.allSchemas.formSchema.find(item=>item.field=='videoAddress') |
|
|
|
uploadFile['componentProps']['modelValue']= row.filePathListView |
|
|
|
|
|
|
|
} |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =InspectionMethod.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
}); |
|
|
|
if(isHave){ |
|
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
|
message.error('失效时间要大于生效时间') |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
// data.filePathList = [] |
|
|
|
// data.tmp = [] |
|
|
|
console.log(data) |
|
|
|
// for (let i = 0; i < data.filePathListView.length; i++) { |
|
|
|
// data.filePathList.push(data.filePathListView[i].url) |
|
|
|
// } |
|
|
|
// data.filePathList = [] |
|
|
|
// for (let i = 0; i < data.filePathListView.length; i++) { |
|
|
|
// data.filePathList.push(data.filePathListView[i].url) |
|
|
|
// } |
|
|
|
// if(data.filePathList.length>0){ |
|
|
|
// data.videoAddress = data.filePathList.join(',') |
|
|
|
// } |
|
|
|
// debugger |
|
|
|
// if(data.filePathListView instanceof Array){ |
|
|
|
// for(let i=0; i<data.filePathListView.length; i++){ |
|
|
|
// data.tmp.push(data.filePathListView[i].url) |
|
|
|
// } |
|
|
|
// data.videoAddress = data.tmp.join(',') |
|
|
|
// }else{ |
|
|
|
// data.videoAddress = data.filePathListView |
|
|
|
// data.filePathListView = data.filePathListView.split(',').map(url=>{return {url}}) |
|
|
|
// } |
|
|
|
// for (let i = 0; i < data.filePathListView.length; i++) { |
|
|
|
// data.filePathList.push(data.filePathListView[i]) |
|
|
|
// } |
|
|
|
// console.log(1111,data) |
|
|
|
// var isHave =InspectionMethod.allSchemas.formSchema.some(function (item) { |
|
|
|
// return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
// }); |
|
|
|
// if(isHave){ |
|
|
|
// if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
|
// message.error('失效时间要大于生效时间') |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if(data.activeTime==0)data.activeTime = null; |
|
|
|
// if(data.expireTime==0)data.expireTime = null; |
|
|
|
if (formType === 'create') { |
|
|
|
|
|
|
|
delete data['uploadFile'] |
|
|
|
await InspectionMethodApi.createInspectionMethod(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
// debugger |
|
|
|
await InspectionMethodApi.updateInspectionMethod(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|