[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
@@ -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(','))