remove all semicolons
This commit is contained in:
@@ -26,17 +26,17 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import errImage from "@/assets/401_images/401.gif";
|
||||
import errImage from "@/assets/401_images/401.gif"
|
||||
|
||||
let { proxy } = getCurrentInstance();
|
||||
let { proxy } = getCurrentInstance()
|
||||
|
||||
const errGif = ref(errImage + "?" + +new Date());
|
||||
const errGif = ref(errImage + "?" + +new Date())
|
||||
|
||||
function back() {
|
||||
if (proxy.$route.query.noGoBack) {
|
||||
proxy.$router.push({ path: "/" });
|
||||
proxy.$router.push({ path: "/" })
|
||||
} else {
|
||||
proxy.$router.go(-1);
|
||||
proxy.$router.go(-1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
+43
-43
@@ -65,16 +65,16 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
||||
import { getCodeImg } from "@/api/login"
|
||||
import Cookies from "js-cookie"
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt"
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const title = import.meta.env.VITE_APP_TITLE;
|
||||
const userStore = useUserStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const title = import.meta.env.VITE_APP_TITLE
|
||||
const userStore = useUserStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const loginForm = ref({
|
||||
username: "admin",
|
||||
@@ -82,85 +82,85 @@ const loginForm = ref({
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
});
|
||||
})
|
||||
|
||||
const loginRules = {
|
||||
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||
};
|
||||
}
|
||||
|
||||
const codeUrl = ref("");
|
||||
const loading = ref(false);
|
||||
const codeUrl = ref("")
|
||||
const loading = ref(false)
|
||||
// 验证码开关
|
||||
const captchaEnabled = ref(true);
|
||||
const captchaEnabled = ref(true)
|
||||
// 注册开关
|
||||
const register = ref(false);
|
||||
const redirect = ref(undefined);
|
||||
const register = ref(false)
|
||||
const redirect = ref(undefined)
|
||||
|
||||
watch(route, (newRoute) => {
|
||||
redirect.value = newRoute.query && newRoute.query.redirect;
|
||||
}, { immediate: true });
|
||||
redirect.value = newRoute.query && newRoute.query.redirect
|
||||
}, { immediate: true })
|
||||
|
||||
function handleLogin() {
|
||||
proxy.$refs.loginRef.validate(valid => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
||||
if (loginForm.value.rememberMe) {
|
||||
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("username", loginForm.value.username, { expires: 30 })
|
||||
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 })
|
||||
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 })
|
||||
} else {
|
||||
// 否则移除
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove("rememberMe");
|
||||
Cookies.remove("username")
|
||||
Cookies.remove("password")
|
||||
Cookies.remove("rememberMe")
|
||||
}
|
||||
// 调用action的登录方法
|
||||
userStore.login(loginForm.value).then(() => {
|
||||
const query = route.query;
|
||||
const query = route.query
|
||||
const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
|
||||
if (cur !== "redirect") {
|
||||
acc[cur] = query[cur];
|
||||
acc[cur] = query[cur]
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
router.push({ path: redirect.value || "/", query: otherQueryParams });
|
||||
return acc
|
||||
}, {})
|
||||
router.push({ path: redirect.value || "/", query: otherQueryParams })
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
// 重新获取验证码
|
||||
if (captchaEnabled.value) {
|
||||
getCode();
|
||||
getCode()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function getCode() {
|
||||
getCodeImg().then(res => {
|
||||
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
||||
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
||||
if (captchaEnabled.value) {
|
||||
codeUrl.value = "data:image/gif;base64," + res.img;
|
||||
loginForm.value.uuid = res.uuid;
|
||||
codeUrl.value = "data:image/gif;base64," + res.img
|
||||
loginForm.value.uuid = res.uuid
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function getCookie() {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get("rememberMe");
|
||||
const username = Cookies.get("username")
|
||||
const password = Cookies.get("password")
|
||||
const rememberMe = Cookies.get("rememberMe")
|
||||
loginForm.value = {
|
||||
username: username === undefined ? loginForm.value.username : username,
|
||||
password: password === undefined ? loginForm.value.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
getCode();
|
||||
getCookie();
|
||||
getCode()
|
||||
getCookie()
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
Vendored
+16
-16
@@ -65,21 +65,21 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Cache">
|
||||
import { getCache } from '@/api/monitor/cache';
|
||||
import * as echarts from 'echarts';
|
||||
import { getCache } from '@/api/monitor/cache'
|
||||
import * as echarts from 'echarts'
|
||||
|
||||
const cache = ref([]);
|
||||
const commandstats = ref(null);
|
||||
const usedmemory = ref(null);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const cache = ref([])
|
||||
const commandstats = ref(null)
|
||||
const usedmemory = ref(null)
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
function getList() {
|
||||
proxy.$modal.loading("正在加载缓存监控数据,请稍候!");
|
||||
proxy.$modal.loading("正在加载缓存监控数据,请稍候!")
|
||||
getCache().then(response => {
|
||||
proxy.$modal.closeLoading();
|
||||
cache.value = response.data;
|
||||
proxy.$modal.closeLoading()
|
||||
cache.value = response.data
|
||||
|
||||
const commandstatsIntance = echarts.init(commandstats.value, "macarons");
|
||||
const commandstatsIntance = echarts.init(commandstats.value, "macarons")
|
||||
commandstatsIntance.setOption({
|
||||
tooltip: {
|
||||
trigger: "item",
|
||||
@@ -97,8 +97,8 @@ function getList() {
|
||||
animationDuration: 1000
|
||||
}
|
||||
]
|
||||
});
|
||||
const usedmemoryInstance = echarts.init(usedmemory.value, "macarons");
|
||||
})
|
||||
const usedmemoryInstance = echarts.init(usedmemory.value, "macarons")
|
||||
usedmemoryInstance.setOption({
|
||||
tooltip: {
|
||||
formatter: "{b} <br/>{a} : " + cache.value.info.used_memory_human
|
||||
@@ -122,11 +122,11 @@ function getList() {
|
||||
]
|
||||
})
|
||||
window.addEventListener("resize", () => {
|
||||
commandstatsIntance.resize();
|
||||
usedmemoryInstance.resize();
|
||||
});
|
||||
commandstatsIntance.resize()
|
||||
usedmemoryInstance.resize()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
Vendored
+37
-37
@@ -155,92 +155,92 @@
|
||||
</template>
|
||||
|
||||
<script setup name="CacheList">
|
||||
import { listCacheName, listCacheKey, getCacheValue, clearCacheName, clearCacheKey, clearCacheAll } from "@/api/monitor/cache";
|
||||
import { listCacheName, listCacheKey, getCacheValue, clearCacheName, clearCacheKey, clearCacheAll } from "@/api/monitor/cache"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const cacheNames = ref([]);
|
||||
const cacheKeys = ref([]);
|
||||
const cacheForm = ref({});
|
||||
const loading = ref(true);
|
||||
const subLoading = ref(false);
|
||||
const nowCacheName = ref("");
|
||||
const tableHeight = ref(window.innerHeight - 200);
|
||||
const cacheNames = ref([])
|
||||
const cacheKeys = ref([])
|
||||
const cacheForm = ref({})
|
||||
const loading = ref(true)
|
||||
const subLoading = ref(false)
|
||||
const nowCacheName = ref("")
|
||||
const tableHeight = ref(window.innerHeight - 200)
|
||||
|
||||
/** 查询缓存名称列表 */
|
||||
function getCacheNames() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listCacheName().then(response => {
|
||||
cacheNames.value = response.data;
|
||||
loading.value = false;
|
||||
});
|
||||
cacheNames.value = response.data
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 刷新缓存名称列表 */
|
||||
function refreshCacheNames() {
|
||||
getCacheNames();
|
||||
proxy.$modal.msgSuccess("刷新缓存列表成功");
|
||||
getCacheNames()
|
||||
proxy.$modal.msgSuccess("刷新缓存列表成功")
|
||||
}
|
||||
|
||||
/** 清理指定名称缓存 */
|
||||
function handleClearCacheName(row) {
|
||||
clearCacheName(row.cacheName).then(response => {
|
||||
proxy.$modal.msgSuccess("清理缓存名称[" + row.cacheName + "]成功");
|
||||
getCacheKeys();
|
||||
});
|
||||
proxy.$modal.msgSuccess("清理缓存名称[" + row.cacheName + "]成功")
|
||||
getCacheKeys()
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询缓存键名列表 */
|
||||
function getCacheKeys(row) {
|
||||
const cacheName = row !== undefined ? row.cacheName : nowCacheName.value;
|
||||
const cacheName = row !== undefined ? row.cacheName : nowCacheName.value
|
||||
if (cacheName === "") {
|
||||
return;
|
||||
return
|
||||
}
|
||||
subLoading.value = true;
|
||||
subLoading.value = true
|
||||
listCacheKey(cacheName).then(response => {
|
||||
cacheKeys.value = response.data;
|
||||
subLoading.value = false;
|
||||
nowCacheName.value = cacheName;
|
||||
});
|
||||
cacheKeys.value = response.data
|
||||
subLoading.value = false
|
||||
nowCacheName.value = cacheName
|
||||
})
|
||||
}
|
||||
|
||||
/** 刷新缓存键名列表 */
|
||||
function refreshCacheKeys() {
|
||||
getCacheKeys();
|
||||
proxy.$modal.msgSuccess("刷新键名列表成功");
|
||||
getCacheKeys()
|
||||
proxy.$modal.msgSuccess("刷新键名列表成功")
|
||||
}
|
||||
|
||||
/** 清理指定键名缓存 */
|
||||
function handleClearCacheKey(cacheKey) {
|
||||
clearCacheKey(cacheKey).then(response => {
|
||||
proxy.$modal.msgSuccess("清理缓存键名[" + cacheKey + "]成功");
|
||||
getCacheKeys();
|
||||
});
|
||||
proxy.$modal.msgSuccess("清理缓存键名[" + cacheKey + "]成功")
|
||||
getCacheKeys()
|
||||
})
|
||||
}
|
||||
|
||||
/** 列表前缀去除 */
|
||||
function nameFormatter(row) {
|
||||
return row.cacheName.replace(":", "");
|
||||
return row.cacheName.replace(":", "")
|
||||
}
|
||||
|
||||
/** 键名前缀去除 */
|
||||
function keyFormatter(cacheKey) {
|
||||
return cacheKey.replace(nowCacheName.value, "");
|
||||
return cacheKey.replace(nowCacheName.value, "")
|
||||
}
|
||||
|
||||
/** 查询缓存内容详细 */
|
||||
function handleCacheValue(cacheKey) {
|
||||
getCacheValue(nowCacheName.value, cacheKey).then(response => {
|
||||
cacheForm.value = response.data;
|
||||
});
|
||||
cacheForm.value = response.data
|
||||
})
|
||||
}
|
||||
|
||||
/** 清理全部缓存 */
|
||||
function handleClearCacheAll() {
|
||||
clearCacheAll().then(response => {
|
||||
proxy.$modal.msgSuccess("清理全部缓存成功");
|
||||
});
|
||||
proxy.$modal.msgSuccess("清理全部缓存成功")
|
||||
})
|
||||
}
|
||||
|
||||
getCacheNames();
|
||||
getCacheNames()
|
||||
</script>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<script setup>
|
||||
import iFrame from '@/components/iFrame'
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { ref } from 'vue'
|
||||
|
||||
const url = ref(import.meta.env.VITE_APP_BASE_API + '/druid/login.html');
|
||||
const url = ref(import.meta.env.VITE_APP_BASE_API + '/druid/login.html')
|
||||
</script>
|
||||
|
||||
@@ -285,24 +285,24 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Job">
|
||||
import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job";
|
||||
import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job"
|
||||
import Crontab from '@/components/Crontab'
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_job_group, sys_job_status } = proxy.useDict("sys_job_group", "sys_job_status");
|
||||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_job_group, sys_job_status } = proxy.useDict("sys_job_group", "sys_job_status")
|
||||
|
||||
const jobList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const openView = ref(false);
|
||||
const openCron = ref(false);
|
||||
const expression = ref("");
|
||||
const jobList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const openView = ref(false)
|
||||
const openCron = ref(false)
|
||||
const expression = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -318,29 +318,29 @@ const data = reactive({
|
||||
invokeTarget: [{ required: true, message: "调用目标字符串不能为空", trigger: "blur" }],
|
||||
cronExpression: [{ required: true, message: "cron执行表达式不能为空", trigger: "change" }]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询定时任务列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listJob(queryParams.value).then(response => {
|
||||
jobList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
jobList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 任务组名字典翻译 */
|
||||
function jobGroupFormat(row, column) {
|
||||
return proxy.selectDictLabel(sys_job_group.value, row.jobGroup);
|
||||
return proxy.selectDictLabel(sys_job_group.value, row.jobGroup)
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -354,108 +354,108 @@ function reset() {
|
||||
misfirePolicy: 1,
|
||||
concurrent: 1,
|
||||
status: "0"
|
||||
};
|
||||
proxy.resetForm("jobRef");
|
||||
}
|
||||
proxy.resetForm("jobRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.jobId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.jobId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
// 更多操作触发
|
||||
function handleCommand(command, row) {
|
||||
switch (command) {
|
||||
case "handleRun":
|
||||
handleRun(row);
|
||||
break;
|
||||
handleRun(row)
|
||||
break
|
||||
case "handleView":
|
||||
handleView(row);
|
||||
break;
|
||||
handleView(row)
|
||||
break
|
||||
case "handleJobLog":
|
||||
handleJobLog(row);
|
||||
break;
|
||||
handleJobLog(row)
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 任务状态修改
|
||||
function handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
proxy.$modal.confirm('确认要"' + text + '""' + row.jobName + '"任务吗?').then(function () {
|
||||
return changeJobStatus(row.jobId, row.status);
|
||||
return changeJobStatus(row.jobId, row.status)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess(text + "成功");
|
||||
proxy.$modal.msgSuccess(text + "成功")
|
||||
}).catch(function () {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
row.status = row.status === "0" ? "1" : "0"
|
||||
})
|
||||
}
|
||||
|
||||
/* 立即执行一次 */
|
||||
function handleRun(row) {
|
||||
proxy.$modal.confirm('确认要立即执行一次"' + row.jobName + '"任务吗?').then(function () {
|
||||
return runJob(row.jobId, row.jobGroup);
|
||||
return runJob(row.jobId, row.jobGroup)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess("执行成功");})
|
||||
.catch(() => {});
|
||||
proxy.$modal.msgSuccess("执行成功")})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
/** 任务详细信息 */
|
||||
function handleView(row) {
|
||||
getJob(row.jobId).then(response => {
|
||||
form.value = response.data;
|
||||
openView.value = true;
|
||||
});
|
||||
form.value = response.data
|
||||
openView.value = true
|
||||
})
|
||||
}
|
||||
|
||||
/** cron表达式按钮操作 */
|
||||
function handleShowCron() {
|
||||
expression.value = form.value.cronExpression;
|
||||
openCron.value = true;
|
||||
expression.value = form.value.cronExpression
|
||||
openCron.value = true
|
||||
}
|
||||
|
||||
/** 确定后回传值 */
|
||||
function crontabFill(value) {
|
||||
form.value.cronExpression = value;
|
||||
form.value.cronExpression = value
|
||||
}
|
||||
|
||||
/** 任务日志列表查询 */
|
||||
function handleJobLog(row) {
|
||||
const jobId = row.jobId || 0;
|
||||
const jobId = row.jobId || 0
|
||||
router.push('/monitor/job-log/index/' + jobId)
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加任务";
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加任务"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const jobId = row.jobId || ids.value;
|
||||
reset()
|
||||
const jobId = row.jobId || ids.value
|
||||
getJob(jobId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改任务";
|
||||
});
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改任务"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -464,38 +464,38 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.jobId != undefined) {
|
||||
updateJob(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addJob(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const jobIds = row.jobId || ids.value;
|
||||
const jobIds = row.jobId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?').then(function () {
|
||||
return delJob(jobIds);
|
||||
return delJob(jobIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("monitor/job/export", {
|
||||
...queryParams.value,
|
||||
}, `job_${new Date().getTime()}.xlsx`);
|
||||
}, `job_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -171,21 +171,21 @@
|
||||
</template>
|
||||
|
||||
<script setup name="JobLog">
|
||||
import { getJob } from "@/api/monitor/job";
|
||||
import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog";
|
||||
import { getJob } from "@/api/monitor/job"
|
||||
import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_common_status, sys_job_group } = proxy.useDict("sys_common_status", "sys_job_group");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_common_status, sys_job_group } = proxy.useDict("sys_common_status", "sys_job_group")
|
||||
|
||||
const jobLogList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const dateRange = ref([]);
|
||||
const route = useRoute();
|
||||
const jobLogList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const dateRange = ref([])
|
||||
const route = useRoute()
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -196,88 +196,88 @@ const data = reactive({
|
||||
dictType: undefined,
|
||||
status: undefined
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询调度日志列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listJobLog(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||
jobLogList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
jobLogList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
function handleClose() {
|
||||
const obj = { path: "/monitor/job" };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
const obj = { path: "/monitor/job" }
|
||||
proxy.$tab.closeOpenPage(obj)
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.jobLogId);
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.jobLogId)
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 详细按钮操作 */
|
||||
function handleView(row) {
|
||||
open.value = true;
|
||||
form.value = row;
|
||||
open.value = true
|
||||
form.value = row
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
proxy.$modal.confirm('是否确认删除调度日志编号为"' + ids.value + '"的数据项?').then(function () {
|
||||
return delJobLog(ids.value);
|
||||
return delJobLog(ids.value)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 清空按钮操作 */
|
||||
function handleClean() {
|
||||
proxy.$modal.confirm("是否确认清空所有调度日志数据项?").then(function () {
|
||||
return cleanJobLog();
|
||||
return cleanJobLog()
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("清空成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("清空成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("monitor/jobLog/export", {
|
||||
...queryParams.value,
|
||||
}, `job_log_${new Date().getTime()}.xlsx`);
|
||||
}, `job_log_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
(() => {
|
||||
const jobId = route.params && route.params.jobId;
|
||||
const jobId = route.params && route.params.jobId
|
||||
if (jobId !== undefined && jobId != 0) {
|
||||
getJob(jobId).then(response => {
|
||||
queryParams.value.jobName = response.data.jobName;
|
||||
queryParams.value.jobGroup = response.data.jobGroup;
|
||||
getList();
|
||||
});
|
||||
queryParams.value.jobName = response.data.jobName
|
||||
queryParams.value.jobGroup = response.data.jobGroup
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
getList();
|
||||
getList()
|
||||
}
|
||||
})();
|
||||
})()
|
||||
</script>
|
||||
|
||||
@@ -125,21 +125,21 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Logininfor">
|
||||
import { list, delLogininfor, cleanLogininfor, unlockLogininfor } from "@/api/monitor/logininfor";
|
||||
import { list, delLogininfor, cleanLogininfor, unlockLogininfor } from "@/api/monitor/logininfor"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_common_status } = proxy.useDict("sys_common_status");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_common_status } = proxy.useDict("sys_common_status")
|
||||
|
||||
const logininforList = ref([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const selectName = ref("");
|
||||
const total = ref(0);
|
||||
const dateRange = ref([]);
|
||||
const defaultSort = ref({ prop: "loginTime", order: "descending" });
|
||||
const logininforList = ref([])
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const selectName = ref("")
|
||||
const total = ref(0)
|
||||
const dateRange = ref([])
|
||||
const defaultSort = ref({ prop: "loginTime", order: "descending" })
|
||||
|
||||
// 查询参数
|
||||
const queryParams = ref({
|
||||
@@ -150,84 +150,84 @@ const queryParams = ref({
|
||||
status: undefined,
|
||||
orderByColumn: undefined,
|
||||
isAsc: undefined
|
||||
});
|
||||
})
|
||||
|
||||
/** 查询登录日志列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
list(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||
logininforList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
logininforList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
queryParams.value.pageNum = 1;
|
||||
proxy.$refs["logininforRef"].sort(defaultSort.value.prop, defaultSort.value.order);
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
queryParams.value.pageNum = 1
|
||||
proxy.$refs["logininforRef"].sort(defaultSort.value.prop, defaultSort.value.order)
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.infoId);
|
||||
multiple.value = !selection.length;
|
||||
single.value = selection.length != 1;
|
||||
selectName.value = selection.map(item => item.userName);
|
||||
ids.value = selection.map(item => item.infoId)
|
||||
multiple.value = !selection.length
|
||||
single.value = selection.length != 1
|
||||
selectName.value = selection.map(item => item.userName)
|
||||
}
|
||||
|
||||
/** 排序触发事件 */
|
||||
function handleSortChange(column, prop, order) {
|
||||
queryParams.value.orderByColumn = column.prop;
|
||||
queryParams.value.isAsc = column.order;
|
||||
getList();
|
||||
queryParams.value.orderByColumn = column.prop
|
||||
queryParams.value.isAsc = column.order
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const infoIds = row.infoId || ids.value;
|
||||
const infoIds = row.infoId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?').then(function () {
|
||||
return delLogininfor(infoIds);
|
||||
return delLogininfor(infoIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 清空按钮操作 */
|
||||
function handleClean() {
|
||||
proxy.$modal.confirm("是否确认清空所有登录日志数据项?").then(function () {
|
||||
return cleanLogininfor();
|
||||
return cleanLogininfor()
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("清空成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("清空成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 解锁按钮操作 */
|
||||
function handleUnlock() {
|
||||
const username = selectName.value;
|
||||
const username = selectName.value
|
||||
proxy.$modal.confirm('是否确认解锁用户"' + username + '"数据项?').then(function () {
|
||||
return unlockLogininfor(username);
|
||||
return unlockLogininfor(username)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess("用户" + username + "解锁成功");
|
||||
}).catch(() => {});
|
||||
proxy.$modal.msgSuccess("用户" + username + "解锁成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("monitor/logininfor/export", {
|
||||
...queryParams.value,
|
||||
}, `logininfor_${new Date().getTime()}.xlsx`);
|
||||
}, `logininfor_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -58,52 +58,52 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Online">
|
||||
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);
|
||||
const total = ref(0);
|
||||
const pageNum = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const onlineList = ref([])
|
||||
const loading = ref(true)
|
||||
const total = ref(0)
|
||||
const pageNum = ref(1)
|
||||
const pageSize = ref(10)
|
||||
|
||||
const queryParams = ref({
|
||||
ipaddr: undefined,
|
||||
userName: undefined
|
||||
});
|
||||
})
|
||||
|
||||
/** 查询登录日志列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
initData(queryParams.value).then(response => {
|
||||
onlineList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
onlineList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
pageNum.value = 1;
|
||||
getList();
|
||||
pageNum.value = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 强退按钮操作 */
|
||||
function handleForceLogout(row) {
|
||||
proxy.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?').then(function () {
|
||||
return forceLogout(row.tokenId);
|
||||
return forceLogout(row.tokenId)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -198,22 +198,22 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Operlog">
|
||||
import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog";
|
||||
import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_oper_type, sys_common_status } = proxy.useDict("sys_oper_type","sys_common_status");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_oper_type, sys_common_status } = proxy.useDict("sys_oper_type","sys_common_status")
|
||||
|
||||
const operlogList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const defaultSort = ref({ prop: "operTime", order: "descending" });
|
||||
const operlogList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const dateRange = ref([])
|
||||
const defaultSort = ref({ prop: "operTime", order: "descending" })
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -226,85 +226,85 @@ const data = reactive({
|
||||
businessType: undefined,
|
||||
status: undefined
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form } = toRefs(data);
|
||||
const { queryParams, form } = toRefs(data)
|
||||
|
||||
/** 查询登录日志 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
list(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||
operlogList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
operlogList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 操作日志类型字典翻译 */
|
||||
function typeFormat(row, column) {
|
||||
return proxy.selectDictLabel(sys_oper_type.value, row.businessType);
|
||||
return proxy.selectDictLabel(sys_oper_type.value, row.businessType)
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
queryParams.value.pageNum = 1;
|
||||
proxy.$refs["operlogRef"].sort(defaultSort.value.prop, defaultSort.value.order);
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
queryParams.value.pageNum = 1
|
||||
proxy.$refs["operlogRef"].sort(defaultSort.value.prop, defaultSort.value.order)
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.operId);
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.operId)
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 排序触发事件 */
|
||||
function handleSortChange(column, prop, order) {
|
||||
queryParams.value.orderByColumn = column.prop;
|
||||
queryParams.value.isAsc = column.order;
|
||||
getList();
|
||||
queryParams.value.orderByColumn = column.prop
|
||||
queryParams.value.isAsc = column.order
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 详细按钮操作 */
|
||||
function handleView(row) {
|
||||
open.value = true;
|
||||
form.value = row;
|
||||
open.value = true
|
||||
form.value = row
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const operIds = row.operId || ids.value;
|
||||
const operIds = row.operId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除日志编号为"' + operIds + '"的数据项?').then(function () {
|
||||
return delOperlog(operIds);
|
||||
return delOperlog(operIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 清空按钮操作 */
|
||||
function handleClean() {
|
||||
proxy.$modal.confirm("是否确认清空所有操作日志数据项?").then(function () {
|
||||
return cleanOperlog();
|
||||
return cleanOperlog()
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("清空成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("清空成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("monitor/operlog/export",{
|
||||
...queryParams.value,
|
||||
}, `config_${new Date().getTime()}.xlsx`);
|
||||
}, `config_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -172,16 +172,16 @@
|
||||
<script setup>
|
||||
import { getServer } from '@/api/monitor/server'
|
||||
|
||||
const server = ref([]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const server = ref([])
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
function getList() {
|
||||
proxy.$modal.loading("正在加载服务监控数据,请稍候!");
|
||||
proxy.$modal.loading("正在加载服务监控数据,请稍候!")
|
||||
getServer().then(response => {
|
||||
server.value = response.data;
|
||||
proxy.$modal.closeLoading();
|
||||
});
|
||||
server.value = response.data
|
||||
proxy.$modal.closeLoading()
|
||||
})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<script setup>
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { params, query } = route
|
||||
const { path } = params
|
||||
|
||||
|
||||
+26
-26
@@ -76,12 +76,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { getCodeImg, register } from "@/api/login";
|
||||
import { ElMessageBox } from "element-plus"
|
||||
import { getCodeImg, register } from "@/api/login"
|
||||
|
||||
const title = import.meta.env.VITE_APP_TITLE;
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const title = import.meta.env.VITE_APP_TITLE
|
||||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const registerForm = ref({
|
||||
username: "",
|
||||
@@ -89,15 +89,15 @@ const registerForm = ref({
|
||||
confirmPassword: "",
|
||||
code: "",
|
||||
uuid: ""
|
||||
});
|
||||
})
|
||||
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (registerForm.value.password !== value) {
|
||||
callback(new Error("两次输入的密码不一致"));
|
||||
callback(new Error("两次输入的密码不一致"))
|
||||
} else {
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const registerRules = {
|
||||
username: [
|
||||
@@ -114,45 +114,45 @@ const registerRules = {
|
||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
||||
],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||
};
|
||||
}
|
||||
|
||||
const codeUrl = ref("");
|
||||
const loading = ref(false);
|
||||
const captchaEnabled = ref(true);
|
||||
const codeUrl = ref("")
|
||||
const loading = ref(false)
|
||||
const captchaEnabled = ref(true)
|
||||
|
||||
function handleRegister() {
|
||||
proxy.$refs.registerRef.validate(valid => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
register(registerForm.value).then(res => {
|
||||
const username = registerForm.value.username;
|
||||
const username = registerForm.value.username
|
||||
ElMessageBox.alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", "系统提示", {
|
||||
dangerouslyUseHTMLString: true,
|
||||
type: "success",
|
||||
}).then(() => {
|
||||
router.push("/login");
|
||||
}).catch(() => {});
|
||||
router.push("/login")
|
||||
}).catch(() => {})
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
loading.value = false
|
||||
if (captchaEnabled) {
|
||||
getCode();
|
||||
getCode()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function getCode() {
|
||||
getCodeImg().then(res => {
|
||||
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
||||
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
||||
if (captchaEnabled.value) {
|
||||
codeUrl.value = "data:image/gif;base64," + res.img;
|
||||
registerForm.value.uuid = res.uuid;
|
||||
codeUrl.value = "data:image/gif;base64," + res.img
|
||||
registerForm.value.uuid = res.uuid
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
getCode();
|
||||
getCode()
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
@@ -165,21 +165,21 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Config">
|
||||
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
|
||||
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_yes_no } = proxy.useDict("sys_yes_no");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_yes_no } = proxy.useDict("sys_yes_no")
|
||||
|
||||
const configList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const configList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const dateRange = ref([])
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -195,24 +195,24 @@ const data = reactive({
|
||||
configKey: [{ required: true, message: "参数键名不能为空", trigger: "blur" }],
|
||||
configValue: [{ required: true, message: "参数键值不能为空", trigger: "blur" }]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询参数列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listConfig(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||
configList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
configList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -224,46 +224,46 @@ function reset() {
|
||||
configValue: undefined,
|
||||
configType: "Y",
|
||||
remark: undefined
|
||||
};
|
||||
proxy.resetForm("configRef");
|
||||
}
|
||||
proxy.resetForm("configRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.configId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.configId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加参数";
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加参数"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const configId = row.configId || ids.value;
|
||||
reset()
|
||||
const configId = row.configId || ids.value
|
||||
getConfig(configId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改参数";
|
||||
});
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改参数"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -272,45 +272,45 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.configId != undefined) {
|
||||
updateConfig(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addConfig(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const configIds = row.configId || ids.value;
|
||||
const configIds = row.configId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function () {
|
||||
return delConfig(configIds);
|
||||
return delConfig(configIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("system/config/export", {
|
||||
...queryParams.value
|
||||
}, `config_${new Date().getTime()}.xlsx`);
|
||||
}, `config_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
/** 刷新缓存按钮操作 */
|
||||
function handleRefreshCache() {
|
||||
refreshCache().then(() => {
|
||||
proxy.$modal.msgSuccess("刷新缓存成功");
|
||||
});
|
||||
proxy.$modal.msgSuccess("刷新缓存成功")
|
||||
})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -141,19 +141,19 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Dept">
|
||||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
|
||||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
|
||||
|
||||
const deptList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const title = ref("");
|
||||
const deptOptions = ref([]);
|
||||
const isExpandAll = ref(true);
|
||||
const refreshTable = ref(true);
|
||||
const deptList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const title = ref("")
|
||||
const deptOptions = ref([])
|
||||
const isExpandAll = ref(true)
|
||||
const refreshTable = ref(true)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -168,23 +168,23 @@ const data = reactive({
|
||||
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
|
||||
phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询部门列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listDept(queryParams.value).then(response => {
|
||||
deptList.value = proxy.handleTree(response.data, "deptId");
|
||||
loading.value = false;
|
||||
});
|
||||
deptList.value = proxy.handleTree(response.data, "deptId")
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -198,54 +198,54 @@ function reset() {
|
||||
phone: undefined,
|
||||
email: undefined,
|
||||
status: "0"
|
||||
};
|
||||
proxy.resetForm("deptRef");
|
||||
}
|
||||
proxy.resetForm("deptRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
getList();
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd(row) {
|
||||
reset();
|
||||
reset()
|
||||
listDept().then(response => {
|
||||
deptOptions.value = proxy.handleTree(response.data, "deptId");
|
||||
});
|
||||
deptOptions.value = proxy.handleTree(response.data, "deptId")
|
||||
})
|
||||
if (row != undefined) {
|
||||
form.value.parentId = row.deptId;
|
||||
form.value.parentId = row.deptId
|
||||
}
|
||||
open.value = true;
|
||||
title.value = "添加部门";
|
||||
open.value = true
|
||||
title.value = "添加部门"
|
||||
}
|
||||
|
||||
/** 展开/折叠操作 */
|
||||
function toggleExpandAll() {
|
||||
refreshTable.value = false;
|
||||
isExpandAll.value = !isExpandAll.value;
|
||||
refreshTable.value = false
|
||||
isExpandAll.value = !isExpandAll.value
|
||||
nextTick(() => {
|
||||
refreshTable.value = true;
|
||||
});
|
||||
refreshTable.value = true
|
||||
})
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
reset()
|
||||
listDeptExcludeChild(row.deptId).then(response => {
|
||||
deptOptions.value = proxy.handleTree(response.data, "deptId");
|
||||
});
|
||||
deptOptions.value = proxy.handleTree(response.data, "deptId")
|
||||
})
|
||||
getDept(row.deptId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改部门";
|
||||
});
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改部门"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -254,30 +254,30 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.deptId != undefined) {
|
||||
updateDept(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addDept(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
proxy.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?').then(function() {
|
||||
return delDept(row.deptId);
|
||||
return delDept(row.deptId)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -177,24 +177,24 @@
|
||||
|
||||
<script setup name="Data">
|
||||
import useDictStore from '@/store/modules/dict'
|
||||
import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type";
|
||||
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
|
||||
import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type"
|
||||
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
|
||||
|
||||
const dataList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const defaultDictType = ref("");
|
||||
const typeOptions = ref([]);
|
||||
const route = useRoute();
|
||||
const dataList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const defaultDictType = ref("")
|
||||
const typeOptions = ref([])
|
||||
const route = useRoute()
|
||||
// 数据标签回显样式
|
||||
const listClassOptions = ref([
|
||||
{ value: "default", label: "默认" },
|
||||
@@ -203,7 +203,7 @@ const listClassOptions = ref([
|
||||
{ value: "info", label: "信息" },
|
||||
{ value: "warning", label: "警告" },
|
||||
{ value: "danger", label: "危险" }
|
||||
]);
|
||||
])
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -219,40 +219,40 @@ const data = reactive({
|
||||
dictValue: [{ required: true, message: "数据键值不能为空", trigger: "blur" }],
|
||||
dictSort: [{ required: true, message: "数据顺序不能为空", trigger: "blur" }]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询字典类型详细 */
|
||||
function getTypes(dictId) {
|
||||
getType(dictId).then(response => {
|
||||
queryParams.value.dictType = response.data.dictType;
|
||||
defaultDictType.value = response.data.dictType;
|
||||
getList();
|
||||
});
|
||||
queryParams.value.dictType = response.data.dictType
|
||||
defaultDictType.value = response.data.dictType
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询字典类型列表 */
|
||||
function getTypeList() {
|
||||
getDictOptionselect().then(response => {
|
||||
typeOptions.value = response.data;
|
||||
});
|
||||
typeOptions.value = response.data
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询字典数据列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listData(queryParams.value).then(response => {
|
||||
dataList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
dataList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -266,53 +266,53 @@ function reset() {
|
||||
dictSort: 0,
|
||||
status: "0",
|
||||
remark: undefined
|
||||
};
|
||||
proxy.resetForm("dataRef");
|
||||
}
|
||||
proxy.resetForm("dataRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 返回按钮操作 */
|
||||
function handleClose() {
|
||||
const obj = { path: "/system/dict" };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
const obj = { path: "/system/dict" }
|
||||
proxy.$tab.closeOpenPage(obj)
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
queryParams.value.dictType = defaultDictType.value;
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
queryParams.value.dictType = defaultDictType.value
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加字典数据";
|
||||
form.value.dictType = queryParams.value.dictType;
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加字典数据"
|
||||
form.value.dictType = queryParams.value.dictType
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.dictCode);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.dictCode)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const dictCode = row.dictCode || ids.value;
|
||||
reset()
|
||||
const dictCode = row.dictCode || ids.value
|
||||
getData(dictCode).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改字典数据";
|
||||
});
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改字典数据"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -321,42 +321,42 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.dictCode != undefined) {
|
||||
updateData(form.value).then(response => {
|
||||
useDictStore().removeDict(queryParams.value.dictType);
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
useDictStore().removeDict(queryParams.value.dictType)
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addData(form.value).then(response => {
|
||||
useDictStore().removeDict(queryParams.value.dictType);
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
useDictStore().removeDict(queryParams.value.dictType)
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const dictCodes = row.dictCode || ids.value;
|
||||
const dictCodes = row.dictCode || ids.value
|
||||
proxy.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
|
||||
return delData(dictCodes);
|
||||
return delData(dictCodes)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
useDictStore().removeDict(queryParams.value.dictType);
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
useDictStore().removeDict(queryParams.value.dictType)
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("system/dict/data/export", {
|
||||
...queryParams.value
|
||||
}, `dict_data_${new Date().getTime()}.xlsx`);
|
||||
}, `dict_data_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getTypes(route.params && route.params.dictId);
|
||||
getTypeList();
|
||||
getTypes(route.params && route.params.dictId)
|
||||
getTypeList()
|
||||
</script>
|
||||
|
||||
@@ -173,21 +173,21 @@
|
||||
|
||||
<script setup name="Dict">
|
||||
import useDictStore from '@/store/modules/dict'
|
||||
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
|
||||
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
|
||||
|
||||
const typeList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const typeList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const dateRange = ref([])
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -202,24 +202,24 @@ const data = reactive({
|
||||
dictName: [{ required: true, message: "字典名称不能为空", trigger: "blur" }],
|
||||
dictType: [{ required: true, message: "字典类型不能为空", trigger: "blur" }]
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询字典类型列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listType(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||
typeList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
typeList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -230,46 +230,46 @@ function reset() {
|
||||
dictType: undefined,
|
||||
status: "0",
|
||||
remark: undefined
|
||||
};
|
||||
proxy.resetForm("dictRef");
|
||||
}
|
||||
proxy.resetForm("dictRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加字典类型";
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加字典类型"
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.dictId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.dictId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const dictId = row.dictId || ids.value;
|
||||
reset()
|
||||
const dictId = row.dictId || ids.value
|
||||
getType(dictId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改字典类型";
|
||||
});
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改字典类型"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -278,46 +278,46 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.dictId != undefined) {
|
||||
updateType(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addType(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const dictIds = row.dictId || ids.value;
|
||||
const dictIds = row.dictId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
|
||||
return delType(dictIds);
|
||||
return delType(dictIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("system/dict/type/export", {
|
||||
...queryParams.value
|
||||
}, `dict_${new Date().getTime()}.xlsx`);
|
||||
}, `dict_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
/** 刷新缓存按钮操作 */
|
||||
function handleRefreshCache() {
|
||||
refreshCache().then(() => {
|
||||
proxy.$modal.msgSuccess("刷新成功");
|
||||
useDictStore().cleanDict();
|
||||
});
|
||||
proxy.$modal.msgSuccess("刷新成功")
|
||||
useDictStore().cleanDict()
|
||||
})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -289,22 +289,22 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Menu">
|
||||
import { addMenu, delMenu, getMenu, listMenu, updateMenu } from "@/api/system/menu";
|
||||
import SvgIcon from "@/components/SvgIcon";
|
||||
import IconSelect from "@/components/IconSelect";
|
||||
import { addMenu, delMenu, getMenu, listMenu, updateMenu } from "@/api/system/menu"
|
||||
import SvgIcon from "@/components/SvgIcon"
|
||||
import IconSelect from "@/components/IconSelect"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_show_hide, sys_normal_disable } = proxy.useDict("sys_show_hide", "sys_normal_disable");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_show_hide, sys_normal_disable } = proxy.useDict("sys_show_hide", "sys_normal_disable")
|
||||
|
||||
const menuList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const title = ref("");
|
||||
const menuOptions = ref([]);
|
||||
const isExpandAll = ref(false);
|
||||
const refreshTable = ref(true);
|
||||
const iconSelectRef = ref(null);
|
||||
const menuList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const title = ref("")
|
||||
const menuOptions = ref([])
|
||||
const isExpandAll = ref(false)
|
||||
const refreshTable = ref(true)
|
||||
const iconSelectRef = ref(null)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -317,33 +317,33 @@ const data = reactive({
|
||||
orderNum: [{ required: true, message: "菜单顺序不能为空", trigger: "blur" }],
|
||||
path: [{ required: true, message: "路由地址不能为空", trigger: "blur" }]
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询菜单列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listMenu(queryParams.value).then(response => {
|
||||
menuList.value = proxy.handleTree(response.data, "menuId");
|
||||
loading.value = false;
|
||||
});
|
||||
menuList.value = proxy.handleTree(response.data, "menuId")
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询菜单下拉树结构 */
|
||||
function getTreeselect() {
|
||||
menuOptions.value = [];
|
||||
menuOptions.value = []
|
||||
listMenu().then(response => {
|
||||
const menu = { menuId: 0, menuName: "主类目", children: [] };
|
||||
menu.children = proxy.handleTree(response.data, "menuId");
|
||||
menuOptions.value.push(menu);
|
||||
});
|
||||
const menu = { menuId: 0, menuName: "主类目", children: [] }
|
||||
menu.children = proxy.handleTree(response.data, "menuId")
|
||||
menuOptions.value.push(menu)
|
||||
})
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -359,62 +359,62 @@ function reset() {
|
||||
isCache: "0",
|
||||
visible: "0",
|
||||
status: "0"
|
||||
};
|
||||
proxy.resetForm("menuRef");
|
||||
}
|
||||
proxy.resetForm("menuRef")
|
||||
}
|
||||
|
||||
/** 展示下拉图标 */
|
||||
function showSelectIcon() {
|
||||
iconSelectRef.value.reset();
|
||||
iconSelectRef.value.reset()
|
||||
}
|
||||
|
||||
/** 选择图标 */
|
||||
function selected(name) {
|
||||
form.value.icon = name;
|
||||
form.value.icon = name
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
getList();
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd(row) {
|
||||
reset();
|
||||
getTreeselect();
|
||||
reset()
|
||||
getTreeselect()
|
||||
if (row != null && row.menuId) {
|
||||
form.value.parentId = row.menuId;
|
||||
form.value.parentId = row.menuId
|
||||
} else {
|
||||
form.value.parentId = 0;
|
||||
form.value.parentId = 0
|
||||
}
|
||||
open.value = true;
|
||||
title.value = "添加菜单";
|
||||
open.value = true
|
||||
title.value = "添加菜单"
|
||||
}
|
||||
|
||||
/** 展开/折叠操作 */
|
||||
function toggleExpandAll() {
|
||||
refreshTable.value = false;
|
||||
isExpandAll.value = !isExpandAll.value;
|
||||
refreshTable.value = false
|
||||
isExpandAll.value = !isExpandAll.value
|
||||
nextTick(() => {
|
||||
refreshTable.value = true;
|
||||
});
|
||||
refreshTable.value = true
|
||||
})
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
async function handleUpdate(row) {
|
||||
reset();
|
||||
await getTreeselect();
|
||||
reset()
|
||||
await getTreeselect()
|
||||
getMenu(row.menuId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改菜单";
|
||||
});
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改菜单"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -423,30 +423,30 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.menuId != undefined) {
|
||||
updateMenu(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addMenu(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
proxy.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?').then(function() {
|
||||
return delMenu(row.menuId);
|
||||
return delMenu(row.menuId)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -159,20 +159,20 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Notice">
|
||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
|
||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_notice_status, sys_notice_type } = proxy.useDict("sys_notice_status", "sys_notice_type");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_notice_status, sys_notice_type } = proxy.useDict("sys_notice_status", "sys_notice_type")
|
||||
|
||||
const noticeList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const noticeList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -187,24 +187,24 @@ const data = reactive({
|
||||
noticeTitle: [{ required: true, message: "公告标题不能为空", trigger: "blur" }],
|
||||
noticeType: [{ required: true, message: "公告类型不能为空", trigger: "change" }]
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询公告列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listNotice(queryParams.value).then(response => {
|
||||
noticeList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
noticeList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -215,45 +215,45 @@ function reset() {
|
||||
noticeType: undefined,
|
||||
noticeContent: undefined,
|
||||
status: "0"
|
||||
};
|
||||
proxy.resetForm("noticeRef");
|
||||
}
|
||||
proxy.resetForm("noticeRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.noticeId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.noticeId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加公告";
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加公告"
|
||||
}
|
||||
|
||||
/**修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const noticeId = row.noticeId || ids.value;
|
||||
reset()
|
||||
const noticeId = row.noticeId || ids.value
|
||||
getNotice(noticeId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改公告";
|
||||
});
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改公告"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -262,31 +262,31 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.noticeId != undefined) {
|
||||
updateNotice(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addNotice(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const noticeIds = row.noticeId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() {
|
||||
return delNotice(noticeIds);
|
||||
return delNotice(noticeIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -145,20 +145,20 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Post">
|
||||
import { listPost, addPost, delPost, getPost, updatePost } from "@/api/system/post";
|
||||
import { listPost, addPost, delPost, getPost, updatePost } from "@/api/system/post"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
|
||||
|
||||
const postList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const postList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -174,24 +174,24 @@ const data = reactive({
|
||||
postCode: [{ required: true, message: "岗位编码不能为空", trigger: "blur" }],
|
||||
postSort: [{ required: true, message: "岗位顺序不能为空", trigger: "blur" }],
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询岗位列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listPost(queryParams.value).then(response => {
|
||||
postList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
postList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
@@ -203,45 +203,45 @@ function reset() {
|
||||
postSort: 0,
|
||||
status: "0",
|
||||
remark: undefined
|
||||
};
|
||||
proxy.resetForm("postRef");
|
||||
}
|
||||
proxy.resetForm("postRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.postId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.postId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加岗位";
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加岗位"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const postId = row.postId || ids.value;
|
||||
reset()
|
||||
const postId = row.postId || ids.value
|
||||
getPost(postId).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改岗位";
|
||||
});
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改岗位"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -250,38 +250,38 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.postId != undefined) {
|
||||
updatePost(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addPost(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const postIds = row.postId || ids.value;
|
||||
const postIds = row.postId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?').then(function() {
|
||||
return delPost(postIds);
|
||||
return delPost(postIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("system/post/export", {
|
||||
...queryParams.value
|
||||
}, `post_${new Date().getTime()}.xlsx`);
|
||||
}, `post_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -92,19 +92,19 @@
|
||||
</template>
|
||||
|
||||
<script setup name="AuthUser">
|
||||
import selectUser from "./selectUser";
|
||||
import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role";
|
||||
import selectUser from "./selectUser"
|
||||
import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role"
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const route = useRoute()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
|
||||
|
||||
const userList = ref([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const userIds = ref([]);
|
||||
const userList = ref([])
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const userIds = ref([])
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
@@ -112,68 +112,68 @@ const queryParams = reactive({
|
||||
roleId: route.params.roleId,
|
||||
userName: undefined,
|
||||
phonenumber: undefined,
|
||||
});
|
||||
})
|
||||
|
||||
/** 查询授权用户列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
allocatedUserList(queryParams).then(response => {
|
||||
userList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
userList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 返回按钮 */
|
||||
function handleClose() {
|
||||
const obj = { path: "/system/role" };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
const obj = { path: "/system/role" }
|
||||
proxy.$tab.closeOpenPage(obj)
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
userIds.value = selection.map(item => item.userId);
|
||||
multiple.value = !selection.length;
|
||||
userIds.value = selection.map(item => item.userId)
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 打开授权用户表弹窗 */
|
||||
function openSelectUser() {
|
||||
proxy.$refs["selectRef"].show();
|
||||
proxy.$refs["selectRef"].show()
|
||||
}
|
||||
|
||||
/** 取消授权按钮操作 */
|
||||
function cancelAuthUser(row) {
|
||||
proxy.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?').then(function () {
|
||||
return authUserCancel({ userId: row.userId, roleId: queryParams.roleId });
|
||||
return authUserCancel({ userId: row.userId, roleId: queryParams.roleId })
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("取消授权成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("取消授权成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 批量取消授权按钮操作 */
|
||||
function cancelAuthUserAll(row) {
|
||||
const roleId = queryParams.roleId;
|
||||
const uIds = userIds.value.join(",");
|
||||
const roleId = queryParams.roleId
|
||||
const uIds = userIds.value.join(",")
|
||||
proxy.$modal.confirm("是否取消选中用户授权数据项?").then(function () {
|
||||
return authUserCancelAll({ roleId: roleId, userIds: uIds });
|
||||
return authUserCancelAll({ roleId: roleId, userIds: uIds })
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("取消授权成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("取消授权成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
+138
-138
@@ -242,32 +242,32 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Role">
|
||||
import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role";
|
||||
import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu";
|
||||
import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role"
|
||||
import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu"
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
|
||||
|
||||
const roleList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const menuOptions = ref([]);
|
||||
const menuExpand = ref(false);
|
||||
const menuNodeAll = ref(false);
|
||||
const deptExpand = ref(true);
|
||||
const deptNodeAll = ref(false);
|
||||
const deptOptions = ref([]);
|
||||
const openDataScope = ref(false);
|
||||
const menuRef = ref(null);
|
||||
const deptRef = ref(null);
|
||||
const roleList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const dateRange = ref([])
|
||||
const menuOptions = ref([])
|
||||
const menuExpand = ref(false)
|
||||
const menuNodeAll = ref(false)
|
||||
const deptExpand = ref(true)
|
||||
const deptNodeAll = ref(false)
|
||||
const deptOptions = ref([])
|
||||
const openDataScope = ref(false)
|
||||
const menuRef = ref(null)
|
||||
const deptRef = ref(null)
|
||||
|
||||
/** 数据范围选项*/
|
||||
const dataScopeOptions = ref([
|
||||
@@ -276,7 +276,7 @@ const dataScopeOptions = ref([
|
||||
{ value: "3", label: "本部门数据权限" },
|
||||
{ value: "4", label: "本部门及以下数据权限" },
|
||||
{ value: "5", label: "仅本人数据权限" }
|
||||
]);
|
||||
])
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -292,115 +292,115 @@ const data = reactive({
|
||||
roleKey: [{ required: true, message: "权限字符不能为空", trigger: "blur" }],
|
||||
roleSort: [{ required: true, message: "角色顺序不能为空", trigger: "blur" }]
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询角色列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listRole(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||
roleList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
roleList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const roleIds = row.roleId || ids.value;
|
||||
const roleIds = row.roleId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?').then(function () {
|
||||
return delRole(roleIds);
|
||||
return delRole(roleIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("system/role/export", {
|
||||
...queryParams.value,
|
||||
}, `role_${new Date().getTime()}.xlsx`);
|
||||
}, `role_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.roleId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.roleId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 角色状态修改 */
|
||||
function handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
proxy.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?').then(function () {
|
||||
return changeRoleStatus(row.roleId, row.status);
|
||||
return changeRoleStatus(row.roleId, row.status)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess(text + "成功");
|
||||
proxy.$modal.msgSuccess(text + "成功")
|
||||
}).catch(function () {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
row.status = row.status === "0" ? "1" : "0"
|
||||
})
|
||||
}
|
||||
|
||||
/** 更多操作 */
|
||||
function handleCommand(command, row) {
|
||||
switch (command) {
|
||||
case "handleDataScope":
|
||||
handleDataScope(row);
|
||||
break;
|
||||
handleDataScope(row)
|
||||
break
|
||||
case "handleAuthUser":
|
||||
handleAuthUser(row);
|
||||
break;
|
||||
handleAuthUser(row)
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/** 分配用户 */
|
||||
function handleAuthUser(row) {
|
||||
router.push("/system/role-auth/user/" + row.roleId);
|
||||
router.push("/system/role-auth/user/" + row.roleId)
|
||||
}
|
||||
|
||||
/** 查询菜单树结构 */
|
||||
function getMenuTreeselect() {
|
||||
menuTreeselect().then(response => {
|
||||
menuOptions.value = response.data;
|
||||
});
|
||||
menuOptions.value = response.data
|
||||
})
|
||||
}
|
||||
|
||||
/** 所有部门节点数据 */
|
||||
function getDeptAllCheckedKeys() {
|
||||
// 目前被选中的部门节点
|
||||
let checkedKeys = deptRef.value.getCheckedKeys();
|
||||
let checkedKeys = deptRef.value.getCheckedKeys()
|
||||
// 半选中的部门节点
|
||||
let halfCheckedKeys = deptRef.value.getHalfCheckedKeys();
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
|
||||
return checkedKeys;
|
||||
let halfCheckedKeys = deptRef.value.getHalfCheckedKeys()
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
|
||||
return checkedKeys
|
||||
}
|
||||
|
||||
/** 重置新增的表单以及其他数据 */
|
||||
function reset() {
|
||||
if (menuRef.value != undefined) {
|
||||
menuRef.value.setCheckedKeys([]);
|
||||
menuRef.value.setCheckedKeys([])
|
||||
}
|
||||
menuExpand.value = false;
|
||||
menuNodeAll.value = false;
|
||||
deptExpand.value = true;
|
||||
deptNodeAll.value = false;
|
||||
menuExpand.value = false
|
||||
menuNodeAll.value = false
|
||||
deptExpand.value = true
|
||||
deptNodeAll.value = false
|
||||
form.value = {
|
||||
roleId: undefined,
|
||||
roleName: undefined,
|
||||
@@ -412,68 +412,68 @@ function reset() {
|
||||
menuCheckStrictly: true,
|
||||
deptCheckStrictly: true,
|
||||
remark: undefined
|
||||
};
|
||||
proxy.resetForm("roleRef");
|
||||
}
|
||||
proxy.resetForm("roleRef")
|
||||
}
|
||||
|
||||
/** 添加角色 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
getMenuTreeselect();
|
||||
open.value = true;
|
||||
title.value = "添加角色";
|
||||
reset()
|
||||
getMenuTreeselect()
|
||||
open.value = true
|
||||
title.value = "添加角色"
|
||||
}
|
||||
|
||||
/** 修改角色 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const roleId = row.roleId || ids.value;
|
||||
const roleMenu = getRoleMenuTreeselect(roleId);
|
||||
reset()
|
||||
const roleId = row.roleId || ids.value
|
||||
const roleMenu = getRoleMenuTreeselect(roleId)
|
||||
getRole(roleId).then(response => {
|
||||
form.value = response.data;
|
||||
form.value.roleSort = Number(form.value.roleSort);
|
||||
open.value = true;
|
||||
form.value = response.data
|
||||
form.value.roleSort = Number(form.value.roleSort)
|
||||
open.value = true
|
||||
nextTick(() => {
|
||||
roleMenu.then((res) => {
|
||||
let checkedKeys = res.checkedKeys;
|
||||
let checkedKeys = res.checkedKeys
|
||||
checkedKeys.forEach((v) => {
|
||||
nextTick(() => {
|
||||
menuRef.value.setChecked(v, true, false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
title.value = "修改角色";
|
||||
menuRef.value.setChecked(v, true, false)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
title.value = "修改角色"
|
||||
}
|
||||
|
||||
/** 根据角色ID查询菜单树结构 */
|
||||
function getRoleMenuTreeselect(roleId) {
|
||||
return roleMenuTreeselect(roleId).then(response => {
|
||||
menuOptions.value = response.menus;
|
||||
return response;
|
||||
});
|
||||
menuOptions.value = response.menus
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
/** 根据角色ID查询部门树结构 */
|
||||
function getDeptTree(roleId) {
|
||||
return deptTreeSelect(roleId).then(response => {
|
||||
deptOptions.value = response.depts;
|
||||
return response;
|
||||
});
|
||||
deptOptions.value = response.depts
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
/** 树权限(展开/折叠)*/
|
||||
function handleCheckedTreeExpand(value, type) {
|
||||
if (type == "menu") {
|
||||
let treeList = menuOptions.value;
|
||||
let treeList = menuOptions.value
|
||||
for (let i = 0; i < treeList.length; i++) {
|
||||
menuRef.value.store.nodesMap[treeList[i].id].expanded = value;
|
||||
menuRef.value.store.nodesMap[treeList[i].id].expanded = value
|
||||
}
|
||||
} else if (type == "dept") {
|
||||
let treeList = deptOptions.value;
|
||||
let treeList = deptOptions.value
|
||||
for (let i = 0; i < treeList.length; i++) {
|
||||
deptRef.value.store.nodesMap[treeList[i].id].expanded = value;
|
||||
deptRef.value.store.nodesMap[treeList[i].id].expanded = value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,29 +481,29 @@ function handleCheckedTreeExpand(value, type) {
|
||||
/** 树权限(全选/全不选) */
|
||||
function handleCheckedTreeNodeAll(value, type) {
|
||||
if (type == "menu") {
|
||||
menuRef.value.setCheckedNodes(value ? menuOptions.value : []);
|
||||
menuRef.value.setCheckedNodes(value ? menuOptions.value : [])
|
||||
} else if (type == "dept") {
|
||||
deptRef.value.setCheckedNodes(value ? deptOptions.value : []);
|
||||
deptRef.value.setCheckedNodes(value ? deptOptions.value : [])
|
||||
}
|
||||
}
|
||||
|
||||
/** 树权限(父子联动) */
|
||||
function handleCheckedTreeConnect(value, type) {
|
||||
if (type == "menu") {
|
||||
form.value.menuCheckStrictly = value ? true : false;
|
||||
form.value.menuCheckStrictly = value ? true : false
|
||||
} else if (type == "dept") {
|
||||
form.value.deptCheckStrictly = value ? true : false;
|
||||
form.value.deptCheckStrictly = value ? true : false
|
||||
}
|
||||
}
|
||||
|
||||
/** 所有菜单节点数据 */
|
||||
function getMenuAllCheckedKeys() {
|
||||
// 目前被选中的菜单节点
|
||||
let checkedKeys = menuRef.value.getCheckedKeys();
|
||||
let checkedKeys = menuRef.value.getCheckedKeys()
|
||||
// 半选中的菜单节点
|
||||
let halfCheckedKeys = menuRef.value.getHalfCheckedKeys();
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
|
||||
return checkedKeys;
|
||||
let halfCheckedKeys = menuRef.value.getHalfCheckedKeys()
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
|
||||
return checkedKeys
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
@@ -511,74 +511,74 @@ function submitForm() {
|
||||
proxy.$refs["roleRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.roleId != undefined) {
|
||||
form.value.menuIds = getMenuAllCheckedKeys();
|
||||
form.value.menuIds = getMenuAllCheckedKeys()
|
||||
updateRole(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
form.value.menuIds = getMenuAllCheckedKeys();
|
||||
form.value.menuIds = getMenuAllCheckedKeys()
|
||||
addRole(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 选择角色权限范围触发 */
|
||||
function dataScopeSelectChange(value) {
|
||||
if (value !== "2") {
|
||||
deptRef.value.setCheckedKeys([]);
|
||||
deptRef.value.setCheckedKeys([])
|
||||
}
|
||||
}
|
||||
|
||||
/** 分配数据权限操作 */
|
||||
function handleDataScope(row) {
|
||||
reset();
|
||||
const deptTreeSelect = getDeptTree(row.roleId);
|
||||
reset()
|
||||
const deptTreeSelect = getDeptTree(row.roleId)
|
||||
getRole(row.roleId).then(response => {
|
||||
form.value = response.data;
|
||||
openDataScope.value = true;
|
||||
form.value = response.data
|
||||
openDataScope.value = true
|
||||
nextTick(() => {
|
||||
deptTreeSelect.then(res => {
|
||||
nextTick(() => {
|
||||
if (deptRef.value) {
|
||||
deptRef.value.setCheckedKeys(res.checkedKeys);
|
||||
deptRef.value.setCheckedKeys(res.checkedKeys)
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
title.value = "分配数据权限";
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
title.value = "分配数据权限"
|
||||
}
|
||||
|
||||
/** 提交按钮(数据权限) */
|
||||
function submitDataScope() {
|
||||
if (form.value.roleId != undefined) {
|
||||
form.value.deptIds = getDeptAllCheckedKeys();
|
||||
form.value.deptIds = getDeptAllCheckedKeys()
|
||||
dataScope(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
openDataScope.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
openDataScope.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/** 取消按钮(数据权限)*/
|
||||
function cancelDataScope() {
|
||||
openDataScope.value = false;
|
||||
reset();
|
||||
openDataScope.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -61,21 +61,21 @@
|
||||
</template>
|
||||
|
||||
<script setup name="SelectUser">
|
||||
import { authUserSelectAll, unallocatedUserList } from "@/api/system/role";
|
||||
import { authUserSelectAll, unallocatedUserList } from "@/api/system/role"
|
||||
|
||||
const props = defineProps({
|
||||
roleId: {
|
||||
type: [Number, String]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable")
|
||||
|
||||
const userList = ref([]);
|
||||
const visible = ref(false);
|
||||
const total = ref(0);
|
||||
const userIds = ref([]);
|
||||
const userList = ref([])
|
||||
const visible = ref(false)
|
||||
const total = ref(0)
|
||||
const userIds = ref([])
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
@@ -83,62 +83,62 @@ const queryParams = reactive({
|
||||
roleId: undefined,
|
||||
userName: undefined,
|
||||
phonenumber: undefined
|
||||
});
|
||||
})
|
||||
|
||||
// 显示弹框
|
||||
function show() {
|
||||
queryParams.roleId = props.roleId;
|
||||
getList();
|
||||
visible.value = true;
|
||||
queryParams.roleId = props.roleId
|
||||
getList()
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
/**选择行 */
|
||||
function clickRow(row) {
|
||||
proxy.$refs["refTable"].toggleRowSelection(row);
|
||||
proxy.$refs["refTable"].toggleRowSelection(row)
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
userIds.value = selection.map(item => item.userId);
|
||||
userIds.value = selection.map(item => item.userId)
|
||||
}
|
||||
|
||||
// 查询表数据
|
||||
function getList() {
|
||||
unallocatedUserList(queryParams).then(res => {
|
||||
userList.value = res.rows;
|
||||
total.value = res.total;
|
||||
});
|
||||
userList.value = res.rows
|
||||
total.value = res.total
|
||||
})
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const emit = defineEmits(["ok"]);
|
||||
const emit = defineEmits(["ok"])
|
||||
/** 选择授权用户操作 */
|
||||
function handleSelectUser() {
|
||||
const roleId = queryParams.roleId;
|
||||
const uIds = userIds.value.join(",");
|
||||
const roleId = queryParams.roleId
|
||||
const uIds = userIds.value.join(",")
|
||||
if (uIds == "") {
|
||||
proxy.$modal.msgError("请选择要分配的用户");
|
||||
return;
|
||||
proxy.$modal.msgError("请选择要分配的用户")
|
||||
return
|
||||
}
|
||||
authUserSelectAll({ roleId: roleId, userIds: uIds }).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
visible.value = false;
|
||||
emit("ok");
|
||||
});
|
||||
proxy.$modal.msgSuccess(res.msg)
|
||||
visible.value = false
|
||||
emit("ok")
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -46,78 +46,78 @@
|
||||
</template>
|
||||
|
||||
<script setup name="AuthRole">
|
||||
import { getAuthRole, updateAuthRole } from "@/api/system/user";
|
||||
import { getAuthRole, updateAuthRole } from "@/api/system/user"
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const route = useRoute()
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const loading = ref(true);
|
||||
const total = ref(0);
|
||||
const pageNum = ref(1);
|
||||
const pageSize = ref(10);
|
||||
const roleIds = ref([]);
|
||||
const roles = ref([]);
|
||||
const loading = ref(true)
|
||||
const total = ref(0)
|
||||
const pageNum = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const roleIds = ref([])
|
||||
const roles = ref([])
|
||||
const form = ref({
|
||||
nickName: undefined,
|
||||
userName: undefined,
|
||||
userId: undefined
|
||||
});
|
||||
})
|
||||
|
||||
/** 单击选中行数据 */
|
||||
function clickRow(row) {
|
||||
if (checkSelectable(row)) {
|
||||
proxy.$refs["roleRef"].toggleRowSelection(row);
|
||||
proxy.$refs["roleRef"].toggleRowSelection(row)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
roleIds.value = selection.map(item => item.roleId);
|
||||
};
|
||||
roleIds.value = selection.map(item => item.roleId)
|
||||
}
|
||||
|
||||
/** 保存选中的数据编号 */
|
||||
function getRowKey(row) {
|
||||
return row.roleId;
|
||||
};
|
||||
return row.roleId
|
||||
}
|
||||
|
||||
// 检查角色状态
|
||||
function checkSelectable(row) {
|
||||
return row.status === "0" ? true : false;
|
||||
};
|
||||
return row.status === "0" ? true : false
|
||||
}
|
||||
|
||||
/** 关闭按钮 */
|
||||
function close() {
|
||||
const obj = { path: "/system/user" };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
};
|
||||
const obj = { path: "/system/user" }
|
||||
proxy.$tab.closeOpenPage(obj)
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
const userId = form.value.userId;
|
||||
const rIds = roleIds.value.join(",");
|
||||
const userId = form.value.userId
|
||||
const rIds = roleIds.value.join(",")
|
||||
updateAuthRole({ userId: userId, roleIds: rIds }).then(response => {
|
||||
proxy.$modal.msgSuccess("授权成功");
|
||||
close();
|
||||
});
|
||||
};
|
||||
proxy.$modal.msgSuccess("授权成功")
|
||||
close()
|
||||
})
|
||||
}
|
||||
|
||||
(() => {
|
||||
const userId = route.params && route.params.userId;
|
||||
const userId = route.params && route.params.userId
|
||||
if (userId) {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
getAuthRole(userId).then(response => {
|
||||
form.value = response.user;
|
||||
roles.value = response.roles;
|
||||
total.value = roles.value.length;
|
||||
form.value = response.user
|
||||
roles.value = response.roles
|
||||
total.value = roles.value.length
|
||||
nextTick(() => {
|
||||
roles.value.forEach(row => {
|
||||
if (row.flag) {
|
||||
proxy.$refs["roleRef"].toggleRowSelection(row);
|
||||
proxy.$refs["roleRef"].toggleRowSelection(row)
|
||||
}
|
||||
});
|
||||
});
|
||||
loading.value = false;
|
||||
});
|
||||
})
|
||||
})
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
})();
|
||||
})()
|
||||
</script>
|
||||
|
||||
+141
-141
@@ -214,33 +214,33 @@
|
||||
</template>
|
||||
|
||||
<script setup name="User">
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { getToken } from "@/utils/auth"
|
||||
import useAppStore from '@/store/modules/app'
|
||||
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user";
|
||||
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user"
|
||||
import { Splitpanes, Pane } from "splitpanes"
|
||||
import "splitpanes/dist/splitpanes.css"
|
||||
|
||||
const router = useRouter();
|
||||
const router = useRouter()
|
||||
const appStore = useAppStore()
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex");
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex")
|
||||
|
||||
const userList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const deptName = ref("");
|
||||
const deptOptions = ref(undefined);
|
||||
const enabledDeptOptions = ref(undefined);
|
||||
const initPassword = ref(undefined);
|
||||
const postOptions = ref([]);
|
||||
const roleOptions = ref([]);
|
||||
const userList = ref([])
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
const dateRange = ref([])
|
||||
const deptName = ref("")
|
||||
const deptOptions = ref(undefined)
|
||||
const enabledDeptOptions = ref(undefined)
|
||||
const initPassword = ref(undefined)
|
||||
const postOptions = ref([])
|
||||
const roleOptions = ref([])
|
||||
/*** 用户导入参数 */
|
||||
const upload = reactive({
|
||||
// 是否显示弹出层(用户导入)
|
||||
@@ -255,7 +255,7 @@ const upload = reactive({
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData"
|
||||
});
|
||||
})
|
||||
// 列显隐信息
|
||||
const columns = ref([
|
||||
{ key: 0, label: `用户编号`, visible: true },
|
||||
@@ -265,7 +265,7 @@ const columns = ref([
|
||||
{ key: 4, label: `手机号码`, visible: true },
|
||||
{ key: 5, label: `状态`, visible: true },
|
||||
{ key: 6, label: `创建时间`, visible: true }
|
||||
]);
|
||||
])
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
@@ -284,122 +284,122 @@ const data = reactive({
|
||||
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
|
||||
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 通过条件过滤节点 */
|
||||
const filterNode = (value, data) => {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
};
|
||||
if (!value) return true
|
||||
return data.label.indexOf(value) !== -1
|
||||
}
|
||||
|
||||
/** 根据名称筛选部门树 */
|
||||
watch(deptName, val => {
|
||||
proxy.$refs["deptTreeRef"].filter(val);
|
||||
});
|
||||
proxy.$refs["deptTreeRef"].filter(val)
|
||||
})
|
||||
|
||||
/** 查询用户列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
||||
loading.value = false;
|
||||
userList.value = res.rows;
|
||||
total.value = res.total;
|
||||
});
|
||||
};
|
||||
loading.value = false
|
||||
userList.value = res.rows
|
||||
total.value = res.total
|
||||
})
|
||||
}
|
||||
|
||||
/** 查询部门下拉树结构 */
|
||||
function getDeptTree() {
|
||||
deptTreeSelect().then(response => {
|
||||
deptOptions.value = response.data;
|
||||
enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)));
|
||||
});
|
||||
};
|
||||
deptOptions.value = response.data
|
||||
enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
|
||||
})
|
||||
}
|
||||
|
||||
/** 过滤禁用的部门 */
|
||||
function filterDisabledDept(deptList) {
|
||||
return deptList.filter(dept => {
|
||||
if (dept.disabled) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
if (dept.children && dept.children.length) {
|
||||
dept.children = filterDisabledDept(dept.children);
|
||||
dept.children = filterDisabledDept(dept.children)
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
/** 节点单击事件 */
|
||||
function handleNodeClick(data) {
|
||||
queryParams.value.deptId = data.id;
|
||||
handleQuery();
|
||||
};
|
||||
queryParams.value.deptId = data.id
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
queryParams.value.deptId = undefined;
|
||||
proxy.$refs.deptTreeRef.setCurrentKey(null);
|
||||
handleQuery();
|
||||
};
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
queryParams.value.deptId = undefined
|
||||
proxy.$refs.deptTreeRef.setCurrentKey(null)
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const userIds = row.userId || ids.value;
|
||||
const userIds = row.userId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () {
|
||||
return delUser(userIds);
|
||||
return delUser(userIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
};
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download("system/user/export", {
|
||||
...queryParams.value,
|
||||
},`user_${new Date().getTime()}.xlsx`);
|
||||
};
|
||||
},`user_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
/** 用户状态修改 */
|
||||
function handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
let text = row.status === "0" ? "启用" : "停用"
|
||||
proxy.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
|
||||
return changeUserStatus(row.userId, row.status);
|
||||
return changeUserStatus(row.userId, row.status)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess(text + "成功");
|
||||
proxy.$modal.msgSuccess(text + "成功")
|
||||
}).catch(function () {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
};
|
||||
row.status = row.status === "0" ? "1" : "0"
|
||||
})
|
||||
}
|
||||
|
||||
/** 更多操作 */
|
||||
function handleCommand(command, row) {
|
||||
switch (command) {
|
||||
case "handleResetPwd":
|
||||
handleResetPwd(row);
|
||||
break;
|
||||
handleResetPwd(row)
|
||||
break
|
||||
case "handleAuthRole":
|
||||
handleAuthRole(row);
|
||||
break;
|
||||
handleAuthRole(row)
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** 跳转角色分配 */
|
||||
function handleAuthRole(row) {
|
||||
const userId = row.userId;
|
||||
router.push("/system/user-auth/role/" + userId);
|
||||
};
|
||||
const userId = row.userId
|
||||
router.push("/system/user-auth/role/" + userId)
|
||||
}
|
||||
|
||||
/** 重置密码按钮操作 */
|
||||
function handleResetPwd(row) {
|
||||
@@ -416,48 +416,48 @@ function handleResetPwd(row) {
|
||||
},
|
||||
}).then(({ value }) => {
|
||||
resetUserPwd(row.userId, value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||
});
|
||||
}).catch(() => {});
|
||||
};
|
||||
proxy.$modal.msgSuccess("修改成功,新密码是:" + value)
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 选择条数 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.userId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
ids.value = selection.map(item => item.userId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImport() {
|
||||
upload.title = "用户导入";
|
||||
upload.open = true;
|
||||
};
|
||||
upload.title = "用户导入"
|
||||
upload.open = true
|
||||
}
|
||||
|
||||
/** 下载模板操作 */
|
||||
function importTemplate() {
|
||||
proxy.download("system/user/importTemplate", {
|
||||
}, `user_template_${new Date().getTime()}.xlsx`);
|
||||
};
|
||||
}, `user_template_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
/**文件上传中处理 */
|
||||
const handleFileUploadProgress = (event, file, fileList) => {
|
||||
upload.isUploading = true;
|
||||
};
|
||||
upload.isUploading = true
|
||||
}
|
||||
|
||||
/** 文件上传成功处理 */
|
||||
const handleFileSuccess = (response, file, fileList) => {
|
||||
upload.open = false;
|
||||
upload.isUploading = false;
|
||||
proxy.$refs["uploadRef"].handleRemove(file);
|
||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
||||
getList();
|
||||
};
|
||||
upload.open = false
|
||||
upload.isUploading = false
|
||||
proxy.$refs["uploadRef"].handleRemove(file)
|
||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 提交上传文件 */
|
||||
function submitFileForm() {
|
||||
proxy.$refs["uploadRef"].submit();
|
||||
};
|
||||
proxy.$refs["uploadRef"].submit()
|
||||
}
|
||||
|
||||
/** 重置操作表单 */
|
||||
function reset() {
|
||||
@@ -474,43 +474,43 @@ function reset() {
|
||||
remark: undefined,
|
||||
postIds: [],
|
||||
roleIds: []
|
||||
};
|
||||
proxy.resetForm("userRef");
|
||||
};
|
||||
}
|
||||
proxy.resetForm("userRef")
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
};
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
reset()
|
||||
getUser().then(response => {
|
||||
postOptions.value = response.posts;
|
||||
roleOptions.value = response.roles;
|
||||
open.value = true;
|
||||
title.value = "添加用户";
|
||||
form.value.password = initPassword.value;
|
||||
});
|
||||
};
|
||||
postOptions.value = response.posts
|
||||
roleOptions.value = response.roles
|
||||
open.value = true
|
||||
title.value = "添加用户"
|
||||
form.value.password = initPassword.value
|
||||
})
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const userId = row.userId || ids.value;
|
||||
reset()
|
||||
const userId = row.userId || ids.value
|
||||
getUser(userId).then(response => {
|
||||
form.value = response.data;
|
||||
postOptions.value = response.posts;
|
||||
roleOptions.value = response.roles;
|
||||
form.value.postIds = response.postIds;
|
||||
form.value.roleIds = response.roleIds;
|
||||
open.value = true;
|
||||
title.value = "修改用户";
|
||||
form.password = "";
|
||||
});
|
||||
};
|
||||
form.value = response.data
|
||||
postOptions.value = response.posts
|
||||
roleOptions.value = response.roles
|
||||
form.value.postIds = response.postIds
|
||||
form.value.roleIds = response.roleIds
|
||||
open.value = true
|
||||
title.value = "修改用户"
|
||||
form.password = ""
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
@@ -518,21 +518,21 @@ function submitForm() {
|
||||
if (valid) {
|
||||
if (form.value.userId != undefined) {
|
||||
updateUser(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addUser(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
getDeptTree();
|
||||
getList();
|
||||
getDeptTree()
|
||||
getList()
|
||||
</script>
|
||||
|
||||
@@ -63,25 +63,25 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Profile">
|
||||
import userAvatar from "./userAvatar";
|
||||
import userInfo from "./userInfo";
|
||||
import resetPwd from "./resetPwd";
|
||||
import { getUserProfile } from "@/api/system/user";
|
||||
import userAvatar from "./userAvatar"
|
||||
import userInfo from "./userInfo"
|
||||
import resetPwd from "./resetPwd"
|
||||
import { getUserProfile } from "@/api/system/user"
|
||||
|
||||
const activeTab = ref("userinfo");
|
||||
const activeTab = ref("userinfo")
|
||||
const state = reactive({
|
||||
user: {},
|
||||
roleGroup: {},
|
||||
postGroup: {}
|
||||
});
|
||||
})
|
||||
|
||||
function getUser() {
|
||||
getUserProfile().then(response => {
|
||||
state.user = response.data;
|
||||
state.roleGroup = response.roleGroup;
|
||||
state.postGroup = response.postGroup;
|
||||
});
|
||||
};
|
||||
state.user = response.data
|
||||
state.roleGroup = response.roleGroup
|
||||
state.postGroup = response.postGroup
|
||||
})
|
||||
}
|
||||
|
||||
getUser();
|
||||
getUser()
|
||||
</script>
|
||||
|
||||
@@ -17,43 +17,43 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { updateUserPwd } from "@/api/system/user";
|
||||
import { updateUserPwd } from "@/api/system/user"
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const user = reactive({
|
||||
oldPassword: undefined,
|
||||
newPassword: undefined,
|
||||
confirmPassword: undefined
|
||||
});
|
||||
})
|
||||
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (user.newPassword !== value) {
|
||||
callback(new Error("两次输入的密码不一致"));
|
||||
callback(new Error("两次输入的密码不一致"))
|
||||
} else {
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const rules = ref({
|
||||
oldPassword: [{ required: true, message: "旧密码不能为空", trigger: "blur" }],
|
||||
newPassword: [{ required: true, message: "新密码不能为空", trigger: "blur" }, { min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }, { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }],
|
||||
confirmPassword: [{ required: true, message: "确认密码不能为空", trigger: "blur" }, { required: true, validator: equalToPassword, trigger: "blur" }]
|
||||
});
|
||||
})
|
||||
|
||||
/** 提交按钮 */
|
||||
function submit() {
|
||||
proxy.$refs.pwdRef.validate(valid => {
|
||||
if (valid) {
|
||||
updateUserPwd(user.oldPassword, user.newPassword).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 关闭按钮 */
|
||||
function close() {
|
||||
proxy.$tab.closePage();
|
||||
};
|
||||
proxy.$tab.closePage()
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -59,17 +59,17 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import "vue-cropper/dist/index.css";
|
||||
import { VueCropper } from "vue-cropper";
|
||||
import { uploadAvatar } from "@/api/system/user";
|
||||
import useUserStore from "@/store/modules/user";
|
||||
import "vue-cropper/dist/index.css"
|
||||
import { VueCropper } from "vue-cropper"
|
||||
import { uploadAvatar } from "@/api/system/user"
|
||||
import useUserStore from "@/store/modules/user"
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const userStore = useUserStore()
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const open = ref(false);
|
||||
const visible = ref(false);
|
||||
const title = ref("修改头像");
|
||||
const open = ref(false)
|
||||
const visible = ref(false)
|
||||
const title = ref("修改头像")
|
||||
|
||||
//图片裁剪数据
|
||||
const options = reactive({
|
||||
@@ -81,16 +81,16 @@ const options = reactive({
|
||||
outputType: "png", // 默认生成截图为PNG格式
|
||||
filename: 'avatar', // 文件名称
|
||||
previews: {} //预览数据
|
||||
});
|
||||
})
|
||||
|
||||
/** 编辑头像 */
|
||||
function editCropper() {
|
||||
open.value = true;
|
||||
open.value = true
|
||||
}
|
||||
|
||||
/** 打开弹出层结束时的回调 */
|
||||
function modalOpened() {
|
||||
visible.value = true;
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
/** 覆盖默认上传行为 */
|
||||
@@ -98,58 +98,58 @@ function requestUpload() {}
|
||||
|
||||
/** 向左旋转 */
|
||||
function rotateLeft() {
|
||||
proxy.$refs.cropper.rotateLeft();
|
||||
proxy.$refs.cropper.rotateLeft()
|
||||
}
|
||||
|
||||
/** 向右旋转 */
|
||||
function rotateRight() {
|
||||
proxy.$refs.cropper.rotateRight();
|
||||
proxy.$refs.cropper.rotateRight()
|
||||
}
|
||||
|
||||
/** 图片缩放 */
|
||||
function changeScale(num) {
|
||||
num = num || 1;
|
||||
proxy.$refs.cropper.changeScale(num);
|
||||
num = num || 1
|
||||
proxy.$refs.cropper.changeScale(num)
|
||||
}
|
||||
|
||||
/** 上传预处理 */
|
||||
function beforeUpload(file) {
|
||||
if (file.type.indexOf("image/") == -1) {
|
||||
proxy.$modal.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
|
||||
proxy.$modal.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。")
|
||||
} else {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
reader.onload = () => {
|
||||
options.img = reader.result;
|
||||
options.filename = file.name;
|
||||
};
|
||||
options.img = reader.result
|
||||
options.filename = file.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 上传图片 */
|
||||
function uploadImg() {
|
||||
proxy.$refs.cropper.getCropBlob(data => {
|
||||
let formData = new FormData();
|
||||
formData.append("avatarfile", data, options.filename);
|
||||
let formData = new FormData()
|
||||
formData.append("avatarfile", data, options.filename)
|
||||
uploadAvatar(formData).then(response => {
|
||||
open.value = false;
|
||||
options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl;
|
||||
userStore.avatar = options.img;
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
visible.value = false;
|
||||
});
|
||||
});
|
||||
open.value = false
|
||||
options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl
|
||||
userStore.avatar = options.img
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
visible.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/** 实时预览 */
|
||||
function realTime(data) {
|
||||
options.previews = data;
|
||||
options.previews = data
|
||||
}
|
||||
|
||||
/** 关闭窗口 */
|
||||
function closeDialog() {
|
||||
options.img = userStore.avatar;
|
||||
options.visible = false;
|
||||
options.img = userStore.avatar
|
||||
options.visible = false
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -23,45 +23,45 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { updateUserProfile } from "@/api/system/user";
|
||||
import { updateUserProfile } from "@/api/system/user"
|
||||
|
||||
const props = defineProps({
|
||||
user: {
|
||||
type: Object
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const form = ref({});
|
||||
const form = ref({})
|
||||
const rules = ref({
|
||||
nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
|
||||
email: [{ required: true, message: "邮箱地址不能为空", trigger: "blur" }, { type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
|
||||
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }],
|
||||
});
|
||||
})
|
||||
|
||||
/** 提交按钮 */
|
||||
function submit() {
|
||||
proxy.$refs.userRef.validate(valid => {
|
||||
if (valid) {
|
||||
updateUserProfile(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
props.user.phonenumber = form.value.phonenumber;
|
||||
props.user.email = form.value.email;
|
||||
});
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
props.user.phonenumber = form.value.phonenumber
|
||||
props.user.email = form.value.email
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
/** 关闭按钮 */
|
||||
function close() {
|
||||
proxy.$tab.closePage();
|
||||
};
|
||||
proxy.$tab.closePage()
|
||||
}
|
||||
|
||||
// 回显当前登录用户信息
|
||||
watch(() => props.user, user => {
|
||||
if (user) {
|
||||
form.value = { nickName: user.nickName, phonenumber: user.phonenumber, email: user.email, sex: user.sex };
|
||||
form.value = { nickName: user.nickName, phonenumber: user.phonenumber, email: user.email, sex: user.sex }
|
||||
}
|
||||
},{ immediate: true });
|
||||
},{ immediate: true })
|
||||
</script>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</el-col>
|
||||
</template>
|
||||
<script setup name="DraggableItem">
|
||||
import draggable from "vuedraggable/dist/vuedraggable.common";
|
||||
import draggable from "vuedraggable/dist/vuedraggable.common"
|
||||
import render from '@/utils/generator/render'
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@@ -36,7 +36,7 @@ defineProps({
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// 表单校验
|
||||
const rules = ref({
|
||||
@@ -44,5 +44,5 @@ const rules = ref({
|
||||
tableComment: [{ required: true, message: "请输入表描述", trigger: "blur" }],
|
||||
className: [{ required: true, message: "请输入实体类名称", trigger: "blur" }],
|
||||
functionAuthor: [{ required: true, message: "请输入作者", trigger: "blur" }]
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -13,34 +13,34 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { createTable } from "@/api/tool/gen";
|
||||
import { createTable } from "@/api/tool/gen"
|
||||
|
||||
const visible = ref(false);
|
||||
const content = ref("");
|
||||
const { proxy } = getCurrentInstance();
|
||||
const emit = defineEmits(["ok"]);
|
||||
const visible = ref(false)
|
||||
const content = ref("")
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emit = defineEmits(["ok"])
|
||||
|
||||
/** 显示弹框 */
|
||||
function show() {
|
||||
visible.value = true;
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImportTable() {
|
||||
if (content.value === "") {
|
||||
proxy.$modal.msgError("请输入建表语句");
|
||||
return;
|
||||
proxy.$modal.msgError("请输入建表语句")
|
||||
return
|
||||
}
|
||||
createTable({ sql: content.value }).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
proxy.$modal.msgSuccess(res.msg)
|
||||
if (res.code === 200) {
|
||||
visible.value = false;
|
||||
emit("ok");
|
||||
visible.value = false
|
||||
emit("ok")
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -127,74 +127,74 @@
|
||||
</template>
|
||||
|
||||
<script setup name="GenEdit">
|
||||
import { getGenTable, updateGenTable } from "@/api/tool/gen";
|
||||
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
|
||||
import basicInfoForm from "./basicInfoForm";
|
||||
import genInfoForm from "./genInfoForm";
|
||||
import { getGenTable, updateGenTable } from "@/api/tool/gen"
|
||||
import { optionselect as getDictOptionselect } from "@/api/system/dict/type"
|
||||
import basicInfoForm from "./basicInfoForm"
|
||||
import genInfoForm from "./genInfoForm"
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const route = useRoute()
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const activeName = ref("columnInfo");
|
||||
const tableHeight = ref(document.documentElement.scrollHeight - 245 + "px");
|
||||
const tables = ref([]);
|
||||
const columns = ref([]);
|
||||
const dictOptions = ref([]);
|
||||
const info = ref({});
|
||||
const activeName = ref("columnInfo")
|
||||
const tableHeight = ref(document.documentElement.scrollHeight - 245 + "px")
|
||||
const tables = ref([])
|
||||
const columns = ref([])
|
||||
const dictOptions = ref([])
|
||||
const info = ref({})
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
const basicForm = proxy.$refs.basicInfo.$refs.basicInfoForm;
|
||||
const genForm = proxy.$refs.genInfo.$refs.genInfoForm;
|
||||
const basicForm = proxy.$refs.basicInfo.$refs.basicInfoForm
|
||||
const genForm = proxy.$refs.genInfo.$refs.genInfoForm
|
||||
Promise.all([basicForm, genForm].map(getFormPromise)).then(res => {
|
||||
const validateResult = res.every(item => !!item);
|
||||
const validateResult = res.every(item => !!item)
|
||||
if (validateResult) {
|
||||
const genTable = Object.assign({}, info.value);
|
||||
genTable.columns = columns.value;
|
||||
const genTable = Object.assign({}, info.value)
|
||||
genTable.columns = columns.value
|
||||
genTable.params = {
|
||||
treeCode: info.value.treeCode,
|
||||
treeName: info.value.treeName,
|
||||
treeParentCode: info.value.treeParentCode,
|
||||
parentMenuId: info.value.parentMenuId
|
||||
};
|
||||
}
|
||||
updateGenTable(genTable).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
proxy.$modal.msgSuccess(res.msg)
|
||||
if (res.code === 200) {
|
||||
close();
|
||||
close()
|
||||
}
|
||||
});
|
||||
})
|
||||
} else {
|
||||
proxy.$modal.msgError("表单校验未通过,请重新检查提交内容");
|
||||
proxy.$modal.msgError("表单校验未通过,请重新检查提交内容")
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function getFormPromise(form) {
|
||||
return new Promise(resolve => {
|
||||
form.validate(res => {
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
resolve(res)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function close() {
|
||||
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: route.query.pageNum } };
|
||||
proxy.$tab.closeOpenPage(obj);
|
||||
const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: route.query.pageNum } }
|
||||
proxy.$tab.closeOpenPage(obj)
|
||||
}
|
||||
|
||||
(() => {
|
||||
const tableId = route.params && route.params.tableId;
|
||||
const tableId = route.params && route.params.tableId
|
||||
if (tableId) {
|
||||
// 获取表详细信息
|
||||
getGenTable(tableId).then(res => {
|
||||
columns.value = res.data.rows;
|
||||
info.value = res.data.info;
|
||||
tables.value = res.data.tables;
|
||||
});
|
||||
columns.value = res.data.rows
|
||||
info.value = res.data.info
|
||||
tables.value = res.data.tables
|
||||
})
|
||||
/** 查询字典下拉列表 */
|
||||
getDictOptionselect().then(response => {
|
||||
dictOptions.value = response.data;
|
||||
});
|
||||
dictOptions.value = response.data
|
||||
})
|
||||
}
|
||||
})();
|
||||
})()
|
||||
</script>
|
||||
|
||||
@@ -235,11 +235,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listMenu } from "@/api/system/menu";
|
||||
import { listMenu } from "@/api/system/menu"
|
||||
|
||||
const subColumns = ref([]);
|
||||
const menuOptions = ref([]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const subColumns = ref([])
|
||||
const menuOptions = ref([])
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const props = defineProps({
|
||||
info: {
|
||||
@@ -250,7 +250,7 @@ const props = defineProps({
|
||||
type: Array,
|
||||
default: null
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// 表单校验
|
||||
const rules = ref({
|
||||
@@ -259,25 +259,25 @@ const rules = ref({
|
||||
moduleName: [{ required: true, message: "请输入生成模块名", trigger: "blur" }],
|
||||
businessName: [{ required: true, message: "请输入生成业务名", trigger: "blur" }],
|
||||
functionName: [{ required: true, message: "请输入生成功能名", trigger: "blur" }]
|
||||
});
|
||||
})
|
||||
|
||||
function subSelectChange(value) {
|
||||
props.info.subTableFkName = "";
|
||||
props.info.subTableFkName = ""
|
||||
}
|
||||
|
||||
function tplSelectChange(value) {
|
||||
if (value !== "sub") {
|
||||
props.info.subTableName = "";
|
||||
props.info.subTableFkName = "";
|
||||
props.info.subTableName = ""
|
||||
props.info.subTableFkName = ""
|
||||
}
|
||||
}
|
||||
|
||||
function setSubTableColumns(value) {
|
||||
for (var item in props.tables) {
|
||||
const name = props.tables[item].tableName;
|
||||
const name = props.tables[item].tableName
|
||||
if (value === name) {
|
||||
subColumns.value = props.tables[item].columns;
|
||||
break;
|
||||
subColumns.value = props.tables[item].columns
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,22 +285,21 @@ function setSubTableColumns(value) {
|
||||
/** 查询菜单下拉树结构 */
|
||||
function getMenuTreeselect() {
|
||||
listMenu().then(response => {
|
||||
menuOptions.value = proxy.handleTree(response.data, "menuId");
|
||||
});
|
||||
menuOptions.value = proxy.handleTree(response.data, "menuId")
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getMenuTreeselect();
|
||||
getMenuTreeselect()
|
||||
})
|
||||
|
||||
watch(() => props.info.subTableName, val => {
|
||||
setSubTableColumns(val);
|
||||
});
|
||||
setSubTableColumns(val)
|
||||
})
|
||||
|
||||
watch(() => props.info.tplWebType, val => {
|
||||
if (val === '') {
|
||||
props.info.tplWebType = "element-plus";
|
||||
props.info.tplWebType = "element-plus"
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -51,76 +51,76 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { listDbTable, importTable } from "@/api/tool/gen";
|
||||
import { listDbTable, importTable } from "@/api/tool/gen"
|
||||
|
||||
const total = ref(0);
|
||||
const visible = ref(false);
|
||||
const tables = ref([]);
|
||||
const dbTableList = ref([]);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const total = ref(0)
|
||||
const visible = ref(false)
|
||||
const tables = ref([])
|
||||
const dbTableList = ref([])
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
tableName: undefined,
|
||||
tableComment: undefined
|
||||
});
|
||||
})
|
||||
|
||||
const emit = defineEmits(["ok"]);
|
||||
const emit = defineEmits(["ok"])
|
||||
|
||||
/** 查询参数列表 */
|
||||
function show() {
|
||||
getList();
|
||||
visible.value = true;
|
||||
getList()
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
/** 单击选择行 */
|
||||
function clickRow(row) {
|
||||
proxy.$refs.table.toggleRowSelection(row);
|
||||
proxy.$refs.table.toggleRowSelection(row)
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
tables.value = selection.map(item => item.tableName);
|
||||
tables.value = selection.map(item => item.tableName)
|
||||
}
|
||||
|
||||
/** 查询表数据 */
|
||||
function getList() {
|
||||
listDbTable(queryParams).then(res => {
|
||||
dbTableList.value = res.rows;
|
||||
total.value = res.total;
|
||||
});
|
||||
dbTableList.value = res.rows
|
||||
total.value = res.total
|
||||
})
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1;
|
||||
getList();
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 导入按钮操作 */
|
||||
function handleImportTable() {
|
||||
const tableNames = tables.value.join(",");
|
||||
const tableNames = tables.value.join(",")
|
||||
if (tableNames == "") {
|
||||
proxy.$modal.msgError("请选择要导入的表");
|
||||
return;
|
||||
proxy.$modal.msgError("请选择要导入的表")
|
||||
return
|
||||
}
|
||||
importTable({ tables: tableNames }).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
proxy.$modal.msgSuccess(res.msg)
|
||||
if (res.code === 200) {
|
||||
visible.value = false;
|
||||
emit("ok");
|
||||
visible.value = false
|
||||
emit("ok")
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
show,
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -146,25 +146,25 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Gen">
|
||||
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
|
||||
import router from "@/router";
|
||||
import importTable from "./importTable";
|
||||
import createTable from "./createTable";
|
||||
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen"
|
||||
import router from "@/router"
|
||||
import importTable from "./importTable"
|
||||
import createTable from "./createTable"
|
||||
|
||||
const route = useRoute();
|
||||
const { proxy } = getCurrentInstance();
|
||||
const route = useRoute()
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const tableList = ref([]);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const tableNames = ref([]);
|
||||
const dateRange = ref([]);
|
||||
const uniqueId = ref("");
|
||||
const defaultSort = ref({ prop: "createTime", order: "descending" });
|
||||
const tableList = ref([])
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const tableNames = ref([])
|
||||
const dateRange = ref([])
|
||||
const uniqueId = ref("")
|
||||
const defaultSort = ref({ prop: "createTime", order: "descending" })
|
||||
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
@@ -181,126 +181,126 @@ const data = reactive({
|
||||
data: {},
|
||||
activeName: "domain.java"
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
const { queryParams, preview } = toRefs(data);
|
||||
const { queryParams, preview } = toRefs(data)
|
||||
|
||||
onActivated(() => {
|
||||
const time = route.query.t;
|
||||
const time = route.query.t
|
||||
if (time != null && time != uniqueId.value) {
|
||||
uniqueId.value = time;
|
||||
queryParams.value.pageNum = Number(route.query.pageNum);
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryForm");
|
||||
getList();
|
||||
uniqueId.value = time
|
||||
queryParams.value.pageNum = Number(route.query.pageNum)
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryForm")
|
||||
getList()
|
||||
}
|
||||
})
|
||||
|
||||
/** 查询表集合 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
loading.value = true
|
||||
listTable(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
|
||||
tableList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
tableList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 生成代码操作 */
|
||||
function handleGenTable(row) {
|
||||
const tbNames = row.tableName || tableNames.value;
|
||||
const tbNames = row.tableName || tableNames.value
|
||||
if (tbNames == "") {
|
||||
proxy.$modal.msgError("请选择要生成的数据");
|
||||
return;
|
||||
proxy.$modal.msgError("请选择要生成的数据")
|
||||
return
|
||||
}
|
||||
if (row.genType === "1") {
|
||||
genCode(row.tableName).then(response => {
|
||||
proxy.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath);
|
||||
});
|
||||
proxy.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath)
|
||||
})
|
||||
} else {
|
||||
proxy.$download.zip("/tool/gen/batchGenCode?tables=" + tbNames, "ruoyi.zip");
|
||||
proxy.$download.zip("/tool/gen/batchGenCode?tables=" + tbNames, "ruoyi.zip")
|
||||
}
|
||||
}
|
||||
|
||||
/** 同步数据库操作 */
|
||||
function handleSynchDb(row) {
|
||||
const tableName = row.tableName;
|
||||
const tableName = row.tableName
|
||||
proxy.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function () {
|
||||
return synchDb(tableName);
|
||||
return synchDb(tableName)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess("同步成功");
|
||||
}).catch(() => {});
|
||||
proxy.$modal.msgSuccess("同步成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 打开导入表弹窗 */
|
||||
function openImportTable() {
|
||||
proxy.$refs["importRef"].show();
|
||||
proxy.$refs["importRef"].show()
|
||||
}
|
||||
|
||||
/** 打开创建表弹窗 */
|
||||
function openCreateTable() {
|
||||
proxy.$refs["createRef"].show();
|
||||
proxy.$refs["createRef"].show()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
queryParams.value.pageNum = 1;
|
||||
proxy.$refs["genRef"].sort(defaultSort.value.prop, defaultSort.value.order);
|
||||
dateRange.value = []
|
||||
proxy.resetForm("queryRef")
|
||||
queryParams.value.pageNum = 1
|
||||
proxy.$refs["genRef"].sort(defaultSort.value.prop, defaultSort.value.order)
|
||||
}
|
||||
|
||||
/** 预览按钮 */
|
||||
function handlePreview(row) {
|
||||
previewTable(row.tableId).then(response => {
|
||||
preview.value.data = response.data;
|
||||
preview.value.open = true;
|
||||
preview.value.activeName = "domain.java";
|
||||
});
|
||||
preview.value.data = response.data
|
||||
preview.value.open = true
|
||||
preview.value.activeName = "domain.java"
|
||||
})
|
||||
}
|
||||
|
||||
/** 复制代码成功 */
|
||||
function copyTextSuccess() {
|
||||
proxy.$modal.msgSuccess("复制成功");
|
||||
proxy.$modal.msgSuccess("复制成功")
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.tableId);
|
||||
tableNames.value = selection.map(item => item.tableName);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
ids.value = selection.map(item => item.tableId)
|
||||
tableNames.value = selection.map(item => item.tableName)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 排序触发事件 */
|
||||
function handleSortChange(column, prop, order) {
|
||||
queryParams.value.orderByColumn = column.prop;
|
||||
queryParams.value.isAsc = column.order;
|
||||
getList();
|
||||
queryParams.value.orderByColumn = column.prop
|
||||
queryParams.value.isAsc = column.order
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleEditTable(row) {
|
||||
const tableId = row.tableId || ids.value[0];
|
||||
router.push({ path: "/tool/gen-edit/index/" + tableId, query: { pageNum: queryParams.value.pageNum } });
|
||||
const tableId = row.tableId || ids.value[0]
|
||||
router.push({ path: "/tool/gen-edit/index/" + tableId, query: { pageNum: queryParams.value.pageNum } })
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const tableIds = row.tableId || ids.value;
|
||||
const tableIds = row.tableId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除表编号为"' + tableIds + '"的数据项?').then(function () {
|
||||
return delTable(tableIds);
|
||||
return delTable(tableIds)
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
getList();
|
||||
getList()
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user