@utogether/udp-core 1.0.1-beta.1 → 1.0.1-beta.10

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 (140) hide show
  1. package/build/plugins.ts +39 -32
  2. package/dist/{403-Dp617CWX.js → 403-Ctxjn4q8.js} +1 -1
  3. package/dist/{404-Cz_Axb6Y.js → 404-W5yzyiZ9.js} +1 -1
  4. package/dist/{500-BGCtRNse.js → 500-DXuGEOm4.js} +1 -1
  5. package/dist/{AuthorityInfo-DGGfm7IS.js → AuthorityInfo-C2tflCt8.js} +1 -1
  6. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-SVgy3HX7.js +100 -0
  7. package/dist/{Company-IV3GTnzY.js → Company-PLez5GoH.js} +3 -3
  8. package/dist/{CompanyPanel-qV-_VtoL.js → CompanyPanel-CIGaQooL.js} +16 -16
  9. package/dist/{Department-B3W-OxW8.js → Department-B9wLsXFm.js} +3 -3
  10. package/dist/{DepartmentPanel-Cw3OWxE7.js → DepartmentPanel-DSM4lTaz.js} +1 -1
  11. package/dist/{DesignPanel-BFxR2fHJ.js → DesignPanel-B6a9wW_A.js} +1 -1
  12. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-DljbeFba.js → DesignPanel.vue_vue_type_style_index_0_lang-DtHfoDQk.js} +24 -26
  13. package/dist/DictView-DhFbQxdJ.js +110 -0
  14. package/dist/InvOrganization-D90AbR3b.js +66 -0
  15. package/dist/Org-DxBkYabD.js +39 -0
  16. package/dist/{Preview-BlDMmpdR.js → Preview-BFtRpBxw.js} +1 -1
  17. package/dist/{ReportDefine-Cub_85LA.js → ReportDefine-BIa2QryC.js} +1 -1
  18. package/dist/{ReportDesign-hFhq5UVE.js → ReportDesign-CnyjI-WD.js} +43 -43
  19. package/dist/{ReportQuery-ChkWEyxT.js → ReportQuery-BiK7yEhV.js} +1 -1
  20. package/dist/{ReportQueryFrom-KVyD_8Dj.js → ReportQueryFrom-C2rqdFTm.js} +1 -1
  21. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-CLNODquq.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-Ba9HLnXQ.js} +1 -1
  22. package/dist/{ReportTemplate-ag9NDvh2.js → ReportTemplate-DdkLscP3.js} +28 -28
  23. package/dist/{Role-_q3lQ8CZ.js → Role-BrsxgK8D.js} +6 -6
  24. package/dist/{RoleAssign-DZb9IRsm.js → RoleAssign-DiqwJqDa.js} +8 -8
  25. package/dist/{RolePanel-CsLsz-Ds.js → RolePanel-BDusGyo7.js} +1 -1
  26. package/dist/{RolePanel-BQb1LlhD.js → RolePanel-Dqx5dI3f.js} +1 -1
  27. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-2Z1q_5uW.js +132 -0
  28. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-BrnRgHEk.js → RolePanel.vue_vue_type_script_setup_true_lang-B5lUnaMI.js} +44 -38
  29. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-CaFKRwXu.js → ScrollPanel.vue_vue_type_style_index_0_lang-vSP23fEq.js} +21 -21
  30. package/dist/{Staff-BSf9Ypbk.js → Staff-Cwi9LQiZ.js} +3 -3
  31. package/dist/{StaffInfo-BNKasyMF.js → StaffInfo-XjVtyaMv.js} +1 -1
  32. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-DDZ7ukd0.js → StaffInfo.vue_vue_type_script_setup_true_lang-wSrAuyet.js} +11 -11
  33. package/dist/{StaffPanel-Bpq0WVlH.js → StaffPanel-C-wYcFdv.js} +1 -1
  34. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-BhiJ0Q-Q.js → StaffPanel.vue_vue_type_script_setup_true_lang-DZNArmnC.js} +2 -2
  35. package/dist/{SysUser-FAABuNti.js → SysUser-O4tvr-Ur.js} +2 -2
  36. package/dist/{SysUserPanel-PxJeOgHm.js → SysUserPanel-B853docZ.js} +1 -1
  37. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-DhiYYC97.js +294 -0
  38. package/dist/{SystemMenu-C-7NAGon.js → SystemMenu-CXR6mrXr.js} +26 -26
  39. package/dist/{UserInfo-ClXKtyGo.js → UserInfo-BkP8pE2a.js} +1 -1
  40. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-8N7P4Hl7.js → UserInfo.vue_vue_type_style_index_0_lang-D4r_umjV.js} +39 -37
  41. package/dist/{childView-C_HmDQNd.js → childView-D0HwbgDT.js} +1 -1
  42. package/dist/{childView-uUlBcTza.js → childView-TRqUkSDC.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-Ckjmw6wJ.js → childView.vue_vue_type_style_index_0_lang-BzISq0Jf.js} +40 -40
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-y0sDvYx5.js → childView.vue_vue_type_style_index_0_lang-DQRgNsJY.js} +1 -1
  45. package/dist/{code-rule-AgCVDKFy.js → code-rule-BV7PQWhK.js} +9 -10
  46. package/dist/core.es.js +14 -11
  47. package/dist/{cron-task-C6FgQxTi.js → cron-task-9ZS9bi7K.js} +1 -1
  48. package/dist/{frameView-BDgISK7N.js → frameView-DE83AN50.js} +1 -1
  49. package/dist/img/l_img.svg +1 -1
  50. package/dist/img/minicolors.png +0 -0
  51. package/dist/img/v_img.svg +1 -1
  52. package/dist/index-DVARtten.js +2623 -0
  53. package/dist/{layoutView-yb3DV2DQ.js → layoutView-D1U-c4By.js} +111 -110
  54. package/dist/{login-log-CvVnyGi3.js → login-log-kqKzKTto.js} +1 -1
  55. package/dist/{login-RRpljbkm.js → login-sPCEiTGT.js} +106 -113
  56. package/dist/{lov-view-C9-rjzZR.js → lov-view-76NcYTYl.js} +2 -2
  57. package/dist/{menuInfo-CzPQyFhp.js → menuInfo-CxjfjFpm.js} +1 -1
  58. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-BumXunCg.js → menuInfo.vue_vue_type_style_index_0_lang-C2qahH3r.js} +100 -97
  59. package/dist/{pda-app-Dvy3U-b6.js → pda-app-BUH16bLj.js} +211 -197
  60. package/dist/{resource-Fy0lFkSV.js → resource-CCuHzoA6.js} +15 -15
  61. package/dist/{su-welcome-DYvSCUST.js → su-welcome-mRArONsd.js} +109 -110
  62. package/dist/{sys-config-DJ1vNQTy.js → sys-config-Cvt05yF6.js} +7 -7
  63. package/dist/udp-core.css +2 -2
  64. package/dist/{utogether-CjmJiHoE.js → utogether-Dm_VBQHR.js} +1 -1
  65. package/index.ts +40 -36
  66. package/package.json +1 -1
  67. package/src/App.vue +65 -70
  68. package/src/api/index.ts +1 -1
  69. package/src/components/SuCharts/src/UserInfo.vue +78 -78
  70. package/src/components/SuScrollTree/ScrollPanel.vue +3 -3
  71. package/src/components/udp/count-down.vue +536 -0
  72. package/src/components/udp/flip-down/FlipCard/flip-card.vue +251 -0
  73. package/src/components/udp/flip-down/FlipCard/interfaces.ts +4 -0
  74. package/src/components/udp/flip-down/FlipClock/flip-clock.vue +113 -0
  75. package/src/components/udp/form-upload.vue +414 -64
  76. package/src/components/udp/form.vue +112 -0
  77. package/src/components/udp/grid.vue +495 -0
  78. package/src/components/udp/index.ts +10 -4
  79. package/src/components/udp/lov.vue +388 -0
  80. package/src/components/udp/modal-form.vue +11 -2
  81. package/src/components/udp/modal-grid.vue +288 -0
  82. package/src/components/udp/upload.vue +423 -0
  83. package/src/components/udp/utils.ts +447 -40
  84. package/src/directives/permission/index.ts +1 -1
  85. package/src/layout/components/lay-navbar/index.vue +1 -1
  86. package/src/layout/components/lay-panel/index.vue +150 -150
  87. package/src/layout/components/lay-search/index.vue +25 -25
  88. package/src/layout/components/lay-sidebar/breadCrumb.vue +1 -1
  89. package/src/layout/components/lay-tag/index.vue +625 -625
  90. package/src/layout/layoutView.vue +215 -215
  91. package/src/main.ts +23 -13
  92. package/src/plugins/i18n/en.ts +302 -289
  93. package/src/plugins/i18n/zh.ts +348 -337
  94. package/src/plugins/vxe-table/index.ts +53 -46
  95. package/src/plugins/vxe-table/render.tsx +956 -817
  96. package/src/router/index.ts +187 -183
  97. package/src/router/modules/remaining.ts +58 -83
  98. package/src/style/button.scss +85 -78
  99. package/src/style/tailwind.css +1 -68
  100. package/src/style/vxetable.scss +44 -11
  101. package/src/utils/authority/index.ts +1 -1
  102. package/src/utils/{http → udp/http}/index.ts +8 -24
  103. package/src/utils/{http → udp/http}/types.d.ts +8 -5
  104. package/src/utils/udp/useRender.ts +17 -6
  105. package/src/views/login/login-view.vue +2 -2
  106. package/src/views/organization/company/CompanyPanel.vue +259 -259
  107. package/src/views/organization/inv-org/InvOrganization.vue +2 -3
  108. package/src/views/organization/org/Org.vue +9 -5
  109. package/src/views/system/menu/SystemMenu.vue +183 -197
  110. package/src/views/system/menu/menuInfo.vue +363 -371
  111. package/src/views/system/role/AuthorityInfo.vue +19 -15
  112. package/src/views/system/role/Role.vue +1 -5
  113. package/src/views/system/role/RolePanel.vue +11 -2
  114. package/src/views/system/role/UserInfo.vue +195 -193
  115. package/src/views/system/role-assign/RoleAssign.vue +57 -57
  116. package/src/views/system/role-assign/RolePanel.vue +139 -136
  117. package/src/views/system/sys/sys-config.vue +1 -1
  118. package/src/views/system/sysUser/SysUserPanel.vue +278 -278
  119. package/src/views/uapp/pda/pda-app.vue +208 -176
  120. package/src/views/udev/dict/DictView.vue +118 -106
  121. package/src/views/udev/dict/childView.vue +7 -7
  122. package/src/views/udev/lov/lov-view.vue +91 -91
  123. package/src/views/ufile/aggregation/File.vue +5 -5
  124. package/src/views/ufile/file/water-mark.vue +14 -14
  125. package/src/views/uhome/su-welcome.vue +3 -3
  126. package/src/views/ulogin/login.vue +14 -9
  127. package/src/views/upms/user/login-log.vue +1 -1
  128. package/src/views/urpt/design/DesignPanel.vue +507 -526
  129. package/src/views/urpt/design/ReportDesign.vue +15 -19
  130. package/src/views/urpt/static-resource/resource.vue +3 -3
  131. package/src/views/urpt/template/ReportTemplate.vue +7 -7
  132. package/types/global.d.ts +2 -1
  133. package/vite.config.ts +6 -2
  134. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-BqccGW7v.js +0 -102
  135. package/dist/DictView-C-i7e4hZ.js +0 -95
  136. package/dist/InvOrganization-cfT6riGU.js +0 -260
  137. package/dist/Org-CA7vTDIF.js +0 -35
  138. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-cmW7zBLu.js +0 -126
  139. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-njefUln5.js +0 -288
  140. package/dist/index-DzOzUkf6.js +0 -3388
