@fecp/mobile 1.0.53 → 1.0.54

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 (30) hide show
  1. package/es/mobile.css +18 -2
  2. package/es/packages/mobile/src/axios/config.mjs +18 -0
  3. package/es/packages/mobile/src/axios/index.mjs +5 -3
  4. package/es/packages/mobile/src/components/form/checkboxGroup/CheckboxGroup.vue.mjs +8 -2
  5. package/es/packages/mobile/src/components/form/checkboxGroup/index.mjs +2 -2
  6. package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +31 -5
  7. package/es/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +15 -8
  8. package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +37 -10
  9. package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +17 -8
  10. package/es/packages/mobile/src/components/form/form/Form.vue.mjs +24 -3
  11. package/es/packages/mobile/src/components/form/formItem/FormItem.vue.mjs +4 -2
  12. package/es/packages/mobile/src/components/form/radioGroup/RadioGroup.vue.mjs +4 -1
  13. package/es/packages/mobile/src/components/form/uploader/Uploader.vue.mjs +198 -16
  14. package/es/packages/mobile/src/utils/env.mjs +8 -0
  15. package/es/packages/mobile/src/utils/optionUtil.mjs +94 -0
  16. package/lib/mobile.css +18 -2
  17. package/lib/packages/mobile/src/axios/config.js +18 -0
  18. package/lib/packages/mobile/src/axios/index.js +5 -3
  19. package/lib/packages/mobile/src/components/form/checkboxGroup/CheckboxGroup.vue.js +8 -2
  20. package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +30 -4
  21. package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +14 -7
  22. package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +36 -9
  23. package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +16 -7
  24. package/lib/packages/mobile/src/components/form/form/Form.vue.js +23 -2
  25. package/lib/packages/mobile/src/components/form/formItem/FormItem.vue.js +4 -2
  26. package/lib/packages/mobile/src/components/form/radioGroup/RadioGroup.vue.js +4 -1
  27. package/lib/packages/mobile/src/components/form/uploader/Uploader.vue.js +197 -15
  28. package/lib/packages/mobile/src/utils/env.js +8 -0
  29. package/lib/packages/mobile/src/utils/optionUtil.js +94 -0
  30. package/package.json +1 -1
@@ -15,12 +15,33 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
15
15
  ;/* empty css */
16
16
  const vue = require("vue");
17
17
  const index = require("../field/index.js");
18
+ const optionUtil = require("../../../utils/optionUtil.js");
18
19
  const index$2 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/picker/index.js");
19
20
  const index$3 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/icon/index.js");
20
21
  const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.js");
21
22
  const _sfc_main = {
22
23
  __name: "FieldPicker",
23
24
  props: {
25
+ // optionType: {
26
+ // type: String,
27
+ // default: "static",
28
+ // },
29
+ // dicKey: {
30
+ // type: String,
31
+ // default: "",
32
+ // },
33
+ // dicList: {
34
+ // type: Array,
35
+ // default: [],
36
+ // },
37
+ // dataSource: {
38
+ // type: String,
39
+ // default: "",
40
+ // },
41
+ // dataSourceParams: {
42
+ // type: Object,
43
+ // default: {},
44
+ // },
24
45
  pickerOptions: {
25
46
  type: Array,
26
47
  default: []
@@ -49,6 +70,15 @@ const _sfc_main = {
49
70
  emits: ["update:modelValue"],
50
71
  setup(__props, { emit: __emit }) {
51
72
  const props = __props;
73
+ const attrs = vue.useAttrs();
74
+ const finalOptions = vue.ref([]);
75
+ optionUtil.getOptions({
76
+ ...attrs,
77
+ staticOptions: props.pickerOptions,
78
+ optionsFieldNames: props.treeOptionsFieldNames
79
+ }).then((data) => {
80
+ finalOptions.value = data;
81
+ });
52
82
  const fieldTextValue = vue.ref("");
53
83
  const showPicker = vue.ref(false);
54
84
  const emit = __emit;
@@ -62,16 +92,14 @@ const _sfc_main = {
62
92
  }
63
93
  });
64
94
  vue.watch(
65
- () => props.modelValue,
66
- (value) => {
95
+ [() => props.modelValue, finalOptions],
96
+ ([value, options]) => {
67
97
  if (!value) {
68
98
  fieldTextValue.value = "";
69
99
  return;
70
100
  }
71
- const optionItem = props.pickerOptions.find(
72
- (item) => item[props.treeOptionsFieldNames.value] == value
73
- );
74
- fieldTextValue.value = optionItem == null ? void 0 : optionItem[props.treeOptionsFieldNames.text];
101
+ const optionItem = options.find((item) => item.value == value);
102
+ fieldTextValue.value = optionItem == null ? void 0 : optionItem.text;
75
103
  },
76
104
  { immediate: true }
77
105
  );
@@ -104,13 +132,12 @@ const _sfc_main = {
104
132
  }, {
105
133
  default: vue.withCtx(() => [
106
134
  vue.createVNode(_component_van_picker, vue.mergeProps(_ctx.$attrs, {
107
- columns: __props.pickerOptions,
108
- "columns-field-names": __props.treeOptionsFieldNames,
135
+ columns: vue.unref(finalOptions),
109
136
  "model-value": vue.unref(pickerValue),
110
137
  readonly: false,
111
138
  onConfirm,
112
139
  onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
113
- }), null, 16, ["columns", "columns-field-names", "model-value"])
140
+ }), null, 16, ["columns", "model-value"])
114
141
  ]),
115
142
  _: 1
116
143
  }, 8, ["show"])
