hy-dispatch-ui-v3 0.2.78 → 0.2.80

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 (36) hide show
  1. package/dist/tailwind.css +18 -4
  2. package/es/components/hyDatePicker/datePicker.vue.mjs +34 -4
  3. package/es/components/hyForm/cpns/formItem.vue.mjs +71 -62
  4. package/es/components/hyForm/js/useAppForm.mjs +4 -3
  5. package/es/components/hyLocationMap/index.mjs +7 -0
  6. package/es/components/hyLocationMap/locationMap.vue.mjs +215 -0
  7. package/es/components/hyLocationMap/style/locationMap.scss +0 -0
  8. package/es/components/hyMap/js/index.mjs +6 -4
  9. package/es/components/hySearch/js/useAppSearch.mjs +4 -31
  10. package/es/components/hyTable/js/search.mjs +1 -1
  11. package/es/components/hyTooltip/tooltip.vue.mjs +27 -17
  12. package/es/components/index.mjs +1 -0
  13. package/es/index.mjs +2 -1
  14. package/es/utils/form.mjs +68 -22
  15. package/es/utils/index.mjs +1 -1
  16. package/es/utils/is.mjs +1 -1
  17. package/es/utils/permission.mjs +3 -1
  18. package/es/version.mjs +1 -1
  19. package/lib/components/hyDatePicker/datePicker.vue.js +32 -2
  20. package/lib/components/hyForm/cpns/formItem.vue.js +70 -61
  21. package/lib/components/hyForm/js/useAppForm.js +2 -1
  22. package/lib/components/hyLocationMap/index.js +12 -0
  23. package/lib/components/hyLocationMap/locationMap.vue.js +219 -0
  24. package/lib/components/hyLocationMap/style/locationMap.scss +0 -0
  25. package/lib/components/hyMap/js/index.js +6 -4
  26. package/lib/components/hySearch/js/useAppSearch.js +2 -29
  27. package/lib/components/hyTable/js/search.js +1 -1
  28. package/lib/components/hyTooltip/tooltip.vue.js +26 -16
  29. package/lib/components/index.js +30 -28
  30. package/lib/index.js +50 -46
  31. package/lib/utils/form.js +69 -21
  32. package/lib/utils/index.js +2 -0
  33. package/lib/utils/is.js +1 -1
  34. package/lib/utils/permission.js +3 -1
  35. package/lib/version.js +1 -1
  36. package/package.json +1 -1
package/lib/utils/form.js CHANGED
@@ -4,6 +4,7 @@ var dayjs = require('dayjs');
4
4
  var vue = require('vue');
5
5
  require('../hooks/index.js');
6
6
  var is = require('./is.js');
7
+ var handler = require('./handler.js');
7
8
  var useLocale = require('../hooks/useLocale.js');
8
9
 
