@utogether/udp-core 1.0.1-beta.2 → 1.0.1-beta.20

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 (159) hide show
  1. package/build/plugins.ts +8 -1
  2. package/dist/{403-BBQoJwTM.js → 403-Bz5EJPLA.js} +1 -1
  3. package/dist/{404-BbJPSIWM.js → 404-ClOnaj9V.js} +1 -1
  4. package/dist/{500-BtFL9R4M.js → 500-DCUfhV7Y.js} +1 -1
  5. package/dist/{AuthorityInfo-DhiwCeLN.js → AuthorityInfo-q6E-js1r.js} +1 -1
  6. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-BM52QDgn.js +100 -0
  7. package/dist/{Company-CGqmslx-.js → Company-BSShW3Q4.js} +3 -3
  8. package/dist/{CompanyPanel-hlDsxD-6.js → CompanyPanel-Dl8eOYLk.js} +26 -26
  9. package/dist/{Department-BZyJtacc.js → Department-CVIxAnUN.js} +3 -3
  10. package/dist/{DepartmentPanel-D-a_EBFt.js → DepartmentPanel-Sa3IDl4z.js} +25 -25
  11. package/dist/{DesignPanel-Bl4luWDV.js → DesignPanel-DnRipagE.js} +1 -1
  12. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-I8C3iGvz.js → DesignPanel.vue_vue_type_style_index_0_lang-DGNyp3Vl.js} +28 -30
  13. package/dist/DictView-uf2K9A1d.js +109 -0
  14. package/dist/InvOrganization-CG9VCpXl.js +74 -0
  15. package/dist/Org-W2CBN1B8.js +39 -0
  16. package/dist/{Preview-pHD84xqI.js → Preview-DPBxdDvW.js} +2 -2
  17. package/dist/{ReportDefine-DnnCNQWS.js → ReportDefine-Dsx9VM-I.js} +1 -1
  18. package/dist/{ReportDesign-BnI_Q4pg.js → ReportDesign-DiIGfte0.js} +43 -43
  19. package/dist/{ReportQuery-Dby2MmtM.js → ReportQuery-9A4Bfs1M.js} +1 -1
  20. package/dist/{ReportQueryFrom-Blm1N8P1.js → ReportQueryFrom-M5qLoGAa.js} +1 -1
  21. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-CnG_Ybnt.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-OQ9pUCKP.js} +1 -1
  22. package/dist/{ReportTemplate-D65RXRY_.js → ReportTemplate-C34FWAuK.js} +28 -28
  23. package/dist/{Role-eFZoTpXc.js → Role-jG3VTeOF.js} +6 -6
  24. package/dist/{RoleAssign-D9-Y3UNz.js → RoleAssign-BfHpCequ.js} +9 -9
  25. package/dist/{RolePanel-DlFw6HSf.js → RolePanel-DW9pNl0L.js} +1 -1
  26. package/dist/{RolePanel-CoUOc3sX.js → RolePanel-xRN2-rkk.js} +1 -1
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-Clwk-MHw.js → RolePanel.vue_vue_type_script_setup_true_lang-BVEHqEq9.js} +44 -38
  28. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-C0rTy6vZ.js +132 -0
  29. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-M2FQJwPU.js → ScrollPanel.vue_vue_type_style_index_0_lang-D65sJYWT.js} +23 -23
  30. package/dist/{Staff-DFBLCsAd.js → Staff-BqBVEjau.js} +3 -3
  31. package/dist/{StaffInfo-d2CK0oBA.js → StaffInfo-DXeyyEFL.js} +1 -1
  32. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-4m8wK9tq.js → StaffInfo.vue_vue_type_script_setup_true_lang-Dg0iYgRf.js} +16 -16
  33. package/dist/{StaffPanel-D6aWLKN3.js → StaffPanel-iE-8VtUm.js} +1 -1
  34. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-C7YT2CVb.js → StaffPanel.vue_vue_type_script_setup_true_lang-BrrvE1xm.js} +2 -2
  35. package/dist/{SysUser-BdZvYxQH.js → SysUser-DSZyW30i.js} +2 -2
  36. package/dist/{SysUserPanel-BIVa6LLr.js → SysUserPanel-CbiG6GQF.js} +1 -1
  37. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-B1Y1fmBe.js +298 -0
  38. package/dist/{SystemMenu-C-5VKlHK.js → SystemMenu-DreuWY-a.js} +33 -33
  39. package/dist/{UserInfo-DqXCRZts.js → UserInfo-DXrzKAim.js} +1 -1
  40. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-N3TwfpPx.js → UserInfo.vue_vue_type_style_index_0_lang-C44E20b4.js} +41 -39
  41. package/dist/{childView-B2lSsqS3.js → childView-VCidWgY6.js} +1 -1
  42. package/dist/{childView-DRUNqgjI.js → childView-k5IkJOBr.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-B9XBDDU_.js → childView.vue_vue_type_style_index_0_lang-C6ftwwvZ.js} +1 -1
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-oGriyFTv.js → childView.vue_vue_type_style_index_0_lang-DmG82dVB.js} +43 -43
  45. package/dist/{code-rule-DZC9T6cl.js → code-rule-7WQMabpW.js} +13 -15
  46. package/dist/core.es.js +18 -10
  47. package/dist/{cron-task-BJwPeA5F.js → cron-task-D1t56MSu.js} +11 -11
  48. package/dist/{frameView-C6wkvok-.js → frameView-CWsIFBgU.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-DxWAYxai.js +5495 -0
  53. package/dist/{layoutView-CeJBpZb_.js → layoutView-DLpHSner.js} +1564 -1559
  54. package/dist/{log-in-e7D5Ss1P.js → log-in-CpGqc33f.js} +5 -4
  55. package/dist/{log-out--RRncZhN.js → log-out-D1b4VRMZ.js} +30 -24
  56. package/dist/login-OjDiQmz8.js +249 -0
  57. package/dist/{login-log-CvVnyGi3.js → login-log-BNRXLeMi.js} +4 -3
  58. package/dist/{lov-view-DRF-99U4.js → lov-view-D28X6m3k.js} +5 -5
  59. package/dist/{menuInfo-3Sjvs9nM.js → menuInfo-DwPB6rHz.js} +1 -1
  60. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-DrQ560nm.js → menuInfo.vue_vue_type_style_index_0_lang-l5DNRfb7.js} +34 -32
  61. package/dist/{pda-app-B9tn7jdv.js → pda-app-Bdms2PRY.js} +202 -188
  62. package/dist/{resource-BqnxbQNe.js → resource-y6SHrHoq.js} +18 -18
  63. package/dist/{su-welcome-VwifUK_O.js → su-welcome-D9G6EuK2.js} +118 -120
  64. package/dist/sys-config-DFnGHiFc.js +355 -0
  65. package/dist/udp-core.css +1 -9
  66. package/dist/utogether-MlnyYtNS.js +4 -0
  67. package/index.ts +17 -5
  68. package/package.json +1 -1
  69. package/src/App.vue +2 -7
  70. package/src/api/http.ts +1 -4
  71. package/src/api/index.ts +5 -3
  72. package/src/api/user.ts +2 -2
  73. package/src/components/SuCharts/src/UserInfo.vue +3 -3
  74. package/src/components/SuScrollTree/ScrollPanel.vue +170 -175
  75. package/src/components/udp/form/form.vue +109 -0
  76. package/src/components/udp/grid/index.vue +509 -0
  77. package/src/components/udp/index.ts +4 -4
  78. package/src/components/udp/utils.ts +405 -40
  79. package/src/directives/permission/index.ts +1 -1
  80. package/src/layout/components/lay-navbar/index.vue +9 -7
  81. package/src/layout/components/lay-panel/index.vue +3 -3
  82. package/src/layout/components/lay-search/index.vue +1 -1
  83. package/src/layout/components/lay-select-org/index.vue +4 -9
  84. package/src/layout/components/lay-sidebar/breadCrumb.vue +1 -1
  85. package/src/layout/components/lay-sidebar/horizontal.vue +4 -5
  86. package/src/layout/components/lay-sidebar/mixNav.vue +6 -4
  87. package/src/layout/components/lay-sidebar/sidebar-logo.vue +94 -98
  88. package/src/layout/components/lay-tag/index.vue +596 -625
  89. package/src/layout/hooks/useTag.ts +223 -233
  90. package/src/layout/layoutView.vue +215 -215
  91. package/src/layout/types.ts +3 -2
  92. package/src/main.ts +39 -31
  93. package/src/plugins/i18n/en.ts +26 -13
  94. package/src/plugins/i18n/zh.ts +35 -16
  95. package/src/plugins/vxe-table/index.ts +67 -4
  96. package/src/plugins/vxe-table/render.tsx +945 -817
  97. package/src/router/index.ts +186 -183
  98. package/src/router/modules/remaining.ts +1 -26
  99. package/src/router/utils.ts +393 -377
  100. package/src/store/modules/app.ts +1 -3
  101. package/src/store/modules/multiTags.ts +110 -109
  102. package/src/store/modules/permission.ts +113 -103
  103. package/src/store/modules/system.ts +1 -3
  104. package/src/style/button.scss +10 -3
  105. package/src/style/login.css +1 -1
  106. package/src/style/tailwind.css +1 -68
  107. package/src/style/vxetable.scss +348 -256
  108. package/src/utils/authority/index.ts +1 -1
  109. package/src/utils/index.ts +3 -1
  110. package/src/utils/propTypes.ts +1 -6
  111. package/src/views/login/login-view.vue +6 -20
  112. package/src/views/organization/company/CompanyPanel.vue +2 -2
  113. package/src/views/organization/department/DepartmentPanel.vue +269 -283
  114. package/src/views/organization/inv-org/InvOrganization.vue +23 -9
  115. package/src/views/organization/org/Org.vue +9 -5
  116. package/src/views/system/menu/SystemMenu.vue +183 -197
  117. package/src/views/system/menu/menuInfo.vue +8 -18
  118. package/src/views/system/role/AuthorityInfo.vue +19 -15
  119. package/src/views/system/role/Role.vue +1 -5
  120. package/src/views/system/role/RolePanel.vue +11 -2
  121. package/src/views/system/role/UserInfo.vue +11 -9
  122. package/src/views/system/role-assign/RoleAssign.vue +2 -2
  123. package/src/views/system/role-assign/RolePanel.vue +12 -9
  124. package/src/views/system/sys/sys-config.vue +66 -21
  125. package/src/views/system/sysUser/SysUserPanel.vue +44 -43
  126. package/src/views/uapp/pda/pda-app.vue +48 -16
  127. package/src/views/udev/coderule/code-rule.vue +120 -121
  128. package/src/views/udev/dict/DictView.vue +16 -4
  129. package/src/views/udev/dict/childView.vue +8 -8
  130. package/src/views/ufile/aggregation/File.vue +5 -5
  131. package/src/views/ufile/file/water-mark.vue +14 -14
  132. package/src/views/uhome/components/menu-favorite.vue +314 -331
  133. package/src/views/uhome/su-welcome.vue +3 -3
  134. package/src/views/ulogin/login.vue +19 -12
  135. package/src/views/upms/interface/log-in.vue +100 -106
  136. package/src/views/upms/interface/log-out.vue +2 -8
  137. package/src/views/upms/user/login-log.vue +54 -60
  138. package/src/views/urpt/design/DesignPanel.vue +16 -35
  139. package/src/views/urpt/design/Preview.vue +1 -0
  140. package/src/views/urpt/design/ReportDesign.vue +17 -23
  141. package/src/views/urpt/static-resource/resource.vue +3 -3
  142. package/src/views/urpt/template/ReportTemplate.vue +7 -7
  143. package/types/global.d.ts +4 -9
  144. package/vite.config.ts +6 -2
  145. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-Duyweh89.js +0 -102
  146. package/dist/DictView-B4a7Hs1X.js +0 -95
  147. package/dist/InvOrganization-q4T3y8dQ.js +0 -260
  148. package/dist/Org-BTGTrAVz.js +0 -35
  149. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-DKHgNWQP.js +0 -126
  150. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BsBKpYR7.js +0 -288
  151. package/dist/index-DZc3qRTx.js +0 -2650
  152. package/dist/login-BOxwzwdB.js +0 -252
  153. package/dist/sys-config-C0-gSBFO.js +0 -277
  154. package/dist/utogether-Di1byIum.js +0 -182
  155. package/src/components/udp/form-upload.vue +0 -183
  156. package/src/components/udp/modal-form.vue +0 -180
  157. package/src/utils/http/index.ts +0 -297
  158. package/src/utils/http/types.d.ts +0 -46
  159. package/src/utils/udp/useRender.ts +0 -420
