From ffa22cc18c75c0a73a3fd987e2b62fbf55316db2 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期四, 25 六月 2026 15:22:46 +0800
Subject: [PATCH] 测试完成
---
src/components/Assistant/index.vue | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 158 insertions(+), 6 deletions(-)
diff --git a/src/components/Assistant/index.vue b/src/components/Assistant/index.vue
index 2ee2946..e7c16a4 100644
--- a/src/components/Assistant/index.vue
+++ b/src/components/Assistant/index.vue
@@ -152,17 +152,76 @@
d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"
/>
</svg>
+ <!-- 鉁� 鏂板鐭俊鍥炬爣 -->
+ <svg
+ v-else-if="action.icon === 'IconMessageSquare'"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ >
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
+ <line x1="8" y1="9" x2="16" y2="9" />
+ <line x1="8" y1="13" x2="14" y2="13" />
+ <line x1="8" y1="17" x2="12" y2="17" />
+ </svg>
</div>
<div class="action-label">{{ action.label }}</div>
</div>
</div>
</div>
</transition>
+ <!-- 鐭俊鍙戦�佸璇濇 -->
+ <el-dialog
+ title="鐭俊鍙戦��"
+ :visible.sync="smsDialogVisible"
+ width="500px"
+ :close-on-click-modal="false"
+ append-to-body
+ >
+ <el-form ref="smsForm" :model="smsForm" label-width="100px">
+ <el-form-item label="鎮h�呭悕绉�">
+ <el-input v-model="smsForm.sendname" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="骞撮緞">
+ <el-input v-model="smsForm.age" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鐢佃瘽">
+ <el-input v-model="smsForm.telcode" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="绉戝">
+ <el-input v-model="smsForm.deptname" readonly></el-input>
+ </el-form-item>
+ <el-form-item label="鐥呭尯">
+ <el-input
+ v-model="smsForm.leavehospitaldistrictname"
+ readonly
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="鐭俊鍐呭">
+ <el-input
+ type="textarea"
+ :rows="4"
+ v-model="smsContent"
+ placeholder="璇疯緭鍏ョ煭淇″唴瀹�..."
+ maxlength="500"
+ show-word-limit
+ ></el-input>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="smsDialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="sendSms" :loading="smsLoading">
+ 纭鍙戦��
+ </el-button>
+ </div>
+ </el-dialog>
</div>
</template>
<script>
import { getCurrentUserServiceSubtaskCount } from "@/api/AiCentre/index";
+import { sendMsg } from "@/api/AiCentre/index";
export default {
name: "FloatBall",
@@ -210,6 +269,17 @@
hideTimer: null,
updateTime: "",
roles: null,
+ // 鐭俊鍙戦�佸璇濇
+ // smsDialogVisible: false,
+ smsLoading: false, // 鉁� 鏂板鍔犺浇鐘舵��
+ smsContent: "",
+ smsForm: {
+ sendname: "",
+ age: "",
+ telcode: "",
+ deptname: "",
+ leavehospitaldistrictname: "",
+ },
// 缁熻鏁版嵁
statsItems: [
{
@@ -269,12 +339,12 @@
icon: "IconPhone",
url: "/followvisit/particty?type=1&serviceType=2",
},
- // {
- // id: 'chat',
- // label: '鍦ㄧ嚎鑱婂ぉ',
- // icon: 'IconMessageCircle',
- // url: '/chat'
- // }
+ {
+ id: "sendSms", // 鉁� 鏂板鐭俊鍙戦��
+ label: "鐭俊鍙戦��",
+ icon: "IconMessageSquare",
+ action: "openSmsDialog", // 鏍囪涓哄脊妗嗘搷浣�
+ },
],
};
},
@@ -283,8 +353,35 @@
totalUnread() {
return this.statsItems.reduce((sum, item) => sum + item.unread, 0);
},
+ // 鉁� Vuex 鍙屽悜缁戝畾
+ smsDialogVisible: {
+ get() {
+ return this.$store.state.sms.smsDialogVisible;
+ },
+ set(val) {
+ if (!val) {
+ this.$store.dispatch("sms/closeSmsDialog");
+ }
+ },
+ },
},
+ watch: {
+ // 鉁� 鐩戝惉 Vuex 瀵硅瘽妗嗙姸鎬�
+ "$store.state.sms.smsDialogVisible"(val) {
+ if (val) {
+ const patientData = this.$store.state.sms.patientData;
+ this.smsForm = { ...patientData };
+ this.smsContent = this.$store.state.sms.smsTemplate || "";
+ // 灞曞紑鎮诞鐞�
+ if (!this.isExpanded) {
+ this.isExpanded = true;
+ this.isHidden = false;
+ clearTimeout(this.hideTimer);
+ }
+ }
+ },
+ },
mounted() {
this.roles = this.$store.state.user.roles;
this.loadPosition();
@@ -424,6 +521,15 @@
},
handleActionClick(action) {
+ // 濡傛灉鏄煭淇″彂閫佹搷浣滐紝鎵撳紑瀵硅瘽妗�
+ console.log(action);
+
+ if (action.action === "openSmsDialog") {
+ this.openSmsDialog();
+ return;
+ }
+
+ // 鍘熸湁閫昏緫淇濇寔涓嶅彉
console.log(this.roles, "this.roles");
if (
action.url &&
@@ -435,7 +541,53 @@
this.$modal.msgError("闈炵鐞嗗憳鐢ㄦ埛鏆傛棤鍒涘缓浠诲姟鏉冮檺");
}
},
+ // 鎵撳紑鐭俊鍙戦�佸璇濇
+ openSmsDialog() {
+ // 浠庢偓娴悆鍐呴儴鎵撳紑鏃讹紝娓呯┖琛ㄥ崟锛堝洜涓烘病鏈夐�変腑鎮h�咃級
+ this.$store.dispatch("sms/openSmsDialog", {
+ name: "",
+ age: "",
+ phone: "",
+ deptName: "",
+ wardName: "",
+ smsTemplate: "",
+ });
+ },
+ // 鍙戦�佺煭淇�
+ async sendSms() {
+ if (!this.smsContent.trim()) {
+ this.$modal.msgError("璇疯緭鍏ョ煭淇″唴瀹�");
+ return;
+ }
+
+ if (!this.smsForm.telcode) {
+ this.$modal.msgError("鎮h�呯數璇濅笉鑳戒负绌�");
+ return;
+ }
+
+ this.smsLoading = true;
+ try {
+ const res = await sendMsg({
+ phone: this.smsForm.telcode,
+ content: this.smsContent,
+ });
+
+ if (res.code === 200) {
+ this.$modal.msgSuccess("鐭俊鍙戦�佹垚鍔�");
+ // 鉁� 閫氳繃 Vuex 鍏抽棴瀵硅瘽妗�
+ this.$store.dispatch("sms/closeSmsDialog");
+ this.smsContent = "";
+ } else {
+ this.$modal.msgError(res.msg || "鍙戦�佸け璐�");
+ }
+ } catch (error) {
+ console.error("鍙戦�佺煭淇″け璐�:", error);
+ this.$modal.msgError("鍙戦�佸け璐ワ紝璇风◢鍚庨噸璇�");
+ } finally {
+ this.smsLoading = false;
+ }
+ },
async updateStats() {
try {
// 杩欓噷鍙互鏇挎崲涓哄疄闄呯殑 API 璋冪敤
--
Gitblit v1.9.3