Explorar o código

去除打包信息

zouzs hai 1 mes
pai
achega
07cbb1c579
Modificáronse 6 ficheiros con 61 adicións e 93 borrados
  1. 1 0
      .gitignore
  2. 0 57
      build/info.ts
  3. 2 2
      build/plugins.ts
  4. 0 1
      package.json
  5. 0 30
      pnpm-lock.yaml
  6. 58 3
      src/views/testTable/pageTable/index.vue

+ 1 - 0
.gitignore

@@ -8,6 +8,7 @@ report.html
 vite.config.*.timestamp*
 
 yarn.lock
+pnpm-lock.yaml
 npm-debug.log*
 .pnpm-error.log*
 .pnpm-debug.log

+ 0 - 57
build/info.ts

@@ -1,57 +0,0 @@
-import type { Plugin } from "vite";
-import gradient from "gradient-string";
-import { getPackageSize } from "./utils";
-import dayjs, { type Dayjs } from "dayjs";
-import duration from "dayjs/plugin/duration";
-import boxen, { type Options as BoxenOptions } from "boxen";
-dayjs.extend(duration);
-
-const welcomeMessage = gradient(["cyan", "magenta"]).multiline(
-  `您好! 欢迎使用 pure-admin 开源项目\n我们为您精心准备了下面两个贴心的保姆级文档\nhttps://pure-admin.cn\nhttps://pure-admin-utils.netlify.app`
-);
-
-const boxenOptions: BoxenOptions = {
-  padding: 0.5,
-  borderColor: "cyan",
-  borderStyle: "round"
-};
-
-export function viteBuildInfo(): Plugin {
-  let config: { command: string };
-  let startTime: Dayjs;
-  let endTime: Dayjs;
-  let outDir: string;
-  return {
-    name: "vite:buildInfo",
-    configResolved(resolvedConfig) {
-      config = resolvedConfig;
-      outDir = resolvedConfig.build?.outDir ?? "dist";
-    },
-    buildStart() {
-      console.log(boxen(welcomeMessage, boxenOptions));
-      if (config.command === "build") {
-        startTime = dayjs(new Date());
-      }
-    },
-    closeBundle() {
-      if (config.command === "build") {
-        endTime = dayjs(new Date());
-        getPackageSize({
-          folder: outDir,
-          callback: (size: string) => {
-            console.log(
-              boxen(
-                gradient(["cyan", "magenta"]).multiline(
-                  `🎉 恭喜打包完成(总用时${dayjs
-                    .duration(endTime.diff(startTime))
-                    .format("mm分ss秒")},打包后的大小为${size})`
-                ),
-                boxenOptions
-              )
-            );
-          }
-        });
-      }
-    }
-  };
-}

+ 2 - 2
build/plugins.ts

@@ -1,6 +1,6 @@
 import { cdn } from "./cdn";
 import vue from "@vitejs/plugin-vue";
-import { viteBuildInfo } from "./info";
+// import { viteBuildInfo } from "./info";
 import svgLoader from "vite-svg-loader";
 import Icons from "unplugin-icons/vite";
 import type { PluginOption } from "vite";
@@ -33,7 +33,7 @@ export function getPluginsList(
       bundler: "vite",
       hideConsole: true
     }),