@@ -0,0 +1,509 @@
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2021-11-17 16:33:37
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-10-29 17:55:12
6
+ * @Description: file content
7
+ -->
8
+ <template>
9
+ <div style="width: 100%; height: 100%">
10
+ <vxe-grid
11
+ ref="xgrid"
12
+ v-bind="data"
13
+ class="ut-grid-wrapper"
14
+ v-on="attrs.events || {}"
15
+ @toolbarButtonClick="toolbarButtonClick"
16
+ @toolbarToolClick="toolbarButtonClick"
17
+ @cell-click="cellClick"
18
+ @cell-dblclick="cellDbclick"
19
+ @edit-activated="editEctivated"
20
+ @form-reset="onReset"
21
+ />
22
+ <!-- <SearchScheme
23
+ v-if="showModal && props.url"
24
+ :items="items"
25
+ :view="viewCode"
26
+ @search="onSearch"
27
+ @close="showModal = false"
28
+ /> -->
29
+ </div>
30
+ </template>
31
+
32
+ <script lang="ts" setup>
33
+ // @ts-nocheck
34
+ import { useI18n } from 'vue-i18n';
35
+ import { ref, onBeforeMount, reactive, getCurrentInstance, toRaw, useAttrs, onUnmounted, nextTick } from 'vue';
36
+ import { VxeGridProps } from 'vxe-table';
37
+ import Sortable from 'sortablejs';
38
+ import { clone } from 'xe-utils';
39
+ import { formatGridItems, i18nColums, formatRules, errorMessage, dbstorage, warnMessage } from '@utogether/utils';
40
+ import {
41
+ queryAll,
42
+ query,
43
+ del,
44
+ save,
45
+ footerSumMethod,
46
+ getToolBarConfig,
47
+ defaultColums,
48
+ onCheckMethod,
49
+ getAttrs
50
+ } from '../utils';
51
+ // import SearchScheme from '../components/SuSearch.vue';
52
+
53
+ defineOptions({
54
+ name: 'UtGrid'
55
+ });
56
+
57
+ export interface IProps {
58
+ checkMethod?: Function;
59
+ serviceCode?: IRecord;
60
+ defaultValue?: IRecord;
61
+ defaultParams?: IRecord;
62
+ url?: string;
63
+ columns: Array<ITableColProps>;
64
+ items?: Array<IFormItemProps>;
65
+ editable?: boolean;
66
+ needExport?: boolean; // 是否需要导出
67
+ autoLoad?: boolean; // 自动加载查询数据
68
+ }
69
+
70
+ const attrs: IRecord = getAttrs(useAttrs());
71
+
72
+ const kSTORECOLUM = 'U_TABLE_COLUMNN_SORT';
73
+ let storeColums;
74
+ const cacheColumns = {};
75
+
76
+ // console.log(attrs);
77
+ const instance = getCurrentInstance()!;
78
+ const hasAuthority = instance.appContext.config.globalProperties.$hasAuthority;
79
+ const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
80
+ const viewCode = instance.parent.type.name;
81
+ const $mode = instance.appContext.config.globalProperties.$mode;
82
+
83
+ const props = withDefaults(defineProps<IProps>(), {
84
+ /**
85
+ * @deprecated 2.10.0版本失效,
86
+ * */
87
+ serviceCode: (): IRecord => {
88
+ return {};
89
+ },
90
+ items: () => [],
91
+ columns: () => [],
92
+ editable: true,
93
+ autoLoad: true,
94
+ needExport: true
95
+ });
96
+
97
+ const { t } = useI18n();
98
+
99
+ const xgrid = ref(null);
100
+ const showModal = ref(false);
101
+
102
+ const favorite = {
103
+ icon: 'vxe-icon-setting',
104
+ name: 'favorite',
105
+ events: {
106
+ click: (e, option) => {
107
+ if (option.name === 'favorite') {
108
+ showModal.value = true;
109
+ }
110
+ }
111
+ }
112
+ };
113
+
114
+ /**
115
+ * @description: 根据items 获取必填选
116
+ */
117
+ const getRules = () => {
118
+ if (!props.columns.length) return {};
119
+ return formatRules(props.columns, t);
120
+ };
121
+ /**
122
+ * @description: colum 统一添加国家化
123
+ */
124
+ const getColumns = () => {
125
+ const columns = props.columns;
126
+ if (attrs.gridId) {
127
+ const cols = defaultColums
128
+ .filter(f => !columns.some(s => s.field === f.field))
129
+ .map(col => {
130
+ if (attrs.format && ['lastUpdateDate', 'creationDate'].includes(col.field)) {
131
+ col.formatter = attrs.format;
132
+ col.width = 90;
133
+ }
134
+ return col;
135
+ });
136
+ const idx = columns.findIndex(s => s.field === 'operate');
137
+ if (idx !== -1) {
138
+ columns.splice(idx, 0, ...cols);
139
+ } else {
140
+ columns.push(...cols);
141
+ }
142
+ }
143
+ const act_columns = attrs.gridId ? formatColums(columns) : columns;
144
+
145
+ return i18nColums(act_columns, attrs.sortable);
146
+ };
147
+
148
+ dbstorage.getItem(kSTORECOLUM).then(value => {
149
+ storeColums = value;
150
+ data.columns = getColumns();
151
+ });
152
+
153
+ const data = reactive<VxeGridProps>({
154
+ border: true,
155
+ pagerConfig: { pageSize: attrs.pageSize || 20 },
156
+ editConfig: {},
157
+ editRules: getRules(),
158
+ formConfig: {},
159
+ columnConfig: { useKey: true },
160
+ toolbarConfig: { enabled: false },
161
+ sortConfig: { multiple: true, trigger: 'cell' },
162
+ height: $mode ? undefined : window.innerHeight - 92,
163
+
164
+ checkboxConfig: {
165
+ checkMethod: ({ row }) => onCheckMethod(row, props),
166
+ checkRowKeys: props.checkRowKeys
167
+ },
168
+ loading: false,
169
+ footerRowClassName: 'ut-grid-footer',
170
+ proxyConfig: {
171
+ form: true, // 查询是需要启用表单代理
172
+ autoLoad: props.autoLoad,
173
+ showResponseMsgvxe: false,
174
+ showActionMsgvxe: false,
175
+ // 接收 Promise
176
+ ajax: {
177
+ queryAll: ({ form }) => queryAll(props, serviceApi, form),
178
+ query: ({ page, form, code }) => query(props, form, page, serviceApi, code, $mode),
179
+ delete: ({ body: { removeRecords } }) => del(serviceApi, removeRecords, props),
180
+ save: ({ body }) => Promise.all(save(serviceApi, body, props)),
181
+ querySuccess: ({ response }) => callback('querySuccess', response),
182
+ queryError: ({ response }) => callback('queryError', response),
183
+ deleteSuccess: ({ response }) => callback('deleteSuccess', response),
184
+ deleteError: ({ response }) => callback('deleteError', response),
185
+ saveSuccess: ({ response }) => callback('saveSuccess', response),
186
+ saveError: ({ response }) => callback('saveError', response)
187
+ }
188
+ },
189
+ columns: !attrs.gridId ? getColumns() : [],
190
+ ...attrs
191
+ });
192
+
193
+ /**
194
+ * @description: 预处理查询form
195
+ * @return {*} items
196
+ */
197
+ const getItems = () => {
198
+ if (!props.items.length) return props.items;
199
+ return formatGridItems(clone(props.items, true), viewCode && props.url ? favorite : viewCode);
200
+ };
201
+
202
+ /**
203
+ * @description 格式化column
204
+ * @return {*} columns
205
+ */
206
+ function formatColums(columns) {
207
+ const customSort = storeColums ? storeColums[attrs.gridId] : {};
208
+ if (!customSort) return columns;
209
+ return columns
210
+ .map((col, idx) => {
211
+ const sort = (idx + 1) * 10;
212
+ col._sort = customSort[col.field] || sort;
213
+ // 缓存列索引数据
214
+ cacheColumns[col.field] = col._sort;
215
+ return col;
216
+ })
217
+ .sort((a, b) => a._sort - b._sort);
218
+ }
219
+
220
+ /**
221
+ * @description: 设置grid参数
222
+ */
223
+ const setGridConfig = () => {
224
+ // 查询
225
+ if (props.items.length) {
226
+ // data.formConfig = {};
227
+ data.formConfig = {
228
+ titleWidth: 100,
229
+ titleAlign: 'right',
230
+ items: getItems(),
231
+ rules: formatRules(props.items, t),
232
+ validConfig: { showMessage: false }
233
+ };
234
+ }
235
+ // tool bar
236
+ const obj = getToolBarConfig(data, props, attrs, hasAuthority);
237
+ Object.assign(data, obj);
238
+ // 表格id,用于自定义列
239
+ if (attrs.gridId) {
240
+ data.id = attrs.gridId;
241
+ data.customConfig = {
242
+ storage: true,
243
+ mode: 'popup',
244
+ checkMethod({ column }) {
245
+ return column.field === 'operate' || ['checkbox', 'radio'].includes(column.type) ? false : true;
246
+ },
247
+ modalOptions: {
248
+ width: 750,
249
+ height: '75%'
250
+ }
251
+ };
252
+ }
253
+ if (attrs.mergeFooter) {
254
+ // 合计方法
255
+ data.showFooter = true;
256
+ data.footerMethod = ({ columns, data }) => footerSumMethod({ columns, data }, attrs.mergeFooter);
257
+ }
258
+ };
259
+ /**
260
+ * @description 手动调用查询方法
261
+ */
262
+ const refreshData = () => {
263
+ xgrid.value.commitProxy('query');
264
+ };
265
+ /**
266
+ * @description 刷新列数据
267
+ */
268
+ const refreshColumn = () => {
269
+ data.editRules = getRules();
270
+ return xgrid.value.refreshColumn();
271
+ };
272
+ /**
273
+ * @description 显示加载框
274
+ */
275
+ const showLoading = () => {
276
+ data.loading = true;
277
+ };
278
+ /**
279
+ * @description 隐藏加载框
280
+ */
281
+ const hiddenLoading = () => {
282
+ data.loading = false;
283
+ };
284
+ /**
285
+ * @description 获取实例方法
286
+ * @return vxe-grid实例的方法
287
+ */
288
+ const getInstance = () => {
289
+ return toRaw(xgrid.value);
290
+ };
291
+ /**
292
+ * @description 获取表格全量数据方法
293
+ * @return vxe-grid表格全量数据
294
+ */
295
+ const getTableData = () => {
296
+ return xgrid.value.getTableData().fullData;
297
+ };
298
+ /**
299
+ * @description 获取表格选中的行
300
+ * @return vxe-grid表格勾选行
301
+ */
302
+ const getSelectRecords = (isFull = false) => {
303
+ const columnType = props.columns[0].type;
304
+ const checkRecords =
305
+ columnType === 'radio' ? xgrid.value.getRadioRecord(isFull) : xgrid.value.getCheckboxRecords(isFull);
306
+ if (columnType === 'checkbox' && !checkRecords.length) {
307
+ warnMessage(t('message.tip_selectedRecord'));
308
+ return [];
309
+ } else if (columnType === 'radio' && !checkRecords) {
310
+ warnMessage(t('message.tip_selectedRecord'));
311
+ return null;
312
+ }
313
+ return checkRecords;
314
+ };
315
+
316
+ const callback = (cb, response) => {
317
+ attrs?.callback && attrs?.callback[cb] && attrs?.callback[cb](response);
318
+ };
319
+
320
+ const onReset = ({ data }) => {
321
+ console.log(data);
322
+ const items = props.items.filter(f => f.itemRender?.props?.multiple);
323
+ console.log(items);
324
+ items.forEach(item => {
325
+ data[`_${item.field}`] = [];
326
+ });
327
+ refreshData();
328
+ };
329
+
330
+ let sortable2: any;
331
+ const columnDrop = () => {
332
+ const $grid = xgrid.value;
333
+ sortable2 = Sortable.create($grid.$el.querySelector('.vxe-table--header .vxe-header--row'), {
334
+ disabled: !attrs.gridId,
335
+ handle: '.vxe-header--column',
336
+ onEnd: async sortableEvent => {
337
+ const targetThElem = sortableEvent.item;
338
+ const newIndex = sortableEvent.newIndex as number;
339
+ const oldIndex = sortableEvent.oldIndex as number;
340
+ const { fullColumn, tableColumn } = $grid.getTableColumn();
341
+ const wrapperElem = targetThElem.parentNode as HTMLElement;
342
+ const newColumn = fullColumn[newIndex];
343
+ const item = fullColumn[oldIndex];
344
+ let nodrag = false;
345
+ let msg = '固定列';
346
+ if (newColumn.fixed) {
347
+ nodrag = false;
348
+ } else if (newIndex === 0 || ['checkbox', 'radio'].includes(item.type)) {
349
+ msg = '勾选列';
350
+ nodrag = true;
351
+ } else if (item.field === 'operate' || newIndex === fullColumn.length - 1) {
352
+ nodrag = true;
353
+ msg = '操作列';
354
+ }
355
+ if (nodrag) {
356
+ // 错误的移动
357
+ const oldThElem = wrapperElem.children[oldIndex] as HTMLElement;
358
+ if (newIndex > oldIndex) {
359
+ wrapperElem.insertBefore(targetThElem, oldThElem);
360
+ } else {
361
+ wrapperElem.insertBefore(targetThElem, oldThElem ? oldThElem.nextElementSibling : oldThElem);
362
+ }
363
+ return errorMessage(msg + '不允许拖动!');
364
+ }
365
+ // 获取列索引 columnIndex > fullColumn
366
+ const oldColumnIndex = $grid.getColumnIndex(tableColumn[oldIndex]);
367
+ const newColumnIndex = $grid.getColumnIndex(tableColumn[newIndex]);
368
+ // 移动到目标列
369
+ const currRow = fullColumn.splice(oldColumnIndex, 1)[0];
370
+ fullColumn.splice(newColumnIndex, 0, currRow);
371
+
372
+ // 拖拽方向 1: 右 -1: 左
373
+ const direction = newColumnIndex - oldColumnIndex > 0 ? 1 : -1;
374
+
375
+ // 获取新列
376
+ const newSort = (newColumnIndex + 1) * 10;
377
+ const oldSort = (oldColumnIndex + 1) * 10;
378
+ // 目标列索引+1,方便后续计算
379
+ const comparisonVal = newSort + 1 * direction;
380
+ for (const key in cacheColumns) {
381
+ const cacheValue = cacheColumns[key];
382
+ if (direction > 0 && cacheValue < comparisonVal && cacheValue > oldSort) {
383
+ // 大于拖拽列且小于目标列的索引,均向前移动一个单位
384
+ cacheColumns[key] = cacheValue - 10 * direction;
385
+ } else if (direction < 0 && cacheValue > comparisonVal && cacheValue < oldSort) {
386
+ // 小于拖拽列且大于目标列的索引, 均向后移动一个单位
387
+ cacheColumns[key] = cacheValue - 10 * direction;
388
+ }
389
+ }
390
+
391
+ cacheColumns[currRow.field] = newSort;
392
+
393
+ dbstorage.setItem(kSTORECOLUM, { [attrs.gridId]: cacheColumns });
394
+ $grid.loadColumn(fullColumn);
395
+ }
396
+ });
397
+ };
398
+
399
+ /**
400
+ * @description 常用查询面板确认查询
401
+ * @param data 常用查询条件
402
+ */
403
+ // const onSearch = data => {
404
+ // showModal.value = false;
405
+ // const { form } = xgrid.value.getProxyInfo();
406
+ // Object.assign(form, data);
407
+ // refreshData();
408
+ // };
409
+
410
+ const reloadGrid = () => {
411
+ setGridConfig();
412
+ };
413
+
414
+ /**
415
+ * @description Vue实例对外暴露的相关方法或属性
416
+ */
417
+ defineExpose({
418
+ getTableData,
419
+ getSelectRecords,
420
+ refreshData,
421
+ refreshColumn,
422
+ getInstance,
423
+ showLoading,
424
+ hiddenLoading,
425
+ reloadGrid
426
+ });
427
+
428
+ const toolbarButtonClick = ({ code }) => {
429
+ emit('buttonClick', code);
430
+ };
431
+ const cellClick = e => {
432
+ emit('cellClick', e);
433
+ };
434
+ const cellDbclick = e => {
435
+ emit('cellDbclick', e);
436
+ };
437
+ const editEctivated = e => {
438
+ emit('editEctivated', e);
439
+ };
440
+
441
+ /**
442
+ * @description: 监听窗口变化,动态改变表格的高度
443
+ */
444
+ const addResizeListener = () => {
445
+ window.onresize = () => {
446
+ return (() => {
447
+ let height = attrs?.height || window.innerHeight - 90;
448
+ if (attrs.mode !== 'inline' && !attrs?.height) {
449
+ height = window.innerHeight - 180;
450
+ }
451
+ data.height = height < 240 ? 240 : height;
452
+ })();
453
+ };
454
+ };
455
+
456
+ let initTime: any;
457
+ nextTick(() => {
458
+ // 加载完成之后在绑定拖动事件
459
+ initTime = setTimeout(() => {
460
+ columnDrop();
461
+ }, 500);
462
+ });
463
+ /**
464
+ * @description Vue实例卸载
465
+ */
466
+ onUnmounted(() => {
467
+ clearTimeout(initTime);
468
+ sortable2 && sortable2.destroy();
469
+ });
470
+ /**
471
+ * @description Vue实例挂载
472
+ */
473
+ onBeforeMount(() => {
474
+ setGridConfig();
475
+ addResizeListener();
476
+ });
477
+
478
+ const emit = defineEmits<{
479
+ (e: 'buttonClick', code: string): void;
480
+ (e: 'cellClick', data: any): void;
481
+ (e: 'cellDbclick', data: any): void;
482
+ (e: 'editEctivated', data: any): void;
483
+ }>();
484
+ </script>
485
+
486
+ <style lang="scss">
487
+ .ut-grid-wrapper {
488
+ padding: 5px;
489
+ background-color: #fff;
490
+
491
+ .vxe-form--item {
492
+ padding: 0.1em 0.8em 0.1em 0 !important;
493
+
494
+ .el-select {
495
+ .el-input {
496
+ height: 26px;
497
+ }
498
+
499
+ .el-select__tags-text {
500
+ color: #000;
501
+ }
502
+ }
503
+ }
504
+
505
+ .vxe-grid--layout-body-content-wrapper {
506
+ overflow: hidden;
507
+ }
508
+ }
509
+ </style>
@@ -1,4 +1,4 @@
1
- import UtModalForm2 from './modal-form.vue';
2
- import FormUpload2 from './form-upload.vue';
3
-
4
- export { UtModalForm2, FormUpload2 };
1
+ import UtGrid2 from './grid/index.vue';
2
+ import UtForm2 from './form/form.vue';
3
+
4
+ export { UtGrid2, UtForm2 };