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

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 (67) hide show
  1. package/dist/{403-C3cfjZIT.js → 403-C51tdhmt.js} +1 -1
  2. package/dist/{404-Bg3j7QIo.js → 404-BByVDQt1.js} +1 -1
  3. package/dist/{500-CMT7Zyy7.js → 500-7ORBeYFO.js} +1 -1
  4. package/dist/{AuthorityInfo-B1mvqs4x.js → AuthorityInfo-DY7tBtIJ.js} +1 -1
  5. package/dist/{AuthorityInfo.vue_vue_type_style_index_0_lang-DwoW7QWO.js → AuthorityInfo.vue_vue_type_style_index_0_lang-BT01DOcF.js} +1 -1
  6. package/dist/{Company-qTguidK8.js → Company-TVbO7O8P.js} +3 -3
  7. package/dist/{CompanyPanel-BBC-o-k3.js → CompanyPanel-N-PeCcNB.js} +1 -1
  8. package/dist/{Department-C3mKZOnK.js → Department-C79u9m-f.js} +3 -3
  9. package/dist/{DepartmentPanel-CNdpOHBT.js → DepartmentPanel-ZpnYDs3e.js} +1 -1
  10. package/dist/{DesignPanel-D9jrRCoG.js → DesignPanel-BxI3zPN_.js} +1 -1
  11. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-A-Aj1Hl0.js → DesignPanel.vue_vue_type_style_index_0_lang-DHELuSCq.js} +2 -2
  12. package/dist/{DictView-CgdVkSiP.js → DictView-DF3Phr1W.js} +1 -1
  13. package/dist/{InvOrganization-RE7s3vBq.js → InvOrganization-WQjThPxn.js} +1 -1
  14. package/dist/{Org-wXDGvTrS.js → Org-Ch94yoN_.js} +1 -1
  15. package/dist/{Preview-Pvt1__BV.js → Preview-B5e7Wyfg.js} +1 -1
  16. package/dist/{ReportDefine-xEQsgFyv.js → ReportDefine-xX0u4LRA.js} +1 -1
  17. package/dist/{ReportDesign-jOSuEFH9.js → ReportDesign-D6zIzSrj.js} +2 -2
  18. package/dist/{ReportQuery-DxEmmGiN.js → ReportQuery-BGYxIKDS.js} +1 -1
  19. package/dist/{ReportQueryFrom-CFlxfS5M.js → ReportQueryFrom-JwjZHl6o.js} +1 -1
  20. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-iHpiYz8f.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-C7h3sKzB.js} +1 -1
  21. package/dist/{ReportTemplate-Dtz3aet7.js → ReportTemplate-BsQwvhgm.js} +1 -1
  22. package/dist/{Role-B_NsHIyE.js → Role-tkz-56_k.js} +3 -3
  23. package/dist/{RoleAssign-C9wm4zq4.js → RoleAssign-YNrcN3gm.js} +3 -3
  24. package/dist/{RolePanel-DWM9mfNs.js → RolePanel-DKEctaEH.js} +1 -1
  25. package/dist/{RolePanel-BlHidBR0.js → RolePanel-DiVzlfn9.js} +1 -1
  26. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-Cn4RRzXm.js → RolePanel.vue_vue_type_script_setup_true_lang-BnT-CeUj.js} +1 -1
  27. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-DVQ9aqb1.js → RolePanel.vue_vue_type_script_setup_true_lang-CnzSFrJN.js} +3 -3
  28. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-CCm-_i8O.js → ScrollPanel.vue_vue_type_style_index_0_lang-BFaW8w6H.js} +1 -1
  29. package/dist/{Staff-BfDc61QS.js → Staff-BchwlV9r.js} +3 -3
  30. package/dist/{StaffInfo-BaJFo4mg.js → StaffInfo-BLH_CKQp.js} +1 -1
  31. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-Bwj4x1wu.js → StaffInfo.vue_vue_type_script_setup_true_lang-BO8TrkGX.js} +1 -1
  32. package/dist/{StaffPanel-B6I2ZS6A.js → StaffPanel-DmG_sNea.js} +1 -1
  33. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-vbyS4w3V.js → StaffPanel.vue_vue_type_script_setup_true_lang-DwLF19H9.js} +2 -2
  34. package/dist/{SysUser-B_r9LYc5.js → SysUser-C3Jxo9WW.js} +2 -2
  35. package/dist/{SysUserPanel-C4ajcHPV.js → SysUserPanel-DAmlNNIy.js} +1 -1
  36. package/dist/{SysUserPanel.vue_vue_type_script_setup_true_lang-8Q0VvC9B.js → SysUserPanel.vue_vue_type_script_setup_true_lang-D9DsstB9.js} +1 -1
  37. package/dist/{SystemMenu-CyPG23uP.js → SystemMenu-TNL4VAjV.js} +2 -2
  38. package/dist/{UserInfo-BkoGt4ib.js → UserInfo-C3bI8rIG.js} +1 -1
  39. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-DrzF1YYG.js → UserInfo.vue_vue_type_style_index_0_lang-Doej66qn.js} +1 -1
  40. package/dist/{childView-9vEO8ymO.js → childView-C7LhTUtY.js} +1 -1
  41. package/dist/{childView-Dh0NyiQe.js → childView-CsTG3EEp.js} +1 -1
  42. package/dist/{childView.vue_vue_type_style_index_0_lang-CMOjfXBX.js → childView.vue_vue_type_style_index_0_lang-B8TeM5HG.js} +1 -1
  43. package/dist/{childView.vue_vue_type_style_index_0_lang-BOeoZuAK.js → childView.vue_vue_type_style_index_0_lang-CvqVgQMY.js} +1 -1
  44. package/dist/{code-rule-C7jI_1gJ.js → code-rule-CYnZutyQ.js} +1 -1
  45. package/dist/core.es.js +1 -1
  46. package/dist/{cron-task-Dg9DJXvv.js → cron-task-DqmjbuDy.js} +1 -1
  47. package/dist/{frameView-CeR-_hjB.js → frameView-CEcc6JS1.js} +1 -1
  48. package/dist/index-z7WdmYMo.js +4545 -0
  49. package/dist/{layoutView-wsLHrEeX.js → layoutView-f2Xn_Oky.js} +2 -2
  50. package/dist/{login-CluzzdqH.js → login-Cz2nPCZV.js} +1 -1
  51. package/dist/{lov-view-BvQCvwbW.js → lov-view-bgIXESV-.js} +2 -2
  52. package/dist/{menuInfo-B8RLelIC.js → menuInfo-WMKWDhUi.js} +1 -1
  53. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-DvkapEZr.js → menuInfo.vue_vue_type_style_index_0_lang-DMLExCay.js} +1 -1
  54. package/dist/{pda-app-D3LNmD9a.js → pda-app-Bz21omEU.js} +1 -1
  55. package/dist/{resource-D8JA_03-.js → resource-CcfcVL4f.js} +1 -1
  56. package/dist/{su-welcome-BjxeEKSo.js → su-welcome-Db9XAwan.js} +1 -1
  57. package/dist/{sys-config-sbeLk9bP.js → sys-config-CN_RSr8E.js} +1 -1
  58. package/dist/udp-core.css +1 -1
  59. package/package.json +1 -1
  60. package/src/components/udp/grid/index.vue +13 -2
  61. package/src/components/udp/utils.ts +7 -5
  62. package/src/layout/components/lay-sidebar/sidebar-logo.vue +93 -92
  63. package/src/main.ts +18 -18
  64. package/src/plugins/vxe-table/index.ts +116 -116
  65. package/src/plugins/vxe-table/render.tsx +945 -956
  66. package/src/style/vxetable.scss +339 -331
  67. package/dist/index-Bb7gIEvu.js +0 -2864
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.17",
4
+ "version": "1.0.1-beta.19",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "main1": "index.ts",
@@ -2,7 +2,7 @@
2
2
  * @Author: wei.li
