@utogether/udp-core 1.0.1-beta.16 → 1.0.1-beta.17

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.
Files changed (122) hide show
  1. package/build/plugins.ts +39 -39
  2. package/dist/{403-RBzulrcG.js → 403-C3cfjZIT.js} +1 -1
  3. package/dist/{404-DX-dU_6C.js → 404-Bg3j7QIo.js} +1 -1
  4. package/dist/{500-BCTk0__d.js → 500-CMT7Zyy7.js} +1 -1
  5. package/dist/{AuthorityInfo-BADTOenq.js → AuthorityInfo-B1mvqs4x.js} +1 -1
  6. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-Cv46yAx_.js → AuthorityInfo.vue_vue_type_style_index_0_lang-DwoW7QWO.js} +1 -1
  7. package/dist/{Company-B-61KrWd.js → Company-qTguidK8.js} +3 -3
  8. package/dist/{CompanyPanel-CawSrEff.js → CompanyPanel-BBC-o-k3.js} +8 -8
  9. package/dist/{Department-CrzJPtvP.js → Department-C3mKZOnK.js} +3 -3
  10. package/dist/{DepartmentPanel-DYuL8H-j.js → DepartmentPanel-CNdpOHBT.js} +3 -3
  11. package/dist/{DesignPanel-DEAv6V68.js → DesignPanel-D9jrRCoG.js} +1 -1
  12. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-BsnXZ2td.js → DesignPanel.vue_vue_type_style_index_0_lang-A-Aj1Hl0.js} +2 -2
  13. package/dist/{DictView-BuO-2b-c.js → DictView-CgdVkSiP.js} +1 -1
  14. package/dist/{InvOrganization-CBgKBJAn.js → InvOrganization-RE7s3vBq.js} +1 -1
  15. package/dist/{Org-BaQw2r-o.js → Org-wXDGvTrS.js} +1 -1
  16. package/dist/{Preview-DvCrmKNk.js → Preview-Pvt1__BV.js} +1 -1
  17. package/dist/{ReportDefine-DyhWz0as.js → ReportDefine-xEQsgFyv.js} +1 -1
  18. package/dist/{ReportDesign-DgZ2f2zv.js → ReportDesign-jOSuEFH9.js} +2 -2
  19. package/dist/{ReportQuery-DTZYbCDi.js → ReportQuery-DxEmmGiN.js} +1 -1
  20. package/dist/{ReportQueryFrom-B-vtJegP.js → ReportQueryFrom-CFlxfS5M.js} +1 -1
  21. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-D6izgxph.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-iHpiYz8f.js} +1 -1
  22. package/dist/{ReportTemplate-DA1ZqKGf.js → ReportTemplate-Dtz3aet7.js} +1 -1
  23. package/dist/{Role-mbqoav5t.js → Role-B_NsHIyE.js} +3 -3
  24. package/dist/{RoleAssign-ltEJIEcr.js → RoleAssign-C9wm4zq4.js} +8 -8
  25. package/dist/{RolePanel-u90v9eS0.js → RolePanel-BlHidBR0.js} +1 -1
  26. package/dist/{RolePanel-1g1a-G8D.js → RolePanel-DWM9mfNs.js} +1 -1
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-D9YxpGnt.js → RolePanel.vue_vue_type_script_setup_true_lang-Cn4RRzXm.js} +1 -1
  28. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-LC4Egk-Q.js → RolePanel.vue_vue_type_script_setup_true_lang-DVQ9aqb1.js} +3 -3
  29. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-DZ3W1epK.js → ScrollPanel.vue_vue_type_style_index_0_lang-CCm-_i8O.js} +1 -1
  30. package/dist/{Staff-CJ2GgCL3.js → Staff-BfDc61QS.js} +3 -3
  31. package/dist/{StaffInfo-3KkodDCK.js → StaffInfo-BaJFo4mg.js} +1 -1
  32. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-CW-isIxJ.js → StaffInfo.vue_vue_type_script_setup_true_lang-Bwj4x1wu.js} +1 -1
  33. package/dist/{StaffPanel-DoXPSoY5.js → StaffPanel-B6I2ZS6A.js} +1 -1
  34. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-DvhGnOMZ.js → StaffPanel.vue_vue_type_script_setup_true_lang-vbyS4w3V.js} +2 -2
  35. package/dist/{SysUser-BuIZhMPh.js → SysUser-B_r9LYc5.js} +2 -2
  36. package/dist/{SysUserPanel-t1GJcJGM.js → SysUserPanel-C4ajcHPV.js} +1 -1
  37. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-CDDkFLlN.js → SysUserPanel.vue_vue_type_script_setup_true_lang-8Q0VvC9B.js} +43 -39
  38. package/dist/{SystemMenu-DuLEL6_l.js → SystemMenu-CyPG23uP.js} +2 -2
  39. package/dist/{UserInfo-WWby4lts.js → UserInfo-BkoGt4ib.js} +1 -1
  40. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-B06ZSrJV.js → UserInfo.vue_vue_type_style_index_0_lang-DrzF1YYG.js} +1 -1
  41. package/dist/{childView-B0-EAoAi.js → childView-9vEO8ymO.js} +1 -1
  42. package/dist/{childView-IYY4L8VK.js → childView-Dh0NyiQe.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-CjF8nZuj.js → childView.vue_vue_type_style_index_0_lang-BOeoZuAK.js} +2 -2
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-B56v6yK7.js → childView.vue_vue_type_style_index_0_lang-CMOjfXBX.js} +1 -1
  45. package/dist/{code-rule-DDLdi3pP.js → code-rule-C7jI_1gJ.js} +1 -1
  46. package/dist/core.es.js +1 -1
  47. package/dist/{cron-task-p3-AFN1w.js → cron-task-Dg9DJXvv.js} +1 -1
  48. package/dist/{frameView-B_WAZErD.js → frameView-CeR-_hjB.js} +1 -1
  49. package/dist/{index-24fnvUBy.js → index-Bb7gIEvu.js} +611 -569
  50. package/dist/{layoutView-CoEp2afn.js → layoutView-wsLHrEeX.js} +1340 -1337
  51. package/dist/{login-DP0oP70W.js → login-CluzzdqH.js} +2 -2
  52. package/dist/{lov-view-BDoZRK-v.js → lov-view-BvQCvwbW.js} +2 -2
  53. package/dist/{menuInfo-5Xls76qB.js → menuInfo-B8RLelIC.js} +1 -1
  54. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-BfZczW9a.js → menuInfo.vue_vue_type_style_index_0_lang-DvkapEZr.js} +1 -1
  55. package/dist/{pda-app-DxGYn4G7.js → pda-app-D3LNmD9a.js} +2 -2
  56. package/dist/{resource-BnYWe_-Q.js → resource-D8JA_03-.js} +1 -1
  57. package/dist/{su-welcome-B2rNhhDH.js → su-welcome-BjxeEKSo.js} +1 -1
  58. package/dist/{sys-config-Bb4WkxZK.js → sys-config-sbeLk9bP.js} +1 -1
  59. package/dist/udp-core.css +1 -9
  60. package/index.ts +48 -48
  61. package/package.json +1 -1
  62. package/src/App.vue +65 -65
  63. package/src/components/SuCharts/src/UserInfo.vue +78 -78
  64. package/src/components/SuScrollTree/ScrollPanel.vue +170 -175
  65. package/src/components/udp/{grid.vue → grid/index.vue} +27 -24
  66. package/src/components/udp/index.ts +2 -9
  67. package/src/components/udp/utils.ts +60 -107
  68. package/src/layout/components/lay-navbar/index.vue +239 -239
  69. package/src/layout/components/lay-panel/index.vue +150 -150
  70. package/src/layout/components/lay-search/index.vue +25 -25
  71. package/src/layout/components/lay-select-org/index.vue +64 -64
  72. package/src/layout/components/lay-sidebar/horizontal.vue +190 -190
  73. package/src/layout/components/lay-sidebar/mixNav.vue +260 -260
  74. package/src/layout/components/lay-sidebar/sidebar-logo.vue +92 -92
  75. package/src/layout/components/lay-tag/index.vue +20 -48
  76. package/src/layout/hooks/useNav.ts +173 -173
  77. package/src/layout/hooks/useTag.ts +5 -3
  78. package/src/layout/types.ts +3 -2
  79. package/src/main.ts +9 -6
  80. package/src/plugins/i18n/en.ts +302 -302
  81. package/src/plugins/i18n/zh.ts +356 -354
  82. package/src/plugins/vxe-table/index.ts +116 -53
  83. package/src/plugins/vxe-table/render.tsx +956 -956
  84. package/src/router/index.ts +186 -177
  85. package/src/router/modules/remaining.ts +58 -58
  86. package/src/router/utils.ts +393 -377
  87. package/src/store/modules/app.ts +1 -3
  88. package/src/store/modules/multiTags.ts +110 -109
  89. package/src/store/modules/permission.ts +113 -100
  90. package/src/style/button.scss +85 -85
  91. package/src/style/login.css +336 -336
  92. package/src/style/vxetable.scss +13 -3
  93. package/src/views/organization/company/CompanyPanel.vue +259 -259
  94. package/src/views/organization/department/DepartmentPanel.vue +269 -283
  95. package/src/views/system/menu/SystemMenu.vue +183 -183
  96. package/src/views/system/menu/menuInfo.vue +363 -363
  97. package/src/views/system/role/UserInfo.vue +195 -195
  98. package/src/views/system/role-assign/RoleAssign.vue +57 -57
  99. package/src/views/system/role-assign/RolePanel.vue +139 -139
  100. package/src/views/system/sys/sys-config.vue +336 -336
  101. package/src/views/system/sysUser/SysUserPanel.vue +279 -278
  102. package/src/views/uapp/pda/pda-app.vue +208 -208
  103. package/src/views/udev/dict/DictView.vue +118 -118
  104. package/src/views/udev/dict/childView.vue +1 -1
  105. package/src/views/udev/lov/lov-view.vue +91 -91
  106. package/src/views/ulogin/login.vue +323 -323
  107. package/src/views/upms/interface/log-out.vue +101 -101
  108. package/src/views/urpt/design/DesignPanel.vue +507 -507
  109. package/types/global.d.ts +230 -230
  110. package/src/components/udp/count-down.vue +0 -536
  111. package/src/components/udp/flip-down/FlipCard/flip-card.vue +0 -251
  112. package/src/components/udp/flip-down/FlipCard/interfaces.ts +0 -4
  113. package/src/components/udp/flip-down/FlipClock/flip-clock.vue +0 -113
  114. package/src/components/udp/form-upload.vue +0 -482
  115. package/src/components/udp/form.vue +0 -112
  116. package/src/components/udp/lov.vue +0 -388
  117. package/src/components/udp/modal-form.vue +0 -190
  118. package/src/components/udp/modal-grid.vue +0 -298
  119. package/src/components/udp/upload.vue +0 -423
  120. package/src/utils/udp/http/index.ts +0 -294
  121. package/src/utils/udp/http/types.d.ts +0 -49
  122. package/src/utils/udp/useRender.ts +0 -431
