Przeglądaj źródła

refactor: 优化代码结构和配置,提升可维护性

- 更新生产环境和开发环境的API基础路径
- 修改设备命令接口,支持传递参数
- 移除Navbar组件中的未使用代码
- 统一分机号字段命名,提高代码一致性
- 优化设备信息展示,移除冗余图片
- 更新服务状态数据中的可执行文件名
- 刷新设备状态时增加返回参数
weieryang 7 miesięcy temu
rodzic
commit
9ea69b3ccc

+ 2 - 2
.env.development

6
 
6
 
7
 # 若依管理系统/开发环境
7
 # 若依管理系统/开发环境
8
 # VUE_APP_BASE_API = 'http://vue.ruoyi.vip/prod-api'
8
 # VUE_APP_BASE_API = 'http://vue.ruoyi.vip/prod-api'
9
-# VUE_APP_BASE_API = 'http://39.164.159.226:17071/prod-api'
10
-VUE_APP_BASE_API = 'http://192.168.1.11:17071/prod-api'
9
+VUE_APP_BASE_API = 'http://39.164.159.226:17071/prod-api'
10
+# VUE_APP_BASE_API = 'http://192.168.1.11:17071/prod-api'
11
 
11
 
12
 # 路由懒加载
12
 # 路由懒加载
13
 VUE_CLI_BABEL_TRANSPILE_MODULES = true
13
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 1 - 1
.env.production

5
 ENV = 'production'
5
 ENV = 'production'
6
 
6
 
7
 # 若依管理系统/生产环境
7
 # 若依管理系统/生产环境
8
-VUE_APP_BASE_API = 'http://192.168.1.16:17071/prod-api'
8
+VUE_APP_BASE_API = 'http://127.0.0.1:17071/prod-api'

+ 3 - 2
src/api/device/command.js

1
 import request from '@/utils/request'
1
 import request from '@/utils/request'
2
 
2
 
3
 // 执行命令
3
 // 执行命令
4
-export function execCommand(id) {
4
+export function execCommand(id, params = {}) {
5
     return request({
5
     return request({
6
         url: '/device/command/exec/' + id,
6
         url: '/device/command/exec/' + id,
7
-        method: 'get'
7
+        method: 'get',
8
+        params
8
     })
9
     })
9
 }
10
 }

+ 2 - 2
src/layout/components/Navbar.vue

12
           <div class="right-menu-item">
12
           <div class="right-menu-item">
13
             <span class="systemTime">{{ nowDate }}{{ nowTime }}</span>
13
             <span class="systemTime">{{ nowDate }}{{ nowTime }}</span>
14
           </div>
14
           </div>
15
-          <div class="right-menu-item  hover-effect" @click="alarem" style="width: 0.8rem">
15
+          <!-- <div class="right-menu-item  hover-effect" @click="alarem" style="width: 0.8rem">
16
             <el-badge :value="noDealCount" :hidden="hiddenNum" class="item">
16
             <el-badge :value="noDealCount" :hidden="hiddenNum" class="item">
17
               <i class="el-icon-bell"></i>
17
               <i class="el-icon-bell"></i>
18
             </el-badge>
18
             </el-badge>
19
-          </div>
19
+          </div> -->
20
           <screenfull id="screenfull" class="right-menu-item hover-effect" />
20
           <screenfull id="screenfull" class="right-menu-item hover-effect" />
21
           <div class="right-menu-item">
21
           <div class="right-menu-item">
22
           <el-divider direction="vertical"></el-divider>
22
           <el-divider direction="vertical"></el-divider>

+ 7 - 6
src/views/extension/index.vue

50
       <el-table-column label="设备IP" align="center" prop="deviceIp"/>
50
       <el-table-column label="设备IP" align="center" prop="deviceIp"/>
51
       <el-table-column label="分机号号段" align="center" prop="ext">
51
       <el-table-column label="分机号号段" align="center" prop="ext">
52
         <template slot-scope="scope">
52
         <template slot-scope="scope">
53
-          <span>{{ scope.row.ext_start }} - {{ scope.row.ext_end }}</span>
53
+          <span>{{ scope.row.extStart }} - {{ scope.row.extEnd }}</span>
54
         </template>
54
         </template>
55
       </el-table-column>
55
       </el-table-column>
56
       
56
       
88
             </el-form-item>
88
             </el-form-item>
89
           </el-col>
89
           </el-col>
90
           <el-col :span="12">
90
           <el-col :span="12">
91
-            <el-form-item label="起始分机号" prop="ext">
92
-              <el-input v-model="form.ext_start" placeholder="请输入分机号" />
91
+            <el-form-item label="起始分机号" prop="extStart">
92
+              <el-input v-model="form.extStart" placeholder="请输入分机号" />
93
             </el-form-item>
93
             </el-form-item>
94
           </el-col>
