修改bug 56576 资料中心 新增 附件上传了 但是提示不能为空

56558 左侧树状图点击标准新闻,然后点击新增,输入信息以及上传附件信息,提交 程序异常
This commit is contained in:
hanshaozhuang
2022-07-15 13:54:38 +08:00
parent ffe0156cb2
commit 8a9d689e18
@@ -247,6 +247,25 @@
label-width="130px" label-width="130px"
v-if="showInfoModal" v-if="showInfoModal"
> >
<el-form-item label="所属目录" prop="treeId" class="add-form-item">
<el-select ref="treeSelect" class="tree-select" v-model="attributeEO.treeId" value-key="id" placeholder="请选择所属目录">
<el-option class="tree-select-option" :value="attributeEO.treeId" :label="attributeEO.treeName">
<el-tree
ref="tree"
node-key="id"
class="tree-line"
icon-class="icon-tree"
:indent="0"
:props="props"
:data="treeList"
:default-expanded-keys="['1']"
highlight-current
@node-click="selectTreeClick"
:filter-node-method="filterNode">
</el-tree>
</el-option>
</el-select>
</el-form-item>
<el-form-item <el-form-item
label="类型" label="类型"
prop="dataType" prop="dataType"
@@ -363,8 +382,13 @@ export default {
dataTitle: '', dataTitle: '',
dataExplain: '', dataExplain: '',
attachFileId: '', attachFileId: '',
treeId: '',
treeName: ''
}, },
attributeEOFormRules: { attributeEOFormRules: {
treeId: [
{required: true, message: '所属目录不能为空', trigger: 'change'},
],
dataType: [ dataType: [
{required: true, message: '类型不能为空', trigger: 'change'}, {required: true, message: '类型不能为空', trigger: 'change'},
], ],
@@ -462,8 +486,15 @@ export default {
treeClick(treeNode) { treeClick(treeNode) {
this.selectSarMenu = treeNode this.selectSarMenu = treeNode
this.dataCenterSearch.treeId = treeNode.id === '1' ? '' : treeNode.id this.dataCenterSearch.treeId = treeNode.id === '1' ? '' : treeNode.id
this.attributeEO.treeId = treeNode.id === '1' ? '' : treeNode.id
this.attributeEO.treeName = treeNode.name
this.searchInfo() this.searchInfo()
}, },
selectTreeClick(treeNode) {
this.dataCenterSearch.treeId = treeNode.id === '1' ? '' : treeNode.id
this.attributeEO.treeId = treeNode.id === '1' ? '' : treeNode.id
this.attributeEO.treeName = treeNode.name
},
// 树节点鼠标移入移出 // 树节点鼠标移入移出
mouseenter(data) { mouseenter(data) {
if (data.name !== '我的收藏') { if (data.name !== '我的收藏') {
@@ -706,7 +737,8 @@ export default {
dataType: '', dataType: '',
dataTitle: '', dataTitle: '',
attachFileId: '', attachFileId: '',
treeId: this.selectSarMenu.id treeId: this.selectSarMenu ? this.selectSarMenu.id : this.treeList[0].id,
treeName: this.selectSarMenu ? this.selectSarMenu.name : this.treeList[0].name
} }
this.fileList = [] this.fileList = []
}, },
@@ -743,7 +775,7 @@ export default {
saveInfo() { saveInfo() {
this.submitLoading = true this.submitLoading = true
this.$refs['attributeEO'].validate((valid) => { this.$refs['attributeEO'].validate((valid) => {
if (valid && this.attributeEO.attachFileId !== '') { if (valid) {
if (this.attributeTitle === '新增'){ if (this.attributeTitle === '新增'){
this.$http.postData( this.$http.postData(
'fileMaterialCenter/file-material', 'fileMaterialCenter/file-material',
@@ -777,9 +809,7 @@ export default {
} }
) )
} }
}else{
} else {
this.$message.error('附件不能为空')
this.submitLoading = false this.submitLoading = false
} }
}) })
@@ -792,6 +822,8 @@ export default {
dataType: '', dataType: '',
dataTitle: '', dataTitle: '',
attachFileId: '', attachFileId: '',
treeId: '',
treeName: ''
} }
}) })
this.showInfoModal = false this.showInfoModal = false
@@ -1013,4 +1045,14 @@ export default {
overflow-y: auto; overflow-y: auto;
} }
} }
.tree-select{
.el-select-dropdown__item{
height: auto;
line-height: normal;
}
}
.tree-select-option{
height: auto;
padding: 0;
}
</style> </style>