leadal-auth 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -0
- package/babel.config.js +5 -0
- package/jsconfig.json +19 -0
- package/ld-auth/demo.html +1 -0
- package/ld-auth/ld-auth.common.js +44730 -0
- package/ld-auth/ld-auth.css +1 -0
- package/ld-auth/ld-auth.umd.js +44730 -0
- package/ld-auth/ld-auth.umd.min.js +55 -0
- package/package.json +58 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +17 -0
- package/public/models/age_gender_model-shard1 +0 -0
- package/public/models/age_gender_model-weights_manifest.json +1 -0
- package/public/models/face_expression_model-shard1 +0 -0
- package/public/models/face_expression_model-weights_manifest.json +1 -0
- package/public/models/face_landmark_68_model-shard1 +0 -0
- package/public/models/face_landmark_68_model-weights_manifest.json +1 -0
- package/public/models/face_landmark_68_tiny_model-shard1 +0 -0
- package/public/models/face_landmark_68_tiny_model-weights_manifest.json +1 -0
- package/public/models/face_recognition_model-shard1 +0 -0
- package/public/models/face_recognition_model-shard2 +6 -0
- package/public/models/face_recognition_model-weights_manifest.json +1 -0
- package/public/models/mtcnn_model-shard1 +0 -0
- package/public/models/mtcnn_model-weights_manifest.json +1 -0
- package/public/models/ssd_mobilenetv1_model-shard1 +0 -0
- package/public/models/ssd_mobilenetv1_model-shard2 +145 -0
- package/public/models/ssd_mobilenetv1_model-weights_manifest.json +1 -0
- package/public/models/tiny_face_detector_model-shard1 +0 -0
- package/public/models/tiny_face_detector_model-weights_manifest.json +1 -0
- package/src/App.vue +19 -0
- package/src/api/card.js +58 -0
- package/src/api/face.js +37 -0
- package/src/api/finger.js +64 -0
- package/src/api/index.js +100 -0
- package/src/assets/BIN.png +0 -0
- package/src/assets/CLOSE.svg +11 -0
- package/src/assets/blue-left.png +0 -0
- package/src/assets/blue-right.png +0 -0
- package/src/assets/finger-ready.png +0 -0
- package/src/assets/finger-select.png +0 -0
- package/src/assets/finger-status-1-last.png +0 -0
- package/src/assets/finger-status-1.gif +0 -0
- package/src/assets/finger-status-2-last.png +0 -0
- package/src/assets/finger-status-2.gif +0 -0
- package/src/assets/finger-status-3-last.png +0 -0
- package/src/assets/finger-status-3.gif +0 -0
- package/src/assets/finger-status-compeleted.png +0 -0
- package/src/assets/finger-status-start.png +0 -0
- package/src/assets/icon-camera.png +0 -0
- package/src/assets/icon-picture.png +0 -0
- package/src/assets/icon-success.png +0 -0
- package/src/assets/img-camera.png +0 -0
- package/src/assets/img-card.png +0 -0
- package/src/assets/img-loading.png +0 -0
- package/src/assets/left.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/right.png +0 -0
- package/src/assets/ukey1.png +0 -0
- package/src/assets/ukey2.png +0 -0
- package/src/assets//346/214/207/347/272/271/350/257/206/345/210/2531.png +0 -0
- package/src/assets//346/214/207/347/272/271/350/257/206/345/210/2532.png +0 -0
- package/src/components/auth-com.vue +100 -0
- package/src/components/card-register/components/CardTable.vue +94 -0
- package/src/components/card-register/components/RegisterDialog.vue +137 -0
- package/src/components/card-register/index.vue +110 -0
- package/src/components/edit-user-dialog.vue +141 -0
- package/src/components/empty.vue +13 -0
- package/src/components/face-register/components/ChooseCameraOrPicture.vue +59 -0
- package/src/components/face-register/components/FaceDetected.vue +543 -0
- package/src/components/face-register/components/FaceInfo.vue +171 -0
- package/src/components/face-register/components/FacePicture.vue +85 -0
- package/src/components/face-register/components/UploadPicture.vue +336 -0
- package/src/components/face-register/index.vue +242 -0
- package/src/components/finger-register/index.vue +685 -0
- package/src/components/organ-tree.vue +211 -0
- package/src/components/tree-select.vue +131 -0
- package/src/components/user-drawer.vue +147 -0
- package/src/components/user-info.vue +272 -0
- package/src/components/user-table.vue +405 -0
- package/src/main.js +26 -0
- package/src/package/auth-manage/index.vue +461 -0
- package/src/package/index.js +22 -0
- package/src/store/index.js +39 -0
- package/src/styles/common.scss +183 -0
- package/src/styles/index.scss +38 -0
- package/src/utils/dict.js +47 -0
- package/src/utils/event-bus.js +6 -0
- package/src/utils/request-auth.js +64 -0
- package/src/utils/request.js +64 -0
- package/src/utils/websocket.js +282 -0
- package/vue.config.js +43 -0
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="organ-manage f_between">
|
|
3
|
+
<div class="organ-manage-tree">
|
|
4
|
+
<organ-tree @load-user-data="f_userData" :key="organTreeKey" />
|
|
5
|
+
</div>
|
|
6
|
+
<div class="organ-manage-main">
|
|
7
|
+
<user-table
|
|
8
|
+
ref="user-table"
|
|
9
|
+
:organ="drawerInfo.organ"
|
|
10
|
+
@drawer="h_setUserId"
|
|
11
|
+
@refreshTree="f_refreshTree"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
<user-drawer
|
|
15
|
+
v-if="visible"
|
|
16
|
+
:auth-collect="authCollect"
|
|
17
|
+
:drawer-info="drawerInfo"
|
|
18
|
+
@closed="h_setVisible"
|
|
19
|
+
@refresh="f_userData"
|
|
20
|
+
>
|
|
21
|
+
<template #face>
|
|
22
|
+
<slot name="face"> </slot>
|
|
23
|
+
</template>
|
|
24
|
+
<template #finger>
|
|
25
|
+
<slot name="finger"> </slot>
|
|
26
|
+
</template>
|
|
27
|
+
<template #idCard>
|
|
28
|
+
<slot name="idCard"> </slot>
|
|
29
|
+
</template>
|
|
30
|
+
</user-drawer>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import OrganTree from "@/components/organ-tree.vue";
|
|
36
|
+
import UserTable from "@/components/user-table.vue";
|
|
37
|
+
import UserDrawer from "@/components/user-drawer.vue";
|
|
38
|
+
import dayjs from "dayjs";
|
|
39
|
+
import WebSocketClient from "@/utils/websocket";
|
|
40
|
+
|
|
41
|
+
export default {
|
|
42
|
+
name: "auth-manage",
|
|
43
|
+
props: {
|
|
44
|
+
authCollect: {
|
|
45
|
+
required: false,
|
|
46
|
+
type: Array,
|
|
47
|
+
default: () => ["face", "finger", "idCard"],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
components: {
|
|
51
|
+
OrganTree,
|
|
52
|
+
UserTable,
|
|
53
|
+
UserDrawer,
|
|
54
|
+
},
|
|
55
|
+
// components: {
|
|
56
|
+
// OrganTree: () => import('@/components/organ-tree.vue'),
|
|
57
|
+
// UserTable: () => import('@/components/user-table.vue'),
|
|
58
|
+
// UserDrawer: () => import('@/components/user-drawer.vue')
|
|
59
|
+
// },
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
visible: false,
|
|
63
|
+
drawerInfo: {},
|
|
64
|
+
organTreeKey: "1",
|
|
65
|
+
websocket: null,
|
|
66
|
+
cardReader: null, // 当前读卡器设备名称
|
|
67
|
+
fingerprintDeviceCount: 0, // 指纹设备数量
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
mounted() {
|
|
71
|
+
// console.log("process.env.VERSION", process.env.VERSION);
|
|
72
|
+
console.log(
|
|
73
|
+
"LD-AUTH打包时间为",
|
|
74
|
+
dayjs(process.env.VERSION).format("YYYY-MM-DD HH:mm:ss")
|
|
75
|
+
);
|
|
76
|
+
this.$authEventBus.$on("startCollection", this.handleStartCollection);
|
|
77
|
+
// 初始化WebSocket连接
|
|
78
|
+
this.initWebSocket();
|
|
79
|
+
},
|
|
80
|
+
// 组件销毁时清理WebSocket连接
|
|
81
|
+
beforeDestroy() {
|
|
82
|
+
if (this.websocket) {
|
|
83
|
+
console.log("🔌 组件销毁,关闭WebSocket连接");
|
|
84
|
+
this.websocket.close();
|
|
85
|
+
this.websocket = null;
|
|
86
|
+
}
|
|
87
|
+
this.$authEventBus.$off("startCollection", this.handleStartCollection);
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
handleStartCollection() {
|
|
91
|
+
if (this.$store.getters.getFingerprintDeviceSN) {
|
|
92
|
+
const message = {
|
|
93
|
+
action: 1001,
|
|
94
|
+
};
|
|
95
|
+
this.websocket.send(message);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
// 初始化WebSocket连接
|
|
100
|
+
initWebSocket() {
|
|
101
|
+
try {
|
|
102
|
+
// 创建WebSocket实例
|
|
103
|
+
this.websocket = new WebSocketClient(`ws://10.1.22.32:38280`, {
|
|
104
|
+
reconnectInterval: 5000, // 重连间隔5秒
|
|
105
|
+
maxReconnectAttempts: 10, // 最大重连10次
|
|
106
|
+
heartbeatInterval: 120000, // 心跳间隔2分钟
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// 监听连接成功事件
|
|
110
|
+
this.websocket.on("open", () => {
|
|
111
|
+
// 连接成功后先检查读卡器连接状态
|
|
112
|
+
this.checkCardReaderConnection();
|
|
113
|
+
// 获取指纹设备SN码
|
|
114
|
+
this.getFingerprintDeviceSN();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// 监听消息接收事件
|
|
118
|
+
this.websocket.on("message", (data) => {
|
|
119
|
+
console.log("📨 收到WebSocket消息:", data);
|
|
120
|
+
this.handleWebSocketMessage(data);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// 监听连接错误事件
|
|
124
|
+
this.websocket.on("error", (error) => {
|
|
125
|
+
console.error("❌ WebSocket连接错误:", error);
|
|
126
|
+
this.$message?.error?.("WebSocket连接错误");
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// 监听连接关闭事件
|
|
130
|
+
this.websocket.on("close", (event) => {
|
|
131
|
+
console.log("🔌 WebSocket连接已关闭:", event.code, event.reason);
|
|
132
|
+
if (event.code !== 1000) {
|
|
133
|
+
// this.$message?.warning?.("WebSocket连接已断开,正在尝试重连...");
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// 监听重连失败事件
|
|
138
|
+
this.websocket.on("reconnectFailed", () => {
|
|
139
|
+
console.error("💥 WebSocket重连失败,已达最大重连次数");
|
|
140
|
+
this.$message?.error?.("WebSocket连接失败,请检查网络或联系管理员");
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// 开始连接
|
|
144
|
+
this.websocket.connect();
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.error("WebSocket初始化失败:", error);
|
|
147
|
+
this.$message?.error?.("WebSocket初始化失败");
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
// 处理WebSocket消息
|
|
152
|
+
handleWebSocketMessage(data) {
|
|
153
|
+
// 根据action处理读卡器相关消息
|
|
154
|
+
if (data.action) {
|
|
155
|
+
switch (data.action) {
|
|
156
|
+
case 1009:
|
|
157
|
+
// 获取指纹设备SN响应
|
|
158
|
+
this.handleFingerprintDeviceSNResponse(data);
|
|
159
|
+
break;
|
|
160
|
+
case 2001:
|
|
161
|
+
// 检查读卡器连接状态响应
|
|
162
|
+
this.handleCheckCardReaderResponse(data);
|
|
163
|
+
break;
|
|
164
|
+
case 2002:
|
|
165
|
+
// 获取读卡器列表响应
|
|
166
|
+
this.handleCardReaderListResponse(data);
|
|
167
|
+
break;
|
|
168
|
+
case 2003:
|
|
169
|
+
// 打开读卡器响应
|
|
170
|
+
this.handleOpenCardReaderResponse(data);
|
|
171
|
+
break;
|
|
172
|
+
case 2004:
|
|
173
|
+
// 读卡器状态更新
|
|
174
|
+
this.$authEventBus.$emit("card", data);
|
|
175
|
+
break;
|
|
176
|
+
case 1001:
|
|
177
|
+
// 开始采集指纹
|
|
178
|
+
this.$authEventBus.$emit("startCollectionMessage", data);
|
|
179
|
+
break;
|
|
180
|
+
default:
|
|
181
|
+
console.log("未知action类型:", data);
|
|
182
|
+
}
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// 根据消息类型处理不同的业务逻辑
|
|
187
|
+
switch (data.type) {
|
|
188
|
+
case "user_update":
|
|
189
|
+
// 用户信息更新
|
|
190
|
+
console.log("用户信息更新:", data.payload);
|
|
191
|
+
this.f_userData(); // 刷新用户数据
|
|
192
|
+
break;
|
|
193
|
+
case "organ_update":
|
|
194
|
+
// 组织架构更新
|
|
195
|
+
console.log("组织架构更新:", data.payload);
|
|
196
|
+
this.f_refreshTree(); // 刷新组织树
|
|
197
|
+
break;
|
|
198
|
+
case "auth_status":
|
|
199
|
+
// 认证状态更新
|
|
200
|
+
console.log("认证状态更新:", data.payload);
|
|
201
|
+
this.$message?.info?.(data.payload.message || "认证状态已更新");
|
|
202
|
+
break;
|
|
203
|
+
case "notification":
|
|
204
|
+
// 系统通知
|
|
205
|
+
console.log("系统通知:", data.payload);
|
|
206
|
+
this.$message?.info?.(data.payload.message || "收到系统通知");
|
|
207
|
+
break;
|
|
208
|
+
default:
|
|
209
|
+
console.log("未知消息类型:", data);
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
// 发送WebSocket消息
|
|
214
|
+
sendWebSocketMessage(type, payload = {}) {
|
|
215
|
+
if (this.websocket && this.websocket.isOpen()) {
|
|
216
|
+
const message = {
|
|
217
|
+
type,
|
|
218
|
+
payload,
|
|
219
|
+
timestamp: Date.now(),
|
|
220
|
+
};
|
|
221
|
+
this.websocket.send(message);
|
|
222
|
+
console.log("📤 发送WebSocket消息:", message);
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
// ===================指纹设备相关方法===================
|
|
227
|
+
|
|
228
|
+
// 获取指纹设备SN码
|
|
229
|
+
getFingerprintDeviceSN() {
|
|
230
|
+
console.log("🔢 获取指纹设备SN码...");
|
|
231
|
+
const message = {
|
|
232
|
+
action: 1009,
|
|
233
|
+
};
|
|
234
|
+
this.websocket.send(message);
|
|
235
|
+
console.log("📤 发送获取指纹设备SN码消息:", message);
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
// 处理指纹设备SN响应
|
|
239
|
+
handleFingerprintDeviceSNResponse(data) {
|
|
240
|
+
console.log("📊 收到指纹设备SN响应:", data);
|
|
241
|
+
|
|
242
|
+
if (data.status === 200 || data.result === 0) {
|
|
243
|
+
// 获取成功
|
|
244
|
+
const deviceSN = data.data?.sn || "";
|
|
245
|
+
|
|
246
|
+
if (deviceSN) {
|
|
247
|
+
console.log("✅ 获取到指纹设备SN:", deviceSN);
|
|
248
|
+
// 存储到Vuex
|
|
249
|
+
this.$store.dispatch("updateFingerprintDeviceSN", deviceSN);
|
|
250
|
+
} else {
|
|
251
|
+
console.warn("⚠️ 指纹设备SN为空");
|
|
252
|
+
this.$store.dispatch("updateFingerprintDeviceSN", "");
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
// 获取失败
|
|
256
|
+
console.error("❌ 获取指纹设备SN失败:", data.msg || "未知错误");
|
|
257
|
+
// this.$store.dispatch("updateFingerprintDeviceSN", "");
|
|
258
|
+
this.$message?.error?.("获取指纹设备SN失败,请检查指纹设备连接");
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
// 获取指纹设备状态
|
|
263
|
+
getFingerprintDeviceStatus() {
|
|
264
|
+
return {
|
|
265
|
+
deviceCount: this.fingerprintDeviceCount,
|
|
266
|
+
hasDevice: this.fingerprintDeviceCount > 0,
|
|
267
|
+
deviceSN: this.$store.getters.getFingerprintDeviceSN,
|
|
268
|
+
};
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
// 刷新指纹设备数量
|
|
272
|
+
refreshFingerprintDeviceCount() {
|
|
273
|
+
if (this.websocket && this.websocket.isOpen()) {
|
|
274
|
+
this.getFingerprintDeviceCount();
|
|
275
|
+
} else {
|
|
276
|
+
console.warn("WebSocket未连接,无法获取指纹设备数量");
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
// 刷新指纹设备SN
|
|
281
|
+
refreshFingerprintDeviceSN() {
|
|
282
|
+
if (this.websocket && this.websocket.isOpen()) {
|
|
283
|
+
this.getFingerprintDeviceSN();
|
|
284
|
+
} else {
|
|
285
|
+
console.warn("WebSocket未连接,无法获取指纹设备SN");
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
// 刷新所有指纹设备信息
|
|
290
|
+
refreshAllFingerprintInfo() {
|
|
291
|
+
if (this.websocket && this.websocket.isOpen()) {
|
|
292
|
+
this.getFingerprintDeviceCount();
|
|
293
|
+
this.getFingerprintDeviceSN();
|
|
294
|
+
} else {
|
|
295
|
+
console.warn("WebSocket未连接,无法获取指纹设备信息");
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
// ===================读卡器相关方法===================
|
|
300
|
+
|
|
301
|
+
// 检查读卡器连接状态
|
|
302
|
+
checkCardReaderConnection() {
|
|
303
|
+
console.log("🔍 检查读卡器连接状态...");
|
|
304
|
+
const message = {
|
|
305
|
+
action: 2001,
|
|
306
|
+
};
|
|
307
|
+
this.websocket.send(message);
|
|
308
|
+
console.log("📤 发送检查读卡器连接状态消息:", message);
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
// 处理检查读卡器连接状态响应
|
|
312
|
+
handleCheckCardReaderResponse(data) {
|
|
313
|
+
console.log("📊 收到读卡器连接状态响应:", data);
|
|
314
|
+
|
|
315
|
+
if (data.status === 200 || data.result === 0) {
|
|
316
|
+
// 检查成功
|
|
317
|
+
if (data.data && data.data.isOpen) {
|
|
318
|
+
// 读卡器已经打开
|
|
319
|
+
this.cardReader = data.data.devName || "读卡器";
|
|
320
|
+
console.log("✅ 读卡器已连接:", this.cardReader);
|
|
321
|
+
} else {
|
|
322
|
+
// 读卡器未打开,需要获取并打开读卡器
|
|
323
|
+
console.log("⚠️ 读卡器未连接,开始获取读卡器列表...");
|
|
324
|
+
this.getCardReaderList();
|
|
325
|
+
}
|
|
326
|
+
} else {
|
|
327
|
+
// 检查失败
|
|
328
|
+
console.error("❌ 检查读卡器状态失败:", data.msg || "未知错误");
|
|
329
|
+
this.$message?.error?.(`检查读卡器状态失败: ${data.msg || "未知错误"}`);
|
|
330
|
+
// 即使检查失败,也尝试获取读卡器列表
|
|
331
|
+
this.getCardReaderList();
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
// 获取读卡器列表
|
|
336
|
+
getCardReaderList() {
|
|
337
|
+
console.log("📡 请求获取读卡器列表...");
|
|
338
|
+
const message = {
|
|
339
|
+
action: 2002,
|
|
340
|
+
};
|
|
341
|
+
this.websocket.send(message);
|
|
342
|
+
console.log("📤 发送获取读卡器列表消息:", message);
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
// 处理读卡器列表响应
|
|
346
|
+
handleCardReaderListResponse(data) {
|
|
347
|
+
console.log("📋 收到读卡器列表响应:", data);
|
|
348
|
+
|
|
349
|
+
if (data.data && Array.isArray(data.data) && data.data.length > 0) {
|
|
350
|
+
// 有读卡器数据,取第一个作为默认读卡器
|
|
351
|
+
const cardReaderName = data.data[0];
|
|
352
|
+
console.log("🎯 找到读卡器:", cardReaderName);
|
|
353
|
+
this.$message?.success?.(`发现读卡器: ${cardReaderName}`);
|
|
354
|
+
|
|
355
|
+
// 自动打开第一个读卡器
|
|
356
|
+
this.openCardReader(cardReaderName);
|
|
357
|
+
} else {
|
|
358
|
+
console.warn("⚠️ 未找到可用的读卡器");
|
|
359
|
+
this.$message?.warning?.("未找到可用的读卡器");
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
// 打开读卡器
|
|
364
|
+
openCardReader(devName) {
|
|
365
|
+
const message = {
|
|
366
|
+
action: 2003,
|
|
367
|
+
devName: devName,
|
|
368
|
+
};
|
|
369
|
+
this.websocket.send(message);
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
// 处理打开读卡器响应
|
|
373
|
+
handleOpenCardReaderResponse(data) {
|
|
374
|
+
if (data.result === 0 || data.status === 200) {
|
|
375
|
+
// 打开成功
|
|
376
|
+
this.cardReader = data.devName || "读卡器";
|
|
377
|
+
} else {
|
|
378
|
+
// 打开失败
|
|
379
|
+
this.$message?.error?.(
|
|
380
|
+
`读卡器打开失败: ${data.message || data.error || "未知错误"}`
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
// 获取当前读卡器状态
|
|
386
|
+
getCardReaderStatus() {
|
|
387
|
+
return {
|
|
388
|
+
isConnected: !!this.cardReader,
|
|
389
|
+
deviceName: this.cardReader,
|
|
390
|
+
};
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
// 重新初始化读卡器
|
|
394
|
+
reinitCardReader() {
|
|
395
|
+
this.cardReader = null;
|
|
396
|
+
if (this.websocket && this.websocket.isOpen()) {
|
|
397
|
+
// 重新初始化时先检查连接状态
|
|
398
|
+
this.checkCardReaderConnection();
|
|
399
|
+
} else {
|
|
400
|
+
this.$message?.warning?.("WebSocket未连接,无法初始化读卡器");
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
// ===================设备管理通用方法===================
|
|
405
|
+
|
|
406
|
+
// 获取所有设备状态
|
|
407
|
+
getAllDeviceStatus() {
|
|
408
|
+
return {
|
|
409
|
+
fingerprint: this.getFingerprintDeviceStatus(),
|
|
410
|
+
cardReader: this.getCardReaderStatus(),
|
|
411
|
+
};
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
// 刷新所有设备状态
|
|
415
|
+
refreshAllDevices() {
|
|
416
|
+
if (this.websocket && this.websocket.isOpen()) {
|
|
417
|
+
this.refreshAllFingerprintInfo();
|
|
418
|
+
this.checkCardReaderConnection();
|
|
419
|
+
} else {
|
|
420
|
+
this.$message?.warning?.("WebSocket未连接,无法刷新设备状态");
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
|
|
424
|
+
f_refreshTree() {
|
|
425
|
+
this.organTreeKey = this.organTreeKey + 1;
|
|
426
|
+
},
|
|
427
|
+
f_userData(val) {
|
|
428
|
+
if (val) {
|
|
429
|
+
this.$set(this.drawerInfo, "organ", val);
|
|
430
|
+
}
|
|
431
|
+
this.$refs["user-table"].f_init(this.drawerInfo.organ);
|
|
432
|
+
},
|
|
433
|
+
h_setVisible() {
|
|
434
|
+
this.visible = false;
|
|
435
|
+
},
|
|
436
|
+
h_setUserId(val, row) {
|
|
437
|
+
this.$set(this.drawerInfo, "userId", val);
|
|
438
|
+
this.$set(this.drawerInfo, "row", row);
|
|
439
|
+
this.visible = true;
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
};
|
|
443
|
+
</script>
|
|
444
|
+
|
|
445
|
+
<style lang="scss" scoped>
|
|
446
|
+
.organ-manage {
|
|
447
|
+
width: 100%;
|
|
448
|
+
height: 100%;
|
|
449
|
+
position: relative;
|
|
450
|
+
|
|
451
|
+
.organ-manage-tree {
|
|
452
|
+
width: 300px;
|
|
453
|
+
height: 100%;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.organ-manage-main {
|
|
457
|
+
width: calc(100% - 320px);
|
|
458
|
+
height: 100%;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import authManage from "./auth-manage/index.vue"; // 引入封装好的组件
|
|
2
|
+
import store from "../store/index";
|
|
3
|
+
import "../styles/index.scss"; // 引入样式文件
|
|
4
|
+
import eventBus from "../utils/event-bus";
|
|
5
|
+
|
|
6
|
+
const install = function (Vue, opt = {}) {
|
|
7
|
+
if (install.installed) return;
|
|
8
|
+
Vue.component(authManage.name, authManage);
|
|
9
|
+
// 挂载 eventBus 到 Vue 原型上,确保组件内部可以使用
|
|
10
|
+
Vue.prototype.$authEventBus = eventBus;
|
|
11
|
+
if (opt.baseUrl) {
|
|
12
|
+
store.commit("SET_BASE_URL", opt.baseUrl);
|
|
13
|
+
}
|
|
14
|
+
if (opt.authUrl) {
|
|
15
|
+
store.commit("SET_AUTH_URL", opt.authUrl);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
install,
|
|
21
|
+
authManage,
|
|
22
|
+
}; // 这个方法以后再使用的时候就可以被use调用
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Vue from "vue";
|
|
2
|
+
import Vuex from "vuex";
|
|
3
|
+
|
|
4
|
+
Vue.use(Vuex);
|
|
5
|
+
|
|
6
|
+
export default new Vuex.Store({
|
|
7
|
+
state: {
|
|
8
|
+
baseUrl: "http://dftdm.netiler.com",
|
|
9
|
+
authUrl: "http://10.1.24.63:8080",
|
|
10
|
+
websocketUrl: "ws://127.0.0.1:38280",
|
|
11
|
+
fingerprintDeviceSN: "", // 指纹设备SN码
|
|
12
|
+
},
|
|
13
|
+
getters: {
|
|
14
|
+
// 获取指纹设备SN码
|
|
15
|
+
getFingerprintDeviceSN: (state) => state.fingerprintDeviceSN,
|
|
16
|
+
},
|
|
17
|
+
mutations: {
|
|
18
|
+
SET_BASE_URL(state, data) {
|
|
19
|
+
state.baseUrl = data;
|
|
20
|
+
},
|
|
21
|
+
SET_AUTH_URL(state, data) {
|
|
22
|
+
state.authUrl = data;
|
|
23
|
+
},
|
|
24
|
+
// 设置指纹设备SN码
|
|
25
|
+
SET_FINGERPRINT_DEVICE_SN(state, sn) {
|
|
26
|
+
state.fingerprintDeviceSN = sn;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
actions: {
|
|
30
|
+
// 更新指纹设备SN码
|
|
31
|
+
updateFingerprintDeviceSN({ commit }, sn) {
|
|
32
|
+
commit("SET_FINGERPRINT_DEVICE_SN", sn);
|
|
33
|
+
},
|
|
34
|
+
updateAuthUrl({ commit }, url) {
|
|
35
|
+
commit("SET_AUTH_URL", url);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
modules: {},
|
|
39
|
+
});
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
$pixel: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 30, 32, 36, 42, 48;
|
|
2
|
+
$position: top, right, bottom, left;
|
|
3
|
+
$position-class: "t", "r", "b", "l";
|
|
4
|
+
|
|
5
|
+
@each $item in $pixel {
|
|
6
|
+
@each $p in $position {
|
|
7
|
+
$index: index($position, $p);
|
|
8
|
+
$class: nth($position-class, $index);
|
|
9
|
+
|
|
10
|
+
.m#{$class}-#{$item} {
|
|
11
|
+
margin-#{$p}: $item + px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.p#{$class}-#{$item} {
|
|
15
|
+
padding-#{$p}: $item + px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.p-#{$item} {
|
|
19
|
+
padding: $item + px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.m-#{$item} {
|
|
23
|
+
margin: $item + px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.fs-#{$item} {
|
|
27
|
+
font-size: $item + px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.w-#{$item} {
|
|
31
|
+
width: $item + px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.h-#{$item} {
|
|
35
|
+
height: $item + px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.flex-center {
|
|
41
|
+
display: flex;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.flex-start {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: flex-start;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.flex-end {
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: flex-end;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.flex-between {
|
|
56
|
+
display: flex;
|
|
57
|
+
justify-content: space-between;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.flex-around {
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: space-around;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.cur-p {
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.no-wrap {
|
|
70
|
+
flex-wrap: nowrap;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.flex-wrap {
|
|
74
|
+
flex-wrap: nowrap;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.flex-1 {
|
|
78
|
+
flex: 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.fw-500 {
|
|
82
|
+
font-weight: 500;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.fw-bold {
|
|
86
|
+
font-weight: bold;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ui-button {
|
|
90
|
+
border: 0 !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.align-center {
|
|
94
|
+
align-items: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.loading-text {
|
|
98
|
+
color: white;
|
|
99
|
+
font-size: 18px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ld-c__empty {
|
|
103
|
+
padding: 10px 0;
|
|
104
|
+
margin: 0;
|
|
105
|
+
text-align: center;
|
|
106
|
+
color: #999;
|
|
107
|
+
font-size: 14px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.w100 {
|
|
111
|
+
width: 100%;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.h100 {
|
|
115
|
+
height: 100%;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.b-wt {
|
|
119
|
+
background: white;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.c-wt {
|
|
123
|
+
color: white;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.viewer-container {
|
|
127
|
+
z-index: 9999 !important;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.el-form-item__label {
|
|
131
|
+
color: #333 !important;
|
|
132
|
+
}
|
|
133
|
+
.el-input__inner {
|
|
134
|
+
color: #333 !important;
|
|
135
|
+
}
|
|
136
|
+
.el-input.is-disabled .el-input__inner {
|
|
137
|
+
color: #9a9a9a !important;
|
|
138
|
+
border-color: #e0e0e0 !important;
|
|
139
|
+
}
|
|
140
|
+
.el-textarea__inner {
|
|
141
|
+
color: #333 !important;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.el-textarea.is-disabled .el-textarea__inner {
|
|
145
|
+
color: #9a9a9a !important;
|
|
146
|
+
border-color: #e0e0e0 !important;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.dright-form {
|
|
150
|
+
width: 410px;
|
|
151
|
+
border-left: 1px solid #e0e0e0;
|
|
152
|
+
padding: 12px;
|
|
153
|
+
height: 100%;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.delete-btn {
|
|
157
|
+
background: #ff5656;
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
padding: 0px;
|
|
160
|
+
color: white;
|
|
161
|
+
border-radius: 50%;
|
|
162
|
+
height: 22px;
|
|
163
|
+
width: 22px;
|
|
164
|
+
line-height: -2px;
|
|
165
|
+
text-align: center;
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
|
|
168
|
+
&:hover {
|
|
169
|
+
background: #ff5656;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.send-footer {
|
|
174
|
+
height: auto !important;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.x-hidden {
|
|
178
|
+
overflow-x: hidden !important;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.op-05 {
|
|
182
|
+
opacity: 0.5;
|
|
183
|
+
}
|