代码优化

This commit is contained in:
shiziyuan9527 2020-04-28 11:38:30 +08:00
parent e5ead937d7
commit 56d8182e01
6 changed files with 18 additions and 30 deletions

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading"> <div v-loading="result.loading">
<el-card> <el-card>
<template v-slot:header> <template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create" <ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="btnTips" :title="$t('commons.member')"/> :create-tip="btnTips" :title="$t('commons.member')"/>
</template> </template>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
@ -162,9 +162,6 @@
buildPagePath(path) { buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },
search() {
this.initTableData();
},
closeFunc() { closeFunc() {
this.form = {}; this.form = {};
this.initTableData(); this.initTableData();

View File

@ -2,7 +2,7 @@
<div> <div>
<el-card v-loading="result.loading"> <el-card v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create" <ms-table-header :condition.sync="condition" @search="list" @create="create"
:create-tip="btnTips" :title="$t('commons.workspace')"/> :create-tip="btnTips" :title="$t('commons.workspace')"/>
</template> </template>
<el-table :data="items" style="width: 100%"> <el-table :data="items" style="width: 100%">
@ -202,16 +202,13 @@
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$get('/workspace/delete/' + row.id, () => { this.$get('/workspace/delete/' + row.id, () => {
Message.success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
this.list(); this.list();
}); });
}).catch(() => { }).catch(() => {
}); });
}, },
search() {
this.list();
},
list() { list() {
let url = '/workspace/list/' + this.currentPage + '/' + this.pageSize; let url = '/workspace/list/' + this.currentPage + '/' + this.pageSize;
let lastOrganizationId = this.currentUser.lastOrganizationId; let lastOrganizationId = this.currentUser.lastOrganizationId;

View File

@ -220,7 +220,7 @@
rule: { rule: {
name: [ name: [
{required: true, message: this.$t('organization.input_name'), trigger: 'blur'}, {required: true, message: this.$t('organization.input_name'), trigger: 'blur'},
{min: 2, max: 10, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}, {min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'},
{ {
required: true, required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/, pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
@ -322,7 +322,7 @@
}).then(() => { }).then(() => {
this.result = this.$get(this.deletePath + row.id, () => { this.result = this.$get(this.deletePath + row.id, () => {
this.$success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
this.initTableData() this.initTableData();
}); });
}).catch(() => { }).catch(() => {
this.$info(this.$t('commons.delete_cancel')); this.$info(this.$t('commons.delete_cancel'));
@ -343,8 +343,8 @@
}); });
}, },
createOrganization(createOrganizationForm) { createOrganization(createOrganizationForm) {
this.$refs[createOrganizationForm].validate(valide => { this.$refs[createOrganizationForm].validate(valid => {
if (valide) { if (valid) {
this.result = this.$post(this.createPath, this.form, () => { this.result = this.$post(this.createPath, this.form, () => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.initTableData(); this.initTableData();
@ -355,11 +355,11 @@
} }
}) })
}, },
updateOrganization(udpateOrganizationForm) { updateOrganization(updateOrganizationForm) {
this.$refs[udpateOrganizationForm].validate(valide => { this.$refs[updateOrganizationForm].validate(valid => {
if (valide) { if (valid) {
this.result = this.$post(this.updatePath, this.form, () => { this.result = this.$post(this.updatePath, this.form, () => {
this.$success(this.$t('commons.modify_success')) this.$success(this.$t('commons.modify_success'));
this.dialogOrgUpdateVisible = false; this.dialogOrgUpdateVisible = false;
this.initTableData(); this.initTableData();
}); });
@ -423,7 +423,7 @@
organizationId: this.currentRow.id organizationId: this.currentRow.id
} }
this.result = this.$post("/organization/member/update", param, () => { this.result = this.$post("/organization/member/update", param, () => {
this.$success(this.$t('commons.modify_success')) this.$success(this.$t('commons.modify_success'));
this.dialogOrgMemberUpdateVisible = false; this.dialogOrgMemberUpdateVisible = false;
this.cellClick(this.currentRow); this.cellClick(this.currentRow);
}); });

View File

@ -2,7 +2,7 @@
<div> <div>
<el-card v-loading="result.loading"> <el-card v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create" <ms-table-header :condition.sync="condition" @search="list" @create="create"
:create-tip="btnTips" :title="$t('commons.workspace')"/> :create-tip="btnTips" :title="$t('commons.workspace')"/>
</template> </template>
<!-- workspace table --> <!-- workspace table -->
@ -324,9 +324,6 @@
this.memberLineData = []; this.memberLineData = [];
this.list(); this.list();
}, },
search() {
this.list();
},
list() { list() {
let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize; let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize;
this.result = this.$post(url, this.condition, response => { this.result = this.$post(url, this.condition, response => {

View File

@ -178,8 +178,8 @@
}); });
}, },
createUser(createUserForm) { createUser(createUserForm) {
this.$refs[createUserForm].validate(valide => { this.$refs[createUserForm].validate(valid => {
if (valide) { if (valid) {
this.result = this.$post(this.createPath, this.form, () => { this.result = this.$post(this.createPath, this.form, () => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
this.search(); this.search();
@ -191,8 +191,8 @@
}) })
}, },
updateUser(updateUserForm) { updateUser(updateUserForm) {
this.$refs[updateUserForm].validate(valide => { this.$refs[updateUserForm].validate(valid => {
if (valide) { if (valid) {
this.result = this.$post(this.updatePath, this.form, () => { this.result = this.$post(this.updatePath, this.form, () => {
this.$success(this.$t('commons.modify_success')); this.$success(this.$t('commons.modify_success'));
this.updateVisible = false; this.updateVisible = false;

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading"> <div v-loading="result.loading">
<el-card> <el-card>
<template v-slot:header> <template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create" <ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
:create-tip="btnTips" :title="$t('commons.member')"/> :create-tip="btnTips" :title="$t('commons.member')"/>
</template> </template>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
@ -167,9 +167,6 @@
buildPagePath(path) { buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },
search() {
this.initTableData();
},
closeFunc() { closeFunc() {
this.form = {}; this.form = {};
this.initTableData(); this.initTableData();