diff --git a/web/package.json b/web/package.json
index 37868851..c51d863a 100644
--- a/web/package.json
+++ b/web/package.json
@@ -4,7 +4,7 @@
"license": "Apache-2.0",
"type": "module",
"scripts": {
- "dev": "vite --force",
+ "dev": "esno ./src/utils/build.ts && vite --force",
"build": "vite build && esno ./src/utils/build.ts",
"lint": "eslint .",
"lint-fix": "eslint --fix .",
diff --git a/web/src/components/table/fieldRender/buttons.vue b/web/src/components/table/fieldRender/buttons.vue
new file mode 100644
index 00000000..e58e306a
--- /dev/null
+++ b/web/src/components/table/fieldRender/buttons.vue
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+ {{ getTranslation(btn.text) }}
+
+
+
+
+
+
+ {{ getTranslation(btn.text) }}
+
+
+
+
+
+
+
+
+
+
+ {{ getTranslation(btn.text) }}
+
+
+
+
+
+
+
+
+
+
+ {{ getTranslation(btn.text) }}
+
+
+
+
+
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/color.vue b/web/src/components/table/fieldRender/color.vue
new file mode 100644
index 00000000..6ba1f747
--- /dev/null
+++ b/web/src/components/table/fieldRender/color.vue
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/customRender.vue b/web/src/components/table/fieldRender/customRender.vue
new file mode 100644
index 00000000..d9bac394
--- /dev/null
+++ b/web/src/components/table/fieldRender/customRender.vue
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/customTemplate.vue b/web/src/components/table/fieldRender/customTemplate.vue
new file mode 100644
index 00000000..5d95401a
--- /dev/null
+++ b/web/src/components/table/fieldRender/customTemplate.vue
@@ -0,0 +1,21 @@
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/datetime.vue b/web/src/components/table/fieldRender/datetime.vue
new file mode 100644
index 00000000..09dc1a3a
--- /dev/null
+++ b/web/src/components/table/fieldRender/datetime.vue
@@ -0,0 +1,22 @@
+
+
+ {{ !cellValue ? '-' : timeFormat(cellValue, field.timeFormat ?? 'yyyy-mm-dd hh:MM:ss') }}
+
+
+
+
diff --git a/web/src/components/table/fieldRender/default.vue b/web/src/components/table/fieldRender/default.vue
new file mode 100644
index 00000000..27bfa306
--- /dev/null
+++ b/web/src/components/table/fieldRender/default.vue
@@ -0,0 +1,5 @@
+
+
+ Field renderer not found
+
+
diff --git a/web/src/components/table/fieldRender/icon.vue b/web/src/components/table/fieldRender/icon.vue
new file mode 100644
index 00000000..7f75608f
--- /dev/null
+++ b/web/src/components/table/fieldRender/icon.vue
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/image.vue b/web/src/components/table/fieldRender/image.vue
new file mode 100644
index 00000000..dd156857
--- /dev/null
+++ b/web/src/components/table/fieldRender/image.vue
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/images.vue b/web/src/components/table/fieldRender/images.vue
new file mode 100644
index 00000000..9e970ba0
--- /dev/null
+++ b/web/src/components/table/fieldRender/images.vue
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/index.vue b/web/src/components/table/fieldRender/index.vue
deleted file mode 100644
index c701ab43..00000000
--- a/web/src/components/table/fieldRender/index.vue
+++ /dev/null
@@ -1,299 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ field.replaceValue ? field.replaceValue[fieldValue] ?? fieldValue : fieldValue }}
-
-
-
-
-
-
-
-
- {{ field.replaceValue ? field.replaceValue[tag] ?? tag : tag }}
-
-
-
-
- {{ field.replaceValue ? field.replaceValue[fieldValue] ?? fieldValue : fieldValue }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ !fieldValue ? '-' : timeFormat(fieldValue, field.timeFormat ?? undefined) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ btn.text }}
-
-
-
-
-
-
- {{ btn.text }}
-
-
-
-
-
-
-
-
-
-
- {{ btn.text }}
-
-
-
-
-
-
-
-
-
-
- {{ btn.text }}
-
-
-
-
-
-
-
-
-
-
diff --git a/web/src/components/table/fieldRender/switch.vue b/web/src/components/table/fieldRender/switch.vue
new file mode 100644
index 00000000..158a6116
--- /dev/null
+++ b/web/src/components/table/fieldRender/switch.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/tag.vue b/web/src/components/table/fieldRender/tag.vue
new file mode 100644
index 00000000..bc3c49db
--- /dev/null
+++ b/web/src/components/table/fieldRender/tag.vue
@@ -0,0 +1,28 @@
+
+
+
+ {{ !isEmpty(field.replaceValue) ? field.replaceValue[cellValue] ?? cellValue : cellValue }}
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/tags.vue b/web/src/components/table/fieldRender/tags.vue
new file mode 100644
index 00000000..f314ff0c
--- /dev/null
+++ b/web/src/components/table/fieldRender/tags.vue
@@ -0,0 +1,54 @@
+
+
+
+
+
+ {{ !isEmpty(field.replaceValue) ? field.replaceValue[tag] ?? tag : tag }}
+
+
+
+
+
+ {{ !isEmpty(field.replaceValue) ? field.replaceValue[cellValue] ?? cellValue : cellValue }}
+
+
+
+
+
+
+
+
diff --git a/web/src/components/table/fieldRender/url.vue b/web/src/components/table/fieldRender/url.vue
new file mode 100644
index 00000000..eb2e8366
--- /dev/null
+++ b/web/src/components/table/fieldRender/url.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/src/components/table/index.ts b/web/src/components/table/index.ts
index 6e81fae8..8f6c82a1 100644
--- a/web/src/components/table/index.ts
+++ b/web/src/components/table/index.ts
@@ -1,14 +1,40 @@
+import { TableColumnCtx } from 'element-plus'
import { i18n } from '/@/lang/index'
-/*
- * 默认Url点击事件处理
+/**
+ * 获取单元格值
*/
-export const openUrl = (url: string, field: TableColumn) => {
- if (field.target == '_blank') {
- window.open(url)
- } else {
- window.location.href = url
+export const getCellValue = (row: TableRow, field: TableColumn, column: TableColumnCtx, index: number) => {
+ if (!field.prop) return ''
+
+ const prop = field.prop
+ let cellValue: any = row[prop]
+
+ // 字段 prop 带 . 比如 user.nickname
+ if (prop.indexOf('.') > -1) {
+ const fieldNameArr = prop.split('.')
+ cellValue = row[fieldNameArr[0]]
+ for (let index = 1; index < fieldNameArr.length; index++) {
+ cellValue = cellValue ? cellValue[fieldNameArr[index]] ?? '' : ''
+ }
+ return cellValue
}
+
+ // 若无值,尝试取默认值
+ if (cellValue === undefined || cellValue === null) {
+ cellValue = field.default
+ }
+
+ // 渲染前格式化
+ if (field.renderFormatter && typeof field.renderFormatter == 'function') {
+ cellValue = field.renderFormatter(row, field, cellValue, column, index)
+ console.warn('baTable.table.column.renderFormatter 即将废弃,请直接使用兼容 el-table 的 baTable.table.column.formatter 代替')
+ }
+ if (field.formatter && typeof field.formatter == 'function') {
+ cellValue = field.formatter(row, column, cellValue, index)
+ }
+
+ return cellValue
}
/*
diff --git a/web/src/components/table/index.vue b/web/src/components/table/index.vue
index 12c30753..0286300d 100644
--- a/web/src/components/table/index.vue
+++ b/web/src/components/table/index.vue
@@ -30,22 +30,15 @@
v-bind="item"
:column-key="(item['columnKey'] ? item['columnKey'] : `table-column-${item.prop}`) || shortUuid()"
>
-
+
-
@@ -71,8 +64,8 @@