Преглед изворни кода

Merge branch 'master' of http://182.92.174.150:3000/tiegu/czo

lz пре 3 година
родитељ
комит
e6ba23b87d

+ 66 - 0
src/api/system/employeenInfo.js

@@ -0,0 +1,66 @@
+import request from '@/utils/request'
+//查询员工
+export function getStaffList(params) {
+	return request({
+		url: '/system/user/list',
+		method: 'get',
+		params
+	})
+}
+
+// 根据员工序号获取责权信息
+export function getResponsibilityRight(userId) {
+    return request({
+        url: '/system/user/responsibilityRight/' + userId,
+        method: 'GET'
+    })
+}
+
+// 获取级别职务下拉树列表
+export function getLevelTreeSelect() {
+	return request({
+		url: '/system/level/treeSelect',
+		method: 'get'
+	})
+}
+
+// 获取性质岗位下拉树列表
+export function getNatureTreeSelect() {
+	return request({
+		url: '/system/nature/treeSelect',
+		method: 'get'
+	})
+}
+
+//查询级别
+export function levelList() {
+	return request({
+		url: '/system/level/list',
+		method: 'get'
+	})
+}
+
+// 新增员工账号信息
+export function addUser(data) {
+	return request({
+		url: '/system/user',
+		method: 'post',
+		data: data
+	})
+}
+
+// 删除员工
+export function delUser(userIds) {
+	return request({
+	  url: 'system/user/' + userIds,
+	  method: 'delete'
+	})
+  }
+
+// 根据员工序号获取授权功能权限
+export function getAuthRole(userId) {
+    return request({
+        url: '/system/user/authRole/' + userId,
+        method: 'GET'
+    })
+}

+ 228 - 140
src/views/system/employeenInfo/index.vue

@@ -1,17 +1,21 @@
 <template>
 	<div class="page-container">
 		<div class="search-container" v-show="showSearch">
-			<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
-				<el-form-item label="姓名" prop="userName">
-					<el-input v-model="queryParams.userName" placeholder="请输入用户姓名" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
-				</el-form-item>
-				<el-form-item label="电话号码" prop="phonenumber">
-					<el-input v-model="queryParams.phonenumber" placeholder="请输入电话号码" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
-				</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>
-				</el-form-item>
+			<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" class="search_form">
+				<div class="search_input">
+					<el-form-item label="姓名">
+						<el-input v-model="queryParams.realName" placeholder="请输入姓名" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
+					</el-form-item>
+					<el-form-item label="电话号码">
+						<el-input v-model="queryParams.phonenumber" placeholder="请输入电话号码" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" />
+					</el-form-item>
+				</div>
+				<div class="search_btn">
+					<el-form-item>
+						<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">搜索</el-button>
+						<el-button icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
+					</el-form-item>
+				</div>
 			</el-form>
 		</div>
 		<div class="content-container">
@@ -24,7 +28,7 @@
 					</div>
 					<!-- 操作 -->
 					<div class="actions">
-						<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:user:add']">添加</el-button>
+						<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:user:add']">添加</el-button>
 						<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:user:export']">导出</el-button>
 						<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['system:user:import']" style="margin-right: 10px">导入</el-button>
 						<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
@@ -37,21 +41,26 @@
 							<span>{{ scope.$index + 1 }}</span>
 						</template>
 					</el-table-column>
-					<el-table-column label="头像" align="center" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" width="90" >
-						<template>
-							<span></span>
+					<el-table-column label="头像" align="center" v-if="columns[1].visible" width="60">
+						<template slot-scope="scope">
+							<img v-bind:src="scope.row.avatar" class="img-circle img_height" @click="modifyAvatar(scope.row)" />
+							<!-- <el-image v-else >
+								<div slot="error" class="image-slot">
+									<i class="el-icon-picture-outline"></i>
+								</div>
+							</el-image> -->
 						</template>
 					</el-table-column>
-					<el-table-column label="姓名" align="center" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" width="120" />
-					<el-table-column label="公司部门" align="center" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" width="160" />
-					<el-table-column label="级别职务" align="center" prop="phonenumber" v-if="columns[4].visible" width="160" />
-					<el-table-column label="性质岗位" align="center" v-if="columns[5].visible" width="160" />
-					<el-table-column label="角色权限" align="center" prop="createTime" v-if="columns[6].visible" width="160" />
-					<el-table-column label="手机号码" align="center" prop="userId" v-if="columns[7].visible" width="150" />
+					<el-table-column label="姓名" align="center" prop="realName" v-if="columns[2].visible" :show-overflow-tooltip="true" width="120" />
+					<el-table-column label="公司部门" align="center" prop="deptNames" v-if="columns[3].visible" :show-overflow-tooltip="true" width="160" />
+					<el-table-column label="级别职务" align="center" prop="levelJobNames" v-if="columns[4].visible" width="160" />
+					<el-table-column label="性质岗位" align="center" prop="naturePostNames" v-if="columns[5].visible" width="160" />
+					<el-table-column label="角色权限" align="center" prop="roleJurisdictionNames" v-if="columns[6].visible" width="160" />
+					<el-table-column label="手机号码" align="center" prop="phonenumber" v-if="columns[7].visible" width="150" />
 					<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
 						<template slot-scope="scope" v-if="scope.row.userId !== 1">
 							<el-button size="mini" type="text" icon="el-icon-edit" @click="getDutiesPowers(scope.row)" v-hasPermi="['system:user:edit']">职责权力</el-button>
-							<el-button size="mini" type="text" icon="el-icon-edit" @click="getRolePermissions(scope.row)" v-hasPermi="['system:user:edit']">角色权限</el-button>
+							<el-button size="mini" type="text" icon="el-icon-edit" @click="getRolePermissions(scope.row)" v-hasPermi="['system:user:edit']">功能权限</el-button>
 							<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">数据权限</el-button>
 							<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">修改</el-button>
 							<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">删除</el-button>
@@ -59,7 +68,7 @@
 					</el-table-column>
 				</el-table>
 				<!-- 分页 -->
-				<pagination v-show="total > queryParams.pageSize" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
+				<pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
 			</div>
 		</div>
 		<!-- 添加或修改用户配置对话框 -->
@@ -69,129 +78,123 @@
 				<div class="basics"><a href="javascript:void(0);" @click="getBasicsInfo">基础信息</a></div>
 			</div>
 			<!-- 账号信息 -->
-			<el-form ref="form" :model="form" :rules="rules" label-width="90px" v-show="accountShow">
+			<el-form ref="accountForm" :model="accountForm" :rules="rules" label-width="90px" v-show="accountShow">
 				<el-row>
 					<el-col :span="12">
