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

@@ -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,