af-mobile-client-vue3 1.2.27 → 1.2.29

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,11 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import Uploader from '@af-mobile-client-vue3/components/core/Uploader/index.vue'
3
+ import DateTimeSecondsPicker from '@af-mobile-client-vue3/components/data/XReportForm/DateTimeSecondsPicker.vue'
3
4
  import XReportFormJsonRender from '@af-mobile-client-vue3/components/data/XReportForm/XReportFormJsonRender.vue'
4
5
  import XSignature from '@af-mobile-client-vue3/components/data/XSignature/index.vue'
5
6
  import { getConfigByNameWithoutIndexedDB } from '@af-mobile-client-vue3/services/api/common'
6
7
  import {
7
8
  showFailToast,
8
- Toast,
9
9
  Button as vanButton,
10
10
  Cell as vanCell,
11
11
  CellGroup as vanCellGroup,
@@ -17,9 +17,7 @@ import {
17
17
  Skeleton as vanSkeleton,
18
18
  } from 'vant'
19
19
  import { defineEmits, nextTick, reactive, ref, watch } from 'vue'
20
- // https://calendar.hxkj.vip/
21
- import VueHashCalendar from 'vue3-hash-calendar'
22
- import 'vue3-hash-calendar/es/index.css'
20
+ // 移除 VueHashCalendar,使用自定义的 DateTimeSecondsPicker
23
21
 
24
22
  // ------------------------- 类型定义 -------------------------
25
23
  interface configDefine {
@@ -66,12 +64,6 @@ let timer: NodeJS.Timeout
66
64
  const scanFinish = ref(false)
67
65
  // 折叠面板当前激活的值
68
66
  const activeCollapseName = ref('副标题')
69
- // 日期选择器显示状态
70
- const showDatePicker = ref(false)
71
- const showTimePicker = ref(false)
72
- // 当前操作的日期时间字段
73
- const currentDateField = ref('')
74
- const currentTimeField = ref('')
75
67
 
76
68
  watch(() => props.configName, () => {
77
69
  // 这里是你的处理逻辑
@@ -128,6 +120,8 @@ function generateDefaultRequiredMessage(field: any): string {
128
120
  return `请选择${label || '日期'}`
129
121
  case 'timePicker':
130
122
  return `请选择${label || '时间'}`
123
+ case 'dateTimeSecondsPicker':
124
+ return `请选择${label || '完整时间'}`
131
125
  case 'curDateInput':
132
126
  return `请设置${label || '时间'}`
133
127
  case 'signature':
@@ -564,6 +558,12 @@ function formatConfigToForm(config: configDefine): void {
564
558
  tempObj.type = 'timePicker'
565
559
  tempObj.required = row[j].required
566
560
  break
561
+ case 'dateTimeSecondsPicker' :
562
+ tempObj.dataIndex = row[j].dataIndex
563
+ tempObj.text = row[j].text
564
+ tempObj.type = 'dateTimeSecondsPicker'
565
+ tempObj.required = row[j].required
566
+ break
567
567
  case 'signature' :
568
568
  tempObj.dataIndex = row[j].dataIndex
569
569
  tempObj.text = row[j].text
@@ -855,45 +855,7 @@ function getNow() {
855
855
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
856
856
  }
857
857
 
858
- // 打开日期选择器
859
- function openDatePicker(dataIndex: string) {
860
- console.log('打开日期选择器:', dataIndex)
861
- currentDateField.value = dataIndex
862
- showDatePicker.value = true
863
- console.log('日期选择器状态:', showDatePicker.value)
864
- }
865
-
866
- // 打开时间选择器
867
- function openTimePicker(dataIndex: string) {
868
- console.log('打开时间选择器:', dataIndex)
869
- currentTimeField.value = dataIndex
870
- showTimePicker.value = true
871
- console.log('时间选择器状态:', showTimePicker.value)
872
- }
873
-
874
- // 确认选择日期
875
- function onConfirmDate(value: any) {
876
- console.log('onConfirmDate', value)
877
- activatedConfig.data[currentDateField.value] = value
878
- showDatePicker.value = false
879
- currentDateField.value = ''
880
- }
881
-
882
- // 确认选择时间
883
- function onConfirmTime(value: any) {
884
- console.log('onConfirmTime', value)
885
- activatedConfig.data[currentTimeField.value] = value
886
- showTimePicker.value = false
887
- currentTimeField.value = ''
888
- }
889
-
890
- // 取消选择
891
- function onCancelPicker() {
892
- showDatePicker.value = false
893
- showTimePicker.value = false
894
- currentDateField.value = ''
895
- currentTimeField.value = ''
896
- }
858
+ // 移除了旧的日期时间选择器相关方法,现在使用 DateTimeSecondsPicker 组件
897
859
  </script>
898
860
 
899
861
  <template>
@@ -913,46 +875,46 @@ function onCancelPicker() {
913
875
  <!-- 标题 -->
914
876
  <h2 v-if="activatedConfig.title" class="title" v-html="activatedConfig.title" />
915
877
  <!-- 副标题 -->
916
- <div v-if="activatedConfig.subTitle && activatedConfig.subTitle.length > 0" class="form_item">
917
- <van-collapse v-model="activeCollapseName" accordion>
918
- <van-collapse-item title="副标题" name="副标题">
919
- <van-form>
920
- <van-cell-group inset>
921
- <template v-for="(subCell, cellIndex) in activatedConfig.subTitle" :key="cellIndex">
922
- <template v-if="subCell.type === 'inputs'">
923
- <template v-for="(item, itemIndex) in formatInputs(subCell)" :key="itemIndex">
924
- <van-field
925
- v-model="activatedConfig.data[subCell.dataIndex][itemIndex]"
926
- :label="`${item}:`"
927
- clearable
928
- type="textarea"
929
- rows="1"
930
- autosize
931
- :placeholder="`请输入${item}`"
932
- />
933
- </template>
934
- </template>
935
- <template v-else>
936
- <van-field
937
- v-model="activatedConfig.data[subCell.dataIndex]"
938
- :label="`${subCell.format}:`"
939
- clearable
940
- type="textarea"
941
- rows="1"
942
- autosize
943
- :placeholder="`请输入${subCell.format}`"
944
- />
945
- </template>
946
- </template>
947
- </van-cell-group>
948
- </van-form>
949
- </van-collapse-item>
950
- </van-collapse>
951
- </div>
878
+ <!-- <div v-if="activatedConfig.subTitle && activatedConfig.subTitle.length > 0" class="form_item"> -->
879
+ <!-- <van-collapse v-model="activeCollapseName" accordion> -->
880
+ <!-- <van-collapse-item title="副标题" name="副标题"> -->
881
+ <!-- <van-form> -->
882
+ <!-- <van-cell-group inset> -->
883
+ <!-- <template v-for="(subCell, cellIndex) in activatedConfig.subTitle" :key="cellIndex"> -->
884
+ <!-- <template v-if="subCell.type === 'inputs'"> -->
885
+ <!-- <template v-for="(item, itemIndex) in formatInputs(subCell)" :key="itemIndex"> -->
886
+ <!-- <van-field -->
887
+ <!-- v-model="activatedConfig.data[subCell.dataIndex][itemIndex]" -->
888
+ <!-- :label="`${item}:`" -->
889
+ <!-- clearable -->
890
+ <!-- type="textarea" -->
891
+ <!-- rows="1" -->
892
+ <!-- autosize -->
893
+ <!-- :placeholder="`请输入${item}`" -->
894
+ <!-- /> -->
895
+ <!-- </template> -->
896
+ <!-- </template> -->
897
+ <!-- <template v-else> -->
898
+ <!-- <van-field -->
899
+ <!-- v-model="activatedConfig.data[subCell.dataIndex]" -->
900
+ <!-- :label="`${subCell.format}:`" -->
901
+ <!-- clearable -->
902
+ <!-- type="textarea" -->
903
+ <!-- rows="1" -->
904
+ <!-- autosize -->
905
+ <!-- :placeholder="`请输入${subCell.format}`" -->
906
+ <!-- /> -->
907
+ <!-- </template> -->
908
+ <!-- </template> -->
909
+ <!-- </van-cell-group> -->
910
+ <!-- </van-form> -->
911
+ <!-- </van-collapse-item> -->
912
+ <!-- </van-collapse> -->
913
+ <!-- </div> -->
952
914
  <!-- 表单项 -->
953
915
  <div class="form_item">
954
916
  <van-collapse v-model="activeCollapseName" accordion>
955
- <van-collapse-item title="表单项" name="表单项">
917
+ <van-collapse-item title="操作卡内容" name="操作卡内容">
956
918
  <van-form>
957
919
  <template v-for="(row, index) in activatedConfig.columns" :key="index">
958
920
  <!-- value属性 -->
@@ -1020,7 +982,7 @@ function onCancelPicker() {
1020
982
  {{ row.valueText || '当前时间' }}
1021
983
  </div>
1022
984
  <div class="cur-date-input-value">
1023
- {{ activatedConfig.data[row.dataIndex] || '未设置' }}
985
+ {{ activatedConfig.data[row.dataIndex] || '未操作' }}
1024
986
  </div>
1025
987
  </div>
1026
988
  <div class="cur-date-input-action">
@@ -1058,22 +1020,32 @@ function onCancelPicker() {
1058
1020
  </van-cell-group>
1059
1021
  <!-- datePicker -->
1060
1022
  <van-cell-group v-else-if="row.type === 'datePicker'" inset :title="row.label" :class="{ 'required-field': row.required }">
1061
- <van-field
1023
+ <DateTimeSecondsPicker
1062
1024
  v-model="activatedConfig.data[row.dataIndex]"
1063
1025
  :label="`${row.label || '日期'}:`"
1064
1026
  placeholder="请选择日期"
1065
- readonly
1066
- @click="openDatePicker(row.dataIndex)"
1027
+ title="选择日期"
1028
+ format="YYYY-MM-DD"
1067
1029
  />
1068
1030
  </van-cell-group>
1069
1031
  <!-- timePicker -->
1070
1032
  <van-cell-group v-else-if="row.type === 'timePicker'" inset :title="row.label" :class="{ 'required-field': row.required }">
1071
- <van-field
1033
+ <DateTimeSecondsPicker
1072
1034
  v-model="activatedConfig.data[row.dataIndex]"
1073
1035
  :label="`${row.label || '时间'}:`"
1074
1036
  placeholder="请选择时间"
1075
- readonly
1076
- @click="openTimePicker(row.dataIndex)"
1037
+ title="选择时间"
1038
+ format="YYYY-MM-DD HH:mm:ss"
1039
+ />
1040
+ </van-cell-group>
1041
+ <!-- dateTimeSecondsPicker -->
1042
+ <van-cell-group v-else-if="row.type === 'dateTimeSecondsPicker'" inset :title="row.label" :class="{ 'required-field': row.required }">
1043
+ <DateTimeSecondsPicker
1044
+ v-model="activatedConfig.data[row.dataIndex]"
1045
+ :label="`${row.label || '完整时间'}:`"
1046
+ placeholder="请选择完整时间"
1047
+ title="选择完整时间"
1048
+ format="YYYY-MM-DD HH:mm:ss"
1077
1049
  />
1078
1050
  </van-cell-group>
1079
1051
  <!-- inputs -->
@@ -1235,31 +1207,29 @@ function onCancelPicker() {
1235
1207
  <van-skeleton title :row="5" />
1236
1208
  </div>
1237
1209
 
1238
- <!-- 日期选择器弹窗 -->
1239
- <VueHashCalendar v-model:visible="showDatePicker" format="YY-MM-DD" model="dialog" picker-type="date" @confirm="onConfirmDate" />
1240
- <VueHashCalendar v-model:visible="showTimePicker" format="YY-MM-DD hh:mm:ss" picker-type="datetime" model="dialog" @confirm="onConfirmTime" />
1210
+ <!-- 已移除 VueHashCalendar,现在使用内置的 DateTimeSecondsPicker 组件 -->
1241
1211
  </template>
1242
1212
 
1243
1213
  <style scoped lang="less">
1244
- .main{
1214
+ .main {
1245
1215
  padding-top: 4vh;
1246
1216
  width: 100vw;
1247
1217
  height: 100vh;
1248
1218
  background-color: #eff2f5;
1249
1219
 
1250
- .title{
1220
+ .title {
1251
1221
  padding-bottom: 2vh;
1252
1222
  color: rgb(50, 50, 51);
1253
1223
  text-align: center;
1254
1224
  margin: 0 0 3vh;
1255
1225
  }
1256
1226
 
1257
- .text_box{
1227
+ .text_box {
1258
1228
  margin-top: 2vh;
1259
1229
  margin-bottom: 2vh;
1260
1230
  }
1261
1231
 
1262
- .main_text{
1232
+ .main_text {
1263
1233
  padding-left: 16px;
1264
1234
  font-weight: 400;
1265
1235
  line-height: 1.6;
@@ -1268,53 +1238,53 @@ function onCancelPicker() {
1268
1238
  font-size: 14px;
1269
1239
  }
1270
1240
 
1271
- .show_value_item{
1241
+ .show_value_item {
1272
1242
  text-align: center;
1273
1243
  font-size: 1.2em;
1274
1244
  }
1275
1245
 
1276
- .cell_group{
1246
+ .cell_group {
1277
1247
  //margin-top: 2vh;
1278
1248
  //margin-bottom: 2vh;
1279
1249
  }
1280
1250
 
1281
- .form_item{
1251
+ .form_item {
1282
1252
  margin-top: 2vh;
1283
1253
  }
1284
1254
 
1285
- .button_group{
1255
+ .button_group {
1286
1256
  text-align: center;
1287
1257
  margin-top: 3vh;
1288
1258
  margin-bottom: 3vh;
1289
1259
  }
1290
1260
 
1291
- .button_group>:first-child {
1261
+ .button_group > :first-child {
1292
1262
  margin-right: 3vw;
1293
1263
  }
1294
1264
 
1295
- .divider{
1265
+ .divider {
1296
1266
  color: #1989fa;
1297
1267
  border-color: #1989fa;
1298
- padding: 0 16px
1268
+ padding: 0 16px;
1299
1269
  }
1300
1270
 
1301
- .submit_button{
1271
+ .submit_button {
1302
1272
  background-color: #eff2f5;
1303
1273
  padding: 5vh;
1304
1274
  }
1305
1275
  }
1306
1276
 
1307
- .skeleton{
1308
- margin-top: 5vh
1277
+ .skeleton {
1278
+ margin-top: 5vh;
1309
1279
  }
1310
- .my-cell-group{
1311
- margin: 0 0 10px 0
1280
+ .my-cell-group {
1281
+ margin: 0 0 10px 0;
1312
1282
  }
1313
1283
  :deep(.van-collapse-item__content) {
1314
1284
  background-color: #eff2f5;
1315
1285
  padding: 10px 0;
1316
1286
  }
1317
- :deep(.van-cell-group__title){
1287
+ :deep(.van-cell-group__title) {
1318
1288
  padding-top: 10px;
1319
1289
  padding-bottom: 10px;
1320
1290
  }
@@ -1325,7 +1295,7 @@ function onCancelPicker() {
1325
1295
  // 必填字段星号样式 - 只对星号生效
1326
1296
  :deep(.van-field__label) {
1327
1297
  // 将包含星号的文本进行特殊处理
1328
- &[style*="color"] {
1298
+ &[style*='color'] {
1329
1299
  color: #323233 !important;
1330
1300
  }
1331
1301
  }
@@ -1340,7 +1310,7 @@ function onCancelPicker() {
1340
1310
  margin-right: 2px;
1341
1311
  }
1342
1312
  }
1343
- :deep(.van-uploader__wrapper){
1313
+ :deep(.van-uploader__wrapper) {
1344
1314
  padding: 10px;
1345
1315
  display: flex;
1346
1316
  flex-wrap: wrap;
@@ -1371,7 +1341,7 @@ function onCancelPicker() {
1371
1341
  word-wrap: break-word;
1372
1342
  white-space: normal;
1373
1343
  display: -webkit-box;
1374
- -webkit-line-clamp: 2; // 最多显示2行
1344
+ -webkit-line-clamp: 4; // 最多显示2行
1375
1345
  -webkit-box-orient: vertical;
1376
1346
  overflow: hidden;
1377
1347
  }
@@ -29,3 +29,8 @@ html.dark {
29
29
  .van-tabbar--fixed {
30
30
  position: fixed !important;
31
31
  }
32
+
33
+ // 所有按钮 添加圆角
34
+ .van-button {
35
+ border-radius: 10px !important;
36
+ }
@@ -1,28 +1,107 @@
1
1
  <script setup lang="ts">
2
2
  import XCellList from '@af-mobile-client-vue3/components/data/XCellList/index.vue'
3
+ import NormalDataLayout from '@af-mobile-client-vue3/components/layout/NormalDataLayout/index.vue'
3
4
  import { defineEmits, ref } from 'vue'
4
5
  import { useRouter } from 'vue-router'
5
6
 
6
- const emit = defineEmits(['addressSelected'])
7
+ // 定义事件
8
+ const emit = defineEmits(['deleteRow'])
9
+ // 访问路由
7
10
  const router = useRouter()
8
- const configName = ref('userfiles_sel_address')
9
- const xCellListRefPatrolPlan = ref()
10
- // 详情
11
- function toDetail(row) {
12
- emit('addressSelected', {
13
- f_address: row.tua_f_address,
14
- f_address_id: row.tua_id,
11
+ // 获取默认值
12
+ const idKey = ref('o_id')
13
+
14
+ // 简易crud表单测试
15
+ const configName = ref('lngChargeAuditMobileCRUD')
16
+ const serviceName = ref('af-gaslink')
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
+ },
15
57
  })
16
58
  }
59
+
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)
89
+ }
17
90
  </script>
18
91
 
19
92
  <template>
20
- <XCellList
21
- ref="xCellListRefPatrolPlan"
22
- service-name="af-revenue"
23
- :config-name="configName"
24
- @to-detail="toDetail"
25
- />
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>
26
105
  </template>
27
106
 
28
107
  <style scoped lang="less">
@@ -6,8 +6,15 @@ import { ref } from 'vue'
6
6
  import { useRoute } from 'vue-router'
7
7
 
8
8
  // 纯表单
9
- const configName = ref('ApplyAddContractFormGroup')
10
- const serviceName = ref('af-apply')
9
+ const configName = ref('form_check_test')
10
+ const serviceName = ref('af-system')
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')
11
18
 
12
19
  const formData = ref({})
13
20
  const formGroup = ref(null)
@@ -18,6 +25,36 @@ function submit(_result) {
18
25
  history.back()
19
26
  })
20
27
  }
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
+ // })
21
58
  </script>
22
59
 
23
60
  <template>
@@ -7,21 +7,8 @@ const configName = ref('AddConstructionForm')
7
7
  const serviceName = ref('af-linepatrol')
8
8
 
9
9
  const formGroupAddConstruction = ref(null)
10
- function emitFunc(func, data) {
11
- console.log('>>>> func: ', func)
12
- console.log('>>>> data: ', data)
13
- if (func === 'selectAddress') {
14
- const add = 'ccss'
15
- // 设置单个字段
16
- formGroupAddConstruction.value?.setForm({ address: '你的字符串' })
17
- }
18
- }
19
- function submit(data) {
20
- console.log('>>>> data: ', JSON.stringify(data))
21
- }
22
10
  </script>
23
11
 
24
- <!-- workflowId -->
25
12
  <template>
26
13
  <NormalDataLayout id="XFormGroupView" title="纯表单">
27
14
  <template #layout_content>
@@ -30,10 +17,6 @@ function submit(data) {
30
17
  mode="新增"
31
18
  :config-name="configName"
32
19
  :service-name="serviceName"
33
- :param-logic-name-param="{ aa: 123 }"
34
- :form-data="{ f_project_name: 333 }"
35
- @x-form-item-emit-func="emitFunc"
36
- @on-submit="submit"
37
20
  />
38
21
  </template>
39
22
  </NormalDataLayout>