af-mobile-client-vue3 1.3.37 → 1.3.39

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.3.37",
4
+ "version": "1.3.39",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -113,26 +113,44 @@ function handlePhotoUpload(photoData: any) {
113
113
 
114
114
  // 删除图片
115
115
  function deleteFileFunction(file: any) {
116
+ // 情况1:有后端id的已上传文件,先调接口再本地移除
116
117
  if (file.id) {
117
118
  deleteFile({ ids: [file.id], f_state: '删除' }).then((res: any) => {
118
119
  if (res.msg !== undefined) {
119
120
  const targetIndex = imageList.value.findIndex(item => item.id === file.id)
120
- if (targetIndex !== -1) {
121
+ if (targetIndex !== -1)
121
122
  imageList.value.splice(targetIndex, 1)
122
123
 
123
- emit('updateAllFileList', imageList.value.filter(item => item.status === 'done').map(item => item)) // 新增
124
+ emit('updateAllFileList', imageList.value.filter(item => item.status === 'done').map(item => item))
124
125
 
125
- const doneIds = Object.values(imageList.value)
126
- .filter(item => item.status === 'done')
127
- .map(item => item.id)
128
- if (props.outerIndex !== undefined)
129
- emit('updateFileList', doneIds, props.outerIndex)
130
- else
131
- emit('updateFileList', doneIds)
132
- }
126
+ const doneIds = Object.values(imageList.value)
127
+ .filter(item => item.status === 'done')
128
+ .map(item => item.id)
129
+ if (props.outerIndex !== undefined)
130
+ emit('updateFileList', doneIds, props.outerIndex)
131
+ else
132
+ emit('updateFileList', doneIds)
133
133
  }
134
134
  })
135
+ return false // 已手动移除,阻止van-uploader再次移除
135
136
  }
137
+
138
+ // 情况2:上传失败/上传中的临时文件(无id),允许直接删除
139
+ const targetIndex = imageList.value.findIndex(item => item.uid === file.uid || item.url === file.url)
140
+ if (targetIndex !== -1)
141
+ imageList.value.splice(targetIndex, 1)
142
+
143
+ emit('updateAllFileList', imageList.value.filter(item => item.status === 'done').map(item => item))
144
+
145
+ const doneIds = Object.values(imageList.value)
146
+ .filter(item => item.status === 'done')
147
+ .map(item => item.id)
148
+ if (props.outerIndex !== undefined)
149
+ emit('updateFileList', doneIds, props.outerIndex)
150
+ else
151
+ emit('updateFileList', doneIds)
152
+
153
+ return false // 阻止van-uploader二次处理
136
154
  }
137
155
 
138
156
  const showActionSheet = ref(false)
@@ -155,7 +155,7 @@ const routes: Array<RouteRecordRaw> = [
155
155
  component: XFormAppraiseView,
156
156
  },
157
157
  {
158
- path: '/Component/XFormView/:id/:openid',
158
+ path: '/Component/XFormView',
159
159
  name: 'XFormView',
160
160
  component: XFormView,
161
161
  },
@@ -19,15 +19,20 @@ interface Param {
19
19
  export class mobileUtil {
20
20
  // 执行flutter端函数
21
21
  static execute(locationParam: Param): any {
22
- locationParam.callBackMethodName = `mobile_func_${Math.random().toString(36).substring(7)}`
23
- if (window.__MICRO_APP_ENVIRONMENT__) {
24
- console.warn('Page Load in _MICRO_APP_');
25
- // 微前端应用中需要绑定函数到真实的window中
26
- (window as any).rawWindow[locationParam.callBackMethodName] = locationParam.callbackFunc
22
+ try {
23
+ locationParam.callBackMethodName = `mobile_func_${Math.random().toString(36).substring(7)}`
24
+ if (window.__MICRO_APP_ENVIRONMENT__) {
25
+ console.warn('Page Load in _MICRO_APP_');
26
+ // 微前端应用中需要绑定函数到真实的window
27
+ (window as any).rawWindow[locationParam.callBackMethodName] = locationParam.callbackFunc
28
+ }
29
+ else {
30
+ window[locationParam.callBackMethodName] = locationParam.callbackFunc
31
+ }
32
+ window[locationParam.funcName].postMessage(JSON.stringify(locationParam))
27
33
  }
28
- else {
29
- window[locationParam.callBackMethodName] = locationParam.callbackFunc
34
+ catch (e) {
35
+ locationParam.callbackFunc({ status: 'error', msg: '手机端函数调用失败!!!' })
30
36
  }
31
- window[locationParam.funcName].postMessage(JSON.stringify(locationParam))
32
37
  }
33
38
  }
@@ -1,57 +1,57 @@
1
- /**
2
- * 根据类型获取日期区间字符串
3
- * @param type '当年' | 'curMonth' | '当日'
4
- * @param show 区分实际值还是显示值, true为实际值, false为显示值
5
- * @returns [start, end] 例:['2024-01-01 00:00:00', '2024-12-31 23:59:59']
6
- */
7
- export function getRangeByType(type: string, show: boolean): [string, string] {
8
- const now = new Date()
9
- const year = now.getFullYear()
10
- const month = (now.getMonth() + 1).toString().padStart(2, '0')
11
- const day = now.getDate().toString().padStart(2, '0')
12
-
13
- if (!show) {
14
- if (type === 'curYear') {
15
- return [
16
- `${year}-01-01 00:00:00`,
17
- `${year}-12-31 23:59:59`,
18
- ]
19
- }
20
- if (type === 'curMonth') {
21
- const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
22
- return [
23
- `${year}-${month}-01 00:00:00`,
24
- `${year}-${month}-${lastDay.toString().padStart(2, '0')} 23:59:59`,
25
- ]
26
- }
27
- if (type === 'curDay') {
28
- return [
29
- `${year}-${month}-${day} 00:00:00`,
30
- `${year}-${month}-${day} 23:59:59`,
31
- ]
32
- }
33
- }
34
- if (show) {
35
- if (type === 'curYear') {
36
- return [
37
- `${year}-01-01`,
38
- `${year}-12-31`,
39
- ]
40
- }
41
- if (type === 'curMonth') {
42
- const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
43
- return [
44
- `${year}-${month}-01`,
45
- `${year}-${month}-${lastDay.toString().padStart(2, '0')}`,
46
- ]
47
- }
48
- if (type === 'curDay') {
49
- return [
50
- `${year}-${month}-${day}`,
51
- `${year}-${month}-${day}`,
52
- ]
53
- }
54
- }
55
- // 兜底返回空字符串数组
56
- return ['', '']
57
- }
1
+ /**
2
+ * 根据类型获取日期区间字符串
3
+ * @param type '当年' | 'curMonth' | '当日'
4
+ * @param show 区分实际值还是显示值, true为实际值, false为显示值
5
+ * @returns [start, end] 例:['2024-01-01 00:00:00', '2024-12-31 23:59:59']
6
+ */
7
+ export function getRangeByType(type: string, show: boolean): [string, string] {
8
+ const now = new Date()
9
+ const year = now.getFullYear()
10
+ const month = (now.getMonth() + 1).toString().padStart(2, '0')
11
+ const day = now.getDate().toString().padStart(2, '0')
12
+
13
+ if (!show) {
14
+ if (type === 'curYear') {
15
+ return [
16
+ `${year}-01-01 00:00:00`,
17
+ `${year}-12-31 23:59:59`,
18
+ ]
19
+ }
20
+ if (type === 'curMonth') {
21
+ const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
22
+ return [
23
+ `${year}-${month}-01 00:00:00`,
24
+ `${year}-${month}-${lastDay.toString().padStart(2, '0')} 23:59:59`,
25
+ ]
26
+ }
27
+ if (type === 'curDay') {
28
+ return [
29
+ `${year}-${month}-${day} 00:00:00`,
30
+ `${year}-${month}-${day} 23:59:59`,
31
+ ]
32
+ }
33
+ }
34
+ if (show) {
35
+ if (type === 'curYear') {
36
+ return [
37
+ `${year}-01-01`,
38
+ `${year}-12-31`,
39
+ ]
40
+ }
41
+ if (type === 'curMonth') {
42
+ const lastDay = new Date(year, now.getMonth() + 1, 0).getDate()
43
+ return [
44
+ `${year}-${month}-01`,
45
+ `${year}-${month}-${lastDay.toString().padStart(2, '0')}`,
46
+ ]
47
+ }
48
+ if (type === 'curDay') {
49
+ return [
50
+ `${year}-${month}-${day}`,
51
+ `${year}-${month}-${day}`,
52
+ ]
53
+ }
54
+ }
55
+ // 兜底返回空字符串数组
56
+ return ['', '']
57
+ }
@@ -1,11 +1,19 @@
1
1
  <script setup lang="ts">
2
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
3
  import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
4
5
  import { defineEmits, ref } from 'vue'
5
6
  import { useRouter } from 'vue-router'
6
7
 
7
8
  // 定义事件
8
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()
9
17
  // 访问路由
10
18
  const router = useRouter()
11
19
  // 获取默认值
@@ -48,7 +56,7 @@ const serviceName = ref('af-gaslink')
48
56
  // 跳转到表单——以表单组来渲染纯表单
49
57
  function toDetail(item) {
50
58
  router.push({
51
- name: 'XFormGroupView',
59
+ name: 'XFormView',
52
60
  query: {
53
61
  id: item[idKey.value],
54
62
  // id: item.rr_id,
@@ -87,18 +95,31 @@ function toDetail(item) {
87
95
  function deleteRow(result) {
88
96
  emit('deleteRow', result.o_id)
89
97
  }
98
+
99
+ // 多选操作处理
100
+ function handleMultiSelectAction(action: string, selectedItems: any[], selectedItemsArray: any[]) {
101
+ console.log('多选操作:', action, selectedItems, selectedItemsArray)
102
+ }
103
+
104
+ // 选择变化处理
105
+ function handleSelectionChange(selectedItems: any[]) {
106
+ console.log('选择变化,当前选中:', selectedItems.length, '个项目')
107
+ // 可以在这里更新UI状态,比如显示选中数量等
108
+ }
90
109
  </script>
91
110
 
92
111
  <template>
93
112
  <NormalDataLayout id="XCellListView" title="工作计划">
94
113
  <template #layout_content>
95
114
  <XCellList
96
- :config-name="configName"
97
- :service-name="serviceName"
98
- :fix-query-form="{ o_f_oper_name: 'edu_test' }"
99
- :id-key="idKey"
115
+ config-name="lngChargeAuditMobileCRUD"
116
+ service-name="af-gaslink"
117
+ :enable-multi-select="true"
118
+ id-key="rr_id"
119
+ :multi-select-actions="multiSelectActions"
100
120
  @to-detail="toDetail"
101
- @delete-row="deleteRow"
121
+ @multi-select-action="handleMultiSelectAction"
122
+ @selection-change="handleSelectionChange"
102
123
  />
103
124
  </template>
104
125
  </NormalDataLayout>
@@ -5,16 +5,19 @@ 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')
11
14
 
12
15
  // const configName = ref("计划下发Form")
13
16
  // const serviceName = ref("af-linepatrol")
14
17
 
15
18
  // 表单组
16
- // const configName = ref('lngChargeAuditMobileFormGroup')
17
- // const serviceName = ref('af-gaslink')
19
+ const configName = ref('lngChargeAuditMobileFormGroup')
20
+ const serviceName = ref('af-gaslink')
18
21
 
19
22
  const formData = ref({})
20
23
  const formGroup = ref(null)
@@ -22,7 +25,8 @@ const route = useRoute()
22
25
  const isInit = ref(false)
23
26
  function submit(_result) {
24
27
  showDialog({ message: '提交成功' }).then(() => {
25
- history.back()
28
+ console.log('12121')
29
+ // history.back()
26
30
  })
27
31
  }
28
32
 
@@ -63,8 +67,8 @@ function submit(_result) {
63
67
  <!-- v-if="isInit" -->
64
68
  <XFormGroup
65
69
  ref="formGroup"
66
- :config-name="configName"
67
- :service-name="serviceName"
70
+ config-name="ApplyAddContractFormGroup"
71
+ service-name="af-apply"
68
72
  :group-form-data="formData"
69
73
  mode="新增"
70
74
  @submit="submit"
@@ -3,8 +3,8 @@ 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
4
  import { ref } from 'vue'
5
5
 
6
- const configName = ref('AddConstructionForm')
7
- const serviceName = ref('af-linepatrol')
6
+ const configName = ref('lngSecurityChecktestForm')
7
+ const serviceName = ref('af-safecheck')
8
8
 
9
9
  const formGroupAddConstruction = ref(null)
10
10
  </script>
@@ -1,118 +1,118 @@
1
- <script setup lang="ts">
2
- import type { LocationResult } from '@af-mobile-client-vue3/components/data/XOlMap/types'
3
- import LocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
4
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
5
- import { showNotify } from 'vant'
6
- import { ref } from 'vue'
7
-
8
- const selectedLocation = ref<LocationResult>()
9
-
10
- // 处理位置选择
11
- function handleLocationConfirm(location: LocationResult) {
12
- // console.log('选择的位置:', location)
13
- // selectedLocation.value = location
14
- showNotify({ type: 'success', message: '位置已选择' })
15
- }
16
- </script>
17
-
18
- <template>
19
- <NormalDataLayout id="XLocationPicker" title="XOlMap地址选择器">
20
- <template #layout_content>
21
- <div class="location-picker-demo">
22
- <!-- 页面标题 -->
23
- <div class="page-header">
24
- <div class="title">
25
- 位置选择
26
- </div>
27
- </div>
28
-
29
- <!-- 选择结果展示 -->
30
- <div v-if="selectedLocation" class="location-result">
31
- <div class="label">
32
- 已选位置:
33
- </div>
34
- <div class="value">
35
- {{ selectedLocation.address }}
36
- </div>
37
- <div class="coordinates">
38
- 经度: {{ selectedLocation.longitude.toFixed(6) }},
39
- 纬度: {{ selectedLocation.latitude.toFixed(6) }}
40
- </div>
41
- </div>
42
-
43
- <!-- 地图组件 -->
44
- <div class="map-container">
45
- <LocationPicker
46
- v-model="selectedLocation"
47
- :default-center="[108.948024, 34.263161]"
48
- :default-zoom="12"
49
- @confirm="handleLocationConfirm"
50
- />
51
- </div>
52
- </div>
53
- </template>
54
- </NormalDataLayout>
55
- </template>
56
-
57
- <style scoped lang="less">
58
- .location-picker-demo {
59
- width: 100%;
60
- height: 100%;
61
- position: relative;
62
- display: flex;
63
- flex-direction: column;
64
- background-color: #f7f8fa;
65
- }
66
-
67
- .page-header {
68
- height: 44px;
69
- display: flex;
70
- align-items: center;
71
- justify-content: center;
72
- background: white;
73
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
74
- position: relative;
75
- z-index: 1;
76
-
77
- .title {
78
- font-size: 16px;
79
- color: #333;
80
- font-weight: 500;
81
- }
82
- }
83
-
84
- .location-result {
85
- background: white;
86
- padding: 12px 16px;
87
- margin: 10px;
88
- border-radius: 8px;
89
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
90
-
91
- .label {
92
- font-size: 14px;
93
- color: #666;
94
- margin-bottom: 4px;
95
- }
96
-
97
- .value {
98
- font-size: 16px;
99
- color: #333;
100
- margin-bottom: 8px;
101
- word-break: break-all;
102
- }
103
-
104
- .coordinates {
105
- font-size: 12px;
106
- color: #999;
107
- }
108
- }
109
-
110
- .map-container {
111
- flex: 1;
112
- position: relative;
113
- margin: 0 10px 10px 10px;
114
- border-radius: 8px;
115
- overflow: hidden;
116
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
117
- }
118
- </style>
1
+ <script setup lang="ts">
2
+ import type { LocationResult } from '@af-mobile-client-vue3/components/data/XOlMap/types'
3
+ import LocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
4
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
5
+ import { showNotify } from 'vant'
6
+ import { ref } from 'vue'
7
+
8
+ const selectedLocation = ref<LocationResult>()
9
+
10
+ // 处理位置选择
11
+ function handleLocationConfirm(location: LocationResult) {
12
+ // console.log('选择的位置:', location)
13
+ // selectedLocation.value = location
14
+ showNotify({ type: 'success', message: '位置已选择' })
15
+ }
16
+ </script>
17
+
18
+ <template>
19
+ <NormalDataLayout id="XLocationPicker" title="XOlMap地址选择器">
20
+ <template #layout_content>
21
+ <div class="location-picker-demo">
22
+ <!-- 页面标题 -->
23
+ <div class="page-header">
24
+ <div class="title">
25
+ 位置选择
26
+ </div>
27
+ </div>
28
+
29
+ <!-- 选择结果展示 -->
30
+ <div v-if="selectedLocation" class="location-result">
31
+ <div class="label">
32
+ 已选位置:
33
+ </div>
34
+ <div class="value">
35
+ {{ selectedLocation.address }}
36
+ </div>
37
+ <div class="coordinates">
38
+ 经度: {{ selectedLocation.longitude.toFixed(6) }},
39
+ 纬度: {{ selectedLocation.latitude.toFixed(6) }}
40
+ </div>
41
+ </div>
42
+
43
+ <!-- 地图组件 -->
44
+ <div class="map-container">
45
+ <LocationPicker
46
+ v-model="selectedLocation"
47
+ :default-center="[108.948024, 34.263161]"
48
+ :default-zoom="12"
49
+ @confirm="handleLocationConfirm"
50
+ />
51
+ </div>
52
+ </div>
53
+ </template>
54
+ </NormalDataLayout>
55
+ </template>
56
+
57
+ <style scoped lang="less">
58
+ .location-picker-demo {
59
+ width: 100%;
60
+ height: 100%;
61
+ position: relative;
62
+ display: flex;
63
+ flex-direction: column;
64
+ background-color: #f7f8fa;
65
+ }
66
+
67
+ .page-header {
68
+ height: 44px;
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: center;
72
+ background: white;
73
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
74
+ position: relative;
75
+ z-index: 1;
76
+
77
+ .title {
78
+ font-size: 16px;
79
+ color: #333;
80
+ font-weight: 500;
81
+ }
82
+ }
83
+
84
+ .location-result {
85
+ background: white;
86
+ padding: 12px 16px;
87
+ margin: 10px;
88
+ border-radius: 8px;
89
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
90
+
91
+ .label {
92
+ font-size: 14px;
93
+ color: #666;
94
+ margin-bottom: 4px;
95
+ }
96
+
97
+ .value {
98
+ font-size: 16px;
99
+ color: #333;
100
+ margin-bottom: 8px;
101
+ word-break: break-all;
102
+ }
103
+
104
+ .coordinates {
105
+ font-size: 12px;
106
+ color: #999;
107
+ }
108
+ }
109
+
110
+ .map-container {
111
+ flex: 1;
112
+ position: relative;
113
+ margin: 0 10px 10px 10px;
114
+ border-radius: 8px;
115
+ overflow: hidden;
116
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
117
+ }
118
+ </style>