Commit 0b5f668e authored by rockyl's avatar rockyl

过滤创建者

parent 5200368d
<template> <template>
<div class="project-auth-manager"> <div class="project-auth-manager">
<p><b>{{$t('Creator')}}</b>:{{project.creator}}</p> <p><b>{{$t('Creator')}}</b>:{{project.creator}}</p>
<el-select style="width: 100%;" size="mini" v-model="operators" filterable multiple :disabled="!editable"> <el-select style="width: 100%;" size="mini" v-model="operatorsExcludeCreator" filterable multiple :disabled="!editable">
<el-option v-for="(item, index) in devPersons" <el-option v-for="(item, index) in devPersons"
:key="index" :key="index"
:disabled="item.name === project.creator || item.name === currentOperator" v-if="item.name !== project.creator"
:disabled="item.name === currentOperator"
:label="item.name" :label="item.name"
:value="item.name"> :value="item.name">
</el-option> </el-option>
...@@ -23,6 +24,7 @@ ...@@ -23,6 +24,7 @@
return { return {
devPersons: [], devPersons: [],
operators: [], operators: [],
operatorsExcludeCreator: [],
}; };
}, },
computed: { computed: {
...@@ -40,22 +42,24 @@ ...@@ -40,22 +42,24 @@
async edit() { async edit() {
this.devPersons = await getDevPersons(); this.devPersons = await getDevPersons();
this.operators = this.project.operators.split(','); this.operators = this.project.operators.split(',');
this.operatorsExcludeCreator = this.operators.concat().filter(item=>item !== this.project.creator);
this.operatorsOrigin = this.operators.concat().sort().join(','); this.operatorsOrigin = this.operators.concat().sort().join(',');
}, },
async save() { async save() {
let operatorsNew = this.operators.concat().sort().join(','); let operators = this.operatorsExcludeCreator.concat();
operators.unshift(this.project.creator);
let operatorsNew = operators.sort().join(',');
if (operatorsNew === this.operatorsOrigin) { if (operatorsNew === this.operatorsOrigin) {
return; return;
} }
let operatorsStr = this.operators.join(','); updateOperators(this.projectId, operatorsNew)
updateOperators(this.projectId, operatorsStr)
.then(() => { .then(() => {
this.$message({ this.$message({
message: this.$t("Operate success"), message: this.$t("Operate success"),
type: "success", type: "success",
}); });
this.modifyOperators(operatorsStr); this.modifyOperators(operatorsNew);
}) })
.catch((e) => { .catch((e) => {
this.$message({message: e.message, type: "error"}); this.$message({message: e.message, type: "error"});
......
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