Commit b7f6794e authored by ztf's avatar ztf

自定义导入文件组件

parent a3531003
......@@ -56,24 +56,16 @@ export default {
toSubmit() {
const id = this.form.id
const status = this.form.state
// post(`/${this.subTypeName}/lifecycle/changeStatus?id=${id}&status=${status}&isValid=true`).then(res => {
// this.$emit('completeEven')
// })
if (this.subTypeName === 'ExtProgram') {
post(`/ExtProgram/lifecycle/changeStatus?id=${id}&status=${status}&isValid=true`).then(res => {
this.$emit('completeEven')
})
} else if (this.subTypeName === 'DxContext' || this.subTypeName === 'DxContextProject') {
post(`/DxContext/lifecycle/changeStatus?id=${id}&status=${status}&isValid=true`).then(res => {
// this.$utils.showMessageSuccess(`修改状态成功`)
this.$emit('completeEven')
})
}
const subTypeName = this.subTypeName === 'ExtProgram' ? 'ExtProgram' : 'DxContext'
post(`/${subTypeName}/lifecycle/changeStatus?id=${id}&status=${status}&isValid=true`).then(res => {
this.$emit('completeEven')
})
},
cancel() {
this.$emit('cancel')
}
}
}
</script>
......
<template>
<div class="importTemp-com">
<el-upload
ref="upload"
:show-file-list="false"
action="#"
accept=".xls,.xlsx,.XLS,.XLSX"
:http-request="(file) => {importFile(file)}"
>
<el-button class="border-none">选择文件:
<img
src="/icons/settledlcons/upLoad.png"
>
</el-button>
</el-upload>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
name: 'ImportFile',
componentName: '导入文件',
basicData: {
type: Object,
default: null
},
data() {
return {
action: '/ExtPuchasePlanAttribute/importPurchasePlan'
}
},
mounted() {
console.log('basicData', this.basicData)
},
methods: {
importFile(file) {
const formData = new FormData()
if (!file) return this.$utils.showMessageWarning('请选择文件')
if (file !== '') {
// const action = `${this.action}${this.basicData.id}&dxContextIdType=${this.basicData.subTypeName}`
formData.append('file', file.file)
formData.append('projectId', this.$route.query.id)
post(this.action, formData).then(res => {
this.$utils.showMessageSuccess('导入成功33')
this.$emit('completeEven')
})
}
}
}
}
</script>
<style lang="scss" scoped>
.importTemp-com{
.border-none{
border: none;
color: #2678cb;
img{
padding-left: 15px;
width: 18px;
height: 16px;
}
}
.info{
background: #eee;
padding: 10px 15px;
margin-bottom: 20px;
}
.flex-c{
display:flex;
justify-content: center;
}
}
</style>
......@@ -2,18 +2,13 @@
* @Author: zhangtianfeng 3232807530@qq.com
* @Date: 2024-09-02 09:44:58
* @LastEditors: zhangtianfeng 3232807530@qq.com
* @LastEditTime: 2024-09-13 09:30:45
* @LastEditTime: 2024-09-13 14:45:42
*/
export default {
props: {},
data() {
return {
projectMenus: [
// 这里还要监听是项目还是子项
// 项目全都展示
// 子项只有进度计划、采购计划,没有ICM接口计划 、IED计划
// 通过传进来的id进行判断这个项目的分类,进行判断,然后进行显示与隐藏
// 通过data.ifShow控制显隐
{
disabled: false,
name: '计划',
......@@ -21,44 +16,9 @@ export default {
icon: '/icons/dee-project/plan.png',
componentType: 'formConfig',
formConfigType: 'page',
ifShow: true,
pageKey: '22c90a9f-0907-49ea-8f8d-d5234e93e0e6',
children: [
{
name: '进度计划',
id: this.$route.query.id,
icon: '/icons/dee-project/baseline.png',
componentType: 'formConfig',
formConfigType: 'page',
pageKey: '22c90a9f-0907-49ea-8f8d-d5234e93e0e6',
ifShow: true
},
{
name: '采购计划',
id: this.$route.query.id,
icon: '/icons/dee-project/baseline.png',
componentType: 'formConfig',
formConfigType: 'page',
pageKey: 'a5728005-cd38-4568-bc63-8888fd7e5b5a',
ifShow: true
},
{
name: 'IED计划',
id: this.$route.query.id,
icon: '/icons/dee-project/baseline.png',
componentType: 'formConfig',
formConfigType: 'page',
pageKey: 'd4e791a9-57bf-477c-b760-53bdc351bc7f',
ifShow: true
},
{
name: '接口计划',
id: this.$route.query.id,
icon: '/icons/dee-project/baseline.png',
componentType: 'formConfig',
formConfigType: 'page',
pageKey: 'fe0b5925-0b7f-42bd-adbc-8ecb738013a0',
ifShow: true
}]
children: []
},
{
name: '团队',
......@@ -86,7 +46,6 @@ export default {
formConfigType: 'page',
pageKey: 'fe0b5925-0b7f-42bd-adbc-8ecb738013a0'
},
{
name: '文档',
id: this.$route.query.id,
......@@ -104,25 +63,63 @@ export default {
// pageKey: 'fe0b5925-0b7f-42bd-adbc-8ecb738013a0'
}
// {
// name: '子项',
// planId: this.$route.query.id,
// icon: '/icons/dee-project/baseline.png',
// componentType: 'formConfig',
// formConfigType: 'page',
// pageKey: 'fe0b5925-0b7f-42bd-adbc-8ecb738013a0'
// name: '子项',
// planId: this.$route.query.id,
// icon: '/icons/dee-project/baseline.png',
// componentType: 'formConfig',
// formConfigType: 'page',
// pageKey: 'fe0b5925-0b7f-42bd-adbc-8ecb738013a0'
// }
]
}
},
computed: {},
watch: {
},
created() {
mounted() {
this.updateMenus()
},
methods: {
// 判断是项目还是子项进行显示与隐藏
updateChildren(items) {
this.$set(this.projectMenus[0], 'children', items)
},
updateMenus() {
const baseItems = [
{
name: '进度计划',
id: this.$route.query.id,
icon: '/icons/dee-project/baseline.png',
componentType: 'formConfig',
formConfigType: 'page',
pageKey: '22c90a9f-0907-49ea-8f8d-d5234e93e0e6'
},
{
name: '采购计划',
id: this.$route.query.id,
icon: '/icons/dee-project/baseline.png',
componentType: 'formConfig',
formConfigType: 'page',
pageKey: 'a5728005-cd38-4568-bc63-8888fd7e5b5a'
}
]
const additionalItems = this.$route.query.type === 'DxContext' ? [
{
name: 'IED计划',
id: this.$route.query.id,
icon: '/icons/dee-project/baseline.png',
componentType: 'formConfig',
formConfigType: 'page',
pageKey: '26bda3a8-5273-4e77-a567-601ad2fa3b26'
},
{
name: '接口计划',
id: this.$route.query.id,
icon: '/icons/dee-project/baseline.png',
componentType: 'formConfig',
formConfigType: 'page',
pageKey: 'fe0b5925-0b7f-42bd-adbc-8ecb738013a0'
}
] : []
this.updateChildren([...baseItems, ...additionalItems])
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment