From 3ae495d3c3e95019b9e0066aae3c3b35802c51fe Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期一, 07 七月 2025 16:24:12 +0800
Subject: [PATCH] 测试完成

---
 dist.zip                                          |    0 
 src/store/modules/user.js                         |    5 +
 src/views/followvisit/again/index.vue             |   13 ++
 src/views/followvisit/record/detailpage/index.vue |    4 
 src/views/sfstatistics/percentage/index.vue       |   27 +++--
 src/utils/sipService.js                           |   78 ++++++++++----
 src/views/patient/patient/index.vue               |    2 
 src/components/CallButton/index.vue               |  124 ++++++++++++++++--------
 src/store/getters.js                              |    1 
 src/views/followvisit/discharge/index.vue         |    2 
 10 files changed, 173 insertions(+), 83 deletions(-)

diff --git a/dist.zip b/dist.zip
new file mode 100644
index 0000000..f3c1fd2
--- /dev/null
+++ b/dist.zip
Binary files differ
diff --git a/src/components/CallButton/index.vue b/src/components/CallButton/index.vue
index 57690ea..6ff7055 100644
--- a/src/components/CallButton/index.vue
+++ b/src/components/CallButton/index.vue
@@ -1,29 +1,23 @@
 <template>
   <div class="call-container">
+    <div class="sip-status" :class="sipStatusClass">
+      SIP鐘舵��: {{ sipStatus }}
+    </div>
     <!-- 鍙风爜杈撳叆 -->
     <input
       v-model="phoneNumber"
       type="text"
       placeholder="杈撳叆鐢佃瘽鍙风爜"
       @keyup.enter="startCall"
-    >
+    />
 
     <!-- 鍛煎彨鎸夐挳 -->
-    <button
-      :class="['call-btn', { 'calling': isCalling }]"
-      @click="startCall"
-    >
-      {{ isCalling ? '閫氳瘽涓�...' : '涓�閿懠鍙�' }}
+    <button :class="['call-btn', { calling: isCalling }]" @click="startCall">
+      {{ isCalling ? "閫氳瘽涓�..." : "涓�閿懠鍙�" }}
     </button>
 
     <!-- 鎸傛柇鎸夐挳 -->
-    <button
-      v-if="isCalling"
-      class="end-call-btn"
-      @click="endCall"
-    >
-      鎸傛柇
-    </button>
+    <button v-if="isCalling" class="end-call-btn" @click="endCall">鎸傛柇</button>
 
     <!-- 闊抽鍏冪礌锛堥殣钘忥級 -->
     <audio id="remoteAudio" autoplay></audio>
@@ -36,60 +30,80 @@
 </template>
 
 <script>
-import sipService from '@/utils/sipService'
+import sipService from "@/utils/sipService";
 
 export default {
   data() {
     return {
-      phoneNumber: '',
+      phoneNumber: "",
       isCalling: false,
-      callStatus: '鍑嗗灏辩华',
+      callStatus: "鍑嗗灏辩华",
+      sipStatus: "鏈繛鎺�",
+      sipStatusClass: "status-disconnected",
       sipConfig: {
-        wsUrl: 'wss://192.168.100.6:7443',
-        sipUri: '1000@192.168.100.6',
-        password: 'Smartor@2023',
-        displayName: 'Web 灏忛緳',
-        realm: '192.168.100.6:8090'
-      }
-    }
+        wsUrl: "wss://192.168.100.6:7443",
+        sipUri: "1000@192.168.100.6",
+        password: "Smartor@2023",
+        displayName: "Web 灏忛緳",
+        realm: "192.168.100.6:8090",
+      },
+    };
   },
   mounted() {
+    // 娴嬭瘯
+    const ws = new WebSocket("wss://192.168.100.6:7443");
+    ws.onopen = () => console.log("WebSocket 杩炴帴鎴愬姛");
+    ws.onerror = (e) => console.error("WebSocket 閿欒:", e);
+
+
     // 鍒濆鍖朣IP杩炴帴
-    sipService.init(this.sipConfig)
+
+    sipService.init(this.sipConfig);
+    sipService.onStatusChange = (status) => {
+      this.sipStatus = status.text;
+      this.sipStatusClass = `status-${status.type}`;
+
+      // 鏍规嵁鐘舵�佹洿鏂癠I鎴栨墽琛屽叾浠栨搷浣�
+      if (status.type === "registered") {
+        console.log("SIP娉ㄥ唽鎴愬姛锛屽彲浠ュ紑濮嬪懠鍙�");
+      } else if (status.type === "failed") {
+        console.error("SIP娉ㄥ唽澶辫触");
+      }
+    };
   },
   beforeDestroy() {
     // 缁勪欢閿�姣佹椂缁撴潫閫氳瘽
-    this.endCall()
+    this.endCall();
   },
   methods: {
     // 寮�濮嬪懠鍙�
     async startCall() {
       if (!this.phoneNumber) {
-        this.callStatus = '璇疯緭鍏ョ數璇濆彿鐮�'
-        return
+        this.callStatus = "璇疯緭鍏ョ數璇濆彿鐮�";
+        return;
       }
       try {
-        this.isCalling = true
-        this.callStatus = '鍛煎彨涓�...'
+        this.isCalling = true;
+        this.callStatus = "鍛煎彨涓�...";
         // 璋冪敤SIP鏈嶅姟
-        sipService.makeCall(this.phoneNumber)
+        sipService.makeCall(this.phoneNumber);
 
-        this.callStatus = '閫氳瘽宸插缓绔�'
+        this.callStatus = "閫氳瘽宸插缓绔�";
       } catch (error) {
-        console.error('鍛煎彨澶辫触:', error)
-        this.callStatus = `鍛煎彨澶辫触: ${error.message}`
-        this.isCalling = false
+        console.error("鍛煎彨澶辫触:", error);
+        this.callStatus = `鍛煎彨澶辫触: ${error.message}`;
+        this.isCalling = false;
       }
     },
 
     // 缁撴潫閫氳瘽
     endCall() {
-      sipService.endCall()
-      this.isCalling = false
-      this.callStatus = '閫氳瘽宸茬粨鏉�'
-    }
-  }
-}
+      sipService.endCall();
+      this.isCalling = false;
+      this.callStatus = "閫氳瘽宸茬粨鏉�";
+    },
+  },
+};
 </script>
 
 <style scoped>
@@ -112,7 +126,7 @@
 
 .call-btn {
   padding: 10px;
-  background-color: #4CAF50;
+  background-color: #4caf50;
   color: white;
   border: none;
   border-radius: 4px;
@@ -124,7 +138,7 @@
 }
 
 .call-btn.calling {
-  background-color: #2196F3;
+  background-color: #2196f3;
 }
 
 .end-call-btn {
@@ -145,4 +159,30 @@
   font-size: 14px;
   color: #666;
 }
+.sip-status {
+  padding: 8px;
+  margin-bottom: 10px;
+  border-radius: 4px;
+  text-align: center;
+}
+
+.status-disconnected {
+  background-color: #ffebee;
+  color: #c62828;
+}
+
+.status-connecting {
+  background-color: #fff8e1;
+  color: #ff8f00;
+}
+
+.status-registered {
+  background-color: #e8f5e9;
+  color: #2e7d32;
+}
+
+.status-failed {
+  background-color: #ffebee;
+  color: #c62828;
+}
 </style>
diff --git a/src/store/getters.js b/src/store/getters.js
index c59295e..8e3a768 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -8,6 +8,7 @@
   token: (state) => state.user.token,
   avatar: (state) => state.user.avatar,
   name: (state) => state.user.name,
