fix: todo
parent
042c4e8390
commit
3b107f56a0
|
@ -116,7 +116,7 @@ const toggleClick = () => {
|
||||||
{{ dayjs(data[item.field]).format(item.dateFormat) }}
|
{{ dayjs(data[item.field]).format(item.dateFormat) }}
|
||||||
</slot>
|
</slot>
|
||||||
<slot v-else-if="item.dictType">
|
<slot v-else-if="item.dictType">
|
||||||
<DictTag :type="item.dictType" :value="data[item.field]" />
|
<DictTag :type="item.dictType" :value="data[item.field] + ''" />
|
||||||
</slot>
|
</slot>
|
||||||
<slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot>
|
<slot v-else :name="item.field" :row="data">{{ data[item.field] }}</slot>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -24,20 +24,20 @@ export type VxeCrudSchema = {
|
||||||
columns: VxeCrudColumns[]
|
columns: VxeCrudColumns[]
|
||||||
}
|
}
|
||||||
type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & {
|
type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & {
|
||||||
field: string
|
field: string // 字段名
|
||||||
title?: string
|
title?: string // 标题名
|
||||||
formatter?: VxeColumnPropTypes.Formatter
|
formatter?: VxeColumnPropTypes.Formatter // vxe formatter格式化
|
||||||
isSearch?: boolean
|
isSearch?: boolean // 是否在查询显示
|
||||||
search?: CrudSearchParams
|
search?: CrudSearchParams // 查询的详细配置
|
||||||
isTable?: boolean
|
isTable?: boolean // 是否在列表显示
|
||||||
table?: CrudTableParams
|
table?: CrudTableParams // 列表的详细配置
|
||||||
isForm?: boolean
|
isForm?: boolean // 是否在表单显示
|
||||||
form?: CrudFormParams
|
form?: CrudFormParams // 表单的详细配置
|
||||||
isDetail?: boolean
|
isDetail?: boolean // 是否在详情显示
|
||||||
detail?: CrudDescriptionsParams
|
detail?: CrudDescriptionsParams // 详情的详细配置
|
||||||
print?: CrudPrintParams
|
print?: CrudPrintParams // vxe 打印的字段
|
||||||
children?: VxeCrudColumns[]
|
children?: VxeCrudColumns[] // 子级
|
||||||
dictType?: string
|
dictType?: string // 字典类型
|
||||||
}
|
}
|
||||||
|
|
||||||
type CrudSearchParams = {
|
type CrudSearchParams = {
|
||||||
|
@ -189,6 +189,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
|
||||||
tableSchemaItem.showOverflow = 'tooltip'
|
tableSchemaItem.showOverflow = 'tooltip'
|
||||||
if (schemaItem?.formatter) {
|
if (schemaItem?.formatter) {
|
||||||
tableSchemaItem.formatter = schemaItem.formatter
|
tableSchemaItem.formatter = schemaItem.formatter
|
||||||
|
tableSchemaItem.width = 160
|
||||||
}
|
}
|
||||||
if (schemaItem?.dictType) {
|
if (schemaItem?.dictType) {
|
||||||
tableSchemaItem.cellRender = {
|
tableSchemaItem.cellRender = {
|
||||||
|
@ -222,6 +223,7 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => {
|
||||||
eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
|
eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
|
||||||
// 判断是否显示
|
// 判断是否显示
|
||||||
if (schemaItem?.isForm !== false) {
|
if (schemaItem?.isForm !== false) {
|
||||||
|
// 默认为 input
|
||||||
let component = schemaItem?.form?.component || 'Input'
|
let component = schemaItem?.form?.component || 'Input'
|
||||||
const options: ComponentOptions[] = []
|
const options: ComponentOptions[] = []
|
||||||
let comonentProps = {}
|
let comonentProps = {}
|
||||||
|
@ -232,15 +234,14 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => {
|
||||||
comonentProps = {
|
comonentProps = {
|
||||||
options: options
|
options: options
|
||||||
}
|
}
|
||||||
if (!(schemaItem.form && schemaItem.form.component)) component = 'Select'
|
if (!(schemaItem.form && schemaItem.form.component)) component = 'SelectV2'
|
||||||
}
|
}
|
||||||
const formSchemaItem = {
|
const formSchemaItem = {
|
||||||
// 默认为 input
|
|
||||||
component: component,
|
|
||||||
componentProps: comonentProps,
|
|
||||||
...schemaItem.form,
|
...schemaItem.form,
|
||||||
field: schemaItem.field,
|
field: schemaItem.field,
|
||||||
label: schemaItem.form?.label || schemaItem.title
|
label: schemaItem.form?.label || schemaItem.title,
|
||||||
|
component: component,
|
||||||
|
componentProps: comonentProps
|
||||||
}
|
}
|
||||||
|
|
||||||
formSchema.push(formSchemaItem)
|
formSchema.push(formSchemaItem)
|
||||||
|
|
|
@ -17,6 +17,7 @@ export default {
|
||||||
cancel: 'Cancel',
|
cancel: 'Cancel',
|
||||||
close: 'Close',
|
close: 'Close',
|
||||||
reload: 'Reload current',
|
reload: 'Reload current',
|
||||||
|
success: 'Success',
|
||||||
closeTab: 'Close current',
|
closeTab: 'Close current',
|
||||||
closeTheLeftTab: 'Close left',
|
closeTheLeftTab: 'Close left',
|
||||||
closeTheRightTab: 'Close right',
|
closeTheRightTab: 'Close right',
|
||||||
|
|
|
@ -17,6 +17,7 @@ export default {
|
||||||
cancel: '取消',
|
cancel: '取消',
|
||||||
close: '关闭',
|
close: '关闭',
|
||||||
reload: '重新加载',
|
reload: '重新加载',
|
||||||
|
success: '成功',
|
||||||
closeTab: '关闭标签页',
|
closeTab: '关闭标签页',
|
||||||
closeTheLeftTab: '关闭左侧标签页',
|
closeTheLeftTab: '关闭左侧标签页',
|
||||||
closeTheRightTab: '关闭右侧标签页',
|
closeTheRightTab: '关闭右侧标签页',
|
||||||
|
|
|
@ -16,8 +16,8 @@ export interface DictDataType {
|
||||||
dictType: string
|
dictType: string
|
||||||
label: string
|
label: string
|
||||||
value: string | number | boolean
|
value: string | number | boolean
|
||||||
colorType: ElementPlusInfoType | '' | 'default' | 'primary'
|
colorType?: ElementPlusInfoType | '' | 'default' | 'primary'
|
||||||
cssClass: string
|
cssClass?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getDictOptions = (dictType: string) => {
|
export const getDictOptions = (dictType: string) => {
|
||||||
|
@ -41,10 +41,11 @@ export const getIntDictOptions = (dictType: string) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log(dictOptions)
|
||||||
return dictOptions
|
return dictOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getDictObj = (dictType: string, value: string) => {
|
export const getDictObj = (dictType: string, value: string | number | boolean) => {
|
||||||
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
||||||
dictOptions.forEach((dict: DictDataType) => {
|
dictOptions.forEach((dict: DictDataType) => {
|
||||||
if (dict.value === value) {
|
if (dict.value === value) {
|
||||||
|
|
|
@ -45,18 +45,24 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '访问令牌的有效期',
|
title: '访问令牌的有效期',
|
||||||
field: 'accessTokenValiditySeconds' // TODO @星语:数字输入框
|
field: 'accessTokenValiditySeconds',
|
||||||
|
form: {
|
||||||
|
component: 'InputNumber'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '刷新令牌的有效期',
|
title: '刷新令牌的有效期',
|
||||||
field: 'refreshTokenValiditySeconds' // TODO @星语:数字输入框
|
field: 'refreshTokenValiditySeconds',
|
||||||
|
form: {
|
||||||
|
component: 'InputNumber'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '授权类型',
|
title: '授权类型',
|
||||||
field: 'authorizedGrantTypes',
|
field: 'authorizedGrantTypes',
|
||||||
dictType: DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE,
|
dictType: DICT_TYPE.SYSTEM_OAUTH2_GRANT_TYPE,
|
||||||
form: {
|
form: {
|
||||||
component: 'Select' // TODO @星语:多选
|
component: 'SelectV2' // TODO @星语:多选
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -102,7 +108,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
||||||
{
|
{
|
||||||
title: t('common.createTime'),
|
title: t('common.createTime'),
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
formatter: 'formatDate', // TODO @星语:宽度,保证时间可以展示出来
|
formatter: 'formatDate',
|
||||||
isForm: false
|
isForm: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
/>
|
/>
|
||||||
<!-- 表单:详情 -->
|
<!-- 表单:详情 -->
|
||||||
<!-- TODO @星语:展示详情时,有点小丑,可额能得看看 -->
|
|
||||||
<Descriptions
|
<Descriptions
|
||||||
v-if="actionType === 'detail'"
|
v-if="actionType === 'detail'"
|
||||||
:schema="allSchemas.detailSchema"
|
:schema="allSchemas.detailSchema"
|
||||||
|
|
|
@ -58,10 +58,10 @@ const handleDetail = async (row: TokenApi.OAuth2TokenVO) => {
|
||||||
// 强退操作
|
// 强退操作
|
||||||
const handleForceLogout = (rowId: number) => {
|
const handleForceLogout = (rowId: number) => {
|
||||||
message
|
message
|
||||||
.delConfirm()
|
.confirm('是否要强制退出用户')
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await TokenApi.deleteAccessTokenApi(rowId)
|
await TokenApi.deleteAccessTokenApi(rowId)
|
||||||
message.success(t('common.delSuccess')) // TODO 星语:提示内容不对
|
message.success(t('common.success'))
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
// 刷新列表
|
// 刷新列表
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
// 全局相关的 import
|
// 全局相关的 import
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
|
import { useVxeGrid } from '@/hooks/web/useVxeGrid'
|
||||||
import { VxeGridInstance } from 'vxe-table'
|
import { VxeGridInstance } from 'vxe-table'
|
||||||
// 业务相关的 import
|
// 业务相关的 import
|
||||||
|
@ -53,6 +54,7 @@ import { allSchemas } from './operatelog.data'
|
||||||
import download from '@/utils/download'
|
import download from '@/utils/download'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
// 列表相关的变量
|
// 列表相关的变量
|
||||||
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
|
const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
|
||||||
const { gridOptions } = useVxeGrid<OperateLogApi.OperateLogVO>({
|
const { gridOptions } = useVxeGrid<OperateLogApi.OperateLogVO>({
|
||||||
|
@ -73,13 +75,14 @@ const handleDetail = (row: OperateLogApi.OperateLogVO) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出操作
|
// 导出操作
|
||||||
// TODO @星语:导出需要有二次确认哈
|
|
||||||
const handleExport = async () => {
|
const handleExport = async () => {
|
||||||
const queryParams = Object.assign(
|
message.exportConfirm().then(async () => {
|
||||||
{},
|
const queryParams = Object.assign(
|
||||||
JSON.parse(JSON.stringify(xGrid.value?.getRefMaps().refForm.value.data)) // TODO @星语:这个有没办法,封装个 util 获取哈?
|
{},
|
||||||
)
|
JSON.parse(JSON.stringify(xGrid.value?.getRefMaps().refForm.value.data)) // TODO @星语:这个有没办法,封装个 util 获取哈?
|
||||||
const res = await OperateLogApi.exportOperateLogApi(queryParams)
|
)
|
||||||
download.excel(res, '岗位列表.xls')
|
const res = await OperateLogApi.exportOperateLogApi(queryParams)
|
||||||
|
download.excel(res, '岗位列表.xls')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue