resolver-egretimp-plus 0.1.89 → 0.1.91

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.
@@ -19,6 +19,13 @@
19
19
  * @license MIT
20
20
  */
21
21
 
22
+ /*!
23
+ * clipboard.js v2.0.11
24
+ * https://clipboardjs.com/
25
+ *
26
+ * Licensed MIT © Zeno Rocha
27
+ */
28
+
22
29
  /*! https://mths.be/punycode v1.4.1 by @mathias */
23
30
 
24
31
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.1.89",
3
+ "version": "0.1.91",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -57,6 +57,7 @@
57
57
  "webpack-cli": "^5.1.4"
58
58
  },
59
59
  "dependencies": {
60
- "@popperjs/core": "^2.11.8"
60
+ "@popperjs/core": "^2.11.8",
61
+ "clipboard": "^2.0.11"
61
62
  }
62
63
  }
@@ -1,4 +1,3 @@
1
- import { isPromise } from '../utils'
2
1
  import { ready } from './udc-sdk-esm/cjs'
3
2
 
4
3
  export const SUBMIT_TYPE = {
@@ -37,6 +36,8 @@ export const MESSAGE_TYPE = {
37
36
  export let bpmInstance = null
38
37
 
39
38
  export class Bpm {
39
+ commonActionKey = 'common'
40
+ showCopyModalCb = null
40
41
  params = {}
41
42
  bpmConfigs = {
42
43
  // getDetailReq, // 保存成功之后获取详情传递的数据
@@ -66,7 +67,7 @@ export class Bpm {
66
67
  window.addEventListener("message", this.messageListener.bind(this))
67
68
  }
68
69
  setNativeMethods() {
69
- const { validate: nativeValidate, dynamicMapComp, bpmSubmitBtn, toExecuteLoadServices } = this.params
70
+ const { validate: nativeValidate, dynamicMapComp, bpmSubmitBtn, toExecuteLoadServices, messageInstance } = this.params
70
71
  const { getDetailReq, customValidate, saveValidate } = this.bpmConfigs
71
72
 
72
73
  const toSave = async (eventData) => {
@@ -82,7 +83,37 @@ export class Bpm {
82
83
  return async (ret) => {
83
84
  const { saveAfter } = this.bpmConfigs
84
85
  this.saveResponse = ret
86
+ // ======= 刚开始保存的弹框复制单号逻辑 ===== start======
87
+ const { copyModal, lang, calcShowCopyModal } = this.params
85
88
  try {
89
+ const tipMsgPath = calcShowCopyModal(ret, eventData)
90
+ if (tipMsgPath) {
91
+ const { submitType } = eventData
92
+ this.showCopyModalCb = () => {
93
+ const msgSubmit = lang?.value?.indexOf('zh') > -1 ? '提交成功' : 'Submit Success'
94
+ const msgSave = lang?.value?.indexOf('zh') > -1 ? '保存成功' : 'Save Success'
95
+ const isSubmit = [SUBMIT_TYPE.SEND, SUBMIT_TYPE.SUBMIT, SUBMIT_TYPE.AGREE].includes(submitType)
96
+ const successMsg = isSubmit ? msgSubmit : msgSave
97
+ this.showCopyModalCb = null
98
+
99
+ return new Promise(resolve => {
100
+ copyModal?.({
101
+ lang: lang?.value,
102
+ type: 'check',
103
+ showcopy: true,
104
+ copytype: lang?.value?.indexOf('zh') > -1 ? '申请单号' : 'Application No.',
105
+ copymsg: tipMsgPath,
106
+ showCancle: false,
107
+ msg: successMsg,
108
+ handleOk: async () => {
109
+ resolve(true)
110
+ }
111
+ })
112
+ })
113
+ }
114
+ }
115
+ // ======= 刚开始保存的弹框复制单号逻辑 ===== end======
116
+
86
117
  await saveAfter?.(ret, eventData)
87
118
  } catch (error) {
88
119
  console.error('saveAfter error, error:', error)
@@ -99,7 +130,7 @@ export class Bpm {
99
130
  })
100
131
  })
101
132
  } else {
102
- messageInstance?.warning?.('no set bpmSubmitBtn, or bpmSubmitBtn is invalid, at preset, bpmSubmitBtn:', props.bpmSubmitBtn)
133
+ messageInstance?.warning?.('no set bpmSubmitBtn, or bpmSubmitBtn is invalid.')
103
134
  }
104
135
  }
105
136
  const getDetail = () => {
@@ -148,6 +179,9 @@ export class Bpm {
148
179
  if (MESSAGE_TYPE.GET_FORM_DATA === messageType) {
149
180
  // 如果有传入这个类型操作,就用传递进来的这个操作
150
181
  let action = this.actions?.[submitType]?.formAction
182
+ if (!action) {
183
+ action = this.actions?.[this.commonActionKey]?.formAction
184
+ }
151
185
  if (!action) {
152
186
  action = this.getDefaultAction(eventData)
153
187
  }
@@ -174,8 +208,12 @@ export class Bpm {
174
208
  let closeFlag = true
175
209
  closeFlag = ![SUBMIT_TYPE.PROCESS_SHOW, SUBMIT_TYPE.BACK, SUBMIT_TYPE.DRAFT_HANDLE].includes(submitType)
176
210
 
211
+ await this.showCopyModalCb?.()
177
212
  // 如果有传入这个类型操作,就用传递进来的这个操作
178
213
  let action = this.actions?.[submitType]?.successAction
214
+ if (!action) {
215
+ action = this.actions?.[this.commonActionKey]?.successAction
216
+ }
179
217
  if (!action) {
180
218
  action = this.getDefaultAction(eventData)
181
219
  }
@@ -242,7 +280,7 @@ export class Bpm {
242
280
  case SUBMIT_TYPE.SEND:
243
281
  case SUBMIT_TYPE.SUBMIT:
244
282
  case SUBMIT_TYPE.AGREE:
245
- return async (eventData) => {
283
+ return async () => {
246
284
  const { validate, toSave, getDetail } = this.nativeMethods
247
285
  const valid = await validate(eventData)
248
286
  if (valid) {
@@ -261,7 +299,7 @@ export class Bpm {
261
299
  case SUBMIT_TYPE.GIVE:
262
300
  case SUBMIT_TYPE.DRAFT_HANDLE:
263
301
  case SUBMIT_TYPE.MULTI_COOPERATE:
264
- return async (eventData) => {
302
+ return async () => {
265
303
  const actionType = eventData?.bpmInfo?.actionType
266
304
  const { toSave, getDetail } = this.nativeMethods
267
305
  if (!actionType) {
@@ -430,22 +430,22 @@ export function openDailg({
430
430
  // 定义的弹框打开前钩子
431
431
  const configBeforeOpenDialog = compConfig?.beforeOpenDialog
432
432
  const paramsBeforeOpenDialog = beforeOpenDialog
433
- if (configBeforeOpenDialog || paramsBeforeOpenDialog) {
434
- beforeOpenDialog = async (...arg) => {
435
- bpmInstance?.changeSlide?.(false)
436
- let beforeOpenDialogRet = true
437
- if (paramsBeforeOpenDialog) {
438
- beforeOpenDialogRet = paramsBeforeOpenDialog?.(...arg)
439
- }
440
- const beforeOpenDialogRetValid = await beforeOpenDialogRet
441
- if (beforeOpenDialogRetValid === false) {
442
- return false
443
- }
444
- if (configBeforeOpenDialog) {
445
- return configBeforeOpenDialog?.(...arg)
446
- } else {
447
- return true
448
- }
433
+ // if (configBeforeOpenDialog || paramsBeforeOpenDialog) {
434
+ // }
435
+ beforeOpenDialog = async (...arg) => {
436
+ bpmInstance?.changeSlide?.(false)
437
+ let beforeOpenDialogRet = true
438
+ if (paramsBeforeOpenDialog) {
439
+ beforeOpenDialogRet = paramsBeforeOpenDialog?.(...arg)
440
+ }
441
+ const beforeOpenDialogRetValid = await beforeOpenDialogRet
442
+ if (beforeOpenDialogRetValid === false) {
443
+ return false
444
+ }
445
+ if (configBeforeOpenDialog) {
446
+ return configBeforeOpenDialog?.(...arg)
447
+ } else {
448
+ return true
449
449
  }
450
450
  }
451
451
  let beforeOpenDialogRet = true
@@ -480,12 +480,12 @@ export function openDailg({
480
480
  // 打开弹框-确认后的钩子
481
481
  const configAfterOpenDialog = compConfig?.afterOpenDialog
482
482
  const paramsAfterOpenDialog = afterOpenDialog
483
- if (configAfterOpenDialog || paramsAfterOpenDialog) {
484
- afterOpenDialog = async (...arg) => {
485
- bpmInstance?.changeSlide?.(true)
486
- paramsAfterOpenDialog?.(...arg)
487
- configAfterOpenDialog?.(...arg)
488
- }
483
+ // if (configAfterOpenDialog || paramsAfterOpenDialog) {
484
+ // }
485
+ afterOpenDialog = async (...arg) => {
486
+ bpmInstance?.changeSlide?.(true)
487
+ paramsAfterOpenDialog?.(...arg)
488
+ configAfterOpenDialog?.(...arg)
489
489
  }
490
490
  afterOpenDialog && afterOpenDialog({
491
491
  dynamicMapComp,
@@ -0,0 +1,9 @@
1
+ import { render, createVNode } from 'vue';
2
+ import modalObj from './modal.vue'
3
+ export const copyModal = (props = {}) => {
4
+ const container = document.createElement('div')
5
+ const vnode = createVNode(modalObj, props);
6
+ render(vnode, container);
7
+ const instance = vnode.component;
8
+ document.body.appendChild(container);
9
+ }
@@ -0,0 +1,195 @@
1
+ .warning-modal {
2
+ .warning-modal-backdrop {
3
+ position: fixed;
4
+ top: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ left: 0;
8
+ z-index: 106000;
9
+ background-color: #000;
10
+ transition: all .3s;
11
+ opacity: 0.5;
12
+ visibility: initial;
13
+ }
14
+
15
+ .warning-modal {
16
+
17
+ position: fixed;
18
+ top: 0;
19
+ right: 0;
20
+ bottom: 0;
21
+ left: 0;
22
+ display: block;
23
+ z-index: 106000;
24
+ outline: 0;
25
+
26
+ .warning-modal-dialog {
27
+ position: relative;
28
+ width: 900px;
29
+ margin: 100px auto;
30
+ -webkit-transform: translate(0);
31
+ transform: translate(0);
32
+
33
+ .warning-modal-content {
34
+ .warning-icon {
35
+ i.aid::before {
36
+ color: #3271FE;
37
+ }
38
+ }
39
+
40
+ .waring-btn {
41
+
42
+ span,
43
+ div {
44
+ &:first-child {
45
+ background-color: #D0D3D6 !important;
46
+ }
47
+ }
48
+
49
+ .yes:last-child {
50
+ background-color: #3271FE !important;
51
+ }
52
+ }
53
+ }
54
+
55
+ }
56
+
57
+ .warning-tips {
58
+ width: 400px;
59
+ }
60
+
61
+ .warning-modal-content {
62
+ height: auto;
63
+ position: relative;
64
+ display: -webkit-box;
65
+ display: -ms-flexbox;
66
+ display: flex;
67
+ -webkit-box-orient: vertical;
68
+ -webkit-box-direction: normal;
69
+ -ms-flex-direction: column;
70
+ flex-direction: column;
71
+ background-color: #fff;
72
+ background-clip: padding-box;
73
+ border-radius: 4px;
74
+ box-shadow: 0 2px 10px 0 rgba(0, 0, 0, .1);
75
+ outline: 0;
76
+ max-width: calc(100vw - 30px*2);
77
+ max-height: calc(100vh - 30px*2);
78
+
79
+ .warning-icon {
80
+ width: 100%;
81
+ height: auto;
82
+ text-align: center;
83
+ padding: 40px 0px 0px 0px;
84
+
85
+ i {
86
+ font-size: 80px;
87
+ color: #3271FE;
88
+ padding-bottom: 10px;
89
+ }
90
+
91
+ p {
92
+ font-size: 24px;
93
+ color: #3271FE;
94
+ }
95
+ }
96
+
97
+ .waring-cnt {
98
+ width: 100%;
99
+ height: auto;
100
+ text-align: center;
101
+ border-radius: 0 0 0 4px;
102
+ cursor: pointer;
103
+
104
+ p {
105
+ font-size: 18px;
106
+ margin-bottom: 0rem;
107
+
108
+ span:first-child {
109
+ color: #455155;
110
+ opacity: 0.6;
111
+ }
112
+
113
+ span:last-child {
114
+ color: #455155;
115
+ opacity: 0.9;
116
+ }
117
+ }
118
+ }
119
+
120
+ .waring-btn {
121
+ width: 100%;
122
+ overflow: hidden;
123
+ margin-top: 20px;
124
+ cursor: pointer;
125
+
126
+ span {
127
+ display: inline-block;
128
+ width: 100%;
129
+ float: left;
130
+ height: 50px;
131
+ line-height: 50px;
132
+ text-align: center;
133
+ font-size: 18px;
134
+ }
135
+
136
+ .no {
137
+ background: #E5E8E8;
138
+ border-bottom-left-radius: 4px;
139
+ }
140
+
141
+ .yes {
142
+ background: #3271FE;
143
+ color: #fff;
144
+ border-bottom-right-radius: 4px;
145
+
146
+ }
147
+ }
148
+
149
+ .reject-btn {
150
+ margin-top: 0px !important;
151
+
152
+ span {
153
+ width: 50%;
154
+ }
155
+ }
156
+ }
157
+ }
158
+
159
+ .warning-modal-close {
160
+ padding: 10px 10px 0px 0px;
161
+ }
162
+ }
163
+
164
+ ._copymodal {
165
+ .waring-cnt {
166
+ word-break: break-word;
167
+ }
168
+
169
+ .maxheight {
170
+ max-height: 500px;
171
+ overflow-y: auto;
172
+ }
173
+
174
+ .copycontent-l {
175
+ padding-right: 15px;
176
+ }
177
+
178
+ .copycontent-r {
179
+ color: rgb(255, 128, 0) !important;
180
+ max-width: 70%;
181
+ word-break: break-word;
182
+ }
183
+
184
+ .copycontent {
185
+ display: flex;
186
+ justify-content: center;
187
+ cursor: pointer;
188
+ font-size: 18px;
189
+ }
190
+ }
191
+
192
+ .yes {
193
+ white-space: nowrap;
194
+ overflow: hidden;
195
+ }
@@ -0,0 +1,201 @@
1
+ <template>
2
+ <div v-if="modal" class="warning-modal _copymodal">
3
+ <div class="warning-modal-backdrop" />
4
+ <div class="warning-modal">
5
+ <div class="warning-modal-dialog warning-tips">
6
+ <div class="warning-modal-content">
7
+ <div class="warning-icon" style="padding-top: 15px">
8
+ <el-icon v-if="type == 'alert'"><WarningFilled /></el-icon>
9
+ <el-icon v-if="type == 'check'"><SuccessFilled /></el-icon>
10
+ <el-icon v-if="type == 'help'"><QuestionFilled /></el-icon>
11
+ </div>
12
+ <div v-if="msg" class="waring-cnt maxheight">
13
+ <p style="padding: 15px">
14
+ <span>{{ msg }}</span>
15
+ </p>
16
+ </div>
17
+ <div v-else class="waring-cnt" v-html="msgHtml" />
18
+ <div v-if="showcopy" class="copycontent">
19
+ <span class="copycontent-l">{{ copytype }}</span>
20
+ <el-tooltip :content="copytip || (lang === 'zh-CN' ? '点击复制单号' : 'Copy by clicking the order number')">
21
+ <span class="copycontent-r" @click="copyClicked(copymsg)" :data-clipboard-text="copymsg">{{
22
+ copymsg
23
+ }}</span>
24
+ </el-tooltip>
25
+ </div>
26
+ <div v-if="endMsg" class="waring-cnt">
27
+ <p style="padding: 15px">
28
+ <span>{{ endMsg }}</span>
29
+ </p>
30
+ </div>
31
+ <div v-if="endMsgHtml" class="waring-cnt" v-html="endMsgHtml" />
32
+ <div
33
+ v-if="messageShow"
34
+ class="copycontent"
35
+ style="display: block; padding: 0 5%"
36
+ >
37
+ <span>{{ firstMsg }} {{ copytype }}</span>
38
+ <el-tooltip :content="copytip || (lang === 'zh-CN' ? '点击复制单号' : 'Copy by clicking the order number')">
39
+ <span class="copycontent-r" @click="copyClicked(copymsg)" :data-clipboard-text="copymsg">{{
40
+ copymsg
41
+ }}</span>
42
+ </el-tooltip>
43
+ <span>{{ lastMsg }}</span>
44
+ </div>
45
+ <div v-if="showCancle" class="waring-btn">
46
+ <span
47
+ class="yes"
48
+ style="background-color: #999; border-bottom-right-radius: 0;width: 50%;"
49
+ @click="handleNo"
50
+ >{{ cancleText || (lang === 'zh-CN' ? '取消' : 'Cancel') }}</span>
51
+ <span class="yes" @click="handleYes" style="width: 50%;">{{ okText || (lang === 'zh-CN' ? '确定' : 'Confirm') }}</span>
52
+ </div>
53
+ <div v-else class="waring-btn">
54
+ <span class="yes" @click="handleYes">{{ okText || (lang === 'zh-CN' ? '确定' : 'Confirm') }}</span>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </template>
61
+
62
+ <script setup >
63
+ import { WarningFilled, SuccessFilled, QuestionFilled } from '@element-plus/icons-vue'
64
+ import { ElIcon ,ElMessage } from 'element-plus'
65
+ </script>
66
+
67
+ <script >
68
+ import { ref } from 'vue'
69
+ import Clipboard from 'clipboard'
70
+
71
+ const customAlert = ref(null)
72
+
73
+ export default {
74
+ props: {
75
+ lang: {
76
+ type: String,
77
+ default: 'zh-CN'
78
+ },
79
+ msg: {
80
+ type: String,
81
+ default: ''
82
+ },
83
+ type: {
84
+ type: String,
85
+ default: 'alert'
86
+ },
87
+ firstMsg: {
88
+ type: String,
89
+ default: ''
90
+ },
91
+ lastMsg: {
92
+ type: String,
93
+ default: ''
94
+ },
95
+ endMsg: {
96
+ type: String,
97
+ default: ''
98
+ },
99
+ endMsgHtml: {
100
+ type: String,
101
+ default: ''
102
+ },
103
+ msgHtml: {
104
+ type: String,
105
+ default: ''
106
+ },
107
+ showCancle: {
108
+ type: Boolean,
109
+ default: true
110
+ },
111
+ cancleText: {
112
+ type: String,
113
+ default: '',
114
+ },
115
+ okText: {
116
+ type: String,
117
+ default: '',
118
+ },
119
+ copytip: {
120
+ type: String,
121
+ default: ''
122
+ },
123
+ successtext: {
124
+ type: String,
125
+ default: '',
126
+ },
127
+ handleCancle: {
128
+ type: Function
129
+ },
130
+ handleOk: {
131
+ type: Function
132
+ },
133
+ showcopy: {
134
+ type: Boolean,
135
+ default: false
136
+ },
137
+ messageShow: {
138
+ type: Boolean,
139
+ default: false
140
+ },
141
+ copytype: {
142
+ type: String,
143
+ default: ''
144
+ },
145
+ copymsg: {
146
+ type: String,
147
+ default: ''
148
+ }
149
+ },
150
+ data() {
151
+ return {
152
+ modal: false
153
+ }
154
+ },
155
+ watch: {
156
+ modal(val) {
157
+ if (!val) {
158
+ let parent = (customAlert.value && customAlert.value['parentNode']) || null
159
+ if (customAlert.value && document.body.contains(parent) && parent) {
160
+ document.body.removeChild(parent)
161
+ }
162
+ }
163
+ }
164
+ },
165
+ created() {
166
+ this.modal = true
167
+ },
168
+ unmounted() {
169
+ let parent = (customAlert.value && customAlert.value['parentNode']) || null
170
+ if (customAlert.value && document.body.contains(parent) && parent) {
171
+ document.body.removeChild(parent)
172
+ }
173
+ },
174
+ methods: {
175
+ async copyClicked(val) {
176
+ let clipboard = new Clipboard(".copycontent-r");
177
+ clipboard.on('success', e => {
178
+ ElMessage({
179
+ message: this.successtext || (this.lang === 'zh-CN' ? '复制成功' : 'Copy success'),
180
+ type: 'success',
181
+ })
182
+ clipboard.destroy()
183
+ })
184
+ clipboard.on('error', e => {
185
+ clipboard.destroy()
186
+ })
187
+ },
188
+ handleNo() {
189
+ this.handleCancle && this.handleCancle()
190
+ this.modal = false
191
+ },
192
+ handleYes() {
193
+ this.handleOk && this.handleOk()
194
+ this.modal = false
195
+ }
196
+ }
197
+ }
198
+ </script>
199
+ <style lang="scss" scoped>
200
+ @use "./modal.scss";
201
+ </style>
package/src/index.jsx CHANGED
@@ -85,6 +85,10 @@ export default {
85
85
  type: [Object, Function],
86
86
  default: () => null
87
87
  },
88
+ copyModal: {
89
+ type: [Object, Function],
90
+ default: () => null
91
+ },
88
92
  openChildDialogInstance: {
89
93
  type: [Function],
90
94
  default: () => {
@@ -192,6 +196,10 @@ export default {
192
196
  bpmBtnPosition: {
193
197
  type: Number,
194
198
  default: 3
199
+ },
200
+ showCopyModal: {
201
+ // 传递给致远的参数
202
+ type: [Function],
195
203
  }
196
204
  },
197
205
  emits: ['update:modelValue', 'rootStoreChange'],
@@ -401,7 +409,11 @@ export default {
401
409
  validate,
402
410
  dynamicMapComp,
403
411
  toExecuteLoadServices,
404
- bpmSubmitBtn: props.bpmSubmitBtn
412
+ bpmSubmitBtn: props.bpmSubmitBtn,
413
+ calcShowCopyModal: props.showCopyModal, // 是否要开启刚开始保存之后弹框提示编码功能
414
+ copyModal: props.copyModal,
415
+ lang: toRef(props, 'lang'),
416
+ messageInstance: props.messageInstance,
405
417
  })
406
418
  bpmInstance?.insertBtn?.(props.bpmBtns, props.bpmBtnPosition)
407
419
  }
@@ -18,6 +18,10 @@ const props = defineProps({
18
18
  default: () => CmiToast
19
19
  // default: () => null
20
20
  },
21
+ copyModal: {
22
+ type: [Object, Function],
23
+ default: () => copyModal
24
+ },
21
25
  confirmInstance: {
22
26
  type: [Object, Function],
23
27
  default: () => {
@@ -75,6 +79,7 @@ defineExpose({
75
79
  v-bind="attrs"
76
80
  :isH5="true" :getNativeComps="getNativeComps"
77
81
  :messageInstance="props.messageInstance"
82
+ :copyModal="props.copyModal"
78
83
  :confirmInstance="props.confirmInstance"
79
84
  :openChildDialogInstance="props.openChildDialogInstance"
80
85
  :loadingInstance="props.loadingInstance"
@@ -22,6 +22,10 @@ const props = defineProps({
22
22
  type: [Object, Function],
23
23
  default: () => null
24
24
  },
25
+ copyModal: {
26
+ type: [Object, Function],
27
+ default: () => null
28
+ },
25
29
  requestTraceId: {
26
30
  type: String,
27
31
  },
@@ -103,6 +107,7 @@ defineExpose({
103
107
  :loadingInstance="props.loadingInstance"
104
108
  :messageInstance="props.messageInstance"
105
109
  :getNativeComps="props.getNativeComps"
110
+ :copyModal="props.copyModal"
106
111
  :config="pageConfig || null"
107
112
  :selects="allSelects"
108
113
  :builtPolyfillReq="props.builtPolyfillReq"