|
|
|
|
@ -32,14 +32,20 @@ |
|
|
|
|
icon="el-icon-setting" |
|
|
|
|
@click="handleSetting">授权配置 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button size="small" |
|
|
|
|
plain |
|
|
|
|
v-if="userInfo.role_name.includes('administrator')" |
|
|
|
|
icon="el-icon-coin" |
|
|
|
|
@click="handleDatasource">数据源配置 |
|
|
|
|
</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template slot-scope="{row}" |
|
|
|
|
slot="accountNumber"> |
|
|
|
|
<el-tag>{{row.accountNumber>0?row.accountNumber:'不限制'}}</el-tag> |
|
|
|
|
<el-tag>{{ row.accountNumber > 0 ? row.accountNumber : '不限制' }}</el-tag> |
|
|
|
|
</template> |
|
|
|
|
<template slot-scope="{row}" |
|
|
|
|
slot="expireTime"> |
|
|
|
|
<el-tag>{{row.expireTime?row.expireTime:'不限制'}}</el-tag> |
|
|
|
|
<el-tag>{{ row.expireTime ? row.expireTime : '不限制' }}</el-tag> |
|
|
|
|
</template> |
|
|
|
|
</avue-crud> |
|
|
|
|
<el-dialog title="租户授权配置" |
|
|
|
|
@ -48,14 +54,20 @@ |
|
|
|
|
width="450px"> |
|
|
|
|
<avue-form :option="settingOption" v-model="settingForm" @submit="handleSubmit"/> |
|
|
|
|
</el-dialog> |
|
|
|
|
<el-dialog title="租户数据源配置" |
|
|
|
|
append-to-body |
|
|
|
|
:visible.sync="datasourceBox" |
|
|
|
|
width="450px"> |
|
|
|
|
<avue-form :option="datasourceOption" v-model="datasourceForm" @submit="handleDatasourceSubmit"/> |
|
|
|
|
</el-dialog> |
|
|
|
|
</basic-container> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {getList, getDetail, remove, update, add, setting} from "@/api/system/tenant"; |
|
|
|
|
import {mapGetters} from "vuex"; |
|
|
|
|
import {getList, getDetail, remove, update, add, setting, datasource} from "@/api/system/tenant"; |
|
|
|
|
import {mapGetters} from "vuex"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
form: {}, |
|
|
|
|
@ -63,6 +75,7 @@ |
|
|
|
|
query: {}, |
|
|
|
|
loading: true, |
|
|
|
|
box: false, |
|
|
|
|
datasourceBox: false, |
|
|
|
|
page: { |
|
|
|
|
pageSize: 10, |
|
|
|
|
currentPage: 1, |
|
|
|
|
@ -186,6 +199,28 @@ |
|
|
|
|
span: 24, |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
datasourceForm: {}, |
|
|
|
|
datasourceOption: { |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "数据源", |
|
|
|
|
prop: "datasourceId", |
|
|
|
|
search: true, |
|
|
|
|
span: 24, |
|
|
|
|
type: "select", |
|
|
|
|
dicUrl: "/api/blade-develop/datasource/select", |
|
|
|
|
props: { |
|
|
|
|
label: "name", |
|
|
|
|
value: "id" |
|
|
|
|
}, |
|
|
|
|
rules: [{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请选择数据源", |
|
|
|
|
trigger: "blur" |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
@ -205,6 +240,9 @@ |
|
|
|
|
ids.push(ele.id); |
|
|
|
|
}); |
|
|
|
|
return ids.join(","); |
|
|
|
|
}, |
|
|
|
|
tenantId() { |
|
|
|
|
return this.selectionList[0].tenantId; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
@ -322,6 +360,21 @@ |
|
|
|
|
} |
|
|
|
|
this.box = true; |
|
|
|
|
}, |
|
|
|
|
handleDatasource() { |
|
|
|
|
if (this.selectionList.length === 0) { |
|
|
|
|
this.$message.warning("请选择至少一条数据"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.selectionList.length !== 1) { |
|
|
|
|
this.$message.warning("只能选择一条数据"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
getDetail(this.selectionList[0].id).then(res => { |
|
|
|
|
const data = res.data.data; |
|
|
|
|
this.datasourceForm.datasourceId = data.datasourceId; |
|
|
|
|
}); |
|
|
|
|
this.datasourceBox = true; |
|
|
|
|
}, |
|
|
|
|
handleSubmit(form, done, loading) { |
|
|
|
|
setting(this.ids, form).then(() => { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
@ -336,6 +389,19 @@ |
|
|
|
|
loading(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleDatasourceSubmit(form, done, loading) { |
|
|
|
|
datasource(this.tenantId, form.datasourceId).then(() => { |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "配置成功!" |
|
|
|
|
}); |
|
|
|
|
done(); |
|
|
|
|
this.datasourceBox = false; |
|
|
|
|
}, error => { |
|
|
|
|
window.console.log(error); |
|
|
|
|
loading(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
currentChange(currentPage) { |
|
|
|
|
this.page.currentPage = currentPage; |
|
|
|
|
}, |
|
|
|
|
@ -356,7 +422,7 @@ |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style> |
|
|
|
|
|