-						<el-form-item label="序号" prop="nickName">
-							<el-input v-model="form.nickName" placeholder="请输入序号" maxlength="30" />
+						<el-form-item label="序号" prop="userId">
+							<el-input v-model="accountForm.userId" placeholder="请输入序号" maxlength="30" disabled />
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
-						<el-form-item label="编号" prop="deptId">
-							<el-input placeholder="请输入编号" maxlength="30" />
+						<el-form-item label="编号" prop="userNumber">
+							<el-input v-model="accountForm.userNumber" placeholder="请输入编号" maxlength="30" />
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="12">
-						<el-form-item label="姓名" prop="phonenumber">
-							<el-input v-model="form.phonenumber" placeholder="请输入姓名" maxlength="11" />
+						<el-form-item label="姓名" prop="realName">
+							<el-input v-model="accountForm.realName" placeholder="请输入姓名" maxlength="11" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
-						<el-form-item label="手机号" prop="email">
-							<el-input v-model="form.email" placeholder="请输入手机号" />
+						<el-form-item label="手机号" prop="phonenumber">
+							<el-input v-model="accountForm.phonenumber" placeholder="请输入手机号" />
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="12">
-						<el-form-item label="账号状态" prop="userName">
-							<el-radio>正常</el-radio>
-							<el-radio>停用</el-radio>
+						<el-form-item label="账号状态" prop="status">
+							<el-radio v-model="accountForm.status" label="0">正常</el-radio>
+							<el-radio v-model="accountForm.status" label="1">停用</el-radio>
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
-						<el-form-item label="性别" prop="password">
-							<el-radio>男</el-radio>
-							<el-radio>女</el-radio>
+						<el-form-item label="性别" prop="sex">
+							<el-radio v-model="accountForm.sex" label="0">男</el-radio>
+							<el-radio v-model="accountForm.sex" label="1">女</el-radio>
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="24">
-						<el-form-item label="身份证号">
-							<el-input placeholder="请输入身份证号" />
+						<el-form-item label="身份证号" prop="idNumber">
+							<el-input v-model="accountForm.idNumber" placeholder="请输入身份证号" />
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="24">
-						<el-form-item label="公司部门">
-							<el-select placeholder="请选择" style="width: 100%">
-								<el-optio></el-optio>
-							</el-select>
+						<el-form-item label="公司部门" prop="deptIds">
+							<el-cascader ref="deptCascader" :options="deptOptions" :props="props" clearable style="width: 100%" @change="deptCascaderChange"></el-cascader>
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="24">
-						<el-form-item label="职称级别">
-							<el-select placeholder="请选择" style="width: 100%">
-								<el-option></el-option>
-							</el-select>
+						<el-form-item label="职称级别" prop="levelJobIds">
+							<el-cascader ref="levelCascader" :options="levelList" :props="props" clearable style="width: 100%" @change="levelCascaderChange"></el-cascader>
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="24">
-						<el-form-item label="性质岗位">
-							<el-select placeholder="请选择" style="width: 100%">
-								<el-option></el-option>
-							</el-select>
+						<el-form-item label="性质岗位" prop="naturePostIds">
+							<el-cascader ref="natureCascader" :options="natureList" :props="props" clearable style="width: 100%" @change="natureCascaderChange"></el-cascader>
 						</el-form-item>
 					</el-col>
 				</el-row>
 			</el-form>
 			<!-- 基础信息 -->
-			<el-form ref="form" :model="form" :rules="rules" label-width="90px" v-show="basicsShow" class="basics_form">
+			<el-form ref="basicsForm" :model="basicsForm" :rules="rules" label-width="90px" v-show="basicsShow" class="basics_form">
 				<el-row>
 					<el-col :span="12">
-						<el-form-item label="年龄" prop="nickName">
-							<el-input v-model="form.nickName" placeholder="请输入年龄" maxlength="30" />
+						<el-form-item label="年龄">
+							<el-input placeholder="请输入年龄" maxlength="30" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
-						<el-form-item label="出生日期" prop="deptId">
+						<el-form-item label="出生日期">
 							<el-input placeholder="请输入出生日期" maxlength="30" />
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="12">
-						<el-form-item label="QQ号" prop="phonenumber">
-							<el-input v-model="form.phonenumber" placeholder="请输入QQ号" maxlength="11" />
+						<el-form-item label="QQ号">
+							<el-input placeholder="请输入QQ号" maxlength="11" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
-						<el-form-item label="企业微信号" prop="email">
-							<el-input v-model="form.email" placeholder="请输入企业微信号" />
+						<el-form-item label="企业微信号">
+							<el-input placeholder="请输入企业微信号" />
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="12">
-						<el-form-item label="学历" prop="userName">
+						<el-form-item label="学历">
 							<el-select placeholder="请选择" style="width: 100%">
 								<el-optio></el-optio>
 							</el-select>
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
-						<el-form-item label="原籍" prop="password">
-							<el-input v-model="form.email" placeholder="请输入原籍" />
+						<el-form-item label="原籍">
+							<el-input placeholder="请输入原籍" />
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="12">
 						<el-form-item label="现住址">
-							<el-input v-model="form.email" placeholder="请输入现住址" />
+							<el-input placeholder="请输入现住址" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
 						<el-form-item label="家庭成员">
-							<el-input v-model="form.email" placeholder="请输入家庭成员" />
+							<el-input placeholder="请输入家庭成员" />
 						</el-form-item>
 					</el-col>
 				</el-row>
@@ -205,7 +208,7 @@
 					</el-col>
 					<el-col :span="12">
 						<el-form-item label="家庭收入">
-							<el-input v-model="form.email" placeholder="请输入家庭收入" />
+							<el-input placeholder="请输入家庭收入" />
 						</el-form-item>
 					</el-col>
 				</el-row>
@@ -276,29 +279,29 @@
 				<el-row>
 					<el-col :span="8">
 						<el-form-item label="原工作单位">
-							<el-input v-model="form.email" placeholder="请输入原单位" />
+							<el-input placeholder="请输入原单位" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="8">
 						<el-form-item label="职务">
-							<el-input v-model="form.email" placeholder="请输入职务" />
+							<el-input placeholder="请输入职务" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="8">
 						<el-form-item label="收入">
-							<el-input v-model="form.email" placeholder="请输入收入" />
+							<el-input placeholder="请输入收入" />
 						</el-form-item>
 					</el-col>
 				</el-row>
 				<el-row>
 					<el-col :span="8">
 						<el-form-item label="开始时间">
-							<el-input v-model="form.email" placeholder="请输入开始时间" />
+							<el-input placeholder="请输入开始时间" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="8">
 						<el-form-item label="结束时间">
-							<el-input v-model="form.email" placeholder="请输入结束时间" />
+							<el-input placeholder="请输入结束时间" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="8">
@@ -502,12 +505,12 @@
 				<el-row>
 					<el-col :span="12">
 						<el-form-item label="联系电话">
-							<el-input v-model="form.email" placeholder="请输入联系电话" />
+							<el-input placeholder="请输入联系电话" />
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
 						<el-form-item label="工作单位">
-							<el-input v-model="form.email" placeholder="请输入工作单位" />
+							<el-input placeholder="请输入工作单位" />
 						</el-form-item>
 					</el-col>
 				</el-row>
@@ -547,7 +550,7 @@
 		</el-dialog>
 
 		<!-- 修改角色权限对话框 -->
-		<el-dialog title="角色权限" :visible.sync="dialogTableRolePermissions">
+		<el-dialog title="功能权限" :visible.sync="dialogTableRolePermissions">
 			<el-table border>
 				<el-table-column label="名称" align="center" width="180"></el-table-column>
 				<el-table-column label="描述" align="center"></el-table-column>
@@ -562,34 +565,38 @@
 		<el-dialog title="责权信息" :visible.sync="dialogPower" width="30%" :before-close="handleClose">
 			<div class="">
 				<span>级别职务:</span>
-				<el-select>
-					<el-option></el-option>
+				<el-select v-model="jodId" placeholder="请选择" @change="changeJob()">
+					<el-option v-for="item in levelJobs" :key="item.jobId" :label="item.jobName" :value="item.jobId"> </el-option>
 				</el-select>
 			</div>
 			<div class="responsibility">
 				<span>责任</span>
 			</div>
-			<el-input type="textarea" :rows="3" readonly placeholder="请输入内容"> </el-input>
+			<el-input type="textarea" :rows="3" v-model="responsibility" :disabled="true" placeholder="请输入内容"> </el-input>
 			<div class="responsibility">
 				<span>权利</span>
 			</div>
-			<el-input type="textarea" :rows="3" readonly placeholder="请输入内容"> </el-input>
+			<el-input type="textarea" :rows="3" v-model="right" :disabled="true" placeholder="请输入内容"> </el-input>
 		</el-dialog>
+
+		<!-- 修改头像对话框 -->
+		<userAvatar ref="userAvatar" />
 	</div>
 </template>
 
 <script>
-import { listUser, getUser, delUser, addUser, updateUser } from '@/api/system/user'
+import { getUser, delUser, addUser, updateUser, getStaffList, getLevelTreeSelect, getResponsibilityRight, getNatureTreeSelect, getAuthRole } from '@/api/system/employeenInfo'
 import { getToken } from '@/utils/auth'
 import { treeselect } from '@/api/system/dept'