+  nickName: (state) => state.user.nickName,
   Id: (state) => state.user.Id,
   introduction: (state) => state.user.introduction,
   roles: (state) => state.user.roles,
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 524f4de..a64959d 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -5,6 +5,7 @@
   state: {
     token: getToken(),
     name: '',
+    nickName:'',
     Id: '',
     avatar: '',
     hisUserId:'',
@@ -87,6 +88,9 @@
     SET_NAME: (state, name) => {
       state.name = name
     },
+    SET_nickNAME: (state, name) => {
+      state.nickName = name
+    },
     SET_Id: (state, Id) => {
       state.Id = Id
       console.log(state.Id,'user2');
@@ -168,6 +172,7 @@
             commit('SET_ROLES', ['ROLE_DEFAULT'])
           }
           commit('SET_NAME', user.userName)
+          commit('SET_nickNAME', user.nickName)
           commit('SET_Id', user.userId)
           commit('SET_hisUserId', user.hisUserId)
           commit('SET_leavehospitaldistrictcodes', user.belongWards)
diff --git a/src/utils/sipService.js b/src/utils/sipService.js
index 95ac836..9c095dd 100644
--- a/src/utils/sipService.js
+++ b/src/utils/sipService.js
@@ -4,42 +4,72 @@
   constructor() {
     this.ua = null
     this.currentSession = null
+    this.onStatusChange = null // 鐘舵�佸彉鍖栧洖璋�
   }
 
   // 鍒濆鍖朣IP瀹㈡埛绔�
   init(config) {
-    this.ua = new JsSIP.UA({
-      sockets: [new JsSIP.WebSocketInterface(config.wsUrl)],
-      uri: config.sipUri,
-      password: config.password,
-      display_name: config.displayName,
-      realm: config.realm,
-      ha1: config.ha1,
-      register: true
-    })
+    try {
+      this.updateStatus('connecting', '杩炴帴涓�...')
 
-    this.ua.start()
+      this.ua = new JsSIP.UA({
+        sockets: [new JsSIP.WebSocketInterface(config.wsUrl)],
+        uri: config.sipUri,
+        password: config.password,
+        display_name: config.displayName,
+        realm: config.realm,
+        register: true,
+        register_expires: 300, // 娉ㄥ唽鏈夋晥鏈�(绉�)
+        connection_recovery_min_interval: 2, // 鏈�灏忛噸杩為棿闅�
+        connection_recovery_max_interval: 30 // 鏈�澶ч噸杩為棿闅�
+      })
 
-    // 娉ㄥ唽浜嬩欢鐩戝惉
-    this.ua.on('registered', () => {
-      console.log('SIP娉ㄥ唽鎴愬姛')
-    })
+      this.ua.start()
 
-    this.ua.on('registrationFailed', (e) => {
-      console.error('SIP娉ㄥ唽澶辫触:', e)
-    })
+      // 娉ㄥ唽浜嬩欢鐩戝惉
+      this.ua.on('registered', () => {
+        this.updateStatus('registered', '宸叉敞鍐�')
+      })
 
-    // 鐩戝惉鏉ョ數
-    this.ua.on('newRTCSession', (data) => {
-      this.handleIncomingCall(data.session)
-    })
+      this.ua.on('registrationFailed', (e) => {
+        this.updateStatus('failed', `娉ㄥ唽澶辫触: ${e.cause}`)
+      })
+
+      this.ua.on('disconnected', () => {
+        this.updateStatus('disconnected', '杩炴帴鏂紑')
+      })
+
+      this.ua.on('connected', () => {
+        this.updateStatus('connecting', '閲嶆柊杩炴帴涓�...')
+      })
+
+      // 鐩戝惉鏉ョ數
+      this.ua.on('newRTCSession', (data) => {
+        this.handleIncomingCall(data.session)
+      })
+
+    } catch (error) {
+      this.updateStatus('failed', `鍒濆鍖栧け璐�: ${error.message}`)
+      console.error('SIP鍒濆鍖栧け璐�:', error)
+    }
   }
 
-  // 涓�閿嫧鍙�
+  // 鏇存柊鐘舵�佸苟閫氱煡UI
+  updateStatus(type, text) {
+    console.log(`SIP鐘舵�佹洿鏂�: ${type} - ${text}`)
+    if (this.onStatusChange) {
+      this.onStatusChange({ type, text })
+    }
+  }
+
+  // 涓�閿嫧鍙� - 澧炲姞娉ㄥ唽鐘舵�佹鏌�
   makeCall(targetNumber) {
     if (!this.ua) {
-      console.error('SIP瀹㈡埛绔湭鍒濆鍖�')
-      return
+      throw new Error('SIP瀹㈡埛绔湭鍒濆鍖�')
+    }
+
+    if (!this.ua.isRegistered()) {
+      throw new Error('SIP鏈敞鍐岋紝鏃犳硶鍛煎彨')
     }
 
     const options = {
diff --git a/src/views/followvisit/again/index.vue b/src/views/followvisit/again/index.vue
index 082669a..bccd382 100644
--- a/src/views/followvisit/again/index.vue
+++ b/src/views/followvisit/again/index.vue
@@ -644,7 +644,17 @@
             </el-form-item>
           </el-col>
         </el-row>
-
+<el-row >
+          <el-col :span="8">
+            <el-form-item label="杩囨护鍖荤敓" width="100" prop="filterDrname">
+              <el-input
+                v-model="form.filterDrname"
+                placeholder="璇疯緭鍏ュ尰鐢熷鍚�"
+                maxlength="30"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-row>
           <el-col :span="24">
             <el-form-item label="杩囨护鍘熷洜">
@@ -1590,6 +1600,7 @@
     handleUpdate(row) {
       particularpatient(row.patid).then((response) => {
         this.form = response.data;
+        this.form.filterDrname = store.getters.nickName;
       });
       this.amendtag = true;
       this.Labelchange = true;
diff --git a/src/views/followvisit/discharge/index.vue b/src/views/followvisit/discharge/index.vue
index dfe82c7..55b8e24 100644
--- a/src/views/followvisit/discharge/index.vue
+++ b/src/views/followvisit/discharge/index.vue
@@ -1828,7 +1828,7 @@
     handleUpdate(row) {
       particularpatient(row.patid).then((response) => {
         this.form = response.data;
-        this.form.filterDrname = store.getters.name;
+        this.form.filterDrname = store.getters.nickName;
       });
       this.amendtag = true;
       this.Labelchange = true;
diff --git a/src/views/followvisit/record/detailpage/index.vue b/src/views/followvisit/record/detailpage/index.vue
index 0cffc18..05807cb 100644
--- a/src/views/followvisit/record/detailpage/index.vue
+++ b/src/views/followvisit/record/detailpage/index.vue
@@ -353,10 +353,10 @@
         </el-collapse>
       </div>
     </div>
-    <div>
+    <!-- <div>
       <h2>涓�閿懠鍙姛鑳�</h2>
       <CallButton/>
-    </div>
+    </div> -->
     <div>
       <el-tabs v-model="activeName" type="border-card">
         <el-tab-pane name="wj">
diff --git a/src/views/patient/patient/index.vue b/src/views/patient/patient/index.vue
index 631acb8..7236eb1 100644
--- a/src/views/patient/patient/index.vue
+++ b/src/views/patient/patient/index.vue
@@ -1297,7 +1297,7 @@
       const userIds = row.id || this.ids;
       particularpatient(userIds).then((response) => {
         this.form = response.data;
-        this.form.filterDrname = store.getters.name;
+        this.form.filterDrname = store.getters.nickName;
       });
       this.amendtag = true;
       this.Labelchange = true;
diff --git a/src/views/sfstatistics/percentage/index.vue b/src/views/sfstatistics/percentage/index.vue
index 8b1537d..123346b 100644
--- a/src/views/sfstatistics/percentage/index.vue
+++ b/src/views/sfstatistics/percentage/index.vue
@@ -125,6 +125,7 @@
               >
                 <el-date-picker
                   v-model="queryParams.dateRange"
+                  value-format="yyyy-MM-dd"
                   type="daterange"
                   range-separator="鑷�"
                   start-placeholder="寮�濮嬫棩鏈�"
@@ -608,18 +609,18 @@
     // 鑾峰彇绉戝鏍�
     getDeptTree() {
       // 绉戝鍒楄〃
-       this.flatArraydept = store.getters.belongDepts.map((dept) => {
-      return {
-        label: dept.deptName,
-        value: dept.deptCode,
-      };
-    });
-    this.flatArrayhospit = store.getters.belongWards.map((dept) => {
-      return {
-        label: dept.districtName,
-        value: dept.districtCode,
-      };
-    });
+      this.flatArraydept = store.getters.belongDepts.map((dept) => {
+        return {
+          label: dept.deptName,
+          value: dept.deptCode,
+        };
+      });
+      this.flatArrayhospit = store.getters.belongWards.map((dept) => {
+        return {
+          label: dept.districtName,
+          value: dept.districtCode,
+        };
+      });
       // deptTreeSelect().then((response) => {
       //   this.deptOptions = response.data;
       //   console.log(this.deptOptions, " this.deptOptions");
@@ -731,6 +732,8 @@
       } else if (this.queryParams.statisticaltype == 2) {
         this.queryParams.leavehospitaldistrictcodes = [];
       }
+      console.log(this.queryParams.dateRange);
+
       this.queryParams.startTime = this.parseTime(
         this.queryParams.dateRange[0]
       );

--
Gitblit v1.9.3