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,127 @@
1
+ 'use strict';
2
+
3
+ var XLSX = require('xlsx');
4
+ var dayjs = require('dayjs');
5
+ var vue = require('vue');
6
+ var AsyncValidator = require('async-validator');
7
+ var elementPlus = require('element-plus');
8
+ var index = require('../../hyForm/js/index.js');
9
+ var useApi = require('../../../hooks/useApi.js');
10
+ var form = require('../../../utils/form.js');
11
+ var is = require('../../../utils/is.js');
12
+
13
+ const doValidate = async (target = {}, columns = [], ruleList = {}) => {
14
+ const data = {};
15
+ let rules = {};
16
+ const columnMap = (columns || []).reduce((columnMap2, column) => {
17
+ if (index.columnShowHandler({ model: data }, column)) {
18
+ columnMap2[column.prop] = column;
19
+ rules[column.prop] = column.rules || [];
20
+ form.setValueByProp(data, column.prop, form.getValueByProp(target, column.prop));
21
+ }
22
+ return columnMap2;
23
+ }, {});
24
+ Object.entries(ruleList || {}).forEach(([key, citem]) => {
25
+ if (columnMap[key]) {
26
+ rules[key] = [
27
+ ...is.isArray(citem) ? citem : [citem],
28
+ ...rules[key]
29
+ ].filter(Boolean);
30
+ }
31
+ });
32
+ const validator = new AsyncValidator(rules);
33
+ return validator.validate(data, { firstFields: true }).then((res) => {
34
+ return true;
35
+ }).catch((error) => {
36
+ const { errors, fields } = error;
37
+ if (!errors || !fields) {
38
+ console.error(error);
39
+ }
40
+ return Promise.reject(errors || []);
41
+ });
42
+ };
43
+ const doReadExcel = (files, props) => {
44
+ return new Promise((resolve2, reject) => {
45
+ const { formColumns, beforeDataHandle } = props;
46
+ const fileReader = new FileReader();
47
+ fileReader.onload = (ev) => {
48
+ try {
49
+ const data = ev.target.result;
50
+ const workbook = XLSX.read(data, {
51
+ type: "binary"
52
+ });
53
+ const wsname1 = workbook.SheetNames[0];
54
+ const ws1 = XLSX.utils.sheet_to_json(workbook.Sheets[wsname1]);
55
+ let content = formColumns.reduce((content2, column) => {
56
+ const title = column.import ? column.import.title : column.label;
57
+ return content2.replace(
58
+ new RegExp(`"${title}":`, "g"),
59
+ `"${column.prop}":`
60
+ );
61
+ }, JSON.stringify(ws1));
62
+ let dataSource = JSON.parse(content);
63
+ if (beforeDataHandle) {
64
+ dataSource = dataSource.map((item) => beforeDataHandle(item));
65
+ }
66
+ resolve2(dataSource);
67
+ } catch (err) {
68
+ reject(err);
69
+ }
70
+ };
71
+ fileReader.readAsBinaryString(files[0]);
72
+ });
73
+ };
74
+ const downloadTemplateHandler = async (props) => {
75
+ const { templateConfig } = props;
76
+ const { url, fileName } = templateConfig;
77
+ if (!url) {
78
+ elementPlus.ElMessage.warning("\u8BF7\u914D\u7F6E\u4E0B\u8F7D\u6A21\u677F\u5730\u5740");
79
+ return;
80
+ }
81
+ const { api } = useApi.useApi();
82
+ try {
83
+ const blob = await vue.unref(api).get(url, {
84
+ responseType: "blob"
85
+ });
86
+ blobDownloadFn(blob, fileName).then(() => {
87
+ resolve();
88
+ });
89
+ } catch (err) {
90
+ console.error(err);
91
+ }
92
+ };
93
+ function blobDownloadFn(blob, name) {
94
+ return new Promise((resolve2, reject) => {
95
+ elementPlus.ElMessage.warning("\u5F00\u59CB\u4E0B\u8F7D");
96
+ const today = dayjs().format("YYYY-MM-DD HH:mm:ss");
97
+ const reader = new FileReader();
98
+ reader.readAsDataURL(blob);
99
+ reader.onload = function(ev) {
100
+ let url = null;
101
+ try {
102
+ if (window.navigator.msSaveOrOpenBlob) {
103
+ const blobObject = new Blob([blob]);
104
+ window.navigator.msSaveOrOpenBlob(blobObject, `${name}_${today}.xls`);
105
+ } else {
106
+ url = URL.createObjectURL(new Blob([blob]));
107
+ const a = document.createElement("a");
108
+ document.body.appendChild(a);
109
+ a.href = url;
110
+ a.download = `${name}_${today}.xls`;
111
+ a.target = "_blank";
112
+ a.click();
113
+ a.remove();
114
+ }
115
+ resolve2();
116
+ } catch (error) {
117
+ reject(error);
118
+ } finally {
119
+ if (url) URL.revokeObjectURL(url);
120
+ }
121
+ };
122
+ });
123
+ }
124
+
125
+ exports.doReadExcel = doReadExcel;
126
+ exports.doValidate = doValidate;
127
+ exports.downloadTemplateHandler = downloadTemplateHandler;
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ var useAppForm = require('../../hyForm/js/useAppForm.js');
4
+ var useAppTable = require('../../hyTable/js/useAppTable.js');
5
+ var is = require('../../../utils/is.js');
6
+
7
+ const useAppTableForm = (config = {}) => {
8
+ let { columns } = config || {};
9
+ columns = [
10
+ {
11
+ type: "expand",
12
+ slot: "expand",
13
+ expandType: "expand",
14
+ width: 48
15
+ },
16
+ ...columns.filter(
17
+ (column) => !["expand", "operator"].includes(column.type)
18
+ ),
19
+ {
20
+ label: "\u5BFC\u5165\u72B6\u6001",
21
+ prop: "validateStatus",
22
+ slot: "validateStatus"
23
+ }
24
+ ];
25
+ const { tableColumns } = useAppTable.useAppTable({ columns });
26
+ const { formModel, formColumns } = useAppForm.useAppForm(
27
+ config.formColumns,
28
+ config.formModel
29
+ );
30
+ formColumns.value.forEach((item) => {
31
+ if (is.isString(item.import)) {
32
+ item.import = {
33
+ title: item.import
34
+ };
35
+ } else {
36
+ item.import = {
37
+ title: item.label,
38
+ ...is.isObject(item.import) ? item.import : {}
39
+ };
40
+ }
41
+ });
42
+ return {
43
+ tableColumns,
44
+ formModel,
45
+ formColumns
46
+ };
47
+ };
48
+
49
+ exports.useAppTableForm = 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
+