af-mobile-client-vue3 1.3.61 → 1.3.62

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,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,147 +1,134 @@
1
1
  <script setup lang="ts">
2
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
- import { defineOptions, onActivated, onMounted, ref } from 'vue'
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
+ import { defineEmits, ref } from 'vue'
4
6
  import { useRouter } from 'vue-router'
5
7
 
6
- defineOptions({ name: 'XCellListView' })
7
- const configName = ref('ApplyMobileProcessCRUD')
8
- const serviceName = ref('af-apply')
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()
17
+ // 访问路由
9
18
  const router = useRouter()
19
+ // 获取默认值
20
+ const idKey = ref('o_id')
21
+
22
+ // 简易crud表单测试
23
+ const configName = ref('lngChargeAuditMobileCRUD')
24
+ const serviceName = ref('af-gaslink')
25
+
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
+ // }
55
+
56
+ // 跳转到表单——以表单组来渲染纯表单
57
+ function toDetail(item) {
58
+ router.push({
59
+ name: 'XFormView',
60
+ query: {
61
+ id: item[idKey.value],
62
+ // id: item.rr_id,
63
+ // o_id: item.o_id,
64
+ },
65
+ })
66
+ }
67
+
68
+ // 新增功能
69
+ // function addOption(totalCount) {
70
+ // router.push({
71
+ // name: 'XFormView',
72
+ // params: { id: totalCount, openid: totalCount },
73
+ // query: {
74
+ // configName: configName.value,
75
+ // serviceName: serviceName.value,
76
+ // mode: '新增',
77
+ // },
78
+ // })
79
+ // }
80
+
81
+ // 修改功能
82
+ // function updateRow(result) {
83
+ // router.push({
84
+ // name: 'XFormView',
85
+ // params: { id: result.o_id, openid: result.o_id },
86
+ // query: {
87
+ // configName: configName.value,
88
+ // serviceName: serviceName.value,
89
+ // mode: '修改',
90
+ // },
91
+ // })
92
+ // }
93
+
10
94
  // 删除功能
