Browse Source

数据权限功能提交

master
parent
commit
d72c18e430
  1. 8
      src/api/system/auth.js
  2. 185
      src/views/system/authData/index.vue
  3. 20
      src/views/system/user/authData.vue

8
src/api/system/auth.js

@ -42,3 +42,11 @@ export function delAuth(dataAuthId) { @@ -42,3 +42,11 @@ export function delAuth(dataAuthId) {
method: 'delete'
})
}
// 批量删除数据权限
export function removeBatchs(data) {
return request({
url: '/dhc/authData/removeBatch',
method: 'post',
data: data
})
}

185
src/views/system/authData/index.vue

@ -1,30 +1,71 @@ @@ -1,30 +1,71 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="部门ID" prop="deptId">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="账号" prop="userName">
<el-input
v-model="queryParams.deptId"
placeholder="请输入部门ID"
v-model="queryParams.userName"
placeholder="请输入账号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="权限控制点" prop="authNode">
<el-form-item label="姓名" prop="nickName">
<el-input
v-model="queryParams.authNode"
placeholder="请输入权限控制点"
v-model="queryParams.nickName"
placeholder="请输入姓名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产品线编码" prop="productLineCode">
<el-form-item label="手机号" prop="phonenumber">
<el-input
v-model="queryParams.productLineCode"
placeholder="请输入产品线编码"
v-model="queryParams.phonenumber"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="组织" prop="deptIds">
<el-cascader v-model="queryParams.deptIds" :options="deptData" @change="setDeptId" placeholder="组织"></el-cascader>
</el-form-item>
<el-form-item label="权限控制点" prop="authNode">
<el-select v-model="queryParams.authNode" placeholder="请选择权限控制节点">
<el-option
v-for="line in dict.type.auth_node"
:key="line.value"
:label="line.label"
:value="line.value"
/>
</el-select>
</el-form-item>
<el-form-item label="产品线" prop="productLineCode">
<el-select v-model="queryParams.productLineCode" placeholder="请选择产品线"
@change="setAreaType">
<el-option
v-for="line in dict.type.product_line"
:key="line.value"
:label="line.label"
:value="line.value"
/>
</el-select>
</el-form-item>
<el-form-item label="区域类型" prop="areaType">
<el-select v-model="queryParams.areaType" placeholder="请选择区域类型" @change="setArea">
<el-option
v-for="type in areaTypeList"
:key="type.value"
:label="type.label"
:value="type.value"
/>
</el-select>
</el-form-item>
<el-form-item label="区域" prop="detailCodes">
<el-select v-model="queryParams.detailCodes" multiple placeholder="请选择区域" >
<el-option
v-for="type in areaList"
:key="type.value"
:label="type.label"
:value="type.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -42,17 +83,6 @@ @@ -42,17 +83,6 @@
v-hasPermi="['dhc:auth:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['dhc:auth:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
@ -72,18 +102,43 @@ @@ -72,18 +102,43 @@
size="mini"
@click="handleExport"
v-hasPermi="['dhc:auth:export']"
>导出</el-button>
>模板下载</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-upload"
size="mini"
@click="handleExport"
v-hasPermi="['dhc:auth:export']"
>导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="authList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="数据权限ID" align="center" prop="dataAuthId" />
<el-table-column label="部门ID" align="center" prop="deptId" />
<el-table-column label="权限控制点" align="center" prop="authNode" />
<el-table-column label="产品线编码" align="center" prop="productLineCode" />
<el-table-column label="区域类型" align="center" prop="areaType" />
<el-table-column label="账号" align="center" prop="userName" />
<el-table-column label="姓名" align="center" prop="nickName" />
<el-table-column label="手机号" align="center" prop="phonenumber" />
<el-table-column label="组织" align="center" prop="deptAllName" />
<el-table-column label="权限控制点" align="center" prop="authNode">
<template slot-scope="scope">
<dict-tag :options="dict.type.auth_node" :value="scope.row.authNode"/>
</template>
</el-table-column>
<el-table-column label="产品线编码" align="center" prop="productLineCode">
<template slot-scope="scope">
<dict-tag :options="dict.type.product_line" :value="scope.row.productLineCode"/>
</template>
</el-table-column>
<el-table-column label="区域类型" align="center" prop="areaType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.area_type" :value="scope.row.areaType"/>
</template>
</el-table-column>
<el-table-column label="区域" align="center" prop="areaName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -92,7 +147,14 @@ @@ -92,7 +147,14 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['dhc:auth:edit']"
>修改</el-button>
>编辑</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-copy-document"
@click="handleUpdate(scope.row)"
v-hasPermi="['dhc:auth:edit']"
>复制</el-button>
<el-button
size="mini"
type="text"
@ -134,16 +196,19 @@ @@ -134,16 +196,19 @@
</template>
<script>
import { listAuth, getAuth, delAuth, addAuth, updateAuth } from "@/api/system/auth";
import { listAuth, getAuth, delAuth, addAuth, updateAuth,removeBatch } from "@/api/system/auth";
import {queryList, queryAreaMaplist} from "@/api/dhc/productLineArea";
import {deptTreeSelect } from "@/api/system/user";
export default {
name: "Auth",
name: "AuthData",
dicts: ['product_line', 'area_type', 'auth_node'],
data() {
return {
//
loading: true,
//
ids: [],
selectData:[],
//
single: true,
//
@ -154,6 +219,9 @@ export default { @@ -154,6 +219,9 @@ export default {
total: 0,
//
authList: [],
areaTypeList: [],
areaList: [],
deptData: [],
//
title: "",
//
@ -162,10 +230,14 @@ export default { @@ -162,10 +230,14 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
deptId: null,
userName: null,
nickName: null,
phonenumber: null,
authNode: null,
productLineCode: null,
areaType: null
areaType: null,
deptIds: [],
detailCodes:[]
},
//
form: {},
@ -188,6 +260,7 @@ export default { @@ -188,6 +260,7 @@ export default {
},
created() {
this.getList();
this.getDeptTree();
},
methods: {
/** 查询数据权限列表 */
@ -228,6 +301,7 @@ export default { @@ -228,6 +301,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.dataAuthId)
this.selectData = selection;
this.single = selection.length!==1
this.multiple = !selection.length
},
@ -269,9 +343,14 @@ export default { @@ -269,9 +343,14 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const dataAuthIds = row.dataAuthId || this.ids;
this.$modal.confirm('是否确认删除数据权限编号为"' + dataAuthIds + '"的数据项?').then(function() {
return delAuth(dataAuthIds);
let params = [];
if (row == undefined) {
params = this.selectData
} else {
params.push(row);
}
this.$modal.confirm('是否确认删除数据权限的数据项?').then(function() {
return delAuth(params);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
@ -282,7 +361,33 @@ export default { @@ -282,7 +361,33 @@ export default {
this.download('dhc/auth/export', {
...this.queryParams
}, `auth_${new Date().getTime()}.xlsx`)
}
},
//
setAreaType(row) {
let queryParams = {productLineCode:row.productLineCode, areaType:'', type:'areaType'}
this.areaTypeList = [];
this.areaList = [];
queryList(queryParams).then(response => {
this.areaTypeList = response;
});
},
//
setArea(row) {
let queryParams = {productLineCode:row.productLineCode, areaType:row.areaType}
this.areaList = [];
queryAreaMaplist(queryParams).then(response => {
this.areaList = response;
});
},
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then(response => {
this.deptData = response.data;
});
},
setDeptId(values){
this.queryParams.deptId = values[values.length-1];
},
}
};
</script>

20
src/views/system/user/authData.vue

@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
<el-table-column label="区域" align="center" prop="detailCodes">
<template slot-scope="scope">
<span v-if="scope.row.editFlag" >
<el-select v-model="scope.row.detailCodes" multiple placeholder="区域类型" @change="setAreaNames">
<el-select v-model="scope.row.detailCodes" multiple placeholder="区域" @change="setAreaNames">
<el-option
v-for="type in areaList"
:key="type.value"
@ -150,7 +150,7 @@ import { addAuth, delAuth } from "@/api/system/auth"; @@ -150,7 +150,7 @@ import { addAuth, delAuth } from "@/api/system/auth";
import {getAuthData, deptTreeSelect } from "@/api/system/user";
import {queryList, queryAreaMaplist} from "@/api/dhc/productLineArea";
export default {
name: "AuthData",
name: "UserAuthData",
dicts: ['product_line', 'area_type', 'auth_node'],
data() {
return {
@ -192,6 +192,22 @@ export default { @@ -192,6 +192,22 @@ export default {
row.editFlag = true;
},
handleSave(row) {
if (row.deptIds.length == 0) {
this.$modal.msgWarning("组织必须选择");
return;
} else if (row.authNode == null || row.authNode =='') {
this.$modal.msgWarning("权限控制节点必须选择");
return;
} else if (row.productLineCode == null || row.productLineCode =='') {
this.$modal.msgWarning("产品线必须选择");
return;
} else if (row.areaType == null || row.areaType =='') {
this.$modal.msgWarning("区域类型必须选择");
return;
} else if (row.detailCodes.length == 0) {
this.$modal.msgWarning("区域必选选择");
return;
}
row.editFlag = false;
addAuth(row).then(response => {
this.$modal.msgSuccess("新增成功");

Loading…
Cancel
Save