|
@@ -1,16 +1,16 @@
|
|
|
<template>
|
|
|
|
|
|
<div>
|
|
|
- 未开发,未对接,光明的页面暂时拿过来用
|
|
|
+
|
|
|
|
|
|
|
|
|
<!-- 卡片视图区域 -->
|
|
|
<el-card class="box-card">
|
|
|
<div class="search-bx1">
|
|
|
- <el-input v-model="sendData.roleName" placeholder="角色" style="width: 220px;" class="g-mr20" clearable />
|
|
|
+ <el-input v-model="searchData.roleName" placeholder="角色" style="width: 220px;" class="g-mr20" clearable />
|
|
|
|
|
|
<el-button type="primary" @click="form_search">搜索</el-button>
|
|
|
- <el-button type="primary" v-if="isButtonEdit" @click="form_add">添加角色</el-button>
|
|
|
+ <el-button type="primary" @click="form_add">添加角色</el-button>
|
|
|
</div>
|
|
|
|
|
|
|
|
@@ -18,20 +18,25 @@
|
|
|
<el-table key="0" :data="tableList" v-loading="tableLoading" element-loading-text="给我一点时间" stripe border fit>
|
|
|
<el-table-column label="序号" width="50px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ scope.row.number }}</span>
|
|
|
+ <span>{{ scope.row.id }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="角色" min-width="150px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ scope.row.roleName }}</span>
|
|
|
+ <span>{{ scope.row.name }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="角色说明" min-width="150px" align="center">
|
|
|
+ <el-table-column label="更新时间" min-width="150px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.created_at_format }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="更新用户" min-width="150px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ scope.row.remark }}</span>
|
|
|
+ <span>{{ scope.row.created_at_format }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+
|
|
|
|
|
|
|
|
|
<!-- <el-table-column label="状态" min-width="100px" align="center">
|
|
@@ -42,13 +47,13 @@
|
|
|
<el-table-column label="操作" align="center" width="400" class-name="small-padding fixed-width" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- 修改按钮 -->
|
|
|
- <el-button v-if="isButtonEdit" type="primary" size="mini" icon="el-icon-edit" @click="form_edit(scope.row)">修改</el-button>
|
|
|
+ <el-button type="primary" size="mini" icon="el-icon-edit" @click="form_edit(scope.row)">修改</el-button>
|
|
|
<!-- 删除按钮 -->
|
|
|
- <el-button v-if="isButtonEdit" type="danger" size="mini" icon="el-icon-delete" @click="form_delete(scope.row)">删除</el-button>
|
|
|
+ <el-button type="danger" size="mini" icon="el-icon-delete" @click="form_delete(scope.row)">删除</el-button>
|
|
|
<!-- 分配角色 -->
|
|
|
- <el-button v-if="isButtonEdit" type="warning" size="mini" icon="el-icon-setting" @click="form_set(scope.row)">分配权限</el-button>
|
|
|
+ <el-button type="warning" size="mini" icon="el-icon-setting" @click="form_set(scope.row)">页面权限</el-button>
|
|
|
|
|
|
- <el-button v-if="isButtonEdit" type="warning" size="mini" icon="el-icon-setting" @click="form_set2(scope.row)">数据权限</el-button>
|
|
|
+ <el-button type="warning" size="mini" icon="el-icon-setting" @click="form_set2(scope.row)">数据权限</el-button>
|
|
|
|
|
|
|
|
|
</template>
|
|
@@ -56,7 +61,7 @@
|
|
|
</el-table>
|
|
|
|
|
|
<!-- 分页区域 -->
|
|
|
- <el-pagination @size-change="change_size_page" @current-change="change_current_page" :current-page="sendData.pageNum" :page-sizes="[1,5,10,20,30,50]" :page-size="sendData.pageSize" layout="total, prev, pager, next" :total="sendData.total"/>
|
|
|
+ <el-pagination @size-change="change_size_page" @current-change="change_current_page" :current-page="searchData.pageNum" :page-sizes="[1,5,10,20,30,50]" :page-size="searchData.pageSize" layout="total, prev, pager, next" :total="searchData.total"/>
|
|
|
</el-card>
|
|
|
|
|
|
|
|
@@ -64,14 +69,10 @@
|
|
|
<el-dialog :title="addFormTxt[addFormStatus]" :visible.sync="addFormShow" @close="add_dialog_close" width="50%">
|
|
|
<div class="">
|
|
|
<el-form ref="addFormRef" :rules="addFormRules" :model="addForm" label-position="right" label-width="70px" style="width:50%;margin:0 auto 50px">
|
|
|
- <el-form-item label="角色名" prop="roleName">
|
|
|
- <el-input v-model="addForm.roleName" ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="角色说明" prop="remark">
|
|
|
- <el-input v-model="addForm.remark"></el-input>
|
|
|
+ <el-form-item label="角色名" prop="name">
|
|
|
+ <el-input v-model="addForm.name" ></el-input>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="addFormStatus==='create'?add_dialog_save():edit_dialog_save()">确认</el-button>
|
|
@@ -87,8 +88,8 @@
|
|
|
<div class="">
|
|
|
<el-form ref="setFormRef" :model="setForm" label-position="right" label-width="70px" style="width:50%;margin:0 auto 50px">
|
|
|
|
|
|
- <!-- 树形控件 -->
|
|
|
- <el-tree ref="tree" :data="rightlist" :props="treeProps" show-checkbox node-key="menuId" default-expand-all :default-checked-keys="checkedIdArr" check-strictly @check-change="change_check"> </el-tree>
|
|
|
+ <!-- 树形控件 -->
|
|
|
+ <el-tree ref="tree" :data="rightlist" :props="treeProps" show-checkbox node-key="id" default-expand-all :default-checked-keys="checkedIdArr" check-strictly @check-change="change_check"> </el-tree>
|
|
|
|
|
|
|
|
|
</el-form>
|
|
@@ -127,8 +128,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { ajaxDataGet, ajaxDataPost, checkButtons} from '@/api/common'
|
|
|
-
|
|
|
+import { ajaxDataGet, ajaxDataPost, ajaxDataPut, ajaxDataDelete, checkButtons} from '@/api/common'
|
|
|
+import { parseTime, json2excel } from '@/utils/index.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
|
|
@@ -139,29 +140,32 @@ export default {
|
|
|
|
|
|
|
|
|
//接口 - 获取 - 表格
|
|
|
- url_get_table:'/role/getAll',
|
|
|
+ url_get_table:'/api/v1/system/role/list',
|
|
|
//接口 - 新增 - 表格
|
|
|
- url_add_table:'/role/add',
|
|
|
+ url_add_table:'/api/v1/system/role/add',
|
|
|
//接口 - 修改 - 表格
|
|
|
- url_edit_table:'/role/update',
|
|
|
+ url_edit_table:'/api/v1/system/role/edit',
|
|
|
//接口 - 删除 - 表格
|
|
|
- url_delete_table:'/role/delete',
|
|
|
+ url_delete_table:'/api/v1/system/role',
|
|
|
|
|
|
isButtonEdit:false,
|
|
|
|
|
|
//获取 - 表格数据 - 参数
|
|
|
- sendData:{
|
|
|
- "roleName": "",
|
|
|
- "pageNum": 1, //页码
|
|
|
- "pageSize": 10, //每页数量
|
|
|
- "total":0, //总页数
|
|
|
- "pastureId": sessionStorage.getItem('g_pastureId')
|
|
|
+ searchData:{
|
|
|
+ name: "",
|
|
|
+ min_updated_time: "",
|
|
|
+ max_updated_time: "",
|
|
|
+ page: 1, //页码
|
|
|
+ page_size: 10, //每页数量
|
|
|
+ total:0, //总页数
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
tableLoading: false,
|
|
|
//表格内容
|
|
|
tableList:[
|
|
|
-
|
|
|
+ {id:1,roleName:'111'}
|
|
|
],
|
|
|
|
|
|
|
|
@@ -174,11 +178,11 @@ export default {
|
|
|
addFormStatus: '',
|
|
|
addFormTxt: { edit: '修改用户', create: '新增用户' },
|
|
|
addForm:{
|
|
|
- roleName:'',remark:''
|
|
|
+ name:'',remark:''
|
|
|
},
|
|
|
|
|
|
addFormRules:{
|
|
|
- roleName: [
|
|
|
+ name: [
|
|
|
{ required: true, message: '用户名必填', trigger: 'blur' },
|
|
|
|
|
|
],
|
|
@@ -202,71 +206,137 @@ export default {
|
|
|
setForm:{
|
|
|
username:'',password:'',email:'',mobile:'',roleList:[2,3]
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
+ rightlistAll:[],
|
|
|
|
|
|
//权限数据
|
|
|
rightlist: [
|
|
|
- // { "menuName": "功能模块", "parentId": 0, "sort": 1, "path": null, "menuId": 208,
|
|
|
+ // { "menuName": "数据统计", "parentId": 0, "sort": 1, "path": null, "menuId": 1, "type":1,
|
|
|
// "children": [
|
|
|
- // {"menuName": "设备基础信息", "parentId": 208, "sort": 2, "path": null, "menuId": 209 },
|
|
|
- // {"menuName": "故障管理", "parentId": 208, "sort": 3,"path": null,"menuId": 210 },
|
|
|
- // {"menuName": "设备绑定", "parentId": 208,"sort": 4, "path": null, "menuId": 211},
|
|
|
- // {"menuName": "备件管理","parentId": 208,"sort": 5,"path": null,"menuId": 212},
|
|
|
- // {"menuName": "盘点","parentId": 208,"sort": 6,"path": null,"menuId": 213},
|
|
|
- // {"menuName": "维修记录","parentId": 208,"sort": 7,"path": null,"menuId": 225}
|
|
|
+ // {"menuName": "饲喂过程", "parentId": 1, "sort": 1, "path": 'FeedProcess', "menuId": 10 ,"type":2},
|
|
|
+ // {"menuName": "增重趋势", "parentId": 1, "sort": 2,"path": 'WeightTrend',"menuId": 11 ,"type":2},
|
|
|
+ // {"menuName": "配方效果", "parentId": 1,"sort": 3, "path": 'FormulaEffect', "menuId": 12,"type":2},
|
|
|
+ // {"menuName": "成长达标率","parentId": 1,"sort": 4,"path": 'GrowthRate',"menuId": 13,"type":2},
|
|
|
+ // {"menuName": "饲料成本","parentId": 1,"sort": 5,"path": 'FeedCost',"menuId": 14,"type":2},
|
|
|
+ // {"menuName": "疾病情况","parentId": 1,"sort": 6,"path": 'DiseaseSituation',"menuId": 15},
|
|
|
+ // {"menuName": "存活率","parentId": 1,"sort": 7,"path": 'SurvivalRate',"menuId": 16},
|
|
|
// ]
|
|
|
// },
|
|
|
- // { "menuName": "工单模块","parentId": 0,"sort": 7,"path": null,"menuId": 214,
|
|
|
+ // { "menuName": "牛只管理","parentId": 0,"sort": 2,"path": null,"menuId": 2, "type":1,
|
|
|
// "children": [
|
|
|
- // {"menuName": "维修接单","parentId": 214,"sort": 8,"path": null,"menuId": 215},
|
|
|
- // {"menuName": "维修","parentId": 214,"sort": 9,"path": null,"menuId": 216},
|
|
|
- // {"menuName": "预防性维护","parentId": 214,"sort": 10,"path": null,"menuId": 217},
|
|
|
- // {"menuName": "工单跟踪","parentId": 214,"sort": 18, "path": null,"menuId": 226}
|
|
|
+ // {"menuName": "称量记录","parentId": 2,"sort": 1,"path": 'WeightRecord',"menuId": 20,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "称量记录编辑","parentId": 20,"sort": 1, "path": null,"menuId": 201,"type":3},
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+ // {"menuName": "牛只信息","parentId": 2,"sort": 2,"path": 'CowInfo',"menuId": 21,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "牛只信息编辑","parentId": 21,"sort": 1, "path": null,"menuId": 211,"type":3},
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+ // {"menuName": "事件记录","parentId": 2,"sort": 3,"path": 'EventRecord',"menuId": 22,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "事件记录编辑","parentId": 22,"sort": 1, "path": null,"menuId": 221,"type":3},
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
// ]
|
|
|
// },
|
|
|
- // {"menuName": "报修模块","parentId": 0,"sort": 11,"path": null,"menuId": 218,
|
|
|
+ // {"menuName": "栏舍管理","parentId": 0,"sort": 3,"path": null,"menuId": 3, "type":1,
|
|
|
// "children": [
|
|
|
- // {"menuName": "报修","parentId": 218,"sort": 12, "path": null,"menuId": 219},
|
|
|
- // {"menuName": "派单","parentId": 218,"sort": 13,"path": null,"menuId": 220}
|
|
|
+ // {"menuName": "牛只栏舍","parentId": 3,"sort": 1, "path": 'CowCowShed',"menuId": 30,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "牛只栏舍编辑","parentId": 30,"sort": 1, "path": null,"menuId": 301,"type":3},
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+ // {"menuName": "栏舍分组","parentId": 3,"sort": 2,"path": 'CowShedGroup',"menuId": 31,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "栏舍分组编辑","parentId": 31,"sort": 1, "path": null,"menuId": 311,"type":3},
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
// ]
|
|
|
// },
|
|
|
- // {"menuName": "审核模块","parentId": 0,"sort": 14,"path": null,"menuId": 221,
|
|
|
+ // {"menuName": "配方计划","parentId": 0,"sort": 4,"path": null,"menuId": 4, "type":1,
|
|
|
// "children": [
|
|
|
- // {"menuName": "维修审核","parentId": 221,"sort": 15, "path": null,"menuId": 222},
|
|
|
- // {"menuName": "领用审核", "parentId": 221,"sort": 16, "path": null,"menuId": 223},
|
|
|
- // {"menuName": "维护审核", "parentId": 221, "sort": 17,"path": null, "menuId": 224}
|
|
|
+ // {"menuName": "饲喂计划","parentId": 4,"sort": 1, "path": 'FeedPlan',"menuId": 40,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "饲喂计划编辑","parentId": 40,"sort": 1, "path": null,"menuId": 401,"type":3},
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+ // {"menuName": "配方模板", "parentId": 4,"sort": 2, "path": 'FormulaTemplate',"menuId": 41,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "配方模板编辑","parentId": 41,"sort": 1, "path": null,"menuId": 411,"type":3},
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
// ]
|
|
|
// },
|
|
|
- // {"menuName": "PC用户管理","parentId": 0,"sort": 30,"path": null,"menuId": 331,
|
|
|
+ // {"menuName": "工单管理","parentId": 0,"sort": 5,"path": null,"menuId": 5, "type":1,
|
|
|
// "children": [
|
|
|
- // {"menuName": "用户管理","parentId": 331,"sort": 18, "path": null,"menuId": 332,
|
|
|
- // "children": [
|
|
|
- // {"menuName": "用户管理查看","parentId": 221,"sort": 15, "path": null,"menuId": 222},
|
|
|
- // {"menuName": "用户管理编辑","parentId": 221,"sort": 15, "path": null,"menuId": 222},
|
|
|
+ // {"menuName": "工单任务(分派)","parentId": 5,"sort": 1, "path": 'WorkTaskAssign',"menuId": 50,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "工单任务(分派)编辑","parentId": 50,"sort": 1, "path": null,"menuId": 501,"type":3},
|
|
|
// ]
|
|
|
- // },
|
|
|
+ // },
|
|
|
+ // {"menuName": "工单任务(执行)", "parentId": 5,"sort": 2, "path": 'WorkTaskImplement',"menuId": 51,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "工单任务(执行)编辑","parentId": 51,"sort": 1, "path": null,"menuId": 511,"type":3},
|
|
|
+ // ]}
|
|
|
// ]
|
|
|
// },
|
|
|
- // {"menuName": "PC权限管理","parentId": 0,"sort": 30,"path": null,"menuId": 331,
|
|
|
+ // {"menuName": "基础设置","parentId": 0,"sort": 6,"path": null,"menuId": 6, "type":1,
|
|
|
// "children": [
|
|
|
- // {"menuName": "角色列表","parentId": 331,"sort": 18, "path": null,"menuId": 332,
|
|
|
- // "children": [
|
|
|
- // {"menuName": "角色列表查看","parentId": 221,"sort": 15, "path": null,"menuId": 222},
|
|
|
- // {"menuName": "角色列表编辑","parentId": 221,"sort": 15, "path": null,"menuId": 222},
|
|
|
+ // {"menuName": "犊牛类型","parentId": 6,"sort": 1, "path": 'CalfType',"menuId": 60,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "犊牛类型编辑","parentId": 60,"sort": 1, "path": null,"menuId": 601,"type":3},
|
|
|
// ]
|
|
|
- // },
|
|
|
+ // },
|
|
|
+ // {"menuName": "工单类型", "parentId": 6,"sort": 2, "path": 'WorkOrderType',"menuId": 61,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "工单类型编辑","parentId": 61,"sort": 1, "path": null,"menuId": 611,"type":3},
|
|
|
+ // ]},
|
|
|
+ // {"menuName": "饲喂车管理", "parentId": 6,"sort": 3, "path": 'FeedCarManagement',"menuId": 62,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "饲喂车管理编辑","parentId": 62,"sort": 1, "path": null,"menuId": 621,"type":3},
|
|
|
+ // ]},
|
|
|
+ // {"menuName": "疾病管理", "parentId": 6,"sort": 4, "path": 'DiseaseType',"menuId": 63,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "疾病管理编辑","parentId": 63,"sort": 1, "path": null,"menuId": 631,"type":3},
|
|
|
+ // ]},
|
|
|
+ // {"menuName": "预设饲喂模板", "parentId": 6,"sort": 5, "path": 'FeedTemplate',"menuId": 64,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "预设饲喂模板编辑","parentId": 64,"sort": 1, "path": null,"menuId": 641,"type":3},
|
|
|
+ // ]},
|
|
|
+ // {"menuName": "默认标准参数", "parentId": 6,"sort": 6, "path": 'DefaultPara',"menuId": 65,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "默认标准参数编辑","parentId": 65,"sort": 1, "path": null,"menuId": 651,"type":3},
|
|
|
+ // ]},
|
|
|
+ // {"menuName": "饲喂成本设置", "parentId": 6,"sort": 7, "path": 'FeedCost',"menuId": 66,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "饲喂成本设置编辑","parentId": 66,"sort": 1, "path": null,"menuId": 661,"type":3},
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+
|
|
|
// ]
|
|
|
// },
|
|
|
- // {"menuName": "PC内容管理","parentId": 0,"sort": 30,"path": null,"menuId": 331,
|
|
|
+ // {"menuName": "系统管理","parentId": 0,"sort": 7,"path": null,"menuId": 7, "type":1,
|
|
|
// "children": [
|
|
|
- // {"menuName": "工时","parentId": 331,"sort": 18, "path": null,"menuId": 332,
|
|
|
- // "children": [
|
|
|
- // {"menuName": "工时查看","parentId": 221,"sort": 15, "path": null,"menuId": 222},
|
|
|
-
|
|
|
+ // {"menuName": "用户管理","parentId": 7,"sort": 1, "path": 'User',"menuId": 70,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "用户管理编辑","parentId": 70,"sort": 1, "path": null,"menuId": 701,"type":3},
|
|
|
// ]
|
|
|
- // },
|
|
|
+ // },
|
|
|
+ // {"menuName": "角色管理", "parentId": 7,"sort": 2, "path": 'Role',"menuId": 71,"type":2,
|
|
|
+ // "children": [
|
|
|
+ // {"menuName": "用户管理编辑","parentId": 71,"sort": 1, "path": null,"menuId": 711,"type":3},
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+
|
|
|
+
|
|
|
// ]
|
|
|
- // }
|
|
|
+ // },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
],
|
|
|
|
|
|
|
|
@@ -274,7 +344,7 @@ export default {
|
|
|
|
|
|
//树形控件的属性绑定对象
|
|
|
treeProps:{
|
|
|
- label:'menuName',children:'children'
|
|
|
+ label:'name',children:'children'
|
|
|
},
|
|
|
|
|
|
//树形默认选中的值
|
|
@@ -289,13 +359,12 @@ export default {
|
|
|
},
|
|
|
created(){
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//表格 - 初始化
|
|
|
- // this.get_table_data()
|
|
|
+ this.get_table_data()
|
|
|
//下拉框
|
|
|
- // this.get_select_list1()
|
|
|
+ this.get_select_list1()
|
|
|
|
|
|
|
|
|
|
|
@@ -316,17 +385,42 @@ export default {
|
|
|
|
|
|
get_select_list1(){
|
|
|
var me = this
|
|
|
- ajaxDataGet('/menu/tree', {"onlyMenu": false, "isPc":""}).then(e => {
|
|
|
- console.log("下拉框1:",e)
|
|
|
+ ajaxDataPost('/api/v1/system/menu/list', {"name":""}).then(e => {
|
|
|
+ console.log("树形下拉框1:",e)
|
|
|
|
|
|
|
|
|
- if(e.data == null || e.data == undefined ||e.data.length == 0 ){
|
|
|
+ if(e.data.list == null || e.data.list == undefined ||e.data.list.length == 0 ){
|
|
|
me.rightlist = []
|
|
|
+ me.rightlistAll = []
|
|
|
+
|
|
|
} else {
|
|
|
- me.rightlist = e.data
|
|
|
+ var rightlistAll = []
|
|
|
+ me.rightlist = e.data.list
|
|
|
+ me.rightlist.forEach(function(item){
|
|
|
+ if(item.children.length !== 0){
|
|
|
+
|
|
|
+ rightlistAll.push(item)
|
|
|
+ item.children.forEach(function(items){
|
|
|
+ if(items.children.length !== 0){
|
|
|
+ rightlistAll.push(items)
|
|
|
+ items.children.forEach(function(itemss){
|
|
|
+ rightlistAll.push(itemss)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ } else {
|
|
|
+ rightlistAll.push(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
}
|
|
|
+ console.log('rightlistAll',rightlistAll)
|
|
|
+ me.rightlistAll = rightlistAll
|
|
|
+
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
})
|
|
|
},
|
|
@@ -334,7 +428,7 @@ export default {
|
|
|
|
|
|
form_search(){
|
|
|
var me = this
|
|
|
- console.log('请求表格列表sendData',me.sendData)
|
|
|
+ console.log('请求表格列表ssearchData',me.searchData)
|
|
|
this.get_table_data()
|
|
|
|
|
|
},
|
|
@@ -345,19 +439,22 @@ export default {
|
|
|
var me = this
|
|
|
|
|
|
me.tableLoading = true
|
|
|
- console.log("sendData======>", me.sendData)
|
|
|
+ console.log("searchData======>", me.searchData)
|
|
|
+ var send_url = me.url_get_table + '?page=' + me.searchData.page + '&page_size=' + me.searchData.page_size
|
|
|
|
|
|
- ajaxDataGet(me.url_get_table, me.sendData).then(e => {
|
|
|
+ ajaxDataPost(send_url, me.searchData).then(e => {
|
|
|
console.log("表格请求结果:",e)
|
|
|
//打印请求成功结果
|
|
|
- if(e.data == null || e.data == undefined ||e.data.length == 0 ){
|
|
|
- me.tableList = []
|
|
|
+ if(e.code == 200 ){
|
|
|
+ me.tableList = e.data.list
|
|
|
+ me.searchData.total = e.data.total; // 总数
|
|
|
+ me.searchData.page = e.data.page; //页码
|
|
|
+ me.searchData.page_size = e.data.page_size; //每页数量
|
|
|
+
|
|
|
} else {
|
|
|
- me.tableList = e.data
|
|
|
- me.sendData.total = e.count; // 总数
|
|
|
- me.sendData.pageNum = e.pageNum; //页码
|
|
|
- me.sendData.pageSize = e.pageSize; //每页数量
|
|
|
+ me.$message({ type: 'error', message: '请求表格列表失败!' + e.msg, duration: 2000 })
|
|
|
}
|
|
|
+
|
|
|
|
|
|
setTimeout(() => {
|
|
|
me.tableLoading = false
|
|
@@ -378,28 +475,31 @@ export default {
|
|
|
//监听 pagenum 改变的事件
|
|
|
change_current_page(item){
|
|
|
console.log(item)
|
|
|
- this.sendData.pageNum = item
|
|
|
+ this.searchData.pageNum = item
|
|
|
this.get_table_data()
|
|
|
},
|
|
|
|
|
|
|
|
|
form_add() {
|
|
|
+
|
|
|
+ this.reset_form()
|
|
|
this.addFormStatus = 'create'
|
|
|
this.addFormShow = true
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs['addFormRef'].clearValidate()
|
|
|
})
|
|
|
},
|
|
|
+ //清空弹窗表单信息
|
|
|
+ reset_form(){
|
|
|
+ this.addForm.name = ''
|
|
|
+ },
|
|
|
|
|
|
-
|
|
|
+ //编辑
|
|
|
form_edit(row) {
|
|
|
- console.log('row', row)
|
|
|
- this.addForm = Object.assign({}, row) // copy obj
|
|
|
-
|
|
|
+ console.log('行内容row=========', row)
|
|
|
+ //编辑行内容赋值
|
|
|
+ this.addForm = Object.assign({}, row)
|
|
|
this.addFormStatus = 'edit'
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
this.addFormShow = true
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs['addFormRef'].clearValidate()
|
|
@@ -407,122 +507,102 @@ export default {
|
|
|
},
|
|
|
|
|
|
|
|
|
- //监听关闭对话框
|
|
|
+ //新增关闭
|
|
|
add_dialog_close(){
|
|
|
//内容重置
|
|
|
this.$refs['addFormRef'].resetFields()
|
|
|
},
|
|
|
|
|
|
-
|
|
|
+ //新增 保存
|
|
|
add_dialog_save() {
|
|
|
var me = this
|
|
|
-
|
|
|
this.$refs['addFormRef'].validate(valid => {
|
|
|
//验证成功
|
|
|
if (valid) {
|
|
|
-
|
|
|
- console.log(me.addForm )
|
|
|
//发起请求
|
|
|
-
|
|
|
var send_data = {
|
|
|
- "roleName": me.addForm.roleName,
|
|
|
- "remark": me.addForm.remark
|
|
|
+ "name": me.addForm.name,
|
|
|
}
|
|
|
console.log("弹窗参数:", send_data)
|
|
|
|
|
|
//关闭弹窗
|
|
|
// me.addFormShow = false
|
|
|
//加载 - 发送新增保存
|
|
|
- ajaxDataPost(me.url_add_table, send_data).then(e => {
|
|
|
- console.log("新增结果:",e)
|
|
|
- //打印请求成功结果
|
|
|
- if(e.msg == "success" ){
|
|
|
- me.$message({ type: 'success', message: '新增成功!' , duration: 2000 })
|
|
|
- //关闭弹窗
|
|
|
- me.addFormShow = false
|
|
|
- me.get_table_data()
|
|
|
- } else {
|
|
|
- me.$message({ type: 'error', message: '新增失败!' + e.msg, duration: 2000 })
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
+ ajaxDataPost(me.url_add_table, send_data).then(e => {
|
|
|
+ console.log("新增结果:",e)
|
|
|
+ //打印请求成功结果
|
|
|
+ if(e.code == 200 ){
|
|
|
+ me.$message({ type: 'success', message: '新增成功!' , duration: 2000 })
|
|
|
+ //关闭弹窗
|
|
|
+ me.addFormShow = false
|
|
|
+ me.get_table_data()
|
|
|
+ } else {
|
|
|
+ me.$message({ type: 'error', message: '新增失败!' + e.msg, duration: 2000 })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
-
|
|
|
+ //编辑 保存
|
|
|
edit_dialog_save(){
|
|
|
var me = this
|
|
|
-
|
|
|
this.$refs['addFormRef'].validate(valid => {
|
|
|
//验证成功
|
|
|
if (valid) {
|
|
|
-
|
|
|
- console.log(me.addForm )
|
|
|
//发起请求
|
|
|
-
|
|
|
var send_data = {
|
|
|
- "roleName": me.addForm.roleName,
|
|
|
- "remark": me.addForm.remark,
|
|
|
- "roleId": me.addForm.roleId,
|
|
|
+ "name": me.addForm.name,
|
|
|
+ "id": me.addForm.id,
|
|
|
}
|
|
|
console.log("弹窗参数:", send_data)
|
|
|
|
|
|
//关闭弹窗
|
|
|
// me.addFormShow = false
|
|
|
- //加载 - 发送编辑保存
|
|
|
- ajaxDataPost(me.url_edit_table, send_data).then(e => {
|
|
|
- console.log("编辑结果:",e)
|
|
|
- //打印请求成功结果
|
|
|
- if(e.msg == "success" ){
|
|
|
- me.$message({ type: 'success', message: '编辑成功!' , duration: 2000 })
|
|
|
- //关闭弹窗
|
|
|
- me.addFormShow = false
|
|
|
- me.get_table_data()
|
|
|
- } else {
|
|
|
- me.$message({ type: 'error', message: '编辑失败!' + e.msg, duration: 2000 })
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
+ //加载 - 发送新增保存
|
|
|
+ ajaxDataPost(me.url_edit_table, send_data).then(e => {
|
|
|
+ console.log("编辑结果:",e)
|
|
|
+ //打印请求成功结果
|
|
|
+ if(e.code == 200 ){
|
|
|
+ me.$message({ type: 'success', message: '编辑成功!' , duration: 2000 })
|
|
|
+ //关闭弹窗
|
|
|
+ me.addFormShow = false
|
|
|
+ me.get_table_data()
|
|
|
+ } else {
|
|
|
+ me.$message({ type: 'error', message: '编辑失败!' + e.msg, duration: 2000 })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+
|
|
|
+
|
|
|
form_delete(row) {
|
|
|
var me = this
|
|
|
|
|
|
- var send_data = {
|
|
|
-
|
|
|
- "roleId": row.roleId
|
|
|
- }
|
|
|
-
|
|
|
- me.$confirm('是否删除该角色?', '提示', {
|
|
|
+ me.$confirm('是否删除此条内容?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
+ console.log("删除的ID参数:", row.id)
|
|
|
+ //加载 - 发送新增保存
|
|
|
+ ajaxDataDelete(me.url_delete_table + '/' +row.id, {}).then(e => {
|
|
|
+ console.log("编辑结果:",e)
|
|
|
+ //打印请求成功结果
|
|
|
+ if(e.code == 200 ){
|
|
|
+ me.$message({ type: 'success', message: '删除成功!' });
|
|
|
+ me.get_table_data()
|
|
|
+ } else {
|
|
|
+ me.$message({ type: 'error', message: '删除失败!' + e.msg, duration: 2000 })
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
- //加载 - 发送编辑保存
|
|
|
- ajaxDataPost(me.url_delete_table, send_data).then(e => {
|
|
|
- console.log("删除结果:",e)
|
|
|
- //打印请求成功结果
|
|
|
- if(e.msg == "success" ){
|
|
|
- me.$message({ type: 'success', message: '删除成功!' , duration: 2000 })
|
|
|
- //关闭弹窗
|
|
|
- me.addFormShow = false
|
|
|
- me.get_table_data()
|
|
|
- } else {
|
|
|
- me.$message({ type: 'error', message: '删除失败!' + e.msg, duration: 2000 })
|
|
|
- }
|
|
|
- })
|
|
|
- // me.$message({
|
|
|
- // type: 'success',
|
|
|
- // message: '删除成功!'
|
|
|
- // });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}).catch(() => {
|
|
|
me.$message({
|
|
|
type: 'info',
|
|
@@ -543,12 +623,16 @@ export default {
|
|
|
console.log('row', row)
|
|
|
this.setForm = Object.assign({}, row)
|
|
|
|
|
|
- this.checkedIdArr = row.menuIdList
|
|
|
|
|
|
- this.setFormShow = true
|
|
|
+
|
|
|
+
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs['setFormRef'].clearValidate()
|
|
|
+
|
|
|
+ this.checkedIdArr = row.menu_ids
|
|
|
})
|
|
|
+
|
|
|
+ this.setFormShow = true
|
|
|
},
|
|
|
|
|
|
|
|
@@ -560,10 +644,35 @@ export default {
|
|
|
this.checkedIdArr = []
|
|
|
//清空树
|
|
|
this.$refs.tree.setCheckedKeys([]);
|
|
|
+ this.setFormShow2 = false
|
|
|
},
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
change_check() {
|
|
|
+ var me = this
|
|
|
+
|
|
|
+ // me.$nextTick(() => {
|
|
|
+ // const arr = []
|
|
|
+ // me.rightlist.forEach(item => {
|
|
|
+ // if (!me.$refs.tree.getNode(item.menuId).childNodes || !me.$refs.tree.getNode(item.menuId).childNodes.length) {
|
|
|
+ // arr.push(item.menuId)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // console.log (arr)
|
|
|
+ // me.$refs.tree.setCheckedKeys(arr)
|
|
|
+ // })
|
|
|
+
|
|
|
+
|
|
|
var checkedKeys = this.$refs.tree.getCheckedKeys() // 所有被选中的节点的 key 所组成的数组数据
|
|
|
console.log(checkedKeys)
|
|
|
this.checkedIdArr = checkedKeys
|
|
@@ -573,7 +682,46 @@ export default {
|
|
|
var me = this
|
|
|
console.log(me.setForm)
|
|
|
|
|
|
- console.log(me.checkedIdArr)
|
|
|
+ console.log("选中的ID checkedIdArr",me.checkedIdArr)
|
|
|
+
|
|
|
+
|
|
|
+ console.log(" rightlistAll",me.rightlistAll)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var isParent = false
|
|
|
+ me.rightlistAll.forEach(function(item){
|
|
|
+
|
|
|
+
|
|
|
+ me.checkedIdArr.forEach(function(items){
|
|
|
+ if(items == item.id ){
|
|
|
+ var parent_id = item.parent_id
|
|
|
+ var name = item.name
|
|
|
+ console.log('item.parent_id',item.parent_id)
|
|
|
+ if(parent_id !== 0){
|
|
|
+ var isParentCheck = me.checkedIdArr.indexOf(parent_id)
|
|
|
+ if(isParentCheck == -1){
|
|
|
+ console.log('父级没勾上',name)
|
|
|
+
|
|
|
+ isParent = true
|
|
|
+ return false
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(isParent){
|
|
|
+ me.$message({ type: 'error', message: '请勾选已选择菜单或按钮的父级权限!' , duration: 2000 })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -586,26 +734,30 @@ export default {
|
|
|
//发起请求
|
|
|
|
|
|
var send_data = {
|
|
|
- "roleId": me.setForm.roleId,
|
|
|
- "menuIdList": me.checkedIdArr
|
|
|
+ "role_id": me.setForm.id,
|
|
|
+ "menu_ids":me.checkedIdArr
|
|
|
|
|
|
}
|
|
|
console.log("弹窗参数:", send_data)
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//关闭弹窗
|
|
|
// me.addFormShow = false
|
|
|
//加载 - 发送编辑保存
|
|
|
- ajaxDataPost('/role/menu/updateRoleMenu', send_data).then(e => {
|
|
|
+ ajaxDataPost('/api/v1/system/role/menu_ids', send_data).then(e => {
|
|
|
console.log("编辑结果:",e)
|
|
|
//打印请求成功结果
|
|
|
- if(e.msg == "success" ){
|
|
|
- me.$message({ type: 'success', message: '编辑成功!' , duration: 2000 })
|
|
|
- //关闭弹窗
|
|
|
- me.setFormShow = false
|
|
|
- me.get_table_data()
|
|
|
- } else {
|
|
|
- me.$message({ type: 'error', message: '编辑失败!' + e.msg, duration: 2000 })
|
|
|
- }
|
|
|
+ if(e.code == 200 ){
|
|
|
+ me.$message({ type: 'success', message: '新增成功!' , duration: 2000 })
|
|
|
+ //关闭弹窗
|
|
|
+ me.setFormShow = false
|
|
|
+ me.get_table_data()
|
|
|
+ me.checkedIdArr = []
|
|
|
+ } else {
|
|
|
+ me.$message({ type: 'error', message: '新增失败!' + e.msg, duration: 2000 })
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
|