94
           </el-col>
95
           <el-col :span="12">
95
           <el-col :span="12">
96
-            <el-form-item label="结束分机号" prop="ext">
97
-              <el-input v-model="form.ext_end" placeholder="请输入分机号" />
96
+            <el-form-item label="结束分机号" prop="extEnd">
97
+              <el-input v-model="form.extEnd" placeholder="请输入分机号" />
98
             </el-form-item>
98
             </el-form-item>
99
           </el-col>
99
           </el-col>
100
         </el-row>
100
         </el-row>
155
       // 表单校验
155
       // 表单校验
156
       rules: {
156
       rules: {
157
         deviceIp: [{ required: true, message: '所属设备不能为空', trigger: ['blur', 'change'] }],
157
         deviceIp: [{ required: true, message: '所属设备不能为空', trigger: ['blur', 'change'] }],
158
-        ext: [{ required: true, message: '分机号不能为空', trigger: ['blur', 'change'] }],
158
+        extStart: [{ required: true, message: '起始分机号不能为空', trigger: ['blur', 'change'] }],
159
+        extEnd: [{ required: true, message: '结束分机号不能为空', trigger: ['blur', 'change'] }],
159
         
160
         
160
       },
161
       },
161
       showDept: false,
162
       showDept: false,

+ 9 - 8
src/views/index.vue

66
                         </el-dropdown-menu>
66
                         </el-dropdown-menu>
67
                       </el-dropdown> -->
67
                       </el-dropdown> -->
68
                       <div class="device-content" style="display: flex; flex-direction: column; height: 100%;">
68
                       <div class="device-content" style="display: flex; flex-direction: column; height: 100%;">
69
-                        <p class="device-name" style="font-size: 14px; margin-bottom: 8px;"><strong>{{ device.name
70
-                            }}</strong></p>
69
+                        <p class="device-name" style="font-size: 14px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"><strong>{{ device.name }}</strong></p>
71
                         <div class="device-detail" style="display: flex; height: 100%;">
70
                         <div class="device-detail" style="display: flex; height: 100%;">
72
-                          <div class="device-img" style="width: 80px; padding-right: 12px;">
71
+                          <!-- <div class="device-img" style="width: 80px; padding-right: 12px;">
73
                             <img src="@/assets/images/ippbx.png" alt=""
72
                             <img src="@/assets/images/ippbx.png" alt=""
74
                               style="max-height: 80px; object-fit: contain;" />
73
                               style="max-height: 80px; object-fit: contain;" />
75
-                          </div>
76
-                          <div class="device-info" style="width: 50%;">
74
+                          </div> -->
75
+                          <div class="device-info">
77
                             <p class="device-ip" style="font-size: 12px; color: #666; margin-bottom: 4px;">{{ device.ip
76
                             <p class="device-ip" style="font-size: 12px; color: #666; margin-bottom: 4px;">{{ device.ip
78
                               }}</p>
77
                               }}</p>
79
                             <el-tag v-if="device.status === null" type="info">未知</el-tag>
78
                             <el-tag v-if="device.status === null" type="info">未知</el-tag>
340
       // 服务状态数据
339
       // 服务状态数据
341
       services: [
340
       services: [
342
         { id: 1, name: 'py_api', exeName: 'api', status: 'stopped' },
341
         { id: 1, name: 'py_api', exeName: 'api', status: 'stopped' },
343
-        { id: 2, name: 'vc_control', exeName: 'app.exe', status: 'stopped' },
344
-        { id: 3, name: 'rec', exeName: 'filezilla.exe', status: 'stopped' },
342
+        { id: 2, name: 'vc_control', exeName: 'VCAPP.exe', status: 'stopped' },
343
+        { id: 3, name: 'rec', exeName: 'Rec.exe', status: 'stopped' },
345
       ],
344
       ],
346
       // 服务器信息
345
       // 服务器信息
347
       server: [],
346
       server: [],
477
     },
476
     },
478
     refreshDeviceStatus () {
477
     refreshDeviceStatus () {
479
       this.$modal.loading("操作中,请稍候!");
478
       this.$modal.loading("操作中,请稍候!");
480
-      execCommand(4).then(res => {
479
+      execCommand(4, {
480
+        isReturn: 1,
481
+      }).then(res => {
481
         // this.$modal.closeLoading();
482
         // this.$modal.closeLoading();
482
         console.log(res.msg.replace(/\r\n/g, '').replace(/""/g, '"'));
483
         console.log(res.msg.replace(/\r\n/g, '').replace(/""/g, '"'));
483
         console.log(JSON.parse(res.msg.replace(/\r\n/g, '').replace(/""/g, '"')), 'refreshDeviceStatus');
484
         console.log(JSON.parse(res.msg.replace(/\r\n/g, '').replace(/""/g, '"')), 'refreshDeviceStatus');