@@ -2,13 +2,14 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const vue = require("vue");
4
4
  const index = require("../field/index.js");
5
+ const optionUtil = require("../../../utils/optionUtil.js");
5
6
  const index$1 = require("../radioGroup/index.js");
6
7
  const _hoisted_1 = { key: 1 };
7
8
  const _sfc_main = {
8
9
  __name: "FieldRadio",
9
10
  props: {
10
11
  modelValue: {
11
- type: String,
12
+ type: [String, Number],
12
13
  default: ""
13
14
  },
14
15
  options: {
@@ -31,6 +32,15 @@ const _sfc_main = {
31
32
  emits: ["update:modelValue"],
32
33
  setup(__props, { emit: __emit }) {
33
34
  const props = __props;
35
+ const attrs = vue.useAttrs();
36
+ const finalOptions = vue.ref([]);
37
+ optionUtil.getOptions({
38
+ ...attrs,
39
+ staticOptions: props.options,
40
+ optionsFieldNames: props.fieldNames
41
+ }).then((data) => {
42
+ finalOptions.value = data;
43
+ });
34
44
  const emit = __emit;
35
45
  const compValue = vue.computed({
36
46
  get: () => {
@@ -41,10 +51,10 @@ const _sfc_main = {
41
51
  }
42
52
  });
43
53
  const fieldTextValue = vue.computed(() => {
44
- const selectedOption = props.options.find(
45
- (option) => option[props.fieldNames.value] === compValue.value
54
+ const selectedOption = finalOptions.value.find(
55
+ (option) => option.value === compValue.value
46
56
  );
47
- return selectedOption ? selectedOption[props.fieldNames.text] : "";
57
+ return selectedOption ? selectedOption.text : "";
48
58
  });
49
59
  return (_ctx, _cache) => {
50
60
  return vue.openBlock(), vue.createBlock(vue.unref(index.MobileField), vue.mergeProps(_ctx.$attrs, {
@@ -54,11 +64,10 @@ const _sfc_main = {
54
64
  }), {
55
65
  input: vue.withCtx(() => [
56
66
  !__props.readonly ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.MobileRadioGroup), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
57
- options: __props.options,
58
- fieldNames: __props.fieldNames,
67
+ options: vue.unref(finalOptions),
59
68
  modelValue: vue.unref(compValue),
60
69
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(compValue) ? compValue.value = $event : null)
61
- }), null, 16, ["options", "fieldNames", "modelValue"])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, vue.toDisplayString(vue.unref(fieldTextValue)), 1))
70
+ }), null, 16, ["options", "modelValue"])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, vue.toDisplayString(vue.unref(fieldTextValue)), 1))
62
71
  ]),
63
72
  _: 1
