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