[update] 修改bug81779

This commit is contained in:
lideqin
2024-02-05 12:03:26 +08:00
parent 78ce51e9cb
commit 213828de68
5 changed files with 49 additions and 2 deletions
+1
View File
@@ -187,6 +187,7 @@ module.exports = {
pleaseSelectDate: '请选择日期', pleaseSelectDate: '请选择日期',
noFileAvailableForPreview: '暂无可预览的文件', noFileAvailableForPreview: '暂无可预览的文件',
enterpriseStandard: '企业标准', enterpriseStandard: '企业标准',
pleaseAtLeastSelectOneUser: '请至少选择一个用户',
// 树右键 // 树右键
treeRight: { treeRight: {
addFolder: '新增文件夹', addFolder: '新增文件夹',
@@ -73,6 +73,12 @@ export default {
default: () => { default: () => {
return '' return ''
} }
},
// 是否校验必选
checkRequired: {
type: Boolean,
required: false,
default: true
} }
}, },
watch: { watch: {
@@ -254,6 +260,14 @@ export default {
this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== record.contactId) this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== record.contactId)
}, },
handleOk () { handleOk () {
if (this.checkRequired && (!this.selectedRowKeys || this.selectedRowKeys.length === 0)) {
if (this.type === 'radio') {
this.$message.warning(this.$t('docTool.split.pleaseSelectUser'))
} else {
this.$message.warning(this.$t('pleaseAtLeastSelectOneUser'))
}
return
}
this.$emit('nameChange', this.dataSourceRight.map(item => item.contactId_dictText).join(',')) this.$emit('nameChange', this.dataSourceRight.map(item => item.contactId_dictText).join(','))
this.$emit('change', this.selectedRowKeys.join(',')) this.$emit('change', this.selectedRowKeys.join(','))
this.$emit('listChange', this.dataSourceRight) this.$emit('listChange', this.dataSourceRight)
@@ -80,6 +80,12 @@ export default {
default: () => { default: () => {
return [] return []
} }
},
// 是否校验必选
checkRequired: {
type: Boolean,
required: false,
default: true
} }
}, },
// computed: { // computed: {
@@ -278,6 +284,14 @@ export default {
this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== record.id) this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== record.id)
}, },
handleOk () { handleOk () {
if (this.checkRequired && (!this.selectedRowKeys || this.selectedRowKeys.length === 0)) {
if (this.type === 'radio') {
this.$message.warning(this.$t('docTool.split.pleaseSelectUser'))
} else {
this.$message.warning(this.$t('pleaseAtLeastSelectOneUser'))
}
return
}
this.$emit('nameChange', this.dataSourceRight.map(item => item.contactId_dictText).join(',')) this.$emit('nameChange', this.dataSourceRight.map(item => item.contactId_dictText).join(','))
this.$emit('change', this.selectedRowKeys.join(',')) this.$emit('change', this.selectedRowKeys.join(','))
this.$emit('listChange', this.dataSourceRight) this.$emit('listChange', this.dataSourceRight)
@@ -126,6 +126,12 @@ export default {
default: () => { default: () => {
return '' return ''
} }
},
// 是否校验必选
checkRequired: {
type: Boolean,
required: false,
default: true
} }
}, },
watch: { watch: {
@@ -346,6 +352,14 @@ export default {
this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== record.userId) this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== record.userId)
}, },
handleOk () { handleOk () {
if (this.checkRequired && (!this.selectedRowKeys || this.selectedRowKeys.length === 0)) {
if (this.type === 'radio') {
this.$message.warning(this.$t('docTool.split.pleaseSelectUser'))
} else {
this.$message.warning(this.$t('pleaseAtLeastSelectOneUser'))
}
return
}
this.$emit('change', this.selectedRowKeys.join(',')) this.$emit('change', this.selectedRowKeys.join(','))
this.$emit('nameChange', this.dataSourceRight.map(item => item.realname + '(' + item.username + ')').join(',')) this.$emit('nameChange', this.dataSourceRight.map(item => item.realname + '(' + item.username + ')').join(','))
this.close() this.close()
+6 -2
View File
@@ -106,7 +106,7 @@ export default {
checkRequired: { checkRequired: {
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: true
} }
}, },
watch: { watch: {
@@ -305,7 +305,11 @@ export default {
}, },
handleOk () { handleOk () {
if (this.checkRequired && (!this.selectedRowKeys || this.selectedRowKeys.length === 0)) { if (this.checkRequired && (!this.selectedRowKeys || this.selectedRowKeys.length === 0)) {
this.$message.warning(this.$t('docTool.split.pleaseSelectUser')) if (this.type === 'radio') {
this.$message.warning(this.$t('docTool.split.pleaseSelectUser'))
} else {
this.$message.warning(this.$t('pleaseAtLeastSelectOneUser'))
}
return return
} }
this.$emit('nameChange', this.dataSourceRight.map(item => item.realname + '(' + item.username + ')').join(',')) this.$emit('nameChange', this.dataSourceRight.map(item => item.realname + '(' + item.username + ')').join(','))