64
73
  }, 16, ["readonly", "modelValue"]);
@@ -3,6 +3,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  ;/* empty css */
4
4
  ;/* empty css */
5
5
  const vue = require("vue");
6
+ const optionUtil = require("../../../utils/optionUtil.js");
6
7
  ;/* empty css */
7
8
  const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
8
9
  const index = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/form/index.js");
@@ -54,6 +55,26 @@ const _sfc_main = {
54
55
  "formReadonly",
55
56
  vue.computed(() => props.formType == "detail")
56
57
  );
58
+ const dicLoaded = vue.ref(false);
59
+ const slots = vue.useSlots();
60
+ const dicListMap = vue.ref({});
61
+ const processSlotComponents = async () => {
62
+ var _a;
63
+ const slotElements = (_a = slots.default) == null ? void 0 : _a.call(slots);
64
+ const dicKeyList = [];
65
+ if (slotElements) {
66
+ slotElements.forEach((node) => {
67
+ if (node.type.__name === "FormItem" && node.props.optionType == "dic") {
68
+ dicKeyList.push(node.props.dicKey);
69
+ }
70
+ });
71
+ const uniqueDicKeys = [...new Set(dicKeyList)];
72
+ dicListMap.value = await optionUtil.getParmDicMapByKeys(uniqueDicKeys.join(","));
73
+ dicLoaded.value = true;
74
+ }
75
+ };
76
+ vue.provide("dicListMap", dicListMap);
77
+ processSlotComponents();
57
78
  return (_ctx, _cache) => {
58
79
  const _component_van_cell_group = index$1.CellGroup;
59
80
  const _component_van_form = index.Form;
@@ -64,7 +85,7 @@ const _sfc_main = {
64
85
  default: vue.withCtx(() => [
65
86
  vue.createVNode(_component_van_cell_group, { inset: __props.isCard }, {
66
87
  default: vue.withCtx(() => [
67
- vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
88
+ vue.unref(dicLoaded) ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }, void 0, true) : vue.createCommentVNode("", true)
68
89
  ]),
69
90
  _: 3
70
91
  }, 8, ["inset"])
@@ -74,5 +95,5 @@ const _sfc_main = {
74
95
  };
75
96
  }
76
97
  };
77
- const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-e0489cda"]]);
98
+ const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-17ab5a76"]]);
78
99
  exports.default = _Form;
@@ -45,6 +45,7 @@ const _sfc_main = {
45
45
  const formData = vue.inject("formData");
46
46
  const formDisabled = vue.inject("formDisabled");
47
47
  const formReadonly = vue.inject("formReadonly");
48
+ const dicListMap = vue.inject("dicListMap");
48
49
  const formItemDisabled = vue.computed(() => {
49
50
  if (formDisabled.value) {
50
51
  return formDisabled.value;
@@ -86,8 +87,9 @@ const _sfc_main = {
86
87
  required: vue.unref(formItemReadonly) ? false : "auto",
87
88
  disabled: vue.unref(formItemDisabled),
88
89
  readonly: vue.unref(formItemReadonly),
89
- placeholder: vue.unref(formItemReadonly) ? "" : __props.placeholder
90
- }), null, 16, ["modelValue", "rules", "required", "disabled", "readonly", "placeholder"]);
90
+ placeholder: vue.unref(formItemReadonly) ? "" : __props.placeholder,
91
+ dicList: vue.unref(dicListMap)[vue.unref(attrs).dicKey]
92
+ }), null, 16, ["modelValue", "rules", "required", "disabled", "readonly", "placeholder", "dicList"]);
91
93
  };
92
94
  }
93
95
  };
