Commit 21b27075 by 姜雷

完成基础数据

parent c0df00d2
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,
});
......@@ -35,3 +35,23 @@ export const updateAccount = entity =>
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
......@@ -18,5 +18,5 @@ export const changePwd = entity =>
fetch({
url: '/admin/admin4ResetPwd',
method: 'post',
data: entity,
data: { ...entity, type: 3 },
});
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>publicCarNumber</div>
<div class="base-repairArea main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="请输入车牌号码" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button class="margin-css" type="primary" icon="el-icon-upload" @click="showEditDialog(0)">新增</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="车牌号码" min-width="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd hh:mm:ss')" label="创建时间" min-width="80">
</el-table-column>
<el-table-column prop="purpose" label="用途" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="deleteHandle(scope)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<el-form :disabled="loading">
<el-form-item label="车牌号码" label-width="200px">
<el-input v-model.trim="selected.name" placeholder="请输入车牌号码" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="用途" label-width="200px">
<el-input v-model.trim="selected.purpose" placeholder="请输入用途" :maxlength="20" clearable></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateSetting">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapGetters, mapActions } from 'vuex';
import { settingAdd, updateSetting, settingDel } from '@/api/baseData/baseData';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
let typeArr = this.$route.path.split('/');
let type = typeArr[typeArr.length - 1];
return {
type: type,
filters: {
name: '',
},
};
},
computed: {
...mapGetters('baseData/publicCarNumber', ['list', 'pagination']),
},
methods: {
...mapActions('baseData/publicCarNumber', {
fetchSettingList: 'fetchList',
}),
initSelected() {
this.selected = {
id: '',
name: '',
purpose: '',
};
},
fetchList(entity) {
this.fetchSettingList({
...entity,
type: this.type,
});
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
purpose: data.row.purpose,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入车牌号码!');
return;
}
return true;
},
updateSetting() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
name: this.selected.name,
purpose: this.selected.purpose,
};
if (this.editType) {
updateSetting({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
settingAdd({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
deleteHandle(data) {
this.$confirm(`确认要删除 ${data.row.name} 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
type: this.type,
};
settingDel(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
import store from '@/store/index';
import publicCarNumber from './publicCarNumber';
export default {
install() {
if (store.state.baseData && store.state.baseData.publicCarNumber) return;
if (!store.state.baseData) {
store.registerModule(['baseData'], {
namespaced: true,
});
}
store.registerModule(['baseData', 'publicCarNumber'], publicCarNumber);
},
uninstall() {
store.unregisterModule(['baseData', 'publicCarNumber']);
},
};
export const GET_CAR_NUMBER_LIST = 'GET_CAR_NUMBER_LIST';
import pagination from '@/store/modules/pagination';
import { fetchSettingList } from '@/api/baseData/baseData';
import { GET_CAR_NUMBER_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchSettingList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_CAR_NUMBER_LIST, list);
});
},
};
const mutations = {
[GET_CAR_NUMBER_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div>publicCarType</div>
<div class="base-repairArea main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="请输入类型名称" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button class="margin-css" type="primary" icon="el-icon-upload" @click="showEditDialog(0)">新增</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="类型名称" min-width="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd hh:mm:ss')" label="创建时间" min-width="80">
</el-table-column>
<el-table-column prop="purpose" label="用途" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="deleteHandle(scope)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<el-form :disabled="loading">
<el-form-item label="类型名称" label-width="200px">
<el-input v-model.trim="selected.name" placeholder="请输入类型名称" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="用途" label-width="200px">
<el-input v-model.trim="selected.purpose" placeholder="请输入用途" :maxlength="20" clearable></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateSetting">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapGetters, mapActions } from 'vuex';
import { settingAdd, updateSetting, settingDel } from '@/api/baseData/baseData';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
let typeArr = this.$route.path.split('/');
let type = typeArr[typeArr.length - 1];
return {
type: type,
filters: {
name: '',
},
};
},
computed: {
...mapGetters('baseData/publicCarType', ['list', 'pagination']),
},
methods: {
...mapActions('baseData/publicCarType', {
fetchSettingList: 'fetchList',
}),
initSelected() {
this.selected = {
id: '',
name: '',
purpose: '',
};
},
fetchList(entity) {
this.fetchSettingList({
...entity,
type: this.type,
});
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
purpose: data.row.purpose,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入类型名称!');
return;
}
return true;
},
updateSetting() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
name: this.selected.name,
purpose: this.selected.purpose,
};
if (this.editType) {
updateSetting({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
settingAdd({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
deleteHandle(data) {
this.$confirm(`确认要删除 ${data.row.name} 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
type: this.type,
};
settingDel(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
import store from '@/store/index';
import publicCarType from './publicCarType';
export default {
install() {
if (store.state.baseData && store.state.baseData.publicCarType) return;
if (!store.state.baseData) {
store.registerModule(['baseData'], {
namespaced: true,
});
}
store.registerModule(['baseData', 'publicCarType'], publicCarType);
},
uninstall() {
store.unregisterModule(['baseData', 'publicCarType']);
},
};
export const GET_CAR_NUMBER_LIST = 'GET_CAR_NUMBER_LIST';
import pagination from '@/store/modules/pagination';
import { fetchSettingList } from '@/api/baseData/baseData';
import { GET_CAR_NUMBER_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchSettingList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_CAR_NUMBER_LIST, list);
});
},
};
const mutations = {
[GET_CAR_NUMBER_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div>repairArea</div>
<div class="base-repairArea main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="请输入区域名称" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button class="margin-css" type="primary" icon="el-icon-upload" @click="showEditDialog(0)">新增</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="区域名称" min-width="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd hh:mm:ss')" label="创建时间" min-width="80">
</el-table-column>
<el-table-column prop="purpose" label="用途" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="deleteHandle(scope)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<el-form :disabled="loading">
<el-form-item label="区域名称" label-width="200px">
<el-input v-model.trim="selected.name" placeholder="请输入区域名称" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="用途" label-width="200px">
<el-input v-model.trim="selected.purpose" placeholder="请输入用途" :maxlength="20" clearable></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateSetting">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapGetters, mapActions } from 'vuex';
import { settingAdd, updateSetting, settingDel } from '@/api/baseData/baseData';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
let typeArr = this.$route.path.split('/');
let type = typeArr[typeArr.length - 1];
return {
type: type,
filters: {
name: '',
},
};
},
computed: {
...mapGetters('baseData/repairArea', ['list', 'pagination']),
},
methods: {
...mapActions('baseData/repairArea', {
fetchSettingList: 'fetchList',
}),
initSelected() {
this.selected = {
id: '',
name: '',
purpose: '',
};
},
fetchList(entity) {
this.fetchSettingList({
...entity,
type: this.type,
});
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
purpose: data.row.purpose,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入区域名称!');
return;
}
return true;
},
updateSetting() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
name: this.selected.name,
purpose: this.selected.purpose,
};
if (this.editType) {
updateSetting({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
settingAdd({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
deleteHandle(data) {
this.$confirm(`确认要删除 ${data.row.name} 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
type: this.type,
};
settingDel(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
import store from '@/store/index';
import repairArea from './repairArea';
export default {
install() {
if (store.state.baseData && store.state.baseData.repairArea) return;
if (!store.state.baseData) {
store.registerModule(['baseData'], {
namespaced: true,
});
}
store.registerModule(['baseData', 'repairArea'], repairArea);
},
uninstall() {
store.unregisterModule(['baseData', 'repairArea']);
},
};
export const GET_CAR_NUMBER_LIST = 'GET_CAR_NUMBER_LIST';
import pagination from '@/store/modules/pagination';
import { fetchSettingList } from '@/api/baseData/baseData';
import { GET_CAR_NUMBER_LIST } from './mutation-types';
const state = {
list: [],
};
const getters = {
list: state => state.list,
};
const actions = {
fetchList({ dispatch, state, commit }, entity) {
return fetchSettingList({
...state.pagination,
...entity,
}).then(res => {
const { list, ...pagination } = res.data;
dispatch('updatePagination', pagination);
commit(GET_CAR_NUMBER_LIST, list);
});
},
};
const mutations = {
[GET_CAR_NUMBER_LIST](state, list) {
state.list = list;
},
};
export default {
namespaced: true,
modules: {
pagination,
},
state,
getters,
actions,
mutations,
};
<template>
<div>repairProject</div>
<div class="base-repairArea main-wrap">
<el-form class="search-bar">
<div class="grid-content">
<el-input v-model.trim="filters.name" placeholder="请输入项目名称" clearable></el-input>
</div>
<el-button type="primary" icon="el-icon-search" @click="searchList">搜索</el-button>
<el-button class="margin-css" type="primary" icon="el-icon-upload" @click="showEditDialog(0)">新增</el-button>
</el-form>
<div class="tabel-wrap">
<el-table border v-loading="loading" :data="list" style="width: 100%">
<el-table-column type="index" label="序号" width="50">
</el-table-column>
<el-table-column prop="name" label="项目名称" min-width="80">
</el-table-column>
<el-table-column prop="createDate" :formatter="(c,r,val) => $formatDate(new Date(val),'yyyy-MM-dd hh:mm:ss')" label="创建时间" min-width="80">
</el-table-column>
<el-table-column prop="purpose" label="用途" min-width="120">
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="80" align="center">
<template slot-scope="scope">
<el-button type="primary" size="mini" class="operationBtnWidth" @click="showEditDialog(1, scope)">修改</el-button>
<el-button type="primary" size="mini" class="operationBtnWidth" @click="deleteHandle(scope)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="prev, pager, next" :current-page="pagination.pageNum" :page-size="pagination.pageSize" :total="pagination.total" @current-change="changePage">
</el-pagination>
</div>
<drag-dialog class="rateDialog" :title="editType?'修改':'新增'" :visible.sync="dialogEditVisible" :before-close="resetEditDialog">
<el-form :disabled="loading">
<el-form-item label="项目名称" label-width="200px">
<el-input v-model.trim="selected.name" placeholder="请输入项目名称" :maxlength="20" clearable></el-input>
</el-form-item>
<el-form-item label="用途" label-width="200px">
<el-input v-model.trim="selected.purpose" placeholder="请输入用途" :maxlength="20" clearable></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetEditDialog">取 消</el-button>
<el-button type="primary" @click="updateSetting">确 定</el-button>
</span>
</drag-dialog>
</div>
</template>
<script>
import listMixin from '@/mixin/listPage.js';
import store from './store.js';
import { mapGetters, mapActions } from 'vuex';
import { settingAdd, updateSetting, settingDel } from '@/api/baseData/baseData';
export default {
beforeRouteEnter(to, from, next) {
store.install();
next();
},
mixins: [listMixin],
data() {
let typeArr = this.$route.path.split('/');
let type = typeArr[typeArr.length - 1];
return {
type: type,
filters: {
name: '',
},
};
},
computed: {
...mapGetters('baseData/repairProject', ['list', 'pagination']),
},
methods: {
...mapActions('baseData/repairProject', {
fetchSettingList: 'fetchList',
}),
initSelected() {
this.selected = {
id: '',
name: '',
purpose: '',
};
},
fetchList(entity) {
this.fetchSettingList({
...entity,
type: this.type,
});
},
showEditDialog(type, data) {
this.editType = type;
if (type) {
this.selected = {
id: data.row.id,
name: data.row.name,
purpose: data.row.purpose,
};
} else {
this.initSelected();
}
this.dialogEditVisible = true;
},
validateSelect() {
if (!this.selected.name) {
this.$message.error('请输入项目名称!');
return;
}
return true;
},
updateSetting() {
if (!this.validateSelect()) {
return;
}
const entity = {
id: this.selected.id,
name: this.selected.name,
purpose: this.selected.purpose,
};
if (this.editType) {
updateSetting({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '更新失败!');
});
} else {
settingAdd({ ...entity, type: this.type })
.then(res => {
this.fetchList();
this.resetEditDialog();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error(err.msg || '新增失败!');
});
}
},
deleteHandle(data) {
this.$confirm(`确认要删除 ${data.row.name} 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const entity = {
id: data.row.id,
type: this.type,
};
settingDel(entity)
.then(res => {
this.fetchList();
this.$message.success(res.msg);
})
.catch(err => {
this.$message.error('删除失败!');
});
})
.catch(action => {
console.log(action);
});
},
},
};
</script>
import store from '@/store/index';
import repairProject from './repairProject';
export default {
install() {
if (store.state.baseData && store.state.baseData.repairProject) return;
if (!store.state.baseData) {
store.registerModule(['baseData'], {
namespaced: true,
});
}
store.registerModule(['baseData', 'repairProject'], repairProject);
},
uninstall() {
store.unregisterModule(['baseData', 'repairProject']);
},
};
......@@ -86,7 +86,7 @@ export default {
checkPwdForm() {
this.$refs.pwdForm.validate(valid => {
if (valid) {
this.updatePassword({ ...this.pwd, type: 3 })
this.updatePassword(this.pwd)
.then(() => {
this.$message.success('修改密码成功!');
......
......@@ -65,14 +65,14 @@
<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-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-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 v-model.trim="selected.cellphone" placeholder="请输入姓名" :maxlength="11" clearable></el-input>
<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-model="selected.sex" :label="1"></el-radio>
......@@ -84,6 +84,20 @@
<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>
......@@ -97,6 +111,9 @@ import {
toggleUserFreezeState,
addAccount,
updateAccount,
fetchMenuList,
fetchUserMenuList,
updateUserAuthMenu,
} from '@/api/system/account';
export default {
......@@ -113,6 +130,8 @@ export default {
isFrozen: '',
},
accountStatusOptions: accountStatusOptions,
dialogAuthVisible: false,
menuList: [],
};
},
computed: {
......@@ -125,11 +144,13 @@ export default {
...mapActions('system/account', { fetchList: 'fetchList' }),
initSelected() {
this.selected = {
id: '',
name: '',
account: '',
department: '',
cellphone: '',
sex: '',
menuList: [],
};
},
getSexValue(c, r, val) {
......@@ -211,27 +232,123 @@ export default {
this.$message.error('请输入姓名!');
return;
}
if (!this.selected.baseUseType) {
this.$message.error('请选择初始使用方法!');
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 = {};
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) {
addAccount(entity)
.then(() => {})
.catch(err => {});
} else {
updateAccount(entity)
.then(() => {})
.catch(err => {});
.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 #000;
}
.menuName {
margin-bottom: 5px;
font-size: 18px;
}
.subMenuList {
height: 40px;
line-height: 40px;
}
}
</style>
......@@ -25,7 +25,7 @@ const actions = {
login(entity)
.then(response => {
const { admin, menu, token } = response.data;
console.log(admin, menu);
// console.log(admin, menu);
if (token) {
setToken(token);
commit(SET_TOKEN, token);
......@@ -59,10 +59,9 @@ const actions = {
},
// 修改密码
updatePassword({ state }, { type, oldPwd, newPwd }) {
updatePassword({ state }, { oldPwd, newPwd }) {
return changePwd({
id: state.id,
type,
oldPwd,
newPwd,
});
......
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