fix: 自服务软件安装模板做下过滤只展示internal为false的,内置的模板不展示,mq 增加管理员设置

catl
时启龙 2024-11-12 15:03:07 +08:00
parent 428cc5214f
commit f0366b0ec3
2 changed files with 36 additions and 17 deletions

View File

@ -76,6 +76,11 @@
<el-input v-model="item.vhost"></el-input>
</basic-form-item>
</el-col>
<el-col :span="12">
<basic-form-item label="是否为管理员:" prop="is_admin" label-width="120px">
<el-switch v-model="item.is_admin" @change="switchAdmin(index)"></el-switch>
</basic-form-item>
</el-col>
</el-row>
</div>
<el-row>
@ -166,7 +171,8 @@ export default {
configure_priv: '.*',
read_priv: '.*',
write_priv: '.*',
vhost: '/'
vhost: '/',
is_admin: false
}
]
}
@ -185,6 +191,17 @@ export default {
this.handleCrypto(this.itemData, decrypt)
},
methods: {
// 1
switchAdmin(index) {
const currentUser = this.itemData.rabbitmq_users[index]
if (currentUser.is_admin) {
this.itemData.rabbitmq_users.forEach((item, idx) => {
if (index !== idx) {
item.is_admin = false
}
})
}
},
//
handleCrypto(itemData, fun = encrypt) {
const { rabbitmq_users } = itemData
@ -218,7 +235,8 @@ export default {
configure_priv: '.*',
read_priv: '.*',
write_priv: '.*',
vhost: '/'
vhost: '/',
is_admin: false
})
},
getPostData() {

View File

@ -54,20 +54,21 @@ export default {
searchConfigs: [
{ label: '模板名称', value: 'name', type: 'Input' },
{ label: '创建', value: 'gmtCreate', type: 'DateRange' },
{ value: 'sceneId', type: 'Const', initValue: '' }
{ value: 'sceneId', type: 'Const', initValue: '' },
{ value: 'internal', type: 'Const', initValue: false }
],
columns: [
{ label: '模板名称', prop: 'name', scopedSlots: { customRender: 'name' } },
{ label: '模板状态', prop: 'status', scopedSlots: { customRender: 'status' } },
{ label: '作业场景', prop: 'sceneName', scopedSlots: { customRender: 'sceneName' } },
{ label: '作业数量', prop: 'taskCount' },
{
label: '内置模板',
prop: 'internal',
customRender(val) {
return val ? '是' : '否'
}
},
// {
// label: '',
// prop: 'internal',
// customRender(val) {
// return val ? '' : ''
// }
// },
{ label: '创建人', prop: 'creator' },
{ label: '最后修改人', prop: 'mender' },
{ label: '创建时间', prop: 'gmtCreate', minWidth: '110px' },
@ -92,7 +93,7 @@ export default {
confirmButtonClass: 'el-button--danger',
type: 'warning'
}).then(() => {
releaseTemplate(data.id).then((data) => {
releaseTemplate(data.id).then(data => {
if (data.success) {
this.$message({
message: data.message,
@ -109,7 +110,7 @@ export default {
confirmButtonClass: 'el-button--danger',
type: 'warning'
}).then(() => {
recallTemplate(data.id).then((data) => {
recallTemplate(data.id).then(data => {
if (data.success) {
this.$message({
message: data.message,
@ -123,7 +124,7 @@ export default {
getList() {
this.loading = true
getTemplate(this.params)
.then((data) => {
.then(data => {
if (data.success) {
this.list = data.data.rows
this.total = data.data.total
@ -156,7 +157,7 @@ export default {
this.$confirm('您确定要删除该编排模板吗?', '提示', {
type: 'warning'
}).then(() => {
removeTemplate(id).then((data) => {
removeTemplate(id).then(data => {
if (data.success) {
this.$message({
message: data.message,
@ -171,7 +172,7 @@ export default {
bindImport() {
const self = this
//
document.getElementById('btnTaskUpload').onchange = function (event) {
document.getElementById('btnTaskUpload').onchange = function(event) {
const data = event.target.files[0]
// $('#btnTaskUpload').html($('#btnTaskUpload').html())
document.getElementById('btnTaskUpload').innerHTML = document.getElementById('btnTaskUpload').innerHTML
@ -179,10 +180,10 @@ export default {
// text
const reader = new FileReader()
reader.readAsText(data)
reader.onload = function (f) {
reader.onload = function(f) {
try {
const data = JSON.parse(this.result)
createTemplate(data).then((data) => {
createTemplate(data).then(data => {
if (data.success) {
self.$message({
message: data.message,