hy-dispatch-ui-v3 0.2.31 → 0.2.33

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 (80) hide show
  1. package/dist/tailwind.css +174 -454
  2. package/es/components/hyAudioPlayer/audioPlayer.vue.mjs +4 -4
  3. package/es/components/hyAudioPlayer/style/audioPlayer.scss +11 -12
  4. package/es/components/hyButton/button.vue.mjs +112 -65
  5. package/es/components/hyButton/style/button.scss +291 -233
  6. package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +1 -1
  7. package/es/components/hyForm/form.vue.mjs +2 -1
  8. package/es/components/hyForm/index.mjs +1 -1
  9. package/es/components/hyForm/js/useAppForm.mjs +1 -2
  10. package/es/components/hyForm/style/form.scss +56 -54
  11. package/es/components/hyIcon/style/icon.scss +1 -1
  12. package/es/components/hyIconBox/style/iconBox.scss +19 -18
  13. package/es/components/hyInput/input.vue.mjs +4 -1
  14. package/es/components/hyMenu/menu.vue.mjs +1 -1
  15. package/es/components/hyMenu/style/menu.scss +1 -1
  16. package/es/components/hySearch/index.mjs +1 -1
  17. package/es/components/hySearch/style/search.scss +50 -50
  18. package/es/components/hyTable/cpns/virtualTable.vue.mjs +342 -319
  19. package/es/components/hyTable/js/index.mjs +19 -3
  20. package/es/components/hyTable/js/useAppTable.mjs +1 -1
  21. package/es/components/hyTable/table.vue.mjs +31 -11
  22. package/es/components/hyTableForm/batchTableForm.vue.mjs +478 -0
  23. package/es/components/hyTableForm/index.mjs +4 -1
  24. package/es/components/hyTableForm/js/index.mjs +123 -0
  25. package/es/components/hyTableForm/js/useAppTableForm.mjs +47 -0
  26. package/es/components/hyTableForm/style/batchTableForm.scss +127 -0
  27. package/es/components/hyTableForm/style/tableForm.scss +42 -0
  28. package/es/components/hyTableForm/tableForm.vue.mjs +452 -7
  29. package/es/components/hyTooltip/tooltip.vue.mjs +2 -2
  30. package/es/components/hyVideoPlayer/cpns/mediaLoading.vue.mjs +1 -1
  31. package/es/components/hyVideoPlayer/style/mediaLoading.scss +5 -5
  32. package/es/components/hyVideoPlayer/style/videoPlayer.scss +7 -6
  33. package/es/components/hyVideoPlayer/videoPlayer.vue.mjs +6 -6
  34. package/es/components/index.mjs +4 -3
  35. package/es/index.mjs +4 -3
  36. package/es/static/hy-svg-icons/hy-icon-dispatch-linear-map-treelist.js +8 -0
  37. package/es/static/hy-svg-icons/hy-icon-dispatch-share-guidao.js +8 -0
  38. package/es/style/tailwind.scss +133 -1
  39. package/es/utils/handler.mjs +4 -4
  40. package/es/version.mjs +1 -1
  41. package/lib/components/hyAudioPlayer/audioPlayer.vue.js +4 -4
  42. package/lib/components/hyAudioPlayer/style/audioPlayer.scss +11 -12
  43. package/lib/components/hyButton/button.vue.js +111 -64
  44. package/lib/components/hyButton/style/button.scss +291 -233
  45. package/lib/components/hyConfirmDialog/confirmDialog.vue.js +1 -1
  46. package/lib/components/hyForm/form.vue.js +2 -1
  47. package/lib/components/hyForm/index.js +1 -0
  48. package/lib/components/hyForm/js/useAppForm.js +1 -2
  49. package/lib/components/hyForm/style/form.scss +56 -54
  50. package/lib/components/hyIcon/style/icon.scss +1 -1
  51. package/lib/components/hyIconBox/style/iconBox.scss +19 -18
  52. package/lib/components/hyInput/input.vue.js +4 -1
  53. package/lib/components/hyMenu/menu.vue.js +1 -1
  54. package/lib/components/hyMenu/style/menu.scss +1 -1
  55. package/lib/components/hySearch/index.js +1 -0
  56. package/lib/components/hySearch/style/search.scss +50 -50
  57. package/lib/components/hyTable/cpns/virtualTable.vue.js +340 -317
  58. package/lib/components/hyTable/js/index.js +19 -3
  59. package/lib/components/hyTable/js/useAppTable.js +1 -1
  60. package/lib/components/hyTable/table.vue.js +31 -11
  61. package/lib/components/hyTableForm/batchTableForm.vue.js +482 -0
  62. package/lib/components/hyTableForm/index.js +5 -0
  63. package/lib/components/hyTableForm/js/index.js +127 -0
  64. package/lib/components/hyTableForm/js/useAppTableForm.js +49 -0
  65. package/lib/components/hyTableForm/style/batchTableForm.scss +127 -0
  66. package/lib/components/hyTableForm/style/tableForm.scss +42 -0
  67. package/lib/components/hyTableForm/tableForm.vue.js +451 -6
  68. package/lib/components/hyTooltip/tooltip.vue.js +2 -2
  69. package/lib/components/hyVideoPlayer/cpns/mediaLoading.vue.js +1 -1
  70. package/lib/components/hyVideoPlayer/style/mediaLoading.scss +5 -5
  71. package/lib/components/hyVideoPlayer/style/videoPlayer.scss +7 -6
  72. package/lib/components/hyVideoPlayer/videoPlayer.vue.js +6 -6
  73. package/lib/components/index.js +35 -30
  74. package/lib/index.js +35 -30
  75. package/lib/static/hy-svg-icons/hy-icon-dispatch-linear-map-treelist.js +8 -0
  76. package/lib/static/hy-svg-icons/hy-icon-dispatch-share-guidao.js +8 -0
  77. package/lib/style/tailwind.scss +133 -1
  78. package/lib/utils/handler.js +4 -4
  79. package/lib/version.js +1 -1
  80. package/package.json +5 -3
