@dt-frames/ui 1.0.4 → 1.0.5

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.
Files changed (65) hide show
  1. package/es/assets/imgs/header/avatar.png +0 -0
  2. package/es/components/curd/src/components/dialog.d.ts +21 -58
  3. package/es/components/curd/src/types/curd.type.d.ts +2 -1
  4. package/es/components/dialog/index.d.ts +2 -0
  5. package/es/components/dialog/src/hooks/useDialog.d.ts +3 -0
  6. package/es/components/forms/index.d.ts +2 -2
  7. package/es/components/forms/src/components/formIcon.d.ts +4 -47
  8. package/es/components/forms/src/index.d.ts +2 -6
  9. package/es/components/index.d.ts +2 -1
  10. package/es/components/modal/src/components/close-icon.d.ts +0 -43
  11. package/es/components/modal/src/index.d.ts +0 -43
  12. package/es/components/source/src/types/table.type.d.ts +1 -1
  13. package/es/components/table/index.d.ts +1 -1
  14. package/es/components/table/src/components/setting/Column.d.ts +6 -5
  15. package/es/components/table/src/hooks/useColumns.d.ts +1 -1
  16. package/es/components/table/src/hooks/useDataSource.d.ts +1 -3
  17. package/es/components/table/src/hooks/useHeaderCode.d.ts +2 -0
  18. package/es/components/table/src/hooks/useRowSelection.d.ts +2 -3
  19. package/es/components/table/src/index.d.ts +15 -3
  20. package/es/components/table/src/props.d.ts +7 -1
  21. package/es/index.js +466 -95
  22. package/es/style/components/icons/index.less +1 -0
  23. package/es/style/components/modal/index.less +0 -3
  24. package/es/style/components/table/index.less +12 -1
  25. package/es/style/theme/header/index.less +8 -4
  26. package/es/theme/header/components/logo.d.ts +43 -0
  27. package/package.json +6 -3
  28. package/src/assets/imgs/header/avatar.png +0 -0
  29. package/src/components/curd/src/components/dialog.vue +11 -5
  30. package/src/components/curd/src/hooks/useCurd.tsx +24 -9
  31. package/src/components/curd/src/types/curd.type.ts +3 -1
  32. package/src/components/dialog/index.ts +5 -0
  33. package/src/components/dialog/src/hooks/useDialog.ts +85 -0
  34. package/src/components/forms/index.ts +3 -4
  35. package/src/components/icons/index.less +1 -0
  36. package/src/components/iframe/src/index.less +3 -0
  37. package/src/components/index.ts +3 -1
  38. package/src/components/modal/index.less +0 -3
  39. package/src/components/modal/src/components/close-icon.vue +4 -4
  40. package/src/components/modal/src/components/modal.tsx +1 -1
  41. package/src/components/modal/src/components/modalFooter.vue +1 -1
  42. package/src/components/modal/src/hooks/useModal.ts +0 -1
  43. package/src/components/source/src/hooks/useFetch.ts +3 -4
  44. package/src/components/source/src/hooks/useSource.ts +4 -3
  45. package/src/components/source/src/types/table.type.ts +1 -1
  46. package/src/components/table/index.less +12 -1
  47. package/src/components/table/index.ts +1 -1
  48. package/src/components/table/src/components/TableActions.vue +2 -2
  49. package/src/components/table/src/components/setting/Column.vue +1 -2
  50. package/src/components/table/src/hooks/useColumns.ts +2 -2
  51. package/src/components/table/src/hooks/useHeaderCode.ts +82 -0
  52. package/src/components/table/src/hooks/useRowSelection.ts +2 -3
  53. package/src/components/table/src/hooks/useTable.ts +13 -1
  54. package/src/components/table/src/hooks/useTableScroll.ts +5 -3
  55. package/src/components/table/src/index.vue +18 -19
  56. package/src/components/table/src/props.ts +8 -3
  57. package/src/theme/header/components/logo.vue +4 -2
  58. package/src/theme/header/components/user-info.vue +21 -4
  59. package/src/theme/header/index.less +8 -4
  60. package/es/index.css +0 -1
  61. package/es/style/components/forms/src/index.less +0 -82
  62. package/es/style/components/icons/src/index.less +0 -96
  63. package/es/style/components/modal/src/index.less +0 -60
  64. package/es/style/components/table/src/index.less +0 -162
  65. package/es/theme/header/components/user-info.d.ts +0 -452
@@ -0,0 +1,82 @@
1
+ import { error, http, Recordable, useAppStore } from "@dt-frames/core"
2
+ import { BasicColumn, CellFormat } from "../types/table.type"
3
+
4
+
5
+ // 解析header
6
+ export function useHeaderCode(code: string, templates: CellFormat = {}, changeColumns: ( rows: BasicColumn[] ) => void) {
7
+ const { appConf } = useAppStore()
8
+
9
+ if( !appConf.pages.queryColumnApi ) {
10
+ error('请在init.config.ts中配置queryColumnApi!')
11
+ return
12
+ }
13
+
14
+
15
+ // 设置文字对齐方式
16
+ const getAlign = ( key: number | null ) => key === 0 ? 'center' : key === 2 ? 'right' : 'left'
17
+
18
+
19
+ // 渲染单元格
20
+ const renderCell = ( type: number, ctx: string ): Recordable => {
21
+ switch( type ) {
22
+ // 时间
23
+ case 0: return { date: ctx }
24
+
25
+ // 字典
26
+ case 1: return { dict: ctx }
27
+
28
+ // 百分比
29
+ case 5: return { percent: ctx }
30
+
31
+ // structure
32
+ case 7:
33
+ if( !appConf.structure[ctx] ) {
34
+ error(`未找到structure: ${ ctx } !`)
35
+ return { }
36
+ }
37
+ return { dict: appConf.structure[ctx] }
38
+
39
+ // 自定义模板
40
+ case 10: return templates[ctx]
41
+
42
+ // 数字
43
+ case 11: return { number: ctx }
44
+ }
45
+ }
46
+
47
+
48
+ function getColumns() {
49
+ http.post(
50
+ appConf.pages.queryColumnApi,
51
+ { tableCode: code }
52
+ ).then( rsp => {
53
+ handleData(rsp)
54
+ } )
55
+ }
56
+
57
+ function handleData(data: Recordable[]) {
58
+ let rows: BasicColumn[] = []
59
+
60
+ data.forEach( it => {
61
+ let obj: BasicColumn = {
62
+ title: it.cloumnName,
63
+ dataIndex: it.cloumnCode,
64
+ sorter: it.ifOrder,
65
+ align: getAlign(it.textAlign),
66
+ ifShow: Boolean( it.ifDisplay ),
67
+ defaultHidden: !Boolean( it.ifDisplay )
68
+ }
69
+
70
+ if( it.cloumnType !== undefined ) obj.render = renderCell( it.cloumnType, it.dictCode )
71
+
72
+ if( it.width ) obj.width = Number(it.width)
73
+
74
+ rows.push(obj)
75
+ } )
76
+
77
+ changeColumns( rows )
78
+ }
79
+
80
+ getColumns()
81
+
82
+ }
@@ -4,9 +4,8 @@
4
4
 
5
5
  import { isFunction, Recordable } from "@dt-frames/core";
6
6
  import type { TableRowSelection } from 'ant-design-vue/lib/table/interface'
7
- import { computed, ComputedRef, ref, Ref, toRaw, unref, watch, nextTick } from "vue";
8
- import { BasicTableProps } from "../types/table.type";
9
- import { omit } from 'lodash-es'
7
+ import { computed, ComputedRef, ref, Ref, toRaw, unref, watch, nextTick } from "vue"
8
+ import { BasicTableProps } from "../types/table.type"
10
9
 
