af-mobile-client-vue3 1.6.55 → 1.6.56

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,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.6.55",
4
+ "version": "1.6.56",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -1,263 +1,263 @@
1
- <script setup lang="ts">
2
- import SignatureComponent from '@af-mobile-client-vue3/components/core/Signature/SignatureComponent.vue'
3
- import XSelect from '@af-mobile-client-vue3/components/core/XSelect/index.vue'
4
- import FilePreview from '@af-mobile-client-vue3/components/data/FilePreview/index.vue'
5
- import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
6
- import { getConfigByName, runLogic } from '@af-mobile-client-vue3/services/api/common'
7
- import { useStepStore } from '@af-mobile-client-vue3/stores/modules/step'
8
- import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
9
- import { showToast, Button as VanButton, CellGroup as VanCellGroup, Dialog as VanDialog, Loading as VanLoading } from 'vant'
10
- import { computed, onMounted, ref } from 'vue'
11
- import { useRoute } from 'vue-router'
12
-
13
- /** 生成合同接口返回的 data 结构 */
14
- interface ContractDetail {
15
- f_signature_url?: string
16
- f_signature_path?: string
17
- f_contract_signature_id?: string
18
- f_contract_type?: string
19
- [key: string]: unknown
20
- }
21
-
22
- interface GenerateContractResponse {
23
- data: ContractDetail
24
- }
25
-
26
- const route = useRoute()
27
- // 获取当前登录用户信息
28
- const userInfo = useUserStore().getUserInfo()
29
- // 获取操作员信息
30
- const currUser = useUserStore().getLogin().f
31
- const stepStore = useStepStore()
32
- const workflowId = ref(route.query.workflowId?.toString() || stepStore.getWorkflowId() || '')
33
- const userId = computed(() => route.query.userId?.toString() || '')
34
- // 合同名称
35
- const f_contract_name = ref('')
36
- // 表单名称
37
- const configName = ref('')
38
- // 展示合同表单
39
- const contractshow = ref(false)
40
- // 合同选择类型
41
- const contracttypes = ref<any[]>([])
42
- // 合同模板
43
- const contractTemplate = ref<any[]>([])
44
- // 用户信息
45
- const userRecord = ref<any[]>([])
46
- // 合同的表单数据
47
- const formData = ref({})
48
- // 合同表单引用
49
- const contractFormRef = ref()
50
- // 显示pdf
51
- const preview = ref(false)
52
- // pdf的路径
53
- const previewPath = ref('')
54
- // pdf查看组件引用
55
- const filePreviewRef = ref()
56
- // 显示签字弹窗
57
- const previewVisible = ref(false)
58
- // 签字组件引用
59
- const signatureRef = ref<any>()
60
- // 生成的合同信息
61
- const contractdetails = ref<ContractDetail>({})
62
- const status = ref(false)
63
-
64
- function contractconfirm() {
65
- if (f_contract_name.value !== '') {
66
- contractshow.value = true
67
- configName.value = `${f_contract_name.value}Form`
68
- getConfigByName(configName.value, (config) => {
69
- if (config !== null && config !== undefined) {
70
- contractFormRef.value.init(config)
71
- }
72
- else {
73
- contractshow.value = false
74
- }
75
- }, 'af-system')
76
- }
77
- else {
78
- contractshow.value = false
79
- }
80
- }
81
- function contractsubmit(res) {
82
- Object.assign(formData.value, res)
83
- const contractInfo = {
84
- f_process_id: workflowId.value,
85
- }
86
- contractTemplate.value.forEach((item) => {
87
- if (item?.f_contract_name === f_contract_name.value) {
88
- Object.assign(contractInfo, item)
89
- }
90
- })
91
- const resData = {
92
- contractInfo,
93
- loginInfo: {
94
- f_operatorid: userInfo.f_operatorid || currUser.resources.id,
95
- f_operator: userInfo.f_operator || currUser.resources.name,
96
- f_orgid: userInfo.f_orgid || currUser.resources.orgid,
97
- },
98
- userRecord: userRecord.value[0],
99
- formData: res,
100
- }
101
- preview.value = true
102
- status.value = true
103
- runLogic('generateContract', resData, 'af-revenue').then((contract: GenerateContractResponse) => {
104
- showToast('生成合同成功!')
105
- console.log('contract', contract)
106
- contractdetails.value = contract.data
107
- const path = contract.data.f_signature_url
108
- filePreviewRef.value.init({ path })
109
- status.value = false
110
- })
111
- }
112
- function goBack() {
113
- preview.value = false
114
- }
115
- function openSign() {
116
- previewVisible.value = true
117
- }
118
- function onDialogCancel() {
119
- previewVisible.value = false
120
- }
121
- async function onSignSubmit() {
122
- const signData = await Promise.resolve(signatureRef.value?.getSignatureData?.())
123
- console.log('signData', signData)
124
- let f_signature_location = ''
125
- contractTemplate.value.forEach((item) => {
126
- if (item?.f_contract_name === f_contract_name.value) {
127
- f_signature_location = item.f_signature_location
128
- }
129
- })
130
- const resData = {
131
- f_signature_path: contractdetails.value.f_signature_path,
132
- f_contract_url: contractdetails.value.f_signature_url,
133
- f_contract_signature_id: contractdetails.value.f_contract_signature_id,
134
- f_signature_location,
135
- f_contract_type: contractdetails.value.f_contract_type,
136
- image: signData,
137
- }
138
- runLogic('contractSignature', resData, 'af-revenue').then(() => {
139
- showToast('合同签字成功!')
140
- preview.value = false
141
- history.back()
142
- })
143
- }
144
-
145
- onMounted(() => {
146
- runLogic('getUserinfoByid', {
147
- condition: ` (ui.f_userinfo_id = '${userId.value}' or ui.f_workflow_id = '${workflowId.value}') `,
148
- }, 'af-system').then((row: any) => {
149
- if (row.length > 0) {
150
- userRecord.value = row
151
- }
152
- else {
153
- showToast('未找到用户信息!')
154
- return
155
- }
156
- runLogic('getContractTemplateByWorkflow', {
157
- f_orgid: userInfo.f_orgid || currUser.resources.orgid,
158
- f_userinfo_code: userRecord.value[0].f_userinfo_code,
159
- workflowId: workflowId.value,
160
- }, 'af-system').then((res: any) => {
161
- contracttypes.value = []
162
- contractTemplate.value = res
163
- res.forEach((item: any) => {
164
- contracttypes.value.push({
165
- label: item.f_contract_name,
166
- value: item.f_contract_name,
167
- })
168
- })
169
- })
170
- })
171
- })
172
- </script>
173
-
174
- <template>
175
- <div v-if="status" style="display: flex; justify-content: center; align-items: center; height: 100vh;">
176
- <VanLoading vertical size="50">
177
- 努力加载中...
178
- </VanLoading>
179
- </div>
180
- <div v-show="!status" class="contract-container">
181
- <VanCellGroup v-if="!preview" class="contract-form-group">
182
- <XSelect
183
- v-model="f_contract_name"
184
- :columns="contracttypes"
185
- label="合同名称"
186
- placeholder="请选择合同名称"
187
- @confirm="contractconfirm"
188
- />
189
- <XForm
190
- v-if="contractshow"
191
- ref="contractFormRef"
192
- class="contract-form"
193
- mode="新增"
194
- :form-data="formData"
195
- :config-name="configName"
196
- service-name="af-telephone"
197
- show-tab-header="false"
198
- :submit-button="true"
199
- @on-submit="contractsubmit"
200
- />
201
- </VanCellGroup>
202
- <div v-if="preview">
203
- <FilePreview
204
- ref="filePreviewRef"
205
- :key="`pdf-${previewPath}`"
206
- style="height: 95vh"
207
- />
208
- <div class="bottom-bar">
209
- <VanButton type="default" block @click="goBack">
210
- 返回
211
- </VanButton>
212
- <VanButton type="primary" block @click="openSign">
213
- 签字提交
214
- </VanButton>
215
- </div>
216
- </div>
217
- <VanDialog
218
- v-model:show="previewVisible"
219
- title="合同信息"
220
- show-cancel-button
221
- show-confirm-button
222
- style="max-width: 90vw; max-height: 40vh;"
223
- @confirm="onSignSubmit"
224
- @cancel="onDialogCancel"
225
- >
226
- <SignatureComponent ref="signatureRef" style="padding: 20px;" label="用户签字" :form-readonly="false" />
227
- </VanDialog>
228
- </div>
229
- </template>
230
-
231
- <style scoped lang="less">
232
- .contract-container {
233
- height: 95vh;
234
- display: flex;
235
- flex-direction: column;
236
- }
237
-
238
- :deep(.contract-form-group) {
239
- flex: 1;
240
- display: flex;
241
- flex-direction: column;
242
- overflow: hidden;
243
- }
244
-
245
- :deep(.contract-form) {
246
- flex: 1;
247
- overflow: auto;
248
- }
249
-
250
- .bottom-bar {
251
- position: fixed;
252
- left: 0;
253
- right: 0;
254
- bottom: 0;
255
- background: #fff;
256
- padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
257
- display: grid;
258
- grid-template-columns: 1fr 1fr;
259
- gap: 8px;
260
- box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
261
- z-index: 100;
262
- }
263
- </style>
1
+ <script setup lang="ts">
2
+ import SignatureComponent from '@af-mobile-client-vue3/components/core/Signature/SignatureComponent.vue'
3
+ import XSelect from '@af-mobile-client-vue3/components/core/XSelect/index.vue'
4
+ import FilePreview from '@af-mobile-client-vue3/components/data/FilePreview/index.vue'
5
+ import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
6
+ import { getConfigByName, runLogic } from '@af-mobile-client-vue3/services/api/common'
7
+ import { useStepStore } from '@af-mobile-client-vue3/stores/modules/step'
8
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
9
+ import { showToast, Button as VanButton, CellGroup as VanCellGroup, Dialog as VanDialog, Loading as VanLoading } from 'vant'
10
+ import { computed, onMounted, ref } from 'vue'
11
+ import { useRoute } from 'vue-router'
12
+
13
+ /** 生成合同接口返回的 data 结构 */
14
+ interface ContractDetail {
15
+ f_signature_url?: string
16
+ f_signature_path?: string
17
+ f_contract_signature_id?: string
18
+ f_contract_type?: string
19
+ [key: string]: unknown
20
+ }
21
+
22
+ interface GenerateContractResponse {
23
+ data: ContractDetail
24
+ }
25
+
26
+ const route = useRoute()
27
+ // 获取当前登录用户信息
28
+ const userInfo = useUserStore().getUserInfo()
29
+ // 获取操作员信息
30
+ const currUser = useUserStore().getLogin().f
31
+ const stepStore = useStepStore()
32
+ const workflowId = ref(route.query.workflowId?.toString() || stepStore.getWorkflowId() || '')
33
+ const userId = computed(() => route.query.userId?.toString() || '')
34
+ // 合同名称
35
+ const f_contract_name = ref('')
36
+ // 表单名称
37
+ const configName = ref('')
38
+ // 展示合同表单
39
+ const contractshow = ref(false)
40
+ // 合同选择类型
41
+ const contracttypes = ref<any[]>([])
42
+ // 合同模板
43
+ const contractTemplate = ref<any[]>([])
44
+ // 用户信息
45
+ const userRecord = ref<any[]>([])
46
+ // 合同的表单数据
47
+ const formData = ref({})
48
+ // 合同表单引用
49
+ const contractFormRef = ref()
50
+ // 显示pdf
51
+ const preview = ref(false)
52
+ // pdf的路径
53
+ const previewPath = ref('')
54
+ // pdf查看组件引用
55
+ const filePreviewRef = ref()
56
+ // 显示签字弹窗
57
+ const previewVisible = ref(false)
58
+ // 签字组件引用
59
+ const signatureRef = ref<any>()
60
+ // 生成的合同信息
61
+ const contractdetails = ref<ContractDetail>({})
62
+ const status = ref(false)
63
+
64
+ function contractconfirm() {
65
+ if (f_contract_name.value !== '') {
66
+ contractshow.value = true
67
+ configName.value = `${f_contract_name.value}Form`
68
+ getConfigByName(configName.value, (config) => {
69
+ if (config !== null && config !== undefined) {
70
+ contractFormRef.value.init(config)
71
+ }
72
+ else {
73
+ contractshow.value = false
74
+ }
75
+ }, 'af-system')
76
+ }
77
+ else {
78
+ contractshow.value = false
79
+ }
80
+ }
81
+ function contractsubmit(res) {
82
+ Object.assign(formData.value, res)
83
+ const contractInfo = {
84
+ f_process_id: workflowId.value,
85
+ }
86
+ contractTemplate.value.forEach((item) => {
87
+ if (item?.f_contract_name === f_contract_name.value) {
88
+ Object.assign(contractInfo, item)
89
+ }
90
+ })
91
+ const resData = {
92
+ contractInfo,
93
+ loginInfo: {
94
+ f_operatorid: userInfo.f_operatorid || currUser.resources.id,
95
+ f_operator: userInfo.f_operator || currUser.resources.name,
96
+ f_orgid: userInfo.f_orgid || currUser.resources.orgid,
97
+ },
98
+ userRecord: userRecord.value[0],
99
+ formData: res,
100
+ }
101
+ preview.value = true
102
+ status.value = true
103
+ runLogic('generateContract', resData, 'af-revenue').then((contract: GenerateContractResponse) => {
104
+ showToast('生成合同成功!')
105
+ console.log('contract', contract)
106
+ contractdetails.value = contract.data
107
+ const path = contract.data.f_signature_url
108
+ filePreviewRef.value.init({ path })
109
+ status.value = false
110
+ })
111
+ }
112
+ function goBack() {
113
+ preview.value = false
114
+ }
115
+ function openSign() {
116
+ previewVisible.value = true
117
+ }
118
+ function onDialogCancel() {
119
+ previewVisible.value = false
120
+ }
121
+ async function onSignSubmit() {
122
+ const signData = await Promise.resolve(signatureRef.value?.getSignatureData?.())
123
+ console.log('signData', signData)
124
+ let f_signature_location = ''
125
+ contractTemplate.value.forEach((item) => {
126
+ if (item?.f_contract_name === f_contract_name.value) {
127
+ f_signature_location = item.f_signature_location
128
+ }
129
+ })
130
+ const resData = {
131
+ f_signature_path: contractdetails.value.f_signature_path,
132
+ f_contract_url: contractdetails.value.f_signature_url,
133
+ f_contract_signature_id: contractdetails.value.f_contract_signature_id,
134
+ f_signature_location,
135
+ f_contract_type: contractdetails.value.f_contract_type,
136
+ image: signData,
137
+ }
138
+ runLogic('contractSignature', resData, 'af-revenue').then(() => {
139
+ showToast('合同签字成功!')
140
+ preview.value = false
141
+ history.back()
142
+ })
143
+ }
144
+
145
+ onMounted(() => {
146
+ runLogic('getUserinfoByid', {
147
+ condition: ` (ui.f_userinfo_id = '${userId.value}' or ui.f_workflow_id = '${workflowId.value}') `,
148
+ }, 'af-system').then((row: any) => {
149
+ if (row.length > 0) {
150
+ userRecord.value = row
151
+ }
152
+ else {
153
+ showToast('未找到用户信息!')
154
+ return
155
+ }
156
+ runLogic('getContractTemplateByWorkflow', {
157
+ f_orgid: userInfo.f_orgid || currUser.resources.orgid,
158
+ f_userinfo_code: userRecord.value[0].f_userinfo_code,
159
+ workflowId: workflowId.value,
160
+ }, 'af-system').then((res: any) => {
161
+ contracttypes.value = []
162
+ contractTemplate.value = res
163
+ res.forEach((item: any) => {
164
+ contracttypes.value.push({
165
+ label: item.f_contract_name,
166
+ value: item.f_contract_name,
167
+ })
168
+ })
169
+ })
170
+ })
171
+ })
172
+ </script>
173
+
174
+ <template>
175
+ <div v-if="status" style="display: flex; justify-content: center; align-items: center; height: 100vh;">
176
+ <VanLoading vertical size="50">
177
+ 努力加载中...
178
+ </VanLoading>
179
+ </div>
180
+ <div v-show="!status" class="contract-container">
181
+ <VanCellGroup v-if="!preview" class="contract-form-group">
182
+ <XSelect
183
+ v-model="f_contract_name"
184
+ :columns="contracttypes"
185
+ label="合同名称"
186
+ placeholder="请选择合同名称"
187
+ @confirm="contractconfirm"
188
+ />
189
+ <XForm
190
+ v-if="contractshow"
191
+ ref="contractFormRef"
192
+ class="contract-form"
193
+ mode="新增"
194
+ :form-data="formData"
195
+ :config-name="configName"
196
+ service-name="af-telephone"
197
+ show-tab-header="false"
198
+ :submit-button="true"
199
+ @on-submit="contractsubmit"
200
+ />
201
+ </VanCellGroup>
202
+ <div v-if="preview">
203
+ <FilePreview
204
+ ref="filePreviewRef"
205
+ :key="`pdf-${previewPath}`"
206
+ style="height: 95vh"
207
+ />
208
+ <div class="bottom-bar">
209
+ <VanButton type="default" block @click="goBack">
210
+ 返回
211
+ </VanButton>
212
+ <VanButton type="primary" block @click="openSign">
213
+ 签字提交
214
+ </VanButton>
215
+ </div>
216
+ </div>
217
+ <VanDialog
218
+ v-model:show="previewVisible"
219
+ title="合同信息"
220
+ show-cancel-button
221
+ show-confirm-button
222
+ style="max-width: 90vw; max-height: 40vh;"
223
+ @confirm="onSignSubmit"
224
+ @cancel="onDialogCancel"
225
+ >
226
+ <SignatureComponent ref="signatureRef" style="padding: 20px;" label="用户签字" :form-readonly="false" />
227
+ </VanDialog>
228
+ </div>
229
+ </template>
230
+
231
+ <style scoped lang="less">
232
+ .contract-container {
233
+ height: 95vh;
234
+ display: flex;
235
+ flex-direction: column;
236
+ }
237
+
238
+ :deep(.contract-form-group) {
239
+ flex: 1;
240
+ display: flex;
241
+ flex-direction: column;
242
+ overflow: hidden;
243
+ }
244
+
245
+ :deep(.contract-form) {
246
+ flex: 1;
247
+ overflow: auto;
248
+ }
249
+
250
+ .bottom-bar {
251
+ position: fixed;
252
+ left: 0;
253
+ right: 0;
254
+ bottom: 0;
255
+ background: #fff;
256
+ padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
257
+ display: grid;
258
+ grid-template-columns: 1fr 1fr;
259
+ gap: 8px;
260
+ box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
261
+ z-index: 100;
262
+ }
263
+ </style>
@@ -1,43 +1,43 @@
1
- <script setup lang="ts">
2
- import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
- import { useStepStore } from '@af-mobile-client-vue3/stores/modules/step'
4
- import { computed, ref } from 'vue'
5
- import { useRoute, useRouter } from 'vue-router'
6
-
7
- const router = useRouter()
8
- const configName = 'userinfoContractCRUD'
9
- const serviceName = 'af-system'
10
- const stepStore = useStepStore()
11
- const workflowId = ref(useRoute().query.workflowId?.toString() || stepStore.getWorkflowId() || '')
12
- const userId = computed(() => useRoute().query.userId?.toString() || '')
13
- function addContract() {
14
- router.push({
15
- name: 'addcontract',
16
- query: {
17
- userId: userId.value,
18
- },
19
- })
20
- }
21
- function previewContract(res) {
22
- router.push({
23
- name: 'viewContract',
24
- query: {
25
- previewPath: res.c_f_signature_url,
26
- },
27
- })
28
- }
29
- </script>
30
-
31
- <template>
32
- <XCellList
33
- :config-name="configName"
34
- :service-name="serviceName"
35
- :custom-add="true"
36
- :fix-query-form="{
37
- c_f_userinfo_id: userId,
38
- c_f_process_id: workflowId,
39
- }"
40
- @add="addContract"
41
- @preview-contract="previewContract"
42
- />
43
- </template>
1
+ <script setup lang="ts">
2
+ import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
+ import { useStepStore } from '@af-mobile-client-vue3/stores/modules/step'
4
+ import { computed, ref } from 'vue'
5
+ import { useRoute, useRouter } from 'vue-router'
6
+
7
+ const router = useRouter()
8
+ const configName = 'userinfoContractCRUD'
9
+ const serviceName = 'af-system'
10
+ const stepStore = useStepStore()
11
+ const workflowId = ref(useRoute().query.workflowId?.toString() || stepStore.getWorkflowId() || '')
12
+ const userId = computed(() => useRoute().query.userId?.toString() || '')
13
+ function addContract() {
14
+ router.push({
15
+ name: 'addcontract',
16
+ query: {
17
+ userId: userId.value,
18
+ },
19
+ })
20
+ }
21
+ function previewContract(res) {
22
+ router.push({
23
+ name: 'viewContract',
24
+ query: {
25
+ previewPath: res.c_f_signature_url,
26
+ },
27
+ })
28
+ }
29
+ </script>
30
+
31
+ <template>
32
+ <XCellList
33
+ :config-name="configName"
34
+ :service-name="serviceName"
35
+ :custom-add="true"
36
+ :fix-query-form="{
37
+ c_f_userinfo_id: userId,
38
+ c_f_process_id: workflowId,
39
+ }"
40
+ @add="addContract"
41
+ @preview-contract="previewContract"
42
+ />
43
+ </template>
@@ -1,22 +1,22 @@
1
- <script setup lang="ts">
2
- import FilePreview from '@af-mobile-client-vue3/components/data/FilePreview/index.vue'
3
- import { computed, onMounted, ref } from 'vue'
4
- import { useRoute } from 'vue-router'
5
-
6
- const route = useRoute()
7
- const previewPath = computed(() => route.query.previewPath?.toString() || '')
8
- const filePreviewRef = ref()
9
-
10
- onMounted(() => {
11
- const path = previewPath.value
12
- filePreviewRef.value.init({ path })
13
- })
14
- </script>
15
-
16
- <template>
17
- <FilePreview
18
- ref="filePreviewRef"
19
- :key="`pdf-${previewPath}`"
20
- style="height: 80vh"
21
- />
22
- </template>
1
+ <script setup lang="ts">
2
+ import FilePreview from '@af-mobile-client-vue3/components/data/FilePreview/index.vue'
3
+ import { computed, onMounted, ref } from 'vue'
4
+ import { useRoute } from 'vue-router'
5
+
6
+ const route = useRoute()
7
+ const previewPath = computed(() => route.query.previewPath?.toString() || '')
8
+ const filePreviewRef = ref()
9
+
10
+ onMounted(() => {
11
+ const path = previewPath.value
12
+ filePreviewRef.value.init({ path })
13
+ })
14
+ </script>
15
+
16
+ <template>
17
+ <FilePreview
18
+ ref="filePreviewRef"
19
+ :key="`pdf-${previewPath}`"
20
+ style="height: 80vh"
21
+ />
22
+ </template>