房间表
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/index.html
index d20bb51..95af389 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/index.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/sq/sqreservations/index.html
@@ -204,7 +204,12 @@
{
title: '参与人员', sort: false, width: 300, templet: function (d) {
if (!d.participants || d.participants.length === 0) {
- return '暂无参与人员
';
+ return '' +
+ '参与者' +
+ '(0人)' +
+ '添加参与者' +
+ '
' +
+ '暂无参与人员
';
}
var html = '';
@@ -239,17 +244,20 @@
html += '
';
}
- // 显示参与者
- if (participants.length > 0) {
- // 统计正常状态的参与者数量
- var normalParticipantsCount = participants.filter(function (it) {
- return it.status == 0;
- }).length;
+ // 显示参与者标签(无论是否有参与者都要显示)
+ // 统计正常状态的参与者数量
+ var normalParticipantsCount = participants.filter(function (it) {
+ return it.status == 0;
+ }).length;
- html += '';
- html += '参与者';
- html += '(' + normalParticipantsCount + '人)';
- html += '
';
+ html += '';
+ html += '参与者';
+ html += '(' + normalParticipantsCount + '人)';
+ html += '添加参与者';
+ html += '
';
+
+ // 显示参与者列表
+ if (participants.length > 0) {
participants.forEach(function (it, index) {
var statusText = '';
@@ -264,14 +272,15 @@
html += '';
html += '
';
- html += '' + (it.UserName || '用户' + it.user_id) + '';
+ html += '' + (it.userName || '用户' + it.user_id) + '';
html += '(ID: ' + it.user_id + ')';
if (statusText) {
html += '' + statusText + '';
}
- // 当用户状态为正常时,显示强制退出按钮
+ // 当用户状态为正常时,显示强制退出按钮和成为发起者按钮
if (it.status == 0) {
html += '强制退出';
+ html += '成为发起者';
}
html += '
';
@@ -326,6 +335,9 @@
html += '
';
});
+ } else {
+ // 如果没有参与者,显示提示信息
+ html += '暂无参与人员
';
}
html += '';
@@ -724,4 +736,131 @@
});
});
}
+
+ // 添加参与者函数
+ function addParticipant(reservationId) {
+ // 弹出添加参与者窗口
+ layer.open({
+ type: 1,
+ title: '添加参与者',
+ area: ['800px', '600px'],
+ content: `
+
+ `,
+ success: function(layero, index) {
+ // 初始化用户表格
+ layui.use(['table'], function() {
+ var table = layui.table;
+ table.render({
+ elem: '#userTable',
+ url: layui.setter.apiUrl + 'Api/SQReservations/SearchUsers',
+ method: 'POST',
+ page: true,
+ limit: 10,
+ limits: [10, 20, 50],
+ cols: [[
+ {type: 'radio', fixed: 'left'},
+ {field: 'id', title: '用户ID', width: 80},
+ {field: 'userName', title: '用户名', width: 150},
+ {field: 'nickName', title: '昵称', width: 150},
+ {field: 'mobile', title: '手机号', width: 120},
+ {field: 'email', title: '邮箱', width: 200}
+ ]],
+ done: function() {
+ // 监听行选择
+ table.on('radio(userTable)', function(obj) {
+ // 存储选中的用户
+ window.selectedUser = obj.data;
+ });
+ }
+ });
+ });
+ },
+ btn: ['确定', '取消'],
+ yes: function(index, layero) {
+ if (!window.selectedUser) {
+ layer.msg('请先选择一个用户', {icon: 2});
+ return;
+ }
+
+ // 确认添加参与者
+ layer.confirm('确定要添加用户 "' + window.selectedUser.userName + '" 为参与者吗?', {
+ icon: 3,
+ title: '确认添加'
+ }, function(confirmIndex) {
+ layer.close(confirmIndex);
+
+ // 调用API添加参与者
+ coreHelper.Post("Api/SQReservations/AddParticipant", {
+ reservationId: reservationId,
+ userId: window.selectedUser.id
+ }, function(e) {
+ if (e.code === 0) {
+ layer.msg('添加参与者成功', {icon: 1});
+ layer.close(index);
+ // 重新加载表格数据
+ layui.table.reloadData('LAY-app-SQReservations-tableBox');
+ } else {
+ layer.msg(e.msg || '添加失败', {icon: 2});
+ }
+ });
+ });
+ }
+ });
+ }
+
+ // 搜索用户函数
+ function searchUsers() {
+ var searchText = document.getElementById('searchUserInput').value.trim();
+ if (!searchText) {
+ layer.msg('请输入搜索内容', {icon: 2});
+ return;
+ }
+
+ // 重新加载用户表格
+ layui.table.reloadData('userTable', {
+ where: {
+ searchText: searchText
+ }
+ });
+ }
+
+ // 成为发起者函数
+ function becomeInitiator(participant, reservationId) {
+ layer.confirm('确定要将用户 "' + (participant.UserName || '用户' + participant.user_id) + '" 设置为发起者吗?', {
+ icon: 3,
+ title: '确认操作'
+ }, function(index) {
+ // 关闭确认框
+ layer.close(index);
+
+ // 调用API设置发起者
+ coreHelper.Post("Api/SQReservations/BecomeInitiator", {
+ reservationId: reservationId,
+ participantId: participant.id,
+ userId: participant.user_id
+ }, function(e) {
+ if (e.code === 0) {
+ layer.msg('设置发起者成功', {icon: 1});
+ // 重新加载表格数据
+ layui.table.reloadData('LAY-app-SQReservations-tableBox');
+ } else {
+ layer.msg(e.msg || '操作失败', {icon: 2});
+ }
+ });
+ });
+ }
\ No newline at end of file