vue2-client 1.15.11 → 1.15.12

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
+ }
@@ -1,211 +1,47 @@
1
- <template>
2
- <a-card :bordered="false">
3
- <x-form-table
4
- title="我的工单"
5
- ref="xFormTable"
6
- :queryParamsName="queryParamsName"
7
- :fixed-query-form="{
8
- users_f_handler_id: currUser.id,
9
- }"
10
- @action="toDetail">
11
- <template slot="button">
12
- <a-button @click="addApply">
13
- <a-icon type="plus"/>
14
- 发起报建
15
- </a-button>
16
- </template>
17
- </x-form-table>
18
- <a-modal
19
- v-model="applyAddFlag"
20
- :footer="null"
21
- :dialog-style="{ top: '5rem' }"
22
- :z-index="1001"
23
- title="发起报建"
24
- :destroyOnClose="true">
25
- <x-add-native-form ref="xForm" @onSubmit="applySubmit"/>
26
- </a-modal>
27
- <WorkflowDetail
28
- ref="workFlow"
29
- @success="success"
30
- @nextClick="nextClick"
31
- @x-form-item-emit-func="handleFormItemEvent"
32
- >
33
- </WorkflowDetail>
34
- <address-select ref="addressSelect" @setAddress="setForm"></address-select>
35
- <!-- 协议作废功能 -->
36
- <a-modal
37
- v-model="formState"
38
- :dialog-style="{ top: '5rem' }"
39
- :z-index="1001"
40
- title="作废"
41
- :destroyOnClose="true"
42
- width="55vw">
43
- <x-add-native-form
44
- ref="xCancelForm"
45
- @onSubmit="submit"
46
- />
47
- <template #footer>
48
- <a-button key="back" @click="formState = false">取消</a-button>
49
- <a-button key="submit" type="primary" :loading="submitLoading" @click="formSubmit">确认</a-button>
50
- </template>
51
- </a-modal>
52
- </a-card>
53
- </template>
54
-
55
1
  <script>
56
2
  import WorkflowDetail from '@vue2-client/pages/WorkflowDetail/WorkflowDetail.vue'
57
- import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
58
- import XAddNativeForm from '@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
59
- import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
60
- import { mapState } from 'vuex'
61
- import AddressSelect from '@vue2-client/pages/addressSelect/index.vue'
62
3
 