11
10
  interface TreeHelperConfig {
12
11
  id: string;
@@ -1,6 +1,7 @@
1
1
  import { DynamicProps, Nullable, getDynamicProps, error } from '@dt-frames/core'
2
2
  import { onUnmounted, ref, toRaw, unref, watch } from 'vue'
3
- import { BasicColumn, BasicTableProps, TableActionType } from '../types/table.type'
3
+ import { BasicColumn, BasicTableProps, CellFormat, TableActionType } from '../types/table.type'
4
+ import { useHeaderCode } from './useHeaderCode'
4
5
 
5
6
 
6
7
  type Props = Partial<DynamicProps<BasicTableProps>>
@@ -18,6 +19,17 @@ export function useTable(tableProps?: Props) {
18
19
  if( unref(loadedRef) && instance === unref(tableRef) ) return
19
20
 
20
21
  tableRef.value = instance
22
+
23
+ if( tableProps.columnCode ) {
24
+ useHeaderCode(
25
+ tableProps.columnCode as string,
26
+ tableProps.templates as CellFormat,
27
+ (columns: BasicColumn[]) => {
28
+ tableProps.columns = columns
29
+ }
30
+ )
31
+ }
32
+
21
33
  tableProps && instance.setProps(getDynamicProps(tableProps))
22
34
 
23
35
  watch(
@@ -20,11 +20,12 @@ export function useTableScroll(
20
20
  const debounceRedoHeight = useDebounceFn( redoHeight, 100 )
21
21
 
22
22
  watch(
23
- () => unref(propsRef)?.dataSource?.length,
24
- () => {
23
+ () => propsRef.value.dataSource,
24
+ (v) => {
25
25
  debounceRedoHeight()
26
26
  },
27
27
  {
28
+ deep: true,
28
29
  flush: 'post' // 在dom渲染之后监听
29
30
  }
30
31
  )
@@ -194,7 +195,8 @@ export function useTableScroll(
194
195
  calcScroll(bodyEl)
195
196
 
196
197
  bodyEl.addEventListener('scroll', (e) => {
197
- calcScroll(bodyEl)
198
+ // 这里做一个节流
199
+ useDebounceFn( () => { calcScroll(bodyEl) }, 100 )()
198
200
  })
199
201
  }
200
202
 
@@ -14,7 +14,7 @@
14
14
  </template>
15
15
 
16
16
  <template #bodyCell="{ column, record, index }">
17
- <template v-if="column.render">
17
+ <template v-if="column?.render">
18
18
  <TableRender :column="column" :record="record" :index="index"></TableRender>
19
19
  </template>
20
20
  </template>
@@ -127,6 +127,21 @@
127
127
  getRowClassName
128
128
  } = useRows( getProps )
129
129
 
130
+ /**
131
+ * 表格改变
132
+ */
133
+ const {
134
+ handleTableChange
135
+ } = useDataSource(
136
+ getProps,
137
+ {
138
+ getPaginationInfo,
139
+ setPagination,
140
+ clearSelectedRowKeys
141
+ },
142
+ emit
143
+ )
144
+
130
145
 
131
146
  const getBind = computed(() => {
132
147
  return {
@@ -139,7 +154,7 @@
139
154
  pagination: toRaw(unref(getPaginationInfo)),
140
155
  rowSelection: unref(getRowSelectionRef),
141
156
  rowKey: unref(getProps).rowKey,
142
- columns: toRaw(unref(getViewColumns)),
157
+ columns: unref(getViewColumns),
143
158
  tableLayout: 'fixed'
144
159
  }
145
160
  })
@@ -163,22 +178,6 @@
163
178
  }
164
179
  const { getHeaderProps } = useTableHeader(getProps, slots, handlers)
165
180
 
166
-
167
- /**
168
- * 表格改变
169
- */
170
- const {
171
- handleTableChange
172
- } = useDataSource(
173
- getProps,
174
- {
175
- getPaginationInfo,
176
- setPagination,
177
- clearSelectedRowKeys
178
- },
179
- emit
180
- )
181
-
182
181
  emit('register', tableAction)
183
182
 
184
183
  return {
@@ -188,7 +187,7 @@
188
187
  handleTableChange,
189
188
  getSelectRows,
190
189
  handleResizeColumn: (w, col) => {
191
- col.width = w;
190
+ col.width = w
192
191
  setCacheColumnsByField(col.dataIndex, col)
193
192
  }
194
193
  }
@@ -3,7 +3,7 @@ import { PropType } from 'vue'
3
3
  import { DEFAULT_SORT_FN } from './const'
4
4
  import type { PaginationProps } from 'ant-design-vue/lib/pagination'
5
5
  import type { TableRowSelection } from 'ant-design-vue/lib/table/interface'
6
- import { ActionType, BasicColumn, BtnsType, SizeType } from './types/table.type'
6
+ import { ActionType, BasicColumn, BtnsType, CellFormat, SizeType } from './types/table.type'
7
7
  import { ButtonProps } from '../../forms'
8
8
  import { DownloadType } from './types/tableHeader.type'
9
9
 
@@ -28,7 +28,7 @@ export const TableProps = {
28
28
  maxWidth: { type: Number },
29
29
 
30
30
  // 是否需要虚拟滚动
31
- virtual: { type: Boolean, default: true },
31
+ virtual: { type: Boolean, default: false },
32
32
 
33
33
  // 排序
34
34
  sortFn: { type: Function, default: DEFAULT_SORT_FN },
@@ -50,6 +50,11 @@ export const TableProps = {
50
50
  // 默认的排序
51
51
  defSort: { type: Object as PropType<Recordable>, default: null },
52
52
 
53
+ // 列code编码
54
+ columnCode: { type: String },
55
+ // 列自定义的模板
56
+ templates: { type: Object as PropType<CellFormat> },
57
+
53
58
  // 列
54
59
  columns: { type: [Array] as PropType<BasicColumn[]>, default: () => [] },
55
60
 
@@ -82,7 +87,7 @@ export const TableProps = {
82
87
 
83
88
  size: {
84
89
  type: String as PropType<SizeType>,
85
- default: 'default',
90
+ default: 'small',
86
91
  },
87
92
 
88
93
  // 分页、排序、筛选变化时触发
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div class="dt-logo" :class="getLogoClass">
3
- <img src="../../../assets/imgs/logo/logo.png" />
3
+ <!-- <img src="../../../assets/imgs/logo/logo.jpeg" /> -->
4
+ <DtIcon icon-class="logo" :size="42" class-name="brand-logo"></DtIcon>
4
5
  <div class="dt-logo__title" v-show="showTitle">
5
6
  {{ title }}
6
7
  </div>
@@ -10,8 +11,9 @@
10
11
  <script lang="ts" setup>
11
12
  import { computed, unref } from "vue";
12
13
  import { useMenu, useTheme } from "@dt-frames/core"
14
+ import { DtIcon } from "../../../components"
13
15
 
14
- const title = 'Ithink-DT 深迪科技';
16
+ const title = '隆基税务后台管理系统';
15
17
  const { getCollapsedShowTitle } = useMenu()
16
18
 
17
19
  const props = defineProps({
@@ -19,7 +19,7 @@
19
19
  <span v-icon="'ic:baseline-lock'"></span>
20
20
  锁定屏幕
21
21
  </li>
22
- <li>
22
+ <li @click="signOut()">
23
23
  <span v-icon="'ant-design:logout-outlined'"></span>
24
24
  退出系统
25
25
  </li>
@@ -27,17 +27,34 @@
27
27
  </template>
28
28
 
29
29
  <div class="userInfo">
30
- <Avatar :src="getUserInfo?.avatar" :size="28" />
31
- <span class="name">{{ getUserInfo?.realName }}</span>
30
+ <Avatar :size="28" >
31
+ <template #icon><img src="../../../assets/imgs/header/avatar.png" /></template>
32
+ </Avatar>
33
+ <span class="name">{{ getUserInfo?.userNo }}</span>
32
34
  </div>
33
35
  </Popover>
34
36
  </template>
35
37
 
36
38
  <script setup lang="ts">
37
39
  import { Popover, Avatar } from 'ant-design-vue';
38
- import { CacheKey, DtCache, useHeader } from '@dt-frames/core';
40
+ import { CacheKey, DtCache, useAppStore, useHeader, isObject, isFunction, useGo, Pages } from '@dt-frames/core'
39
41
 
40
42
  const getUserInfo = DtCache.getLocal(CacheKey.USER_INFO)
41
43
  const { getUserActions } = useHeader()
44
+ const { appConf } = useAppStore()
45
+ const go = useGo()
46
+
47
+
48
+ // 退出系统
49
+ function signOut() {
50
+ if( isObject(appConf.pages?.ssoLogin) && appConf.pages.ssoLogin?.logout) {
51
+ let redictUrl = isFunction(appConf.pages.ssoLogin.logout)
52
+ ? appConf.pages.ssoLogin.logout()
53
+ : appConf.pages.ssoLogin.logout
42
54
 
55
+ location.href = redictUrl
56
+ } else {
57
+ go(Pages.LOGIN)
58
+ }
59
+ }
43
60
  </script>
@@ -121,10 +121,6 @@
121
121
  color: #333;
122
122
  }
123
123
  }
124
-
125
- .icon{
126
- padding: 0 14px;
127
- }
128
124
  }
129
125
 
130
126
  &--light{
@@ -209,6 +205,14 @@
209
205
  right: 4px;
210
206
  top: 10px;
211
207
  }
208
+
209
+
210
+ }
211
+
212
+ .brand-logo{
213
+ width: 40px;
214
+ height: 60px;
215
+ margin-left: -7px;
212
216
  }
213
217
 
214
218
  .dt-multiple-header{
package/es/index.css DELETED
@@ -1 +0,0 @@
1
- .red[data-v-60d583d2]{color:red}
@@ -1,82 +0,0 @@
1
- .text-secondary{
2
- color: #666;
3
- }
4
-
5
- .suffix-item .suffix {
6
- display: inline-flex;
7
- padding-left: 6px;
8
- margin-top: 1px;
9
- line-height: 1;
10
- align-items: center;
11
- }
12
-
13
- .form-btns{
14
- button{
15
- margin-left: 12px;
16
- }
17
-
18
- .advanced{
19
- margin-left: 8px;
20
- .text{
21
- margin-right: 5px;
22
- }
23
- .basic-arrow{
24
- margin-left: -8px;
25
- }
26
- }
27
- }
28
-
29
- .basic-arrow{
30
- display: inline-block;
31
- cursor: pointer;
32
- transform: rotate(0deg);
33
- transition: all 0.3s ease 0.1s;
34
- transform-origin: center center;
35
-
36
-
37
- .dt-icon{
38
- vertical-align: middle;
39
- color: @primary-color !important;
40
- }
41
-
42
- &--active{
43
- transform: rotate(180deg);
44
- }
45
- }
46
-
47
- .form-btns{
48
- .ant-form-item-control-input-content{
49
- display: flex;
50
- .ant-btn{
51
- display: flex;
52
- align-items: center;
53
- }
54
- .ant-btn .dt-icon{
55
- font-size: 20px;
56
- height: 100%;
57
-
58
- svg{
59
- display: block;
60
- height: 100%;
61
- text-align: center;
62
- }
63
-
64
- .preIcon{
65
- padding-right: 2px;
66
- }
67
- }
68
-
69
- .ant-btn-primary .dt-icon svg{
70
- color: #fff;
71
- }
72
- }
73
- }
74
-
75
- .basic-form--compact{
76
- .ant-form-item {
77
- margin-bottom: 14px !important;
78
- }
79
- }
80
-
81
-
82
-
@@ -1,96 +0,0 @@
1
- @primary-color: #269ac1;
2
- @icon-pick-hover-color: #269ac1;
3
-
4
- .svg-icon {
5
- fill: currentColor;
6
- vertical-align: middle;
7
- }
8
-
9
- .dt-icon{
10
- display: inline-block;
11
- text-align: center;
12
- & > svg{
13
- vertical-align: middle;
14
- }
15
- }
16
-
17
- .dt-pick-icon {
18
- display: flex;
19
- flex-direction: row;
20
- height: 600px;
21
-
22
- &__menus{
23
- height: 100%;
24
- overflow-y: auto;
25
- width: 140px;
26
- border-right: 1px solid #e7e7e7;
27
- border-top: 1px solid #e7e7e7;
28
- background: #fff;
29
- .menu{
30
- border-bottom: 1px solid #e7e7e7;
31
- padding: 8px;
32
- text-align: center;
33
- cursor: pointer;
34
- transform: all 0.25s;
35
- p{
36
- font-size: 14px;
37
- line-height: 24x;
38
- span{
39
- opacity: 0.7;
40
- font-size: 12px;
41
- padding-left: 6px;
42
- }
43
- }
44
- &.active, &:hover{
45
- background: @primary-color;
46
- color: #fff;
47
- }
48
- }
49
- }
50
-
51
- &__content{
52
- height: 100%;
53
- overflow-y: auto;
54
- flex: 1;
55
- background: #fff;
56
-
57
- .ant-input-search{
58
- width: 50%;
59
- margin: 0 25% 40px 25%;
60
- }
61
-
62
- &_item{
63
- display: flex;
64
- flex-direction: row;
65
- flex-wrap: wrap;
66
- padding: 20px;
67
- a {
68
- margin: 6px;
69
- line-height: 22px;
70
- height: 30px;
71
- width: 30px;
72
- text-align: center;
73
- cursor: pointer;
74
- padding: 4px;
75
- transform: all 0.2s;
76
- border: 1px solid #fff;
77
- &:hover{
78
- border: 1px solid @primary-color;
79
- border-radius: 4px;
80
- color: @primary-color;
81
- }
82
- }
83
- }
84
-
85
- i{
86
- font-size: 22px;
87
- }
88
- }
89
- }
90
-
91
- .dt-pick-icon-item{
92
- .ant-tooltip-inner, .ant-tooltip-arrow-content {
93
- background: #fff !important;
94
- color: @icon-pick-hover-color ;
95
- }
96
- }
@@ -1,60 +0,0 @@
1
- .fullscreen-modal {
2
- overflow: hidden;
3
-
4
- .ant-modal {
5
- top: 0 !important;
6
- right: 0 !important;
7
- bottom: 0 !important;
8
- left: 0 !important;
9
- width: 100% !important;
10
- height: 100%;
11
- padding: 0;
12
-
13
- &-content {
14
- height: 100%;
15
- }
16
- }
17
- }
18
-
19
- .dt-basic-modal-close {
20
- display: flex;
21
- height: 95%;
22
- align-items: center;
23
- justify-content: space-around;
24
-
25
- > span {
26
- margin-left: 48px;
27
- font-size: 16px;
28
- }
29
-
30
- &--can-full {
31
- margin-right: 15px;
32
- > i {
33
- padding-right: 15px;
34
- width: 40px;
35
- }
36
- }
37
-
38
- &:not(&--can-full) {
39
- > i:nth-child(1) {
40
- &:hover {
41
- font-weight: 700;
42
- }
43
- }
44
-
45
- &>i:nth-child(1) {
46
- display: inline-block;
47
- padding: 10px;
48
-
49
- &:hover {
50
- color: @primary-color;
51
- }
52
- }
53
-
54
- &>i:last-child {
55
- &:hover {
56
- color: @error-color;
57
- }
58
- }
59
- }
60
- }