fix : 征集公司校验,单文件显示改为表格,手机端审批后刷新,需求征集回车触发搜索,组织机构管理搜索

This commit is contained in:
2024-07-22 20:39:26 +08:00
parent ae6da83a1a
commit 3c1fcc327c
17 changed files with 470 additions and 169 deletions

View File

@@ -3,19 +3,18 @@
<el-row>
<el-col :span="24">
<el-form-item :label="label" prop="attachment" label-width="125">
<template v-if="preview&&JSON.stringify(singleFile) !== '{}'&&JSON.stringify(singleFile)!=='null'">
<el-button type="primary" link @click="handleDownload(singleFile)" style="font-size: 16px">
{{ singleFile ? singleFile?.originalFileName : formData.singleFile?.originalFileName }}
</el-button>
<el-button type="danger" link @click="deleteSingleFile(singleFile?singleFile:formData.singleFile,1)">删除
</el-button>
</template>
<template
v-else-if="!preview||JSON.stringify(singleFile) == '{}'||singleFile==null||formData.singleFile==null">
<template v-if="preview">
<file-upload @getFile="getAttachment" :multiple="false"
:disabled="isSingleFile" ref="fileUploadRef"/>
<!-- :showFileList="showFileList" @delete="deleteAttachment"-->
<fvTable style="width: 100%;max-height: 80px;" v-if="showSingleTable" height="80" :tableConfig="singleTableConfig"
:disabled="singleFileArray?.length>0?true:false" title="如需修改需求申请书附件,请先删除文件再上传!"/>
<fvTable style="width: 100%;max-height: 80px;" height="80" v-if="singleFileArray?.length>0" :tableConfig="editSingleTableConfig"
:data="singleFileArray" :isSettingCol="false" :pagination="false">
</fvTable>
</template>
<template v-else-if="!preview">
<file-upload @getFile="getAttachment" :multiple="false"
:disabled="isSingleFile" />
<fvTable style="width: 100%;max-height: 80px;" v-if="showSingleTable" height="80"
:tableConfig="singleTableConfig"
:data="_singleFileValue" :isSettingCol="false" :pagination="false">
</fvTable>
</template>
@@ -24,7 +23,7 @@
<el-col :span="24">
<el-form-item label="其他文件" label-width="125">
<file-upload @getFile="getOtherFile"/>
<fvTable style="width: 100%;max-height: 162px;" v-if="showTable" height="162" :tableConfig="tableConfig"
<fvTable style="width: 100%;max-height: 162px;" v-if="showTable" height="162" :tableConfig="tableConfig"
:data="allFileList" :isSettingCol="false" :pagination="false">
<template #empty>
<el-empty :image-size="55" description="暂无数据" style="padding: 0"/>
@@ -84,7 +83,7 @@ const props = defineProps({
default: ''
}
})
const emit = defineEmits(["getAttachment", "getOtherFile","update:singleList"])
const emit = defineEmits(["getAttachment", "getOtherFile", "update:singleList"])
const tableConfig = reactive({
columns: [
{
@@ -98,6 +97,7 @@ const tableConfig = reactive({
prop: 'originalFileName',
label: '文件名',
align: 'center',
width: 400,
},
{
prop: 'tag',
@@ -160,6 +160,7 @@ const singleTableConfig = reactive({
prop: 'originalFileName',
label: '文件名',
align: 'center',
width: 400,
},
{
prop: 'tag',
@@ -209,18 +210,80 @@ const singleTableConfig = reactive({
}
]
})
const fileUploadRef = ref()
const editSingleTableConfig = reactive({
columns: [
{
prop: 'index',
type: 'index',
label: '序号',
align: 'center',
width: '80',
},
{
prop: 'originalFileName',
label: '文件名',
align: 'center',
width: 400,
},
{
prop: 'tag',
label: '标签',
align: 'center'
},
{
prop: 'size',
label: '文件大小',
align: 'center',
currentRender: ({row, index}) => (parseInt(row.size / 1024) + 'KB')
},
{
prop: 'oper',
label: '操作',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = []
btn.push({label: '下载', func: () => handleDownload(row), type: 'primary'})
// if (row.newFile) {
// btn.push({label: '删除', func: () => handleDelete(row), type: 'primary'})
// }
return (
<div style={{width: '100%'}}>
{
btn.map(item => (
<el-button
type={item.type}
onClick={() => item.func()}
link
>
{item.label}
</el-button>
))
}
{
row.newFile || props.preview || !props.preview ?
<popover-delete name={row.originalFileName} type={'文件'} btnType={'danger'}
// perm={['']}
onDelete={() => deleteSingleFile(row, 1)}/>
: ''
}
</div>
)
}
}
]
})
const singleFileArray = ref([])
const rules = reactive({
attachment: [{required: true, message: '请上传附件', trigger: ['blur', 'change']}],
})
const applyForm = ref()
const singleFile = ref(props.formData.singleFile)
const singleFile = ref({})
const isSingleFile = ref(false)
const allFileList = ref([])
const deleteFileVal = ref({})
const singleFileList = ref([])
if(localStorage.getItem('singleFile')){
singleFile.value = JSON.parse(localStorage.getItem('singleFile'))
if (localStorage.getItem('singleFile')) {
singleFileArray.value.push(JSON.parse(localStorage.getItem('singleFile')))
singleFile.value =JSON.parse(localStorage.getItem('singleFile'))
}
const _singleFileValue = computed({
get() {
@@ -230,8 +293,6 @@ const _singleFileValue = computed({
emit('update:singleList', value)
}
})
// console.log('_singleFileValue',_singleFileValue.value)
const _otherFileListValue = computed({
get() {
return props.otherFileList;
@@ -240,8 +301,8 @@ const _otherFileListValue = computed({
emit('update:otherFileList', value)
}
})
if(_otherFileListValue.value&&_otherFileListValue.value.length>0){
_otherFileListValue.value.forEach(item=>{
if (_otherFileListValue.value && _otherFileListValue.value.length > 0) {
_otherFileListValue.value.forEach(item => {
allFileList.value.push(item)
})
}
@@ -279,16 +340,20 @@ watch(() => props.showTable, (newVal) => {
// singleFileList.value = newVal
// }, {deep: true})
watch(() => props.formData.singleFile, (newVal) => {
// console.log('singleFile', newVal)
props.formData.singleFile = newVal
if(newVal!=null){
singleFileArray.value.push(newVal)
}else{
singleFileArray.value=[]
}
singleFile.value = newVal
props.formData.singleFile=newVal
}, {deep: true})
watch(() => isSingleFile.value, (newVal) => {
isSingleFile.value = newVal
}, {deep: true})
watch(() => singleFile.value, (newVal) => {
singleFile.value = newVal
}, {deep: true})
// watch(() => singleFile.value, (newVal) => {
// singleFile.value = newVal
// }, {deep: true})
const handleDelete = (row, type) => {
deleteFile(row.fileId).then(res => {
ElNotification({
@@ -307,14 +372,11 @@ const handleDelete = (row, type) => {
});
}
const handleSingleDelete = (row) => {
// console.log('row',row)
// fileUploadRef.value.handleRemove(deleteFileVal.value.id)
handleDelete(row, 'single')
}
const getAttachment = (val) => {
// console.log('getAttachment', val)
isSingleFile.value = true
// deleteFileVal.value=val
emit('getAttachment', val)
}
const compositeParam = (item) => {
@@ -346,6 +408,7 @@ const deleteAttachment = (val) => {
})
isSingleFile.value = false
singleFile.value = null
singleFileArray.value= []
}
});
}
@@ -364,7 +427,8 @@ const deleteSingleFile = (row, type) => {
if (res.code === 1000) {
isSingleFile.value = false
if (type === 1) {
singleFile.value = null
singleFile.value =null
singleFileArray.value= []
} else {
props.otherFileList.splice(props.otherFileList.findIndex((item) => item.fileId === row.fileId), 1);
}