fan 2 лет назад
Родитель
Сommit
0064a649af
1 измененных файлов с 20 добавлено и 72 удалено
  1. 20 72
      src/views/biz/archives/diagnosisHistory/FormModal.vue

+ 20 - 72
src/views/biz/archives/diagnosisHistory/FormModal.vue

@@ -24,20 +24,7 @@
           <BasicTable @register="registerTable" @edit-change="callEditChange">
             <template #bodyCell="{ column, record }">
               <template v-if="column.key === 'action'">
-                <TableAction
-                  :actions="[
-                    {
-                      auth: 'archives:diagnosisHistory:edit',
-                      icon: 'icon-xt-details_delete_default|iconfont',
-                      tooltip: '删除',
-                      popConfirm: {
-                        title: '是否取消删除',
-                        placement: 'left',
-                        confirm: handleDel.bind(null, record, column),
-                      },
-                    },
-                  ]"
-                />
+                <TableAction :actions="createActions(record, column)" />
               </template>
             </template>
           </BasicTable>
@@ -46,20 +33,7 @@
           <BasicTable @register="registerTableOperation" @edit-change="callEditChange">
             <template #bodyCell="{ column, record }">
               <template v-if="column.key === 'action'">
-                <TableAction
-                  :actions="[
-                    {
-                      auth: 'archives:diagnosisHistory:edit',
-                      icon: 'icon-xt-details_delete_default|iconfont',
-                      tooltip: '删除',
-                      popConfirm: {
-                        title: '是否取消删除',
-                        placement: 'left',
-                        confirm: handleDel.bind(null, record, column),
-                      },
-                    },
-                  ]"
-                />
+                <TableAction :actions="createActions(record, column)" />
               </template>
             </template>
           </BasicTable>
@@ -68,20 +42,7 @@
           <BasicTable @register="registerTableContagious" @edit-change="callEditChange">
             <template #bodyCell="{ column, record }">
               <template v-if="column.key === 'action'">
-                <TableAction
-                  :actions="[
-                    {
-                      auth: 'archives:diagnosisHistory:edit',
-                      icon: 'icon-xt-details_delete_default|iconfont',
-                      tooltip: '删除',
-                      popConfirm: {
-                        title: '是否取消删除',
-                        placement: 'left',
-                        confirm: handleDel.bind(null, record, column),
-                      },
-                    },
-                  ]"
-                />
+                <TableAction :actions="createActions(record, column)" />
               </template>
             </template>
           </BasicTable>
@@ -97,20 +58,7 @@
           <BasicTable @register="registerTableMulti" @edit-change="callEditChange">
             <template #bodyCell="{ column, record }">
               <template v-if="column.key === 'action'">
-                <TableAction
-                  :actions="[
-                    {
-                      auth: 'archives:diagnosisHistory:edit',
-                      icon: 'icon-xt-details_delete_default|iconfont',
-                      tooltip: '删除',
-                      popConfirm: {
-                        title: '是否取消删除',
-                        placement: 'left',
-                        confirm: handleDel.bind(null, record, column),
-                      },
-                    },
-                  ]"
-                />
+                <TableAction :actions="createActions(record, column)" />
               </template>
             </template>
           </BasicTable>
@@ -119,20 +67,7 @@
           <BasicTable @register="registerTableOther" @edit-change="callEditChange">
             <template #bodyCell="{ column, record }">
               <template v-if="column.key === 'action'">
-                <TableAction
-                  :actions="[
-                    {
-                      auth: 'archives:diagnosisHistory:edit',
-                      icon: 'icon-xt-details_delete_default|iconfont',
-                      tooltip: '删除',
-                      popConfirm: {
-                        title: '是否取消删除',
-                        placement: 'left',
-                        confirm: handleDel.bind(null, record, column),
-                      },
-                    },
-                  ]"
-                />
+                <TableAction :actions="createActions(record, column)" />
               </template>
             </template>
           </BasicTable>
@@ -146,7 +81,7 @@
   import { ref, unref, nextTick, reactive } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { BasicForm, useForm } from '/@/components/Form';
-  import { BasicTable, useTable, TableAction } from '/@/components/Table';
+  import { BasicTable, useTable, TableAction, BasicColumn, ActionItem } from '/@/components/Table';
   import { PlusOutlined } from '@ant-design/icons-vue';
 
   import { useMessage } from '/@/hooks/web/useMessage';
@@ -424,7 +359,20 @@
     dataSource: tableDataOther.value,
     columns: columnsOther,
   });
-
+  // 创建 删除 按钮
+  function createActions(record, column: BasicColumn): ActionItem[] {
+    return [
+      {
+        auth: 'archives:diagnosisHistory:edit',
+        icon: 'icon-xt-details_delete_default|iconfont',
+        tooltip: '删除',
+        popConfirm: {
+          title: '是否取消删除',
+          confirm: handleDel.bind(null, record, column),
+        },
+      },
+    ];
+  }
   async function handleAdd() {
     if (type.value == DiagnosisEnum.allergic_field) {
       tableDataAllergic.value.push({