-
-
-
-
-
+
+ 重新加载选项
+
+
+
+
+
- {{ item?.label || "" }}
-
+ {{ item.label }}
+
:
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
搜索
重置
-
-
-
- {{ isExpand ? "收起" : "展开" }}
-
-
-
+
+ {{ isExpand ? "收起" : "展开" }}
+
+
@@ -66,109 +72,134 @@
diff --git a/src/components/TableActions/index.vue b/src/components/TableActions/index.vue
new file mode 100644
index 00000000..feaec494
--- /dev/null
+++ b/src/components/TableActions/index.vue
@@ -0,0 +1,157 @@
+
+
+
+
+
+ {{ action.label }}
+
+
+
+
+
+
+ 更多
+
+
+
+
+
+
+
+ {{ action.label }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/TableActions/types.ts b/src/components/TableActions/types.ts
new file mode 100644
index 00000000..4ab68ee2
--- /dev/null
+++ b/src/components/TableActions/types.ts
@@ -0,0 +1,14 @@
+import type { ButtonProps } from "element-plus";
+import type { CSSProperties } from "vue";
+
+/**
+ * 已完成权限筛选的表格行操作。
+ */
+export interface TableAction {
+ key: string;
+ label?: string;
+ buttonProps?: Partial
& { style?: CSSProperties };
+ disabled?: boolean;
+ loading?: boolean;
+ run: () => void | Promise;
+}
diff --git a/src/components/TableSelect/index.vue b/src/components/TableSelect/index.vue
index 7613a33f..cc877548 100644
--- a/src/components/TableSelect/index.vue
+++ b/src/components/TableSelect/index.vue
@@ -108,7 +108,7 @@
>
-
+
@@ -161,7 +161,9 @@ export interface ISelectConfig {
placeholder?: string;
/** popover 组件属性 */
popover?: Partial>;
- /** 列表的网络请求函数(需返回 Promise) */
+ /**
+ * 列表的网络请求函数(需返回 Promise)
+ */
indexAction: (_queryParams: T) => Promise;
/** 主键(跨页选择必填,默认为 id) */
pk?: string;
@@ -198,7 +200,7 @@ const props = withDefaults(
}>(),
{
text: "",
- }
+ },
);
/**
@@ -216,17 +218,12 @@ const isMultiple = props.selectConfig.multiple === true;
const width = props.selectConfig.width ?? "100%";
// 占位符
const placeholder = props.selectConfig.placeholder ?? "请选择";
-// 是否显示弹出框
const popoverVisible = ref(false);
-// 加载状态
const loading = ref(false);
-// 数据总数
const total = ref(0);
-// 列表数据
const pageData = ref([]);
// 每页条数
const pageSize = 10;
-// 搜索参数
const queryParams = reactive<{
pageNum: number;
pageSize: number;
@@ -236,16 +233,13 @@ const queryParams = reactive<{
pageSize,
});
-// 计算 popover 的宽度
const tableSelectRef = ref();
const popoverWidth = ref(width);
useResizeObserver(tableSelectRef, (entries) => {
popoverWidth.value = `${entries[0].contentRect.width}px`;
});
-// 表单操作
const formRef = ref();
-// 初始化搜索条件
for (const item of props.selectConfig.formItems) {
queryParams[item.prop] = item.initialValue ?? "";
}
@@ -283,7 +277,6 @@ function fetchPageData(isRestart = false) {
});
}
-// 列表操作
const tableRef = ref();
// 数据刷新后是否保留选项
for (const item of props.selectConfig.tableColumns) {
@@ -292,7 +285,6 @@ for (const item of props.selectConfig.tableColumns) {
break;
}
}
-// 选择
const selectedItems = ref([]);
const confirmText = computed(() => {
return selectedItems.value.length > 0 ? `已选${selectedItems.value.length}条` : "请选择";
@@ -327,7 +319,6 @@ function handlePagination() {
fetchPageData();
}
-// 弹出框
const isInit = ref(false);
/**
* 显示
diff --git a/src/components/TextScroll/index.vue b/src/components/TextScroll/index.vue
index 958dc9dd..958ed097 100644
--- a/src/components/TextScroll/index.vue
+++ b/src/components/TextScroll/index.vue
@@ -1,6 +1,7 @@
-
-
+
{{ displayText }}
+
{{ displayText }}
-