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

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 (165) hide show
  1. package/build/plugins.ts +3 -3
  2. package/dist/{403-BuP9jvH9.js → 403-DdjDWbkf.js} +1 -1
  3. package/dist/{404-DfQk8kKl.js → 404-D9vF2gFz.js} +1 -1
  4. package/dist/{500-OgROWdiZ.js → 500-mVaDmUjL.js} +1 -1
  5. package/dist/{AuthorityInfo-q2ksfkWH.js → AuthorityInfo-DOUJ_Zrj.js} +1 -1
  6. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-B12sAzqt.js +100 -0
  7. package/dist/{Company-DgqowAxc.js → Company-DY__kM9F.js} +3 -3
  8. package/dist/{CompanyPanel-BNb1rUhD.js → CompanyPanel-C5N8QcMA.js} +17 -17
  9. package/dist/{Department-Cl8CROSU.js → Department-DsuDZdy5.js} +3 -3
  10. package/dist/{DepartmentPanel-D5VkqKeP.js → DepartmentPanel-CdwI7Rzu.js} +25 -25
  11. package/dist/{DesignPanel-BGvEusHC.js → DesignPanel-B50-g0TL.js} +1 -1
  12. package/dist/{DesignPanel.vue_vue_type_style_index_0_lang-BQF1uQ7w.js → DesignPanel.vue_vue_type_style_index_0_lang-KV8JOZ6v.js} +28 -30
  13. package/dist/DictView-Be2Z5Obk.js +110 -0
  14. package/dist/InvOrganization-Lui1q3Ou.js +74 -0
  15. package/dist/Org-qO5ExsPN.js +39 -0
  16. package/dist/{Preview-BaGmXH7r.js → Preview-Dq4dfV2D.js} +2 -2
  17. package/dist/{ReportDefine-DkQdBErt.js → ReportDefine-DH3FvbS1.js} +1 -1
  18. package/dist/{ReportDesign-DzB_A_G6.js → ReportDesign-Bou01Jbr.js} +43 -43
  19. package/dist/{ReportQuery-DRcMb6ya.js → ReportQuery-BBkmPPSw.js} +1 -1
  20. package/dist/{ReportQueryFrom-CeA9xhR4.js → ReportQueryFrom-BCY8lTJ7.js} +1 -1
  21. package/dist/{ReportQueryFrom.vue_vue_type_style_index_0_lang-CgGtcs5V.js → ReportQueryFrom.vue_vue_type_style_index_0_lang-CpktcM8J.js} +1 -1
  22. package/dist/{ReportTemplate-qaiTMQuT.js → ReportTemplate-C_yJXxQ-.js} +28 -28
  23. package/dist/{Role-DsFulAjq.js → Role-CTatYsrC.js} +6 -6
  24. package/dist/{RoleAssign-DMRdocpa.js → RoleAssign-Cqt3CelK.js} +9 -9
  25. package/dist/{RolePanel-wXVysDHM.js → RolePanel-C3JMpNu8.js} +1 -1
  26. package/dist/{RolePanel-B9POS_pg.js → RolePanel-brKRJIhD.js} +1 -1
  27. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-DD8u9pq8.js +132 -0
  28. package/dist/{RolePanel.vue_vue_type_script_setup_true_lang-CleVvkcY.js → RolePanel.vue_vue_type_script_setup_true_lang-i6Gq4r5B.js} +44 -38
  29. package/dist/{ScrollPanel.vue_vue_type_style_index_0_lang-DlXUs0j9.js → ScrollPanel.vue_vue_type_style_index_0_lang-CiWKyjm3.js} +23 -23
  30. package/dist/{Staff-Cq4V7ruC.js → Staff-Cd3twQ6Y.js} +3 -3
  31. package/dist/{StaffInfo-CJDKMbud.js → StaffInfo-DJp0a0qd.js} +1 -1
  32. package/dist/{StaffInfo.vue_vue_type_script_setup_true_lang-DQ4DL1KY.js → StaffInfo.vue_vue_type_script_setup_true_lang-Dp2AhJ4I.js} +16 -16
  33. package/dist/{StaffPanel-CG-uggdr.js → StaffPanel-B93hClzs.js} +1 -1
  34. package/dist/{StaffPanel.vue_vue_type_script_setup_true_lang-DAgN7zN2.js → StaffPanel.vue_vue_type_script_setup_true_lang-CXjUzq7n.js} +2 -2
  35. package/dist/{SysUser-kwnzRNdD.js → SysUser-BvI6vaqI.js} +2 -2
  36. package/dist/{SysUserPanel-DTlZf3vk.js → SysUserPanel-C9V8X-Ek.js} +1 -1
  37. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-bMqTui07.js +343 -0
  38. package/dist/{SystemMenu-BVT0n-L2.js → SystemMenu-D4WME5d0.js} +27 -27
  39. package/dist/{UserInfo-BbTQ9Zat.js → UserInfo-D-AfdfJs.js} +1 -1
  40. package/dist/{UserInfo.vue_vue_type_style_index_0_lang-D_bpYDmI.js → UserInfo.vue_vue_type_style_index_0_lang-C-JQYIxe.js} +41 -39
  41. package/dist/{childView-BJbIhjmf.js → childView--WMSo-wH.js} +1 -1
  42. package/dist/{childView-DCsGFrG-.js → childView-1MTl6Kaj.js} +1 -1
  43. package/dist/childView.vue_vue_type_style_index_0_lang-B8Losc4Y.js +170 -0
  44. package/dist/{childView.vue_vue_type_style_index_0_lang-BCDxpVoD.js → childView.vue_vue_type_style_index_0_lang-BAVKNIXs.js} +1 -1
  45. package/dist/{code-rule-DePU6cdp.js → code-rule-D-RqrQB6.js} +42 -41
  46. package/dist/core.es.js +19 -10
  47. package/dist/{cron-task-DUM1SIGL.js → cron-task-D-X-KFZm.js} +11 -11
  48. package/dist/flow-task-B07st2aD.js +10 -0
  49. package/dist/{frameView-CEUTDtSm.js → frameView-MAW_-GHJ.js} +1 -1
  50. package/dist/index-Bc9vCX7z.js +2904 -0
  51. package/dist/{layoutView-PCjwVwkX.js → layoutView-De2QIEr2.js} +1639 -1629
  52. package/dist/{log-in-e7D5Ss1P.js → log-in-CpGqc33f.js} +5 -4
  53. package/dist/{log-out--RRncZhN.js → log-out-D1b4VRMZ.js} +30 -24
  54. package/dist/{login-log-CvVnyGi3.js → login-log-BNRXLeMi.js} +4 -3
  55. package/dist/login-rdZ0GPYc.js +249 -0
  56. package/dist/{lov-view-D8wwkxFJ.js → lov-view-Ao7LMspL.js} +5 -5
  57. package/dist/{menuInfo-B5JKVwrB.js → menuInfo-DmOcK6An.js} +1 -1
  58. package/dist/{menuInfo.vue_vue_type_style_index_0_lang-CcM9WX4n.js → menuInfo.vue_vue_type_style_index_0_lang-Ln-zFWV7.js} +121 -99
  59. package/dist/{pda-app-DIa1p1Ww.js → pda-app-DY63mQ2T.js} +202 -188
  60. package/dist/{resource-CCQ7Dd-5.js → resource-B21uV58T.js} +18 -18
  61. package/dist/{su-welcome-CLp9YaJa.js → su-welcome-DgjzJeDF.js} +122 -121
  62. package/dist/sys-config-DOtK2I32.js +370 -0
  63. package/dist/udp-core.css +1 -9
  64. package/dist/utogether-MlnyYtNS.js +4 -0
  65. package/index.ts +19 -6
  66. package/package.json +3 -3
  67. package/src/App.vue +65 -70
  68. package/src/api/http.ts +1 -4
  69. package/src/api/index.ts +5 -3
  70. package/src/api/user.ts +2 -2
  71. package/src/components/SuCharts/src/UserInfo.vue +3 -3
  72. package/src/components/SuScrollTree/ScrollPanel.vue +4 -9
  73. package/src/components/udp/content/index.vue +89 -0
  74. package/src/components/udp/form/form.vue +109 -0
  75. package/src/components/udp/{grid.vue → grid/index.vue} +524 -500
  76. package/src/components/udp/index.ts +4 -6
  77. package/src/components/udp/ut-stamp-badge/index.vue +272 -0
  78. package/src/components/udp/utils.ts +408 -379
  79. package/src/directives/permission/index.ts +1 -1
  80. package/src/layout/components/lay-navbar/index.vue +8 -6
  81. package/src/layout/components/lay-panel/index.vue +150 -150
  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/horizontal.vue +8 -6
  85. package/src/layout/components/lay-sidebar/mixNav.vue +260 -258
  86. package/src/layout/components/lay-sidebar/sidebar-logo.vue +8 -12
  87. package/src/layout/components/lay-tag/index.vue +596 -625
  88. package/src/layout/hooks/useTag.ts +12 -18
  89. package/src/layout/types.ts +3 -2
  90. package/src/main.ts +115 -110
  91. package/src/plugins/i18n/en.ts +302 -291
  92. package/src/plugins/i18n/module/u-workflow.ts +1 -1
  93. package/src/plugins/i18n/zh.ts +362 -338
  94. package/src/plugins/vxe-table/index.ts +116 -53
  95. package/src/plugins/vxe-table/render.tsx +183 -57
  96. package/src/router/index.ts +101 -97
  97. package/src/router/modules/flow.ts +35 -0
  98. package/src/router/modules/remaining.ts +1 -26
  99. package/src/router/utils.ts +50 -7
  100. package/src/store/modules/app.ts +1 -3
  101. package/src/store/modules/multiTags.ts +15 -14
  102. package/src/store/modules/permission.ts +25 -15
  103. package/src/store/modules/system.ts +1 -3
  104. package/src/style/button.scss +85 -85
  105. package/src/style/login.css +1 -1
  106. package/src/style/vxetable.scss +348 -258
  107. package/src/utils/authority/index.ts +1 -1
  108. package/src/utils/index.ts +3 -1
  109. package/src/utils/propTypes.ts +1 -6
  110. package/src/utils/{http → udp/http}/index.ts +27 -30
  111. package/src/utils/{http → udp/http}/types.d.ts +2 -6
  112. package/src/views/login/login-view.vue +6 -20
  113. package/src/views/organization/company/CompanyPanel.vue +259 -259
  114. package/src/views/organization/department/DepartmentPanel.vue +6 -20
  115. package/src/views/organization/inv-org/InvOrganization.vue +22 -7
  116. package/src/views/organization/org/Org.vue +9 -5
  117. package/src/views/system/cron/cron-task.vue +2 -12
  118. package/src/views/system/menu/SystemMenu.vue +185 -197
  119. package/src/views/system/menu/menuInfo.vue +384 -372
  120. package/src/views/system/role/AuthorityInfo.vue +19 -15
  121. package/src/views/system/role/Role.vue +1 -5
  122. package/src/views/system/role/RolePanel.vue +11 -2
  123. package/src/views/system/role/UserInfo.vue +11 -9
  124. package/src/views/system/role-assign/RoleAssign.vue +2 -2
  125. package/src/views/system/role-assign/RolePanel.vue +12 -9
  126. package/src/views/system/sys/sys-config.vue +70 -21
  127. package/src/views/system/sysUser/SysUserPanel.vue +132 -62
  128. package/src/views/uapp/pda/pda-app.vue +48 -16
  129. package/src/views/udev/coderule/code-rule.vue +132 -121
  130. package/src/views/udev/dict/DictView.vue +118 -106
  131. package/src/views/udev/dict/childView.vue +71 -111
  132. package/src/views/udev/lov/childView.vue +1 -7
  133. package/src/views/udev/lov/lov-view.vue +91 -91
  134. package/src/views/ufile/aggregation/File.vue +5 -5
  135. package/src/views/ufile/file/water-mark.vue +14 -14
  136. package/src/views/uhome/components/menu-favorite.vue +314 -331
  137. package/src/views/uhome/su-welcome.vue +3 -3
  138. package/src/views/ulogin/login.vue +19 -12
  139. package/src/views/upms/interface/log-in.vue +2 -8
  140. package/src/views/upms/interface/log-out.vue +2 -8
  141. package/src/views/upms/user/login-log.vue +2 -8
  142. package/src/views/urpt/design/DesignPanel.vue +16 -35
  143. package/src/views/urpt/design/Preview.vue +1 -0
  144. package/src/views/urpt/design/ReportDesign.vue +17 -23
  145. package/src/views/urpt/static-resource/resource.vue +3 -3
  146. package/src/views/urpt/template/ReportTemplate.vue +7 -7
  147. package/src/views/utask/flow-task.vue +18 -0
  148. package/types/global.d.ts +4 -9
  149. package/vite.config.ts +2 -1
  150. package/dist/AuthorityInfo.vue_vue_type_style_index_0_lang-Bwsf6lMH.js +0 -102
  151. package/dist/DictView-BnxfaOBv.js +0 -96
  152. package/dist/InvOrganization-5y79ZLdY.js +0 -66
  153. package/dist/Org-2oBAXN2r.js +0 -35
  154. package/dist/RolePanel.vue_vue_type_script_setup_true_lang-t6S_0zmJ.js +0 -126
  155. package/dist/SysUserPanel.vue_vue_type_script_setup_true_lang-BW6PlGjM.js +0 -288
  156. package/dist/childView.vue_vue_type_style_index_0_lang-CDtsalCm.js +0 -187
  157. package/dist/index-ZdgOD7cF.js +0 -3399
  158. package/dist/login-B1CjWVKu.js +0 -252
  159. package/dist/sys-config-BBmf_SqF.js +0 -277
  160. package/dist/utogether-Bkptx2lB.js +0 -182
  161. package/src/components/udp/form-upload.vue +0 -183
  162. package/src/components/udp/lov.vue +0 -410
  163. package/src/components/udp/modal-form.vue +0 -180
  164. package/src/components/udp/modal-grid.vue +0 -297
  165. package/src/utils/udp/useRender.ts +0 -420
