Browse Source

图片

master_hella_20240701
zhang_li 7 months ago
parent
commit
c6c5e0b413
  1. 12
      src/components/UploadFile/src/UploadFile.vue
  2. 38
      src/views/qms/inspectionMethod/index.vue
  3. 17
      src/views/qms/inspectionMethod/inspectionMethod.data.ts

12
src/components/UploadFile/src/UploadFile.vue

@ -148,17 +148,7 @@ const listToString = (list: UploadUserFile[], separator?: string) => {
} }
return strs != '' ? strs.substr(0, strs.length - 1) : '' return strs != '' ? strs.substr(0, strs.length - 1) : ''
} }
watch(
() => props.modelValue,
(data) => {
if (!data) return
fileList.value = data
},
{
deep: true,
immediate: true
}
)
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.upload-file-uploader { .upload-file-uploader {

38
src/views/qms/inspectionMethod/index.vue

@ -42,6 +42,13 @@
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="formsSuccess" @success="formsSuccess"
:sumFormDataByForm ="(formRef,formModel)=>{
console.log(formModel)
const {videoAddress} = formModel
formRef.value.setValues({
installPackageUrl:videoAddress
})
}"
:rules="InspectionMethodRules" :rules="InspectionMethodRules"
:formAllSchemas="InspectionMethod.allSchemas" :formAllSchemas="InspectionMethod.allSchemas"
:apiUpdate="InspectionMethodApi.updateInspectionMethod" :apiUpdate="InspectionMethodApi.updateInspectionMethod"
@ -163,6 +170,18 @@ const openForm = (type: string, row?: any) => {
} }
}) })
} }
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
}
}
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
@ -170,13 +189,17 @@ const openForm = (type: string, row?: any) => {
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType,data) => {
// data.filePathList = [] // data.filePathList = []
// data.tmp = [] // data.tmp = []
data.filePathList = [] console.log(data)
for (let i = 0; i < data.filePathListView.length; i++) { // for (let i = 0; i < data.filePathListView.length; i++) {
data.filePathList.push(data.filePathListView[i].url) // data.filePathList.push(data.filePathListView[i].url)
} // }
if(data.filePathList.length>0){ // data.filePathList = []
data.videoAddress = data.filePathList.join(',') // 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 // debugger
// if(data.filePathListView instanceof Array){ // if(data.filePathListView instanceof Array){
// for(let i=0; i<data.filePathListView.length; i++){ // for(let i=0; i<data.filePathListView.length; i++){
@ -204,6 +227,7 @@ const formsSuccess = async (formType,data) => {
// if(data.expireTime==0)data.expireTime = null; // if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') { if (formType === 'create') {
delete data['uploadFile']
await InspectionMethodApi.createInspectionMethod(data) await InspectionMethodApi.createInspectionMethod(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {

17
src/views/qms/inspectionMethod/inspectionMethod.data.ts

@ -53,7 +53,7 @@ export const InspectionMethod = useCrudSchemas(reactive<CrudSchema[]>([
}, },
{ {
label: '文件', label: '文件',
field: 'filePathListView', field: 'videoAddress',
sort: 'custom', sort: 'custom',
isTable: false, isTable: false,
table: { table: {
@ -84,6 +84,21 @@ export const InspectionMethod = useCrudSchemas(reactive<CrudSchema[]>([
} }
} }
}, },
{
label: '文件',
field: 'videoAddress',
sort: 'custom',
isTable: false,
isForm: false,
table: {
},
form: {
component: 'UploadFile',
componentProps: {
}
}
},
{ {
label: '创建时间', label: '创建时间',
field: 'createTime', field: 'createTime',

Loading…
Cancel
Save