fix : 修复项目实施附件查询及上传功能、代码文件优化
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleSearch" color="#DED0B2">搜索</el-button>
|
||||
<el-button color="#DED0B2" @click="handleUpload">上传附件</el-button>
|
||||
<el-button v-if="uploadState" color="#DED0B2" @click="handleUpload">上传附件</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-card style="width: 100%">
|
||||
@@ -27,11 +27,13 @@
|
||||
|
||||
<script setup lang="jsx">
|
||||
import {downloadFile} from "@/api/project-demand";
|
||||
import {getTags,getImplementationAttachment} from "@/api/project-manage";
|
||||
import {searchFileList} from "@/api/project-manage/attachment.js";
|
||||
import {getTags} from "@/api/project-manage";
|
||||
import {ElNotification} from "element-plus";
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const uploadState = ref(true)
|
||||
const attachment = reactive({
|
||||
tag: ''
|
||||
})
|
||||
@@ -80,49 +82,45 @@ const showTable = ref(true)
|
||||
const otherFileList = ref([])
|
||||
const getTagsOption = () => {
|
||||
if (!route.query.id) return
|
||||
let params={
|
||||
projectId: route.query.id
|
||||
}
|
||||
getTags(params).then(res => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
getTags(route.query.id).then(res => {
|
||||
if (res.code === 1000) {
|
||||
tagsOption.value = res.data
|
||||
}else{
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleSearch = () => {
|
||||
let params
|
||||
let params = {
|
||||
targetId: route.query.id,
|
||||
targetState: "30"
|
||||
}
|
||||
if (attachment.tag) {
|
||||
tagsOption.value.forEach(item => {
|
||||
if (item.value === attachment.tag) {
|
||||
attachment.tag = item.label
|
||||
}
|
||||
})
|
||||
params = {
|
||||
targetId: route.query.id,
|
||||
tag: attachment.tag
|
||||
}
|
||||
} else {
|
||||
params = {
|
||||
targetId: route.query.id
|
||||
}
|
||||
params.tag = attachment.tag
|
||||
}
|
||||
getImplementationAttachment(params).then(res => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
searchFileList(params).then(res => {
|
||||
showTable.value = false
|
||||
if (res.code === 1000) {
|
||||
otherFileList.value = res.data
|
||||
otherFileList.value = res.data.fileList
|
||||
uploadState.value = res.data.upload
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
})
|
||||
}else{
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -143,8 +141,9 @@ const handleDownload = (row) => {
|
||||
a.click()
|
||||
})
|
||||
}
|
||||
getTagsOption()
|
||||
|
||||
handleSearch()
|
||||
getTagsOption()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button type="primary" link @click="changeInput">{{showInput? '选择': '输入'}}</el-button>
|
||||
<el-button type="primary" link @click="changeInput">{{ showInput ? '选择' : '输入' }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<baseTitle title="其他文件"></baseTitle>
|
||||
@@ -30,9 +30,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import {uploadAttachment,getTags} from "@/api/project-manage";
|
||||
import {getTags} from "@/api/project-manage";
|
||||
import {ElNotification} from "element-plus";
|
||||
import {useTagsView} from '@/stores/tagsview.js'
|
||||
import {uploadFileList} from "@/api/project-manage/attachment";
|
||||
|
||||
const tagsViewStore = useTagsView()
|
||||
const route = useRoute()
|
||||
@@ -41,7 +42,7 @@ const fileList = ref([])
|
||||
const showInput = ref(false)
|
||||
const tagsOption = ref([])
|
||||
const formData = ref({
|
||||
tagName:''
|
||||
tagName: ''
|
||||
})
|
||||
const tableConfig = reactive({
|
||||
columns: [
|
||||
@@ -87,16 +88,13 @@ const name = ref(router.currentRoute.value.name)
|
||||
const rules = reactive({
|
||||
tagName: [{required: true, message: '请输入标签名称', trigger: ['blur', 'change']}],
|
||||
})
|
||||
const changeInput=()=>{
|
||||
showInput.value=!showInput.value;
|
||||
formData.value.tagName='';
|
||||
const changeInput = () => {
|
||||
showInput.value = !showInput.value;
|
||||
formData.value.tagName = '';
|
||||
}
|
||||
const getTagsOption = () => {
|
||||
if (!route.query.id) return
|
||||
let params={
|
||||
projectId: route.query.id
|
||||
}
|
||||
getTags(params).then(res => {
|
||||
getTags(route.query.id).then(res => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
@@ -134,26 +132,17 @@ const getFile = (val) => {
|
||||
showTable.value = true
|
||||
})
|
||||
}
|
||||
const getFileParam = (item) => {
|
||||
return {
|
||||
fileId: item.fileId
|
||||
}
|
||||
}
|
||||
const handleSubmit = async (instance) => {
|
||||
if (!instance) return
|
||||
instance.validate(async (valid) => {
|
||||
if (!valid) return
|
||||
let files = []
|
||||
fileList.value.forEach(item => {
|
||||
files.push(getFileParam(item))
|
||||
})
|
||||
let params = {
|
||||
fileList: files,
|
||||
fileList: fileList.value,
|
||||
projectId: route.query.id,
|
||||
tag: formData.value.tagName
|
||||
tag: formData.value.tagName,
|
||||
targetState: "30"
|
||||
}
|
||||
console.log('params', params)
|
||||
let res = await uploadAttachment(params)
|
||||
let res = await uploadFileList(params)
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
@@ -161,17 +150,17 @@ const handleSubmit = async (instance) => {
|
||||
})
|
||||
if (res.code === 1000) {
|
||||
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
|
||||
if(route.query.type==='40'){
|
||||
if (route.query.type === '40') {
|
||||
await router.push({
|
||||
name: 'Filing/attachment',
|
||||
query:{
|
||||
query: {
|
||||
id: route.query.id
|
||||
}
|
||||
})
|
||||
}else {
|
||||
} else {
|
||||
await router.push({
|
||||
name: 'Implementation/attachment',
|
||||
query:{
|
||||
query: {
|
||||
id: route.query.id
|
||||
}
|
||||
})
|
||||
@@ -183,7 +172,7 @@ getTagsOption()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
:deep(.el-table--fit ){
|
||||
height: 300px!important;
|
||||
:deep(.el-table--fit ) {
|
||||
height: 300px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user