fmt
This commit is contained in:
@ -1,5 +1,13 @@
|
||||
<script setup>
|
||||
import {nextTick, onMounted, onUnmounted, ref, toRefs, watch, watchEffect,} from "vue";
|
||||
import {
|
||||
nextTick,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref,
|
||||
toRefs,
|
||||
watch,
|
||||
watchEffect,
|
||||
} from "vue";
|
||||
import InfiniteLoading from "v3-infinite-loading";
|
||||
import "v3-infinite-loading/lib/style.css";
|
||||
import { debounce } from "lodash-es"; //required if you're not going to override default slots
|
||||
@ -42,7 +50,7 @@ const emit = defineEmits(["update:modelValue", "change", "confirm"]);
|
||||
const showPopOver = ref(false);
|
||||
|
||||
const inputRefWhenShowPop = ref();
|
||||
const inputRefWhenNotShowPop = ref()
|
||||
const inputRefWhenNotShowPop = ref();
|
||||
const placeholderWhenShowPop = ref("");
|
||||
const placeholderWhenNotShowPop = ref("");
|
||||
const optionLabelWhenShowPop = ref("");
|
||||
@ -86,7 +94,7 @@ const loadMore = async ($state) => {
|
||||
};
|
||||
|
||||
const handleInputClick = (event) => {
|
||||
event.stopPropagation()
|
||||
event.stopPropagation();
|
||||
showPopOver.value = true;
|
||||
placeholderWhenShowPop.value = optionLabelWhenNotShowPop.value;
|
||||
nextTick(() => {
|
||||
@ -152,7 +160,6 @@ watch(modelValue, (value) => {
|
||||
emit("change", value);
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 点击空白关闭弹出选项列表
|
||||
* @param event
|
||||
@ -173,17 +180,25 @@ onMounted(() => {
|
||||
page.value++;
|
||||
initOptions();
|
||||
document.body.addEventListener("click", handleBodyClick);
|
||||
watch(showPopOver, (show) => {
|
||||
watch(
|
||||
showPopOver,
|
||||
(show) => {
|
||||
if (show) {
|
||||
inputRefWhenNotShowPop.value?.input?.parentNode?.removeEventListener('click', handleInputClick)
|
||||
inputRefWhenNotShowPop.value?.input?.parentNode?.removeEventListener(
|
||||
"click",
|
||||
handleInputClick
|
||||
);
|
||||
} else {
|
||||
nextTick(() => {
|
||||
inputRefWhenNotShowPop.value?.input?.parentNode?.addEventListener('click', handleInputClick)
|
||||
})
|
||||
|
||||
inputRefWhenNotShowPop.value?.input?.parentNode?.addEventListener(
|
||||
"click",
|
||||
handleInputClick
|
||||
);
|
||||
});
|
||||
}
|
||||
}, {immediate: true})
|
||||
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
|
@ -1,36 +1,75 @@
|
||||
export const sys_normal_disable = [{
|
||||
label: "正常", value: "1", elTagType: "success",
|
||||
}, {
|
||||
label: "禁用", value: "0", elTagType: "danger",
|
||||
},];
|
||||
|
||||
export const sys_user_gender = [{
|
||||
label: "男", value: "0",
|
||||
}, {
|
||||
label: "女", value: "1",
|
||||
}, {
|
||||
label: "未知", value: "2",
|
||||
},];
|
||||
|
||||
export const menu_show_hide = [{
|
||||
label: "隐藏", value: "0", elTagType: "warning",
|
||||
}, {
|
||||
label: "显示", value: "1", elTagType: "success",
|
||||
},];
|
||||
|
||||
export const sys_yes_no = [{
|
||||
label: "否", value: "N",
|
||||
}, {
|
||||
label: "是", value: "Y", elTagType: "danger",
|
||||
},];
|
||||
|
||||
export const database_type_dict = [{
|
||||
label: "MySQL", value: "MySQL", elTagType: "",
|
||||
}, {
|
||||
label: "Oracle", value: "Oracle", elTagType: "",
|
||||
}, {
|
||||
label: "PostgreSQL", value: "PostgreSQL", elTagType: "",
|
||||
export const sys_normal_disable = [
|
||||
{
|
||||
label: "正常",
|
||||
value: "1",
|
||||
elTagType: "success",
|
||||
},
|
||||
{
|
||||
label: "Microsoft SQL Server", value: "Microsoft SQL Server", elTagType: "",
|
||||
}];
|
||||
label: "禁用",
|
||||
value: "0",
|
||||
elTagType: "danger",
|
||||
},
|
||||
];
|
||||
|
||||
export const sys_user_gender = [
|
||||
{
|
||||
label: "男",
|
||||
value: "0",
|
||||
},
|
||||
{
|
||||
label: "女",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
label: "未知",
|
||||
value: "2",
|
||||
},
|
||||
];
|
||||
|
||||
export const menu_show_hide = [
|
||||
{
|
||||
label: "隐藏",
|
||||
value: "0",
|
||||
elTagType: "warning",
|
||||
},
|
||||
{
|
||||
label: "显示",
|
||||
value: "1",
|
||||
elTagType: "success",
|
||||
},
|
||||
];
|
||||
|
||||
export const sys_yes_no = [
|
||||
{
|
||||
label: "否",
|
||||
value: "N",
|
||||
},
|
||||
{
|
||||
label: "是",
|
||||
value: "Y",
|
||||
elTagType: "danger",
|
||||
},
|
||||
];
|
||||
|
||||
export const database_type_dict = [
|
||||
{
|
||||
label: "MySQL",
|
||||
value: "MySQL",
|
||||
elTagType: "",
|
||||
},
|
||||
{
|
||||
label: "Oracle",
|
||||
value: "Oracle",
|
||||
elTagType: "",
|
||||
},
|
||||
{
|
||||
label: "PostgreSQL",
|
||||
value: "PostgreSQL",
|
||||
elTagType: "",
|
||||
},
|
||||
{
|
||||
label: "Microsoft SQL Server",
|
||||
value: "Microsoft SQL Server",
|
||||
elTagType: "",
|
||||
},
|
||||
];
|
||||
|
@ -78,6 +78,7 @@ const useUserStore = defineStore("user", {
|
||||
this.roles = [];
|
||||
this.permissions = [];
|
||||
this.userInfoRes = null;
|
||||
this.tenant = null;
|
||||
removeToken();
|
||||
resolve();
|
||||
})
|
||||
|
@ -1,5 +1,10 @@
|
||||
import axios from "axios";
|
||||
import {ElLoading, ElMessage, ElMessageBox, ElNotification,} from "element-plus";
|
||||
import {
|
||||
ElLoading,
|
||||
ElMessage,
|
||||
ElMessageBox,
|
||||
ElNotification,
|
||||
} from "element-plus";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import errorCode from "@/utils/errorCode";
|
||||
import { blobValidate, tansParams } from "@/utils/ruoyi";
|
||||
|
@ -231,12 +231,12 @@ const handleTenantConfirm = (option) => {
|
||||
};
|
||||
|
||||
watchEffect(() => {
|
||||
console.log(loginForm.value.tenant)
|
||||
console.log(loginForm.value.tenant);
|
||||
if (loginForm.value.tenant) {
|
||||
console.log('getcode')
|
||||
console.log("getcode");
|
||||
getCode();
|
||||
}
|
||||
})
|
||||
});
|
||||
getCookie();
|
||||
defaultTenantNamt.value = useUserStore().tempTenantName;
|
||||
</script>
|
||||
|
@ -13,19 +13,16 @@
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||
>搜索
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="onlineList"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table v-loading="loading" :data="onlineList" style="width: 100%">
|
||||
<el-table-column align="center" label="序号" type="index" width="100">
|
||||
<template #default="scope">
|
||||
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
|
||||
<span>{{
|
||||
(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -87,8 +84,7 @@
|
||||
type="primary"
|
||||
@click="handleForceLogout(scope.row)"
|
||||
>强退
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -153,8 +149,7 @@ function handleForceLogout(row) {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
getList();
|
||||
|
@ -26,8 +26,7 @@
|
||||
<el-form-item>
|
||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||
>搜索
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@ -41,8 +40,7 @@
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>新增
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -53,8 +51,7 @@
|
||||
type="success"
|
||||
@click="handleUpdate"
|
||||
>修改
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -65,8 +62,7 @@
|
||||
type="danger"
|
||||
@click="handleDelete"
|
||||
>删除
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -76,8 +72,7 @@
|
||||
type="warning"
|
||||
@click="handleExport"
|
||||
>导出
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@ -120,8 +115,7 @@
|
||||
type="primary"
|
||||
@click="handleSetting(scope.row)"
|
||||
>设置
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tenant:edit']"
|
||||
icon="Edit"
|
||||
@ -129,8 +123,7 @@
|
||||
type="primary"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['tenant:remove']"
|
||||
icon="Delete"
|
||||
@ -138,8 +131,7 @@
|
||||
type="primary"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button
|
||||
>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -213,8 +205,18 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改租户对话框 -->
|
||||
<el-dialog v-model="showTenantSetting" append-to-body title="租户设置" width="500px">
|
||||
<el-form ref="tenantSettingRef" :model="tenantSettingForm" :rules="tenantSettingRules" label-width="130px">
|
||||
<el-dialog
|
||||
v-model="showTenantSetting"
|
||||
append-to-body
|
||||
title="租户设置"
|
||||
width="500px"
|
||||
>
|
||||
<el-form
|
||||
ref="tenantSettingRef"
|
||||
:model="tenantSettingForm"
|
||||
:rules="tenantSettingRules"
|
||||
label-width="130px"
|
||||
>
|
||||
<!--TODO:-->
|
||||
<el-form-item label="模式">
|
||||
<el-radio-group v-model="tenantSettingForm.mode">
|
||||
@ -224,19 +226,41 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<template v-if="tenantSettingForm.mode === '3'">
|
||||
<div v-for="item in tenantSettingForm.datasourceList" :key="`${item.ip}-${item.port}-${item.name}`"
|
||||
class="data-source-item">
|
||||
<div
|
||||
v-for="item in tenantSettingForm.datasourceList"
|
||||
:key="`${item.ip}-${item.port}-${item.name}`"
|
||||
class="data-source-item"
|
||||
>
|
||||
<div class="left">
|
||||
<div class="database-type">{{ "MySQL" }}</div>
|
||||
<div class="database-url">{{ "127.0.0.1" }} : {{ 3306 }}</div>
|
||||
<div class="database-name">{{ "ry-vue" }}</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-button circle icon="edit" plain size="small" type="primary"></el-button>
|
||||
<el-button circle icon="delete" plain size="small" type="danger"></el-button>
|
||||
<el-button
|
||||
circle
|
||||
icon="edit"
|
||||
plain
|
||||
size="small"
|
||||
type="primary"
|
||||
></el-button>
|
||||
<el-button
|
||||
circle
|
||||
icon="delete"
|
||||
plain
|
||||
size="small"
|
||||
type="danger"
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-button icon="plus" plain size="small" style="margin-top: 18px" type="primary">新增数据源</el-button>
|
||||
<el-button
|
||||
icon="plus"
|
||||
plain
|
||||
size="small"
|
||||
style="margin-top: 18px"
|
||||
type="primary"
|
||||
>新增数据源</el-button
|
||||
>
|
||||
<!-- <el-form-item label="数据库类型" prop="type">-->
|
||||
<!-- <el-select v-model="tenantSettingForm.host">-->
|
||||
<!-- <el-option v-for="option in database_type_dict" :key="option.value" :label="option.label"-->
|
||||
@ -262,7 +286,9 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitTenantSetting">确 定</el-button>
|
||||
<el-button type="primary" @click="submitTenantSetting"
|
||||
>确 定</el-button
|
||||
>
|
||||
<el-button @click="cancelSettingTenant">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@ -271,7 +297,14 @@
|
||||
</template>
|
||||
|
||||
<script name="Tenant" setup>
|
||||
import {addTenant, delTenant, getSetting, getTenant, listTenant, updateTenant,} from "@/api/tenant/tenant";
|
||||
import {
|
||||
addTenant,
|
||||
delTenant,
|
||||
getSetting,
|
||||
getTenant,
|
||||
listTenant,
|
||||
updateTenant,
|
||||
} from "@/api/tenant/tenant";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@ -284,9 +317,9 @@ const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const showTenantSetting = ref(false) /*是否显示租户设置对话框*/
|
||||
const tenantSettingRef = ref()
|
||||
const editDatasourceIndex = ref(-1)
|
||||
const showTenantSetting = ref(false); /*是否显示租户设置对话框*/
|
||||
const tenantSettingRef = ref();
|
||||
const editDatasourceIndex = ref(-1);
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
@ -323,14 +356,14 @@ const data = reactive({
|
||||
// }
|
||||
// ],
|
||||
// mode: '3'
|
||||
}
|
||||
,
|
||||
},
|
||||
tenantSettingRules: {
|
||||
/*TODO:*/
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const {queryParams, form, rules, tenantSettingForm, tenantSettingRules} = toRefs(data);
|
||||
const { queryParams, form, rules, tenantSettingForm, tenantSettingRules } =
|
||||
toRefs(data);
|
||||
|
||||
/** 查询租户列表 */
|
||||
function getList() {
|
||||
@ -352,9 +385,9 @@ function cancel() {
|
||||
* 取消租户设置
|
||||
*/
|
||||
const cancelSettingTenant = () => {
|
||||
showTenantSetting.value = false
|
||||
resetSettingTenant()
|
||||
}
|
||||
showTenantSetting.value = false;
|
||||
resetSettingTenant();
|
||||
};
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
@ -385,17 +418,19 @@ function reset() {
|
||||
const resetSettingTenant = () => {
|
||||
form.value = {
|
||||
/*TODO:*/
|
||||
datasourceList: [{
|
||||
datasourceList: [
|
||||
{
|
||||
type: null,
|
||||
ip: null,
|
||||
port: null,
|
||||
name: null,
|
||||
username: null,
|
||||
password: null,
|
||||
}]
|
||||
}
|
||||
tenantSettingRef.value?.resetFields()
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
tenantSettingRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
@ -440,12 +475,12 @@ function handleUpdate(row) {
|
||||
*/
|
||||
const handleSetting = (row) => {
|
||||
// editDatasourceIndex.value = 0
|
||||
resetSettingTenant()
|
||||
getSetting(row.tenantId).then(resp => {
|
||||
tenantSettingForm.value = resp.data
|
||||
showTenantSetting.value = true
|
||||
})
|
||||
}
|
||||
resetSettingTenant();
|
||||
getSetting(row.tenantId).then((resp) => {
|
||||
tenantSettingForm.value = resp.data;
|
||||
showTenantSetting.value = true;
|
||||
});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
@ -473,8 +508,8 @@ function submitForm() {
|
||||
*/
|
||||
const submitTenantSetting = () => {
|
||||
/*TODO:*/
|
||||
showTenantSetting.value = false
|
||||
}
|
||||
showTenantSetting.value = false;
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
@ -488,8 +523,7 @@ function handleDelete(row) {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
@ -539,6 +573,5 @@ getList();
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user