11
- function phone(result) {
12
- // todo 调用真机进行通话
95
+ function deleteRow(result) {
96
+ emit('deleteRow', result.o_id)
97
+ }
98
+
99
+ // 多选操作处理
100
+ function handleMultiSelectAction(action: string, selectedItems: any[], selectedItemsArray: any[]) {
101
+ console.log('多选操作:', action, selectedItems, selectedItemsArray)
13
102
  }
14
- // 跳转流程处理
15
- function action(row) {
16
- router.push({ name: 'XFormGroupView', query: { workflowId: row.ab_f_workflow_id, stepId: row.ws_f_step_id } })
103
+
104
+ // 选择变化处理
105
+ function handleSelectionChange(selectedItems: any[]) {
106
+ console.log('选择变化,当前选中:', selectedItems.length, '个项目')
107
+ // 可以在这里更新UI状态,比如显示选中数量等
17
108
  }
18
- // 工作日志
19
- function worklog(row) {
20
- router.push({ name: 'worklog', query: { workflowid: row.ab_f_workflow_id, defname: row.ws_f_name } })
109
+
110
+ // 数据加载完成后处理 @after-load
111
+ function afterLoad(result) {
112
+ console.log('afterLoad:', result)
21
113
  }
22
- onMounted(() => {
23
- console.log('初始化页面===')
24
- })
25
- onActivated(() => {
26
- // 每次回到页面都会触发
27
- console.log('activated: 每次回到页面都会触发')
28
- })
29
114
  </script>
30
115
 
31
116
  <template>
32
- <XCellList
33
- :config-name="configName"
34
- :service-name="serviceName"
35
- @phone="phone"
36
- @action="action"
37
- @worklog="worklog"
38
- />
117
+ <NormalDataLayout id="XCellListView" title="工作计划">
118
+ <template #layout_content>
119
+ <XCellList
120
+ config-name="lngChargeAuditMobileCRUD"
121
+ service-name="af-gaslink"
122
+ :enable-multi-select="true"
123
+ id-key="rr_id"
124
+ :multi-select-actions="multiSelectActions"
125
+ @to-detail="toDetail"
126
+ @multi-select-action="handleMultiSelectAction"
127
+ @selection-change="handleSelectionChange"
128
+ />
129
+ </template>
130
+ </NormalDataLayout>
39
131
  </template>
40
132
 
41
133
  <style scoped lang="less">
42
- .cell-search-after {
43
- padding: 0 12px 12px 12px;
44
- background-color: #fff;
45
- .van-row:first-child {
46
- align-items: center;
47
- margin-bottom: 8px;
48
- padding: 0 2px;
49
- h4 {
50
- font-size: 1.08rem;
51
- font-weight: 600;
52
- margin: 0;
53
- color: #222;
54
- letter-spacing: 1px;
55
- }
56
- .stat-date-range {
57
- display: flex;
58
- align-items: center;
59
- justify-content: flex-end;
60
- font-size: 0.92rem;
61
- color: #b0b3b8;
62
- font-weight: 400;
63
- span {
64
- margin-left: 4px;
65
- font-size: 0.92rem;
66
- color: #b0b3b8;
67
- }
68
- .van-icon {
69
- font-size: 1rem;
70
- color: #b0b3b8;
71
- margin-right: 2px;
72
- }
73
- }
74
- }
75
- .van-row:nth-child(2) {
76
- margin-top: 8px;
77
- // 统计卡片间距由gutter控制
78
- .van-col {
79
- // 让卡片宽度自适应
80
- .stat-card {
81
- width: 100%;
82
- }
83
- }
84
- }
85
- .stat-card {
86
- display: flex;
87
- flex-direction: column;
88
- align-items: center;
89
- justify-content: center;
90
- border-radius: 12px;
91
- padding: 6px 0 4px 0; // 压缩高度
92
- min-height: 44px; // 压缩高度
93
- position: relative;
94
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
95
- background: #f7f8fa;
96
- .stat-num {
97
- font-size: 1.08rem; // 缩小字体
98
- font-weight: 600;
99
- margin-bottom: 2px;
100
- }
101
- .stat-label {
102
- font-size: 0.82rem; // 缩小字体
103
- margin-bottom: 2px;
104
- }
105
- .stat-icon {
106
- position: absolute;
107
- top: 6px;
108
- right: 8px;
109
- font-size: 1rem;
110
- opacity: 0.4;
111
- }
112
- }
113
- .stat-total {
114
- background: #f0f5ff;
115
- color: #2f54eb;
116
- .stat-num,
117
- .stat-label {
118
- color: #2f54eb;
119
- }
120
- .stat-icon {
121
- color: #2f54eb;
122
- }
123
- }
124
- .stat-done {
125
- background: #e6fffb;
126
- color: #13c2c2;
127
- .stat-num,
128
- .stat-label {
129
- color: #13c2c2;
130
- }
131
- .stat-icon {
132
- color: #13c2c2;
133
- }
134
- }
135
- .stat-processing {
136
- background: #f9f0ff;
137
- color: #b37feb;
138
- .stat-num,
139
- .stat-label {
140
- color: #b37feb;
141
- }
142
- .stat-icon {
143
- color: #b37feb;
144
- }
145
- }
146
- }
147
134
  </style>
@@ -1,91 +1,82 @@
1
- <script setup lang="ts">
2
- import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { showDialog } from 'vant'
5
- import { ref } from 'vue'
6
- import { useRoute } from 'vue-router'
7
-
8
- // 纯表单
9
- const configName = ref('appapplyuserinfoFormGroup')
10
- const serviceName = ref('af-apply')
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
- const formData = ref({ t_userinfo: { f_user_name: 111 } })
20
- const formGroup = ref(null)
21
- const route = useRoute()
22
- const isInit = ref(false)
23
- function submit(_result) {
24
- showDialog({ message: '提交成功' })
25
- history.back()
26
- }
27
- const myXForm = ref([])
28
- function setRef(value: any) {
29
- console.log('myXForm', myXForm)
30
- formGroup.value.setRef(myXForm.value)
31
- console.log(formGroup)
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
- // })
62
- function a() {
63
- }
64
- </script>
65
-
66
- <template>
67
- <NormalDataLayout id="XFormGroupView" title="纯表单">
68
- <template #layout_content>
69
- <button @click="a">
70
- 修改
71
- </button>
72
- <!-- v-if="isInit" -->
73
- <XFormGroup
74
- ref="formGroup"
75
- :config-name="configName"
76
- :service-name="serviceName"
77
- :group-form-data="formData"
78
- mode="新增"
79
- @submit="submit"
80
- >
81
- <!-- <template #device="{ setRef, removeRef, item, formData }">
82
- <XFormView :setRef="setRef" :formGroupName="'myXForm'"/>
83
- </template> -->
84
- </XFormGroup>
85
- </template>
86
- </NormalDataLayout>
87
- </template>
88
-
89
- <style scoped lang="less">
90
-
91
- </style>
1
+ <script setup lang="ts">
2
+ import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
+ import { showDialog } from 'vant'
5
+ import { ref } from 'vue'
6
+ import { useRoute } from 'vue-router'
7
+
8
+ // const configName = ref('reviewFormGroup')
9
+ // const serviceName = ref('af-revenue')
10
+
11
+ // 纯表单
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')
21
+
22
+ const formData = ref({})
23
+ const formGroup = ref(null)
24
+ const route = useRoute()
25
+ const isInit = ref(false)
26
+ function submit(_result) {
27
+ showDialog({ message: '提交成功' }).then(() => {
28
+ console.log('12121')
29
+ // history.back()
30
+ })
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
+ // })
62
+ </script>
63
+
64
+ <template>
65
+ <NormalDataLayout id="XFormGroupView" title="纯表单">
66
+ <template #layout_content>
67
+ <!-- v-if="isInit" -->
68
+ <XFormGroup
69
+ ref="formGroup"
70
+ config-name="ApplyAddContractFormGroup"
71
+ service-name="af-apply"
72
+ :group-form-data="formData"
73
+ mode="新增"
74
+ @submit="submit"
75
+ />
76
+ </template>
77
+ </NormalDataLayout>
78
+ </template>
79
+
80
+ <style scoped lang="less">
81
+
82
+ </style>
@@ -1,28 +1,42 @@
1
- <script setup lang="ts">
2
- import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
- import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
- import { ref } from 'vue'
5
-
6
- const configName = ref('lngSecurityChecktestForm')
7
- const serviceName = ref('af-safecheck')
8
-
9
- const formGroupAddConstruction = ref(null)
10
- </script>
11
-
12
- <template>
13
- <NormalDataLayout id="XFormGroupView" title="纯表单">
14
- <template #layout_content>
15
- <XForm
16
- ref="formGroupAddConstruction"
17
- mode="新增"
18
- :config-name="configName"
19
- :service-name="serviceName"
20
- :form-readonly="false"
21
- />
22
- </template>
23
- </NormalDataLayout>
24
- </template>
25
-
26
- <style scoped lang="less">
27
-
28
- </style>
1
+ <script setup lang="ts">
2
+ import XForm from '@af-mobile-client-vue3/components/data/XForm/index.vue'
3
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
4
+ import { ref } from 'vue'
5
+ import {
6
+ Button as VanButton,
7
+ } from 'vant'
8
+
9
+ const configName = ref('测试Form')
10
+ const serviceName = ref('af-safecheck')
11
+ const formGroupAddConstruction = ref()
12
+
13
+ // 提交测试
14
+ function onSubmit(form) {
15
+ console.log('事件触发提交表单----', form)
16
+ }
17
+ async function onAsyncSubmit() {
18
+ const res = await formGroupAddConstruction.value.asyncSubmit()
19
+ console.log('异步提交表单----', res)
20
+ }
21
+ </script>
22
+
23
+ <template>
24
+ <NormalDataLayout id="XFormGroupView" title="纯表单">
25
+ <template #layout_content>
26
+ <XForm
27
+ ref="formGroupAddConstruction"
28
+ mode="新增"
29
+ :config-name="configName"
30
+ :show-tab-header="false"
31
+ service-name="af-safecheck"
32
+ :is-group-form="true"
33
+ @on-submit="onSubmit"
34
+ />
35
+ </template>
36
+ </NormalDataLayout>
37
+ <van-button type="primary" @click="onAsyncSubmit">提交</van-button>
38
+ </template>
39
+
40
+ <style scoped lang="less">
41
+
42
+ </style>