hy-dispatch-ui-v3 0.2.59 → 0.2.60

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 (87) hide show
  1. package/dist/tailwind.css +129 -0
  2. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  3. package/es/api/index.mjs +137 -0
  4. package/es/bussiness/hyAddDepartmentType/addDepartmentType.vue.mjs +365 -0
  5. package/es/bussiness/hyAddDepartmentType/index.mjs +6 -0
  6. package/es/bussiness/hyAddDepartmentType/style/addDepartmentType.scss +31 -0
  7. package/es/bussiness/index.mjs +1 -1
  8. package/es/components/hyAudioPlayer/audioPlayer.vue.mjs +1 -1
  9. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +45 -36
  10. package/es/components/hyDatePicker/datePicker.vue.mjs +2 -0
  11. package/es/components/hyForm/cpns/formItem.vue.mjs +106 -43
  12. package/es/components/hyForm/cpns/locationSelect.vue.mjs +358 -0
  13. package/es/components/hyForm/form.vue.mjs +83 -31
  14. package/es/components/hyForm/js/index.mjs +9 -2
  15. package/es/components/hyForm/js/useAppForm.mjs +6 -36
  16. package/es/components/hyMap/map.vue.mjs +3 -3
  17. package/es/components/hyRadioGroup/index.mjs +6 -0
  18. package/es/components/hyRadioGroup/radioGroup.vue.mjs +123 -0
  19. package/es/components/hyRadioGroup/style/radioGroup.scss +0 -0
  20. package/es/components/hySearch/cpns/searchItem.vue.mjs +20 -13
  21. package/es/components/hySearch/js/useAppSearch.mjs +3 -33
  22. package/es/components/hyTable/cpns/virtualTable.vue.mjs +9 -1
  23. package/es/components/hyTable/js/index.mjs +6 -3
  24. package/es/components/hyTable/js/search.mjs +1 -0
  25. package/es/components/hyTable/table.vue.mjs +11 -4
  26. package/es/components/hyTableForm/batchTableForm.vue.mjs +5 -2
  27. package/es/components/hyTableForm/tableForm.vue.mjs +6 -0
  28. package/es/components/hyTree/js/index.mjs +69 -53
  29. package/es/components/hyTree/tree.vue.mjs +36 -1
  30. package/es/components/index.mjs +1 -0
  31. package/es/index.mjs +3 -1
  32. package/es/locale/en.mjs +17 -1
  33. package/es/locale/zh_CN.mjs +17 -1
  34. package/es/static/hy-svg-icons/hy-icon-ops-linear-shouqi.js +8 -0
  35. package/es/static/hy-svg-icons/hy-icon-ops-linear-zhankai.js +8 -0
  36. package/es/style/index.scss +53 -0
  37. package/es/style/theme.scss +0 -53
  38. package/es/utils/form.mjs +56 -7
  39. package/es/utils/index.mjs +1 -1
  40. package/es/utils/map/hook/bigMap.mjs +4 -0
  41. package/es/utils/map/hook/gaode.mjs +3 -0
  42. package/es/utils/map/hook/leafletjs.mjs +10 -10
  43. package/es/utils/map/index.mjs +27 -7
  44. package/es/version.mjs +1 -1
  45. package/lib/_virtual/_plugin-vue_export-helper.js +13 -0
  46. package/lib/api/index.js +147 -0
  47. package/lib/bussiness/hyAddDepartmentType/addDepartmentType.vue.js +369 -0
  48. package/lib/bussiness/hyAddDepartmentType/index.js +11 -0
  49. package/lib/bussiness/hyAddDepartmentType/style/addDepartmentType.scss +31 -0
  50. package/lib/bussiness/index.js +5 -0
  51. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +44 -35
  52. package/lib/components/hyDatePicker/datePicker.vue.js +2 -0
  53. package/lib/components/hyForm/cpns/formItem.vue.js +111 -48
  54. package/lib/components/hyForm/cpns/locationSelect.vue.js +362 -0
  55. package/lib/components/hyForm/form.vue.js +79 -27
  56. package/lib/components/hyForm/js/index.js +9 -1
  57. package/lib/components/hyForm/js/useAppForm.js +5 -35
  58. package/lib/components/hyMap/map.vue.js +3 -3
  59. package/lib/components/hyRadioGroup/index.js +11 -0
  60. package/lib/components/hyRadioGroup/radioGroup.vue.js +127 -0
  61. package/lib/components/hyRadioGroup/style/radioGroup.scss +0 -0
  62. package/lib/components/hySearch/cpns/searchItem.vue.js +19 -12
  63. package/lib/components/hySearch/js/useAppSearch.js +2 -32
  64. package/lib/components/hyTable/cpns/virtualTable.vue.js +9 -1
  65. package/lib/components/hyTable/js/index.js +6 -3
  66. package/lib/components/hyTable/js/search.js +1 -0
  67. package/lib/components/hyTable/table.vue.js +43 -36
  68. package/lib/components/hyTableForm/batchTableForm.vue.js +5 -2
  69. package/lib/components/hyTableForm/tableForm.vue.js +6 -0
  70. package/lib/components/hyTree/js/index.js +69 -53
  71. package/lib/components/hyTree/tree.vue.js +36 -1
  72. package/lib/components/index.js +14 -12
  73. package/lib/index.js +56 -49
  74. package/lib/locale/en.js +17 -1
  75. package/lib/locale/zh_CN.js +17 -1
  76. package/lib/static/hy-svg-icons/hy-icon-ops-linear-shouqi.js +8 -0
  77. package/lib/static/hy-svg-icons/hy-icon-ops-linear-zhankai.js +8 -0
  78. package/lib/style/index.scss +53 -0
  79. package/lib/style/theme.scss +0 -53
  80. package/lib/utils/form.js +57 -5
  81. package/lib/utils/index.js +3 -0
  82. package/lib/utils/map/hook/bigMap.js +4 -0
  83. package/lib/utils/map/hook/gaode.js +3 -0
  84. package/lib/utils/map/hook/leafletjs.js +10 -10
  85. package/lib/utils/map/index.js +26 -6
  86. package/lib/version.js +1 -1
  87. package/package.json +2 -2
