@ditari/bsui 1.1.25 → 1.1.26

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.
@@ -1,18 +1,276 @@
1
1
  <script setup lang="ts">
2
-
2
+ import { ref, onDeactivated } from "vue";
3
3
  import { useTable } from "./hooks";
4
4
 
5
5
  const { data, loading, config, selectedRowKeys } = useTable();
6
+
7
+ const formState = ref({
8
+ name: "",
9
+ to: "",
10
+ from: ""
11
+ });
12
+
13
+ onDeactivated(() => {
14
+ console.log("222");
15
+ });
16
+
17
+ const scheme = [
18
+ {
19
+ type: "a-col",
20
+ props: {
21
+ span: 6
22
+ },
23
+ body: {
24
+ type: "a-form-item",
25
+ props: {
26
+ label: "姓名",
27
+ name: "name"
28
+ },
29
+ body: {
30
+ type: "a-input",
31
+ props: {
32
+ name: "name",
33
+ placeholder: "请输入姓名"
34
+ }
35
+ }
36
+ }
37
+ },
38
+ {
39
+ type: "a-col",
40
+ props: {
41
+ span: 6
42
+ },
43
+ body: {
44
+ type: "a-form-item",
45
+ props: {
46
+ label: "姓名",
47
+ name: "name"
48
+ },
49
+ body: {
50
+ type: "a-input",
51
+ props: {
52
+ name: "name",
53
+ placeholder: "请输入姓名"
54
+ }
55
+ }
56
+ }
57
+ },
58
+ {
59
+ type: "a-col",
60
+ props: {
61
+ span: 6
62
+ },
63
+ body: {
64
+ type: "a-form-item",
65
+ props: {
66
+ label: "姓名",
67
+ name: "name"
68
+ },
69
+ body: {
70
+ type: "a-input",
71
+ props: {
72
+ name: "name",
73
+ placeholder: "请输入姓名"
74
+ }
75
+ }
76
+ }
77
+ },
78
+ {
79
+ type: "a-col",
80
+ props: {
81
+ span: 6
82
+ },
83
+ body: {
84
+ type: "a-form-item",
85
+ props: {
86
+ label: "姓名",
87
+ name: "name"
88
+ },
89
+ body: {
90
+ type: "a-input",
91
+ props: {
92
+ name: "name",
93
+ placeholder: "请输入姓名"
94
+ }
95
+ }
96
+ }
97
+ },
98
+ {
99
+ type: "a-col",
100
+ props: {
101
+ span: 6
102
+ },
103
+ body: {
104
+ type: "a-form-item",
105
+ props: {
106
+ label: "姓名",
107
+ name: "name"
108
+ },
109
+ body: {
110
+ type: "a-input",
111
+ props: {
112
+ name: "name",
113
+ placeholder: "请输入姓名"
114
+ }
115
+ }
116
+ }
117
+ },
118
+ {
119
+ type: "a-col",
120
+ props: {
121
+ span: 6
122
+ },
123
+ body: {
124
+ type: "a-form-item",
125
+ props: {
126
+ label: "姓名",
127
+ name: "name"
128
+ },
129
+ body: {
130
+ type: "a-input",
131
+ props: {
132
+ name: "name",
133
+ placeholder: "请输入姓名"
134
+ }
135
+ }
136
+ }
137
+ },
138
+ {
139
+ type: "a-col",
140
+ props: {
141
+ span: 6
142
+ },
143
+ body: {
144
+ type: "a-form-item",
145
+ props: {
146
+ label: "姓名",
147
+ name: "name"
148
+ },
149
+ body: {
150
+ type: "a-input",
151
+ props: {
152
+ name: "name",
153
+ placeholder: "请输入姓名"
154
+ }
155
+ }
156
+ }
157
+ },
158
+ {
159
+ type: "a-col",
160
+ props: {
161
+ span: 6
162
+ },
163
+ body: {
164
+ type: "a-form-item",
165
+ props: {
166
+ label: "姓名",
167
+ name: "name"
168
+ },
169
+ body: {
170
+ type: "a-input",
171
+ props: {
172
+ name: "name",
173
+ placeholder: "请输入姓名"
174
+ }
175
+ }
176
+ }
177
+ },
178
+ {
179
+ type: "a-col",
180
+ props: {
181
+ span: 6
182
+ },
183
+ body: {
184
+ type: "a-form-item",
185
+ props: {
186
+ label: "姓名",
187
+ name: "name"
188
+ },
189
+ body: {
190
+ type: "a-input",
191
+ props: {
192
+ name: "name",
193
+ placeholder: "请输入姓名"
194
+ }
195
+ }
196
+ }
197
+ },
198
+ {
199
+ type: "a-col",
200
+ props: {
201
+ span: 6
202
+ },
203
+ body: {
204
+ type: "a-form-item",
205
+ props: {
206
+ label: "姓名",
207
+ name: "name"
208
+ },
209
+ body: {
210
+ type: "a-input",
211
+ props: {
212
+ name: "name",
213
+ placeholder: "请输入姓名"
214
+ }
215
+ }
216
+ }
217
+ },
218
+ {
219
+ type: "a-col",
220
+ props: {
221
+ span: 6
222
+ },
223
+ body: {
224
+ type: "a-form-item",
225
+ props: {
226
+ label: "姓名",
227
+ name: "name"
228
+ },
229
+ body: {
230
+ type: "a-input",
231
+ props: {
232
+ name: "name",
233
+ placeholder: "请输入姓名"
234
+ }
235
+ }
236
+ }
237
+ },
238
+ {
239
+ type: "a-col",
240
+ props: {
241
+ span: 6
242
+ },
243
+ body: {
244
+ type: "a-form-item",
245
+ props: {
246
+ label: "申报日期",
247
+ name: "date"
248
+ },
249
+ body: {
250
+ type: "d-range-picker",
251
+ props: {
252
+ value: formState,
253
+ field: ["to", "from"]
254
+ }
255
+ }
256
+ }
257
+ }
258
+ ];
259
+
260
+ const onQuery = () => {
261
+ console.log("22");
262
+ };
6
263
  </script>
7
264
  <script lang="ts">
8
265
  export default {
9
- name: "List"
266
+ name: "TableList"
10
267
  };
11
268
  </script>
12
269
  <template>
13
270
  <d-list-layout>
14
271
  <template #form>
15
- <!-- <d-query-form :value="formState" :scheme="scheme"> </d-query-form>-->
272
+ <d-query-form :value="formState" :scheme="scheme" @query="onQuery">
273
+ </d-query-form>
16
274
  </template>
17
275
  <template #table="{ height }">
18
276
  <d-table
@@ -24,14 +282,95 @@ export default {
24
282
  :config="config"
25
283
  :height="height"
26
284
  >
27
- <template #expandedRowRender="{ record }">
28
- {{record}}
29
- </template>
30
285
  <template #action>
31
286
  <a-button>ok</a-button>
32
287
  </template>
33
288
  </d-table>
34
289
  </template>
290
+ <!-- <TestModal v-model:visible="visible" />-->
35
291
  </d-list-layout>
36
292
  </template>
37
- <style scoped></style>
293
+ <style lang="scss">
294
+ @mixin rowEdit {
295
+ //content: "";
296
+ //display: block;
297
+ //position: absolute;
298
+ //top: 0;
299
+ //left: 0;
300
+ //z-index: 1993;
301
+ //transition: all 0.3s ease-in-out; /* 或者使用动画实现 */
302
+ content: "";
303
+ position: absolute;
304
+ //top: 0;
305
+ //left: 0;
306
+ //right: 0;
307
+ //bottom: 0;
308
+ z-index: 1993;
309
+
310
+ // border: 1px solid red;
311
+ //transform: scaleY(0);
312
+ transition: transform 0.3s ease-in-out;
313
+ }
314
+ .row-edit-class {
315
+ position: relative;
316
+
317
+ &:after {
318
+ @include rowEdit;
319
+ //box-shadow: 0 0 0 2px red;
320
+ }
321
+
322
+ //&::before {
323
+ // border-top: 1px solid #ccc;
324
+ // border-bottom: 1px solid #ccc;
325
+ // transform: scaleY(0);
326
+ //}
327
+ //
328
+ //&::after {
329
+ // border-left: 1px solid #ccc;
330
+ // border-right: 1px solid #ccc;
331
+ //}
332
+ }
333
+
334
+ //tr:hover::before,
335
+ //tr:hover::after {
336
+ // transform: scaleY(1) scaleX(1);
337
+ //}
338
+
339
+ .row-class {
340
+ position: relative;
341
+ z-index: 1993;
342
+ //box-shadow: 2px 1px 8px 2px #162157;
343
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
344
+ transform: translate(0px, 1px);
345
+ transition: box-shadow 0.3s, transform 0.3s, font-weight 0.9s;
346
+ td {
347
+ font-weight: bold;
348
+
349
+ &:first-child {
350
+ &::before {
351
+ position: absolute;
352
+ left: 0px;
353
+ top: -2px;
354
+ bottom: -2px;
355
+ content: "";
356
+ width: 4px;
357
+ background: #017ffe;
358
+ transition: width 0.3s, background 0.3s;
359
+ }
360
+ }
361
+ }
362
+ }
363
+ //
364
+ //tr {
365
+ // &:hover {
366
+ // position: relative;
367
+ // z-index: 1993;
368
+ // box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
369
+ // transform: translateZ(10px);
370
+ // transition: box-shadow 0.3s, transform 0.3s;
371
+ // }
372
+ //}
373
+ tr {
374
+ cursor: pointer;
375
+ }
376
+ </style>
@@ -0,0 +1,42 @@
1
+ import { defineComponent, ref } from "vue";
2
+ import { Table } from "ant-design-vue";
3
+ import type { ExpandedRowRender } from "ant-design-vue/es/vc-table/interface";
4
+
5
+ export default defineComponent({
6
+ setup(props,{ slots }) {
7
+ const renderExpandedRow: ExpandedRowRender<any> = (
8
+ record: any,
9
+ index: number,
10
+ indent: number,
11
+ expanded: boolean
12
+ ) => {
13
+ // 这里可以根据 record 等参数动态生成展开行的内容
14
+ return (
15
+ <a-card>
16
+ <p>这是一行展开的内容</p>
17
+ </a-card>
18
+ );
19
+ };
20
+
21
+ const mySlots:any = {};
22
+ if (slots.expandedRowRender) {
23
+ mySlots.expandedRowRender = () => {};
24
+ }
25
+ return {
26
+ mySlots,
27
+ renderExpandedRow
28
+ };
29
+ },
30
+ render() {
31
+ return (
32
+ <Table
33
+ columns={[{ title: "序号", dataIndex: "index" }]}
34
+ dataSource={[{ index: 1 }, { index: "2" }]}
35
+ >
36
+ {{
37
+ ...this.mySlots
38
+ }}
39
+ </Table>
40
+ );
41
+ }
42
+ });
@@ -0,0 +1,64 @@
1
+ <script setup lang="ts">
2
+ import { reactive, ref } from "vue";
3
+ import { useRequestList } from "../../../src/hooks";
4
+ import { userList } from "../../api/list";
5
+
6
+ const visible = ref(true);
7
+ const selectedKeys = ref([]);
8
+ const queryParams = ref({
9
+ page: 1,
10
+ size: 30
11
+ });
12
+
13
+ const columns = [
14
+ {
15
+ title: "边民姓名",
16
+ dataIndex: "civilName",
17
+ align: "center"
18
+ },
19
+ {
20
+ title: "边民身份证号",
21
+ dataIndex: "idcardNo",
22
+ align: "center",
23
+ render: (h: any, params: any) => {
24
+ if (!params.row.idcardNo) {
25
+ return "";
26
+ }
27
+ return h(
28
+ "span",
29
+ params.row.idcardNo.replace(
30
+ /^(\d{6})\d{6}(.{6}$)/g,
31
+ `$1${Array(9).join("*")}$2`
32
+ )
33
+ );
34
+ }
35
+ }
36
+ ];
37
+
38
+ const { data, pagination, loading, run, onPageChange, onQuery } =
39
+ useRequestList(userList, {
40
+ params: queryParams,
41
+ dataKey: "data.data"
42
+ });
43
+
44
+ //表格选项
45
+ const config = reactive({
46
+ columns,
47
+ selection: "S",
48
+ bordered: true,
49
+ pagination,
50
+ onPageChange,
51
+ dbClick: (record: unknown) => {}
52
+ });
53
+ </script>
54
+ <template>
55
+ <d-modal v-model:visible="visible" title="2222">
56
+ <d-table
57
+ v-model:keys="selectedKeys"
58
+ row-key="idcardNo"
59
+ :data="[{}, {}, {}, {}, {}, {}, {}, {}]"
60
+ :height="650"
61
+ :config="config"
62
+ ></d-table>
63
+ </d-modal>
64
+ </template>
@@ -0,0 +1,31 @@
1
+ <script setup lang="ts">
2
+ defineProps({
3
+ background: {
4
+ type: String,
5
+ default: "red"
6
+ },
7
+ text: {
8
+ type: String,
9
+ default: "red"
10
+ }
11
+ });
12
+ </script>
13
+ <script lang="ts">
14
+ export default {
15
+ name: "WorkStatusRound"
16
+ };
17
+ </script>
18
+ <template>
19
+ <div>
20
+ <div class="status" :style="{ background: background }"></div>
21
+ {{ text }}
22
+ </div>
23
+ </template>
24
+ <style scoped>
25
+ .status {
26
+ width: 10px;
27
+ height: 10px;
28
+ borderradius: 50%;
29
+ margin-right: 5px;
30
+ }
31
+ </style>
@@ -1,4 +1,4 @@
1
- import { useRequestList } from "../../../../../hooks/src/http/index";
1
+ import { useRequestList } from "../../../../../hooks";
2
2
  import { reactive, ref } from "vue";
3
3
  import { testService } from "../../api/list";
4
4
 
@@ -50,17 +50,14 @@ export const useTableConfig = () => {
50
50
  };
51
51
 
52
52
  export const useTable = () => {
53
- const queryParams = ref({});
53
+ const queryParams = ref({ limit: 20, page: 1 });
54
54
  const selectedRowKeys = ref<any>([]);
55
55
  const { columns } = useTableConfig();
56
56
 
57
57
  const { data, loading, onPageChange, pagination, run, onQuery } =
58
58
  useRequestList(testService, {
59
59
  params: queryParams,
60
- dataKey: "data.data",
61
- onBefore: () => {
62
- return false;
63
- }
60
+ dataKey: "data.data"
64
61
  });
65
62
 
66
63
  const id = ref("");
@@ -71,9 +68,6 @@ export const useTable = () => {
71
68
  bordered: true,
72
69
  pagination,
73
70
  selection: "N",
74
- pageOption: {
75
- sizeOptions: ["20", "40", "50", "100"]
76
- },
77
71
  onPageChange,
78
72
  dbClick: (record: any) => {
79
73
  const index = selectedRowKeys.value.indexOf(record.id);
@@ -0,0 +1,6 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * 待办项
4
+ */
5
+ </script>
6
+ <template></template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.1.25",
3
+ "version": "1.1.26",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -7,7 +7,8 @@ import {
7
7
  ReloadOutlined,
8
8
  DoubleRightOutlined
9
9
  } from "@ant-design/icons-vue";
10
-
10
+ import { useKeepAliveStore } from "@ditari/store";
11
+ import { useRoute } from "vue-router";
11
12
  import DJsonSchemeRender from "../json-scheme-render/JsonSchemeRender";
12
13
 
13
14
  /**
@@ -36,6 +37,9 @@ export default defineComponent({
36
37
  },
37
38
  emits: ["reset", "query"],
38
39
  setup(props, { slots, emit }) {
40
+ const keepStore = useKeepAliveStore();
41
+ const route = useRoute();
42
+
39
43
  // 表单
40
44
  const { loading, modelValue, formRef, onQuery, onReset } = useForm();
41
45
  // 展开
@@ -66,9 +70,21 @@ export default defineComponent({
66
70
  /// 监听回车事件
67
71
  watch(enterKey, (v) => {
68
72
  if (v) {
69
- if (!loading.value) {
73
+ // 有路由名字会被keepalive进行缓存
74
+ // 用于判断当前页面是否被激活 因为页面被缓存的时候,页面切换后,回车事件依然会触发
75
+ const isActive = keepStore.list.some((name) => name === route.name);
76
+ if (!loading.value && isActive) {
70
77
  emit("query", modelValue.value);
71
78
  }
79
+ // TODO 逻辑有问题
80
+ // if (!route.name) {
81
+ // // 没有路由名字,不会被缓存
82
+ // if (!loading.value) {
83
+ // emit("query", modelValue.value);
84
+ // }
85
+ // } else {
86
+ //
87
+ // }
72
88
  }
73
89
  });
74
90
 
@@ -126,6 +142,7 @@ export default defineComponent({
126
142
  </Space>
127
143
  );
128
144
  }
145
+
129
146
  return {
130
147
  renderAction
131
148
  };