-    viteBuildInfo(),
+    // viteBuildInfo(),
     /**
      * 开发环境下移除非必要的vue-router动态路由警告No match found for location with path
      * 非必要具体看 https://github.com/vuejs/router/issues/521 和 https://github.com/vuejs/router/issues/359

+ 0 - 1
package.json

@@ -101,7 +101,6 @@
     "eslint-config-prettier": "^10.1.8",
     "eslint-plugin-prettier": "^5.5.3",
     "eslint-plugin-vue": "^10.3.0",
-    "gradient-string": "^3.0.0",
     "husky": "^9.1.7",
     "lint-staged": "^16.1.2",
     "postcss": "^8.5.6",

+ 0 - 30
pnpm-lock.yaml

@@ -162,9 +162,6 @@ importers:
       eslint-plugin-vue:
         specifier: ^10.3.0
         version: 10.4.0(@typescript-eslint/parser@8.44.0(eslint@9.36.0(jiti@2.5.1))(typescript@5.9.2))(eslint@9.36.0(jiti@2.5.1))(vue-eslint-parser@10.2.0(eslint@9.36.0(jiti@2.5.1)))
-      gradient-string:
-        specifier: ^3.0.0
-        version: 3.0.0
       husky:
         specifier: ^9.1.7
         version: 9.1.7
@@ -1319,9 +1316,6 @@ packages:
   '@types/sortablejs@1.15.8':
     resolution: {integrity: sha512-b79830lW+RZfwaztgs1aVPgbasJ8e7AXtZYHTELNXZPsERt4ymJdjV4OccDbHQAvHrCcFpbF78jkm0R6h/pZVg==}
 
-  '@types/tinycolor2@1.4.6':
-    resolution: {integrity: sha512-iEN8J0BoMnsWBqjVbWH/c0G0Hh7O21lpR2/+PrvAVgWdzL7eexIFm4JN/Wn10PTcmNdtS6U67r499mlWMXOxNw==}
-
   '@types/web-bluetooth@0.0.16':
     resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==}
 
@@ -2268,10 +2262,6 @@ packages:
   graceful-fs@4.2.11:
     resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
 
-  gradient-string@3.0.0:
-    resolution: {integrity: sha512-frdKI4Qi8Ihp4C6wZNB565de/THpIaw3DjP5ku87M+N9rNSGmPTjfkq61SdRXB7eCaL8O1hkKDvf6CDMtOzIAg==}
-    engines: {node: '>=14'}
-
   graphemer@1.4.0:
     resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
 
@@ -3505,9 +3495,6 @@ packages:
   through@2.3.8:
     resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
 
-  tinycolor2@1.6.0:
-    resolution: {integrity: sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==}
-
   tinyexec@1.0.1:
     resolution: {integrity: sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw==}
 
@@ -3515,9 +3502,6 @@ packages:
     resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}
     engines: {node: '>=12.0.0'}
 
-  tinygradient@1.1.5:
-    resolution: {integrity: sha512-8nIfc2vgQ4TeLnk2lFj4tRLvvJwEfQuabdsmvDdQPT0xlk9TaNtpGd6nNRxXoK6vQhN6RSzj+Cnp5tTQmpxmbw==}
-
   tippy.js@6.3.7:
     resolution: {integrity: sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==}
 
@@ -4787,8 +4771,6 @@ snapshots:
 
   '@types/sortablejs@1.15.8': {}
 
-  '@types/tinycolor2@1.4.6': {}
-
   '@types/web-bluetooth@0.0.16': {}
 
   '@types/web-bluetooth@0.0.21': {}
@@ -5953,11 +5935,6 @@ snapshots:
 
   graceful-fs@4.2.11: {}
 
-  gradient-string@3.0.0:
-    dependencies:
-      chalk: 5.6.2
-      tinygradient: 1.1.5
-
   graphemer@1.4.0: {}
 
   has-flag@4.0.0: {}
@@ -7118,8 +7095,6 @@ snapshots:
 
   through@2.3.8: {}
 
-  tinycolor2@1.6.0: {}
-
   tinyexec@1.0.1: {}
 
   tinyglobby@0.2.15:
@@ -7127,11 +7102,6 @@ snapshots:
       fdir: 6.5.0(picomatch@4.0.3)
       picomatch: 4.0.3
 
-  tinygradient@1.1.5:
-    dependencies:
-      '@types/tinycolor2': 1.4.6
-      tinycolor2: 1.6.0
-
   tippy.js@6.3.7:
     dependencies:
       '@popperjs/core': 2.11.8

+ 58 - 3
src/views/testTable/pageTable/index.vue

@@ -6,22 +6,38 @@
       :before-search-submit="handleBeforeSearch"
       :is-card="true"
       :table="{
-        onSortChange: handleSortChange
+        onSortChange: handleSortChange,
+        isSelection: true,
+        actionBar: { buttons, type: 'button', width: 240 }
       }"
     />
   </div>
 </template>
 
 <script lang="ts" setup>
-import { defineOptions, ref } from "vue";
-import { type PageInfo, type PlusColumn, PlusPage } from "plus-pro-components";
+import { computed, defineOptions, ref } from "vue";
+import {
+  type PageInfo,
+  type PlusColumn,
+  PlusPage,
+  useTable
+} from "plus-pro-components";
 import "plus-pro-components/es/components/page/style/css";
 import { cloneDeep } from "lodash-es";
+import { number } from "echarts";
 
 defineOptions({
   name: "PageTable"
 });
 
+interface TableRow {
+  id: number;
+  name: string;
+  status: string;
+  tag: string;
+  time: Date;
+}
+
 const getList = async (
   query: PageInfo & {
     status?: string;
@@ -121,6 +137,8 @@ const calendarChange = (obj: any) => {
   if (maxDate) choiceDate.value = null;
 };
 
+const { buttons } = useTable<TableRow[]>();
+
 const tableConfig: PlusColumn[] = [
   {
     label: "名称",
@@ -225,4 +243,41 @@ const tableConfig: PlusColumn[] = [
     minWidth: "180px"
   }
 ];
+
+buttons.value = [
+  {
+    // 查看
+    text: "查看",
+    code: "view",
+    props: (row: any) => ({
+      type: "info",
+      disabled: row.status === "1"
+    }),
+    show: (row: any) => row.status === "1"
+  },
+  {
+    // 修改
+    text: "修改",
+    code: "edit",
+    // props v0.1.16 版本新增函数类型
+    props: (row: any) => ({
+      type: "primary",
+      disabled: row.status === "1"
+    }),
+    show: computed(() => true)
+  },
+  {
+    // 删除
+    text: "删除",
+    code: "delete",
+    // props v0.1.16 版本新增计算属性支持
+    props: computed(() => ({ type: "danger" })),
+    confirm: {
+      options: {
+        draggable: true,
+        message: "确定删除此数据吗?"
+      }
+    }
+  }
+];
 </script>