@@ -90,3 +90,56 @@ video {
90
90
  -ms-user-select: none; /*IE10*/
91
91
  user-select: none;
92
92
  }
93
+
94
+ .search_lightColor {
95
+ min-width: 254px;
96
+ line-height: 32px;
97
+ background: rgba(var(--hy-background), 1);
98
+ border-radius: 8px;
99
+ padding: 4px;
100
+ display: flex;
101
+ border: 1px solid rgba(var(--hy-border), 1);
102
+ transition: 0.3s;
103
+ position: relative;
104
+ z-index: 1;
105
+ }
106
+
107
+ .search_lightColor:focus,
108
+ .search_lightColor:hover {
109
+ border-color: rgba(var(--hy-theme), 1);
110
+ }
111
+ .search_lightColor .hy-el-input .hy-el-input__wrapper {
112
+ background: rgba(var(--hy-background), 1);
113
+ border-color: rgba(var(--hy-background), 1);
114
+ box-shadow: none;
115
+ padding: 0 26px 0 10px;
116
+ font-size: 12px;
117
+ color: rgba(var(--hy-main), 1);
118
+ }
119
+
120
+ .search_lightColor .hy-el-input .hy-el-input__wrapper:focus,
121
+ .search_lightColor .hy-el-input .hy-el-input__wrapper:hover {
122
+ border-color: rgba(var(--hy-background), 1);
123
+ box-shadow: none;
124
+ }
125
+
126
+ .search_lightColor .searchBox:active {
127
+ opacity: 0.6;
128
+ }
129
+ .search_lightColor .searchBox {
130
+ width: 42px;
131
+ height: 32px;
132
+ background: rgba(var(--hy-background-3), 1);
133
+ border-radius: 8px;
134
+ line-height: 30px;
135
+ text-align: center;
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ cursor: pointer;
140
+ }
141
+ .search_lightColor .searchBox .svgBox {
142
+ width: 18px;
143
+ height: 18px;
144
+ vertical-align: middle;
145
+ }
@@ -20,59 +20,6 @@
20
20
  --hy-border: 54, 93, 132;
