|
|
@ -134,6 +134,36 @@ |
|
|
</van-radio-group> |
|
|
</van-radio-group> |
|
|
</template> |
|
|
</template> |
|
|
</van-field> |
|
|
</van-field> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 附件 --> |
|
|
|
|
|
<div class="file-upload"> |
|
|
|
|
|
<div class="file-upload-center"> |
|
|
|
|
|
<label><span v-if="!isReadonly" class="file-required">*</span> 附 件</label> |
|
|
|
|
|
<span>(仅限PDF文档,5MB以下)</span> |
|
|
|
|
|
<span class="down-mod"><van-icon name="upgrade" /><a @click="downloadFile">模板下载</a></span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<van-uploader |
|
|
|
|
|
v-model="fileListObj" |
|
|
|
|
|
max-count="1" |
|
|
|
|
|
:max-size="5 * 1024 * 1024" |
|
|
|
|
|
class="file" |
|
|
|
|
|
:after-read="uploadFiles" |
|
|
|
|
|
multiple |
|
|
|
|
|
:disabled="isReadonly" |
|
|
|
|
|
:deletable="!isReadonly" |
|
|
|
|
|
accept=".pdf" |
|
|
|
|
|
:before-read="beforeRead" |
|
|
|
|
|
:before-delete="deleteFile" |
|
|
|
|
|
@oversize="onOversize" |
|
|
|
|
|
> |
|
|
|
|
|
<template #preview-cover="{ file }"> |
|
|
|
|
|
<div class="preview-cover van-ellipsis">{{ file.name }}</div> |
|
|
|
|
|
</template> |
|
|
|
|
|
</van-uploader> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="warning-rule"> |
|
|
|
|
|
<span><van-icon name="warning-o" /></span>仅支持上传5MB以下的PDF格式文档 |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- 提交按钮 --> |
|
|
<!-- 提交按钮 --> |
|
|
@ -266,6 +296,8 @@ import { showToast, showSuccessToast, showConfirmDialog } from 'vant'; |
|
|
import { addPlan, editPlan, getPlanDetail, getSubmitDeadline, getManualMatchDays, getMaxInnerUnitAcPersonNum, searchBureauUnitUsers } from '@/api/enforcement/plan'; |
|
|
import { addPlan, editPlan, getPlanDetail, getSubmitDeadline, getManualMatchDays, getMaxInnerUnitAcPersonNum, searchBureauUnitUsers } from '@/api/enforcement/plan'; |
|
|
import { queryEnterpriseListAndQrInfo } from '@/api/enforcement/index'; |
|
|
import { queryEnterpriseListAndQrInfo } from '@/api/enforcement/index'; |
|
|
import { maskPhone } from '@/util/util'; |
|
|
import { maskPhone } from '@/util/util'; |
|
|
|
|
|
import { uploadFile } from '@/util/fileUpload'; |
|
|
|
|
|
import { toFullFileUrl } from '@/util/fileUrl'; |
|
|
const router = useRouter(); |
|
|
const router = useRouter(); |
|
|
const route = useRoute(); |
|
|
const route = useRoute(); |
|
|
const {useCommon} = $globalStore; |
|
|
const {useCommon} = $globalStore; |
|
|
@ -316,6 +348,9 @@ const noticeText = computed(() => { |
|
|
return '专项计划时间不受提交截止日限制'; |
|
|
return '专项计划时间不受提交截止日限制'; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 附件上传组件状态 |
|
|
|
|
|
const fileListObj = ref([]); |
|
|
|
|
|
|
|
|
// 表单数据 |
|
|
// 表单数据 |
|
|
const form = ref({ |
|
|
const form = ref({ |
|
|
id: '', |
|
|
id: '', |
|
|
@ -344,6 +379,7 @@ const form = ref({ |
|
|
deptId: '', |
|
|
deptId: '', |
|
|
deptName: '', |
|
|
deptName: '', |
|
|
isDelete: 0, |
|
|
isDelete: 0, |
|
|
|
|
|
fileList: [], |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 人员列表 |
|
|
// 人员列表 |
|
|
@ -542,6 +578,26 @@ const loadDetail = (id) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 回填附件,兼容对象数组和路径字符串数组 |
|
|
|
|
|
const detailFiles = Array.isArray(data.fileList) ? data.fileList : []; |
|
|
|
|
|
form.value.fileList = detailFiles.map(item => { |
|
|
|
|
|
const uploadPath = typeof item === 'string' |
|
|
|
|
|
? item |
|
|
|
|
|
: (item.uploadPath || item.fileUrl || item.filePath || item.url || ''); |
|
|
|
|
|
return { |
|
|
|
|
|
uploadPath, |
|
|
|
|
|
fileName: typeof item === 'object' && item |
|
|
|
|
|
? (item.fileName || item.fileSaveName || item.name || '') |
|
|
|
|
|
: '', |
|
|
|
|
|
}; |
|
|
|
|
|
}).filter(item => item.uploadPath); |
|
|
|
|
|
fileListObj.value = form.value.fileList.map(item => ({ |
|
|
|
|
|
url: toFullFileUrl(item.uploadPath), |
|
|
|
|
|
uploadPath: item.uploadPath, |
|
|
|
|
|
status: 'done', |
|
|
|
|
|
message: '', |
|
|
|
|
|
name: item.fileName || item.uploadPath.split('/').pop() || '附件', |
|
|
|
|
|
})); |
|
|
// 解析人员 |
|
|
// 解析人员 |
|
|
if (data.enforceUserNames) { |
|
|
if (data.enforceUserNames) { |
|
|
const names = data.enforceUserNames.split(','); |
|
|
const names = data.enforceUserNames.split(','); |
|
|
@ -797,6 +853,58 @@ const syncPersonData = () => { |
|
|
form.value.enforceUserCodes = personList.value.map(p => p.code || '').join(','); |
|
|
form.value.enforceUserCodes = personList.value.map(p => p.code || '').join(','); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 下载附件模板 |
|
|
|
|
|
const downloadFile = () => { |
|
|
|
|
|
window.open('http://jdm.szssfj.cn/jdmApi/profile//EnforcementInspectionPlanTemplate.xlsx'); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 上传前校验 PDF 类型 |
|
|
|
|
|
const beforeRead = (file) => { |
|
|
|
|
|
if (isReadonly.value) return false; |
|
|
|
|
|
const files = Array.isArray(file) ? file : [file]; |
|
|
|
|
|
const isValid = files.every(item => item.type === 'application/pdf'); |
|
|
|
|
|
if (!isValid) { |
|
|
|
|
|
showToast('仅支持上传PDF格式文档'); |
|
|
|
|
|
} |
|
|
|
|
|
return isValid; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 上传附件 |
|
|
|
|
|
const uploadFiles = (file) => { |
|
|
|
|
|
if (isReadonly.value) return; |
|
|
|
|
|
const files = Array.isArray(file) ? file : [file]; |
|
|
|
|
|
form.value.fileList = []; |
|
|
|
|
|
files.forEach(f => { |
|
|
|
|
|
uploadFile(f, (res) => { |
|
|
|
|
|
const uploadPath = res.url || ''; |
|
|
|
|
|
if (!uploadPath) { |
|
|
|
|
|
f.status = 'failed'; |
|
|
|
|
|
f.message = '上传失败'; |
|
|
|
|
|
form.value.fileList = []; |
|
|
|
|
|
showToast('附件上传失败,请重试'); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
f.url = uploadPath; |
|
|
|
|
|
form.value.fileList = [{ |
|
|
|
|
|
uploadPath, |
|
|
|
|
|
fileName: f.file?.name || f.name || '', |
|
|
|
|
|
}]; |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 删除附件时同步提交数据 |
|
|
|
|
|
const deleteFile = (file, detail) => { |
|
|
|
|
|
if (isReadonly.value) return false; |
|
|
|
|
|
form.value.fileList.splice(detail.index, 1); |
|
|
|
|
|
return true; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 文件大小超出限制 |
|
|
|
|
|
const onOversize = () => { |
|
|
|
|
|
showToast('文件大小不能超过 5MB'); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
// 返回 |
|
|
// 返回 |
|
|
const onBack = () => { |
|
|
const onBack = () => { |
|
|
router.back(); |
|
|
router.back(); |
|
|
@ -824,6 +932,18 @@ const validate = () => { |
|
|
showToast('执法人员不得少于2人'); |
|
|
showToast('执法人员不得少于2人'); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
if (!fileListObj.value.length) { |
|
|
|
|
|
showToast('请上传PDF格式附件(5MB以下)'); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if (fileListObj.value.some(file => file.status === 'uploading')) { |
|
|
|
|
|
showToast('附件上传中,请稍候'); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
if (!form.value.fileList.length || !form.value.fileList[0]?.uploadPath) { |
|
|
|
|
|
showToast('附件上传失败,请重新上传'); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
@ -1120,6 +1240,94 @@ const doSubmit = () => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.file-upload { |
|
|
|
|
|
padding: 16px; |
|
|
|
|
|
background: #fff; |
|
|
|
|
|
|
|
|
|
|
|
.file-upload-center { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
margin-bottom: 12px; |
|
|
|
|
|
font-size: 14px; |
|
|
|
|
|
color: #323233; |
|
|
|
|
|
position: relative; |
|
|
|
|
|
|
|
|
|
|
|
.file-required { |
|
|
|
|
|
color: red; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
label { |
|
|
|
|
|
font-weight: 500; |
|
|
|
|
|
margin-right: 8px; |
|
|
|
|
|
white-space: nowrap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
> span { |
|
|
|
|
|
color: #969799; |
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
white-space: nowrap; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.down-mod { |
|
|
|
|
|
position: absolute; |
|
|
|
|
|
right: 0; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
gap: 2px; |
|
|
|
|
|
color: #faad14; |
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
|
|
|
|
|
|
a { |
|
|
|
|
|
color: #faad14; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.file { |
|
|
|
|
|
:deep(.van-uploader__upload), |
|
|
|
|
|
:deep(.van-uploader__preview), |
|
|
|
|
|
:deep(.van-uploader__preview-image) { |
|
|
|
|
|
width: 80px; |
|
|
|
|
|
height: 80px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
:deep(.van-uploader__upload) { |
|
|
|
|
|
border: 1px dashed #dcdee0; |
|
|
|
|
|
border-radius: 4px; |
|
|
|
|
|
background: #fafafa; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.preview-cover { |
|
|
|
|
|
position: absolute; |
|
|
|
|
|
bottom: 0; |
|
|
|
|
|
left: 0; |
|
|
|
|
|
right: 0; |
|
|
|
|
|
padding: 8px; |
|
|
|
|
|
background: rgba(0, 0, 0, 0.6); |
|
|
|
|
|
color: #fff; |
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
overflow: hidden; |
|
|
|
|
|
text-overflow: ellipsis; |
|
|
|
|
|
white-space: nowrap; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.warning-rule { |
|
|
|
|
|
margin: 12px 16px 16px; |
|
|
|
|
|
padding: 6px; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
background: #fff7e6; |
|
|
|
|
|
color: #faad14; |
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
border-radius: 4px; |
|
|
|
|
|
|
|
|
|
|
|
span { |
|
|
|
|
|
margin-right: 4px; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.submit-wrap { |
|
|
.submit-wrap { |
|
|
padding: 22px 0 0; |
|
|
padding: 22px 0 0; |
|
|
|
|
|
|
|
|
|