fix : 修复页面细节
This commit is contained in:
@@ -1,20 +1,11 @@
|
||||
<template>
|
||||
<el-form :model="attachment" inline class="query-form" ref="queryForm" rules="rules">
|
||||
<el-form :model="attachment" inline class="query-form">
|
||||
<el-form-item label="标签" prop="tag">
|
||||
<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"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input v-model="attachment.tag" placeholder="请输入标签" clearable style="width: 200px"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleSearch(queryForm)" color="#DED0B2">搜索</el-button>
|
||||
<el-button color="#DED0B2" :disabled="!attachment.tag" style="padding: 0" title="请先选择标签再上传附件!">
|
||||
<file-upload @getFile="getFile" :disabled="!attachment.tag"/>
|
||||
</el-button>
|
||||
<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%">
|
||||
@@ -29,7 +20,7 @@
|
||||
|
||||
<script setup lang="jsx">
|
||||
import {downloadFile} from "@/api/project-demand";
|
||||
import {getImplementationAttachment,searchFile} from "@/api/project-manage";
|
||||
import {getImplementationAttachment} from "@/api/project-manage";
|
||||
import {ElNotification} from "element-plus";
|
||||
|
||||
const route = useRoute()
|
||||
@@ -37,11 +28,6 @@ const router = useRouter()
|
||||
const attachment = reactive({
|
||||
tag: ''
|
||||
})
|
||||
const rules = reactive({
|
||||
tag: [{required: true, message: '请选择标签', trigger: 'blur'}]
|
||||
})
|
||||
const queryForm = ref()
|
||||
const tagsOption = ref([])
|
||||
const tableConfig = reactive({
|
||||
columns: [
|
||||
{
|
||||
@@ -71,6 +57,7 @@ const tableConfig = reactive({
|
||||
prop: 'oper',
|
||||
label: '操作',
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
return (
|
||||
<div>
|
||||
@@ -84,58 +71,39 @@ const tableConfig = reactive({
|
||||
const showTable = ref(true)
|
||||
const otherFileList = ref([])
|
||||
|
||||
const compositeParam = (item) => {
|
||||
return {
|
||||
fileId: item.id,
|
||||
size: item.size,
|
||||
originalFileName: item.originalFilename,
|
||||
fileType: item.fileType,
|
||||
url: item.url,
|
||||
tag: attachment.tag,
|
||||
const handleSearch = () => {
|
||||
let params
|
||||
if (attachment.tag) {
|
||||
params = {
|
||||
projectId: route.query.id,
|
||||
tag: attachment.tag
|
||||
}
|
||||
} else {
|
||||
params = {
|
||||
projectId: route.query.id
|
||||
}
|
||||
}
|
||||
}
|
||||
const getFile = (val) => {
|
||||
console.log('上传文件', val)
|
||||
showTable.value = false
|
||||
let fileObj = compositeParam(val)
|
||||
otherFileList.value.push(fileObj)
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
})
|
||||
}
|
||||
const getTagsOption = (id = route.query.id) => {
|
||||
if (!route.query.id) return
|
||||
getImplementationAttachment(id).then(res => {
|
||||
getImplementationAttachment(params).then(res => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
showTable.value = false
|
||||
if (res.code === 1000) {
|
||||
tagsOption.value = res.data
|
||||
otherFileList.value = res.data
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleSearch = (instance) => {
|
||||
if (!instance) return
|
||||
instance.validate(async (valid) => {
|
||||
if (!valid) return
|
||||
let tagName = ''
|
||||
tagsOption.value.forEach(item => {
|
||||
if (item.label === attachment.tag) {
|
||||
tagName = item.value
|
||||
}
|
||||
})
|
||||
searchFile(route.query.id, tagName).then(res => {
|
||||
showTable.value = false
|
||||
if (res.code === 1000) {
|
||||
otherFileList.value = res.data
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
})
|
||||
}
|
||||
})
|
||||
const handleUpload = () => {
|
||||
router.push({
|
||||
name: 'Implementation/upload',
|
||||
query: {
|
||||
id: route.query.id
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleDownload = (row) => {
|
||||
@@ -147,7 +115,7 @@ const handleDownload = (row) => {
|
||||
a.click()
|
||||
})
|
||||
}
|
||||
getTagsOption()
|
||||
handleSearch()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user