@@ -29,7 +29,10 @@ const _sfc_main = {
29
29
  return (_ctx, _cache) => {
30
30
  const _component_van_radio = index$1.Radio;
31
31
  const _component_van_radio_group = index.RadioGroup;
32
- return vue.openBlock(), vue.createBlock(_component_van_radio_group, vue.mergeProps(_ctx.$attrs, { shape: "round" }), {
32
+ return vue.openBlock(), vue.createBlock(_component_van_radio_group, vue.mergeProps(_ctx.$attrs, {
33
+ shape: "round",
34
+ class: "fec-m-radio"
35
+ }), {
33
36
  default: vue.withCtx(() => [
34
37
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.options, (item) => {
35
38
  return vue.openBlock(), vue.createBlock(_component_van_radio, {
@@ -12,21 +12,203 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
12
12
  ;/* empty css */
13
13
  ;/* empty css */
14
14
  const vue = require("vue");
15
+ const dataSourceUtil = require("../../../utils/dataSourceUtil.js");
16
+ ;/* empty css */
15
17
  const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
16
18
  const index = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/uploader/index.js");
17
- const _sfc_main = {};
18
- function _sfc_render(_ctx, _cache) {
19
- const _component_van_uploader = index.Uploader;
20
- return vue.openBlock(), vue.createBlock(_component_van_uploader, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), vue.createSlots({ _: 2 }, [
21
- vue.renderList(_ctx.$slots, (item, key) => {
22
- return {
23
- name: key,
24
- fn: vue.withCtx(() => [
25
- vue.renderSlot(_ctx.$slots, key)
26
- ])
27
- };
28
- })
29
- ]), 1040);
30
- }
31
- const _Uploader = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["render", _sfc_render]]);
19
+ const functionCall = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/toast/function-call.js");
20
+ require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/toast/index.js");
21
+ const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/icon/index.js");
22
+ const _hoisted_1 = { class: "preview-cover van-ellipsis" };
23
+ const _hoisted_2 = {
24
+ key: 0,
25
+ class: "van-uploader__preview-delete--shadow"
26
+ };
27
+ const _sfc_main = {
28
+ __name: "Uploader",
29
+ props: {
30
+ modelValue: {
31
+ type: Array,
32
+ default: []
33
+ },
34
+ autoUpload: {
35
+ //选择文件后自动上传
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ dataSource: {
40
+ type: String,
41
+ default: ""
42
+ },
43
+ dataSourceParams: {
44
+ type: Object,
45
+ default: {}
46
+ },
47
+ acceptType: {
48
+ //上传文件类型
49
+ type: Array,
50
+ default: []
51
+ },
52
+ maxSize: {
53
+ //文件大小限制,单位为 MB
54
+ type: Number,
55
+ default: 5
56
+ },
57
+ previewSize: {
58
+ //上传区域的尺寸
59
+ type: Number,
60
+ default: 80
61
+ },
62
+ readonly: {
63
+ type: Boolean,
64
+ default: false
65
+ }
66
+ },
67
+ emits: ["update:modelValue"],
68
+ setup(__props, { emit: __emit }) {
69
+ const props = __props;
70
+ const emit = __emit;
71
+ const fileList = vue.computed({
72
+ get: () => {
73
+ return props.modelValue;
74
+ },
75
+ set: (val) => {
76
+ emit("update:modelValue", val);
77
+ }
78
+ });
79
+ const compMaxSize = vue.computed(() => {
80
+ return props.maxSize * 1024 * 1024;
81
+ });
82
+ const accept = vue.computed(() => {
83
+ const acceptArr = [];
84
+ if (props.acceptType.includes("image")) {
85
+ acceptArr.push("image/*");
86
+ }
87
+ if (props.acceptType.includes("video")) {
88
+ acceptArr.push("video/*");
89
+ }
90
+ if (props.acceptType.includes("audio")) {
91
+ acceptArr.push("audio/*");
92
+ }
93
+ if (props.acceptType.includes("text")) {
94
+ acceptArr.push("text/plain");
95
+ }
96
+ if (props.acceptType.includes("doc")) {
97
+ acceptArr.push(".doc");
98
+ acceptArr.push(".docx");
99
+ }
100
+ if (props.acceptType.includes("xls")) {
101
+ acceptArr.push(".xls");
102
+ acceptArr.push(".xlsx");
103
+ }
104
+ if (props.acceptType.includes("ppt")) {
105
+ acceptArr.push(".ppt");
106
+ acceptArr.push(".pptx");
107
+ }
108
+ if (props.acceptType.includes("pdf")) {
109
+ acceptArr.push("application/pdf");
110
+ }
111
+ if (props.acceptType.includes("zip")) {
112
+ acceptArr.push("application/zip");
113
+ acceptArr.push("application/x-rar-compressed");
114
+ }
115
+ return acceptArr.join(",");
116
+ });
117
+ const validators = {
118
+ image: (file) => ["image/jpeg", "image/png", "image/gif", "image/svg+xml"].includes(
119
+ file.type
120
+ ),
121
+ video: (file) => file.type.startsWith("video/"),
122
+ audio: (file) => file.type.startsWith("audio/"),
123
+ text: (file) => file.type === "text/plain",
124
+ doc: (file) => [".doc", ".docx"].some((ext) => file.name.endsWith(ext)),
125
+ xls: (file) => [".xls", ".xlsx"].some((ext) => file.name.endsWith(ext)),
126
+ ppt: (file) => [".ppt", ".pptx"].some((ext) => file.name.endsWith(ext)),
127
+ pdf: (file) => file.type === "application/pdf",
128
+ zip: (file) => ["application/zip", "application/x-rar-compressed"].includes(file.type)
129
+ };
130
+ const typeChineseMap = {
131
+ image: "图片",
132
+ video: "视频",
133
+ audio: "音频",
134
+ text: "文本",
135
+ doc: "Word文档",
136
+ xls: "Excel文档",
137
+ ppt: "PowerPoint文档",
138
+ pdf: "PDF文档",
139
+ zip: "压缩包"
140
+ };
141
+ const beforeRead = (file) => {
142
+ console.log("🚀 ~ beforeRead:", file);
143
+ for (const type of props.acceptType) {
144
+ if (validators[type] && !validators[type](file)) {
145
+ functionCall.showToast(`上传的文件不是有效的${typeChineseMap[type]}`);
146
+ return false;
147
+ }
148
+ }
149
+ return true;
150
+ };
151
+ const afterRead = (file) => {
152
+ console.log("🚀 ~ file:", file);
153
+ if (!props.autoUpload) {
154
+ return;
155
+ }
156
+ file.status = "uploading";
157
+ file.message = "上传中...";
158
+ fileList.value.map((item) => {
159
+ return {
160
+ file: item.file
161
+ };
162
+ });
163
+ const dataSource = dataSourceUtil.useDataSource(props.dataSource);
164
+ dataSource == null ? void 0 : dataSource.load({ fileList: fileList.value, ...props.dataSourceParams }).then((res) => {
165
+ }).catch((err) => {
166
+ file.status = "failed";
167
+ file.message = "上传失败";
168
+ });
169
+ };
170
+ const onOversize = (file) => {
171
+ console.log(file);
172
+ functionCall.showToast(`文件大小不能超过 ${props.maxSize}kb`);
173
+ };
174
+ return (_ctx, _cache) => {
175
+ const _component_van_icon = index$1.Icon;
176
+ const _component_van_uploader = index.Uploader;
177
+ return vue.openBlock(), vue.createBlock(_component_van_uploader, vue.mergeProps(_ctx.$attrs, {
178
+ modelValue: vue.unref(fileList),
179
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(fileList) ? fileList.value = $event : null),
180
+ accept: vue.unref(accept),
181
+ "after-read": afterRead,
182
+ "before-read": beforeRead,
183
+ onOversize,
184
+ "max-size": vue.unref(compMaxSize),
185
+ "result-type": "file",
186
+ "preview-size": __props.previewSize + "px"
187
+ }), vue.createSlots({
188
+ "preview-cover": vue.withCtx(({ file }) => [
189
+ vue.createElementVNode("div", _hoisted_1, vue.toDisplayString((file == null ? void 0 : file.name) || ""), 1)
190
+ ]),
191
+ "preview-delete": vue.withCtx(() => [
192
+ !__props.readonly ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
193
+ vue.createVNode(_component_van_icon, {
194
+ name: "cross",
195
+ class: "van-uploader__preview-delete-icon"
196
+ })
197
+ ])) : vue.createCommentVNode("", true)
198
+ ]),
199
+ _: 2
200
+ }, [
201
+ vue.renderList(_ctx.$slots, (item, key) => {
202
+ return {
203
+ name: key,
204
+ fn: vue.withCtx(() => [
205
+ key != "preview-cover" && key != "preview-delete" ? vue.renderSlot(_ctx.$slots, key, { key: 0 }, void 0, true) : vue.createCommentVNode("", true)
206
+ ])
207
+ };
208
+ })
209
+ ]), 1040, ["modelValue", "accept", "max-size", "preview-size"]);
210
+ };
211
+ }
212
+ };
213
+ const _Uploader = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-cbd8c56a"]]);
32
214
  exports.default = _Uploader;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ function getEnvConfig() {
4
+ const configName = "configProd";
5
+ return window[configName] || window.parent[configName];
6
+ }
7
+ const envConfig = getEnvConfig();
8
+ exports.default = envConfig;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index = require("../../../../_virtual/index.js");
4
+ const index$1 = require("../axios/index.js");
5
+ const dataSourceUtil = require("./dataSourceUtil.js");
6
+ const env = require("./env.js");
7
+ const baseUrl = env.default.api_base_url;
8
+ const getOptions = ({
9
+ optionType,
10
+ dicKey,
11
+ dicList,
12
+ dataSource,
13
+ dataSourceParams,
14
+ staticOptions,
15
+ optionsFieldNames
16
+ }) => {
17
+ return new Promise((resolve, reject) => {
18
+ switch (optionType) {
19
+ case "static":
20
+ resolve(staticOptions);
21
+ case "dic":
22
+ let dicListToOption = function(dicList2) {
23
+ return dicList2.map((item) => {
24
+ return {
25
+ text: item.optName,
26
+ value: item.optCode
27
+ };
28
+ });
29
+ };
30
+ if (dicList && !index.default.isEmpty(dicList)) {
31
+ resolve(dicListToOption(dicList));
32
+ } else {
33
+ getParmDicMapByKeys(dicKey).then((data) => {
34
+ const option = dicListToOption(data[dicKey]);
35
+ resolve(option);
36
+ });
37
+ }
38
+ break;
39
+ case "library":
40
+ const dataSourceRef = dataSourceUtil.useDataSource(dataSource);
41
+ dataSourceRef == null ? void 0 : dataSourceRef.load(dataSourceParams || {}).then((res) => {
42
+ var _a;
43
+ const data = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.records) || (res == null ? void 0 : res.data) || res || [];
44
+ const option = data.map((item) => {
45
+ return {
46
+ text: item[optionsFieldNames.text],
47
+ value: index.default.toValueString(item[optionsFieldNames.value])
48
+ };
49
+ });
50
+ resolve(option);
51
+ }).catch((err) => {
52
+ console.error(err);
53
+ });
54
+ break;
55
+ }
56
+ });
57
+ };
58
+ const getTreeOptions = ({
59
+ optionType,
60
+ dataSource,
61
+ dataSourceParams,
62
+ staticOptions,
63
+ optionsFieldNames
64
+ }) => {
65
+ return new Promise((resolve, reject) => {
66
+ switch (optionType) {
67
+ case "static":
68
+ resolve(staticOptions);
69
+ case "library":
70
+ const dataSourceRef = dataSourceUtil.useDataSource(dataSource);
71
+ dataSourceRef == null ? void 0 : dataSourceRef.load(dataSourceParams || {}).then((res) => {
72
+ var _a;
73
+ const data = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.records) || (res == null ? void 0 : res.data) || res || [];
74
+ resolve(data);
75
+ }).catch((err) => {
76
+ console.error(err);
77
+ });
78
+ break;
79
+ }
80
+ });
81
+ };
82
+ const getParmDicMapByKeys = async (dicKeys) => {
83
+ const http = index$1.default();
84
+ const res = await http.postForm(
85
+ `${baseUrl}/parm/sysParmDic/getDicListByKey`,
86
+ {
87
+ keyName: dicKeys
88
+ }
89
+ );
90
+ return res.data;
91
+ };
92
+ exports.getOptions = getOptions;
93
+ exports.getParmDicMapByKeys = getParmDicMapByKeys;
94
+ exports.getTreeOptions = getTreeOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecp/mobile",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "main": "lib/packages/mobile/index.js",
5
5
  "module": "es/packages/mobile/index.mjs",
6
6
  "files": [