Commit cdfb2018 by 姜雷

添加用车管理页面

parent 21b27075
import fetch from '@/api/fetch';
export const fetchApplyList = entity =>
fetch({
url: '/publicCar/teacherAppoCar4Page',
method: 'post',
data: entity,
});
export const dealApply = entity =>
fetch({
url: '/publicCar/teacherAppoCar4Deal',
method: 'post',
data: entity,
});
import fetch from '@/api/fetch'; import fetch from '@/api/fetch';
export const fetchUserList = entity => export const fetchTeacherList = entity =>
fetch({ fetch({
url: '/admin/admin4Page', 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', method: 'post',
data: entity, data: entity,
}); });
...@@ -10,8 +10,8 @@ export const login = entity => ...@@ -10,8 +10,8 @@ export const login = entity =>
// 登出 // 登出
export const logout = () => export const logout = () =>
fetch({ fetch({
method: 'post', url: '/login/manager/appLoginOut',
data: {}, method: 'get',
}); });
// 修改密码 // 修改密码
export const changePwd = entity => export const changePwd = entity =>
......
...@@ -14,7 +14,18 @@ export const accountStatusOptions = [ ...@@ -14,7 +14,18 @@ export const accountStatusOptions = [
value: 1, value: 1,
}, },
]; ];
export const sexOptions = [
{
label: '男',
value: 1,
},
{
label: '女',
value: 2,
},
];
export default { export default {
...constants, ...constants,
accountStatusOptions, accountStatusOptions,
sexOptions,
}; };
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> <template>
<div>publicCar</div> <div class="manage-publicCar 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.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" 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="showEditDialog(0, 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%">
<el-form class="editForm" :disabled="loading">
<el-form-item class="col-line-2" label="用车部门" label-width="100px">
<span>{{selected.department}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="用车申请时间" label-width="100px">
<span>{{selected.createDate}}</span>
</el-form-item>
<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="用车人数" label-width="100px">
<span>{{selected.userCount}}</span>
</el-form-item>
<el-form-item label="用车类型" label-width="100px">
<span>{{selected.categoryName}}</span>
</el-form-item>
<el-form-item label="用车起止时间" label-width="100px">
<span>{{selected.beginDate}}</span>
<span>{{selected.endDate}}</span>
</el-form-item>
<el-form-item label="用车详细路线" label-width="100px">
<span>{{selected.lineDescription}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="派车人" label-width="100px">
<span>{{selected.dealName}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="派车车牌" label-width="100px">
<span>{{selected.carPlate}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="出车公里数" label-width="100px">
<span>{{selected.startKilometers}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="收车公里数" label-width="100px">
<span>{{selected.stopKilometers}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="实际公里数" label-width="100px">
<span>{{selected.trueKilometers}}</span>
</el-form-item>
<el-form-item label="资金来源" label-width="100px">
<span>{{selected.priceSource}}</span>
</el-form-item>
<el-form-item label="用车单价" label-width="100px">
<span>{{selected.price}}</span>
<span>{{selected.totalPrice}}</span>
</el-form-item>
<el-form-item label-width="100px">
<el-radio>同意</el-radio>
<el-radio>不同意</el-radio>
<span>{{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 type="primary" @click="resetEditDialog">确 定</el-button>
</div>
</drag-dialog>
</div>
</template> </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';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
return {
filters: {
name: '',
department: '',
dealResult: '',
createDate: '',
endDate: '',
},
selected: {},
//1处理中 2已同意 3未同意
dealResultOptions: [
{
label: '处理中',
value: 1,
},
{
label: '已同意',
value: 2,
},
{
label: '未同意',
value: 3,
},
],
};
},
computed: {
...mapGetters('management/publicCar', ['list', 'pagination']),
},
methods: {
...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: '',
};
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
department: data.row.department,
createDate: data.row.createDate,
name: data.row.name,
userCount: data.row.userCount,
categoryName: data.row.categoryName,
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,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
dealApplyHandle() {
dealApply();
},
},
};
</script>
<style lang="scss">
.manage-publicCar {
.editForm {
display: flex;
}
.col-line-2 {
width: 45%;
}
}
</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']);
},
};
...@@ -8,7 +8,9 @@ export default { ...@@ -8,7 +8,9 @@ export default {
namespaced: true, namespaced: true,
}); });
} }
store.registerModule(['management', 'user'], user); if (!store.state.management.user) {
store.registerModule(['management', 'user'], user);
}
}, },
uninstall() { uninstall() {
store.unregisterModule(['management', 'user']); store.unregisterModule(['management', 'user']);
......
import pagination from '../../../store/modules/pagination'; import pagination from '../../../store/modules/pagination';
import { fetchUserList } from '@/api/management/user'; import { fetchTeacherList } from '@/api/management/user';
import { GET_USER_LIST } from './mutation-types'; import { GET_USER_LIST } from './mutation-types';
const state = { const state = {
...@@ -10,7 +10,7 @@ const getters = { ...@@ -10,7 +10,7 @@ const getters = {
}; };
const actions = { const actions = {
fetchUserList({ dispatch, state, commit }, entity) { fetchUserList({ dispatch, state, commit }, entity) {
return fetchUserList({ return fetchTeacherList({
...state.pagination, ...state.pagination,
...entity, ...entity,
}).then(res => { }).then(res => {
......
...@@ -75,8 +75,7 @@ ...@@ -75,8 +75,7 @@
<el-input :value="selected.cellphone" @change="updateCellphone" type="number" placeholder="请输入手机号" clearable></el-input> <el-input :value="selected.cellphone" @change="updateCellphone" type="number" placeholder="请输入手机号" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="性别" label-width="200px"> <el-form-item label="性别" label-width="200px">
<el-radio v-model="selected.sex" :label="1"></el-radio> <el-radio v-for="(sex, index) in sexOptions" :key="index" v-model="selected.sex" :label="sex.value">{{sex.label}}</el-radio>
<el-radio v-model="selected.sex" :label="2"></el-radio>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -115,6 +114,7 @@ import { ...@@ -115,6 +114,7 @@ import {
fetchUserMenuList, fetchUserMenuList,
updateUserAuthMenu, updateUserAuthMenu,
} from '@/api/system/account'; } from '@/api/system/account';
import { sexOptions } from '@/config';
export default { export default {
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
...@@ -132,6 +132,7 @@ export default { ...@@ -132,6 +132,7 @@ export default {
accountStatusOptions: accountStatusOptions, accountStatusOptions: accountStatusOptions,
dialogAuthVisible: false, dialogAuthVisible: false,
menuList: [], menuList: [],
sexOptions: sexOptions,
}; };
}, },
computed: { computed: {
...@@ -154,7 +155,8 @@ export default { ...@@ -154,7 +155,8 @@ export default {
}; };
}, },
getSexValue(c, r, val) { getSexValue(c, r, val) {
return val == 1 ? '男' : '女'; let item = this.sexOptions.find(item => item.value == val);
return item ? item.label : val;
}, },
getStatusValue(c, r, val) { getStatusValue(c, r, val) {
let item = this.accountStatusOptions.find(item => item.value == val); let item = this.accountStatusOptions.find(item => item.value == val);
......
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