ct-component-plus 0.0.22 → 0.0.24

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ct-component-plus",
3
3
  "private": false,
4
- "version": "0.0.22",
4
+ "version": "0.0.24",
5
5
  "type": "module",
6
6
  "main": "packages/components/index.js",
7
7
  "files": [
@@ -38,7 +38,6 @@ const showValue = computed({
38
38
  val = props.addTimestamp(val);
39
39
  } else if (isArray(val)) {
40
40
  if (isArray(props.addTimestamp)) {
41
- console.log(val);
42
41
  val = val.map((item, index) => {
43
42
  if (!item) return item;
44
43
  return +props.addTimestamp[index] + item;
@@ -18,6 +18,7 @@ import dialog from "./dialog";
18
18
  import messageBox from './message-box';
19
19
  import CtMessage from './message';
20
20
 
21
+ import CtLoading from './loading';
21
22
  import CtPage from './page';
22
23
 
23
24
  import ElementPlus from 'element-plus'
@@ -46,6 +47,7 @@ const components = [
46
47
  dialog,
47
48
  messageBox,
48
49
  CtMessage,
50
+ CtLoading,
49
51
  CtPage
50
52
  ]
51
53
 
@@ -0,0 +1,8 @@
1
+ import CtLoading from "./src/CtLoading.vue";
2
+
3
+ /* istanbul ignore next */
4
+ CtLoading.install = function (Vue) {
5
+ Vue.component('CtLoading', CtLoading);
6
+ };
7
+
8
+ export default CtLoading;
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div class="ct-loading">
3
+ <div class="ct-loading__main" v-show="showLoad">
4
+ <component :is="componentMap[type]" :is-load="isLoad"></component>
5
+ </div>
6
+ <!-- 默认插槽,放置显示内容 -->
7
+ <div v-show="!showLoad" class="slot-content">
8
+ <slot> </slot>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import beating from "./beating.vue";
15
+ import spinner from "./spinner.vue";
16
+ import CircleProgress from "./progress.vue";
17
+ export default {
18
+ props: {
19
+ type: {
20
+ type: String,
21
+ default: "beating", //beating,spinner,progress
22
+ },
23
+ isLoad: {
24
+ type: Boolean,
25
+ },
26
+ delay: {
27
+ type: [String, Number],
28
+ default: 500,
29
+ },
30
+ },
31
+ components: {
32
+ beating,
33
+ spinner,
34
+ CircleProgress,
35
+ },
36
+ data() {
37
+ return {
38
+ showLoad: false,
39
+ componentMap: {
40
+ beating: "beating",
41
+ spinner: "spinner",
42
+ progress: "CircleProgress",
43
+ },
44
+ };
45
+ },
46
+ created() {},
47
+ mounted() {},
48
+ methods: {},
49
+ watch: {
50
+ isLoad: {
51
+ handler(val) {
52
+ if (val) {
53
+ this.showLoad = val;
54
+ } else {
55
+ if (this.type == "progress") {
56
+ setTimeout(() => {
57
+ this.showLoad = val;
58
+ }, Number(this.delay));
59
+ } else {
60
+ this.showLoad = val;
61
+ }
62
+ }
63
+ },
64
+ immediate: true,
65
+ },
66
+ },
67
+ };
68
+ </script>
69
+ <style scoped lang='less'>
70
+ .ct-loading {
71
+ width: 100%;
72
+ min-height: 200px;
73
+ position: relative;
74
+ }
75
+ </style>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <!-- 跳动加载特效 -->
3
+ <div class="ct-loading__beating">
4
+ <div></div>
5
+ <div></div>
6
+ <div></div>
7
+ <div></div>
8
+ <div></div>
9
+ </div>
10
+ </template>
11
+ <script>
12
+ export default {};
13
+ </script>
14
+
15
+ <style lang="less" scoped>
16
+ .ct-loading__beating {
17
+ width: 40px;
18
+ height: 45px;
19
+ text-align: center;
20
+ font-size: 10px;
21
+ position: absolute;
22
+ left: 50%;
23
+ top: 50%;
24
+ transform: translate(-50%, -50%);
25
+ border-radius: 10px;
26
+ }
27
+
28
+ .ct-loading__beating > div {
29
+ background-color: var(--ct-color-primary, #2e65fd);
30
+ opacity: 0.8;
31
+ height: 100%;
32
+ width: 4px;
33
+ border-radius: 10px;
34
+ display: inline-block;
35
+ margin: 0 2px;
36
+ -webkit-animation: stretchdelay 1.2s infinite ease-in-out;
37
+ animation: stretchdelay 1.2s infinite ease-in-out;
38
+
39
+ &:nth-child(2) {
40
+ -webkit-animation-delay: -1.1s;
41
+ animation-delay: -1.1s;
42
+ }
43
+
44
+ &:nth-child(3) {
45
+ -webkit-animation-delay: -1s;
46
+ animation-delay: -1s;
47
+ }
48
+
49
+ &:nth-child(4) {
50
+ -webkit-animation-delay: -0.9s;
51
+ animation-delay: -0.9s;
52
+ }
53
+
54
+ &:nth-child(5) {
55
+ -webkit-animation-delay: -0.8s;
56
+ animation-delay: -0.8s;
57
+ }
58
+ }
59
+ @keyframes stretchdelay {
60
+ 0%,
61
+ 40%,
62
+ 100% {
63
+ transform: scaleY(0.4);
64
+ -webkit-transform: scaleY(0.4);
65
+ }
66
+
67
+ 20% {
68
+ transform: scaleY(1);
69
+ -webkit-transform: scaleY(1);
70
+ }
71
+ }
72
+ </style>
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <svg class="ct-loading__progress" width="100" height="100">
3
+ <circle
4
+ cx="50"
5
+ cy="50"
6
+ r="45"
7
+ stroke="#F5F7FA"
8
+ stroke-width="6"
9
+ fill="none"
10
+ ></circle>
11
+ <circle
12
+ cx="50"
13
+ cy="50"
14
+ r="45"
15
+ :stroke="color"
16
+ class="circle"
17
+ id="ct-loading__progress"
18
+ ></circle>
19
+ <text x="50" y="55" fill="#141617" text-anchor="middle">
20
+ <tspan class="text">{{ currentPercentage }}</tspan>
21
+ <tspan class="percent">%</tspan>
22
+ </text>
23
+ </svg>
24
+ </template>
25
+
26
+ <script>
27
+ export default {
28
+ name: "CircleProgress",
29
+ props: {
30
+ color: {
31
+ default: "#2E65FD",
32
+ },
33
+ isLoad: {
34
+ type: Boolean,
35
+ },
36
+ },
37
+ data() {
38
+ return {
39
+ currentPercentage: 0,
40
+ progressLen: 282.6,
41
+ circleDom: null,
42
+ interval: null,
43
+ };
44
+ },
45
+ created() {},
46
+ mounted() {
47
+ this.circleDom = document.querySelector("#ct-loading__progress");
48
+ },
49
+ methods: {
50
+ setPercent(dom, num) {
51
+ if (num > 100) return;
52
+ dom.style["stroke-dashoffset"] =
53
+ this.progressLen - (this.progressLen / 100) * num;
54
+ },
55
+ },
56
+ watch: {
57
+ isLoad: {
58
+ handler(val) {
59
+ if (val) {
60
+ this.currentPercentage = 0;
61
+ this.interval = setInterval(() => {
62
+ if (this.currentPercentage <= 60) {
63
+ this.currentPercentage += Math.floor(Math.random() * 5 + 5);
64
+ } else {
65
+ this.currentPercentage += Math.floor(Math.random() * 5);
66
+ }
67
+ if (this.currentPercentage >= 99) this.currentPercentage = 99;
68
+ }, 250);
69
+ } else {
70
+ this.currentPercentage = 100;
71
+ }
72
+ },
73
+ immediate: true,
74
+ },
75
+ currentPercentage(val) {
76
+ this.setPercent(this.circleDom, val);
77
+ if (val == 100) {
78
+ clearInterval(this.interval);
79
+ }
80
+ },
81
+ },
82
+ beforeDestroy() {
83
+ clearInterval(this.interval);
84
+ },
85
+ };
86
+ </script>
87
+ <style scoped lang='less'>
88
+ .ct-loading__progress {
89
+ position: absolute;
90
+ left: 50%;
91
+ top: 50%;
92
+ transform: translate(-50%, -50%);
93
+ .circle {
94
+ fill: none;
95
+ stroke-width: 6;
96
+ stroke-dasharray: 282.6;
97
+ stroke-dashoffset: 282.6;
98
+ //animation: circle 3s infinite;
99
+ stroke-linecap: round;
100
+ transform: rotate(-90deg);
101
+ transform-origin: center;
102
+ transform-box: fill-box;
103
+ transition: all 0.5s;
104
+ }
105
+ @keyframes circle {
106
+ 100% {
107
+ stroke-dashoffset: 0;
108
+ }
109
+ }
110
+
111
+ .text,
112
+ .percent {
113
+ font-weight: 500;
114
+ }
115
+ text {
116
+ display: flex;
117
+ justify-content: center;
118
+ align-items: center;
119
+ }
120
+ }
121
+ </style>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <div class="ct-loading__spinner">
3
+ <img src="../../../assets/img/icon_load_circle.png" alt="" />
4
+ <slot name="text"></slot>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ export default {
10
+ data() {
11
+ return {};
12
+ },
13
+ created() {},
14
+ mounted() {},
15
+ methods: {},
16
+ };
17
+ </script>
18
+ <style scoped lang='less'>
19
+ .ct-loading__spinner {
20
+ position: absolute;
21
+ left: 50%;
22
+ top: 50%;
23
+ transform: translate(-50%, -50%);
24
+
25
+ img {
26
+ width: 40px;
27
+ transform-origin: center;
28
+ animation: rotate 2s infinite linear;
29
+ }
30
+ @keyframes rotate {
31
+ 0% {
32
+ transform: rotate(0deg);
33
+ }
34
+ 100% {
35
+ transform: rotate(360deg);
36
+ }
37
+ }
38
+ }
39
+ </style>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div type="border" class="download-button" @click="download">
3
+ <ct-icon name="download2_line"></ct-icon>
4
+ <span>下载</span>
5
+ </div>
6
+ </template>
7
+
8
+ <script setup>
9
+ import { inject, unref } from "vue";
10
+ const downloadLoading = inject("downloadLoading", false);
11
+ const emit = defineEmits(["download"]);
12
+ const download = () => {
13
+ if (unref(downloadLoading)) return;
14
+ emit("download");
15
+ };
16
+ </script>
17
+ <style lang='less' scoped>
18
+ .download-button {
19
+ display: inline-flex;
20
+ align-items: center;
21
+ }
22
+ </style>
@@ -0,0 +1,149 @@
1
+ <template>
2
+ <div :class="[ns.b()]">
3
+ <div :class="[ns.e('container')]">
4
+ <div :class="[ns.e('left')]">
5
+ <slot name="table-title">
6
+ <ct-icon
7
+ :class="[ns.e('total-icon')]"
8
+ name="content-search_line"
9
+ ></ct-icon>
10
+ <span>查询结果:</span>
11
+ <span>共{{ total }}条记录</span>
12
+ <span>,每页显示{{ pageSize }}条</span>
13
+ <slot name="table-desc"></slot>
14
+ </slot>
15
+ </div>
16
+ <div :class="[ns.e('right')]">
17
+ <slot name="table-handle">
18
+ <slot name="table-handle-before"></slot>
19
+ <div :class="[ns.e('handle')]">
20
+ <div
21
+ :class="[ns.e('handle-item'), ns.is(item, true)]"
22
+ v-for="(item, index) in handleList"
23
+ :key="index"
24
+ v-show="handleItemShow(item)"
25
+ >
26
+ <component
27
+ v-if="handleItemShow(item)"
28
+ :is="getHandleComponent(item)"
29
+ v-bind="handleOptionsBind(item)"
30
+ v-model:sortObj="modelSort"
31
+ @download="download"
32
+ />
33
+ </div>
34
+ </div>
35
+ <slot name="table-handle-after"></slot>
36
+ </slot>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <script setup>
43
+ import { reactive, onMounted, ref, computed } from "vue";
44
+ import { useNamespace } from "../../../../hooks";
45
+ import DownloadButton from "./DownloadButton.vue";
46
+ import TableSort from "../../../table/src/TableSort.vue";
47
+ const props = defineProps({
48
+ total: Number,
49
+ pageSize: Number,
50
+ handleList: {
51
+ type: Array,
52
+ default: () => {
53
+ return ["sort", "download"];
54
+ },
55
+ },
56
+ sortList: {
57
+ type: Array,
58
+ default: () => {
59
+ return [];
60
+ },
61
+ },
62
+ sortObj: {
63
+ type: Object,
64
+ default: () => {
65
+ return {};
66
+ },
67
+ },
68
+ });
69
+ const emit = defineEmits(["update:sortObj", "changeSort", "download"]);
70
+ const ns = useNamespace("page-table-title");
71
+ const modelSort = computed({
72
+ get() {
73
+ return props.sortObj;
74
+ },
75
+ set(val) {
76
+ emit("update:sortObj", val);
77
+ if (val.prop && val.order) {
78
+ emit("changeSort", val);
79
+ }
80
+ },
81
+ });
82
+ const getHandleComponent = (type) => {
83
+ const componentMap = {
84
+ sort: TableSort,
85
+ download: DownloadButton,
86
+ };
87
+ return componentMap[type] || "div";
88
+ };
89
+ const handleOptionsBind = (item) => {
90
+ if (item === "sort") {
91
+ return { sortList: props.sortList };
92
+ }
93
+ return {};
94
+ };
95
+ const download = () => {
96
+ emit("download");
97
+ };
98
+ const handleItemShow = (item) => {
99
+ if (item === "sort") {
100
+ return props.sortList.length > 0;
101
+ }
102
+ return true;
103
+ };
104
+ onMounted(() => {});
105
+ </script>
106
+ <style lang='less' scoped>
107
+ .ct-page-table-title {
108
+ &__container {
109
+ display: flex;
110
+ align-items: center;
111
+ justify-content: space-between;
112
+ height: 56px;
113
+ background-color: #fff;
114
+ }
115
+ &__left {
116
+ display: flex;
117
+ align-items: center;
118
+ justify-content: flex-start;
119
+ }
120
+ &__total-icon {
121
+ margin-right: 8px;
122
+ }
123
+ &__handle {
124
+ display: flex;
125
+ align-items: center;
126
+ justify-content: flex-end;
127
+ &-item {
128
+ &:not(:last-child) {
129
+ margin-right: 12px;
130
+ }
131
+ display: inline-flex;
132
+ align-items: center;
133
+ height: 28px;
134
+ padding: 0 9px;
135
+ color: var(--ct-color-primary);
136
+ border: 1px solid var(--ct-color-primary);
137
+ border-radius: 3px;
138
+ background-color: #fff;
139
+ cursor: pointer;
140
+ &:hover {
141
+ background-color: var(--ct-color-primary-bg);
142
+ }
143
+ :deep(.ct-icon) {
144
+ margin-right: 4px;
145
+ }
146
+ }
147
+ }
148
+ }
149
+ </style>
@@ -1,14 +1,97 @@
1
1
  <script>
2
- import { h, reactive, resolveComponent } from "vue";
2
+ import {
3
+ h,
4
+ reactive,
5
+ inject,
6
+ ref,
7
+ computed,
8
+ resolveComponent,
9
+ provide,
10
+ nextTick,
11
+ } from "vue";
3
12
  import { useNamespace } from "../../../hooks";
4
13
  import SearchBox from "../../search-box";
5
- import tableBox from "../../table";
14
+ import TableBox from "../../table";
15
+ import CtPagination from "../../pagination";
16
+ import CtLoading from "../../loading";
17
+ import TableTitle from "./modules/TableTitle.vue";
18
+ import { isFunction } from "../../../utils";
6
19
  export default {
7
20
  name: "PageComponent",
8
- props: {},
9
- setup(props, { emit, slots }) {
21
+ props: {
22
+ searchApi: {
23
+ type: String,
24
+ default: "",
25
+ },
26
+ needInit: {
27
+ type: Boolean,
28
+ default: true,
29
+ },
30
+ searchConfig: {
31
+ type: Object,
32
+ default: () => {
33
+ return {};
34
+ },
35
+ },
36
+ pageSize: Number,
37
+ tableHandleList: {
38
+ type: Array,
39
+ default: () => {
40
+ return ["sort", "download"];
41
+ },
42
+ },
43
+ searchProps: {
44
+ type: Object,
45
+ default: () => {
46
+ return {};
47
+ },
48
+ },
49
+ tableProps: {
50
+ type: Object,
51
+ default: () => {
52
+ return {};
53
+ },
54
+ },
55
+ loadProps: {
56
+ type: Object,
57
+ default: () => {
58
+ return {};
59
+ },
60
+ },
61
+ paginationProps: {
62
+ type: Object,
63
+ default: () => {
64
+ return {};
65
+ },
66
+ },
67
+ cbs: {
68
+ type: Object,
69
+ default: () => {
70
+ return {};
71
+ },
72
+ },
73
+ },
74
+ setup(props, { emit, slots, expose }) {
75
+ const baseDao = inject("$ctBaseDao");
76
+ const serviceConfig = inject("$ctServiceConfig");
77
+ const searchMethod =
78
+ props.searchConfig.method || serviceConfig.defaultMethod || "post";
79
+ const downlaodMethod =
80
+ props.searchConfig.downlaodMethod ||
81
+ serviceConfig.defaultDownlaodMethod ||
82
+ "handlerDownload";
83
+ const state = reactive({
84
+ total: 0,
85
+ pageSize: props.pageSize,
86
+ pageNo: 1,
87
+ sortObj: {},
88
+ searchParams: {},
89
+ pageLoading: false,
90
+ downloadLoading: false,
91
+ });
92
+ const downloadLoading = ref(false);
93
+ provide("downloadLoading", downloadLoading);
10
94
  const getSelfSlots = (name) => {
11
- console.log(slots);
12
95
  if (!name) return null;
13
96
  const key = `_${name}-`;
14
97
  const res = {};
@@ -19,13 +102,66 @@ export default {
19
102
  });
20
103
  return res;
21
104
  };
105
+ // searchBox逻辑
106
+ const searchRef = ref(null);
107
+ const doSearch = (params) => {
108
+ state.searchParams = params;
109
+ state.pageNo = 1;
110
+ getPageData();
111
+ };
112
+ const getPageData = async (download = false) => {
113
+ let dataP = {
114
+ ...state.searchParams,
115
+ };
116
+ if (props.pageSize) {
117
+ dataP.pageSize = props.pageSize;
118
+ dataP.pageNo = state.pageNo;
119
+ }
120
+ state.pageLoading = true;
121
+ if (isFunction(props.cbs.doSearch)) {
122
+ await props.cbs.doSearch(dataP);
123
+ state.pageLoading = false;
124
+ return;
125
+ }
126
+ if (isFunction(props.cbs.beforeSearch)) {
127
+ const paramsHandle = await props.cbs.beforeSearch(dataP);
128
+ if (paramsHandle === false) return;
129
+ dataP = paramsHandle || dataP;
130
+ }
131
+ if (download) {
132
+ if (isFunction(props.cbs.doDownload)) {
133
+ await props.cbs.doDownload(dataP);
134
+ } else {
135
+ await baseDao[downlaodMethod](props.searchApi, dataP);
136
+ }
137
+ return;
138
+ }
139
+ await baseDao[searchMethod](props.searchApi, dataP)
140
+ .then(async (res) => {
141
+ let data = res || {};
142
+ if (isFunction(props.cbs.afterSearch)) {
143
+ const dataHandle = await props.cbs.afterSearch(data);
144
+ if (dataHandle) data = dataHandle;
145
+ }
146
+ const { total, tableData, columnData, list } = data;
147
+ state.total = total || 0;
148
+ if (columnData) {
149
+ tableProps.columnData = columnData;
150
+ }
151
+ tableProps.tableData = tableData || list || [];
152
+ })
153
+ .finally(() => {
154
+ state.pageLoading = false;
155
+ });
156
+ state.pageLoading = false;
157
+ };
158
+
159
+ const tableTitleRef = ref(null);
160
+ // tableBox逻辑
161
+ const tableRef = ref(null);
162
+ const paginationRef = ref(null);
22
163
  const tableProps = reactive({
23
- columnData: [
24
- { label: "序号", value: "index" },
25
- { label: "校验结果", value: "result" },
26
- { label: "处理状态", value: "status" },
27
- { label: "操作", value: "id" },
28
- ],
164
+ columnData: props.tableProps.columnData || [],
29
165
  tableData: [
30
166
  { index: 1, result: 3, status: "暂未处理" },
31
167
  { index: 2, result: 0, status: "无需处理" },
@@ -33,46 +169,168 @@ export default {
33
169
  { index: 4, result: 0, status: "处理完成" },
34
170
  ],
35
171
  });
36
-
37
- const tableDom = h(
38
- tableBox,
39
- {
40
- "table-props": tableProps,
41
- },
42
- { ...getSelfSlots("table") }
43
- );
44
- const searchDom = h(
45
- SearchBox,
46
- {
47
- "search-list": [],
48
- "have-reset": true,
49
- },
50
- { ...slots }
51
- );
172
+ const sortList = computed(() => {
173
+ const tableSortList = props.tableProps.columnData.filter((item) => {
174
+ return item.sortable;
175
+ });
176
+ return tableSortList || [];
177
+ });
178
+ const changeSort = (val) => {
179
+ state.pageNo = 1;
180
+ state.sortObj = val;
181
+ getPageData();
182
+ };
183
+ const changePageNo = (val) => {
184
+ state.pageNo = val;
185
+ getPageData();
186
+ };
187
+ const doDownload = async () => {
188
+ downloadLoading.value = true;
189
+ try {
190
+ await getPageData(true);
191
+ } catch (error) {}
192
+ await new Promise((resolve) => {
193
+ setTimeout(() => {
194
+ resolve();
195
+ }, 3000);
196
+ });
197
+ downloadLoading.value = false;
198
+ };
199
+ const clickSearch = () => {
200
+ if (searchRef.value && isFunction(searchRef.value.doSearch)) {
201
+ searchRef.value.doSearch();
202
+ } else {
203
+ doSearch({});
204
+ }
205
+ };
206
+ if (props.needInit) {
207
+ nextTick(() => {
208
+ clickSearch();
209
+ });
210
+ }
52
211
  const ns = useNamespace("page-component");
212
+ expose({
213
+ searchMethod,
214
+ searchRef,
215
+ tableTitleRef,
216
+ tableRef,
217
+ paginationRef,
218
+ doSearch,
219
+ clickSearch,
220
+ getPageData,
221
+ changePageNo,
222
+ changeSort,
223
+ });
53
224
  return () =>
54
225
  h("div", { class: ns.b() }, [
55
226
  h("div", { class: ns.e("container") }, [
56
227
  h("div", { class: ns.e("header") }, [
57
- h(
58
- "div",
59
- slots.header
60
- ? slots.header()
61
- : h("div", { class: ns.em("header", "default") }, [
62
- slots.headerBefore ? slots.headerBefore() : null,
63
- h("div", { class: ns.e("header-search") }, [searchDom]),
64
- slots.headerAfter ? slots.headerAfter() : null,
65
- ])
66
- ),
67
- // h('ct-search-box', {
68
- // searchList: searchList,
69
- // haveReset: true,
70
- // onDoSearch: doSearch
71
- // })
228
+ slots.header
229
+ ? slots.header()
230
+ : h("div", { class: ns.em("header", "default") }, [
231
+ slots.headerBefore ? slots.headerBefore() : null,
232
+ h("div", { class: ns.e("search") }, [
233
+ h(
234
+ SearchBox,
235
+ {
236
+ onDoSearch: doSearch,
237
+ ...props.searchProps,
238
+ ref: searchRef,
239
+ },
240
+ { ...getSelfSlots("search") }
241
+ ),
242
+ ]),
243
+ slots.headerAfter ? slots.headerAfter() : null,
244
+ ]),
245
+ ]),
246
+ h("div", { class: ns.e("content") }, [
247
+ slots.content
248
+ ? slots.content()
249
+ : h("div", { class: ns.em("content", "default") }, [
250
+ h(
251
+ CtLoading,
252
+ { "is-load": state.pageLoading, ...props.loadProps },
253
+ {
254
+ default: () => [
255
+ slots.contentBefore ? slots.contentBefore() : null,
256
+ slots.tableTop
257
+ ? slots.tableTitle()
258
+ : h(
259
+ TableTitle,
260
+ {
261
+ total: state.total,
262
+ pageSize: state.pageSize,
263
+ handleList: props.tableHandleList,
264
+ sortList: sortList.value,
265
+ sortObj: state.sortObj,
266
+ "onUpdate:sortObj": (val) => {
267
+ state.sortObj = val;
268
+ },
269
+ onChangeSort: changeSort,
270
+ onDownload: doDownload,
271
+ ref: tableTitleRef,
272
+ },
273
+ {
274
+ tableTitle: slots.tableTitle,
275
+ tableDesc: slots.tableDesc,
276
+ }
277
+ ),
278
+ h("div", { class: ns.e("table") }, [
279
+ h(
280
+ TableBox,
281
+ {
282
+ "table-props": tableProps,
283
+ ...props.tableProps,
284
+ ref: tableRef,
285
+ },
286
+ { ...getSelfSlots("table") }
287
+ ),
288
+ h(CtPagination, {
289
+ class: ns.e("pagination"),
290
+ pageSize: state.pageSize,
291
+ total: state.total,
292
+ "current-page": state.pageNo,
293
+ "onUpdate:current-page": changePageNo,
294
+ ...props.paginationProps,
295
+ ref: paginationRef,
296
+ }),
297
+ ]),
298
+ slots.contentAfter ? slots.contentAfter() : null,
299
+ ],
300
+ }
301
+ ),
302
+ ]),
72
303
  ]),
73
- h("div", { class: ns.e("content") }, [tableDom]),
74
304
  ]),
75
305
  ]);
76
306
  },
77
307
  };
78
- </script>
308
+ </script>
309
+ <style lang='less' scoped>
310
+ .ct-page-component {
311
+ --content-spacing-horizontal: 20px;
312
+ &__header {
313
+ background-color: #fff;
314
+ padding: var(--content-spacing-horizontal);
315
+ margin-bottom: 16px;
316
+ border-radius: var(--ct-border-radius);
317
+ :deep(.ct-search-box) {
318
+ margin-bottom: 0;
319
+ }
320
+ }
321
+ &__content {
322
+ background-color: #fff;
323
+ padding: 0 var(--content-spacing-horizontal)
324
+ var(--content-spacing-horizontal);
325
+ border-radius: var(--ct-border-radius);
326
+ :deep(.ct-table-box) {
327
+ margin-bottom: 0;
328
+ }
329
+ }
330
+ &__pagination {
331
+ justify-content: flex-end;
332
+ margin-top: 15px;
333
+ margin-bottom: 0;
334
+ }
335
+ }
336
+ </style>
@@ -114,8 +114,12 @@ const componentAll = computed(() => {
114
114
  };
115
115
  return componentMap;
116
116
  });
117
+ const buriedParams = ref({});
117
118
  const handleBuriedParams = (params) => {
118
- console.log(params);
119
+ const key = params.value;
120
+ if (key) {
121
+ buriedParams.value[key] = params;
122
+ }
119
123
  };
120
124
  const getComponentProps = (item) => {
121
125
  const bpKey = toFirstUpperCase(buriedParamsKey);
@@ -164,6 +168,8 @@ defineExpose({
164
168
  searchParamsCurrent,
165
169
  componentAll: componentAll.value,
166
170
  getComponent,
171
+ buriedParams,
172
+ doSearch,
167
173
  });
168
174
  onMounted(() => {});
169
175
  </script>
@@ -92,7 +92,7 @@ const showOptions = computed(() => {
92
92
  });
93
93
  const valueModel = computed({
94
94
  get() {
95
- return props.modelValue || (props.multiple ? [] : "");
95
+ return props.modelValue || (props.multiple ? [] : props.modelValue);
96
96
  },
97
97
  set(newValue) {
98
98
  emit("update:modelValue", newValue);
@@ -303,6 +303,9 @@ defineExpose({
303
303
  }
304
304
  }
305
305
  &__popper {
306
+ &.is-multiple {
307
+ min-width: 140px;
308
+ }
306
309
  .el-select-dropdown__wrap {
307
310
  max-height: unset;
308
311
  }
@@ -24,7 +24,7 @@ export const tableProps = {
24
24
  return []
25
25
  }
26
26
  },
27
- isMultiSelect: {
27
+ isMultiSelect: {//是否开启多选
28
28
  type: Boolean,
29
29
  default: false
30
30
  },
@@ -32,8 +32,16 @@ export const tableProps = {
32
32
  type: Array,
33
33
  default: [],
34
34
  },
35
+ multiSelectAttr: {
36
+ type: Object,
37
+ default: () => {
38
+ return {
39
+ width:'88'
40
+ }
41
+ }
42
+ },
35
43
  teleportDom: {
36
- type: String,
44
+ type:[String, Node],
37
45
  },
38
46
  defaultSort: {
39
47
  type: Object,
@@ -14,6 +14,7 @@
14
14
  v-if="isMultiSelect"
15
15
  type="selection"
16
16
  width="88"
17
+ v-bind="multiSelectAttr"
17
18
  :reserve-selection="true"
18
19
  ></el-table-column>
19
20
  <el-table-column
@@ -37,7 +38,8 @@
37
38
  :column="column"
38
39
  :label="column.label"
39
40
  :value="column.value"
40
- ></slot>
41
+ >
42
+ </slot>
41
43
  </template>
42
44
  <template #default="scope">
43
45
  <slot
@@ -81,7 +83,8 @@
81
83
  :is="tableEmptyDom"
82
84
  v-if="tableEmptyDom"
83
85
  :text="emptyText"
84
- ></component>
86
+ >
87
+ </component>
85
88
  <span v-else>{{ emptyText }}</span>
86
89
  </slot>
87
90
  </template>
@@ -253,6 +256,7 @@ defineExpose({ tableRef });
253
256
  .ct-table__body {
254
257
  width: 100%;
255
258
  }
259
+
256
260
  .ct-table__pagination {
257
261
  margin-top: 24px;
258
262
  display: flex;
@@ -26,7 +26,7 @@ export const useBarEcharts = (type, option, data) => {
26
26
  function update(data) {
27
27
  //数据更新方式
28
28
  if (data.length == 0) {
29
- console.log('用户没有传入图表数据,请在hooks外处理');
29
+ console.warn('用户没有传入图表数据,请在hooks外处理');
30
30
  return;
31
31
  }
32
32
  if (data.length > 1) {
@@ -59,13 +59,13 @@ export const useBarEcharts = (type, option, data) => {
59
59
  { deep: true, immediate: true }
60
60
  );
61
61
  // 灵活配置并入option
62
-
63
- watch(() => option, (val) => {
64
- objectMerge(barOption.value, option);
65
- },
66
- {
62
+
63
+ watch(() => option, (val) => {
64
+ objectMerge(barOption.value, option);
65
+ },
66
+ {
67
67
  deep: true, immediate: true
68
- })
68
+ })
69
69
  return {
70
70
  barOption,
71
71
  itemTemplate
@@ -30,7 +30,7 @@ export const useLineEcharts = (type, option, data) => {
30
30
  function update(data) {
31
31
  //数据更新方式
32
32
  if (data.length == 0) {
33
- console.log('用户没有传入图表数据,请在hooks外处理');
33
+ console.warn('用户没有传入图表数据,请在hooks外处理');
34
34
  return;
35
35
  }
36
36
  if (data.length > 1) {
@@ -78,7 +78,7 @@ export const useLineEcharts = (type, option, data) => {
78
78
  }, {
79
79
  deep: true, immediate: true
80
80
  })
81
-
81
+
82
82
  return {
83
83
  lineOption,
84
84
  itemTemplate