代码优化

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">
<el-card>
<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')"/>
</template>
<el-table :data="tableData" style="width: 100%">
@ -162,9 +162,6 @@
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
search() {
this.initTableData();
},
closeFunc() {
this.form = {};
this.initTableData();

View File

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

View File

@ -220,7 +220,7 @@
rule: {
name: [
{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,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
@ -322,7 +322,7 @@
}).then(() => {
this.result = this.$get(this.deletePath + row.id, () => {
this.$success(this.$t('commons.delete_success'));
this.initTableData()
this.initTableData();
});
}).catch(() => {
this.$info(this.$t('commons.delete_cancel'));
@ -343,8 +343,8 @@
});
},
createOrganization(createOrganizationForm) {
this.$refs[createOrganizationForm].validate(valide => {
if (valide) {
this.$refs[createOrganizationForm].validate(valid => {
if (valid) {
this.result = this.$post(this.createPath, this.form, () => {
this.$success(this.$t('commons.save_success'));
this.initTableData();
@ -355,11 +355,11 @@
}
})
},
updateOrganization(udpateOrganizationForm) {
this.$refs[udpateOrganizationForm].validate(valide => {
if (valide) {
updateOrganization(updateOrganizationForm) {
this.$refs[updateOrganizationForm].validate(valid => {
if (valid) {
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.initTableData();
});
@ -423,7 +423,7 @@
organizationId: this.currentRow.id
}
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.cellClick(this.currentRow);
});

View File

@ -2,7 +2,7 @@
<div>
<el-card v-loading="result.loading">
<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')"/>
</template>
<!-- workspace table -->
@ -324,9 +324,6 @@
this.memberLineData = [];
this.list();
},
search() {
this.list();
},
list() {
let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize;
this.result = this.$post(url, this.condition, response => {

View File

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

View File

@ -2,7 +2,7 @@
<div v-loading="result.loading">
<el-card>
<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')"/>
</template>
<el-table :data="tableData" style="width: 100%">
@ -167,9 +167,6 @@
buildPagePath(path) {
return path + "/" + this.currentPage + "/" + this.pageSize;
},
search() {
this.initTableData();
},
closeFunc() {
this.form = {};
this.initTableData();