fix : 修复项目归档五个附件上传功能、提示框、文件多选上传、详情驳回/同意路由跳转问题

This commit is contained in:
2024-06-01 18:30:11 +08:00
parent 04a7ba8802
commit dd046f645f
19 changed files with 659 additions and 88 deletions

View File

@@ -90,3 +90,10 @@ export const getRequirementAttachment = (params) => {
params:params
});
};
export const uploadRequirementAttachment= (data) => {
return request({
url: '/workflow/mosr/requirement/upload',
method: "post",
data: data
});
};

View File

@@ -34,6 +34,13 @@ export const getInitiationAttachment = (params) => {
params:params
});
};
export const uploadInitiationAttachment= (data) => {
return request({
url: '/workflow/mosr/project/approval/upload',
method: "post",
data: data
});
};
//项目实施
export const getCheckDetail = (projectId) => {
return request({
@@ -126,3 +133,10 @@ export const getFilingAttachment = (params) => {
params:params
});
};
export const uploadFilingAttachment= (data) => {
return request({
url: '/workflow/mosr/project/filing/upload',
method: "post",
data: data
});
};

View File

@@ -10,7 +10,7 @@
<el-button type="danger" link @click="deleteOtherFile(singleFile,1)">删除</el-button>
</template>
<template v-else-if="!preview||JSON.stringify(singleFile) === '{}'||singleFile==null">
<file-upload @getFile="getAttachment" :showFileList="showFileList" :maxSize="0" @delete="deleteAttachment"/>
<file-upload @getFile="getAttachment" :showFileList="showFileList" :multiple="false" :maxSize="1" :disabled="isSingleFile" @delete="deleteAttachment"/>
</template>
</el-form-item>
</el-col>
@@ -63,20 +63,21 @@ const tableConfig = reactive({
align: 'center',
currentRender: ({row, index}) => (parseInt(row.size / 1024) + 'KB')
},
// {
// prop: 'oper',
// label: '操作',
// align: 'center',
// showOverflowTooltip: false,
// currentRender: ({row, index}) => {
// return (
// <div>
// <el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
// <el-button type="primary" size="large" link onClick={() => deleteOtherFile(row)}>删除</el-button>
// </div>
// )
// }
// }
{
prop: 'oper',
label: '操作',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
return (
<div>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
</div>
)
}
}
// <el-button type="primary" size="large" link onClick={() => deleteOtherFile(row)}>删除</el-button>
]
})
const rules = reactive({
@@ -84,6 +85,7 @@ const rules = reactive({
})
const applyForm = ref()
const singleFile = ref()
const isSingleFile = ref(false)
const allFileList = ref([])
const props = defineProps({
showFileList: {
@@ -110,12 +112,17 @@ watch(() => props.showTable, (newVal) => {
props.showTable = newVal
}, {deep: true})
watch(() => props.otherFileList, (newVal) => {
console.log('new',newVal)
// newVal?.forEach(item => {
console.log('newotherFileList',newVal)
if (props.preview) {
newVal?.forEach(item => {
allFileList.value.push(item)
})
}else {
allFileList.value=newVal
// })
}
}, {deep: true})
watch(() => props.formData.fileList, (newVal) => {
console.log('newVal-fileList',newVal)
if (props.preview) {
newVal?.forEach(item => {
allFileList.value.push(item)
@@ -127,6 +134,7 @@ watch(() => props.formData.singleFile, (newVal) => {
singleFile.value = newVal
}, {deep: true})
const getAttachment = (val) => {
isSingleFile.value=true
emit('getAttachment', val)
}
const getOtherFile = (val) => {
@@ -135,7 +143,12 @@ const getOtherFile = (val) => {
const deleteAttachment = (val) => {
deleteFile(val).then(res => {
if (res.code === 1000) {
ElMessage.success("删除成功");
ElNotification({
title: '提示',
message:"删除成功",
type:'success'
})
isSingleFile.value=false
}
});
}

View File

@@ -37,8 +37,7 @@ const schema = computed(() => {
props: {
placeholder: '请输入审核意见',
type: 'textarea',
// maxlength: 140,
rows:3
rows: 3
}
}
]
@@ -52,7 +51,13 @@ const back = () => {
router.push({name: 'Filing'})
break;
case 'Implementation/detail':
router.push({name: 'Implementation'})
if (route.query.step === '20') {
router.push({name: 'Initiation'})
} else if (route.query.step === '40') {
router.push({name: 'Implementation'})
} else if (route.query.step === '50') {
router.push({name: 'Filing'})
}
break;
case 'Summary/detail':
router.push({name: 'Summary'})

View File

@@ -4,7 +4,7 @@
:headers="headers"
:limit="maxSize"
with-credentials
:multiple="maxSize > 0"
:multiple="multiple"
:data="uploadParams"
:show-file-list="showFileList"
:auto-upload="true"
@@ -19,8 +19,9 @@
</template>
<script setup>
import {ElMessage,ElMessageBox} from "element-plus";
import { ElMessageBox, ElNotification} from "element-plus";
import {getToken} from '@/utils/auth'
const baseURL = import.meta.env.VITE_BASE_URL
const uploadFileUrl = ref(baseURL + "/workflow/process/file/upload")
const headers = reactive({
@@ -43,13 +44,16 @@ const props = defineProps({
showFileList: {
type: Boolean,
default: false
},disabled: {
}, disabled: {
type: Boolean,
default: false
}, multiple: {
type: Boolean,
default: true
}
})
const emit = defineEmits(["input", "getFile","delete"])
const emit = defineEmits(["input", "getFile", "delete"])
const fileList = ref([])
const _value = computed({
get() {
@@ -59,7 +63,7 @@ const _value = computed({
emit("input", val);
}
})
const beforeRemove = (file, fileList) => {
const beforeRemove = (file) => {
return ElMessageBox.confirm(`确认删除名称为${file.name}的文件吗?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -67,38 +71,32 @@ const beforeRemove = (file, fileList) => {
}).then(() => true)
}
const handleRemove = (file, fileList) => {
emit("delete",file.response.data.id)
const handleRemove = (file) => {
emit("delete", file.response.data.id)
}
const beforeUpload = (file) => {
// const FileExt = file.name.replace(/.+\./, "");
// if (['zip', 'rar', 'pdf', 'doc', 'docx', 'xlsx'].indexOf(FileExt.toLowerCase()) === -1) {
// ElMessage.warning('请上传后缀名为pdf、doc、docx、xlsx、zip或rar的文件');
// return false;
// } else
// if (props.maxSize > 0 && file.size / 1024 / 1024 > props.maxSize) {
// ElMessage.warning(`每个文件最大不超过 ${props.maxSize}MB`)
// } else {
const beforeUpload = () => {
loading.value = true
return true
// }
}
const handleUploadSuccess = (res, file) => {
if (res.code !== 1000) {
loading.value = false
ElMessage.error("上传失败")
} else {
loading.value = false
ElMessage.success("上传成功")
}
const handleUploadSuccess = (res) => {
ElNotification({
title: '提示',
message: res.code === 1000 ? '上传成功' : '上传失败',
type: res.code === 1000 ? 'success' : 'error'
})
loading.value = false
showTable.value = true
let data = res.data
fileList.value.push(data)
emit("getFile", res.data)
}
const uploadError=(err)=>{
const uploadError = () => {
loading.value = false
ElMessage.error("上传失败,请稍后再试!")
ElNotification({
title: '提示',
message: "上传失败,请稍后再试!",
type: 'error'
})
}
</script>
@@ -108,6 +106,7 @@ a {
font-size: 14px;
color: #2a99ff;
}
:deep(.el-upload-list) {
width: 400px;
}

View File

@@ -89,21 +89,18 @@ const tableConfig = reactive({
if(row.buttons){
buttons = new Set(Array.from(row.buttons))
}
// if (buttons.has("details")) {
if (buttons.has("details")) {
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'})
// }
// if (buttons.has("edit")) {
}
if (buttons.has("edit")) {
btn.push({label: '编辑', prem: ['mosr:requirement:resubmit'], func: () => handleEdit(row), type: 'primary'})
// }
// if (buttons.has("delete")) {
// btn.push({label: '删除',prem: ['mosr:requirement:del'], func: () => handleDelete(row), type: 'primary'})
// }
// if (buttons.has("report")) {
}
if (buttons.has("report")) {
btn.push({label: '明细导出', prem: ['mosr:requirement:info'], func: () => handleReport(row), type: 'primary'})
// }
// if (buttons.has("report")) {
}
if (buttons.has("report")) {
btn.push({label: '汇总导出', prem: ['mosr:requirement:info'], func: () => handleReport(row), type: 'primary'})
// }
}
return (
<div style={{width: '100%'}}>
{
@@ -119,11 +116,11 @@ const tableConfig = reactive({
))
}
{
// buttons.has("delete") ?
buttons.has("delete") ?
<popover-delete name={row.requirementName} type={'费用分摊'} btnType={'danger'}
perm={['mosr:requirement:del']}
onDelete={() => handleDelete(row)}/>
// : ''
: ''
}
</div>
)

View File

@@ -236,11 +236,6 @@ const init = async () => {
const resFund = await getFundOption()
specialFundOption.value = resFund.data
getWorkflowInfo().then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
let data = res.data
processInstanceData.value = data
@@ -256,7 +251,12 @@ const init = async () => {
nextTick(() => {
processDiagramViewer.value = true
})
} else {
}else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}
@@ -367,7 +367,7 @@ onMounted(async () => {
margin-top: 0;
}
:deep(.el-table--fit ){
height: 400px;
height: 600px;
}
.add-block {
//display: flex;

View File

@@ -272,7 +272,9 @@ onMounted(async () => {
:deep(.el-empty__description) {
margin-top: 0;
}
:deep(.el-table--fit ){
height: 600px;
}
.detail-block {
overflow: hidden;
padding-right: 10px;

View File

@@ -112,12 +112,9 @@ const tableConfig = reactive({
if (buttons.has("edit")) {
btn.push({label: '编辑', prem: ['mosr:requirement:resubmit'], func: () => handleEdit(row), type: 'primary'})
}
// if (buttons.has("delete")) {
// btn.push({label: '删除',prem: ['mosr:requirement:del'], func: () => handleDelete(row), type: 'primary'})
// }
// if (buttons.has("report")) {
if (buttons.has("report")) {
btn.push({label: '需求上报', prem: ['mosr:requirement:info'], func: () => handleReport(row), type: 'primary'})
// }
}
return (
<div style={{width: '100%'}}>
{

View File

@@ -1,9 +1,142 @@
<template>
<tag-and-file-upload />
<baseTitle title="标签名称"></baseTitle>
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">
<el-form-item label="标签名称" prop="tagName">
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/>
</el-form-item>
</el-form>
<baseTitle title="其他文件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先输入标签!':''"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
</fvTable>
</el-card>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button>
</div>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js'
import {uploadRequirementAttachment} from "@/api/project-demand";
const tagsViewStore = useTagsView()
const route = useRoute()
const router = useRouter()
const fileList = ref([])
const tagsOption = ref([])
const formData = ref({
tagName:''
})
const tableConfig = reactive({
columns: [
{
prop: 'index',
type: 'index',
label: '序号',
align: 'center',
width: '80',
},
{
prop: 'originalFileName',
label: '附件名称',
align: 'center',
},
{
prop: 'tag',
label: '标签',
align: 'center'
},
{
prop: 'tag',
label: '文件大小',
align: 'center'
},
{
prop: 'oper',
label: '操作',
align: 'center',
currentRender: ({row, index}) => {
return (
<div>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
</div>
)
}
}
]
})
const showTable = ref(true)
const tagForm = ref()
const name = ref(router.currentRoute.value.name)
const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
})
const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
tag: formData.value.tagName,
}
}
const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false
let fileObj = compositeParam(val)
fileList.value.push(fileObj)
nextTick(() => {
showTable.value = true
})
}
const getFileParam = (item) => {
return {
fileId: item.fileId
}
}
const handleSubmit = async (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = []
fileList.value.forEach(item => {
files.push(getFileParam(item))
})
let params = {
fileList: files,
projectId: route.query.id,
tag: formData.value.tagName
}
console.log('params', params)
let res = await uploadRequirementAttachment(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Filing/attachment',
query:{
id: route.query.id
}
})
}
})
}
</script>
<style scoped>

View File

@@ -46,3 +46,10 @@ export const getCollectAttachment = (params) => {
params:params
});
};
export const uploadCollectAttachment= (data) => {
return request({
url: '/workflow/mosr/requirement/collect/upload',
method: "post",
data: data
});
};

View File

@@ -1,9 +1,142 @@
<template>
<tag-and-file-upload />
<baseTitle title="标签名称"></baseTitle>
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">
<el-form-item label="标签名称" prop="tagName">
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/>
</el-form-item>
</el-form>
<baseTitle title="其他文件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先输入标签!':''"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
</fvTable>
</el-card>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button>
</div>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js'
import {uploadCollectAttachment} from "./api";
const tagsViewStore = useTagsView()
const route = useRoute()
const router = useRouter()
const fileList = ref([])
const tagsOption = ref([])
const formData = ref({
tagName:''
})
const tableConfig = reactive({
columns: [
{
prop: 'index',
type: 'index',
label: '序号',
align: 'center',
width: '80',
},
{
prop: 'originalFileName',
label: '附件名称',
align: 'center',
},
{
prop: 'tag',
label: '标签',
align: 'center'
},
{
prop: 'tag',
label: '文件大小',
align: 'center'
},
{
prop: 'oper',
label: '操作',
align: 'center',
currentRender: ({row, index}) => {
return (
<div>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
</div>
)
}
}
]
})
const showTable = ref(true)
const tagForm = ref()
const name = ref(router.currentRoute.value.name)
const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
})
const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
tag: formData.value.tagName,
}
}
const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false
let fileObj = compositeParam(val)
fileList.value.push(fileObj)
nextTick(() => {
showTable.value = true
})
}
const getFileParam = (item) => {
return {
fileId: item.fileId
}
}
const handleSubmit = async (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = []
fileList.value.forEach(item => {
files.push(getFileParam(item))
})
let params = {
fileList: files,
projectId: route.query.id,
tag: formData.value.tagName
}
console.log('params', params)
let res = await uploadCollectAttachment(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Filing/attachment',
query:{
id: route.query.id
}
})
}
})
}
</script>
<style scoped>

View File

@@ -32,7 +32,7 @@ import {getFilingAttachment, getInitiationAttachment} from "@/api/project-manage
const route = useRoute()
const router = useRouter()
const activeName = ref('3')
const activeName = ref('4')
const attachment = ref({})
const showTable = ref(true)
const implementation = ref()

View File

@@ -190,7 +190,7 @@ const tableConfig = reactive({
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.state !== null) {
return (<Tag dictType={'project_initiation'} value={row.state}/>)
return (<Tag dictType={'project_filing'} value={row.state}/>)
} else {
return '--'
}
@@ -207,9 +207,9 @@ const tableConfig = reactive({
if (buttons.has("details")) {
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'})
}
// if (buttons.has("attachments")) {
if (buttons.has("attachments")) {
btn.push({label: '附件', prem: ['mosr:requirement:resubmit'], func: () => handleAttachment(row), type: 'primary'})
// }
}
if (buttons.has("entry")) {
btn.push({label: '结项', prem: ['mosr:requirement:del'], func: () => handleConclusion(row), type: 'primary'})
}

View File

@@ -1,9 +1,142 @@
<template>
<tag-and-file-upload />
<baseTitle title="标签名称"></baseTitle>
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">
<el-form-item label="标签名称" prop="tagName">
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/>
</el-form-item>
</el-form>
<baseTitle title="其他文件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先输入标签!':''"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
</fvTable>
</el-card>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button>
</div>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js'
import {uploadFilingAttachment} from "@/api/project-manage";
const tagsViewStore = useTagsView()
const route = useRoute()
const router = useRouter()
const fileList = ref([])
const tagsOption = ref([])
const formData = ref({
tagName:''
})
const tableConfig = reactive({
columns: [
{
prop: 'index',
type: 'index',
label: '序号',
align: 'center',
width: '80',
},
{
prop: 'originalFileName',
label: '附件名称',
align: 'center',
},
{
prop: 'tag',
label: '标签',
align: 'center'
},
{
prop: 'tag',
label: '文件大小',
align: 'center'
},
{
prop: 'oper',
label: '操作',
align: 'center',
currentRender: ({row, index}) => {
return (
<div>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
</div>
)
}
}
]
})
const showTable = ref(true)
const tagForm = ref()
const name = ref(router.currentRoute.value.name)
const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
})
const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
tag: formData.value.tagName,
}
}
const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false
let fileObj = compositeParam(val)
fileList.value.push(fileObj)
nextTick(() => {
showTable.value = true
})
}
const getFileParam = (item) => {
return {
fileId: item.fileId
}
}
const handleSubmit = async (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = []
fileList.value.forEach(item => {
files.push(getFileParam(item))
})
let params = {
fileList: files,
projectId: route.query.id,
tag: formData.value.tagName
}
console.log('params', params)
let res = await uploadFilingAttachment(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Filing/attachment',
query:{
id: route.query.id
}
})
}
})
}
</script>
<style scoped>

View File

@@ -221,9 +221,9 @@ const tableConfig = reactive({
if (buttons.has("standing")) {
btn.push({label: '台账', prem: ['mosr:requirement:info'], func: () => handleStandingBook(row), type: 'primary'})
}
// if (buttons.has("attachments")) {
if (buttons.has("attachments")) {
btn.push({label: '附件', prem: ['mosr:requirement:info'], func: () => handleAttachment(row), type: 'primary'})
// }
}
if (buttons.has("viewAllocation")) {
btn.push({label: '查看分摊', prem: ['mosr:requirement:info'], func: () => handleShare(row), type: 'primary'})
}

View File

@@ -213,7 +213,7 @@ const tableConfig = reactive({
// btn.push({label: '删除',prem: ['mosr:requirement:del'], func: () => handleDelete(row), type: 'primary'})
// }
if (buttons.has("apply")) {
btn.push({label: '申请',prem: ['mosr:requirement:info'], func: () => handleApply(row), type: 'primary'})
btn.push({label: '立项',prem: ['mosr:requirement:info'], func: () => handleApply(row), type: 'primary'})
}
return (
<div style={{width: '100%'}}>

View File

@@ -1,9 +1,142 @@
<template>
<tag-and-file-upload />
<baseTitle title="标签名称"></baseTitle>
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">
<el-form-item label="标签名称" prop="tagName">
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px"/>
</el-form-item>
</el-form>
<baseTitle title="其他文件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先输入标签!':''"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
</fvTable>
</el-card>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(tagForm)">提交</el-button>
</div>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js'
import {uploadInitiationAttachment} from "@/api/project-manage";
const tagsViewStore = useTagsView()
const route = useRoute()
const router = useRouter()
const fileList = ref([])
const tagsOption = ref([])
const formData = ref({
tagName:''
})
const tableConfig = reactive({
columns: [
{
prop: 'index',
type: 'index',
label: '序号',
align: 'center',
width: '80',
},
{
prop: 'originalFileName',
label: '附件名称',
align: 'center',
},
{
prop: 'tag',
label: '标签',
align: 'center'
},
{
prop: 'tag',
label: '文件大小',
align: 'center'
},
{
prop: 'oper',
label: '操作',
align: 'center',
currentRender: ({row, index}) => {
return (
<div>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
</div>
)
}
}
]
})
const showTable = ref(true)
const tagForm = ref()
const name = ref(router.currentRoute.value.name)
const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
})
const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
tag: formData.value.tagName,
}
}
const getFile = (val) => {
console.log('上传文件', val)
showTable.value = false
let fileObj = compositeParam(val)
fileList.value.push(fileObj)
nextTick(() => {
showTable.value = true
})
}
const getFileParam = (item) => {
return {
fileId: item.fileId
}
}
const handleSubmit = async (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let files = []
fileList.value.forEach(item => {
files.push(getFileParam(item))
})
let params = {
fileList: files,
projectId: route.query.id,
tag: formData.value.tagName
}
console.log('params', params)
let res = await uploadInitiationAttachment(params)
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Filing/attachment',
query:{
id: route.query.id
}
})
}
})
}
</script>
<style scoped>

View File

@@ -15,8 +15,6 @@
<!-- <form-design ref="formDesign"/>-->
<!-- </div>-->
</div>
</div>
<el-dialog v-model="validVisible" title="设置项检查">
<el-steps align-center :active="validStep" finish-status="success">