doum
13 小时以前 cb6aca0642ac8dd5de877ade168066d85acb589c
admin/src/views/business/deviceRole_f.vue
@@ -1,8 +1,8 @@
<template>
    <TableLayout :permissions="['business:company:query']">
    <TableLayout :permissions="['business:devicerole:query']">
        <!-- 搜索表单 -->
        <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
            <el-form-item label="门禁组名称" prop="name">
            <el-form-item title="门禁组名称" prop="name">
                <el-input v-model="searchForm.name" placeholder="请输入门禁组名称" @keypress.enter.native="search"></el-input>
            </el-form-item>
            <section>
@@ -13,32 +13,38 @@
        <!-- 表格和分页 -->
        <template v-slot:table-wrap>
            <ul class="toolbar">
                <li><el-button type="primary">同步</el-button></li>
                <li><el-button type="primary"  v-permissions="['business:hksync:privilege']" @click="synchronousData">同步</el-button></li>
            </ul>
            <el-table
                    v-loading="isWorking.search"
                    :data="tableData.list"
                    stripe
                    @selection-change="handleSelectionChange"
                :height="tableHeightNew"
                v-loading="isWorking.search"
                :data="tableData.list"
                stripe
                @selection-change="handleSelectionChange"
            >
                <el-table-column type="selection" width="55"></el-table-column>
                <el-table-column prop="name" label="门禁组名称" min-width="100px"></el-table-column>
                <el-table-column prop="name" label="适用用户类型" min-width="100px"></el-table-column>
                <el-table-column prop="name" label="使用人数" min-width="100px"></el-table-column>
                <el-table-column label="适用用户类型" min-width="100px">
                    <template slot-scope="{row}">
                        <span v-if="row.type === '0'">劳务访客</span>
                        <span v-if="row.type === '1'">普通访客</span>
                        <span v-if="row.type === '2'">内部人员</span>
                    </template>
                </el-table-column>
                <el-table-column prop="isDefault" label="是否默认" min-width="100px">
                    <template slot-scope="{row}">
                        <span v-if="row.isDefault === 1">是</span>
                        <span v-if="row.isDefault === 0">否</span>
                        <span v-if="row.isDefault === 0">是</span>
                        <span v-if="row.isDefault === 1">否</span>
                    </template>
                </el-table-column>
                <el-table-column
                    v-if="containPermissions(['business:company:update', 'business:company:delete'])"
                    v-if="containPermissions(['business:devicerole:update'])"
                    label="操作"
                    min-width="120"
                    fixed="right"
                >
                    <template slot-scope="{row}">
                        <el-button type="text" @click="$refs.operaDeviceRoleWindow.open('编辑门禁角色信息表', row)" icon="el-icon-edit" v-permissions="['business:company:update']">编辑</el-button>
                        <el-button type="text" @click="$refs.operaDeviceRoleWindow.open('编辑门禁角色信息表', row)" icon="el-icon-edit" v-permissions="['business:devicerole:update']">编辑</el-button>
                    </template>
                </el-table-column>
            </el-table>
@@ -59,6 +65,7 @@
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaDeviceRoleWindow from '@/components/business/OperaDeviceRoleFWindow'
import { syncPrivilege } from '@/api/business/deviceRole'
export default {
  name: 'DeviceRole',
  extends: BaseTable,
@@ -68,7 +75,7 @@
      // 搜索
      searchForm: {
        name: '',
        type: '1'
        type: '0,1'
      }
    }
  },
@@ -80,6 +87,23 @@
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    synchronousData () {
      this.$confirm('确认同步吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        syncPrivilege({})
          .then(res => {
            this.$message({ type: 'success', message:res || '同步成功' })
            this.search()
          })
      }).catch(() => {
      })
    }
  }
}
</script>