@@ -0,0 +1,388 @@
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>
@@ -34,6 +34,14 @@
34
34
  />
35
35
  </template>
36
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
+ />
37
45
  <ut-button status="warning" content="cancel" icon="ri-close-line" @tap="onClose" />
38
46
  <ut-button status="u-cyan" content="confirm" icon="ri-save-3-line" @tap="onConfirm" />
39
47
  </template>
@@ -49,9 +57,9 @@ export default {
49
57
  <script lang="ts" setup>
50
58
  import { onBeforeMount, ref, computed, getCurrentInstance, useAttrs } from 'vue';
51
59
  import { useI18n } from 'vue-i18n';
52
- import { getAttrs, formatItems } from './utils';
60
+ import { getAttrs } from './utils';
53
61
  import to from 'await-to-js';
54
- import { formatRules, successMessage } from '@utogether/utils';
62
+ import { formatRules, successMessage, formatItems } from '@utogether/utils';
55
63
 
56
64
  // import type { IRecord, IFormItemProps } from '../../types';
57
65
 
@@ -86,6 +94,7 @@ const props = withDefaults(defineProps<IProps>(), {
86
94
 
87
95
  const attrs: IRecord = getAttrs(useAttrs());
88
96
 
97
+ const continuous = ref('0');
89
98
  const loading = ref(false);
90
99
  const instance = getCurrentInstance()!;
91
100
 
@@ -0,0 +1,288 @@
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2021-11-24 17:53:49
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-07-22 11:42:46
6
+ * @Description: 共用弹框
7
+ -->
8
+ <template>
9
+ <div>
10
+ <vxe-modal
11
+ v-model="showModal"
12
+ :title="title"
13
+ :width="width"
14
+ :height="height"
15
+ :loading="data.loading"
16
+ :show-footer="showFooter"
17
+ resize
18
+ destroy-on-close
19
+ @close="close"
20
+ >
21
+ <template #default>
22
+ <slot />
23
+ <vxe-grid
24
+ ref="xGrid"
25
+ v-bind="data"
26
+ resizable
27
+ v-on="attrs.events || {}"
28
+ @edit-activated="onEditActived"
29
+ @toolbarButtonClick="toolbarButtonClick"
30
+ @toolbarToolClick="toolbarButtonClick"
31
+ @cell-click="cellClick"
32
+ />
33
+ </template>
34
+ <template #footer>
35
+ <slot name="bottom" />
36
+ <ut-button icon="ri-close-line" status="warning" content="cancel" @tap="close" />
37
+ <ut-button icon="ri-save-3-line" content="confirm" @tap="onConfirm" />
38
+ </template>
39
+ </vxe-modal>
40
+ </div>
41
+ </template>
42
+ <script lang="ts">
43
+ export default {
44
+ name: 'UtModalGrid'
45
+ };
46
+ </script>
47
+ <script lang="ts" setup>
48
+ // @ts-nocheck
49
+ import { onBeforeMount, reactive, ref, toRaw, getCurrentInstance, useAttrs } from 'vue';
50
+ import { useI18n } from 'vue-i18n';
51
+ import { VxeGridProps } from 'vxe-table';
52
+ import { formatGridItems, i18nColums, formatRules, successMessage, warnMessage } from '@utogether/utils';
53
+ import { clone, isFunction, merge } from 'xe-utils';
54
+ import { queryAll, query, del, save, footerSumMethod, getToolBarConfig, onCheckMethod, getAttrs } from './utils';
55
+
56
+ // import type { IRecord, IFormItemProps, ITableColProps } from '../../types';
57
+
58
+ export interface IProps {
59
+ checkMethod?: Function;
60
+ columns: Array<ITableColProps>; // 列表行
61
+ defaultValue?: IRecord;
62
+ defaultParams?: IRecord;
63
+ gridOptions?: IRecord;
64
+ auth?: IRecord;
65
+ url?: string; // 查询服务路径
66
+ submitUrl?: string; // 确认
67
+ checkRowKeys?: Array<string>; // 默认选中列表
68
+ items?: Array<IFormItemProps>; // 查询条件
69
+ title?: string; // 标题
70
+ width?: number | string;
71
+ height?: number;
72
+ editable?: boolean; // 可编辑
73
+ needExport?: boolean; // 是否需要导出
74
+ showFooter?: boolean; // 显示底部按钮
75
+ addChild?: boolean; // 可编辑
76
+ autoClose?: boolean; // 组件自主关闭
77
+ autoLoad?: boolean; // 是否自动加载查询数据
78
+ }
79
+ const attrs: IRecord = getAttrs(useAttrs());
80
+
81
+ const props = withDefaults(defineProps<IProps>(), {
82
+ gridOptions: () => {
83
+ return {};
84
+ },
85
+ items: () => [],
86
+ columns: () => [],
87
+ checkRowKeys: () => [],
88
+ addChild: false,
89
+ editable: true,
90
+ showFooter: false,
91
+ autoLoad: true,
92
+ needExport: true,
93
+ autoClose: true,
94
+ width: '520',
95
+ height: 420,
96
+ title: '数据记录',
97
+ url: '',
98
+ submitUrl: ''
99
+ });
100
+
101
+ const showModal = ref(false);
102
+
103
+ const xGrid = ref(null);
104
+ const instance = getCurrentInstance()!;
105
+
106
+ const hasAuthority = instance.appContext.config.globalProperties.$hasAuthority;
107
+ const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
108
+ const $mode = instance.appContext.config.globalProperties.$mode;
109
+
110
+ const { t } = useI18n();
111
+
112
+ /**
113
+ * @description: colum 统一添加国家化
114
+ */
115
+ const getColumns = () => {
116
+ const col = props.columns.map(m => {
117
+ if (!props.editable) {
118
+ m.editRender = { enabled: false };
119
+ } else if (!m.type && !m.editRender && props.editable && !!m.editable) {
120
+ m.editRender = { name: 'VxeInput' };
121
+ }
122
+ return m;
123
+ });
124
+ return i18nColums(col);
125
+ };
126
+
127
+ const getItems = () => {
128
+ if (!props.items.length) return props.items;
129
+ return formatGridItems(clone(props.items, true));
130
+ };
131
+
132
+ /**
133
+ * @description: 根据items 获取必填选
134
+ */
135
+ const getRules = () => {
136
+ if (!props.columns.length) return {};
137
+ return formatRules(props.columns, t);
138
+ };
139
+
140
+ const data = reactive<VxeGridProps>({
141
+ loading: false,
142
+ border: true,
143
+ pagerConfig: {},
144
+ formConfig: {},
145
+ toolbarConfig: { enabled: false },
146
+ height: 'auto',
147
+ editConfig: {},
148
+ rowConfig: { keyField: '_X_ROW_KEY' },
149
+ editRules: getRules(),
150
+ proxyConfig: {
151
+ form: true, // 查询是需要启用表单代理
152
+ autoLoad: props.autoLoad,
153
+ ajax: {
154
+ queryAll: ({ form }) => queryAll(props, serviceApi, form),
155
+ query: ({ page, form }) => query(props, form, page, serviceApi, $mode),
156
+ delete: ({ body: { removeRecords } }) => del(serviceApi, removeRecords, props),
157
+ save: ({ body }) => Promise.all(save(serviceApi, body, props))
158
+ }
159
+ },
160
+ checkboxConfig: {
161
+ checkMethod: ({ row }) => onCheckMethod(row, props),
162
+ checkRowKeys: props.checkRowKeys
163
+ },
164
+ columns: getColumns()
165
+ });
166
+
167
+ // 确认数据
168
+ const onConfirm = async () => {
169
+ let records = null;
170
+ const type = props.columns[0].type;
171
+ if (type === 'checkbox') {
172
+ records = xGrid.value.getCheckboxRecords();
173
+ } else if (type === 'radio') {
174
+ records = xGrid.value.getRadioRecord();
175
+ } else {
176
+ records = xGrid.value.getTableData().fullData;
177
+ }
178
+ if (type === 'checkbox' && !records.length && !props.addChild) {
179
+ return warnMessage(t('message.selectedRecord'));
180
+ } else if (type === 'radio' && !records) {
181
+ return warnMessage(t('message.selectedRecord'));
182
+ }
183
+ if (isFunction(attrs.beforeConfirm) && !attrs.beforeConfirm(records)) return;
184
+ const { submitUrl } = props;
185
+ // 服务submitUrl
186
+ if (submitUrl) {
187
+ showLoading();
188
+ let res;
189
+ try {
190
+ records.forEach(record => Object.assign(record, props.defaultParams));
191
+ res = await serviceApi.post(submitUrl, records);
192
+ } finally {
193
+ res && emit('confirm', res);
194
+ res && successMessage(t('message.operateSuccess'));
195
+ close();
196
+ hiddenLoading();
197
+ }
198
+ } else {
199
+ props.autoClose && close();
200
+ emit('confirm', records);
201
+ }
202
+ };
203
+ // 请求数据
204
+ const refreshData = () => {
205
+ xGrid.value.commitProxy('query');
206
+ };
207
+ const refreshColumn = () => {
208
+ data.editRules = getRules();
209
+ xGrid.value.refreshColumn();
210
+ };
211
+ const getInstance = () => {
212
+ return toRaw(xGrid.value);
213
+ };
214
+ const cellClick = ({ row }) => {
215
+ const type = props.columns[0].type;
216
+ if (type === 'checkbox') {
217
+ xGrid.value.setCheckboxRow(row, true);
218
+ } else if (type === 'radio') {
219
+ xGrid.value.setRadioRow(row);
220
+ }
221
+ };
222
+ // 单元格被激活编辑激活回调
223
+ const onEditActived = data => {
224
+ emit('actived', data);
225
+ };
226
+ const toolbarButtonClick = ({ code }) => {
227
+ emit('buttonClick', code);
228
+ };
229
+ const showLoading = () => {
230
+ data.loading = true;
231
+ };
232
+ const hiddenLoading = () => {
233
+ data.loading = false;
234
+ };
235
+ const emit = defineEmits<{
236
+ (e: 'close'): void;
237
+ (e: 'confirm', record: any): void;
238
+ (e: 'actived', record: any): void;
239
+ (e: 'buttonClick', code: string): void;
240
+ }>();
241
+ // 关闭弹框
242
+ const close = () => {
243
+ if (isFunction(attrs.beforeClose) && !attrs.beforeClose()) return;
244
+ showModal.value = false;
245
+ emit('close');
246
+ };
247
+
248
+ /**
249
+ * @description: 设置grid参数
250
+ */
251
+
252
+ const setGridConfig = () => {
253
+ // 查询
254
+ if (props.items.length) {
255
+ data.formConfig = {
256
+ titleWidth: 100,
257
+ titleAlign: 'right',
258
+ items: getItems(),
259
+ rules: formatRules(props.items, t),
260
+ validConfig: { showMessage: false }
261
+ };
262
+ }
263
+ // tool bar
264
+ const obj = getToolBarConfig(data, props, attrs, hasAuthority);
265
+ Object.assign(data, obj);
266
+
267
+ // 合计方法
268
+ if (attrs.mergeFooter) {
269
+ data.showFooter = true;
270
+ data.footerMethod = ({ columns, data }) => footerSumMethod({ columns, data }, attrs.mergeFooter);
271
+ }
272
+ merge(data, props.gridOptions);
273
+ };
274
+
275
+ // 子组件需对外暴露方法
276
+ defineExpose({
277
+ refreshData,
278
+ refreshColumn,
279
+ getInstance,
280
+ showLoading,
281
+ hiddenLoading,
282
+ close
283
+ });
284
+ onBeforeMount(() => {
285
+ showModal.value = true;
286
+ setGridConfig();
287
+ });
288
+ </script>