vue2-client 1.16.35 → 1.16.37

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.
@@ -0,0 +1,120 @@
1
+ <script setup lang="ts">
2
+ import XFormGroup from '@vue2-client/base-client/components/common/XFormGroup/XFormGroup.vue'
3
+ import { ref, onMounted, getCurrentInstance, watch } from 'vue'
4
+ import { getConfigByNameAsync } from '@vue2-client/services/api/common'
5
+
6
+ // 与 HTab 保持一致的样式开关
7
+ defineProps({
8
+ hasTopMargin: { type: Boolean, default: true },
9
+ // 隐藏左侧索引栏(样式控制)
10
+ leftHide: { type: Boolean, default: false }
11
+ })
12
+
13
+ // 内部 XFormGroup 实例引用
14
+ const xFormGroupRef = ref()
15
+
16
+ // 暴露方法:对齐 XFormGroup 的外部可用方法
17
+ defineExpose({
18
+ getXFormGroupInstance: () => xFormGroupRef.value,
19
+ init: (params) => xFormGroupRef.value && xFormGroupRef.value.init && xFormGroupRef.value.init(params),
20
+ asyncSubmit: () => xFormGroupRef.value && xFormGroupRef.value.asyncSubmit && xFormGroupRef.value.asyncSubmit(),
21
+ getNativeFormRef: (group) => xFormGroupRef.value && xFormGroupRef.value.getNativeFormRef && xFormGroupRef.value.getNativeFormRef(group),
22
+ getNativeForm: (group) => xFormGroupRef.value && xFormGroupRef.value.getNativeForm && xFormGroupRef.value.getNativeForm(group)
23
+ })
24
+
25
+ // 自动初始化:当外部传入 queryParamsName 时,自动加载配置并调用 XFormGroup.init
26
+ const vm = getCurrentInstance()
27
+ const autoInit = async () => {
28
+ try {
29
+ const a = vm?.proxy?.$attrs || {}
30
+ const queryParamsName = a.queryParamsName
31
+ if (!queryParamsName) return
32
+ const serviceName = a.serviceName || process.env.VUE_APP_SYSTEM_NAME
33
+ const env = a.env || 'prod'
34
+ const showLeftTab = a.showLeftTab || false
35
+ const businessType = a.businessType || '新增'
36
+ const modifyModelData = a.modifyModelData || {}
37
+
38
+ const isDev = env === 'dev'
39
+ const res = await getConfigByNameAsync(queryParamsName, serviceName, isDev)
40
+
41
+ const payload = {
42
+ ...res,
43
+ serviceName,
44
+ env,
45
+ showLeftTab,
46
+ businessType,
47
+ modifyModelData
48
+ }
49
+ if (xFormGroupRef.value && typeof xFormGroupRef.value.init === 'function') {
50
+ xFormGroupRef.value.init(payload)
51
+ } else {
52
+ // do nothing
53
+ }
54
+ } catch (e) {
55
+ // swallow
56
+ }
57
+ }
58
+
59
+ onMounted(() => {
60
+ autoInit()
61
+ })
62
+
63
+ // 当关键 attrs 变更时,重新初始化
64
+ watch(() => [vm?.proxy?.$attrs?.queryParamsName, vm?.proxy?.$attrs?.serviceName, vm?.proxy?.$attrs?.env], () => {
65
+ autoInit()
66
+ })
67
+ </script>
68
+
69
+ <template>
70
+ <div
71
+ class="h-form-group-wrapper"
72
+ :class="{
73
+ 'h-form-group-has-top-margin': hasTopMargin,
74
+ 'left-hide': leftHide
75
+ }"
76
+ >
77
+ <x-form-group
78
+ ref="xFormGroupRef"
79
+ v-bind="$attrs"
80
+ v-on="$listeners"
81
+ >
82
+ <template v-for="(_, name) in $slots" #[name]="slotData">
83
+ <slot :name="name" v-bind="slotData" />
84
+ </template>
85
+ </x-form-group>
86
+ </div>
87
+
88
+ </template>
89
+
90
+ <style scoped lang="less">
91
+ .h-form-group-wrapper {
92
+ // XFormGroup 自身容器
93
+ :deep(.XFormGroupClass) {
94
+ height: 100%;
95
+
96
+ .heigth100 { height: 100%; }
97
+ :deep(.ant-spin-container) { height: 100%; }
98
+
99
+ // 默认分组标题样式,参考 XFormGroup
100
+ .xFormGroupTitle {
101
+ font-size: 15px;
102
+ font-weight: bold;
103
+ color: @primary-color;
104
+ }
105
+
106
+ .formGroupContext {
107
+ height: 100%;
108
+ overflow-y: auto;
109
+ }
110
+ }
111
+ // 隐藏左侧(索引栏)
112
+ &.left-hide {
113
+ :deep(.ant-spin-container) {
114
+ .ant-row {
115
+ .ant-col-3 { display: none; }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ </style>
@@ -0,0 +1,3 @@
1
+ import HFormGroup from './HFormGroup.vue'
2
+
3
+ export default HFormGroup
@@ -1,54 +1,61 @@
1
- <template>
2
- <div class="h-tab-demo">
3
- <!-- &lt;!&ndash; XTab &ndash;&gt;-->
4
- <!-- <a-card title="XTab">-->
5
- <!-- <h-tab-->
6
- <!-- configName="openPrescriptionTab"-->
7
- <!-- serverName="af-his"-->
8
- <!-- />-->
9
- <!-- </a-card>-->
10
-
11
- <!-- HFormTable -->
12
- <a-card title="HFormTable" style="margin-top: 20px;">
13
- <h-form-table
14
- queryParamsName="outpatientAdviceAllCRUD"
15
- serviceName="af-his"
16
- />
17
- </a-card>
18
-
19
- <!-- HForm -->
20
- <a-card title="HAddNativeForm" style="margin-top: 20px;">
21
- <h-add-native-form
22
- queryParamsName="TCMAdviceFormConfig"
23
- serviceName="af-his"
24
- />
25
- </a-card>
26
-
27
- <!-- &lt;!&ndash; HButtons &ndash;&gt;-->
28
- <!-- <a-card title="HButtons" style="margin-top: 20px;">-->
29
- <!-- <h-buttons-->
30
- <!-- queryParamsName="outpatientAdviceGroup"-->
31
- <!-- serviceName="af-his"-->
32
- <!-- />-->
33
- <!-- </a-card>-->
34
- </div>
35
- </template>
36
-
37
- <script setup>
38
- // import HTab from './HTab/HTab.vue'
39
- import HFormTable from './HFormTable/HFormTable.vue'
40
- // import HButtons from './HButtons/HButtons.vue'
41
- import HAddNativeForm from '@vue2-client/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm.vue'
42
- </script>
43
-
44
- <style scoped lang="less">
45
- .h-tab-demo {
46
- padding: 20px;
47
-
48
- h4 {
49
- color: #333;
50
- margin-bottom: 10px;
51
- font-size: 14px;
52
- }
53
- }
54
- </style>
1
+ <template>
2
+ <div class="h-tab-demo">
3
+ <!-- &lt;!&ndash; XTab &ndash;&gt;-->
4
+ <!-- <a-card title="XTab">-->
5
+ <!-- <h-tab-->
6
+ <!-- configName="openPrescriptionTab"-->
7
+ <!-- serverName="af-his"-->
8
+ <!-- />-->
9
+ <!-- </a-card>-->
10
+
11
+ <!-- HFormTable -->
12
+ <a-card title="HFormTable" style="margin-top: 20px;">
13
+ <h-form-table
14
+ queryParamsName="outpatientAdviceAllCRUD"
15
+ serviceName="af-his"
16
+ />
17
+ </a-card>
18
+
19
+ <!-- HForm -->
20
+ <a-card title="HAddNativeForm" style="margin-top: 20px;">
21
+ <h-add-native-form
22
+ queryParamsName="TCMAdviceFormConfig"
23
+ serviceName="af-his"
24
+ />
25
+ </a-card>
26
+ <!-- <a-card title="HFormGroup" style="margin-top: 20px;">-->
27
+ <!-- <h-form-group-->
28
+ <!-- queryParamsName="surgeryApplicationFormGroup"-->
29
+ <!-- serviceName="af-his"-->
30
+ <!-- :left-hide="true"-->
31
+ <!-- />-->
32
+ <!-- </a-card>-->
33
+ <!-- &lt;!&ndash; HButtons &ndash;&gt;-->
34
+ <!-- <a-card title="HButtons" style="margin-top: 20px;">-->
35
+ <!-- <h-buttons-->
36
+ <!-- queryParamsName="outpatientAdviceGroup"-->
37
+ <!-- serviceName="af-his"-->
38
+ <!-- />-->
39
+ <!-- </a-card>-->
40
+ </div>
41
+ </template>
42
+
43
+ <script setup>
44
+ // import HTab from './HTab/HTab.vue'
45
+ import HFormTable from './HFormTable/HFormTable.vue'
46
+ // import HButtons from './HButtons/HButtons.vue'
47
+ import HAddNativeForm from '@vue2-client/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm.vue'
48
+ // import HFormGroup from './HFormGroup/HFormGroup.vue'
49
+ </script>
50
+
51
+ <style scoped lang="less">
52
+ .h-tab-demo {
53
+ padding: 20px;
54
+
55
+ h4 {
56
+ color: #333;
57
+ margin-bottom: 10px;
58
+ font-size: 14px;
59
+ }
60
+ }
61
+ </style>
@@ -4,8 +4,12 @@
4
4
  title="示例表单"
5
5
  :queryParamsName="queryParamsName"
6
6
  :fixedAddForm="fixedAddForm"
7
+ :x-tree-config-name="xTreeConfigName"
7
8
  :externalSelectedRowKeys="selectedKeys"
8
- serviceName="af-linepatrol"
9
+ @action="action"
10
+ @selectRow="selectRow"
11
+ @columnClick="columnClick"
12
+ serviceName="af-revenue"
9
13
  ref="xFormTable">
10
14
  </x-form-table>
11
15
  </a-card>
@@ -13,18 +17,19 @@
13
17
 
14
18
  <script>
15
19
  import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'
16
- import XAddNativeForm from '@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
20
+ import { microDispatch } from '@vue2-client/utils/microAppUtils'
17
21
 
18
22
  export default {
19
23
  name: 'Demo',
20
24
  components: {
21
- XFormTable,
22
- XAddNativeForm
25
+ XFormTable
23
26
  },
24
27
  data () {
25
28
  return {
26
29
  // 查询配置文件名
27
- queryParamsName: 'ceshiCRUD',
30
+ queryParamsName: 'address_management',
31
+ // 查询配置左侧tree
32
+ xTreeConfigName: 'addressType',
28
33
  // 新增表单固定值
29
34
  fixedAddForm: {},
30
35
  // 是否显示详情抽屉
@@ -39,9 +44,42 @@ export default {
39
44
  }
40
45
  }
41
46
  },
42
- mounted () {
43
- },
44
47
  methods: {
48
+ test () {
49
+ this.$refs.xFormTable.setTableData([])
50
+ },
51
+ defaultF () {
52
+ this.$refs.xFormTable.setTableSize('default')
53
+ },
54
+ middleF () {
55
+ this.$refs.xFormTable.setTableSize('middle')
56
+ },
57
+ smallF () {
58
+ this.$refs.xFormTable.setTableSize('small')
59
+ },
60
+ columnClick (key, value, record) {
61
+ microDispatch({
62
+ type: 'v3route',
63
+ path: '/bingliguanli/dianzibingliluru',
64
+ props: { selected: arguments[0].his_f_admission_id }
65
+ })
66
+ },
67
+ action (record, id, actionType) {
68
+ this.detailVisible = true
69
+ console.log('触发了详情操作', record, id, actionType)
70
+ },
71
+ onClose () {
72
+ this.detailVisible = false
73
+ // 关闭详情之后重新查询表单
74
+ this.$refs.xFormTable.refreshTable(true)
75
+ },
76
+ selectRow (selectedRowKeys, selectedRows) {
77
+ this.selected = {
78
+ keys: selectedRowKeys,
79
+ rows: selectedRows
80
+ }
81
+ console.log('selectedDemo', this.selected)
82
+ },
45
83
  },
46
84
  computed: {},
47
85
  }