@fecp/mobile 1.0.53 → 1.0.55

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 (40) hide show
  1. package/es/mobile.css +21 -2
  2. package/es/packages/mobile/index.mjs +2 -0
  3. package/es/packages/mobile/src/axios/config.mjs +21 -0
  4. package/es/packages/mobile/src/axios/index.mjs +5 -3
  5. package/es/packages/mobile/src/components/all.mjs +2 -0
  6. package/es/packages/mobile/src/components/form/checkboxGroup/CheckboxGroup.vue.mjs +8 -2
  7. package/es/packages/mobile/src/components/form/checkboxGroup/index.mjs +2 -2
  8. package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +31 -5
  9. package/es/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +15 -8
  10. package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +37 -10
  11. package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +17 -8
  12. package/es/packages/mobile/src/components/form/fieldUploader/FieldUploader.vue.mjs +52 -0
  13. package/es/packages/mobile/src/components/form/fieldUploader/index.mjs +10 -0
  14. package/es/packages/mobile/src/components/form/form/Form.vue.mjs +24 -3
  15. package/es/packages/mobile/src/components/form/formItem/FormItem.vue.mjs +4 -2
  16. package/es/packages/mobile/src/components/form/radioGroup/RadioGroup.vue.mjs +4 -1
  17. package/es/packages/mobile/src/components/form/uploader/Uploader.vue.mjs +205 -16
  18. package/es/packages/mobile/src/utils/dataSourceUtil.mjs +6 -0
  19. package/es/packages/mobile/src/utils/env.mjs +8 -0
  20. package/es/packages/mobile/src/utils/optionUtil.mjs +94 -0
  21. package/lib/mobile.css +21 -2
  22. package/lib/packages/mobile/index.js +34 -32
  23. package/lib/packages/mobile/src/axios/config.js +21 -0
  24. package/lib/packages/mobile/src/axios/index.js +5 -3
  25. package/lib/packages/mobile/src/components/all.js +34 -32
  26. package/lib/packages/mobile/src/components/form/checkboxGroup/CheckboxGroup.vue.js +8 -2
  27. package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +30 -4
  28. package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +14 -7
  29. package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +36 -9
  30. package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +16 -7
  31. package/lib/packages/mobile/src/components/form/fieldUploader/FieldUploader.vue.js +52 -0
  32. package/lib/packages/mobile/src/components/form/fieldUploader/index.js +10 -0
  33. package/lib/packages/mobile/src/components/form/form/Form.vue.js +23 -2
  34. package/lib/packages/mobile/src/components/form/formItem/FormItem.vue.js +4 -2
  35. package/lib/packages/mobile/src/components/form/radioGroup/RadioGroup.vue.js +4 -1
  36. package/lib/packages/mobile/src/components/form/uploader/Uploader.vue.js +204 -15
  37. package/lib/packages/mobile/src/utils/dataSourceUtil.js +6 -0
  38. package/lib/packages/mobile/src/utils/env.js +8 -0
  39. package/lib/packages/mobile/src/utils/optionUtil.js +94 -0
  40. package/package.json +1 -1
@@ -6,6 +6,8 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
6
6
  ;/* empty css */
7
7
  ;/* empty css */
8
8
  const vue = require("vue");
9
+ ;/* empty css */
10
+ const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
9
11
  const index = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/checkbox-group/index.js");
10
12
  const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/checkbox/index.js");
