Commit e01945e9 by 姜雷

Merge branch 'test' into 'master'

Test See merge request !9
parents 3d1a7644 dfe6e702
...@@ -2,20 +2,16 @@ ...@@ -2,20 +2,16 @@
> A Vue.js project > A Vue.js project
## Build Setup ## 打包说明:
``` bash ```bash
# install dependencies # 项目打包命令
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build npm run build
# build for production and view the bundle analyzer report # 打包目标地址 ./dist
npm run build --report # 线上需替换 ./src/config/constants.js 文件中 SERVER_URL 为正式环境接口部署地址
``` ```
#
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
<template> <template>
<div id="app"> <div id="app">
<router-view/> <router-view />
</div> </div>
</template> </template>
...@@ -79,6 +79,27 @@ input[type='number'] { ...@@ -79,6 +79,27 @@ input[type='number'] {
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: textfield; -moz-appearance: textfield;
} }
.editForm {
display: flex;
flex-wrap: wrap;
}
.line-wrap,
.col-line-1,
.el-form-item {
width: 100%;
}
.line-wrap {
display: flex;
}
.tableMinHeightBig {
min-height: 120px;
}
.col-line-2 {
width: 45%;
}
.col-line-3 {
width: 32%;
}
</style> </style>
<script> <script>
export default { 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'; ...@@ -3,7 +3,6 @@ import { Message, MessageBox } from 'element-ui';
import store from '../store'; import store from '../store';
import config from '../config/index'; import config from '../config/index';
import { errorHandle } from './validate'; import { errorHandle } from './validate';
import md5 from 'blueimp-md5';
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
...@@ -38,12 +37,12 @@ service.interceptors.request.use( ...@@ -38,12 +37,12 @@ service.interceptors.request.use(
service.interceptors.response.use(response => { service.interceptors.response.use(response => {
const res = response.data; const res = response.data;
/** /**
* code为非'0'是抛错 * code为非'1000'是抛错
*/ */
setTimeout(() => { setTimeout(() => {
store.dispatch('fetchDone'); store.dispatch('fetchDone');
}, 500); }, 500);
if (res.code !== '0') { if (res.code !== 1000) {
if ( if (
response.headers && response.headers &&
response.headers['content-type'] === 'application/octet-stream' response.headers['content-type'] === 'application/octet-stream'
...@@ -57,7 +56,7 @@ service.interceptors.response.use(response => { ...@@ -57,7 +56,7 @@ service.interceptors.response.use(response => {
}); });
// -2:其他客户端登录了;Token 过期了; // -2:其他客户端登录了;Token 过期了;
if (res.code === '-2') { if (res.code === -2) {
if (logout) return; if (logout) return;
logout = true; logout = true;
MessageBox.confirm( MessageBox.confirm(
......
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'; ...@@ -3,21 +3,20 @@ import fetch from '@/api/fetch';
// 登录 // 登录
export const login = entity => export const login = entity =>
fetch({ fetch({
url: '/login/manager/login.do',
method: 'post', method: 'post',
data: { data: entity,
...entity,
},
withCredentials: true,
}); });
// 登出 // 登出
export const logout = () => export const logout = () =>
fetch({ fetch({
method: 'post', url: '/login/manager/appLoginOut',
data: {}, method: 'get',
}); });
// 修改密码 // 修改密码
export const changePwd = entity => export const changePwd = entity =>
fetch({ fetch({
url: '/admin/admin4ResetPwd',
method: 'post', method: 'post',
data: entity, data: { ...entity, type: 3 },
}); });
...@@ -4,7 +4,7 @@ $sideBar-width: 250px; ...@@ -4,7 +4,7 @@ $sideBar-width: 250px;
.main-container { .main-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-height: calc(100vh - 70px); max-height: calc(100vh - 100px);
transition: margin-left 0.28s; transition: margin-left 0.28s;
margin-left: $sideBar-width; margin-left: $sideBar-width;
} // 侧边栏 } // 侧边栏
......
export default { export default {
SERVER_URL: '', // DEV SERVER_URL: 'http://192.168.1.33:8888', // DEV
TOKEN_KEY: 'Admin-Token', TOKEN_KEY: 'Admin-Token',
}; };
import constants from './constants'; import constants from './constants';
export const PAGE_TITLE = '成都师范学院后勤管理系统';
export const RYM_GZKEY = 'dc2017'; export const RYM_GZKEY = 'dc2017';
export const IMG_URL = 'http://qiniu.dcrym.com/'; export const IMG_URL = 'http://qiniu.dcrym.com/';
export const CONSTANTS = constants; export const CONSTANTS = constants;
export const accountStatusOptions = [
{
label: '正常',
value: 0,
},
{
label: '冻结',
value: 1,
},
];
export const sexOptions = [
{
label: '男',
value: 1,
},
{
label: '女',
value: 2,
},
];
export default { export default {
...constants, ...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 prop="sortId" label="排序" min-width="50"></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-item label="排序" label-width="200px">
<el-input-number v-model.trim="selected.sortId" :controls="false" :precision="0" :min="0" :max="1000" clearable></el-input-number>
</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: '',
sortId: null,
};
},
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,
sortId: data.row.sortId,
};
} 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,
sortId: this.selected.sortId,
};
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 prop="sortId" label="排序" min-width="50"></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-item label="排序" label-width="200px">
<el-input-number v-model.trim="selected.sortId" :controls="false" :precision="0" :min="0" :max="1000" clearable></el-input-number>
</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: '',
sortId: 0,
};
},
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,
sortId: data.row.sortId,
};
} 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,
sortId: this.selected.sortId,
};
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 prop="sortId" label="排序" min-width="50"></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-item label="排序" label-width="200px">
<el-input-number v-model.trim="selected.sortId" :controls="false" :precision="0" :min="0" :max="1000" clearable></el-input-number>
</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: '',
sortId: null,
};
},
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,
sortId: data.row.sortId,
};
} 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,
sortId: this.selected.sortId,
};
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 prop="sortId" label="排序" min-width="50"></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-item label="排序" label-width="200px">
<el-input-number v-model.trim="selected.sortId" :controls="false" :precision="0" :min="0" :max="1000" clearable></el-input-number>
</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: '',
sortId: 0,
};
},
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,
sortId: data.row.sortId,
};
} 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,
sortId: this.selected.sortId,
};
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']);
},
};
<template> <template>
<div class="tab-container"> <div class="tab-container">
homePage <img src="@/assets/images/request_timeout@3x.png" alt="">
</div> </div>
</template> </template>
......
...@@ -4,11 +4,10 @@ ...@@ -4,11 +4,10 @@
<div class="com-logo"> <div class="com-logo">
<img src="../../assets/images/logo.png" alt="logo"> <img src="../../assets/images/logo.png" alt="logo">
</div> </div>
<h1 class="com-title">管理系统</h1> <h1 class="com-title">{{title}}</h1>
<UserBox></UserBox> <UserBox></UserBox>
</div> </div>
<div> <div>
<sidebar class="sidebar-container"></sidebar> <sidebar class="sidebar-container"></sidebar>
<div class="main-container"> <div class="main-container">
<navbar></navbar> <navbar></navbar>
...@@ -16,6 +15,9 @@ ...@@ -16,6 +15,9 @@
<app-main></app-main> <app-main></app-main>
</div> </div>
</div> </div>
<div class="copyright">
Copyright@成都多彩任意门科技有限公司2015-2017 蜀ICP备14012163号-1
</div>
</div> </div>
</template> </template>
...@@ -49,6 +51,18 @@ ...@@ -49,6 +51,18 @@
margin-left: 67px; margin-left: 67px;
text-indent: 20px; text-indent: 20px;
} }
.copyright {
box-sizing: border-box;
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
position: absolute;
top: calc(100vh - 30px);
padding-left: 250px;
font-size: 14px;
color: #666;
}
} }
</style> </style>
...@@ -60,6 +74,7 @@ import { ...@@ -60,6 +74,7 @@ import {
TagsView, TagsView,
UserBox, UserBox,
} from '@/containers/layout/components'; } from '@/containers/layout/components';
import { PAGE_TITLE } from '@/config';
export default { export default {
name: 'layout', name: 'layout',
...@@ -70,6 +85,11 @@ export default { ...@@ -70,6 +85,11 @@ export default {
TagsView, TagsView,
UserBox, UserBox,
}, },
data() {
return {
title: PAGE_TITLE,
};
},
computed: { computed: {
sidebar() { sidebar() {
return this.$store.state.app.sidebar; return this.$store.state.app.sidebar;
......
<template> <template>
<div class="login-container"> <div class="login-container">
<div class="login-form-wrap">
<el-form autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginForm" label-position="left" label-width="0px" class="card-box login-form"> <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> <!-- <div class="title">{{title}}</div> -->
<el-form-item prop="username"> <div class="title">成师后勤管理系统</div>
<el-form-item class="loginFormItem" prop="username">
<span class="svg-container svg-container_login"> <span class="svg-container svg-container_login">
<svg-icon icon-class="user" /> <svg-icon icon-class="user" />
</span> </span>
<el-input name="username" type="text" v-model="loginForm.name" autoComplete="on" placeholder="username" /> <el-input name="username" type="text" v-model="loginForm.name" autoComplete="on" placeholder="username" />
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item class="loginFormItem" prop="password">
<span class="svg-container"> <span class="svg-container">
<svg-icon icon-class="password"></svg-icon> <svg-icon icon-class="password"></svg-icon>
</span> </span>
...@@ -28,11 +30,13 @@ ...@@ -28,11 +30,13 @@
</div> --> </div> -->
</el-form> </el-form>
</div> </div>
</div>
</template> </template>
<script> <script>
import { isvalidUsername } from '@/utils/validate'; import { isvalidUsername } from '@/utils/validate';
import { mapActions } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import { PAGE_TITLE } from '@/config';
export default { export default {
name: 'login', name: 'login',
...@@ -52,6 +56,7 @@ export default { ...@@ -52,6 +56,7 @@ export default {
} }
}; };
return { return {
title: PAGE_TITLE,
loginForm: { loginForm: {
name: '', name: '',
password: '', password: '',
...@@ -64,10 +69,12 @@ export default { ...@@ -64,10 +69,12 @@ export default {
{ required: true, trigger: 'blur', validator: validatePass }, { required: true, trigger: 'blur', validator: validatePass },
], ],
}, },
loading: false,
pwdType: 'password', pwdType: 'password',
}; };
}, },
computed: {
...mapGetters(['loading']),
},
methods: { methods: {
...mapActions(['Login']), ...mapActions(['Login']),
showPwd() { showPwd() {
...@@ -80,15 +87,13 @@ export default { ...@@ -80,15 +87,13 @@ export default {
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
this.loading = true;
this.Login(this.loginForm) this.Login(this.loginForm)
.then(() => { .then(path => {
console.log('login done'); console.log('login done');
this.loading = false; this.$router.push({ path: path });
this.$router.push({ path: '/' });
}) })
.catch(() => { .catch(err => {
this.loading = false; console.log(err);
}); });
} else { } else {
console.log('error submit!!'); console.log('error submit!!');
...@@ -110,6 +115,8 @@ $light_gray: #eee; ...@@ -110,6 +115,8 @@ $light_gray: #eee;
height: 100%; height: 100%;
width: 100%; width: 100%;
background-color: $bg; background-color: $bg;
background-image: url('../../assets/images/login/login_bg@3x.png');
background-size: cover;
input:-webkit-autofill { input:-webkit-autofill {
box-shadow: 0 0 0px 1000px #293444 inset !important; box-shadow: 0 0 0px 1000px #293444 inset !important;
-webkit-text-fill-color: #fff !important; -webkit-text-fill-color: #fff !important;
...@@ -120,7 +127,7 @@ $light_gray: #eee; ...@@ -120,7 +127,7 @@ $light_gray: #eee;
-webkit-appearance: none; -webkit-appearance: none;
border-radius: 0px; border-radius: 0px;
padding: 12px 5px 12px 15px; padding: 12px 5px 12px 15px;
color: $light_gray; color: #666;
height: 47px; height: 47px;
} }
.el-input { .el-input {
...@@ -144,25 +151,35 @@ $light_gray: #eee; ...@@ -144,25 +151,35 @@ $light_gray: #eee;
} }
} }
.title { .title {
font-size: 26px; font-size: 40px;
font-weight: 400;
color: $light_gray; color: $light_gray;
margin: 0px auto 40px auto; margin: 0px auto 70px auto;
text-align: center; text-align: center;
font-weight: bold; }
.login-form-wrap {
width: 1290px;
height: 730px;
background: url('../../assets/images/login/login_screen_bg@3x.png') center
no-repeat;
margin: 100px auto 0;
position: relative;
} }
.login-form { .login-form {
position: absolute; position: absolute;
left: 0; top: 200px;
right: 0; right: 230px;
width: 400px; width: 336px;
padding: 35px 35px 15px 35px; }
margin: 120px auto; .loginFormItem {
height: 52px;
background-color: #fff;
border-radius: 8px;
margin-bottom: 28px;
} }
.el-form-item { .el-form-item {
border: 1px solid rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.1); // background: rgba(0, 0, 0, 0.1);
border-radius: 5px; // border-radius: 5px;
color: #454545; color: #454545;
} }
.show-pwd { .show-pwd {
...@@ -180,4 +197,46 @@ $light_gray: #eee; ...@@ -180,4 +197,46 @@ $light_gray: #eee;
bottom: 28px; bottom: 28px;
} }
} }
@media screen and (max-width: 1334px) {
.login-container {
background-image: url('../../assets/images/login/login_bg@2x.png');
input {
padding: 12px 5px 12px 15px;
height: 31px;
}
.el-input {
height: 31px;
}
.login-form-wrap {
width: 860px;
height: 487px;
background: url('../../assets/images/login/login_screen_bg@2x.png') center;
}
.login-form {
top: 133.333px;
right: 152.333px;
width: 224px;
}
.title {
font-size: 26px;
margin: 0px auto 46px auto;
}
.loginFormItem {
height: 34px;
background-color: #fff;
border-radius: 8px;
margin-bottom: 28px;
.el-form-item__content {
line-height: 22px;
}
}
.svg-container {
padding: 6px 5px 6px 15px;
width: 20px;
&_login {
font-size: 14px;
}
}
}
}
</style> </style>
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="applyIdentity" label="报修人身份" min-width="100"></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="applyCellphone" 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="" @click="showDetail(item)">
</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>
<drag-dialog title="查看图片" :visible.sync="dialogImgVisible" :before-close="resetImgDialog" width="70%">
<img style="width: 100%;" :src="imgUrl" alt="">
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="resetImgDialog">确 定</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: '老师',
},
],
dialogImgVisible: false,
imgUrl: '',
};
},
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 || '处理失败!');
});
},
resetImgDialog() {
this.imgUrl = '';
this.dialogImgVisible = false;
},
showDetail(imgUrl) {
this.imgUrl = imgUrl;
this.dialogImgVisible = true;
},
},
};
</script>
<style lang="scss">
.previewRow {
display: flex;
.previewItem {
width: 170px;
height: 96px;
margin-right: 20px;
img {
width: 100%;
height: 100%;
}
}
.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-4">用车申请时间</div>
<div :span="4" class="tableCell tabelCol-6">{{selected.createDate}}</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-4">用车人数</div>
<div :span="4" class="tableCell tabelCol-6">{{selected.userCount}}</div>
</div>
<div class="tableRow tableMinHeightBig">
<div :span="4" class="tableCell tabelCol-4">
<span>用车类型<br>(勾选)</span>
</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}}(共 {{day}} 天)</div>
</div>
<div class="tableRow tableMinHeightBig">
<div :span="4" class="tableCell tabelCol-4">
<span>用车详细路线</span>
</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-10"></div>
<div :span="4" class="tableCell tabelCol-4 directCol">
<div>派车人</div>
<div>派车车牌</div>
</div>
<div :span="4" class="tableCell tabelCol-6 directCol">
<span>
{{selected.dealName}}
</span>
<span>
{{selected.carPlate}}
</span>
</div>
</div>
<div class="tableRow">
<div :span="4" class="tableCell tabelCol-4">出车公里数</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.startKilometers?selected.startKilometers:''}}</div>
<div :span="4" class="tableCell tabelCol-4">收车公里数</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.stopKilometers?selected.stopKilometers:''}}</div>
<div :span="4" class="tableCell tabelCol-4">实际公里数</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.trueKilometers?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?selected.price:''}}</div>
<div :span="4" class="tableCell tabelCol-4">用车金额</div>
<div :span="4" class="tableCell tabelCol-4">{{selected.totalPrice?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 class="tableBottm">
本表一式两份交车队北区体育场204或205办公室
</div>
</div>
</template>
<script>
export default {
data() {
const {
query: { data },
} = this.$route;
console.log(data);
return {
selected: JSON.parse(data),
};
},
computed: {
day() {
let sed = Math.ceil(
(new Date(this.selected.endDate).getTime() / 1000 / 60 / 60 -
new Date(this.selected.beginDate).getTime() / 1000 / 60 / 60) /
24
);
return sed;
},
},
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;
width: 649px;
height: 978px;
text-align: center;
margin: 0 auto;
line-height: 45px;
.tableTitle {
font-size: 20px;
line-height: 80px;
}
.printTable {
border: 1px solid #000;
.tableRow {
display: flex;
}
.tableCell {
display: flex;
justify-content: center;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
word-break: break-all;
}
.tableCell:last-child {
border-right: none;
}
.tableRow:last-child .tableCell {
border-bottom: none;
}
.tal {
text-indent: 20px;
text-align: left;
justify-content: flex-start;
align-items: flex-start;
}
.directCol {
flex-direction: column;
line-height: 36px;
}
.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%;
}
}
.tableBottm {
text-align: left;
}
}
</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'; ...@@ -11,9 +11,12 @@ import store from './store';
import '@/assets/styles/index.scss'; // global css import '@/assets/styles/index.scss'; // global css
import '@/assets/icons'; // icon import '@/assets/icons'; // icon
import '@/permission' // 用户登录认证 import '@/permission'; // 用户登录认证
// import './mock' // mockjs // import './mock' // mockjs
import extendCom from '@/utils/extends'; import extendCom from '@/utils/extends';
import { PAGE_TITLE } from '@/config';
document.title = PAGE_TITLE;
Vue.use(ElementUI); Vue.use(ElementUI);
extendCom(Vue); 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'; // 验权 ...@@ -6,44 +6,47 @@ import { getToken } from '@/utils/auth'; // 验权
NProgress.configure({ showSpinner: false }); // NProgress Configuration NProgress.configure({ showSpinner: false }); // NProgress Configuration
const whiteList = ['/login']; // 不重定向白名单 const whiteList = ['/login', '/print/publicCar']; // 不重定向白名单
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start(); // 进度条Progress NProgress.start(); // 进度条Progress
// 白名单直接进入
if (whiteList.indexOf(to.path) !== -1) {
next();
NProgress.done();
return;
}
// 如果有用户登陆信息
if (getToken()) { if (getToken()) {
if (to.path === '/login') { if (to.path === '/login') {
next({ path: '/' }); next({ path: '/' });
NProgress.done(); NProgress.done();
} else { return;
}
// 路由已经鉴权
if (store.getters.isRouteDone) { if (store.getters.isRouteDone) {
next(); // next();
} else { return;
// if(store.getters.userInfo.loginState) }
// 没有鉴权动态获取路由
store store
.dispatch('GenerateRoutes') .dispatch('GenerateRoutes')
.then(() => { .then(() => {
router.addRoutes(store.getters.addRouters.slice()); // 动态添加可访问路由表 router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
next({ ...to, replace: true }); next({ ...to, replace: true });
}) })
.catch((err) => { .catch(err => {
console.log('验证失败,请重新登录') console.log('验证失败,请重新登录');
console.log(err) console.log(err);
store.dispatch('FedLogOut').then(() => { store.dispatch('FedLogOut').then(() => {
// Message.error('验证失败,请重新登录'); // Message.error('验证失败,请重新登录');
next({ path: '/login' }); next({ path: '/login' });
}); });
}); });
return;
} }
} next('/login');
} else {
if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
// next('/login');
next();
NProgress.done(); NProgress.done();
}
}
}); });
router.afterEach(() => { 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'; ...@@ -4,6 +4,10 @@ import Layout from '../containers/layout/Layout.vue';
import Login from '@/containers/login/index'; import Login from '@/containers/login/index';
import errorPage404 from '@/containers/errorPage/404'; import errorPage404 from '@/containers/errorPage/404';
import errorPage401 from '@/containers/errorPage/401'; 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); const _import = require('./_import_' + process.env.NODE_ENV);
...@@ -19,6 +23,7 @@ export const constantRouterMap = [ ...@@ -19,6 +23,7 @@ export const constantRouterMap = [
name: 'home', name: 'home',
redirect: 'home', redirect: 'home',
meta: { title: '首页', icon: 'example' }, meta: { title: '首页', icon: 'example' },
hidden: true,
children: [ children: [
{ {
path: 'home', path: 'home',
...@@ -28,6 +33,12 @@ export const constantRouterMap = [ ...@@ -28,6 +33,12 @@ export const constantRouterMap = [
}, },
], ],
}, },
{
path: '/print/publicCar',
component: printPublicCarPage,
name: 'printPublicCarPage',
hidden: true,
},
]; ];
export const asyncRouterMap = [ export const asyncRouterMap = [
...@@ -35,6 +46,9 @@ export const asyncRouterMap = [ ...@@ -35,6 +46,9 @@ export const asyncRouterMap = [
component: Layout, component: Layout,
meta: { icon: 'example' }, meta: { icon: 'example' },
}, },
...managementRoute,
...baseRoute,
...systemRoute,
{ path: '*', redirect: '/404', hidden: true }, { 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({ ...@@ -13,7 +13,7 @@ const store = new Vuex.Store({
app, app,
user, user,
}, },
strict: debug, // strict: debug,
plugins: debug ? [createLogger()] : [], plugins: debug ? [createLogger()] : [],
}); });
export default store; 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 tagsView from './tagsView';
import sidebar from './sidebar'; import sidebar from './sidebar';
import base from './base/base';
import { FETCH_START, FETCH_DONE } from './mutation-types'; import { FETCH_START, FETCH_DONE } from './mutation-types';
const state = () => ({ const state = () => ({
loading: true, loading: false,
}); });
const getters = { const getters = {
...@@ -30,6 +31,7 @@ export default { ...@@ -30,6 +31,7 @@ export default {
modules: { modules: {
tagsView, tagsView,
sidebar, sidebar,
base,
}, },
state, state,
getters, getters,
......
...@@ -14,33 +14,54 @@ const state = { ...@@ -14,33 +14,54 @@ const state = {
const getters = { const getters = {
token: state => state.token, token: state => state.token,
userInfo: ({ token, ...other }) => other, userInfo: ({ token, route, ...other }) => other,
adminId: state => state.id, adminId: state => state.id,
}; };
const actions = { const actions = {
// 登录 // 登录
Login({ commit, dispatch }, entity) { Login({ commit, dispatch }, entity) {
return login(entity).then(response => { return new Promise((resolve, reject) => {
const { login(entity)
token, .then(response => {
userInfo: { menus, ...others }, const { admin, menu, token } = response.data;
} = response.data; // console.log(admin, menu);
if (token) {
setToken(token); setToken(token);
commit(SET_TOKEN, token); commit(SET_TOKEN, token);
commit(UPDATE_USERINFO, others); }
dispatch('initRoute', menus).then(() => { commit(UPDATE_USERINFO, admin);
resolve(); dispatch('initRoute', menu).then(() => {
let path = '/';
if (menu.length) {
path += menu[0].menuUrl;
if (menu[0].childList && menu[0].childList.length) {
path =
path.lastIndexOf('/') === path.length - 1
? path + menu[0].childList[0].menuUrl
: path + '/' + menu[0].childList[0].menuUrl;
}
}
resolve(path);
});
})
.catch(error => {
reject(error);
}); });
}); });
}, },
// 登出 // 登出
LogOut({ commit, state }) { LogOut({ commit, state }) {
return logout(state.token).then(() => { return logout(state.token)
.then(() => {
commit(SET_TOKEN, '');
removeToken();
})
.catch(err => {
console.log(err);
commit(SET_TOKEN, ''); commit(SET_TOKEN, '');
removeToken(); removeToken();
resolve();
}); });
}, },
...@@ -70,6 +91,7 @@ const mutations = { ...@@ -70,6 +91,7 @@ const mutations = {
[UPDATE_USERINFO](state, userInfo) { [UPDATE_USERINFO](state, userInfo) {
state = Object.assign(state, { state = Object.assign(state, {
...userInfo, ...userInfo,
loginState: 1,
}); });
}, },
}; };
......
import { asyncRouterMap, constantRouterMap } from '@/router/index'; import { asyncRouterMap, constantRouterMap } from '@/router/index';
import { INIT_ROUTERS, SET_ROUTERS, ROUTERS_DONE } from './mutation-types'; import { INIT_ROUTERS, SET_ROUTERS, ROUTERS_DONE } from './mutation-types';
import cloneDeep from 'lodash/cloneDeep';
let initRouter = cloneDeep(constantRouterMap);
const filterAsyncRouter = () => {}; const filterAsyncRouter = () => {};
const state = { const state = {
isRouteDone: false, // 是否生成了动态路由 isRouteDone: false, // 是否生成了动态路由
routers: initRouter, routers: constantRouterMap,
addRouters: [], addRouters: [],
}; };
...@@ -21,6 +19,8 @@ const actions = { ...@@ -21,6 +19,8 @@ const actions = {
initRoute({ commit }, menus) { initRoute({ commit }, menus) {
return new Promise(resolve => { return new Promise(resolve => {
let authList = []; let authList = [];
menus &&
menus.length &&
menus.map(item => { menus.map(item => {
const mainMenu = { const mainMenu = {
...asyncRouterMap[0], ...asyncRouterMap[0],
...@@ -28,15 +28,15 @@ const actions = { ...@@ -28,15 +28,15 @@ const actions = {
if (mainMenu) { if (mainMenu) {
const { children, ...routeMenu } = mainMenu; const { children, ...routeMenu } = mainMenu;
let subMenuList = []; let subMenuList = [];
if (item.children && item.children.length) { if (item.childList && item.childList.length) {
item.children.map(subItem => { item.childList.map(subItem => {
const subMenu = asyncRouterMap.find( const subMenu = asyncRouterMap.find(
menu => menu.id === subItem.id menu => menu.id === subItem.id
); );
if (subMenu) { if (subMenu) {
subMenuList.push({ subMenuList.push({
...subMenu, ...subMenu,
path: subItem.menuLink, path: subItem.menuUrl,
name: subItem.id, name: subItem.id,
meta: { meta: {
...subMenu.meta, ...subMenu.meta,
...@@ -49,7 +49,7 @@ const actions = { ...@@ -49,7 +49,7 @@ const actions = {
} }
authList.push({ authList.push({
...routeMenu, ...routeMenu,
path: '/' + item.menuLink, path: item.menuUrl,
name: item.menuName, name: item.menuName,
meta: { ...routeMenu.meta, title: item.menuName }, meta: { ...routeMenu.meta, title: item.menuName },
children: subMenuList, children: subMenuList,
...@@ -68,7 +68,7 @@ const actions = { ...@@ -68,7 +68,7 @@ const actions = {
commit(ROUTERS_DONE); commit(ROUTERS_DONE);
resolve(); resolve();
} else { } else {
dispatch('Login') dispatch('Login', {})
.then(() => { .then(() => {
commit(ROUTERS_DONE); commit(ROUTERS_DONE);
resolve(); resolve();
...@@ -83,8 +83,8 @@ const actions = { ...@@ -83,8 +83,8 @@ const actions = {
const mutations = { const mutations = {
[SET_ROUTERS](state, routers) { [SET_ROUTERS](state, routers) {
state.addRouters = routers.slice(); state.addRouters = routers;
state.routers = initRouter.concat(routers); state.routers = constantRouterMap.concat(routers);
}, },
[ROUTERS_DONE](state) { [ROUTERS_DONE](state) {
state.isRouteDone = true; state.isRouteDone = true;
......
# admin
> A Vue.js project
## 打包说明:
```bash
# 项目打包命令
npm run build
# 打包目标地址 ./dist
# 线上需替换 ./src/config/constants.js 文件中 SERVER_URL 为正式环境接口部署地址
```
#
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
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