Răsfoiți Sursa

feat: 优化门禁

liujt 2 săptămâni în urmă
părinte
comite
5d27e8cfdb

+ 12 - 0
src/api/‌doorSecurity‌/index.js

@@ -98,6 +98,18 @@ export async function getDeviceDetail(id) {
   return Promise.reject(new Error(res.data.message));
 }  
 
+/**
+ * 设备详情
+ * @param params 查询条件
+ */
+export async function loginHaiKan(id) {
+  const res = await request.get(`/mms/access/device/loginHaiKan/${id}`);
+  if (res.data.code == 0 && res.data.data) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}  
+
 /**
  * 设备新增
  * @param params 查询条件

+ 4 - 5
src/views/doorSecurity/doorLedger/components/addOrEditDialog.vue

@@ -35,11 +35,8 @@
       <el-form-item label="流名称" prop="stream">
         <el-input v-model="formData.stream" placeholder="请输入流名称" clearable />
       </el-form-item>
-      <!-- <el-form-item label="启用禁用" prop="enable">
-        <el-radio-group v-model="formData.enable">
-          <el-radio :label="0">启用</el-radio>
-          <el-radio :label="1">禁用</el-radio>
-        </el-radio-group>
+      <!-- <el-form-item label="门禁后台路径" prop="backendUrl">
+        <el-input v-model="formData.backendUrl" placeholder="请输入门禁后台路径" clearable />
       </el-form-item> -->
     </el-form>
     <span slot="footer" class="dialog-footer">
@@ -78,6 +75,7 @@ import { getDeviceDetail, saveDevice } from '@/api/‌doorSecurity‌';
           password: '',
           doorCount: 0,
           stream: '',
+          // backendUrl: '',
         },
         formRules: {
           deviceName: [
@@ -153,6 +151,7 @@ import { getDeviceDetail, saveDevice } from '@/api/‌doorSecurity‌';
             password: '',
             doorCount: 0,
             stream: '',
+            // backendUrl: '',
           };
         }
         this.$nextTick(() => {

+ 7 - 0
src/views/doorSecurity/doorLedger/components/detailDialog.vue

@@ -66,6 +66,13 @@
           </el-form-item>
         </el-col>
       </el-row>
+      <!-- <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="门禁后台路径">
+            <el-input v-model="formData.backendUrl" disabled />
+          </el-form-item>
+        </el-col>
+      </el-row> -->
     </el-form>
     <span slot="footer" class="dialog-footer">
       <el-button type="primary" @click="dialogVisible = false">关 闭</el-button>

+ 25 - 3
src/views/doorSecurity/doorLedger/index.vue

@@ -59,6 +59,12 @@
             {{ row.deviceName }}
           </el-link>
         </template>
+        <!-- 门禁后台路径 -->
+        <template v-slot:backendUrl="{ row }">
+          <el-link type="primary" :underline="false" :href="`https://${row.ipAddress}/`" target="_blank">
+            https://{{ row.ipAddress }}/
+          </el-link>
+        </template>
         <!-- 操作 -->
         <template v-slot:action="{ row }">
           <!-- <el-link
@@ -73,9 +79,9 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openJump(row)"
           >
-            修改
+            跳转
           </el-link> -->
           <el-popconfirm
             class="ele-action"
@@ -114,7 +120,7 @@
 <script>
   import seekPage from '@/BIZComponents/seekPage.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
-  import { listDoorLedger, removeDoorLedger, enableDoorLedger } from '@/api/‌doorSecurity‌';
+  import { listDoorLedger, removeDoorLedger, enableDoorLedger, loginHaiKan } from '@/api/‌doorSecurity‌';
   import addOrEditDialog from './components/addOrEditDialog.vue';
   import detailDialog from './components/detailDialog.vue';
 
@@ -214,6 +220,14 @@
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            minWidth: 120,
+            prop: 'backendUrl',
+            label: '门禁后台路径',
+            align: 'center',
+            showOverflowTooltip: true,
+            slot: 'backendUrl'
+          },
           {
             minWidth: 100,
             prop: 'status',
@@ -280,6 +294,14 @@
       }
     },
     methods: {
+      openJump(row) {
+        loginHaiKan(row.id).then((res) => {
+          console.log(res, 'res');
+          // window.open(res.backendUrl);
+        }).catch(() => {
+          
+        });
+      },
       /* 表格数据源 */
       datasource({ page, limit, where }) {
         return listDoorLedger({

+ 4 - 4
src/views/doorSecurity/personnelAuthorization/components/door-authorize.vue

@@ -234,13 +234,13 @@
     },
     watch: {
       visible(visible) {
-        console.log(visible, 'visible');
+        console.log(visible, 'visible', this.deviceInfo);
         if (visible) {
           if(this.deviceInfo) {
             this.form.isPermanent = this.deviceInfo.isPermanent;
-            this.form.validStart = this.deviceInfo.validStart;
-            this.form.validEnd = this.deviceInfo.validEnd;
-            this.form.validTime = [this.deviceInfo.validStart, this.deviceInfo.validEnd];
+            this.form.validStart = this.deviceInfo?.validStart || '';
+            this.form.validEnd = this.deviceInfo?.validEnd || '';
+            this.form.validTime = this.deviceInfo?.validStart ? [this.deviceInfo?.validStart, this.deviceInfo?.validEnd] : [];
           }
         } else {
           this.$refs.form?.clearValidate();

+ 14 - 5
src/views/doorSecurity/personnelAuthorization/components/door-bind.vue

@@ -1,6 +1,6 @@
 <!-- 用户编辑弹窗 -->
 <template>
-  <ele-modal
+  <!-- <ele-modal
     width="1100px"
     :visible="visible"
     :append-to-body="true"
@@ -9,7 +9,7 @@
     title="添加设备"
     @update:visible="updateVisible"
     :maxable="true"
-  >
+  > -->
     <el-form
       ref="form"
       :autoComplete="false"
@@ -49,7 +49,7 @@
             ref="table"
             :columns="columns"
             :datasource="datasource"
-            height="calc(100vh - 405px)"
+            height="calc(100vh - 330px)"
             style="margin-bottom: 10px"
             full-height="calc(100vh - 116px)"
             tool-class="ele-toolbar-form"
@@ -96,13 +96,13 @@
         </el-col>
       </el-row>
     </el-form>
-    <template v-slot:footer>
+    <!-- <template v-slot:footer>
       <el-button @click="updateVisible(false)">取消</el-button>
       <el-button type="primary" :loading="loading" @click="updateVisible(false)">
         确定
       </el-button>
     </template>
-  </ele-modal>
+  </ele-modal> -->
 </template>
 
 <script>
@@ -331,6 +331,15 @@
           this.$refs.form?.clearValidate();
           this.form = { ...this.defaultForm };
         }
+      },
+      list: {
+        handler(newVal) {
+          console.log(newVal, 'list changed');
+          if (this.$refs.table) {
+            this.reload();
+          }
+        },
+        deep: true
       }
     }
   };

+ 24 - 11
src/views/doorSecurity/personnelAuthorization/components/door-modal.vue

@@ -8,7 +8,8 @@
     custom-class="ele-dialog-form"
     title="门禁"
     @update:visible="updateVisible"
-    :maxable="true"
+    :maxable="false"
+    :fullscreen="true"
   >
     <el-form
       ref="form"
@@ -17,8 +18,8 @@
       :rules="rules"
       label-width="100px"
     >
-      <el-row>
-        <el-col :span="24" style="margin-bottom: 20px;">
+      <el-row :gutter="20">
+        <el-col :span="12" style="margin-bottom: 20px;">
           <!-- <el-form-item label="设备:" prop="deviceId">
             <el-select
               v-model="form.deviceId"
@@ -51,15 +52,27 @@
               >
               </el-option>
             </el-select> -->
-            <el-button type="primary" @click="handleBindDevice">添加设备</el-button>
+            <!-- <el-button type="primary" @click="handleBindDevice">添加设备</el-button> -->
+            <!-- 绑定 -->
+            <doorBind ref="doorBindRef" :current="current" :list="datasource" :visible.sync="showBind" @success="getData"></doorBind>
           <!-- </el-form-item> -->
         </el-col>
-        <el-col :span="24">
+        <el-col :span="12">
+          <el-form
+            ref="form"
+            :autoComplete="false"
+            :model="form1"
+            label-width="0"
+          >
+            <el-form-item label="" prop="deviceName">
+              已绑定设备
+            </el-form-item>
+          </el-form>
           <ele-pro-table
             ref="table"
             :columns="columns"
             :datasource="datasource"
-            height="calc(100vh - 405px)"
+            height="calc(100vh - 330px)"
             style="margin-bottom: 10px"
             full-height="calc(100vh - 116px)"
             tool-class="ele-toolbar-form"
@@ -108,15 +121,14 @@
       </el-row>
     </el-form>
     <template v-slot:footer>
-      <el-button @click="updateVisible(false)">取消</el-button>
-      <el-button type="primary" :loading="loading" @click="updateVisible(false)">
+      <el-button @click="updateVisible(false)">关闭</el-button>
+      <!-- <el-button type="primary" :loading="loading" @click="updateVisible(false)">
         确定
-      </el-button>
+      </el-button> -->
     </template>
     <!-- 授权 -->
     <doorAuthorize ref="doorAuthorizeRef" :current="current" :deviceInfo="deviceInfo" :list="datasource" :visible.sync="showAuthorize" @success="getData"></doorAuthorize>
-    <!-- 绑定 -->
-    <doorBind ref="doorBindRef" :current="current" :list="datasource" :visible.sync="showBind" @success="getData"></doorBind>
+    
   </ele-modal>
 </template>
 
@@ -141,6 +153,7 @@
         deviceId: '',
       };
       return {
+        form1: {},
         showAuthorize: false,
         deviceInfo: {},
         cacheKeyUrl: 'eos-64acd1e7-202605271646-user-door',

+ 1 - 1
src/views/doorSecurity/personnelAuthorization/components/org-user-list.vue

@@ -9,7 +9,7 @@
       height="calc(100vh - 265px)"
       full-height="calc(100vh - 116px)"
       tool-class="ele-toolbar-form"
-      :page-size="pageSize"
+      :page-size="20"
       row-key="id"
       :selection.sync="selection"
       @columns-change="handleColumnChange"