fmt
This commit is contained in:
@ -1,9 +1,17 @@
|
|||||||
<script setup>
|
<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 InfiniteLoading from "v3-infinite-loading";
|
||||||
import "v3-infinite-loading/lib/style.css";
|
import "v3-infinite-loading/lib/style.css";
|
||||||
import {debounce} from "lodash-es"; //required if you're not going to override default slots
|
import { debounce } from "lodash-es"; //required if you're not going to override default slots
|
||||||
import {ElInput, ElPopover, ElScrollbar} from "element-plus";
|
import { ElInput, ElPopover, ElScrollbar } from "element-plus";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {},
|
modelValue: {},
|
||||||
@ -17,7 +25,7 @@ const props = defineProps({
|
|||||||
width: {
|
width: {
|
||||||
type: Number,
|
type: Number,
|
||||||
},
|
},
|
||||||
prefixIcon: {type: String},
|
prefixIcon: { type: String },
|
||||||
query: {
|
query: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
@ -35,14 +43,14 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const {modelValue} = toRefs(props);
|
const { modelValue } = toRefs(props);
|
||||||
const loadKey = ref(0);
|
const loadKey = ref(0);
|
||||||
const emit = defineEmits(["update:modelValue", "change", "confirm"]);
|
const emit = defineEmits(["update:modelValue", "change", "confirm"]);
|
||||||
|
|
||||||
const showPopOver = ref(false);
|
const showPopOver = ref(false);
|
||||||
|
|
||||||
const inputRefWhenShowPop = ref();
|
const inputRefWhenShowPop = ref();
|
||||||
const inputRefWhenNotShowPop = ref()
|
const inputRefWhenNotShowPop = ref();
|
||||||
const placeholderWhenShowPop = ref("");
|
const placeholderWhenShowPop = ref("");
|
||||||
const placeholderWhenNotShowPop = ref("");
|
const placeholderWhenNotShowPop = ref("");
|
||||||
const optionLabelWhenShowPop = ref("");
|
const optionLabelWhenShowPop = ref("");
|
||||||
@ -86,7 +94,7 @@ const loadMore = async ($state) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleInputClick = (event) => {
|
const handleInputClick = (event) => {
|
||||||
event.stopPropagation()
|
event.stopPropagation();
|
||||||
showPopOver.value = true;
|
showPopOver.value = true;
|
||||||
placeholderWhenShowPop.value = optionLabelWhenNotShowPop.value;
|
placeholderWhenShowPop.value = optionLabelWhenNotShowPop.value;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
@ -152,7 +160,6 @@ watch(modelValue, (value) => {
|
|||||||
emit("change", value);
|
emit("change", value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点击空白关闭弹出选项列表
|
* 点击空白关闭弹出选项列表
|
||||||
* @param event
|
* @param event
|
||||||
@ -173,17 +180,25 @@ onMounted(() => {
|
|||||||
page.value++;
|
page.value++;
|
||||||
initOptions();
|
initOptions();
|
||||||
document.body.addEventListener("click", handleBodyClick);
|
document.body.addEventListener("click", handleBodyClick);
|
||||||
watch(showPopOver, (show) => {
|
watch(
|
||||||
|
showPopOver,
|
||||||
|
(show) => {
|
||||||
if (show) {
|
if (show) {
|
||||||
inputRefWhenNotShowPop.value?.input?.parentNode?.removeEventListener('click', handleInputClick)
|
inputRefWhenNotShowPop.value?.input?.parentNode?.removeEventListener(
|
||||||
|
"click",
|
||||||
|
handleInputClick
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
inputRefWhenNotShowPop.value?.input?.parentNode?.addEventListener('click', handleInputClick)
|
inputRefWhenNotShowPop.value?.input?.parentNode?.addEventListener(
|
||||||
})
|
"click",
|
||||||
|
handleInputClick
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, {immediate: true})
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
@ -216,7 +231,7 @@ onUnmounted(() => {
|
|||||||
@click.stop
|
@click.stop
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<slot name="prefix"/>
|
<slot name="prefix" />
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<!--选项隐藏时-->
|
<!--选项隐藏时-->
|
||||||
@ -234,7 +249,7 @@ onUnmounted(() => {
|
|||||||
>
|
>
|
||||||
<!-- @click.stop="handleFocus"-->
|
<!-- @click.stop="handleFocus"-->
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<slot name="prefix"/>
|
<slot name="prefix" />
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,36 +1,75 @@
|
|||||||
export const sys_normal_disable = [{
|
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: "",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
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.roles = [];
|
||||||
this.permissions = [];
|
this.permissions = [];
|
||||||
this.userInfoRes = null;
|
this.userInfoRes = null;
|
||||||
|
this.tenant = null;
|
||||||
removeToken();
|
removeToken();
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {ElLoading, ElMessage, ElMessageBox, ElNotification,} from "element-plus";
|
import {
|
||||||
import {getToken} from "@/utils/auth";
|
ElLoading,
|
||||||
|
ElMessage,
|
||||||
|
ElMessageBox,
|
||||||
|
ElNotification,
|
||||||
|
} from "element-plus";
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
import errorCode from "@/utils/errorCode";
|
import errorCode from "@/utils/errorCode";
|
||||||
import {blobValidate, tansParams} from "@/utils/ruoyi";
|
import { blobValidate, tansParams } from "@/utils/ruoyi";
|
||||||
import cache from "@/plugins/cache";
|
import cache from "@/plugins/cache";
|
||||||
import {saveAs} from "file-saver";
|
import { saveAs } from "file-saver";
|
||||||
import useUserStore from "@/store/modules/user";
|
import useUserStore from "@/store/modules/user";
|
||||||
|
|
||||||
let downloadLoadingInstance;
|
let downloadLoadingInstance;
|
||||||
// 是否显示重新登录
|
// 是否显示重新登录
|
||||||
export let isRelogin = {show: false};
|
export let isRelogin = { show: false };
|
||||||
|
|
||||||
axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
|
axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
@ -158,13 +163,13 @@ service.interceptors.response.use(
|
|||||||
}
|
}
|
||||||
return Promise.reject("您已被挤下线");
|
return Promise.reject("您已被挤下线");
|
||||||
} else if (code === 500) {
|
} else if (code === 500) {
|
||||||
ElMessage({message: msg, type: "error"});
|
ElMessage({ message: msg, type: "error" });
|
||||||
return Promise.reject(new Error(msg));
|
return Promise.reject(new Error(msg));
|
||||||
} else if (code === 601) {
|
} else if (code === 601) {
|
||||||
ElMessage({message: msg, type: "warning"});
|
ElMessage({ message: msg, type: "warning" });
|
||||||
return Promise.reject(new Error(msg));
|
return Promise.reject(new Error(msg));
|
||||||
} else if (code !== 200) {
|
} else if (code !== 200) {
|
||||||
ElNotification.error({title: msg});
|
ElNotification.error({ title: msg });
|
||||||
return Promise.reject("error");
|
return Promise.reject("error");
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(res.data);
|
return Promise.resolve(res.data);
|
||||||
@ -172,7 +177,7 @@ service.interceptors.response.use(
|
|||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
console.log("err" + error);
|
console.log("err" + error);
|
||||||
let {message} = error;
|
let { message } = error;
|
||||||
if (message == "Network Error") {
|
if (message == "Network Error") {
|
||||||
message = "后端接口连接异常";
|
message = "后端接口连接异常";
|
||||||
} else if (message.includes("timeout")) {
|
} else if (message.includes("timeout")) {
|
||||||
@ -180,7 +185,7 @@ service.interceptors.response.use(
|
|||||||
} else if (message.includes("Request failed with status code")) {
|
} else if (message.includes("Request failed with status code")) {
|
||||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
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);
|
return Promise.reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -198,7 +203,7 @@ export function download(url, params, filename, config) {
|
|||||||
return tansParams(params);
|
return tansParams(params);
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
headers: {"Content-Type": "application/x-www-form-urlencoded"},
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
...config,
|
...config,
|
||||||
})
|
})
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<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>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
@keyup.enter="handleLogin"
|
@keyup.enter="handleLogin"
|
||||||
>
|
>
|
||||||
<template #prefix>
|
<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>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -83,7 +83,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="login-code">
|
<div class="login-code">
|
||||||
<img :src="codeUrl" class="login-code-img" @click="getCode"/>
|
<img :src="codeUrl" class="login-code-img" @click="getCode" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
@ -117,16 +117,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {getCodeImg, getTenantNormalList} from "@/api/login";
|
import { getCodeImg, getTenantNormalList } from "@/api/login";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import {decrypt, encrypt} from "@/utils/jsencrypt";
|
import { decrypt, encrypt } from "@/utils/jsencrypt";
|
||||||
import useUserStore from "@/store/modules/user";
|
import useUserStore from "@/store/modules/user";
|
||||||
import PagedSelect from "@/components/InfiniteSelect";
|
import PagedSelect from "@/components/InfiniteSelect";
|
||||||
import {getCurrentInstance, ref, watchEffect} from "vue";
|
import { getCurrentInstance, ref, watchEffect } from "vue";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const {proxy} = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
const loginForm = ref({
|
const loginForm = ref({
|
||||||
tenant: "",
|
tenant: "",
|
||||||
@ -138,10 +138,10 @@ const loginForm = ref({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const loginRules = {
|
const loginRules = {
|
||||||
tenant: [{required: true, trigger: "change", message: "请选择租户"}],
|
tenant: [{ required: true, trigger: "change", message: "请选择租户" }],
|
||||||
username: [{required: true, trigger: "blur", message: "请输入您的账号"}],
|
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||||
password: [{required: true, trigger: "blur", message: "请输入您的密码"}],
|
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||||
code: [{required: true, trigger: "change", message: "请输入验证码"}],
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }],
|
||||||
};
|
};
|
||||||
const defaultTenantNamt = ref("");
|
const defaultTenantNamt = ref("");
|
||||||
const codeUrl = ref("");
|
const codeUrl = ref("");
|
||||||
@ -158,12 +158,12 @@ function handleLogin() {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
||||||
if (loginForm.value.rememberMe) {
|
if (loginForm.value.rememberMe) {
|
||||||
Cookies.set("tenant", loginForm.value.tenant, {expires: 30});
|
Cookies.set("tenant", loginForm.value.tenant, { expires: 30 });
|
||||||
Cookies.set("username", loginForm.value.username, {expires: 30});
|
Cookies.set("username", loginForm.value.username, { expires: 30 });
|
||||||
Cookies.set("password", encrypt(loginForm.value.password), {
|
Cookies.set("password", encrypt(loginForm.value.password), {
|
||||||
expires: 30,
|
expires: 30,
|
||||||
});
|
});
|
||||||
Cookies.set("rememberMe", loginForm.value.rememberMe, {expires: 30});
|
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 });
|
||||||
} else {
|
} else {
|
||||||
// 否则移除
|
// 否则移除
|
||||||
Cookies.remove("tenant");
|
Cookies.remove("tenant");
|
||||||
@ -175,7 +175,7 @@ function handleLogin() {
|
|||||||
userStore
|
userStore
|
||||||
.login(loginForm.value)
|
.login(loginForm.value)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
router.push({path: redirect.value || "/"});
|
router.push({ path: redirect.value || "/" });
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@ -231,12 +231,12 @@ const handleTenantConfirm = (option) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
console.log(loginForm.value.tenant)
|
console.log(loginForm.value.tenant);
|
||||||
if (loginForm.value.tenant) {
|
if (loginForm.value.tenant) {
|
||||||
console.log('getcode')
|
console.log("getcode");
|
||||||
getCode();
|
getCode();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
getCookie();
|
getCookie();
|
||||||
defaultTenantNamt.value = useUserStore().tempTenantName;
|
defaultTenantNamt.value = useUserStore().tempTenantName;
|
||||||
</script>
|
</script>
|
||||||
|
@ -13,19 +13,16 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||||
>搜索
|
>搜索
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table
|
<el-table v-loading="loading" :data="onlineList" style="width: 100%">
|
||||||
v-loading="loading"
|
|
||||||
:data="onlineList"
|
|
||||||
style="width: 100%"
|
|
||||||
>
|
|
||||||
<el-table-column align="center" label="序号" type="index" width="100">
|
<el-table-column align="center" label="序号" type="index" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
|
<span>{{
|
||||||
|
(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
|
||||||
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@ -87,8 +84,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
@click="handleForceLogout(scope.row)"
|
@click="handleForceLogout(scope.row)"
|
||||||
>强退
|
>强退
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -104,9 +100,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script name="Online" setup>
|
<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 onlineList = ref([]);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
@ -153,8 +149,7 @@ function handleForceLogout(row) {
|
|||||||
getList();
|
getList();
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getList();
|
getList();
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button icon="Search" type="primary" @click="handleQuery"
|
<el-button icon="Search" type="primary" @click="handleQuery"
|
||||||
>搜索
|
>搜索
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -41,8 +40,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
>新增
|
>新增
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -53,8 +51,7 @@
|
|||||||
type="success"
|
type="success"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
>修改
|
>修改
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -65,8 +62,7 @@
|
|||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
>删除
|
>删除
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@ -76,8 +72,7 @@
|
|||||||
type="warning"
|
type="warning"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
>导出
|
>导出
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar
|
<right-toolbar
|
||||||
v-model:showSearch="showSearch"
|
v-model:showSearch="showSearch"
|
||||||
@ -90,12 +85,12 @@
|
|||||||
:data="tenantList"
|
:data="tenantList"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<el-table-column align="center" type="selection" width="55"/>
|
<el-table-column align="center" type="selection" width="55" />
|
||||||
<el-table-column align="center" label="编码" prop="tenantId"/>
|
<el-table-column align="center" label="编码" prop="tenantId" />
|
||||||
<el-table-column align="center" label="公司名称" prop="companyName"/>
|
<el-table-column align="center" label="公司名称" prop="companyName" />
|
||||||
<el-table-column align="center" label="联系人名称" prop="contactName"/>
|
<el-table-column align="center" label="联系人名称" prop="contactName" />
|
||||||
<el-table-column align="center" label="联系人电话" prop="contactPhone"/>
|
<el-table-column align="center" label="联系人电话" prop="contactPhone" />
|
||||||
<el-table-column align="center" label="公司地址" prop="address"/>
|
<el-table-column align="center" label="公司地址" prop="address" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
label="过期时间"
|
label="过期时间"
|
||||||
@ -106,8 +101,8 @@
|
|||||||
<span>{{ parseTime(scope.row.expireTime, "{y}-{m}-{d}") }}</span>
|
<span>{{ parseTime(scope.row.expireTime, "{y}-{m}-{d}") }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="用户数量" prop="accountCount"/>
|
<el-table-column align="center" label="用户数量" prop="accountCount" />
|
||||||
<el-table-column align="center" label="状态" prop="status"/>
|
<el-table-column align="center" label="状态" prop="status" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
align="center"
|
align="center"
|
||||||
class-name="small-padding fixed-width"
|
class-name="small-padding fixed-width"
|
||||||
@ -120,8 +115,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
@click="handleSetting(scope.row)"
|
@click="handleSetting(scope.row)"
|
||||||
>设置
|
>设置
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPermi="['tenant:edit']"
|
v-hasPermi="['tenant:edit']"
|
||||||
icon="Edit"
|
icon="Edit"
|
||||||
@ -129,8 +123,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
>修改
|
>修改
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
<el-button
|
<el-button
|
||||||
v-hasPermi="['tenant:remove']"
|
v-hasPermi="['tenant:remove']"
|
||||||
icon="Delete"
|
icon="Delete"
|
||||||
@ -138,8 +131,7 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
>删除
|
>删除
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -156,10 +148,10 @@
|
|||||||
<el-dialog v-model="open" :title="title" append-to-body width="500px">
|
<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 ref="tenantRef" :model="form" :rules="rules" label-width="130px">
|
||||||
<el-form-item label="公司名称" prop="companyName">
|
<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>
|
||||||
<el-form-item label="联系人名称" prop="contactName">
|
<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>
|
||||||
<el-form-item label="联系人电话" prop="contactPhone">
|
<el-form-item label="联系人电话" prop="contactPhone">
|
||||||
<el-input
|
<el-input
|
||||||
@ -168,7 +160,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="公司地址" prop="address">
|
<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>
|
||||||
<el-form-item label="公司简介" prop="profile">
|
<el-form-item label="公司简介" prop="profile">
|
||||||
<el-input
|
<el-input
|
||||||
@ -194,7 +186,7 @@
|
|||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="用户数量" prop="accountCount">
|
<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>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input
|
<el-input
|
||||||
@ -213,8 +205,18 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 添加或修改租户对话框 -->
|
<!-- 添加或修改租户对话框 -->
|
||||||
<el-dialog v-model="showTenantSetting" append-to-body title="租户设置" width="500px">
|
<el-dialog
|
||||||
<el-form ref="tenantSettingRef" :model="tenantSettingForm" :rules="tenantSettingRules" label-width="130px">
|
v-model="showTenantSetting"
|
||||||
|
append-to-body
|
||||||
|
title="租户设置"
|
||||||
|
width="500px"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="tenantSettingRef"
|
||||||
|
:model="tenantSettingForm"
|
||||||
|
:rules="tenantSettingRules"
|
||||||
|
label-width="130px"
|
||||||
|
>
|
||||||
<!--TODO:-->
|
<!--TODO:-->
|
||||||
<el-form-item label="模式">
|
<el-form-item label="模式">
|
||||||
<el-radio-group v-model="tenantSettingForm.mode">
|
<el-radio-group v-model="tenantSettingForm.mode">
|
||||||
@ -223,20 +225,42 @@
|
|||||||
<el-radio label="3">数据源</el-radio>
|
<el-radio label="3">数据源</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<template v-if="tenantSettingForm.mode==='3'">
|
<template v-if="tenantSettingForm.mode === '3'">
|
||||||
<div v-for="item in tenantSettingForm.datasourceList" :key="`${item.ip}-${item.port}-${item.name}`"
|
<div
|
||||||
class="data-source-item">
|
v-for="item in tenantSettingForm.datasourceList"
|
||||||
|
:key="`${item.ip}-${item.port}-${item.name}`"
|
||||||
|
class="data-source-item"
|
||||||
|
>
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="database-type">{{ "MySQL" }}</div>
|
<div class="database-type">{{ "MySQL" }}</div>
|
||||||
<div class="database-url">{{ "127.0.0.1" }} : {{ 3306 }}</div>
|
<div class="database-url">{{ "127.0.0.1" }} : {{ 3306 }}</div>
|
||||||
<div class="database-name">{{ "ry-vue" }}</div>
|
<div class="database-name">{{ "ry-vue" }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<el-button circle icon="edit" plain size="small" type="primary"></el-button>
|
<el-button
|
||||||
<el-button circle icon="delete" plain size="small" type="danger"></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>
|
||||||
</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-form-item label="数据库类型" prop="type">-->
|
||||||
<!-- <el-select v-model="tenantSettingForm.host">-->
|
<!-- <el-select v-model="tenantSettingForm.host">-->
|
||||||
<!-- <el-option v-for="option in database_type_dict" :key="option.value" :label="option.label"-->
|
<!-- <el-option v-for="option in database_type_dict" :key="option.value" :label="option.label"-->
|
||||||
@ -262,7 +286,9 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-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>
|
<el-button @click="cancelSettingTenant">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -271,9 +297,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script name="Tenant" setup>
|
<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 tenantList = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
@ -284,9 +317,9 @@ const single = ref(true);
|
|||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
const showTenantSetting = ref(false) /*是否显示租户设置对话框*/
|
const showTenantSetting = ref(false); /*是否显示租户设置对话框*/
|
||||||
const tenantSettingRef = ref()
|
const tenantSettingRef = ref();
|
||||||
const editDatasourceIndex = ref(-1)
|
const editDatasourceIndex = ref(-1);
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@ -307,7 +340,7 @@ const data = reactive({
|
|||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
companyName: [
|
companyName: [
|
||||||
{required: true, message: "公司名称不能为空", trigger: "blur"},
|
{ required: true, message: "公司名称不能为空", trigger: "blur" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
tenantSettingForm: {
|
tenantSettingForm: {
|
||||||
@ -323,14 +356,14 @@ const data = reactive({
|
|||||||
// }
|
// }
|
||||||
// ],
|
// ],
|
||||||
// mode: '3'
|
// mode: '3'
|
||||||
}
|
},
|
||||||
,
|
|
||||||
tenantSettingRules: {
|
tenantSettingRules: {
|
||||||
/*TODO:*/
|
/*TODO:*/
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const {queryParams, form, rules, tenantSettingForm, tenantSettingRules} = toRefs(data);
|
const { queryParams, form, rules, tenantSettingForm, tenantSettingRules } =
|
||||||
|
toRefs(data);
|
||||||
|
|
||||||
/** 查询租户列表 */
|
/** 查询租户列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
@ -352,9 +385,9 @@ function cancel() {
|
|||||||
* 取消租户设置
|
* 取消租户设置
|
||||||
*/
|
*/
|
||||||
const cancelSettingTenant = () => {
|
const cancelSettingTenant = () => {
|
||||||
showTenantSetting.value = false
|
showTenantSetting.value = false;
|
||||||
resetSettingTenant()
|
resetSettingTenant();
|
||||||
}
|
};
|
||||||
|
|
||||||
// 表单重置
|
// 表单重置
|
||||||
function reset() {
|
function reset() {
|
||||||
@ -385,17 +418,19 @@ function reset() {
|
|||||||
const resetSettingTenant = () => {
|
const resetSettingTenant = () => {
|
||||||
form.value = {
|
form.value = {
|
||||||
/*TODO:*/
|
/*TODO:*/
|
||||||
datasourceList: [{
|
datasourceList: [
|
||||||
|
{
|
||||||
type: null,
|
type: null,
|
||||||
ip: null,
|
ip: null,
|
||||||
port: null,
|
port: null,
|
||||||
name: null,
|
name: null,
|
||||||
username: null,
|
username: null,
|
||||||
password: null,
|
password: null,
|
||||||
}]
|
},
|
||||||
}
|
],
|
||||||
tenantSettingRef.value?.resetFields()
|
};
|
||||||
}
|
tenantSettingRef.value?.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
@ -440,12 +475,12 @@ function handleUpdate(row) {
|
|||||||
*/
|
*/
|
||||||
const handleSetting = (row) => {
|
const handleSetting = (row) => {
|
||||||
// editDatasourceIndex.value = 0
|
// editDatasourceIndex.value = 0
|
||||||
resetSettingTenant()
|
resetSettingTenant();
|
||||||
getSetting(row.tenantId).then(resp => {
|
getSetting(row.tenantId).then((resp) => {
|
||||||
tenantSettingForm.value = resp.data
|
tenantSettingForm.value = resp.data;
|
||||||
showTenantSetting.value = true
|
showTenantSetting.value = true;
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
@ -473,8 +508,8 @@ function submitForm() {
|
|||||||
*/
|
*/
|
||||||
const submitTenantSetting = () => {
|
const submitTenantSetting = () => {
|
||||||
/*TODO:*/
|
/*TODO:*/
|
||||||
showTenantSetting.value = false
|
showTenantSetting.value = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
@ -488,8 +523,7 @@ function handleDelete(row) {
|
|||||||
getList();
|
getList();
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
@ -539,6 +573,5 @@ getList();
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user