11
13
  const _sfc_main = {
@@ -28,7 +30,10 @@ const _sfc_main = {
28
30
  return (_ctx, _cache) => {
29
31
  const _component_van_checkbox = index$1.Checkbox;
30
32
  const _component_van_checkbox_group = index.CheckboxGroup;
31
- return vue.openBlock(), vue.createBlock(_component_van_checkbox_group, vue.mergeProps(_ctx.$attrs, { shape: "square" }), {
33
+ return vue.openBlock(), vue.createBlock(_component_van_checkbox_group, vue.mergeProps(_ctx.$attrs, {
34
+ shape: "square",
35
+ class: "fec-m-checkbox"
36
+ }), {
32
37
  default: vue.withCtx(() => [
33
38
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.options, (item) => {
34
39
  return vue.openBlock(), vue.createBlock(_component_van_checkbox, {
@@ -47,4 +52,5 @@ const _sfc_main = {
47
52
  };
48
53
  }
49
54
  };
50
- exports.default = _sfc_main;
55
+ const _CheckboxGroup = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-eeda4504"]]);
56
+ exports.default = _CheckboxGroup;
@@ -13,6 +13,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
13
13
  ;/* empty css */
14
14
  const vue = require("vue");
15
15
  const index = require("../field/index.js");
16
+ const optionUtil = require("../../../utils/optionUtil.js");
16
17
  const index$2 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/cascader/index.js");
17
18
  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");
18
19
  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");
@@ -48,6 +49,31 @@ const _sfc_main = {
48
49
  emits: ["update:modelValue"],
49
50
  setup(__props, { emit: __emit }) {
50
51
  const props = __props;
52
+ const attrs = vue.useAttrs();
53
+ const finalOptions = vue.ref([]);
54
+ optionUtil.getTreeOptions({
55
+ ...attrs,
56
+ staticOptions: props.treeOptions,
57
+ optionsFieldNames: props.treeOptionsFieldNames
58
+ }).then((data) => {
59
+ finalOptions.value = clearEmptyChildren(data);
60
+ });
61
+ function clearEmptyChildren(data) {
62
+ if (typeof data === "object" && data !== null) {
63
+ if (Array.isArray(data)) {
64
+ return data.map((item) => clearEmptyChildren(item));
65
+ } else {
66
+ const newData = { ...data };
67
+ if (newData.children && newData.children.length === 0) {
68
+ delete newData.children;
69
+ } else if (newData.children) {
70
+ newData.children = clearEmptyChildren(newData.children);
71
+ }
72
+ return newData;
73
+ }
74
+ }
75
+ return data;
76
+ }
51
77
  const fieldTextValue = vue.ref("");
52
78
  const showPicker = vue.ref(false);
53
79
  const emit = __emit;
@@ -87,14 +113,14 @@ const _sfc_main = {
87
113
  return displayValues.join("/");
88
114
  }
89
115
  vue.watch(
90
- () => props.modelValue,
91
- (value) => {
116
+ [() => props.modelValue, finalOptions],
117
+ ([value, options]) => {
92
118
  if (!value) {
93
119
  fieldTextValue.value = "";
94
120
  return;
95
121
  }
96
122
  fieldTextValue.value = getDisplayValue(
97
- props.treeOptions,
123
+ options,
98
124
  props.treeOptionsFieldNames,
99
125
  value
100
126
  );
@@ -132,7 +158,7 @@ const _sfc_main = {
132
158
  vue.createVNode(_component_van_cascader, vue.mergeProps(_ctx.$attrs, {
133
159
  modelValue: vue.unref(pickerValue),
134
160
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(pickerValue) ? pickerValue.value = $event : null),
135
- options: __props.treeOptions,
161
+ options: vue.unref(finalOptions),
136
162
  "field-names": __props.treeOptionsFieldNames,
137
163
  placeholder: "请选择",
138
164
  onFinish,
@@ -2,6 +2,7 @@
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("../checkboxGroup/index.js");
6
7
  const _hoisted_1 = { key: 1 };
7
8
  const _sfc_main = {
@@ -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: () => {
@@ -50,10 +60,8 @@ const _sfc_main = {
50
60
  });
51
61
  const fieldTextValue = vue.computed(() => {
52
62
  return compValue.value.map((value) => {
53
- const option = props.options.find(
54
- (opt) => opt[props.fieldNames.value] === value
55
- );
56
- return option ? option[props.fieldNames.text] : value;
63
+ const option = finalOptions.value.find((opt) => opt.value === value);
64
+ return option ? option.text : value;
57
65
  }).join(", ");
58
66
  });
59
67
  return (_ctx, _cache) => {
@@ -64,11 +72,10 @@ const _sfc_main = {
64
72
  }), {
65
73
  input: vue.withCtx(() => [
66
74
  !__props.readonly ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.MobileCheckboxGroup), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
67
- options: __props.options,
68
- fieldNames: __props.fieldNames,
75
+ options: vue.unref(finalOptions),
69
76
  modelValue: vue.unref(compValue),
70
77
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(compValue) ? compValue.value = $event : null)
71
- }), null, 16, ["options", "fieldNames", "modelValue"])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, vue.toDisplayString(vue.unref(fieldTextValue)), 1))
78
+ }), null, 16, ["options", "modelValue"])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, vue.toDisplayString(vue.unref(fieldTextValue)), 1))
72
79
  ]),
73
80
  _: 1
74
81
  }, 16, ["readonly", "modelValue"]);
@@ -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"]);
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ const index = require("../field/index.js");
5
+ const index$1 = require("../uploader/index.js");
6
+ const _sfc_main = {
7
+ __name: "FieldUploader",
8
+ props: {
9
+ modelValue: {
10
+ type: Array,
11
+ default: []
12
+ },
13
+ readonly: {
14
+ type: Boolean,
15
+ default: false
16
+ }
17
+ },
18
+ emits: ["update:modelValue"],
19
+ setup(__props, { emit: __emit }) {
20
+ const props = __props;
21
+ vue.useAttrs();
22
+ const emit = __emit;
23
+ const compValue = vue.computed({
24
+ get: () => {
25
+ return props.modelValue;
26
+ },
27
+ set: (val) => {
28
+ emit("update:modelValue", val);
29
+ }
30
+ });
31
+ const fieldTextValue = vue.computed(() => {
32
+ return "";
33
+ });
34
+ return (_ctx, _cache) => {
35
+ return vue.openBlock(), vue.createBlock(vue.unref(index.MobileField), vue.mergeProps(_ctx.$attrs, {
36
+ readonly: "",
37
+ modelValue: vue.unref(fieldTextValue),
38
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(fieldTextValue) ? fieldTextValue.value = $event : null)
39
+ }), {
40
+ input: vue.withCtx(() => [
41
+ vue.createVNode(vue.unref(index$1.MobileUploader), vue.mergeProps(_ctx.$attrs, {
42
+ readonly: __props.readonly,
43
+ modelValue: vue.unref(compValue),
44
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(compValue) ? compValue.value = $event : null)
45
+ }), null, 16, ["readonly", "modelValue"])
46
+ ]),
47
+ _: 1
48
+ }, 16, ["modelValue"]);
49
+ };
50
+ }
51
+ };
52
+ exports.default = _sfc_main;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const FieldUploader = require("./FieldUploader.vue.js");
4
+ const install = require("../../../utils/install.js");
5
+ const MobileFieldUploader = install.default.withInstall(
6
+ "MobileFieldUploader",
7
+ FieldUploader.default
8
+ );
9
+ exports.MobileFieldUploader = MobileFieldUploader;
10
+ exports.default = MobileFieldUploader;
@@ -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,210 @@ 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 = {
23
+ key: 0,
24
+ class: "preview-cover van-ellipsis"
25
+ };
26
+ const _hoisted_2 = {
27
+ key: 1,
28
+ class: "preview-cover van-ellipsis"
29
+ };
30
+ const _hoisted_3 = {
31
+ key: 0,
32
+ class: "van-uploader__preview-delete--shadow"
33
+ };
34
+ const _sfc_main = {
35
+ __name: "Uploader",
36
+ props: {
37
+ modelValue: {
38
+ type: Array,
39
+ default: []
40
+ },
41
+ autoUpload: {
42
+ //选择文件后自动上传
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ dataSource: {
47
+ type: String,
48
+ default: ""
49
+ },
50
+ dataSourceParams: {
51
+ type: Object,
52
+ default: {}
53
+ },
54
+ acceptType: {
55
+ //上传文件类型
56
+ type: Array,
57
+ default: []
58
+ },
59
+ maxSize: {
60
+ //文件大小限制,单位为 MB
61
+ type: Number,
62
+ default: 5
63
+ },
64
+ previewSize: {
65
+ //上传区域的尺寸
66
+ type: Number,
67
+ default: 80
68
+ },
69
+ readonly: {
70
+ type: Boolean,
71
+ default: false
72
+ }
73
+ },
74
+ emits: ["update:modelValue"],
75
+ setup(__props, { emit: __emit }) {
76
+ const props = __props;
77
+ const emit = __emit;
78
+ const fileList = vue.computed({
79
+ get: () => {
80
+ return props.modelValue;
81
+ },
82
+ set: (val) => {
83
+ emit("update:modelValue", val);
84
+ }
85
+ });
86
+ const compMaxSize = vue.computed(() => {
87
+ return props.maxSize * 1024 * 1024;
88
+ });
89
+ const accept = vue.computed(() => {
90
+ const acceptArr = [];
91
+ if (props.acceptType.includes("all")) {
92
+ return "";
93
+ }
94
+ if (props.acceptType.includes("image")) {
95
+ acceptArr.push("image/*");
96
+ }
97
+ if (props.acceptType.includes("video")) {
98
+ acceptArr.push("video/*");
99
+ }
100
+ if (props.acceptType.includes("audio")) {
101
+ acceptArr.push("audio/*");
102
+ }
103
+ if (props.acceptType.includes("text")) {
104
+ acceptArr.push("text/plain");
105
+ }
106
+ if (props.acceptType.includes("doc")) {
107
+ acceptArr.push(".doc");
108
+ acceptArr.push(".docx");
109
+ }
110
+ if (props.acceptType.includes("xls")) {
111
+ acceptArr.push(".xls");
112
+ acceptArr.push(".xlsx");
113
+ }
114
+ if (props.acceptType.includes("ppt")) {
115
+ acceptArr.push(".ppt");
116
+ acceptArr.push(".pptx");
117
+ }
118
+ if (props.acceptType.includes("pdf")) {
119
+ acceptArr.push("application/pdf");
120
+ }
121
+ if (props.acceptType.includes("zip")) {
122
+ acceptArr.push("application/zip");
123
+ acceptArr.push("application/x-rar-compressed");
124
+ }
125
+ return acceptArr.join(",");
126
+ });
127
+ const validators = {
128
+ image: (file) => isImage(file),
129
+ video: (file) => file.type.startsWith("video/"),
130
+ audio: (file) => file.type.startsWith("audio/"),
131
+ text: (file) => file.type === "text/plain",
132
+ doc: (file) => [".doc", ".docx"].some((ext) => file.name.endsWith(ext)),
133
+ xls: (file) => [".xls", ".xlsx"].some((ext) => file.name.endsWith(ext)),
134
+ ppt: (file) => [".ppt", ".pptx"].some((ext) => file.name.endsWith(ext)),
135
+ pdf: (file) => file.type === "application/pdf",
136
+ zip: (file) => ["application/zip", "application/x-rar-compressed"].includes(file.type)
137
+ };
138
+ const isImage = (file) => {
139
+ return ["image/jpeg", "image/png", "image/gif", "image/svg+xml"].includes(
140
+ file == null ? void 0 : file.type
141
+ );
142
+ };
143
+ const typeChineseMap = {
144
+ image: "图片",
145
+ video: "视频",
146
+ audio: "音频",
147
+ text: "文本",
148
+ doc: "Word文档",
149
+ xls: "Excel文档",
150
+ ppt: "PowerPoint文档",
151
+ pdf: "PDF文档",
152
+ zip: "压缩包"
153
+ };
154
+ const beforeRead = (file) => {
155
+ for (const type of props.acceptType) {
156
+ if (validators[type] && !validators[type](file)) {
157
+ functionCall.showToast(`上传的文件不是有效的${typeChineseMap[type]}`);
158
+ return false;
159
+ }
160
+ }
161
+ return true;
162
+ };
163
+ const afterRead = (file) => {
164
+ if (!props.autoUpload) {
165
+ return;
166
+ }
167
+ file.status = "uploading";
168
+ file.message = "上传中...";
169
+ const dataSource = dataSourceUtil.useDataSource(props.dataSource);
170
+ dataSource == null ? void 0 : dataSource.load({ file: file.file, ...props.dataSourceParams }).then((res) => {
171
+ file.status = "done";
172
+ }).catch((err) => {
173
+ file.status = "failed";
174
+ file.message = "上传失败";
175
+ });
176
+ };
177
+ const onOversize = (file) => {
178
+ console.log(file);
179
+ functionCall.showToast(`文件大小不能超过 ${props.maxSize}kb`);
180
+ };
181
+ return (_ctx, _cache) => {
182
+ const _component_van_icon = index$1.Icon;
183
+ const _component_van_uploader = index.Uploader;
184
+ return vue.openBlock(), vue.createBlock(_component_van_uploader, vue.mergeProps({ class: "fac-uploader" }, _ctx.$attrs, {
185
+ modelValue: vue.unref(fileList),
186
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(fileList) ? fileList.value = $event : null),
187
+ accept: vue.unref(accept),
188
+ "after-read": afterRead,
189
+ "before-read": beforeRead,
190
+ onOversize,
191
+ "max-size": vue.unref(compMaxSize),
192
+ "result-type": "file",
193
+ "preview-size": __props.previewSize + "px"
194
+ }), vue.createSlots({
195
+ "preview-cover": vue.withCtx(({ file, name }) => [
196
+ isImage(file) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, vue.toDisplayString((file == null ? void 0 : file.name) || ""), 1)) : name ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, vue.toDisplayString(name), 1)) : vue.createCommentVNode("", true)
197
+ ]),
198
+ "preview-delete": vue.withCtx(() => [
199
+ !__props.readonly ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
200
+ vue.createVNode(_component_van_icon, {
201
+ name: "cross",
202
+ class: "van-uploader__preview-delete-icon"
203
+ })
204
+ ])) : vue.createCommentVNode("", true)
205
+ ]),
206
+ _: 2
207
+ }, [
208
+ vue.renderList(_ctx.$slots, (item, key) => {
209
+ return {
210
+ name: key,
211
+ fn: vue.withCtx(() => [
212
+ key != "preview-cover" && key != "preview-delete" ? vue.renderSlot(_ctx.$slots, key, { key: 0 }, void 0, true) : vue.createCommentVNode("", true)
213
+ ])
214
+ };
215
+ })
216
+ ]), 1040, ["modelValue", "accept", "max-size", "preview-size"]);
217
+ };
218
+ }
219
+ };
220
+ const _Uploader = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-29fd81a1"]]);
32
221
  exports.default = _Uploader;