<template>
|
<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-input v-model="searchForm.name" placeholder="请输入门禁组名称" @keypress.enter.native="search"></el-input>
|
</el-form-item>
|
<section>
|
<el-button type="primary" @click="search">搜索</el-button>
|
<el-button @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<!-- 表格和分页 -->
|
<template v-slot:table-wrap>
|
<ul class="toolbar">
|
<li><el-button type="primary" @click="synchronousData">同步</el-button></li>
|
</ul>
|
<el-table
|
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 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 === 0">是</span>
|
<span v-if="row.isDefault === 1">否</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
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:devicerole:update']">编辑</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:pagination="tableData.pagination"
|
>
|
</pagination>
|
</template>
|
<!-- 新建/修改 -->
|
<OperaDeviceRoleWindow ref="operaDeviceRoleWindow" @success="handlePageChange"/>
|
</TableLayout>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
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,
|
components: { TableLayout, Pagination, OperaDeviceRoleWindow },
|
data () {
|
return {
|
// 搜索
|
searchForm: {
|
name: '',
|
type: '0,1'
|
}
|
}
|
},
|
created () {
|
this.config({
|
module: '门禁角色信息表',
|
api: '/business/deviceRole',
|
'field.id': 'id',
|
'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>
|