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> <el-input v-model="item.vhost"></el-input>
</basic-form-item> </basic-form-item>
</el-col> </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> </el-row>
</div> </div>
<el-row> <el-row>
@ -166,7 +171,8 @@ export default {
configure_priv: '.*', configure_priv: '.*',
read_priv: '.*', read_priv: '.*',
write_priv: '.*', write_priv: '.*',
vhost: '/' vhost: '/',
is_admin: false
} }
] ]
} }
@ -185,6 +191,17 @@ export default {
this.handleCrypto(this.itemData, decrypt) this.handleCrypto(this.itemData, decrypt)
}, },
methods: { 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) { handleCrypto(itemData, fun = encrypt) {
const { rabbitmq_users } = itemData const { rabbitmq_users } = itemData
@ -218,7 +235,8 @@ export default {
configure_priv: '.*', configure_priv: '.*',
read_priv: '.*', read_priv: '.*',
write_priv: '.*', write_priv: '.*',
vhost: '/' vhost: '/',
is_admin: false
}) })
}, },
getPostData() { getPostData() {

View File

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