Sfoglia il codice sorgente

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
xingyu 2 anni fa
parent
commit
0ef05fba7c

+ 1 - 1
yudao-dependencies/pom.xml

@@ -41,7 +41,7 @@
         <!-- Bpm 工作流相关 -->
         <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>
         <lombok.version>1.18.24</lombok.version>
         <mapstruct.version>1.5.3.Final</mapstruct.version>

+ 1 - 1
yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java

@@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.captcha.config;
 import cn.hutool.core.util.ClassUtil;
 import cn.iocoder.yudao.framework.captcha.core.enums.CaptchaRedisKeyConstants;
 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.context.annotation.Bean;
 import org.springframework.data.redis.core.StringRedisTemplate;

+ 1 - 1
yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/enums/CaptchaRedisKeyConstants.java

@@ -1,7 +1,7 @@
 package cn.iocoder.yudao.framework.captcha.core.enums;
 
 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;
 

+ 1 - 1
yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java

@@ -1,6 +1,6 @@
 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.NoArgsConstructor;
 import org.springframework.data.redis.core.StringRedisTemplate;

yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService → yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.xingyuv.captcha.service.CaptchaCacheService


+ 3 - 3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java

@@ -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.social.SocialUserService;
 import cn.iocoder.yudao.module.system.service.user.AdminUserService;
-import com.anji.captcha.model.common.ResponseModel;
-import com.anji.captcha.model.vo.CaptchaVO;
-import com.anji.captcha.service.CaptchaService;
+import com.xingyuv.captcha.model.common.ResponseModel;
+import com.xingyuv.captcha.model.vo.CaptchaVO;
+import com.xingyuv.captcha.service.CaptchaService;
 import com.google.common.annotations.VisibleForTesting;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;

+ 4 - 4
yudao-ui-admin-vue3/package.json

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

+ 41 - 41
yudao-ui-admin-vue3/pnpm-lock.yaml

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

+ 47 - 39
yudao-ui-admin-vue3/src/components/DictTag/src/DictTag.vue

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

+ 86 - 7
yudao-ui-admin-vue3/src/components/XTable/src/XTable.vue

@@ -205,7 +205,7 @@ const getPageConfig = (options: XTableProps) => {
     if (isBoolean(pagination)) {
       options.pagerConfig = {
         border: false, // 带边框
-        background: true, // 带背景颜色
+        background: false, // 带背景颜色
         perfect: false, // 配套的样式
         pageSize: 10, // 每页大小
         pagerCount: 7, // 显示页码按钮的数量
@@ -229,19 +229,19 @@ const getPageConfig = (options: XTableProps) => {
     if (pagination != false) {
       options.pagerConfig = {
         border: false, // 带边框
-        background: true, // 带背景颜色
+        background: false, // 带背景颜色
         perfect: false, // 配套的样式
         pageSize: 10, // 每页大小
         pagerCount: 7, // 显示页码按钮的数量
         autoHidden: false, // 当只有一页时自动隐藏
         pageSizes: [5, 10, 20, 30, 50, 100], // 每页大小选项列表
         layouts: [
+          'Sizes',
           'PrevJump',
           'PrevPage',
-          'JumpNumber',
+          'Number',
           'NextPage',
           'NextJump',
-          'Sizes',
           'FullJump',
           'Total'
         ]
@@ -276,7 +276,7 @@ const reload = () => {
 }
 
 // 删除
-const deleteData = async (ids: string | number) => {
+const deleteData = async (id: string | number) => {
   const g = unref(xGrid)
   if (!g) {
     return
@@ -288,7 +288,7 @@ const deleteData = async (ids: string | number) => {
   }
   return new Promise(async () => {
     message.delConfirm().then(async () => {
-      await (options?.deleteApi && options?.deleteApi(ids))
+      await (options?.deleteApi && options?.deleteApi(id))
       message.success(t('common.delSuccess'))
       // 刷新列表
       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 g = unref(xGrid)
@@ -324,12 +367,48 @@ const getSearchData = () => {
   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>) => {
   innerProps.value = { ...unref(innerProps), ...prop }
 }
 
 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>
 <style lang="scss">
 @import './style/index.scss';

+ 1 - 0
yudao-ui-admin-vue3/src/components/XTable/src/type.ts

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

+ 9 - 0
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts

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

+ 13 - 5
yudao-ui-admin-vue3/src/hooks/web/useXTable.ts

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

+ 5 - 5
yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts

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

+ 6 - 0
yudao-ui-admin-vue3/src/store/modules/dict.ts

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

+ 1 - 1
yudao-ui-admin-vue3/src/utils/dict.ts

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

+ 13 - 30
yudao-ui-admin-vue3/src/views/system/post/index.vue

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