diff --git a/src/views/tenant/index.vue b/src/views/tenant/index.vue index 5a894fa..b24a1f1 100644 --- a/src/views/tenant/index.vue +++ b/src/views/tenant/index.vue @@ -1,31 +1,31 @@ - + - + - + - + @@ -265,25 +265,25 @@ {{ option.label }} + v-for="option in tenantModeDict" + :key="option.value" + :label="option.value" + >{{ option.label }} @@ -291,7 +291,7 @@ @@ -491,20 +491,15 @@ import { updateDatasource, updateTenant, } from "@/api/tenant/tenant"; -import { getCurrentInstance, reactive, ref, toRefs } from "vue"; -import { ElMessage, ElMessageBox } from "element-plus"; -import { - database_type_dict, - initStatusDict, - tenantModeDict, - tenantStatusDict, -} from "@/constant/dict"; +import {getCurrentInstance, reactive, ref, toRefs} from "vue"; +import {ElMessage, ElMessageBox} from "element-plus"; +import {database_type_dict, initStatusDict, tenantModeDict, tenantStatusDict,} from "@/constant/dict"; import DictTag from "@/components/DictTag/index.vue"; -import { cloneDeep } from "lodash-es"; -import { ArrowRight } from "@element-plus/icons-vue"; -import { useRouter } from "vue-router"; +import {cloneDeep} from "lodash-es"; +import {ArrowRight} from "@element-plus/icons-vue"; +import {useRouter} from "vue-router"; -const { proxy } = getCurrentInstance(); +const {proxy} = getCurrentInstance(); const router = useRouter(); const tenantList = ref([]); @@ -543,7 +538,7 @@ const data = reactive({ }, rules: { companyName: [ - { required: true, message: "公司名称不能为空", trigger: "blur" }, + {required: true, message: "公司名称不能为空", trigger: "blur"}, ], }, tenantSettingForm: {}, @@ -615,6 +610,13 @@ const { } = toRefs(data); const datasource = ref([]); +const isInit = (tenantId) => { + console.log(tenantId) + console.log((tenantList.value.find(el => el.tenantId === tenantId)?.initialized === '1')) + return (tenantList.value.find(el => el.tenantId === tenantId)?.initialized === '1') +} + + /** 查询租户列表 */ function getList() { loading.value = true; @@ -710,12 +712,12 @@ const handleAddDataSource = () => { */ const handleDeleteDataSource = (row) => { ElMessageBox.confirm(`确认删除此数据源: ${row.ip}`, "删除数据源", {}).then( - async () => { - await deleteDatasource(row.datasourceId); - ElMessage.success("已删除数据源"); - const resp = await datasourceList(tempTenantId.value); - datasource.value = resp.data; - } + async () => { + await deleteDatasource(row.datasourceId); + ElMessage.success("已删除数据源"); + const resp = await datasourceList(tempTenantId.value); + datasource.value = resp.data; + } ); }; @@ -826,7 +828,7 @@ const submitTenantSetting = async () => { const ori = tenantSettingForm.value.oriMode; const cur = tenantSettingForm.value.mode; const warningText = () => ( - + 切换到其他模式会清除已有的数据源配置, 是否继续? ); @@ -846,25 +848,26 @@ const submitTenantSetting = async () => { function handleDelete(row) { const _tenantIds = row.tenantId || ids.value; proxy.$modal - .confirm('是否确认删除租户编号为"' + _tenantIds + '"的数据项?') - .then(function () { - return delTenant(_tenantIds); - }) - .then(() => { - getList(); - proxy.$modal.msgSuccess("删除成功"); - }) - .catch(() => {}); + .confirm('是否确认删除租户编号为"' + _tenantIds + '"的数据项?') + .then(function () { + return delTenant(_tenantIds); + }) + .then(() => { + getList(); + proxy.$modal.msgSuccess("删除成功"); + }) + .catch(() => { + }); } /** 导出按钮操作 */ function handleExport() { proxy.download( - "tenant/tenant/export", - { - ...queryParams.value, - }, - `tenant_${new Date().getTime()}.xlsx` + "tenant/tenant/export", + { + ...queryParams.value, + }, + `tenant_${new Date().getTime()}.xlsx` ); }