af-mobile-client-vue3 1.2.16 → 1.2.17
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
|
@@ -42,6 +42,7 @@ const props = withDefaults(defineProps<{
|
|
|
42
42
|
formName?: string
|
|
43
43
|
mode?: string
|
|
44
44
|
submitButton?: boolean
|
|
45
|
+
isHandleFormKey?: boolean
|
|
45
46
|
}>(), {
|
|
46
47
|
configName: undefined,
|
|
47
48
|
groupFormItems: null,
|
|
@@ -50,6 +51,7 @@ const props = withDefaults(defineProps<{
|
|
|
50
51
|
formName: 'default',
|
|
51
52
|
mode: '查询',
|
|
52
53
|
submitButton: true,
|
|
54
|
+
isHandleFormKey: true,
|
|
53
55
|
})
|
|
54
56
|
const emits = defineEmits(['onSubmit'])
|
|
55
57
|
const userStore = useUserStore()
|
|
@@ -76,9 +78,6 @@ const realJsonData = computed(() => {
|
|
|
76
78
|
})
|
|
77
79
|
})
|
|
78
80
|
|
|
79
|
-
// 是否处理表单Key值
|
|
80
|
-
const isHandleFormKey = ref(true)
|
|
81
|
-
|
|
82
81
|
// 过滤出用于静默新增场景的表单项
|
|
83
82
|
const silenceAddJsonData = computed(() => {
|
|
84
83
|
return myFormItems.value.filter((item) => {
|
|
@@ -263,7 +262,7 @@ function setForm(obj) {
|
|
|
263
262
|
function getRealKey(key, mustHandleKey = false) {
|
|
264
263
|
if (key === 'selected_id')
|
|
265
264
|
return key
|
|
266
|
-
if (isHandleFormKey
|
|
265
|
+
if (props.isHandleFormKey || mustHandleKey) {
|
|
267
266
|
return key.substring(key.indexOf('_') + 1)
|
|
268
267
|
}
|
|
269
268
|
else {
|
|
@@ -305,7 +304,7 @@ function handleFormKeys(form, mustHandleKey = false) {
|
|
|
305
304
|
realForm[extraFormKey][realKey] = value
|
|
306
305
|
}
|
|
307
306
|
else {
|
|
308
|
-
const realKey = isHandleFormKey
|
|
307
|
+
const realKey = props.isHandleFormKey || mustHandleKey ? getRealKey(key, mustHandleKey) : key
|
|
309
308
|
// 如果发生重名,不覆盖,把key的别名带上
|
|
310
309
|
if (realForm[realKey]) {
|
|
311
310
|
realForm[key] = value
|
|
@@ -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,26 +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'
|
|
5
4
|
import { defineEmits, ref } from 'vue'
|
|
6
5
|
import { useRouter } from 'vue-router'
|
|
7
6
|
|
|
8
7
|
// 定义事件
|
|
9
8
|
const emit = defineEmits(['deleteRow'])
|
|
10
|
-
const userInfo = useUserStore().getUserInfo()
|
|
11
9
|
// 访问路由
|
|
12
10
|
const router = useRouter()
|
|
13
11
|
// 获取默认值
|
|
14
12
|
const idKey = ref('o_id')
|
|
15
13
|
|
|
16
14
|
// 简易crud表单测试
|
|
17
|
-
|
|
18
|
-
// const serviceName = ref('af-gaslink')
|
|
19
|
-
// const configName = ref('lngPriceManageMobileCRUD')
|
|
20
|
-
const configName = ref('测试2')
|
|
15
|
+
const configName = ref('lngChargeAuditMobileCRUD')
|
|
21
16
|
const serviceName = ref('af-gaslink')
|
|
22
|
-
// const configName = ref('mobile_liushuiQueryCRUD')
|
|
23
|
-
// const serviceName = ref('af-revenue')
|
|
24
17
|
|
|
25
18
|
// 资源权限测试
|
|
26
19
|
// const configName = ref('crud_sources_test')
|
|
@@ -56,11 +49,11 @@ const serviceName = ref('af-gaslink')
|
|
|
56
49
|
function toDetail(item) {
|
|
57
50
|
router.push({
|
|
58
51
|
name: 'XFormGroupView',
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
query: {
|
|
53
|
+
id: item[idKey.value],
|
|
54
|
+
// id: item.rr_id,
|
|
55
|
+
// o_id: item.o_id,
|
|
56
|
+
},
|
|
64
57
|
})
|
|
65
58
|
}
|
|
66
59
|
|
|
@@ -76,35 +69,19 @@ function toDetail(item) {
|
|
|
76
69
|
// },
|
|
77
70
|
// })
|
|
78
71
|
// }
|
|
79
|
-
function addOption() {
|
|
80
|
-
router.push({
|
|
81
|
-
name: 'XFormGroupView',
|
|
82
|
-
// params: { id: totalCount.value },
|
|
83
|
-
// query: {
|
|
84
|
-
// configName: configName.value,
|
|
85
|
-
// serviceName: serviceName.value,
|
|
86
|
-
// mode: '新增',
|
|
87
|
-
// },
|
|
88
|
-
})
|
|
89
|
-
// 如果存在回调函数,调用它并传递true表示已处理
|
|
90
|
-
// if (typeof callback === 'function') {
|
|
91
|
-
// callback(true)
|
|
92
|
-
// }
|
|
93
|
-
}
|
|
94
72
|
|
|
95
73
|
// 修改功能
|
|
96
|
-
function updateRow(result) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
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
|
+
// }
|
|
108
85
|
|
|
109
86
|
// 删除功能
|
|
110
87
|
function deleteRow(result) {
|
|
@@ -115,23 +92,11 @@ function deleteRow(result) {
|
|
|
115
92
|
<template>
|
|
116
93
|
<NormalDataLayout id="XCellListView" title="工作计划">
|
|
117
94
|
<template #layout_content>
|
|
118
|
-
<!-- <XCellList -->
|
|
119
|
-
<!-- :config-name="configName" -->
|
|
120
|
-
<!-- :service-name="serviceName" -->
|
|
121
|
-
<!-- :custom-add="true" -->
|
|
122
|
-
<!-- :custom-edit="true" -->
|
|
123
|
-
<!-- :id-key="idKey" -->
|
|
124
|
-
<!-- @to-detail="toDetail" -->
|
|
125
|
-
<!-- @delete-row="deleteRow" -->
|
|
126
|
-
<!-- @update="updateRow" -->
|
|
127
|
-
<!-- @add="addOption" -->
|
|
128
|
-
<!-- /> -->
|
|
129
|
-
|
|
130
|
-
<!-- :fix-query-form="{ u_f_price_state: ['生效', '待生效'] }" -->
|
|
131
|
-
|
|
132
95
|
<XCellList
|
|
133
|
-
config-name="
|
|
134
|
-
service-name="
|
|
96
|
+
:config-name="configName"
|
|
97
|
+
:service-name="serviceName"
|
|
98
|
+
:fix-query-form="{ o_f_oper_name: 'edu_test' }"
|
|
99
|
+
:id-key="idKey"
|
|
135
100
|
@to-detail="toDetail"
|
|
136
101
|
@delete-row="deleteRow"
|
|
137
102
|
/>
|
|
@@ -5,19 +5,16 @@ 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
|
-
|
|
11
8
|
// 纯表单
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const configName = ref('form_check_test')
|
|
10
|
+
const serviceName = ref('af-system')
|
|
14
11
|
|
|
15
12
|
// const configName = ref("计划下发Form")
|
|
16
13
|
// const serviceName = ref("af-linepatrol")
|
|
17
14
|
|
|
18
15
|
// 表单组
|
|
19
|
-
const configName = ref('lngChargeAuditMobileFormGroup')
|
|
20
|
-
const serviceName = ref('af-gaslink')
|
|
16
|
+
// const configName = ref('lngChargeAuditMobileFormGroup')
|
|
17
|
+
// const serviceName = ref('af-gaslink')
|
|
21
18
|
|
|
22
19
|
const formData = ref({})
|
|
23
20
|
const formGroup = ref(null)
|