Преглед на файлове

用户管理新增门禁管理,先隐藏,不完善

liujt преди 2 седмици
родител
ревизия
350226087c

+ 75 - 0
src/api/system/‌doorSecurity‌/index.js

@@ -0,0 +1,75 @@
+import request from '@/utils/request';
+
+/**
+ * 绑定列表
+ * @param params 查询条件
+ */
+export async function listDoorUsers(params) {
+  const res = await request.get('/mms/acs/bind/list', {
+    params
+  });
+  if (res.data.code == 0 && res.data.data) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}  
+
+/**
+ * 设备台账
+ * @param params 菜单信息
+ */
+export async function listDevice(params) {
+  const res = await request.post(`/mms/access/device/list`, params);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 绑定
+ * @param params 菜单信息
+ */
+export async function bindDevice(params) {
+  const res = await request.post(`/mms/acs/bind/bind`, params);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 绑定
+ * @param params 菜单信息
+ */
+export async function editBind(params) {
+  const res = await request.post(`/mms/acs/bind/edit`, params);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+} 
+
+/**
+ * 同步
+ * @param params 菜单信息
+ */
+export async function syncDevice(id) {
+  const res = await request.post(`/mms/acs/bind/sync-pull/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 同步
+ * @param params 菜单信息
+ */
+export async function unbindDevice(id) {
+  const res = await request.post(`/mms/acs/bind/unbind/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 305 - 0
src/views/system/organization/components/door-authorize.vue

@@ -0,0 +1,305 @@
+<!-- 用户编辑弹窗 -->
+<template>
+  <ele-modal
+    width="600px"
+    :visible="visible"
+    :append-to-body="true"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    title="授权"
+    @update:visible="updateVisible"
+    :maxable="true"
+  >
+    <el-form
+      ref="form"
+      :autoComplete="false"
+      :model="form"
+      :rules="rules"
+      label-width="100px"
+    >
+      <el-row>
+        <el-col :span="24">
+          <el-form-item label="授权类型:" prop="isPermanent">
+            <el-radio-group v-model="form.isPermanent">
+              <el-radio :label="0">临时授权</el-radio>
+              <el-radio :label="1">长期授权</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24" v-if="form.isPermanent == 0">
+          <el-form-item label="授权有效期:" prop="validTime">
+            <el-date-picker
+                v-model="form.validTime"
+                type="daterange"
+                range-separator="至"
+                start-placeholder="开始日期"
+                end-placeholder="结束日期"
+                value-format="yyyy-MM-dd HH:mm:ss"
+                style="width: 100%"
+              >
+              </el-date-picker>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <template v-slot:footer>
+      <el-button @click="updateVisible(false)">取消</el-button>
+      <el-button type="primary" :loading="loading" @click="submitForm">
+        确定
+      </el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import { listDevice, bindDevice, editBind } from '@/api/system/‌doorSecurity‌'
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  export default {
+    components: {  },
+    mixins: [tabMixins],
+    props: {
+      // 弹窗是否打开
+      visible: Boolean,
+      // isUpdate: Boolean,
+      // 修改回显的数据
+      current: Object,
+      list: Array,
+      deviceInfo: Object,
+    },
+    data() {
+      const defaultForm = {
+        isPermanent: 0,
+        validStart: '',
+        validEnd: '',
+        validTime: [],
+      };
+      return {
+        cacheKeyUrl: 'eos-64acd1e7-202605281106-user-door-authorize',
+        selection: [],
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm },
+        // 表单验证规则
+        rules: {
+          isPermanent: [{ required: true, message: '请选择授权类型', trigger: 'blur' }],
+          validTime: [{ required: true, message: '请选择授权时间', trigger: 'blur' }],
+        },
+        // 提交状态
+        loading: false,
+        // 是否是修改
+        isUpdate: false,
+        userInfo: {
+          postName: '',
+        },
+        // datasource: [],
+        deviceOptions: [],
+        bindDeviceData: [],
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      },
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'deviceName',
+            label: '设备名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 200
+          },
+          {
+            prop: 'ipAddress',
+            label: '设备IP',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 160
+          },
+          {
+            prop: 'port',
+            label: '端口',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 130
+          },
+          {
+            prop: 'doorCount',
+            label: '门数',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 200,
+          },
+          {
+            prop: 'isBind',
+            label: '是否绑定',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            formatter: (row) => {
+              return row.isBind ? '已绑定' : '未绑定';
+            }
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            formatter: (row) => {
+              return row.status == 1 ? '在线' : '离线';
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 120,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ]
+      }
+    },
+    mounted() {
+
+    },
+    methods: {
+      async datasource({ page, limit, where, order }) {
+        console.log(this.list, 'this.list');
+        const res = await listDevice({ ...where, ...order, pageNum: page, size: limit });
+        // 与已绑定设备对比,标记绑定状态
+        if (res.list && this.list.length > 0) {
+          console.log(this.list, 'this.list~~~');
+          const bindDeviceIds = this.list.map(item => item.deviceId);
+          console.log(bindDeviceIds, 'bindDeviceIds');
+          res.list = res.list.map(item => ({
+            ...item,
+            isBind: bindDeviceIds.includes(item.id) ? true : false
+          }));
+        }
+        console.log(res, 'res');
+        return res;
+      },
+ 
+      bindUserDevice(row) {
+        console.log(row, 'row');
+        bindDevice({
+          deviceId: row.id,
+          userId: this.current.id,
+          jobNumber: this.current.jobNumber,
+        }).then(res => {
+          console.log(res, 'res');
+          this.$message({
+            message: '绑定成功',
+            type: 'success'
+          });
+          row.isBind = true;
+     
+          this.$emit('success');
+        }).catch(err => {
+          console.log(err, 'err');
+          // this.$message({
+          //   message: '绑定失败',
+          //   type: 'error'
+          // });
+        })
+      },
+
+      submitForm() {
+        this.$refs.form?.validate(valid => {
+          if (valid) {
+            this.loading = true;
+            editBind({
+              deviceId: this.deviceInfo.deviceId,
+              id: this.deviceInfo.id,
+              isPermanent: this.form.isPermanent,
+              jobNumber: this.current.jobNumber,
+              userId: this.current.id,
+              validEnd: this.form.validTime.length > 0 ? this.form.validTime[1] : '',
+              validStart: this.form.validTime.length > 0 ? this.form.validTime[0] : '',
+            }).then(res => {
+              this.loading = false;
+              this.$message({
+                message: '操作成功',
+                type: 'success'
+              });
+              this.$emit('success');
+              this.updateVisible(false);
+            }).catch(err => {
+              this.loading = false;
+              // this.$message({
+                //   message: '绑定失败',
+                //   type: 'error'
+                // });
+            })
+          }
+        })
+      },
+      /* 保存编辑 */
+      /* 更新visible */
+      updateVisible(value) {
+        this.$emit('update:visible', value);
+      },
+    },
+    watch: {
+      visible(visible) {
+        console.log(visible, 'visible');
+        if (visible) {
+        
+        } else {
+          this.$refs.form?.clearValidate();
+          this.form = { ...this.defaultForm };
+        }
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  :deep(.el-input--medium .el-input__inner) {
+    height: auto !important;
+  }
+  :deep(.el-table) {
+    .el-form-item {
+      margin-bottom: 0;
+    }
+  }
+  :deep(.organizationList .el-input__inner) {
+    border: 0;
+    background: none;
+  }
+  :deep(.organizationList .el-input__suffix) {
+    display: none;
+  }
+  :deep(.organizationList .el-tag) {
+    background: none;
+  }
+</style>

+ 352 - 0
src/views/system/organization/components/door-bind.vue

@@ -0,0 +1,352 @@
+<!-- 用户编辑弹窗 -->
+<template>
+  <ele-modal
+    width="1100px"
+    :visible="visible"
+    :append-to-body="true"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    title="添加设备"
+    @update:visible="updateVisible"
+    :maxable="true"
+  >
+    <el-form
+      ref="form"
+      :autoComplete="false"
+      :model="form"
+      :rules="rules"
+      label-width="100px"
+    >
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="设备名称:" prop="deviceName">
+            <el-input
+              clearable
+              :maxlength="200"
+              v-model="form.deviceName"
+              placeholder="请输入设备名称"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="" prop="deviceName">
+            <!-- <el-input
+              clearable
+              :maxlength="200"
+              v-model="form.deviceName"
+              placeholder="请输入设备名称"
+            /> -->
+            <el-button type="primary" @click="handleSearch">
+              查询
+            </el-button>
+            <el-button type="primary" @click="handleReset">
+              重置
+            </el-button>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            height="calc(100vh - 405px)"
+            style="margin-bottom: 10px"
+            full-height="calc(100vh - 116px)"
+            tool-class="ele-toolbar-form"
+            :selection.sync="selection"
+            :page-size="20"
+            @columns-change="handleColumnChange"
+            :cache-key="cacheKeyUrl"
+          >
+            <!-- 表头工具栏 -->
+            <template v-slot:toolbar>
+
+            </template>
+
+            <!-- 操作列 -->
+            <template v-slot:action="{ row }">
+              <el-link
+                v-if="!row.isBind"
+                type="primary"
+                :underline="false"
+                icon="el-icon-edit"
+                @click="bindUserDevice(row)"
+              >
+                绑定
+              </el-link>
+              <!-- <el-popconfirm
+                class="ele-action"
+                title="确定要删除此信息吗?"
+                v-if="
+                  (isNeed_process_is_close &&
+                    [0, 3].includes(row.reviewStatus)) ||
+                  !isNeed_process_is_close
+                "
+                @confirm="remove([row.id])"
+              >
+                <template v-slot:reference>
+                  <el-link type="danger" :underline="false" icon="el-icon-delete">
+                    删除
+                  </el-link>
+                </template>
+              </el-popconfirm> -->
+            </template>
+          </ele-pro-table>
+        </el-col>
+      </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>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import { getUserDetail } from '@/api/system/organization';
+  import { listDoorUsers, listDevice, bindDevice } from '@/api/system/‌doorSecurity‌'
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  export default {
+    components: {  },
+    mixins: [tabMixins],
+    props: {
+      // 弹窗是否打开
+      visible: Boolean,
+      // isUpdate: Boolean,
+      // 修改回显的数据
+      current: Object,
+      list: Array,
+    },
+    data() {
+      const defaultForm = {
+        deviceName: '',
+      };
+      return {
+        cacheKeyUrl: 'eos-64acd1e7-202605281106-user-door-bind',
+        selection: [],
+        statusOptions: [
+          { 
+            label: '待同步',
+            value: 0
+
+          },
+          {
+            label: '已同步',
+            value: 1
+          },
+          {
+            label: '失败',
+            value: 2
+          }
+        ],
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm },
+        // 表单验证规则
+        rules: {},
+        // 提交状态
+        loading: false,
+        // 是否是修改
+        isUpdate: false,
+        userInfo: {
+          postName: '',
+        },
+        // datasource: [],
+        deviceOptions: [],
+        bindDeviceData: []
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      },
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'deviceName',
+            label: '设备名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 200
+          },
+          {
+            prop: 'ipAddress',
+            label: '设备IP',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 160
+          },
+          {
+            prop: 'port',
+            label: '端口',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 130
+          },
+          {
+            prop: 'doorCount',
+            label: '门数',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 200,
+          },
+          {
+            prop: 'isBind',
+            label: '是否绑定',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            formatter: (row) => {
+              return row.isBind ? '已绑定' : '未绑定';
+            }
+          },
+          {
+            prop: 'status',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            formatter: (row) => {
+              return row.status == 1 ? '在线' : '离线';
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 120,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ]
+      }
+    },
+    mounted() {
+
+    },
+    methods: {
+      handleSearch() {
+        this.reload(this.form);
+      },
+      handleReset() {
+        this.form = { ...this.defaultForm };
+        this.reload(this.form);
+      },
+      async datasource({ page, limit, where, order }) {
+        console.log(this.list, 'this.list');
+        const res = await listDevice({ ...where, ...order, pageNum: page, size: limit });
+        // 与已绑定设备对比,标记绑定状态
+        if (res.list && this.list.length > 0) {
+          console.log(this.list, 'this.list~~~');
+          const bindDeviceIds = this.list.map(item => item.deviceId);
+          console.log(bindDeviceIds, 'bindDeviceIds');
+          res.list = res.list.map(item => ({
+            ...item,
+            isBind: bindDeviceIds.includes(item.id) ? true : false
+          }));
+        }
+        console.log(res, 'res');
+        return res;
+      },
+      reload(where) {
+        this.$refs.table.reload({ pageNum: 1, where: where });
+      },
+      bindUserDevice(row) {
+        console.log(row, 'row');
+        bindDevice({
+          deviceId: row.id,
+          userId: this.current.id,
+          jobNumber: this.current.jobNumber,
+        }).then(res => {
+          console.log(res, 'res');
+          this.$message({
+            message: '绑定成功',
+            type: 'success'
+          });
+          row.isBind = true;
+          this.reload();
+          this.$emit('success');
+        }).catch(err => {
+          console.log(err, 'err');
+          // this.$message({
+          //   message: '绑定失败',
+          //   type: 'error'
+          // });
+        })
+      },
+
+      async getUserDetail() {
+        if (!this.current.id) {
+          return;
+        }
+        this.userInfo = await getUserDetail(this.current.id);
+      },
+      /* 保存编辑 */
+      /* 更新visible */
+      updateVisible(value) {
+        this.$emit('update:visible', value);
+      },
+    },
+    watch: {
+      visible(visible) {
+        console.log(visible, 'visible');
+        if (visible) {
+          this.reload();
+        } else {
+          this.$refs.form?.clearValidate();
+          this.form = { ...this.defaultForm };
+        }
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  :deep(.el-input--medium .el-input__inner) {
+    height: auto !important;
+  }
+  :deep(.el-table) {
+    .el-form-item {
+      margin-bottom: 0;
+    }
+  }
+  :deep(.organizationList .el-input__inner) {
+    border: 0;
+    background: none;
+  }
+  :deep(.organizationList .el-input__suffix) {
+    display: none;
+  }
+  :deep(.organizationList .el-tag) {
+    background: none;
+  }
+</style>

+ 376 - 0
src/views/system/organization/components/door-modal.vue

@@ -0,0 +1,376 @@
+<!-- 用户编辑弹窗 -->
+<template>
+  <ele-modal
+    width="1100px"
+    :visible="visible"
+    :append-to-body="true"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    title="门禁"
+    @update:visible="updateVisible"
+    :maxable="true"
+  >
+    <el-form
+      ref="form"
+      :autoComplete="false"
+      :model="form"
+      :rules="rules"
+      label-width="100px"
+    >
+      <el-row>
+        <el-col :span="24" style="margin-bottom: 20px;">
+          <!-- <el-form-item label="设备:" prop="deviceId">
+            <el-select
+              v-model="form.deviceId"
+              placeholder="请选择"
+              style="width: 100%"
+              @change="handleDeviceChange"
+            >
+              <el-option
+                v-for="item in deviceOptions"
+                :key="item.id"
+                :label="item.deviceName"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+            
+          </el-form-item> -->
+          <!-- <el-form-item label="" prop="deviceId"> -->
+            <!-- <el-select
+              v-model="form.deviceId"
+              placeholder="请选择"
+              style="width: 100%"
+              @change="handleDeviceChange"
+            >
+              <el-option
+                v-for="item in deviceOptions"
+                :key="item.id"
+                :label="item.deviceName"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select> -->
+            <el-button type="primary" @click="handleBindDevice">添加设备</el-button>
+          <!-- </el-form-item> -->
+        </el-col>
+        <el-col :span="24">
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            height="calc(100vh - 405px)"
+            style="margin-bottom: 10px"
+            full-height="calc(100vh - 116px)"
+            tool-class="ele-toolbar-form"
+            :selection.sync="selection"
+            :page-size="20"
+            @columns-change="handleColumnChange"
+            :cache-key="cacheKeyUrl"
+            :needPage="false"
+          >
+            <!-- 表头工具栏 -->
+            <template v-slot:toolbar>
+
+            </template>
+
+            <!-- 操作列 -->
+            <template v-slot:action="{ row }">
+              <el-link
+                type="primary"
+                :underline="false"
+                @click="handleAuthorize(row)"
+              >
+                授权
+              </el-link>
+              <el-link
+                type="primary"
+                :underline="false"
+                @click="handleSync(row)"
+              >
+                同步
+              </el-link>
+              <el-popconfirm
+                class="ele-action"
+                title="确定要解绑吗?"
+                @confirm="unbind(row)"
+              >
+                <template v-slot:reference>
+                  <el-link type="danger" :underline="false">
+                    解绑
+                  </el-link>
+                </template>
+              </el-popconfirm>
+            </template>
+          </ele-pro-table>
+        </el-col>
+      </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>
+    </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>
+
+<script>
+  // import { emailReg, phoneReg } from 'ele-admin';
+  import doorAuthorize from './door-authorize.vue';
+  import doorBind from './door-bind.vue';
+  import { addUsers, putUsers, getById } from '@/api/system/user';
+  import { getUserDetail } from '@/api/system/organization';
+  import { listDoorUsers, listDevice, syncDevice, unbindDevice } from '@/api/system/‌doorSecurity‌'
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  export default {
+    components: { doorAuthorize, doorBind },
+    mixins: [tabMixins],
+    props: {
+      // 弹窗是否打开
+      visible: Boolean,
+      // 修改回显的数据
+      current: Object,
+    },
+    data() {
+      const defaultForm = {
+        deviceId: '',
+      };
+      return {
+        showAuthorize: false,
+        deviceInfo: {},
+        cacheKeyUrl: 'eos-64acd1e7-202605271646-user-door',
+        selection: [],
+        statusOptions: [
+          { 
+            label: '待同步',
+            value: 0
+
+          },
+          {
+            label: '已同步',
+            value: 1
+          },
+          {
+            label: '失败',
+            value: 2
+          }
+        ],
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm },
+        // 表单验证规则
+        rules: {},
+        // 提交状态
+        loading: false,
+        // 是否是修改
+        userInfo: {
+          postName: '',
+        },
+        datasource: [],
+        deviceOptions: [],
+        showBind: false,
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      },
+      columns() {
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'deviceName',
+            label: '设备名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 200
+          },
+          {
+            prop: 'ipAddress',
+            label: '设备IP',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 160
+          },
+          {
+            prop: 'port',
+            label: '端口',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: true,
+            minWidth: 130
+          },
+          {
+            prop: 'isPermanent',
+            label: '是否长期授权',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            formatter: (row) => {
+              return row.isPermanent === 1 ? '是' : '否';
+            }
+          },
+          {
+            prop: 'validStart',
+            label: '有效期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (row) => {
+              return row.validStart ? row.validStart + '~' + row.validEnd : '';
+            }
+          },
+          {
+            prop: 'syncStatus',
+            label: '状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            formatter: (row) => {
+              return this.statusOptions.find(item => item.value === row.syncStatus)?.label || '';
+            }
+          },
+          {
+            prop: 'syncMsg',
+            label: '同步日志',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 170
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 200,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          }
+        ]
+      }
+    },
+    mounted() {
+      console.log('mounted~~~');
+      // this.getData();
+    },
+    methods: {
+      unbind(row) {
+        unbindDevice(row.id).then(res => {
+          this.$message({
+            message: '解绑成功',
+            type: 'success'
+          });
+          this.getData();
+        }).catch(err => {
+        })
+      },
+      handleBindDevice() {
+        this.showBind = true;
+      },
+      async handleSync(row) {
+        await syncDevice(row.id);
+        this.$message({
+          message: '同步成功',
+          type: 'success'
+        });
+        this.getData();
+      },
+      handleAuthorize(row) {
+        this.deviceInfo = row;
+        this.showAuthorize = true;
+        console.log(row, 'row');
+      },
+      handleDeviceChange(val) {
+        console.log(val, 'val');
+        this.getData();
+      },
+      getData() {
+        listDoorUsers({ userId: this.current.id, ...this.form }).then(res => {
+          console.log(res, 'res');
+          this.datasource = res;
+        })
+      },
+      getDeviceList() {
+        listDevice({
+          size: 9999,
+          pageNum: 1,
+        }).then(res => {
+          console.log(res, 'res');
+          this.deviceOptions = res.list;
+        })
+      },
+      async getUserDetail() {
+        if (!this.form.mainUserId) {
+          return;
+        }
+        this.userInfo = await getUserDetail(this.form.mainUserId);
+      },
+      /* 更新visible */
+      updateVisible(value) {
+        this.$emit('update:visible', value);
+      },
+    },
+    watch: {
+      visible(visible) {
+        console.log(visible, 'visible');
+        if (visible) {
+          this.getDeviceList();
+          this.getData();
+        } else {
+          this.$refs.form?.clearValidate();
+          this.form = { ...this.defaultForm };
+        }
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  :deep(.el-input--medium .el-input__inner) {
+    height: auto !important;
+  }
+  :deep(.el-table) {
+    .el-form-item {
+      margin-bottom: 0;
+    }
+  }
+  :deep(.organizationList .el-input__inner) {
+    border: 0;
+    background: none;
+  }
+  :deep(.organizationList .el-input__suffix) {
+    display: none;
+  }
+  :deep(.organizationList .el-tag) {
+    background: none;
+  }
+</style>

+ 19 - 2
src/views/system/organization/components/org-user-list.vue

@@ -119,6 +119,14 @@
         >
           新建账号
         </el-link>
+        <!-- <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-key"
+          @click="openDoor(row)"
+        >
+          门禁
+        </el-link> -->
         <el-popconfirm
           class="ele-action"
           title="确定要删除此用户吗?"
@@ -199,6 +207,7 @@
       ref="criticalProcessRef"
       @chooseProcess="chooseProcess"
     ></critical-process>
+    <DoorModal ref="doorModalRef" :visible.sync="showDoor" :current="current" />
   </div>
 </template>
 
@@ -220,6 +229,7 @@
   import dictMixins from '@/mixins/dictMixins';
   import { getFactoryarea } from '@/api/factoryModel';
   import criticalProcess from './criticalProcess.vue';
+  import DoorModal from './door-modal.vue';
 
   export default {
     mixins: [tabMixins, dictMixins],
@@ -229,7 +239,8 @@
       OrgUserEdit,
       addUsers,
       UserSearch,
-      criticalProcess
+      criticalProcess,
+      DoorModal
     },
     props: {
       // 机构id
@@ -386,7 +397,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 200,
+            width: 260,
             align: 'left',
             resizable: false,
             fixed: 'right',
@@ -398,6 +409,7 @@
     },
     data() {
       return {
+        showDoor: false,
         moudleName: 'mainUser',
         showEdit1: false,
         userShow: false,
@@ -487,6 +499,11 @@
       };
     },
     methods: {
+      openDoor(row) {
+        console.log(row);
+        this.current = row;
+        this.showDoor = true;
+      },
       allPushBtn() {
         const dataId = this.selection.map((v) => v.id);
         employeePush(dataId)