@@ -1,388 +0,0 @@
1
- <template>
2
- <div class="ut-lov-wrapper">
3
- <vxe-modal
4
- v-if="mode === 'vxe'"
5
- v-model="showLovModal"
6
- :width="modalWidth"
7
- :destroy-on-close="false"
8
- :title="lovTitle"
9
- :transfer="transfer"
10
- height="66%"
11
- resize
12
- esc-closable
13
- show-footer
14
- :class-name="className"
15
- :before-hide-method="beforeHideMethod"
16
- >
17
- <template #default>
18
- <vxe-grid ref="xgrid" v-bind="data" resizable @cell-dblclick="onCellClick" />
19
- </template>
20
- <template #footer>
21
- <vxe-button :content="$t('message.btn.cancel')" icon="ri-close-line" status="warning" @click="onClose" />
22
- <vxe-button :content="$t('message.btn.confirm')" icon="ri-save-3-line" status="primary" @click="onConfirm" />
23
- </template>
24
- </vxe-modal>
25
- <el-dialog
26
- v-else
27
- v-model="showLovModal"
28
- :width="modalWidth"
29
- :show-close="false"
30
- :title="lovTitle"
31
- :append-to-body="transfer"
32
- draggable
33
- destroy-on-close
34
- close-on-press-escape
35
- >
36
- <template #default>
37
- <div style="height: 360px">
38
- <vxe-grid ref="xgrid" v-bind="data" resizable @cell-dblclick="onCellClick" />
39
- </div>
40
- </template>
41
- <template #footer>
42
- <vxe-button :content="$t('message.btn.cancel')" icon="ri-close-line" status="warning" @click="onClose" />
43
- <vxe-button :content="$t('message.btn.confirm')" icon="ri-save-3-line" status="primary" @click="onConfirm" />
44
- </template>
45
- </el-dialog>
46
- <vxe-input
47
- v-model="record[displayName || field]"
48
- :clearable="!disabled && clearable"
49
- :disabled="disabled"
50
- :readonly="readonly"
51
- :placeholder="placeholder"
52
- style="width: 100%"
53
- type="search"
54
- size="mini"
55
- @search-click="onSeach"
56
- @clear="onClear"
57
- />
58
- </div>
59
- </template>
60
-
61
- <script lang="ts">
62
- export default {
63
- name: 'UtLov'
64
- };
65
- </script>
66
-
67
- <script setup lang="ts">
68
- // @ts-nocheck
69
- import { ref, reactive, getCurrentInstance } from 'vue';
70
- import { VxeGridProps } from 'vxe-table';
71
- import to from 'await-to-js';
72
- import { clone, toDateString, isEmpty } from 'xe-utils';
73
- import { useRender, cookies, delay } from '@utogether/utils';
74
- // import type { IFormItemProps, IRecord } from '../../types';
75
-
76
- export interface IProps {
77
- record: object;
78
- defaultParams?: object;
79
- code: string;
80
- field: string;
81
- displayName?: string;
82
- placeholder?: string;
83
- mode?: string;
84
- clearable?: boolean;
85
- multiple?: boolean;
86
- disabled?: boolean;
87
- autoLoad?: boolean;
88
- readonly?: boolean;
89
- transfer?: boolean;
90
- }
91
- const props = withDefaults(defineProps<IProps>(), {
92
- record: () => {
93
- return {};
94
- },
95
- defaultParams: () => {
96
- return {};
97
- },
98
- mode: 'vxe',
99
- placeholder: '请选择',
100
- clearable: true,
101
- multiple: false,
102
- disabled: false,
103
- readonly: true,
104
- autoLoad: true
105
- });
106
-
107
- const instance = getCurrentInstance()!;
108
- const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
109
-
110
- const minWidth = 600;
111
- const showLovModal = ref(false);
112
- const modalWidth = ref(minWidth);
113
- const lovTitle = ref('');
114
- const className = ref('vxe-table--ignore-clear');
115
-
116
- const data = reactive<VxeGridProps>({
117
- loading: false,
118
- border: true,
119
- pagerConfig: {},
120
- formConfig: { titleWidth: 90, titleAlign: 'right', items: [] },
121
- height: 'auto',
122
- editConfig: {},
123
- rowConfig: { keyField: '_X_ROW_KEY' },
124
- proxyConfig: {
125
- form: true, // 查询是需要启用表单代理
126
- autoLoad: false,
127
- response: {
128
- result: 'list',
129
- total: 'total'
130
- },
131
- ajax: {
132
- query: ({ page, form }) => {
133
- const commonParam = cookies.get('kCookies_param') ? JSON.parse(cookies.get('kCookies_param')) : {};
134
- let queryParams = Object.assign({}, form, commonParam, props.defaultParams);
135
- queryParams.pageNum = page?.currentPage || 1;
136
- queryParams.pageSize = page?.pageSize || 20;
137
- if (!props.readonly) {
138
- const { field, displayName } = props;
139
- // 非只读时,意味着可录入文本,此时查询是需要加上录入的文本内容作为条件
140
- queryParams[displayName || field] = props.record[displayName || field];
141
- }
142
- // console.log(queryParams);
143
- queryParams = formatterParam(queryParams);
144
- if (lovData.lovType !== 'url') {
145
- queryParams.lovCode = props.code;
146
- return serviceApi.get('/upfm/v1/lovViewHeader/listBySql', queryParams);
147
- }
148
- return serviceApi.get(lovData.lovUrl, queryParams);
149
- }
150
- }
151
- },
152
- checkboxConfig: {},
153
- columns: []
154
- });
155
-
156
- // const displayName = ref(null);
157
- let lovData = undefined;
158
- let dataList = [];
159
-
160
- const formatterParam = params => {
161
- const columns = dataList.filter(col => ['date', 'month'].includes(col.fieldType) && col.isSearch);
162
- columns.forEach(col => {
163
- if (col.fieldType === 'date') {
164
- params[col.field] = toDateString(params[col.field], 'yyyy-MM-dd 00:00:00');
165
- } else if (col.fieldType === 'month') {
166
- params[col.field] = toDateString(params[col.field], 'yyyy-MM');
167
- }
168
- });
169
- return params;
170
- };
171
- // 查询字段
172
- const getFormItem = () => {
173
- const items = clone(dataList, true).filter(col => col.isSearch === 'Y');
174
- if (!items.length) return;
175
- // console.log(items);
176
- const isCollapse = items.length > 2;
177
- const forItems: IFormItemProps[] = items
178
- .sort((a, b) => a.seqNo - b.seqNo)
179
- .map((item: IRecord, idx) => {
180
- return {
181
- field: item.colField,
182
- title: item.colTitle,
183
- span: 8,
184
- folding: idx > 1,
185
- itemRender: getItemRender(item)
186
- };
187
- });
188
- searchBtn.collapseNode = isCollapse;
189
- if (isCollapse) {
190
- // 按钮设置为 折叠节点并将搜索按钮插入到第一列的最后
191
- forItems.splice(2, 0, searchBtn);
192
- } else {
193
- forItems.push(searchBtn);
194
- }
195
- data.formConfig.items = forItems;
196
- };
197
- const searchBtn: IFormItemProps = {
198
- span: 8,
199
- align: 'right',
200
- collapseNode: false,
201
- itemRender: {
202
- name: 'VxeButtonGroup',
203
- options: [
204
- {
205
- type: 'submit',
206
- submit: 'submit',
207
- content: 'message.btn.search',
208
- status: 'primary',
209
- icon: 'ri-search-line'
210
- // props: {
211
- // },
212
- },
213
- {
214
- type: 'reset',
215
- name: 'reset',
216
- content: 'message.btn.reset',
217
- status: 'info',
218
- icon: 'ri-refresh-line'
219
- // props: {
220
- // },
221
- }
222
- ]
223
- }
224
- };
225
-
226
- // console.log("useRender", useRender);
227
- const renderHook = useRender();
228
-
229
- const getItemRender = item => {
230
- if (['date', 'month'].includes(item.fieldType)) {
231
- const valueFormat = item.fieldType === 'date' ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM';
232
- return renderHook.renderDate({ type: item.fieldType, valueFormat });
233
- } else if (item.fieldType === 'dictCode') {
234
- return renderHook.renderDict(item.dictCode);
235
- }
236
- return { name: 'VxeInput' };
237
- };
238
-
239
- // 获取columns
240
- const getColumns = () => {
241
- const columns = clone(dataList, true).filter((col: IRecord) => col.isCol === 'Y');
242
- const colWidth = columns.reduce((curv, prev: IRecord) => curv + +prev.colWidth, 65);
243
- modalWidth.value = colWidth < minWidth ? minWidth : colWidth > 900 ? 900 : colWidth;
244
- data.columns = columns
245
- .sort((a, b) => a.seqNo - b.seqNo)
246
- .map(col => {
247
- const fieldType = col.fieldType;
248
- const dictCode = ['formatDict', col.dictCode];
249
- return {
250
- field: col.colField,
251
- title: col.colTitle,
252
- minWidth: col.colWidth,
253
- formatter: fieldType === 'date' ? ['formatDate'] : col.fieldType === 'dictCode' ? dictCode : null
254
- };
255
- });
256
- if (props.multiple) {
257
- data.columns.unshift({ type: 'checkbox', width: 45, align: 'center' });
258
- } else {
259
- data.columns.unshift({ type: 'radio', width: 45, align: 'center' });
260
- }
261
- };
262
-
263
- // 获取grid配置
264
- const xgrid = ref(null);
265
-
266
- const getGridConfig = async () => {
267
- console.log('88888');
268
- data.loading = true;
269
- const url = '/upfm/v1/lovViewHeader/detailByViewCode';
270
- const [err, res]: [Error, any] = await to(serviceApi.get(url, { lovCode: props.code }));
271
- data.loading = false;
272
- if (err) onClose();
273
- lovTitle.value = res?.lovTitle || res.lovName;
274
- dataList = res.lineList;
275
- lovData = res;
276
- props.autoLoad && xgrid.value.commitProxy('query');
277
- getColumns();
278
- getFormItem();
279
- };
280
-
281
- const onSeach = async () => {
282
- if (props.disabled) return;
283
- getGridConfig();
284
- await delay(64);
285
- showLovModal.value = true;
286
- };
287
-
288
- const onClear = () => {
289
- emit('clear', '');
290
- };
291
-
292
- // 双击
293
- const onCellClick = ({ row }) => {
294
- const record = !props.multiple ? row : [row];
295
- emit('change', record, lovData.valueField);
296
- onClose();
297
- };
298
-
299
- const onConfirm = () => {
300
- const grid = xgrid.value;
301
- const record = !props.multiple ? grid.getRadioRecord() : grid.getCheckboxRecords();
302
- !isEmpty(record) && emit('change', record, lovData.valueField);
303
- onClose();
304
- };
305
- /** 输入框显示值 */
306
- // const setDisplayLabel = row => {
307
- // let value = row[lovData.valueField];
308
- // if (props.multiple) {
309
- // value = row.map(m => m[lovData.valueField]).join();
310
- // }
311
- // Object.assign(props.record, { [props.field]: value });
312
- // };
313
-
314
- // 关闭Lov
315
- const onClose = () => {
316
- dataList.length = 0;
317
- showLovModal.value = false;
318
- };
319
-
320
- const beforeHideMethod = ({ type }) => {
321
- // console.log("cccc", type);
322
- };
323
-
324
- const emit = defineEmits<{
325
- (e: 'clear', str: ''): void;
326
- (e: 'change', record: any, field: string): void;
327
- }>();
328
- </script>
329
-
330
- <style lang="scss">
331
- .ut-lov-wrapper {
332
- .vxe-pager .vxe-pager--sizes {
333
- display: inline-block;
334
- width: 7em !important;
335
- text-align: center;
336
- cursor: pointer;
337
- }
338
-
339
- .el-dialog__header {
340
- padding: 0.6em 4.6em 0.6em 1em;
341
- margin-right: 0;
342
- background-color: #f8f8f8;
343
- border-bottom: 1px solid #ebeef5;
344
-
345
- .el-dialog__title {
346
- font-size: 1.1em;
347
- font-weight: 600;
348
- color: #000 !important;
349
- }
350
- }
351
-
352
- .el-dialog__body {
353
- padding: 5px 6px;
354
- }
355
-
356
- .el-dialog__footer {
357
- padding: 5px 6px;
358
- }
359
-
360
- .vxe-grid {
361
- .vxe-form {
362
- .vxe-form--item {
363
- .vxe-form--item-title-label {
364
- font-weight: 500 !important;
365
- color: #000 !important;
366
- }
367
-
368
- .vxe-input--date-picker-suffix {
369
- color: #000 !important;
370
- }
371
- }
372
- }
373
-
374
- .vxe-cell {
375
- .vxe-cell--label {
376
- font-weight: 500 !important;
377
- color: #000 !important;
378
- }
379
- }
380
- }
381
-
382
- .vxe-input {
383
- i[class*='vxe-icon-'] {
384
- color: #6a6a6a !important;
385
- }
386
- }
387
- }
388
- </style>
@@ -1,190 +0,0 @@
1
- <!--
2
- * @Author: wei.li
3
- * @Date: 2021-11-29 21:02:43
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-07-14 17:38:19
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="height"
16
- :loading="loading"
17
- :show-footer="dataStatus !== 'detail'"
18
- v-bind="modalAttrs"
19
- min-width="240"
20
- min-height="300"
21
- destroy-on-close
22
- resize
23
- @close="onClose"
24
- >
25
- <template #default>
26
- <vxe-form
27
- ref="xForm"
28
- :data="record"
29
- :items="formItems"
30
- :rules="rules"
31
- title-align="right"
32
- :title-width="formAttrs.titleWidth || 90"
33
- v-bind="formAttrs"
34
- />
35
- </template>
36
- <template #footer>
37
- <vxe-checkbox
38
- v-if="!url && dataStatus === 'add'"
39
- v-model="continuous"
40
- content="连续添加"
41
- unchecked-value="0"
42
- checked-value="1"
43
- style="margin-right: 12px"
44
- />
45
- <ut-button status="warning" content="cancel" icon="ri-close-line" @tap="onClose" />
46
- <ut-button status="u-cyan" content="confirm" icon="ri-save-3-line" @tap="onConfirm" />
47
- </template>
48
- </vxe-modal>
49
- </div>
50
- </template>
51
-
52
- <script lang="ts">
53
- export default {
54
- name: 'UtModalForm'
55
- };
56
- </script>
57
- <script lang="ts" setup>
58
- import { onBeforeMount, ref, computed, getCurrentInstance, useAttrs } from 'vue';
59
- import { useI18n } from 'vue-i18n';
60
- import { getAttrs } from './utils';
61
- import to from 'await-to-js';
62
- import { formatRules, successMessage, formatItems } from '@utogether/utils';
63
- import { clone } from 'xe-utils';
64
-
65
- // import type { IRecord, IFormItemProps } from '../../types';
66
-
67
- export interface IProps {
68
- record: IRecord; // 数据对象
69
- formAttrs?: IRecord;
70
- modalAttrs?: IRecord;
71
- items: Array<IFormItemProps>; // form item
72
- url?: string; // 服务路径
73
- method?: string; // 请求方式
74
- title?: string; // 标题
75
- dataStatus?: string; // 状态
76
- width?: number;
77
- height?: number;
78
- }
79
-
80
- const props = withDefaults(defineProps<IProps>(), {
81
- record: (): IRecord => {
82
- return {};
83
- },
84
- formAttrs: (): IRecord => {
85
- return {};
86
- },
87
- items: () => [],
88
- title: '数据记录',
89
- width: 420,
90
- height: 360,
91
- dataStatus: 'detail',
92
- url: '',
93
- method: 'post'
94
- });
95
-
96
- const attrs: IRecord = getAttrs(useAttrs());
97
-
98
- const continuous = ref('0');
99
- const loading = ref(false);
100
- const instance = getCurrentInstance()!;
101
-
102
- const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
103
-
104
- /**
105
- * @description: 根据items 获取必填选
106
- */
107
- const rules = computed(() => {
108
- if (!props.items.length) return {};
109
- return formatRules(props.items, t);
110
- });
111
-
112
- const formItems = computed(() => {
113
- if (!props.items.length) return props.items;
114
- return formatItems(clone(props.items, true), props.dataStatus);
115
- });
116
-
117
- const { t } = useI18n();
118
- const showModal = ref(false);
119
-
120
- const xForm = ref(null);
121
- /**
122
- * @description: 弹框确认
123
- */
124
- const onConfirm = () => {
125
- // @ts-ignore
126
- xForm.value.validate(async (valid: boolean) => {
127
- if (!valid) {
128
- const { record, url, method } = props;
129
- if (url) {
130
- showLoading();
131
- const body = attrs?.dataProcessMethod ? attrs?.dataProcessMethod(record) : record;
132
- if (url) {
133
- const [err, data] = await to(serviceApi[method](url, body));
134
- if (!err) {
135
- successMessage();
136
- emit('confirm', data);
137
- }
138
- }
139
- hiddenLoading();
140
- onClose();
141
- } else {
142
- emit('confirm');
143
- }
144
- }
145
- });
146
- };
147
-
148
- /**
149
- * @description: 显示加载框
150
- */
151
- const showLoading = () => {
152
- loading.value = true;
153
- };
154
-
155
- /**
156
- * @description: 关闭加载框
157
- */
158
- const hiddenLoading = () => {
159
- loading.value = false;
160
- };
161
- const validateForm = (cb: Function) => {
162
- // @ts-ignore
163
- xForm.value.validate(cb);
164
- };
165
-
166
- /**
167
- * @description: 关闭弹框
168
- */
169
- const onClose = () => {
170
- showModal.value = false;
171
- emit('close');
172
- };
173
- /**
174
- * @description: 打开弹框
175
- */
176
- const openModal = () => {
177
- showModal.value = true;
178
- };
179
-
180
- const emit = defineEmits<{
181
- (e: 'close'): void;
182
- (e: 'confirm', record?: any): void;
183
- }>();
184
-
185
- defineExpose({ showLoading, hiddenLoading, openModal, validateForm });
186
-
187
- onBeforeMount(() => {
188
- openModal();
189
- });
190
- </script>