af-mobile-client-vue3 1.1.34 → 1.1.36

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.
@@ -1,428 +1,108 @@
1
1
  <script setup lang="ts">
2
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
- import { getConfigByName } from '@af-mobile-client-vue3/services/api/common'
4
- import { post } from '@af-mobile-client-vue3/services/restTools'
5
- import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
6
- import {
7
- showDialog,
8
- showNotify,
9
- Badge as VanBadge,
10
- Dialog as VanDialog,
11
- Field as VanField,
12
- Icon as VanIcon,
13
- Radio as VanRadio,
14
- RadioGroup as VanRadioGroup,
15
- } from 'vant'
16
- import { defineEmits, onMounted, onUnmounted, reactive, ref } from 'vue'
3
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
+ import { defineEmits, ref } from 'vue'
5
+ import { useRouter } from 'vue-router'
17
6
 
18
7
  // 定义事件
19
8
  const emit = defineEmits(['deleteRow'])
20
- const userState = useUserStore().getLogin()
21
- let timer: number | null = null
22
- const configName = ref('ReservationOrderCRUD')
23
- const serviceName = ref('af-safecheck')
24
-
25
- // 获取组件引用
26
- const cellListRef = ref()
27
- const statistics = reactive({
28
- awaiting_security: 0,
29
- pending: 0,
30
- })
31
-
32
- const fixQueryForm = { }
33
-
34
- // 处理公告点击
35
- function handleBadgeClick(opt) {
36
- const condition = {}
37
- if (opt === 'backlog') {
38
- condition.os_f_accept_status = '待受理'
39
- condition.os_f_accept_user_id = null
40
- }
41
- else {
42
- condition.os_f_accept_status = '待安检'
43
- condition.os_f_accept_user_id = userState.f.resources.id
44
- }
45
- cellListRef.value?.updateConditionAndRefresh(condition)
46
- }
47
-
48
- // 获取待办数据
49
- function fetchTodoData() {
50
- post(`/af-safecheck/logic/getToDoSafeOrder`, { params: { userid: userState.f.resources.id, f_urban_area: userState.f.resources.orgs } }).then((res) => {
51
- console.log('res====', res)
52
- if (res && res.length > 0) {
53
- statistics.awaiting_security = res[0].awaiting_security || 0
54
- statistics.pending = res[0].pending || 0
55
- }
56
- })
57
- }
58
-
59
- onMounted(() => {
60
- // 立即执行一次
61
- fetchTodoData()
62
- getConfig()
63
- // 设置定时器,每10秒执行一次
64
- timer = window.setInterval(() => {
65
- fetchTodoData()
66
- }, 10000)
67
- window.addEventListener('appstate-change', (e: any) => {
68
- if (e.detail.appState === 'afterhidden') {
69
- if (timer) {
70
- clearInterval(timer)
71
- timer = null
72
- }
73
- }
74
- })
75
- })
76
-
77
- // 组件销毁时清理定时器
78
- onUnmounted(() => {
79
- if (timer) {
80
- clearInterval(timer)
81
- timer = null
82
- }
83
- })
84
-
85
- // 添加新的状态变量
86
- const showCompleteDialog = ref(false)
87
- const showInvalidateDialog = ref(false)
88
- const currentItem = ref(null)
89
- const completeForm = reactive({
90
- result: '',
91
- problemDesc: '',
92
- remark: '',
93
- })
94
- const invalidateForm = reactive({
95
- reason: '',
96
- remark: '',
97
- })
98
-
99
- // 安检结果选项
100
- const inspectionResults = ref([])
101
-
102
- // 作废原因选项
103
- const invalidateReasons = ref([])
104
-
105
- // 开始安检
106
- function accept(item) {
107
- currentItem.value = item
108
- showCompleteDialog.value = true
109
- }
110
- // 作废安检
111
- function showInvalidated(item) {
112
- currentItem.value = item
113
- showInvalidateDialog.value = true
114
- }
115
- // 完成安检
116
- function completed() {
117
- if (!completeForm.result) {
118
- showNotify({
119
- type: 'warning',
120
- message: '请选择安检结果',
121
- duration: 2000,
122
- })
123
- return false
124
- }
125
-
126
- const currentResult = inspectionResults.value.find(item => item.value === completeForm.result)
127
- if (currentResult?.showProblemDesc && !completeForm.problemDesc) {
128
- showNotify({
129
- type: 'warning',
130
- message: '请填写问题描述',
131
- duration: 2000,
132
- })
133
- return false
134
- }
135
-
136
- // TODO: 调用后端API保存安检结果
137
- post('/af-safecheck/entity/save/t_order_safecheck', {
138
- id: currentItem.value.os_id,
139
- f_accept_status: '已安检',
140
- f_check_result: completeForm.result,
141
- f_problem_desc: completeForm.problemDesc || null,
142
- f_remark: completeForm.remark || null,
143
- version: currentItem.value.os_version,
144
- }).then(() => {
145
- showNotify({
146
- type: 'success',
147
- message: '安检完成',
148
- duration: 2000,
149
- })
150
- // 刷新列表
151
- cellListRef.value?.updateConditionAndRefresh()
152
- fetchTodoData()
153
- // 关闭弹窗并重置表单
154
- showCompleteDialog.value = false
155
- resetCompleteForm()
156
- })
157
- return true
158
- }
159
-
160
- // 作废安检
161
- function invalidated() {
162
- if (!invalidateForm.reason) {
163
- showNotify({
164
- type: 'warning',
165
- message: '请选择作废原因',
166
- duration: 2000,
167
- })
168
- return false
169
- }
170
-
171
- // TODO: 调用后端API保存作废信息
172
- post('/af-safecheck/entity/save/t_order_safecheck', {
173
- id: currentItem.value.os_id,
174
- f_accept_status: '已作废',
175
- f_problem_desc: `${invalidateForm.reason}-${invalidateForm.remark}`,
176
- version: currentItem.value.os_version,
177
- }).then(() => {
178
- showNotify({
179
- type: 'success',
180
- message: '安检已作废',
181
- duration: 2000,
182
- })
183
- // 刷新列表
184
- cellListRef.value?.updateConditionAndRefresh()
185
- fetchTodoData()
186
- // 关闭弹窗并重置表单
187
- showInvalidateDialog.value = false
188
- resetInvalidateForm()
189
- })
190
- return true
191
- }
192
-
193
- function accepted(item) {
194
- // TODO: 调用后端API保存作废信息
195
- post('/af-safecheck/entity/save/t_order_safecheck', {
196
- id: item.os_id,
197
- f_accept_status: '待安检',
198
- f_accept_user_id: userState.f.resources.id,
199
- f_accept_user_name: userState.f.resources.name,
200
- version: item.os_version,
201
- }).then(() => {
202
- showNotify({
203
- type: 'success',
204
- message: '已成功受理,请及时安检!',
205
- duration: 2000,
206
- })
207
- // 刷新列表
208
- cellListRef.value?.updateConditionAndRefresh()
209
- fetchTodoData()
9
+ // 访问路由
10
+ const router = useRouter()
11
+ // 获取默认值
12
+ const idKey = ref('o_id')
13
+
14
+ // 简易crud表单测试
15
+ const configName = ref('crud_oper_log_manage')
16
+ const serviceName = ref('af-system')
17
+
18
+ // 资源权限测试
19
+ // const configName = ref('crud_sources_test')
20
+ // const serviceName = ref('af-system')
21
+
22
+ // 实际业务测试
23
+ // const configName = ref('lngChargeAuditMobileCRUD')
24
+ // const serviceName = ref('af-gaslink')
25
+
26
+ // 跳转到详情页面
27
+ // function toDetail(item) {
28
+ // router.push({
29
+ // name: 'XCellDetailView',
30
+ // params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
31
+ // query: {
32
+ // operName: item[operNameKey.value],
33
+ // method:item[methodKey.value],
34
+ // requestMethod:item[requestMethodKey.value],
35
+ // operatorType:item[operatorTypeKey.value],
36
+ // operUrl:item[operUrlKey.value],
37
+ // operIp:item[operIpKey.value],
38
+ // costTime:item[costTimeKey.value],
39
+ // operTime:item[operTimeKey.value],
40
+ //
41
+ // title: item[titleKey.value],
42
+ // businessType: item[businessTypeKey.value],
43
+ // status:item[statusKey.value]
44
+ // }
45
+ // })
46
+ // }
47
+
48
+ // 跳转到表单——以表单组来渲染纯表单
49
+ function toDetail(item) {
50
+ router.push({
51
+ name: 'XFormGroupView',
52
+ query: {
53
+ id: item[idKey.value],
54
+ // id: item.rr_id,
55
+ // o_id: item.o_id,
56
+ },
210
57
  })
211
- return true
212
58
  }
213
59
 
214
- function getConfig() {
215
- getConfigByName('invalidateReasonsConfig', (result) => {
216
- if (result?.value)
217
- invalidateReasons.value = result.value
218
- }, 'af-safecheck')
219
- getConfigByName('inspectionResultsConfig', (result) => {
220
- if (result?.value)
221
- inspectionResults.value = result.value
222
- }, 'af-safecheck')
223
- }
224
- // 重置完成安检表单
225
- function resetCompleteForm() {
226
- completeForm.result = ''
227
- completeForm.problemDesc = ''
228
- completeForm.remark = ''
229
- }
230
-
231
- // 重置作废安检表单
232
- function resetInvalidateForm() {
233
- invalidateForm.reason = ''
234
- invalidateForm.remark = ''
235
- }
236
- // 退出登录
237
- async function exit_login() {
238
- showDialog({
239
- title: '提示',
240
- message: '确定要退出登录吗?',
241
- confirmButtonText: '确定',
242
- cancelButtonText: '取消',
243
- showCancelButton: true,
244
- }).then(async () => {
245
- await useUserStore().logout()
246
- }).catch(() => {
247
- // 用户点击取消,不做任何操作
248
- })
60
+ // 新增功能
61
+ // function addOption(totalCount) {
62
+ // router.push({
63
+ // name: 'XFormView',
64
+ // params: { id: totalCount, openid: totalCount },
65
+ // query: {
66
+ // configName: configName.value,
67
+ // serviceName: serviceName.value,
68
+ // mode: '新增',
69
+ // },
70
+ // })
71
+ // }
72
+
73
+ // 修改功能
74
+ // function updateRow(result) {
75
+ // router.push({
76
+ // name: 'XFormView',
77
+ // params: { id: result.o_id, openid: result.o_id },
78
+ // query: {
79
+ // configName: configName.value,
80
+ // serviceName: serviceName.value,
81
+ // mode: '修改',
82
+ // },
83
+ // })
84
+ // }
85
+
86
+ // 删除功能
87
+ function deleteRow(result) {
88
+ emit('deleteRow', result.o_id)
249
89
  }
250
90
  </script>
251
91
 
252
92
  <template>
253
- <div class="xlv_t">
254
- <XCellList
255
- ref="cellListRef"
256
- :config-name="configName"
257
- :service-name="serviceName"
258
- :fix-query-form="fixQueryForm"
259
- @accept="accepted"
260
- @completed="accept"
261
- @invalidated="showInvalidated"
262
- >
263
- <!-- <template #search-left-loginout>
264
- <VanBadge @click="exit_login()">
265
- <VanIcon name="arrow-left" size="24" />
266
- </VanBadge>
267
- </template>-->
268
- <template #search-right-bad>
269
- <VanBadge :content="statistics.pending" @click="handleBadgeClick('backlog')">
270
- <VanIcon name="bullhorn-o" size="24" />
271
- </VanBadge>
272
- </template>
273
- <template #search-right-my>
274
- <VanBadge :content="statistics.awaiting_security" @click="handleBadgeClick('my')">
275
- <VanIcon name="description-o" size="24" />
276
- </VanBadge>
277
- </template>
278
- </XCellList>
279
-
280
- <!-- 完成安检弹窗 -->
281
- <VanDialog
282
- v-model:show="showCompleteDialog"
283
- title="完成安检"
284
- show-cancel-button
285
- :close-on-click-overlay="false"
286
- :close-on-popstate="false"
287
- :before-close="(action) => action === 'confirm' ? completed() : true"
288
- class="inspection-dialog"
289
- @cancel="resetCompleteForm"
290
- >
291
- <div class="dialog-content">
292
- <div class="form-item">
293
- <div class="form-label">
294
- 安检结果
295
- </div>
296
- <VanRadioGroup v-model="completeForm.result" class="radio-group">
297
- <VanRadio
298
- v-for="item in inspectionResults"
299
- :key="item.value"
300
- :name="item.value"
301
- class="radio-item"
302
- >
303
- {{ item.label }}
304
- </VanRadio>
305
- </VanRadioGroup>
306
- </div>
307
-
308
- <div v-if="inspectionResults.find(item => item.value === completeForm.result)?.showProblemDesc" class="form-item">
309
- <div class="form-label">
310
- 问题描述
311
- </div>
312
- <VanField
313
- v-model="completeForm.problemDesc"
314
- type="textarea"
315
- rows="3"
316
- placeholder="请详细描述发现的问题"
317
- class="field-item"
318
- />
319
- </div>
320
-
321
- <div class="form-item">
322
- <div class="form-label">
323
- 备注信息
324
- </div>
325
- <VanField
326
- v-model="completeForm.remark"
327
- type="textarea"
328
- rows="3"
329
- placeholder="请输入其他备注信息(选填)"
330
- class="field-item"
331
- />
332
- </div>
333
- </div>
334
- </VanDialog>
335
-
336
- <!-- 作废安检弹窗 -->
337
- <VanDialog
338
- v-model:show="showInvalidateDialog"
339
- title="作废安检"
340
- show-cancel-button
341
- :close-on-click-overlay="false"
342
- :close-on-popstate="false"
343
- :before-close="(action) => action === 'confirm' ? invalidated() : true"
344
- class="inspection-dialog"
345
- @cancel="resetInvalidateForm"
346
- >
347
- <div class="dialog-content">
348
- <div class="form-item">
349
- <div class="form-label">
350
- 作废原因
351
- </div>
352
- <VanRadioGroup v-model="invalidateForm.reason" class="radio-group">
353
- <VanRadio
354
- v-for="item in invalidateReasons"
355
- :key="item.value"
356
- :name="item.value"
357
- class="radio-item"
358
- >
359
- {{ item.label }}
360
- </VanRadio>
361
- </VanRadioGroup>
362
- </div>
363
-
364
- <div class="form-item">
365
- <div class="form-label">
366
- 补充说明
367
- </div>
368
- <VanField
369
- v-model="invalidateForm.remark"
370
- type="textarea"
371
- rows="3"
372
- placeholder="请详细说明作废原因(选填)"
373
- class="field-item"
374
- />
375
- </div>
376
- </div>
377
- </VanDialog>
378
- </div>
93
+ <NormalDataLayout id="XCellListView" title="工作计划">
94
+ <template #layout_content>
95
+ <XCellList
96
+ :config-name="configName"
97
+ :service-name="serviceName"
98
+ :fix-query-form="{ o_f_oper_name: 'edu_test' }"
99
+ :id-key="idKey"
100
+ @to-detail="toDetail"
101
+ @delete-row="deleteRow"
102
+ />
103
+ </template>
104
+ </NormalDataLayout>
379
105
  </template>
380
106
 
381
107
  <style scoped lang="less">
382
- .xlv_t{
383
- --van-cell-horizontal-padding: 0;
384
- --van-cell-vertical-padding: 0;
385
- .dialog-content {
386
- padding: 8%;
387
- .form-item {
388
- margin-bottom: 20px;
389
-
390
- &:last-child {
391
- margin-bottom: 0;
392
- }
393
- }
394
-
395
- .form-label {
396
- font-size: 14px;
397
- color: #323233;
398
- margin-bottom: 12px;
399
- font-weight: 500;
400
- }
401
-
402
- .radio-group {
403
- display: flex;
404
- flex-direction: column;
405
- gap: 12px;
406
- }
407
-
408
- .radio-item {
409
- font-size: 14px;
410
- color: #323233;
411
- }
412
-
413
- .field-item {
414
- :deep(.van-field__control) {
415
- min-height: 80px;
416
- border: 1px solid #ebedf0;
417
- border-radius: 4px;
418
- padding: 8px 12px;
419
- background-color: #f7f8fa;
420
- }
421
-
422
- :deep(.van-field__placeholder) {
423
- color: #969799;
424
- }
425
- }
426
- }
427
- }
428
108
  </style>
@@ -9,13 +9,6 @@ import { useRoute } from 'vue-router'
9
9
  const configName = ref('form_check_test')
10
10
  const serviceName = ref('af-system')
11
11
 
12
- // const configName = ref("计划下发Form")
13
- // const serviceName = ref("af-linepatrol")
14
-
15
- // 表单组
16
- // const configName = ref('lngChargeAuditMobileFormGroup')
17
- // const serviceName = ref('af-gaslink')
18
-
19
12
  const formData = ref({})
20
13
  const formGroup = ref(null)
21
14
  const route = useRoute()
@@ -25,36 +18,6 @@ function submit(_result) {
25
18
  history.back()
26
19
  })
27
20
  }
28
-
29
- // 表单组——数据
30
- // function initComponents () {
31
- // runLogic('getlngChargeAuditMobileFormGroupData', {id: 29}, 'af-gaslink').then((res) => {
32
- // formData.value = {...res}
33
- // })
34
- // }
35
-
36
- // 纯表单——数据
37
- // function initComponents() {
38
- // formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
39
- // }
40
-
41
- // function initComponents() {
42
- // runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
43
- // console.log('res------', res)
44
- // formData.value = { ...res }
45
- // formGroup.value.init({
46
- // configName: configName.value,
47
- // serviceName: serviceName.value,
48
- // groupFormData: { ...res },
49
- // mode: "新增"
50
- // })
51
- // isInit.value = true
52
- // })
53
- // }
54
-
55
- // onBeforeMount(() => {
56
- // initComponents()
57
- // })
58
21
  </script>
59
22
 
60
23
  <template>