@@ -0,0 +1,123 @@
1
+ import XLSX from 'xlsx';
2
+ import dayjs from 'dayjs';
3
+ import { unref } from 'vue';
4
+ import AsyncValidator from 'async-validator';
5
+ import { ElMessage } from 'element-plus';
6
+ import { columnShowHandler } from '../../hyForm/js/index.mjs';
7
+ import { useApi } from '../../../hooks/useApi.mjs';
8
+ import { setValueByProp, getValueByProp } from '../../../utils/form.mjs';
9
+ import { isArray } from '../../../utils/is.mjs';
10
+
11
+ const doValidate = async (target = {}, columns = [], ruleList = {}) => {
12
+ const data = {};
13
+ let rules = {};
14
+ const columnMap = (columns || []).reduce((columnMap2, column) => {
15
+ if (columnShowHandler({ model: data }, column)) {
16
+ columnMap2[column.prop] = column;
17
+ rules[column.prop] = column.rules || [];
18
+ setValueByProp(data, column.prop, getValueByProp(target, column.prop));
19
+ }
20
+ return columnMap2;
21
+ }, {});
22
+ Object.entries(ruleList || {}).forEach(([key, citem]) => {
23
+ if (columnMap[key]) {
24
+ rules[key] = [
25
+ ...isArray(citem) ? citem : [citem],
26
+ ...rules[key]
27
+ ].filter(Boolean);
28
+ }
29
+ });
30
+ const validator = new AsyncValidator(rules);
31
+ return validator.validate(data, { firstFields: true }).then((res) => {
32
+ return true;
33
+ }).catch((error) => {
34
+ const { errors, fields } = error;
35
+ if (!errors || !fields) {
36
+ console.error(error);
37
+ }
38
+ return Promise.reject(errors || []);
39
+ });
40
+ };
41
+ const doReadExcel = (files, props) => {
42
+ return new Promise((resolve2, reject) => {
43
+ const { formColumns, beforeDataHandle } = props;
44
+ const fileReader = new FileReader();
45
+ fileReader.onload = (ev) => {
46
+ try {
47
+ const data = ev.target.result;
48
+ const workbook = XLSX.read(data, {
49
+ type: "binary"
50
+ });
51
+ const wsname1 = workbook.SheetNames[0];
52
+ const ws1 = XLSX.utils.sheet_to_json(workbook.Sheets[wsname1]);
53
+ let content = formColumns.reduce((content2, column) => {
54
+ const title = column.import ? column.import.title : column.label;
55
+ return content2.replace(
56
+ new RegExp(`"${title}":`, "g"),
57
+ `"${column.prop}":`
58
+ );
59
+ }, JSON.stringify(ws1));
60
+ let dataSource = JSON.parse(content);
61
+ if (beforeDataHandle) {
62
+ dataSource = dataSource.map((item) => beforeDataHandle(item));
63
+ }
64
+ resolve2(dataSource);
65
+ } catch (err) {
66
+ reject(err);
67
+ }
68
+ };
69
+ fileReader.readAsBinaryString(files[0]);
70
+ });
71
+ };
72
+ const downloadTemplateHandler = async (props) => {
73
+ const { templateConfig } = props;
74
+ const { url, fileName } = templateConfig;
75
+ if (!url) {
76
+ ElMessage.warning("\u8BF7\u914D\u7F6E\u4E0B\u8F7D\u6A21\u677F\u5730\u5740");
77
+ return;
78
+ }
79
+ const { api } = useApi();
80
+ try {
81
+ const blob = await unref(api).get(url, {
82
+ responseType: "blob"
83
+ });
84
+ blobDownloadFn(blob, fileName).then(() => {
85
+ resolve();
86
+ });
87
+ } catch (err) {
88
+ console.error(err);
89
+ }
90
+ };
91
+ function blobDownloadFn(blob, name) {
92
+ return new Promise((resolve2, reject) => {
93
+ ElMessage.warning("\u5F00\u59CB\u4E0B\u8F7D");
94
+ const today = dayjs().format("YYYY-MM-DD HH:mm:ss");
95
+ const reader = new FileReader();
96
+ reader.readAsDataURL(blob);
97
+ reader.onload = function(ev) {
98
+ let url = null;
99
+ try {
100
+ if (window.navigator.msSaveOrOpenBlob) {
101
+ const blobObject = new Blob([blob]);
102
+ window.navigator.msSaveOrOpenBlob(blobObject, `${name}_${today}.xls`);
103
+ } else {
104
+ url = URL.createObjectURL(new Blob([blob]));
105
+ const a = document.createElement("a");
106
+ document.body.appendChild(a);
107
+ a.href = url;
108
+ a.download = `${name}_${today}.xls`;
109
+ a.target = "_blank";
110
+ a.click();
111
+ a.remove();
112
+ }
113
+ resolve2();
114
+ } catch (error) {
115
+ reject(error);
116
+ } finally {
117
+ if (url) URL.revokeObjectURL(url);
118
+ }
119
+ };
120
+ });
121
+ }
122
+
123
+ export { doReadExcel, doValidate, downloadTemplateHandler };
@@ -0,0 +1,47 @@
1
+ import { useAppForm } from '../../hyForm/js/useAppForm.mjs';
2
+ import { useAppTable } from '../../hyTable/js/useAppTable.mjs';
3
+ import { isString, isObject } from '../../../utils/is.mjs';
4
+
5
+ const useAppTableForm = (config = {}) => {
6
+ let { columns } = config || {};
7
+ columns = [
8
+ {
9
+ type: "expand",
10
+ slot: "expand",
11
+ expandType: "expand",
12
+ width: 48
13
+ },
14
+ ...columns.filter(
15
+ (column) => !["expand", "operator"].includes(column.type)
16
+ ),
17
+ {
18
+ label: "\u5BFC\u5165\u72B6\u6001",
19
+ prop: "validateStatus",
20
+ slot: "validateStatus"
21
+ }
22
+ ];
23
+ const { tableColumns } = useAppTable({ columns });
24
+ const { formModel, formColumns } = useAppForm(
25
+ config.formColumns,
26
+ config.formModel
27
+ );
28
+ formColumns.value.forEach((item) => {
29
+ if (isString(item.import)) {
30
+ item.import = {
31
+ title: item.import
32
+ };
33
+ } else {
34
+ item.import = {
35
+ title: item.label,
36
+ ...isObject(item.import) ? item.import : {}
37
+ };
38
+ }
39
+ });
40
+ return {
41
+ tableColumns,
42
+ formModel,
43
+ formColumns
44
+ };
45
+ };
46
+
47
+ export { useAppTableForm };
@@ -0,0 +1,127 @@
1
+ .hy-batch-table-form {
2
+ position: relative;
3
+ height: 100%;
4
+ max-height: 100vh;
5
+ overflow: hidden;
6
+ .hy-batch-table-form-upload-box {
7
+ height: 340px;
8
+ position: relative;
9
+ border-radius: 8px;
10
+ border: 1px dashed rgba(var(--hy-auxiliary));
11
+ box-sizing: border-box;
12
+ &:hover {
13
+ border-color: rgba(var(--hy-theme));
14
+ }
15
+ .upload-bg {
16
+ position: absolute;
17
+ width: 100%;
18
+ height: 100%;
19
+ perspective: 800px;
20
+ pointer-events: none;
21
+ overflow: hidden;
22
+ &::before {
23
+ display: block;
24
+ content: '';
25
+ position: absolute;
26
+ top: -50%;
27
+ left: -50%;
28
+ width: 200%;
29
+ height: 200%;
30
+ /* 绘制网格线:使用青色,透明度调低,让它融合在 #14273a 背景里 */
31
+ background-image:
32
+ /* 纵向线 */ linear-gradient(
33
+ 90deg,
34
+ rgba(0, 229, 255, 0.1) 1px,
35
+ transparent 1px
36
+ ),
37
+ /* 横向线 */
38
+ linear-gradient(rgba(0, 229, 255, 0.1) 1px, transparent 1px);
39
+
40
+ /* 网格尺寸 40px */
41
+ background-size: 40px 40px;
42
+
43
+ /* 3D 倒伏效果 */
44
+ transform: rotateX(60deg);
45
+
46
+ /* 动效:无限流动 */
47
+ animation: grid-flow 20s linear infinite;
48
+
49
+ /* 遮罩:四周渐隐,让网格不那么生硬 */
50
+ mask-image: radial-gradient(
51
+ circle at 50% 50%,
52
+ black 10%,
53
+ transparent 80%
54
+ );
55
+ -webkit-mask-image: radial-gradient(
56
+ circle at 50% 50%,
57
+ black 10%,
58
+ transparent 80%
59
+ );
60
+ }
61
+ &::after {
62
+ display: block;
63
+ content: '';
64
+ position: absolute;
65
+ top: 0;
66
+ left: 0;
67
+ width: 100%;
68
+ height: 100%;
69
+ background: radial-gradient(
70
+ circle at 50% 50%,
71
+ rgba(0, 229, 255, 0.05) 0%,
72
+ transparent 70%
73
+ );
74
+ }
75
+ }
76
+
77
+ .hy-el-upload {
78
+ width: 100%;
79
+ height: 100%;
80
+ .hy-el-upload-dragger {
81
+ width: 100%;
82
+ height: 100%;
83
+ display: flex;
84
+ flex-direction: column;
85
+ align-items: center;
86
+ justify-content: center;
87
+ border: none;
88
+ &:hover {
89
+ border-color: var(--theme);
90
+ .type-icon-box {
91
+ transform: translateY(-10px);
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ .hy-batch-table-form-step-box {
99
+ width: 100%;
100
+ height: 260px;
101
+ font-size: 14px;
102
+ margin-top: 16px;
103
+ padding-top: 24px;
104
+ border-radius: 8px;
105
+ background-color: rgba(var(--hy-background-2), 0.5);
106
+ .hy-el-step {
107
+ .hy-el-step__description {
108
+ padding-left: 0px !important;
109
+ padding-right: 0px !important;
110
+ }
111
+ }
112
+ }
113
+
114
+ .hy-batch-table-form-template-box {
115
+ width: 100%;
116
+ height: 48px;
117
+ display: flex;
118
+ align-items: center;
119
+ justify-content: space-between;
120
+ font-size: 12px;
121
+ padding: 0 16px 0 18px;
122
+ border: 1px dashed rgba(var(--hy-auxiliary), 0.5);
123
+ border-radius: 4px;
124
+ background: rgba(var(--hy-background-2), 0.5);
125
+ }
126
+ }
127
+
@@ -0,0 +1,42 @@
1
+ .hy-table-form {
2
+ display: flex;
3
+ flex-direction: column;
4
+
5
+ .hy-el-table-v2__row.hy-el-table-v2__row-error,
6
+ .hy-el-table-v2__row.hy-el-table-v2__row-error:hover {
7
+ outline: 1px solid rgba(var(--hy-danger-2));
8
+ outline-offset: -1px;
9
+ box-shadow: inset 0px 0px 19px 0px rgba(var(--hy-danger-2), 0.5);
10
+ }
11
+
12
+ .hy-table-form-tabs {
13
+ height: 1.875rem;
14
+ display: flex;
15
+ gap: 2px;
16
+ font-size: 0.875rem;
17
+ color: rgba(var(--hy-auxiliary));
18
+ border: 1px solid rgba(var(--hy-border));
19
+ border-radius: 4px;
20
+ padding: 2px;
21
+ font-size: 0.75rem;
22
+ .hy-table-form-tab-button {
23
+ display: flex;
24
+ align-items: center;
25
+ font-weight: bold;
26
+ padding: 0 0.75rem;
27
+ border: 1px solid transparent;
28
+ border-radius: 2px;
29
+ cursor: pointer;
30
+ transition: all 0.3s linear;
31
+ &:hover {
32
+ color: rgba(var(--hy-main));
33
+ }
34
+ &.is-select {
35
+ color: rgba(var(--hy-main));
36
+ background: linear-gradient(180deg, rgba(var(--hy-theme)) 0%, #2A4968 100%);
37
+ border-image: linear-gradient(180deg, rgba(var(--hy-theme)) 80%, rgba(var(--hy-auxiliary))) 1 1;
38
+ }
39
+ }
40
+ }
41
+ }
42
+