Browse Source

系统管理/\APP升级/安装包信息管理 --- 新增:上传附件功能

master_hella_20240701
yufei0306 8 months ago
parent
commit
38f7bce772
  1. 8
      src/components/UploadFile/src/UploadFile.vue
  2. 15
      src/views/system/systemInstallPackage/index.vue
  3. 27
      src/views/system/systemInstallPackage/systemInstallPackage.data.ts

8
src/components/UploadFile/src/UploadFile.vue

@ -129,11 +129,11 @@ const excelUploadError: UploadProps['onError'] = (): void => {
} }
// //
const handleRemove = (file) => { const handleRemove = (file) => {
const findex = fileList.value.map((f) => f.name).indexOf(file.name) // const findex = fileList.value.map((f) => f.name).indexOf(file.name)
if (findex > -1) { // if (findex > -1) {
fileList.value.splice(findex, 1) // fileList.value.splice(findex, 1)
emit('update:modelValue', listToString(fileList.value)) emit('update:modelValue', listToString(fileList.value))
} // }
} }
const handlePreview: UploadProps['onPreview'] = (uploadFile) => { const handlePreview: UploadProps['onPreview'] = (uploadFile) => {
console.log(uploadFile) console.log(uploadFile)

15
src/views/system/systemInstallPackage/index.vue

@ -41,6 +41,13 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
:sumFormDataByForm ="(formRef,formModel)=>{
console.log(formModel)
const {uploadFile} = formModel
formRef.value.setValues({
installPackageUrl:uploadFile
})
}"
@success="formsSuccess" @success="formsSuccess"
:rules="SystemInstallPackageRules" :rules="SystemInstallPackageRules"
:formAllSchemas="SystemInstallPackage.allSchemas" :formAllSchemas="SystemInstallPackage.allSchemas"
@ -131,12 +138,20 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
if('create'==type){
const currentTime = new Date().getTime()
const fileId = SystemInstallPackage.allSchemas.formSchema.find(item=>item.field=='fileId')
fileId['value'] = currentTime
const uploadFile = SystemInstallPackage.allSchemas.formSchema.find(item=>item.field=='uploadFile')
uploadFile['componentProps']['upData']['tableId'] = currentTime
}
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType,data) => {
if (formType === 'create') { if (formType === 'create') {
delete data['uploadFile']
await SystemInstallPackageApi.createSystemInstallPackage(data) await SystemInstallPackageApi.createSystemInstallPackage(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {

27
src/views/system/systemInstallPackage/systemInstallPackage.data.ts

@ -25,6 +25,11 @@ export const SystemInstallPackage = useCrudSchemas(reactive<CrudSchema[]>([
label: '安装路径', label: '安装路径',
field: 'installPackageUrl', field: 'installPackageUrl',
sort: 'custom', sort: 'custom',
form: {
componentProps: {
disabled: true
},
}
}, },
{ {
label: '是否强制更新', label: '是否强制更新',
@ -53,14 +58,34 @@ export const SystemInstallPackage = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '附件id', label: '附件id',
field: 'fileId', field: 'fileId',
isForm:false,
sort: 'custom', sort: 'custom',
form: {
componentProps: {
disabled: true
},
value:'',
}
}, },
{ {
label: '备注', label: '备注',
field: 'remark', field: 'remark',
sort: 'custom', sort: 'custom',
}, },
{
label: '上传附件',
field: 'uploadFile',
sort: 'custom',
form: {
component: 'UploadFile',
componentProps: {
upData:{
tableId: '',
tableName: ''
},
limit:1
}
},
},
{ {
label: '创建时间', label: '创建时间',
field: 'createTime', field: 'createTime',

Loading…
Cancel
Save