正在显示
7 个修改的文件
包含
509 行增加
和
40 行删除
src/api/group_company.js
0 → 100644
1 | +import axios from 'axios' | ||
2 | + | ||
3 | +let base = '/group'; | ||
4 | + | ||
5 | + | ||
6 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
7 | + | ||
8 | + | ||
9 | +export const remove = params => { return axios({ | ||
10 | + method: 'DELETE', | ||
11 | + url: `${base}/del`, | ||
12 | + data: params, | ||
13 | + headers: { | ||
14 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
15 | + } | ||
16 | +})}; | ||
17 | + | ||
18 | +//批量删除 | ||
19 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
20 | + | ||
21 | +export const edit = params => { return axios({ | ||
22 | + method: 'PUT', | ||
23 | + url: `${base}/edit`, | ||
24 | + data: params, | ||
25 | + headers: { | ||
26 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
27 | + } | ||
28 | +})}; | ||
29 | + | ||
30 | +export const add = params => { return axios({ | ||
31 | + method: 'POST', | ||
32 | + url: `${base}/add`, | ||
33 | + data: params, | ||
34 | + headers: { | ||
35 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
36 | + } | ||
37 | +})}; |
@@ -16,7 +16,7 @@ export const remove = params => { return axios({ | @@ -16,7 +16,7 @@ export const remove = params => { return axios({ | ||
16 | })}; | 16 | })}; |
17 | 17 | ||
18 | //批量删除 | 18 | //批量删除 |
19 | -export const batchRemove = params => { return axios.get(`${base}/user/batchremove`, { params: params }); }; | 19 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; |
20 | 20 | ||
21 | export const edit = params => { return axios({ | 21 | export const edit = params => { return axios({ |
22 | method: 'PUT', | 22 | method: 'PUT', |
@@ -9,6 +9,7 @@ import LOG from './views/nav1/Log.vue' | @@ -9,6 +9,7 @@ import LOG from './views/nav1/Log.vue' | ||
9 | import PreManifest from './views/agent/PreManifest.vue' | 9 | import PreManifest from './views/agent/PreManifest.vue' |
10 | import Company from './views/nav1/company.vue' | 10 | import Company from './views/nav1/company.vue' |
11 | import Department from './views/nav1/department.vue' | 11 | import Department from './views/nav1/department.vue' |
12 | +import Group from './views/nav1/groupcompany.vue' | ||
12 | // import Form from './views/nav1/Form.vue' | 13 | // import Form from './views/nav1/Form.vue' |
13 | 14 | ||
14 | import User from './views/nav1/user.vue' | 15 | import User from './views/nav1/user.vue' |
@@ -53,6 +54,7 @@ let routes = [ | @@ -53,6 +54,7 @@ let routes = [ | ||
53 | { path: '/log', component: LOG, name: '系统日志' }, | 54 | { path: '/log', component: LOG, name: '系统日志' }, |
54 | { path: '/department', component: Department, name: '部门管理' }, | 55 | { path: '/department', component: Department, name: '部门管理' }, |
55 | { path: '/company', component: Company, name: '公司管理'}, | 56 | { path: '/company', component: Company, name: '公司管理'}, |
57 | + { path: '/group', component: Group, name: '集团管理'} | ||
56 | ] | 58 | ] |
57 | }, | 59 | }, |
58 | { | 60 | { |
@@ -21,10 +21,12 @@ | @@ -21,10 +21,12 @@ | ||
21 | </el-table-column> | 21 | </el-table-column> |
22 | <el-table-column type="index"> | 22 | <el-table-column type="index"> |
23 | </el-table-column> | 23 | </el-table-column> |
24 | - <el-table-column prop="companyId" label="ID" sortable> | 24 | + <el-table-column prop="companyId" label="ID" v-if="show" sortable> |
25 | </el-table-column> | 25 | </el-table-column> |
26 | <el-table-column prop="companyName" label="公司名称" sortable> | 26 | <el-table-column prop="companyName" label="公司名称" sortable> |
27 | </el-table-column> | 27 | </el-table-column> |
28 | + <el-table-column prop="groupName" label="集团名称" sortable> | ||
29 | + </el-table-column> | ||
28 | <el-table-column prop="creatTime" label="入库时间" sortable> | 30 | <el-table-column prop="creatTime" label="入库时间" sortable> |
29 | </el-table-column> | 31 | </el-table-column> |
30 | <el-table-column label="操作" min-width="150"> | 32 | <el-table-column label="操作" min-width="150"> |
@@ -52,7 +54,14 @@ | @@ -52,7 +54,14 @@ | ||
52 | <el-input v-model="editForm.companyName" auto-complete="off" placeholder="请输入公司名称"></el-input> | 54 | <el-input v-model="editForm.companyName" auto-complete="off" placeholder="请输入公司名称"></el-input> |
53 | </el-form-item> | 55 | </el-form-item> |
54 | <el-form-item label="集团名称"> | 56 | <el-form-item label="集团名称"> |
55 | - <el-input v-model="editForm.groupId" auto-complete="off" placeholder=""></el-input> | 57 | + <el-select v-model="editForm.groupId" placeholder="请选择"> |
58 | + <el-option | ||
59 | + v-for="item in groupLists" | ||
60 | + :key="item.groupId" | ||
61 | + :label="item.groupName" | ||
62 | + :value="item.groupId"> | ||
63 | + </el-option> | ||
64 | + </el-select> | ||
56 | </el-form-item> | 65 | </el-form-item> |
57 | </el-form> | 66 | </el-form> |
58 | <div slot="footer" class="dialog-footer"> | 67 | <div slot="footer" class="dialog-footer"> |
@@ -68,7 +77,14 @@ | @@ -68,7 +77,14 @@ | ||
68 | <el-input v-model="addForm.companyName" auto-complete="off" placeholder="请输入公司名称"></el-input> | 77 | <el-input v-model="addForm.companyName" auto-complete="off" placeholder="请输入公司名称"></el-input> |
69 | </el-form-item> | 78 | </el-form-item> |
70 | <el-form-item label="集团名称" prop="groupId"> | 79 | <el-form-item label="集团名称" prop="groupId"> |
71 | - <el-input v-model="addForm.groupId" auto-complete="off" placeholder="请输入集团名称"></el-input> | 80 | + <el-select v-model="addForm.groupId" placeholder="请选择"> |
81 | + <el-option | ||
82 | + v-for="item in groupLists" | ||
83 | + :key="item.groupId" | ||
84 | + :label="item.groupName" | ||
85 | + :value="item.groupId"> | ||
86 | + </el-option> | ||
87 | + </el-select> | ||
72 | </el-form-item> | 88 | </el-form-item> |
73 | </el-form> | 89 | </el-form> |
74 | <div slot="footer" class="dialog-footer"> | 90 | <div slot="footer" class="dialog-footer"> |
@@ -83,6 +99,7 @@ | @@ -83,6 +99,7 @@ | ||
83 | import util from '../../common/js/util' | 99 | import util from '../../common/js/util' |
84 | import NProgress from 'nprogress' | 100 | import NProgress from 'nprogress' |
85 | import { getList, remove, batchRemove, edit, add } from '../../api/company'; | 101 | import { getList, remove, batchRemove, edit, add } from '../../api/company'; |
102 | + import { getList as groupList } from '../../api/group_company'; | ||
86 | import moment from 'moment' | 103 | import moment from 'moment' |
87 | 104 | ||
88 | export default { | 105 | export default { |
@@ -92,6 +109,8 @@ | @@ -92,6 +109,8 @@ | ||
92 | companyName: '' | 109 | companyName: '' |
93 | }, | 110 | }, |
94 | companyList: [], | 111 | companyList: [], |
112 | + // 接受集团名称 | ||
113 | + groupLists:[], | ||
95 | permIds: [], | 114 | permIds: [], |
96 | total: 0, | 115 | total: 0, |
97 | pageNum: 1, | 116 | pageNum: 1, |
@@ -124,6 +143,7 @@ | @@ -124,6 +143,7 @@ | ||
124 | { required: true, message: '请输入公司名称', trigger: 'blur' } | 143 | { required: true, message: '请输入公司名称', trigger: 'blur' } |
125 | ] | 144 | ] |
126 | }, | 145 | }, |
146 | + | ||
127 | //新增界面数据 | 147 | //新增界面数据 |
128 | addForm: { | 148 | addForm: { |
129 | companyName: '', | 149 | companyName: '', |
@@ -141,13 +161,7 @@ | @@ -141,13 +161,7 @@ | ||
141 | this.getCompanys(); | 161 | this.getCompanys(); |
142 | }, | 162 | }, |
143 | methods: { | 163 | methods: { |
144 | - //性别显示转换 | ||
145 | - formatSex: function (row, column) { | ||
146 | - return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知'; | ||
147 | - }, | ||
148 | - formatState: function (row, column) { | ||
149 | - return row.state == true ? '是' : row.state == false ? '否' : '未知'; | ||
150 | - }, | 164 | + |
151 | handleCurrentChange(val) { | 165 | handleCurrentChange(val) { |
152 | this.pageNum = val; | 166 | this.pageNum = val; |
153 | this.getRoles(); | 167 | this.getRoles(); |
@@ -182,6 +196,32 @@ | @@ -182,6 +196,32 @@ | ||
182 | 196 | ||
183 | }, | 197 | }, |
184 | 198 | ||
199 | + //获取集团列表 | ||
200 | + getGroupComapnys() { | ||
201 | + | ||
202 | + this.listLoading = true; | ||
203 | + //NProgress.start(); | ||
204 | + groupList().then((res) => { | ||
205 | + this.total = res.data.total; | ||
206 | + this.groupLists = res.data.list; | ||
207 | + console.log(this.companyList); | ||
208 | + this.listLoading = false; | ||
209 | + //NProgress.done(); | ||
210 | + }).catch((error) => { | ||
211 | + | ||
212 | + this.listLoading = false; | ||
213 | + if(null!= error.response && error.response!==undefined){ | ||
214 | + let status= error.response.status; | ||
215 | + let msg = error.response.statusText; | ||
216 | + alert(status+msg); | ||
217 | + }else { | ||
218 | + alert(error); | ||
219 | + } | ||
220 | + | ||
221 | + }); | ||
222 | + | ||
223 | + }, | ||
224 | + | ||
185 | //删除 | 225 | //删除 |
186 | handleDel: function (index, row) { | 226 | handleDel: function (index, row) { |
187 | this.$confirm('确认删除该记录吗?', '提示', { | 227 | this.$confirm('确认删除该记录吗?', '提示', { |
@@ -212,6 +252,7 @@ | @@ -212,6 +252,7 @@ | ||
212 | handleEdit: function (index, row) { | 252 | handleEdit: function (index, row) { |
213 | this.editFormVisible = true; | 253 | this.editFormVisible = true; |
214 | this.editForm = Object.assign({}, row); | 254 | this.editForm = Object.assign({}, row); |
255 | + this.getGroupComapnys(); | ||
215 | }, | 256 | }, |
216 | setPerm: function (index, row) { | 257 | setPerm: function (index, row) { |
217 | var _this = this; | 258 | var _this = this; |
@@ -235,6 +276,7 @@ | @@ -235,6 +276,7 @@ | ||
235 | companyName: '', | 276 | companyName: '', |
236 | groupId: '' | 277 | groupId: '' |
237 | }; | 278 | }; |
279 | + this.getGroupComapnys(); | ||
238 | }, | 280 | }, |
239 | 281 | ||
240 | //新增 | 282 | //新增 |
@@ -21,10 +21,12 @@ | @@ -21,10 +21,12 @@ | ||
21 | </el-table-column> | 21 | </el-table-column> |
22 | <el-table-column type="index"> | 22 | <el-table-column type="index"> |
23 | </el-table-column> | 23 | </el-table-column> |
24 | - <el-table-column prop="departmentId" label="ID" sortable> | 24 | + <el-table-column prop="departmentId" label="ID" v-if="show" sortable> |
25 | </el-table-column> | 25 | </el-table-column> |
26 | <el-table-column prop="departmentName" label="部门名称" sortable> | 26 | <el-table-column prop="departmentName" label="部门名称" sortable> |
27 | </el-table-column> | 27 | </el-table-column> |
28 | + <el-table-column prop="companyName" label="所属公司名称" sortable> | ||
29 | + </el-table-column> | ||
28 | <el-table-column prop="creatTime" label="入库时间" sortable> | 30 | <el-table-column prop="creatTime" label="入库时间" sortable> |
29 | </el-table-column> | 31 | </el-table-column> |
30 | <el-table-column label="操作" min-width="150"> | 32 | <el-table-column label="操作" min-width="150"> |
@@ -52,7 +54,14 @@ | @@ -52,7 +54,14 @@ | ||
52 | <el-input v-model="editForm.departmentName" auto-complete="off" placeholder="请输入公司名称"></el-input> | 54 | <el-input v-model="editForm.departmentName" auto-complete="off" placeholder="请输入公司名称"></el-input> |
53 | </el-form-item> | 55 | </el-form-item> |
54 | <el-form-item label="公司名称"> | 56 | <el-form-item label="公司名称"> |
55 | - <el-input v-model="editForm.companyId" auto-complete="off" placeholder=""></el-input> | 57 | + <el-select v-model="editForm.companyId" placeholder="请选择公司"> |
58 | + <el-option | ||
59 | + v-for="item in companyList" | ||
60 | + :key="item.companyId" | ||
61 | + :label="item.companyName" | ||
62 | + :value="item.companyId"> | ||
63 | + </el-option> | ||
64 | + </el-select> | ||
56 | </el-form-item> | 65 | </el-form-item> |
57 | </el-form> | 66 | </el-form> |
58 | <div slot="footer" class="dialog-footer"> | 67 | <div slot="footer" class="dialog-footer"> |
@@ -64,11 +73,18 @@ | @@ -64,11 +73,18 @@ | ||
64 | <!--新增界面--> | 73 | <!--新增界面--> |
65 | <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> | 74 | <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> |
66 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | 75 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> |
67 | - <el-form-item label="公司名称" prop="companyName"> | ||
68 | - <el-input v-model="addForm.departmentName" auto-complete="off" placeholder="请输入公司名称"></el-input> | 76 | + <el-form-item label="部门名称" prop="deprtmentName"> |
77 | + <el-input v-model="addForm.departmentName" auto-complete="off" placeholder="请输入部门名称"></el-input> | ||
69 | </el-form-item> | 78 | </el-form-item> |
70 | - <el-form-item label="集团名称" prop="groupId"> | ||
71 | - <el-input v-model="addForm.companyId" auto-complete="off" placeholder="请输入集团名称"></el-input> | 79 | + <el-form-item label="公司名称" prop="companyId"> |
80 | + <el-select v-model="addForm.companyId" placeholder="请选择公司"> | ||
81 | + <el-option | ||
82 | + v-for="item in companyList" | ||
83 | + :key="item.companyId" | ||
84 | + :label="item.companyName" | ||
85 | + :value="item.companyId"> | ||
86 | + </el-option> | ||
87 | + </el-select> | ||
72 | </el-form-item> | 88 | </el-form-item> |
73 | </el-form> | 89 | </el-form> |
74 | <div slot="footer" class="dialog-footer"> | 90 | <div slot="footer" class="dialog-footer"> |
@@ -83,6 +99,7 @@ | @@ -83,6 +99,7 @@ | ||
83 | import util from '../../common/js/util' | 99 | import util from '../../common/js/util' |
84 | import NProgress from 'nprogress' | 100 | import NProgress from 'nprogress' |
85 | import { getList, remove, batchRemove, edit, add } from '../../api/department'; | 101 | import { getList, remove, batchRemove, edit, add } from '../../api/department'; |
102 | + import { getList as getCompanyList } from '../../api/company'; | ||
86 | import moment from 'moment' | 103 | import moment from 'moment' |
87 | 104 | ||
88 | export default { | 105 | export default { |
@@ -91,7 +108,9 @@ | @@ -91,7 +108,9 @@ | ||
91 | filters: { | 108 | filters: { |
92 | companyName: '' | 109 | companyName: '' |
93 | }, | 110 | }, |
111 | + | ||
94 | departmentList: [], | 112 | departmentList: [], |
113 | + companyList: [], | ||
95 | permIds: [], | 114 | permIds: [], |
96 | total: 0, | 115 | total: 0, |
97 | pageNum: 1, | 116 | pageNum: 1, |
@@ -146,7 +165,7 @@ | @@ -146,7 +165,7 @@ | ||
146 | this.pageNum = val; | 165 | this.pageNum = val; |
147 | this.getDepartments(); | 166 | this.getDepartments(); |
148 | }, | 167 | }, |
149 | - //获取公司列表 | 168 | + //获取列表 |
150 | getDepartments() { | 169 | getDepartments() { |
151 | let para = { | 170 | let para = { |
152 | pageNum: this.pageNum, | 171 | pageNum: this.pageNum, |
@@ -174,6 +193,30 @@ | @@ -174,6 +193,30 @@ | ||
174 | }); | 193 | }); |
175 | 194 | ||
176 | }, | 195 | }, |
196 | + //获取列表 | ||
197 | + getCompanylists() { | ||
198 | + let para = { | ||
199 | + }; | ||
200 | + this.listLoading = true; | ||
201 | + //NProgress.start(); | ||
202 | + getCompanyList(para).then((res) => { | ||
203 | + this.total = res.data.total; | ||
204 | + this.companyList = res.data.list; | ||
205 | + this.listLoading = false; | ||
206 | + //NProgress.done(); | ||
207 | + }).catch((error) => { | ||
208 | + this.listLoading = false; | ||
209 | + if(null!= error.response && error.response!==undefined){ | ||
210 | + let status= error.response.status; | ||
211 | + let msg = error.response.statusText; | ||
212 | + alert(status+msg); | ||
213 | + }else { | ||
214 | + alert(error); | ||
215 | + } | ||
216 | + | ||
217 | + }); | ||
218 | + | ||
219 | + }, | ||
177 | 220 | ||
178 | //删除 | 221 | //删除 |
179 | handleDel: function (index, row) { | 222 | handleDel: function (index, row) { |
@@ -205,6 +248,7 @@ | @@ -205,6 +248,7 @@ | ||
205 | handleEdit: function (index, row) { | 248 | handleEdit: function (index, row) { |
206 | this.editFormVisible = true; | 249 | this.editFormVisible = true; |
207 | this.editForm = Object.assign({}, row); | 250 | this.editForm = Object.assign({}, row); |
251 | + this.getCompanylists(); | ||
208 | }, | 252 | }, |
209 | setPerm: function (index, row) { | 253 | setPerm: function (index, row) { |
210 | var _this = this; | 254 | var _this = this; |
@@ -228,6 +272,7 @@ | @@ -228,6 +272,7 @@ | ||
228 | departmentName: '', | 272 | departmentName: '', |
229 | companyId: '' | 273 | companyId: '' |
230 | }; | 274 | }; |
275 | + this.getCompanylists(); | ||
231 | }, | 276 | }, |
232 | 277 | ||
233 | //新增 | 278 | //新增 |
src/views/nav1/groupcompany.vue
0 → 100644
1 | +<template> | ||
2 | + <section> | ||
3 | + <!--工具条--> | ||
4 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
5 | + <el-form :inline="true" :model="filters"> | ||
6 | + <el-form-item> | ||
7 | + <el-input v-model="filters.groupName" placeholder="集团名称"></el-input> | ||
8 | + </el-form-item> | ||
9 | + <el-form-item> | ||
10 | + <el-button type="primary" v-on:click="getGroupCompanys()">查询</el-button> | ||
11 | + </el-form-item> | ||
12 | + <el-form-item> | ||
13 | + <el-button type="primary" @click="groupCompanyAdd">新增</el-button> | ||
14 | + </el-form-item> | ||
15 | + </el-form> | ||
16 | + </el-col> | ||
17 | + | ||
18 | + <!--列表--> | ||
19 | + <el-table :data="groupCompanyList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
20 | + <el-table-column type="selection" width="55"> | ||
21 | + </el-table-column> | ||
22 | + <el-table-column type="index"> | ||
23 | + </el-table-column> | ||
24 | + <el-table-column prop="groupId" label="ID" sortable> | ||
25 | + </el-table-column> | ||
26 | + <el-table-column prop="groupName" label="集团名称" sortable> | ||
27 | + </el-table-column> | ||
28 | + <el-table-column prop="creatTime" label="入库时间" sortable> | ||
29 | + </el-table-column> | ||
30 | + <el-table-column label="操作" min-width="150"> | ||
31 | + <template slot-scope="scope"> | ||
32 | + <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
33 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
34 | + </template> | ||
35 | + </el-table-column> | ||
36 | + </el-table> | ||
37 | + | ||
38 | + <!--工具条--> | ||
39 | + <el-col :span="24" class="toolbar"> | ||
40 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
41 | + <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
42 | + </el-pagination> | ||
43 | + </el-col> | ||
44 | + | ||
45 | + <!--编辑界面--> | ||
46 | + <el-dialog title="编辑" v-model="editFormVisible" :close-on-click-modal="false"> | ||
47 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
48 | + <el-form-item label="ID"> | ||
49 | + <span>{{editForm.groupId}}</span> | ||
50 | + </el-form-item> | ||
51 | + <el-form-item label="集团名称"> | ||
52 | + <el-input v-model="editForm.groupName" auto-complete="off" placeholder="请输入公司名称"></el-input> | ||
53 | + </el-form-item> | ||
54 | + </el-form> | ||
55 | + <div slot="footer" class="dialog-footer"> | ||
56 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
57 | + <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
58 | + </div> | ||
59 | + </el-dialog> | ||
60 | + | ||
61 | + <!--新增界面--> | ||
62 | + <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> | ||
63 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
64 | + <el-form-item label="集团名称" prop="groupId"> | ||
65 | + <el-input v-model="addForm.groupName" auto-complete="off" placeholder="请输入集团名称"></el-input> | ||
66 | + </el-form-item> | ||
67 | + </el-form> | ||
68 | + <div slot="footer" class="dialog-footer"> | ||
69 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
70 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
71 | + </div> | ||
72 | + </el-dialog> | ||
73 | + </section> | ||
74 | +</template> | ||
75 | + | ||
76 | +<script> | ||
77 | + import util from '../../common/js/util' | ||
78 | + import NProgress from 'nprogress' | ||
79 | + import { getList, remove, batchRemove, edit, add } from '../../api/group_company'; | ||
80 | + import moment from 'moment' | ||
81 | + | ||
82 | + export default { | ||
83 | + data() { | ||
84 | + return { | ||
85 | + filters: { | ||
86 | + groupName: '' | ||
87 | + }, | ||
88 | + groupCompanyList: [], | ||
89 | + permIds: [], | ||
90 | + total: 0, | ||
91 | + pageNum: 1, | ||
92 | + pageSize: 5, | ||
93 | + listLoading: false, | ||
94 | + sels: [],//列表选中列 | ||
95 | + //编辑界面是否显示 | ||
96 | + editFormVisible: false, | ||
97 | + editLoading: false, | ||
98 | + editFormRules: { | ||
99 | + groupName: [ | ||
100 | + { required: true, message: '请输入集团名称', trigger: 'blur' } | ||
101 | + ] | ||
102 | + }, | ||
103 | + //编辑界面数据 | ||
104 | + editForm: { | ||
105 | + groupId: '', | ||
106 | + groupName: '' | ||
107 | + }, | ||
108 | + //设置权限数据 | ||
109 | + setPermForm: {}, | ||
110 | + //新增界面是否显示 | ||
111 | + addFormVisible: false, | ||
112 | + //设置权限界面是否显示 | ||
113 | + PermFormVisible: false, | ||
114 | + addLoading: false, | ||
115 | + addFormRules: { | ||
116 | + groupName: [ | ||
117 | + { required: true, message: '请输入集团名称', trigger: 'blur' } | ||
118 | + ] | ||
119 | + }, | ||
120 | + //新增界面数据 | ||
121 | + addForm: { | ||
122 | + groupName: '' | ||
123 | + }, | ||
124 | + groupCompanyFrom: { | ||
125 | + groupId: 1, | ||
126 | + groupName: '', | ||
127 | + groupCompanys: [] | ||
128 | + } | ||
129 | + | ||
130 | + } | ||
131 | + }, | ||
132 | + mounted() { | ||
133 | + this.getGroupCompanys(); | ||
134 | + }, | ||
135 | + methods: { | ||
136 | + | ||
137 | + handleCurrentChange(val) { | ||
138 | + this.pageNum = val; | ||
139 | + this.getGroupCompanys(); | ||
140 | + }, | ||
141 | + //获取列表 | ||
142 | + getGroupCompanys() { | ||
143 | + let para = { | ||
144 | + pageNum: this.pageNum, | ||
145 | + pageSize: this.pageSize, | ||
146 | + groupName: this.filters.groupName | ||
147 | + }; | ||
148 | + this.listLoading = true; | ||
149 | + //NProgress.start(); | ||
150 | + getList(para).then((res) => { | ||
151 | + this.total = res.data.total; | ||
152 | + this.groupCompanyList = res.data.list; | ||
153 | + this.listLoading = false; | ||
154 | + //NProgress.done(); | ||
155 | + }).catch((error) => { | ||
156 | + | ||
157 | + this.listLoading = false; | ||
158 | + if(null!= error.response && error.response!==undefined){ | ||
159 | + let status= error.response.status; | ||
160 | + let msg = error.response.statusText; | ||
161 | + alert(status+msg); | ||
162 | + }else { | ||
163 | + alert(error); | ||
164 | + } | ||
165 | + | ||
166 | + }); | ||
167 | + | ||
168 | + }, | ||
169 | + | ||
170 | + //删除 | ||
171 | + handleDel: function (index, row) { | ||
172 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
173 | + type: 'warning' | ||
174 | + }).then(() => { | ||
175 | + this.listLoading = true; | ||
176 | + //NProgress.start(); | ||
177 | + let para = { groupId: row.groupId }; | ||
178 | + remove(para).then((res) => { | ||
179 | + this.listLoading = false; | ||
180 | + //NProgress.done(); | ||
181 | + this.$message({ | ||
182 | + message: '删除成功', | ||
183 | + type: 'success' | ||
184 | + }); | ||
185 | + this.getGroupCompanys(); | ||
186 | + }).catch((error) => { | ||
187 | + this.listLoading = false; | ||
188 | + alert(error); | ||
189 | + }); | ||
190 | + }).catch(); | ||
191 | + }, | ||
192 | + /** | ||
193 | + * 显示编辑界面 | ||
194 | + * @param index | ||
195 | + * @param row 为这行的数据对象 | ||
196 | + */ | ||
197 | + handleEdit: function (index, row) { | ||
198 | + this.editFormVisible = true; | ||
199 | + this.editForm = Object.assign({}, row); | ||
200 | + }, | ||
201 | + setPerm: function (index, row) { | ||
202 | + var _this = this; | ||
203 | + this.groupIds = []; | ||
204 | + this.PermFormVisible = true; | ||
205 | + this.groupCompanyFrom = Object.assign({}, row); | ||
206 | + let rolePerms = this.groupCompanyFrom.groupCompanys; | ||
207 | + if (util.checkNull(rolePerms)){ | ||
208 | + rolePerms.forEach(function (group,v_index,v_arr) { | ||
209 | + if(util.checkNull(perm)){ | ||
210 | + _this.groupIds[v_index] = group.groupId; | ||
211 | + } | ||
212 | + }); | ||
213 | + } | ||
214 | + this.getPermList(); | ||
215 | + }, | ||
216 | + //显示新增界面,每次点开初始化数据 | ||
217 | + groupCompanyAdd: function () { | ||
218 | + this.addFormVisible = true; | ||
219 | + this.addForm = { | ||
220 | + groupName: '', | ||
221 | + companyId: '' | ||
222 | + }; | ||
223 | + }, | ||
224 | + | ||
225 | + //新增 | ||
226 | + addSubmit: function () { | ||
227 | + this.$refs.addForm.validate((valid) => { | ||
228 | + if (valid) { | ||
229 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
230 | + this.addLoading = true; | ||
231 | + //NProgress.start(); | ||
232 | + let para = Object.assign({}, this.addForm); | ||
233 | + add(para).then((res) => { | ||
234 | + this.addLoading = false; | ||
235 | + //NProgress.done(); | ||
236 | + this.$message({ | ||
237 | + message: '提交成功', | ||
238 | + type: 'success' | ||
239 | + }); | ||
240 | + this.$refs['addForm'].resetFields(); | ||
241 | + this.addFormVisible = false; | ||
242 | + this.getGroupCompanys(); | ||
243 | + }).catch(error => alert(error)); | ||
244 | + }); | ||
245 | + } | ||
246 | + }); | ||
247 | + }, | ||
248 | + //编辑 | ||
249 | + editSubmit: function () { | ||
250 | + this.$refs.editForm.validate((valid) => { | ||
251 | + if (valid) { | ||
252 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
253 | + this.editLoading = true; | ||
254 | + let para = Object.assign({}, this.editForm); | ||
255 | + this.editLoading = false; | ||
256 | + edit(para).then((res) => { | ||
257 | + | ||
258 | + //NProgress.done(); | ||
259 | + this.$message({ | ||
260 | + message: '提交成功', | ||
261 | + type: 'success' | ||
262 | + }); | ||
263 | + this.$refs['editForm'].resetFields(); | ||
264 | + this.editFormVisible = false; | ||
265 | + this.getGroupCompanys(); | ||
266 | + }).catch(error => alert(error)); | ||
267 | + }); | ||
268 | + } | ||
269 | + }); | ||
270 | + }, | ||
271 | + | ||
272 | + selsChange: function (sels) { | ||
273 | + this.sels = sels; | ||
274 | + }, | ||
275 | + //批量删除 | ||
276 | + batchRemove: function () { | ||
277 | + var ids = this.sels.map(item => item.groupId).toString(); | ||
278 | + console.log(ids); | ||
279 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
280 | + type: 'warning' | ||
281 | + }).then(() => { | ||
282 | + this.listLoading = true; | ||
283 | + //NProgress.start(); | ||
284 | + let para = { ids: ids }; | ||
285 | + batchRemove(para).then((res) => { | ||
286 | + this.listLoading = false; | ||
287 | + //NProgress.done(); | ||
288 | + this.$message({ | ||
289 | + message: '删除成功', | ||
290 | + type: 'success' | ||
291 | + }); | ||
292 | + this.getGroupCompanys(); | ||
293 | + }); | ||
294 | + }).catch(() => { | ||
295 | + | ||
296 | + }); | ||
297 | + } | ||
298 | + }, | ||
299 | + | ||
300 | + } | ||
301 | +</script> |
@@ -21,14 +21,12 @@ | @@ -21,14 +21,12 @@ | ||
21 | </el-table-column> | 21 | </el-table-column> |
22 | <el-table-column type="index" width="60"> | 22 | <el-table-column type="index" width="60"> |
23 | </el-table-column> | 23 | </el-table-column> |
24 | - <el-table-column prop="roleId" label="ID" width="100" sortable> | 24 | + <el-table-column prop="roleId" label="ID" width="100" v-if="show" sortable> |
25 | </el-table-column> | 25 | </el-table-column> |
26 | <el-table-column prop="roleName" label="部门名称" min-width="200" sortable> | 26 | <el-table-column prop="roleName" label="部门名称" min-width="200" sortable> |
27 | </el-table-column> | 27 | </el-table-column> |
28 | <el-table-column prop="description" label="部门描述" min-width="200" sortable> | 28 | <el-table-column prop="description" label="部门描述" min-width="200" sortable> |
29 | </el-table-column> | 29 | </el-table-column> |
30 | - <el-table-column prop="roleSign" label="排序" width="100" sortable> | ||
31 | - </el-table-column> | ||
32 | <el-table-column label="操作" min-width="260"> | 30 | <el-table-column label="操作" min-width="260"> |
33 | <template slot-scope="scope"> | 31 | <template slot-scope="scope"> |
34 | <el-button size="small" @click="setPerm(scope.$index, scope.row)">设置权限</el-button> | 32 | <el-button size="small" @click="setPerm(scope.$index, scope.row)">设置权限</el-button> |
@@ -51,18 +49,22 @@ | @@ -51,18 +49,22 @@ | ||
51 | <el-form-item label="ID"> | 49 | <el-form-item label="ID"> |
52 | <span>{{editForm.roleId}}</span> | 50 | <span>{{editForm.roleId}}</span> |
53 | </el-form-item> | 51 | </el-form-item> |
54 | - <el-form-item label="角色名称"> | 52 | + <el-form-item label="岗位名称"> |
55 | <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入角色名称:例如:ROLE_name"></el-input> | 53 | <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入角色名称:例如:ROLE_name"></el-input> |
56 | </el-form-item> | 54 | </el-form-item> |
57 | - <el-form-item label="角色描述"> | 55 | + <el-form-item label="岗位描述"> |
58 | <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入角色描述:例如:用户管理员"></el-input> | 56 | <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入角色描述:例如:用户管理员"></el-input> |
59 | </el-form-item> | 57 | </el-form-item> |
60 | - <el-form-item label="角色排序"> | ||
61 | - <el-input v-model="editForm.roleSign" auto-complete="off" placeholder="请输入角色排序:例如:数字123"></el-input> | 58 | + <el-form-item label="部门名称"> |
59 | + <el-select v-model="editForm.departmentId" placeholder="请选择"> | ||
60 | + <el-option | ||
61 | + v-for="item in departmentNameList" | ||
62 | + :key="item.departmentId" | ||
63 | + :label="item.departmentName" | ||
64 | + :value="item.departmentId"> | ||
65 | + </el-option> | ||
66 | + </el-select> | ||
62 | </el-form-item> | 67 | </el-form-item> |
63 | - <!--<el-form-item label="创建日期">--> | ||
64 | - <!--<el-date-picker type="date" placeholder="创建日期" v-model="editForm.creattime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"></el-date-picker>--> | ||
65 | - <!--</el-form-item>--> | ||
66 | </el-form> | 68 | </el-form> |
67 | <div slot="footer" class="dialog-footer"> | 69 | <div slot="footer" class="dialog-footer"> |
68 | <el-button @click.native="editFormVisible = false">取消</el-button> | 70 | <el-button @click.native="editFormVisible = false">取消</el-button> |
@@ -73,14 +75,21 @@ | @@ -73,14 +75,21 @@ | ||
73 | <!--新增界面--> | 75 | <!--新增界面--> |
74 | <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> | 76 | <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> |
75 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | 77 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> |
76 | - <el-form-item label="角色名称" prop="roleName"> | 78 | + <el-form-item label="岗位名称" prop="roleName"> |
77 | <el-input v-model="addForm.roleName" auto-complete="off" placeholder="请输入角色名称:例如:ROLE_name"></el-input> | 79 | <el-input v-model="addForm.roleName" auto-complete="off" placeholder="请输入角色名称:例如:ROLE_name"></el-input> |
78 | </el-form-item> | 80 | </el-form-item> |
79 | - <el-form-item label="角色描述" prop="description"> | 81 | + <el-form-item label="岗位描述" prop="description"> |
80 | <el-input v-model="addForm.description" auto-complete="off" placeholder="请输入角色描述:例如:用户管理员"></el-input> | 82 | <el-input v-model="addForm.description" auto-complete="off" placeholder="请输入角色描述:例如:用户管理员"></el-input> |
81 | </el-form-item> | 83 | </el-form-item> |
82 | - <el-form-item label="角色排序" prop="roleSign"> | ||
83 | - <el-input v-model="addForm.roleSign" auto-complete="off" placeholder="请输入角色排序:例如:数字123"></el-input> | 84 | + <el-form-item label="部门名称" prop="roleSign"> |
85 | + <el-select v-model="addForm.departmentId" placeholder="请选择"> | ||
86 | + <el-option | ||
87 | + v-for="item in departmentNameList" | ||
88 | + :key="item.departmentId" | ||
89 | + :label="item.departmentName" | ||
90 | + :value="item.departmentId"> | ||
91 | + </el-option> | ||
92 | + </el-select> | ||
84 | </el-form-item> | 93 | </el-form-item> |
85 | </el-form> | 94 | </el-form> |
86 | <div slot="footer" class="dialog-footer"> | 95 | <div slot="footer" class="dialog-footer"> |
@@ -90,7 +99,7 @@ | @@ -90,7 +99,7 @@ | ||
90 | </el-dialog> | 99 | </el-dialog> |
91 | 100 | ||
92 | <!--权限设置界面--> | 101 | <!--权限设置界面--> |
93 | - <el-dialog title="角色的权限设置" v-model="PermFormVisible" :close-on-click-modal="false"> | 102 | + <el-dialog title="岗位的权限设置" v-model="PermFormVisible" :close-on-click-modal="false"> |
94 | <el-form :model="permForm" label-width="80px" ref="permForm"> | 103 | <el-form :model="permForm" label-width="80px" ref="permForm"> |
95 | <el-checkbox-group v-model="permIds" size="small"> | 104 | <el-checkbox-group v-model="permIds" size="small"> |
96 | <el-checkbox v-for="perm in permissons" :label="perm.permissionId" :key="perm.permissionId">{{perm.name}}</el-checkbox> | 105 | <el-checkbox v-for="perm in permissons" :label="perm.permissionId" :key="perm.permissionId">{{perm.name}}</el-checkbox> |
@@ -108,6 +117,7 @@ | @@ -108,6 +117,7 @@ | ||
108 | import util from '../../common/js/util' | 117 | import util from '../../common/js/util' |
109 | import NProgress from 'nprogress' | 118 | import NProgress from 'nprogress' |
110 | import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api'; | 119 | import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api'; |
120 | + import { getList as getDepartmentList} from '../../api/department'; | ||
111 | import { getList as permList } from '../../api/perm_api'; | 121 | import { getList as permList } from '../../api/perm_api'; |
112 | import moment from 'moment' | 122 | import moment from 'moment' |
113 | export default { | 123 | export default { |
@@ -116,6 +126,7 @@ | @@ -116,6 +126,7 @@ | ||
116 | filters: { | 126 | filters: { |
117 | roleName: '' | 127 | roleName: '' |
118 | }, | 128 | }, |
129 | + departmentNameList:[], | ||
119 | roles: [], | 130 | roles: [], |
120 | permissons: [], | 131 | permissons: [], |
121 | permIds: [], | 132 | permIds: [], |
@@ -129,7 +140,7 @@ | @@ -129,7 +140,7 @@ | ||
129 | editLoading: false, | 140 | editLoading: false, |
130 | editFormRules: { | 141 | editFormRules: { |
131 | roleName: [ | 142 | roleName: [ |
132 | - { required: true, message: '请输入角色名称', trigger: 'blur' } | 143 | + { required: true, message: '请输入岗位名称', trigger: 'blur' } |
133 | ] | 144 | ] |
134 | }, | 145 | }, |
135 | //编辑界面数据 | 146 | //编辑界面数据 |
@@ -137,7 +148,8 @@ | @@ -137,7 +148,8 @@ | ||
137 | roleId: 1, | 148 | roleId: 1, |
138 | description: '', | 149 | description: '', |
139 | roleName: '', | 150 | roleName: '', |
140 | - roleSign: 1 | 151 | + roleSign: 1, |
152 | + departmentId:'' | ||
141 | }, | 153 | }, |
142 | 154 | ||
143 | //新增界面是否显示 | 155 | //新增界面是否显示 |
@@ -147,17 +159,18 @@ | @@ -147,17 +159,18 @@ | ||
147 | addLoading: false, | 159 | addLoading: false, |
148 | addFormRules: { | 160 | addFormRules: { |
149 | roleName: [ | 161 | roleName: [ |
150 | - { required: true, message: '请输入角色名称', trigger: 'blur' } | 162 | + { required: true, message: '请输入岗位名称', trigger: 'blur' } |
151 | ], | 163 | ], |
152 | description: [ | 164 | description: [ |
153 | - { required: true, message: '请输入角色描述', trigger: 'blur' } | 165 | + { required: true, message: '请输入岗位描述', trigger: 'blur' } |
154 | ] | 166 | ] |
155 | }, | 167 | }, |
156 | //新增界面数据 | 168 | //新增界面数据 |
157 | addForm: { | 169 | addForm: { |
158 | description: '', | 170 | description: '', |
159 | roleName: '', | 171 | roleName: '', |
160 | - roleSign: 1 | 172 | + roleSign: 1, |
173 | + departmentId:'' | ||
161 | }, | 174 | }, |
162 | permForm: { | 175 | permForm: { |
163 | roleId: 1, | 176 | roleId: 1, |
@@ -209,6 +222,33 @@ | @@ -209,6 +222,33 @@ | ||
209 | }); | 222 | }); |
210 | 223 | ||
211 | }, | 224 | }, |
225 | + | ||
226 | + | ||
227 | + //获取部门列表 | ||
228 | + getdepartmentNames() { | ||
229 | + | ||
230 | + this.listLoading = true; | ||
231 | + //NProgress.start(); | ||
232 | + getDepartmentList().then((res) => { | ||
233 | + this.total = res.data.total; | ||
234 | + this.departmentNameList = res.data.list; | ||
235 | + this.listLoading = false; | ||
236 | + //NProgress.done(); | ||
237 | + }).catch((error) => { | ||
238 | + | ||
239 | + this.listLoading = false; | ||
240 | + if(null!= error.response && error.response!==undefined){ | ||
241 | + let status= error.response.status; | ||
242 | + let msg = error.response.statusText; | ||
243 | + alert(status+msg); | ||
244 | + }else { | ||
245 | + alert(error); | ||
246 | + } | ||
247 | + | ||
248 | + }); | ||
249 | + | ||
250 | + }, | ||
251 | + | ||
212 | //获取权限列表 | 252 | //获取权限列表 |
213 | getPermList() { | 253 | getPermList() { |
214 | let para = { | 254 | let para = { |
@@ -237,7 +277,7 @@ | @@ -237,7 +277,7 @@ | ||
237 | }).then(() => { | 277 | }).then(() => { |
238 | this.listLoading = true; | 278 | this.listLoading = true; |
239 | //NProgress.start(); | 279 | //NProgress.start(); |
240 | - let para = { userId: row.userId }; | 280 | + let para = { roleId: row.roleId }; |
241 | remove(para).then((res) => { | 281 | remove(para).then((res) => { |
242 | this.listLoading = false; | 282 | this.listLoading = false; |
243 | //NProgress.done(); | 283 | //NProgress.done(); |
@@ -260,6 +300,7 @@ | @@ -260,6 +300,7 @@ | ||
260 | handleEdit: function (index, row) { | 300 | handleEdit: function (index, row) { |
261 | this.editFormVisible = true; | 301 | this.editFormVisible = true; |
262 | this.editForm = Object.assign({}, row); | 302 | this.editForm = Object.assign({}, row); |
303 | + this.getdepartmentNames(); | ||
263 | }, | 304 | }, |
264 | setPerm: function (index, row) { | 305 | setPerm: function (index, row) { |
265 | var _this = this; | 306 | var _this = this; |
@@ -289,6 +330,7 @@ | @@ -289,6 +330,7 @@ | ||
289 | mobilephone: '', | 330 | mobilephone: '', |
290 | age: 1 | 331 | age: 1 |
291 | }; | 332 | }; |
333 | + this.getdepartmentNames(); | ||
292 | }, | 334 | }, |
293 | //编辑 | 335 | //编辑 |
294 | editSubmit: function () { | 336 | editSubmit: function () { |
@@ -383,7 +425,7 @@ | @@ -383,7 +425,7 @@ | ||
383 | }, | 425 | }, |
384 | //批量删除 | 426 | //批量删除 |
385 | batchRemove: function () { | 427 | batchRemove: function () { |
386 | - var ids = this.sels.map(item => item.id).toString(); | 428 | + var ids = this.sels.map(item => item.roleId).toString(); |
387 | this.$confirm('确认删除选中记录吗?', '提示', { | 429 | this.$confirm('确认删除选中记录吗?', '提示', { |
388 | type: 'warning' | 430 | type: 'warning' |
389 | }).then(() => { | 431 | }).then(() => { |
-
请 注册 或 登录 后发表评论