9
10
  function getValueByProp(model, prop) {
@@ -171,6 +172,31 @@ function columnHelpHandler(props, column) {
171
172
  if (is.isFunction(help)) return help(column, props.model);
172
173
  return;
173
174
  }
175
+ function columnTimeRangeOptionsHandler(config) {
176
+ const { timeRangeOptions } = config || {};
177
+ if (!timeRangeOptions?.length) return timeRangeOptions;
178
+ return timeRangeOptions.reduce((list, item) => {
179
+ let { value, label, unit } = item;
180
+ if (!value || !is.isNumber(value) || isNaN(value)) return list;
181
+ const isPlural = value > 1;
182
+ if (!label) {
183
+ switch (unit) {
184
+ case "year":
185
+ label = useLocale.$t("hy.lastDate", [value + useLocale.$t(isPlural ? "hy.years" : "hy.year")]);
186
+ break;
187
+ case "month":
188
+ label = useLocale.$t("hy.lastDate", [value + useLocale.$t(isPlural ? "hy.months" : "hy.month")]);
189
+ break;
190
+ case "day":
191
+ default:
192
+ unit = "day";
193
+ label = value === 1 ? useLocale.$t("hy.today") : useLocale.$t("hy.lastDate", [value + useLocale.$t(isPlural ? "hy.days" : "hy.day")]);
194
+ }
195
+ }
196
+ list.push({ ...item, label, unit });
197
+ return list;
198
+ }, []);
199
+ }
174
200
  function genColumnShortcuts(column) {
175
201
  if (!["datetimerange", "daterange", "monthrange", "yearrange"].includes(column.attrs?.type) || !is.isArray(column.field) || !column.timeRangeOptions?.length) {
176
202
  return;
@@ -187,35 +213,57 @@ function genColumnShortcuts(column) {
187
213
  value: genShortcutItem
188
214
  };
189
215
  });
190
- function genShortcutItem() {
191
- const format = "YYYY-MM-DD";
192
- const date = dayjs(Date.now());
193
- const { value, unit, type } = this.options;
194
- const timeRangeFill2 = this.options.timeRangeFill || type === "datetimerange";
195
- if (unit === "day" && value === 1) {
196
- return [
197
- date.format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
198
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
199
- ];
200
- } else if (unit === "day") {
201
- return [
202
- date.subtract(value - 1, unit).format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
203
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
204
- ];
205
- } else {
206
- return [
207
- date.subtract(value, unit).format(`${format}${timeRangeFill2 ? " 00:00:00" : ""}`),
208
- date.format(`${format}${timeRangeFill2 ? " 23:59:59" : ""}`)
209
- ];
210
- }
216
+ }
217
+ function genShortcutItem(options = this.options) {
218
+ const format = "YYYY-MM-DD";
219
+ const date = dayjs(Date.now());
220
+ const { value, unit, type } = options;
221
+ const timeRangeFill = options.timeRangeFill || type === "datetimerange";
222
+ if (!is.isNumber(value) || value < 1) {
223
+ console.warning("timeRangeOptions \u7684 value \u5B57\u6BB5\u8981\u4F20\u5165\u6570\u5B57");
224
+ return [];
225
+ }
226
+ if (!["day", "month", "year"].includes(unit)) {
227
+ console.warning("timeRangeOptions \u7684 unit \u5B57\u6BB5\u4F20\u5165\u683C\u5F0F\u9519\u8BEF");
228
+ return [];
211
229
  }
230
+ if (unit === "day" && value === 1) {
231
+ return [
232
+ date.format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
233
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
234
+ ];
235
+ } else if (unit === "day") {
236
+ return [
237
+ date.subtract(value - 1, unit).format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
238
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
239
+ ];
240
+ } else {
241
+ return [
242
+ date.subtract(value, unit).format(`${format}${timeRangeFill ? " 00:00:00" : ""}`),
243
+ date.format(`${format}${timeRangeFill ? " 23:59:59" : ""}`)
244
+ ];
245
+ }
246
+ }
247
+ function columnDefaultValueHandler(column) {
248
+ const { type, defaultValue, attrs } = column || {};
249
+ const value = handler.funRunHandler(defaultValue);
250
+ if (type === "date-picker" && is.isObject(value) && ["datetimerange", "daterange", "monthrange", "yearrange"].includes(attrs.type)) {
251
+ return genShortcutItem({
252
+ ...value,
253
+ type: attrs.type,
254
+ timeRangeFill: attrs.timeRangeFill
255
+ });
256
+ }
257
+ return value;
212
258
  }
213
259
 
214
260
  exports.clearSpace = clearSpace;
261
+ exports.columnDefaultValueHandler = columnDefaultValueHandler;
215
262
  exports.columnHelpHandler = columnHelpHandler;
216
263
  exports.columnLabelHandler = columnLabelHandler;
217
264
  exports.columnPlaceholderHandler = columnPlaceholderHandler;
218
265
  exports.columnRuleHandler = columnRuleHandler;
266
+ exports.columnTimeRangeOptionsHandler = columnTimeRangeOptionsHandler;
219
267
  exports.columnnoDataTextHandler = columnnoDataTextHandler;
220
268
  exports.genColumnDefaultLabel = genColumnDefaultLabel;
221
269
  exports.genColumnShortcuts = genColumnShortcuts;
@@ -54,10 +54,12 @@ exports.fileUpload = file.fileUpload;
54
54
  exports.presignedUrl = file.presignedUrl;
55
55
  exports.sizeToTextHandler = file.sizeToTextHandler;
56
56
  exports.clearSpace = form.clearSpace;
57
+ exports.columnDefaultValueHandler = form.columnDefaultValueHandler;
57
58
  exports.columnHelpHandler = form.columnHelpHandler;
58
59
  exports.columnLabelHandler = form.columnLabelHandler;
59
60
  exports.columnPlaceholderHandler = form.columnPlaceholderHandler;
60
61
  exports.columnRuleHandler = form.columnRuleHandler;
62
+ exports.columnTimeRangeOptionsHandler = form.columnTimeRangeOptionsHandler;
61
63
  exports.columnnoDataTextHandler = form.columnnoDataTextHandler;
62
64
  exports.genColumnDefaultLabel = form.genColumnDefaultLabel;
63
65
  exports.genColumnShortcuts = form.genColumnShortcuts;
package/lib/utils/is.js CHANGED
@@ -7,7 +7,7 @@ var usePermissionMap = require('../hooks/usePermissionMap.js');
7
7
  var permission = require('./permission.js');
8
8
 
9
9
  const isString = (e) => typeof e === "string";
10
- const isNumber = (e) => typeof e === "number";
10
+ const isNumber = (e) => typeof e === "number" && !isNaN(e);
11
11
  const isObject = (e) => Object.prototype.toString.call(e) === "[object Object]";
12
12
  const isFunction = (e) => typeof e === "function";
13
13
  const isArray = (e) => Array.isArray(e);
@@ -494,7 +494,9 @@ const PERMISSION = {
494
494
  // 区域管理
495
495
  operator_areaManagement: "operator_areaManagement",
496
496
  // 工单系统
497
- headerNavigation_policeticketSyncShangrao: "headerNavigation_policeticketSyncShangrao"
497
+ headerNavigation_policeticketSyncShangrao: "headerNavigation_policeticketSyncShangrao",
498
+ // 采集站管理 - 非全链路模式 - 同步数据
499
+ operator_acquisitionStation_nonFullChainMode_manualDataSynchronization: "operator_acquisitionStation_nonFullChainMode_manualDataSynchronization"
498
500
  };
499
501
 
500
502
  exports.PERMISSION = PERMISSION;
package/lib/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const version = "0.2.77";
3
+ const version = "0.2.79";
4
4
 
5
5
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-dispatch-ui-v3",
3
- "version": "0.2.78",
3
+ "version": "0.2.80",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "scripts": {