From 3505aa60ad15de91bc9b437ca8d69124c8074974 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期二, 25 六月 2024 11:42:28 +0800
Subject: [PATCH] 通用页面更新

---
 src/views/tigerprojects/bas/shift/index.vue |  256 +++++++++++++++++++++++++-------------------------
 1 files changed, 128 insertions(+), 128 deletions(-)

diff --git a/src/views/tigerprojects/bas/shift/index.vue b/src/views/tigerprojects/bas/shift/index.vue
index c95f89a..dee37e1 100644
--- a/src/views/tigerprojects/bas/shift/index.vue
+++ b/src/views/tigerprojects/bas/shift/index.vue
@@ -2,27 +2,31 @@
   <div>
     <BasicTable @register="registerTable">
       <template #toolbar>
-        <a-button color="primary" @click="handleAdd"> 娣诲姞 </a-button>
-        <a-button ghost color="primary" @click="aoaToExcel"> 瀵煎嚭 </a-button>
+        <a-button type="primary" @click="handleAdd" preIcon="add_02|svg"> 鏂板 </a-button>
+        <a-button ghost color="success" @click="aoaToExcel" preIcon="excel-export|svg">
+          瀵煎嚭
+        </a-button>
       </template>
       <template #action="{ record }">
-        <TableAction :actions="[
-      {
-        icon: 'clarity:note-edit-line',
-        tooltip: '淇敼',
-        onClick: handleEdit.bind(null, record),
-      },
-      {
-        icon: 'ant-design:delete-outlined',
-        color: 'error',
-        tooltip: '鍒犻櫎',
-        popConfirm: {
-          title: '鏄惁纭鍒犻櫎?',
-          placement: 'left',
-          confirm: handleDelete.bind(null, record),
-        },
-      },
-    ]" />
+        <TableAction
+          :actions="[
+            {
+              icon: 'clarity:note-edit-line',
+              tooltip: '淇敼',
+              onClick: handleEdit.bind(null, record),
+            },
+            {
+              icon: 'ant-design:delete-outlined',
+              color: 'error',
+              tooltip: '鍒犻櫎',
+              popConfirm: {
+                title: '鏄惁纭鍒犻櫎?',
+                placement: 'left',
+                confirm: handleDelete.bind(null, record),
+              },
+            },
+          ]"
+        />
       </template>
     </BasicTable>
     <Loading :loading="compState.loading" :tip="compState.tip" />
@@ -30,115 +34,111 @@
   </div>
 </template>
 <script lang="ts" setup>
-import { reactive, unref } from 'vue';
-import { aoaToSheetXlsx } from '/@/components/Excel';
-import { BasicTable, useTable, TableAction } from '/@/components/Table';
-import { useDrawer } from '/@/components/Drawer';
-import { columns, searchFormSchema } from './shift.data';
-import { getListByPage, Delete } from '/@/api/tigerapi/bas/shift';
-import { useGo } from '/@/hooks/web/usePage';
-import { Loading } from '/@/components/Loading';
-import { useMessage } from '/@/hooks/web/useMessage';
-import { useI18n } from '/@/hooks/web/useI18n';
-import { buildUUID } from '/@/utils/uuid';
+  import { reactive, unref } from 'vue';
+  import { aoaToSheetXlsx } from '/@/components/Excel';
+  import { BasicTable, useTable, TableAction } from '/@/components/Table';
+  import { useDrawer } from '/@/components/Drawer';
+  import { columns, searchFormSchema } from './shift.data';
+  import { getListByPage, Delete } from '/@/api/tigerapi/bas/shift';
+  import { useGo } from '/@/hooks/web/usePage';
+  import { Loading } from '/@/components/Loading';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { useI18n } from '/@/hooks/web/useI18n';
+  import { buildUUID } from '/@/utils/uuid';
 
