Commit 5f330e67 authored by jingnan's avatar jingnan 👀

履历本附件类型单一性校验

parent 6fc32c3b
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
:key="i.value" :key="i.value"
:label="i.label" :label="i.label"
:value="i.value" :value="i.value"
:disabled="disabledOptions.includes(i.value)"
/> />
</el-select> </el-select>
<span v-else>{{ scope.row.contentType }}</span> <span v-else>{{ scope.row.contentType }}</span>
...@@ -118,7 +119,8 @@ export default { ...@@ -118,7 +119,8 @@ export default {
}], }],
extension: [], extension: [],
options: [], options: [],
currentSelection: [] currentSelection: [],
disabledOptions: []
} }
}, },
computed: { computed: {
...@@ -144,6 +146,21 @@ export default { ...@@ -144,6 +146,21 @@ export default {
}) })
} }
} }
},
tableData: {
immediate: true,
deep: true,
handler(val) {
if (val) {
this.disabledOptions = val.map(item => {
if (item.id) {
return this.$utils.getParamsFromLists(this.options, 'label', item.contentType, 'value')
} else {
return item.contentType
}
})
}
}
} }
}, },
created() { created() {
...@@ -232,6 +249,11 @@ export default { ...@@ -232,6 +249,11 @@ export default {
submitUpload() { submitUpload() {
const flag = this.tableData.find(item => !item.fileName || !item.contentType) const flag = this.tableData.find(item => !item.fileName || !item.contentType)
if (flag) return this.$utils.showMessageWarning('请完成列表内数据的填写!') if (flag) return this.$utils.showMessageWarning('请完成列表内数据的填写!')
const contentTypeArr = this.tableData.map(r => r.contentType && this.$utils.getParamsFromLists(this.options, 'value', r.contentType, 'label'))
if (this.isRepeat(contentTypeArr)) {
this.$utils.showMessageError('附件类型不能重复!')
return
}
this.loading = true this.loading = true
const fileExtVOS = [] // 新增文件的名称和附件类型 const fileExtVOS = [] // 新增文件的名称和附件类型
const objFileLinkIds = [] // 已有的文件 const objFileLinkIds = [] // 已有的文件
...@@ -289,6 +311,14 @@ export default { ...@@ -289,6 +311,14 @@ export default {
handleClose() { handleClose() {
this.showBtns = false this.showBtns = false
this.getTableData() this.getTableData()
},
isRepeat(arr) {
const hash = {}
for (const i in arr) {
if (hash[arr[i]]) { return true }
hash[arr[i]] = true
}
return false
} }
} }
......
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