3
3
  * @Date: 2021-11-17 16:33:37
4
4
  * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-10-18 15:18:16
5
+ * @LastEditTime: 2025-10-29 17:55:12
6
6
  * @Description: file content
7
7
  -->
8
8
  <template>
@@ -17,6 +17,7 @@
17
17
  @cell-click="cellClick"
18
18
  @cell-dblclick="cellDbclick"
19
19
  @edit-activated="editEctivated"
20
+ @form-reset="onReset"
20
21
  />
21
22
  <!-- <SearchScheme
22
23
  v-if="showModal && props.url"
@@ -174,7 +175,7 @@ const data = reactive<VxeGridProps>({
174
175
  // 接收 Promise
175
176
  ajax: {
176
177
  queryAll: ({ form }) => queryAll(props, serviceApi, form),
177
- query: ({ page, form }) => query(props, form, page, serviceApi, $mode),
178
+ query: ({ page, form, code }) => query(props, form, page, serviceApi, code, $mode),
178
179
  delete: ({ body: { removeRecords } }) => del(serviceApi, removeRecords, props),
179
180
  save: ({ body }) => Promise.all(save(serviceApi, body, props)),
180
181
  querySuccess: ({ response }) => callback('querySuccess', response),
@@ -316,6 +317,16 @@ const callback = (cb, response) => {
316
317
  attrs?.callback && attrs?.callback[cb] && attrs?.callback[cb](response);
317
318
  };
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
+
319
330
  let sortable2: any;
320
331
  const columnDrop = () => {
321
332
  const $grid = xgrid.value;
@@ -2,7 +2,7 @@
2
2
  * @Author: wei.li
3
3
  * @Date: 2022-06-23 17:29:11
4
4
  * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-10-18 11:53:47
5
+ * @LastEditTime: 2025-10-29 18:04:53
6
6
  * @Description: file content
7
7
  */
8
8
  // @ts-nocheck
@@ -70,7 +70,7 @@ export const queryAll = (props, http, form) => {
70
70
  * @param isDoc doc文档
71
71
  * @returns Promise
72
72
  */
73
- export const query = (props, form, page, http, isDoc) => {
73
+ export const query = (props, form, page, http, code, isDoc) => {
74
74
  if (isDoc) return getDocData();
75
75
  for (const key in form) {
76
76
  if (form[key] && isString(form[key])) {
@@ -80,7 +80,8 @@ export const query = (props, form, page, http, isDoc) => {
80
80
  const params = { pageNum: page.currentPage, pageSize: page.pageSize };
81
81
  const commonParam = getCookieParam();
82
82
  Object.assign(params, commonParam, props.defaultParams || {}, form);
83
- let query = formatMultipleParams(params, props.items);
83
+
84
+ let query = formatMultipleParams(params, props.items, form);
84
85
  query = formatDateRange(query, props.items);
85
86
  const { url } = props;
86
87
  if (!url) return null;
@@ -140,12 +141,13 @@ export const save = (http, body, props) => {
140
141
  */
141
142
  const formatMultipleParams = (listQuery: any, items) => {
142
143
  const multipleItems = items.filter(f => f.itemRender?.props?.multiple || f.multiple);
144
+ debugger;
143
145
  if (isEmpty(multipleItems)) return listQuery;
144
146
  const query = clone(listQuery, true);
145
147
  multipleItems.forEach((element: any) => {
146
148
  if (element.itemRender.name === '#select') {
147
- const data = query[`_${element.field}`] || query[`${element.field}`];
148
- query[element.field] = !isString(data) ? data?.join(',') : data;
149
+ // const data = query[`_${element.field}`] || query[`${element.field}`];
150
+ // query[element.field] = !isString(data) ? data?.join(',') : data;
149
151
  delete query[`_${element.field}`];
150
152
  }
151
153
  });
@@ -1,92 +1,93 @@
1
- <!--
2
- * @Author: wei.li
3
- * @Date: 2021-11-17 16:02:30
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-04-17 17:15:15
6
- * @Description: file content
7
- -->
8
- <script setup lang="ts">
9
- import { ref } from 'vue';
10
- import { storageLocal } from '@utogether/utils';
11
- import { kSYSCONFIG } from '../../../contant';
12
- import utogether from '../../../assets/images/utogether.png';
13
-
14
- const props = defineProps({
15
- collapse: Boolean
16
- });
17
-
18
- const sysConfig = storageLocal.getItem(kSYSCONFIG) || {};
19
-
20
- const title = sysConfig['title'];
21
- const logo = ref(sysConfig['logo'] || utogether);
22
- // console.log(logo);
23
- </script>
24
-
25
- <template>
26
- <div class="sidebar-logo-container" :class="{ collapses: props.collapse }">
27
- <transition name="sidebarLogoFade">
28
- <router-link v-if="props.collapse" key="props.collapse" :title="title" class="sidebar-logo-link" to="/">
29
- <img :src="logo" class="ut-collapse-img ut-sidebar-logo" />
30
- </router-link>
31
- <router-link v-else key="expand" :title="title" class="sidebar-logo-link" to="/">
32
- <img :src="logo" class="ut-sidebar-logo h-10" />
33
- <span class="sidebar-title">{{ title }}</span>
34
- </router-link>
35
- </transition>
36
- </div>
37
- </template>
38
-
39
- <style lang="scss" scoped>
40
- .sidebar-logo-container {
41
- position: relative;
42
- width: 100%;
43
- height: 48px;
44
- overflow: hidden;
45
- text-align: center;
46
- background-color: var(--udp-theme-sidebar-logo);
47
-
48
- .sidebar-logo-link {
49
- // margin-top: 5px;
50
- display: flex;
51
- flex-direction: column;
52
- height: 100%;
53
- overflow: hidden;
54
- text-overflow: ellipsis;
55
- white-space: nowrap;
56
-
57
- .ut-sidebar-logo {
58
- height: 100%;
59
- }
60
-
61
- .ut-collapse-img {
62
- width: 100%;
63
- }
64
-
65
- .sidebar-title {
66
- display: block;
67
- // width: 140px;
68
- // margin-top: 10px;
69
- margin-left: 10px;
70
- overflow: hidden;
71
- text-overflow: ellipsis;
72
- font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif;
73
- font-size: 24px;
74
- font-weight: 600;
75
- color: var(--udp-theme-project-text);
76
- text-align: left;
77
- white-space: nowrap;
78
- }
79
- }
80
-
81
- .collapses {
82
- .sidebar-logo {
83
- margin-right: 0;
84
- }
85
- }
86
-
87
- svg {
88
- width: 50px;
89
- height: 50px;
90
- }
91
- }
92
- </style>
1
+ <!--
2
+ * @Author: wei.li
3
+ * @Date: 2021-11-17 16:02:30
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-04-17 17:15:15
6
+ * @Description: file content
7
+ -->
8
+ <script setup lang="ts">
9
+ import { ref } from 'vue';
10
+ import { storageLocal } from '@utogether/utils';
11
+ import { kSYSCONFIG } from '../../../contant';
12
+ import utogether from '../../../assets/images/utogether.png';
13
+
14
+ const props = defineProps({
15
+ collapse: Boolean
16
+ });
17
+
18
+ const sysConfig = storageLocal.getItem(kSYSCONFIG) || {};
19
+
20
+ const title = sysConfig['title'];
21
+ const logo = ref(sysConfig['logo'] || utogether);
22
+ // console.log(logo);
23
+ </script>
24
+
25
+ <template>
26
+ <div class="sidebar-logo-container" :class="{ collapses: props.collapse }">
27
+ <transition name="sidebarLogoFade">
28
+ <router-link v-if="props.collapse" key="props.collapse" :title="title" class="sidebar-logo-link" to="/">
29
+ <img :src="logo" class="ut-collapse-img ut-sidebar-logo" />
30
+ </router-link>
31
+ <router-link v-else key="expand" :title="title" class="sidebar-logo-link" to="/">
32
+ <img :src="logo" class="ut-sidebar-logo h-10" />
33
+ <span class="sidebar-title">{{ title }}</span>
34
+ </router-link>
35
+ </transition>
36
+ </div>
37
+ </template>
38
+
39
+ <style lang="scss" scoped>
40
+ .sidebar-logo-container {
41
+ position: relative;
42
+ width: 100%;
43
+ height: 48px;
44
+ overflow: hidden;
45
+ text-align: center;
46
+ background-color: var(--udp-theme-sidebar-logo);
47
+
48
+ .sidebar-logo-link {
49
+ // margin-top: 5px;
50
+ display: flex;
51
+ flex-direction: column;
52
+ height: 100%;
53
+ overflow: hidden;
54
+ text-overflow: ellipsis;
55
+ white-space: nowrap;
56
+
57
+ .ut-sidebar-logo {
58
+ max-width: 67%;
59
+ height: 100%;
60
+ }
61
+
62
+ .ut-collapse-img {
63
+ width: 100%;
64
+ }
65
+
66
+ .sidebar-title {
67
+ display: block;
68
+ // width: 140px;
69
+ // margin-top: 10px;
70
+ margin-left: 10px;
71
+ overflow: hidden;
72
+ text-overflow: ellipsis;
73
+ font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif;
74
+ font-size: 24px;
75
+ font-weight: 600;
76
+ color: var(--udp-theme-project-text);
77
+ text-align: left;
78
+ white-space: nowrap;
79
+ }
80
+ }
81
+
82
+ .collapses {
83
+ .sidebar-logo {
84
+ margin-right: 0;
85
+ }
86
+ }
87
+
88
+ svg {
89
+ width: 50px;
90
+ height: 50px;
91
+ }
92
+ }
93
+ </style>
package/src/main.ts CHANGED
@@ -32,23 +32,23 @@ import './style/index.scss';
32
32
 
33
33
  // import SuTable from './components/SuTable/SuTable.vue';
34
34
 
35
- // import {
36
- // UtButton,
37
- // utLov2,
38
- // UGrid,
39
- // UtDivider,
40
- // UtModalForm2
41
- // FormUpload2,
42
- // UtForm2
43
- // UtGrid2
44
- // UtContent2,
45
- // UtStampBadge2
46
- // UtModalGrid2
47
- // UtUpload2
48
- // UtIconSelect,
49
- // UtCalendar
50
- // uAttachment
51
- // } from './components/udp';
35
+ import {
36
+ // UtButton,
37
+ // utLov2,
38
+ // UGrid,
39
+ // UtDivider,
40
+ // UtModalForm2
41
+ // FormUpload2,
42
+ // UtForm2
43
+ UtGrid2
44
+ // UtContent2,
45
+ // UtStampBadge2
46
+ // UtModalGrid2
47
+ // UtUpload2
48
+ // UtIconSelect,
49
+ // UtCalendar
50
+ // uAttachment
51
+ } from './components/udp';
52
52
 
53
53
  const app = createApp(App);
54
54
 
@@ -93,7 +93,7 @@ const init = ({ router, config, lang, views, env, tableConfig }) => {
93
93
  // app.component('uAttachment', uAttachment).component('UGrid', UGrid);
94
94
  // .component('UtDivider', UtDivider)
95
95
  // app.component('UtModalForm2', UtModalForm2);
96
- // app.component('UtGrid2', UtGrid2);
96
+ app.component('UtGrid2', UtGrid2);
97
97
  // app.component('UtForm2', UtForm2);
98
98
  // app.component('UtModalGrid2', UtModalGrid2);
99
99
  // .component('UtIconSelect', UtIconSelect)
@@ -1,116 +1,116 @@
1
- /*
2
- * @Author: levi7754 levi7754@163.com
3
- * @Date: 2024-06-05 14:32:03
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-09-17 18:45:35
6
- * @FilePath: /udp-front/packages/udp-core/src/plugins/vxe-table/index.ts
7
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
- */
9
- import 'xe-utils';
10
- import { merge, toDateString, getWhatDay } from 'xe-utils';
11
- import { geti18n, transformI18n } from '../i18n/index';
12
- // import { storageLocal } from '@utogether/utils';
13
- import { VxetableRender } from '@utogether/utils';
14
- // import { VxetableRender } from './render';
15
- import { getServiceApi } from '../../api';
16
-
17
- import VXETable, { VxeUI } from 'vxe-table';
18
- // import './render.tsx';
19
-
20
- // const dict = storageLocal.getItem('kLov');
21
- VxetableRender(VXETable, { serviceApi: getServiceApi(), i18n: transformI18n });
22
- setCommands();
23
-
24
- // 全局默认参数
25
- const defaultConfig = {
26
- // 对组件内置的提示语进行国际化翻译
27
- // @ts-ignore
28
- i18n: (key, args) => geti18n().global.t(key, args),
29
- // 可选,对参数中的列头、校验提示..等进行自动翻译(只对支持国际化的有效)
30
- translate(key) {
31
- // 例如,只翻译 "message." 开头的键值
32
- const NAMESPACED = ['message.', 'el.'];
33
- if (key && NAMESPACED.findIndex(v => key.includes(v)) !== -1) {
34
- return geti18n().global.t.call(geti18n().global.locale, key);
35
- }
36
- return key;
37
- }
38
- };
39
-
40
- export function setTableConfig(config = {}) {
41
- VXETable.setConfig(merge(defaultConfig, config));
42
-
43
- VxeUI.interceptor.add('event.clearEdit', {
44
- tableInterceptorMethod(params) {
45
- const { $event } = params;
46
- if ($event.target.className.indexOf('vxe-table--ignore-clear') > -1) return false;
47
- }
48
- });
49
- }
50
-
51
- export function setTheme(theme) {
52
- // 切换为暗黑主题
53
- VxeUI.setTheme(theme);
54
- }
55
-
56
- function setCommands() {
57
- // 定义选中日期今天指令
58
- VxeUI.commands.add('utTodyay', {
59
- dateRangePickerCommandMethod({ $dateRangePicker }) {
60
- const startDate = toDateString(new Date(), 'yyyy-MM-dd 00:00:00');
61
- const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
62
- $dateRangePicker.setModelValue(startDate, endDate);
63
- }
64
- });
65
- // 定义选中日期昨天指令
66
- VxeUI.commands.add('utYesterDay', {
67
- dateRangePickerCommandMethod({ $dateRangePicker }) {
68
- const startDate = toDateString(getWhatDay(new Date(), -1), 'yyyy-MM-dd 00:00:00');
69
- const endDate = toDateString(getWhatDay(new Date(), -1), 'yyyy-MM-dd 23:59:59');
70
- $dateRangePicker.setModelValue(startDate, endDate);
71
- }
72
- });
73
- // 定义选中日期最近一周指令
74
- VxeUI.commands.add('utRecentWeek', {
75
- dateRangePickerCommandMethod({ $dateRangePicker }) {
76
- const startDate = toDateString(getWhatDay(new Date(), -7), 'yyyy-MM-dd 00:00:00');
77
- const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
78
- $dateRangePicker.setModelValue(startDate, endDate);
79
- }
80
- });
81
-
82
- // 定义选中日期最近一个月指令
83
- VxeUI.commands.add('utRecentMonth', {
84
- dateRangePickerCommandMethod({ $dateRangePicker }) {
85
- const startDate = toDateString(getWhatDay(new Date(), -30), 'yyyy-MM-dd 00:00:00');
86
- const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
87
- $dateRangePicker.setModelValue(startDate, endDate);
88
- }
89
- });
90
-
91
- // 定义选中日期最近三个月指令
92
- VxeUI.commands.add('utRecentThreeMonth', {
93
- dateRangePickerCommandMethod({ $dateRangePicker }) {
94
- const startDate = toDateString(getWhatDay(new Date(), -90), 'yyyy-MM-dd 00:00:00');
95
- const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
96
- $dateRangePicker.setModelValue(startDate, endDate);
97
- }
98
- });
99
-
100
- // 定义选中日期最近半年指令
101
- VxeUI.commands.add('utRecentHalfYear', {
102
- dateRangePickerCommandMethod({ $dateRangePicker }) {
103
- const startDate = toDateString(getWhatDay(new Date(), -180), 'yyyy-MM-dd 00:00:00');
104
- const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
105
- $dateRangePicker.setModelValue(startDate, endDate);
106
- }
107
- });
108
- // 定义选中日期最近半年指令
109
- VxeUI.commands.add('utRecentYear', {
110
- dateRangePickerCommandMethod({ $dateRangePicker }) {
111
- const startDate = toDateString(getWhatDay(new Date(), -365), 'yyyy-MM-dd 00:00:00');
112
- const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
113
- $dateRangePicker.setModelValue(startDate, endDate);
114
- }
115
- });
116
- }
1
+ /*
2
+ * @Author: levi7754 levi7754@163.com
3
+ * @Date: 2024-06-05 14:32:03
4
+ * @LastEditors: levi7754 levi7754@163.com
5
+ * @LastEditTime: 2025-10-30 08:54:16
6
+ * @FilePath: /udp-front/packages/udp-core/src/plugins/vxe-table/index.ts
7
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
+ */
9
+ import 'xe-utils';
10
+ import { merge, toDateString, getWhatDay } from 'xe-utils';
11
+ import { geti18n, transformI18n } from '../i18n/index';
12
+ // import { storageLocal } from '@utogether/utils';
13
+ import { VxetableRender } from '@utogether/utils';
14
+ // import { VxetableRender } from './render';
15
+ import { getServiceApi } from '../../api';
16
+
17
+ import VXETable, { VxeUI } from 'vxe-table';
18
+ // import './render.tsx';
19
+
20
+ // const dict = storageLocal.getItem('kLov');
21
+ VxetableRender(VXETable, { serviceApi: getServiceApi(), i18n: transformI18n });
22
+ setCommands();
23
+
24
+ // 全局默认参数
25
+ const defaultConfig = {
26
+ // 对组件内置的提示语进行国际化翻译
27
+ // @ts-ignore
28
+ i18n: (key, args) => geti18n().global.t(key, args),
29
+ // 可选,对参数中的列头、校验提示..等进行自动翻译(只对支持国际化的有效)
30
+ translate(key) {
31
+ // 例如,只翻译 "message." 开头的键值
32
+ const NAMESPACED = ['message.', 'el.'];
33
+ if (key && NAMESPACED.findIndex(v => key.includes(v)) !== -1) {
34
+ return geti18n().global.t.call(geti18n().global.locale, key);
35
+ }
36
+ return key;
37
+ }
38
+ };
39
+
40
+ export function setTableConfig(config = {}) {
41
+ VXETable.setConfig(merge(defaultConfig, config));
42
+
43
+ VxeUI.interceptor.add('event.clearEdit', {
44
+ tableInterceptorMethod(params) {
45
+ const { $event } = params;
46
+ if ($event.target.className.indexOf('vxe-table--ignore-clear') > -1) return false;
47
+ }
48
+ });
49
+ }
50
+
51
+ export function setTheme(theme) {
52
+ // 切换为暗黑主题
53
+ VxeUI.setTheme(theme);
54
+ }
55
+
56
+ function setCommands() {
57
+ // 定义选中日期今天指令
58
+ VxeUI.commands.add('utTodyay', {
59
+ dateRangePickerCommandMethod({ $dateRangePicker }) {
60
+ const startDate = toDateString(new Date(), 'yyyy-MM-dd 00:00:00');
61
+ const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
62
+ $dateRangePicker.setModelValue(startDate, endDate);
63
+ }
64
+ });
65
+ // 定义选中日期昨天指令
66
+ VxeUI.commands.add('utYesterDay', {
67
+ dateRangePickerCommandMethod({ $dateRangePicker }) {
68
+ const startDate = toDateString(getWhatDay(new Date(), -1), 'yyyy-MM-dd 00:00:00');
69
+ const endDate = toDateString(getWhatDay(new Date(), -1), 'yyyy-MM-dd 23:59:59');
70
+ $dateRangePicker.setModelValue(startDate, endDate);
71
+ }
72
+ });
73
+ // 定义选中日期最近一周指令
74
+ VxeUI.commands.add('utRecentWeek', {
75
+ dateRangePickerCommandMethod({ $dateRangePicker }) {
76
+ const startDate = toDateString(getWhatDay(new Date(), -7), 'yyyy-MM-dd 00:00:00');
77
+ const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
78
+ $dateRangePicker.setModelValue(startDate, endDate);
79
+ }
80
+ });
81
+
82
+ // 定义选中日期最近一个月指令
83
+ VxeUI.commands.add('utRecentMonth', {
84
+ dateRangePickerCommandMethod({ $dateRangePicker }) {
85
+ const startDate = toDateString(getWhatDay(new Date(), -30), 'yyyy-MM-dd 00:00:00');
86
+ const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
87
+ $dateRangePicker.setModelValue(startDate, endDate);
88
+ }
89
+ });
90
+
91
+ // 定义选中日期最近三个月指令
92
+ VxeUI.commands.add('utRecentThreeMonth', {
93
+ dateRangePickerCommandMethod({ $dateRangePicker }) {
94
+ const startDate = toDateString(getWhatDay(new Date(), -90), 'yyyy-MM-dd 00:00:00');
95
+ const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
96
+ $dateRangePicker.setModelValue(startDate, endDate);
97
+ }
98
+ });
99
+
100
+ // 定义选中日期最近半年指令
101
+ VxeUI.commands.add('utRecentHalfYear', {
102
+ dateRangePickerCommandMethod({ $dateRangePicker }) {
103
+ const startDate = toDateString(getWhatDay(new Date(), -180), 'yyyy-MM-dd 00:00:00');
104
+ const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
105
+ $dateRangePicker.setModelValue(startDate, endDate);
106
+ }
107
+ });
108
+ // 定义选中日期最近半年指令
109
+ VxeUI.commands.add('utRecentYear', {
110
+ dateRangePickerCommandMethod({ $dateRangePicker }) {
111
+ const startDate = toDateString(getWhatDay(new Date(), -365), 'yyyy-MM-dd 00:00:00');
112
+ const endDate = toDateString(new Date(), 'yyyy-MM-dd 23:59:59');
113
+ $dateRangePicker.setModelValue(startDate, endDate);
114
+ }
115
+ });
116
+ }