bl-common-vue3 3.8.47 → 3.8.49

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bl-common-vue3",
3
- "version": "3.8.47",
3
+ "version": "3.8.49",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "description": "bailing vue3 common components lib",
@@ -33,7 +33,6 @@
33
33
  "tinymce": "^6.0.0",
34
34
  "@tinymce/tinymce-vue": "^5.1.0",
35
35
  "vuedraggable": "^4.1.0",
36
- "qrcode.vue": "^3.3.3",
37
36
  "file-saver": "^2.0.5",
38
37
  "style-resources-loader": "^1.5.0"
39
38
  },
@@ -1620,6 +1620,11 @@ export default defineComponent({
1620
1620
  type: Boolean,
1621
1621
  default: false,
1622
1622
  },
1623
+ // 导入成功后的回调
1624
+ importSuccessCallback: {
1625
+ type: Function,
1626
+ default: () => {},
1627
+ },
1623
1628
  },
1624
1629
  components: {
1625
1630
  PlusOutlined,
@@ -2680,7 +2685,10 @@ export default defineComponent({
2680
2685
  getDictionaryMap();
2681
2686
  };
2682
2687
 
2683
- const handleImportSuccess = () => {
2688
+ const handleImportSuccess = async () => {
2689
+ if(props.importSuccessCallback && typeof props.importSuccessCallback === 'function'){
2690
+ await props.importSuccessCallback();
2691
+ }
2684
2692
  loadData();
2685
2693
  state.importVisible = false;
2686
2694
  };
@@ -3231,34 +3239,32 @@ export default defineComponent({
3231
3239
 
3232
3240
  const handleApprovalClick = (alias) => {
3233
3241
  state.getApprovalProcess = false;
3234
- if (window.__MICRO_APP_ENVIRONMENT__) {
3235
- let urlParams = `${props.approvalProcessType}=${alias}`;
3236
- window.microApp.forceDispatch({
3237
- type: "SetChildDrawerList",
3238
- info: {
3239
- props: {
3240
- title: t("CustomTable.index.909124-2"),
3241
- maskCloseable: true,
3242
- visible: true,
3243
- closable: true,
3244
- width: 1200,
3245
- bodyStyle: {
3246
- padding: "15px",
3247
- background: "#fff",
3248
- height: "100%",
3249
- },
3250
- destroyOnClose: true,
3251
- },
3252
- microId: "org_workApproval_ApprovalProcessDesign",
3253
- app: "workApproval",
3254
- url: `/approval/processDesignMain?${urlParams}`,
3255
- params: {
3256
- isMainDrawer: true,
3257
- closeDesign: () => {},
3242
+ let urlParams = `${props.approvalProcessType}=${alias}`;
3243
+ window.microApp.forceDispatch({
3244
+ type: "SetChildDrawerList",
3245
+ info: {
3246
+ props: {
3247
+ title: t("CustomTable.index.909124-2"),
3248
+ maskCloseable: true,
3249
+ visible: true,
3250
+ closable: true,
3251
+ width: 1200,
3252
+ bodyStyle: {
3253
+ padding: "15px",
3254
+ background: "#fff",
3255
+ height: "100%",
3258
3256
  },
3257
+ destroyOnClose: true,
3259
3258
  },
3260
- });
3261
- }
3259
+ microId: "org_workApproval_ApprovalProcessDesign",
3260
+ app: "workApproval",
3261
+ url: `/approval/processDesignMain?${urlParams}`,
3262
+ params: {
3263
+ isMainDrawer: true,
3264
+ closeDesign: () => {},
3265
+ },
3266
+ },
3267
+ });
3262
3268
  };
3263
3269
 
3264
3270
  const i18nMapShow = computed(() => {
@@ -19,7 +19,7 @@
19
19
  :src="urls"
20
20
  :style="{ width: size + 'px', height: size + 'px' }"
21
21
  />
22
- <qrcode-vue v-else :value="urls" :size="size" id="h5Qrcode" />
22
+ <img v-else :src="qrImgUrl" :style="{ width: size + 'px', height: size + 'px' }" />
23
23
  <div class="qrcode-btn">
24
24
  <Button
25
25
  v-if="download && type == 'url'"
@@ -49,11 +49,10 @@
49
49
  :src="url"
50
50
  :style="{ width: size + 'px', height: size + 'px' }"
51
51
  />
52
- <qrcode-vue
52
+ <img
53
53
  v-else
54
- :value="url"
55
- :size="size"
56
- :id="'h5Qrcode_' + index"
54
+ :src="qrImgUrls[index]"
55
+ :style="{ width: size + 'px', height: size + 'px' }"
57
56
  />
58
57
  <div class="qrcode-btn">
59
58
  <Button
@@ -79,17 +78,16 @@
79
78
  </template>
80
79
 
81
80
  <script>
82
- import { defineComponent, reactive, toRefs, watch, computed } from "@vue/runtime-core";
81
+ import { defineComponent, reactive, toRefs, watch, computed, ref } from "@vue/runtime-core";
83
82
  import { Modal, Row, Col, Button, message } from "ant-design-vue";
84
- import QrcodeVue from "qrcode.vue";
85
83
  import {t, loadLanguageAsync} from "../../locale";
86
84
  import utils from "../../common/utils/util";
87
85
  import { CopyOutlined, DownloadOutlined } from '@ant-design/icons-vue';
88
86
 
89
87
  export default defineComponent({
90
88
  name: "QrcodeModal",
89
+ emits: ["cancel", "request"],
91
90
  components: {
92
- QrcodeVue,
93
91
  Modal,
94
92
  Row,
95
93
  Col,
@@ -140,6 +138,9 @@ export default defineComponent({
140
138
  colNum: 24,
141
139
  });
142
140
 
141
+ const qrImgUrl = ref("");
142
+ const qrImgUrls = ref([]);
143
+
143
144
  const titleProps = computed(() => {
144
145
  return props.title || t('QrcodeModal.index.612016-1')
145
146
  });
@@ -148,16 +149,44 @@ export default defineComponent({
148
149
  emit("cancel");
149
150
  };
150
151
 
151
- const downloadCode = (index) => {
152
+ const downloadCode = async (index) => {
153
+ const imgUrl = index === -1 ? qrImgUrl.value : qrImgUrls.value[index];
154
+ if (!imgUrl) return;
155
+ const response = await fetch(imgUrl);
156
+ const blob = await response.blob();
157
+ const url = URL.createObjectURL(blob);
152
158
  const a = document.createElement("a");
153
- const id = index === -1 ? "h5Qrcode" : "h5Qrcode_" + index;
154
- const image = document
155
- .getElementById(id)
156
- .toDataURL("image/png")
157
- .replace("image/png", "image/octet-stream");
158
- a.href = image;
159
+ a.href = url;
159
160
  a.download = `${titleProps.value || "pic"}.png`;
161
+ document.body.appendChild(a);
160
162
  a.click();
163
+ document.body.removeChild(a);
164
+ URL.revokeObjectURL(url);
165
+ };
166
+
167
+ const fetchQrImages = () => {
168
+ const urlList = typeof props.urls === 'string' ? [props.urls] : [...props.urls];
169
+ qrImgUrl.value = "";
170
+ qrImgUrls.value = [];
171
+
172
+ urlList.forEach((url, index) => {
173
+ emit("request", {
174
+ params: {
175
+ method: "get",
176
+ server: "/public",
177
+ url: "/qrcode",
178
+ extra: { qrCode: url },
179
+ },
180
+ success: (res) => {
181
+ if (typeof props.urls === 'string') {
182
+ qrImgUrl.value = res.url;
183
+ } else {
184
+ qrImgUrls.value[index] = res.url;
185
+ qrImgUrls.value = [...qrImgUrls.value];
186
+ }
187
+ },
188
+ });
189
+ });
161
190
  };
162
191
 
163
192
  const init = () => {
@@ -173,6 +202,9 @@ export default defineComponent({
173
202
  (val) => {
174
203
  if (val) {
175
204
  init();
205
+ if (props.type === 'url') {
206
+ fetchQrImages();
207
+ }
176
208
  }
177
209
  }
178
210
  );
@@ -198,6 +230,8 @@ export default defineComponent({
198
230
  return {
199
231
  t,
200
232
  ...toRefs(state),
233
+ qrImgUrl,
234
+ qrImgUrls,
201
235
  titleProps,
202
236
  handleClose,
203
237
  downloadCode,