vue2-client 1.14.97 → 1.14.99

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,96 +1,96 @@
1
- <template>
2
- <a-card :bordered="false" :body-style="bodyStyle">
3
- <a-tabs
4
- :tabBarGutter="tabBarGutter"
5
- :activeKey="activeKey"
6
- @change="tabPaneChange"
7
- :hideAdd="true"
8
- :tabBarStyle="{ display: showTabBar ? 'block' : 'none' }"
9
- >
10
- <slot name="extraBeforeTabs"></slot>
11
- <a-tab-pane
12
- :forceRender="true"
13
- v-for="(tab, index) in data"
14
- :key="index"
15
- :tab="tab.title"
16
- >
17
- <component
18
- :is="resolveComponentType(tab.type)"
19
- :key="`xTabPaneComp${index}`"
20
- :ref="`tab_comp_${index}`"
21
- v-bind="tab.props || {}"
22
- />
23
- </a-tab-pane>
24
- </a-tabs>
25
- </a-card>
26
- </template>
27
-
28
- <script setup>
29
- import { ref, onMounted } from 'vue'
30
- import { resolveComponentType } from '../componentTypes'
31
-
32
- const props = defineProps({
33
- // 标签页数据
34
- data: {
35
- type: Array,
36
- required: true
37
- },
38
- // 是否显示标签栏
39
- showTabBar: {
40
- type: Boolean,
41
- default: true
42
- },
43
- // 标签页切换时的回调函数
44
- onChange: {
45
- type: [String, Function],
46
- default: null
47
- },
48
- // Tab间距
49
- tabBarGutter: {
50
- type: Number,
51
- default: 10
52
- },
53
- // 卡片样式
54
- bodyStyle: {
55
- type: Object,
56
- default: () => ({})
57
- },
58
- // 默认激活的标签页
59
- defaultActiveKey: {
60
- type: [String, Number],
61
- default: 0
62
- }
63
- })
64
-
65
- // 激活的标签页
66
- const activeKey = ref(0)
67
-
68
- // 切换标签页
69
- const tabPaneChange = (newKey) => {
70
- if (activeKey.value === newKey) return
71
-
72
- const oldKey = activeKey.value
73
- activeKey.value = newKey
74
-
75
- // 触发标签页切换事件
76
- if (props.onChange) {
77
- try {
78
- if (props.onChange instanceof Function) {
79
- props.onChange(oldKey, newKey, props.data[oldKey], props.data[newKey])
80
- } else {
81
- // 创建一个安全的函数执行环境
82
- // eslint-disable-next-line no-new-func
83
- const onChange = new Function('oldKey', 'newKey', 'oldTab', 'newTab', `return (${props.onChange})(oldKey, newKey, oldTab, newTab)`)
84
- onChange(oldKey, newKey, props.data[oldKey], props.data[newKey])
85
- }
86
- } catch (error) {
87
- console.error('执行标签页切换回调错误:', error)
88
- }
89
- }
90
- }
91
-
92
- // 生命周期
93
- onMounted(() => {
94
- activeKey.value = props.defaultActiveKey
95
- })
96
- </script>
1
+ <template>
2
+ <a-card :bordered="false" :body-style="bodyStyle">
3
+ <a-tabs
4
+ :tabBarGutter="tabBarGutter"
5
+ :activeKey="activeKey"
6
+ @change="tabPaneChange"
7
+ :hideAdd="true"
8
+ :tabBarStyle="{ display: showTabBar ? 'block' : 'none' }"
9
+ >
10
+ <slot name="extraBeforeTabs"></slot>
11
+ <a-tab-pane
12
+ :forceRender="true"
13
+ v-for="(tab, index) in data"
14
+ :key="index"
15
+ :tab="tab.title"
16
+ >
17
+ <component
18
+ :is="resolveComponentType(tab.type)"
19
+ :key="`xTabPaneComp${index}`"
20
+ :ref="`tab_comp_${index}`"
21
+ v-bind="tab.props || {}"
22
+ />
23
+ </a-tab-pane>
24
+ </a-tabs>
25
+ </a-card>
26
+ </template>
27
+
28
+ <script setup>
29
+ import { ref, onMounted } from 'vue'
30
+ import { resolveComponentType } from '../componentTypes'
31
+
32
+ const props = defineProps({
33
+ // 标签页数据
34
+ data: {
35
+ type: Array,
36
+ required: true
37
+ },
38
+ // 是否显示标签栏
39
+ showTabBar: {
40
+ type: Boolean,
41
+ default: true
42
+ },
43
+ // 标签页切换时的回调函数
44
+ onChange: {
45
+ type: [String, Function],
46
+ default: null
47
+ },
48
+ // Tab间距
49
+ tabBarGutter: {
50
+ type: Number,
51
+ default: 10
52
+ },
53
+ // 卡片样式
54
+ bodyStyle: {
55
+ type: Object,
56
+ default: () => ({})
57
+ },
58
+ // 默认激活的标签页
59
+ defaultActiveKey: {
60
+ type: [String, Number],
61
+ default: 0
62
+ }
63
+ })
64
+
65
+ // 激活的标签页
66
+ const activeKey = ref(0)
67
+
68
+ // 切换标签页
69
+ const tabPaneChange = (newKey) => {
70
+ if (activeKey.value === newKey) return
71
+
72
+ const oldKey = activeKey.value
73
+ activeKey.value = newKey
74
+
75
+ // 触发标签页切换事件
76
+ if (props.onChange) {
77
+ try {
78
+ if (props.onChange instanceof Function) {
79
+ props.onChange(oldKey, newKey, props.data[oldKey], props.data[newKey])
80
+ } else {
81
+ // 创建一个安全的函数执行环境
82
+ // eslint-disable-next-line no-new-func
83
+ const onChange = new Function('oldKey', 'newKey', 'oldTab', 'newTab', `return (${props.onChange})(oldKey, newKey, oldTab, newTab)`)
84
+ onChange(oldKey, newKey, props.data[oldKey], props.data[newKey])
85
+ }
86
+ } catch (error) {
87
+ console.error('执行标签页切换回调错误:', error)
88
+ }
89
+ }
90
+ }
91
+
92
+ // 生命周期
93
+ onMounted(() => {
94
+ activeKey.value = props.defaultActiveKey
95
+ })
96
+ </script>
@@ -1,22 +1,22 @@
1
- // 支持的组件类型映射
2
- export const components = {
3
- XTab: () => import('@vue2-client/base-client/components/layout/XPageView/XTab'),
4
- XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable'),
5
- XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm'),
6
- XReportGrid: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
7
- XErrorView: () => import('@vue2-client/base-client/components/layout/XPageView/XErrorView'),
8
- // 全局组件不需要导入,直接返回null,让Vue使用全局注册的组件
9
- }
10
-
11
- // 组件类型解析函数
12
- export const resolveComponentType = (type) => {
13
- if (!type) return components.XErrorView
14
-
15
- // 如果是Ant Design Vue组件(以'a-'开头),直接返回原名称
16
- if (type.startsWith('a-')) {
17
- return type
18
- }
19
-
20
- // 否则从已注册的组件集合中查找
21
- return components[type] || components.XErrorView
22
- }
1
+ // 支持的组件类型映射
2
+ export const components = {
3
+ XTab: () => import('@vue2-client/base-client/components/layout/XPageView/XTab'),
4
+ XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable'),
5
+ XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm'),
6
+ XReportGrid: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
7
+ XErrorView: () => import('@vue2-client/base-client/components/layout/XPageView/XErrorView'),
8
+ // 全局组件不需要导入,直接返回null,让Vue使用全局注册的组件
9
+ }
10
+
11
+ // 组件类型解析函数
12
+ export const resolveComponentType = (type) => {
13
+ if (!type) return components.XErrorView
14
+
15
+ // 如果是Ant Design Vue组件(以'a-'开头),直接返回原名称
16
+ if (type.startsWith('a-')) {
17
+ return type
18
+ }
19
+
20
+ // 否则从已注册的组件集合中查找
21
+ return components[type] || components.XErrorView
22
+ }
@@ -30,6 +30,23 @@
30
30
  >
