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

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 (93) hide show
  1. package/build/plugins.ts +6 -1
  2. package/dist/{403-BBQoJwTM.js → 403-BuP9jvH9.js} +1 -1
  3. package/dist/{404-BbJPSIWM.js → 404-DfQk8kKl.js} +1 -1
  4. package/dist/{500-BtFL9R4M.js → 500-OgROWdiZ.js} +1 -1
  5. package/dist/{AuthorityInfo-DhiwCeLN.js → AuthorityInfo-q2ksfkWH.js} +1 -1
  6. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-Duyweh89.js → AuthorityInfo.vue_vue_type_style_index_0_lang-Bwsf6lMH.js} +1 -1
  7. package/dist/{Company-CGqmslx-.js → Company-DgqowAxc.js} +3 -3
  8. package/dist/{CompanyPanel-hlDsxD-6.js → CompanyPanel-BNb1rUhD.js} +16 -16
  9. package/dist/{Department-BZyJtacc.js → Department-Cl8CROSU.js} +3 -3
  10. package/dist/{DepartmentPanel-D-a_EBFt.js → DepartmentPanel-D5VkqKeP.js} +1 -1
  11. package/dist/{DesignPanel-Bl4luWDV.js → DesignPanel-BGvEusHC.js} +1 -1
  12. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-I8C3iGvz.js → DesignPanel.vue_vue_type_style_index_0_lang-BQF1uQ7w.js} +2 -2
  13. package/dist/{DictView-B4a7Hs1X.js → DictView-BnxfaOBv.js} +13 -12
  14. package/dist/InvOrganization-5y79ZLdY.js +66 -0
  15. package/dist/{Org-BTGTrAVz.js → Org-2oBAXN2r.js} +1 -1
  16. package/dist/{Preview-pHD84xqI.js → Preview-BaGmXH7r.js} +1 -1
  17. package/dist/{ReportDefine-DnnCNQWS.js → ReportDefine-DkQdBErt.js} +1 -1
  18. package/dist/{ReportDesign-BnI_Q4pg.js → ReportDesign-DzB_A_G6.js} +2 -2
  19. package/dist/{ReportQuery-Dby2MmtM.js → ReportQuery-DRcMb6ya.js} +1 -1
  20. package/dist/{ReportQueryFrom-Blm1N8P1.js → ReportQueryFrom-CeA9xhR4.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-CgGtcs5V.js} +1 -1
  22. package/dist/{ReportTemplate-D65RXRY_.js → ReportTemplate-qaiTMQuT.js} +1 -1
  23. package/dist/{Role-eFZoTpXc.js → Role-DsFulAjq.js} +3 -3
  24. package/dist/{RoleAssign-D9-Y3UNz.js → RoleAssign-DMRdocpa.js} +3 -3
  25. package/dist/{RolePanel-DlFw6HSf.js → RolePanel-B9POS_pg.js} +1 -1
  26. package/dist/{RolePanel-CoUOc3sX.js → RolePanel-wXVysDHM.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-CleVvkcY.js} +3 -3
  28. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DKHgNWQP.js → RolePanel.vue_vue_type_script_setup_true_lang-t6S_0zmJ.js} +1 -1
  29. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-M2FQJwPU.js → ScrollPanel.vue_vue_type_style_index_0_lang-DlXUs0j9.js} +1 -1
  30. package/dist/{Staff-DFBLCsAd.js → Staff-Cq4V7ruC.js} +3 -3
  31. package/dist/{StaffInfo-d2CK0oBA.js → StaffInfo-CJDKMbud.js} +1 -1
  32. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-4m8wK9tq.js → StaffInfo.vue_vue_type_script_setup_true_lang-DQ4DL1KY.js} +1 -1
  33. package/dist/{StaffPanel-D6aWLKN3.js → StaffPanel-CG-uggdr.js} +1 -1
  34. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-C7YT2CVb.js → StaffPanel.vue_vue_type_script_setup_true_lang-DAgN7zN2.js} +2 -2
  35. package/dist/{SysUser-BdZvYxQH.js → SysUser-kwnzRNdD.js} +2 -2
  36. package/dist/{SysUserPanel-BIVa6LLr.js → SysUserPanel-DTlZf3vk.js} +1 -1
  37. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-BsBKpYR7.js → SysUserPanel.vue_vue_type_script_setup_true_lang-BW6PlGjM.js} +1 -1
  38. package/dist/{SystemMenu-C-5VKlHK.js → SystemMenu-BVT0n-L2.js} +9 -9
  39. package/dist/{UserInfo-DqXCRZts.js → UserInfo-BbTQ9Zat.js} +1 -1
  40. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-N3TwfpPx.js → UserInfo.vue_vue_type_style_index_0_lang-D_bpYDmI.js} +1 -1
  41. package/dist/{childView-B2lSsqS3.js → childView-BJbIhjmf.js} +1 -1
  42. package/dist/{childView-DRUNqgjI.js → childView-DCsGFrG-.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-B9XBDDU_.js → childView.vue_vue_type_style_index_0_lang-BCDxpVoD.js} +1 -1
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-oGriyFTv.js → childView.vue_vue_type_style_index_0_lang-CDtsalCm.js} +1 -1
  45. package/dist/{code-rule-DZC9T6cl.js → code-rule-DePU6cdp.js} +1 -1
  46. package/dist/core.es.js +1 -1
  47. package/dist/{cron-task-BJwPeA5F.js → cron-task-DUM1SIGL.js} +1 -1
  48. package/dist/{frameView-C6wkvok-.js → frameView-CEUTDtSm.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-ZdgOD7cF.js +3399 -0
  53. package/dist/{layoutView-CeJBpZb_.js → layoutView-PCjwVwkX.js} +109 -108
  54. package/dist/{login-BOxwzwdB.js → login-B1CjWVKu.js} +2 -2
  55. package/dist/{lov-view-DRF-99U4.js → lov-view-D8wwkxFJ.js} +2 -2
  56. package/dist/{menuInfo-3Sjvs9nM.js → menuInfo-B5JKVwrB.js} +1 -1
  57. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-DrQ560nm.js → menuInfo.vue_vue_type_style_index_0_lang-CcM9WX4n.js} +27 -27
  58. package/dist/{pda-app-B9tn7jdv.js → pda-app-DIa1p1Ww.js} +1 -1
  59. package/dist/{resource-BqnxbQNe.js → resource-CCQ7Dd-5.js} +1 -1
  60. package/dist/{su-welcome-VwifUK_O.js → su-welcome-CLp9YaJa.js} +1 -1
  61. package/dist/{sys-config-C0-gSBFO.js → sys-config-BBmf_SqF.js} +1 -1
  62. package/dist/udp-core.css +2 -2
  63. package/dist/{utogether-Di1byIum.js → utogether-Bkptx2lB.js} +1 -1
  64. package/package.json +1 -1
  65. package/src/App.vue +70 -70
  66. package/src/components/udp/grid.vue +500 -0
  67. package/src/components/udp/index.ts +7 -4
  68. package/src/components/udp/lov.vue +410 -0
  69. package/src/components/udp/modal-form.vue +2 -2
  70. package/src/components/udp/modal-grid.vue +297 -0
  71. package/src/components/udp/utils.ts +379 -40
  72. package/src/layout/components/lay-navbar/index.vue +1 -1
  73. package/src/layout/components/lay-panel/index.vue +150 -150
  74. package/src/layout/components/lay-sidebar/breadCrumb.vue +1 -1
  75. package/src/layout/components/lay-tag/index.vue +625 -625
  76. package/src/layout/layoutView.vue +215 -215
  77. package/src/main.ts +110 -109
  78. package/src/plugins/i18n/en.ts +291 -289
  79. package/src/plugins/i18n/zh.ts +338 -337
  80. package/src/plugins/vxe-table/index.ts +3 -3
  81. package/src/plugins/vxe-table/render.tsx +4 -2
  82. package/src/style/button.scss +85 -78
  83. package/src/style/tailwind.css +1 -68
  84. package/src/style/vxetable.scss +258 -256
  85. package/src/views/organization/company/CompanyPanel.vue +259 -259
  86. package/src/views/organization/inv-org/InvOrganization.vue +2 -3
  87. package/src/views/system/menu/SystemMenu.vue +1 -1
  88. package/src/views/system/menu/menuInfo.vue +372 -373
  89. package/src/views/udev/dict/DictView.vue +106 -106
  90. package/src/views/udev/lov/lov-view.vue +91 -91
  91. package/vite.config.ts +4 -1
  92. package/dist/InvOrganization-q4T3y8dQ.js +0 -260
  93. package/dist/index-DZc3qRTx.js +0 -2650
@@ -1,6 +1,6 @@
1
1
  import { computed as W, ref as L } from "vue";
2
2
  import { useGlobal as g, storageLocal as u, deviceDetection as H, cookies as C, storageSession as M } from "@utogether/utils";
3
- import { y as P, j as E, s as j, g as h, v as d, z as J, l as K, m as R, n as V, u as S, r as G, o as O, A as x, B as Z } from "./index-DZc3qRTx.js";
3
+ import { y as P, j as E, s as j, g as h, v as d, z as J, l as K, m as R, n as V, u as S, r as G, o as O, A as x, B as Z } from "./index-ZdgOD7cF.js";
4
4
  import { useI18n as f } from "vue-i18n";
5
5
  import { defineStore as v } from "pinia";
6
6
  function I() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@utogether/udp-core",
3
3
  "private": false,
4
- "version": "1.0.1-beta.2",
4
+ "version": "1.0.1-beta.3",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "main1": "index.ts",
package/src/App.vue CHANGED
@@ -1,70 +1,70 @@
1
- <!--
2
- * @Author: wei.li
3
- * @Date: 2021-12-23 17:33:19
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-04-08 14:44:35
6
- * @Description: file content
7
- -->
8
- <template>
9
- <el-config-provider size="small" :z-index="2000" :locale="currentLocale">
10
- <router-view />
11
- </el-config-provider>
12
- </template>
13
-
14
- <script lang="ts">
15
- import { defineComponent } from 'vue';
16
- import { ElConfigProvider } from 'element-plus';
17
- import { checkVersion } from 'version-rocket';
18
- import { useI18n } from 'vue-i18n';
19
- import en from 'element-plus/es/locale/lang/en';
20
- import zhCn from 'element-plus/es/locale/lang/zh-cn';
21
- import { storageLocal } from '@utogether/utils';
22
- import { kSYSCONFIG } from './contant';
23
- import { getServiceApi } from './api';
24
-
25
- export default defineComponent({
26
- name: 'app',
27
- components: {
28
- [ElConfigProvider.name]: ElConfigProvider
29
- },
30
- beforeRouteEnter(to, from, next) {
31
- getServiceApi()
32
- .get('/upfm/v1/sysConfig', {})
33
- .then(res => {
34
- console.log(res);
35
- next();
36
- });
37
- },
38
- computed: {
39
- currentLocale() {
40
- return this.$storage?.locale?.locale === 'zh' ? zhCn : en;
41
- }
42
- },
43
- beforeCreate() {
44
- const { t } = useI18n();
45
- const sysConfig = storageLocal.getItem(kSYSCONFIG);
46
- const config = sysConfig || { title: 'U-DP' };
47
- const title = config['title'];
48
- // 版本实时更新检测,只作用于线上环境
49
- // 5分钟检测一次版本
50
- checkVersion(
51
- {
52
- pollingTime: 300000,
53
- checkOriginSpecifiedFilesUrl: [`${location.origin}/index.html`],
54
- enable: process.env.NODE_ENV !== 'development'
55
- },
56
- {
57
- title,
58
- description: t('message.udp.newVersion'),
59
- buttonText: t('message.udp.updatenow'),
60
- cancelButtonText: t('message.udp.updateLater')
61
- }
62
- );
63
- }
64
- });
65
- </script>
66
- <style lang="scss">
67
- // .hiprint-printElement-image-content img {
68
- // content: url('/images/logo.png');
69
- // }
70
- </style>
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2021-12-23 17:33:19
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-07-25 22:37:59
6
+ * @Description: file content
7
+ -->
8
+ <template>
9
+ <el-config-provider size="small" :z-index="12000" :locale="currentLocale">
10
+ <router-view />
11
+ </el-config-provider>
12
+ </template>
13
+
14
+ <script lang="ts">
15
+ import { defineComponent } from 'vue';
16
+ import { ElConfigProvider } from 'element-plus';
17
+ import { checkVersion } from 'version-rocket';
18
+ import { useI18n } from 'vue-i18n';
19
+ import en from 'element-plus/es/locale/lang/en';
20
+ import zhCn from 'element-plus/es/locale/lang/zh-cn';
21
+ import { storageLocal } from '@utogether/utils';
22
+ import { kSYSCONFIG } from './contant';
23
+ import { getServiceApi } from './api';
24
+
25
+ export default defineComponent({
26
+ name: 'app',
27
+ components: {
28
+ [ElConfigProvider.name]: ElConfigProvider
29
+ },
30
+ beforeRouteEnter(to, from, next) {
31
+ getServiceApi()
32
+ .get('/upfm/v1/sysConfig', {})
33
+ .then(res => {
34
+ console.log(res);
35
+ next();
36
+ });
37
+ },
38
+ computed: {
39
+ currentLocale() {
40
+ return this.$storage?.locale?.locale === 'zh' ? zhCn : en;
41
+ }
42
+ },
43
+ beforeCreate() {
44
+ const { t } = useI18n();
45
+ const sysConfig = storageLocal.getItem(kSYSCONFIG);
46
+ const config = sysConfig || { title: 'U-DP' };
47
+ const title = config['title'];
48
+ // 版本实时更新检测,只作用于线上环境
49
+ // 5分钟检测一次版本
50
+ checkVersion(
51
+ {
52
+ pollingTime: 300000,
53
+ checkOriginSpecifiedFilesUrl: [`${location.origin}/index.html`],
54
+ enable: process.env.NODE_ENV !== 'development'
55
+ },
56
+ {
57
+ title,
58
+ description: t('message.udp.newVersion'),
59
+ buttonText: t('message.udp.updatenow'),
60
+ cancelButtonText: t('message.udp.updateLater')
61
+ }
62
+ );
63
+ }
64
+ });
65
+ </script>
66
+ <style lang="scss">
67
+ // .hiprint-printElement-image-content img {
68
+ // content: url('/images/logo.png');
69
+ // }
70
+ </style>
@@ -0,0 +1,500 @@
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2021-11-17 16:33:37
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-07-23 10:21:02
6
+ * @Description: file content
7
+ -->
8
+ <template>
9
+ <div style="width: 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
+ />
21
+ <!-- <SearchScheme
22
+ v-if="showModal && props.url"
23
+ :items="items"
24
+ :view="viewCode"
25
+ @search="onSearch"
26
+ @close="showModal = false"
27
+ /> -->
28
+ </div>
29
+ </template>
30
+
31
+ <script lang="ts" setup>
32
+ // @ts-nocheck
33
+ import { useI18n } from 'vue-i18n';
34
+ import {
35
+ ref,
36
+ onBeforeMount,
37
+ reactive,
38
+ getCurrentInstance,
39
+ toRaw,
40
+ useAttrs,
41
+ onUnmounted,
42
+ nextTick
43
+ } from 'vue';
44
+ import { VxeGridProps } from 'vxe-table';
45
+ import Sortable from 'sortablejs';
46
+ import { clone } from 'xe-utils';
47
+ import {
48
+ formatGridItems,
49
+ i18nColums,
50
+ formatRules,
51
+ errorMessage,
52
+ dbstorage,
53
+ warnMessage
54
+ } from '@utogether/utils';
55
+ import {
56
+ queryAll,
57
+ query,
58
+ del,
59
+ save,
60
+ footerSumMethod,
61
+ getToolBarConfig,
62
+ defaultColums,
63
+ onCheckMethod,
64
+ getAttrs
65
+ } from './utils';
66
+ // import SearchScheme from '../components/SuSearch.vue';
67
+ // import type { IRecord, IFormItemProps, ITableColProps } from '../../types';
68
+
69
+ defineOptions({
70
+ name: 'UtGrid'
71
+ });
72
+
73
+ export interface IProps {
74
+ checkMethod?: Function;
75
+ serviceCode?: IRecord;
76
+ defaultValue?: IRecord;
77
+ defaultParams?: IRecord;
78
+ url?: string;
79
+ columns: Array<ITableColProps>;
80
+ items?: Array<IFormItemProps>;
81
+ editable?: boolean;
82
+ needExport?: boolean; // 是否需要导出
83
+ autoLoad?: boolean; // 自动加载查询数据
84
+ }
85
+
86
+ const attrs: IRecord = getAttrs(useAttrs());
87
+
88
+ const kSTORECOLUM = 'U_TABLE_COLUMNN_SORT';
89
+ let storeColums;
90
+ const cacheColumns = {};
91
+
92
+ // console.log(attrs);
93
+ const instance = getCurrentInstance()!;
94
+ const hasAuthority = instance.appContext.config.globalProperties.$hasAuthority;
95
+ const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
96
+ const viewCode = instance.parent.type.name;
97
+ const $mode = instance.appContext.config.globalProperties.$mode;
98
+
99
+ const props = withDefaults(defineProps<IProps>(), {
100
+ /**
101
+ * @deprecated 2.10.0版本失效,
102
+ * */
103
+ serviceCode: (): IRecord => {
104
+ return {};
105
+ },
106
+ items: () => [],
107
+ columns: () => [],
108
+ editable: true,
109
+ autoLoad: true,
110
+ needExport: true
111
+ });
112
+
113
+ const { t } = useI18n();
114
+
115
+ const xgrid = ref(null);
116
+ const showModal = ref(false);
117
+
118
+ const favorite = {
119
+ icon: 'vxe-icon-setting',
120
+ name: 'favorite',
121
+ events: {
122
+ click: (e, option) => {
123
+ if (option.name === 'favorite') {
124
+ showModal.value = true;
125
+ }
126
+ }
127
+ }
128
+ };
129
+
130
+ /**
131
+ * @description: 根据items 获取必填选
132
+ */
133
+ const getRules = () => {
134
+ if (!props.columns.length) return {};
135
+ return formatRules(props.columns, t);
136
+ };
137
+ /**
138
+ * @description: colum 统一添加国家化
139
+ */
140
+ const getColumns = () => {
141
+ const columns = props.columns;
142
+ if (attrs.gridId) {
143
+ const cols = defaultColums
144
+ .filter(f => !columns.some(s => s.field === f.field))
145
+ .map(col => {
146
+ if (attrs.format && ['lastUpdateDate', 'creationDate'].includes(col.field)) {
147
+ col.formatter = attrs.format;
148
+ col.width = 90;
149
+ }
150
+ return col;
151
+ });
152
+ const idx = columns.findIndex(s => s.field === 'operate');
153
+ if (idx !== -1) {
154
+ columns.splice(idx, 0, ...cols);
155
+ } else {
156
+ columns.push(...cols);
157
+ }
158
+ }
159
+ const act_columns = attrs.gridId ? formatColums(columns) : columns;
160
+
161
+ return i18nColums(act_columns);
162
+ };
163
+
164
+ dbstorage.getItem(kSTORECOLUM).then(value => {
165
+ storeColums = value;
166
+ data.columns = getColumns();
167
+ });
168
+
169
+ const data = reactive<VxeGridProps>({
170
+ border: true,
171
+ pagerConfig: { pageSize: attrs.pageSize || 20 },
172
+ editConfig: {},
173
+ editRules: getRules(),
174
+ formConfig: {},
175
+ columnConfig: { useKey: true },
176
+ toolbarConfig: { enabled: false },
177
+ sortConfig: { multiple: true, trigger: 'cell' },
178
+ height: $mode ? undefined : window.innerHeight - 90,
179
+
180
+ checkboxConfig: {
181
+ checkMethod: ({ row }) => onCheckMethod(row, props),
182
+ checkRowKeys: props.checkRowKeys
183
+ },
184
+ loading: false,
185
+ footerRowClassName: 'ut-grid-footer',
186
+ proxyConfig: {
187
+ form: true, // 查询是需要启用表单代理
188
+ autoLoad: props.autoLoad,
189
+ // 接收 Promise
190
+ ajax: {
191
+ queryAll: ({ form }) => queryAll(props, serviceApi, form),
192
+ query: ({ page, form }) => query(props, form, page, serviceApi, $mode),
193
+ delete: ({ body: { removeRecords } }) => del(serviceApi, removeRecords, props),
194
+ save: ({ body }) => Promise.all(save(serviceApi, body, props))
195
+ }
196
+ },
197
+ columns: !attrs.gridId ? getColumns() : [],
198
+ ...attrs
199
+ });
200
+
201
+ /**
202
+ * @description: 预处理查询form
203
+ * @return {*} items
204
+ */
205
+ const getItems = () => {
206
+ if (!props.items.length) return props.items;
207
+ return formatGridItems(clone(props.items, true), viewCode && props.url ? favorite : viewCode);
208
+ };
209
+
210
+ /**
211
+ * @description 格式化column
212
+ * @return {*} columns
213
+ */
214
+ function formatColums(columns) {
215
+ const customSort = storeColums ? storeColums[attrs.gridId] : {};
216
+ if (!customSort) return columns;
217
+ return columns
218
+ .map((col, idx) => {
219
+ const sort = (idx + 1) * 10;
220
+ col._sort = customSort[col.field] || sort;
221
+ // 缓存列索引数据
222
+ cacheColumns[col.field] = col._sort;
223
+ return col;
224
+ })
225
+ .sort((a, b) => a._sort - b._sort);
226
+ }
227
+
228
+ /**
229
+ * @description: 设置grid参数
230
+ */
231
+ const setGridConfig = () => {
232
+ // 查询
233
+ if (props.items.length) {
234
+ // data.formConfig = {};
235
+ data.formConfig = {
236
+ titleWidth: 100,
237
+ titleAlign: 'right',
238
+ items: getItems(),
239
+ rules: formatRules(props.items, t),
240
+ validConfig: { showMessage: false }
241
+ };
242
+ }
243
+ // tool bar
244
+ const obj = getToolBarConfig(data, props, attrs, hasAuthority);
245
+ Object.assign(data, obj);
246
+ // 表格id,用于自定义列
247
+ if (attrs.gridId) {
248
+ data.id = attrs.gridId;
249
+ data.customConfig = {
250
+ storage: true,
251
+ mode: 'popup',
252
+ checkMethod({ column }) {
253
+ return column.field === 'operate' || ['checkbox', 'radio'].includes(column.type) ? false : true;
254
+ },
255
+ modalOptions: {
256
+ width: 750,
257
+ height: '75%'
258
+ }
259
+ };
260
+ }
261
+ if (attrs.mergeFooter) {
262
+ // 合计方法
263
+ data.showFooter = true;
264
+ data.footerMethod = ({ columns, data }) => footerSumMethod({ columns, data }, attrs.mergeFooter);
265
+ }
266
+ };
267
+ /**
268
+ * @description 手动调用查询方法
269
+ */
270
+ const refreshData = () => {
271
+ xgrid.value.commitProxy('query');
272
+ };
273
+ /**
274
+ * @description 刷新列数据
275
+ */
276
+ const refreshColumn = () => {
277
+ data.editRules = getRules();
278
+ return xgrid.value.refreshColumn();
279
+ };
280
+ /**
281
+ * @description 显示加载框
282
+ */
283
+ const showLoading = () => {
284
+ data.loading = true;
285
+ };
286
+ /**
287
+ * @description 隐藏加载框
288
+ */
289
+ const hiddenLoading = () => {
290
+ data.loading = false;
291
+ };
292
+ /**
293
+ * @description 获取实例方法
294
+ * @return vxe-grid实例的方法
295
+ */
296
+ const getInstance = () => {
297
+ return toRaw(xgrid.value);
298
+ };
299
+ /**
300
+ * @description 获取表格全量数据方法
301
+ * @return vxe-grid表格全量数据
302
+ */
303
+ const getTableData = () => {
304
+ return xgrid.value.getTableData().fullData;
305
+ };
306
+ /**
307
+ * @description 获取表格选中的行
308
+ * @return vxe-grid表格勾选行
309
+ */
310
+ const getSelectRecords = (isFull = false) => {
311
+ const columnType = props.columns[0].type;
312
+ const checkRecords =
313
+ columnType === 'radio' ? xgrid.value.getRadioRecord(isFull) : xgrid.value.getCheckboxRecords(isFull);
314
+ if (columnType === 'checkbox' && !checkRecords.length) {
315
+ warnMessage(t('message.tip_selectedRecord'));
316
+ return [];
317
+ } else if (columnType === 'radio' && !checkRecords) {
318
+ warnMessage(t('message.tip_selectedRecord'));
319
+ return null;
320
+ }
321
+ return checkRecords;
322
+ };
323
+
324
+ let sortable2: any;
325
+ const columnDrop = () => {
326
+ const $grid = xgrid.value;
327
+ sortable2 = Sortable.create($grid.$el.querySelector('.vxe-table--header .vxe-header--row'), {
328
+ disabled: !attrs.gridId,
329
+ handle: '.vxe-header--column',
330
+ onEnd: async sortableEvent => {
331
+ const targetThElem = sortableEvent.item;
332
+ const newIndex = sortableEvent.newIndex as number;
333
+ const oldIndex = sortableEvent.oldIndex as number;
334
+ const { fullColumn, tableColumn } = $grid.getTableColumn();
335
+ const wrapperElem = targetThElem.parentNode as HTMLElement;
336
+ const newColumn = fullColumn[newIndex];
337
+ const item = fullColumn[oldIndex];
338
+ let nodrag = false;
339
+ let msg = '固定列';
340
+ if (newColumn.fixed) {
341
+ nodrag = false;
342
+ } else if (newIndex === 0 || ['checkbox', 'radio'].includes(item.type)) {
343
+ msg = '勾选列';
344
+ nodrag = true;
345
+ } else if (item.field === 'operate' || newIndex === fullColumn.length - 1) {
346
+ nodrag = true;
347
+ msg = '操作列';
348
+ }
349
+ if (nodrag) {
350
+ // 错误的移动
351
+ const oldThElem = wrapperElem.children[oldIndex] as HTMLElement;
352
+ if (newIndex > oldIndex) {
353
+ wrapperElem.insertBefore(targetThElem, oldThElem);
354
+ } else {
355
+ wrapperElem.insertBefore(targetThElem, oldThElem ? oldThElem.nextElementSibling : oldThElem);
356
+ }
357
+ return errorMessage(msg + '不允许拖动!');
358
+ }
359
+ // 获取列索引 columnIndex > fullColumn
360
+ const oldColumnIndex = $grid.getColumnIndex(tableColumn[oldIndex]);
361
+ const newColumnIndex = $grid.getColumnIndex(tableColumn[newIndex]);
362
+ // 移动到目标列
363
+ const currRow = fullColumn.splice(oldColumnIndex, 1)[0];
364
+ fullColumn.splice(newColumnIndex, 0, currRow);
365
+
366
+ // 拖拽方向 1: 右 -1: 左
367
+ const direction = newColumnIndex - oldColumnIndex > 0 ? 1 : -1;
368
+
369
+ // 获取新列
370
+ const newSort = (newColumnIndex + 1) * 10;
371
+ const oldSort = (oldColumnIndex + 1) * 10;
372
+ // 目标列索引+1,方便后续计算
373
+ const comparisonVal = newSort + 1 * direction;
374
+ for (const key in cacheColumns) {
375
+ const cacheValue = cacheColumns[key];
376
+ if (direction > 0 && cacheValue < comparisonVal && cacheValue > oldSort) {
377
+ // 大于拖拽列且小于目标列的索引,均向前移动一个单位
378
+ cacheColumns[key] = cacheValue - 10 * direction;
379
+ } else if (direction < 0 && cacheValue > comparisonVal && cacheValue < oldSort) {
380
+ // 小于拖拽列且大于目标列的索引, 均向后移动一个单位
381
+ cacheColumns[key] = cacheValue - 10 * direction;
382
+ }
383
+ }
384
+
385
+ cacheColumns[currRow.field] = newSort;
386
+
387
+ dbstorage.setItem(kSTORECOLUM, { [attrs.gridId]: cacheColumns });
388
+ $grid.loadColumn(fullColumn);
389
+ }
390
+ });
391
+ };
392
+
393
+ /**
394
+ * @description 常用查询面板确认查询
395
+ * @param data 常用查询条件
396
+ */
397
+ const onSearch = data => {
398
+ showModal.value = false;
399
+ const { form } = xgrid.value.getProxyInfo();
400
+ Object.assign(form, data);
401
+ refreshData();
402
+ };
403
+
404
+ /**
405
+ * @description Vue实例对外暴露的相关方法或属性
406
+ */
407
+ defineExpose({
408
+ getTableData,
409
+ getSelectRecords,
410
+ refreshData,
411
+ refreshColumn,
412
+ getInstance,
413
+ showLoading,
414
+ hiddenLoading
415
+ });
416
+
417
+ const toolbarButtonClick = ({ code }) => {
418
+ emit('buttonClick', code);
419
+ };
420
+ const cellClick = e => {
421
+ emit('cellClick', e);
422
+ };
423
+ const cellDbclick = e => {
424
+ emit('cellDbclick', e);
425
+ };
426
+ const editEctivated = e => {
427
+ emit('editEctivated', e);
428
+ };
429
+
430
+ /**
431
+ * @description: 监听窗口变化,动态改变表格的高度
432
+ */
433
+ const addResizeListener = () => {
434
+ window.onresize = () => {
435
+ return (() => {
436
+ console.log('onresize');
437
+ let height = attrs?.height || window.innerHeight - 90 - 1;
438
+ if (attrs?.mode === 'form' && !attrs?.height) {
439
+ height = window.innerHeight - 180;
440
+ }
441
+ data.height = height < 240 ? 240 : height;
442
+ console.log(data.height);
443
+ })();
444
+ };
445
+ };
446
+
447
+ let initTime: any;
448
+ nextTick(() => {
449
+ // 加载完成之后在绑定拖动事件
450
+ initTime = setTimeout(() => {
451
+ columnDrop();
452
+ }, 500);
453
+ });
454
+
455
+ /**
456
+ * @description Vue实例卸载
457
+ */
458
+ onUnmounted(() => {
459
+ clearTimeout(initTime);
460
+ sortable2 && sortable2.destroy();
461
+ });
462
+ /**
463
+ * @description Vue实例挂载
464
+ */
465
+ onBeforeMount(() => {
466
+ setGridConfig();
467
+ addResizeListener();
468
+ });
469
+
470
+ const emit = defineEmits<{
471
+ (e: 'buttonClick', code: string): void;
472
+ (e: 'cellClick', data: any): void;
473
+ (e: 'cellDbclick', data: any): void;
474
+ (e: 'editEctivated', data: any): void;
475
+ }>();
476
+ </script>
477
+
478
+ <style lang="scss">
479
+ .ut-grid-wrapper {
480
+ padding: 5px;
481
+ background-color: #fff;
482
+
483
+ .vxe-form--item {
484
+ padding: 0.1em 0.8em 0.1em 0 !important;
485
+
486
+ .el-select {
487
+ .el-input {
488
+ height: 26px;
489
+ }
490
+
491
+ .el-select__tags-text {
492
+ color: #000;
493
+ }
494
+ }
495
+ }
496
+ .vxe-grid--layout-body-content-wrapper {
497
+ overflow: hidden;
498
+ }
499
+ }
500
+ </style>
@@ -1,4 +1,7 @@
1
- import UtModalForm2 from './modal-form.vue';
2
- import FormUpload2 from './form-upload.vue';
3
-
4
- export { UtModalForm2, FormUpload2 };
1
+ import UtModalForm2 from './modal-form.vue';
2
+ import FormUpload2 from './form-upload.vue';
3
+ import utLov2 from './lov.vue';
4
+ import UtModalGrid2 from './modal-grid.vue';
5
+ import UtGrid2 from './grid.vue';
6
+
7
+ export { UtGrid2, UtModalForm2, FormUpload2, utLov2, UtModalGrid2 };