Merge branch 'hongchao-dev'

This commit is contained in:
jjLv 2024-12-11 09:28:28 +08:00
commit 57468d35b3
2 changed files with 94 additions and 21 deletions

View File

@ -172,7 +172,7 @@
ref="addAndEditFormRef" ref="addAndEditFormRef"
label-position="right" label-position="right"
:model="addAndEditForm" :model="addAndEditForm"
:rules="htRules" :rules="addAndEditFormRules"
> >
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
@ -187,28 +187,56 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="1" style="margin-bottom: 0" class="upload-tip"> <el-form-item label="1" style="margin-bottom: 0" class="upload-tip">
支持格式word.单个文件大小不能超过2M最多可上传1张
<el-button size="small" type="primary">点击上传</el-button> </el-form-item>
<el-upload </el-col>
class="upload-demo" </el-row>
action="https://jsonplaceholder.typicode.com/posts/" <el-row :gutter="20" >
:on-preview="handlePreview" <el-col :span="24">
:on-remove="handleRemove" <el-form-item label="附件" prop="fileInfoList">
:before-remove="beforeRemove" <div style="flex: 1">
multiple <UploadComponentNew
:limit="1" :maxSize="10"
:on-exceed="handleExceed" :max-limit="1"
:file-list="fileList"> width="100%"
<div class="upload-tip" >支持格式.word.单个文件大小不能超过2M</div> height="100%"
</el-upload> :multiple="true"
:autoUpload="true"
:minLimit="addAndEditForm.fileInfoList.length"
:actionUrl="uploadUrl"
listType="text"
:justifyContent="`flex-start`"
@onFileChange="onFileChange"
:acceptTypeList="['.doc','.docx' ]"
>
<template v-slot:default>
<!-- <el-icon size="48" color="#aaa"><Plus /></el-icon> -->
<el-button
:icon="UploadFilled"
type="primary"
class="primary-lease"
>上传文件</el-button
>
</template>
</UploadComponentNew>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" class="primary-lease" @click="onCancel"
>取消</el-button
>
<el-button class="primary-lease" type="primary" @click="onSubmit()">
提交
</el-button>
</div>
</template>
</el-dialog> </el-dialog>
</template> </template>
@ -230,12 +258,14 @@ const store2 = mainStore()
const isViewForm = ref(false) const isViewForm = ref(false)
const isDisabled = ref(false) const isDisabled = ref(false)
const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload'
import { import {
getEquipmentTypeApi, // getEquipmentTypeApi, //
getCompanyListApi, // getCompanyListApi, //
getEquipmentListApi, // getEquipmentListApi, //
} from 'http/api/usercenter/goodsmang' } from 'http/api/usercenter/goodsmang'
import { InfoFilled, UploadFilled } from '@element-plus/icons-vue'
/* 查询参数 */ /* 查询参数 */
const queryParams: any = ref({ const queryParams: any = ref({
deviceName: '', deviceName: '',
@ -248,7 +278,8 @@ const queryParams: any = ref({
const addAndEditForm = reactive<any>({ const addAndEditForm = reactive<any>({
htName: '', htName: '',
mainFileList: [], fileInfoList: [],
fileInfoTempList: [],
}) })
// //
@ -295,6 +326,48 @@ const onDialogClose = () => {
// addAndEditFormRef.value.resetFields() // addAndEditFormRef.value.resetFields()
} }
//
const onFileChange = (fileList: any) => {
addAndEditForm.value.fileInfoTempList = []
const fileListTemp = fileList.map((e: any) => {
return {
fileName: e.name,
fileUrl: e.url,
}
})
addAndEditForm.value.fileInfoTempList.push(...fileListTemp)
}
const addAndEditFormRules = reactive({
htName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
fileInfoList: [{ required: true, message: '请上传合同附件', trigger: 'blur' }],
})
//
const onSubmit = () => {
addAndEditForm.value.fileInfoList = addAndEditForm.value.fileInfoTempList
addAndEditFormRef.value.validate(async (valid: any) => {
if (valid) {
// const SEN_API = settleinTitle.value === '' ? editSafeBookApi : addSafeBookApi
// const res: any = await SEN_API(addAndEditForm.value)
// if (res.code === 200) {
// ElMessage({
// type: 'success',
// message: '',
// })
// dialogVisibleSettlein.value = false
// // getLeaseListData()
// }
}
})
}
//
const onCancel = () => {
dialogVisibleSettlein.value = false
}
onMounted(() => { onMounted(() => {
// //
getTypeTreeData() getTypeTreeData()

View File

@ -1481,8 +1481,8 @@ const options = ref<any>([
:span="6" :span="6"
style=" style="
display: flex; display: flex;
justify-content: left; justify-content: center;
align-items: left; align-items: center;
" "
> >
<div style=""> <div style="">