Commit fe76efb9 by 姜雷

添加报修处理和基础数据接口

parent cdfb2018
......@@ -79,6 +79,19 @@ input[type='number'] {
-webkit-appearance: none;
-moz-appearance: textfield;
}
.editForm {
display: flex;
flex-wrap: wrap;
}
.col-line-1 {
width: 100%;
}
.col-line-2 {
width: 45%;
}
.col-line-3 {
width: 32%;
}
</style>
<script>
export default {
......
import fetch from '@/api/fetch';
// (获取基础数据【车牌,用车类型,报修区域,报修项目】)
export const getBaseData = entity =>
fetch({
url: '/baseData/getBaseData',
method: 'get',
params: entity,
});
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,
});
......@@ -85,28 +85,44 @@
<span>{{selected.dealName}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="派车车牌" label-width="100px">
<span>{{selected.carPlate}}</span>
<el-input v-if="editType" v-model.trim="selected.carPlate" placeholder="请选择派车车牌" clearable></el-input>
<span v-else>{{selected.carPlate}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="出车公里数" label-width="100px">
<span>{{selected.startKilometers}}</span>
<el-input v-if="editType" v-model.trim="selected.startKilometers" placeholder="" clearable></el-input>
<span v-else>{{selected.startKilometers}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="收车公里数" label-width="100px">
<span>{{selected.stopKilometers}}</span>
<el-input v-if="editType" v-model.trim="selected.stopKilometers" placeholder="" clearable></el-input>
<span v-else>{{selected.stopKilometers}}</span>
</el-form-item>
<el-form-item class="col-line-3" label="实际公里数" label-width="100px">
<el-input v-if="editType" v-model.trim="selected.trueKilometers" placeholder="" clearable></el-input>
<span>{{selected.trueKilometers}}</span>
</el-form-item>
<el-form-item label="资金来源" label-width="100px">
<el-input v-if="editType" v-model.trim="selected.priceSource" placeholder="可不填" clearable></el-input>
<span>{{selected.priceSource}}</span>
</el-form-item>
<el-form-item label="用车单价" label-width="100px">
<span>{{selected.price}}</span>
<span>{{selected.totalPrice}}</span>
<template v-if="editType">
<el-input v-model.trim="selected.price" placeholder="可不填" clearable></el-input>
<el-input v-model.trim="selected.totalPrice" placeholder="可不填" clearable></el-input>
</template>
<template v-else>
<span>{{selected.price}}</span>
<span>{{selected.totalPrice}}</span>
</template>
</el-form-item>
<el-form-item label-width="100px">
<el-radio>同意</el-radio>
<el-radio>不同意</el-radio>
<span>{{selected.dealOpinion}}</span>
<template v-if="editType">
<el-radio label="1">同意</el-radio>
<el-radio label="2">不同意</el-radio>
<span>{{selected.dealOpinion}}</span>
</template>
<template v-else>
<span>{{selected.agree}}-{{selected.dealOpinion}}</span>
</template>
</el-form-item>
</el-form>
<div v-if="editType" slot="footer" class="dialog-footer">
......@@ -210,8 +226,50 @@ export default {
}
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;
},
dealApplyHandle() {
dealApply();
if (!this.validateSelect()) {
return;
}
const entity = {
userId: this.selected.userId,
};
dealApply(entity)
.then(res => {
console.log(res);
this.$message.success(res.msg);
this.resetEditDialog();
})
.catch(err => {
console.log(err);
this.$message.error(err.msg || '处理失败!');
});
},
},
};
......@@ -222,8 +280,5 @@ export default {
.editForm {
display: flex;
}
.col-line-2 {
width: 45%;
}
}
</style>
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>repair</div>
<div class="manage-repair main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="报修人" clearable></el-input>
</div>
<div class="grid-content">
<el-select v-model="filters.areaId" filterable clearable placeholder="报修区域">
<el-option v-for="item in repairAreaOptions" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</div>
<div class="grid-content">
<el-select v-model="filters.dealState" filterable clearable placeholder="处理状态">
<el-option v-for="item in dealStateOptions" :key="item.id" :label="item.label" :value="item.value">
</el-option>
</el-select>
</div>
<div class="grid-content">
<el-select v-model="filters.applyIdentity" filterable clearable placeholder="身份">
<el-option v-for="item in applyIdentityOptions" :key="item.id" :label="item.label" :value="item.value">
</el-option>
</el-select>
</div>
<div class="grid-content">
<el-date-picker v-model="filters.startDate" type="datetime" placeholder="报修开始时间" clearable>
</el-date-picker>
</div>
<div class="grid-content">
<el-date-picker v-model="filters.endDate" type="datetime" placeholder="报修结束时间" clearable>
</el-date-picker>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column prop="name" label="报修人" min-width="120"></el-table-column>
<el-table-column prop="repairCellphone" label="报修人tel" min-width="120"></el-table-column>
<el-table-column prop="area" label="报修区域" min-width="120"></el-table-column>
<el-table-column prop="term" label="报修项目" min-width="120"></el-table-column>
<el-table-column prop="address" label="报修地址" min-width="120"></el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd')" label="报修时间" min-width="120"></el-table-column>
<el-table-column prop="dealState" :formatter="getDealStateValue" label="处理状态" min-width="120"></el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.dealState == 1" type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">处理</el-button>
<el-button v-else type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(0, scope)">详情</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog :title="editType ? '处理' : '详情'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog" width="70%">
<el-form class="editForm" :disabled="loading">
<el-form-item class="col-line-2" label="报修人" label-width="100px">
<span>{{selected.name}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="报修人tel" label-width="100px">
<span>{{selected.repairCellphone}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="报修区域" label-width="100px">
<span>{{selected.area}}</span>
</el-form-item>
<el-form-item class="col-line-2" label="报修项目" label-width="100px">
<span>{{selected.term}}</span>
</el-form-item>
<el-form-item class="col-line-1" label="报修地址" label-width="100px">
<span>{{selected.address}}</span>
</el-form-item>
<el-form-item class="col-line-1" label="报修时间" label-width="100px">
<span>{{$formatDate(new Date(selected.createDate),'yyyy-MM-dd')}}</span>
</el-form-item>
<el-form-item class="col-line-1" v-if="selected.dealState == 1" label-width="100px">
<el-radio v-model="selected.dealed" :label="2">已处理</el-radio>
</el-form-item>
</el-form>
<div v-if="editType" slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="dealApplyHandle">确 定</el-button>
</div>
<div v-else slot="footer" class="dialog-footer">
<el-button type="primary" @click="resetEditDialog">确 定</el-button>
</div>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import { mapGetters, mapActions } from 'vuex';
import store from './store.js';
import { dealApply } from '@/api/management/repair.js';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
return {
filters: {
name: '',
dealState: '',
startDate: '',
endDate: '',
},
dealStateOptions: [
{
label: '处理中',
value: 1,
},
{
label: '已处理',
value: 2,
},
],
applyIdentityOptions: [
{
label: '学生',
value: '学生',
},
{
label: '教师',
value: '教师',
},
],
};
},
created() {
this.fetchRepairAreaOptions();
},
computed: {
...mapGetters(['loading', 'repairAreaOptions']),
...mapGetters('management/repair', ['list', 'pagination']),
},
methods: {
...mapActions(['fetchRepairAreaOptions']),
...mapActions('management/repair', ['fetchList']),
initSelected() {
this.selected = {
name: '',
repairCellphone: '',
area: '',
term: '',
address: '',
dealed: '',
};
},
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,
};
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.dealed) {
this.$message.error('请勾选已处理!');
return;
}
return true;
},
dealApplyHandle() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
dealState: this.selected.dealed,
};
dealApply(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
this.resetEditDialog();
})
.catch(err => {
console.log(err);
this.$message.error(err.msg || '处理失败!');
});
},
},
};
</script>
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']);
},
};
......@@ -3,11 +3,14 @@ import account from './account';
export default {
install() {
if (store.state.system && store.state.system.account) return;
store.registerModule(['system'], {
namespaced: true,
});
store.registerModule(['system', 'account'], account);
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/account';
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>wx</div>
<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="120">
</el-table-column>
<el-table-column prop="name" label="功能编号" min-width="120">
</el-table-column>
<el-table-column prop="name" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd')" label="创建时间" min-width="120">
</el-table-column>
<el-table-column prop="name" 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.auth" 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="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<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';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
return {
filters: {
name: '',
},
};
},
computed: {
...mapGetters(['loading']),
...mapGetters('system/wxAuth', ['list', 'pagination']),
},
methods: {
...mapActions('system/wxAuth', ['fetchList']),
},
};
</script>
import {
FETCH_CAR_PLATE,
FETCH_CAR_CATEGORY,
FETCH_REPAIR_AREA,
FETCH_REPAIR_TERM,
} from './mutation-types';
import { getBaseData } from '@/api/base/base';
const state = () => ({
carPlate: [],
carCategory: [],
repairArea: [],
repairTerm: [],
});
const getters = {
carPlateOptions: state => state.carPlate,
carCategoryOptions: state => state.carCategory,
repairAreaOptions: state => state.repairArea,
repairTermOptions: state => state.repairTerm,
};
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);
});
},
};
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;
},
};
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';
import tagsView from './tagsView';
import sidebar from './sidebar';
import base from './base/base';
import { FETCH_START, FETCH_DONE } from './mutation-types';
const state = () => ({
......@@ -30,6 +31,7 @@ export default {
modules: {
tagsView,
sidebar,
base,
},
state,
getters,
......
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