Merge branch 'master' into difyPlugin
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -203,3 +203,4 @@ cython_debug/
|
|||||||
THAI-Platform/*
|
THAI-Platform/*
|
||||||
urbanLifelineWeb/packages/wechat_demo/*
|
urbanLifelineWeb/packages/wechat_demo/*
|
||||||
urbanLifelineWeb/packages/workcase_wechat/unpackage/*
|
urbanLifelineWeb/packages/workcase_wechat/unpackage/*
|
||||||
|
docs/AI训练资料
|
||||||
17
difyPlugin/.vscode/launch.json
vendored
Normal file
17
difyPlugin/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "DifyPlugin: FastAPI",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "run.py",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"python": "F:\\Environment\\conda\\envs\\difyPlugin\\python.exe",
|
||||||
|
"env": {
|
||||||
|
"PYTHONPATH": "${workspaceFolder}/difyPlugin"
|
||||||
|
},
|
||||||
|
"jinja": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
0
difyPlugin/.vscode/settings.json
vendored
Normal file
0
difyPlugin/.vscode/settings.json
vendored
Normal file
@@ -38,6 +38,7 @@ CREATE TABLE workcase.tb_chat_room(
|
|||||||
guest_name VARCHAR(100) NOT NULL, -- 来客姓名
|
guest_name VARCHAR(100) NOT NULL, -- 来客姓名
|
||||||
ai_session_id VARCHAR(50) DEFAULT NULL, -- AI对话会话ID(从ai.tb_chat同步)
|
ai_session_id VARCHAR(50) DEFAULT NULL, -- AI对话会话ID(从ai.tb_chat同步)
|
||||||
message_count INTEGER NOT NULL DEFAULT 0, -- 消息总数
|
message_count INTEGER NOT NULL DEFAULT 0, -- 消息总数
|
||||||
|
device_code VARCHAR(50) NOT NULL, -- 设备代码
|
||||||
last_message_time TIMESTAMPTZ DEFAULT NULL, -- 最后消息时间
|
last_message_time TIMESTAMPTZ DEFAULT NULL, -- 最后消息时间
|
||||||
last_message TEXT DEFAULT NULL, -- 最后一条消息内容(用于列表展示)
|
last_message TEXT DEFAULT NULL, -- 最后一条消息内容(用于列表展示)
|
||||||
comment_level INTEGER DEFAULT 0, -- 服务评分(1-5)
|
comment_level INTEGER DEFAULT 0, -- 服务评分(1-5)
|
||||||
|
|||||||
14
urbanLifelineServ/.vscode/launch.json
vendored
14
urbanLifelineServ/.vscode/launch.json
vendored
@@ -1,20 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
|
||||||
"type": "java",
|
|
||||||
"name": "URLQRCodeParseTest",
|
|
||||||
"request": "launch",
|
|
||||||
"mainClass": "org.xyzh.workcase.test.URLQRCodeParseTest",
|
|
||||||
"projectName": "workcase"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "java",
|
|
||||||
"name": "QRCodeTest",
|
|
||||||
"request": "launch",
|
|
||||||
"mainClass": "org.xyzh.workcase.test.QRCodeTest",
|
|
||||||
"projectName": "workcase"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "java",
|
"type": "java",
|
||||||
"name": "AesEncryptUtil",
|
"name": "AesEncryptUtil",
|
||||||
|
|||||||
@@ -284,9 +284,8 @@ public class DifyApiClient {
|
|||||||
dataMap.put("process_rule", defaultProcessRule);
|
dataMap.put("process_rule", defaultProcessRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认设置文档形式和语言
|
// 只保留官方支持的参数
|
||||||
dataMap.put("doc_form", "text_model");
|
// doc_form 和 doc_language 不是请求参数,移除
|
||||||
dataMap.put("doc_language", "Chinese");
|
|
||||||
|
|
||||||
String dataJson = JSON.toJSONString(dataMap);
|
String dataJson = JSON.toJSONString(dataMap);
|
||||||
logger.info("上传文档到知识库: datasetId={}, file={}, data={}", datasetId, originalFilename, dataJson);
|
logger.info("上传文档到知识库: datasetId={}, file={}, data={}", datasetId, originalFilename, dataJson);
|
||||||
|
|||||||
@@ -235,10 +235,10 @@ public class KnowledgeController {
|
|||||||
* @since 2025-12-18
|
* @since 2025-12-18
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasAuthority('ai:knowledge:file:delete')")
|
@PreAuthorize("hasAuthority('ai:knowledge:file:delete')")
|
||||||
@DeleteMapping("/file/{fileId}")
|
@DeleteMapping("/file/{fileRootId}")
|
||||||
public ResultDomain<Boolean> deleteFile(@PathVariable("fileId") @NotBlank String fileId) {
|
public ResultDomain<Boolean> deleteFile(@PathVariable("fileRootId") @NotBlank String fileRootId) {
|
||||||
logger.info("删除知识库文件: fileId={}", fileId);
|
logger.info("删除知识库文件: fileId={}", fileRootId);
|
||||||
return knowledgeService.deleteKnowledgeFileById(fileId);
|
return knowledgeService.deleteKnowledgeFileById(fileRootId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public interface TbKnowledgeMapper {
|
|||||||
*/
|
*/
|
||||||
int deleteKnowledge(TbKnowledge knowledge);
|
int deleteKnowledge(TbKnowledge knowledge);
|
||||||
|
|
||||||
|
int updateKnowledgeFileCount(@Param("knowledgeId") String knowledgeId, @Param("num") Integer num);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询知识库
|
* 根据ID查询知识库
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ public class AgentChatServiceImpl implements AgentChatService {
|
|||||||
sessionData.put("apiKey", agent.getApiKey());
|
sessionData.put("apiKey", agent.getApiKey());
|
||||||
sessionData.put("outer", agent.getIsOuter());
|
sessionData.put("outer", agent.getIsOuter());
|
||||||
sessionData.put("service", prepareData.getService());
|
sessionData.put("service", prepareData.getService());
|
||||||
|
sessionData.put("isGuest", "guest".equals(loginDomain.getUser().getStatus()));
|
||||||
|
|
||||||
String cacheKey = CHAT_SESSION_PREFIX + sessionId;
|
String cacheKey = CHAT_SESSION_PREFIX + sessionId;
|
||||||
redisService.set(cacheKey, sessionData, SESSION_TTL, TimeUnit.SECONDS);
|
redisService.set(cacheKey, sessionData, SESSION_TTL, TimeUnit.SECONDS);
|
||||||
@@ -335,6 +336,7 @@ public class AgentChatServiceImpl implements AgentChatService {
|
|||||||
String apiKey = (String) sessionData.get("apiKey");
|
String apiKey = (String) sessionData.get("apiKey");
|
||||||
String service = (String) sessionData.get("service");
|
String service = (String) sessionData.get("service");
|
||||||
Boolean outer = (Boolean) sessionData.get("outer");
|
Boolean outer = (Boolean) sessionData.get("outer");
|
||||||
|
Boolean isGuest = (Boolean) sessionData.get("isGuest");
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<DifyFileInfo> filesData = (List<DifyFileInfo>) sessionData.get("filesData");
|
List<DifyFileInfo> filesData = (List<DifyFileInfo>) sessionData.get("filesData");
|
||||||
@@ -375,7 +377,7 @@ public class AgentChatServiceImpl implements AgentChatService {
|
|||||||
if(outer && NonUtils.isNotEmpty(service)){
|
if(outer && NonUtils.isNotEmpty(service)){
|
||||||
TbKnowledge filter = new TbKnowledge();
|
TbKnowledge filter = new TbKnowledge();
|
||||||
filter.setService(service);
|
filter.setService(service);
|
||||||
filter.setCategory("external");
|
filter.setCategory(isGuest?"external":"internal");
|
||||||
ResultDomain<TbKnowledge> knowledgeRD = knowledgeService.listKnowledges(filter);
|
ResultDomain<TbKnowledge> knowledgeRD = knowledgeService.listKnowledges(filter);
|
||||||
List<String> datasets = new ArrayList<>();
|
List<String> datasets = new ArrayList<>();
|
||||||
if(knowledgeRD.getSuccess()){
|
if(knowledgeRD.getSuccess()){
|
||||||
|
|||||||
@@ -533,6 +533,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|||||||
knowledgeFile.setDifyFileId(difyFileId);
|
knowledgeFile.setDifyFileId(difyFileId);
|
||||||
knowledgeFile.setVersion(1);
|
knowledgeFile.setVersion(1);
|
||||||
|
|
||||||
|
knowledgeMapper.updateKnowledgeFileCount(knowledgeId, 1);
|
||||||
int rows = knowledgeFileMapper.insertKnowledgeFile(knowledgeFile);
|
int rows = knowledgeFileMapper.insertKnowledgeFile(knowledgeFile);
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
logger.info("保存知识库文件记录成功: knowledgeId={}, fileId={}, difyFileId={}", knowledgeId, fileId, difyFileId);
|
logger.info("保存知识库文件记录成功: knowledgeId={}, fileId={}, difyFileId={}", knowledgeId, fileId, difyFileId);
|
||||||
@@ -722,10 +723,13 @@ public class KnowledgeServiceImpl implements KnowledgeService {
|
|||||||
if (!difyDocIds.isEmpty()) {
|
if (!difyDocIds.isEmpty()) {
|
||||||
aiFileUploadService.batchDeleteFilesFromDify(knowledge.getDifyDatasetId(), difyDocIds);
|
aiFileUploadService.batchDeleteFilesFromDify(knowledge.getDifyDatasetId(), difyDocIds);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
return ResultDomain.failure("知识库未关联Dify");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 软删除本地记录和minio文件
|
// 3. 软删除本地记录和minio文件
|
||||||
int rows = knowledgeFileMapper.deleteFilesByRootId(fileRootId);
|
int rows = knowledgeFileMapper.deleteFilesByRootId(fileRootId);
|
||||||
|
knowledgeMapper.updateKnowledgeFileCount(knowledge.getKnowledgeId(), -1);
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
logger.info("删除知识库文件成功: fileRootId={}", fileRootId);
|
logger.info("删除知识库文件成功: fileRootId={}", fileRootId);
|
||||||
for (TbKnowledgeFile file : versions) {
|
for (TbKnowledgeFile file : versions) {
|
||||||
|
|||||||
@@ -29,7 +29,12 @@ security:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: ai-service
|
name: ai-service
|
||||||
|
# 文件上传配置
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
enabled: true
|
||||||
|
max-file-size: 500MB
|
||||||
|
max-request-size: 500MB
|
||||||
# ================== Spring Cloud Nacos ==================
|
# ================== Spring Cloud Nacos ==================
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
@@ -72,6 +77,7 @@ dubbo:
|
|||||||
name: urban-lifeline-agent
|
name: urban-lifeline-agent
|
||||||
qos-enable: false
|
qos-enable: false
|
||||||
protocol:
|
protocol:
|
||||||
|
payload: 110100480
|
||||||
name: dubbo
|
name: dubbo
|
||||||
port: -1
|
port: -1
|
||||||
registry:
|
registry:
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ dubbo:
|
|||||||
name: urban-lifeline-agent
|
name: urban-lifeline-agent
|
||||||
qos-enable: false
|
qos-enable: false
|
||||||
protocol:
|
protocol:
|
||||||
|
payload: 110100480
|
||||||
name: dubbo
|
name: dubbo
|
||||||
port: -1
|
port: -1
|
||||||
registry:
|
registry:
|
||||||
|
|||||||
@@ -112,6 +112,12 @@
|
|||||||
WHERE knowledge_id = #{knowledgeId} AND deleted = false
|
WHERE knowledge_id = #{knowledgeId} AND deleted = false
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateKnowledgeFileCount">
|
||||||
|
UPDATE ai.tb_knowledge
|
||||||
|
SET document_count = document_count + #{num}
|
||||||
|
WHERE knowledge_id = #{knowledgeId} AND deleted = false
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="selectKnowledgeById" resultMap="BaseResultMap">
|
<select id="selectKnowledgeById" resultMap="BaseResultMap">
|
||||||
SELECT <include refid="Base_Column_List"/>
|
SELECT <include refid="Base_Column_List"/>
|
||||||
FROM ai.tb_knowledge
|
FROM ai.tb_knowledge
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ public class TbChatRoomDTO extends BaseDTO {
|
|||||||
@Schema(description = "服务评分(1-5星)")
|
@Schema(description = "服务评分(1-5星)")
|
||||||
private Integer commentLevel;
|
private Integer commentLevel;
|
||||||
|
|
||||||
|
@Schema(description = "设备代码")
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
@Schema(description = "关闭人")
|
@Schema(description = "关闭人")
|
||||||
private String closedBy;
|
private String closedBy;
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ public class ChatRoomVO extends BaseVO {
|
|||||||
@Schema(description = "服务评分(1-5星)")
|
@Schema(description = "服务评分(1-5星)")
|
||||||
private Integer commentLevel;
|
private Integer commentLevel;
|
||||||
|
|
||||||
|
@Schema(description = "设备代码")
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
@Schema(description = "关闭人")
|
@Schema(description = "关闭人")
|
||||||
private String closedBy;
|
private String closedBy;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ security:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: file-service
|
name: file-service
|
||||||
|
|
||||||
# ================== Spring Cloud Nacos ==================
|
# ================== Spring Cloud Nacos ==================
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
@@ -57,8 +56,8 @@ spring:
|
|||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
enabled: true
|
enabled: true
|
||||||
max-file-size: 100MB
|
max-file-size: 500MB
|
||||||
max-request-size: 100MB
|
max-request-size: 500MB
|
||||||
|
|
||||||
# ================== SpringDoc ==================
|
# ================== SpringDoc ==================
|
||||||
springdoc:
|
springdoc:
|
||||||
@@ -79,6 +78,7 @@ dubbo:
|
|||||||
name: urban-lifeline-file
|
name: urban-lifeline-file
|
||||||
qos-enable: false
|
qos-enable: false
|
||||||
protocol:
|
protocol:
|
||||||
|
payload: 110100480
|
||||||
name: dubbo
|
name: dubbo
|
||||||
port: -1
|
port: -1
|
||||||
registry:
|
registry:
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
@Validated
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/workcase/chat")
|
@RequestMapping("/workcase/chat")
|
||||||
public class WorkcaseChatContorller {
|
public class WorkcaseChatController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WorkcaseChatService workcaseChatService;
|
private WorkcaseChatService workcaseChatService;
|
||||||
@@ -78,7 +78,8 @@ public class WorkcaseChatContorller {
|
|||||||
@PostMapping("/room")
|
@PostMapping("/room")
|
||||||
public ResultDomain<TbChatRoomDTO> createChatRoom(@RequestBody TbChatRoomDTO chatRoom) {
|
public ResultDomain<TbChatRoomDTO> createChatRoom(@RequestBody TbChatRoomDTO chatRoom) {
|
||||||
ValidationResult vr = ValidationUtils.validate(chatRoom, Arrays.asList(
|
ValidationResult vr = ValidationUtils.validate(chatRoom, Arrays.asList(
|
||||||
ValidationUtils.requiredString("guestId", "来客ID")
|
ValidationUtils.requiredString("guestId", "来客ID"),
|
||||||
|
ValidationUtils.requiredString("deviceCode", "设备代码")
|
||||||
));
|
));
|
||||||
if (!vr.isValid()) {
|
if (!vr.isValid()) {
|
||||||
return ResultDomain.failure(vr.getAllErrors());
|
return ResultDomain.failure(vr.getAllErrors());
|
||||||
@@ -67,6 +67,21 @@ public class ChatMessageListener implements MessageListener {
|
|||||||
// 转发到聊天室列表订阅者,前端刷新列表状态
|
// 转发到聊天室列表订阅者,前端刷新列表状态
|
||||||
messagingTemplate.convertAndSend("/topic/chat/list-update", chatMessage);
|
messagingTemplate.convertAndSend("/topic/chat/list-update", chatMessage);
|
||||||
logger.debug("列表更新已转发到STOMP: /topic/chat/list-update");
|
logger.debug("列表更新已转发到STOMP: /topic/chat/list-update");
|
||||||
|
|
||||||
|
// 同时转发到对应聊天室频道,确保聊天窗口也能收到消息
|
||||||
|
String roomId = chatMessage.getRoomId();
|
||||||
|
if (roomId != null && !roomId.isEmpty()) {
|
||||||
|
// 查询完整的VO数据
|
||||||
|
ChatRoomMessageVO messageVO = chatMessageMapper.selectChatMessageVOById(chatMessage.getMessageId());
|
||||||
|
if (messageVO != null) {
|
||||||
|
messagingTemplate.convertAndSend("/topic/chat/" + roomId, messageVO);
|
||||||
|
logger.debug("列表更新消息同时转发到聊天室: /topic/chat/{}", roomId);
|
||||||
|
} else {
|
||||||
|
// 如果查不到VO(可能事务未提交),直接用DTO转发
|
||||||
|
logger.warn("未找到消息VO,使用DTO转发: messageId={}", chatMessage.getMessageId());
|
||||||
|
messagingTemplate.convertAndSend("/topic/chat/" + roomId, chatMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("处理Redis消息失败", e);
|
logger.error("处理Redis消息失败", e);
|
||||||
|
|||||||
@@ -122,7 +122,11 @@ public class ChatRoomServiceImpl implements ChatRoomService {
|
|||||||
}
|
}
|
||||||
// 从AI同步对话历史
|
// 从AI同步对话历史
|
||||||
if(NonUtils.isNotEmpty(chatRoom.getAiSessionId())){
|
if(NonUtils.isNotEmpty(chatRoom.getAiSessionId())){
|
||||||
|
try{
|
||||||
syncAiChatMessages(chatRoom);
|
syncAiChatMessages(chatRoom);
|
||||||
|
}catch(Exception ex){
|
||||||
|
return ResultDomain.failure("创建失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultDomain.success("创建成功", chatRoom);
|
return ResultDomain.success("创建成功", chatRoom);
|
||||||
@@ -680,7 +684,8 @@ public class ChatRoomServiceImpl implements ChatRoomService {
|
|||||||
roomMsg.setMessageType("text");
|
roomMsg.setMessageType("text");
|
||||||
roomMsg.setStatus("sent");
|
roomMsg.setStatus("sent");
|
||||||
roomMsg.setFiles(aiMsg.getFiles());
|
roomMsg.setFiles(aiMsg.getFiles());
|
||||||
roomMsg.setSendTime(new Date(baseTime + i * 1000L));
|
roomMsg.setSendTime(aiMsg.getCreateTime());
|
||||||
|
roomMsg.setCreateTime(aiMsg.getCreateTime());
|
||||||
roomMsg.setIsAiMessage(true);
|
roomMsg.setIsAiMessage(true);
|
||||||
roomMsg.setAiMessageId(aiMsg.getMessageId());
|
roomMsg.setAiMessageId(aiMsg.getMessageId());
|
||||||
roomMsg.setCreator(chatRoom.getGuestId());
|
roomMsg.setCreator(chatRoom.getGuestId());
|
||||||
|
|||||||
@@ -32,7 +32,12 @@ security:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: workcase-service
|
name: workcase-service
|
||||||
|
# 文件上传配置
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
enabled: true
|
||||||
|
max-file-size: 500MB
|
||||||
|
max-request-size: 500MB
|
||||||
# ================== Spring Cloud Nacos ==================
|
# ================== Spring Cloud Nacos ==================
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
@@ -75,6 +80,7 @@ dubbo:
|
|||||||
name: urban-lifeline-workcase
|
name: urban-lifeline-workcase
|
||||||
qos-enable: false
|
qos-enable: false
|
||||||
protocol:
|
protocol:
|
||||||
|
payload: 110100480
|
||||||
name: dubbo
|
name: dubbo
|
||||||
port: -1
|
port: -1
|
||||||
registry:
|
registry:
|
||||||
|
|||||||
@@ -62,6 +62,8 @@
|
|||||||
<if test="isAiMessage != null">, is_ai_message</if>
|
<if test="isAiMessage != null">, is_ai_message</if>
|
||||||
<if test="aiMessageId != null">, ai_message_id</if>
|
<if test="aiMessageId != null">, ai_message_id</if>
|
||||||
<if test="status != null">, status</if>
|
<if test="status != null">, status</if>
|
||||||
|
<if test="sendTime != null">, send_time</if>
|
||||||
|
<if test="createTime != null">, create_time</if>
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{optsn}, #{messageId}, #{roomId}, #{senderId}, #{senderType}, #{senderName}, #{content}, #{creator}
|
#{optsn}, #{messageId}, #{roomId}, #{senderId}, #{senderType}, #{senderName}, #{content}, #{creator}
|
||||||
<if test="messageType != null">, #{messageType}</if>
|
<if test="messageType != null">, #{messageType}</if>
|
||||||
@@ -71,6 +73,8 @@
|
|||||||
<if test="isAiMessage != null">, #{isAiMessage}</if>
|
<if test="isAiMessage != null">, #{isAiMessage}</if>
|
||||||
<if test="aiMessageId != null">, #{aiMessageId}</if>
|
<if test="aiMessageId != null">, #{aiMessageId}</if>
|
||||||
<if test="status != null">, #{status}</if>
|
<if test="status != null">, #{status}</if>
|
||||||
|
<if test="sendTime != null">, send_time</if>
|
||||||
|
<if test="createTime != null">, #{createTime}</if>
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<result column="guest_name" property="guestName" jdbcType="VARCHAR"/>
|
<result column="guest_name" property="guestName" jdbcType="VARCHAR"/>
|
||||||
<result column="ai_session_id" property="aiSessionId" jdbcType="VARCHAR"/>
|
<result column="ai_session_id" property="aiSessionId" jdbcType="VARCHAR"/>
|
||||||
<result column="message_count" property="messageCount" jdbcType="INTEGER"/>
|
<result column="message_count" property="messageCount" jdbcType="INTEGER"/>
|
||||||
|
<result column="device_code" property="deviceCode" jdbcType="VARCHAR"/>
|
||||||
<result column="last_message_time" property="lastMessageTime" jdbcType="TIMESTAMP"/>
|
<result column="last_message_time" property="lastMessageTime" jdbcType="TIMESTAMP"/>
|
||||||
<result column="last_message" property="lastMessage" jdbcType="VARCHAR"/>
|
<result column="last_message" property="lastMessage" jdbcType="VARCHAR"/>
|
||||||
<result column="comment_level" property="commentLevel" jdbcType="INTEGER"/>
|
<result column="comment_level" property="commentLevel" jdbcType="INTEGER"/>
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
<result column="guest_name" property="guestName" jdbcType="VARCHAR"/>
|
<result column="guest_name" property="guestName" jdbcType="VARCHAR"/>
|
||||||
<result column="ai_session_id" property="aiSessionId" jdbcType="VARCHAR"/>
|
<result column="ai_session_id" property="aiSessionId" jdbcType="VARCHAR"/>
|
||||||
<result column="message_count" property="messageCount" jdbcType="INTEGER"/>
|
<result column="message_count" property="messageCount" jdbcType="INTEGER"/>
|
||||||
|
<result column="device_code" property="deviceCode" jdbcType="VARCHAR"/>
|
||||||
<result column="unread_count" property="unreadCount" jdbcType="INTEGER"/>
|
<result column="unread_count" property="unreadCount" jdbcType="INTEGER"/>
|
||||||
<result column="last_message_time" property="lastMessageTime" jdbcType="TIMESTAMP"/>
|
<result column="last_message_time" property="lastMessageTime" jdbcType="TIMESTAMP"/>
|
||||||
<result column="last_message" property="lastMessage" jdbcType="VARCHAR"/>
|
<result column="last_message" property="lastMessage" jdbcType="VARCHAR"/>
|
||||||
@@ -51,13 +53,13 @@
|
|||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
room_id, optsn, workcase_id, room_name, room_type, status, guest_id, guest_name,
|
room_id, optsn, workcase_id, room_name, room_type, status, guest_id, guest_name,
|
||||||
ai_session_id, message_count, last_message_time, last_message, comment_level, closed_by, closed_time,
|
ai_session_id, message_count, device_code, last_message_time, last_message, comment_level, closed_by, closed_time,
|
||||||
creator, create_time, update_time, delete_time, deleted
|
creator, create_time, update_time, delete_time, deleted
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="insertChatRoom" parameterType="org.xyzh.api.workcase.dto.TbChatRoomDTO">
|
<insert id="insertChatRoom" parameterType="org.xyzh.api.workcase.dto.TbChatRoomDTO">
|
||||||
INSERT INTO workcase.tb_chat_room (
|
INSERT INTO workcase.tb_chat_room (
|
||||||
optsn, room_id, workcase_id, room_name, guest_id, guest_name, creator
|
optsn, room_id, workcase_id, room_name, guest_id, guest_name, device_code, creator
|
||||||
<if test="roomType != null">, room_type</if>
|
<if test="roomType != null">, room_type</if>
|
||||||
<if test="status != null">, status</if>
|
<if test="status != null">, status</if>
|
||||||
<if test="aiSessionId != null">, ai_session_id</if>
|
<if test="aiSessionId != null">, ai_session_id</if>
|
||||||
@@ -65,7 +67,7 @@
|
|||||||
<if test="lastMessageTime != null">, last_message_time</if>
|
<if test="lastMessageTime != null">, last_message_time</if>
|
||||||
<if test="lastMessage != null">, last_message</if>
|
<if test="lastMessage != null">, last_message</if>
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{optsn}, #{roomId}, #{workcaseId}, #{roomName}, #{guestId}, #{guestName}, #{creator}
|
#{optsn}, #{roomId}, #{workcaseId}, #{roomName}, #{guestId}, #{guestName}, #{deviceCode}, #{creator}
|
||||||
<if test="roomType != null">, #{roomType}</if>
|
<if test="roomType != null">, #{roomType}</if>
|
||||||
<if test="status != null">, #{status}</if>
|
<if test="status != null">, #{status}</if>
|
||||||
<if test="aiSessionId != null">, #{aiSessionId}</if>
|
<if test="aiSessionId != null">, #{aiSessionId}</if>
|
||||||
@@ -84,6 +86,7 @@
|
|||||||
<if test="status != null and status != ''">status = #{status},</if>
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
<if test="aiSessionId != null">ai_session_id = #{aiSessionId},</if>
|
<if test="aiSessionId != null">ai_session_id = #{aiSessionId},</if>
|
||||||
<if test="messageCount != null">message_count = #{messageCount},</if>
|
<if test="messageCount != null">message_count = #{messageCount},</if>
|
||||||
|
<if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
|
||||||
<if test="lastMessageTime != null">last_message_time = #{lastMessageTime},</if>
|
<if test="lastMessageTime != null">last_message_time = #{lastMessageTime},</if>
|
||||||
<if test="lastMessage != null">last_message = #{lastMessage},</if>
|
<if test="lastMessage != null">last_message = #{lastMessage},</if>
|
||||||
<if test="commentLevel != null">comment_level = #{commentLevel},</if>
|
<if test="commentLevel != null">comment_level = #{commentLevel},</if>
|
||||||
@@ -124,7 +127,7 @@
|
|||||||
|
|
||||||
<select id="selectChatRoomPage" resultMap="VOResultMap">
|
<select id="selectChatRoomPage" resultMap="VOResultMap">
|
||||||
SELECT r.room_id, r.optsn, r.workcase_id, r.room_name, r.room_type, r.status,
|
SELECT r.room_id, r.optsn, r.workcase_id, r.room_name, r.room_type, r.status,
|
||||||
r.guest_id, r.guest_name, r.ai_session_id, r.message_count,
|
r.guest_id, r.guest_name, r.ai_session_id, r.message_count, r.device_code,
|
||||||
r.last_message_time, r.last_message, r.comment_level, r.closed_by, r.closed_time,
|
r.last_message_time, r.last_message, r.comment_level, r.closed_by, r.closed_time,
|
||||||
r.creator, r.create_time, r.update_time, r.delete_time, r.deleted,
|
r.creator, r.create_time, r.update_time, r.delete_time, r.deleted,
|
||||||
COALESCE(m.unread_count, 0) as unread_count
|
COALESCE(m.unread_count, 0) as unread_count
|
||||||
|
|||||||
@@ -134,10 +134,9 @@ async function handleLogin() {
|
|||||||
if (response.success && response.data) {
|
if (response.success && response.data) {
|
||||||
const loginData = response.data
|
const loginData = response.data
|
||||||
|
|
||||||
// 8. 保存 Token
|
// 8. 保存 Token(只用 TokenManager,避免格式不一致)
|
||||||
if (loginData.token) {
|
if (loginData.token) {
|
||||||
TokenManager.setToken(loginData.token, loginForm.rememberMe)
|
TokenManager.setToken(loginData.token, loginForm.rememberMe)
|
||||||
localStorage.setItem('token', loginData.token)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9. 保存 LoginDomain 到 LocalStorage
|
// 9. 保存 LoginDomain 到 LocalStorage
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ export const aiKnowledgeAPI = {
|
|||||||
* 删除知识库文件
|
* 删除知识库文件
|
||||||
* @param fileId 文件ID
|
* @param fileId 文件ID
|
||||||
*/
|
*/
|
||||||
async deleteFile(fileId: string): Promise<ResultDomain<boolean>> {
|
async deleteFile(fileRootId: string): Promise<ResultDomain<boolean>> {
|
||||||
const response = await api.delete<boolean>(`${this.baseUrl}/file/${fileId}`)
|
const response = await api.delete<boolean>(`${this.baseUrl}/file/${fileRootId}`)
|
||||||
return response.data
|
return response.data
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
const newToken = loginDomain.token
|
const newToken = loginDomain.token
|
||||||
|
|
||||||
// 保存到localStorage(覆盖旧的登录状态)
|
// 保存到localStorage(覆盖旧的登录状态)
|
||||||
localStorage.setItem('token', newToken)
|
// 只用 TokenManager 存储 token,避免格式不一致
|
||||||
localStorage.setItem('loginDomain', JSON.stringify(loginDomain))
|
|
||||||
TokenManager.setToken(newToken)
|
TokenManager.setToken(newToken)
|
||||||
|
localStorage.setItem('loginDomain', JSON.stringify(loginDomain))
|
||||||
|
|
||||||
console.log('[Workcase Router] Token验证成功,登录状态已刷新')
|
console.log('[Workcase Router] Token验证成功,登录状态已刷新')
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export interface TbChatRoomDTO extends BaseDTO {
|
|||||||
status?: string
|
status?: string
|
||||||
guestId?: string
|
guestId?: string
|
||||||
guestName?: string
|
guestName?: string
|
||||||
|
deviceCode?: string
|
||||||
aiSessionId?: string
|
aiSessionId?: string
|
||||||
currentAgentId?: string
|
currentAgentId?: string
|
||||||
agentCount?: number
|
agentCount?: number
|
||||||
@@ -164,6 +165,7 @@ export interface ChatRoomVO extends BaseVO {
|
|||||||
status?: string
|
status?: string
|
||||||
guestId?: string
|
guestId?: string
|
||||||
guestName?: string
|
guestName?: string
|
||||||
|
deviceCode?: string
|
||||||
aiSessionId?: string
|
aiSessionId?: string
|
||||||
currentAgentId?: string
|
currentAgentId?: string
|
||||||
currentAgentName?: string
|
currentAgentName?: string
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ const deleteFile = async (row: DocumentItem) => {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
const result = await aiKnowledgeAPI.deleteFile(row.id)
|
const result = await aiKnowledgeAPI.deleteFile(row.fileRootId)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
ElMessage.success('删除成功')
|
ElMessage.success('删除成功')
|
||||||
fetchDocuments(activeKnowledgeId.value)
|
fetchDocuments(activeKnowledgeId.value)
|
||||||
@@ -306,7 +306,7 @@ const customKnowledgeUpload = async (files: File[]) => {
|
|||||||
const result = await aiKnowledgeAPI.uploadToKnowledge(files[0], targetKnowledgeId)
|
const result = await aiKnowledgeAPI.uploadToKnowledge(files[0], targetKnowledgeId)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
ElMessage.success('文件上传成功')
|
ElMessage.success('文件上传成功')
|
||||||
fetchKnowledges()
|
// fetchKnowledges()
|
||||||
fetchDocuments(activeKnowledgeId.value)
|
fetchDocuments(activeKnowledgeId.value)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.message || '上传失败')
|
throw new Error(result.message || '上传失败')
|
||||||
@@ -316,7 +316,7 @@ const customKnowledgeUpload = async (files: File[]) => {
|
|||||||
const result = await aiKnowledgeAPI.batchUploadToKnowledge(files, targetKnowledgeId)
|
const result = await aiKnowledgeAPI.batchUploadToKnowledge(files, targetKnowledgeId)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
ElMessage.success('文件上传成功')
|
ElMessage.success('文件上传成功')
|
||||||
fetchKnowledges()
|
// fetchKnowledges()
|
||||||
fetchDocuments(activeKnowledgeId.value)
|
fetchDocuments(activeKnowledgeId.value)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(result.message || '上传失败')
|
throw new Error(result.message || '上传失败')
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ import { Client } from '@stomp/stompjs'
|
|||||||
// WebSocket配置 (通过Nginx代理访问网关,再到workcase服务)
|
// WebSocket配置 (通过Nginx代理访问网关,再到workcase服务)
|
||||||
// SockJS URL (http://)
|
// SockJS URL (http://)
|
||||||
const getWsUrl = () => {
|
const getWsUrl = () => {
|
||||||
const token = localStorage.getItem('token')!
|
const token = JSON.parse(localStorage.getItem('token')!).value
|
||||||
const protocol = window.location.protocol
|
const protocol = window.location.protocol
|
||||||
const host = window.location.host
|
const host = window.location.host
|
||||||
return `${protocol}//${host}/api/urban-lifeline/workcase/ws/chat-sockjs?token=${encodeURIComponent(token)}`
|
return `${protocol}//${host}/api/urban-lifeline/workcase/ws/chat-sockjs?token=${encodeURIComponent(token)}`
|
||||||
@@ -557,32 +557,6 @@ const startMeeting = async () => {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 没有活跃会议,创建新会议
|
|
||||||
const createResult = await workcaseChatAPI.createVideoMeeting({
|
|
||||||
roomId: currentRoomId.value,
|
|
||||||
meetingName: currentRoom.value?.roomName || '视频会议'
|
|
||||||
})
|
|
||||||
|
|
||||||
if (createResult.success && createResult.data) {
|
|
||||||
const currentMeetingId = createResult.data.meetingId!
|
|
||||||
|
|
||||||
// 开始会议
|
|
||||||
await workcaseChatAPI.startVideoMeeting(currentMeetingId)
|
|
||||||
|
|
||||||
// 加入会议获取会议页面URL
|
|
||||||
const joinResult = await workcaseChatAPI.joinVideoMeeting(currentMeetingId)
|
|
||||||
if (joinResult.success && joinResult.data?.iframeUrl) {
|
|
||||||
// 使用router跳转到JitsiMeetingView页面,附加roomId参数用于返回
|
|
||||||
const meetingUrl = joinResult.data.iframeUrl + `&roomId=${currentRoomId.value}`
|
|
||||||
router.push(meetingUrl)
|
|
||||||
ElMessage.success('会议已创建')
|
|
||||||
} else {
|
|
||||||
ElMessage.error(joinResult.message || '获取会议链接失败')
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ElMessage.error(createResult.message || '创建会议失败')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('发起会议失败:', error)
|
console.error('发起会议失败:', error)
|
||||||
ElMessage.error('发起会议失败')
|
ElMessage.error('发起会议失败')
|
||||||
@@ -707,9 +681,17 @@ const subscribeToRoom = (roomId: string) => {
|
|||||||
// 避免重复添加自己发送的普通消息
|
// 避免重复添加自己发送的普通消息
|
||||||
// 但会议消息(meet类型)始终添加,因为它是系统生成的通知
|
// 但会议消息(meet类型)始终添加,因为它是系统生成的通知
|
||||||
if (chatMessage.messageType === 'meet' || chatMessage.senderId !== loginDomain.user.userId) {
|
if (chatMessage.messageType === 'meet' || chatMessage.senderId !== loginDomain.user.userId) {
|
||||||
|
// 会议消息延时处理,等待数据库事务提交
|
||||||
|
if (chatMessage.messageType === 'meet') {
|
||||||
|
console.log('[ChatRoom] 收到会议消息,延时1秒后刷新')
|
||||||
|
setTimeout(() => {
|
||||||
|
loadMessages(roomId)
|
||||||
|
}, 1000)
|
||||||
|
} else {
|
||||||
messages.value.push(chatMessage)
|
messages.value.push(chatMessage)
|
||||||
scrollToBottom()
|
scrollToBottom()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -784,6 +784,16 @@ function handleNewMessage(message: ChatRoomMessageVO) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 会议消息延时处理,等待数据库事务提交
|
||||||
|
if (message.messageType === 'meet') {
|
||||||
|
console.log('[chatRoom] 收到会议消息,延时1秒后刷新')
|
||||||
|
setTimeout(async () => {
|
||||||
|
// 重新加载最新消息,确保获取到完整的会议消息数据
|
||||||
|
await loadMessages()
|
||||||
|
}, 1000)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 添加新消息到列表
|
// 添加新消息到列表
|
||||||
messages.push(message)
|
messages.push(message)
|
||||||
nextTick(() => scrollToBottom())
|
nextTick(() => scrollToBottom())
|
||||||
|
|||||||
@@ -696,3 +696,110 @@
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设备代码输入弹窗样式
|
||||||
|
.device-code-modal {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-mask {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
position: relative;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 16px;
|
||||||
|
width: 80%;
|
||||||
|
max-width: 320px;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-code-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-code-input:focus {
|
||||||
|
border-color: #007AFF;
|
||||||
|
background-color: white;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 44px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: none;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn.cancel {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn.cancel:active {
|
||||||
|
background-color: #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn.confirm {
|
||||||
|
background-color: #007AFF;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn.confirm:active {
|
||||||
|
background-color: #0056b3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-btn .btn-text {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -148,6 +148,33 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 设备代码输入弹窗 -->
|
||||||
|
<view class="device-code-modal" v-if="showDeviceCodeDialog">
|
||||||
|
<view class="modal-mask" @tap="cancelDeviceCodeInput"></view>
|
||||||
|
<view class="modal-content">
|
||||||
|
<view class="modal-header">
|
||||||
|
<text class="modal-title">请输入设备代码</text>
|
||||||
|
</view>
|
||||||
|
<view class="modal-body">
|
||||||
|
<input
|
||||||
|
class="device-code-input"
|
||||||
|
v-model="deviceCodeInput"
|
||||||
|
placeholder="请输入设备代码"
|
||||||
|
focus
|
||||||
|
@confirm="confirmDeviceCodeInput"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="modal-footer">
|
||||||
|
<button class="modal-btn cancel" @tap="cancelDeviceCodeInput">
|
||||||
|
<text class="btn-text">取消</text>
|
||||||
|
</button>
|
||||||
|
<button class="modal-btn confirm" @tap="confirmDeviceCodeInput">
|
||||||
|
<text class="btn-text">确定</text>
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -194,6 +221,12 @@
|
|||||||
const chatId = ref<string>('') // 当前会话ID
|
const chatId = ref<string>('') // 当前会话ID
|
||||||
const currentTaskId = ref<string>('') // 当前任务ID(用于停止)
|
const currentTaskId = ref<string>('') // 当前任务ID(用于停止)
|
||||||
|
|
||||||
|
// 设备代码相关
|
||||||
|
const deviceCode = ref<string>('') // 设备代码
|
||||||
|
const showDeviceCodeDialog = ref<boolean>(false) // 是否显示设备代码输入弹窗
|
||||||
|
const deviceCodeInput = ref<string>('') // 弹窗中的设备代码输入
|
||||||
|
const pendingAction = ref<'workcase' | 'human' | ''>('') // 待执行的操作类型
|
||||||
|
|
||||||
// 初始化用户信息
|
// 初始化用户信息
|
||||||
async function initUserInfo() {
|
async function initUserInfo() {
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
@@ -489,10 +522,54 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 直接跳转到工单详情页的 create 模式(复用 workcaseDetail 页面)
|
// 检查并获取设备代码
|
||||||
async function showCreator() {
|
function checkDeviceCode(action: 'workcase' | 'human') {
|
||||||
// 首页直接创建工单:为了让工单和聊天室绑定,这里先创建一个聊天室(workcase类型),再带 roomId 跳转
|
if (!deviceCode.value) {
|
||||||
// 如果你希望“无聊天室也能创建工单”,后端 WorkcaseServiceImpl 也支持 roomId 为空时自动创建聊天室
|
// 如果没有设备代码,显示输入弹窗
|
||||||
|
pendingAction.value = action
|
||||||
|
deviceCodeInput.value = ''
|
||||||
|
showDeviceCodeDialog.value = true
|
||||||
|
} else {
|
||||||
|
// 如果已有设备代码,直接执行对应操作
|
||||||
|
if (action === 'workcase') {
|
||||||
|
doCreateWorkcase()
|
||||||
|
} else {
|
||||||
|
doContactHuman()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认输入设备代码
|
||||||
|
function confirmDeviceCodeInput() {
|
||||||
|
if (!deviceCodeInput.value.trim()) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入设备代码',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceCode.value = deviceCodeInput.value.trim()
|
||||||
|
showDeviceCodeDialog.value = false
|
||||||
|
|
||||||
|
// 执行待处理的操作
|
||||||
|
if (pendingAction.value === 'workcase') {
|
||||||
|
doCreateWorkcase()
|
||||||
|
} else if (pendingAction.value === 'human') {
|
||||||
|
doContactHuman()
|
||||||
|
}
|
||||||
|
pendingAction.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消输入设备代码
|
||||||
|
function cancelDeviceCodeInput() {
|
||||||
|
showDeviceCodeDialog.value = false
|
||||||
|
deviceCodeInput.value = ''
|
||||||
|
pendingAction.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// 实际创建工单
|
||||||
|
async function doCreateWorkcase() {
|
||||||
uni.showLoading({ title: '正在创建工单...' })
|
uni.showLoading({ title: '正在创建工单...' })
|
||||||
try {
|
try {
|
||||||
const res = await workcaseChatAPI.createChatRoom({
|
const res = await workcaseChatAPI.createChatRoom({
|
||||||
@@ -501,6 +578,7 @@
|
|||||||
roomName: `${userInfo.value.username || '访客'}的工单`,
|
roomName: `${userInfo.value.username || '访客'}的工单`,
|
||||||
roomType: 'workcase',
|
roomType: 'workcase',
|
||||||
status: 'active',
|
status: 'active',
|
||||||
|
deviceCode: deviceCode.value,
|
||||||
aiSessionId: chatId.value || ''
|
aiSessionId: chatId.value || ''
|
||||||
})
|
})
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
@@ -521,6 +599,51 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 实际联系人工
|
||||||
|
async function doContactHuman() {
|
||||||
|
uni.showLoading({ title: '正在连接客服...' })
|
||||||
|
try {
|
||||||
|
// 创建聊天室
|
||||||
|
const res = await workcaseChatAPI.createChatRoom({
|
||||||
|
guestId: userInfo.value.userId || userInfo.value.wechatId,
|
||||||
|
guestName: userInfo.value.username || '访客',
|
||||||
|
roomName: `${userInfo.value.username || '访客'}的咨询`,
|
||||||
|
roomType: 'guest',
|
||||||
|
status: 'active',
|
||||||
|
deviceCode: deviceCode.value,
|
||||||
|
aiSessionId: chatId.value || ''
|
||||||
|
})
|
||||||
|
uni.hideLoading()
|
||||||
|
|
||||||
|
if (res.success && res.data) {
|
||||||
|
const roomId = res.data.roomId
|
||||||
|
console.log('创建聊天室成功:', roomId)
|
||||||
|
// 跳转到聊天室页面
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/chatRoom/chatRoom/chatRoom?roomId=${roomId}&roomName=${encodeURIComponent(res.data.roomName || '人工客服')}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message || '连接客服失败',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
uni.hideLoading()
|
||||||
|
console.error('创建聊天室失败:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '连接客服失败,请稍后重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接跳转到工单详情页的 create 模式(复用 workcaseDetail 页面)
|
||||||
|
async function showCreator() {
|
||||||
|
// 检查设备代码
|
||||||
|
checkDeviceCode('workcase')
|
||||||
|
}
|
||||||
|
|
||||||
// 兼容旧逻辑:不再使用页面内工单创建器
|
// 兼容旧逻辑:不再使用页面内工单创建器
|
||||||
function hideCreator() {
|
function hideCreator() {
|
||||||
showWorkcaseCreator.value = false
|
showWorkcaseCreator.value = false
|
||||||
@@ -557,40 +680,8 @@
|
|||||||
|
|
||||||
// 联系人工客服 - 创建聊天室并进入
|
// 联系人工客服 - 创建聊天室并进入
|
||||||
async function contactHuman() {
|
async function contactHuman() {
|
||||||
uni.showLoading({ title: '正在连接客服...' })
|
// 检查设备代码
|
||||||
try {
|
checkDeviceCode('human')
|
||||||
// 创建聊天室
|
|
||||||
const res = await workcaseChatAPI.createChatRoom({
|
|
||||||
guestId: userInfo.value.userId || userInfo.value.wechatId,
|
|
||||||
guestName: userInfo.value.username || '访客',
|
|
||||||
roomName: `${userInfo.value.username || '访客'}的咨询`,
|
|
||||||
roomType: 'guest',
|
|
||||||
status: 'active',
|
|
||||||
aiSessionId: chatId.value || ''
|
|
||||||
})
|
|
||||||
uni.hideLoading()
|
|
||||||
|
|
||||||
if (res.success && res.data) {
|
|
||||||
const roomId = res.data.roomId
|
|
||||||
console.log('创建聊天室成功:', roomId)
|
|
||||||
// 跳转到聊天室页面
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/chatRoom/chatRoom/chatRoom?roomId=${roomId}&roomName=${encodeURIComponent(res.data.roomName || '人工客服')}`
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
title: res.message || '连接客服失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (error: any) {
|
|
||||||
uni.hideLoading()
|
|
||||||
console.error('创建聊天室失败:', error)
|
|
||||||
uni.showToast({
|
|
||||||
title: '连接客服失败,请稍后重试',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理快速问题
|
// 处理快速问题
|
||||||
|
|||||||
@@ -1,116 +1,185 @@
|
|||||||
.meeting-create-page {
|
.page {
|
||||||
min-height: 100vh;
|
background: #f8fafc;
|
||||||
background-color: #f5f7fa;
|
|
||||||
padding-bottom: 120rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-header {
|
.nav {
|
||||||
background-color: #fff;
|
position: fixed;
|
||||||
padding: 32rpx;
|
top: 0;
|
||||||
border-bottom: 1px solid #ebeef5;
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: #fff;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: flex-end;
|
||||||
|
padding-left: 24rpx;
|
||||||
|
padding-right: 24rpx;
|
||||||
|
padding-bottom: 16rpx;
|
||||||
|
z-index: 100;
|
||||||
|
border-bottom: 1rpx solid #e5e7eb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-title {
|
.nav-back {
|
||||||
font-size: 36rpx;
|
width: 60rpx;
|
||||||
font-weight: 600;
|
height: 64rpx;
|
||||||
color: #303133;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-back-icon {
|
||||||
|
width: 20rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
border-left-width: 4rpx;
|
||||||
|
border-left-style: solid;
|
||||||
|
border-left-color: #333;
|
||||||
|
border-bottom-width: 4rpx;
|
||||||
|
border-bottom-style: solid;
|
||||||
|
border-bottom-color: #333;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-title {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 64rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-capsule {
|
||||||
|
width: 174rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 24rpx;
|
||||||
|
padding-bottom: 140rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 24rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单容器
|
||||||
.form-container {
|
.form-container {
|
||||||
background-color: #fff;
|
background: #fff;
|
||||||
margin-top: 16rpx;
|
border-radius: 16rpx;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-item {
|
.form-item {
|
||||||
padding: 24rpx 32rpx;
|
padding: 24rpx;
|
||||||
border-bottom: 1px solid #ebeef5;
|
border-bottom-width: 1rpx;
|
||||||
}
|
border-bottom-style: solid;
|
||||||
|
border-bottom-color: #f3f4f6;
|
||||||
.form-item.required .label-text::after {
|
|
||||||
content: ' *';
|
|
||||||
color: #f56c6c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-label {
|
.form-label {
|
||||||
display: flex;
|
font-size: 26rpx;
|
||||||
align-items: center;
|
color: #6b7280;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
}
|
|
||||||
|
|
||||||
.label-text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #606266;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.required-star {
|
|
||||||
color: #f56c6c;
|
|
||||||
margin-left: 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-input {
|
.form-input {
|
||||||
width: 100%;
|
padding: 0 24rpx;
|
||||||
padding: 16rpx 24rpx;
|
height: 68rpx;
|
||||||
border: 1px solid #dcdfe6;
|
background-color: #f9fafb;
|
||||||
|
border-width: 1rpx;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #e5e7eb;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #303133;
|
color: #111827;
|
||||||
}
|
|
||||||
|
|
||||||
.picker-display {
|
|
||||||
padding: 16rpx 24rpx;
|
|
||||||
border: 1px solid #dcdfe6;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #303133;
|
|
||||||
}
|
|
||||||
|
|
||||||
.picker-display .placeholder {
|
|
||||||
color: #c0c4cc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-tip {
|
.form-tip {
|
||||||
margin-top: 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-tip text {
|
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #909399;
|
color: #9ca3af;
|
||||||
|
margin-top: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-footer {
|
.required {
|
||||||
|
color: #ef4444;
|
||||||
|
margin-left: 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-content {
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 68rpx;
|
||||||
|
padding: 0 24rpx;
|
||||||
|
background-color: #f9fafb;
|
||||||
|
border-width: 1rpx;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #e5e7eb;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-text {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #111827;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-text.placeholder {
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-arrow {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #9ca3af;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 底部占位
|
||||||
|
.footer-placeholder {
|
||||||
|
height: 120rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 底部操作栏
|
||||||
|
.footer-actions {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
display: flex;
|
bottom: 0;
|
||||||
justify-content: space-between;
|
|
||||||
padding: 24rpx 32rpx;
|
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-top: 1px solid #ebeef5;
|
border-top-width: 1rpx;
|
||||||
box-shadow: 0 -2rpx 8rpx rgba(0, 0, 0, 0.05);
|
border-top-style: solid;
|
||||||
|
border-top-color: #e5e7eb;
|
||||||
|
padding: 24rpx;
|
||||||
|
flex-direction: row;
|
||||||
|
z-index: 99;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.action-button {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 24rpx 0;
|
height: 80rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
font-size: 32rpx;
|
align-items: center;
|
||||||
text-align: center;
|
justify-content: center;
|
||||||
border: none;
|
border-width: 1rpx;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #e5e7eb;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-right: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-cancel {
|
.action-button.primary {
|
||||||
background-color: #f5f7fa;
|
background-color: #4b87ff;
|
||||||
color: #606266;
|
border-color: #4b87ff;
|
||||||
margin-right: 16rpx;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-submit {
|
.action-button.primary .button-text {
|
||||||
background-color: #409eff;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-submit[loading] {
|
.button-text {
|
||||||
opacity: 0.7;
|
font-size: 28rpx;
|
||||||
|
color: #6b7280;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="meeting-create-page">
|
<!-- #ifdef APP -->
|
||||||
<view class="page-header">
|
<scroll-view style="flex:1">
|
||||||
<text class="page-title">创建视频会议</text>
|
<!-- #endif -->
|
||||||
|
<view class="page">
|
||||||
|
<!-- 导航栏 -->
|
||||||
|
<view class="nav" :style="{ paddingTop: headerPaddingTop + 'px', height: headerTotalHeight + 'px' }">
|
||||||
|
<view class="nav-back" @tap="handleCancel">
|
||||||
|
<view class="nav-back-icon"></view>
|
||||||
|
</view>
|
||||||
|
<text class="nav-title">创建视频会议</text>
|
||||||
|
<view class="nav-capsule"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 内容区域 -->
|
||||||
|
<scroll-view class="content" scroll-y="true" :style="{ marginTop: headerTotalHeight + 'px' }">
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<view class="section">
|
||||||
<view class="form-container">
|
<view class="form-container">
|
||||||
<!-- 会议名称 -->
|
<!-- 会议名称 -->
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<view class="form-label">
|
<text class="form-label">会议名称</text>
|
||||||
<text class="label-text">会议名称</text>
|
|
||||||
</view>
|
|
||||||
<input
|
<input
|
||||||
v-model="formData.meetingName"
|
v-model="formData.meetingName"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
@@ -19,66 +29,56 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 开始时间 -->
|
<!-- 开始时间 -->
|
||||||
<view class="form-item required">
|
<view class="form-item">
|
||||||
<view class="form-label">
|
<text class="form-label">开始时间<text class="required">*</text></text>
|
||||||
<text class="label-text">开始时间</text>
|
|
||||||
<text class="required-star">*</text>
|
|
||||||
</view>
|
|
||||||
<picker
|
<picker
|
||||||
mode="multiSelector"
|
mode="multiSelector"
|
||||||
:value="startTimePickerValue"
|
:value="startTimePickerValue"
|
||||||
:range="timePickerRange"
|
:range="timePickerRange"
|
||||||
@change="handleStartTimeChange"
|
@change="handleStartTimeChange"
|
||||||
>
|
>
|
||||||
<view class="picker-display">
|
<view class="picker-content">
|
||||||
<text :class="formData.startTime ? '' : 'placeholder'">
|
<text class="picker-text" :class="{ placeholder: !formData.startTime }">
|
||||||
{{ formData.startTime || '请选择开始时间' }}
|
{{ formData.startTime || '请选择开始时间' }}
|
||||||
</text>
|
</text>
|
||||||
|
<text class="picker-arrow">></text>
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 结束时间 -->
|
<!-- 结束时间 -->
|
||||||
<view class="form-item required">
|
<view class="form-item">
|
||||||
<view class="form-label">
|
<text class="form-label">结束时间<text class="required">*</text></text>
|
||||||
<text class="label-text">结束时间</text>
|
|
||||||
<text class="required-star">*</text>
|
|
||||||
</view>
|
|
||||||
<picker
|
<picker
|
||||||
mode="multiSelector"
|
mode="multiSelector"
|
||||||
:value="endTimePickerValue"
|
:value="endTimePickerValue"
|
||||||
:range="timePickerRange"
|
:range="timePickerRange"
|
||||||
@change="handleEndTimeChange"
|
@change="handleEndTimeChange"
|
||||||
>
|
>
|
||||||
<view class="picker-display">
|
<view class="picker-content">
|
||||||
<text :class="formData.endTime ? '' : 'placeholder'">
|
<text class="picker-text" :class="{ placeholder: !formData.endTime }">
|
||||||
{{ formData.endTime || '请选择结束时间' }}
|
{{ formData.endTime || '请选择结束时间' }}
|
||||||
</text>
|
</text>
|
||||||
|
<text class="picker-arrow">></text>
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 提前入会 -->
|
<!-- 提前入会 -->
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<view class="form-label">
|
<text class="form-label">提前入会(分钟)</text>
|
||||||
<text class="label-text">提前入会(分钟)</text>
|
|
||||||
</view>
|
|
||||||
<input
|
<input
|
||||||
v-model.number="formData.advance"
|
v-model.number="formData.advance"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="提前入会时间"
|
placeholder="提前入会时间"
|
||||||
/>
|
/>
|
||||||
<view class="form-tip">
|
<text class="form-tip">用户可在会议开始前N分钟加入</text>
|
||||||
<text>用户可在会议开始前N分钟加入</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 会议密码 -->
|
<!-- 会议密码 -->
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<view class="form-label">
|
<text class="form-label">会议密码</text>
|
||||||
<text class="label-text">会议密码</text>
|
|
||||||
</view>
|
|
||||||
<input
|
<input
|
||||||
v-model="formData.meetingPassword"
|
v-model="formData.meetingPassword"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
@@ -91,9 +91,7 @@
|
|||||||
|
|
||||||
<!-- 最大人数 -->
|
<!-- 最大人数 -->
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<view class="form-label">
|
<text class="form-label">最大人数</text>
|
||||||
<text class="label-text">最大人数</text>
|
|
||||||
</view>
|
|
||||||
<input
|
<input
|
||||||
v-model.number="formData.maxParticipants"
|
v-model.number="formData.maxParticipants"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
@@ -102,21 +100,37 @@
|
|||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 底部按钮 -->
|
<!-- 底部占位 -->
|
||||||
<view class="form-footer">
|
<view class="footer-placeholder"></view>
|
||||||
<button class="btn btn-cancel" @click="handleCancel">取消</button>
|
</scroll-view>
|
||||||
<button class="btn btn-submit" :loading="submitting" @click="handleSubmit">创建会议</button>
|
|
||||||
|
<!-- 底部操作栏 -->
|
||||||
|
<view class="footer-actions">
|
||||||
|
<view class="action-button" @tap="handleCancel">
|
||||||
|
<text class="button-text">取消</text>
|
||||||
|
</view>
|
||||||
|
<view class="action-button primary" @tap="handleSubmit">
|
||||||
|
<text class="button-text">创建会议</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- #ifdef APP -->
|
||||||
|
</scroll-view>
|
||||||
|
<!-- #endif -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed } from 'vue'
|
import { ref, reactive, computed, onMounted } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { workcaseChatAPI } from '../../../api/workcase/workcaseChat'
|
import { workcaseChatAPI } from '../../../api/workcase/workcaseChat'
|
||||||
import type { CreateMeetingParam } from '../../../types/workcase/chatRoom'
|
import type { CreateMeetingParam } from '../../../types/workcase/chatRoom'
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const headerPaddingTop = ref<number>(44)
|
||||||
|
const headerTotalHeight = ref<number>(88)
|
||||||
|
|
||||||
// 路由参数
|
// 路由参数
|
||||||
const roomId = ref('')
|
const roomId = ref('')
|
||||||
const workcaseId = ref('')
|
const workcaseId = ref('')
|
||||||
@@ -136,8 +150,8 @@ const formData = reactive<CreateMeetingParam>({
|
|||||||
const submitting = ref(false)
|
const submitting = ref(false)
|
||||||
|
|
||||||
// 时间选择器数据
|
// 时间选择器数据
|
||||||
const startTimePickerValue = ref([0, 0, 0, 0])
|
const startTimePickerValue = ref([0, 0, 0])
|
||||||
const endTimePickerValue = ref([0, 0, 0, 0])
|
const endTimePickerValue = ref([0, 0, 0])
|
||||||
|
|
||||||
// 生成时间选择器范围
|
// 生成时间选择器范围
|
||||||
const timePickerRange = computed(() => {
|
const timePickerRange = computed(() => {
|
||||||
@@ -179,6 +193,26 @@ onLoad((options: any) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const windowInfo = uni.getWindowInfo()
|
||||||
|
const statusBarHeight = windowInfo.statusBarHeight || 44
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
try {
|
||||||
|
const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
|
||||||
|
headerPaddingTop.value = menuButtonInfo.top
|
||||||
|
headerTotalHeight.value = menuButtonInfo.bottom + 8
|
||||||
|
} catch (e) {
|
||||||
|
headerPaddingTop.value = statusBarHeight
|
||||||
|
headerTotalHeight.value = statusBarHeight + 44
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
headerPaddingTop.value = statusBarHeight
|
||||||
|
headerTotalHeight.value = statusBarHeight + 44
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
|
||||||
// 处理开始时间选择
|
// 处理开始时间选择
|
||||||
function handleStartTimeChange(e: any) {
|
function handleStartTimeChange(e: any) {
|
||||||
const val = e.detail.value
|
const val = e.detail.value
|
||||||
@@ -214,69 +248,45 @@ function handleEndTimeChange(e: any) {
|
|||||||
// 验证表单
|
// 验证表单
|
||||||
function validateForm(): boolean {
|
function validateForm(): boolean {
|
||||||
if (!formData.startTime) {
|
if (!formData.startTime) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '请选择开始时间', icon: 'none' })
|
||||||
title: '请选择开始时间',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!formData.endTime) {
|
if (!formData.endTime) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '请选择结束时间', icon: 'none' })
|
||||||
title: '请选择结束时间',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const start = new Date(formData.startTime).getTime()
|
const start = new Date(formData.startTime.replace(' ', 'T')).getTime()
|
||||||
const end = new Date(formData.endTime).getTime()
|
const end = new Date(formData.endTime.replace(' ', 'T')).getTime()
|
||||||
|
|
||||||
if (start < Date.now()) {
|
if (start < Date.now()) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '开始时间不能早于当前时间', icon: 'none' })
|
||||||
title: '开始时间不能早于当前时间',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end <= start) {
|
if (end <= start) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '结束时间必须晚于开始时间', icon: 'none' })
|
||||||
title: '结束时间必须晚于开始时间',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end - start < 5 * 60 * 1000) {
|
if (end - start < 5 * 60 * 1000) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '会议时长不能少于5分钟', icon: 'none' })
|
||||||
title: '会议时长不能少于5分钟',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end - start > 24 * 60 * 60 * 1000) {
|
if (end - start > 24 * 60 * 60 * 1000) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '会议时长不能超过24小时', icon: 'none' })
|
||||||
title: '会议时长不能超过24小时',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.advance !== undefined && (formData.advance < 0 || formData.advance > 60)) {
|
if (formData.advance !== undefined && (formData.advance < 0 || formData.advance > 60)) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '提前入会时间范围为0-60分钟', icon: 'none' })
|
||||||
title: '提前入会时间范围为0-60分钟',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formData.maxParticipants !== undefined && (formData.maxParticipants < 2 || formData.maxParticipants > 100)) {
|
if (formData.maxParticipants !== undefined && (formData.maxParticipants < 2 || formData.maxParticipants > 100)) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '参与人数范围为2-100人', icon: 'none' })
|
||||||
title: '参与人数范围为2-100人',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,33 +299,24 @@ async function handleSubmit() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (submitting.value) return
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
const result = await workcaseChatAPI.createVideoMeeting(formData)
|
const result = await workcaseChatAPI.createVideoMeeting(formData)
|
||||||
|
|
||||||
if (result.success && result.data) {
|
if (result.success && result.data) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '会议创建成功', icon: 'success' })
|
||||||
title: '会议创建成功',
|
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 延迟返回,让用户看到成功提示
|
// 延迟返回,让用户看到成功提示
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 1500)
|
}, 1500)
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({ title: result.message || '创建会议失败', icon: 'none' })
|
||||||
title: result.message || '创建会议失败',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('创建会议失败:', error)
|
console.error('创建会议失败:', error)
|
||||||
uni.showToast({
|
uni.showToast({ title: '创建会议失败,请重试', icon: 'none' })
|
||||||
title: '创建会议失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
} finally {
|
} finally {
|
||||||
submitting.value = false
|
submitting.value = false
|
||||||
}
|
}
|
||||||
@@ -327,6 +328,6 @@ function handleCancel() {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style lang="scss" scoped>
|
||||||
@import url('./MeetingCreate.scss')
|
@import "./MeetingCreate.scss";
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ export interface TbChatRoomDTO extends BaseDTO {
|
|||||||
roomType?: string
|
roomType?: string
|
||||||
status?: string
|
status?: string
|
||||||
guestId?: string
|
guestId?: string
|
||||||
commentLevel?: number
|
|
||||||
guestName?: string
|
guestName?: string
|
||||||
|
deviceCode?: string
|
||||||
|
commentLevel?: number
|
||||||
aiSessionId?: string
|
aiSessionId?: string
|
||||||
currentAgentId?: string
|
currentAgentId?: string
|
||||||
agentCount?: number
|
agentCount?: number
|
||||||
@@ -164,8 +165,9 @@ export interface ChatRoomVO extends BaseVO {
|
|||||||
roomType?: string
|
roomType?: string
|
||||||
status?: string
|
status?: string
|
||||||
guestId?: string
|
guestId?: string
|
||||||
commentLevel?: string
|
|
||||||
guestName?: string
|
guestName?: string
|
||||||
|
commentLevel?: string
|
||||||
|
deviceCode?: string
|
||||||
aiSessionId?: string
|
aiSessionId?: string
|
||||||
currentAgentId?: string
|
currentAgentId?: string
|
||||||
currentAgentName?: string
|
currentAgentName?: string
|
||||||
|
|||||||
4
修改点.md
Normal file
4
修改点.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
1. createTableWorkcase.sql 修改了tb_chat_room 增加了device_code字段。修改相关dto\vo\xml。
|
||||||
|
2. WorkcaseChatController.java 修改创建聊天室的接口,增加了deviceCode字段必传。
|
||||||
|
3. 修改workcase/types/workcase/chatRoom.ts里的dto和vo。修改workcase_wechat/types/workcase/chatRoom.ts的dto和vo
|
||||||
|
4. 修改workcase_wechat/pages/index/index.uvue。新增const deviceCode = ref('');只有这个有值时,才让用户创建聊天室和工单(工单自动填入表单),否则弹窗让用户填写
|
||||||
Reference in New Issue
Block a user