zhytech-ui-mobile 1.1.10 → 1.1.12

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.
package/README.md CHANGED
@@ -79,6 +79,16 @@ npm install --legacy-peer-deps
79
79
 
80
80
  > #### 版本更新清单:
81
81
 
82
+ **V 1.1.12**
83
+ ```html
84
+ 1.修复动态表单结果返回时,复选框、单选框选值的itemSourceType取错问题
85
+ ```
86
+
87
+ **V 1.1.11**
88
+ ```html
89
+ 1.调整动态接口设置画面,新增baseUrlFromProps参数,用于从props中获取baseUrl
90
+ ```
91
+
82
92
  **V 1.1.10**
83
93
  ```html
84
94
  1.修复人员组件多显示下拉框问题
@@ -6,6 +6,10 @@ export interface httpSettingView {
6
6
  * HTTP请求类型
7
7
  */
8
8
  eventType: string;
9
+ /**
10
+ * 是否从组件属性中获取基础URL
11
+ */
12
+ baseUrlFromProps: boolean;
9
13
  /**
10
14
  * HTTP基础URL
11
15
  */
@@ -72,8 +72,9 @@ export declare function useUtils(): {
72
72
  * @description: 调用api
73
73
  * @param httpSetting 接口配置
74
74
  * @param datas 接口参数替换数据
75
+ * @param baseUrl 接口基础URL
75
76
  * @param autoDealResult 是否自动处理结果
76
77
  * @return
77
78
  */
78
- callApi(httpSetting: httpSettingView, datas: Record<string, any>, autoDealResult?: boolean): Promise<any>;
79
+ callApi(httpSetting: httpSettingView, datas: Record<string, any>, baseUrl?: string, autoDealResult?: boolean): Promise<any>;
79
80
  };
@@ -17006,16 +17006,26 @@ function useUtils() {
17006
17006
  * @description: 调用api
17007
17007
  * @param httpSetting 接口配置
17008
17008
  * @param datas 接口参数替换数据
17009
+ * @param baseUrl 接口基础URL
17009
17010
  * @param autoDealResult 是否自动处理结果
17010
17011
  * @return
17011
17012
  */
17012
- async callApi(httpSetting, datas, autoDealResult) {
17013
+ async callApi(httpSetting, datas, baseUrl, autoDealResult) {
17013
17014
  var _a2, _b2;
17014
- if (isEmpty(httpSetting) || !httpSetting.baseUrl || !httpSetting.functionUrl) {
17015
- return {};
17015
+ let responseData = {};
17016
+ if (isEmpty(httpSetting) || !httpSetting.functionUrl) {
17017
+ return responseData;
17018
+ }
17019
+ let httpUrl = httpSetting.baseUrl;
17020
+ if (httpSetting.baseUrlFromProps && baseUrl) {
17021
+ httpUrl = baseUrl;
17022
+ }
17023
+ if (!httpUrl) {
17024
+ showToast2("error", "动态获取数据的接口基础url为空,请检查模板配置!");
17025
+ return responseData;
17016
17026
  }
17017
- const flag = httpSetting.baseUrl.endsWith("/") || httpSetting.functionUrl.startsWith("/");
17018
- const url = `${httpSetting.baseUrl}${flag ? "" : "/"}${httpSetting.functionUrl}`;
17027
+ const flag = httpUrl.endsWith("/") || httpSetting.functionUrl.startsWith("/");
17028
+ const url = `${httpUrl}${flag ? "" : "/"}${httpSetting.functionUrl}`;
17019
17029
  let params = {};
17020
17030
  if (!isEmpty(httpSetting.parameters)) {
17021
17031
  (_a2 = httpSetting.parameters) == null ? void 0 : _a2.forEach((item) => {
@@ -17026,7 +17036,7 @@ function useUtils() {
17026
17036
  });
17027
17037
  }
17028
17038
  try {
17029
- const responseData = await new Promise((resolve2, reject2) => {
17039
+ responseData = await new Promise((resolve2, reject2) => {
17030
17040
  if (httpSetting.loading) {
17031
17041
  showLoading({ title: httpSetting.loadingText || "加载中...", mask: true });
17032
17042
  }
@@ -17046,7 +17056,7 @@ function useUtils() {
17046
17056
  });
17047
17057
  });
17048
17058
  if (responseData.code !== 1) {
17049
- showToast2("error", responseData.message || "接口调用失败");
17059
+ showToast2("error", responseData.message);
17050
17060
  return responseData;
17051
17061
  }
17052
17062
  let data2 = formatDateTimeRecursively(responseData.data);
@@ -17117,6 +17127,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
17117
17127
  const props = __props;
17118
17128
  const formType = inject("formType");
17119
17129
  const everyItemDisplayAnalysisSwitch = inject("everyItemDisplayAnalysisSwitch");
17130
+ const httpBaseUrl = inject("httpBaseUrl");
17120
17131
  const displayAnswerDescription = ref(false);
17121
17132
  const { datas, componentProps } = toRefs(props);
17122
17133
  const emits = __emit;
@@ -17134,7 +17145,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
17134
17145
  if (isEmpty(httpSetting)) {
17135
17146
  return;
17136
17147
  }
17137
- await callApi(httpSetting, datas.value, true);
17148
+ await callApi(httpSetting, datas.value, httpBaseUrl, true);
17138
17149
  };
17139
17150
  return (_ctx, _cache) => {
17140
17151
  const _component_wd_icon = resolveEasycom(resolveDynamicComponent("wd-icon"), __easycom_0$5);
@@ -23084,6 +23095,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
23084
23095
  setup(__props, { emit: __emit }) {
23085
23096
  const props = __props;
23086
23097
  const formType = inject("formType");
23098
+ const httpBaseUrl = inject("httpBaseUrl");
23087
23099
  const { datas, componentProps } = toRefs(props);
23088
23100
  const emits = __emit;
23089
23101
  watch(datas, (newValue) => emits("update:datas", newValue));
@@ -23133,7 +23145,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
23133
23145
  if (!httpSetting) {
23134
23146
  return;
23135
23147
  }
23136
- initEmployeeOptions.value = await callApi(httpSetting, datas.value, false) ?? [];
23148
+ initEmployeeOptions.value = await callApi(httpSetting, datas.value, httpBaseUrl, false) ?? [];
23137
23149
  employeeOptions.value = initEmployeeOptions.value;
23138
23150
  componentProps.value.remoteFlag && await init4();
23139
23151
  };
@@ -23153,7 +23165,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
23153
23165
  newHttpSetting.parameters[index2].value = filterValue;
23154
23166
  }
23155
23167
  });
23156
- const options = await callApi(newHttpSetting, datas.value, false) ?? [];
23168
+ const options = await callApi(newHttpSetting, datas.value, httpBaseUrl, false) ?? [];
23157
23169
  if (addFlag) {
23158
23170
  employeeOptions.value = [...employeeOptions.value, ...options];
23159
23171
  } else {
@@ -26514,6 +26526,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
26514
26526
  showCorrectOrNot: {
26515
26527
  type: Boolean,
26516
26528
  default: false
26529
+ },
26530
+ /**
26531
+ * 接口基础路径
26532
+ */
26533
+ httpBaseUrl: {
26534
+ type: String,
26535
+ default: ""
26517
26536
  }
26518
26537
  },
26519
26538
  emits: ["change", "switchPage"],
@@ -26524,14 +26543,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
26524
26543
  const props = __props;
26525
26544
  const emits = __emit;
26526
26545
  const { formData, onePageItemFlag } = toRefs(props);
26527
- provide("realTimeDisplayAnswerMode", props.realTimeDisplayAnswerMode);
26528
- provide("everyItemDisplayAnalysisSwitch", props.everyItemDisplayAnalysisSwitch);
26529
- provide("uploadOptions", props.uploadOptions);
26530
- provide("formData", formData);
26531
26546
  provide(
26532
26547
  "formType",
26533
26548
  computed(() => formData.value.props.formType)
26534
26549
  );
26550
+ provide("uploadOptions", props.uploadOptions);
26551
+ provide("formData", formData);
26552
+ provide("realTimeDisplayAnswerMode", props.realTimeDisplayAnswerMode);
26553
+ provide("everyItemDisplayAnalysisSwitch", props.everyItemDisplayAnalysisSwitch);
26554
+ provide("httpBaseUrl", props.httpBaseUrl);
26535
26555
  const theme2 = inject("theme", ref({}));
26536
26556
  const themeVars = ref({});
26537
26557
  watch(
@@ -26622,7 +26642,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
26622
26642
  case "radio":
26623
26643
  const radioOption = (_b2 = (_a2 = component.props) == null ? void 0 : _a2.options) == null ? void 0 : _b2.find((option) => option.value === data2[componentID]);
26624
26644
  resultData.push({
26625
- sourceType: component.itemSourceType,
26645
+ sourceType: radioOption.itemSourceType,
26626
26646
  pageID,
26627
26647
  groupID,
26628
26648
  parentID: componentID,
@@ -26637,7 +26657,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
26637
26657
  var _a3, _b3;
26638
26658
  const checkboxOption = (_b3 = (_a3 = component.props) == null ? void 0 : _a3.options) == null ? void 0 : _b3.find((option) => option.value === value);
26639
26659
  resultData.push({
26640
- sourceType: component.itemSourceType,
26660
+ sourceType: checkboxOption.itemSourceType,
26641
26661
  pageID,
26642
26662
  groupID,
26643
26663
  parentID: componentID,