Browse Source

图片

master_hella_20240701
zhang_li 7 months ago
parent
commit
c6c5e0b413
  1. 12
      src/components/UploadFile/src/UploadFile.vue
  2. 64
      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) : ''
}
watch(
() => props.modelValue,
(data) => {
if (!data) return
fileList.value = data
},
{
deep: true,
immediate: true
}
)
</script>
<style scoped lang="scss">
.upload-file-uploader {

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

@ -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"
@ -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)
}
@ -170,27 +189,31 @@ const openForm = (type: string, row?: any) => {
const formsSuccess = async (formType,data) => {
// data.filePathList = []
// data.tmp = []
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(',')
}
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)
// 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';
// });
@ -204,6 +227,7 @@ const formsSuccess = async (formType,data) => {
// if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
delete data['uploadFile']
await InspectionMethodApi.createInspectionMethod(data)
message.success(t('common.createSuccess'))
} else {

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

@ -53,7 +53,7 @@ export const InspectionMethod = useCrudSchemas(reactive<CrudSchema[]>([
},
{
label: '文件',
field: 'filePathListView',
field: 'videoAddress',
sort: 'custom',
isTable: false,
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: '创建时间',
field: 'createTime',

Loading…
Cancel
Save