Merge branch 'dev' into feature/springdoc

pull/2/head
xingyu 2023-01-16 21:30:48 +08:00
commit 18c6445802
13 changed files with 87 additions and 66 deletions

View File

@ -1,6 +1,6 @@
{
"name": "yudao-ui-admin-vue3",
"version": "1.6.6-snapshot.1912",
"version": "1.6.6-snapshot.1921",
"description": "基于vue3、vite4、element-plus、typesScript",
"author": "xingyu",
"private": false,

View File

@ -33,7 +33,7 @@ export const getTenantIdByNameApi = (name: string) => {
// 登出
export const loginOutApi = () => {
return request.delete({ url: '/system/auth/logout' })
return request.post({ url: '/system/auth/logout' })
}
// 获取用户权限信息

View File

@ -25,7 +25,7 @@ const props = defineProps({
default: () => []
},
data: {
type: Object as PropType<Recordable>,
type: Object as PropType<any>,
default: () => ({})
}
})

View File

@ -17,6 +17,9 @@ 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
}
})
@ -31,25 +34,11 @@ onUpdated(() => {
})
</script>
<template>
<!-- 默认样式 -->
<span
v-if="
dictData?.colorType === 'default' ||
dictData?.colorType === '' ||
dictData?.colorType === undefined
"
:key="dictData?.value.toString()"
:class="dictData?.cssClass"
>
{{ dictData?.label }}
</span>
<!-- Tag 样式 -->
<ElTag
v-else
:disable-transitions="true"
:key="dictData?.value + ''"
:type="dictData?.colorType === 'primary' ? 'success' : dictData?.colorType"
:class="dictData?.cssClass"
:type="dictData?.colorType"
:color="dictData?.cssClass"
>
{{ dictData?.label }}
</ElTag>

View File

@ -99,6 +99,9 @@ const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => {
//
const handleFileSuccess: UploadProps['onSuccess'] = (res: any): void => {
message.success('上传成功')
const fileListNew = fileList.value
fileListNew.pop()
fileList.value = fileListNew
uploadList.value.push({ name: res.data, url: res.data })
if (uploadList.value.length == uploadNumber.value) {
fileList.value = fileList.value.concat(uploadList.value)

View File

@ -120,7 +120,7 @@ const getColumnsConfig = (options: XTableProps) => {
const getProxyConfig = (options: XTableProps) => {
const { getListApi, proxyConfig, data, isList } = options
if (proxyConfig || data) return
if (getListApi && isFunction(getListApi) && !isList) {
if (getListApi && isFunction(getListApi)) {
if (!isList) {
options.proxyConfig = {
seq: true, //
@ -194,7 +194,8 @@ const getProxyConfig = (options: XTableProps) => {
//
const getPageConfig = (options: XTableProps) => {
const { pagination, pagerConfig, treeConfig } = options
const { pagination, pagerConfig, treeConfig, isList } = options
if (isList) return
if (treeConfig) {
options.treeConfig = options.treeConfig
return

View File

@ -35,7 +35,7 @@ const loginOut = () => {
type: 'warning'
})
.then(async () => {
userStore.loginOut()
await userStore.loginOut()
tagsViewStore.delAllViews()
replace('/login?redirect=/index')
})

View File

@ -65,6 +65,29 @@ export const useDictStore = defineStore('dict', {
this.isSetDict = true
wsCache.set(CACHE_KEY.DICT_CACHE, dictDataMap, { exp: 60 }) // 60 秒 过期
}
},
async resetDict() {
wsCache.delete(CACHE_KEY.DICT_CACHE)
const res = await listSimpleDictDataApi()
// 设置数据
const dictDataMap = new Map<string, any>()
res.forEach((dictData: DictDataVO) => {
// 获得 dictType 层级
const enumValueObj = dictDataMap[dictData.dictType]
if (!enumValueObj) {
dictDataMap[dictData.dictType] = []
}
// 处理 dictValue 层级
dictDataMap[dictData.dictType].push({
value: dictData.value,
label: dictData.label,
colorType: dictData.colorType,
cssClass: dictData.cssClass
})
})
this.dictMap = dictDataMap
this.isSetDict = true
wsCache.set(CACHE_KEY.DICT_CACHE, dictDataMap, { exp: 60 }) // 60 秒 过期
}
}
})

View File

@ -2,7 +2,7 @@ import { store } from '../index'
import { defineStore } from 'pinia'
import { getAccessToken, removeToken } from '@/utils/auth'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { getInfoApi } from '@/api/login'
import { getInfoApi, loginOutApi } from '@/api/login'
const { wsCache } = useCache()
@ -59,7 +59,8 @@ export const useUserStore = defineStore('admin-user', {
this.isSetUser = true
wsCache.set(CACHE_KEY.USER, userInfo)
},
loginOut() {
async loginOut() {
await loginOutApi()
removeToken()
wsCache.clear()
this.resetState()

View File

@ -16,7 +16,7 @@ export interface DictDataType {
dictType: string
label: string
value: string | number | boolean
colorType: ElementPlusInfoType | '' | 'default' | 'primary'
colorType: ElementPlusInfoType | ''
cssClass: string
}

View File

@ -1,6 +1,5 @@
import { EChartsOption } from 'echarts'
import { useI18n } from '@/hooks/web/useI18n'
import { EChartsOption as EChartsWordOption } from 'echarts-wordcloud'
const { t } = useI18n()
@ -185,7 +184,7 @@ export const radarOption: EChartsOption = {
]
}
export const wordOptions: EChartsWordOption = {
export const wordOptions = {
series: [
{
type: 'wordCloud',

View File

@ -7,7 +7,7 @@ import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n()
// 表单校验
export const dictDataRules = reactive({
title: [required],
label: [required],
value: [required],
sort: [required]
})
@ -34,42 +34,48 @@ export const crudSchemas = reactive<VxeCrudSchema>({
title: '数据键值',
field: 'value'
},
// {
// title: '标签类型',
// field: 'colorType',
// form: {
// component: 'Select',
// componentProps: {
// options: [
// {
// label: 'default',
// value: ''
// },
// {
// label: 'success',
// value: 'success'
// },
// {
// label: 'info',
// value: 'info'
// },
// {
// label: 'warning',
// value: 'warning'
// },
// {
// label: 'danger',
// value: 'danger'
// }
// ]
// }
// },
// isTable: false
// },
{
title: '颜色类型',
field: 'colorType',
form: {
component: 'Select',
componentProps: {
options: [
{
label: 'default',
value: ''
},
{
label: 'success',
value: 'success'
},
{
label: 'info',
value: 'info'
},
{
label: 'warning',
value: 'warning'
},
{
label: 'danger',
value: 'danger'
}
]
}
},
isTable: false
},
{
title: 'CSS Class',
title: '颜色',
field: 'cssClass',
isTable: false
isTable: false,
form: {
component: 'ColorPicker',
componentProps: {
predefine: ['#ffffff', '#409eff', '#67c23a', '#e6a23c', '#f56c6c', '#909399', '#c71585']
}
}
},
{
title: '显示排序',

View File

@ -7,7 +7,8 @@ const { t } = useI18n() // 国际化
// 表单校验
export const dictTypeRules = reactive({
name: [required]
name: [required],
type: [required]
})
// 新增 + 修改
const crudSchemas = reactive<VxeCrudSchema>({
@ -41,9 +42,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
field: 'createTime',
formatter: 'formatDate',
isForm: false,
table: {
width: 150
},
isTable: false,
search: {
show: true,
itemRender: {