feat : 附件处理

This commit is contained in:
clay
2024-06-02 22:36:02 +08:00
parent fb64361c64
commit f6ada88026
5 changed files with 406 additions and 110 deletions

View File

@@ -0,0 +1,10 @@
import request from '@/utils/request.js'
export const searchFileList = (params) => {
return request({
url: `/workflow/mosr/attachment/list`,
method: "get",
params: params
});
};

View File

@@ -3,7 +3,7 @@
<el-form-item label="关键词" prop="name">
<el-input v-model="attachment.name" placeholder="请输入" clearable filterable style="width: 300px"/>
</el-form-item>
<el-form-item label="标签" prop="tag" v-if="type==='3'">
<el-form-item label="标签" prop="tag" v-if="type==='3'">
<el-select v-model="attachment.tag" placeholder="请选择标签" clearable filterable style="width: 300px">
<el-option
v-for="item in tagsOption"
@@ -15,7 +15,7 @@
</el-form-item>
<el-form-item>
<el-button @click="handleSearch" color="#DED0B2">搜索</el-button>
<el-button color="#DED0B2" @click="handleUpload">上传附件</el-button>
<el-button v-if="uploadState" color="#DED0B2" @click="handleUpload">上传附件</el-button>
</el-form-item>
</el-form>
<el-card style="width: 100%">
@@ -44,9 +44,14 @@ const props = defineProps({
otherFileList: {
type: Array,
default: []
}, type: {
},
type: {
type: String,
default: '0'
},
uploadState:{
type: Boolean,
default: true
}
})
const tagsOption = ref([])
@@ -122,7 +127,7 @@ const handleDownload = (row) => {
})
}
watch(() => props.type, (val) => {
console.log('va四川省l',val)
console.log('va四川省l', val)
props.type = val
if (val === '3') {
getTagsOption()

View File

@@ -1,34 +1,31 @@
<template>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="需求征集" name="0">
<search-files-by-tag @search="searchRequirement" @upload="upload"
:otherFileList="otherFileList"/>
<el-tab-pane label="需求征集" name="00">
<search-files-by-tag v-if="showTable" @search="searchRequirement" @upload="upload"
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
<el-tab-pane label="需求上报" name="1">
<search-files-by-tag @search="searchReport" @upload="upload"
:otherFileList="otherFileList"/>
<el-tab-pane label="需求上报" name="10">
<search-files-by-tag v-if="showTable" @search="searchReport" @upload="upload"
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
<el-tab-pane label="项目立项" name="2">
<el-tab-pane label="项目立项" name="20">
<search-files-by-tag @search="searchInitiation" @upload="upload"
:otherFileList="otherFileList"/>
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
<el-tab-pane label="项目实施" name="3">
<el-tab-pane label="项目实施" name="40">
<search-files-by-tag type="3" @search="searchImplementation" @upload="upload" ref="implementation"
:otherFileList="otherFileList"/>
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
<el-tab-pane label="项目归档" name="4">
<el-tab-pane label="项目归档" name="50">
<search-files-by-tag @search="searchFiling" @upload="upload"
:otherFileList="otherFileList"/>
:otherFileList="otherFileList" :uploadState="uploadState"/>
</el-tab-pane>
</el-tabs>
</template>
<script setup lang="jsx">
import {searchFileList} from "@/api/project-manage/attachment.js";
import {ElNotification} from "element-plus";
import {getImplementationAttachment} from "@/api/project-manage";
import {getRequirementAttachment} from "@/api/project-demand";
import {getCollectAttachment} from "@/views/project-demand/summary/api";
import {getFilingAttachment, getInitiationAttachment} from "@/api/project-manage";
const route = useRoute()
const router = useRouter()
@@ -36,85 +33,79 @@ const activeName = ref('4')
const attachment = ref({})
const showTable = ref(true)
const implementation = ref()
const uploadState = ref(true)
const otherFileList = ref([])
const projectId = ref(route.query.id)
const requirementId = ref(route.query.requirementId)
const handleClick = (tab) => {
let name = {}
switchSearch(name, tab.index)
switchSearch(name, tab.props.name)
}
const getParams = (param, type) => {
let targetId
let params
if (type === 1) {
targetId = route.query.requirementId
params = {
targetId: targetId,
...param
}
} else if (type === 2){
targetId = route.query.id
if(JSON.stringify(param) !== '{}'){
if (param.tag &&!param.name) {
implementation.value.tagsOption?.forEach(item => {
if (item.value === param.tag) {
param.tag = item.label
}
})
params = {
targetId: targetId,
tag:param.tag
}
}else if(!param.tag &&param.name){
params = {
targetId: targetId,
...param
}
} else if (!param.tag &&!param.name) {
params = {
targetId: targetId,
}
}
}else {
params = {
targetId: targetId
}
}
}else {
targetId = route.query.id
params = {
targetId: targetId,
...param
}
const switchSearch = (name, index) => {
switch (index) {
case '00':
searchRequirement({})
break
case '10':
searchReport({})
break
case '20':
searchInitiation({})
break
case '40':
searchImplementation({})
break
case '50':
searchFiling({})
break
}
return params;
}
const searchRequirement = async (param) => {
await search(param)
}
const search = async (param, type) => {
const res = await getRequirementAttachment(getParams(param, type))
changeFileList(res)
param.targetState = '00'
param.targetId = projectId.value
searchFileList(param).then(res => {
changeFileList(res)
})
}
const searchReport = async (param) => {
const res = await getCollectAttachment(getParams(param))
changeFileList(res)
param.targetState = '10'
param.targetId = projectId.value
searchFileList(param).then(res => {
changeFileList(res)
})
}
const searchInitiation = async (param) => {
const res = await getInitiationAttachment(getParams(param))
changeFileList(res)
param.targetState = '20'
param.targetId = projectId.value
searchFileList(param).then(res => {
changeFileList(res)
})
}
const searchImplementation = async (param) => {
const res = await getImplementationAttachment(getParams(param,2))
changeFileList(res)
param.targetState = '40'
param.targetId = projectId.value
searchFileList(param).then(res => {
changeFileList(res)
})
}
const searchFiling = async (param) => {
const res = await getFilingAttachment(getParams(param))
changeFileList(res)
param.targetState = '50'
param.targetId = projectId.value
searchFileList(param).then(res => {
changeFileList(res)
})
}
const changeFileList = (res) => {
showTable.value = false
if (res.code === 1000) {
otherFileList.value = res.data
otherFileList.value = res.data.fileList
uploadState.value = res.data.upload
nextTick(() => {
showTable.value = true
})
@@ -126,16 +117,25 @@ const changeFileList = (res) => {
})
}
}
onMounted(() => {
if (activeName.value === '4') {
searchFiling({})
}
})
const upload = () => {
if(activeName.value==='3'){
if (activeName.value === '3') {
router.push({
name: 'Implementation/upload',
query: {
id: route.query.id,
type:'3'
type: '3'
}
})
}else {
} else {
router.push({
name: switchUpload(activeName.value),
query: {
@@ -144,7 +144,7 @@ const upload = () => {
})
}
}
const switchUpload=(index)=>{
const switchUpload = (index) => {
switch (index) {
case '0':
return 'Requirement/upload';
@@ -158,33 +158,6 @@ const switchUpload=(index)=>{
return 'Filing/upload';
}
}
const switchSearch = (name, index) => {
switch (index) {
case '0':
search(name, 1)
break
case '1':
searchReport(name)
break
case '2':
searchInitiation(name)
break
case '3':
searchImplementation(name)
break
case '4':
searchFiling(name)
break
}
}
onMounted(() => {
if (activeName.value === '4') {
let name = {
name: ''
}
searchFiling(name)
}
})
</script>
<style scoped lang="scss">

View File

@@ -0,0 +1,214 @@
<template>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="需求征集" name="0">
<search-files-by-tag @search="searchRequirement" @upload="upload"
:otherFileList="otherFileList"/>
</el-tab-pane>
<el-tab-pane label="需求上报" name="1">
<search-files-by-tag @search="searchReport" @upload="upload"
:otherFileList="otherFileList"/>
</el-tab-pane>
<el-tab-pane label="项目立项" name="2">
<search-files-by-tag @search="searchInitiation" @upload="upload"
:otherFileList="otherFileList"/>
</el-tab-pane>
<el-tab-pane label="项目实施" name="3">
<search-files-by-tag type="3" @search="searchImplementation" @upload="upload" ref="implementation"
:otherFileList="otherFileList"/>
</el-tab-pane>
<el-tab-pane label="项目归档" name="4">
<search-files-by-tag @search="searchFiling" @upload="upload"
:otherFileList="otherFileList"/>
</el-tab-pane>
</el-tabs>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {getImplementationAttachment} from "@/api/project-manage";
import {getRequirementAttachment} from "@/api/project-demand";
import {getCollectAttachment} from "@/views/project-demand/summary/api";
import {getFilingAttachment, getInitiationAttachment} from "@/api/project-manage";
const route = useRoute()
const router = useRouter()
const activeName = ref('4')
const attachment = ref({})
const showTable = ref(true)
const implementation = ref()
const otherFileList = ref([])
const handleClick = (tab) => {
let name = {}
switchSearch(name, tab.index)
}
const getParams = (param, type) => {
let targetId
let params
if (type === 1) {
targetId = route.query.requirementId
params = {
targetId: targetId,
...param
}
} else if (type === 2){
targetId = route.query.id
if(JSON.stringify(param) !== '{}'){
if (param.tag &&!param.name) {
implementation.value.tagsOption?.forEach(item => {
if (item.value === param.tag) {
param.tag = item.label
}
})
params = {
targetId: targetId,
tag:param.tag
}
}else if(!param.tag &&param.name){
params = {
targetId: targetId,
...param
}
} else if (!param.tag &&!param.name) {
params = {
targetId: targetId,
}
}
}else {
params = {
targetId: targetId
}
}
}else {
targetId = route.query.id
params = {
targetId: targetId,
...param
}
}
return params;
}
const searchRequirement = async (param) => {
await search(param)
}
const search = async (param, type) => {
const res = await getRequirementAttachment(getParams(param, type))
changeFileList(res)
}
const searchReport = async (param) => {
const res = await getCollectAttachment(getParams(param))
changeFileList(res)
}
const searchInitiation = async (param) => {
const res = await getInitiationAttachment(getParams(param))
changeFileList(res)
}
const searchImplementation = async (param) => {
const res = await getImplementationAttachment(getParams(param,2))
changeFileList(res)
}
const searchFiling = async (param) => {
const res = await getFilingAttachment(getParams(param))
changeFileList(res)
}
const changeFileList = (res) => {
showTable.value = false
if (res.code === 1000) {
otherFileList.value = res.data
nextTick(() => {
showTable.value = true
})
} else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
}
const upload = () => {
if(activeName.value==='3'){
router.push({
name: 'Implementation/upload',
query: {
id: route.query.id,
type:'3'
}
})
}else {
router.push({
name: switchUpload(activeName.value),
query: {
id: route.query.id
}
})
}
}
const switchUpload=(index)=>{
switch (index) {
case '0':
return 'Requirement/upload';
case '1':
return 'Summary/upload';
case '2':
return 'Initiation/upload';
case '3':
return 'Implementation/upload';
case '4':
return 'Filing/upload';
}
}
const switchSearch = (name, index) => {
switch (index) {
case '0':
search(name, 1)
break
case '1':
searchReport(name)
break
case '2':
searchInitiation(name)
break
case '3':
searchImplementation(name)
break
case '4':
searchFiling(name)
break
}
}
onMounted(() => {
if (activeName.value === '4') {
let name = {
name: ''
}
searchFiling(name)
}
})
</script>
<style scoped lang="scss">
:deep(.el-tabs__header) {
margin: 15px 0 30px 0;
}
:deep(.el-tabs__nav-scroll) {
width: 100%;
display: flex;
.el-tabs__nav {
display: flex;
flex: 1;
.el-tabs__item {
flex: 1;
font-size: 16px;
}
.is-active {
color: black;
//background-color: #DED0B2;
}
}
}
</style>

View File

@@ -0,0 +1,94 @@
<template>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="需求征集" name="00">
<search-files-by-tag @search="searchRequirement" @upload="upload"
:otherFileList="otherFileList"/>
</el-tab-pane>
<el-tab-pane label="需求上报" name="10">
<search-files-by-tag @search="searchReport" @upload="upload"
:otherFileList="otherFileList"/>
</el-tab-pane>
<el-tab-pane label="项目立项" name="20">
<search-files-by-tag @search="searchInitiation" @upload="upload"
:otherFileList="otherFileList"/>
</el-tab-pane>
<el-tab-pane label="项目实施" name="40">
<search-files-by-tag type="3" @search="searchImplementation" @upload="upload" ref="implementation"
:otherFileList="otherFileList"/>
</el-tab-pane>
<el-tab-pane label="项目归档" name="50">
<search-files-by-tag @search="searchFiling" @upload="upload"
:otherFileList="otherFileList"/>
</el-tab-pane>
</el-tabs>
</template>
<script setup lang="jsx">
import {searchFileList} from "@/api/project-manage/attachment.js";
const route = useRoute()
const router = useRouter()
const activeName = ref('4')
const attachment = ref({})
const showTable = ref(true)
const implementation = ref()
const otherFileList = ref([])
const handleClick = (tab) => {
let name = {}
switchSearch(name, tab.index)
}
const switchSearch = (name, index) => {
switch (index) {
case '0':
search(name, 1)
break
case '1':
searchReport(name)
break
case '2':
searchInitiation(name)
break
case '3':
searchImplementation(name)
break
case '4':
searchFiling(name)
break
}
}
onMounted(() => {
if (activeName.value === '4') {
let name = {
name: ''
}
searchFiling(name)
}
})
</script>
<style scoped lang="scss">
:deep(.el-tabs__header) {
margin: 15px 0 30px 0;
}
:deep(.el-tabs__nav-scroll) {
width: 100%;
display: flex;
.el-tabs__nav {
display: flex;
flex: 1;
.el-tabs__item {
flex: 1;
font-size: 16px;
}
.is-active {
color: black;
//background-color: #DED0B2;
}
}
}
</style>