update 重构 彻底删除proxy用法 改为vue3官方推荐写法

This commit is contained in:
疯狂的狮子Li
2026-04-10 13:56:08 +08:00
parent eb62402423
commit 9acf52e8a7
144 changed files with 1264 additions and 1082 deletions
+6 -8
View File
@@ -138,8 +138,8 @@
<script setup name="Demo" lang="ts">
import { listDemo, getDemo, delDemo, addDemo, updateDemo } from '@/api/demo/demo';
import { DemoVO, DemoQuery, DemoForm } from '@/api/demo/demo/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import modal from '@/plugins/modal';
import { download as requestDownload } from '@/utils/request';
const demoList = ref<DemoVO[]>([]);
const buttonLoading = ref(false);
@@ -256,7 +256,7 @@ const submitForm = () => {
} else {
await addDemo(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
dialog.visible = false;
await getList();
}
@@ -266,17 +266,15 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: DemoVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal
.confirm('是否确认删除测试单编号为"' + _ids + '"的数据项?')
.finally(() => (loading.value = false));
await modal.confirm('是否确认删除测试单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delDemo(_ids);
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'demo/demo/export',
{
...queryParams.value
+7 -7
View File
@@ -116,6 +116,8 @@
<script setup name="Tree" lang="ts">
import { listTree, getTree, delTree, addTree, updateTree } from '@/api/demo/tree';
import { TreeVO, TreeQuery, TreeForm } from '@/api/demo/tree/types';
import modal from '@/plugins/modal';
import { handleTree } from '@/utils/ruoyi';
type TreeOption = {
id: number;
@@ -123,8 +125,6 @@ type TreeOption = {
children?: TreeOption[];
};
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const treeList = ref<TreeVO[]>([]);
const treeOptions = ref<TreeOption[]>([]);
const buttonLoading = ref(false);
@@ -172,7 +172,7 @@ const { queryParams, form, rules } = toRefs(data);
const getList = async () => {
loading.value = true;
const res = await listTree(queryParams.value);
const data = proxy?.handleTree<TreeVO>(res.data, 'id', 'parentId');
const data = handleTree<TreeVO>(res.data, 'id', 'parentId');
if (data) {
treeList.value = data;
loading.value = false;
@@ -184,7 +184,7 @@ const getTreeselect = async () => {
const res = await listTree();
treeOptions.value = [];
const data: TreeOption = { id: 0, treeName: '顶级节点', children: [] };
data.children = proxy?.handleTree<TreeOption>(res.data, 'id', 'parentId');
data.children = handleTree<TreeOption>(res.data, 'id', 'parentId');
treeOptions.value.push(data);
};
@@ -261,7 +261,7 @@ const submitForm = () => {
} else {
await addTree(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -270,11 +270,11 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row: TreeVO) => {
await proxy?.$modal.confirm('是否确认删除测试树编号为"' + row.id + '"的数据项?');
await modal.confirm('是否确认删除测试树编号为"' + row.id + '"的数据项?');
loading.value = true;
await delTree(row.id).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {
+6 -4
View File
@@ -20,17 +20,19 @@
</template>
<script setup lang="ts">
import { useRoute, useRouter } from 'vue-router';
import errImage from '@/assets/401_images/401.gif';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const router = useRouter();
const errGif = ref(errImage + '?' + +new Date());
function back() {
if (proxy?.$route.query.noGoBack) {
proxy.$router.push({ path: '/' });
if (route.query.noGoBack) {
router.push({ path: '/' });
} else {
proxy?.$router.go(-1);
router.go(-1);
}
}
</script>
+2 -6
View File
@@ -129,9 +129,7 @@ const goTarget = (url: string) => {
grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
gap: 18px;
padding: 30px;
background:
radial-gradient(circle at top left, rgba(53, 109, 255, 0.16), transparent 30%),
var(--app-surface-bg);
background: radial-gradient(circle at top left, rgba(53, 109, 255, 0.16), transparent 30%), var(--app-surface-bg);
}
.hero-copy {
@@ -366,9 +364,7 @@ const goTarget = (url: string) => {
:global(html.dark) {
.hero-panel {
background:
radial-gradient(circle at top left, rgba(53, 109, 255, 0.18), transparent 30%),
var(--app-surface-bg);
background: radial-gradient(circle at top left, rgba(53, 109, 255, 0.18), transparent 30%), var(--app-surface-bg);
}
}
</style>
+36 -21
View File
@@ -36,7 +36,7 @@
type="text"
size="large"
auto-complete="off"
:placeholder="proxy.$t('login.username')"
:placeholder="$t('login.username')"
>
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input>
@@ -48,7 +48,7 @@
type="password"
size="large"
auto-complete="off"
:placeholder="proxy.$t('login.password')"
:placeholder="$t('login.password')"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
@@ -60,7 +60,7 @@
v-model="loginForm.code"
size="large"
auto-complete="off"
:placeholder="proxy.$t('login.code')"
:placeholder="$t('login.code')"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
@@ -71,28 +71,28 @@
</el-form-item>
<div class="form-meta">
<el-checkbox v-model="loginForm.rememberMe">{{ proxy.$t('login.rememberPassword') }}</el-checkbox>
<el-checkbox v-model="loginForm.rememberMe">{{ $t('login.rememberPassword') }}</el-checkbox>
<router-link v-if="register" class="link-type" :to="'/register'">
{{ proxy.$t('login.switchRegisterPage') }}
{{ $t('login.switchRegisterPage') }}
</router-link>
</div>
<div class="social-panel">
<span class="social-label">第三方登录</span>
<div class="social-actions">
<el-button circle :title="proxy.$t('login.social.wechat')" @click="doSocialLogin('wechat')">
<el-button circle :title="$t('login.social.wechat')" @click="doSocialLogin('wechat')">
<svg-icon icon-class="wechat" />
</el-button>
<el-button circle :title="proxy.$t('login.social.maxkey')" @click="doSocialLogin('maxkey')">
<el-button circle :title="$t('login.social.maxkey')" @click="doSocialLogin('maxkey')">
<svg-icon icon-class="maxkey" />
</el-button>
<el-button circle :title="proxy.$t('login.social.topiam')" @click="doSocialLogin('topiam')">
<el-button circle :title="$t('login.social.topiam')" @click="doSocialLogin('topiam')">
<svg-icon icon-class="topiam" />
</el-button>
<el-button circle :title="proxy.$t('login.social.gitee')" @click="doSocialLogin('gitee')">
<el-button circle :title="$t('login.social.gitee')" @click="doSocialLogin('gitee')">
<svg-icon icon-class="gitee" />
</el-button>
<el-button circle :title="proxy.$t('login.social.github')" @click="doSocialLogin('github')">
<el-button circle :title="$t('login.social.github')" @click="doSocialLogin('github')">
<svg-icon icon-class="github" />
</el-button>
</div>
@@ -100,8 +100,8 @@
<el-form-item class="submit-row">
<el-button :loading="loading" size="large" type="primary" class="submit-button" @click.prevent="handleLogin">
<span v-if="!loading">{{ proxy.$t('login.login') }}</span>
<span v-else>{{ proxy.$t('login.logging') }}</span>
<span v-if="!loading">{{ $t('login.login') }}</span>
<span v-else>{{ $t('login.logging') }}</span>
</el-button>
</el-form-item>
</el-form>
@@ -114,15 +114,13 @@
</template>
<script setup lang="ts">
import { to } from 'await-to-js';
import { useI18n } from 'vue-i18n';
import { getCodeImg } from '@/api/login';
import { authRouterUrl } from '@/api/system/social/auth';
import { useUserStore } from '@/store/modules/user';
import { LoginData } from '@/api/types';
import { to } from 'await-to-js';
import { HttpStatus } from '@/enums/RespEnum';
import { useI18n } from 'vue-i18n';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { useUserStore } from '@/store/modules/user';
const title = import.meta.env.VITE_APP_TITLE;
const currentYear = new Date().getFullYear();
@@ -145,9 +143,27 @@ const loginForm = ref<LoginData>({
} as LoginData);
const loginRules: ElFormRules = {
username: [{ required: true, trigger: 'blur', message: t('login.rule.username.required') }],
password: [{ required: true, trigger: 'blur', message: t('login.rule.password.required') }],
code: [{ required: true, trigger: 'change', message: t('login.rule.code.required') }]
username: [
{
required: true,
trigger: 'blur',
message: t('login.rule.username.required')
}
],
password: [
{
required: true,
trigger: 'blur',
message: t('login.rule.password.required')
}
],
code: [
{
required: true,
trigger: 'change',
message: t('login.rule.code.required')
}
]
};
const codeUrl = ref('');
@@ -561,5 +577,4 @@ onMounted(() => {
grid-template-columns: 1fr;
}
}
</style>
+4 -4
View File
@@ -143,19 +143,19 @@
</template>
<script setup name="Cache" lang="ts">
import { getCache } from '@/api/monitor/cache';
import * as echarts from 'echarts';
import { getCache } from '@/api/monitor/cache';
import { CacheVO } from '@/api/monitor/cache/types';
import modal from '@/plugins/modal';
const cache = ref<Partial<CacheVO>>({});
const commandstats = ref();
const usedmemory = ref();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const getList = async () => {
proxy?.$modal.loading('正在加载缓存监控数据,请稍候!');
modal.loading('正在加载缓存监控数据,请稍候!');
const res = await getCache();
proxy?.$modal.closeLoading();
modal.closeLoading();
cache.value = res.data;
const commandstatsIntance = echarts.init(commandstats.value, 'macarons');
commandstatsIntance.setOption({
+16 -13
View File
@@ -137,7 +137,7 @@
width="180"
>
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.loginTime) }}</span>
<span>{{ parseTime(scope.row.loginTime) }}</span>
</template>
</el-table-column>
</el-table>
@@ -156,10 +156,13 @@
<script setup name="LoginInfo" lang="ts">
import { list, delLoginInfo, cleanLoginInfo, unlockLoginInfo } from '@/api/monitor/logininfo';
import { LoginInfoQuery, LoginInfoVO } from '@/api/monitor/logininfo/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime, addDateRange } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_device_type } = toRefs<any>(proxy?.useDict('sys_device_type'));
const { sys_common_status } = toRefs<any>(proxy?.useDict('sys_common_status'));
const { sys_device_type } = toRefs<any>(useDict('sys_device_type'));
const { sys_common_status } = toRefs<any>(useDict('sys_common_status'));
const loginInfoList = ref<LoginInfoVO[]>([]);
const loading = ref(true);
@@ -169,7 +172,7 @@ const single = ref(true);
const multiple = ref(true);
const selectName = ref<Array<string>>([]);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const defaultSort = ref<any>({ prop: 'loginTime', order: 'descending' });
const queryFormRef = ref<ElFormInstance>();
@@ -188,7 +191,7 @@ const queryParams = ref<LoginInfoQuery>({
/** 查询登录日志列表 */
const getList = async () => {
loading.value = true;
const res = await list(proxy?.addDateRange(queryParams.value, dateRange.value));
const res = await list(addDateRange(queryParams.value, dateRange.value));
loginInfoList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
@@ -221,28 +224,28 @@ const handleSortChange = (column: any) => {
/** 删除按钮操作 */
const handleDelete = async (row?: LoginInfoVO) => {
const infoIds = row?.infoId || ids.value;
await proxy?.$modal.confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?');
await modal.confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?');
await delLoginInfo(infoIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 清空按钮操作 */
const handleClean = async () => {
await proxy?.$modal.confirm('是否确认清空所有登录日志数据项?');
await modal.confirm('是否确认清空所有登录日志数据项?');
await cleanLoginInfo();
await getList();
proxy?.$modal.msgSuccess('清空成功');
modal.msgSuccess('清空成功');
};
/** 解锁按钮操作 */
const handleUnlock = async () => {
const username = selectName.value;
await proxy?.$modal.confirm('是否确认解锁用户"' + username + '"数据项?');
await modal.confirm('是否确认解锁用户"' + username + '"数据项?');
await unlockLoginInfo(username);
proxy?.$modal.msgSuccess('用户' + username + '解锁成功');
modal.msgSuccess('用户' + username + '解锁成功');
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'monitor/loginInfo/export',
{
...queryParams.value
+8 -7
View File
@@ -68,7 +68,7 @@
<el-table-column label="浏览器" align="center" prop="browser" :show-overflow-tooltip="true" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.loginTime) }}</span>
<span>{{ parseTime(scope.row.loginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -97,13 +97,14 @@
</template>
<script setup name="Online" lang="ts">
import { to } from 'await-to-js';
import { forceLogout, list as initData } from '@/api/monitor/online';
import { OnlineQuery, OnlineVO } from '@/api/monitor/online/types';
import api from '@/api/system/user';
import { to } from 'await-to-js';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_device_type } = toRefs<any>(proxy?.useDict('sys_device_type'));
const { sys_device_type } = toRefs<any>(useDict('sys_device_type'));
const onlineList = ref<OnlineVO[]>([]);
const loading = ref(true);
@@ -138,11 +139,11 @@ const resetQuery = () => {
};
/** 强退按钮操作 */
const handleForceLogout = async (row: OnlineVO) => {
const [err] = await to(proxy?.$modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?') as any);
const [err] = await to(modal.confirm('是否确认强退名称为"' + row.userName + '"的用户?') as any);
if (!err) {
await forceLogout(row.tokenId);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
}
};
+15 -12
View File
@@ -161,7 +161,7 @@
:sort-orders="['descending', 'ascending']"
>
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.operTime) }}</span>
<span>{{ parseTime(scope.row.operTime) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -208,11 +208,14 @@
<script setup name="Operlog" lang="ts">
import { list, delOperlog, cleanOperlog } from '@/api/monitor/operlog';
import { OperLogForm, OperLogQuery, OperLogVO } from '@/api/monitor/operlog/types';
import OperInfoDialog from './oper-info-dialog.vue';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime, addDateRange, selectDictLabel } from '@/utils/ruoyi';
import OperInfoDialog from './operInfoDialog.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_oper_type, sys_common_status, sys_device_type } = toRefs<any>(
proxy?.useDict('sys_oper_type', 'sys_common_status', 'sys_device_type')
useDict('sys_oper_type', 'sys_common_status', 'sys_device_type')
);
const operlogList = ref<OperLogVO[]>([]);
@@ -221,7 +224,7 @@ const showSearch = ref(true);
const ids = ref<Array<number | string>>([]);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const defaultSort = ref<any>({ prop: 'operTime', order: 'descending' });
const operLogTableRef = ref<ElTableInstance>();
@@ -280,14 +283,14 @@ const { queryParams, form } = toRefs(data);
/** 查询登录日志 */
const getList = async () => {
loading.value = true;
const res = await list(proxy?.addDateRange(queryParams.value, dateRange.value));
const res = await list(addDateRange(queryParams.value, dateRange.value));
operlogList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
};
/** 操作日志类型字典翻译 */
const typeFormat = (row: OperLogForm) => {
return proxy?.selectDictLabel(sys_oper_type.value, row.businessType);
return selectDictLabel(sys_oper_type.value, row.businessType);
};
/** 搜索按钮操作 */
const handleQuery = () => {
@@ -322,23 +325,23 @@ const handleView = (row: OperLogVO) => {
/** 删除按钮操作 */
const handleDelete = async (row?: OperLogVO) => {
const operIds = row?.operId || ids.value;
await proxy?.$modal.confirm('是否确认删除日志编号为"' + operIds + '"的数据项?');
await modal.confirm('是否确认删除日志编号为"' + operIds + '"的数据项?');
await delOperlog(operIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 清空按钮操作 */
const handleClean = async () => {
await proxy?.$modal.confirm('是否确认清空所有操作日志数据项?');
await modal.confirm('是否确认清空所有操作日志数据项?');
await cleanOperlog();
await getList();
proxy?.$modal.msgSuccess('清空成功');
modal.msgSuccess('清空成功');
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'monitor/operlog/export',
{
...queryParams.value
@@ -52,7 +52,7 @@
</template>
</el-descriptions-item>
<el-descriptions-item label="操作时间">
<template #default>{{ proxy.parseTime(info.operTime) }}</template>
<template #default>{{ parseTime(info.operTime) }}</template>
</el-descriptions-item>
<el-descriptions-item v-if="info.status === 1" label="异常信息">
<template #default>
@@ -64,9 +64,11 @@
</template>
<script setup lang="ts">
import type { OperLogForm } from '@/api/monitor/operlog/types';
import VueJsonPretty from 'vue-json-pretty';
import type { OperLogForm } from '@/api/monitor/operlog/types';
import 'vue-json-pretty/lib/styles.css';
import { useDict } from '@/utils/dict';
import { parseTime, selectDictLabel } from '@/utils/ruoyi';
const open = ref(false);
const info = ref<OperLogForm | null>(null);
@@ -99,13 +101,12 @@ function formatToJsonObject(data: string) {
/**
* 字典信息
*/
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_oper_type, sys_device_type } = toRefs<any>(proxy?.useDict('sys_oper_type', 'sys_device_type'));
const { sys_oper_type, sys_device_type } = toRefs<any>(useDict('sys_oper_type', 'sys_device_type'));
const typeFormat = (row: OperLogForm) => {
return proxy?.selectDictLabel(sys_oper_type.value, row.businessType);
return selectDictLabel(sys_oper_type.value, row.businessType);
};
const deviceTypeFormat = (deviceType: string) => {
return proxy?.selectDictLabel(sys_device_type.value, deviceType);
return selectDictLabel(sys_device_type.value, deviceType);
};
</script>
+34 -17
View File
@@ -36,7 +36,7 @@
type="text"
size="large"
auto-complete="off"
:placeholder="proxy.$t('register.username')"
:placeholder="$t('register.username')"
>
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input>
@@ -47,7 +47,7 @@
type="password"
size="large"
auto-complete="off"
:placeholder="proxy.$t('register.password')"
:placeholder="$t('register.password')"
@keyup.enter="handleRegister"
>
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
@@ -59,7 +59,7 @@
type="password"
size="large"
auto-complete="off"
:placeholder="proxy.$t('register.confirmPassword')"
:placeholder="$t('register.confirmPassword')"
@keyup.enter="handleRegister"
>
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
@@ -70,7 +70,7 @@
v-model="registerForm.code"
size="large"
auto-complete="off"
:placeholder="proxy.$t('register.code')"
:placeholder="$t('register.code')"
@keyup.enter="handleRegister"
>
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
@@ -82,7 +82,7 @@
<div class="form-meta">
<span class="register-tip">注册后将返回登录页继续完成认证</span>
<router-link class="link-type" :to="'/login'">{{ proxy.$t('register.switchLoginPage') }}</router-link>
<router-link class="link-type" :to="'/login'">{{ $t('register.switchLoginPage') }}</router-link>
</div>
<el-form-item class="submit-row">
@@ -93,8 +93,8 @@
class="submit-button"
@click.prevent="handleRegister"
>
<span v-if="!loading">{{ proxy.$t('register.register') }}</span>
<span v-else>{{ proxy.$t('register.registering') }}</span>
<span v-if="!loading">{{ $t('register.register') }}</span>
<span v-else>{{ $t('register.registering') }}</span>
</el-button>
</el-form-item>
</el-form>
@@ -107,12 +107,10 @@
</template>
<script setup lang="ts">
import { getCodeImg, register } from '@/api/login';
import { RegisterForm } from '@/api/types';
import { to } from 'await-to-js';
import { useI18n } from 'vue-i18n';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { getCodeImg, register } from '@/api/login';
import { RegisterForm } from '@/api/types';
const title = import.meta.env.VITE_APP_TITLE;
const currentYear = new Date().getFullYear();
@@ -145,7 +143,11 @@ const equalToPassword = (rule: any, value: string, callback: any) => {
const registerRules: ElFormRules = {
username: [
{ required: true, trigger: 'blur', message: t('register.rule.username.required') },
{
required: true,
trigger: 'blur',
message: t('register.rule.username.required')
},
{
min: 2,
max: 20,
@@ -154,7 +156,11 @@ const registerRules: ElFormRules = {
}
],
password: [
{ required: true, trigger: 'blur', message: t('register.rule.password.required') },
{
required: true,
trigger: 'blur',
message: t('register.rule.password.required')
},
{
min: 5,
max: 20,
@@ -163,15 +169,27 @@ const registerRules: ElFormRules = {
},
{
pattern: /^[^<>"'|\\]+$/,
message: t('register.rule.password.pattern', { strings: '< > " \' \\ |' }),
message: t('register.rule.password.pattern', {
strings: '< > " \' \\ |'
}),
trigger: 'blur'
}
],
confirmPassword: [
{ required: true, trigger: 'blur', message: t('register.rule.confirmPassword.required') },
{
required: true,
trigger: 'blur',
message: t('register.rule.confirmPassword.required')
},
{ required: true, validator: equalToPassword, trigger: 'blur' }
],
code: [{ required: true, trigger: 'change', message: t('register.rule.code.required') }]
code: [
{
required: true,
trigger: 'change',
message: t('register.rule.code.required')
}
]
};
const codeUrl = ref('');
const loading = ref(false);
@@ -502,5 +520,4 @@ onMounted(() => {
grid-template-columns: 1fr;
}
}
</style>
+12 -12
View File
@@ -213,11 +213,13 @@
<script setup name="Client" lang="ts">
import { listClient, getClient, delClient, addClient, updateClient, changeStatus } from '@/api/system/client';
import { ClientVO, ClientQuery, ClientForm } from '@/api/system/client/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_grant_type } = toRefs<any>(proxy?.useDict('sys_grant_type'));
const { sys_device_type } = toRefs<any>(proxy?.useDict('sys_device_type'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const { sys_grant_type } = toRefs<any>(useDict('sys_grant_type'));
const { sys_device_type } = toRefs<any>(useDict('sys_device_type'));
const clientList = ref<ClientVO[]>([]);
const buttonLoading = ref(false);
@@ -340,7 +342,7 @@ const submitForm = () => {
} else {
await addClient(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
dialog.visible = false;
await getList();
}
@@ -350,17 +352,15 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: ClientVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal
.confirm('是否确认删除客户端管理编号为"' + _ids + '"的数据项?')
.finally(() => (loading.value = false));
await modal.confirm('是否确认删除客户端管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delClient(_ids);
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/client/export',
{
...queryParams.value
@@ -373,9 +373,9 @@ const handleExport = () => {
const handleStatusChange = async (row: ClientVO) => {
const text = row.status === '0' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '"吗?');
await modal.confirm('确认要"' + text + '"吗?');
await changeStatus(row.clientId, row.status);
proxy?.$modal.msgSuccess(text + '成功');
modal.msgSuccess(text + '成功');
} catch (err) {
row.status = row.status === '0' ? '1' : '0';
}
+13 -10
View File
@@ -120,7 +120,7 @@
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
@@ -189,9 +189,12 @@
<script setup name="Config" lang="ts">
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from '@/api/system/config';
import { ConfigForm, ConfigQuery, ConfigVO } from '@/api/system/config/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime, addDateRange } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_yes_no } = toRefs<any>(proxy?.useDict('sys_yes_no'));
const { sys_yes_no } = toRefs<any>(useDict('sys_yes_no'));
const configList = ref<ConfigVO[]>([]);
const loading = ref(true);
@@ -200,7 +203,7 @@ const ids = ref<Array<number | string>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const queryFormRef = ref<ElFormInstance>();
const configFormRef = ref<ElFormInstance>();
@@ -237,7 +240,7 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询参数列表 */
const getList = async () => {
loading.value = true;
const res = await listConfig(proxy?.addDateRange(queryParams.value, dateRange.value));
const res = await listConfig(addDateRange(queryParams.value, dateRange.value));
configList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
@@ -289,7 +292,7 @@ const submitForm = () => {
configFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.configId ? await updateConfig(form.value) : await addConfig(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -298,14 +301,14 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: ConfigVO) => {
const configIds = row?.configId || ids.value;
await proxy?.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?');
await modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?');
await delConfig(configIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/config/export',
{
...queryParams.value
@@ -316,7 +319,7 @@ const handleExport = () => {
/** 刷新缓存按钮操作 */
const handleRefreshCache = async () => {
await refreshCache();
proxy?.$modal.msgSuccess('刷新缓存成功');
modal.msgSuccess('刷新缓存成功');
};
onMounted(() => {
+26 -12
View File
@@ -79,7 +79,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="200">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" align="center" label="操作">
@@ -192,8 +192,11 @@
<script setup name="Dept" lang="ts">
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from '@/api/system/dept';
import { DeptForm, DeptQuery, DeptVO } from '@/api/system/dept/types';
import { UserVO } from '@/api/system/user/types';
import { listUserByDeptId } from '@/api/system/user';
import { UserVO } from '@/api/system/user/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { handleTree, parseTime } from '@/utils/ruoyi';
interface DeptOptionsType {
deptId: number | string;
@@ -201,8 +204,7 @@ interface DeptOptionsType {
children: DeptOptionsType[];
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const deptList = ref<DeptVO[]>([]);
const loading = ref(true);
@@ -244,8 +246,20 @@ const initData: PageData<DeptForm, DeptQuery> = {
parentId: [{ required: true, message: '上级部门不能为空', trigger: 'blur' }],
deptName: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
email: [{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }],
phone: [{ pattern: /^1[3456789][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }]
email: [
{
type: 'email',
message: '请输入正确的邮箱地址',
trigger: ['blur', 'change']
}
],
phone: [
{
pattern: /^1[3456789][0-9]\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur'
}
]
}
};
const data = reactive<PageData<DeptForm, DeptQuery>>(initData);
@@ -256,7 +270,7 @@ const { queryParams, form, rules } = toRefs<PageData<DeptForm, DeptQuery>>(data)
const getList = async () => {
loading.value = true;
const res = await listDept(queryParams.value);
const data = proxy?.handleTree<DeptVO>(res.data, 'deptId');
const data = handleTree<DeptVO>(res.data, 'deptId');
if (data) {
deptList.value = data;
}
@@ -309,7 +323,7 @@ const toggleExpandAll = (data: DeptVO[], status: boolean) => {
const handleAdd = async (row?: DeptVO) => {
reset();
const res = await listDept();
const data = proxy?.handleTree<DeptOptionsType>(res.data, 'deptId');
const data = handleTree<DeptOptionsType>(res.data, 'deptId');
if (data) {
deptOptions.value = data;
if (row && row.deptId) {
@@ -328,7 +342,7 @@ const handleUpdate = async (row: DeptVO) => {
const res = await getDept(row.deptId);
form.value = res.data;
const response = await listDeptExcludeChild(row.deptId);
const data = proxy?.handleTree<DeptOptionsType>(response.data, 'deptId');
const data = handleTree<DeptOptionsType>(response.data, 'deptId');
if (data) {
deptOptions.value = data;
if (data.length === 0) {
@@ -348,7 +362,7 @@ const submitForm = () => {
deptFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.deptId ? await updateDept(form.value) : await addDept(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -356,10 +370,10 @@ const submitForm = () => {
};
/** 删除按钮操作 */
const handleDelete = async (row: DeptVO) => {
await proxy?.$modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?');
await modal.confirm('是否确认删除名称为"' + row.deptName + '"的数据项?');
await delDept(row.deptId);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {
+21 -20
View File
@@ -113,7 +113,7 @@
<el-table-column label="备注" align="center" prop="remark" width="160" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -280,7 +280,7 @@
<el-table-column label="备注" align="center" prop="remark" width="100" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
@@ -397,13 +397,14 @@
</template>
<script setup name="Dict" lang="ts">
import { useDictStore } from '@/store/modules/dict';
import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
import { listData, getData, delData, addData, updateData } from '@/api/system/dict/data';
import { DictTypeForm, DictTypeQuery, DictTypeVO } from '@/api/system/dict/type/types';
import { DictDataForm, DictDataQuery, DictDataVO } from '@/api/system/dict/data/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
import { DictTypeForm, DictTypeQuery, DictTypeVO } from '@/api/system/dict/type/types';
import modal from '@/plugins/modal';
import { useDictStore } from '@/store/modules/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime } from '@/utils/ruoyi';
const typeList = ref<DictTypeVO[]>([]);
const typeLoading = ref(true);
@@ -587,7 +588,7 @@ const submitTypeForm = () => {
typeFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
typeForm.value.dictId ? await updateType(typeForm.value) : await addType(typeForm.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
typeDialog.visible = false;
getTypeList();
}
@@ -596,14 +597,14 @@ const submitTypeForm = () => {
const handleTypeDelete = async (row?: DictTypeVO) => {
const dictIds = row?.dictId || typeIds.value;
await proxy?.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?');
await modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?');
await delType(dictIds);
getTypeList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
const handleTypeExport = () => {
proxy?.download(
requestDownload(
'system/dict/type/export',
{
...typeQueryParams.value
@@ -614,7 +615,7 @@ const handleTypeExport = () => {
const handleRefreshCache = async () => {
await refreshCache();
proxy?.$modal.msgSuccess('刷新成功');
modal.msgSuccess('刷新成功');
useDictStore().cleanDict();
};
@@ -656,7 +657,7 @@ const handleDataResetQuery = () => {
const handleDataAdd = () => {
if (!currentDict.value) {
proxy?.$modal.msgWarning('请先选择字典');
modal.msgWarning('请先选择字典');
return;
}
resetDataForm();
@@ -673,7 +674,7 @@ const handleDataSelectionChange = (selection: DictDataVO[]) => {
const handleDataUpdate = async (row?: DictDataVO) => {
if (!currentDict.value) {
proxy?.$modal.msgWarning('请先选择字典');
modal.msgWarning('请先选择字典');
return;
}
resetDataForm();
@@ -689,7 +690,7 @@ const submitDataForm = () => {
if (valid) {
dataForm.value.dictCode ? await updateData(dataForm.value) : await addData(dataForm.value);
useDictStore().removeDict(dataQueryParams.value.dictType);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dataDialog.visible = false;
await getDataList();
}
@@ -698,23 +699,23 @@ const submitDataForm = () => {
const handleDataDelete = async (row?: DictDataVO) => {
if (!currentDict.value) {
proxy?.$modal.msgWarning('请先选择字典');
modal.msgWarning('请先选择字典');
return;
}
const dictCodes = row?.dictCode || dataIds.value;
await proxy?.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?');
await modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?');
await delData(dictCodes);
await getDataList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
useDictStore().removeDict(dataQueryParams.value.dictType);
};
const handleDataExport = () => {
if (!currentDict.value) {
proxy?.$modal.msgWarning('请先选择字典');
modal.msgWarning('请先选择字典');
return;
}
proxy?.download(
requestDownload(
'system/dict/data/export',
{
...dataQueryParams.value
+10 -8
View File
@@ -368,6 +368,9 @@
import { addMenu, cascadeDelMenu, delMenu, getMenu, listMenu, updateMenu } from '@/api/system/menu';
import { MenuForm, MenuQuery, MenuVO } from '@/api/system/menu/types';
import { MenuTypeEnum } from '@/enums/MenuTypeEnum';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { handleTree } from '@/utils/ruoyi';
interface MenuOptionsType {
menuId: number;
@@ -375,8 +378,7 @@ interface MenuOptionsType {
children: MenuOptionsType[] | undefined;
}
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_show_hide, sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_show_hide', 'sys_normal_disable'));
const { sys_show_hide, sys_normal_disable } = toRefs<any>(useDict('sys_show_hide', 'sys_normal_disable'));
const menuList = ref<MenuVO[]>([]);
const menuChildrenListMap = ref({});
@@ -512,7 +514,7 @@ const getTreeselect = async () => {
menuOptions.value = [];
const response = await listMenu();
const menu: MenuOptionsType = { menuId: 0, menuName: '主类目', children: [] };
menu.children = proxy?.handleTree<MenuOptionsType>(response.data, 'menuId');
menu.children = handleTree<MenuOptionsType>(response.data, 'menuId');
menuOptions.value.push(menu);
};
/** 取消按钮 */
@@ -559,7 +561,7 @@ const submitForm = () => {
menuFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.menuId ? await updateMenu(form.value) : await addMenu(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -567,10 +569,10 @@ const submitForm = () => {
};
/** 删除按钮操作 */
const handleDelete = async (row: MenuVO) => {
await proxy?.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?');
await modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?');
await delMenu(row.menuId);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
const deleteLoading = ref<boolean>(false);
@@ -598,14 +600,14 @@ const cancelCascade = () => {
const submitDeleteForm = async () => {
const menuIds = menuTreeRef.value?.getCheckedKeys();
if (menuIds.length < 0) {
proxy?.$modal.msgWarning('请选择要删除的菜单');
modal.msgWarning('请选择要删除的菜单');
return;
}
deleteLoading.value = true;
await cascadeDelMenu(menuIds).finally(() => (deleteLoading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
deleteDialog.visible = false;
};
+11 -8
View File
@@ -100,7 +100,7 @@
<el-table-column label="创建者" align="center" prop="createByName" width="100" />
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -215,7 +215,7 @@
</div>
<div class="notice-detail__meta-item">
<span class="notice-detail__meta-label">创建时间:</span>
<span>{{ proxy.parseTime(detailForm.createTime, '{y}-{m}-{d} {h}:{i}:{s}') || '-' }}</span>
<span>{{ parseTime(detailForm.createTime, '{y}-{m}-{d} {h}:{i}:{s}') || '-' }}</span>
</div>
</div>
</div>
@@ -227,13 +227,16 @@
</template>
<script setup name="Notice" lang="ts">
import { useRoute, useRouter } from 'vue-router';
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from '@/api/system/notice';
import { NoticeForm, NoticeQuery, NoticeVO } from '@/api/system/notice/types';
import { sanitizeHtml } from '@/utils/sanitize';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { resolveOssContent } from '@/utils/ossContent';
import { parseTime } from '@/utils/ruoyi';
import { sanitizeHtml } from '@/utils/sanitize';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_notice_status, sys_notice_type } = toRefs<any>(proxy?.useDict('sys_notice_status', 'sys_notice_type'));
const { sys_notice_status, sys_notice_type } = toRefs<any>(useDict('sys_notice_status', 'sys_notice_type'));
const route = useRoute();
const router = useRouter();
@@ -370,7 +373,7 @@ const submitForm = () => {
noticeFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.noticeId ? await updateNotice(form.value) : await addNotice(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -379,10 +382,10 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: NoticeVO) => {
const noticeIds = row?.noticeId || ids.value;
await proxy?.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?');
await modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?');
await delNotice(noticeIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {
+8 -8
View File
@@ -208,10 +208,10 @@ import {
changeOssConfigStatus
} from '@/api/system/ossConfig';
import { OssConfigForm, OssConfigQuery, OssConfigVO } from '@/api/system/ossConfig/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_yes_no } = toRefs<any>(proxy?.useDict('sys_yes_no'));
const { sys_yes_no } = toRefs<any>(useDict('sys_yes_no'));
const ossConfigList = ref<OssConfigVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
@@ -372,7 +372,7 @@ const submitForm = () => {
} else {
await addOssConfig(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('新增成功');
modal.msgSuccess('新增成功');
dialog.visible = false;
await getList();
}
@@ -382,10 +382,10 @@ const submitForm = () => {
const handleStatusChange = async (row: OssConfigVO) => {
const text = row.status === 'Y' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.configKey + '"配置吗?');
await modal.confirm('确认要"' + text + '""' + row.configKey + '"配置吗?');
await changeOssConfigStatus(row.ossConfigId, row.status, row.configKey);
await getList();
proxy?.$modal.msgSuccess(text + '成功');
modal.msgSuccess(text + '成功');
} catch {
row.status = row.status === 'Y' ? 'N' : 'Y';
}
@@ -393,11 +393,11 @@ const handleStatusChange = async (row: OssConfigVO) => {
/** 删除按钮操作 */
const handleDelete = async (row?: OssConfigVO) => {
const ossConfigIds = row?.ossConfigId || ids.value;
await proxy?.$modal.confirm('是否确认删除OSS配置编号为"' + ossConfigIds + '"的数据项?');
await modal.confirm('是否确认删除OSS配置编号为"' + ossConfigIds + '"的数据项?');
loading.value = true;
await delOssConfig(ossConfigIds).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {
+15 -11
View File
@@ -128,7 +128,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" sortable="custom">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="上传人" align="center" prop="createByName" />
@@ -184,12 +184,16 @@
</template>
<script setup name="Oss" lang="ts">
import { useRouter } from 'vue-router';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { listOss, delOss } from '@/api/system/oss';
import ImagePreview from '@/components/ImagePreview/index.vue';
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
import ImagePreview from '@/components/ImagePreview/index.vue';
import download from '@/plugins/download';
import modal from '@/plugins/modal';
import { parseTime, addDateRange } from '@/utils/ruoyi';
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const ossList = ref<OssVO[]>([]);
const showTable = ref(true);
@@ -202,7 +206,7 @@ const multiple = ref(true);
const total = ref(0);
const type = ref(0);
const previewListResource = ref(true);
const dateRangeCreateTime = ref<[DateModelType, DateModelType]>(['', '']);
const dateRangeCreateTime = ref<any>(['', '']);
const dialog = reactive<DialogOption>({
visible: false,
@@ -242,9 +246,9 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询OSS对象存储列表 */
const getList = async () => {
loading.value = true;
const res = await proxy?.getConfigKey('sys.oss.previewListResource');
const res = await getConfigKey('sys.oss.previewListResource');
previewListResource.value = res?.data === undefined ? true : res.data === 'true';
const response = await listOss(proxy?.addDateRange(queryParams.value, dateRangeCreateTime.value, 'CreateTime'));
const response = await listOss(addDateRange(queryParams.value, dateRangeCreateTime.value, 'CreateTime'));
ossList.value = response.data?.rows;
total.value = response.data?.total;
loading.value = false;
@@ -355,14 +359,14 @@ const submitForm = () => {
};
/** 下载按钮操作 */
const handleDownload = (row: OssVO) => {
proxy?.$download.oss(row.ossId);
download.oss(row.ossId);
};
/** 预览开关按钮 */
const handlePreviewListResource = async (preview: boolean) => {
try {
await proxy?.updateConfigByKey('sys.oss.previewListResource', preview);
await updateConfigByKey('sys.oss.previewListResource', preview);
await getList();
proxy?.$modal.msgSuccess((preview ? '启用' : '停用') + '成功');
modal.msgSuccess((preview ? '启用' : '停用') + '成功');
} catch {
return;
}
@@ -370,11 +374,11 @@ const handlePreviewListResource = async (preview: boolean) => {
/** 删除按钮操作 */
const handleDelete = async (row?: OssVO) => {
const ossIds = row?.ossId || ids.value;
await proxy?.$modal.confirm('是否确认删除OSS对象存储编号为"' + ossIds + '"的数据项?');
await modal.confirm('是否确认删除OSS对象存储编号为"' + ossIds + '"的数据项?');
loading.value = true;
await delOss(ossIds).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {
+12 -9
View File
@@ -146,7 +146,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
@@ -231,13 +231,16 @@
</template>
<script setup name="Post" lang="ts">
import TreePanel from '@/components/TreePanel/index.vue';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import { listPost, addPost, delPost, getPost, updatePost, deptTreeSelect } from '@/api/system/post';
import { PostForm, PostQuery, PostVO } from '@/api/system/post/types';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import TreePanel from '@/components/TreePanel/index.vue';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const postList = ref<PostVO[]>([]);
const loading = ref(true);
@@ -373,7 +376,7 @@ const submitForm = () => {
postFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.postId ? await updatePost(form.value) : await addPost(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -383,15 +386,15 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: PostVO) => {
const postIds = row?.postId || ids.value;
await proxy?.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?');
await modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?');
await delPost(postIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/post/export',
{
...queryParams.value
+10 -8
View File
@@ -106,15 +106,17 @@
</template>
<script setup name="AuthUser" lang="ts">
import { RouteLocationNormalized } from 'vue-router';
import { allocatedUserList, authUserCancel, authUserCancelAll } from '@/api/system/role';
import { UserQuery } from '@/api/system/user/types';
import { UserVO } from '@/api/system/user/types';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { useDict } from '@/utils/dict';
import SelectUser from './selectUser.vue';
import { RouteLocationNormalized } from 'vue-router';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const userList = ref<UserVO[]>([]);
const loading = ref(true);
@@ -155,7 +157,7 @@ const handleClose = () => {
query: undefined,
redirectedFrom: undefined
};
proxy?.$tab.closeOpenPage(obj);
tab.closeOpenPage(obj as any);
};
/** 搜索按钮操作 */
const handleQuery = () => {
@@ -178,19 +180,19 @@ const openSelectUser = () => {
};
/** 取消授权按钮操作 */
const cancelAuthUser = async (row: UserVO) => {
await proxy?.$modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?');
await modal.confirm('确认要取消该用户"' + row.userName + '"角色吗?');
await authUserCancel({ userId: row.userId, roleId: queryParams.roleId });
await getList();
proxy?.$modal.msgSuccess('取消授权成功');
modal.msgSuccess('取消授权成功');
};
/** 批量取消授权按钮操作 */
const cancelAuthUserAll = async () => {
const roleId = queryParams.roleId;
const uIds = userIds.value.join(',');
await proxy?.$modal.confirm('是否取消选中用户授权数据项?');
await modal.confirm('是否取消选中用户授权数据项?');
await authUserCancelAll({ roleId: roleId, userIds: uIds });
await getList();
proxy?.$modal.msgSuccess('取消授权成功');
modal.msgSuccess('取消授权成功');
};
onMounted(() => {
+22 -17
View File
@@ -112,7 +112,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
@@ -275,6 +275,9 @@
</template>
<script setup name="Role" lang="ts">
import { useRouter } from 'vue-router';
import { roleMenuTreeselect, treeselect as menuTreeselect } from '@/api/system/menu/index';
import { MenuTreeOption, RoleMenuTree } from '@/api/system/menu/types';
import {
addRole,
changeRoleStatus,
@@ -285,13 +288,14 @@ import {
updateRole,
deptTreeSelect
} from '@/api/system/role';
import { roleMenuTreeselect, treeselect as menuTreeselect } from '@/api/system/menu/index';
import { RoleVO, RoleForm, RoleQuery, DeptTreeOption } from '@/api/system/role/types';
import { MenuTreeOption, RoleMenuTree } from '@/api/system/menu/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime, addDateRange } from '@/utils/ruoyi';
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const roleList = ref<RoleVO[]>();
const loading = ref(true);
@@ -300,7 +304,7 @@ const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const menuOptions = ref<MenuTreeOption[]>([]);
const menuExpand = ref(false);
const menuNodeAll = ref(false);
@@ -366,7 +370,7 @@ const dialog = reactive<DialogOption>({
*/
const getList = () => {
loading.value = true;
listRole(proxy?.addDateRange(queryParams.value, dateRange.value)).then(res => {
listRole(addDateRange(queryParams.value, dateRange.value)).then(res => {
roleList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
@@ -390,15 +394,15 @@ const resetQuery = () => {
/**删除按钮操作 */
const handleDelete = async (row?: RoleVO) => {
const roleids = row?.roleId || ids.value;
await proxy?.$modal.confirm('是否确认删除角色编号为' + roleids + '数据项目');
await modal.confirm('是否确认删除角色编号为' + roleids + '数据项目');
await delRole(roleids);
getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/role/export',
{
...queryParams.value
@@ -417,9 +421,9 @@ const handleSelectionChange = (selection: RoleVO[]) => {
const handleStatusChange = async (row: RoleVO) => {
const text = row.status === '0' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?');
await modal.confirm('确认要"' + text + '""' + row.roleName + '"角色吗?');
await changeRoleStatus(row.roleId, row.status);
proxy?.$modal.msgSuccess(text + '成功');
modal.msgSuccess(text + '成功');
} catch {
row.status = row.status === '0' ? '1' : '0';
}
@@ -494,19 +498,20 @@ const getRoleDeptTreeSelect = async (roleId: string | number) => {
return res.data;
};
/** 树权限(展开/折叠)*/
const handleCheckedTreeExpand = (value: boolean, type: string) => {
const handleCheckedTreeExpand = (value: unknown, type: string) => {
const expanded = Boolean(value);
if (type == 'menu') {
const treeList = menuOptions.value;
for (let i = 0; i < treeList.length; i++) {
if (menuRef.value) {
menuRef.value.store.nodesMap[treeList[i].id].expanded = value;
menuRef.value.store.nodesMap[treeList[i].id].expanded = expanded;
}
}
} else if (type == 'dept') {
const treeList = deptOptions.value;
for (let i = 0; i < treeList.length; i++) {
if (deptRef.value) {
deptRef.value.store.nodesMap[treeList[i].id].expanded = value;
deptRef.value.store.nodesMap[treeList[i].id].expanded = expanded;
}
}
}
@@ -544,7 +549,7 @@ const submitForm = () => {
if (valid) {
form.value.menuIds = getMenuAllCheckedKeys();
form.value.roleId ? await updateRole(form.value) : await addRole(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
getList();
}
@@ -577,7 +582,7 @@ const submitDataScope = async () => {
if (form.value.roleId) {
form.value.deptIds = getDeptAllCheckedKeys();
await dataScope(form.value);
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
openDataScope.value = false;
getList();
}
+7 -5
View File
@@ -49,7 +49,7 @@
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
@@ -76,6 +76,9 @@
import { authUserSelectAll, unallocatedUserList } from '@/api/system/role';
import { UserVO } from '@/api/system/user/types';
import { UserQuery } from '@/api/system/user/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
import { parseTime } from '@/utils/ruoyi';
const props = defineProps({
roleId: {
@@ -84,8 +87,7 @@ const props = defineProps({
}
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const userList = ref<UserVO[]>([]);
const visible = ref(false);
@@ -144,11 +146,11 @@ const handleSelectUser = async () => {
const roleId = queryParams.roleId;
const ids = userIds.value.join(',');
if (ids == '') {
proxy?.$modal.msgError('请选择要分配的用户');
modal.msgError('请选择要分配的用户');
return;
}
await authUserSelectAll({ roleId, userIds: ids });
proxy?.$modal.msgSuccess('分配成功');
modal.msgSuccess('分配成功');
emit('ok');
visible.value = false;
};
+6 -5
View File
@@ -54,7 +54,7 @@
<el-table-column label="权限字符" align="center" prop="roleKey" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
@@ -64,14 +64,15 @@
</template>
<script setup name="AuthRole" lang="ts">
import { RouteLocationNormalized } from 'vue-router';
import { RoleVO } from '@/api/system/role/types';
import { getAuthRole, updateAuthRole } from '@/api/system/user';
import { UserForm } from '@/api/system/user/types';
import { RouteLocationNormalized } from 'vue-router';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { parseTime } from '@/utils/ruoyi';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const loading = ref(true);
const total = ref(0);
@@ -119,14 +120,14 @@ const close = () => {
redirectedFrom: undefined,
path: '/system/user'
};
proxy?.$tab.closeOpenPage(obj);
tab.closeOpenPage(obj as any);
};
/** 提交按钮 */
const submitForm = async () => {
const userId = form.value.userId;
const rIds = roleIds.value.join(',');
await updateAuthRole({ userId: userId as string, roleIds: rIds });
proxy?.$modal.msgSuccess('授权成功');
modal.msgSuccess('授权成功');
close();
};
+33 -24
View File
@@ -451,22 +451,27 @@
</template>
<script setup name="User" lang="ts">
import TreePanel from '@/components/TreePanel/index.vue';
import { to } from 'await-to-js';
import { useRouter } from 'vue-router';
import { getConfigKey } from '@/api/system/config';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import { optionselect } from '@/api/system/post';
import { PostVO } from '@/api/system/post/types';
import { RoleVO } from '@/api/system/role/types';
import api from '@/api/system/user';
import { UserForm, UserQuery, UserVO } from '@/api/system/user/types';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import { RoleVO } from '@/api/system/role/types';
import { PostVO } from '@/api/system/post/types';
import { globalHeaders } from '@/utils/request';
import { to } from 'await-to-js';
import { optionselect } from '@/api/system/post';
import { checkPermi } from '@/utils/permission';
import TreePanel from '@/components/TreePanel/index.vue';
import modal from '@/plugins/modal';
import { useUserStore } from '@/store/modules/user';
import { useDict } from '@/utils/dict';
import { checkPermi } from '@/utils/permission';
import { globalHeaders } from '@/utils/request';
import { download as requestDownload } from '@/utils/request';
import { addDateRange } from '@/utils/ruoyi';
import UserViewDrawer from './view.vue';
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable, sys_user_gender } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_gender'));
const { sys_normal_disable, sys_user_gender } = toRefs<any>(useDict('sys_normal_disable', 'sys_user_gender'));
const userList = ref<UserVO[]>();
const loading = ref(true);
const showSearch = ref(true);
@@ -474,7 +479,7 @@ const ids = ref<Array<number | string>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const treeCollapsed = ref(false);
const deptOptions = ref<DeptTreeVO[]>([]);
const enabledDeptOptions = ref<DeptTreeVO[]>([]);
@@ -564,7 +569,11 @@ const initData: PageData<UserForm, UserQuery> = {
message: '用户密码长度必须介于 5 和 20 之间',
trigger: 'blur'
},
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\ |', trigger: 'blur' }
{
pattern: /^[^<>"'|\\]+$/,
message: '不能包含非法字符:< > " \' \\ |',
trigger: 'blur'
}
],
email: [
{
@@ -590,7 +599,7 @@ const { queryParams, form, rules } = toRefs<PageData<UserForm, UserQuery>>(data)
/** 查询用户列表 */
const getList = async () => {
loading.value = true;
const res = await api.listUser(proxy?.addDateRange(queryParams.value, dateRange.value));
const res = await api.listUser(addDateRange(queryParams.value, dateRange.value));
loading.value = false;
userList.value = res.data?.rows;
total.value = res.data?.total;
@@ -640,21 +649,21 @@ const resetQuery = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: UserVO) => {
const userIds = row?.userId || ids.value;
const [err] = await to(proxy?.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?') as any);
const [err] = await to(modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?') as any);
if (!err) {
await api.delUser(userIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
}
};
/** 解锁按钮操作 */
const handleUnlock = async () => {
const userId = ids.value[0];
const [err] = await to(proxy?.$modal.confirm('是否确认解锁用户编号为"' + userId + '"的数据项?') as any);
const [err] = await to(modal.confirm('是否确认解锁用户编号为"' + userId + '"的数据项?') as any);
if (!err) {
await api.unlockUser(userId);
proxy?.$modal.msgSuccess('用户编号"' + userId + '"解锁成功');
modal.msgSuccess('用户编号"' + userId + '"解锁成功');
}
};
@@ -662,9 +671,9 @@ const handleUnlock = async () => {
const handleStatusChange = async (row: UserVO) => {
const text = row.status === '0' ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?');
await modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?');
await api.changeUserStatus(row.userId, row.status);
proxy?.$modal.msgSuccess(text + '成功');
modal.msgSuccess(text + '成功');
} catch (err) {
row.status = row.status === '0' ? '1' : '0';
}
@@ -693,7 +702,7 @@ const handleResetPwd = async (row: UserVO) => {
);
if (!err && res) {
await api.resetUserPwd(row.userId, res.value);
proxy?.$modal.msgSuccess('修改成功,新密码是:' + res.value);
modal.msgSuccess('修改成功,新密码是:' + res.value);
}
};
@@ -716,7 +725,7 @@ const handleImport = () => {
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'system/user/export',
{
...queryParams.value
@@ -726,7 +735,7 @@ const handleExport = () => {
};
/** 下载模板操作 */
const importTemplate = () => {
proxy?.download('system/user/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`);
requestDownload('system/user/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`);
};
/**文件上传中处理 */
@@ -811,7 +820,7 @@ const submitForm = () => {
} else {
await api.addUser(form.value);
}
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -839,7 +848,7 @@ const resetForm = () => {
onMounted(() => {
getDeptTree(); // 初始化部门数据
getList(); // 初始化列表数据
proxy?.getConfigKey('sys.user.initPassword').then(response => {
getConfigKey('sys.user.initPassword').then(response => {
initPassword.value = response.data;
});
});
+6 -6
View File
@@ -93,15 +93,15 @@
</template>
<script setup name="Profile" lang="ts">
import UserAvatar from './userAvatar.vue';
import UserInfo from './userInfo.vue';
import ResetPwd from './resetPwd.vue';
import ThirdParty from './thirdParty.vue';
import OnlineDevice from './onlineDevice.vue';
import { getOnline } from '@/api/monitor/online';
import { getAuthList } from '@/api/system/social/auth';
import { getUserProfile } from '@/api/system/user';
import { getOnline } from '@/api/monitor/online';
import { UserVO } from '@/api/system/user/types';
import OnlineDevice from './onlineDevice.vue';
import ResetPwd from './resetPwd.vue';
import ThirdParty from './thirdParty.vue';
import UserAvatar from './userAvatar.vue';
import UserInfo from './userInfo.vue';
const activeTab = ref('userinfo');
interface State {
@@ -12,7 +12,7 @@
<el-table-column label="浏览器" align="center" prop="browser" :show-overflow-tooltip="true" />
<el-table-column label="登录时间" align="center" prop="loginTime" width="180">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.loginTime) }}</span>
<span>{{ parseTime(scope.row.loginTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -28,10 +28,13 @@
<script setup name="Online" lang="ts">
import { delOnline } from '@/api/monitor/online';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { useDict } from '@/utils/dict';
import { propTypes } from '@/utils/propTypes';
import { parseTime } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_device_type } = toRefs<any>(proxy?.useDict('sys_device_type'));
const { sys_device_type } = toRefs<any>(useDict('sys_device_type'));
const props = defineProps({
devices: propTypes.any.isRequired
@@ -46,10 +49,10 @@ const handldDelOnline = (row: any) => {
})
.then((res: any) => {
if (res.code === 200) {
proxy?.$modal.msgSuccess('删除成功');
proxy?.$tab.refreshPage();
modal.msgSuccess('删除成功');
tab.refreshPage();
} else {
proxy?.$modal.msgError(res.msg);
modal.msgError(res.msg);
}
})
.catch(() => {});
+10 -5
View File
@@ -17,10 +17,11 @@
</template>
<script setup lang="ts">
import { updateUserPwd } from '@/api/system/user';
import type { ResetPwdForm } from '@/api/system/user/types';
import { updateUserPwd } from '@/api/system/user';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const pwdRef = ref<ElFormInstance>();
const user = ref<ResetPwdForm>({
oldPassword: '',
@@ -45,7 +46,11 @@ const rules = ref({
message: '长度在 6 到 20 个字符',
trigger: 'blur'
},
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\ |', trigger: 'blur' }
{
pattern: /^[^<>"'|\\]+$/,
message: '不能包含非法字符:< > " \' \\ |',
trigger: 'blur'
}
],
confirmPassword: [
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
@@ -62,13 +67,13 @@ const submit = () => {
pwdRef.value?.validate(async (valid: boolean) => {
if (valid) {
await updateUserPwd(user.value.oldPassword, user.value.newPassword);
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
}
});
};
/** 关闭按钮 */
const close = () => {
proxy?.$tab.closePage();
tab.closePage();
};
</script>
+6 -6
View File
@@ -62,10 +62,10 @@
<script setup lang="ts">
import { authUnlock, authRouterUrl } from '@/api/system/social/auth';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { propTypes } from '@/utils/propTypes';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps({
auths: propTypes.any.isRequired
});
@@ -78,10 +78,10 @@ const unlockAuth = (row: any) => {
})
.then((res: any) => {
if (res.code === 200) {
proxy?.$modal.msgSuccess('解绑成功');
proxy?.$tab.refreshPage();
modal.msgSuccess('解绑成功');
tab.refreshPage();
} else {
proxy?.$modal.msgError(res.msg);
modal.msgError(res.msg);
}
})
.catch(() => {});
@@ -92,7 +92,7 @@ const authUrl = (source: string) => {
if (res.code === 200) {
window.location.href = res.data;
} else {
proxy?.$modal.msgError(res.msg);
modal.msgError(res.msg);
}
});
};
+4 -4
View File
@@ -57,10 +57,11 @@
<script setup lang="ts">
import 'vue-cropper/dist/index.css';
import { UploadRawFile } from 'element-plus';
import { VueCropper } from 'vue-cropper';
import { uploadAvatar } from '@/api/system/user';
import modal from '@/plugins/modal';
import { useUserStore } from '@/store/modules/user';
import { UploadRawFile } from 'element-plus';
interface Options {
img: string | any; // 裁剪图片的地址
@@ -75,7 +76,6 @@ interface Options {
}
const userStore = useUserStore();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const open = ref(false);
const visible = ref(false);
@@ -121,7 +121,7 @@ const changeScale = (num: number) => {
/** 上传预处理 */
const beforeUpload = (file: UploadRawFile): any => {
if (file.type.indexOf('image/') == -1) {
proxy?.$modal.msgError('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。');
modal.msgError('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。');
} else {
const reader = new FileReader();
reader.readAsDataURL(file);
@@ -140,7 +140,7 @@ const uploadImg = async () => {
open.value = false;
options.img = res.data.imgUrl;
userStore.setAvatar(options.img);
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
visible.value = false;
});
};
+9 -4
View File
@@ -24,13 +24,14 @@
<script setup lang="ts">
import { updateUserProfile } from '@/api/system/user';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import { propTypes } from '@/utils/propTypes';
const props = defineProps({
user: propTypes.any.isRequired
});
const userForm = computed(() => props.user);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const userRef = ref<ElFormInstance>();
const rule: ElFormRules = {
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }],
@@ -48,7 +49,11 @@ const rule: ElFormRules = {
message: '手机号码不能为空',
trigger: 'blur'
},
{ pattern: /^1[3456789][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }
{
pattern: /^1[3456789][0-9]\d{8}$/,
message: '请输入正确的手机号码',
trigger: 'blur'
}
]
};
const rules = ref<ElFormRules>(rule);
@@ -58,13 +63,13 @@ const submit = () => {
userRef.value?.validate(async (valid: boolean) => {
if (valid) {
await updateUserProfile(props.user);
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
}
});
};
/** 关闭按钮 */
const close = () => {
proxy?.$tab.closePage();
tab.closePage();
};
</script>
+24 -12
View File
@@ -1,18 +1,29 @@
<template>
<el-drawer v-model="visible" title="用户信息详情" :size="680" append-to-body :close-on-click-modal="true" @closed="info = null">
<el-drawer
v-model="visible"
title="用户信息详情"
:size="680"
append-to-body
:close-on-click-modal="true"
@closed="info = null"
>
<el-descriptions v-if="info" v-loading="loading" :column="2" border>
<el-descriptions-item label="用户名称">{{ info.nickName }}</el-descriptions-item>
<el-descriptions-item label="归属部门">{{ info.deptName || (info.dept && info.dept.deptName) || '-' }}</el-descriptions-item>
<el-descriptions-item label="归属部门">
{{ info.deptName || (info.dept && info.dept.deptName) || '-' }}
</el-descriptions-item>
<el-descriptions-item label="手机号码">{{ info.phoneNumber || '-' }}</el-descriptions-item>
<el-descriptions-item label="邮箱">{{ info.email || '-' }}</el-descriptions-item>
<el-descriptions-item label="登录账号">{{ info.userName }}</el-descriptions-item>
<el-descriptions-item label="用户状态">
<el-tag :type="info.status === '0' ? 'success' : 'danger'">
{{ proxy?.selectDictLabel(sys_normal_disable, info.status) }}
{{ selectDictLabel(sys_normal_disable, info.status) }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="岗位">{{ postNames || '-' }}</el-descriptions-item>
<el-descriptions-item label="用户性别">{{ proxy?.selectDictLabel(sys_user_gender, info.gender) || '-' }}</el-descriptions-item>
<el-descriptions-item label="用户性别">
{{ selectDictLabel(sys_user_gender, info.gender) || '-' }}
</el-descriptions-item>
<el-descriptions-item label="角色" :span="2">{{ roleNames || '-' }}</el-descriptions-item>
</el-descriptions>
@@ -29,13 +40,14 @@
</template>
<script setup lang="ts">
import api from '@/api/system/user';
import type { UserVO } from '@/api/system/user/types';
import type { PostVO } from '@/api/system/post/types';
import type { RoleVO } from '@/api/system/role/types';
import type { UserVO } from '@/api/system/user/types';
import api from '@/api/system/user';
import { useDict } from '@/utils/dict';
import { selectDictLabel } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable, sys_user_gender } = toRefs<any>(proxy?.useDict('sys_normal_disable', 'sys_user_gender'));
const { sys_normal_disable, sys_user_gender } = toRefs<any>(useDict('sys_normal_disable', 'sys_user_gender'));
const visible = ref(false);
const loading = ref(false);
@@ -48,16 +60,16 @@ const roleIds = ref<string[]>([]);
const postNames = computed(() => {
if (!postOptions.value.length || !postIds.value.length) return '';
return postOptions.value
.filter((p) => postIds.value.includes(String(p.postId)))
.map((p) => p.postName)
.filter(p => postIds.value.includes(String(p.postId)))
.map(p => p.postName)
.join('、');
});
const roleNames = computed(() => {
if (!roleOptions.value.length || !roleIds.value.length) return '';
return roleOptions.value
.filter((r) => roleIds.value.includes(String(r.roleId)))
.map((r) => r.roleName)
.filter(r => roleIds.value.includes(String(r.roleId)))
.map(r => r.roleName)
.join('、');
});
+16 -1
View File
@@ -1,5 +1,5 @@
<template>
<el-form ref="basicInfoForm" :model="infoForm" :rules="rules" label-width="150px">
<el-form ref="formRef" :model="infoForm" :rules="rules" label-width="150px">
<el-row>
<el-col :span="12">
<el-form-item label="表名称" prop="tableName">
@@ -31,6 +31,7 @@
</template>
<script setup lang="ts">
import type { FormInstance } from 'element-plus';
import { propTypes } from '@/utils/propTypes';
const prop = defineProps({
@@ -38,6 +39,7 @@ const prop = defineProps({
});
const infoForm = computed(() => prop.info);
const formRef = ref<FormInstance>();
// 表单校验
const rules = ref({
@@ -46,4 +48,17 @@ const rules = ref({
className: [{ required: true, message: '请输入实体类名称', trigger: 'blur' }],
functionAuthor: [{ required: true, message: '请输入作者', trigger: 'blur' }]
});
/** Element Plus 推荐:通过 validate() 的 Promise 做校验 */
async function validate(): Promise<boolean> {
if (!formRef.value) return false;
try {
await formRef.value.validate();
return true;
} catch {
return false;
}
}
defineExpose({ validate });
</script>
+45 -64
View File
@@ -118,17 +118,17 @@
</template>
<script setup name="GenEdit" lang="ts">
import { getGenTable, updateGenTable } from '@/api/tool/gen';
import { DbColumnVO, DbTableVO } from '@/api/tool/gen/types';
import { useRoute } from 'vue-router';
import { optionselect as getDictOptionselect } from '@/api/system/dict/type';
import { DictTypeVO } from '@/api/system/dict/type/types';
import { getGenTable, updateGenTable } from '@/api/tool/gen';
import { DbColumnVO, DbTableVO } from '@/api/tool/gen/types';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import BasicInfoForm from './basicInfoForm.vue';
import GenInfoForm from './genInfoForm.vue';
import { RouteLocationNormalized } from 'vue-router';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const activeName = ref('columnInfo');
const tableHeight = ref(document.documentElement.scrollHeight - 245 + 'px');
const tables = ref<DbTableVO[]>([]);
@@ -140,64 +140,45 @@ const basicInfo = ref<InstanceType<typeof BasicInfoForm>>();
const genInfo = ref<InstanceType<typeof GenInfoForm>>();
/** 提交按钮 */
const submitForm = () => {
const basicForm = basicInfo.value?.$refs.basicInfoForm;
const genForm = genInfo.value?.$refs.genInfoForm;
Promise.all([basicForm, genForm].map(getFormPromise)).then(async res => {
const validateResult = res.every(item => !!item);
if (validateResult) {
const genTable: any = 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
};
const response = await updateGenTable(genTable);
proxy?.$modal.msgSuccess(response.msg);
if (response.code === 200) {
close();
}
} else {
proxy?.$modal.msgError('表单校验未通过,请重新检查提交内容');
}
});
};
const getFormPromise = (form: any) => {
return new Promise(resolve => {
form.validate((res: any) => {
resolve(res);
});
});
};
const close = () => {
const obj: RouteLocationNormalized = {
path: '/tool/gen',
fullPath: '',
hash: '',
matched: [],
meta: undefined,
name: undefined,
params: undefined,
redirectedFrom: undefined,
query: { t: Date.now().toString(), pageNum: route.query.pageNum }
};
proxy?.$tab.closeOpenPage(obj);
};
(async () => {
const tableId = route.params && (route.params.tableId as string);
if (tableId) {
// 获取表详细信息
const res = await getGenTable(tableId);
columns.value = res.data.rows;
info.value = res.data.info;
tables.value = res.data.tables;
/** 查询字典下拉列表 */
const response = await getDictOptionselect();
dictOptions.value = response.data;
const submitForm = async () => {
const basicOk = (await basicInfo.value?.validate()) ?? false;
const genOk = (await genInfo.value?.validate()) ?? false;
if (!basicOk || !genOk) {
modal.msgError('表单校验未通过,请重新检查提交内容');
return;
}
})();
const genTable: Record<string, unknown> = { ...info.value };
genTable.columns = columns.value;
genTable.params = {
treeCode: info.value?.treeCode,
treeName: info.value.treeName,
treeParentCode: info.value.treeParentCode,
parentMenuId: info.value.parentMenuId
};
const response = await updateGenTable(genTable as any);
modal.msgSuccess(response.msg ?? '');
if (response.code === 200) {
close();
}
};
const close = () => {
tab.closeOpenPage({
path: '/tool/gen',
query: { t: Date.now().toString(), pageNum: route.query.pageNum }
});
};
onMounted(async () => {
const tableId = route.params?.tableId as string | undefined;
if (!tableId) return;
const res = await getGenTable(tableId);
const detail = res.data;
if (!detail) return;
columns.value = detail.rows;
info.value = detail.info;
tables.value = detail.tables;
const response = await getDictOptionselect();
dictOptions.value = response.data;
});
</script>
+17 -3
View File
@@ -1,5 +1,5 @@
<template>
<el-form ref="genInfoForm" :model="infoForm" :rules="rules" label-width="150px">
<el-form ref="formRef" :model="infoForm" :rules="rules" label-width="150px">
<el-row>
<el-col :span="12">
<el-form-item prop="tplCategory">
@@ -227,18 +227,20 @@
</template>
<script setup lang="ts">
import type { FormInstance } from 'element-plus';
import { listMenu } from '@/api/system/menu';
import { propTypes } from '@/utils/propTypes';
import { handleTree } from '@/utils/ruoyi';
interface MenuOptionsType {
menuId: number | string;
menuName: string;
children?: MenuOptionsType[];
}
const { proxy } = getCurrentInstance();
const subColumns = ref<any>([]);
const menuOptions = ref<Array<MenuOptionsType>>([]);
const formRef = ref<FormInstance>();
const props = defineProps({
info: propTypes.any.isRequired,
@@ -279,7 +281,7 @@ const setSubTableColumns = (value: string) => {
/** 查询菜单下拉树结构 */
const getMenuTreeselect = async () => {
const res = await listMenu();
const data = proxy?.handleTree<MenuOptionsType>(res.data, 'menuId');
const data = handleTree<MenuOptionsType>(res.data, 'menuId');
if (data) {
menuOptions.value = data;
@@ -293,6 +295,18 @@ watch(
}
);
async function validate(): Promise<boolean> {
if (!formRef.value) return false;
try {
await formRef.value.validate();
return true;
} catch {
return false;
}
}
defineExpose({ validate });
onMounted(() => {
getMenuTreeselect();
});
+7 -4
View File
@@ -53,12 +53,12 @@
<script setup lang="ts">
import { listDbTable, importTable, getDataNames } from '@/api/tool/gen';
import { DbTableQuery, DbTableVO } from '@/api/tool/gen/types';
import modal from '@/plugins/modal';
const total = ref(0);
const visible = ref(false);
const tables = ref<Array<string>>([]);
const dbTableList = ref<Array<DbTableVO>>([]);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const tableRef = ref<ElTableInstance>();
const queryFormRef = ref<ElFormInstance>();
@@ -118,11 +118,14 @@ const resetQuery = () => {
const handleImportTable = async () => {
const tableNames = tables.value.join(',');
if (tableNames == '') {
proxy?.$modal.msgError('请选择要导入的表');
modal.msgError('请选择要导入的表');
return;
}
const res = await importTable({ tables: tableNames, dataName: queryParams.dataName });
proxy?.$modal.msgSuccess(res.msg);
const res = await importTable({
tables: tableNames,
dataName: queryParams.dataName
});
modal.msgSuccess(res.msg ?? '');
if (res.code === 200) {
visible.value = false;
emit('ok');
+14 -11
View File
@@ -191,13 +191,16 @@
</template>
<script setup name="Gen" lang="ts">
import { useRoute } from 'vue-router';
import { delTable, genCode, getDataNames, listTable, previewTable, synchDb } from '@/api/tool/gen';
import { TableQuery, TableVO } from '@/api/tool/gen/types';
import download from '@/plugins/download';
import modal from '@/plugins/modal';
import router from '@/router';
import { addDateRange } from '@/utils/ruoyi';
import ImportTable from './importTable.vue';
const route = useRoute();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const tableList = ref<TableVO[]>([]);
const loading = ref(true);
@@ -206,7 +209,7 @@ const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const uniqueId = ref('');
const dataNameList = ref<Array<string>>([]);
@@ -242,7 +245,7 @@ const getDataNameList = async () => {
/** 查询表集合 */
const getList = async () => {
loading.value = true;
const res = await listTable(proxy?.addDateRange(queryParams.value, dateRange.value));
const res = await listTable(addDateRange(queryParams.value, dateRange.value));
tableList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
@@ -256,22 +259,22 @@ const handleQuery = () => {
const handleGenTable = async (row?: TableVO) => {
const tbIds = row?.tableId || ids.value;
if (tbIds == '') {
proxy?.$modal.msgError('请选择要生成的数据');
modal.msgError('请选择要生成的数据');
return;
}
if (row?.genType === '1') {
await genCode(row.tableId);
proxy?.$modal.msgSuccess('成功生成到自定义路径:' + row.genPath);
modal.msgSuccess('成功生成到自定义路径:' + row.genPath);
} else {
proxy?.$download.zip('/tool/gen/batchGenCode?tableIdStr=' + tbIds, 'ruoyi.zip');
download.zip('/tool/gen/batchGenCode?tableIdStr=' + tbIds, 'ruoyi.zip');
}
};
/** 同步数据库操作 */
const handleSynchDb = async (row: TableVO) => {
const tableId = row.tableId;
await proxy?.$modal.confirm('确认要强制同步"' + row.tableName + '"表结构吗?');
await modal.confirm('确认要强制同步"' + row.tableName + '"表结构吗?');
await synchDb(tableId);
proxy?.$modal.msgSuccess('同步成功');
modal.msgSuccess('同步成功');
};
/** 打开导入表弹窗 */
const openImportTable = () => {
@@ -292,7 +295,7 @@ const handlePreview = async (row: TableVO) => {
};
/** 复制代码成功 */
const copyTextSuccess = () => {
proxy?.$modal.msgSuccess('复制成功');
modal.msgSuccess('复制成功');
};
// 多选框选中数据
const handleSelectionChange = (selection: TableVO[]) => {
@@ -311,10 +314,10 @@ const handleEditTable = (row?: TableVO) => {
/** 删除按钮操作 */
const handleDelete = async (row?: TableVO) => {
const tableIds = row?.tableId || ids.value;
await proxy?.$modal.confirm('是否确认删除表编号为"' + tableIds + '"的数据项?');
await modal.confirm('是否确认删除表编号为"' + tableIds + '"的数据项?');
await delTable(tableIds);
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {
+7 -7
View File
@@ -123,6 +123,8 @@
<script setup name="Category" lang="ts">
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from '@/api/workflow/category';
import { CategoryVO, CategoryQuery, CategoryForm } from '@/api/workflow/category/types';
import modal from '@/plugins/modal';
import { handleTree } from '@/utils/ruoyi';
type CategoryOption = {
categoryId: number;
@@ -130,8 +132,6 @@ type CategoryOption = {
children?: CategoryOption[];
};
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const categoryList = ref<CategoryVO[]>([]);
const categoryOptions = ref<CategoryOption[]>([]);
const buttonLoading = ref(false);
@@ -173,7 +173,7 @@ const { queryParams, form, rules } = toRefs(data);
const getList = async () => {
loading.value = true;
const res = await listCategory(queryParams.value);
const data = proxy?.handleTree<CategoryVO>(res.data, 'categoryId', 'parentId');
const data = handleTree<CategoryVO>(res.data, 'categoryId', 'parentId');
if (data) {
categoryList.value = data;
loading.value = false;
@@ -185,7 +185,7 @@ const getTreeselect = async () => {
const res = await listCategory();
categoryOptions.value = [];
// 处理树形数据
const data = proxy?.handleTree<CategoryOption>(res.data, 'categoryId', 'parentId');
const data = handleTree<CategoryOption>(res.data, 'categoryId', 'parentId');
if (data) {
categoryOptions.value = data; // 将处理后的树形数据赋值
}
@@ -264,7 +264,7 @@ const submitForm = () => {
} else {
await addCategory(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
getList();
}
@@ -273,11 +273,11 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row: CategoryVO) => {
await proxy?.$modal.confirm('是否确认删除"' + row.categoryName + '"的分类?');
await modal.confirm('是否确认删除"' + row.categoryName + '"的分类?');
loading.value = true;
await delCategory(row.categoryId).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {
+23 -16
View File
@@ -73,12 +73,12 @@
</el-table-column>
<el-table-column label="开始时间" align="center" prop="startDate">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" align="center" prop="endDate">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="请假天数" align="center" prop="leaveDays" />
@@ -151,12 +151,19 @@
</template>
<script setup name="Leave" lang="ts">
import { delLeave, listLeave } from '@/api/workflow/leave';
import { useRoute } from 'vue-router';
import { cancelProcessApply } from '@/api/workflow/instance';
import { delLeave, listLeave } from '@/api/workflow/leave';
import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import router from '@/router';
import { useDict } from '@/utils/dict';
import { download as requestDownload } from '@/utils/request';
import { parseTime } from '@/utils/ruoyi';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
const route = useRoute();
const { wf_business_status } = toRefs<any>(useDict('wf_business_status'));
const leaveList = ref<LeaveVO[]>([]);
const loading = ref(true);
const showSearch = ref(true);
@@ -228,8 +235,8 @@ const handleSelectionChange = (selection: LeaveVO[]) => {
/** 新增按钮操作 */
const handleAdd = () => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
tab.closePage(route);
router.push({
path: `/workflow/leaveEdit/index`,
query: {
type: 'add'
@@ -239,8 +246,8 @@ const handleAdd = () => {
/** 修改按钮操作 */
const handleUpdate = (row?: LeaveVO) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
tab.closePage(route);
router.push({
path: `/workflow/leaveEdit/index`,
query: {
id: row.id,
@@ -251,8 +258,8 @@ const handleUpdate = (row?: LeaveVO) => {
/** 查看按钮操作 */
const handleView = (row?: LeaveVO) => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
tab.closePage(route);
router.push({
path: `/workflow/leaveEdit/index`,
query: {
id: row.id,
@@ -264,15 +271,15 @@ const handleView = (row?: LeaveVO) => {
/** 删除按钮操作 */
const handleDelete = async (row?: LeaveVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除请假编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await modal.confirm('是否确认删除请假编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delLeave(_ids);
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'workflow/leave/export',
{
...queryParams.value
@@ -283,7 +290,7 @@ const handleExport = () => {
/** 撤销按钮操作 */
const handleCancelProcessApply = async (id: string) => {
await proxy?.$modal.confirm('是否确认撤销当前单据?');
await modal.confirm('是否确认撤销当前单据?');
loading.value = true;
const data = {
businessId: id,
@@ -291,7 +298,7 @@ const handleCancelProcessApply = async (id: string) => {
};
await cancelProcessApply(data).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('撤销成功');
modal.msgSuccess('撤销成功');
};
onMounted(() => {
getList();
+19 -15
View File
@@ -61,15 +61,19 @@
</template>
<script setup name="Leave" lang="ts">
import { useRoute } from 'vue-router';
import { addLeave, getLeave, submitAndFlowStart, updateLeave } from '@/api/workflow/leave';
import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
import { startWorkFlow } from '@/api/workflow/task';
import SubmitVerify from '@/components/Process/submitVerify.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import ApprovalButton from '@/components/Process/approvalButton.vue';
import { AxiosResponse } from 'axios';
import { StartProcessBo } from '@/api/workflow/workflowCommon/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import ApprovalButton from '@/components/Process/approvalButton.vue';
import ApprovalRecord from '@/components/Process/approvalRecord.vue';
import SubmitVerify from '@/components/Process/submitVerify.vue';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import router from '@/router';
const route = useRoute();
const buttonLoading = ref(false);
const loading = ref(true);
@@ -197,7 +201,7 @@ const getInfo = () => {
/** 提交按钮 */
const submitForm = (status: string, mode: boolean) => {
if (leaveTime.value.length === 0) {
proxy?.$modal.msgError('请假时间不能为空');
modal.msgError('请假时间不能为空');
return;
}
try {
@@ -211,9 +215,9 @@ const submitForm = (status: string, mode: boolean) => {
const res = await submitAndFlowStart(form.value).finally(() => (buttonLoading.value = false));
form.value = res.data;
buttonLoading.value = false;
proxy?.$modal.msgSuccess('操作成功');
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
modal.msgSuccess('操作成功');
tab.closePage(route);
router.go(-1);
} else {
let res;
if (form.value.id) {
@@ -224,9 +228,9 @@ const submitForm = (status: string, mode: boolean) => {
form.value = res.data;
if (status === 'draft') {
buttonLoading.value = false;
proxy?.$modal.msgSuccess('暂存成功');
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
modal.msgSuccess('暂存成功');
tab.closePage(route);
router.go(-1);
} else {
await handleStartWorkFlow(res.data);
}
@@ -272,8 +276,8 @@ const handleApprovalRecord = () => {
};
//提交回调
const submitCallback = async () => {
await proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
await tab.closePage(route);
router.go(-1);
};
//审批
const approvalVerifyOpen = async () => {
@@ -282,7 +286,7 @@ const approvalVerifyOpen = async () => {
onMounted(() => {
nextTick(async () => {
routeParams.value = proxy.$route.query;
routeParams.value = route.query;
reset();
loading.value = false;
if (
+17 -15
View File
@@ -5,23 +5,21 @@
</template>
<script setup name="WarmFlow" lang="ts">
const { proxy } = getCurrentInstance();
import { onMounted } from 'vue';
import { onBeforeUnmount, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import tab from '@/plugins/tab';
import { getToken } from '@/utils/auth';
const route = useRoute();
// definitionId为需要查询的流程定义id,
// disabled为是否可编辑, 例如:查看的时候不可编辑,不可保存
const iframeUrl = ref('');
const baseUrl = import.meta.env.VITE_APP_BASE_API;
const iframeLoaded = () => {
// iframe监听组件内设计器保存事件
window.onmessage = event => {
switch (event.data.method) {
case 'close':
close();
break;
}
};
const onDesignerMessage = (event: MessageEvent) => {
if (event.data?.method === 'close') {
close();
}
};
const open = async (definitionId, disabled) => {
const url = baseUrl + `/warm-flow-ui/index.html?id=${definitionId}&onlyDesignShow=true`;
@@ -31,14 +29,18 @@ const open = async (definitionId, disabled) => {
function close() {
const obj = {
path: '/workflow/processDefinition',
query: { activeName: proxy.$route.query.activeName }
query: { activeName: route.query.activeName }
};
proxy.$tab.closeOpenPage(obj);
tab.closeOpenPage(obj);
}
onMounted(() => {
iframeLoaded();
open(proxy.$route.query.definitionId, proxy.$route.query.disabled);
window.addEventListener('message', onDesignerMessage);
open(route.query.definitionId, route.query.disabled);
});
onBeforeUnmount(() => {
window.removeEventListener('message', onDesignerMessage);
});
/**
* 对外暴露子组件方法
+39 -33
View File
@@ -324,7 +324,10 @@
</template>
<script setup name="processDefinition" lang="ts">
import TreePanel from '@/components/TreePanel/index.vue';
import type { ElMessageBoxOptions, TabsPaneContext, UploadRequestOptions } from 'element-plus';
import { useRoute, useRouter } from 'vue-router';
import { categoryTree } from '@/api/workflow/category';
import { CategoryTreeVO } from '@/api/workflow/category/types';
import {
listDefinition,
deleteDefinition,
@@ -337,12 +340,13 @@ import {
getInfo,
copy
} from '@/api/workflow/definition';
import { categoryTree } from '@/api/workflow/category';
import { CategoryTreeVO } from '@/api/workflow/category/types';
import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types';
import type { ElMessageBoxOptions, TabsPaneContext, UploadRequestOptions } from 'element-plus';
import TreePanel from '@/components/TreePanel/index.vue';
import modal from '@/plugins/modal';
import { download as requestDownload } from '@/utils/request';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const router = useRouter();
const queryFormRef = ref<ElFormInstance>();
const treePanelRef = ref<InstanceType<typeof TreePanel>>();
@@ -458,10 +462,11 @@ const handleSelectionChange = (selection: any) => {
};
//分页
const getPageList = async () => {
const query = proxy.$route.query;
if (query.activeName) {
activeName.value = query.activeName;
proxy.$route.query.activeName = '';
if (route.query.activeName) {
activeName.value = route.query.activeName as string;
const q = { ...route.query };
delete q.activeName;
router.replace({ path: route.path, query: q });
}
if (activeName.value === '0') {
getList();
@@ -490,16 +495,16 @@ const getUnPublishList = async () => {
const handleDelete = async (row?: FlowDefinitionVo) => {
const id = row?.id || ids.value;
const defList = processDefinitionList.value.filter(x => id.indexOf(x.id) != -1).map(x => x.flowCode);
await proxy?.$modal.confirm('是否确认删除流程定义编码为【' + defList + '】的数据项?');
await modal.confirm('是否确认删除流程定义编码为【' + defList + '】的数据项?');
loading.value = true;
await deleteDefinition(id).finally(() => (loading.value = false));
await handleQuery();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 发布流程定义 */
const handlePublish = async (row?: FlowDefinitionVo) => {
await proxy?.$modal.confirm(
await modal.confirm(
'是否确认发布流程定义编码为【' +
row.flowCode +
'】版本为【' +
@@ -510,7 +515,7 @@ const handlePublish = async (row?: FlowDefinitionVo) => {
await publish(row.id).finally(() => (loading.value = false));
activeName.value = '0';
await handleQuery();
proxy?.$modal.msgSuccess('发布成功');
modal.msgSuccess('发布成功');
};
/** 挂起/激活 */
const handleProcessDefState = async (row: FlowDefinitionVo, status: number | string | boolean) => {
@@ -522,10 +527,10 @@ const handleProcessDefState = async (row: FlowDefinitionVo, status: number | str
}
try {
loading.value = true;
await proxy?.$modal.confirm(msg);
await modal.confirm(msg);
await active(row.id, !!status);
await handleQuery();
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
} catch (error) {
row.activityStatus = status === 0 ? 1 : 0;
console.error(error);
@@ -537,11 +542,11 @@ const handleProcessDefState = async (row: FlowDefinitionVo, status: number | str
//上传文件前的钩子
const handlerBeforeUpload = () => {
if (selectCategory.value === 'ALL') {
proxy?.$modal.msgError('顶级节点不可作为分类!');
modal.msgError('顶级节点不可作为分类!');
return false;
}
if (!selectCategory.value) {
proxy?.$modal.msgError('请选择左侧要上传的分类!');
modal.msgError('请选择左侧要上传的分类!');
return false;
}
};
@@ -554,7 +559,7 @@ const handlerImportDefinition = (data: UploadRequestOptions): XMLHttpRequest =>
importDef(formData)
.then(() => {
uploadDialog.visible = false;
proxy?.$modal.msgSuccess('部署成功');
modal.msgSuccess('部署成功');
activeName.value = '1';
handleQuery();
})
@@ -568,12 +573,12 @@ const handlerImportDefinition = (data: UploadRequestOptions): XMLHttpRequest =>
* @param row
*/
const design = async (row: FlowDefinitionVo) => {
proxy.$router.push({
router.push({
path: `/workflow/design/index`,
query: {
definitionId: row.id,
disabled: false,
activeName: activeName.value
definitionId: String(row.id),
disabled: 'false',
activeName: String(activeName.value)
}
});
};
@@ -583,12 +588,12 @@ const design = async (row: FlowDefinitionVo) => {
* @param row
*/
const designView = async (row: FlowDefinitionVo) => {
proxy.$router.push({
router.push({
path: `/workflow/design/index`,
query: {
definitionId: row.id,
disabled: true,
activeName: activeName.value
definitionId: String(row.id),
disabled: 'true',
activeName: String(activeName.value)
}
});
};
@@ -602,8 +607,8 @@ const reset = () => {
*/
const handleAdd = async () => {
reset();
if (queryParams.value.category != '') {
form.value.category = queryParams.value.category;
if (queryParams.value.category != null && queryParams.value.category !== '') {
form.value.category = String(queryParams.value.category);
}
form.value.modelValue = 'CLASSICS';
form.value.formCustom = 'N';
@@ -631,8 +636,9 @@ const handleSubmit = async () => {
defFormRef.value.validate(async (valid: boolean) => {
if (valid) {
loading.value = true;
const ext = {};
ext.autoPass = autoPass.value;
const ext: { autoPass: boolean } = {
autoPass: autoPass.value
};
form.value.ext = JSON.stringify(ext);
if (form.value.id) {
await edit(form.value).finally(() => (loading.value = false));
@@ -640,7 +646,7 @@ const handleSubmit = async () => {
await add(form.value).finally(() => (loading.value = false));
activeName.value = '1';
}
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
modelDialog.visible = false;
handleQuery();
}
@@ -657,7 +663,7 @@ const handleCopyDef = async (row: FlowDefinitionVo) => {
copy(row.id)
.then(resp => {
if (resp.code === 200) {
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
activeName.value = '1';
handleQuery();
}
@@ -668,7 +674,7 @@ const handleCopyDef = async (row: FlowDefinitionVo) => {
/** 导出按钮操作 */
const handleExportDef = () => {
proxy?.download(`/workflow/definition/exportDef/${ids.value[0]}`, {}, `${flowCodeList.value[0]}.json`);
requestDownload(`/workflow/definition/exportDef/${ids.value[0]}`, {}, `${flowCodeList.value[0]}.json`);
};
</script>
+40 -34
View File
@@ -9,7 +9,7 @@
placeholder="请输入流程分类名"
:data="categoryOptions"
:expanded-span="4"
filter-field="categoryName"
filter-field="label"
@node-click="handleNodeClick"
/>
<el-col
@@ -60,7 +60,7 @@
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
@click="() => handleDelete()"
>
删除
</el-button>
@@ -143,7 +143,12 @@
<template #default="scope">
<el-row v-if="tab === 'running'" :gutter="10" class="mb8">
<el-col :span="1.5">
<el-popover :ref="`popoverRef${scope.$index}`" trigger="click" placement="left" :width="300">
<el-popover
:ref="el => setPopoverRef(el, scope.$index)"
trigger="click"
placement="left"
:width="300"
>
<el-input
v-model="deleteReason"
resize="none"
@@ -295,7 +300,12 @@
</template>
<script setup lang="ts">
import TreePanel from '@/components/TreePanel/index.vue';
import { ElForm, FormInstance, type TabsPaneContext } from 'element-plus';
import { ref } from 'vue';
import VueJsonPretty from 'vue-json-pretty';
import { UserVO } from '@/api/system/user/types';
import { categoryTree } from '@/api/workflow/category';
import { CategoryTreeVO } from '@/api/workflow/category/types';
import {
pageByRunning,
pageByFinish,
@@ -305,22 +315,24 @@ import {
invalid,
updateVariable
} from '@/api/workflow/instance';
import { categoryTree } from '@/api/workflow/category';
import { CategoryTreeVO } from '@/api/workflow/category/types';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import 'vue-json-pretty/lib/styles.css';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';
import TreePanel from '@/components/TreePanel/index.vue';
import UserSelect from '@/components/UserSelect/index.vue';
import { ElForm, FormInstance } from 'element-plus';
//审批记录组件
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
const { wf_business_status } = toRefs<any>(useDict('wf_business_status'));
const queryFormRef = ref<ElFormInstance>();
const treePanelRef = ref<InstanceType<typeof TreePanel>>();
import { ref } from 'vue';
import { UserVO } from '@/api/system/user/types';
const popoverRefs = ref<Record<number, { hide?: () => void } | null>>({});
const setPopoverRef = (el: unknown, index: number) => {
if (el) {
popoverRefs.value[index] = el as { hide?: () => void };
}
};
const form = ref<Record<string, any>>({
instanceId: undefined,
key: undefined,
@@ -354,7 +366,7 @@ const processDefinitionName = ref();
// 模型定义表格数据
const processInstanceList = ref<FlowInstanceVO[]>([]);
const processDefinitionHistoryList = ref<Array<any>>([]);
const categoryOptions = ref<CategoryOption[]>([]);
const categoryOptions = ref<CategoryTreeVO[]>([]);
const treeCollapsed = ref(false);
const processDefinitionDialog = reactive<DialogOption>({
@@ -362,12 +374,6 @@ const processDefinitionDialog = reactive<DialogOption>({
title: '流程定义'
});
type CategoryOption = {
id: string;
categoryName: string;
children?: CategoryOption[];
};
const tab = ref('running');
// 作废原因
const deleteReason = ref('');
@@ -446,9 +452,9 @@ const getProcessInstanceFinishList = () => {
};
/** 删除按钮操作 */
const handleDelete = async (row: FlowInstanceVO) => {
const instanceIdList = row.id || instanceIds.value;
await proxy?.$modal.confirm('是否确认删除?');
const handleDelete = async (row?: FlowInstanceVO) => {
const instanceIdList = row?.id ?? instanceIds.value;
await modal.confirm('是否确认删除?');
loading.value = true;
if ('running' === tab.value) {
await deleteByInstanceIds(instanceIdList).finally(() => (loading.value = false));
@@ -457,12 +463,12 @@ const handleDelete = async (row: FlowInstanceVO) => {
await deleteHisByInstanceIds(instanceIdList).finally(() => (loading.value = false));
getProcessInstanceFinishList();
}
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
const changeTab = async (data: string) => {
const changeTab = async (pane: TabsPaneContext) => {
processInstanceList.value = [];
queryParams.value.pageNum = 1;
if ('running' === data.paneName) {
if ('running' === pane.paneName) {
getProcessInstanceRunningList();
} else {
getProcessInstanceFinishList();
@@ -470,7 +476,7 @@ const changeTab = async (data: string) => {
};
/** 作废按钮操作 */
const handleInvalid = async (row: FlowInstanceVO) => {
await proxy?.$modal.confirm('是否确认作废?');
await modal.confirm('是否确认作废?');
loading.value = true;
if ('running' === tab.value) {
const param = {
@@ -479,11 +485,11 @@ const handleInvalid = async (row: FlowInstanceVO) => {
};
await invalid(param).finally(() => (loading.value = false));
getProcessInstanceRunningList();
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
}
};
const cancelPopover = async (index: any) => {
(proxy?.$refs[`popoverRef${index}`] as any)?.hide(); //关闭弹窗
const cancelPopover = async (index: number) => {
popoverRefs.value[index]?.hide?.();
};
/** 查看按钮操作 */
const handleView = row => {
@@ -494,7 +500,7 @@ const handleView = row => {
formCustom: row.formCustom,
formPath: row.formPath
});
workflowCommon.routerJump(routerJumpVo, proxy);
workflowCommon.routerJump(routerJumpVo);
};
//查询流程变量
@@ -560,9 +566,9 @@ const handleVariable = async (formEl: FormInstance | undefined) => {
await formEl.validate(async (valid, fields) => {
if (valid) {
form.value.instanceId = instanceId.value;
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
await updateVariable(form.value);
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
const data = await instanceVariable(instanceId.value);
variables.value = data.data.variable;
}
+6 -5
View File
@@ -210,9 +210,10 @@
<script setup name="Spel" lang="ts">
import { listSpel, getSpel, delSpel, addSpel, updateSpel } from '@/api/workflow/spel';
import { SpelVO, SpelQuery, SpelForm } from '@/api/workflow/spel/types';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_show_hide, sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_show_hide', 'sys_normal_disable'));
const { sys_show_hide, sys_normal_disable } = toRefs<any>(useDict('sys_show_hide', 'sys_normal_disable'));
const spelList = ref<SpelVO[]>([]);
const buttonLoading = ref(false);
@@ -326,7 +327,7 @@ const submitForm = () => {
} else {
await addSpel(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -336,11 +337,11 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: SpelVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal
await modal
.confirm('是否确认删除流程spel表达式定义编号为"' + _ids + '"的数据项?')
.finally(() => (loading.value = false));
await delSpel(_ids);
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
await getList();
};
+16 -14
View File
@@ -176,15 +176,18 @@
</template>
<script setup lang="ts">
import { TabsPaneContext } from 'element-plus';
import { UserVO } from '@/api/system/user/types';
import { pageByAllTaskWait, pageByAllTaskFinish, updateAssignee, urgeTask } from '@/api/workflow/task';
import UserSelect from '@/components/UserSelect';
import { TaskQuery } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
import processMeddle from '@/components/Process/processMeddle';
import messageType from '@/components/Process/MessageType';
import { UserVO } from '@/api/system/user/types';
import { TabsPaneContext } from 'element-plus';
import messageType from '@/components/Process/MessageType.vue';
import processMeddle from '@/components/Process/processMeddle.vue';
import UserSelect from '@/components/UserSelect/index.vue';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
//选人组件
const userSelectRef = ref<InstanceType<typeof UserSelect>>();
//流程干预组件
@@ -194,9 +197,8 @@ const applyUserSelectRef = ref<InstanceType<typeof UserSelect>>();
//消息组件
const messageTypeRef = ref<InstanceType<typeof messageType>>();
const queryFormRef = ref<ElFormInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
const { wf_task_status } = toRefs<any>(proxy?.useDict('wf_task_status'));
const { wf_business_status } = toRefs<any>(useDict('wf_business_status'));
const { wf_task_status } = toRefs<any>(useDict('wf_task_status'));
// 遮罩层
const loading = ref(true);
// 选中数组
@@ -289,23 +291,23 @@ const handleUserOpen = () => {
//打开修改选人
const handleUserTask = async data => {
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
data.taskIdList = ids.value;
await urgeTask(data);
messageTypeRef.value.close();
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
handleQuery();
};
//修改办理人
const submitCallback = async data => {
if (data && data.length > 0) {
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
await updateAssignee(ids.value, data[0].userId);
handleQuery();
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
} else {
proxy?.$modal.msgWarning('请选择用户!');
modal.msgWarning('请选择用户!');
}
};
/** 查看按钮操作 */
@@ -317,7 +319,7 @@ const handleView = row => {
formCustom: row.formCustom,
formPath: row.formPath
});
workflowCommon.routerJump(routerJumpVo, proxy);
workflowCommon.routerJump(routerJumpVo);
};
const handleMeddle = row => {
processMeddleRef.value.open(row.id);
+11 -10
View File
@@ -149,17 +149,18 @@
</template>
<script setup lang="ts">
import TreePanel from '@/components/TreePanel/index.vue';
import { pageByCurrent, deleteByInstanceIds, cancelProcessApply } from '@/api/workflow/instance';
import { categoryTree } from '@/api/workflow/category';
import { CategoryTreeVO } from '@/api/workflow/category/types';
import { pageByCurrent, deleteByInstanceIds, cancelProcessApply } from '@/api/workflow/instance';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
import TreePanel from '@/components/TreePanel/index.vue';
import modal from '@/plugins/modal';
import { useDict } from '@/utils/dict';
const { wf_business_status } = toRefs<any>(useDict('wf_business_status'));
const queryFormRef = ref<ElFormInstance>();
const treePanelRef = ref<InstanceType<typeof TreePanel>>();
// 遮罩层
const loading = ref(true);
@@ -240,18 +241,18 @@ const getList = () => {
/** 删除按钮操作 */
const handleDelete = async (row: FlowInstanceVO) => {
const instanceIdList = row.id || instanceIds.value;
await proxy?.$modal.confirm('是否确认删除?');
await modal.confirm('是否确认删除?');
loading.value = true;
if ('running' === tab.value) {
await deleteByInstanceIds(instanceIdList).finally(() => (loading.value = false));
getList();
}
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
/** 撤销按钮操作 */
const handleCancelProcessApply = async (businessId: string) => {
await proxy?.$modal.confirm('是否确认撤销当前单据?');
await modal.confirm('是否确认撤销当前单据?');
loading.value = true;
if ('running' === tab.value) {
const data = {
@@ -261,7 +262,7 @@ const handleCancelProcessApply = async (businessId: string) => {
await cancelProcessApply(data).finally(() => (loading.value = false));
getList();
}
proxy?.$modal.msgSuccess('撤销成功');
modal.msgSuccess('撤销成功');
};
//办理
@@ -273,7 +274,7 @@ const handleOpen = async (row, type) => {
formCustom: row.formCustom,
formPath: row.formPath
});
workflowCommon.routerJump(routerJumpVo, proxy);
workflowCommon.routerJump(routerJumpVo);
};
</script>
+5 -4
View File
@@ -92,14 +92,15 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { pageByTaskCopy } from '@/api/workflow/task';
import { TaskQuery } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
//审批记录组件
import { useDict } from '@/utils/dict';
const queryFormRef = ref<ElFormInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
const { wf_business_status } = toRefs<any>(useDict('wf_business_status'));
// 遮罩层
const loading = ref(true);
// 选中数组
@@ -158,7 +159,7 @@ const handleView = row => {
formCustom: row.formCustom,
formPath: row.formPath
});
workflowCommon.routerJump(routerJumpVo, proxy);
workflowCommon.routerJump(routerJumpVo);
};
onMounted(() => {
+9 -8
View File
@@ -129,18 +129,19 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { UserVO } from '@/api/system/user/types';
import { pageByTaskFinish } from '@/api/workflow/task';
import { TaskQuery, FlowTaskVO } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
//审批记录组件
import UserSelect from '@/components/UserSelect/index.vue';
import { useDict } from '@/utils/dict';
const { wf_business_status } = toRefs<any>(useDict('wf_business_status'));
const { wf_task_status } = toRefs<any>(useDict('wf_task_status'));
const queryFormRef = ref<ElFormInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
const { wf_task_status } = toRefs<any>(proxy?.useDict('wf_task_status'));
import UserSelect from '@/components/UserSelect';
import { ref } from 'vue';
import { UserVO } from '@/api/system/user/types';
const userSelectRef = ref<InstanceType<typeof UserSelect>>();
// 遮罩层
@@ -207,7 +208,7 @@ const handleView = (row: FlowTaskVO) => {
formCustom: row.formCustom,
formPath: row.formPath
});
workflowCommon.routerJump(routerJumpVo, proxy);
workflowCommon.routerJump(routerJumpVo);
};
//打开申请人选择
const openUserSelect = () => {
+6 -6
View File
@@ -115,16 +115,16 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { UserVO } from '@/api/system/user/types';
import { pageByTaskWait } from '@/api/workflow/task';
import { TaskQuery, FlowTaskVO } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
import UserSelect from '@/components/UserSelect/index.vue';
import { useDict } from '@/utils/dict';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_business_status } = toRefs<any>(proxy?.useDict('wf_business_status'));
import UserSelect from '@/components/UserSelect';
import { ref } from 'vue';
import { UserVO } from '@/api/system/user/types';
const { wf_business_status } = toRefs<any>(useDict('wf_business_status'));
const userSelectRef = ref<InstanceType<typeof UserSelect>>();
//提交组件
@@ -198,7 +198,7 @@ const handleOpen = async (row: FlowTaskVO) => {
formCustom: row.formCustom,
formPath: row.formPath
});
workflowCommon.routerJump(routerJumpVo, proxy);
workflowCommon.routerJump(routerJumpVo);
};
//打开申请人选择
const openUserSelect = () => {