31
31
  </WorkflowDetail>
32
32
  <address-select ref="addressSelect" @setAddress="setForm"></address-select>
33
+ <!-- 协议作废功能 -->
34
+ <a-modal
35
+ v-model="formState"
36
+ :dialog-style="{ top: '5rem' }"
37
+ :z-index="1001"
38
+ title="作废"
39
+ :destroyOnClose="true"
40
+ width="55vw">
41
+ <x-add-native-form
42
+ ref="xCancelForm"
43
+ @onSubmit="submit"
44
+ />
45
+ <template #footer>
46
+ <a-button key="back" @click="formState = false">取消</a-button>
47
+ <a-button key="submit" type="primary" :loading="submitLoading" @click="formSubmit">确认</a-button>
48
+ </template>
49
+ </a-modal>
33
50
  </a-card>
34
51
  </template>
35
52
 
@@ -54,7 +71,10 @@ export default {
54
71
  // 查询配置文件名
55
72
  queryParamsName: 'applyCRUD',
56
73
  // 发起报建弹框控制
57
- applyAddFlag: false
74
+ applyAddFlag: false,
75
+ formState: false,
76
+ submitLoading: false,
77
+ cancelRecord: {}
58
78
  }
59
79
  },
60
80
  computed: {
@@ -101,6 +121,55 @@ export default {
101
121
  },
102
122
  setForm (record) {
103
123
  this.$refs.workFlow.setFormValue({ address: record.f_address })
124
+ },
125
+ // 协议作废
126
+ setCancel (record) {
127
+ this.cancelRecord = record
128
+ this.formState = true
129
+ this.$nextTick(() => {
130
+ getConfigByName('setCancelForm', 'af-apply', (config) => {
131
+ if (this.$refs.xCancelForm) {
132
+ this.$refs.xCancelForm.init({
133
+ formItems: config.formJson,
134
+ title: '补充协议作废',
135
+ businessType: '修改',
136
+ showSubmitBtn: false,
137
+ ...config
138
+ })
139
+ if (this.$refs.xCancelForm) {
140
+ console.log(record)
141
+ // this.$refs.xCancelForm.setForm(recordData)
142
+ }
143
+ } else {
144
+ console.error('xCancelForm组件未加载完成')
145
+ // 延迟重试
146
+ setTimeout(() => {
147
+ this.setCancel(record)
148
+ }, 100)
149
+ }
150
+ })
151
+ })
152
+ },
153
+ async formSubmit () {
154
+ this.submitLoading = true
155
+ const formData = await this.$refs.xCancelForm.asyncSubmit()
156
+ try {
157
+ await this.submit(formData)
158
+ } catch (error) {
159
+ this.$message.error('表单验证失败,请检查填写内容')
160
+ } finally {
161
+ this.submitLoading = false
162
+ }
163
+ },
164
+ async submit (formData) {
165
+ const data = {
166
+ ...formData,
167
+ }
168
+ console.log('==formData', data)
169
+ await runLogic('666', data, 'af-apply').then(() => {
170
+ this.$message.success('操作成功')
171
+ this.formState = false
172
+ })
104
173
  }
105
174
  }
106
175
  }