Commit eec5f19b by 姜雷

Merge branch 'develop' into test

parents 3d1a7644 91c0af98
......@@ -79,6 +79,20 @@ input[type='number'] {
-webkit-appearance: none;
-moz-appearance: textfield;
}
.editForm {
display: flex;
flex-wrap: wrap;
}
.col-line-1,
.el-form-item {
width: 100%;
}
.col-line-2 {
width: 45%;
}
.col-line-3 {
width: 32%;
}
</style>
<script>
export default {
......
import fetch from '@/api/fetch';
// (获取基础数据【车牌,用车类型,报修区域,报修项目】)
export const getBaseData = entity =>
fetch({
url: '/baseData/getBaseData',
method: 'get',
params: entity,
});
// 为授权选择页面查询所有用户列表
export const getUserList = () =>
fetch({
url: '/baseData/getAppUser',
method: 'get',
});
import createFetch from '../baseFetch';
import CONSTANTS from '@/config/index';
const path = CONSTANTS.BASE_SERVER_URL + '/dcxy/api';
const service = createFetch({
baseURL: path,
});
export default service;
import fetch from '@/api/fetch';
// (1报修区域 2报修项目 3用车类型名称 4车牌号)
// 添加
export const settingAdd = entity =>
fetch({
url: '/setting/setting4Add',
method: 'post',
data: entity,
});
export const settingDel = entity =>
fetch({
url: '/setting/setting4Delete',
method: 'post',
data: entity,
});
export const fetchSettingList = entity =>
fetch({
url: '/setting/setting4Page',
method: 'post',
data: entity,
});
export const updateSetting = entity =>
fetch({
url: '/setting/setting4Update',
method: 'post',
data: entity,
});
......@@ -3,7 +3,6 @@ import { Message, MessageBox } from 'element-ui';
import store from '../store';
import config from '../config/index';
import { errorHandle } from './validate';
import md5 from 'blueimp-md5';
// 创建axios实例
const service = axios.create({
......@@ -38,12 +37,12 @@ service.interceptors.request.use(
service.interceptors.response.use(response => {
const res = response.data;
/**
* code为非'0'是抛错
* code为非'1000'是抛错
*/
setTimeout(() => {
store.dispatch('fetchDone');
}, 500);
if (res.code !== '0') {
if (res.code !== 1000) {
if (
response.headers &&
response.headers['content-type'] === 'application/octet-stream'
......
import fetch from '@/api/fetch';
export const fetchApplyList = entity =>
fetch({
url: '/publicCar/manager/teacherAppoCar4Page',
method: 'post',
data: entity,
});
export const dealApply = entity =>
fetch({
url: '/publicCar/manager/teacherAppoCar4Deal',
method: 'post',
data: entity,
});
import fetch from '@/api/fetch';
export const fetchApplyList = entity =>
fetch({
url: '/repair/manager/userRepair4Page',
method: 'post',
data: entity,
});
export const dealApply = entity =>
fetch({
url: '/repair/manager/userRepair4Deal',
method: 'post',
data: entity,
});
import fetch from '@/api/fetch';
export const fetchTeacherList = entity =>
fetch({
url: '/teacher/teacher4Page',
method: 'post',
data: entity,
});
export const addTeacher = entity =>
fetch({
url: '/teacher/teacher4Add',
method: 'post',
data: entity,
});
export const updateTeacher = entity =>
fetch({
url: '/teacher/teacher4Update',
method: 'post',
data: entity,
});
export const toggleTeacherStatus = entity =>
fetch({
url: '/teacher/teacher4Auther',
method: 'post',
data: entity,
});
import fetch from '@/api/fetch';
// 获取系统用户列表
export const fetchList = entity =>
fetch({
url: '/admin/admin4Page',
method: 'post',
data: entity,
});
// 重置密码
export const resetPwd = entity =>
fetch({
url: '/admin/admin4ResetPwd',
method: 'post',
data: { ...entity, type: 1 },
});
// 账号冻结解冻
export const toggleUserFreezeState = entity =>
fetch({
url: '/admin/admin4ResetPwd',
method: 'post',
data: { ...entity, type: 2 },
});
// 系统用户新增
export const addAccount = entity =>
fetch({
url: '/admin/admin4Add',
method: 'post',
data: entity,
});
// 系统用户修改
export const updateAccount = entity =>
fetch({
url: '/admin/admin4Update',
method: 'post',
data: entity,
});
// 获取全部菜单
export const fetchMenuList = () =>
fetch({
url: '/admin/menu4List',
method: 'post',
});
// 获取全部菜单
export const fetchUserMenuList = entity =>
fetch({
url: '/admin/list4MenuAdminRef',
method: 'post',
data: entity,
});
// 用户授权菜单
export const updateUserAuthMenu = entity =>
fetch({
url: '/admin/admin4Author',
method: 'post',
data: entity,
});
\ No newline at end of file
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,
});
......@@ -3,21 +3,20 @@ import fetch from '@/api/fetch';
// 登录
export const login = entity =>
fetch({
url: '/login/manager/login.do',
method: 'post',
data: {
...entity,
},
withCredentials: true,
data: entity,
});
// 登出
export const logout = () =>
fetch({
method: 'post',
data: {},
url: '/login/manager/appLoginOut',
method: 'get',
});
// 修改密码
export const changePwd = entity =>
fetch({
url: '/admin/admin4ResetPwd',
method: 'post',
data: entity,
data: { ...entity, type: 3 },
});
export default {
SERVER_URL: '', // DEV
SERVER_URL: 'http://192.168.1.33:8888', // DEV
TOKEN_KEY: 'Admin-Token',
};
import constants from './constants';
export const PAGE_TITLE = '管理系统';
export const RYM_GZKEY = 'dc2017';
export const IMG_URL = 'http://qiniu.dcrym.com/';
export const CONSTANTS = constants;
export const accountStatusOptions = [
{
label: '正常',
value: 0,
},
{
label: '冻结',
value: 1,
},
];
export const sexOptions = [
{
label: '男',
value: 1,
},
{
label: '女',
value: 2,
},
];
export default {
...constants,
accountStatusOptions,
sexOptions,
};
export const GET_CAR_NUMBER_LIST = 'GET_CAR_NUMBER_LIST';
import pagination from '@/store/modules/pagination';
import { fetchSettingList } from '@/api/baseData/baseData';
import { GET_CAR_NUMBER_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchSettingList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_CAR_NUMBER_LIST, list);
});
},
};
const mutations = {
[GET_CAR_NUMBER_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div class="base-repairArea main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="请输入车牌号码" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button class="margin-css" type="primary" icon="el-icon-upload" @click="showEditDialog(0)">新增</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="车牌号码" min-width="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd hh:mm:ss')" label="创建时间" min-width="80">
</el-table-column>
<el-table-column prop="purpose" label="用途" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="deleteHandle(scope)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<el-form :disabled="loading">
<el-form-item label="车牌号码" label-width="200px">
<el-input v-model.trim="selected.name" placeholder="请输入车牌号码" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="用途" label-width="200px">
<el-input v-model.trim="selected.purpose" placeholder="请输入用途" :maxlength="20" clearable></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateSetting">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapGetters, mapActions } from 'vuex';
import { settingAdd, updateSetting, settingDel } from '@/api/baseData/baseData';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
let typeArr = this.$route.path.split('/');
let type = typeArr[typeArr.length - 1];
return {
type: type,
filters: {
name: '',
},
};
},
computed: {
...mapGetters('baseData/publicCarNumber', ['list', 'pagination']),
},
methods: {
...mapActions('baseData/publicCarNumber', {
fetchSettingList: 'fetchList',
}),
initSelected() {
this.selected = {
id: '',
name: '',
purpose: '',
};
},
fetchList(entity) {
this.fetchSettingList({
...entity,
type: this.type,
});
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
purpose: data.row.purpose,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入车牌号码!');
return;
}
return true;
},
updateSetting() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
name: this.selected.name,
purpose: this.selected.purpose,
};
if (this.editType) {
updateSetting({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
settingAdd({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
deleteHandle(data) {
this.$confirm(`确认要删除 ${data.row.name} 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
type: this.type,
};
settingDel(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
import store from '@/store/index';
import publicCarNumber from './publicCarNumber';
export default {
install() {
if (store.state.baseData && store.state.baseData.publicCarNumber) return;
if (!store.state.baseData) {
store.registerModule(['baseData'], {
namespaced: true,
});
}
store.registerModule(['baseData', 'publicCarNumber'], publicCarNumber);
},
uninstall() {
store.unregisterModule(['baseData', 'publicCarNumber']);
},
};
export const GET_CAR_NUMBER_LIST = 'GET_CAR_NUMBER_LIST';
import pagination from '@/store/modules/pagination';
import { fetchSettingList } from '@/api/baseData/baseData';
import { GET_CAR_NUMBER_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchSettingList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_CAR_NUMBER_LIST, list);
});
},
};
const mutations = {
[GET_CAR_NUMBER_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div class="base-repairArea main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="请输入类型名称" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button class="margin-css" type="primary" icon="el-icon-upload" @click="showEditDialog(0)">新增</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="类型名称" min-width="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd hh:mm:ss')" label="创建时间" min-width="80">
</el-table-column>
<el-table-column prop="purpose" label="用途" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="deleteHandle(scope)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<el-form :disabled="loading">
<el-form-item label="类型名称" label-width="200px">
<el-input v-model.trim="selected.name" placeholder="请输入类型名称" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="用途" label-width="200px">
<el-input v-model.trim="selected.purpose" placeholder="请输入用途" :maxlength="20" clearable></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateSetting">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapGetters, mapActions } from 'vuex';
import { settingAdd, updateSetting, settingDel } from '@/api/baseData/baseData';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
let typeArr = this.$route.path.split('/');
let type = typeArr[typeArr.length - 1];
return {
type: type,
filters: {
name: '',
},
};
},
computed: {
...mapGetters('baseData/publicCarType', ['list', 'pagination']),
},
methods: {
...mapActions('baseData/publicCarType', {
fetchSettingList: 'fetchList',
}),
initSelected() {
this.selected = {
id: '',
name: '',
purpose: '',
};
},
fetchList(entity) {
this.fetchSettingList({
...entity,
type: this.type,
});
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
purpose: data.row.purpose,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入类型名称!');
return;
}
return true;
},
updateSetting() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
name: this.selected.name,
purpose: this.selected.purpose,
};
if (this.editType) {
updateSetting({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
settingAdd({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
deleteHandle(data) {
this.$confirm(`确认要删除 ${data.row.name} 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
type: this.type,
};
settingDel(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
import store from '@/store/index';
import publicCarType from './publicCarType';
export default {
install() {
if (store.state.baseData && store.state.baseData.publicCarType) return;
if (!store.state.baseData) {
store.registerModule(['baseData'], {
namespaced: true,
});
}
store.registerModule(['baseData', 'publicCarType'], publicCarType);
},
uninstall() {
store.unregisterModule(['baseData', 'publicCarType']);
},
};
export const GET_CAR_NUMBER_LIST = 'GET_CAR_NUMBER_LIST';
import pagination from '@/store/modules/pagination';
import { fetchSettingList } from '@/api/baseData/baseData';
import { GET_CAR_NUMBER_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchSettingList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_CAR_NUMBER_LIST, list);
});
},
};
const mutations = {
[GET_CAR_NUMBER_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div class="base-repairArea main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="请输入区域名称" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button class="margin-css" type="primary" icon="el-icon-upload" @click="showEditDialog(0)">新增</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="区域名称" min-width="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd hh:mm:ss')" label="创建时间" min-width="80">
</el-table-column>
<el-table-column prop="purpose" label="用途" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="deleteHandle(scope)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<el-form :disabled="loading">
<el-form-item label="区域名称" label-width="200px">
<el-input v-model.trim="selected.name" placeholder="请输入区域名称" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="用途" label-width="200px">
<el-input v-model.trim="selected.purpose" placeholder="请输入用途" :maxlength="20" clearable></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateSetting">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapGetters, mapActions } from 'vuex';
import { settingAdd, updateSetting, settingDel } from '@/api/baseData/baseData';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
let typeArr = this.$route.path.split('/');
let type = typeArr[typeArr.length - 1];
return {
type: type,
filters: {
name: '',
},
};
},
computed: {
...mapGetters('baseData/repairArea', ['list', 'pagination']),
},
methods: {
...mapActions('baseData/repairArea', {
fetchSettingList: 'fetchList',
}),
initSelected() {
this.selected = {
id: '',
name: '',
purpose: '',
};
},
fetchList(entity) {
this.fetchSettingList({
...entity,
type: this.type,
});
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
purpose: data.row.purpose,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入区域名称!');
return;
}
return true;
},
updateSetting() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
name: this.selected.name,
purpose: this.selected.purpose,
};
if (this.editType) {
updateSetting({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
settingAdd({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
deleteHandle(data) {
this.$confirm(`确认要删除 ${data.row.name} 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
type: this.type,
};
settingDel(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
import store from '@/store/index';
import repairArea from './repairArea';
export default {
install() {
if (store.state.baseData && store.state.baseData.repairArea) return;
if (!store.state.baseData) {
store.registerModule(['baseData'], {
namespaced: true,
});
}
store.registerModule(['baseData', 'repairArea'], repairArea);
},
uninstall() {
store.unregisterModule(['baseData', 'repairArea']);
},
};
export const GET_CAR_NUMBER_LIST = 'GET_CAR_NUMBER_LIST';
import pagination from '@/store/modules/pagination';
import { fetchSettingList } from '@/api/baseData/baseData';
import { GET_CAR_NUMBER_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchSettingList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_CAR_NUMBER_LIST, list);
});
},
};
const mutations = {
[GET_CAR_NUMBER_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div class="base-repairArea main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="请输入项目名称" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button class="margin-css" type="primary" icon="el-icon-upload" @click="showEditDialog(0)">新增</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="项目名称" min-width="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd hh:mm:ss')" label="创建时间" min-width="80">
</el-table-column>
<el-table-column prop="purpose" label="用途" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="deleteHandle(scope)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<el-form :disabled="loading">
<el-form-item label="项目名称" label-width="200px">
<el-input v-model.trim="selected.name" placeholder="请输入项目名称" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="用途" label-width="200px">
<el-input v-model.trim="selected.purpose" placeholder="请输入用途" :maxlength="20" clearable></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateSetting">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapGetters, mapActions } from 'vuex';
import { settingAdd, updateSetting, settingDel } from '@/api/baseData/baseData';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
let typeArr = this.$route.path.split('/');
let type = typeArr[typeArr.length - 1];
return {
type: type,
filters: {
name: '',
},
};
},
computed: {
...mapGetters('baseData/repairProject', ['list', 'pagination']),
},
methods: {
...mapActions('baseData/repairProject', {
fetchSettingList: 'fetchList',
}),
initSelected() {
this.selected = {
id: '',
name: '',
purpose: '',
};
},
fetchList(entity) {
this.fetchSettingList({
...entity,
type: this.type,
});
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
purpose: data.row.purpose,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入项目名称!');
return;
}
return true;
},
updateSetting() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
name: this.selected.name,
purpose: this.selected.purpose,
};
if (this.editType) {
updateSetting({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
settingAdd({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
deleteHandle(data) {
this.$confirm(`确认要删除 ${data.row.name} 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
type: this.type,
};
settingDel(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
import store from '@/store/index';
import repairProject from './repairProject';
export default {
install() {
if (store.state.baseData && store.state.baseData.repairProject) return;
if (!store.state.baseData) {
store.registerModule(['baseData'], {
namespaced: true,
});
}
store.registerModule(['baseData', 'repairProject'], repairProject);
},
uninstall() {
store.unregisterModule(['baseData', 'repairProject']);
},
};
......@@ -4,7 +4,7 @@
<div class="com-logo">
<img src="../../assets/images/logo.png" alt="logo">
</div>
<h1 class="com-title">管理系统</h1>
<h1 class="com-title">{{title}}</h1>
<UserBox></UserBox>
</div>
<div>
......@@ -60,6 +60,7 @@ import {
TagsView,
UserBox,
} from '@/containers/layout/components';
import { PAGE_TITLE } from '@/config';
export default {
name: 'layout',
......@@ -70,6 +71,11 @@ export default {
TagsView,
UserBox,
},
data() {
return {
title: PAGE_TITLE,
};
},
computed: {
sidebar() {
return this.$store.state.app.sidebar;
......
<template>
<div class="login-container">
<el-form autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginForm" label-position="left" label-width="0px" class="card-box login-form">
<h3 class="title">多彩校园综合管理系统</h3>
<h3 class="title">{{title}}</h3>
<el-form-item prop="username">
<span class="svg-container svg-container_login">
<svg-icon icon-class="user" />
......@@ -32,7 +32,8 @@
<script>
import { isvalidUsername } from '@/utils/validate';
import { mapActions } from 'vuex';
import { mapActions, mapGetters } from 'vuex';
import { PAGE_TITLE } from '@/config';
export default {
name: 'login',
......@@ -52,6 +53,7 @@ export default {
}
};
return {
title: PAGE_TITLE,
loginForm: {
name: '',
password: '',
......@@ -64,10 +66,12 @@ export default {
{ required: true, trigger: 'blur', validator: validatePass },
],
},
loading: false,
pwdType: 'password',
};
},
computed: {
...mapGetters(['loading']),
},
methods: {
...mapActions(['Login']),
showPwd() {
......@@ -80,15 +84,13 @@ export default {
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
this.Login(this.loginForm)
.then(() => {
console.log('login done');
this.loading = false;
this.$router.push({ path: '/' });
})
.catch(() => {
this.loading = false;
.catch(err => {
console.log(err);
});
} else {
console.log('error submit!!');
......
export const GET_PUBLIC_CAR_LIST = 'GET_PUBLIC_CAR_LIST';
import pagination from '../../../store/modules/pagination';
import { fetchApplyList } from '@/api/management/publicCar';
import { GET_PUBLIC_CAR_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchApplyList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_PUBLIC_CAR_LIST, list);
});
},
};
const mutations = {
[GET_PUBLIC_CAR_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
import store from '@/store/index';
import publicCar from './publicCar';
export default {
install() {
if (!store.state.management) {
store.registerModule(['management'], {
namespaced: true,
});
}
if (!store.state.management.publicCar) {
store.registerModule(['management', 'publicCar'], publicCar);
}
},
uninstall() {
store.unregisterModule(['management', 'publicCar']);
},
};
export const GET_REPAIR_LIST = 'GET_REPAIR_LIST';
import pagination from '../../../store/modules/pagination';
import { fetchApplyList } from '@/api/management/repair';
import { GET_REPAIR_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchApplyList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_REPAIR_LIST, list);
});
},
};
const mutations = {
[GET_REPAIR_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div class="manage-repair main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="报修人" clearable></el-input>
</div>
<div class="grid-content">
<el-select v-model="filters.areaId" filterable clearable placeholder="报修区域">
<el-option v-for="item in repairAreaOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
<div class="grid-content">
<el-select v-model="filters.dealState" filterable clearable placeholder="处理状态">
<el-option v-for="item in dealStateOptions" :key="item.id" :label="item.label" :value="item.value">
</el-option>
</el-select>
</div>
<div class="grid-content">
<el-select v-model="filters.applyIdentity" filterable clearable placeholder="身份">
<el-option v-for="item in applyIdentityOptions" :key="item.id" :label="item.label" :value="item.value">
</el-option>
</el-select>
</div>
<div class="grid-content">
<el-date-picker v-model="filters.startDate" type="datetime" placeholder="报修开始时间" clearable>
</el-date-picker>
</div>
<div class="grid-content">
<el-date-picker v-model="filters.endDate" type="datetime" placeholder="报修结束时间" clearable>
</el-date-picker>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column prop="name" label="报修人" min-width="120"></el-table-column>
<el-table-column prop="repairCellphone" label="报修人tel" min-width="120"></el-table-column>
<el-table-column prop="area" label="报修区域" min-width="120"></el-table-column>
<el-table-column prop="term" label="报修项目" min-width="120"></el-table-column>
<el-table-column prop="address" label="报修地址" min-width="120"></el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd')" label="报修时间" min-width="120"></el-table-column>
<el-table-column prop="dealState" :formatter="getDealStateValue" label="处理状态" min-width="120"></el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.dealState == 1" type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">处理</el-button>
<el-button v-else type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(0, scope)">详情</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog :title="editType ? '处理' : '详情'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog" width="70%">
<el-form class="editForm" :disabled="loading">
<el-form-item class="col-line-2" label="报修人" label-width="100px">
<span>{{selected.name}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="报修人tel" label-width="100px">
<span>{{selected.repairCellphone}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="报修区域" label-width="100px">
<span>{{selected.area}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="报修项目" label-width="100px">
<span>{{selected.term}}</span>
</el-form-item>
<el-form-item class="col-line-1" label="报修地址" label-width="100px">
<span>{{selected.address}}</span>
</el-form-item>
<el-form-item class="col-line-1" label="报修时间" label-width="100px">
<span>{{$formatDate(new Date(selected.createDate),'yyyy-MM-dd')}}</span>
</el-form-item>
<el-form-item v-if="selected.uploadImg" class="col-line-1" label="图片" label-width="100px">
<div class="previewRow">
<div class="previewItem" v-for="(item, index) in selected.uploadImg.split(',')" :key="index">
<img :src="item" alt="">
</div>
</div>
</el-form-item>
<el-form-item class="col-line-1" v-if="selected.dealState == 1" label-width="100px">
<el-radio v-model="selected.dealed" :label="2">已处理</el-radio>
</el-form-item>
</el-form>
<div v-if="editType" slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="dealApplyHandle">确 定</el-button>
</div>
<div v-else slot="footer" class="dialog-footer">
<el-button type="primary" @click="resetEditDialog">确 定</el-button>
</div>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import { mapGetters, mapActions } from 'vuex';
import store from './store.js';
import { dealApply } from '@/api/management/repair.js';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
return {
filters: {
name: '',
dealState: '',
startDate: '',
endDate: '',
},
dealStateOptions: [
{
label: '处理中',
value: 1,
},
{
label: '已处理',
value: 2,
},
],
applyIdentityOptions: [
{
label: '学生',
value: '学生',
},
{
label: '教师',
value: '教师',
},
],
};
},
created() {
this.fetchRepairAreaOptions();
},
computed: {
...mapGetters(['loading', 'repairAreaOptions']),
...mapGetters('management/repair', ['list', 'pagination']),
},
methods: {
...mapActions(['fetchRepairAreaOptions']),
...mapActions('management/repair', ['fetchList']),
initSelected() {
this.selected = {
name: '',
repairCellphone: '',
area: '',
term: '',
address: '',
dealed: '',
uploadImg: '',
};
},
getDealStateValue(c, r, val) {
let item = this.dealStateOptions.find(item => item.value == val);
return item ? item.label : val;
},
showEditDialog(type, data) {
this.editType = type;
this.selected = {
id: data.row.id,
name: data.row.name,
repairCellphone: data.row.repairCellphone,
area: data.row.area,
term: data.row.term,
address: data.row.address,
createDate: data.row.createDate,
dealState: data.row.dealState,
uploadImg: data.row.uploadImg,
};
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.dealed) {
this.$message.error('请勾选已处理!');
return;
}
return true;
},
dealApplyHandle() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
dealState: this.selected.dealed,
};
dealApply(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
this.resetEditDialog();
})
.catch(err => {
console.log(err);
this.$message.error(err.msg || '处理失败!');
});
},
},
};
</script>
<style lang="scss">
.previewRow {
display: flex;
.previewItem {
width: 170px;
height: 96px;
margin-right: 20px;
}
.previewItem:last-child {
margin-right: 0;
}
}
</style>
import store from '@/store/index';
import repair from './repair';
export default {
install() {
if (!store.state.management) {
store.registerModule(['management'], {
namespaced: true,
});
}
if (!store.state.management.repair) {
store.registerModule(['management', 'repair'], repair);
}
},
uninstall() {
store.unregisterModule(['management', 'repair']);
},
};
export const GET_USER_LIST = 'GET_USER_LIST';
import store from '@/store/index';
import user from './user';
export default {
install() {
if (!store.state.management) {
store.registerModule(['management'], {
namespaced: true,
});
}
if (!store.state.management.user) {
store.registerModule(['management', 'user'], user);
}
},
uninstall() {
store.unregisterModule(['management', 'user']);
},
};
import pagination from '../../../store/modules/pagination';
import { fetchTeacherList } from '@/api/management/user';
import { GET_USER_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
userList: state => state.list,
};
const actions = {
fetchUserList({ dispatch, state, commit }, entity) {
return fetchTeacherList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_USER_LIST, list);
});
},
};
const mutations = {
[GET_USER_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div id="publicCarForm" class="printTableWrap">
<div class="tableTitle">成都师范学院公务用车审批表</div>
<div class="printTable">
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">用车部门</div>
<div :span="10" class="tableCell tabelCol-10">{{selected.department}}</div>
<div :span="6" class="tableCell tabelCol-6">用车申请时间</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.department}}</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">申请人</div>
<div :span="10" class="tableCell tabelCol-10">{{selected.name}}</div>
<div :span="6" class="tableCell tabelCol-6">用车人数</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.userCount}}</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">用车类型<br>(勾选)</div>
<div :span="20" class="tableCell tabelCol-20 tal">{{selected.categoryName}}</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">用车起始时间</div>
<div :span="20" class="tableCell tabelCol-20 tal">{{selected.beginDate}} - {{selected.endDate}}(共 {{2}} 天)</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">用车详细路线</div>
<div :span="20" class="tableCell tabelCol-20 tal">{{selected.lineDescription}}</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">部门负责人<br>签字(盖章)</div>
<div :span="4" class="tableCell tabelCol-12"></div>
<div :span="4" class="tableCell tabelCol-4">派车人</div>
<div :span="4" class="tableCell tabelCol-4">
{{selected.dealName}}<br/>
{{selected.carPlate}}</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">出车公里数</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.startKilometers}}</div>
<div :span="4" class="tableCell tabelCol-4">收车公里数</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.stopKilometers}}</div>
<div :span="4" class="tableCell tabelCol-4">实际公里数</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.trueKilometers}}</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">资金来源</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.priceSource}}</div>
<div :span="4" class="tableCell tabelCol-4">用车单价</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.price}}</div>
<div :span="4" class="tableCell tabelCol-4">用车金额</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.totalPrice}}</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">驾驶员签字</div>
<div :span="8" class="tableCell tabelCol-8"></div>
<div :span="4" class="tableCell tabelCol-4">用车人签字</div>
<div :span="8" class="tableCell tabelCol-8"></div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
const {
query: { data },
} = this.$route;
console.log(data);
return {
selected: JSON.parse(data),
};
},
created() {
window.vmPrint = this.printHandle;
},
methods: {
printHandle() {
// window.print();
document.execCommand('print', false, null);
},
},
};
</script>
<style lang="scss">
.printTableWrap {
color: #000;
border-collapse: collapse;
text-align: center;
max-width: 649px;
max-height: 978px;
text-align: center;
margin: 0 auto;
.tableTitle {
font-size: 20px;
line-height: 80px;
}
.printTable {
border: 1px solid #000;
.tal {
text-indent: 20px;
text-align: left;
}
.tableRow {
display: flex;
}
.tableCell {
padding: 10px 0;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
}
.tableCell:last-child {
border-right: none;
}
.tableRow:last-child .tableCell {
border-bottom: none;
}
.tabelCol-4 {
width: 16.66667%;
}
.tabelCol-10 {
width: 41.66667%;
}
.tabelCol-6 {
width: 25%;
}
.tabelCol-8 {
width: 33.33333%;
}
.tabelCol-20 {
width: 83.33333%;
}
.tabelCol-12 {
width: 50%;
}
}
}
</style>
import pagination from '../../../store/modules/pagination';
import { fetchList } from '@/api/system/account';
import { GET_ACCOUNT_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
accountList: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_ACCOUNT_LIST, list);
});
},
};
const mutations = {
[GET_ACCOUNT_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
export const GET_ACCOUNT_LIST = 'GET_ACCOUNT_LIST';
import store from '@/store/index';
import account from './account';
export default {
install() {
if (!store.state.system) {
store.registerModule(['system'], {
namespaced: true,
});
}
if (!store.state.system.account) {
store.registerModule(['system', 'account'], account);
}
},
uninstall() {
store.unregisterModule(['system', 'account']);
},
};
export const GET_AUTH_LIST = 'GET_AUTH_LIST';
import store from '@/store/index';
import wxAuth from './wxAuth';
export default {
install() {
if (!store.state.system) {
store.registerModule(['system'], {
namespaced: true,
});
}
if (!store.state.system.wxAuth) {
store.registerModule(['system', 'wxAuth'], wxAuth);
}
},
uninstall() {
store.unregisterModule(['system', 'wxAuth']);
},
};
import pagination from '../../../store/modules/pagination';
import { fetchList } from '@/api/system/wxAuth';
import { GET_AUTH_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_AUTH_LIST, list);
});
},
};
const mutations = {
[GET_AUTH_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div class="system-wxAuth main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="微信端功能" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="微信功能" min-width="80">
</el-table-column>
<el-table-column prop="code" label="功能编号" min-width="50">
</el-table-column>
<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 prop="purpose" label="用途" min-width="150">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="50" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.type == 2" type="primary" size="mini" class="operationBtnWidth" @click="showUserAuth(scope)">授权</el-button>
<span v-else>所有用户开放</span>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<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">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateAuth">确 定</el-button>
</div>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapActions, mapGetters } from 'vuex';
import { fetchAuthUserList, updateAuthList } from '@/api/system/wxAuth.js';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
return {
filters: {
name: '',
},
};
},
computed: {
...mapGetters(['loading', 'authUserList']),
...mapGetters('system/wxAuth', ['list', 'pagination']),
allAuthList() {
return this.authUserList.map(item => ({
key: item.userId,
label: item.name,
disabled: false,
}));
},
},
created() {
this.fetchAllAuthUserList();
},
methods: {
...mapActions(['fetchAllAuthUserList']),
...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>
<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>
......@@ -11,9 +11,12 @@ import store from './store';
import '@/assets/styles/index.scss'; // global css
import '@/assets/icons'; // icon
import '@/permission' // 用户登录认证
import '@/permission'; // 用户登录认证
// import './mock' // mockjs
import extendCom from '@/utils/extends';
import { PAGE_TITLE } from '@/config';
document.title = PAGE_TITLE;
Vue.use(ElementUI);
extendCom(Vue);
......
import { mapGetters } from 'vuex';
export default {
data() {
return {
filters: {},
selected: {},
selectedList: [],
editType: 0,
dialogEditVisible: false,
};
},
computed: {
...mapGetters(['loading']),
},
created() {
this.fetchList({
pageNum: 1,
});
},
methods: {
fetchList() {},
searchList() {
this.changePage(1);
},
getFilters() {
let filters = this.$getFilters(this.filters);
return filters;
},
changePage(index) {
const filters = this.getFilters();
this.fetchList({
...filters,
pageNum: index,
});
},
handleSelectionChange(val) {
this.selectedList = val;
},
resetEditDialog(done) {
this.selected = {};
done && typeof done == 'function'
? done()
: (this.dialogEditVisible = false);
},
},
};
......@@ -6,44 +6,47 @@ import { getToken } from '@/utils/auth'; // 验权
NProgress.configure({ showSpinner: false }); // NProgress Configuration
const whiteList = ['/login']; // 不重定向白名单
const whiteList = ['/login', '/print/publicCar']; // 不重定向白名单
router.beforeEach((to, from, next) => {
NProgress.start(); // 进度条Progress
// 白名单直接进入
if (whiteList.indexOf(to.path) !== -1) {
next();
NProgress.done();
return;
}
// 如果有用户登陆信息
if (getToken()) {
if (to.path === '/login') {
next({ path: '/' });
NProgress.done();
} else {
return;
}
// 路由已经鉴权
if (store.getters.isRouteDone) {
next(); //
} else {
// if(store.getters.userInfo.loginState)
next();
return;
}
// 没有鉴权动态获取路由
store
.dispatch('GenerateRoutes')
.then(() => {
router.addRoutes(store.getters.addRouters.slice()); // 动态添加可访问路由表
router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
next({ ...to, replace: true });
})
.catch((err) => {
console.log('验证失败,请重新登录')
console.log(err)
.catch(err => {
console.log('验证失败,请重新登录');
console.log(err);
store.dispatch('FedLogOut').then(() => {
// Message.error('验证失败,请重新登录');
next({ path: '/login' });
});
});
return;
}
}
} else {
if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
// next('/login');
next();
next('/login');
NProgress.done();
}
}
});
router.afterEach(() => {
......
const _import = require('./_import_' + process.env.NODE_ENV);
const systemRoutes = [
{
id: 7,
component: _import('baseData/repairArea/repairArea'),
},
{
id: 8,
component: _import('baseData/repairProject/repairProject'),
},
{
id: 9,
component: _import('baseData/publicCarType/publicCarType'),
},
{
id: 10,
component: _import('baseData/publicCarNumber/publicCarNumber'),
},
];
export default systemRoutes;
......@@ -4,6 +4,10 @@ import Layout from '../containers/layout/Layout.vue';
import Login from '@/containers/login/index';
import errorPage404 from '@/containers/errorPage/404';
import errorPage401 from '@/containers/errorPage/401';
import systemRoute from './system';
import baseRoute from './baseData';
import managementRoute from './management';
import printPublicCarPage from '../containers/print/publicCar.vue';
const _import = require('./_import_' + process.env.NODE_ENV);
......@@ -28,6 +32,12 @@ export const constantRouterMap = [
},
],
},
{
path: '/print/publicCar',
component: printPublicCarPage,
name: 'printPublicCarPage',
hidden: true,
},
];
export const asyncRouterMap = [
......@@ -35,6 +45,9 @@ export const asyncRouterMap = [
component: Layout,
meta: { icon: 'example' },
},
...managementRoute,
...baseRoute,
...systemRoute,
{ path: '*', redirect: '/404', hidden: true },
];
......
const _import = require('./_import_' + process.env.NODE_ENV);
const managementRoutes = [
{
id: 4,
component: _import('management/user/user'),
},
{
id: 5,
component: _import('management/repair/repair'),
},
{
id: 6,
component: _import('management/publicCar/publicCar'),
},
];
export default managementRoutes;
const _import = require('./_import_' + process.env.NODE_ENV);
const systemRoutes = [
{
id: 11,
component: _import('system/wxAuth/wxAuth'),
},
{
id: 12,
component: _import('system/account/account'),
},
];
export default systemRoutes;
......@@ -13,7 +13,7 @@ const store = new Vuex.Store({
app,
user,
},
strict: debug,
// strict: debug,
plugins: debug ? [createLogger()] : [],
});
export default store;
import {
FETCH_CAR_PLATE,
FETCH_CAR_CATEGORY,
FETCH_REPAIR_AREA,
FETCH_REPAIR_TERM,
FETCH_ALL_AUTH_USER,
} from './mutation-types';
import { getBaseData, getUserList } from '@/api/base/base';
const state = () => ({
carPlate: [],
carCategory: [],
repairArea: [],
repairTerm: [],
authUserList: [],
});
const getters = {
carPlateOptions: state => state.carPlate,
carCategoryOptions: state => state.carCategory,
repairAreaOptions: state => state.repairArea,
repairTermOptions: state => state.repairTerm,
authUserList: state => state.authUserList,
};
const actions = {
fetchCarPlateOptions({ commit }) {
getBaseData({
type: '4',
}).then(res => {
commit(FETCH_CAR_PLATE, res.data);
});
},
fetchCarCategoryOptions({ commit }) {
getBaseData({
type: '3',
}).then(res => {
commit(FETCH_CAR_CATEGORY, res.data);
});
},
fetchRepairAreaOptions({ commit }) {
getBaseData({
type: '1',
}).then(res => {
commit(FETCH_REPAIR_AREA, res.data);
});
},
fetchRepairTermOptions({ commit }) {
getBaseData({
type: '2',
}).then(res => {
commit(FETCH_REPAIR_TERM, res.data);
});
},
fetchAllAuthUserList({ commit }) {
getUserList().then(res => {
commit(FETCH_ALL_AUTH_USER, res.data);
});
},
};
const mutations = {
[FETCH_CAR_PLATE](state, list) {
state.carPlate = list;
},
[FETCH_CAR_CATEGORY](state, list) {
state.carCategory = list;
},
[FETCH_REPAIR_AREA](state, list) {
state.repairArea = list;
},
[FETCH_REPAIR_TERM](state, list) {
state.repairTerm = list;
},
[FETCH_ALL_AUTH_USER](state, list) {
state.authUserList = list;
},
};
export default {
state,
getters,
actions,
mutations,
};
export const FETCH_CAR_PLATE = 'FETCH_CAR_PLATE';
export const FETCH_CAR_CATEGORY = 'FETCH_CAR_CATEGORY';
export const FETCH_REPAIR_AREA = 'FETCH_REPAIR_AREA';
export const FETCH_REPAIR_TERM = 'FETCH_REPAIR_TERM';
export const FETCH_ALL_AUTH_USER = 'FETCH_ALL_AUTH_USER';
import tagsView from './tagsView';
import sidebar from './sidebar';
import base from './base/base';
import { FETCH_START, FETCH_DONE } from './mutation-types';
const state = () => ({
loading: true,
loading: false,
});
const getters = {
......@@ -30,6 +31,7 @@ export default {
modules: {
tagsView,
sidebar,
base,
},
state,
getters,
......
......@@ -14,24 +14,30 @@ const state = {
const getters = {
token: state => state.token,
userInfo: ({ token, ...other }) => other,
userInfo: ({ token, route, ...other }) => other,
adminId: state => state.id,
};
const actions = {
// 登录
Login({ commit, dispatch }, entity) {
return login(entity).then(response => {
const {
token,
userInfo: { menus, ...others },
} = response.data;
return new Promise((resolve, reject) => {
login(entity)
.then(response => {
const { admin, menu, token } = response.data;
// console.log(admin, menu);
if (token) {
setToken(token);
commit(SET_TOKEN, token);
commit(UPDATE_USERINFO, others);
dispatch('initRoute', menus).then(() => {
}
commit(UPDATE_USERINFO, admin);
dispatch('initRoute', menu).then(() => {
resolve();
});
})
.catch(error => {
reject(error);
});
});
},
......@@ -40,7 +46,6 @@ const actions = {
return logout(state.token).then(() => {
commit(SET_TOKEN, '');
removeToken();
resolve();
});
},
......@@ -70,6 +75,7 @@ const mutations = {
[UPDATE_USERINFO](state, userInfo) {
state = Object.assign(state, {
...userInfo,
loginState: 1,
});
},
};
......
import { asyncRouterMap, constantRouterMap } from '@/router/index';
import { INIT_ROUTERS, SET_ROUTERS, ROUTERS_DONE } from './mutation-types';
import cloneDeep from 'lodash/cloneDeep';
let initRouter = cloneDeep(constantRouterMap);
const filterAsyncRouter = () => {};
const state = {
isRouteDone: false, // 是否生成了动态路由
routers: initRouter,
routers: constantRouterMap,
addRouters: [],
};
......@@ -21,6 +19,8 @@ const actions = {
initRoute({ commit }, menus) {
return new Promise(resolve => {
let authList = [];
menus &&
menus.length &&
menus.map(item => {
const mainMenu = {
...asyncRouterMap[0],
......@@ -28,15 +28,15 @@ const actions = {
if (mainMenu) {
const { children, ...routeMenu } = mainMenu;
let subMenuList = [];
if (item.children && item.children.length) {
item.children.map(subItem => {
if (item.childList && item.childList.length) {
item.childList.map(subItem => {
const subMenu = asyncRouterMap.find(
menu => menu.id === subItem.id
);
if (subMenu) {
subMenuList.push({
...subMenu,
path: subItem.menuLink,
path: subItem.menuUrl,
name: subItem.id,
meta: {
...subMenu.meta,
......@@ -49,7 +49,7 @@ const actions = {
}
authList.push({
...routeMenu,
path: '/' + item.menuLink,
path: item.menuUrl,
name: item.menuName,
meta: { ...routeMenu.meta, title: item.menuName },
children: subMenuList,
......@@ -68,7 +68,7 @@ const actions = {
commit(ROUTERS_DONE);
resolve();
} else {
dispatch('Login')
dispatch('Login', {})
.then(() => {
commit(ROUTERS_DONE);
resolve();
......@@ -83,8 +83,8 @@ const actions = {
const mutations = {
[SET_ROUTERS](state, routers) {
state.addRouters = routers.slice();
state.routers = initRouter.concat(routers);
state.addRouters = routers;
state.routers = constantRouterMap.concat(routers);
},
[ROUTERS_DONE](state) {
state.isRouteDone = true;
......
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