[update] 修改企标立项,增加专家至少选两人限制

This commit is contained in:
lideqin
2023-12-26 16:14:29 +08:00
parent c709cf57d1
commit 2e62839c72
3 changed files with 24 additions and 14 deletions
+3
View File
@@ -176,6 +176,9 @@ module.exports = {
attach: '附件',
checkedAll: '全选',
pleaseCompleteTableInfo: '请完善表格信息',
node: '节点',
atLeastSelect: '至少选择',
personnal: '人',
// 树右键
treeRight: {
addFolder: '新增文件夹',
+15 -8
View File
@@ -156,17 +156,24 @@ export default {
let personnelObj = {}
console.log(this.stepsData)
for (let i = 0; i < this.stepsData.length; i++) {
// 该属性还没有人就给他赋值
// 该属性还没有人就给他赋值,并且如果minLength有值的话,需要判断选的人数过了这个限制
if ((this.stepsData[i].canChoose || i === 0) && !personnelObj[this.stepsData[i].variableName]) {
personnelObj[this.stepsData[i].variableName] = this.stepsData[i].linkUserIds
if (this.stepsData[i].minLength) {
// 有设置至少选几人
if (this.stepsData[i].linkUserIds && this.stepsData[i].linkUserIds.split(',').length >= this.stepsData[i].minLength) {
// 说明人数通过了限制
personnelObj[this.stepsData[i].variableName] = this.stepsData[i].linkUserIds
} else {
// 提示XX节点至少选择XX人
this.$message.warning(this.stepsData[i].nodeName + this.$t('node') + this.$t('atLeastSelect') + this.stepsData[i].minLength + this.$t('personnal'))
personnelObj[this.stepsData[i].variableName] = ''
return
}
} else {
personnelObj[this.stepsData[i].variableName] = this.stepsData[i].linkUserIds
}
}
}
// for (const item of this.stepsData) {
// // 该属性还没有人就给他赋值
// if ((item.canChoose || item.sort === 1) && !personnelObj[item.variableName]) {
// personnelObj[item.variableName] = item.linkUserIds
// }
// }
console.log(personnelObj)
for (const item in personnelObj) {
if (!this.notPermissField.includes(item) && !personnelObj[item]) {
@@ -81,7 +81,7 @@
<div class="modal-content">
<a-table
:columns="columns"
rowKey="id"
rowKey="userId"
bordered
:scroll="{x: '100%', y: '280px'}"
:data-source="dataSource"
@@ -101,7 +101,7 @@
</div>
<p class="modal-content-title">{{ $t('userSelect.selectedPersonnel') }}</p>
<div v-if="dataSourceRight && dataSourceRight.length > 0" class="name-content">
<div v-for="(item, index) in dataSourceRight" :key="item.id" class="name-div">
<div v-for="(item, index) in dataSourceRight" :key="item.userId" class="name-div">
{{ item.realname + '(' + item.username + ')' }}
<a-icon type="close" @click="handleDelete(item, index)" />
</div>
@@ -295,7 +295,7 @@ export default {
if (selectedRowKeys.length > this.dataSourceRight.length) {
// 说明是增加了数据
for (const rowIndex in selectedRows) {
if (!this.dataSourceRight.find(item => item.id === selectedRows[rowIndex].id)) {
if (!this.dataSourceRight.find(item => item.userId === selectedRows[rowIndex].userId)) {
// 右侧不存在,追加到右侧表格
this.dataSourceRight.push(selectedRows[rowIndex])
}
@@ -305,7 +305,7 @@ export default {
if (selectedRowKeys && selectedRowKeys.length > 0) {
// 没有选中数据,说明这一页没有选中数据了
for (let i = 0; i < this.dataSourceRight.length; i++) {
if (!selectedRowKeys.find(item => item === this.dataSourceRight[i].id)) {
if (!selectedRowKeys.find(item => item === this.dataSourceRight[i].userId)) {
// 表格选中中没有找到这一条数据,说明已经被删了
this.dataSourceRight.splice(i, 1)
i--
@@ -332,7 +332,7 @@ export default {
this.loadingRight = true
getAction(this.url.userListByIds, params).then((res) => {
if (res.success) {
this.dataSourceRight = res.result || []
this.dataSourceRight = res.result.map(item => { return { ...item, userId: item.id } }) || []
} else {
this.$message.warn(res.message)
}
@@ -343,7 +343,7 @@ export default {
// 名字列表的删除
handleDelete (record, index) {
this.dataSourceRight.splice(index, 1)
this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== record.id)
this.selectedRowKeys = this.selectedRowKeys.filter(item => item !== record.userId)
},
handleOk () {
this.$emit('change', this.selectedRowKeys.join(','))