|
|
|
@ -217,20 +217,23 @@
|
|
|
|
|
<el-button style="margin-left: 10px" @click="addAllowUser">添加用户</el-button> |
|
|
|
|
</div> |
|
|
|
|
<div style="margin: 10px 0"> |
|
|
|
|
<el-tag |
|
|
|
|
v-for="(tag, index) in allowUserData" |
|
|
|
|
:key="tag" |
|
|
|
|
class="mx-1" |
|
|
|
|
closable |
|
|
|
|
@close="delAllowUser(index)" |
|
|
|
|
style="margin:3px 5px" |
|
|
|
|
> |
|
|
|
|
<template v-for="items in adminData"> |
|
|
|
|
<span v-if="items.value == tag"> |
|
|
|
|
@{{ items.label }} |
|
|
|
|
</span> |
|
|
|
|
</template> |
|
|
|
|
</el-tag> |
|
|
|
|
<el-table :data="updateNotebook.user" style="width: 100%"> |
|
|
|
|
<el-table-column prop="user" label="用户" width="180" > |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<span v-if="scope.row.user">@{{ scope.row.user }}</span> |
|
|
|
|
<span v-else>用户名</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="mode" label="权限"> |
|
|
|
|
<template #default="scope"> |
|
|
|
|
<el-radio-group v-model="scope.row.mode" class="ml-4"> |
|
|
|
|
@foreach(\Plugins\Notebook\Enums\NotebookUserEnumMode::mapping() as $mode) |
|
|
|
|
<el-radio :label="{{ $mode['value'] }}" size="large">{{ $mode['label'] }}</el-radio> |
|
|
|
|
@endforeach |
|
|
|
|
</el-radio-group> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
@endsection |
|
|
|
@ -277,34 +280,39 @@
|
|
|
|
|
VueInit.methods.allowUser = function (item, index) { |
|
|
|
|
this.allowVisible = true; |
|
|
|
|
this.updateNotebook = item; |
|
|
|
|
if (item.allow_see) { |
|
|
|
|
this.allowUserData = item.allow_see.split(','); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
VueInit.methods.addAllowUser = function () { |
|
|
|
|
if (this.waitAddAllowUser.length > 0) { |
|
|
|
|
let isPure = true; |
|
|
|
|
let waitAddAllowUser = []; |
|
|
|
|
|
|
|
|
|
this.waitAddAllowUser.map(v =>{ |
|
|
|
|
if (!this.allowUserData.includes(v)) { |
|
|
|
|
this.allowUserData.push(v); |
|
|
|
|
isPure = false; |
|
|
|
|
if (!this.updateNotebook.map(v1 => v1.administrators_id).includes(v)) { |
|
|
|
|
waitAddAllowUser.push(v); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.waitAddAllowUser = []; |
|
|
|
|
if (!isPure) { |
|
|
|
|
this.updateNotebook.allow_see = this.allowUserData.join(','); |
|
|
|
|
this.update(this.updateNotebook); |
|
|
|
|
if (waitAddAllowUser) { |
|
|
|
|
this.addAllowUserRequest(waitAddAllowUser); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
VueInit.methods.addAllowUserRequest = function (waitAddAllowUser){ |
|
|
|
|
axios({ |
|
|
|
|
url:'', |
|
|
|
|
method:'post', |
|
|
|
|
data:waitAddAllowUser |
|
|
|
|
url: 'add-user', |
|
|
|
|
method: 'post', |
|
|
|
|
data: { |
|
|
|
|
notebook_id: this.updateNotebook.id, |
|
|
|
|
user_ids: waitAddAllowUser |
|
|
|
|
} |
|
|
|
|
}).then(({data}) =>{ |
|
|
|
|
if (data.code === 200) { |
|
|
|
|
this.$message.success("设置成功"); |
|
|
|
|
// todo getNewData |
|
|
|
|
}else{ |
|
|
|
|
this.$message.error("设置失败"); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|