fmt
This commit is contained in:
@ -1,9 +1,17 @@
|
||||
<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
|
||||
import {ElInput, ElPopover, ElScrollbar} from "element-plus";
|
||||
import { debounce } from "lodash-es"; //required if you're not going to override default slots
|
||||
import { ElInput, ElPopover, ElScrollbar } from "element-plus";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {},
|
||||
@ -17,7 +25,7 @@ const props = defineProps({
|
||||
width: {
|
||||
type: Number,
|
||||
},
|
||||
prefixIcon: {type: String},
|
||||
prefixIcon: { type: String },
|
||||
query: {
|
||||
type: Object,
|
||||
required: true,
|
||||
@ -35,14 +43,14 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const {modelValue} = toRefs(props);
|
||||
const { modelValue } = toRefs(props);
|
||||
const loadKey = ref(0);
|
||||
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(() => {
|
||||
@ -216,7 +231,7 @@ onUnmounted(() => {
|
||||
@click.stop
|
||||
>
|
||||
<template #prefix>
|
||||
<slot name="prefix"/>
|
||||
<slot name="prefix" />
|
||||
</template>
|
||||
</el-input>
|
||||
<!--选项隐藏时-->
|
||||
@ -234,7 +249,7 @@ onUnmounted(() => {
|
||||
>
|
||||
<!-- @click.stop="handleFocus"-->
|
||||
<template #prefix>
|
||||
<slot name="prefix"/>
|
||||
<slot name="prefix" />
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
@ -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: "Microsoft SQL Server", value: "Microsoft SQL Server", elTagType: "",
|
||||
}];
|
||||
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: "",
|
||||
},
|
||||
{
|
||||
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,15 +1,20 @@
|
||||
import axios from "axios";
|
||||
import {ElLoading, ElMessage, ElMessageBox, ElNotification,} from "element-plus";
|
||||
import {getToken} from "@/utils/auth";
|
||||
import {
|
||||
ElLoading,
|
||||
ElMessage,
|
||||
ElMessageBox,
|
||||
ElNotification,
|
||||
} from "element-plus";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import errorCode from "@/utils/errorCode";
|
||||
import {blobValidate, tansParams} from "@/utils/ruoyi";
|
||||
import { blobValidate, tansParams } from "@/utils/ruoyi";
|
||||
import cache from "@/plugins/cache";
|
||||
import {saveAs} from "file-saver";
|
||||
import { saveAs } from "file-saver";
|
||||
import useUserStore from "@/store/modules/user";
|
||||
|
||||
let downloadLoadingInstance;
|
||||
// 是否显示重新登录
|
||||
export let isRelogin = {show: false};
|
||||
export let isRelogin = { show: false };
|
||||
|
||||
axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
|
||||
// 创建axios实例
|
||||
@ -158,13 +163,13 @@ service.interceptors.response.use(
|
||||
}
|
||||
return Promise.reject("您已被挤下线");
|
||||
} else if (code === 500) {
|
||||
ElMessage({message: msg, type: "error"});
|
||||
ElMessage({ message: msg, type: "error" });
|
||||
return Promise.reject(new Error(msg));
|
||||
} else if (code === 601) {
|
||||
ElMessage({message: msg, type: "warning"});
|
||||
ElMessage({ message: msg, type: "warning" });
|
||||
return Promise.reject(new Error(msg));
|
||||
} else if (code !== 200) {
|
||||
ElNotification.error({title: msg});
|
||||
ElNotification.error({ title: msg });
|
||||
return Promise.reject("error");
|
||||
} else {
|
||||
return Promise.resolve(res.data);
|
||||
@ -172,7 +177,7 @@ service.interceptors.response.use(
|
||||
},
|
||||
(error) => {
|
||||
console.log("err" + error);
|
||||
let {message} = error;
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "后端接口连接异常";
|
||||
} else if (message.includes("timeout")) {
|
||||
@ -180,7 +185,7 @@ service.interceptors.response.use(
|
||||
} else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
ElMessage({message: message, type: "error", duration: 5 * 1000});
|
||||
ElMessage({ message: message, type: "error", duration: 5 * 1000 });
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
@ -198,7 +203,7 @@ export function download(url, params, filename, config) {
|
||||
return tansParams(params);
|
||||
},
|
||||
],
|
||||
headers: {"Content-Type": "application/x-www-form-urlencoded"},
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
||||
responseType: "blob",
|
||||
...config,
|
||||
})
|
||||
|
@ -48,7 +48,7 @@
|
||||
type="text"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon class="el-input__icon input-icon" icon-class="user"/>
|
||||
<svg-icon class="el-input__icon input-icon" icon-class="user" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -62,7 +62,7 @@
|
||||
@keyup.enter="handleLogin"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg-icon class="el-input__icon input-icon" icon-class="password"/>
|
||||
<svg-icon class="el-input__icon input-icon" icon-class="password" />
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@ -83,7 +83,7 @@
|
||||
</template>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" class="login-code-img" @click="getCode"/>
|
||||
<img :src="codeUrl" class="login-code-img" @click="getCode" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-checkbox
|
||||
@ -117,16 +117,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getCodeImg, getTenantNormalList} from "@/api/login";
|
||||
import { getCodeImg, getTenantNormalList } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import {decrypt, encrypt} from "@/utils/jsencrypt";
|
||||
import { decrypt, encrypt } from "@/utils/jsencrypt";
|
||||
import useUserStore from "@/store/modules/user";
|
||||
import PagedSelect from "@/components/InfiniteSelect";
|
||||
import {getCurrentInstance, ref, watchEffect} from "vue";
|
||||
import { getCurrentInstance, ref, watchEffect } from "vue";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const router = useRouter();
|
||||
const {proxy} = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const loginForm = ref({
|
||||
tenant: "",
|
||||
@ -138,10 +138,10 @@ const loginForm = ref({
|
||||
});
|
||||
|
||||
const loginRules = {
|
||||
tenant: [{required: true, trigger: "change", message: "请选择租户"}],
|
||||
username: [{required: true, trigger: "blur", message: "请输入您的账号"}],
|
||||
password: [{required: true, trigger: "blur", message: "请输入您的密码"}],
|
||||
code: [{required: true, trigger: "change", message: "请输入验证码"}],
|
||||
tenant: [{ required: true, trigger: "change", message: "请选择租户" }],
|
||||
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }],
|
||||
};
|
||||
const defaultTenantNamt = ref("");
|
||||
const codeUrl = ref("");
|
||||
@ -158,12 +158,12 @@ function handleLogin() {
|
||||
loading.value = true;
|
||||
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
||||
if (loginForm.value.rememberMe) {
|
||||
Cookies.set("tenant", loginForm.value.tenant, {expires: 30});
|
||||
Cookies.set("username", loginForm.value.username, {expires: 30});
|
||||
Cookies.set("tenant", loginForm.value.tenant, { expires: 30 });
|
||||
Cookies.set("username", loginForm.value.username, { expires: 30 });
|
||||
Cookies.set("password", encrypt(loginForm.value.password), {
|
||||
expires: 30,
|
||||
});
|
||||
Cookies.set("rememberMe", loginForm.value.rememberMe, {expires: 30});
|
||||
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 });
|
||||
} else {
|
||||
// 否则移除
|
||||
Cookies.remove("tenant");
|
||||
@ -175,7 +175,7 @@ function handleLogin() {
|
||||
userStore
|
||||
.login(loginForm.value)
|
||||
.then(() => {
|
||||
router.push({path: redirect.value || "/"});
|
||||
router.push({ path: redirect.value || "/" });
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
@ -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>
|
||||
@ -104,9 +100,9 @@
|
||||
</template>
|
||||
|
||||
<script name="Online" setup>
|
||||
import {forceLogout, list as initData} from "@/api/monitor/online";
|
||||
import { forceLogout, list as initData } from "@/api/monitor/online";
|
||||
|
||||
const {proxy} = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const onlineList = ref([]);
|
||||
const loading = ref(true);
|
||||
@ -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"
|
||||
@ -90,12 +85,12 @@
|
||||
:data="tenantList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column align="center" type="selection" width="55"/>
|
||||
<el-table-column align="center" label="编码" prop="tenantId"/>
|
||||
<el-table-column align="center" label="公司名称" prop="companyName"/>
|
||||
<el-table-column align="center" label="联系人名称" prop="contactName"/>
|
||||
<el-table-column align="center" label="联系人电话" prop="contactPhone"/>
|
||||
<el-table-column align="center" label="公司地址" prop="address"/>
|
||||
<el-table-column align="center" type="selection" width="55" />
|
||||
<el-table-column align="center" label="编码" prop="tenantId" />
|
||||
<el-table-column align="center" label="公司名称" prop="companyName" />
|
||||
<el-table-column align="center" label="联系人名称" prop="contactName" />
|
||||
<el-table-column align="center" label="联系人电话" prop="contactPhone" />
|
||||
<el-table-column align="center" label="公司地址" prop="address" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="过期时间"
|
||||
@ -106,8 +101,8 @@
|
||||
<span>{{ parseTime(scope.row.expireTime, "{y}-{m}-{d}") }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="用户数量" prop="accountCount"/>
|
||||
<el-table-column align="center" label="状态" prop="status"/>
|
||||
<el-table-column align="center" label="用户数量" prop="accountCount" />
|
||||
<el-table-column align="center" label="状态" prop="status" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
@ -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>
|
||||
@ -156,10 +148,10 @@
|
||||
<el-dialog v-model="open" :title="title" append-to-body width="500px">
|
||||
<el-form ref="tenantRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-form-item label="公司名称" prop="companyName">
|
||||
<el-input v-model="form.companyName" placeholder="请输入公司名称"/>
|
||||
<el-input v-model="form.companyName" placeholder="请输入公司名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人名称" prop="contactName">
|
||||
<el-input v-model="form.contactName" placeholder="请输入联系人名称"/>
|
||||
<el-input v-model="form.contactName" placeholder="请输入联系人名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="联系人电话" prop="contactPhone">
|
||||
<el-input
|
||||
@ -168,7 +160,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="公司地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入公司地址"/>
|
||||
<el-input v-model="form.address" placeholder="请输入公司地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司简介" prop="profile">
|
||||
<el-input
|
||||
@ -194,7 +186,7 @@
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户数量" prop="accountCount">
|
||||
<el-input v-model="form.accountCount" placeholder="请输入用户数量"/>
|
||||
<el-input v-model="form.accountCount" placeholder="请输入用户数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
@ -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">
|
||||
@ -223,20 +225,42 @@
|
||||
<el-radio label="3">数据源</el-radio>
|
||||
</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">
|
||||
<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 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,9 +297,16 @@
|
||||
</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();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const tenantList = ref([]);
|
||||
const open = ref(false);
|
||||
@ -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: {
|
||||
@ -307,7 +340,7 @@ const data = reactive({
|
||||
},
|
||||
rules: {
|
||||
companyName: [
|
||||
{required: true, message: "公司名称不能为空", trigger: "blur"},
|
||||
{ required: true, message: "公司名称不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
tenantSettingForm: {
|
||||
@ -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