af-mobile-client-vue3 1.2.50 → 1.2.52

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,4 +1,5 @@
1
- import { dirname, resolve } from 'node:path'
1
+ import path, { dirname, resolve } from 'node:path'
2
+
2
3
  import process from 'node:process'
3
4
  import { fileURLToPath } from 'node:url'
4
5
  import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
@@ -10,10 +11,12 @@ import viteCompression from 'vite-plugin-compression'
10
11
  import { mockDevServerPlugin } from 'vite-plugin-mock-dev-server'
11
12
  import { VitePWA } from 'vite-plugin-pwa'
12
13
  import Sitemap from 'vite-plugin-sitemap'
14
+ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
13
15
  import VueDevTools from 'vite-plugin-vue-devtools'
14
16
  import { createViteVConsole } from './vconsole'
15
17
 
16
18
  export function createVitePlugins(mode: string) {
19
+ const root = process.cwd()
17
20
  const env = loadEnv(mode, process.cwd())
18
21
 
19
22
  return [
@@ -35,12 +38,12 @@ export function createVitePlugins(mode: string) {
35
38
  mockDevServerPlugin(),
36
39
 
37
40
  // TODO 放到统一icons处理,移除该插件
38
- // createSvgIconsPlugin({
39
- // // 指定图标文件夹
40
- // iconDirs: [path.resolve(root, 'src/icons/svg')],
41
- // // 指定 symbolId 格式
42
- // symbolId: 'icon-[dir]-[name]',
43
- // }),
41
+ createSvgIconsPlugin({
42
+ // 指定图标文件夹
43
+ iconDirs: [path.resolve(root, 'src/icons/svg')],
44
+ // 指定 symbolId 格式
45
+ symbolId: 'icon-[dir]-[name]',
46
+ }),
44
47
 
45
48
  // 生产环境 gzip 压缩资源
46
49
  viteCompression({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.2.50",
4
+ "version": "1.2.52",
5
5
  "packageManager": "pnpm@10.12.3",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -78,6 +78,7 @@
78
78
  "vite-plugin-mock-dev-server": "^1.9.1",
79
79
  "vite-plugin-pwa": "^1.0.0",
80
80
  "vite-plugin-sitemap": "^0.8.2",
81
+ "vite-plugin-svg-icons": "^2.0.1",
81
82
  "vite-plugin-vconsole": "^2.1.1",
82
83
  "vite-plugin-vue-devtools": "^7.7.7",
83
84
  "vue-tsc": "^2.2.10"
@@ -56,6 +56,6 @@ const styleExternalIcon = computed(() => {
56
56
  }
57
57
 
58
58
  .svg-icon-active-blue {
59
- color: #1989FA
59
+ color: #1989fa;
60
60
  }
61
61
  </style>
@@ -210,16 +210,21 @@ function initComponent() {
210
210
  }
211
211
  configContent.value = result
212
212
  // 扁平化 type=group 的 groupItems,保持顺序
213
- let flatFormJson = []
214
- flatFormJson = result.formJson.filter(item => (!item.isOnlyAddOrEdit && item.type !== 'group') || (item.type === 'group' && item.groupItems.some(groupItem => !groupItem.isOnlyAddOrEdit)))
215
- // result.formJson.forEach((item) => {
216
- // if (item.type === 'group' && Array.isArray(item.groupItems)) {
217
- // flatFormJson.push(...item.groupItems)
218
- // }
219
- // else {
220
- // flatFormJson.push(item)
221
- // }
222
- // })
213
+ const flatFormJson = []
214
+ result.formJson.forEach((item) => {
215
+ if (item.type === 'group' && Array.isArray(item.groupItems)) {
216
+ item.groupItems.forEach((groupItem) => {
217
+ if (!groupItem.isOnlyAddOrEdit) {
218
+ flatFormJson.push(groupItem)
219
+ }
220
+ })
221
+ }
222
+ else {
223
+ if (!item.isOnlyAddOrEdit && item.type !== 'group') {
224
+ flatFormJson.push(item)
225
+ }
226
+ }
227
+ })
223
228
  formQueryList.value = flatFormJson
224
229
  console.log('formQueryList', formQueryList.value)
225
230
  if (result.buttonState) {
@@ -47,6 +47,7 @@ const renderableGroupItems = computed(() => {
47
47
 
48
48
  // 组件初始化函数
49
49
  function init(params: Form) {
50
+ console.log('初始化数据------', { ...params })
50
51
  initStatus.value = true
51
52
  propsData.value = {
52
53
  configName: props.configName,
@@ -55,6 +56,7 @@ function init(params: Form) {
55
56
  mode: props.mode,
56
57
  ...params,
57
58
  }
59
+ console.log('数据整合----', propsData.value)
58
60
  formData.value = propsData.value.groupFormData
59
61
  getConfigByName(propsData.value.configName, (result) => {
60
62
  if (result?.groups) {
@@ -70,10 +72,12 @@ function init(params: Form) {
70
72
  submitSimple.value = result?.showSubmitBtn
71
73
  groupItems.value = [{ ...result }]
72
74
  }
75
+ console.log('即将加载完成的数据--:', formData.value)
73
76
  isInit.value = true
74
77
  }, propsData.value.serviceName)
75
78
  }
76
79
  watch(() => props.groupFormData, (_val) => {
80
+ console.log('监听器-------', props.groupFormData)
77
81
  formData.value = { ...formData.value, ...props.groupFormData }
78
82
  })
79
83
  onBeforeMount(() => {
package/src/main.ts CHANGED
@@ -10,6 +10,8 @@ import 'virtual:uno.css'
10
10
  import '@af-mobile-client-vue3/styles/app.less'
11
11
  import '@af-mobile-client-vue3/styles/var.less'
12
12
 
13
+ // svg icon
14
+ import 'virtual:svg-icons-register'
13
15
  // Vant 桌面端适配
14
16
  import '@vant/touch-emulator'
15
17
 
@@ -10,6 +10,7 @@ import XCellDetailView from '@af-mobile-client-vue3/views/component/XCellDetailV
10
10
  import XCellListView from '@af-mobile-client-vue3/views/component/XCellListView/index.vue'
11
11
  import XFormAppraiseView from '@af-mobile-client-vue3/views/component/XFormAppraiseView/index.vue'
12
12
  import XFormGroupView from '@af-mobile-client-vue3/views/component/XFormGroupView/index.vue'
13
+ import xformgroup222 from '@af-mobile-client-vue3/views/component/XFormGroupView/xformgroup222.vue'
13
14
  import XFormView from '@af-mobile-client-vue3/views/component/XFormView/index.vue'
14
15
  import XOlMapView from '@af-mobile-client-vue3/views/component/XOlMapView/index.vue'
15
16
  import XLocationPicker from '@af-mobile-client-vue3/views/component/XOlMapView/XLocationPicker/index.vue'
@@ -66,6 +67,11 @@ const routes: Array<RouteRecordRaw> = [
66
67
  name: 'XCellDetailView',
67
68
  component: XCellDetailView,
68
69
  },
70
+ {
71
+ path: '/xformgroup222',
72
+ name: 'xformgroup222',
73
+ component: xformgroup222,
74
+ },
69
75
  {
70
76
  path: '/Component/XFormGroupView',
71
77
  name: 'XFormGroupView',
@@ -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,19 +1,26 @@
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
+ const userInfo = useUserStore().getUserInfo()
9
11
  // 访问路由
10
12
  const router = useRouter()
11
13
  // 获取默认值
12
14
  const idKey = ref('o_id')
13
15
 
14
16
  // 简易crud表单测试
15
- const configName = ref('lngChargeAuditMobileCRUD')
17
+ // const configName = ref('orderCarInMobileCRUD')
18
+ // const serviceName = ref('af-gaslink')
19
+ // const configName = ref('lngPriceManageMobileCRUD')
20
+ const configName = ref('测试2')
16
21
  const serviceName = ref('af-gaslink')
22
+ // const configName = ref('mobile_liushuiQueryCRUD')
23
+ // const serviceName = ref('af-revenue')
17
24
 
18
25
  // 资源权限测试
19
26
  // const configName = ref('crud_sources_test')
@@ -48,12 +55,12 @@ const serviceName = ref('af-gaslink')
48
55
  // 跳转到表单——以表单组来渲染纯表单
49
56
  function toDetail(item) {
50
57
  router.push({
51
- name: 'XFormGroupView',
52
- query: {
53
- id: item[idKey.value],
54
- // id: item.rr_id,
55
- // o_id: item.o_id,
56
- },
58
+ name: 'xformgroup222',
59
+ // query: {
60
+ // id: item[idKey.value],
61
+ // id: item.rr_id,
62
+ // o_id: item.o_id,
63
+ // },
57
64
  })
58
65
  }
59
66
 
@@ -69,19 +76,36 @@ function toDetail(item) {
69
76
  // },
70
77
  // })
71
78
  // }
79
+ function addOption() {
80
+ console.log('用户----', userInfo)
81
+ router.push({
82
+ name: 'XFormGroupView',
83
+ // params: { id: totalCount.value },
84
+ // query: {
85
+ // configName: configName.value,
86
+ // serviceName: serviceName.value,
87
+ // mode: '新增',
88
+ // },
89
+ })
90
+ // 如果存在回调函数,调用它并传递true表示已处理
91
+ // if (typeof callback === 'function') {
92
+ // callback(true)
93
+ // }
94
+ }
72
95
 
73
96
  // 修改功能
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
- // }
97
+ function updateRow(result) {
98
+ console.log('用户----', userInfo)
99
+ router.push({
100
+ name: 'XFormView',
101
+ params: { id: 1, openid: 2 },
102
+ query: {
103
+ configName: configName.value,
104
+ serviceName: serviceName.value,
105
+ mode: '修改',
106
+ },
107
+ })
108
+ }
85
109
 
86
110
  // 删除功能
87
111
  function deleteRow(result) {
@@ -92,13 +116,38 @@ function deleteRow(result) {
92
116
  <template>
93
117
  <NormalDataLayout id="XCellListView" title="工作计划">
94
118
  <template #layout_content>
119
+ <!-- <XCellList -->
120
+ <!-- :config-name="configName" -->
121
+ <!-- :service-name="serviceName" -->
122
+ <!-- :custom-add="true" -->
123
+ <!-- :custom-edit="true" -->
124
+ <!-- :id-key="idKey" -->
125
+ <!-- @to-detail="toDetail" -->
126
+ <!-- @delete-row="deleteRow" -->
127
+ <!-- @update="updateRow" -->
128
+ <!-- @add="addOption" -->
129
+ <!-- /> -->
130
+
131
+ <!-- :fix-query-form="{ u_f_price_state: ['生效', '待生效'] }" -->
132
+
133
+ <!-- <XCellList -->
134
+ <!-- config-name="ApplyMobileSuperviseCRUD" -->
135
+ <!-- service-name="af-apply" -->
136
+ <!-- @to-detail="toDetail" -->
137
+ <!-- @delete-row="deleteRow" -->
138
+ <!-- /> -->
139
+
140
+ <!-- <XCellList -->
141
+ <!-- service-name="af-revenue" -->
142
+ <!-- config-name="userfiles_sel_address" -->
143
+ <!-- @to-detail="toDetail" -->
144
+ <!-- /> -->
95
145
  <XCellList
96
- :config-name="configName"
97
- :service-name="serviceName"
98
- :fix-query-form="{ o_f_oper_name: 'edu_test' }"
99
- :id-key="idKey"
146
+ service-name="af-apply"
147
+ config-name="ApplyMobileProcessCRUD"
148
+ :custom-add="true"
100
149
  @to-detail="toDetail"
101
- @delete-row="deleteRow"
150
+ @add="addOption"
102
151
  />
103
152
  </template>
104
153
  </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="ceshi11111FormGroup"
71
+ service-name="af-apply"
68
72
  :group-form-data="formData"
69
73
  mode="新增"
70
74
  @submit="submit"
@@ -0,0 +1,94 @@
1
+ <script setup lang="ts">
2
+ import XFormGroup from '@af-mobile-client-vue3/components/data/XFormGroup/index.vue'
3
+ import { runLogic } from '@af-mobile-client-vue3/services/api/common'
4
+ import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
5
+ import dayjs from 'dayjs/esm/index'
6
+ import { showToast } from 'vant'
7
+ import { onMounted, ref } from 'vue'
8
+ import { useRoute } from 'vue-router'
9
+
10
+ const configName = ref('appapplyuserinfoFormGroup')
11
+ const serviceName = ref('af-apply')
12
+ const route = useRoute()
13
+ const userInfo = useUserStore().getUserInfo()
14
+ const workflowId = ref('2909')
15
+ const userinfoid = ref('93015')
16
+ const model = ref('编辑')
17
+ const groupFormData = ref({})
18
+
19
+ function submit(res) {
20
+ if (model.value === '新增') {
21
+ res.t_userinfo.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
22
+ res.t_userinfo.f_orgid = userInfo.f_orgid
23
+ res.t_userinfo.f_orgname = userInfo.f_orgname
24
+ res.t_userinfo.f_depid = userInfo.f_depid
25
+ res.t_userinfo.f_depname = userInfo.f_depname
26
+ res.t_userinfo.f_operatorid = userInfo.f_operatorid
27
+ res.t_userinfo.f_operator = userInfo.f_operator
28
+ res.t_userinfo.f_workflow_id = this.f_workflow_id
29
+ res.t_userinfo.f_user_state = '预备'
30
+
31
+ res.t_userfiles.f_operate_date = dayjs().format('YYYY-MM-DD HH:mm:ss')
32
+ res.t_userfiles.f_orgid = userInfo.f_orgid
33
+ res.t_userfiles.f_orgname = userInfo.f_orgname
34
+ res.t_userfiles.f_depid = userInfo.f_depid
35
+ res.t_userfiles.f_depname = userInfo.f_depname
36
+ res.t_userfiles.f_operatorid = userInfo.f_operatorid
37
+ res.t_userfiles.f_operator = userInfo.f_operator
38
+ res.t_userfiles.f_workflow_id = this.f_workflow_id
39
+ res.t_userfiles.f_table_state = '待开通'
40
+ }
41
+ let saveData = res
42
+ if (saveData.t_userfiles.f_gasbrand_id.length > 0) {
43
+ saveData.t_userfiles.f_gasbrand_id = saveData.t_userfiles.f_gasbrand_id[0]
44
+ }
45
+ if (saveData.t_userfiles.f_price_id.length > 0) {
46
+ saveData.t_userfiles.f_price_id = saveData.t_userfiles.f_price_id[0]
47
+ }
48
+ if (model.value === '编辑') {
49
+ saveData = Object.assign(saveData, {
50
+ f_operator_record: userInfo.f_operator,
51
+ f_operatorid_record: userInfo.f_operatorid,
52
+ f_orgid_record: userInfo.f_orgid,
53
+ f_orgname_record: userInfo.f_orgname,
54
+ f_depid_record: userInfo.f_depid,
55
+ f_depname_record: userInfo.f_depname,
56
+ })
57
+ }
58
+ runLogic('userFIleSaveLogic', saveData, 'af-revenue').then((res) => {
59
+ showToast('操作成功!')
60
+ history.back()
61
+ })
62
+ }
63
+ function init() {
64
+ if (model.value === '编辑') {
65
+ runLogic('getFileDetailForEdit', { f_userinfo_id: userinfoid.value }, 'af-revenue').then((res) => {
66
+ if (res.t_userfiles.f_gasbrand_id) {
67
+ res.t_userfiles.f_gasbrand_id = [res.t_userfiles.f_gasbrand_id]
68
+ }
69
+ if (res.t_userfiles.f_price_id) {
70
+ res.t_userfiles.f_price_id = [res.t_userfiles.f_price_id]
71
+ }
72
+ console.log('1111111----,', res)
73
+ groupFormData.value = res
74
+ })
75
+ }
76
+ }
77
+ onMounted(() => {
78
+ init()
79
+ })
80
+ </script>
81
+
82
+ <template>
83
+ <XFormGroup
84
+ mode="修改"
85
+ :config-name="configName"
86
+ :service-name="serviceName"
87
+ :group-form-data="groupFormData"
88
+ @submit="submit"
89
+ />
90
+ </template>
91
+
92
+ <style scoped lang="less">
93
+
94
+ </style>
@@ -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('addappapplychargeForm')
7
+ const serviceName = ref('af-apply')
8
8
 
9
9
  const formGroupAddConstruction = ref(null)
10
10
  </script>