Merge remote-tracking branch 'origin/dev' into feature/springdoc

# Conflicts:
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/captcha/CaptchaController.java
pull/2/head
xingyu 2023-01-17 21:18:53 +08:00
commit 0ef05fba7c
17 changed files with 234 additions and 140 deletions

View File

@ -41,7 +41,7 @@
<!-- Bpm 工作流相关 --> <!-- Bpm 工作流相关 -->
<flowable.version>6.8.0</flowable.version> <flowable.version>6.8.0</flowable.version>
<!-- 工具类相关 --> <!-- 工具类相关 -->
<captcha-plus.version>1.0.0</captcha-plus.version> <captcha-plus.version>1.0.1</captcha-plus.version>
<jsoup.version>1.15.3</jsoup.version> <jsoup.version>1.15.3</jsoup.version>
<lombok.version>1.18.24</lombok.version> <lombok.version>1.18.24</lombok.version>
<mapstruct.version>1.5.3.Final</mapstruct.version> <mapstruct.version>1.5.3.Final</mapstruct.version>

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.captcha.config;
import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.ClassUtil;
import cn.iocoder.yudao.framework.captcha.core.enums.CaptchaRedisKeyConstants; import cn.iocoder.yudao.framework.captcha.core.enums.CaptchaRedisKeyConstants;
import cn.iocoder.yudao.framework.captcha.core.service.RedisCaptchaServiceImpl; import cn.iocoder.yudao.framework.captcha.core.service.RedisCaptchaServiceImpl;
import com.anji.captcha.service.CaptchaCacheService; import com.xingyuv.captcha.service.CaptchaCacheService;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.framework.captcha.core.enums; package cn.iocoder.yudao.framework.captcha.core.enums;
import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine;
import com.anji.captcha.model.vo.PointVO; import com.xingyuv.captcha.model.vo.PointVO;
import java.time.Duration; import java.time.Duration;

View File

@ -1,6 +1,6 @@
package cn.iocoder.yudao.framework.captcha.core.service; package cn.iocoder.yudao.framework.captcha.core.service;
import com.anji.captcha.service.CaptchaCacheService; import com.xingyuv.captcha.service.CaptchaCacheService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;

View File

@ -22,9 +22,9 @@ import cn.iocoder.yudao.module.system.service.member.MemberService;
import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService; import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
import cn.iocoder.yudao.module.system.service.social.SocialUserService; import cn.iocoder.yudao.module.system.service.social.SocialUserService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.anji.captcha.model.common.ResponseModel; import com.xingyuv.captcha.model.common.ResponseModel;
import com.anji.captcha.model.vo.CaptchaVO; import com.xingyuv.captcha.model.vo.CaptchaVO;
import com.anji.captcha.service.CaptchaService; import com.xingyuv.captcha.service.CaptchaService;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;

View File

