瀏覽代碼

fix: 修复已知BUG

kailong321200875 2 年之前
父節點
當前提交
782b8e2f94

+ 7 - 1
src/components/Descriptions/src/Descriptions.vue

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

+ 4 - 1
src/components/TagsView/src/TagsView.vue

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

+ 1 - 2
src/hooks/web/useCrudSchemas.ts

@@ -214,7 +214,6 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
   for (const task of formRequestTask) {
     task()
   }
-  console.log(formSchema)
   return formSchema
 }
 
@@ -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 {

+ 4 - 5
src/permission.ts

@@ -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()
@@ -43,6 +38,10 @@ router.beforeEach(async (to, from, next) => {
           dictStore.setIsSetDict(true)
         }
       }
+      if (permissionStore.getIsAddRouters) {
+        next()
+        return
+      }
 
       // 开发者可根据实际情况进行修改
       const roleRouters = wsCache.get('roleRouters') || []

+ 10 - 10
src/views/Components/Descriptions.vue

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

+ 42 - 0
src/views/Components/Table/UseTableDemo.vue

@@ -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[]>([
@@ -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>