refactor: 优化项目创建相关代码
This commit is contained in:
parent
089db4d33d
commit
69b66bdacc
|
@ -23,7 +23,9 @@
|
||||||
<div>
|
<div>
|
||||||
<ms-table-operator :edit-permission="['ORGANIZATION_WORKSPACE:READ+EDIT']"
|
<ms-table-operator :edit-permission="['ORGANIZATION_WORKSPACE:READ+EDIT']"
|
||||||
:delete-permission="['ORGANIZATION_WORKSPACE:READ+DELETE']"
|
:delete-permission="['ORGANIZATION_WORKSPACE:READ+DELETE']"
|
||||||
@editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
|
:show-delete="workspaceId !== scope.row.id"
|
||||||
|
@editClick="edit(scope.row)"
|
||||||
|
@deleteClick="handleDelete(scope.row)"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -224,6 +226,9 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
currentUser: () => {
|
currentUser: () => {
|
||||||
return getCurrentUser();
|
return getCurrentUser();
|
||||||
|
},
|
||||||
|
workspaceId() {
|
||||||
|
return getCurrentWorkspaceId();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
<el-card class="table-card">
|
<el-card class="table-card">
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<ms-table-header :create-permission="['SYSTEM_ORGANIZATION:READ+CREATE']" :condition.sync="condition" @search="initTableData" @create="create"
|
<ms-table-header :create-permission="['SYSTEM_ORGANIZATION:READ+CREATE']" :condition.sync="condition"
|
||||||
|
@search="initTableData" @create="create"
|
||||||
:create-tip="$t('organization.create')" :title="$t('commons.organization')"/>
|
:create-tip="$t('organization.create')" :title="$t('commons.organization')"/>
|
||||||
</template>
|
</template>
|
||||||
<!-- system menu organization table-->
|
<!-- system menu organization table-->
|
||||||
|
@ -24,7 +25,9 @@
|
||||||
<div>
|
<div>
|
||||||
<ms-table-operator :edit-permission="['SYSTEM_ORGANIZATION:READ+EDIT']"
|
<ms-table-operator :edit-permission="['SYSTEM_ORGANIZATION:READ+EDIT']"
|
||||||
:delete-permission="['SYSTEM_ORGANIZATION:READ+DELETE']"
|
:delete-permission="['SYSTEM_ORGANIZATION:READ+DELETE']"
|
||||||
@editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
|
:show-delete="organizationId !== scope.row.id"
|
||||||
|
@editClick="edit(scope.row)"
|
||||||
|
@deleteClick="handleDelete(scope.row)"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -34,7 +37,8 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- dialog of organization member -->
|
<!-- dialog of organization member -->
|
||||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true" @close="closeFunc"
|
<el-dialog :close-on-click-modal="false" :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true"
|
||||||
|
@close="closeFunc"
|
||||||
class="dialog-css">
|
class="dialog-css">
|
||||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
||||||
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
||||||
|
@ -64,7 +68,8 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- add organization form -->
|
<!-- add organization form -->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('organization.create')" :visible.sync="dialogOrgAddVisible" width="30%" @closed="closeFunc"
|
<el-dialog :close-on-click-modal="false" :title="$t('organization.create')" :visible.sync="dialogOrgAddVisible"
|
||||||
|
width="30%" @closed="closeFunc"
|
||||||
:destroy-on-close="true">
|
:destroy-on-close="true">
|
||||||
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
||||||
ref="createOrganization">
|
ref="createOrganization">
|
||||||
|
@ -85,7 +90,8 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- update organization form -->
|
<!-- update organization form -->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('organization.modify')" :visible.sync="dialogOrgUpdateVisible" width="30%"
|
<el-dialog :close-on-click-modal="false" :title="$t('organization.modify')" :visible.sync="dialogOrgUpdateVisible"
|
||||||
|
width="30%"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@close="closeFunc">
|
@close="closeFunc">
|
||||||
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
||||||
|
@ -105,7 +111,8 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- add organization member form -->
|
<!-- add organization member form -->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogOrgMemberAddVisible" width="30%"
|
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogOrgMemberAddVisible"
|
||||||
|
width="30%"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@close="closeFunc">
|
@close="closeFunc">
|
||||||
<el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="right" label-width="100px"
|
<el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="right" label-width="100px"
|
||||||
|
@ -143,7 +150,8 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- update organization member form -->
|
<!-- update organization member form -->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogOrgMemberUpdateVisible" width="30%"
|
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogOrgMemberUpdateVisible"
|
||||||
|
width="30%"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@close="closeFunc">
|
@close="closeFunc">
|
||||||
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
|
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
|
||||||
|
@ -214,6 +222,11 @@ export default {
|
||||||
MsDialogFooter,
|
MsDialogFooter,
|
||||||
MsTableOperatorButton
|
MsTableOperatorButton
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
organizationId() {
|
||||||
|
return getCurrentOrganizationId();
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryPath: '/organization/list',
|
queryPath: '/organization/list',
|
||||||
|
@ -259,7 +272,7 @@ export default {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
orgId: ""
|
orgId: ""
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
|
@ -278,15 +291,15 @@ export default {
|
||||||
});
|
});
|
||||||
this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.orgId}, response => {
|
this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.orgId}, response => {
|
||||||
this.$set(this.memberForm, "groups", response.data);
|
this.$set(this.memberForm, "groups", response.data);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
dataFilter(val) {
|
dataFilter(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.memberForm.userList = this.memberForm.copyUserList.filter((item) => {
|
this.memberForm.userList = this.memberForm.copyUserList.filter((item) => {
|
||||||
if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) {
|
if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) {
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.memberForm.userList = this.memberForm.copyUserList;
|
this.memberForm.userList = this.memberForm.copyUserList;
|
||||||
}
|
}
|
||||||
|
@ -305,7 +318,7 @@ export default {
|
||||||
// })
|
// })
|
||||||
this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.orgId}, response => {
|
this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.orgId}, response => {
|
||||||
this.$set(this.memberForm, "allgroups", response.data);
|
this.$set(this.memberForm, "allgroups", response.data);
|
||||||
})
|
});
|
||||||
// 编辑时填充角色信息
|
// 编辑时填充角色信息
|
||||||
this.$set(this.memberForm, 'groupIds', groupIds);
|
this.$set(this.memberForm, 'groupIds', groupIds);
|
||||||
listenGoBack(this.closeFunc);
|
listenGoBack(this.closeFunc);
|
||||||
|
@ -328,7 +341,7 @@ export default {
|
||||||
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
||||||
let groups = response.data;
|
let groups = response.data;
|
||||||
this.$set(this.memberLineData[i], "groups", groups);
|
this.$set(this.memberLineData[i], "groups", groups);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.dialogTotal = data.itemCount;
|
this.dialogTotal = data.itemCount;
|
||||||
});
|
});
|
||||||
|
@ -345,9 +358,12 @@ export default {
|
||||||
this.memberLineData = data.listObject;
|
this.memberLineData = data.listObject;
|
||||||
let url = "/userrole/list/org/" + row.id;
|
let url = "/userrole/list/org/" + row.id;
|
||||||
for (let i = 0; i < this.memberLineData.length; i++) {
|
for (let i = 0; i < this.memberLineData.length; i++) {
|
||||||
this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.memberLineData[i].id }, response => {
|
this.result = this.$post('/user/group/list', {
|
||||||
|
type: GROUP_ORGANIZATION,
|
||||||
|
resourceId: this.memberLineData[i].id
|
||||||
|
}, response => {
|
||||||
this.$set(this.memberLineData[i], "groups", response.data);
|
this.$set(this.memberLineData[i], "groups", response.data);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.dialogTotal = data.itemCount;
|
this.dialogTotal = data.itemCount;
|
||||||
});
|
});
|
||||||
|
@ -390,7 +406,7 @@ export default {
|
||||||
if (currentUser.id === userId) {
|
if (currentUser.id === userId) {
|
||||||
refreshSessionAndCookies(ORGANIZATION, sourceId);
|
refreshSessionAndCookies(ORGANIZATION, sourceId);
|
||||||
}
|
}
|
||||||
this.$success(this.$t('commons.remove_success'))
|
this.$success(this.$t('commons.remove_success'));
|
||||||
this.cellClick(this.currentRow);
|
this.cellClick(this.currentRow);
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -408,7 +424,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
updateOrganization(updateOrganizationForm) {
|
updateOrganization(updateOrganizationForm) {
|
||||||
this.$refs[updateOrganizationForm].validate(valid => {
|
this.$refs[updateOrganizationForm].validate(valid => {
|
||||||
|
@ -421,7 +437,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
initTableData() {
|
initTableData() {
|
||||||
this.result = this.$post(this.queryPath + "/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
this.result = this.$post(this.queryPath + "/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||||
|
@ -431,15 +447,15 @@ export default {
|
||||||
let param = {
|
let param = {
|
||||||
name: '',
|
name: '',
|
||||||
organizationId: this.tableData[i].id
|
organizationId: this.tableData[i].id
|
||||||
}
|
};
|
||||||
let path = "user/special/org/member/list/all";
|
let path = "user/special/org/member/list/all";
|
||||||
this.$post(path, param, res => {
|
this.$post(path, param, res => {
|
||||||
let member = res.data;
|
let member = res.data;
|
||||||
this.$set(this.tableData[i], "memberSize", member.length);
|
this.$set(this.tableData[i], "memberSize", member.length);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
closeFunc() {
|
closeFunc() {
|
||||||
this.memberLineData = [];
|
this.memberLineData = [];
|
||||||
|
@ -469,7 +485,7 @@ export default {
|
||||||
refreshSessionAndCookies(sign, sourceId);
|
refreshSessionAndCookies(sign, sourceId);
|
||||||
this.cellClick(this.currentRow);
|
this.cellClick(this.currentRow);
|
||||||
this.dialogOrgMemberAddVisible = false;
|
this.dialogOrgMemberAddVisible = false;
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -483,7 +499,7 @@ export default {
|
||||||
phone: this.memberForm.phone,
|
phone: this.memberForm.phone,
|
||||||
groupIds: this.memberForm.groupIds,
|
groupIds: this.memberForm.groupIds,
|
||||||
organizationId: this.currentRow.id
|
organizationId: this.currentRow.id
|
||||||
}
|
};
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.result = this.$post("/organization/member/update", param, () => {
|
this.result = this.$post("/organization/member/update", param, () => {
|
||||||
|
@ -496,7 +512,7 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Reference in New Issue