@utogether/udp-core 2.0.0-beta.26 → 2.0.0-beta.28
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.
- package/dist/403-CyoOD-Ik.js +65 -0
- package/dist/404-Ch_OHTw0.js +65 -0
- package/dist/500-Cf9am7HK.js +67 -0
- package/dist/AuthorityInfo-BJ427cqG.js +4 -0
- package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-D9y7AwbB.js +99 -0
- package/dist/AuthorityPanel-lVnZ5bce.js +4 -0
- package/dist/AuthorityPanel.vue_vue_type_style_index_0_lang-nsfhDlvV.js +113 -0
- package/dist/Company-qo-lKPkv.js +25 -0
- package/dist/CompanyPanel-DkKWAKvY.js +204 -0
- package/dist/DataSet-iBHzs75s.js +147 -0
- package/dist/Department-CHUQByKX.js +25 -0
- package/dist/DepartmentPanel-C742dfOO.js +248 -0
- package/dist/DesignPanel-D9oE5R7m.js +4 -0
- package/dist/DesignPanel.vue_vue_type_style_index_0_lang-hYldVEbo.js +1097 -0
- package/dist/DictView-CrFXprP9.js +110 -0
- package/dist/InvOrganization-Cz8SzIgs.js +73 -0
- package/dist/Org-Bzt6yKox.js +38 -0
- package/dist/Preview-jonigfMQ.js +48 -0
- package/dist/ReportDefine-BpiM5Ovq.js +10 -0
- package/dist/ReportDesign-fp09cXJ7.js +164 -0
- package/dist/ReportQuery-52ZP1PYP.js +74 -0
- package/dist/ReportQueryFrom-DSYavJb1.js +4 -0
- package/dist/ReportQueryFrom.vue_vue_type_style_index_0_lang-DBGYEp0u.js +177 -0
- package/dist/ReportTemplate-CA_UW0eD.js +161 -0
- package/dist/Role-DqOt8Bk0.js +25 -0
- package/dist/RoleAssign-BdxhefhQ.js +26 -0
- package/dist/RolePanel-2gZ3H0ET.js +4 -0
- package/dist/RolePanel-BsNd0svJ.js +4 -0
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-DLOwgF99.js +152 -0
- package/dist/RolePanel.vue_vue_type_script_setup_true_lang-DmzD9kab.js +131 -0
- package/dist/ScrollPanel.vue_vue_type_style_index_0_lang-B9ptUMeI.js +99 -0
- package/dist/Staff-D3L8fEoY.js +26 -0
- package/dist/StaffInfo-DYRw6ZYJ.js +4 -0
- package/dist/StaffInfo.vue_vue_type_script_setup_true_lang-xqEOQnMs.js +107 -0
- package/dist/StaffPanel-DkrNH6Px.js +4 -0
- package/dist/StaffPanel.vue_vue_type_script_setup_true_lang-BPBMnliy.js +152 -0
- package/dist/SysUser-Bl1-cIpJ.js +15 -0
- package/dist/SysUserPanel-yxNLaBwt.js +4 -0
- package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BDcsgSl5.js +352 -0
- package/dist/SystemMenu-C4_Arn12.js +155 -0
- package/dist/UserInfo-QcNwJCUR.js +4 -0
- package/dist/UserInfo.vue_vue_type_style_index_0_lang-DLIeUphX.js +159 -0
- package/dist/childView-B23DEO2u.js +4 -0
- package/dist/childView-saDZQv9x.js +4 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-RsKR6CAC.js +182 -0
- package/dist/childView.vue_vue_type_style_index_0_lang-ZFEfavUY.js +142 -0
- package/dist/code-rule-2_Ihx_by.js +147 -0
- package/dist/core.es.js +26 -6
- package/dist/cron-task-BFOPJQIk.js +134 -0
- package/dist/flow-task-PoDnE_kE.js +10 -0
- package/dist/frameView-f7Ya0Knj.js +43 -0
- package/dist/index-BpdTDaTk.js +3213 -0
- package/dist/layout-home-v3DPJ7rB.js +231 -0
- package/dist/layoutView-DZHoQDH1.js +3190 -0
- package/dist/log-in-BPAMJTwH.js +115 -0
- package/dist/log-out-DZACF0jg.js +129 -0
- package/dist/login-B8cwozax.js +216 -0
- package/dist/login-log-CVvRgZSu.js +70 -0
- package/dist/lov-view-Ba7Y7xy0.js +98 -0
- package/dist/menuInfo-BpRKFYK8.js +4 -0
- package/dist/menuInfo.vue_vue_type_style_index_0_lang-DJ5sUC6m.js +359 -0
- package/dist/pda-app-C0jJecrL.js +706 -0
- package/dist/redirect-DTz8GSnv.js +15 -0
- package/dist/resource-BG22Cw4P.js +97 -0
- package/dist/su-welcome-DaxhbrC6.js +879 -0
- package/dist/sys-config-CG2fMtak.js +384 -0
- package/dist/udp-core.css +1 -2
- package/dist/useNav-_u2UAQWk.js +84 -0
- package/dist/utogether-MlnyYtNS.js +4 -0
- package/dist/wecom-push-B75FLee5.js +70 -0
- package/index.ts +54 -50
- package/package.json +21 -21
- package/src/App.vue +79 -78
- package/src/api/http.ts +10 -4
- package/src/api/index.ts +51 -51
- package/src/api/user.ts +64 -64
- package/src/components/SuQrcode/src/index.tsx +231 -236
- package/src/components/udp/content/index.vue +93 -93
- package/src/components/udp/form-upload/form-upload.vue +496 -496
- package/src/components/udp/grid/index.vue +643 -544
- package/src/components/udp/index.ts +2 -1
- package/src/components/udp/modal-form/index.vue +326 -0
- package/src/components/udp/utils.ts +420 -420
- package/src/layout/components/lay-navbar/index.vue +240 -240
- package/src/layout/components/lay-panel/index.vue +2 -6
- package/src/layout/components/lay-search/components/SearchModal.vue +185 -181
- package/src/layout/components/lay-sidebar/mixNav.vue +261 -261
- package/src/layout/components/lay-sidebar/sidebarItem.vue +199 -195
- package/src/layout/components/lay-sidebar/vertical.vue +92 -92
- package/src/layout/layoutView.vue +1 -0
- package/src/main.ts +111 -109
- package/src/plugins/i18n/zh.ts +5 -1
- package/src/plugins/vxe-table/index.ts +116 -116
- package/src/router/index.ts +5 -34
- package/src/router/utils.ts +434 -430
- package/src/store/modules/permission.ts +1 -1
- package/src/store/modules/system.ts +193 -186
- package/src/style/print-lock.css +380 -375
- package/src/style/suprint.css +990 -985
- package/src/style/vxetable.scss +372 -364
- package/src/utils/authority/index.ts +19 -2
- package/src/utils/dataFormat/index.ts +309 -222
- package/src/utils/udp/http/index.ts +126 -67
- package/src/utils/udp/http/types.d.ts +15 -14
- package/src/views/login/login-view.vue +4 -21
- package/src/views/organization/department/DepartmentPanel.vue +3 -4
- package/src/views/system/sys/sys-config.vue +344 -344
- package/src/views/uhome/components/home-todo.vue +191 -178
- package/src/views/uhome/dynamic-card.vue +31 -31
- package/src/views/uhome/su-welcome.vue +310 -310
- package/src/views/ulogin/login.vue +292 -296
- package/src/views/urpt/design/DesignPanel.vue +538 -507
- package/src/views/urpt/design/print-data.ts +39 -59
- package/tsconfig.json +2 -3
- package/types/global.d.ts +234 -234
- package/vite.config.ts +2 -1
- package/dist/403-D6Wb3JJh.js +0 -72
- package/dist/404-B_HNbPNV.js +0 -72
- package/dist/500-BMemTTy1.js +0 -77
- package/dist/AuthorityInfo-6wHxwiFM.js +0 -91
- package/dist/AuthorityPanel-OqF_DvXA.js +0 -98
- package/dist/Company-BLXSfow0.js +0 -21
- package/dist/CompanyPanel-B4kRZ5Cg.js +0 -199
- package/dist/DataSet-CuGZcKC-.js +0 -141
- package/dist/Department-oFhsa7cd.js +0 -21
- package/dist/DepartmentPanel-B1UGpu-r.js +0 -242
- package/dist/DepartmentPanel-BL58AdoT.js +0 -2
- package/dist/DesignPanel-DmkFVw1N.js +0 -1196
- package/dist/DictView-CC5yMzOq.js +0 -100
- package/dist/File-WJXjGYxr.js +0 -89
- package/dist/InvOrganization-BwMmD8Ua.js +0 -76
- package/dist/Org-HgnOWubi.js +0 -76
- package/dist/Preview-CAzWxLmP.js +0 -45
- package/dist/ReIcon-DecitXmg.js +0 -413
- package/dist/ReportDefine-BgLM-Rjk.js +0 -10
- package/dist/ReportDesign-DwchGG2P.js +0 -158
- package/dist/ReportQuery-D5jaRJEn.js +0 -101
- package/dist/ReportQueryFrom-CNlmtYey.js +0 -198
- package/dist/ReportTemplate-CNcTmccs.js +0 -162
- package/dist/Role-Be8WfdCA.js +0 -21
- package/dist/RoleAssign-CtehGAUf.js +0 -22
- package/dist/RolePanel-CAwITg_q.js +0 -131
- package/dist/RolePanel-SN0FGFZ7.js +0 -176
- package/dist/ScrollPanel-DW30pGz1.js +0 -88
- package/dist/Staff-V2YsNKcj.js +0 -22
- package/dist/StaffInfo-CKRPW0r4.js +0 -149
- package/dist/StaffPanel-BxcgMg7u.js +0 -143
- package/dist/SysUser-Dxyj5w5m.js +0 -12
- package/dist/SysUserPanel-DI6CWcZo.js +0 -365
- package/dist/SystemMenu-BBHREM8T.js +0 -154
- package/dist/UserInfo-BMVQ0xwE.js +0 -194
- package/dist/_plugin-vue_export-helper-C6QCLu9I.js +0 -8
- package/dist/api-BFNxcxSN.js +0 -30
- package/dist/authority-BJFEUdrh.js +0 -20
- package/dist/await-to-js.es5-DkWYmPXW.js +0 -10
- package/dist/childView-BBjPEraB.js +0 -184
- package/dist/childView-DNqG2UVm.js +0 -181
- package/dist/code-rule-QFrhqFrW.js +0 -151
- package/dist/contant-Q77dU_V3.js +0 -4
- package/dist/cron-task-BpUDKEAU.js +0 -131
- package/dist/flow-task-DAc2NrDU.js +0 -11
- package/dist/frameView-Di0zJZUR.js +0 -39
- package/dist/layout-home-BVp7vYLR.js +0 -239
- package/dist/layoutView-B6Mx2ERA.js +0 -2662
- package/dist/log-in-BrNB0mLz.js +0 -117
- package/dist/log-out-dYfqvzy6.js +0 -111
- package/dist/login-D_Hjy3Jd.js +0 -231
- package/dist/login-log-CJak-ANA.js +0 -79
- package/dist/lov-view-DM5Nm5tW.js +0 -95
- package/dist/menuInfo-BlOY1KZW.js +0 -346
- package/dist/mitt-CQgI7DYU.js +0 -27
- package/dist/pda-app-CA7YI37u.js +0 -589
- package/dist/redirect-N0k4tImU.js +0 -16
- package/dist/resource-CfQTHFcs.js +0 -94
- package/dist/su-welcome-DVD3S_du.js +0 -799
- package/dist/sys-config-Ddb3vBpK.js +0 -316
- package/dist/system-Cm3lyBas.js +0 -1528
- package/dist/udp-core-DaQd5CF1.js +0 -2028
- package/dist/useDataThemeChange-DJ4K3VGp.js +0 -226
- package/dist/useNav-BhOJIdrJ.js +0 -106
- package/dist/utogether-l7JXs4Lv.js +0 -4
- package/dist/water-mark-WDQZ9YqB.js +0 -119
- package/dist/wecom-push-kWkAVRCj.js +0 -77
|
@@ -5,5 +5,6 @@ import FormUpload2 from './form-upload/form-upload.vue';
|
|
|
5
5
|
import UtStampBadge2 from './ut-stamp-badge/index.vue';
|
|
6
6
|
import UtUpload2 from './upload/index.vue';
|
|
7
7
|
import UtLov2 from './lov/index.vue';
|
|
8
|
+
import UtModalForm2 from './modal-form/index.vue';
|
|
8
9
|
|
|
9
|
-
export { UtGrid2, UtForm2, UtContent2, FormUpload2, UtStampBadge2, UtUpload2, UtLov2 };
|
|
10
|
+
export { UtGrid2, UtForm2, UtContent2, FormUpload2, UtStampBadge2, UtUpload2, UtLov2, UtModalForm2 };
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: wei.li
|
|
3
|
+
* @Date: 2021-11-29 21:02:43
|
|
4
|
+
* @LastEditors: levi7754 levi7754@163.com
|
|
5
|
+
* @LastEditTime: 2026-08-06 10:20:41
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div>
|
|
11
|
+
<vxe-modal
|
|
12
|
+
v-model="showModal"
|
|
13
|
+
:title="title"
|
|
14
|
+
:width="width"
|
|
15
|
+
:height="modalHeight"
|
|
16
|
+
:loading="loading"
|
|
17
|
+
:show-footer="dataStatus !== 'detail'"
|
|
18
|
+
min-width="240"
|
|
19
|
+
destroy-on-close
|
|
20
|
+
resize
|
|
21
|
+
v-bind="modalOptions"
|
|
22
|
+
@close="onClose"
|
|
23
|
+
>
|
|
24
|
+
<template #default>
|
|
25
|
+
<vxe-form
|
|
26
|
+
ref="xForm"
|
|
27
|
+
:data="data"
|
|
28
|
+
:items="formItems"
|
|
29
|
+
:rules="rules"
|
|
30
|
+
:title-width="titleWidth"
|
|
31
|
+
title-align="right"
|
|
32
|
+
v-bind="formOptions"
|
|
33
|
+
>
|
|
34
|
+
<template #dividerPrefix />
|
|
35
|
+
<!-- <template #collapseNode>
|
|
36
|
+
<vxe-checkbox
|
|
37
|
+
v-model="collapseStatus"
|
|
38
|
+
content="查看更多"
|
|
39
|
+
:checked-value="false"
|
|
40
|
+
:unchecked-value="true"
|
|
41
|
+
class="pl-10"
|
|
42
|
+
@change="onChange"
|
|
43
|
+
/>
|
|
44
|
+
</template> -->
|
|
45
|
+
</vxe-form>
|
|
46
|
+
</template>
|
|
47
|
+
<template v-if="!loading" #footer>
|
|
48
|
+
<vxe-checkbox
|
|
49
|
+
v-if="dataStatus === 'add'"
|
|
50
|
+
v-model="isContinue"
|
|
51
|
+
:content="$t('message.udp.continuousAddition')"
|
|
52
|
+
style="margin-right: 8px"
|
|
53
|
+
/>
|
|
54
|
+
<ut-button
|
|
55
|
+
v-if="attrs?.showCancleButton !== false"
|
|
56
|
+
status="warning"
|
|
57
|
+
:content="modalOptions?.cancelButtonText || 'cancel'"
|
|
58
|
+
icon="ri-close-line"
|
|
59
|
+
@tap="onClose"
|
|
60
|
+
/>
|
|
61
|
+
<slot />
|
|
62
|
+
<ut-button
|
|
63
|
+
v-if="attrs?.showConfirmButton !== false"
|
|
64
|
+
status="u-cyan"
|
|
65
|
+
:content="modalOptions?.confirmButtonText || 'confirm'"
|
|
66
|
+
icon="ri-save-3-line"
|
|
67
|
+
@tap="onConfirm"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
70
|
+
</vxe-modal>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script lang="ts">
|
|
75
|
+
export default {
|
|
76
|
+
name: 'UtModalForm'
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
79
|
+
<script lang="ts" setup>
|
|
80
|
+
import { onBeforeMount, ref, computed, getCurrentInstance, useAttrs } from 'vue';
|
|
81
|
+
import { useI18n } from 'vue-i18n';
|
|
82
|
+
import { getAttrs } from '../utils';
|
|
83
|
+
import to from 'await-to-js';
|
|
84
|
+
import { formatRules, formatItems, successMessage } from '@utogether/utils';
|
|
85
|
+
import { clone } from 'xe-utils';
|
|
86
|
+
|
|
87
|
+
export interface IProps {
|
|
88
|
+
record: IRecord; // 数据对象
|
|
89
|
+
formOptions?: IRecord;
|
|
90
|
+
modalOptions?: IRecord;
|
|
91
|
+
items: Array<IFormItemProps>; // form item
|
|
92
|
+
url?: string; // 服务路径
|
|
93
|
+
method?: string; // 请求方式
|
|
94
|
+
title?: string; // 标题
|
|
95
|
+
titleWidth?: string | number; // 标题宽度
|
|
96
|
+
dataStatus?: string; // 状态
|
|
97
|
+
width?: number;
|
|
98
|
+
beforeHideMethod?: () => Promise<boolean>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const props = withDefaults(defineProps<IProps>(), {
|
|
102
|
+
record: (): IRecord => {
|
|
103
|
+
return {};
|
|
104
|
+
},
|
|
105
|
+
formOptions: (): IRecord => {
|
|
106
|
+
return {};
|
|
107
|
+
},
|
|
108
|
+
modalOptions: (): IRecord => {
|
|
109
|
+
return {};
|
|
110
|
+
},
|
|
111
|
+
items: () => [],
|
|
112
|
+
title: '数据记录',
|
|
113
|
+
width: 420,
|
|
114
|
+
titleWidth: 100,
|
|
115
|
+
dataStatus: 'detail',
|
|
116
|
+
url: '',
|
|
117
|
+
method: 'post'
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const attrs: IRecord = getAttrs(useAttrs());
|
|
121
|
+
|
|
122
|
+
const loading = ref(false);
|
|
123
|
+
|
|
124
|
+
const isContinue = ref(false);
|
|
125
|
+
// 保存初始record,用于连续添加时重置
|
|
126
|
+
const defaultRecord = clone(props.record, true);
|
|
127
|
+
|
|
128
|
+
const data = ref<IRecord>(props.record);
|
|
129
|
+
|
|
130
|
+
const instance = getCurrentInstance()!;
|
|
131
|
+
|
|
132
|
+
const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @description: 根据items 获取必填选
|
|
136
|
+
*/
|
|
137
|
+
const rules = computed(() => {
|
|
138
|
+
if (!props.items.length) return {};
|
|
139
|
+
return formatRules(props.items, t);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const { t } = useI18n();
|
|
143
|
+
|
|
144
|
+
const formItems = computed(() => {
|
|
145
|
+
if (!props.items.length) return props.items;
|
|
146
|
+
return formatItems(clone(props.items, true), props.dataStatus, 24);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const modalHeight = computed(() => {
|
|
150
|
+
const maxHeight = Math.floor(window.innerHeight * 0.8);
|
|
151
|
+
let height = 0;
|
|
152
|
+
let offset = props.dataStatus !== 'detail' ? 100 : 60;
|
|
153
|
+
if (props.items.length === 1) {
|
|
154
|
+
// 仅有一项时,增加8px的边距
|
|
155
|
+
offset += 8;
|
|
156
|
+
}
|
|
157
|
+
console.log('modalHeight', maxHeight);
|
|
158
|
+
let contentHeight = 0;
|
|
159
|
+
let currentRowSpan = 0;
|
|
160
|
+
let currentRowHeight = 0;
|
|
161
|
+
|
|
162
|
+
const flattenItems = (items: any[]): any[] => {
|
|
163
|
+
const result: any[] = [];
|
|
164
|
+
items.forEach(item => {
|
|
165
|
+
result.push(item);
|
|
166
|
+
if (item.children?.length) {
|
|
167
|
+
result.push(...item.children);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return result;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const flatItems = flattenItems(props.items);
|
|
174
|
+
console.log('flatItems', flatItems);
|
|
175
|
+
flatItems
|
|
176
|
+
.filter(item => item.visible !== false)
|
|
177
|
+
.forEach((item, index) => {
|
|
178
|
+
const span = item.span ?? 24;
|
|
179
|
+
let itemHeight = item.itemRender?.name === 'VxeTextarea' ? 75 : item.vertical || item.titleBold ? 30 : 45;
|
|
180
|
+
if (item.visibleMethod) {
|
|
181
|
+
if (!item.visibleMethod({ data: props.record })) {
|
|
182
|
+
itemHeight = 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (index === 0) {
|
|
186
|
+
currentRowSpan = span;
|
|
187
|
+
currentRowHeight = itemHeight;
|
|
188
|
+
} else if (currentRowSpan + span <= 24) {
|
|
189
|
+
currentRowSpan += span;
|
|
190
|
+
currentRowHeight = Math.max(currentRowHeight, itemHeight);
|
|
191
|
+
} else {
|
|
192
|
+
contentHeight += currentRowHeight;
|
|
193
|
+
currentRowSpan = span;
|
|
194
|
+
currentRowHeight = itemHeight;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const nextSpan = flatItems[index + 1]?.span ?? 24;
|
|
198
|
+
if (nextSpan + currentRowSpan > 24) {
|
|
199
|
+
contentHeight += currentRowHeight;
|
|
200
|
+
currentRowSpan = 0;
|
|
201
|
+
currentRowHeight = 0;
|
|
202
|
+
console.log(index, '-contentHeight=', contentHeight, itemHeight);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
// contentHeight += currentRowHeight;
|
|
206
|
+
|
|
207
|
+
height = contentHeight + offset;
|
|
208
|
+
height = maxHeight < height ? maxHeight : height;
|
|
209
|
+
// console.log('height', height);
|
|
210
|
+
// console.log('maxHeight', maxHeight);
|
|
211
|
+
return height;
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
const showModal = ref(false);
|
|
215
|
+
|
|
216
|
+
const xForm = ref(null);
|
|
217
|
+
/**
|
|
218
|
+
* @description: 弹框确认
|
|
219
|
+
*/
|
|
220
|
+
const onConfirm = () => {
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
xForm.value.validate(async (valid: boolean) => {
|
|
223
|
+
if (!valid) {
|
|
224
|
+
const { url, method } = props;
|
|
225
|
+
if (url) {
|
|
226
|
+
showLoading();
|
|
227
|
+
const body = attrs?.dataProcessMethod ? attrs?.dataProcessMethod(data.value) : data.value;
|
|
228
|
+
const [err, res] = await to(serviceApi[method](url, body));
|
|
229
|
+
hiddenLoading();
|
|
230
|
+
if (!err) {
|
|
231
|
+
let beforeHideMethodResult = true;
|
|
232
|
+
if (props.beforeHideMethod) {
|
|
233
|
+
beforeHideMethodResult = await props.beforeHideMethod();
|
|
234
|
+
}
|
|
235
|
+
successMessage();
|
|
236
|
+
emit('confirm', res);
|
|
237
|
+
if (isContinue.value) {
|
|
238
|
+
// 连续添加:重置表单为默认值,不关闭弹框
|
|
239
|
+
resetRecord();
|
|
240
|
+
} else if (beforeHideMethodResult) {
|
|
241
|
+
onClose();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
} else {
|
|
245
|
+
emit('confirm');
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// const onBeforeHideMethod = () => {
|
|
252
|
+
// console.log('onBeforeHideMethod');
|
|
253
|
+
// return new Promise((resolve, reject) => {
|
|
254
|
+
// reject(new Error());
|
|
255
|
+
// });
|
|
256
|
+
// };
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @description: 重置表单数据为初始值
|
|
260
|
+
*/
|
|
261
|
+
const resetRecord = () => {
|
|
262
|
+
data.value = clone(defaultRecord, true);
|
|
263
|
+
xForm.value?.clearValidate();
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @description: 显示加载框
|
|
268
|
+
*/
|
|
269
|
+
const showLoading = () => {
|
|
270
|
+
loading.value = true;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @description: 关闭加载框
|
|
275
|
+
*/
|
|
276
|
+
const hiddenLoading = () => {
|
|
277
|
+
loading.value = false;
|
|
278
|
+
};
|
|
279
|
+
const validate = (cb: Function) => {
|
|
280
|
+
// @ts-ignore
|
|
281
|
+
xForm.value.validate(cb);
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* @deprecated 已过期,使用validate
|
|
285
|
+
*/
|
|
286
|
+
const validateForm = (cb: Function) => {
|
|
287
|
+
// @ts-ignore
|
|
288
|
+
xForm.value.validate(cb);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @description: 关闭弹框
|
|
293
|
+
*/
|
|
294
|
+
const onClose = () => {
|
|
295
|
+
showModal.value = false;
|
|
296
|
+
emit('close');
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* @description: 打开弹框
|
|
300
|
+
*/
|
|
301
|
+
const openModal = () => {
|
|
302
|
+
showModal.value = true;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
const closeModal = () => {
|
|
306
|
+
onClose();
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const emit = defineEmits<{
|
|
310
|
+
(e: 'close'): void;
|
|
311
|
+
(e: 'confirm', record?: any): void;
|
|
312
|
+
}>();
|
|
313
|
+
|
|
314
|
+
defineExpose({
|
|
315
|
+
showLoading,
|
|
316
|
+
hiddenLoading,
|
|
317
|
+
openModal,
|
|
318
|
+
closeModal,
|
|
319
|
+
validate,
|
|
320
|
+
validateForm
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
onBeforeMount(() => {
|
|
324
|
+
openModal();
|
|
325
|
+
});
|
|
326
|
+
</script>
|