zsysview 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-loading="view.loading">
|
|
3
|
+
<!-- 工具条 -->
|
|
4
|
+
<zsyslist_header
|
|
5
|
+
:config="config"
|
|
6
|
+
v-model:query="query"
|
|
7
|
+
@refresh="GetListData()"
|
|
8
|
+
>
|
|
9
|
+
<template #headermain>
|
|
10
|
+
<slot name="headermain"></slot>
|
|
11
|
+
</template>
|
|
12
|
+
</zsyslist_header>
|
|
13
|
+
|
|
14
|
+
<!-- 列表内容 -->
|
|
15
|
+
<el-table :data="data.listdata" style="width: 100%" :stripe="true">
|
|
16
|
+
<slot name="content"></slot>
|
|
17
|
+
<template #empty>
|
|
18
|
+
<el-empty description="无相关数据" :image-size="100" />
|
|
19
|
+
</template>
|
|
20
|
+
</el-table>
|
|
21
|
+
|
|
22
|
+
<!-- 分页 -->
|
|
23
|
+
<el-pagination
|
|
24
|
+
v-if="config.HideBottomToolbar != true"
|
|
25
|
+
v-model:current-page="currentPage"
|
|
26
|
+
v-model:page-size="pageSize"
|
|
27
|
+
:page-sizes="[30, 50, 100, 150, 200]"
|
|
28
|
+
layout="total, sizes, prev, next, pager, jumper"
|
|
29
|
+
:total="total"
|
|
30
|
+
prev-text="上一页"
|
|
31
|
+
next-text="下一页"
|
|
32
|
+
@change="pageChange"
|
|
33
|
+
style="margin-top: 6px; margin-bottom: 6px"
|
|
34
|
+
>
|
|
35
|
+
</el-pagination>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import { ref, onMounted, onUnmounted, reactive } from "vue";
|
|
41
|
+
import zsyslist_header from "./zsyslist_header.vue";
|
|
42
|
+
// import { HttpApiV1 as http } from "../../../httpapi/http_api_v1";
|
|
43
|
+
// import { zsysEventBus } from "@/utils/zsys_eventBus";
|
|
44
|
+
const eventBus = zsysEventBus();
|
|
45
|
+
const view = reactive({
|
|
46
|
+
loading: false,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
//获取应用层的配置
|
|
50
|
+
// const props = defineProps(['config'])
|
|
51
|
+
const props = defineProps({
|
|
52
|
+
config: { type: Object, required: true },
|
|
53
|
+
module: { type: String, default: "" },
|
|
54
|
+
// closeOnClickModal: { type: Boolean, default: true }
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
console.log("zlist", props.module);
|
|
58
|
+
|
|
59
|
+
const config: ListConfig = props.config as ListConfig;
|
|
60
|
+
const query = reactive({ keyword: "" });
|
|
61
|
+
const currentPage = ref(1);
|
|
62
|
+
const pageSize = ref(30);
|
|
63
|
+
const total = ref(0);
|
|
64
|
+
|
|
65
|
+
const data = ref({} as ListData); //后台返回的数据
|
|
66
|
+
// console.log(data.value.count);
|
|
67
|
+
|
|
68
|
+
// 定义整个列表控件的功能
|
|
69
|
+
export interface ListConfig {
|
|
70
|
+
ApiUrl: string;
|
|
71
|
+
QuickConditionsGroups?: QuickConditionsGroup[]; //快捷查询条件组
|
|
72
|
+
HideBottomToolbar?: boolean; //隐藏底部工具条
|
|
73
|
+
KeywordTip?: string; //快捷查询提示
|
|
74
|
+
ExportUrl?: string; //导出功能接口
|
|
75
|
+
ExportColumn?: ExportColumn[]; //支持导出的字段选项,如果没有的话,就是全部支持字段
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface ExportColumn {
|
|
79
|
+
ColumnTitle: string;
|
|
80
|
+
ColumnName: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
//快捷查询条件结构
|
|
84
|
+
export interface QuickConditionsGroup {
|
|
85
|
+
Label: string; //快捷查询组的标题
|
|
86
|
+
QuickConditions: SqlQueryParam[]; //快捷查询组的选项
|
|
87
|
+
Select: number; //选中的选项的下标
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//查询条件结构
|
|
91
|
+
interface SqlQueryParam {
|
|
92
|
+
label: string;
|
|
93
|
+
column: string | null;
|
|
94
|
+
condition?: string | null;
|
|
95
|
+
value?: number | string | null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//列表数据返回值
|
|
99
|
+
interface ListData {
|
|
100
|
+
count: number;
|
|
101
|
+
listdata: [];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// const config = defineProps<ListConfig>()
|
|
105
|
+
// 使用 toRefs 保持响应性
|
|
106
|
+
// const { user } = toRefs(props)
|
|
107
|
+
// const userName = computed(() => user.value.name)
|
|
108
|
+
|
|
109
|
+
const GetListData = async () => {
|
|
110
|
+
view.loading = true;
|
|
111
|
+
let q = {
|
|
112
|
+
page_size: pageSize.value,
|
|
113
|
+
page_index: currentPage.value,
|
|
114
|
+
user_query_param: GetUserQueryParam(),
|
|
115
|
+
keyword: query.keyword,
|
|
116
|
+
};
|
|
117
|
+
let res = await http.Post(config.ApiUrl, q);
|
|
118
|
+
if (res.IsSuccess) {
|
|
119
|
+
let d = res.data as ListData;
|
|
120
|
+
data.value = d;
|
|
121
|
+
total.value = d.count;
|
|
122
|
+
}
|
|
123
|
+
view.loading = false;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
//provide("refresh_list",GetListData)//提供给子组件调用
|
|
127
|
+
// 处理aud事件
|
|
128
|
+
const aud_event = (payload: { module: string; id: bigint }) => {
|
|
129
|
+
console.log("aud_event:", payload);
|
|
130
|
+
if (payload.module == props.module || payload.module == "all") {
|
|
131
|
+
GetListData();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const GetUserQueryParam = (): SqlQueryParam[] => {
|
|
136
|
+
let re: SqlQueryParam[] = [];
|
|
137
|
+
for (const g of config.QuickConditionsGroups || []) {
|
|
138
|
+
if (g.QuickConditions[g.Select].column != null) {
|
|
139
|
+
re.push(g.QuickConditions[g.Select]);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return re;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
onMounted(() => {
|
|
146
|
+
eventBus.on("aud", aud_event);
|
|
147
|
+
GetListData();
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
onUnmounted(() => {
|
|
151
|
+
eventBus.off("aud", aud_event);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
//==============分页功能===================================
|
|
155
|
+
|
|
156
|
+
const pageChange = (pageindex: number, size: number) => {
|
|
157
|
+
currentPage.value = pageindex;
|
|
158
|
+
pageSize.value = size;
|
|
159
|
+
console.log(currentPage.value, pageSize.value);
|
|
160
|
+
GetListData();
|
|
161
|
+
};
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<style scoped></style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<el-table :data="tableData" style="width: 100%" stripe="true">
|
|
4
|
+
<slot name="content"></slot>
|
|
5
|
+
<!-- <el-table-column prop="date" label="ID" width="180" />
|
|
6
|
+
<el-table-column prop="name" label="IP" width="180" />
|
|
7
|
+
<el-table-column prop="address" label="时间" width="180"/>
|
|
8
|
+
<el-table-column prop="address" label="操作人" width="180"/>
|
|
9
|
+
<el-table-column prop="address" label="日志内容" /> -->
|
|
10
|
+
</el-table>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
const tableData = [
|
|
15
|
+
{
|
|
16
|
+
date: '2016-05-03',
|
|
17
|
+
name: 'Tom',
|
|
18
|
+
address: 'No. 189, Grove St, Los Angeles',
|
|
19
|
+
},{
|
|
20
|
+
date: '2016-05-03',
|
|
21
|
+
name: 'Tom',
|
|
22
|
+
address: 'No. 189, Grove St, Los Angeles',
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<style scoped>
|
|
28
|
+
|
|
29
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-row>
|
|
3
|
+
<el-col :span="24">
|
|
4
|
+
<el-space :size="4" wrap>
|
|
5
|
+
<slot name="headermain"></slot>
|
|
6
|
+
<el-tooltip content="刷新列表数据">
|
|
7
|
+
<el-button :icon="Refresh" @click="refresh" />
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
<el-tooltip v-if="config.KeywordTip?true:false" :show-after="800" :content="config.KeywordTip?config.KeywordTip:'快捷搜索'">
|
|
10
|
+
<el-input style="width: 160px;" :placeholder="config.KeywordTip?config.KeywordTip:'快捷搜索'" :prefix-icon="Search" v-model="query.keyword"
|
|
11
|
+
clearable @keyup.enter.native="refresh" />
|
|
12
|
+
</el-tooltip>
|
|
13
|
+
<!-- <el-tooltip content="打开/关闭高级搜索功能">
|
|
14
|
+
<el-button>高级搜索</el-button>
|
|
15
|
+
</el-tooltip> -->
|
|
16
|
+
<!-- <el-button>排序</el-button> -->
|
|
17
|
+
<el-tooltip v-if="config.ExportUrl?true:false" content="将查询的结果全部导出">
|
|
18
|
+
<el-button @Click="view.exportDialogShow=true">导出</el-button>
|
|
19
|
+
</el-tooltip>
|
|
20
|
+
<!-- <el-button>批量操作</el-button> -->
|
|
21
|
+
</el-space>
|
|
22
|
+
</el-col>
|
|
23
|
+
</el-row>
|
|
24
|
+
|
|
25
|
+
<el-row style="margin-top: 8px;" v-for="v in config.QuickConditionsGroups">
|
|
26
|
+
<el-col :span="24">
|
|
27
|
+
<el-space :size="4" wrap>
|
|
28
|
+
<el-text>{{ v.Label }}</el-text>
|
|
29
|
+
<el-radio-group v-model="v.Select" size="small">
|
|
30
|
+
<el-radio-button v-for="q, index in v.QuickConditions" :value="index" @change="refresh">{{ q.label
|
|
31
|
+
}}</el-radio-button>
|
|
32
|
+
</el-radio-group>
|
|
33
|
+
</el-space>
|
|
34
|
+
</el-col>
|
|
35
|
+
</el-row>
|
|
36
|
+
<el-divider style="margin-top: 4px; margin-bottom: 4px;" />
|
|
37
|
+
<!-- 导出 -->
|
|
38
|
+
<export_dialog v-model="view.exportDialogShow" :export-url="config.ExportUrl" :export-column="config.ExportColumn"></export_dialog>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { defineProps,reactive } from 'vue'
|
|
43
|
+
import { Refresh, Search } from '@element-plus/icons-vue'
|
|
44
|
+
import export_dialog from '@/components/zsys/export/export_dialog.vue';
|
|
45
|
+
|
|
46
|
+
const props = defineProps(['config', 'query'])
|
|
47
|
+
const config = props.config
|
|
48
|
+
const query = props.query
|
|
49
|
+
|
|
50
|
+
const view = reactive({
|
|
51
|
+
exportDialogShow:false
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const emit = defineEmits<{
|
|
55
|
+
(e: 'refresh'): void
|
|
56
|
+
}>()
|
|
57
|
+
|
|
58
|
+
const refresh = () => { emit('refresh') }
|
|
59
|
+
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style scoped></style>
|
package/index.ts
ADDED
|
File without changes
|