@ebiz/designer-components 0.0.18-kzy.5 → 0.0.18-kzy.6

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/dist/index.mjs CHANGED
@@ -126715,7 +126715,7 @@ const {
126715
126715
  formToJSON: f$t,
126716
126716
  getAdapter: h$t,
126717
126717
  mergeConfig: p$t
126718
- } = $r, sy = "http://localhost:8090/api", yb = $r.create({
126718
+ } = $r, sy = "http://" + window.location.host + "/api", yb = $r.create({
126719
126719
  baseURL: sy,
126720
126720
  timeout: 3e4,
126721
126721
  headers: {
@@ -126955,9 +126955,16 @@ const ps = {
126955
126955
  "BATCH_DEL_DATA",
126956
126956
  "MULTIPLE_DATA_LINK_SEARCH"
126957
126957
  ], i = t, { text: o, isNormal: a, disabled: l, type: s, size: u, apiConfig: c, data: d, isUseMethod: f } = ot(n), h = re("请先设置接口配置"), p = () => {
126958
- n.onClick(), !a.value && c.value.apiId && (n.onPrepare(), ps.fetch(d.value, { key: c.value.key, apiId: c.value.apiId, apiType: r[c.value.apiType] }).then((v) => {
126959
- i("click", v), n.onFinish();
126960
- }));
126958
+ if (n.onClick(), !(a.value || !isValidApiConfig()))
126959
+ try {
126960
+ if (n.onPrepare() === !1)
126961
+ return null;
126962
+ ps.fetch(d.value, { key: c.value.key, apiId: c.value.apiId, apiType: r[c.value.apiType] }).then((m) => {
126963
+ i("click", m), n.onFinish();
126964
+ });
126965
+ } catch (v) {
126966
+ n.onError(v);
126967
+ }
126961
126968
  };
126962
126969
  return (v, m) => (T(), se(ht(Xn), {
126963
126970
  content: !ht(a) && !ht(c).apiId ? h.value : "",
@@ -138108,7 +138115,7 @@ const uDt = /* @__PURE__ */ Rt(rMt, [["render", iMt], ["__scopeId", "data-v-491f
138108
138115
  size: {
138109
138116
  type: String,
138110
138117
  default: "",
138111
- validator: (e) => ["small", "medium", "large"].includes(e)
138118
+ validator: (e) => ["small", "medium", "large", ""].includes(e)
138112
138119
  },
138113
138120
  /**
138114
138121
  * 空数据文本
@@ -138216,9 +138223,8 @@ const uDt = /* @__PURE__ */ Rt(rMt, [["render", iMt], ["__scopeId", "data-v-491f
138216
138223
  (T(!0), R(Te, null, Je(d.value, (w) => (T(), se(ht(al), {
138217
138224
  key: w.value,
138218
138225
  value: w.value,
138219
- label: w.label,
138220
- onClick: (k) => y.handleClick(w.value)
138221
- }, null, 8, ["value", "label", "onClick"]))), 128))
138226
+ label: w.label
138227
+ }, null, 8, ["value", "label"]))), 128))
138222
138228
  ]),
138223
138229
  _: 2
138224
138230
  }, [
@@ -138238,7 +138244,7 @@ const uDt = /* @__PURE__ */ Rt(rMt, [["render", iMt], ["__scopeId", "data-v-491f
138238
138244
  } : void 0
138239
138245
  ]), 1032, ["modelValue", "loading", "multiple", "placeholder", "clearable", "disabled", "size", "empty", "popupProps"]));
138240
138246
  }
138241
- }), CDt = /* @__PURE__ */ Rt(e9t, [["__scopeId", "data-v-e1cae77a"]]), t9t = {
138247
+ }), CDt = /* @__PURE__ */ Rt(e9t, [["__scopeId", "data-v-9da31a27"]]), t9t = {
138242
138248
  name: "EbizTimeline"
138243
138249
  }, n9t = /* @__PURE__ */ Object.assign(t9t, {
138244
138250
  props: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebiz/designer-components",
3
- "version": "0.0.18-kzy.5",
3
+ "version": "0.0.18-kzy.6",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -8,9 +8,9 @@ import axios from 'axios'
8
8
  import { TinyNotify } from '@opentiny/vue'
9
9
 
10
10
  // 本地开发使用
11
- const API_BASE_URL = "http://localhost:8090/api";
11
+ // const API_BASE_URL = "http://localhost:8090/api";
12
12
  // 组件发布使用
13
- // const API_BASE_URL = 'http://' + window.location.host + '/api'
13
+ const API_BASE_URL = 'http://' + window.location.host + '/api'
14
14
 
15
15
  /**
16
16
  * 创建axios实例
@@ -90,12 +90,24 @@ const tooltipText = ref('请先设置接口配置')
90
90
 
91
91
  const click = () => {
92
92
  props.onClick()
93
- if (!isNormal.value && apiConfig.value.apiId) {
94
- props.onPrepare()
93
+ // 如果是普通按钮或API配置无效,不调用接口
94
+ if (isNormal.value || !isValidApiConfig()) {
95
+ return
96
+ }
97
+
98
+ try {
99
+ // 调用前置处理并获取返回值
100
+ const shouldContinue = props.onPrepare()
101
+ if (shouldContinue === false) {
102
+ return null
103
+ }
104
+
95
105
  dataService.fetch(data.value, { key: apiConfig.value.key, apiId: apiConfig.value.apiId, apiType: apiMap[apiConfig.value.apiType] }).then((res) => {
96
106
  emit('click', res)
97
107
  props.onFinish()
98
108
  })
109
+ } catch (error) {
110
+ props.onError(error)
99
111
  }
100
112
  }
101
113
 
@@ -2,8 +2,7 @@
2
2
  <t-select ref="selectRef" v-model="selectedValue" :loading="loading" :filterable="true" @search="handleRemoteSearch"
3
3
  :multiple="multiple" :placeholder="placeholder" :clearable="clearable" :disabled="disabled" :size="size"
4
4
  :empty="emptyText" :popupProps="popupProps" @change="handleChange" @focus="handleFocus" @blur="handleBlur">
5
- <t-option v-for="item in options" :key="item.value" :value="item.value" :label="item.label"
6
- @click="handleClick(item.value)"></t-option>
5
+ <t-option v-for="item in options" :key="item.value" :value="item.value" :label="item.label"></t-option>
7
6
  <template #prefixIcon v-if="$slots.prefix">
8
7
  <slot name="prefix"></slot>
9
8
  </template>
@@ -98,7 +97,7 @@ const props = defineProps({
98
97
  size: {
99
98
  type: String,
100
99
  default: '',
101
- validator: (val) => ['small', 'medium', 'large'].includes(val)
100
+ validator: (val) => ['small', 'medium', 'large', ''].includes(val)
102
101
  },
103
102
  /**
104
103
  * 空数据文本