Commit 2bb1f0f5 by liimin

新增代码规范规则

1 parent addc33fb
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<el-table-column label="部门" prop="departName" width="200" align="center" ></el-table-column> <el-table-column label="部门" prop="departName" width="200" align="center" ></el-table-column>
<el-table-column label="职务" prop="postName" width="200" align="center" ></el-table-column> <el-table-column label="职务" prop="postName" width="200" align="center" ></el-table-column>
<el-table-column label="所属站点" prop="stationName" width="200" align="center" ></el-table-column> <el-table-column label="所属站点" prop="stationName" width="200" align="center" ></el-table-column>
<el-table-column align="center" fixed="right" width="200" label="操作"> <el-table-column align="center" fixed="right" width="220" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<auth-button :mapping="mapping" :data="scope.row"></auth-button> <auth-button :mapping="mapping" :data="scope.row"></auth-button>
</template> </template>
...@@ -111,16 +111,16 @@ import { ...@@ -111,16 +111,16 @@ import {
AccountValidate, AccountValidate,
AccountActived, AccountActived,
Reg Reg
} from '@/api/sys.account' } from '@/api/sys.account';
import notice from '@/common/notice' import notice from '@/common/notice';
import { mapActions } from 'vuex' import { mapActions } from 'vuex';
import util from '@/libs/util' import util from '@/libs/util';
export default { export default {
name: 'FimsUsers', name: 'FimsUsers',
components: { components: {
DialogReg: () => import('./dialogReg') DialogReg: () => import('./dialogReg')
}, },
data () { data() {
return { return {
tag: Object.freeze({ tag: Object.freeze({
effect: 'dark', effect: 'dark',
...@@ -170,128 +170,128 @@ export default { ...@@ -170,128 +170,128 @@ export default {
// 角色 // 角色
roles: [] roles: []
} }
} };
}, },
watch: { watch: {
'searchTimes' (value) { 'searchTimes'(value) {
!value && this.loadUserList() !value && this.loadUserList();
} }
}, },
mounted () { mounted() {
this.fetchData() this.fetchData();
this.$event.$on('e-reg-dialog-close', isReload => { this.$event.$on('e-reg-dialog-close', isReload => {
this.registerDialogVisible = false this.registerDialogVisible = false;
isReload && this.loadUserList() isReload && this.loadUserList();
}) });
}, },
methods: { methods: {
...mapActions('d2admin/base', ['load']), ...mapActions('d2admin/base', ['load']),
// 加载业务所需所有数据 // 加载业务所需所有数据
fetchData () { fetchData() {
this.loadBaseData() this.loadBaseData();
this.loadUserList() this.loadUserList();
}, },
async loadBaseData () { async loadBaseData() {
const { role, station, post } = await this.load() const { role, station, post } = await this.load();
this.baseData.posts = post this.baseData.posts = post;
this.baseData.stations = station this.baseData.stations = station;
this.baseData.roles = role this.baseData.roles = role;
Object.freeze(this.baseData) Object.freeze(this.baseData);
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams() {
let startTime = '' let startTime = '';
let endTime = '' let endTime = '';
if (this.searchTimes && this.searchTimes.length) { if (this.searchTimes && this.searchTimes.length) {
[startTime, endTime] = this.searchTimes [startTime, endTime] = this.searchTimes;
startTime = `${startTime} 00:00:00` startTime = `${startTime} 00:00:00`;
endTime = `${endTime} 23:59:59` endTime = `${endTime} 23:59:59`;
} }
return { return {
...this.page, ...this.page,
...this.searchForm, ...this.searchForm,
startTime, startTime,
endTime endTime
} };
}, },
loadUserList () { loadUserList() {
this.tableLoading = true this.tableLoading = true;
const params = this.getParams() const params = this.getParams();
UserList(params) UserList(params)
.then(res => { .then(res => {
const { pagination, userList } = res const { pagination, userList } = res;
this.tableData = userList this.tableData = userList;
this.page = pagination this.page = pagination;
this.tableLoading = false this.tableLoading = false;
}) })
.catch(() => { .catch(() => {
notice.errorTips() notice.errorTips();
this.tableLoading = false this.tableLoading = false;
}) });
}, },
filterTag (value, row) { filterTag(value, row) {
return row.status === value return row.status === value;
}, },
handleRegister () { handleRegister() {
const row = { const row = {
data: { data: {
title: '用户创建', title: '用户创建',
submit: Reg submit: Reg
} }
} };
this.openDialog(row) this.openDialog(row);
}, },
handleSearch () { handleSearch() {
this.loadUserList() this.loadUserList();
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.page.pageCount = value this.page.pageCount = value;
this.loadUserList() this.loadUserList();
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.page.pageSize = value this.page.pageSize = value;
this.loadUserList() this.loadUserList();
}, },
handleEdit (row) { handleEdit(row) {
row = util.deepClone(row) row = util.deepClone(row);
row.data = { row.data = {
title: '用户编辑', title: '用户编辑',
submit: AccountModify submit: AccountModify
} };
this.openDialog(row) this.openDialog(row);
}, },
openDialog (row) { openDialog(row) {
this.registerDialogVisible = true this.registerDialogVisible = true;
this.editData = row this.editData = row;
}, },
handleVerify (row) { handleVerify(row) {
row = util.deepClone(row) row = util.deepClone(row);
row.data = { row.data = {
title: '用户审核', title: '用户审核',
submit: AccountValidate submit: AccountValidate
} };
this.openDialog(row) this.openDialog(row);
}, },
// ------------ // ------------
// 列表各种操作 // 列表各种操作
async handleOperation (row, e) { async handleOperation(row, e) {
const _actionText = e.target.innerText const _actionText = e.target.innerText;
const res = await this.apiMapping[_actionText]({ userId: row.userId }) const res = await this.apiMapping[_actionText]({ userId: row.userId });
const { operateStatus } = res const { operateStatus } = res;
if (operateStatus) { if (operateStatus) {
notice.okTips(`${_actionText}成功!`) notice.okTips(`${_actionText}成功!`);
this.loadUserList() this.loadUserList();
} else { } else {
notice.errorTips(`${_actionText}失败!`) notice.errorTips(`${_actionText}失败!`);
} }
} }
} }
} };
</script> </script>
<style scoped> <style scoped>
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!