Commit e01945e9 by 姜雷

Merge branch 'test' into 'master'

Test See merge request !9
parents 3d1a7644 dfe6e702
......@@ -2,20 +2,16 @@
> A Vue.js project
## Build Setup
## 打包说明:
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
```bash
# 项目打包命令
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# 打包目标地址 ./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).
<template>
<div id="app">
<router-view/>
<router-view />
</div>
</template>
......@@ -79,6 +79,27 @@ input[type='number'] {
-webkit-appearance: none;
-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>
<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'
......@@ -57,7 +56,7 @@ service.interceptors.response.use(response => {
});
// -2:其他客户端登录了;Token 过期了;
if (res.code === '-2') {
if (res.code === -2) {
if (logout) return;
logout = true;
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';
// 登录
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 },
});
......@@ -4,7 +4,7 @@ $sideBar-width: 250px;
.main-container {
display: flex;
flex-direction: column;
max-height: calc(100vh - 70px);
max-height: calc(100vh - 100px);
transition: margin-left 0.28s;
margin-left: $sideBar-width;
} // 侧边栏
......
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 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>
<div class="tab-container">
homePage
<img src="@/assets/images/request_timeout@3x.png" alt="">
</div>
</template>
......
......@@ -4,17 +4,19 @@
<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>
<sidebar class="sidebar-container"></sidebar>
<div class="main-container">
<navbar></navbar>
<tags-view></tags-view>
<app-main></app-main>
<sidebar class="sidebar-container"></sidebar>
<div class="main-container">
<navbar></navbar>
<tags-view></tags-view>
<app-main></app-main>
</div>
</div>
<div class="copyright">
Copyright@成都多彩任意门科技有限公司2015-2017 蜀ICP备14012163号-1
</div>
</div>
</template>
......@@ -49,6 +51,18 @@
margin-left: 67px;
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>
......@@ -60,6 +74,7 @@ import {
TagsView,
UserBox,
} from '@/containers/layout/components';
import { PAGE_TITLE } from '@/config';
export default {
name: 'layout',
......@@ -70,6 +85,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>
<el-form-item prop="username">
<span class="svg-container svg-container_login">
<svg-icon icon-class="user" />
</span>
<el-input name="username" type="text" v-model="loginForm.name" autoComplete="on" placeholder="username" />
</el-form-item>
<el-form-item prop="password">
<span class="svg-container">
<svg-icon icon-class="password"></svg-icon>
</span>
<el-input name="password" :type="pwdType" @keyup.enter.native="handleLogin" v-model="loginForm.password" autoComplete="on" placeholder="password"></el-input>
<span class="show-pwd" @click="showPwd">
<svg-icon icon-class="eye" />
</span>
</el-form-item>
<el-form-item>
<el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin">
登录
</el-button>
</el-form-item>
<!-- <div class="tips">
<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">
<!-- <div class="title">{{title}}</div> -->
<div class="title">成师后勤管理系统</div>
<el-form-item class="loginFormItem" prop="username">
<span class="svg-container svg-container_login">
<svg-icon icon-class="user" />
</span>
<el-input name="username" type="text" v-model="loginForm.name" autoComplete="on" placeholder="username" />
</el-form-item>
<el-form-item class="loginFormItem" prop="password">
<span class="svg-container">
<svg-icon icon-class="password"></svg-icon>
</span>
<el-input name="password" :type="pwdType" @keyup.enter.native="handleLogin" v-model="loginForm.password" autoComplete="on" placeholder="password"></el-input>
<span class="show-pwd" @click="showPwd">
<svg-icon icon-class="eye" />
</span>
</el-form-item>
<el-form-item>
<el-button type="primary" style="width:100%;" :loading="loading" @click.native.prevent="handleLogin">
登录
</el-button>
</el-form-item>
<!-- <div class="tips">
<span style="margin-right:20px;">username: admin</span>
<span> password: admin</span>
</div> -->
</el-form>
</el-form>
</div>
</div>
</template>
<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 +56,7 @@ export default {
}
};
return {
title: PAGE_TITLE,
loginForm: {
name: '',
password: '',
......@@ -64,10 +69,12 @@ export default {
{ required: true, trigger: 'blur', validator: validatePass },
],
},
loading: false,
pwdType: 'password',
};
},
computed: {
...mapGetters(['loading']),
},
methods: {
...mapActions(['Login']),
showPwd() {
......@@ -80,15 +87,13 @@ export default {
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
this.Login(this.loginForm)
.then(() => {
.then(path => {
console.log('login done');
this.loading = false;
this.$router.push({ path: '/' });
this.$router.push({ path: path });
})
.catch(() => {
this.loading = false;
.catch(err => {
console.log(err);
});
} else {
console.log('error submit!!');
......@@ -110,6 +115,8 @@ $light_gray: #eee;
height: 100%;
width: 100%;
background-color: $bg;
background-image: url('../../assets/images/login/login_bg@3x.png');
background-size: cover;
input:-webkit-autofill {
box-shadow: 0 0 0px 1000px #293444 inset !important;
-webkit-text-fill-color: #fff !important;
......@@ -120,7 +127,7 @@ $light_gray: #eee;
-webkit-appearance: none;
border-radius: 0px;
padding: 12px 5px 12px 15px;
color: $light_gray;
color: #666;
height: 47px;
}
.el-input {
......@@ -144,25 +151,35 @@ $light_gray: #eee;
}
}
.title {
font-size: 26px;
font-weight: 400;
font-size: 40px;
color: $light_gray;
margin: 0px auto 40px auto;
margin: 0px auto 70px auto;
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 {
position: absolute;
left: 0;
right: 0;
width: 400px;
padding: 35px 35px 15px 35px;
margin: 120px auto;
top: 200px;
right: 230px;
width: 336px;
}
.loginFormItem {
height: 52px;
background-color: #fff;
border-radius: 8px;
margin-bottom: 28px;
}
.el-form-item {
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.1);
border-radius: 5px;
// background: rgba(0, 0, 0, 0.1);
// border-radius: 5px;
color: #454545;
}
.show-pwd {
......@@ -180,4 +197,46 @@ $light_gray: #eee;
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>
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,
};
<template>
<div class="manage-publicCar main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" :maxlength="20" placeholder="请输入申请人" clearable></el-input>
</div>
<div class="grid-content">
<el-input v-model.trim="filters.department" :maxlength="20" placeholder="请输入用车部门" clearable></el-input>
</div>
<div class="grid-content">
<el-select v-model="filters.dealResult" filterable clearable placeholder="处理状态">
<el-option v-for="item in dealResultOptions" :key="item.id" :label="item.label" :value="item.value">
</el-option>
</el-select>
</div>
<div class="grid-content">
<el-date-picker v-model="filters.createDate" 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="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd')" label="申请时间" min-width="80">
</el-table-column>
<el-table-column prop="department" label="用车部门" min-width="100">
</el-table-column>
<el-table-column prop="categoryName" :formatter="getCategoryValue" label="用车类型" min-width="100">
</el-table-column>
<el-table-column prop="userCount" label="用车人数" min-width="80">
</el-table-column>
<el-table-column prop="dealResult" :formatter="getResultValue" label="处理状态" min-width="80">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="130" align="center">
<template slot-scope="scope">
<template v-if="scope.row.dealResult == 1">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">处理</el-button>
</template>
<template v-else-if="scope.row.dealResult == 2">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(0, scope)">详情</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showPrintDialog(scope)">打印</el-button>
</template>
<template v-else>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(0, scope)">详情</el-button>
</template>
</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%" top="5vh">
<el-form class="editForm" :disabled="loading">
<div class="line-wrap">
<el-form-item class="col-line-3" label="用车部门" label-width="100px">
<span>{{selected.department}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="用车申请时间" label-width="100px">
<span>{{selected.createDate}}</span>
</el-form-item>
</div>
<div class="line-wrap">
<el-form-item class="col-line-3" label="申请人" label-width="100px">
<span>{{selected.name}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="用车人数" label-width="100px">
<span>{{selected.userCount}}</span>
</el-form-item>
</div>
<el-form-item label="用车类型" label-width="100px">
<span>{{selected.categoryName}}</span>
</el-form-item>
<el-form-item label="用车起止时间" label-width="100px">
<span>{{selected.beginDate}} - {{selected.endDate}}</span>
</el-form-item>
<el-form-item label="用车详细路线" label-width="100px">
<span>{{selected.lineDescription}}</span>
</el-form-item>
<div class="line-wrap">
<el-form-item class="col-line-3" label="派车人" label-width="100px">
<span>{{selected.dealName}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="派车车牌" label-width="100px">
<el-select v-if="editType" v-model="selected.carPlate" filterable clearable placeholder="派车车牌">
<el-option v-for="item in carPlateOptions" :key="item.id" :label="item.name" :value="item.name">
</el-option>
</el-select>
<span v-else>{{selected.carPlate}}</span>
</el-form-item>
</div>
<div class="line-wrap">
<el-form-item class="col-line-3" label="出车公里数" label-width="100px">
<el-input-number v-model.trim="selected.startKilometers" :controls="false" :precision="0" :min="0" :max="9999999" placeholder="" clearable></el-input-number>
</el-form-item>
<el-form-item class="col-line-3" label="收车公里数" label-width="100px">
<el-input-number v-model.trim="selected.stopKilometers" :controls="false" :precision="0" :min="0" :max="9999999" placeholder="" clearable></el-input-number>
</el-form-item>
<el-form-item class="col-line-3" label="实际公里数" label-width="100px">
<el-input-number v-model.trim="selected.trueKilometers" :controls="false" :precision="0" :min="0" :max="9999999" placeholder="" clearable></el-input-number>
</el-form-item>
</div>
<el-form-item label="资金来源" label-width="100px">
<el-input v-model.trim="selected.priceSource" placeholder="可不填" :maxlength="20" clearable></el-input>
</el-form-item>
<div class="line-wrap">
<el-form-item class="col-line-3" label="用车单价" label-width="100px">
<el-input-number v-model.trim="selected.price" :controls="false" :precision="2" :min="0" :max="9999999.99" placeholder="可不填" clearable></el-input-number>
</el-form-item>
<el-form-item class="col-line-3" label="用车金额" label-width="100px">
<el-input-number v-model.trim="selected.totalPrice" :controls="false" :precision="2" :min="0" :max="9999999.99" placeholder="可不填" clearable></el-input-number>
</el-form-item>
</div>
<!-- <template v-else>
<el-form-item class="col-line-2" label="用车单价" label-width="100px">
<span>{{selected.price}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="用车金额" label-width="100px">
<span>{{selected.totalPrice}}</span>
</el-form-item>
</template> -->
<el-form-item v-if="editType" label-width="100px">
<div class="item-value-start">
<el-radio v-model="selected.dealResult" @change="toogleDealResult" :label="2">同意</el-radio>
<el-radio v-model="selected.dealResult" @change="toogleDealResult" :label="3">不同意</el-radio>
<el-input v-if="selected.dealResult === 3" v-model.trim="selected.dealOpinion" :maxlength="20" placeholder="可不填" clearable></el-input>
</div>
</el-form-item>
<el-form-item v-else label="处理结果" label-width="100px">
<span>{{selected.dealResult ===2?'同意':selected.dealOpinion}}</span>
</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 @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateDealHandle">确 定</el-button>
</div>
</drag-dialog>
<drag-dialog title="用车管理-打印" :visible.sync="dialogPrintVisible" :before-close="resetPrintDialog" width="70%" top="5vh">
<iframe v-if="dialogPrintVisible" class="printIframe" ref="print" :src="`/print/publicCar?data=${JSON.stringify(selected)}`" frameborder="0" :data-item="selected"></iframe>
<div slot="footer" class="dialog-footer">
<el-button @click="resetPrintDialog">取 消</el-button>
<el-button type="primary" @click="printHandle">打 印</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/publicCar.js';
// import printJS from 'print-js';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
return {
filters: {
name: '',
department: '',
dealResult: '',
createDate: '',
endDate: '',
},
selected: {},
dialogPrintVisible: false,
//1处理中 2已同意 3未同意
dealResultOptions: [
{
label: '处理中',
value: 1,
},
{
label: '已同意',
value: 2,
},
{
label: '未同意',
value: 3,
},
],
};
},
computed: {
...mapGetters(['carPlateOptions', 'userInfo']),
...mapGetters('management/publicCar', ['list', 'pagination']),
},
methods: {
...mapActions(['fetchCarPlateOptions']),
...mapActions('management/publicCar', ['fetchList']),
getResultValue(c, r, val) {
let item = this.dealResultOptions.find(item => item.value == val);
return item ? item.label : val;
},
initSelected() {
this.selected = {
userId: '',
name: '',
department: '',
duty: '',
title: '',
sex: '',
birthday: '',
jobNumber: '',
cellphone: '',
};
},
getCategoryValue(c, r, val) {
let list = JSON.parse(val);
let item = list.find(item => item.checked);
return item ? item.name : '';
},
showEditDialog(type, data) {
this.editType = type;
if (this.carPlateOptions.length == 0) {
this.fetchCarPlateOptions();
}
let categoryName = JSON.parse(data.row.categoryName).map(
item => (item.checked ? `☑ ${item.name}` : `▢ ${item.name}`)
);
this.selected = {
id: data.row.id,
department: data.row.department,
createDate: data.row.createDate,
name: data.row.name,
userCount: data.row.userCount,
categoryName: categoryName.join('; '),
// beginDate: this.$formatDate(
// new Date(data.row.beginDate),
// 'yyyy-MM-dd hh:mm:ss'
// ),
// endDate: this.$formatDate(
// new Date(data.row.endDate),
// 'yyyy-MM-dd hh:mm:ss'
// ),
beginDate: data.row.beginDate,
endDate: data.row.endDate,
lineDescription: data.row.lineDescription,
dealName: data.row.dealName || this.userInfo.name,
carPlate: data.row.carPlate,
startKilometers: data.row.startKilometers,
stopKilometers: data.row.stopKilometers,
trueKilometers: data.row.trueKilometers,
priceSource: data.row.priceSource,
price: data.row.price,
totalPrice: data.row.totalPrice,
dealResult: data.row.dealResult,
dealOpinion: data.row.dealOpinion,
};
this.dialogEditVisible = true;
},
toogleDealResult(val) {
if (val === 2) {
this.selected.dealOpinion = '';
}
},
validateSelect() {
if (this.selected.dealResult == 2 && !this.selected.carPlate) {
this.$message.error('请选择派车车牌!');
return;
}
if (this.selected.dealResult == 1) {
this.$message.error('请选择处理意见!');
return;
}
return true;
},
dealApplyHandle() {
if (!this.validateSelect()) {
return;
}
this.$confirm(`确认要处理吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
let dealOpinion = '';
if (this.selected.dealResult == 3) {
dealOpinion = this.selected.dealOpinion
? `不同意 - ${this.selected.dealOpinion}`
: `不同意 - 无车可派送`;
}
const entity = {
userId: this.userInfo.id,
id: this.selected.id,
carPlate: this.selected.carPlate,
startKilometers: this.selected.startKilometers,
stopKilometers: this.selected.stopKilometers,
trueKilometers: this.selected.trueKilometers,
priceSource: this.selected.priceSource,
price: this.selected.price,
totalPrice: this.selected.totalPrice,
dealName: this.selected.dealName,
dealResult: this.selected.dealResult,
dealOpinion: dealOpinion,
};
dealApply(entity)
.then(res => {
console.log(res);
this.fetchList();
this.$message.success(res.msg);
this.resetEditDialog();
})
.catch(err => {
console.log(err);
this.$message.error(err.msg || '处理失败!');
});
})
.catch(action => {
console.log(action);
});
},
updateDealHandle() {
const entity = {
id: this.selected.id,
startKilometers: this.selected.startKilometers,
stopKilometers: this.selected.stopKilometers,
trueKilometers: this.selected.trueKilometers,
priceSource: this.selected.priceSource,
price: this.selected.price,
totalPrice: this.selected.totalPrice,
};
dealApply(entity)
.then(res => {
console.log(res);
this.fetchList();
this.$message.success(res.msg);
this.resetEditDialog();
})
.catch(err => {
console.log(err);
this.$message.error(err.msg || '处理失败!');
});
},
showPrintDialog(data) {
let categoryName = JSON.parse(data.row.categoryName).map(
item => (item.checked ? `☑ ${item.name}` : `▢ ${item.name}`)
);
this.selected = {
id: data.row.id,
department: data.row.department,
createDate: data.row.createDate,
name: data.row.name,
userCount: data.row.userCount,
categoryName: categoryName.join('; '),
// beginDate: this.$formatDate(
// new Date(data.row.beginDate),
// 'yyyy-MM-dd hh:mm:ss'
// ),
// endDate: this.$formatDate(
// new Date(data.row.endDate),
// 'yyyy-MM-dd hh:mm:ss'
// ),
beginDate: data.row.beginDate,
endDate: data.row.endDate,
lineDescription: data.row.lineDescription,
dealName: data.row.dealName,
carPlate: data.row.carPlate,
startKilometers: data.row.startKilometers,
stopKilometers: data.row.stopKilometers,
trueKilometers: data.row.trueKilometers,
priceSource: data.row.priceSource,
price: data.row.price,
totalPrice: data.row.totalPrice,
dealResult: data.row.dealResult,
dealOpinion: data.row.dealOpinion,
};
this.dialogPrintVisible = true;
},
resetPrintDialog(done) {
this.selected = {};
done && typeof done == 'function'
? done()
: (this.dialogPrintVisible = false);
},
printHandle() {
this.$refs.print.contentWindow.vmPrint();
},
},
};
</script>
<style lang="scss">
.manage-publicCar {
.el-input-number .el-input__inner {
text-align: left;
}
.item-value {
display: flex;
justify-content: space-between;
}
.item-value-start {
display: flex;
.el-radio {
line-height: 40px;
}
.el-input {
margin-left: 30px;
}
}
.printIframe {
width: 100%;
height: 500px;
}
}
</style>
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 class="manage-account main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" :maxlength="20" placeholder="请输入姓名" clearable></el-input>
</div>
<div class="grid-content">
<el-input v-model.trim="filters.department" :maxlength="20" placeholder="请输入科室" clearable></el-input>
</div>
<div class="grid-content">
<el-select v-model="filters.isFrozen" filterable clearable placeholder="账号状态">
<el-option v-for="item in accountStatusOptions" :key="item.id" :label="item.label" :value="item.value">
</el-option>
</el-select>
</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="userList" 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="department" label="部门科室" min-width="100">
</el-table-column>
<el-table-column prop="duty" label="职务" min-width="100">
</el-table-column>
<el-table-column prop="title" label="职称" min-width="80">
</el-table-column>
<el-table-column prop="sex" :formatter="getSexValue" label="性别" min-width="50">
</el-table-column>
<el-table-column prop="birthday" :formatter="(c,r,val) => val ? $formatDate(new Date(val),'yyyy-MM-dd') : ''" label="出生年月" min-width="80">
</el-table-column>
<el-table-column prop="cellphone" label="手机号" min-width="100">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="130" 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="toggleTeacherStatus(scope)">{{scope.row.isFrozen?'账户解冻':'账户冻结'}}</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="editItem" label="姓名" label-width="100px">
<el-input v-model.trim="selected.name" placeholder="请输入姓名" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item class="editItem" label="部门科室" label-width="100px">
<el-input v-model.trim="selected.department" placeholder="请输入部门科室" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item class="editItem" label="职务" label-width="100px">
<el-input v-model.trim="selected.duty" placeholder="请输入职务" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item class="editItem" label="职称" label-width="100px">
<el-input v-model.trim="selected.title" placeholder="请输入职称" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item class="editItem" label="性别" label-width="100px">
<el-radio v-for="(sex, index) in sexOptions" :key="index" v-model="selected.sex" :label="sex.value">{{sex.label}}</el-radio>
</el-form-item>
<el-form-item class="editItem" label="出生年月" label-width="100px">
<el-date-picker v-model="selected.birthday" type="date" placeholder="请输入出生年月" clearable>
</el-date-picker>
</el-form-item>
<el-form-item class="editItem" label="工号" label-width="100px">
<el-input v-model.trim="selected.jobNumber" placeholder="请输入工号" :maxlength="8" clearable></el-input>
</el-form-item>
<el-form-item class="editItem" label="手机号" label-width="100px">
<el-input v-model="selected.cellphone" ref="telInput" :maxlength="11" placeholder="请输入手机号" clearable></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateTeacher">确 定</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 {
addTeacher,
updateTeacher,
toggleTeacherStatus,
} from '@/api/management/user.js';
import { sexOptions } from '@/config';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
return {
filters: {
name: '',
department: '',
isFrozen: '',
},
selected: {},
accountStatusOptions: [
{
label: '解冻',
value: 0,
},
{
label: '冻结',
value: 1,
},
],
sexOptions: sexOptions,
};
},
computed: {
...mapGetters('management/user', ['userList', 'pagination']),
...mapGetters(['loading']),
},
methods: {
...mapActions('management/user', { fetchList: 'fetchUserList' }),
...mapActions(['fetchAllAuthUserList']),
initfilters() {
this.filters = {
name: '',
department: '',
isFrozen: '',
};
},
initSelected() {
this.selected = {
userId: '',
name: '',
department: '',
duty: '',
title: '',
sex: '',
birthday: '',
jobNumber: '',
cellphone: '',
};
},
getSexValue(c, r, val) {
let item = this.sexOptions.find(item => item.value == val);
return item ? item.label : val;
},
getFilters() {
let filters = {
...this.$getFilters(this.filters),
isFrozen: this.filters.isFrozen,
};
return filters;
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
userId: data.row.userId,
name: data.row.name,
department: data.row.department,
duty: data.row.duty,
title: data.row.title,
sex: data.row.sex,
birthday: data.row.birthday,
jobNumber: data.row.jobNumber,
cellphone: data.row.cellphone,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入姓名!');
return;
}
if (!this.selected.department) {
this.$message.error('请输入部门科室!');
return;
}
// if (!this.selected.duty) {
// this.$message.error('请输入职务!');
// return;
// }
// if (!this.selected.title) {
// this.$message.error('请输入职称!');
// return;
// }
if (!this.selected.sex) {
this.$message.error('请输入性别!');
return;
}
// if (!this.selected.birthday) {
// this.$message.error('请输入出生年月!');
// return;
// }
return true;
},
formatCellphone(val) {
return val.replace(/\D/g, '');
},
updateCellphone(val) {
console.log(this.$refs.telInput);
// this.selected.cellphone = val.replace(/\D/g, '');
this.$refs.telInput.value = val.replace(/\D/g, '');
},
updateTeacher() {
if (!this.validateSelect()) {
return;
}
const entity = {
userId: this.selected.userId,
name: this.selected.name,
department: this.selected.department,
duty: this.selected.duty,
title: this.selected.title,
sex: this.selected.sex,
birthday: this.selected.birthday,
jobNumber: this.selected.jobNumber,
cellphone: this.selected.cellphone,
};
this.$confirm(`确认要${this.editType ? '编辑' : '新增'}吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
if (this.editType) {
updateTeacher(entity)
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
addTeacher(entity)
.then(res => {
this.fetchList();
this.fetchAllAuthUserList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
})
.catch(action => {
console.log(action);
});
},
toggleTeacherStatus(data) {
this.$confirm(
`确认要${data.row.isFrozen ? '解冻' : '冻结'} ${data.row.name} 吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
const entity = {
userId: data.row.userId,
isFrozen: data.row.isFrozen ? 0 : 1,
};
toggleTeacherStatus(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
<style lang="scss">
.manage-account {
.editForm {
display: flex;
flex-wrap: wrap;
}
.editItem {
width: 45%;
}
}
</style>
<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,
};
<template>
<div class="system-account 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-input v-model.trim="filters.department" placeholder="请输入科室" clearable></el-input>
</div>
<div class="grid-content">
<el-select v-model="filters.isFrozen" filterable clearable placeholder="账号状态">
<el-option v-for="item in accountStatusOptions" :key="item.id" :label="item.label" :value="item.value">
</el-option>
</el-select>
</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="120">
</el-table-column>
<el-table-column prop="department" label="部门科室" min-width="120">
</el-table-column>
<el-table-column prop="cellphone" label="手机号" min-width="120">
</el-table-column>
<el-table-column prop="sex" :formatter="getSexValue" label="性别" min-width="120">
</el-table-column>
<el-table-column prop="account" label="登陆账号" min-width="120">
</el-table-column>
<el-table-column prop="isFrozen" :formatter="getStatusValue" label="状态" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-dropdown trigger="click">
<el-button type="primary" size="mini">
<i class="el-icon-setting"></i>
</el-button>
<el-dropdown-menu class="AccountIndex" slot="dropdown">
<el-dropdown-item>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showUserAuth(scope)">授权</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showResetUserPwd(scope)">重置密码</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="freezeUser(scope)">{{scope.row.isFrozen?'账户解冻':'账户冻结'}}</el-button>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</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.department" placeholder="请输入部门科室" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="登陆账号" label-width="200px">
<span v-if="editType">{{selected.account}}</span>
<el-input v-else v-model.trim="selected.account" placeholder="请输入登陆账号" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="手机号" label-width="200px">
<el-input :value="selected.cellphone" @change="updateCellphone" type="number" placeholder="请输入手机号" clearable></el-input>
</el-form-item>
<el-form-item label="性别" label-width="200px">
<el-radio v-for="(sex, index) in sexOptions" :key="index" v-model="selected.sex" :label="sex.value">{{sex.label}}</el-radio>
</el-form-item>
<el-form-item v-if="editType === 0" label-width="200px">
<p style="color:red">
用户初始密码为:123456
</p>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateAccount">确 定</el-button>
</div>
</drag-dialog>
<drag-dialog class="rateDialog" title="权限" :visible.sync="dialogAuthVisible" :before-close="resetAuthDialog">
<el-checkbox-group class="menuList" v-model="selected.menuList">
<div class="menuItem" v-for="(menu, index) in menuList" :key="index">
<div class="menuName">{{menu.menuName}}</div>
<div class="subMenuList">
<el-checkbox class="subMenuItem" v-for="(subMenu, index) in menu.childList" :key="index" :label="subMenu.id">{{subMenu.menuName}}</el-checkbox>
</div>
</div>
</el-checkbox-group>
<span slot="footer" class="dialog-footer">
<el-button @click="resetAuthDialog">取 消</el-button>
<el-button type="primary" @click="updateUserAuth">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '../../../mixin/listPage.js';
import { accountStatusOptions } from '@/config';
import { mapGetters, mapActions } from 'vuex';
import store from './store.js';
import {
resetPwd,
toggleUserFreezeState,
addAccount,
updateAccount,
fetchMenuList,
fetchUserMenuList,
updateUserAuthMenu,
} from '@/api/system/account';
import { sexOptions } from '@/config';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
return {
filters: {
name: '',
department: '',
isFrozen: '',
},
accountStatusOptions: accountStatusOptions,
dialogAuthVisible: false,
menuList: [],
sexOptions: sexOptions,
};
},
computed: {
...mapGetters('system/account', {
list: 'accountList',
pagination: 'pagination',
}),
},
methods: {
...mapActions('system/account', { fetchList: 'fetchList' }),
initSelected() {
this.selected = {
id: '',
name: '',
account: '',
department: '',
cellphone: '',
sex: '',
menuList: [],
};
},
getSexValue(c, r, val) {
let item = this.sexOptions.find(item => item.value == val);
return item ? item.label : val;
},
getStatusValue(c, r, val) {
let item = this.accountStatusOptions.find(item => item.value == val);
return item ? item.label : val;
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
account: data.row.account,
department: data.row.department,
cellphone: data.row.cellphone,
sex: data.row.sex,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
showResetUserPwd(data) {
this.$confirm(`是否要重置密码?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
};
resetPwd(entity)
.then(res => {
this.fetchList();
this.$message.success('密码已重置为123456!');
})
.catch(err => {
this.$message.error('重置密码失败!');
});
})
.catch(action => {
console.log(action);
});
},
freezeUser(data) {
this.$confirm(
`确认要${data.row.isFrozen ? '解冻' : '冻结'} ${data.row.name} 用户吗?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
const entity = {
id: data.row.id,
isFrozen: data.row.isFrozen ? 0 : 1,
};
toggleUserFreezeState(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('冻结/解冻失败!');
});
})
.catch(action => {
console.log(action);
});
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入姓名!');
return;
}
if (!this.selected.department) {
this.$message.error('请选择部门科室!');
return;
}
if (!this.selected.account) {
this.$message.error('请选择登陆账号!');
return;
}
if (!this.selected.cellphone) {
this.$message.error('请输入手机号!');
return;
}
if (this.selected.cellphone.length !== 11) {
this.$message.error('请输入正确手机号!');
return;
}
if (!this.selected.sex) {
this.$message.error('请选择性别!');
return;
}
return true;
},
updateCellphone(val) {
console.log(val);
this.selected.cellphone = val.slice(0, 11);
},
updateAccount() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
account: this.selected.account,
name: this.selected.name,
department: this.selected.department,
cellphone: this.selected.cellphone,
sex: this.selected.sex,
};
if (this.editType) {
updateAccount(entity)
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
addAccount(entity)
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
showUserAuth(data) {
if (this.menuList.length == 0) {
fetchMenuList().then(res => {
this.menuList = res.data;
});
}
fetchUserMenuList({
id: data.row.id,
})
.then(res => {
this.selected = {
id: data.row.id,
menuList: res.data,
};
this.dialogAuthVisible = true;
})
.catch(err => {
this.$message.error(err.msg || '请求失败');
});
},
resetAuthDialog(done) {
this.selected = {};
done && typeof done == 'function'
? done()
: (this.dialogAuthVisible = false);
},
updateUserAuth() {
const entity = {
id: this.selected.id,
author: this.selected.menuList.join(','),
};
updateUserAuthMenu(entity)
.then(res => {
this.$message.success(res.msg);
this.resetAuthDialog();
})
.catch(err => {
this.$message.success(err.msg || '更新失败!');
});
},
},
};
</script>
<style lang="scss">
.system-account {
.menuItem {
padding: 5px 24px;
border-bottom: 1px solid #ccc;
}
.menuName {
margin: 20px 0 5px;
font-size: 18px;
}
.subMenuList {
line-height: 40px;
}
}
</style>
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 {
if (store.getters.isRouteDone) {
next(); //
} else {
// if(store.getters.userInfo.loginState)
store
.dispatch('GenerateRoutes')
.then(() => {
router.addRoutes(store.getters.addRouters.slice()); // 动态添加可访问路由表
next({ ...to, replace: true });
})
.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');
// 路由已经鉴权
if (store.getters.isRouteDone) {
next();
NProgress.done();
return;
}
// 没有鉴权动态获取路由
store
.dispatch('GenerateRoutes')
.then(() => {
router.addRoutes(store.getters.addRouters); // 动态添加可访问路由表
next({ ...to, replace: true });
})
.catch(err => {
console.log('验证失败,请重新登录');
console.log(err);
store.dispatch('FedLogOut').then(() => {
// Message.error('验证失败,请重新登录');
next({ path: '/login' });
});
});
return;
}
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);
......@@ -19,6 +23,7 @@ export const constantRouterMap = [
name: 'home',
redirect: 'home',
meta: { title: '首页', icon: 'example' },
hidden: true,
children: [
{
path: 'home',
......@@ -28,6 +33,12 @@ export const constantRouterMap = [
},
],
},
{
path: '/print/publicCar',
component: printPublicCarPage,
name: 'printPublicCarPage',
hidden: true,
},
];
export const asyncRouterMap = [
......@@ -35,6 +46,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,34 +14,55 @@ 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;
setToken(token);
commit(SET_TOKEN, token);
commit(UPDATE_USERINFO, others);
dispatch('initRoute', menus).then(() => {
resolve();
});
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, admin);
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 }) {
return logout(state.token).then(() => {
commit(SET_TOKEN, '');
removeToken();
resolve();
});
return logout(state.token)
.then(() => {
commit(SET_TOKEN, '');
removeToken();
})
.catch(err => {
console.log(err);
commit(SET_TOKEN, '');
removeToken();
});
},
// 前端 登出
......@@ -70,6 +91,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,41 +19,43 @@ const actions = {
initRoute({ commit }, menus) {
return new Promise(resolve => {
let authList = [];
menus.map(item => {
const mainMenu = {
...asyncRouterMap[0],
};
if (mainMenu) {
const { children, ...routeMenu } = mainMenu;
let subMenuList = [];
if (item.children && item.children.length) {
item.children.map(subItem => {
const subMenu = asyncRouterMap.find(
menu => menu.id === subItem.id
);
if (subMenu) {
subMenuList.push({
...subMenu,
path: subItem.menuLink,
name: subItem.id,
meta: {
...subMenu.meta,
title: subItem.menuName,
buts: { ...subItem.buts },
},
});
}
menus &&
menus.length &&
menus.map(item => {
const mainMenu = {
...asyncRouterMap[0],
};
if (mainMenu) {
const { children, ...routeMenu } = mainMenu;
let subMenuList = [];
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.menuUrl,
name: subItem.id,
meta: {
...subMenu.meta,
title: subItem.menuName,
buts: { ...subItem.buts },
},
});
}
});
}
authList.push({
...routeMenu,
path: item.menuUrl,
name: item.menuName,
meta: { ...routeMenu.meta, title: item.menuName },
children: subMenuList,
});
}
authList.push({
...routeMenu,
path: '/' + item.menuLink,
name: item.menuName,
meta: { ...routeMenu.meta, title: item.menuName },
children: subMenuList,
});
}
});
});
console.log(authList);
authList.push(asyncRouterMap[asyncRouterMap.length - 1]); // 添加404页面
commit(SET_ROUTERS, authList);
......@@ -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;
......
# 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