+import userAvatar from './profile/userAvatar.vue'
 import Treeselect from '@riophae/vue-treeselect'
 import TreeChoice from '@/components/treeChoice/index.vue'
 import '@riophae/vue-treeselect/dist/vue-treeselect.css'
 
 export default {
-	name: 'User',
+	name: 'employeenInfo',
 	dicts: ['sys_normal_disable', 'sys_user_sex'],
-	components: { Treeselect, TreeChoice },
+	components: { Treeselect, TreeChoice, userAvatar },
 	data() {
 		return {
 			// 遮罩层
@@ -606,18 +613,16 @@ export default {
 			deptOptions: undefined,
 			// 是否显示弹出层
 			open: false,
-			// 部门名称
-			deptName: undefined,
-			// 默认密码
-			initPassword: undefined,
-			// 日期范围
-			dateRange: [],
 			// 岗位选项
 			postOptions: [],
 			// 角色选项
 			roleOptions: [],
-			// 表单参数
-			form: {},
+			// 账号表单参数
+			accountForm: {
+				userId: null
+			},
+			// 基础表单参数
+			basicsForm: {},
 			defaultProps: {
 				children: 'children',
 				label: 'label'
@@ -641,10 +646,8 @@ export default {
 			queryParams: {
 				pageNum: 1,
 				pageSize: 10,
-				userName: undefined,
-				phonenumber: undefined,
-				status: undefined,
-				deptId: undefined
+				realName: undefined,
+				phonenumber: undefined
 			},
 			// 列信息
 			columns: [
@@ -659,51 +662,53 @@ export default {
 			],
 			// 表单校验
 			rules: {
-				userName: [
-					{ required: true, message: '用户名称不能为空', trigger: 'blur' },
-					{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
-				],
-				nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
-				password: [
-					{ required: true, message: '用户密码不能为空', trigger: 'blur' },
-					{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
-				],
-				email: [
-					{
-						type: 'email',
-						message: "'请输入正确的邮箱地址",
-						trigger: ['blur', 'change']
-					}
-				],
-				phonenumber: [
-					{
-						pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-						message: '请输入正确的手机号码',
-						trigger: 'blur'
-					}
-				]
+				// userName: [
+				// 	{ required: true, message: '用户名称不能为空', trigger: 'blur' },
+				// 	{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
+				// ],
+				// nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
+				// password: [
+				// 	{ required: true, message: '用户密码不能为空', trigger: 'blur' },
+				// 	{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
+				// ],
+				// email: [
+				// 	{
+				// 		type: 'email',
+				// 		message: "'请输入正确的邮箱地址",
+				// 		trigger: ['blur', 'change']
+				// 	}
+				// ],
+				// phonenumber: [
+				// 	{
+				// 		pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+				// 		message: '请输入正确的手机号码',
+				// 		trigger: 'blur'
+				// 	}
+				// ]
 			},
 			dialogTableRolePermissions: false, // 角色权限弹出层
 			dialogPower: false, // 责权信息弹出层
 			accountShow: true, // 账号信息
-			basicsShow: false // 基础信息
+			basicsShow: false, // 基础信息
+			props: { multiple: true }, // 联级多选
+			// propsLevel: { multiple: true },
+			levelList: [], // 级别列表
+			natureList: [], // 性质岗位列表
+			levelJobs: [], // 责权信息列表
+			jodId: '', // 职位id
+			responsibility: '', // 职责
+			right: '', // 权力
 		}
 	},
-	mounted() {
-		console.log(this.$store)
-	},
 	created() {
 		this.getList()
 		this.getTreeselect()
-		this.getConfigKey('sys.user.initPassword').then((response) => {
-			this.initPassword = response.msg
-		})
 	},
 	methods: {
 		/** 查询用户列表 */
 		getList() {
 			this.loading = true
-			listUser(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
+			getStaffList(this.queryParams).then((response) => {
 				this.userList = response.rows
 				this.total = response.total
 				this.loading = false
@@ -730,7 +735,7 @@ export default {
 			this.form = {
 				userId: undefined,
 				deptId: undefined,
-				userName: undefined,
+				// userName: undefined,
 				nickName: undefined,
 				password: undefined,
 				phonenumber: undefined,
@@ -750,7 +755,6 @@ export default {
 		},
 		/** 重置按钮操作 */
 		resetQuery() {
-			this.dateRange = []
 			this.resetForm('queryForm')
 			this.handleQuery()
 		},
@@ -758,16 +762,28 @@ export default {
 		handleAdd() {
 			this.reset()
 			this.getTreeselect()
-			getUser().then((response) => {
-				this.postOptions = response.posts
-				this.roleOptions = response.roles
-				this.open = true
-				this.title = '添加用户'
-				this.form.password = this.initPassword
-			})
+			this.open = true
+			this.title = '添加用户'
+			this.getLevelList()
+			this.getNatureList()
+			this.accountForm.userId =
+				Math.max.apply(
+					Math,
+					this.userList.map(function (item) {
+						return item.userId
+					})
+				) + 1
+			// getUser().then((response) => {
+			// 	// this.postOptions = response.posts
+			// 	// this.roleOptions = response.roles
+			// 	// this.form.password = this.initPassword
+			// })
 		},
 		// 修改角色权限
 		getRolePermissions(row) {
+			getAuthRole(row.userId).then((res) => {
+				console.log(res)
+			})
 			this.dialogTableRolePermissions = true
 		},
 		// 保存角色权限修改
@@ -779,9 +795,18 @@ export default {
 			this.dialogTableRolePermissions = false
 		},
 		// 职责权限
-		getDutiesPowers() {
+		getDutiesPowers(row) {
+			let staff = this.userList.find((item, index, c) => item.userId === row.userId)
+			this.levelJobs = staff.levelJobs
+			this.jodId = this.levelJobs[0].jobId
+			console.log(this.levelJobs)
 			this.dialogPower = true
 		},
+		// 选择职责权限
+		changeJob(val) {
+			// console.log(val)
+			console.log(123)
+		},
 		// 账号信息
 		getAccountInfo() {
 			this.accountShow = true
@@ -792,6 +817,55 @@ export default {
 			this.accountShow = false
 			this.basicsShow = true
 		},
+		// 修改头像
+		modifyAvatar(row) {
+			this.$refs.userAvatar.editCropper()
+		},
+		// 关闭责权信息
+		handleClose() {
+			this.dialogPower = false
+		},
+		//获取级别数据
+		getLevelList() {
+			getLevelTreeSelect().then((res) => {
+				if (res.code == 200) {
+					this.levelList = res.data
+				} else {
+					this.$msg({ type: 'error', message: res.msg })
+				}
+			})
+		},
+		// 获取性质岗位数据
+		getNatureList() {
+			getNatureTreeSelect().then((res) => {
+				if (res.code == 200) {
+					this.natureList = res.data
+				} else {
+					this.$msg({ type: 'error', message: res.msg })
+				}
+			})
+		},
+		// 部门级联选择
+		deptCascaderChange(val) {
+			let getCheckedNodes = this.$refs.deptCascader.getCheckedNodes()
+			const newArr = getCheckedNodes.map((item, index, c) => item.data.id)
+			this.accountForm.deptIds = newArr.join(',')
+			console.log(this.accountForm.deptIds)
+		},
+		// 职称级别级联选择
+		levelCascaderChange(val) {
+			let getCheckedNodes = this.$refs.levelCascader.getCheckedNodes()
+			const newArr = getCheckedNodes.map((item, index, c) => item.data.id)
+			this.accountForm.levelJobIds = newArr.join(',')
+			console.log(this.accountForm.levelJobIds)
+		},
+		// 性质岗位级联选择
+		natureCascaderChange(val) {
+			let getCheckedNodes = this.$refs.natureCascader.getCheckedNodes()
+			const newArr = getCheckedNodes.map((item, index, c) => item.data.id)
+			this.accountForm.naturePostIds = newArr.join(',')
+			console.log(this.accountForm.naturePostIds)
+		},
 		/** 修改按钮操作 */
 		handleUpdate(row) {
 			this.reset()
@@ -810,7 +884,8 @@ export default {
 		},
 		/** 提交按钮 */
 		submitForm: function () {
-			this.$refs['form'].validate((valid) => {
+			console.log(this.accountForm)
+			this.$refs['accountForm'].validate((valid) => {
 				if (valid) {
 					if (this.form.userId != undefined) {
 						updateUser(this.form).then((response) => {
@@ -819,7 +894,7 @@ export default {
 							this.getList()
 						})
 					} else {
-						addUser(this.form).then((response) => {
+						addUser(this.accountForm).then((response) => {
 							this.$modal.msgSuccess('新增成功')
 							this.open = false
 							this.getList()
@@ -830,11 +905,11 @@ export default {
 		},
 		/** 删除按钮操作 */
 		handleDelete(row) {
-			const userIds = row.userId
+			// const userIds = row.userId
 			this.$modal
-				.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?')
+				.confirm('是否确认删除用户编号为"' + row.userId + '"的数据项?')
 				.then(function () {
-					return delUser(userIds)
+					return delUser(row.userId)
 				})
 				.then(() => {
 					this.getList()
@@ -912,11 +987,24 @@ export default {
 	border: 1px solid #dfe6ec;
 	border-bottom: none;
 }
-.basics_form{
+.basics_form {
 	overflow: auto;
 	height: 600px;
 }
+.img_height {
+	height: 32px;
+	width: 32px;
+	vertical-align: middle;
+	cursor: pointer;
+}
 .el-col-lg-4-8 {
 	width: 20%;
 }
+.search_form {
+	display: flex;
+	justify-content: space-between;
+}
+.search_form .el-form-item {
+	margin-bottom: 0;
+}
 </style>

+ 1 - 1
src/views/system/employeenInfo/profile/userAvatar.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
+    <!-- <div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div> -->
     <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened"  @close="closeDialog">
       <el-row>
         <el-col :xs="24" :md="12" :style="{height: '350px'}">

+ 582 - 570
src/views/system/role/index.vue

@@ -124,136 +124,137 @@
 </template>
 
 <script>
-	import {
-		listRole,
-		getRole,
-		delRole,
-		addRole,
-		updateRole,
-		dataScope,
-		changeRoleStatus,
-		getRoleMenuTreeselect,
-		saveRoleMenu,
-		getTableHeadList,
-		authUserCancelAll,
-		setSysTableCfgIsShow
-	} from '@/api/system/role'
-	import { treeselect as menuTreeselect, roleMenuTreeselect } from '@/api/system/menu'
-	import { treeselect as deptTreeselect, roleDeptTreeselect } from '@/api/system/dept'
-	import pinyin from 'js-pinyin'
+import {
+	listRole,
+	getRole,
+	delRole,
+	addRole,
+	updateRole,
+	dataScope,
+	changeRoleStatus,
+	getRoleMenuTreeselect,
+	saveRoleMenu,
+	getTableHeadList,
+	authUserCancelAll,
+	setSysTableCfgIsShow
+} from '@/api/system/role'
+import { treeselect as menuTreeselect, roleMenuTreeselect } from '@/api/system/menu'
+import { treeselect as deptTreeselect, roleDeptTreeselect } from '@/api/system/dept'
+import pinyin from 'js-pinyin'
 
-	export default {
-		name: 'Role',
-		dicts: ['sys_normal_disable'],
-		data() {
-			return {
-				// 遮罩层
-				loading: true,
-				// 总条数
-				total: 0,
-				// 角色表格数据
-				roleList: [],
-				// 弹出层标题
-				title: '',
-				// 是否显示弹出层
-				open: false,
-				// 是否显示弹出层(数据权限)
-				openDataScope: false,
-				menuExpand: false,
-				menuNodeAll: false,
-				deptExpand: true,
-				deptNodeAll: false,
-				// 日期范围
-				dateRange: [],
-				// 菜单列表
-				menuOptions: [],
-				// 部门列表
-				deptOptions: [],
-				// 查询参数
-				queryParams: {
-					pageNum: 1,
-					pageSize: 10,
-					roleName: undefined,
-					roleKey: undefined,
-					status: undefined
-				},
-				// 表单参数
-				form: {},
-				form1: {},
-				// 表单校验
-				rules: {
-					roleName: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }]
-				},
-				roleShow: true,
-				functionalShow: false,
-				headShow: false,
-				over: 1,
-				background: '',
-				getIndex: null,
-				getIndex1: null,
-				getIndex2: null,
-				functionList: [], // 功能权限列表
-				btnList: [], // 功能权限按钮列表
-				headList: [],
-				FuncList: [],
-				FuncListTree: [],
-				objRole: {},
-				objFun: {},
-				btnsLists: [],
-				btnsList: [],
-				checkedKeys: [],
-				checked: false,
-				roleId: '',
-				listName: '',
-				menuId: '',
-				checkStatus: -1,
-				disabled: false
-			}
+export default {
+	name: 'Role',
+	dicts: ['sys_normal_disable'],
+	data() {
+		return {
+			// 遮罩层
+			loading: true,
+			// 总条数
+			total: 0,
+			// 角色表格数据
+			roleList: [],
+			// 弹出层标题
+			title: '',
+			// 是否显示弹出层
+			open: false,
+			// 是否显示弹出层(数据权限)
+			openDataScope: false,
+			menuExpand: false,
+			menuNodeAll: false,
+			deptExpand: true,
+			deptNodeAll: false,
+			// 日期范围
+			dateRange: [],
+			// 菜单列表
+			menuOptions: [],
+			// 部门列表
+			deptOptions: [],
+			// 查询参数
+			queryParams: {
+				pageNum: 1,
+				pageSize: 10,
+				roleName: undefined,
+				roleKey: undefined,
+				status: undefined
+			},
+			// 表单参数
+			form: {},
+			form1: {},
+			// 表单校验
+			rules: {
+				roleName: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }]
+			},
+			roleShow: true,
+			functionalShow: false,
+			headShow: false,
+			over: 1,
+			background: '',
+			getIndex: null,
+			getIndex1: null,
+			getIndex2: null,
+			functionList: [], // 功能权限列表
+			btnList: [], // 功能权限按钮列表
+			headList: [],
+			FuncList: [],
+			FuncListTree: [],
+			objRole: {},
+			objFun: {},
+			btnsLists: [],
+			btnsList: [],
+			checkedKeys: [],
+			checked: false,
+			roleId: '',
+			listName: '',
+			menuId: '',
+			checkStatus: -1,
+			disabled: false
+		}
+	},
+	created() {
+		this.getList()
+	},
+	filters: {},
+	methods: {
+		// 角色列表
+		getRole() {
+			this.getList()
+			this.over = 1
+			this.roleShow = true
+			this.functionalShow = false
+			this.headShow = false
 		},
-		created() {
+		// 功能权限列表
+		getFunctionalAuthority() {
 			this.getList()
+			this.roleLineDbclick(this.objRole)
+			this.headShow = false
 		},
-		filters: {},
-		methods: {
-			// 角色列表
-			getRole() {
-				this.getList()
-				this.over = 1
-				this.roleShow = true
-				this.functionalShow = false
-				this.headShow = false
-			},
-			// 功能权限列表
-			getFunctionalAuthority() {
-				this.getList()
-				this.roleLineDbclick(this.objRole)
-				this.headShow = false
-			},
-			// 表头权限;列表
-			getHeaderPermission() {
-				this.functionalLineDbclick(this.objFun)
-				this.getList()
-			},
-			/** 查询角色列表 */
-			getList() {
-				this.loading = true
-				listRole(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
-					this.roleList = response.rows
-					this.total = response.total
-					this.loading = false
-				})
-			},
-			// 单击角色表格某一行 行点击事件,这里获取到的行对象(row)是没有index属性的
-			roleLineClick(row) {
-				this.getIndex = row.index
-				this.objRole = row
-			},
-			//为行对象(row)设置index属性
-			tableRowClassName({ row, rowIndex }) {
-				row.index = rowIndex
-			},
-			// 双击角色表格某一行
-			roleLineDbclick(row) {
+		// 表头权限;列表
+		getHeaderPermission() {
+			this.functionalLineDbclick(this.objFun)
+			this.getList()
+		},
+		/** 查询角色列表 */
+		getList() {
+			this.loading = true
+			listRole(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
+				this.roleList = response.rows
+				this.total = response.total
+				this.loading = false
+			})
+		},
+		// 单击角色表格某一行 行点击事件,这里获取到的行对象(row)是没有index属性的
+		roleLineClick(row) {
+			this.getIndex = row.index
+			this.objRole = row
+		},
+		//为行对象(row)设置index属性
+		tableRowClassName({ row, rowIndex }) {
+			row.index = rowIndex
+		},
+		// 双击角色表格某一行
+		roleLineDbclick(row) {
+			if (JSON.stringify(row) !== '{}') {
 				this.roleId = ''
 				this.functionList = []
 				this.checkedKeys = []
@@ -262,484 +263,495 @@
 				this.FuncListTree = []
 				this.roleId = row.roleId
 				getRoleMenuTreeselect(row.roleId).then((res) => {
-					this.checkedKeys = res.data.checkedKeys
-					this.functionList = res.data.menus
-					this.btnList = this.functionList.filter((item, index, c) => item.menuType == 'F')
-					this.btnsLists = this.functionList.filter((item, index, c) => item.menuType == 'C')
-					this.FuncList = this.functionList.filter((item, index, c) => item.menuType == 'M' || item.menuType == 'C')
-					this.FuncListTree = this.handleTree(this.FuncList, 'menuId', 'parentId')
+					if (res.code === 200) {
+						this.checkedKeys = res.data.checkedKeys
+						this.functionList = res.data.menus
+						this.btnList = this.functionList.filter((item, index, c) => item.menuType == 'F')
+						this.btnsLists = this.functionList.filter((item, index, c) => item.menuType == 'C')
+						this.FuncList = this.functionList.filter((item, index, c) => item.menuType == 'M' || item.menuType == 'C')
+						this.FuncListTree = this.handleTree(this.FuncList, 'menuId', 'parentId')
+					}
 				})
 				this.functionalShow = true
 				this.roleShow = false
 				this.over = 2
-			},
-			// 单击功能权限表格某一行
-			functionalLineClick(row, event, column) {
+			} else {
+				this.$notify({
+					title: '警告',
+					message: '请选择角色',
+					type: 'warning'
+				})
+			}
+		},
+		// 单击功能权限表格某一行
+		functionalLineClick(row, event, column) {
+			if (row) {
 				this.getIndex1 = row.index
 				this.objFun = row
-			},
-			// 双击功能权限表格某一行
-			functionalLineDbclick(row, event, column) {
-				this.disabled = this.isChecked(row) ? false : true
-				this.headList = []
-				this.functionalShow = false
-				this.headShow = true
-				this.over = 3
-				this.listName = row.menuName
-				this.menuId = row.menuId
-				this.checkStatus = this.isChecked(row) ? 0 : 1
-				getTableHeadList(this.roleId, row.menuId, this.checkStatus).then((res) => {
-					this.headList = res.data
+			}
+		},
+		// 双击功能权限表格某一行
+		functionalLineDbclick(row, event, column) {
+			this.disabled = this.isChecked(row) ? false : true
+			this.headList = []
+			this.functionalShow = false
+			this.headShow = true
+			this.over = 3
+			this.listName = row.menuName
+			this.menuId = row.menuId
+			this.checkStatus = this.isChecked(row) ? 0 : 1
+			getTableHeadList(this.roleId, row.menuId, this.checkStatus).then((res) => {
+				this.headList = res.data
+			})
+		},
+		// 单击表头权限表格某一行
+		headlLineClick(row, event, column) {
+			this.getIndex2 = row.index
+		},
+		/** 查询菜单树结构 */
+		getMenuTreeselect() {
+			menuTreeselect().then((response) => {
+				this.menuOptions = response.data
+			})
+		},
+		/** 查询部门树结构 */
+		getDeptTreeselect() {
+			deptTreeselect().then((response) => {
+				this.deptOptions = response.data
+			})
+		},
+		// 所有菜单节点数据
+		// getMenuAllCheckedKeys() {
+		//   // 目前被选中的菜单节点
+		//   let checkedKeys = this.$refs.menu.getCheckedKeys();
+		//   // 半选中的菜单节点
+		//   let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
+		//   checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
+		//   return checkedKeys;
+		// },
+		// // 所有部门节点数据
+		// getDeptAllCheckedKeys() {
+		//   // 目前被选中的部门节点
+		//   let checkedKeys = this.$refs.dept.getCheckedKeys();
+		//   // 半选中的部门节点
+		//   let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys();
+		//   checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
+		//   return checkedKeys;
+		// },
+		/** 根据角色ID查询菜单树结构 */
+		getRoleMenuTreeselect(roleId) {
+			return roleMenuTreeselect(roleId).then((response) => {
+				this.menuOptions = response.menus
+				return response
+			})
+		},
+		/** 根据角色ID查询部门树结构 */
+		getRoleDeptTreeselect(roleId) {
+			return roleDeptTreeselect(roleId).then((response) => {
+				this.deptOptions = response.depts
+				return response
+			})
+		},
+		// 角色状态修改
+		handleStatusChange(row) {
+			let text = row.status === '0' ? '禁用' : '启用'
+			this.$modal
+				.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?')
+				.then(function () {
+					row.status = row.status === '0' ? '1' : '0'
+					return changeRoleStatus(row.roleId, row.status)
 				})
-			},
-			// 单击表头权限表格某一行
-			headlLineClick(row, event, column) {
-				this.getIndex2 = row.index
-			},
-			/** 查询菜单树结构 */
-			getMenuTreeselect() {
-				menuTreeselect().then((response) => {
-					this.menuOptions = response.data
+				.then(() => {
+					this.$modal.msgSuccess(text + '成功')
 				})
-			},
-			/** 查询部门树结构 */
-			getDeptTreeselect() {
-				deptTreeselect().then((response) => {
-					this.deptOptions = response.data
+				.catch(function () {
+					row.status = row.status === '0' ? '1' : '0'
 				})
-			},
-			// 所有菜单节点数据
-			// getMenuAllCheckedKeys() {
-			//   // 目前被选中的菜单节点
-			//   let checkedKeys = this.$refs.menu.getCheckedKeys();
-			//   // 半选中的菜单节点
-			//   let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
-			//   checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
-			//   return checkedKeys;
-			// },
-			// // 所有部门节点数据
-			// getDeptAllCheckedKeys() {
-			//   // 目前被选中的部门节点
-			//   let checkedKeys = this.$refs.dept.getCheckedKeys();
-			//   // 半选中的部门节点
-			//   let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys();
-			//   checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
-			//   return checkedKeys;
-			// },
-			/** 根据角色ID查询菜单树结构 */
-			getRoleMenuTreeselect(roleId) {
-				return roleMenuTreeselect(roleId).then((response) => {
-					this.menuOptions = response.menus
-					return response
+		},
+		// 修改功能操作权限
+		updateBtn(e, obj1) {
+			let obj = {
+				menuId: e.menuId,
+				roleId: this.roleId
+			}
+			let arr = []
+			arr.push(obj)
+			// let parent = this.functionList.find((item) => item.menuId == e.parentId)
+			// let parents = []
+			// while (parent) {
+			// 	parents.push(parent)
+			// 	parent = this.functionList.find((item) => item.menuId == parent.parentId)
+			// }
+			if (this.checkedKeys.includes(e.menuId)) {
+				authUserCancelAll(arr).then((res) => {
+					if (res.code == 200) {
+						this.checkedKeys = this.checkedKeys.filter((item) => item != e.menuId)
+						this.$msg({ message: '修改成功' })
+					}
 				})
-			},
-			/** 根据角色ID查询部门树结构 */
-			getRoleDeptTreeselect(roleId) {
-				return roleDeptTreeselect(roleId).then((response) => {
-					this.deptOptions = response.depts
-					return response
+			} else {
+				// let arrs = []
+				// arrs.push(obj)
+				// parents.forEach(element => {
+				// 	let e = {
+				// 		menuId: element.menuId,
+				// 		roleId: this.roleId
+				// 	}
+				// 	arrs.push(e)
+				// });
+				saveRoleMenu(arr).then((res) => {
+					if (res.code == 200) {
+						this.checkedKeys.push(e.menuId)
+						this.$msg({ message: '修改成功' })
+						// this.checkedKeys.push(obj1.menuId)
+						// parents.forEach(element => {
+						//   this.checkedKeys.push(element.menuId)
+						// });
+					}
 				})
-			},
-			// 角色状态修改
-			handleStatusChange(row) {
-				let text = row.status === '0' ? '禁用' : '启用'
-				this.$modal
-					.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?')
-					.then(function () {
-						row.status = row.status === '0' ? '1' : '0'
-						return changeRoleStatus(row.roleId, row.status)
-					})
-					.then(() => {
-						this.$modal.msgSuccess(text + '成功')
-					})
-					.catch(function () {
-						row.status = row.status === '0' ? '1' : '0'
-					})
-			},
-			// 修改功能操作权限
-			updateBtn(e, obj1) {
+			}
+
+			// let checked = !this.checkedKeys.includes(e.menuId)
+			// let obj = {
+			// 	menuId: e.menuId,
+			// 	roleId: this.roleId
+			// }
+			// let arr = []
+			// arr.push(obj)
+			// saveRoleMenu(arr).then((res) => {
+			// 		if (res.code == 200) {
+			// 			this.checkedKeys.push(e.menuId)
+			// 		}
+			// 	})
+			// if (checked) {
+			// 	let sArr = [...this.checkedKeys, e.menuId]
+			// 	parents.forEach((p) => {
+			// 		if (this.findChildrenIds(p).every((item) => sArr.includes(item))) {
+			// 			arr.push({
+			// 				menuId: p.menuId,
+			// 				roleId: this.roleId
+			// 			})
+			// 		}
+			// 	})
+			// } else {
+			// 	parents.forEach((p) => {
+			// 		arr.push({
+			// 			menuId: p.menuId,
+			// 			roleId: this.roleId
+			// 		})
+			// 	})
+			// }
+			// let req = JSON.stringify(arr)
+			// this.form1.json = req
+			// if (!checked) {
+			// 	authUserCancelAll(arr).then((res) => {
+			// 		if (res.code == 200) {
+			// 			this.checkedKeys = this.checkedKeys.filter((item) => item != e.menuId)
+			// 		}
+			// 	})
+			// } else {
+			// 	saveRoleMenu(arr).then((res) => {
+			// 		if (res.code == 200) {
+			// 			this.checkedKeys.push(e.menuId)
+			// 		}
+			// 	})
+			// }
+		},
+		// 表头权限显示
+		showOrHide(row) {
+			let iss = row.isShow === '1' ? '0' : '1'
+			setSysTableCfgIsShow(row.id, iss, this.menuId, this.roleId).then((res) => {
+				if (res.code == 200) {
+					row.isShow = row.isShow == '1' || row.isShow == null ? '0' : '1'
+					this.$msg({ message: '修改成功' })
+				}
+			})
+		},
+		// 取消按钮
+		cancel() {
+			this.open = false
+			this.reset()
+		},
+		// 取消按钮(数据权限)
+		cancelDataScope() {
+			this.openDataScope = false
+			this.reset()
+		},
+		// 表单重置
+		reset() {
+			// if (this.$refs.menu != undefined) {
+			//   this.$refs.menu.setCheckedKeys([]);
+			// }
+			;(this.menuExpand = false),
+				(this.menuNodeAll = false),
+				(this.deptExpand = true),
+				(this.deptNodeAll = false),
+				(this.form = {
+					roleId: undefined,
+					roleName: undefined,
+					roleKey: undefined,
+					roleSort: 0,
+					status: '0',
+					menuIds: [],
+					deptIds: [],
+					menuCheckStrictly: true,
+					deptCheckStrictly: true,
+					remark: undefined
+				})
+			this.resetForm('form')
+		},
+		// /** 搜索按钮操作 */
+		// handleQuery() {
+		// 	this.queryParams.pageNum = 1
+		// 	this.getList()
+		// },
+		// /** 重置按钮操作 */
+		// resetQuery() {
+		// 	this.dateRange = []
+		// 	this.resetForm('queryForm')
+		// 	this.handleQuery()
+		// },
+		// 树权限(展开/折叠)
+		// handleCheckedTreeExpand(value, type) {
+		// 	if (type == 'menu') {
+		// 		let treeList = this.menuOptions
+		// 		for (let i = 0; i < treeList.length; i++) {
+		// 			this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value
+		// 		}
+		// 	} else if (type == 'dept') {
+		// 		let treeList = this.deptOptions
+		// 		for (let i = 0; i < treeList.length; i++) {
+		// 			this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value
+		// 		}
+		// 	}
+		// },
+		// 树权限(全选/全不选)
+		// handleCheckedTreeNodeAll(value, type) {
+		//   if (type == 'menu') {
+		//     this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
+		//   } else if (type == 'dept') {
+		//     this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []);
+		//   }
+		// },
+		// 树权限(父子联动)
+		handleCheckedTreeConnect(e, type, item) {
+			let value = e.target.checked
+			// if (item.parentId) {
+
+			// }
+			// let ms = this.functionList.filter((item, index, c) => item.menuType == 'M')
+			// let mss = this.functionList.filter((it, index, c) => it.parentId == item.parentId)
+			// let m = ms.filter(i => i.menuId == item.parentId)
+			// console.log(mss)
+			// let ids = this.findChildrenIds(item)
+			// let objs = ids.map((m) => {
+			// 	return {
+			// 		menuId: m,
+			// 		roleId: this.roleId
+			// 	}
+			// })
+			// objs.push({
+			// 	menuId: item.menuId,
+			// 	roleId: this.roleId
+			// })
+			if (value) {
+				this.checkStatus = 0
+				this.disabled = false
+				this.checkedKeys.push(item.menuId)
 				let obj = {
-					menuId: e.menuId,
+					menuId: item.menuId,
 					roleId: this.roleId
 				}
 				let arr = []
 				arr.push(obj)
-				// let parent = this.functionList.find((item) => item.menuId == e.parentId)
-				// let parents = []
-				// while (parent) {
-				// 	parents.push(parent)
-				// 	parent = this.functionList.find((item) => item.menuId == parent.parentId)
-				// }
-				if (this.checkedKeys.includes(e.menuId)) {
-					authUserCancelAll(arr).then((res) => {
-						if (res.code == 200) {
-							this.checkedKeys = this.checkedKeys.filter((item) => item != e.menuId)
-							this.$msg({ message: '修改成功' })
-						}
-					})
-				} else {
-					// let arrs = []
-					// arrs.push(obj)
-					// parents.forEach(element => {
-					// 	let e = {
-					// 		menuId: element.menuId,
-					// 		roleId: this.roleId
-					// 	}
-					// 	arrs.push(e)
-					// });
-					saveRoleMenu(arr).then((res) => {
-						if (res.code == 200) {
-							this.checkedKeys.push(e.menuId)
-							this.$msg({ message: '修改成功' })
-							// this.checkedKeys.push(obj1.menuId)
-							// parents.forEach(element => {
-							//   this.checkedKeys.push(element.menuId)
-							// });
-						}
-					})
-				}
-
-				// let checked = !this.checkedKeys.includes(e.menuId)
-				// let obj = {
-				// 	menuId: e.menuId,
-				// 	roleId: this.roleId
-				// }
-				// let arr = []
-				// arr.push(obj)
-				// saveRoleMenu(arr).then((res) => {
-				// 		if (res.code == 200) {
-				// 			this.checkedKeys.push(e.menuId)
-				// 		}
-				// 	})
-				// if (checked) {
-				// 	let sArr = [...this.checkedKeys, e.menuId]
-				// 	parents.forEach((p) => {
-				// 		if (this.findChildrenIds(p).every((item) => sArr.includes(item))) {
-				// 			arr.push({
-				// 				menuId: p.menuId,
-				// 				roleId: this.roleId
-				// 			})
-				// 		}
-				// 	})
-				// } else {
-				// 	parents.forEach((p) => {
-				// 		arr.push({
-				// 			menuId: p.menuId,
-				// 			roleId: this.roleId
-				// 		})
-				// 	})
-				// }
-				// let req = JSON.stringify(arr)
-				// this.form1.json = req
-				// if (!checked) {
-				// 	authUserCancelAll(arr).then((res) => {
-				// 		if (res.code == 200) {
-				// 			this.checkedKeys = this.checkedKeys.filter((item) => item != e.menuId)
-				// 		}
-				// 	})
-				// } else {
-				// 	saveRoleMenu(arr).then((res) => {
-				// 		if (res.code == 200) {
-				// 			this.checkedKeys.push(e.menuId)
-				// 		}
-				// 	})
-				// }
-			},
-			// 表头权限显示
-			showOrHide(row) {
-				let iss = row.isShow === '1' ? '0' : '1'
-				setSysTableCfgIsShow(row.id, iss, this.menuId, this.roleId).then((res) => {
+				saveRoleMenu(arr).then((res) => {
 					if (res.code == 200) {
-						row.isShow = row.isShow == '1' || row.isShow == null ? '0' : '1'
 						this.$msg({ message: '修改成功' })
 					}
 				})
-			},
-			// 取消按钮
-			cancel() {
-				this.open = false
-				this.reset()
-			},
-			// 取消按钮(数据权限)
-			cancelDataScope() {
-				this.openDataScope = false
-				this.reset()
-			},
-			// 表单重置
-			reset() {
-				// if (this.$refs.menu != undefined) {
-				//   this.$refs.menu.setCheckedKeys([]);
-				// }
-				;(this.menuExpand = false),
-					(this.menuNodeAll = false),
-					(this.deptExpand = true),
-					(this.deptNodeAll = false),
-					(this.form = {
-						roleId: undefined,
-						roleName: undefined,
-						roleKey: undefined,
-						roleSort: 0,
-						status: '0',
-						menuIds: [],
-						deptIds: [],
-						menuCheckStrictly: true,
-						deptCheckStrictly: true,
-						remark: undefined
-					})
-				this.resetForm('form')
-			},
-			// /** 搜索按钮操作 */
-			// handleQuery() {
-			// 	this.queryParams.pageNum = 1
-			// 	this.getList()
-			// },
-			// /** 重置按钮操作 */
-			// resetQuery() {
-			// 	this.dateRange = []
-			// 	this.resetForm('queryForm')
-			// 	this.handleQuery()
-			// },
-			// 树权限(展开/折叠)
-			// handleCheckedTreeExpand(value, type) {
-			// 	if (type == 'menu') {
-			// 		let treeList = this.menuOptions
-			// 		for (let i = 0; i < treeList.length; i++) {
-			// 			this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value
-			// 		}
-			// 	} else if (type == 'dept') {
-			// 		let treeList = this.deptOptions
-			// 		for (let i = 0; i < treeList.length; i++) {
-			// 			this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value
-			// 		}
-			// 	}
-			// },
-			// 树权限(全选/全不选)
-			// handleCheckedTreeNodeAll(value, type) {
-			//   if (type == 'menu') {
-			//     this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
-			//   } else if (type == 'dept') {
-			//     this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []);
-			//   }
-			// },
-			// 树权限(父子联动)
-			handleCheckedTreeConnect(e, type, item) {
-				let value = e.target.checked
-				// if (item.parentId) {
-
-				// }
-				// let ms = this.functionList.filter((item, index, c) => item.menuType == 'M')
-				// let mss = this.functionList.filter((it, index, c) => it.parentId == item.parentId)
-				// let m = ms.filter(i => i.menuId == item.parentId)
-				// console.log(mss)
-				// let ids = this.findChildrenIds(item)
-				// let objs = ids.map((m) => {
-				// 	return {
-				// 		menuId: m,
-				// 		roleId: this.roleId
-				// 	}
-				// })
-				// objs.push({
-				// 	menuId: item.menuId,
-				// 	roleId: this.roleId
-				// })
-				if (value) {
-					this.checkStatus = 0
-					this.disabled = false
-					this.checkedKeys.push(item.menuId)
-					let obj = {
-						menuId: item.menuId,
-						roleId: this.roleId
-					}
-					let arr = []
-					arr.push(obj)
-					saveRoleMenu(arr).then((res) => {
-						if (res.code == 200) {
-							this.$msg({ message: '修改成功' })
-						}
-					})
-				} else {
-					this.checkedKeys = this.checkedKeys.filter((f) => f != item.menuId)
-					this.checkStatus = 1
-					this.disabled = true
-					let obj = {
-						menuId: item.menuId,
-						roleId: this.roleId
-					}
-					let arr = []
-					arr.push(obj)
-					authUserCancelAll(arr).then((res) => {
-						if (res.code == 200) {
-							this.$msg({ message: '修改成功' })
-						}
-					})
+			} else {
+				this.checkedKeys = this.checkedKeys.filter((f) => f != item.menuId)
+				this.checkStatus = 1
+				this.disabled = true
+				let obj = {
+					menuId: item.menuId,
+					roleId: this.roleId
 				}
-			},
-			/** 新增按钮操作 */
-			handleAdd() {
-				this.reset()
-				this.getMenuTreeselect()
-				this.open = true
-				this.title = '添加角色'
-			},
-			/** 修改按钮操作 */
-			handleUpdate(row) {
-				this.reset()
-				const roleId = row.roleId || this.ids
-				// const roleMenu = this.getRoleMenuTreeselect(roleId);
-				getRole(roleId).then((response) => {
-					this.form = response.data
-					this.open = true
-					// this.$nextTick(() => {
-					//   roleMenu.then(res => {
-					//     let checkedKeys = res.checkedKeys
-					//     checkedKeys.forEach((v) => {
-					//         this.$nextTick(()=>{
-					//             this.$refs.menu.setChecked(v, true ,false);
-					//         })
-					//     })
-					//   });
-					// });
-					this.title = '修改角色'
-				})
-			},
-			/** 选择角色权限范围触发 */
-			// dataScopeSelectChange(value) {
-			//   if(value !== '2') {
-			//     this.$refs.dept.setCheckedKeys([]);
-			//   }
-			// },
-			/** 分配数据权限操作 */
-			handleDataScope(row) {
-				this.reset()
-				const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId)
-				getRole(row.roleId).then((response) => {
-					this.form = response.data
-					this.openDataScope = true
-					// this.$nextTick(() => {
-					//   roleDeptTreeselect.then(res => {
-					//     this.$refs.dept.setCheckedKeys(res.checkedKeys);
-					//   });
-					// });
-					this.title = '分配数据权限'
-				})
-			},
-			/** 分配用户操作 */
-			// handleAuthUser: function (row) {
-			// 	const roleId = row.roleId
-			// 	this.$router.push('/system/role-auth/user/' + roleId)
-			// },
-			/** 提交按钮 */
-			submitForm: function () {
-				this.$refs['form'].validate((valid) => {
-					if (valid) {
-						if (this.form.roleId != undefined) {
-							// this.form.menuIds = this.getMenuAllCheckedKeys();
-							this.form.menuIds = []
-							updateRole(this.form).then((response) => {
-								console.log(response)
-								this.$modal.msgSuccess('修改成功')
-								this.open = false
-								this.getList()
-							})
-						} else {
-							// this.form.menuIds = this.getMenuAllCheckedKeys();
-							let val = this.form.roleName
-							this.form.roleKey = pinyin.getFullChars(val)
-							addRole(this.form).then((response) => {
-								this.$modal.msgSuccess('新增成功')
-								this.open = false
-								this.getList()
-							})
-						}
+				let arr = []
+				arr.push(obj)
+				authUserCancelAll(arr).then((res) => {
+					if (res.code == 200) {
+						this.$msg({ message: '修改成功' })
 					}
 				})
-			},
-			/** 提交按钮(数据权限) */
-			submitDataScope: function () {
-				if (this.form.roleId != undefined) {
-					this.form.deptIds = this.getDeptAllCheckedKeys()
-					dataScope(this.form).then((response) => {
-						this.$modal.msgSuccess('修改成功')
-						this.openDataScope = false
-						this.getList()
-					})
-				}
-			},
-			/** 删除按钮操作 */
-			handleDelete(row) {
-				const roleIds = row.roleId || this.ids
-				this.$modal
-					.confirm('是否确认删除角色为"' + row.roleName + '"的数据项?')
-					.then(function () {
-						return delRole(roleIds)
-					})
-					.then((res) => {
-						if (res.code === 200) {
+			}
+		},
+		/** 新增按钮操作 */
+		handleAdd() {
+			this.reset()
+			this.getMenuTreeselect()
+			this.open = true
+			this.title = '添加角色'
+		},
+		/** 修改按钮操作 */
+		handleUpdate(row) {
+			this.reset()
+			const roleId = row.roleId || this.ids
+			// const roleMenu = this.getRoleMenuTreeselect(roleId);
+			getRole(roleId).then((response) => {
+				this.form = response.data
+				this.open = true
+				// this.$nextTick(() => {
+				//   roleMenu.then(res => {
+				//     let checkedKeys = res.checkedKeys
+				//     checkedKeys.forEach((v) => {
+				//         this.$nextTick(()=>{
+				//             this.$refs.menu.setChecked(v, true ,false);
+				//         })
+				//     })
+				//   });
+				// });
+				this.title = '修改角色'
+			})
+		},
+		/** 选择角色权限范围触发 */
+		// dataScopeSelectChange(value) {
+		//   if(value !== '2') {
+		//     this.$refs.dept.setCheckedKeys([]);
+		//   }
+		// },
+		/** 分配数据权限操作 */
+		handleDataScope(row) {
+			this.reset()
+			const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId)
+			getRole(row.roleId).then((response) => {
+				this.form = response.data
+				this.openDataScope = true
+				// this.$nextTick(() => {
+				//   roleDeptTreeselect.then(res => {
+				//     this.$refs.dept.setCheckedKeys(res.checkedKeys);
+				//   });
+				// });
+				this.title = '分配数据权限'
+			})
+		},
+		/** 分配用户操作 */
+		// handleAuthUser: function (row) {
+		// 	const roleId = row.roleId
+		// 	this.$router.push('/system/role-auth/user/' + roleId)
+		// },
+		/** 提交按钮 */
+		submitForm: function () {
+			this.$refs['form'].validate((valid) => {
+				if (valid) {
+					if (this.form.roleId != undefined) {
+						// this.form.menuIds = this.getMenuAllCheckedKeys();
+						this.form.menuIds = []
+						updateRole(this.form).then((response) => {
+							console.log(response)
+							this.$modal.msgSuccess('修改成功')
+							this.open = false
 							this.getList()
-							this.$modal.msgSuccess('删除成功')
-						} else if (res.code === 500) {
+						})
+					} else {
+						// this.form.menuIds = this.getMenuAllCheckedKeys();
+						let val = this.form.roleName
+						this.form.roleKey = pinyin.getFullChars(val)
+						addRole(this.form).then((response) => {
+							this.$modal.msgSuccess('新增成功')
+							this.open = false
 							this.getList()
-							this.$notify({
-								title: '警告',
-								message: res.msg,
-								type: 'warning'
-							})
-						}
-					})
-					.catch(() => {})
-			},
-			/** 导出按钮操作 */
-			// handleExport() {
-			// 	this.download(
-			// 		'system/role/export',
-			// 		{
-			// 			...this.queryParams
-			// 		},
-			// 		`role_${new Date().getTime()}.xlsx`
-			// 	)
-			// },
-			//寻找子id集合
-			findIds(parent) {
-				if (!parent.children) {
-					return
+						})
+					}
 				}
-				let res = []
-				parent.children.forEach((item) => {
-					if (item.menuType == 'C') {
-						res.push(item)
-					} else {
-						res = res.concat(this.findIds(item))
+			})
+		},
+		/** 提交按钮(数据权限) */
+		submitDataScope: function () {
+			if (this.form.roleId != undefined) {
+				this.form.deptIds = this.getDeptAllCheckedKeys()
+				dataScope(this.form).then((response) => {
+					this.$modal.msgSuccess('修改成功')
+					this.openDataScope = false
+					this.getList()
+				})
+			}
+		},
+		/** 删除按钮操作 */
+		handleDelete(row) {
+			const roleIds = row.roleId || this.ids
+			this.$modal
+				.confirm('是否确认删除角色为"' + row.roleName + '"的数据项?')
+				.then(function () {
+					return delRole(roleIds)
+				})
+				.then((res) => {
+					if (res.code === 200) {
+						this.getList()
+						this.$modal.msgSuccess('删除成功')
+					} else if (res.code === 500) {
+						this.getList()
+						this.$notify({
+							title: '警告',
+							message: res.msg,
+							type: 'warning'
+						})
 					}
 				})
-				return res
-			},
-			//寻找子id集合
-			findChildrenIds(parent) {
-				if (parent.menuType == 'M') {
-					let childIds = this.findIds(parent).map((item) => item.menuId)
-					return this.btnList.filter((item) => childIds.includes(item.parentId)).map((item) => item.menuId)
-				} else if (parent.menuType == 'C') {
-					return this.btnList.filter((item) => item.parentId == parent.menuId).map((item) => item.menuId)
+				.catch(() => {})
+		},
+		/** 导出按钮操作 */
+		// handleExport() {
+		// 	this.download(
+		// 		'system/role/export',
+		// 		{
+		// 			...this.queryParams
+		// 		},
+		// 		`role_${new Date().getTime()}.xlsx`
+		// 	)
+		// },
+		//寻找子id集合
+		findIds(parent) {
+			if (!parent.children) {
+				return
+			}
+			let res = []
+			parent.children.forEach((item) => {
+				if (item.menuType == 'C') {
+					res.push(item)
+				} else {
+					res = res.concat(this.findIds(item))
 				}
+			})
+			return res
+		},
+		//寻找子id集合
+		findChildrenIds(parent) {
+			if (parent.menuType == 'M') {
+				let childIds = this.findIds(parent).map((item) => item.menuId)
+				return this.btnList.filter((item) => childIds.includes(item.parentId)).map((item) => item.menuId)
+			} else if (parent.menuType == 'C') {
+				return this.btnList.filter((item) => item.parentId == parent.menuId).map((item) => item.menuId)
+			}
+		}
+	},
+	computed: {
+		btnListss() {
+			return function (pid) {
+				return this.btnList.filter((item) => item.parentId == pid)
 			}
 		},
-		computed: {
-			btnListss() {
-				return function (pid) {
-					return this.btnList.filter((item) => item.parentId == pid)
-				}
-			},
-			isChecked() {
-				return function (obj) {
-					// return this.findChildrenIds(obj).length > 0 && this.findChildrenIds(obj).every((item) => this.checkedKeys.includes(item))
-					return this.checkedKeys.includes(obj.menuId)
-				}
+		isChecked() {
+			return function (obj) {
+				// return this.findChildrenIds(obj).length > 0 && this.findChildrenIds(obj).every((item) => this.checkedKeys.includes(item))
+				return this.checkedKeys.includes(obj.menuId)
 			}
 		}
 	}
+}
 </script>
 <style scoped>
-	.activeClass {
-		color: #409eff;
-	}
+.activeClass {
+	color: #409eff;
+}
 </style>