fix : 修复项目实施附件查询功能及上传附件页面初始
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
<script setup lang="jsx">
|
||||
import FileUpload from '@/components/FileUpload.vue'
|
||||
import {deleteFile, downloadFile} from "../api/project-demand";
|
||||
import {deleteFile, downloadFile} from "@/api/project-demand";
|
||||
import {ElMessage, ElMessageBox, ElNotification} from "element-plus";
|
||||
|
||||
const emit = defineEmits(["getAttachment", "getOtherFile"])
|
||||
|
||||
148
src/components/SearchFilesByTag.vue
Normal file
148
src/components/SearchFilesByTag.vue
Normal file
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<el-form :model="attachment" inline>
|
||||
<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-select v-model="attachment.tag" placeholder="请选择标签" clearable filterable style="width: 300px">
|
||||
<el-option
|
||||
v-for="item in tagsOption"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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>
|
||||
<el-card style="width: 100%">
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import {downloadFile} from "@/api/project-demand";
|
||||
import {ElNotification} from "element-plus";
|
||||
import {getTags} from "@/api/project-manage";
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const attachment = reactive({
|
||||
name: '',
|
||||
tag: ''
|
||||
})
|
||||
const emit = defineEmits(['search'])
|
||||
const props = defineProps({
|
||||
otherFileList: {
|
||||
type: Array,
|
||||
default: []
|
||||
}, type: {
|
||||
type: String,
|
||||
default: '0'
|
||||
}
|
||||
})
|
||||
const tagsOption = ref([])
|
||||
const tableConfig = reactive({
|
||||
columns: [
|
||||
{
|
||||
prop: 'originalFileName',
|
||||
label: '附件名称',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'tag',
|
||||
label: '自定义标签',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'processNodeTag',
|
||||
label: '内置标签',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'size',
|
||||
label: '上传时间',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'oper',
|
||||
label: '操作',
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
return (
|
||||
<div>
|
||||
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
const showTable = ref(true)
|
||||
const getTagsOption = () => {
|
||||
if (!route.query.id) return
|
||||
let params = {
|
||||
projectId: route.query.id
|
||||
}
|
||||
getTags(params).then(res => {
|
||||
|
||||
if (res.code === 1000) {
|
||||
tagsOption.value = res.data
|
||||
} else {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleSearch = () => {
|
||||
emit('search', attachment)
|
||||
}
|
||||
const handleUpload = () => {
|
||||
emit('upload')
|
||||
}
|
||||
const handleDownload = (row) => {
|
||||
downloadFile(row.fileId).then(res => {
|
||||
const blob = new Blob([res])
|
||||
let a = document.createElement('a')
|
||||
a.href = URL.createObjectURL(blob)
|
||||
a.download = row.originalFileName
|
||||
a.click()
|
||||
})
|
||||
}
|
||||
watch(() => props.type, (val) => {
|
||||
console.log('va四川省l',val)
|
||||
props.type = val
|
||||
if (val === '3') {
|
||||
getTagsOption()
|
||||
}
|
||||
})
|
||||
watch(() => props.otherFileList, (val) => {
|
||||
showTable.value = false
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
})
|
||||
props.otherFileList = val
|
||||
})
|
||||
if (props.type === '3') {
|
||||
getTagsOption()
|
||||
}
|
||||
defineExpose({
|
||||
tagsOption
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -2,8 +2,8 @@
|
||||
<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"
|
||||
@@ -38,7 +38,7 @@ const props = defineProps({
|
||||
default: []
|
||||
}, showInput: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: true
|
||||
},
|
||||
})
|
||||
const rules = reactive({
|
||||
|
||||
Reference in New Issue
Block a user