63
4
  export default {
64
- name: 'Apply',
65
- components: {
66
- XFormTable,
67
- XAddNativeForm,
68
- WorkflowDetail,
69
- AddressSelect
70
- },
71
- provide () {
72
- return {
73
- generalFunction: {
74
- setCancel: this.setCancel,
75
- updateFormData: this.updateFormData,
76
- }
77
- }
78
- },
79
- data () {
80
- return {
81
- // 查询配置文件名
82
- queryParamsName: 'ApplyProcessCRUD',
83
- // 发起报建弹框控制
84
- applyAddFlag: false,
85
- formState: false,
86
- submitLoading: false,
87
- cancelRecord: {}
88
- }
89
- },
90
- computed: {
91
- ...mapState('account', { currUser: 'user' }),
5
+ name: 'WorkFlowDemo',
6
+ components: { WorkflowDetail },
7
+ mounted () {
8
+ this.$refs.workFlow.init({
9
+ workflowId: '58'
10
+ })
92
11
  },
93
12
  methods: {
94
- addApply () {
95
- console.log('打开了吗')
96
- this.applyAddFlag = true
97
- this.$nextTick(
98
- () => {
99
- getConfigByName('addApplyForm', 'af-apply', (res) => {
100
- this.$refs.xForm.init({
101
- businessType: '新增',
102
- title: '发起报建',
103
- ...res
104
- })
105
- })
106
- }
107
- )
108
- },
109
- applySubmit (formData) {
110
- runLogic('addApply', formData).then(
111
- res => {
112
- this.$message.success('发起报建成功')
113
- this.$refs.xFormTable.refreshTable(true)
114
- this.applyAddFlag = false
115
- }
116
- ).catch(() => {
117
- this.applyAddFlag = false
118
- })
119
- },
120
- success () {
121
- console.log('完工')
122
- },
123
- toDetail (record, id) {
124
- this.$refs.workFlow.init({
125
- workflowId: record.ab_f_workflow_id
126
- })
127
- },
128
- handleFormItemEvent (func, data, value) {
129
- console.log('打印一下:', func, data, value)
130
- if (func === 'selectAddress') {
131
- this.$refs.addressSelect.setFormShow()
132
- }
133
- },
134
- setForm (record) {
135
- this.$refs.workFlow.setFormValue({ address: record.f_address, address_id: record.f_address_id })
136
- },
137
- nextClick ({ form, formStep, workflowId }) {
138
- console.log('success', form, formStep, workflowId)
139
- const data = {
140
- workflowId,
141
- form,
142
- formStep
143
- }
144
- runLogic('applySubmitAfter', data, 'af-apply').then(
145
- res => {
146
- if (res) {
147
- // this.$message.success('提交成功!')
148
- this.$refs.xFormTable.refreshTable(true)
149
- }
150
- }
151
- )
152
- },
153
- // 协议作废
154
- setCancel (record) {
155
- this.cancelRecord = record
156
- this.formState = true
157
- this.$nextTick(() => {
158
- getConfigByName('setCancelForm', 'af-apply', (config) => {
159
- if (this.$refs.xCancelForm) {
160
- this.$refs.xCancelForm.init({
161
- formItems: config.formJson,
162
- title: '补充协议作废',
163
- businessType: '修改',
164
- showSubmitBtn: false,
165
- ...config
166
- })
167
- if (this.$refs.xCancelForm) {
168
- console.log(record)
169
- // this.$refs.xCancelForm.setForm(recordData)
170
- }
171
- } else {
172
- console.error('xCancelForm组件未加载完成')
173
- // 延迟重试
174
- setTimeout(() => {
175
- this.setCancel(record)
176
- }, 100)
177
- }
178
- })
179
- })
180
- },
181
- async formSubmit () {
182
- this.submitLoading = true
183
- const formData = await this.$refs.xCancelForm.asyncSubmit()
184
- try {
185
- await this.submit(formData)
186
- } catch (error) {
187
- this.$message.error('表单验证失败,请检查填写内容')
188
- } finally {
189
- this.submitLoading = false
190
- }
191
- },
192
- async submit (formData) {
193
- const data = {
194
- ...formData,
195
- }
196
- console.log('==formData', data)
197
- await runLogic('暂时没有实现的logic', data, 'af-apply').then(() => {
198
- this.$message.success('操作成功')
199
- this.formState = false
200
- })
201
- },
202
- updateFormData (workflowId) {
203
- runLogic('queryAgreementAmount', { workflowId: workflowId }, 'af-apply').then((res) => {
204
- console.log('>>>> res==', res)
205
- this.$refs.workFlow.$refs.workflowHandle.$refs.xAddForm.setForm({ add_amount: 1200 })
206
- })
207
- console.log()
13
+ /**
14
+ * 流程详情页成功
15
+ * @param note 备注信息
16
+ * @param form 表单信息
17
+ * @param workflowId
18
+ */
19
+ success ({ note, form, workflowId }) {
20
+ console.log('success', note, form, workflowId)
21
+ },
22
+ /**
23
+ * 流程详情页成功
24
+ * @param note 备注信息
25
+ * @param form 表单信息
26
+ * @param workflowId 工作流id
27
+ * @param fromStepId 起ID
28
+ * @param toStepId 往ID
29
+ * @param successStepId 完成步骤id
30
+ * @param successStep 完成步骤名称
31
+ * @param fromStep 起步骤名称
32
+ * @param toStep 往步骤名称
33
+ */
34
+ nextClick ({ note, form, workflowId, fromStepId, toStepId, fromStep, toStep, successStepId, successStep }) {
35
+ console.log('success', note, form, workflowId, fromStepId, toStepId, fromStep, toStep, successStepId, successStep)
208
36
  }
209
37
  }
210
38
  }
211
39
  </script>
40
+
41
+ <template>
42
+ <WorkflowDetail ref="workFlow" @success="success" @nextClick="nextClick"></WorkflowDetail>
43
+ </template>
44
+
45
+ <style scoped lang="less">
46
+
47
+ </style>