21
21
  }
22
22
 
23
- .search_lightColor {
24
- min-width: 254px;
25
- line-height: 32px;
26
- background: rgba(var(--hy-background), 1);
27
- border-radius: 8px;
28
- padding: 4px;
29
- display: flex;
30
- border: 1px solid rgba(var(--hy-border), 1);
31
- transition: 0.3s;
32
- position: relative;
33
- z-index: 1;
34
- }
35
-
36
- .search_lightColor:focus,
37
- .search_lightColor:hover {
38
- border-color: rgba(var(--hy-theme), 1);
39
- }
40
- .search_lightColor .hy-el-input .hy-el-input__wrapper {
41
- background: rgba(var(--hy-background), 1);
42
- border-color: rgba(var(--hy-background), 1);
43
- box-shadow: none;
44
- padding: 0 26px 0 10px;
45
- font-size: 12px;
46
- color: rgba(var(--hy-main), 1);
47
- }
48
-
49
- .search_lightColor .hy-el-input .hy-el-input__wrapper:focus,
50
- .search_lightColor .hy-el-input .hy-el-input__wrapper:hover {
51
- border-color: rgba(var(--hy-background), 1);
52
- box-shadow: none;
53
- }
54
-
55
- .search_lightColor .searchBox:active {
56
- opacity: 0.6;
57
- }
58
- .search_lightColor .searchBox {
59
- width: 42px;
60
- height: 32px;
61
- background: rgba(var(--hy-background-3), 1);
62
- border-radius: 8px;
63
- line-height: 30px;
64
- text-align: center;
65
- display: flex;
66
- align-items: center;
67
- justify-content: center;
68
- cursor: pointer;
69
- }
70
- .search_lightColor .searchBox .svgBox {
71
- width: 18px;
72
- height: 18px;
73
- vertical-align: middle;
74
- }
75
-
76
23
  .deviceType-sos {
77
24
  font-size: 14px;
78
25
  font-weight: bold;
package/es/utils/form.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { unref } from 'vue';
2
- import { isString, isArray, isObject, isBoolean, isFunction } from './is.mjs';
2
+ import { isString, isArray, isEmpty, isFunction, isObject, isBoolean } from './is.mjs';
3
3
  import { useLocale } from '../hooks/useLocale.mjs';
4
4
 
5
5
  function getValueByProp(model, prop) {
@@ -50,9 +50,10 @@ function clearSpace(value, type = "between") {
50
50
  }
51
51
  return value;
52
52
  }
53
- const genRuleRequiredMsgHandler = (config) => {
53
+ const genRuleRequiredMsgHandler = (column, model) => {
54
54
  const { t } = useLocale();
55
- const { type, prop, label } = config || {};
55
+ const { type, prop } = column || {};
56
+ const label = columnLabelHandler(column, model);
56
57
  if (!prop || !prop?.length) return "";
57
58
  switch (type) {
58
59
  case "input":
@@ -73,16 +74,64 @@ const requiredHandler = (column, model) => {
73
74
  if (isFunction(required)) return required(column, model);
74
75
  return false;
75
76
  };
77
+ const ruleHandler = (column, model) => {
78
+ const rules = unref(column.rules);
79
+ if (isArray(rules)) return [...rules];
80
+ if (isObject(rules)) return [rules];
81
+ if (isFunction(rules)) {
82
+ return ruleHandler({ rules: rules(column, model) }, model);
83
+ }
84
+ return [];
85
+ };
76
86
  const columnRuleHandler = (column, model) => {
77
- let { rules } = column;
78
- rules = isArray(rules) ? [...rules] : isObject(rules) ? [rules] : [];
87
+ const rules = ruleHandler(column, model);
79
88
  if (column.required) {
80
89
  rules.unshift({
81
90
  required: requiredHandler(column, model),
82
- message: genRuleRequiredMsgHandler(column)
91
+ message: genRuleRequiredMsgHandler(column, model)
83
92
  });
84
93
  }
85
94
  return rules;
86
95
  };
96
+ const genColumnDefaultLabel = (column) => {
97
+ if (column.label) return unref(column.label);
98
+ const { t } = useLocale();
99
+ switch (column.type) {
100
+ // 部门级联选择框
101
+ case "org-cascader":
102
+ return t("form.department");
103
+ }
104
+ };
105
+ const columnLabelHandler = (column, model) => {
106
+ const label = unref(column.label);
107
+ if (isEmpty(label)) return "";
108
+ if (isFunction(label)) {
109
+ return label(column, model);
110
+ }
111
+ return label;
112
+ };
113
+ function columnPlaceholderHandler(column, model) {
114
+ const { t } = useLocale();
115
+ const { type, attrs = {} } = column || {};
116
+ const label = columnLabelHandler(column, model);
117
+ let placeholder = attrs.placeholder;
118
+ switch (type) {
119
+ case "input":
120
+ case "input-number":
121
+ case "lat":
122
+ case "lon":
123
+ placeholder = placeholder || t("hy.pleaseEnterPlaceholder", [label]);
124
+ break;
125
+ case "select":
126
+ case "date-picker":
127
+ case "time-picker":
128
+ case "org-cascader":
129
+ placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
130
+ break;
131
+ default:
132
+ placeholder = placeholder || label;
133
+ }
134
+ return placeholder;
135
+ }
87
136
 
88
- export { clearSpace, columnRuleHandler, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp };
137
+ export { clearSpace, columnLabelHandler, columnPlaceholderHandler, columnRuleHandler, genColumnDefaultLabel, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp };
@@ -4,7 +4,7 @@ export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isOb
4
4
  export { cloneDeep, copyText, createUniqueId, funRunHandler, mergeDeep, withInstall } from './handler.mjs';
5
5
  export { formatDuration, getDefaultValueFormatByType } from './date.mjs';
6
6
  export { blobToDataURL, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './file.mjs';
7
- export { clearSpace, columnRuleHandler, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp } from './form.mjs';
7
+ export { clearSpace, columnLabelHandler, columnPlaceholderHandler, columnRuleHandler, genColumnDefaultLabel, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp } from './form.mjs';
8
8
  export { enterNumbersRrLetters, enterTheMumber, filterSpaces, formatNumber, formatTimeFn, getPublicFileSize, inputForbidden, keepTwoDecimalPlaces, onlyNumber } from './input.mjs';
9
9
  export { PERMISSION } from './permission.mjs';
10
10
  export { InitMap, setMapServer, setPoiServer } from './map/index.mjs';
@@ -264,6 +264,10 @@ class bigMap extends EventEmitter {
264
264
  const center2 = target.getCenter();
265
265
  return latAndLngCheckExport(center2);
266
266
  },
267
+ // 自适应地图容器大小
268
+ invalidateSize: function(target) {
269
+ return target.invalidateSize();
270
+ },
267
271
  // 四个角
268
272
  getBounds: function(target) {
269
273
  const bounds = target.getBounds();
@@ -166,6 +166,9 @@ class Google extends EventEmitter {
166
166
  getCenter: function(target) {
167
167
  return target.getCenter();
168
168
  },
169
+ invalidateSize: function(target) {
170
+ return null;
171
+ },
169
172
  fitBounds: function(target, params) {
170
173
  if (!Array.isArray(params)) {
171
174
  params = [params];
@@ -345,6 +345,10 @@ class Leafletjs extends EventEmitter {
345
345
  const { lng: lng2, lat: lat2 } = latAndLngCheckExport(center2);
346
346
  return L.latLng(lat2, lng2);
347
347
  },
348
+ // 自适应地图容器大小
349
+ invalidateSize: function(target) {
350
+ return target.invalidateSize();
351
+ },
348
352
  // 四个角
349
353
  getBounds: function(target) {
350
354
  const bounds = target.getBounds();
@@ -403,24 +407,20 @@ class Leafletjs extends EventEmitter {
403
407
  return map;
404
408
  }
405
409
  // 设置地图瓦片地址
406
- setLayersUrl(map) {
410
+ setLayersUrl(map, changeColorType = true) {
407
411
  const layersUrlList = this.initParams.layersUrlList || [];
408
412
  const layersIndex = this.initParams.layersIndex || 0;
409
- const layersOption = layersUrlList[layersIndex];
410
- if (!layersOption) {
413
+ const layersUrls = layersUrlList[layersIndex];
414
+ if (!layersUrls) {
411
415
  return;
412
416
  }
413
417
  const { mapServerType } = this.initParams;
414
418
  if (mapServerType === "WMTS" || mapServerType === "Dynamic") {
415
- return this.createLayers(map, layersOption);
419
+ return this.createLayers(map, layersUrls);
416
420
  }
417
- const { layersUrls = "", filter, key } = layersOption;
418
421
  layersUrls.split(",").forEach((layersUrl) => {
419
- if (layersUrl.indexOf("{mapKey}") !== -1) {
420
- layersUrl = layersUrl.replace("{mapKey}", key);
421
- }
422
- if (filter) {
423
- this.createCustomLayers(map, layersUrl, { filter });
422
+ if (changeColorType) {
423
+ this.createCustomLayers(map, layersUrl);
424
424
  } else {
425
425
  this.createLayers(map, layersUrl);
426
426
  }
@@ -2,7 +2,8 @@ import Google from './hook/gaode.mjs';
2
2
  import Leafletjs from './hook/leafletjs.mjs';
3
3
  import bigMap from './hook/bigMap.mjs';
4
4
  import { EventEmitter } from 'events';
5
- import hyCommon from 'hy-common';
5
+ import hyCommon, { Common } from 'hy-common';
6
+ import { useApi } from '../../hooks/useApi.mjs';
6
7
 
7
8
  const scriptPromises = new globalThis.Map();
8
9
  const mapServerPromises = new globalThis.Map();
@@ -51,17 +52,17 @@ function setMapServer(mapType, mapConfig = {}) {
51
52
  if (mapType === "gaode" && window.AMap?.Map) {
52
53
  return Promise.resolve();
53
54
  }
54
- if (mapType === "bigMap" && window.BM) {
55
+ if (mapType === "bigmap" && window.BM) {
55
56
  return Promise.resolve();
56
57
  }
57
- if (mapType !== "gaode" && mapType !== "bigMap") {
58
+ if (mapType !== "gaode" && mapType !== "bigmap") {
58
59
  return Promise.resolve();
59
60
  }
60
61
  if (mapServerPromises.has(mapType)) {
61
62
  return mapServerPromises.get(mapType);
62
63
  }
63
64
  const promise = (async () => {
64
- if (mapType === "bigMap") {
65
+ if (mapType === "bigmap") {
65
66
  const staticBaseUrl = mapConfig.staticBaseUrl;
66
67
  await loadScript(staticUrl("bigemap.js", staticBaseUrl));
67
68
  await Promise.all([
@@ -106,6 +107,8 @@ function setPoiServer(mapConfig) {
106
107
  projectCoordinate: data.projectPoiCoordinate,
107
108
  mapSk: data.mapSk
108
109
  };
110
+ const { api } = useApi();
111
+ Common.setAxios(api.value);
109
112
  return new hyCommon.Map({
110
113
  poiServer
111
114
  });
@@ -163,6 +166,22 @@ class InitMap extends EventEmitter {
163
166
  }
164
167
  // 初始化地图
165
168
  NewMap(params = {}) {
169
+ const leftletjsObj = {};
170
+ if (params.mapType === "leafletjs") {
171
+ const { layersServer, layersUrl, mapKey, mapServerType } = params;
172
+ if (layersUrl && mapServerType !== "WMTS") {
173
+ const layersUrlList = (layersUrl || "").split(",").filter(Boolean);
174
+ leftletjsObj.layersUrlList = layersUrlList.map((url) => {
175
+ const index = url.indexOf("{mapKey}");
176
+ if (index !== -1) {
177
+ return url.replace("{mapKey}", mapKey);
178
+ }
179
+ return url;
180
+ });
181
+ } else {
182
+ leftletjsObj.layersUrlList = params.mapServerList;
183
+ }
184
+ }
166
185
  params = {
167
186
  mapType: "gaode",
168
187
  // 地图类型
@@ -181,13 +200,14 @@ class InitMap extends EventEmitter {
181
200
  // 地图瓦片地址
182
201
  zoomOffset: params.zoomOffset || 0,
183
202
  // 缩放偏移量
184
- ...params
203
+ ...params,
204
+ ...leftletjsObj
185
205
  };
186
206
  if (params.mapType === "gaode") {
187
207
  this.map = new Google(params);
188
- } else if (params.mapType === "leaflet") {
208
+ } else if (params.mapType === "leafletjs") {
189
209
  this.map = new Leafletjs(params);
190
- } else if (params.mapType === "bigMap") {
210
+ } else if (params.mapType === "bigmap") {
191
211
  this.map = new bigMap(params);
192
212
  }
193
213
  }
package/es/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.2.58";
1
+ const version = "0.2.59";
2
2
 
3
3
  export { version };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _export_sfc = (sfc, props) => {
6
+ const target = sfc.__vccOpts || sfc;
7
+ for (const [key, val] of props) {
8
+ target[key] = val;
9
+ }
10
+ return target;
11
+ };
12
+
13
+ exports.default = _export_sfc;
@@ -0,0 +1,147 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+ var useLocale = require('../hooks/useLocale.js');
5
+ var useApi = require('../hooks/useApi.js');
6
+
7
+ const { t } = useLocale.useLocale();
8
+ function selectApi(controller, params) {
9
+ return new Promise((resolve, reject) => {
10
+ const { api } = useApi.useApi();
11
+ const http = vue.unref(api);
12
+ if (!params) {
13
+ return reject(new Error(t("iDNotPassed")));
14
+ }
15
+ http.post(controller + "/select", {
16
+ id: params !== -1 ? params : null
17
+ }).then((res) => {
18
+ resolve(res);
19
+ }).catch((res) => {
20
+ reject(new Error(t("interfaceError")));
21
+ });
22
+ });
23
+ }
24
+ function detailApi(controller, params) {
25
+ return new Promise((resolve, reject) => {
26
+ const { api } = useApi.useApi();
27
+ const http = vue.unref(api);
28
+ if (!params) {
29
+ return reject(new Error(t("iDNotPassed")));
30
+ }
31
+ http.post(controller + "/detail", { id: params }).then((res) => {
32
+ resolve(res);
33
+ }).catch((res) => {
34
+ reject(new Error(t("interfaceError")));
35
+ });
36
+ });
37
+ }
38
+ function insertFnApi(controller, params) {
39
+ for (const obj in params) {
40
+ if (obj.indexOf("createDtm") > -1 || obj.indexOf("updateDtm") > -1) {
41
+ delete params[obj];
42
+ } else if (params[obj] === null) {
43
+ delete params[obj];
44
+ }
45
+ }
46
+ const url = controller + "/insert";
47
+ return new Promise((resolve, reject) => {
48
+ const { api } = useApi.useApi();
49
+ const http = vue.unref(api);
50
+ http.post(url, params, { isJSON: true }).then((res) => {
51
+ return resolve(res);
52
+ });
53
+ });
54
+ }
55
+ function saveFnApi(controller, params, options) {
56
+ for (const obj in params) {
57
+ if (obj.indexOf("createDtm") > -1 || obj.indexOf("updateDtm") > -1) {
58
+ delete params[obj];
59
+ } else if (params[obj] === null) {
60
+ delete params[obj];
61
+ }
62
+ }
63
+ const url = controller + "/save";
64
+ return new Promise((resolve, reject) => {
65
+ const { api } = useApi.useApi();
66
+ const http = vue.unref(api);
67
+ http.post(url, params, { isJSON: true, ...options }).then((res) => {
68
+ return resolve(res);
69
+ }).catch((res) => {
70
+ reject(res);
71
+ });
72
+ });
73
+ }
74
+ function saveApi(controller, params) {
75
+ for (const obj in params) {
76
+ if (obj.indexOf("createDtm") > -1 || obj.indexOf("updateDtm") > -1) {
77
+ delete params[obj];
78
+ } else if (params[obj] === null) {
79
+ delete params[obj];
80
+ }
81
+ }
82
+ let url = "";
83
+ if (params.id) {
84
+ url = controller + "/update";
85
+ } else {
86
+ url = controller + "/insert";
87
+ }
88
+ return new Promise((resolve, reject) => {
89
+ const { api } = useApi.useApi();
90
+ const http = vue.unref(api);
91
+ http.post(url, params, { isJSON: true }).then((res) => {
92
+ return resolve(res);
93
+ });
94
+ });
95
+ }
96
+ function findAllApi(controller, params) {
97
+ return new Promise((resolve, reject) => {
98
+ const { api } = useApi.useApi();
99
+ const http = vue.unref(api);
100
+ http.post(controller + "/findAll", params).then((res) => {
101
+ resolve(res);
102
+ });
103
+ });
104
+ }
105
+ function pageApi(controller, params, isJsonData) {
106
+ return new Promise((resolve, reject) => {
107
+ const { api } = useApi.useApi();
108
+ const http = vue.unref(api);
109
+ http.post(controller + "/page", params, { isJSON: isJsonData }).then((res) => {
110
+ resolve(res);
111
+ });
112
+ });
113
+ }
114
+ function deleteBatchApi(controller, ids) {
115
+ return new Promise((resolve, reject) => {
116
+ const { api } = useApi.useApi();
117
+ const http = vue.unref(api);
118
+ if (!ids) {
119
+ return reject(new Error(t("iDNotPassed")));
120
+ }
121
+ http.post(controller + "/deleteBatch", { ids }).then((res) => {
122
+ resolve(res);
123
+ });
124
+ });
125
+ }
126
+ function displayChangeApi(controller, ids, display) {
127
+ return new Promise((resolve) => {
128
+ const { api } = useApi.useApi();
129
+ const http = vue.unref(api);
130
+ http.post(controller + "/displayChange", {
131
+ ids: ids.toString(),
132
+ display
133
+ }).then(() => {
134
+ resolve();
135
+ });
136
+ });
137
+ }
138
+
139
+ exports.deleteBatchApi = deleteBatchApi;
140
+ exports.detailApi = detailApi;
141
+ exports.displayChangeApi = displayChangeApi;
142
+ exports.findAllApi = findAllApi;
143
+ exports.insertFnApi = insertFnApi;
144
+ exports.pageApi = pageApi;
145
+ exports.saveApi = saveApi;
146
+ exports.saveFnApi = saveFnApi;
147
+ exports.selectApi = selectApi;