@ -1,6 +1,6 @@
{ {
"name": "yudao-ui-admin-vue3", "name": "yudao-ui-admin-vue3",
"version": "1.6.6-snapshot.1921", "version": "1.6.6-snapshot.1922",
"description": "基于vue3、vite4、element-plus、typesScript", "description": "基于vue3、vite4、element-plus、typesScript",
"author": "xingyu", "author": "xingyu",
"private": false, "private": false,
@ -66,8 +66,8 @@
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.0", "@types/qrcode": "^1.5.0",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.48.1", "@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.1", "@typescript-eslint/parser": "^5.48.2",
"@vitejs/plugin-legacy": "^3.0.1", "@vitejs/plugin-legacy": "^3.0.1",
"@vitejs/plugin-vue": "^4.0.0", "@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.0", "@vitejs/plugin-vue-jsx": "^3.0.0",
@ -83,7 +83,7 @@
"postcss-html": "^1.5.0", "postcss-html": "^1.5.0",
"postcss-scss": "^4.0.6", "postcss-scss": "^4.0.6",
"prettier": "^2.8.3", "prettier": "^2.8.3",
"rimraf": "^4.0.7", "rimraf": "^4.1.0",
"rollup": "^3.10.0", "rollup": "^3.10.0",
"sass": "^1.57.1", "sass": "^1.57.1",
"stylelint": "^14.16.1", "stylelint": "^14.16.1",

View File

@ -13,8 +13,8 @@ specifiers:
'@types/nprogress': ^0.2.0 '@types/nprogress': ^0.2.0
'@types/qrcode': ^1.5.0 '@types/qrcode': ^1.5.0
'@types/qs': ^6.9.7 '@types/qs': ^6.9.7
'@typescript-eslint/eslint-plugin': ^5.48.1 '@typescript-eslint/eslint-plugin': ^5.48.2
'@typescript-eslint/parser': ^5.48.1 '@typescript-eslint/parser': ^5.48.2
'@vitejs/plugin-legacy': ^3.0.1 '@vitejs/plugin-legacy': ^3.0.1
'@vitejs/plugin-vue': ^4.0.0 '@vitejs/plugin-vue': ^4.0.0
'@vitejs/plugin-vue-jsx': ^3.0.0 '@vitejs/plugin-vue-jsx': ^3.0.0
@ -50,7 +50,7 @@ specifiers:
prettier: ^2.8.3 prettier: ^2.8.3
qrcode: ^1.5.1 qrcode: ^1.5.1
qs: ^6.11.0 qs: ^6.11.0
rimraf: ^4.0.7 rimraf: ^4.1.0
rollup: ^3.10.0 rollup: ^3.10.0
sass: ^1.57.1 sass: ^1.57.1
stylelint: ^14.16.1 stylelint: ^14.16.1
@ -125,8 +125,8 @@ devDependencies:
'@types/nprogress': 0.2.0 '@types/nprogress': 0.2.0
'@types/qrcode': 1.5.0 '@types/qrcode': 1.5.0
'@types/qs': 6.9.7 '@types/qs': 6.9.7
'@typescript-eslint/eslint-plugin': 5.48.1_oomjohfipuyaxs2zyomcx4f5by '@typescript-eslint/eslint-plugin': 5.48.2_caon6io6stgpr7lz2rtbhekxqy
'@typescript-eslint/parser': 5.48.1_7uibuqfxkfaozanbtbziikiqje '@typescript-eslint/parser': 5.48.2_7uibuqfxkfaozanbtbziikiqje
'@vitejs/plugin-legacy': 3.0.1_terser@5.16.1+vite@4.0.4 '@vitejs/plugin-legacy': 3.0.1_terser@5.16.1+vite@4.0.4
'@vitejs/plugin-vue': 4.0.0_vite@4.0.4+vue@3.2.45 '@vitejs/plugin-vue': 4.0.0_vite@4.0.4+vue@3.2.45
'@vitejs/plugin-vue-jsx': 3.0.0_vite@4.0.4+vue@3.2.45 '@vitejs/plugin-vue-jsx': 3.0.0_vite@4.0.4+vue@3.2.45
@ -142,7 +142,7 @@ devDependencies:
postcss-html: 1.5.0 postcss-html: 1.5.0
postcss-scss: 4.0.6_postcss@8.4.21 postcss-scss: 4.0.6_postcss@8.4.21
prettier: 2.8.3 prettier: 2.8.3
rimraf: 4.0.7 rimraf: 4.1.0
rollup: 3.10.0 rollup: 3.10.0
sass: 1.57.1 sass: 1.57.1
stylelint: 14.16.1 stylelint: 14.16.1
@ -1279,8 +1279,8 @@ packages:
resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==} resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==}
dev: false dev: false
/@typescript-eslint/eslint-plugin/5.48.1_oomjohfipuyaxs2zyomcx4f5by: /@typescript-eslint/eslint-plugin/5.48.2_caon6io6stgpr7lz2rtbhekxqy:
resolution: {integrity: sha512-9nY5K1Rp2ppmpb9s9S2aBiF3xo5uExCehMDmYmmFqqyxgenbHJ3qbarcLt4ITgaD6r/2ypdlcFRdcuVPnks+fQ==} resolution: {integrity: sha512-sR0Gja9Ky1teIq4qJOl0nC+Tk64/uYdX+mi+5iB//MH8gwyx8e3SOyhEzeLZEFEEfCaLf8KJq+Bd/6je1t+CAg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
'@typescript-eslint/parser': ^5.0.0 '@typescript-eslint/parser': ^5.0.0
@ -1290,10 +1290,10 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.48.1_7uibuqfxkfaozanbtbziikiqje '@typescript-eslint/parser': 5.48.2_7uibuqfxkfaozanbtbziikiqje
'@typescript-eslint/scope-manager': 5.48.1 '@typescript-eslint/scope-manager': 5.48.2
'@typescript-eslint/type-utils': 5.48.1_7uibuqfxkfaozanbtbziikiqje '@typescript-eslint/type-utils': 5.48.2_7uibuqfxkfaozanbtbziikiqje
'@typescript-eslint/utils': 5.48.1_7uibuqfxkfaozanbtbziikiqje '@typescript-eslint/utils': 5.48.2_7uibuqfxkfaozanbtbziikiqje
debug: 4.3.4 debug: 4.3.4
eslint: 8.32.0 eslint: 8.32.0
ignore: 5.2.1 ignore: 5.2.1
@ -1306,8 +1306,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/parser/5.48.1_7uibuqfxkfaozanbtbziikiqje: /@typescript-eslint/parser/5.48.2_7uibuqfxkfaozanbtbziikiqje:
resolution: {integrity: sha512-4yg+FJR/V1M9Xoq56SF9Iygqm+r5LMXvheo6DQ7/yUWynQ4YfCRnsKuRgqH4EQ5Ya76rVwlEpw4Xu+TgWQUcdA==} resolution: {integrity: sha512-38zMsKsG2sIuM5Oi/olurGwYJXzmtdsHhn5mI/pQogP+BjYVkK5iRazCQ8RGS0V+YLk282uWElN70zAAUmaYHw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
@ -1316,9 +1316,9 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/scope-manager': 5.48.1 '@typescript-eslint/scope-manager': 5.48.2
'@typescript-eslint/types': 5.48.1 '@typescript-eslint/types': 5.48.2
'@typescript-eslint/typescript-estree': 5.48.1_typescript@4.9.4 '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.9.4
debug: 4.3.4 debug: 4.3.4
eslint: 8.32.0 eslint: 8.32.0
typescript: 4.9.4 typescript: 4.9.4
@ -1326,16 +1326,16 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/scope-manager/5.48.1: /@typescript-eslint/scope-manager/5.48.2:
resolution: {integrity: sha512-S035ueRrbxRMKvSTv9vJKIWgr86BD8s3RqoRZmsSh/s8HhIs90g6UlK8ZabUSjUZQkhVxt7nmZ63VJ9dcZhtDQ==} resolution: {integrity: sha512-zEUFfonQid5KRDKoI3O+uP1GnrFd4tIHlvs+sTJXiWuypUWMuDaottkJuR612wQfOkjYbsaskSIURV9xo4f+Fw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies: dependencies:
'@typescript-eslint/types': 5.48.1 '@typescript-eslint/types': 5.48.2
'@typescript-eslint/visitor-keys': 5.48.1 '@typescript-eslint/visitor-keys': 5.48.2
dev: true dev: true
/@typescript-eslint/type-utils/5.48.1_7uibuqfxkfaozanbtbziikiqje: /@typescript-eslint/type-utils/5.48.2_7uibuqfxkfaozanbtbziikiqje:
resolution: {integrity: sha512-Hyr8HU8Alcuva1ppmqSYtM/Gp0q4JOp1F+/JH5D1IZm/bUBrV0edoewQZiEc1r6I8L4JL21broddxK8HAcZiqQ==} resolution: {integrity: sha512-QVWx7J5sPMRiOMJp5dYshPxABRoZV1xbRirqSk8yuIIsu0nvMTZesKErEA3Oix1k+uvsk8Cs8TGJ6kQ0ndAcew==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
eslint: '*' eslint: '*'
@ -1344,8 +1344,8 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/typescript-estree': 5.48.1_typescript@4.9.4 '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.9.4
'@typescript-eslint/utils': 5.48.1_7uibuqfxkfaozanbtbziikiqje '@typescript-eslint/utils': 5.48.2_7uibuqfxkfaozanbtbziikiqje
debug: 4.3.4 debug: 4.3.4
eslint: 8.32.0 eslint: 8.32.0
tsutils: 3.21.0_typescript@4.9.4 tsutils: 3.21.0_typescript@4.9.4
@ -1354,13 +1354,13 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/types/5.48.1: /@typescript-eslint/types/5.48.2:
resolution: {integrity: sha512-xHyDLU6MSuEEdIlzrrAerCGS3T7AA/L8Hggd0RCYBi0w3JMvGYxlLlXHeg50JI9Tfg5MrtsfuNxbS/3zF1/ATg==} resolution: {integrity: sha512-hE7dA77xxu7ByBc6KCzikgfRyBCTst6dZQpwaTy25iMYOnbNljDT4hjhrGEJJ0QoMjrfqrx+j1l1B9/LtKeuqA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true dev: true
/@typescript-eslint/typescript-estree/5.48.1_typescript@4.9.4: /@typescript-eslint/typescript-estree/5.48.2_typescript@4.9.4:
resolution: {integrity: sha512-Hut+Osk5FYr+sgFh8J/FHjqX6HFcDzTlWLrFqGoK5kVUN3VBHF/QzZmAsIXCQ8T/W9nQNBTqalxi1P3LSqWnRA==} resolution: {integrity: sha512-bibvD3z6ilnoVxUBFEgkO0k0aFvUc4Cttt0dAreEr+nrAHhWzkO83PEVVuieK3DqcgL6VAK5dkzK8XUVja5Zcg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
typescript: '*' typescript: '*'
@ -1368,8 +1368,8 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/types': 5.48.1 '@typescript-eslint/types': 5.48.2
'@typescript-eslint/visitor-keys': 5.48.1 '@typescript-eslint/visitor-keys': 5.48.2
debug: 4.3.4 debug: 4.3.4
globby: 11.1.0 globby: 11.1.0
is-glob: 4.0.3 is-glob: 4.0.3
@ -1380,17 +1380,17 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/utils/5.48.1_7uibuqfxkfaozanbtbziikiqje: /@typescript-eslint/utils/5.48.2_7uibuqfxkfaozanbtbziikiqje:
resolution: {integrity: sha512-SmQuSrCGUOdmGMwivW14Z0Lj8dxG1mOFZ7soeJ0TQZEJcs3n5Ndgkg0A4bcMFzBELqLJ6GTHnEU+iIoaD6hFGA==} resolution: {integrity: sha512-2h18c0d7jgkw6tdKTlNaM7wyopbLRBiit8oAxoP89YnuBOzCZ8g8aBCaCqq7h208qUTroL7Whgzam7UY3HVLow==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies: dependencies:
'@types/json-schema': 7.0.11 '@types/json-schema': 7.0.11
'@types/semver': 7.3.13 '@types/semver': 7.3.13
'@typescript-eslint/scope-manager': 5.48.1 '@typescript-eslint/scope-manager': 5.48.2
'@typescript-eslint/types': 5.48.1 '@typescript-eslint/types': 5.48.2
'@typescript-eslint/typescript-estree': 5.48.1_typescript@4.9.4 '@typescript-eslint/typescript-estree': 5.48.2_typescript@4.9.4
eslint: 8.32.0 eslint: 8.32.0
eslint-scope: 5.1.1 eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@8.32.0 eslint-utils: 3.0.0_eslint@8.32.0
@ -1400,11 +1400,11 @@ packages:
- typescript - typescript
dev: true dev: true
/@typescript-eslint/visitor-keys/5.48.1: /@typescript-eslint/visitor-keys/5.48.2:
resolution: {integrity: sha512-Ns0XBwmfuX7ZknznfXozgnydyR8F6ev/KEGePP4i74uL3ArsKbEhJ7raeKr1JSa997DBDwol/4a0Y+At82c9dA==} resolution: {integrity: sha512-z9njZLSkwmjFWUelGEwEbdf4NwKvfHxvGC0OcGN1Hp/XNDIcJ7D5DpPNPv6x6/mFvc1tQHsaWmpD/a4gOvvCJQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies: dependencies:
'@typescript-eslint/types': 5.48.1 '@typescript-eslint/types': 5.48.2
eslint-visitor-keys: 3.3.0 eslint-visitor-keys: 3.3.0
dev: true dev: true
@ -5192,8 +5192,8 @@ packages:
glob: 7.2.3 glob: 7.2.3
dev: true dev: true
/rimraf/4.0.7: /rimraf/4.1.0:
resolution: {integrity: sha512-CUEDDrZvc0swDgVdXGiv3FcYYQMpJxjvSGt85Amj6yU+MCVWurrLCeLiJDdJPHCzNJnwuebBEdcO//eP11Xa7w==} resolution: {integrity: sha512-ZJdkUR5/dRrRJHdcSKJLrpRn6tVjl9ALxd4yrTCxFsMpjQNzwHF6GLqMsuEzEYIXxHlFPDSk21Vr8VPuFBEz0g==}
engines: {node: '>=14'} engines: {node: '>=14'}
hasBin: true hasBin: true
dev: true dev: true

View File

@ -1,8 +1,12 @@
<script setup lang="ts"> <script lang="tsx">
import { onMounted, onUpdated, PropType, ref } from 'vue' import { defineComponent, PropType, ref } from 'vue'
import { getDictOptions, DictDataType } from '@/utils/dict' import { isHexColor } from '@/utils/color'
import { ElTag } from 'element-plus' import { ElTag } from 'element-plus'
const props = defineProps({ import { DictDataType, getDictOptions } from '@/utils/dict'
export default defineComponent({
name: 'DictTag',
props: {
type: { type: {
type: String as PropType<string>, type: String as PropType<string>,
required: true required: true
@ -11,9 +15,10 @@ const props = defineProps({
type: [String, Number, Boolean] as PropType<string | number | boolean>, type: [String, Number, Boolean] as PropType<string | number | boolean>,
required: true required: true
} }
}) },
const dictData = ref<DictDataType>() setup(props) {
const getDictObj = (dictType: string, value: string) => { const dictData = ref<DictDataType>()
const getDictObj = (dictType: string, value: string) => {
const dictOptions = getDictOptions(dictType) const dictOptions = getDictOptions(dictType)
dictOptions.forEach((dict: DictDataType) => { dictOptions.forEach((dict: DictDataType) => {
if (dict.value === value) { if (dict.value === value) {
@ -23,23 +28,26 @@ const getDictObj = (dictType: string, value: string) => {
dictData.value = dict dictData.value = dict
} }
}) })
} }
const rederDictTag = () => {
onMounted(() => { if (!props.type) {
return getDictObj(props.type, props.value?.toString()) return null
}) }
getDictObj(props.type, props.value.toString())
onUpdated(() => { return (
getDictObj(props.type, props.value?.toString()) <ElTag
type={dictData.value?.colorType}
color={
dictData.value?.cssClass && isHexColor(dictData.value?.cssClass)
? dictData.value?.cssClass
: ''
}
>
{dictData.value?.label}
</ElTag>
)
}
return () => rederDictTag()
}
}) })
</script> </script>
<template>
<ElTag
:disable-transitions="true"
:key="dictData?.value + ''"
:type="dictData?.colorType"
:color="dictData?.cssClass"
>
{{ dictData?.label }}
</ElTag>
</template>

View File

@ -205,7 +205,7 @@ const getPageConfig = (options: XTableProps) => {
if (isBoolean(pagination)) { if (isBoolean(pagination)) {
options.pagerConfig = { options.pagerConfig = {
border: false, // border: false, //
background: true, // background: false, //
perfect: false, // perfect: false, //
pageSize: 10, // pageSize: 10, //
pagerCount: 7, // pagerCount: 7, //
@ -229,19 +229,19 @@ const getPageConfig = (options: XTableProps) => {
if (pagination != false) { if (pagination != false) {
options.pagerConfig = { options.pagerConfig = {
border: false, // border: false, //
background: true, // background: false, //
perfect: false, // perfect: false, //
pageSize: 10, // pageSize: 10, //
pagerCount: 7, // pagerCount: 7, //
autoHidden: false, // autoHidden: false, //
pageSizes: [5, 10, 20, 30, 50, 100], // pageSizes: [5, 10, 20, 30, 50, 100], //
layouts: [ layouts: [
'Sizes',
'PrevJump', 'PrevJump',
'PrevPage', 'PrevPage',
'JumpNumber', 'Number',
'NextPage', 'NextPage',
'NextJump', 'NextJump',
'Sizes',
'FullJump', 'FullJump',
'Total' 'Total'
] ]
@ -276,7 +276,7 @@ const reload = () => {
} }
// //
const deleteData = async (ids: string | number) => { const deleteData = async (id: string | number) => {
const g = unref(xGrid) const g = unref(xGrid)
if (!g) { if (!g) {
return return
@ -288,7 +288,7 @@ const deleteData = async (ids: string | number) => {
} }
return new Promise(async () => { return new Promise(async () => {
message.delConfirm().then(async () => { message.delConfirm().then(async () => {
await (options?.deleteApi && options?.deleteApi(ids)) await (options?.deleteApi && options?.deleteApi(id))
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
reload() reload()
@ -296,6 +296,49 @@ const deleteData = async (ids: string | number) => {
}) })
} }
//
const deleteBatch = async () => {
const g = unref(xGrid)
if (!g) {
return
}
const rows = g.getCheckboxRecords() || g.getRadioRecord()
let ids: any[] = []
if (rows.length == 0) {
message.error('请选择数据')
return
} else {
rows.forEach((row) => {
ids.push(row.id)
})
}
const options = innerProps.value || props.options
if (options.deleteListApi) {
return new Promise(async () => {
message.delConfirm().then(async () => {
await (options?.deleteListApi && options?.deleteListApi(ids))
message.success(t('common.delSuccess'))
//
reload()
})
})
} else if (options.deleteApi) {
return new Promise(async () => {
message.delConfirm().then(async () => {
ids.forEach(async (id) => {
await (options?.deleteApi && options?.deleteApi(id))
})
message.success(t('common.delSuccess'))
//
reload()
})
})
} else {
console.error('未传入delListApi')
return
}
}
// //
const exportList = async (fileName?: string) => { const exportList = async (fileName?: string) => {
const g = unref(xGrid) const g = unref(xGrid)
@ -324,12 +367,48 @@ const getSearchData = () => {
return queryParams return queryParams
} }
//
const getCurrentColumn = () => {
const g = unref(xGrid)
if (!g) {
return
}
return g.getCurrentColumn()
}
// redio
const getRadioRecord = () => {
const g = unref(xGrid)
if (!g) {
return
}
return g.getRadioRecord(false)
}
// checkbox
const getCheckboxRecords = () => {
const g = unref(xGrid)
if (!g) {
return
}
return g.getCheckboxRecords(false)
}
const setProps = (prop: Partial<XTableProps>) => { const setProps = (prop: Partial<XTableProps>) => {
innerProps.value = { ...unref(innerProps), ...prop } innerProps.value = { ...unref(innerProps), ...prop }
} }
defineExpose({ reload, Ref: xGrid, getSearchData, deleteData, exportList }) defineExpose({ reload, Ref: xGrid, getSearchData, deleteData, exportList })
emit('register', { reload, getSearchData, setProps, deleteData, exportList }) emit('register', {
reload,
getSearchData,
setProps,
deleteData,
deleteBatch,
exportList,
getCurrentColumn,
getRadioRecord,
getCheckboxRecords
})
</script> </script>
<style lang="scss"> <style lang="scss">
@import './style/index.scss'; @import './style/index.scss';

View File

@ -10,6 +10,7 @@ export type XTableProps<D = any> = VxeGridProps<D> & {
getListApi?: Function // 获取列表接口 getListApi?: Function // 获取列表接口
getAllListApi?: Function // 获取全部数据接口 用于 vxe 导出 getAllListApi?: Function // 获取全部数据接口 用于 vxe 导出
deleteApi?: Function // 删除接口 deleteApi?: Function // 删除接口
deleteListApi?: Function // 批量删除接口
exportListApi?: Function // 导出接口 exportListApi?: Function // 导出接口
exportName?: string // 导出文件夹名称 exportName?: string // 导出文件夹名称
params?: any // 其他查询参数 params?: any // 其他查询参数

View File

@ -18,6 +18,7 @@ export type VxeCrudSchema = {
primaryKey?: string // 主键ID primaryKey?: string // 主键ID
primaryTitle?: string // 主键标题 默认为序号 primaryTitle?: string // 主键标题 默认为序号
primaryType?: VxeColumnPropTypes.Type | 'id' // 还支持 "id" | "seq" | "radio" | "checkbox" | "expand" | "html" | null primaryType?: VxeColumnPropTypes.Type | 'id' // 还支持 "id" | "seq" | "radio" | "checkbox" | "expand" | "html" | null
firstColumn?: VxeColumnPropTypes.Type // 第一列显示类型
action?: boolean // 是否开启表格内右侧操作栏插槽 action?: boolean // 是否开启表格内右侧操作栏插槽
actionTitle?: string // 操作栏标题 默认为操作 actionTitle?: string // 操作栏标题 默认为操作
actionWidth?: string // 操作栏插槽宽度,一般2个字带图标 text 类型按钮 50-70 actionWidth?: string // 操作栏插槽宽度,一般2个字带图标 text 类型按钮 50-70
@ -184,6 +185,14 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => {
const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns => { const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns => {
const { t } = useI18n() const { t } = useI18n()
const tableSchema: VxeGridPropTypes.Columns = [] const tableSchema: VxeGridPropTypes.Columns = []
// 第一列
if (crudSchema.firstColumn) {
const tableSchemaItem = {
type: crudSchema.firstColumn,
width: '50px'
}
tableSchema.push(tableSchemaItem)
}
// 主键ID // 主键ID
if (crudSchema.primaryKey && crudSchema.primaryType) { if (crudSchema.primaryKey && crudSchema.primaryType) {
const primaryTitle = crudSchema.primaryTitle ? crudSchema.primaryTitle : t('common.index') const primaryTitle = crudSchema.primaryTitle ? crudSchema.primaryTitle : t('common.index')

View File

@ -2,10 +2,14 @@ import { ref, unref } from 'vue'
import { XTableProps } from '@/components/XTable/src/type' import { XTableProps } from '@/components/XTable/src/type'
export interface tableMethod { export interface tableMethod {
reload: () => void reload: () => void // 刷新表格
setProps: (props: XTableProps) => void setProps: (props: XTableProps) => void
deleteData: (ids: string | number) => void deleteData: (id: string | number) => void // 删除数据
exportList: (fileName?: string) => void deleteBatch: () => void // 批量删除
exportList: (fileName?: string) => void // 导出列表
getCurrentColumn: () => void // 获取当前列
getRadioRecord: () => void // 获取当前选中列redio
getCheckboxRecords: () => void //获取当前选中列, checkbox
} }
export const useXTable = (props: XTableProps): [Function, tableMethod] => { export const useXTable = (props: XTableProps): [Function, tableMethod] => {
@ -25,8 +29,12 @@ export const useXTable = (props: XTableProps): [Function, tableMethod] => {
const methods: tableMethod = { const methods: tableMethod = {
reload: () => getInstance().reload(), reload: () => getInstance().reload(),
setProps: (props) => getInstance().setProps(props), setProps: (props) => getInstance().setProps(props),
deleteData: (ids: string | number) => getInstance().deleteData(ids), deleteData: (id: string | number) => getInstance().deleteData(id),
exportList: (fileName?: string) => getInstance().exportList(fileName) deleteBatch: () => getInstance().deleteBatch(),
exportList: (fileName?: string) => getInstance().exportList(fileName),
getCurrentColumn: () => getInstance().getCheckboxRecords(),
getRadioRecord: () => getInstance().getRadioRecord(),
getCheckboxRecords: () => getInstance().getCheckboxRecords()
} }
return [register, methods] return [register, methods]
} }

View File

@ -76,26 +76,26 @@ VXETable.setup({
}, },
pagerConfig: { pagerConfig: {
border: false, border: false,
background: true, background: false,
autoHidden: true, autoHidden: true,
perfect: true, perfect: true,
pageSize: 10, pageSize: 10,
pagerCount: 7, pagerCount: 7,
pageSizes: [5, 10, 15, 20, 50, 100, 200, 500], pageSizes: [5, 10, 15, 20, 50, 100, 200, 500],
layouts: [ layouts: [
'Sizes',
'PrevJump', 'PrevJump',
'PrevPage', 'PrevPage',
'Jump', 'Number',
'PageCount',
'NextPage', 'NextPage',
'NextJump', 'NextJump',
'Sizes', 'FullJump',
'Total' 'Total'
] ]
} }
}, },
pager: { pager: {
background: true, background: false,
autoHidden: false, autoHidden: false,
perfect: true, perfect: true,
pageSize: 10, pageSize: 10,

View File

@ -66,6 +66,12 @@ export const useDictStore = defineStore('dict', {
wsCache.set(CACHE_KEY.DICT_CACHE, dictDataMap, { exp: 60 }) // 60 秒 过期 wsCache.set(CACHE_KEY.DICT_CACHE, dictDataMap, { exp: 60 }) // 60 秒 过期
} }
}, },
getDictByType(type: string) {
if (!this.isSetDict) {
this.setDictMap()
}
return this.dictMap[type]
},
async resetDict() { async resetDict() {
wsCache.delete(CACHE_KEY.DICT_CACHE) wsCache.delete(CACHE_KEY.DICT_CACHE)
const res = await listSimpleDictDataApi() const res = await listSimpleDictDataApi()

View File

@ -21,7 +21,7 @@ export interface DictDataType {
} }
export const getDictOptions = (dictType: string) => { export const getDictOptions = (dictType: string) => {
return dictStore.getDictMap[dictType] return dictStore.getDictByType(dictType)
} }
export const getIntDictOptions = (dictType: string) => { export const getIntDictOptions = (dictType: string) => {

View File

@ -9,7 +9,7 @@
preIcon="ep:zoom-in" preIcon="ep:zoom-in"
:title="t('action.add')" :title="t('action.add')"
v-hasPermi="['system:post:create']" v-hasPermi="['system:post:create']"
@click="handleCreate()" @click="openModel('create')"
/> />
<!-- 操作导出 --> <!-- 操作导出 -->
<XButton <XButton
@ -24,21 +24,18 @@
<!-- 操作修改 --> <!-- 操作修改 -->
<XTextButton <XTextButton
preIcon="ep:edit" preIcon="ep:edit"
:title="t('action.edit')"
v-hasPermi="['system:post:update']" v-hasPermi="['system:post:update']"
@click="handleUpdate(row.id)" @click="openModel('update', row.id)"
/> />
<!-- 操作详情 --> <!-- 操作详情 -->
<XTextButton <XTextButton
preIcon="ep:view" preIcon="ep:view"
:title="t('action.detail')"
v-hasPermi="['system:post:query']" v-hasPermi="['system:post:query']"
@click="handleDetail(row.id)" @click="openModel('detail', row.id)"
/> />
<!-- 操作删除 --> <!-- 操作删除 -->
<XTextButton <XTextButton
preIcon="ep:delete" preIcon="ep:delete"
:title="t('action.del')"
v-hasPermi="['system:post:delete']" v-hasPermi="['system:post:delete']"
@click="deleteData(row.id)" @click="deleteData(row.id)"
/> />
@ -103,34 +100,20 @@ const actionLoading = ref(false) // 按钮 Loading
const formRef = ref<FormExpose>() // Ref const formRef = ref<FormExpose>() // Ref
const detailData = ref() // Ref const detailData = ref() // Ref
// const openModel = async (type: string, rowId?: number) => {
const setDialogTile = (type: string) => {
modelLoading.value = true modelLoading.value = true
modelTitle.value = t('action.' + type) modelTitle.value = t('action.' + type)
actionType.value = type actionType.value = type
modelVisible.value = true modelVisible.value = true
}
//
const handleCreate = () => {
setDialogTile('create')
modelLoading.value = false
}
//
const handleUpdate = async (rowId: number) => {
setDialogTile('update')
// //
if (rowId) {
const res = await PostApi.getPostApi(rowId) const res = await PostApi.getPostApi(rowId)
if (type === 'update') {
unref(formRef)?.setValues(res) unref(formRef)?.setValues(res)
modelLoading.value = false } else if (type === 'detail') {
}
//
const handleDetail = async (rowId: number) => {
setDialogTile('detail')
const res = await PostApi.getPostApi(rowId)
detailData.value = res detailData.value = res
}
}
modelLoading.value = false modelLoading.value = false
} }
@ -155,7 +138,7 @@ const submitForm = async () => {
} finally { } finally {
actionLoading.value = false actionLoading.value = false
// //
await reload() reload()
} }
} }
}) })