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({
url: '/workflow/mosr/project/implementation/option',
method: "get",
params:{
projectId:projectId
}
params:params
});
};
//项目归档

View File

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

View File

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

View File

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