Skip to content

Commit

Permalink
fix: 修复已知BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Mar 3, 2023
1 parent 772e243 commit 782b8e2
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 19 deletions.
8 changes: 7 additions & 1 deletion src/components/Descriptions/src/Descriptions.vue
Expand Up @@ -107,7 +107,13 @@ const toggleClick = () => {
v-bind="getBindItemValue(item)"
>
<template #label>
<slot :name="`${item.field}-label`" :label="item.label">{{ item.label }}</slot>
<slot
:name="`${item.field}-label`"
:row="{
label: item.label
}"
>{{ item.label }}</slot
>
</template>

<template #default>
Expand Down
5 changes: 4 additions & 1 deletion src/components/TagsView/src/TagsView.vue
Expand Up @@ -412,7 +412,10 @@ watch(
{
icon: 'ant-design:close-outlined',
label: t('common.closeTab'),
disabled: !!visitedViews?.length && selectedTag?.meta.affix
disabled: !!visitedViews?.length && selectedTag?.meta.affix,
command: () => {
closeSelectedTag(selectedTag!)
}
},
{
divided: true,
Expand Down
3 changes: 1 addition & 2 deletions src/hooks/web/useCrudSchemas.ts
Expand Up @@ -214,7 +214,6 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
for (const task of formRequestTask) {
task()
}
console.log(formSchema)
return formSchema
}

Expand Down Expand Up @@ -243,7 +242,7 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[

// 给options添加国际化
const filterOptions = (options: Recordable, labelField?: string) => {
return options.map((v: Recordable) => {
return options?.map((v: Recordable) => {
if (labelField) {
v['labelField'] = t(v.labelField)
} else {
Expand Down
9 changes: 4 additions & 5 deletions src/permission.ts
Expand Up @@ -30,11 +30,6 @@ router.beforeEach(async (to, from, next) => {
if (to.path === '/login') {
next({ path: '/' })
} else {
if (permissionStore.getIsAddRouters) {
next()
return
}

if (!dictStore.getIsSetDict) {
// 获取所有字典
const res = await getDictApi()
Expand All @@ -43,6 +38,10 @@ router.beforeEach(async (to, from, next) => {
dictStore.setIsSetDict(true)
}
}
if (permissionStore.getIsAddRouters) {
next()
return
}

// 开发者可根据实际情况进行修改
const roleRouters = wsCache.get('roleRouters') || []
Expand Down
20 changes: 10 additions & 10 deletions src/views/Components/Descriptions.vue
Expand Up @@ -82,20 +82,20 @@ const formValidation = () => {

<Form is-custom :model="form" :rules="rules" @register="register">
<Descriptions :title="t('descriptionsDemo.form')" :data="data" :schema="schema" class="mt-20px">
<template #username-label="{ row: scope }">
<span class="is-required--item">{{ scope.label }}</span>
<template #username-label="{ row }">
<span class="is-required--item">{{ row.label }}</span>
</template>
<template #nickName-label="{ row: scope }">
<span class="is-required--item">{{ scope.label }}</span>
<template #nickName-label="{ row }">
<span class="is-required--item">{{ row.label }}</span>
</template>
<template #phone-label="{ row: scope }">
<span class="is-required--item">{{ scope.label }}</span>
<template #phone-label="{ row }">
<span class="is-required--item">{{ row.label }}</span>
</template>
<template #email-label="{ row: scope }">
<span class="is-required--item">{{ scope.label }}</span>
<template #email-label="{ row }">
<span class="is-required--item">{{ row.label }}</span>
</template>
<template #addr-label="{ row: scope }">
<span class="is-required--item">{{ scope.label }}</span>
<template #addr-label="{ row }">
<span class="is-required--item">{{ row.label }}</span>
</template>

<template #username>
Expand Down
42 changes: 42 additions & 0 deletions src/views/Components/Table/UseTableDemo.vue
Expand Up @@ -21,6 +21,22 @@ const { getList } = methods
getList()
const {
register: register2,
tableObject: tableObject2,
methods: methods2
} = useTable<TableData>({
getListApi: getTableListApi,
response: {
list: 'list',
total: 'total'
}
})
const { getList: getList2 } = methods2
getList2()
const { t } = useI18n()
const columns = reactive<TableColumn[]>([
Expand Down Expand Up @@ -178,4 +194,30 @@ const selectAllNone = () => {
</template>
</Table>
</ContentWrap>

<ContentWrap :title="`UseTable 2 ${t('tableDemo.example')}`">
<Table
v-model:pageSize="tableObject2.pageSize"
v-model:currentPage="tableObject2.currentPage"
:columns="columns"
:data="tableObject2.tableList"
:loading="tableObject2.loading"
:pagination="paginationObj"
@register="register2"
>
<template #action="data">
<ElButton type="primary" @click="actionFn(data as TableSlotDefault)">
{{ t('tableDemo.action') }}
</ElButton>
</template>

<template #expand="data">
<div class="ml-30px">
<div>{{ t('tableDemo.title') }}:{{ data.row.title }}</div>
<div>{{ t('tableDemo.author') }}:{{ data.row.author }}</div>
<div>{{ t('tableDemo.displayTime') }}:{{ data.row.display_time }}</div>
</div>
</template>
</Table>
</ContentWrap>
</template>

0 comments on commit 782b8e2

Please sign in to comment.