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 工作流相关 -->
<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>

View File

@ -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;

View File

@ -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;

View File

@ -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;

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.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;

View File

@ -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",

View File

@ -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

View File

@ -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
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
}
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>
)
}
return () => rederDictTag()
}
})
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
}
})
}
onMounted(() => {
return getDictObj(props.type, props.value?.toString())
})
onUpdated(() => {
getDictObj(props.type, props.value?.toString())
})
</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)) {
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';

View File

@ -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 // 其他查询参数

View File

@ -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')

View File

@ -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]
}

View File

@ -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,

View File

@ -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()

View File

@ -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) => {

View File

@ -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()
}
}
})