-const { t } = useI18n();
-const { createMessage } = useMessage();
-const [registerDrawer, { openDrawer }] = useDrawer();
-const go = useGo();
-const compState = reactive({
-  absolute: false,
-  loading: false,
-  tip: '鍔犺浇涓�...',
-});
-const [registerTable, { getForm, getPaginationRef, reload }] = useTable({
-  title: '鐢熶骇鐝埗',
-  api: getListByPage,
-  columns,
-  formConfig: {
-    labelWidth: 120,
-    schemas: searchFormSchema,
-  },
-  actionColumn: {
-    width: 120,
-    title: '鎿嶄綔',
-    dataIndex: 'action',
-    slots: { customRender: 'action' },
-    fixed: 'right', //undefined,
-  },
-  ellipsis: true,
-  useSearchForm: true,
-  showTableSetting: false,
-  bordered: true,
-  showIndexColumn: false,
-});
-let arr: any[] = [];
-//瀵煎嚭
-function aoaToExcel() {
-  const totals = getPaginationRef().total
-  if (totals < 30000) {
-    arr = [];
-    compState.loading = true;
-    const col = getForm().getFieldsValue()
-    getListByPage(col).then((res) => {
-      res.items.forEach(element => {
-        arr.push({
-          '鐝埗缂栫爜': element.SFTS_CODE,
-          '鐝埗鍚嶇О': element.SFTS_NAME,
-          '鏄惁鍚敤': element.IS_ACTIVE,
-          '澶囨敞': element.REMARK,
-          '鍒涘缓浜�': element.CREATE_USER,
-          '鍒涘缓鏃堕棿': element.CREATE_TIME,
-        });
-      });
-      const arrHeader = columns.map((column) => column.title);
-      const arrData = arr.map((item) => {
-        return Object.keys(item).map((key) => item[key]);
-      });
-      // 淇濊瘉data椤哄簭涓巋eader涓�鑷�
-      if (arr.length < 30000) {
-        aoaToSheetXlsx({
-          data: arrData,
-          header: arrHeader,
-          filename: '鐝埗.xlsx',
-        });
-      } else {
-        createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
-      }
-
-      compState.loading = false;
-
-    })
-
-  } else {
-    createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
-  }
-
-
-}
-//娣诲姞
-function handleAdd() {
-  const rule = { SFTS_CODE: '0', ID: buildUUID() };
-  go(`/shiftDetail/${encodeURI(JSON.stringify(rule))}`);
-}
-//缂栬緫
-function handleEdit(record: any) {
-  const rule = { SFTS_CODE: record.SFTS_CODE, ID: record.ID };
-  go(`/shiftDetail/${encodeURI(JSON.stringify(rule))}`);
-}
-function handleSuccess() {
-  reload();
-}
-//鍒犻櫎
-function handleDelete(record: any) {
-  const apiAction = Delete(record.ID);
-  apiAction.then((action) => {
-    if (action.IsSuccessed) {
-      createMessage.success(t('宸插垹闄�'));
-      reload();
-    } else {
-      createMessage.success(t('鍒犻櫎鎿嶄綔澶辫触'));
-    }
+  const { t } = useI18n();
+  const { createMessage } = useMessage();
+  const [registerDrawer, { openDrawer }] = useDrawer();
+  const go = useGo();
+  const compState = reactive({
+    absolute: false,
+    loading: false,
+    tip: '鍔犺浇涓�...',
   });
-}
+  const [registerTable, { getForm, getPaginationRef, reload }] = useTable({
+    title: '鐢熶骇鐝埗',
+    api: getListByPage,
+    columns,
+    formConfig: {
+      labelWidth: 120,
+      schemas: searchFormSchema,
+    },
+    actionColumn: {
+      width: 120,
+      title: '鎿嶄綔',
+      dataIndex: 'action',
+      slots: { customRender: 'action' },
+      fixed: 'right', //undefined,
+    },
+    ellipsis: true,
+    useSearchForm: true,
+    showTableSetting: true,
+    bordered: true,
+    showIndexColumn: false,
+  });
+  let arr: any[] = [];
+  //瀵煎嚭
+  function aoaToExcel() {
+    const totals = getPaginationRef().total;
+    if (totals < 30000) {
+      arr = [];
+      compState.loading = true;
+      const col = getForm().getFieldsValue();
+      getListByPage(col).then((res) => {
+        res.items.forEach((element) => {
+          arr.push({
+            鐝埗缂栫爜: element.SFTS_CODE,
+            鐝埗鍚嶇О: element.SFTS_NAME,
+            鏄惁鍚敤: element.IS_ACTIVE,
+            澶囨敞: element.REMARK,
+            鍒涘缓浜�: element.CREATE_USER,
+            鍒涘缓鏃堕棿: element.CREATE_TIME,
+          });
+        });
+        const arrHeader = columns.map((column) => column.title);
+        const arrData = arr.map((item) => {
+          return Object.keys(item).map((key) => item[key]);
+        });
+        // 淇濊瘉data椤哄簭涓巋eader涓�鑷�
+        if (arr.length < 30000) {
+          aoaToSheetXlsx({
+            data: arrData,
+            header: arrHeader,
+            filename: '鐝埗.xlsx',
+          });
+        } else {
+          createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
+        }
+
+        compState.loading = false;
+      });
+    } else {
+      createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
+    }
+  }
+  //娣诲姞
+  function handleAdd() {
+    const rule = { SFTS_CODE: '0', ID: buildUUID() };
+    go(`/shiftDetail/${encodeURI(JSON.stringify(rule))}`);
+  }
+  //缂栬緫
+  function handleEdit(record: any) {
+    const rule = { SFTS_CODE: record.SFTS_CODE, ID: record.ID };
+    go(`/shiftDetail/${encodeURI(JSON.stringify(rule))}`);
+  }
+  function handleSuccess() {
+    reload();
+  }
+  //鍒犻櫎
+  function handleDelete(record: any) {
+    const apiAction = Delete(record.ID);
+    apiAction.then((action) => {
+      if (action.IsSuccessed) {
+        createMessage.success(t('宸插垹闄�'));
+        reload();
+      } else {
+        createMessage.success(t('鍒犻櫎鎿嶄綔澶辫触'));
+      }
+    });
+  }
 </script>

--
Gitblit v1.9.3