@@ -45,6 +60,10 @@ const tableObjectRef = ref({
loading: false,
params: {}
})
+// 列表头部按钮
+const HeadButttondata = [
+ defaultButtons.defaultFilterBtn(null), // 筛选
+]
const getPage: any = ref()
const searchSchema = ref()
const tableColumns = ref()
@@ -55,7 +74,7 @@ const rowRef = ref()
const allSchemasRef = ref()
const multipleBol = ref(false)
const searchConditionRef = ref()
-const open = (
+const open = async (
titleName: any,
allSchemas: any,
getApiPage: any,
@@ -79,17 +98,29 @@ const open = (
rowRef.value = row
multipleBol.value = multiple
dialogTitle.value = titleName
- const getList = async () => {
- await getPage.value(searchCondition).then((res) => {
+ searchConditionRef.value = searchCondition
+ if (searchCondition) tableObjectRef.value.params = searchCondition;
+ await getList()
+}
+const getList = async () => {
+ await getPage.value(tableObjectRef.value.params).then((res) => {
tableObjectRef.value.tableList = res
})
}
console.log(tableObjectRef.value)
-
- getList()
+//展示的数据
+const pageSize = ref(10)
+const currentPage = ref(1)
+const showTableData = () => {
+ if (tableObjectRef.value.tableList.length > pageSize.value) {
+ return tableObjectRef.value.tableList.slice(
+ (currentPage.value - 1) * pageSize.value,
+ currentPage.value * pageSize.value
+ )
+ } else {
+ return tableObjectRef.value.tableList
+ }
}
-
-
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
@@ -139,6 +170,34 @@ const submitForm = async () => {
formLoading.value = false
}
}
+
+// 筛选提交
+const searchFormClick = (searchData) => {
+ // 20240104 修改 判断 当前弹窗 是否有条件 如果有条件 需拼接到 筛选中 searchData.filters
+ if (searchConditionRef.value) {
+ Object.keys(searchConditionRef.value).forEach(key => {
+ if (searchData.filters) {
+ searchData.filters.push({
+ action: "==",
+ column: key,
+ value: searchConditionRef.value[key]
+ })
+ // }
+ } else {
+ searchData.filters = [{
+ action: "==",
+ column: key,
+ value: searchConditionRef.value[key]
+ }]
+ }
+ });
+ }
+ tableObjectRef.value.params = {
+ isSearch: true,
+ filters: searchData.filters
+ }
+ getList()// 刷新当前列表
+}
\ No newline at end of file