@@ -1,410 +0,0 @@
1
- <template>
2
- <div class="ut-lov-wrapper">
3
- <vxe-modal
4
- v-if="mode === 'vxe'"
5
- v-model="showLovModal"
6
- :width="modalWidth"
7
- :destroy-on-close="false"
8
- :title="lovTitle"
9
- :transfer="transfer"
10
- height="66%"
11
- resize
12
- esc-closable
13
- show-footer
14
- :className="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
22
- :content="$t('message.btn.cancel')"
23
- icon="ri-close-line"
24
- status="warning"
25
- @click="onClose"
26
- />
27
- <vxe-button
28
- :content="$t('message.btn.confirm')"
29
- icon="ri-save-3-line"
30
- status="primary"
31
- @click="onConfirm"
32
- />
33
- </template>
34
- </vxe-modal>
35
- <el-dialog
36
- v-else
37
- v-model="showLovModal"
38
- :width="modalWidth"
39
- :show-close="false"
40
- :title="lovTitle"
41
- :append-to-body="transfer"
42
- draggable
43
- destroy-on-close
44
- close-on-press-escape
45
- >
46
- <template #default>
47
- <div style="height: 360px">
48
- <vxe-grid ref="xgrid" v-bind="data" resizable @cell-dblclick="onCellClick" />
49
- </div>
50
- </template>
51
- <template #footer>
52
- <vxe-button
53
- :content="$t('message.btn.cancel')"
54
- icon="ri-close-line"
55
- status="warning"
56
- @click="onClose"
57
- />
58
- <vxe-button
59
- :content="$t('message.btn.confirm')"
60
- icon="ri-save-3-line"
61
- status="primary"
62
- @click="onConfirm"
63
- />
64
- </template>
65
- </el-dialog>
66
- <vxe-input
67
- v-model="record[displayName || field]"
68
- :clearable="!disabled && clearable"
69
- :disabled="disabled"
70
- :readonly="readonly"
71
- :placeholder="placeholder"
72
- style="width: 100%"
73
- type="search"
74
- size="mini"
75
- @search-click="onSeach"
76
- @clear="onClear"
77
- />
78
- </div>
79
- </template>
80
-
81
- <script lang="ts">
82
- export default {
83
- name: 'UtLov'
84
- };
85
- </script>
86
-
87
- <script setup lang="ts">
88
- // @ts-nocheck
89
- import { ref, reactive, getCurrentInstance } from 'vue';
90
- import { VxeGridProps } from 'vxe-table';
91
- import to from 'await-to-js';
92
- import { clone, toDateString, isEmpty } from 'xe-utils';
93
- import { useRender, cookies, delay } from '@utogether/utils';
94
- // import type { IFormItemProps, IRecord } from '../../types';
95
-
96
- export interface IProps {
97
- record: object;
98
- defaultParams?: object;
99
- code: string;
100
- field: string;
101
- displayName?: string;
102
- placeholder?: string;
103
- mode?: string;
104
- clearable?: boolean;
105
- multiple?: boolean;
106
- disabled?: boolean;
107
- autoLoad?: boolean;
108
- readonly?: boolean;
109
- transfer?: boolean;
110
- }
111
- const props = withDefaults(defineProps<IProps>(), {
112
- record: () => {
113
- return {};
114
- },
115
- defaultParams: () => {
116
- return {};
117
- },
118
- mode: 'vxe',
119
- placeholder: '请选择',
120
- clearable: true,
121
- multiple: false,
122
- disabled: false,
123
- readonly: true,
124
- autoLoad: true
125
- });
126
-
127
- const instance = getCurrentInstance()!;
128
- const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
129
-
130
- const minWidth = 600;
131
- const showLovModal = ref(false);
132
- const modalWidth = ref(minWidth);
133
- const lovTitle = ref('');
134
- const className = ref('vxe-table--ignore-clear');
135
-
136
- const data = reactive<VxeGridProps>({
137
- loading: false,
138
- border: true,
139
- pagerConfig: {},
140
- formConfig: { titleWidth: 90, titleAlign: 'right', items: [] },
141
- height: 'auto',
142
- editConfig: {},
143
- rowConfig: { keyField: '_X_ROW_KEY' },
144
- proxyConfig: {
145
- form: true, // 查询是需要启用表单代理
146
- autoLoad: false,
147
- response: {
148
- result: 'list',
149
- total: 'total'
150
- },
151
- ajax: {
152
- query: ({ page, form }) => {
153
- const commonParam = cookies.get('kCookies_param')
154
- ? JSON.parse(cookies.get('kCookies_param'))
155
- : {};
156
- let queryParams = Object.assign({}, form, commonParam, props.defaultParams);
157
- queryParams.pageNum = page?.currentPage || 1;
158
- queryParams.pageSize = page?.pageSize || 20;
159
- if (!props.readonly) {
160
- const { field, displayName } = props;
161
- // 非只读时,意味着可录入文本,此时查询是需要加上录入的文本内容作为条件
162
- queryParams[displayName || field] = props.record[displayName || field];
163
- }
164
- // console.log(queryParams);
165
- queryParams = formatterParam(queryParams);
166
- if (lovData.lovType !== 'url') {
167
- queryParams.lovCode = props.code;
168
- return serviceApi.get('/upfm/v1/lovViewHeader/listBySql', queryParams);
169
- }
170
- return serviceApi.get(lovData.lovUrl, queryParams);
171
- }
172
- }
173
- },
174
- checkboxConfig: {},
175
- columns: []
176
- });
177
-
178
- // const displayName = ref(null);
179
- let lovData = undefined;
180
- let dataList = [];
181
-
182
- const formatterParam = params => {
183
- const columns = dataList.filter(col => ['date', 'month'].includes(col.fieldType) && col.isSearch);
184
- columns.forEach(col => {
185
- if (col.fieldType === 'date') {
186
- params[col.field] = toDateString(params[col.field], 'yyyy-MM-dd 00:00:00');
187
- } else if (col.fieldType === 'month') {
188
- params[col.field] = toDateString(params[col.field], 'yyyy-MM');
189
- }
190
- });
191
- return params;
192
- };
193
- // 查询字段
194
- const getFormItem = () => {
195
- const items = clone(dataList, true).filter(col => col.isSearch === 'Y');
196
- if (!items.length) return;
197
- // console.log(items);
198
- const isCollapse = items.length > 2;
199
- const forItems: IFormItemProps[] = items
200
- .sort((a, b) => a.seqNo - b.seqNo)
201
- .map((item: IRecord, idx) => {
202
- return {
203
- field: item.colField,
204
- title: item.colTitle,
205
- span: 8,
206
- folding: idx > 1,
207
- itemRender: getItemRender(item)
208
- };
209
- });
210
- searchBtn.collapseNode = isCollapse;
211
- if (isCollapse) {
212
- // 按钮设置为 折叠节点并将搜索按钮插入到第一列的最后
213
- forItems.splice(2, 0, searchBtn);
214
- } else {
215
- forItems.push(searchBtn);
216
- }
217
- data.formConfig.items = forItems;
218
- };
219
- const searchBtn: IFormItemProps = {
220
- span: 8,
221
- align: 'right',
222
- collapseNode: false,
223
- itemRender: {
224
- name: 'VxeButtonGroup',
225
- options: [
226
- {
227
- type: 'submit',
228
- submit: 'submit',
229
- content: 'message.btn.search',
230
- status: 'primary',
231
- icon: 'ri-search-line'
232
- // props: {
233
- // },
234
- },
235
- {
236
- type: 'reset',
237
- name: 'reset',
238
- content: 'message.btn.reset',
239
- status: 'info',
240
- icon: 'ri-refresh-line'
241
- // props: {
242
- // },
243
- }
244
- ]
245
- }
246
- };
247
-
248
- // console.log("useRender", useRender);
249
- const renderHook = useRender();
250
-
251
- const getItemRender = item => {
252
- if (['date', 'month'].includes(item.fieldType)) {
253
- const valueFormat = item.fieldType === 'date' ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM';
254
- return renderHook.renderDate({ type: item.fieldType, valueFormat });
255
- } else if (item.fieldType === 'dictCode') {
256
- return renderHook.renderDict(item.dictCode);
257
- }
258
- return { name: 'VxeInput' };
259
- };
260
-
261
- // 获取columns
262
- const getColumns = () => {
263
- const columns = clone(dataList, true).filter((col: IRecord) => col.isCol === 'Y');
264
- const colWidth = columns.reduce((curv, prev: IRecord) => curv + +prev.colWidth, 65);
265
- modalWidth.value = colWidth < minWidth ? minWidth : colWidth > 900 ? 900 : colWidth;
266
- data.columns = columns
267
- .sort((a, b) => a.seqNo - b.seqNo)
268
- .map(col => {
269
- const fieldType = col.fieldType;
270
- const dictCode = ['formatDict', col.dictCode];
271
- return {
272
- field: col.colField,
273
- title: col.colTitle,
274
- minWidth: col.colWidth,
275
- formatter: fieldType === 'date' ? ['formatDate'] : col.fieldType === 'dictCode' ? dictCode : null
276
- };
277
- });
278
- if (props.multiple) {
279
- data.columns.unshift({ type: 'checkbox', width: 45, align: 'center' });
280
- } else {
281
- data.columns.unshift({ type: 'radio', width: 45, align: 'center' });
282
- }
283
- };
284
-
285
- // 获取grid配置
286
- const xgrid = ref(null);
287
-
288
- const getGridConfig = async () => {
289
- console.log('88888');
290
- data.loading = true;
291
- const url = '/upfm/v1/lovViewHeader/detailByViewCode';
292
- const [err, res]: [Error, any] = await to(serviceApi.get(url, { lovCode: props.code }));
293
- data.loading = false;
294
- if (err) onClose();
295
- lovTitle.value = res?.lovTitle || res.lovName;
296
- dataList = res.lineList;
297
- lovData = res;
298
- props.autoLoad && xgrid.value.commitProxy('query');
299
- getColumns();
300
- getFormItem();
301
- };
302
-
303
- const onSeach = async () => {
304
- if (props.disabled) return;
305
- getGridConfig();
306
- await delay(64);
307
- showLovModal.value = true;
308
- };
309
-
310
- const onClear = () => {
311
- emit('clear', '');
312
- };
313
-
314
- // 双击
315
- const onCellClick = ({ row }) => {
316
- const record = !props.multiple ? row : [row];
317
- emit('change', record, lovData.valueField);
318
- onClose();
319
- };
320
-
321
- const onConfirm = () => {
322
- const grid = xgrid.value;
323
- const record = !props.multiple ? grid.getRadioRecord() : grid.getCheckboxRecords();
324
- !isEmpty(record) && emit('change', record, lovData.valueField);
325
- onClose();
326
- };
327
- /** 输入框显示值 */
328
- // const setDisplayLabel = row => {
329
- // let value = row[lovData.valueField];
330
- // if (props.multiple) {
331
- // value = row.map(m => m[lovData.valueField]).join();
332
- // }
333
- // Object.assign(props.record, { [props.field]: value });
334
- // };
335
-
336
- // 关闭Lov
337
- const onClose = () => {
338
- dataList.length = 0;
339
- showLovModal.value = false;
340
- };
341
-
342
- const beforeHideMethod = ({ type }) => {
343
- // console.log("cccc", type);
344
- };
345
-
346
- const emit = defineEmits<{
347
- (e: 'clear', str: ''): void;
348
- (e: 'change', record: any, field: string): void;
349
- }>();
350
- </script>
351
-
352
- <style lang="scss">
353
- .ut-lov-wrapper {
354
- .vxe-pager .vxe-pager--sizes {
355
- display: inline-block;
356
- width: 7em !important;
357
- text-align: center;
358
- cursor: pointer;
359
- }
360
-
361
- .el-dialog__header {
362
- padding: 0.6em 4.6em 0.6em 1em;
363
- margin-right: 0;
364
- background-color: #f8f8f8;
365
- border-bottom: 1px solid #ebeef5;
366
-
367
- .el-dialog__title {
368
- font-size: 1.1em;
369
- font-weight: 600;
370
- color: #000 !important;
371
- }
372
- }
373
-
374
- .el-dialog__body {
375
- padding: 5px 6px;
376
- }
377
-
378
- .el-dialog__footer {
379
- padding: 5px 6px;
380
- }
381
-
382
- .vxe-grid {
383
- .vxe-form {
384
- .vxe-form--item {
385
- .vxe-form--item-title-label {
386
- font-weight: 500 !important;
387
- color: #000 !important;
388
- }
389
-
390
- .vxe-input--date-picker-suffix {
391
- color: #000 !important;
392
- }
393
- }
394
- }
395
-
396
- .vxe-cell {
397
- .vxe-cell--label {
398
- font-weight: 500 !important;
399
- color: #000 !important;
400
- }
401
- }
402
- }
403
-
404
- .vxe-input {
405
- i[class*='vxe-icon-'] {
406
- color: #6a6a6a !important;
407
- }
408
- }
409
- }
410
- </style>
@@ -1,180 +0,0 @@
1
- <!--
2
- * @Author: wei.li
3
- * @Date: 2021-11-29 21:02:43
4
- * @LastEditors: levi7754 levi7754@163.com
5
- * @LastEditTime: 2025-07-14 17:38:19
6
- * @Description: file content
7
- -->
8
-
9
- <template>
10
- <div>
11
- <vxe-modal
12
- v-model="showModal"
13
- :title="title"
14
- :width="width"
15
- :height="height"
16
- :loading="loading"
17
- :show-footer="dataStatus !== 'detail'"
18
- v-bind="modalAttrs"
19
- min-width="240"
20
- min-height="300"
21
- destroy-on-close
22
- resize
23
- @close="onClose"
24
- >
25
- <template #default>
26
- <vxe-form
27
- ref="xForm"
28
- :data="record"
29
- :items="formItems"
30
- :rules="rules"
31
- title-align="right"
32
- :title-width="formAttrs.titleWidth || 90"
33
- v-bind="formAttrs"
34
- />
35
- </template>
36
- <template #footer>
37
- <ut-button status="warning" content="cancel" icon="ri-close-line" @tap="onClose" />
38
- <ut-button status="u-cyan" content="confirm" icon="ri-save-3-line" @tap="onConfirm" />
39
- </template>
40
- </vxe-modal>
41
- </div>
42
- </template>
43
-
44
- <script lang="ts">
45
- export default {
46
- name: 'UtModalForm'
47
- };
48
- </script>
49
- <script lang="ts" setup>
50
- import { onBeforeMount, ref, computed, getCurrentInstance, useAttrs } from 'vue';
51
- import { useI18n } from 'vue-i18n';
52
- import { getAttrs } from './utils';
53
- import to from 'await-to-js';
54
- import { formatRules, successMessage, formatItems } from '@utogether/utils';
55
-
56
- // import type { IRecord, IFormItemProps } from '../../types';
57
-
58
- export interface IProps {
59
- record: IRecord; // 数据对象
60
- formAttrs?: IRecord;
61
- modalAttrs?: IRecord;
62
- items: Array<IFormItemProps>; // form item
63
- url?: string; // 服务路径
64
- method?: string; // 请求方式
65
- title?: string; // 标题
66
- dataStatus?: string; // 状态
67
- width?: number;
68
- height?: number;
69
- }
70
-
71
- const props = withDefaults(defineProps<IProps>(), {
72
- record: (): IRecord => {
73
- return {};
74
- },
75
- formAttrs: (): IRecord => {
76
- return {};
77
- },
78
- items: () => [],
79
- title: '数据记录',
80
- width: 420,
81
- height: 360,
82
- dataStatus: 'detail',
83
- url: '',
84
- method: 'post'
85
- });
86
-
87
- const attrs: IRecord = getAttrs(useAttrs());
88
-
89
- const loading = ref(false);
90
- const instance = getCurrentInstance()!;
91
-
92
- const serviceApi = instance.appContext.config.globalProperties.$serviceApi;
93
-
94
- /**
95
- * @description: 根据items 获取必填选
96
- */
97
- const rules = computed(() => {
98
- if (!props.items.length) return {};
99
- return formatRules(props.items, t);
100
- });
101
-
102
- const formItems = computed(() => {
103
- if (!props.items.length) return props.items;
104
- return formatItems(props.items, props.dataStatus);
105
- });
106
-
107
- const { t } = useI18n();
108
- const showModal = ref(false);
109
-
110
- const xForm = ref(null);
111
- /**
112
- * @description: 弹框确认
113
- */
114
- const onConfirm = () => {
115
- // @ts-ignore
116
- xForm.value.validate(async (valid: boolean) => {
117
- if (!valid) {
118
- const { record, url, method } = props;
119
- if (url) {
120
- showLoading();
121
- const body = attrs?.dataProcessMethod ? attrs?.dataProcessMethod(record) : record;
122
- if (url) {
123
- const [err, data] = await to(serviceApi[method](url, body));
124
- if (!err) {
125
- successMessage();
126
- emit('confirm', data);
127
- }
128
- }
129
- hiddenLoading();
130
- onClose();
131
- } else {
132
- emit('confirm');
133
- }
134
- }
135
- });
136
- };
137
-
138
- /**
139
- * @description: 显示加载框
140
- */
141
- const showLoading = () => {
142
- loading.value = true;
143
- };
144
-
145
- /**
146
- * @description: 关闭加载框
147
- */
148
- const hiddenLoading = () => {
149
- loading.value = false;
150
- };
151
- const validateForm = (cb: Function) => {
152
- // @ts-ignore
153
- xForm.value.validate(cb);
154
- };
155
-
156
- /**
157
- * @description: 关闭弹框
158
- */
159
- const onClose = () => {
160
- showModal.value = false;
161
- emit('close');
162
- };
163
- /**
164
- * @description: 打开弹框
165
- */
166
- const openModal = () => {
167
- showModal.value = true;
168
- };
169
-
170
- const emit = defineEmits<{
171
- (e: 'close'): void;
172
- (e: 'confirm', record?: any): void;
173
- }>();
174
-
175
- defineExpose({ showLoading, hiddenLoading, openModal, validateForm });
176
-
177
- onBeforeMount(() => {
178
- openModal();
179
- });
180
- </script>