fix : 修复项目实施附件查询及上传功能

This commit is contained in:
2024-06-01 00:46:00 +08:00
parent f4ad871831
commit daf5ffe2c9
4 changed files with 68 additions and 40 deletions

View File

@@ -77,13 +77,11 @@ export const addLedger = (data) => {
}); });
}; };
export const getTags = (projectId) => { export const getTags = (params) => {
return request({ return request({
url: '/workflow/mosr/project/implementation/option', url: '/workflow/mosr/project/implementation/option',
method: "get", method: "get",
params:{ params:params
projectId:projectId
}
}); });
}; };
//项目归档 //项目归档

View File

@@ -1,23 +1,30 @@
<template> <template>
<el-form :model="attachment" inline class="query-form"> <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-form-item label="关键词" prop="tag"> <el-tab-pane label="需求征集" name="first">
<el-input v-model="attachment.tag" placeholder="请输入" clearable filterable style="width: 200px"/> <el-form :model="attachment" inline class="query-form">
</el-form-item> <el-form-item label="关键词" prop="tag">
<el-form-item> <el-input v-model="attachment.tag" placeholder="请输入" clearable filterable style="width: 200px"/>
<el-button @click="handleSearch" color="#DED0B2">搜索</el-button> </el-form-item>
<el-button color="#DED0B2" @click="handleUpload">上传附件</el-button> <el-form-item>
</el-form-item> <el-button @click="handleSearch" color="#DED0B2">搜索</el-button>
</el-form> <el-button color="#DED0B2" @click="handleUpload">上传附件</el-button>
<!-- <fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>--> </el-form-item>
<el-card style="width: 100%"> </el-form>
<file-upload @getFile="getOtherFile" :showFileList="true"/> <!-- <fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>-->
<fvTable style="width: 100%;max-height: 250px" v-if="showTable" :tableConfig="tableConfig" <el-card style="width: 100%">
:data="otherFileList" :isSettingCol="false" :pagination="false"> <file-upload @getFile="getOtherFile" :showFileList="true"/>
<template #empty> <fvTable style="width: 100%;max-height: 250px" v-if="showTable" :tableConfig="tableConfig"
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/> :data="otherFileList" :isSettingCol="false" :pagination="false">
</template> <template #empty>
</fvTable> <el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</el-card> </template>
</fvTable>
</el-card>
</el-tab-pane>
<el-tab-pane label="分摊汇总" name="second">
</el-tab-pane>
</el-tabs>
</template> </template>
<script setup lang="jsx"> <script setup lang="jsx">
@@ -25,6 +32,7 @@ import {downloadFile} from "@/api/project-demand";
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const activeName = ref('first')
const attachment = reactive({ const attachment = reactive({
tag: '' tag: ''
}) })
@@ -76,7 +84,7 @@ const tableConfig = reactive({
} }
] ]
}) })
const showTable=ref(true) const showTable = ref(true)
const otherFileList = ref([]) const otherFileList = ref([])
const handleUpload = () => { const handleUpload = () => {
router.push({ router.push({
@@ -91,7 +99,7 @@ const handleDownload = (row) => {
downloadFile(row.fileId).then(res => { downloadFile(row.fileId).then(res => {
const blob = new Blob([res]) const blob = new Blob([res])
let a = document.createElement('a') let a = document.createElement('a')
a.href=URL.createObjectURL(blob) a.href = URL.createObjectURL(blob)
a.download = row.originalFileName a.download = row.originalFileName
a.click() a.click()
}) })

View File

@@ -4,9 +4,9 @@
<el-select v-model="attachment.tag" placeholder="请选择标签" clearable filterable style="width: 200px"> <el-select v-model="attachment.tag" placeholder="请选择标签" clearable filterable style="width: 200px">
<el-option <el-option
v-for="item in tagsOption" v-for="item in tagsOption"
:key="item.label" :key="item.value"
:label="item.value" :label="item.label"
:value="item.label" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -27,7 +27,7 @@
<script setup lang="jsx"> <script setup lang="jsx">
import {downloadFile} from "@/api/project-demand"; import {downloadFile} from "@/api/project-demand";
import {getImplementationAttachment,getTags} from "@/api/project-manage"; import {getTags,getImplementationAttachment} from "@/api/project-manage";
import {ElNotification} from "element-plus"; import {ElNotification} from "element-plus";
const route = useRoute() const route = useRoute()
@@ -80,7 +80,10 @@ const showTable = ref(true)
const otherFileList = ref([]) const otherFileList = ref([])
const getTagsOption = () => { const getTagsOption = () => {
if (!route.query.id) return if (!route.query.id) return
getTags(route.query.id).then(res => { let params={
projectId: route.query.id
}
getTags(params).then(res => {
ElNotification({ ElNotification({
title: '提示', title: '提示',
message: res.msg, message: res.msg,
@@ -94,13 +97,18 @@ const getTagsOption = () => {
const handleSearch = () => { const handleSearch = () => {
let params let params
if (attachment.tag) { if (attachment.tag) {
tagsOption.value.forEach(item => {
if (item.value === attachment.tag) {
attachment.tag = item.label
}
})
params = { params = {
projectId: route.query.id, targetId: route.query.id,
tag: attachment.tag tag: attachment.tag
} }
} else { } else {
params = { params = {
projectId: route.query.id targetId: route.query.id
} }
} }
getImplementationAttachment(params).then(res => { getImplementationAttachment(params).then(res => {
@@ -111,6 +119,7 @@ const handleSearch = () => {
}) })
showTable.value = false showTable.value = false
if (res.code === 1000) { if (res.code === 1000) {
// tagsOption.value = res.data
otherFileList.value = res.data otherFileList.value = res.data
nextTick(() => { nextTick(() => {
showTable.value = true showTable.value = true
@@ -136,7 +145,7 @@ const handleDownload = (row) => {
}) })
} }
getTagsOption() getTagsOption()
handleSearch() // handleSearch()
</script> </script>
<style scoped> <style scoped>

View File

@@ -2,20 +2,21 @@
<baseTitle title="标签名称"></baseTitle> <baseTitle title="标签名称"></baseTitle>
<el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules"> <el-form :model="formData" ref="tagForm" label-width="auto" :rules="rules">
<el-form-item label="标签名称" prop="tagName"> <el-form-item label="标签名称" prop="tagName">
<el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 400px" v-if="showInput"/> <el-input v-model="formData.tagName" placeholder="请输入标签名称" style="width: 300px" v-if="showInput"/>
<el-select v-model="formData.tagName" placeholder="请选择标签" clearable filterable style="width: 200px" v-else> <el-select v-model="formData.tagName" placeholder="请选择标签名称" clearable filterable style="width: 300px" v-else>
<el-option <el-option
v-for="item in tagsOption" v-for="item in tagsOption"
:key="item.label" :key="item.value"
:label="item.value" :label="item.label"
:value="item.label" :value="item.value"
/> />
</el-select> </el-select>
<el-button type="primary" link @click="changeInput">{{showInput? '选择': '输入'}}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<baseTitle title="其他文件"></baseTitle> <baseTitle title="其他文件"></baseTitle>
<el-card style="width: 100%;margin: 15px 0"> <el-card style="width: 100%;margin: 15px 0">
<file-upload @getFile="getFile"/> <file-upload @getFile="getFile" :disabled="!formData.tagName" :title="!formData.tagName?'请先选择/输入标签!':''"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig" <fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="fileList" :isSettingCol="false" :pagination="false"> :data="fileList" :isSettingCol="false" :pagination="false">
<template #empty> <template #empty>
@@ -86,9 +87,16 @@ const name = ref(router.currentRoute.value.name)
const rules = reactive({ const rules = reactive({
tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}], tagName: [{required: true, message: '请输入标签名称', trigger: 'blur'}],
}) })
const changeInput=()=>{
showInput.value=!showInput.value;
formData.value.tagName='';
}
const getTagsOption = () => { const getTagsOption = () => {
if (!route.query.id) return if (!route.query.id) return
getTags(route.query.id).then(res => { let params={
projectId: route.query.id
}
getTags(params).then(res => {
ElNotification({ ElNotification({
title: '提示', title: '提示',
message: res.msg, message: res.msg,
@@ -102,6 +110,11 @@ const getTagsOption = () => {
} }
const compositeParam = (item) => { const compositeParam = (item) => {
tagsOption.value.forEach(item => {
if (item.value == formData.value.tagName) {
formData.value.tagName = item.label
}
})
return { return {
fileId: item.id, fileId: item.id,
size: item.size, size: item.size,