Commit 2f07cf9c by 姜雷

添加微信菜单授权

parent fe76efb9
...@@ -83,7 +83,8 @@ input[type='number'] { ...@@ -83,7 +83,8 @@ input[type='number'] {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.col-line-1 { .col-line-1,
.el-form-item {
width: 100%; width: 100%;
} }
.col-line-2 { .col-line-2 {
......
import fetch from '@/api/fetch'; import fetch from '@/api/fetch';
// (获取基础数据【车牌,用车类型,报修区域,报修项目】) // (获取基础数据【车牌,用车类型,报修区域,报修项目】)
export const getBaseData = entity => export const getBaseData = entity =>
fetch({ fetch({
url: '/baseData/getBaseData', url: '/baseData/getBaseData',
method: 'get', method: 'get',
params: entity, params: entity,
}); });
// 为授权选择页面查询所有用户列表
export const getUserList = () =>
fetch({
url: '/baseData/getAppUser',
method: 'get',
});
...@@ -2,14 +2,14 @@ import fetch from '@/api/fetch'; ...@@ -2,14 +2,14 @@ import fetch from '@/api/fetch';
export const fetchApplyList = entity => export const fetchApplyList = entity =>
fetch({ fetch({
url: '/publicCar/teacherAppoCar4Page', url: '/publicCar/manager/teacherAppoCar4Page',
method: 'post', method: 'post',
data: entity, data: entity,
}); });
export const dealApply = entity => export const dealApply = entity =>
fetch({ fetch({
url: '/publicCar/teacherAppoCar4Deal', url: '/publicCar/manager/teacherAppoCar4Deal',
method: 'post', method: 'post',
data: entity, data: entity,
}); });
import fetch from '@/api/fetch';
// 获取微信功能列表
export const fetchList = entity =>
fetch({
url: '/appFunction/appFunction4Page',
method: 'post',
data: entity,
});
// 获取菜单授权用户列表
export const fetchAuthUserList = entity =>
fetch({
url: '/appFunction/appFunction4AuthorList',
method: 'post',
data: entity,
});
// 更新授权用户
export const updateAuthList = entity =>
fetch({
url: '/appFunction/appFunction4Author',
method: 'post',
data: entity,
});
...@@ -125,6 +125,7 @@ export default { ...@@ -125,6 +125,7 @@ export default {
}, },
methods: { methods: {
...mapActions('management/user', { fetchList: 'fetchUserList' }), ...mapActions('management/user', { fetchList: 'fetchUserList' }),
...mapActions(['fetchAllAuthUserList']),
initfilters() { initfilters() {
this.filters = { this.filters = {
name: '', name: '',
...@@ -239,6 +240,7 @@ export default { ...@@ -239,6 +240,7 @@ export default {
addTeacher(entity) addTeacher(entity)
.then(res => { .then(res => {
this.fetchList(); this.fetchList();
this.fetchAllAuthUserList();
this.resetEditDialog(); this.resetEditDialog();
this.$message.success(res.msg); this.$message.success(res.msg);
}) })
......
...@@ -342,14 +342,13 @@ export default { ...@@ -342,14 +342,13 @@ export default {
.system-account { .system-account {
.menuItem { .menuItem {
padding: 5px 24px; padding: 5px 24px;
border-bottom: 1px solid #000; border-bottom: 1px solid #ccc;
} }
.menuName { .menuName {
margin-bottom: 5px; margin: 20px 0 5px;
font-size: 18px; font-size: 18px;
} }
.subMenuList { .subMenuList {
height: 40px;
line-height: 40px; line-height: 40px;
} }
} }
......
import pagination from '../../../store/modules/pagination'; import pagination from '../../../store/modules/pagination';
import { fetchList } from '@/api/system/account'; import { fetchList } from '@/api/system/wxAuth';
import { GET_AUTH_LIST } from './mutation-types'; import { GET_AUTH_LIST } from './mutation-types';
const state = { const state = {
......
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
<el-table border v-loading="loading" :data="list" style="width: 100%"> <el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50"> <el-table-column type="index" label="序号" width="50">
</el-table-column> </el-table-column>
<el-table-column prop="name" label="微信功能" min-width="120"> <el-table-column prop="name" label="微信功能" min-width="80">
</el-table-column> </el-table-column>
<el-table-column prop="name" label="功能编号" min-width="120"> <el-table-column prop="code" label="功能编号" min-width="50">
</el-table-column> </el-table-column>
<el-table-column prop="name" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd')" label="创建时间" min-width="120"> <el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd')" label="创建时间" min-width="50">
</el-table-column> </el-table-column>
<el-table-column prop="name" label="用途" min-width="120"> <el-table-column prop="purpose" label="用途" min-width="150">
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center"> <el-table-column fixed="right" label="操作" min-width="50" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="scope.row.auth" type="primary" size="mini" class="operationBtnWidth" @click="showUserAuth(scope)">授权</el-button> <el-button v-if="scope.row.type == 2" type="primary" size="mini" class="operationBtnWidth" @click="showUserAuth(scope)">授权</el-button>
<span v-else>所有用户开放</span> <span v-else>所有用户开放</span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -28,8 +28,14 @@ ...@@ -28,8 +28,14 @@
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage"> <el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination> </el-pagination>
</div> </div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog"> <drag-dialog class="wxAuthDialog" title="修改" :visible.sync="dialogEditVisible" :before-close="resetEditDialog" width="70%">
<el-transfer v-loading="loading" v-model="selected.userId" :props="{ key: 'userId', label: 'name'}" :titles="['未被选中列', '已被选中列']" :data="authUserList">
<div slot-scope="{ option }">
<span class="auth-name">{{ option.name }}</span>
<span class="auth-department">{{ option.department }}</span>
<span class="auth-cellphone">{{ option.cellphone }}</span>
</div>
</el-transfer>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button> <el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateAuth">确 定</el-button> <el-button type="primary" @click="updateAuth">确 定</el-button>
...@@ -39,9 +45,10 @@ ...@@ -39,9 +45,10 @@
</template> </template>
<script> <script>
import listMixin from '../../../mixin/listPage.js'; import listMixin from '@/mixin/listPage.js';
import store from './store.js'; import store from './store.js';
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import { fetchAuthUserList, updateAuthList } from '@/api/system/wxAuth.js';
export default { export default {
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
...@@ -57,11 +64,78 @@ export default { ...@@ -57,11 +64,78 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters(['loading']), ...mapGetters(['loading', 'authUserList']),
...mapGetters('system/wxAuth', ['list', 'pagination']), ...mapGetters('system/wxAuth', ['list', 'pagination']),
allAuthList() {
return this.authUserList.map(item => ({
key: item.userId,
label: item.name,
disabled: false,
}));
},
},
created() {
this.fetchAllAuthUserList();
}, },
methods: { methods: {
...mapActions(['fetchAllAuthUserList']),
...mapActions('system/wxAuth', ['fetchList']), ...mapActions('system/wxAuth', ['fetchList']),
initSelected() {
this.selected = {
id: '',
userId: [],
};
},
showUserAuth(data) {
fetchAuthUserList({
id: data.row.id,
})
.then(res => {
let list = res.data.map(item => item.userId);
this.selected = {
id: data.row.id,
userId: list,
};
this.dialogEditVisible = true;
})
.catch(err => {
this.$message.error(err.msg || '查询失败!');
});
},
filterMethod() {},
updateAuth() {
const entity = {
menuId: this.selected.id,
userId: this.selected.userId.join(','),
};
updateAuthList(entity)
.then(res => {
this.$message.success(res.msg);
this.resetEditDialog();
})
.catch(err => {
this.$message.error(err.msg || '提交失败!');
});
},
}, },
}; };
</script> </script>
<style lang="scss">
.wxAuthDialog {
text-align: center;
.el-transfer-panel {
text-align: left;
width: 43%;
}
.auth-name,
.auth-department,
.auth-cellphone {
display: inline-block;
width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
</style>
...@@ -3,14 +3,16 @@ import { ...@@ -3,14 +3,16 @@ import {
FETCH_CAR_CATEGORY, FETCH_CAR_CATEGORY,
FETCH_REPAIR_AREA, FETCH_REPAIR_AREA,
FETCH_REPAIR_TERM, FETCH_REPAIR_TERM,
FETCH_ALL_AUTH_USER,
} from './mutation-types'; } from './mutation-types';
import { getBaseData } from '@/api/base/base'; import { getBaseData, getUserList } from '@/api/base/base';
const state = () => ({ const state = () => ({
carPlate: [], carPlate: [],
carCategory: [], carCategory: [],
repairArea: [], repairArea: [],
repairTerm: [], repairTerm: [],
authUserList: [],
}); });
const getters = { const getters = {
...@@ -18,6 +20,7 @@ const getters = { ...@@ -18,6 +20,7 @@ const getters = {
carCategoryOptions: state => state.carCategory, carCategoryOptions: state => state.carCategory,
repairAreaOptions: state => state.repairArea, repairAreaOptions: state => state.repairArea,
repairTermOptions: state => state.repairTerm, repairTermOptions: state => state.repairTerm,
authUserList: state => state.authUserList,
}; };
const actions = { const actions = {
...@@ -49,6 +52,11 @@ const actions = { ...@@ -49,6 +52,11 @@ const actions = {
commit(FETCH_REPAIR_TERM, res.data); commit(FETCH_REPAIR_TERM, res.data);
}); });
}, },
fetchAllAuthUserList({ commit }) {
getUserList().then(res => {
commit(FETCH_ALL_AUTH_USER, res.data);
});
},
}; };
const mutations = { const mutations = {
[FETCH_CAR_PLATE](state, list) { [FETCH_CAR_PLATE](state, list) {
...@@ -63,6 +71,9 @@ const mutations = { ...@@ -63,6 +71,9 @@ const mutations = {
[FETCH_REPAIR_TERM](state, list) { [FETCH_REPAIR_TERM](state, list) {
state.repairTerm = list; state.repairTerm = list;
}, },
[FETCH_ALL_AUTH_USER](state, list) {
state.authUserList = list;
},
}; };
export default { export default {
state, state,
......
...@@ -2,3 +2,5 @@ export const FETCH_CAR_PLATE = 'FETCH_CAR_PLATE'; ...@@ -2,3 +2,5 @@ export const FETCH_CAR_PLATE = 'FETCH_CAR_PLATE';
export const FETCH_CAR_CATEGORY = 'FETCH_CAR_CATEGORY'; export const FETCH_CAR_CATEGORY = 'FETCH_CAR_CATEGORY';
export const FETCH_REPAIR_AREA = 'FETCH_REPAIR_AREA'; export const FETCH_REPAIR_AREA = 'FETCH_REPAIR_AREA';
export const FETCH_REPAIR_TERM = 'FETCH_REPAIR_TERM'; export const FETCH_REPAIR_TERM = 'FETCH_REPAIR_TERM';
export const FETCH_ALL_AUTH_USER = 'FETCH_ALL_AUTH_USER';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment