af-mobile-client-vue3 1.6.21 → 1.6.22

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,116 +1,134 @@
1
1
  <script setup lang="ts">
2
- import type { CascadeOption } from '@af-mobile-client-vue3/components/data/XAddressCascadePicker/index.vue'
3
- import XAddressCascadePicker from '@af-mobile-client-vue3/components/data/XAddressCascadePicker/index.vue'
4
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
5
3
  import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
6
- import { showToast } from 'vant'
4
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
7
5
  import { ref } from 'vue'
8
6
  import { useRouter } from 'vue-router'
9
7
 
10
8
  // 定义事件
11
- const emit = defineEmits(['deleteRow', 'addressSelected'])
9
+ const emit = defineEmits(['deleteRow'])
10
+
11
+ // 多选操作配置
12
+ const multiSelectActions = ref([
13
+ { name: '批量审核', key: 'batchAudit', color: '#000000', icon: 'passed' },
14
+ ])
15
+
16
+ const userInfo = useUserStore().getUserInfo()
12
17
  // 访问路由
13
18
  const router = useRouter()
14
19
  // 获取默认值
15
- // const idKey = ref('o_id')
20
+ const idKey = ref('o_id')
16
21
 
17
22
  // 简易crud表单测试
18
- const configName = ref('ceshiCRUD')
19
- const serviceName = ref('af-safecheck')
20
- const showAddressPicker = ref(false)
21
-
22
- const communityOptions = ref<CascadeOption[]>([
23
- { id: 'c1', label: '阳光花园阳光花园阳光花园阳光花园阳光花园阳光花园阳光花园', sub_text: '2栋', children: [
24
- { id: 'b11', label: '11号楼', status_text: '入户', status_type: '#16a34a', children: [
25
- { id: 'u111', label: '11单元', children: [
26
- { id: 'u111-h-101', label: '1011室', code: '111222333444555', status_text: '测试', status_type: '#6b7280', is_leaf: true },
27
- { id: 'u111-h-102', label: '1021室', code: '111', status_text: '入户', status_type: '#16a34a', is_leaf: true },
28
- { id: 'u111-h-103', label: '1031室', code: '111', status_text: '未检', status_type: '#6b7280', is_leaf: true },
29
- { id: 'u111-h-104', label: '1041室', code: '111', status_text: '未检', status_type: '#6b7280', is_leaf: true },
30
- ] },
31
- ] },
32
- ] },
33
- { id: 'c2', label: '金色家园', sub_text: '1栋' },
34
- { id: 'c3', label: '阳光商业广场', sub_text: '4栋' },
35
- { id: 'c4', label: '工业园A区', sub_text: '2栋' },
36
- { id: 'c5', label: '建材市场', sub_text: '1栋' },
37
- ])
23
+ const configName = ref('lngChargeAuditMobileCRUD')
24
+ const serviceName = ref('af-gaslink')
38
25
 
39
- const buildingMap: Record<string, CascadeOption[]> = {
40
- c1: [{ id: 'b11', label: '1号楼' }, { id: 'b12', label: '2号楼' }],
41
- c2: [{ id: 'b21', label: '1号楼' }],
42
- c3: [{ id: 'b31', label: 'A栋' }, { id: 'b32', label: 'B栋' }],
43
- c4: [{ id: 'b41', label: '1号楼' }, { id: 'b42', label: '2号楼' }, { id: 'b43', label: '3号楼' }],
44
- c5: [{ id: 'b51', label: '1号楼' }],
45
- }
26
+ // 资源权限测试
27
+ // const configName = ref('crud_sources_test')
28
+ // const serviceName = ref('af-system')
29
+
30
+ // 实际业务测试
31
+ // const configName = ref('lngChargeAuditMobileCRUD')
32
+ // const serviceName = ref('af-gaslink')
33
+
34
+ // 跳转到详情页面
35
+ // function toDetail(item) {
36
+ // router.push({
37
+ // name: 'XCellDetailView',
38
+ // params: { id: item[idKey.value] }, // 如果使用命名路由,推荐使用路由参数而不是直接构建 URL
39
+ // query: {
40
+ // operName: item[operNameKey.value],
41
+ // method:item[methodKey.value],
42
+ // requestMethod:item[requestMethodKey.value],
43
+ // operatorType:item[operatorTypeKey.value],
44
+ // operUrl:item[operUrlKey.value],
45
+ // operIp:item[operIpKey.value],
46
+ // costTime:item[costTimeKey.value],
47
+ // operTime:item[operTimeKey.value],
48
+ //
49
+ // title: item[titleKey.value],
50
+ // businessType: item[businessTypeKey.value],
51
+ // status:item[statusKey.value]
52
+ // }
53
+ // })
54
+ // }
46
55
 
47
- function buildHouseLeafList(unitId: string): CascadeOption[] {
48
- return Array.from({ length: 8 }).map((_, index) => {
49
- const roomNo = 101 + index
50
- return {
51
- id: `${unitId}-h-${roomNo}`,
52
- label: String(roomNo),
53
- is_leaf: true,
54
- code: `U${String(index + 1).padStart(3, '0')}`,
55
- status_text: index % 2 === 0 ? '入户' : '未检',
56
- status_type: index % 2 === 0 ? '#16a34a' : '#6b7280',
57
- }
56
+ // 跳转到表单——以表单组来渲染纯表单
57
+ function toDetail(item) {
58
+ const query = {
59
+ checkId: null,
60
+ safeCheckType: '年度普查',
61
+ bonusData: JSON.stringify({
62
+ inspectionType: {},
63
+ }),
64
+ userType: '民用',
65
+ userinfoid: '96451',
66
+ newDate: new Date().getTime(),
67
+ isDraft: 'false', // 是否存在临时数据
68
+ draftType: '计划安检',
69
+ }
70
+ router.push({
71
+ name: 'SecurityCertificate',
72
+ query,
58
73
  })
74
+ // router.push({
75
+ // name: 'XFormView',
76
+ // query: {
77
+ // id: item[idKey.value],
78
+ // // id: item.rr_id,
79
+ // // o_id: item.o_id,
80
+ // },
81
+ // })
59
82
  }
60
83
 
61
- const unitWithFloorAndHouseMap: Record<string, CascadeOption[]> = {
62
- b11: [
63
- { id: 'u111', label: '1单元', children: buildHouseLeafList('u111') },
64
- { id: 'u112', label: '2单元', children: buildHouseLeafList('u112') },
65
- ],
66
- b12: [
67
- { id: 'u121', label: '1单元', children: buildHouseLeafList('u121') },
68
- ],
69
- b21: [
70
- { id: 'u211', label: '1单元', children: buildHouseLeafList('u211') },
71
- ],
72
- b31: [
73
- { id: 'u311', label: '1单元', children: buildHouseLeafList('u311') },
74
- { id: 'u312', label: '2单元', children: buildHouseLeafList('u312') },
75
- ],
76
- b32: [
77
- { id: 'u321', label: '1单元', children: buildHouseLeafList('u321') },
78
- ],
79
- b41: [
80
- { id: 'u411', label: '1单元', children: buildHouseLeafList('u411') },
81
- ],
82
- b42: [
83
- { id: 'u421', label: '1单元', children: buildHouseLeafList('u421') },
84
- { id: 'u422', label: '2单元', children: buildHouseLeafList('u422') },
85
- ],
86
- b43: [
87
- { id: 'u431', label: '1单元', children: buildHouseLeafList('u431') },
88
- ],
89
- b51: [
90
- { id: 'u511', label: '1单元', children: buildHouseLeafList('u511') },
91
- ],
92
- }
84
+ // 新增功能
85
+ // function addOption(totalCount) {
86
+ // router.push({
87
+ // name: 'XFormView',
88
+ // params: { id: totalCount, openid: totalCount },
89
+ // query: {
90
+ // configName: configName.value,
91
+ // serviceName: serviceName.value,
92
+ // mode: '新增',
93
+ // },
94
+ // })
95
+ // }
93
96
 
94
- async function loadAddressChildren(node: CascadeOption, _path: CascadeOption[], levelIndex: number): Promise<CascadeOption[]> {
95
- if (levelIndex === 0) {
96
- return buildingMap[String(node.id)] || []
97
- }
97
+ // 修改功能
98
+ // function updateRow(result) {
99
+ // router.push({
100
+ // name: 'XFormView',
101
+ // params: { id: result.o_id, openid: result.o_id },
102
+ // query: {
103
+ // configName: configName.value,
104
+ // serviceName: serviceName.value,
105
+ // mode: '修改',
106
+ // },
107
+ // })
108
+ // }
98
109
 
99
- if (levelIndex === 1) {
100
- return unitWithFloorAndHouseMap[String(node.id)] || []
101
- }
110
+ // 删除功能
111
+ function deleteRow(result) {
112
+ emit('deleteRow', result.o_id)
113
+ }
102
114
 
103
- return []
115
+ // 多选操作处理
116
+ function handleMultiSelectAction(action: string, selectedItems: any[], selectedItemsArray: any[]) {
117
+ console.log('多选操作:', action, selectedItems, selectedItemsArray)
104
118
  }
105
119
 
106
- function selectAddress() {
107
- showAddressPicker.value = true
120
+ // 选择变化处理
121
+ function handleSelectionChange(selectedItems: any[]) {
122
+ console.log('选择变化,当前选中:', selectedItems.length, '个项目')
123
+ // 可以在这里更新UI状态,比如显示选中数量等
108
124
  }
109
125
 
110
- function handleAddressConfirm(payload: { leaf: CascadeOption, path: CascadeOption[] }) {
111
- console.log('>>>> payload: ', JSON.stringify(payload))
112
- const pathLabel = payload.path.map(item => item.label).join(' / ')
113
- showToast(`已选择:${pathLabel}`)
126
+ // 数据加载完成后处理 @after-load
127
+ function afterLoad(result) {
128
+ console.log('afterLoad:', result)
129
+ }
130
+ function emitFunc(func, data) {
131
+ console.log('emitFunc:', func, data)
114
132
  }
115
133
  </script>
116
134
 
@@ -118,18 +136,16 @@ function handleAddressConfirm(payload: { leaf: CascadeOption, path: CascadeOptio
118
136
  <NormalDataLayout id="XCellListView" title="工作计划">
119
137
  <template #layout_content>
120
138
  <XCellList
121
- :config-name="configName"
122
- :service-name="serviceName"
123
- @select-address="selectAddress"
124
- />
125
- <XAddressCascadePicker
126
- v-model="showAddressPicker"
127
- title="地址选择"
128
- :root-options="communityOptions"
129
- :load-children="loadAddressChildren"
130
- :expanded-level-indexes="[2]"
131
- :preserve-last-state-on-confirm="true"
132
- @confirm="handleAddressConfirm"
139
+ config-name="scanCodeAndNFCRUD"
140
+ service-name="af-safecheck"
141
+ :enable-multi-select="true"
142
+ id-key="t_id"
143
+ :is-limit-query="true"
144
+ :multi-select-actions="multiSelectActions"
145
+ @to-detail="toDetail"
146
+ @multi-select-action="handleMultiSelectAction"
147
+ @selection-change="handleSelectionChange"
148
+ @x-form-item-emit-func="emitFunc"
133
149
  />
134
150
  </template>
135
151
  </NormalDataLayout>
@@ -5,22 +5,60 @@ import { showDialog } from 'vant'
5
5
  import { ref } from 'vue'
6
6
  import { useRoute } from 'vue-router'
7
7
 
8
+ // const configName = ref('reviewFormGroup')
9
+ // const serviceName = ref('af-revenue')
10
+
8
11
  // 纯表单
9
- const configName = ref('form_check_test')
10
- const serviceName = ref('af-system')
12
+ // const configName = ref('form_check_test')
13
+ // const serviceName = ref('af-system')
14
+
15
+ // const configName = ref("计划下发Form")
16
+ // const serviceName = ref("af-linepatrol")
17
+
18
+ // 表单组
19
+ const configName = ref('lngChargeAuditMobileFormGroup')
20
+ const serviceName = ref('af-gaslink')
11
21
 
12
22
  const formData = ref({})
13
- const formGroup = ref<any>(null)
23
+ const formGroup = ref(null)
14
24
  const route = useRoute()
15
25
  const isInit = ref(false)
16
26
  function submit(_result) {
17
27
  showDialog({ message: '提交成功' }).then(() => {
18
- formGroup.value?.closeLoading?.()
19
- history.back()
20
- }).catch(() => {
21
- formGroup.value?.closeLoading?.()
28
+ console.log('12121')
29
+ // history.back()
22
30
  })
23
31
  }
32
+
33
+ // 表单组——数据
34
+ // function initComponents () {
35
+ // runLogic('getlngChargeAuditMobileFormGroupData', {id: 29}, 'af-gaslink').then((res) => {
36
+ // formData.value = {...res}
37
+ // })
38
+ // }
39
+
40
+ // 纯表单——数据
41
+ // function initComponents() {
42
+ // formData.value = { plan_name: 'af-llllll', plan_point: '1号点位', plan_single: '1号点位', plan_range: '2024-12-12' }
43
+ // }
44
+
45
+ // function initComponents() {
46
+ // runLogic('getlngChargeAuditMobileFormGroupData', { id: route.query?.id, o_id: route.query?.o_id }, 'af-gaslink').then((res) => {
47
+ // console.log('res------', res)
48
+ // formData.value = { ...res }
49
+ // formGroup.value.init({
50
+ // configName: configName.value,
51
+ // serviceName: serviceName.value,
52
+ // groupFormData: { ...res },
53
+ // mode: "新增"
54
+ // })
55
+ // isInit.value = true
56
+ // })
57
+ // }
58
+
59
+ // onBeforeMount(() => {
60
+ // initComponents()
61
+ // })
24
62
  </script>
25
63
 
26
64
  <template>
@@ -29,10 +67,9 @@ function submit(_result) {
29
67
  <!-- v-if="isInit" -->
30
68
  <XFormGroup
31
69
  ref="formGroup"
32
- :config-name="configName"
33
- :service-name="serviceName"
70
+ config-name="ApplyAddContractFormGroup"
71
+ service-name="af-apply"
34
72
  :group-form-data="formData"
35
- :enable-submit-loading="true"
36
73
  mode="新增"
37
74
  @submit="submit"
38
75
  />
@@ -1,36 +1,25 @@
1
1
  <script setup lang="ts">
2
2
  import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
3
  import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
-
5
- import router from '@af-mobile-client-vue3/router'
6
4
  import { ref } from 'vue'
5
+ import {
6
+ Button as VanButton,
7
+ } from 'vant'
7
8
 
8
- const configName = ref('AddConstructionForm')
9
- const serviceName = ref('af-linepatrol')
10
-
11
- const formGroupAddConstruction = ref<any>(null)
12
- function sleep(ms) {
13
- return new Promise(resolve => setTimeout(resolve, ms))
14
- }
15
- // 地图预览相关
16
- const previewMapRef = ref(null)
9
+ const configName = ref('测试Form')
10
+ const serviceName = ref('af-safecheck')
11
+ const formGroupAddConstruction = ref()
17
12
 
18
- async function onSubmit(data: any) {
19
- try {
20
- console.warn('提交表单', data)
21
- await sleep(1000) // 暂停10秒
22
- router.back()
23
- }
24
- finally {
25
- formGroupAddConstruction.value?.closeLoading?.()
26
- }
13
+ // 提交测试
14
+ function onSubmit(form) {
15
+ console.log('事件触发提交表单----', form)
27
16
  }
28
- function onAddressChange(data: any) {
29
- console.warn('表单新增数据变化', data)
17
+ async function onAsyncSubmit() {
18
+ const res = await formGroupAddConstruction.value.asyncSubmit()
19
+ console.log('异步提交表单----', res)
30
20
  }
31
-
32
- function onRegionChange(data: any) {
33
- console.warn('表单新增数据变化', data)
21
+ function emitFunc(func, data) {
22
+ console.log('emitFunc:', func, data)
34
23
  }
35
24
  </script>
36
25
 
@@ -39,16 +28,17 @@ function onRegionChange(data: any) {
39
28
  <template #layout_content>
40
29
  <XForm
41
30
  ref="formGroupAddConstruction"
42
- mode="新增"
31
+ mode="修改"
43
32
  :config-name="configName"
44
- :service-name="serviceName"
45
- :enable-submit-loading="true"
46
- @address-change="onAddressChange"
47
- @region-change="onRegionChange"
33
+ :show-tab-header="false"
34
+ service-name="af-safecheck"
35
+ :is-group-form="true"
48
36
  @on-submit="onSubmit"
37
+ @x-form-item-emit-func="emitFunc"
49
38
  />
50
39
  </template>
51
40
  </NormalDataLayout>
41
+ <van-button type="primary" @click="onAsyncSubmit">提交1</van-button>
52
42
  </template>
53
43
 
54
44
  <style scoped lang="less">