修复bug
This commit is contained in:
@@ -14,13 +14,15 @@
|
||||
<el-option label="系统通知" value="system" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划发送时间" prop="sendTime">
|
||||
<el-form-item label="计划发送时间" label-width="100px" prop="sendTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.sendTime"
|
||||
type="datetime"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择计划发送时间">
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@@ -306,7 +308,9 @@ export default {
|
||||
content: null,
|
||||
notificationType: null,
|
||||
creator: null,
|
||||
sendTime: null
|
||||
sendTime: null,
|
||||
findStart: null,
|
||||
findEnd: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@@ -334,7 +338,11 @@ export default {
|
||||
/** 查询【请填写功能名称】列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listNotifications(this.queryParams).then(response => {
|
||||
// 创建查询参数副本,排除sendTime参数
|
||||
const params = { ...this.queryParams }
|
||||
delete params.sendTime
|
||||
|
||||
listNotifications(params).then(response => {
|
||||
this.notificationsList = response.rows
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
@@ -359,6 +367,15 @@ export default {
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
// 处理时间段参数
|
||||
if (this.queryParams.sendTime && this.queryParams.sendTime.length === 2) {
|
||||
this.queryParams.findStart = this.queryParams.sendTime[0]
|
||||
this.queryParams.findEnd = this.queryParams.sendTime[1]
|
||||
} else {
|
||||
this.queryParams.findStart = null
|
||||
this.queryParams.findEnd = null
|
||||
}
|
||||
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
@@ -412,7 +429,23 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm('是否确认删除通知编号为"' + ids + '"的数据项?').then(function() {
|
||||
let confirmMessage = ''
|
||||
|
||||
if (row && row.title) {
|
||||
// 单个删除,显示通知标题
|
||||
confirmMessage = `是否确认删除通知"${row.title}"?`
|
||||
} else {
|
||||
// 批量删除,显示选中的通知标题
|
||||
const selectedNotifications = this.notificationsList.filter(item => this.ids.includes(item.id))
|
||||
if (selectedNotifications.length === 1) {
|
||||
confirmMessage = `是否确认删除通知"${selectedNotifications[0].title}"?`
|
||||
} else {
|
||||
const titles = selectedNotifications.map(item => item.title).join('、')
|
||||
confirmMessage = `是否确认删除以下通知:${titles}?`
|
||||
}
|
||||
}
|
||||
|
||||
this.$modal.confirm(confirmMessage).then(function() {
|
||||
return delNotifications(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
@@ -445,11 +478,11 @@ export default {
|
||||
getBindUsers(id).then(response => {
|
||||
if (response.data && response.data.length > 0) {
|
||||
console.log("已绑定用户列表:", response.data);
|
||||
|
||||
|
||||
// 将用户ID转换为字符串类型,确保类型一致
|
||||
const bindUserIds = response.data.map(user => String(user.userId));
|
||||
this.userIds = bindUserIds;
|
||||
|
||||
|
||||
console.log("转换后的用户ID列表:", bindUserIds);
|
||||
|
||||
// 延迟执行,确保表格已经完全渲染
|
||||
@@ -457,13 +490,13 @@ export default {
|
||||
// 先清除所有选中状态
|
||||
if (this.$refs.userTable) {
|
||||
this.$refs.userTable.clearSelection();
|
||||
|
||||
|
||||
// 为已绑定的用户设置选中状态
|
||||
this.userList.forEach(row => {
|
||||
// 确保类型一致,都转换为字符串进行比较
|
||||
const rowUserId = String(row.userId);
|
||||
console.log("比较用户ID:", rowUserId, "是否在列表中:", bindUserIds.includes(rowUserId));
|
||||
|
||||
|
||||
if (bindUserIds.includes(rowUserId)) {
|
||||
console.log("选中用户:", row);
|
||||
this.$refs.userTable.toggleRowSelection(row, true);
|
||||
|
||||
Reference in New Issue
Block a user