@agile-team/wl-skills-kit 1.0.0
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.
- package/CHANGELOG.md +13 -0
- package/README.md +328 -0
- package/bin/wl-skills.js +104 -0
- package/files/.github/copilot-instructions.md +211 -0
- package/files/.github/docs/SYS_MENU_INFO.md +247 -0
- package/files/.github/docs/menu-sync-design.md +265 -0
- package/files/.github/docs/use-skill.md +379 -0
- package/files/.github/docs/wl-skills-kit.md +266 -0
- package/files/.github/skills/api-contract/SKILL.md +247 -0
- package/files/.github/skills/convention-extract/SKILL.md +355 -0
- package/files/.github/skills/menu-sync/SKILL.md +255 -0
- package/files/.github/skills/menu-sync/env/guide.md +73 -0
- package/files/.github/skills/page-codegen/SKILL.md +825 -0
- package/files/.github/skills/page-codegen/TPL-CHANGE-HISTORY.md +281 -0
- package/files/.github/skills/page-codegen/TPL-DETAIL-TABS.md +1112 -0
- package/files/.github/skills/page-codegen/TPL-DRIVEN.md +124 -0
- package/files/.github/skills/page-codegen/TPL-FORM-ROUTE.md +441 -0
- package/files/.github/skills/page-codegen/TPL-LIST.md +196 -0
- package/files/.github/skills/page-codegen/TPL-MASTER-DETAIL.md +153 -0
- package/files/.github/skills/page-codegen/TPL-OPERATION-STATION.md +442 -0
- package/files/.github/skills/page-codegen/TPL-RECORD-FORM.md +376 -0
- package/files/.github/skills/page-codegen/TPL-TREE-LIST.md +191 -0
- package/files/.github/skills/prototype-scan/SKILL.md +414 -0
- package/files/demo/README.md +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/api.md +54 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/data.ts +346 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add/index.vue +28 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/data.ts +115 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/index.scss +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-add-form/index.vue +43 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/data.ts +338 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change/index.vue +28 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/data.ts +115 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/index.scss +44 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-form/index.vue +43 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/api.md +88 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/data.ts +601 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-customer-archive/index.vue +64 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/api.md +67 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/data.ts +286 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/index.scss +139 -0
- package/files/demo/produce/aiflow/mmwr-customer-detail/index.vue +318 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/api.md +98 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/data.ts +543 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/index.scss +1 -0
- package/files/demo/produce/aiflow/mmwr-temp-customer-archive/index.vue +52 -0
- package/files/demo/sale/demo/add-demo/data.ts +518 -0
- package/files/demo/sale/demo/add-demo/index.scss +207 -0
- package/files/demo/sale/demo/add-demo/index.vue +167 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/data.ts +524 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/index.scss +155 -0
- package/files/demo/sale/demo/billet-flame-cut-plan/index.vue +117 -0
- package/files/demo/sale/demo/domestic-trade-order/data.ts +308 -0
- package/files/demo/sale/demo/domestic-trade-order/index.scss +99 -0
- package/files/demo/sale/demo/domestic-trade-order/index.vue +77 -0
- package/files/demo/sale/demo/heat-batch-return/data.ts +367 -0
- package/files/demo/sale/demo/heat-batch-return/index.scss +100 -0
- package/files/demo/sale/demo/heat-batch-return/index.vue +170 -0
- package/files/demo/sale/demo/heat-batch-return/meltDialog.vue +320 -0
- package/files/demo/sale/demo/metallurgical-spec/data.ts +825 -0
- package/files/demo/sale/demo/metallurgical-spec/index.scss +264 -0
- package/files/demo/sale/demo/metallurgical-spec/index.vue +309 -0
- package/files/docs/jh-date-range.md +257 -0
- package/files/docs/jh-date.md +222 -0
- package/files/docs/jh-dept-picker.md +190 -0
- package/files/docs/jh-drag-row.md +590 -0
- package/files/docs/jh-file-upload.md +216 -0
- package/files/docs/jh-pagination.md +505 -0
- package/files/docs/jh-picker.md +218 -0
- package/files/docs/jh-select.md +148 -0
- package/files/docs/jh-text.md +248 -0
- package/files/docs/jh-user-picker.md +197 -0
- package/files/docs/page-query-hook-best-practices.md +362 -0
- package/files/docs/request.md +925 -0
- package/files/src/components/global/C_ParentView/index.vue +3 -0
- package/files/src/components/global/C_RightToolbar/index.vue +459 -0
- package/files/src/components/global/C_Splitter/index.vue +195 -0
- package/files/src/components/global/C_SvgIcon/index.vue +61 -0
- package/files/src/components/global/C_SvgIcon/svgicon.js +10 -0
- package/files/src/components/global/C_TagStatus/README.md +264 -0
- package/files/src/components/global/C_TagStatus/config.ts +192 -0
- package/files/src/components/global/C_TagStatus/index.vue +127 -0
- package/files/src/components/global/C_TagStatus/types.ts +64 -0
- package/files/src/components/global/C_Tree/README.md +153 -0
- package/files/src/components/global/C_Tree/index.scss +42 -0
- package/files/src/components/global/C_Tree/index.vue +119 -0
- package/files/src/components/global/C_Tree/types.ts +59 -0
- package/files/src/components/local/c_formModal/README.md +235 -0
- package/files/src/components/local/c_formModal/data.ts +95 -0
- package/files/src/components/local/c_formModal/index.scss +8 -0
- package/files/src/components/local/c_formModal/index.vue +107 -0
- package/files/src/components/local/c_formSections/README.md +496 -0
- package/files/src/components/local/c_formSections/data.ts +175 -0
- package/files/src/components/local/c_formSections/index.scss +280 -0
- package/files/src/components/local/c_formSections/index.vue +429 -0
- package/files/src/components/local/c_listModal/data.ts +41 -0
- package/files/src/components/local/c_listModal/index.vue +136 -0
- package/files/src/components/local/c_spliterTitle/index.scss +25 -0
- package/files/src/components/local/c_spliterTitle/index.vue +21 -0
- package/files/src/components/remote/AGGrid/README.md +530 -0
- package/files/src/components/remote/BaseForm/README.md +508 -0
- package/files/src/components/remote/BaseQuery/README.md +865 -0
- package/files/src/components/remote/BaseTable/README.md +941 -0
- package/files/src/components/remote/BaseToolbar/README.md +496 -0
- package/files/src/types/page.ts +24 -0
- package/package.json +31 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenYu ycyplus@gmail.com
|
|
3
|
+
* @Date: 2026-01-01 13:30:00
|
|
4
|
+
* @LastEditors: ChenYu ycyplus@gmail.com
|
|
5
|
+
* @LastEditTime: 2026-01-01 16:30:00
|
|
6
|
+
* @FilePath: \cx-ui-sale\src\components\local\c_formSections\index.vue
|
|
7
|
+
* @Description: 表单区块组件 - 集成楼层导航、工具栏、布局切换等功能
|
|
8
|
+
* Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
9
|
+
-->
|
|
10
|
+
<template>
|
|
11
|
+
<div class="c-form-sections-wrapper">
|
|
12
|
+
<!-- 顶部标题栏 -->
|
|
13
|
+
<div v-if="showHeader" class="c-form-header">
|
|
14
|
+
<span class="header-title">{{ headerTitle }}</span>
|
|
15
|
+
<div class="header-right">
|
|
16
|
+
<!-- 布局切换器 -->
|
|
17
|
+
<div v-if="showLayoutSwitch" class="layout-switcher">
|
|
18
|
+
<span
|
|
19
|
+
v-for="option in internalLayoutOptions"
|
|
20
|
+
:key="option.columns"
|
|
21
|
+
class="layout-icon"
|
|
22
|
+
:class="{ active: currentLayout === option.columns }"
|
|
23
|
+
:title="option.title"
|
|
24
|
+
@click="currentLayout = option.columns"
|
|
25
|
+
>
|
|
26
|
+
{{ option.icon }}
|
|
27
|
+
</span>
|
|
28
|
+
</div>
|
|
29
|
+
<el-divider
|
|
30
|
+
v-if="showLayoutSwitch && headerActions.length > 0"
|
|
31
|
+
direction="vertical"
|
|
32
|
+
/>
|
|
33
|
+
<!-- 顶部操作按钮 -->
|
|
34
|
+
<template v-for="action in headerActions" :key="action.label">
|
|
35
|
+
<el-button
|
|
36
|
+
:type="action.type || ''"
|
|
37
|
+
size="small"
|
|
38
|
+
:disabled="action.disabled"
|
|
39
|
+
@click="action.onClick"
|
|
40
|
+
>
|
|
41
|
+
<el-icon v-if="action.icon">
|
|
42
|
+
<component :is="action.icon" />
|
|
43
|
+
</el-icon>
|
|
44
|
+
{{ action.label }}
|
|
45
|
+
</el-button>
|
|
46
|
+
</template>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<!-- 工具栏 -->
|
|
51
|
+
<div v-if="showToolbar" class="c-form-toolbar">
|
|
52
|
+
<div class="toolbar-left">
|
|
53
|
+
<!-- 必填字段过滤开关 -->
|
|
54
|
+
<span v-if="showRequiredFilter" class="required-toggle">
|
|
55
|
+
<span class="label">仅显示必填字段</span>
|
|
56
|
+
<el-switch v-model="showRequiredOnly" size="small" />
|
|
57
|
+
</span>
|
|
58
|
+
<!-- 工具栏左侧插槽 -->
|
|
59
|
+
<slot name="toolbar-left"></slot>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="toolbar-right">
|
|
62
|
+
<!-- 工具栏右侧插槽 -->
|
|
63
|
+
<slot name="toolbar-right"></slot>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<!-- 主体内容区域 -->
|
|
68
|
+
<div class="c-form-content">
|
|
69
|
+
<!-- 左侧楼层导航 -->
|
|
70
|
+
<el-tabs
|
|
71
|
+
v-if="showNavTabs"
|
|
72
|
+
:tab-position="navTabsPosition"
|
|
73
|
+
v-model="activeNavTab"
|
|
74
|
+
@tab-click="handleNavTabClick"
|
|
75
|
+
class="nav-tabs"
|
|
76
|
+
>
|
|
77
|
+
<el-tab-pane
|
|
78
|
+
v-for="tab in navTabs"
|
|
79
|
+
:key="tab.name"
|
|
80
|
+
:label="tab.label"
|
|
81
|
+
:name="tab.name"
|
|
82
|
+
/>
|
|
83
|
+
</el-tabs>
|
|
84
|
+
|
|
85
|
+
<!-- 表单区域 -->
|
|
86
|
+
<div class="form-container" ref="formContainerRef">
|
|
87
|
+
<el-form
|
|
88
|
+
:label-width="labelWidth"
|
|
89
|
+
:label-position="labelPosition"
|
|
90
|
+
:model="form"
|
|
91
|
+
:rules="rules"
|
|
92
|
+
>
|
|
93
|
+
<el-collapse v-model="activeNamesModel">
|
|
94
|
+
<!-- 循环渲染折叠面板 -->
|
|
95
|
+
<el-collapse-item
|
|
96
|
+
v-for="section in visibleSections"
|
|
97
|
+
:key="section.name"
|
|
98
|
+
:name="section.name"
|
|
99
|
+
:id="section.id"
|
|
100
|
+
>
|
|
101
|
+
<template #title>
|
|
102
|
+
<span class="section-title">{{ section.title }}</span>
|
|
103
|
+
<el-divider />
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<!-- 特殊区块 - 使用具名插槽 -->
|
|
107
|
+
<slot
|
|
108
|
+
v-if="section.isSpecial"
|
|
109
|
+
:name="`special-${section.name}`"
|
|
110
|
+
:section="section"
|
|
111
|
+
>
|
|
112
|
+
<el-row :gutter="gutter">
|
|
113
|
+
<el-col :span="24">
|
|
114
|
+
<el-empty description="请通过插槽自定义特殊区块内容" />
|
|
115
|
+
</el-col>
|
|
116
|
+
</el-row>
|
|
117
|
+
</slot>
|
|
118
|
+
|
|
119
|
+
<!-- 普通区块 - 循环渲染字段 -->
|
|
120
|
+
<el-row v-else :gutter="gutter">
|
|
121
|
+
<el-col
|
|
122
|
+
v-for="field in section.fieldsConfig"
|
|
123
|
+
:key="field.prop"
|
|
124
|
+
:span="currentFieldSpan"
|
|
125
|
+
>
|
|
126
|
+
<el-form-item
|
|
127
|
+
:label="field.label"
|
|
128
|
+
:prop="field.prop"
|
|
129
|
+
:required="field.required"
|
|
130
|
+
>
|
|
131
|
+
<!-- 下拉选择框 -->
|
|
132
|
+
<el-select
|
|
133
|
+
v-if="field.type === 'select'"
|
|
134
|
+
v-model="form[field.prop]"
|
|
135
|
+
:placeholder="field.placeholder || '请选择'"
|
|
136
|
+
:clearable="field.clearable !== false"
|
|
137
|
+
>
|
|
138
|
+
<el-option
|
|
139
|
+
v-for="opt in field.options"
|
|
140
|
+
:key="opt.value"
|
|
141
|
+
:label="opt.label"
|
|
142
|
+
:value="opt.value"
|
|
143
|
+
/>
|
|
144
|
+
</el-select>
|
|
145
|
+
|
|
146
|
+
<!-- 多行文本框 -->
|
|
147
|
+
<el-input
|
|
148
|
+
v-else-if="field.type === 'textarea'"
|
|
149
|
+
v-model="form[field.prop]"
|
|
150
|
+
type="textarea"
|
|
151
|
+
:rows="field.rows || 3"
|
|
152
|
+
:placeholder="field.placeholder || '请输入'"
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
<!-- 日期选择器 -->
|
|
156
|
+
<el-date-picker
|
|
157
|
+
v-else-if="field.type === 'date'"
|
|
158
|
+
v-model="form[field.prop]"
|
|
159
|
+
type="date"
|
|
160
|
+
:placeholder="field.placeholder || '选择日期'"
|
|
161
|
+
style="width: 100%"
|
|
162
|
+
/>
|
|
163
|
+
|
|
164
|
+
<!-- 日期时间选择器 -->
|
|
165
|
+
<el-date-picker
|
|
166
|
+
v-else-if="field.type === 'datetime'"
|
|
167
|
+
v-model="form[field.prop]"
|
|
168
|
+
type="datetime"
|
|
169
|
+
:placeholder="field.placeholder || '选择日期时间'"
|
|
170
|
+
style="width: 100%"
|
|
171
|
+
/>
|
|
172
|
+
|
|
173
|
+
<!-- 数字输入框 -->
|
|
174
|
+
<el-input-number
|
|
175
|
+
v-else-if="field.type === 'number'"
|
|
176
|
+
v-model="form[field.prop]"
|
|
177
|
+
:min="field.min"
|
|
178
|
+
:max="field.max"
|
|
179
|
+
:precision="field.precision"
|
|
180
|
+
:step="field.step || 1"
|
|
181
|
+
style="width: 100%"
|
|
182
|
+
/>
|
|
183
|
+
|
|
184
|
+
<!-- 自定义字段 - 使用作用域插槽 -->
|
|
185
|
+
<slot
|
|
186
|
+
v-else-if="field.type === 'custom'"
|
|
187
|
+
:name="`field-${field.prop}`"
|
|
188
|
+
:field="field"
|
|
189
|
+
:form="form"
|
|
190
|
+
>
|
|
191
|
+
<el-input
|
|
192
|
+
v-model="form[field.prop]"
|
|
193
|
+
:placeholder="field.placeholder || '请输入'"
|
|
194
|
+
/>
|
|
195
|
+
</slot>
|
|
196
|
+
|
|
197
|
+
<!-- 默认单行文本输入框 -->
|
|
198
|
+
<el-input
|
|
199
|
+
v-else
|
|
200
|
+
v-model="form[field.prop]"
|
|
201
|
+
:placeholder="field.placeholder || '请输入'"
|
|
202
|
+
/>
|
|
203
|
+
</el-form-item>
|
|
204
|
+
</el-col>
|
|
205
|
+
</el-row>
|
|
206
|
+
</el-collapse-item>
|
|
207
|
+
</el-collapse>
|
|
208
|
+
</el-form>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
</template>
|
|
213
|
+
|
|
214
|
+
<script setup lang="ts">
|
|
215
|
+
import { ref, computed } from "vue";
|
|
216
|
+
import type {
|
|
217
|
+
SectionConfig,
|
|
218
|
+
FormDataType,
|
|
219
|
+
NavTabConfig,
|
|
220
|
+
HeaderAction,
|
|
221
|
+
LayoutOption
|
|
222
|
+
} from "./data";
|
|
223
|
+
|
|
224
|
+
/** 组件 Props */
|
|
225
|
+
interface Props {
|
|
226
|
+
// ===== 基础配置 =====
|
|
227
|
+
/** 表单区块配置数组 */
|
|
228
|
+
sections: SectionConfig[];
|
|
229
|
+
/** 表单数据对象 */
|
|
230
|
+
form: FormDataType;
|
|
231
|
+
/** 激活的折叠面板 name 数组 */
|
|
232
|
+
activeNames?: string[];
|
|
233
|
+
/** 表单验证规则 */
|
|
234
|
+
rules?: any;
|
|
235
|
+
/** 表单标签宽度 */
|
|
236
|
+
labelWidth?: string;
|
|
237
|
+
/** 表单标签位置 */
|
|
238
|
+
labelPosition?: "left" | "right" | "top";
|
|
239
|
+
/** 栅格间距 */
|
|
240
|
+
gutter?: number;
|
|
241
|
+
/** 每个字段占据的栅格数(外部手动控制时使用,会覆盖内部布局切换) */
|
|
242
|
+
fieldSpan?: number;
|
|
243
|
+
|
|
244
|
+
// ===== 顶部标题栏配置 =====
|
|
245
|
+
/** 是否显示顶部标题栏 */
|
|
246
|
+
showHeader?: boolean;
|
|
247
|
+
/** 标题栏标题文本 */
|
|
248
|
+
headerTitle?: string;
|
|
249
|
+
/** 顶部操作按钮 */
|
|
250
|
+
headerActions?: HeaderAction[];
|
|
251
|
+
|
|
252
|
+
// ===== 工具栏配置 =====
|
|
253
|
+
/** 是否显示工具栏 */
|
|
254
|
+
showToolbar?: boolean;
|
|
255
|
+
/** 是否显示必填字段过滤开关 */
|
|
256
|
+
showRequiredFilter?: boolean;
|
|
257
|
+
|
|
258
|
+
// ===== 布局切换配置 =====
|
|
259
|
+
/** 是否显示布局切换器 */
|
|
260
|
+
showLayoutSwitch?: boolean;
|
|
261
|
+
/** 默认布局列数 */
|
|
262
|
+
defaultLayout?: 2 | 3 | 4 | 5;
|
|
263
|
+
/** 可选布局列数 */
|
|
264
|
+
layoutOptions?: Array<2 | 3 | 4 | 5>;
|
|
265
|
+
|
|
266
|
+
// ===== 楼层导航配置 =====
|
|
267
|
+
/** 是否显示楼层导航 */
|
|
268
|
+
showNavTabs?: boolean;
|
|
269
|
+
/** 楼层导航位置 */
|
|
270
|
+
navTabsPosition?: "left" | "right";
|
|
271
|
+
/** 楼层导航配置(不传则自动从 sections 生成) */
|
|
272
|
+
navTabs?: NavTabConfig[];
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
276
|
+
activeNames: () => [],
|
|
277
|
+
labelWidth: "100px",
|
|
278
|
+
labelPosition: "right",
|
|
279
|
+
gutter: 20,
|
|
280
|
+
fieldSpan: undefined,
|
|
281
|
+
|
|
282
|
+
showHeader: false,
|
|
283
|
+
headerTitle: "主档维护",
|
|
284
|
+
headerActions: () => [],
|
|
285
|
+
|
|
286
|
+
showToolbar: false,
|
|
287
|
+
showRequiredFilter: false,
|
|
288
|
+
|
|
289
|
+
showLayoutSwitch: false,
|
|
290
|
+
defaultLayout: 5,
|
|
291
|
+
layoutOptions: () => [2, 3, 4, 5],
|
|
292
|
+
|
|
293
|
+
showNavTabs: false,
|
|
294
|
+
navTabsPosition: "left",
|
|
295
|
+
navTabs: () => []
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
/** 组件 Emits */
|
|
299
|
+
interface Emits {
|
|
300
|
+
(e: "update:activeNames", value: string[]): void;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const emit = defineEmits<Emits>();
|
|
304
|
+
|
|
305
|
+
// ===== 内部状态 =====
|
|
306
|
+
/** 仅显示必填字段开关 */
|
|
307
|
+
const showRequiredOnly = ref(false);
|
|
308
|
+
|
|
309
|
+
/** 当前布局列数 */
|
|
310
|
+
const currentLayout = ref<2 | 3 | 4 | 5>(props.defaultLayout);
|
|
311
|
+
|
|
312
|
+
/** 当前激活的导航标签 */
|
|
313
|
+
const activeNavTab = ref("");
|
|
314
|
+
|
|
315
|
+
/** 表单容器引用 */
|
|
316
|
+
const formContainerRef = ref<HTMLElement | null>(null);
|
|
317
|
+
|
|
318
|
+
// ===== 计算属性 =====
|
|
319
|
+
/** 激活的折叠面板(v-model) */
|
|
320
|
+
const activeNamesModel = computed({
|
|
321
|
+
get: () => props.activeNames,
|
|
322
|
+
set: (val) => emit("update:activeNames", val)
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* 🆕 内部布局选项配置
|
|
327
|
+
*/
|
|
328
|
+
const internalLayoutOptions = computed<LayoutOption[]>(() => {
|
|
329
|
+
return props.layoutOptions.map((col) => ({
|
|
330
|
+
columns: col,
|
|
331
|
+
icon: "|".repeat(col),
|
|
332
|
+
title: `${col}列布局`
|
|
333
|
+
}));
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* 🆕 当前字段 span 值
|
|
338
|
+
* 优先使用外部传入的 fieldSpan,否则根据内部布局计算
|
|
339
|
+
*/
|
|
340
|
+
const currentFieldSpan = computed(() => {
|
|
341
|
+
if (props.fieldSpan !== undefined) {
|
|
342
|
+
return props.fieldSpan;
|
|
343
|
+
}
|
|
344
|
+
return Math.floor(24 / currentLayout.value);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* 🆕 过滤后的区块(根据必填字段过滤)
|
|
349
|
+
*/
|
|
350
|
+
const filteredSections = computed(() => {
|
|
351
|
+
if (!showRequiredOnly.value) {
|
|
352
|
+
return props.sections;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return props.sections.map((section) => {
|
|
356
|
+
if (section.isSpecial) {
|
|
357
|
+
return section;
|
|
358
|
+
}
|
|
359
|
+
return {
|
|
360
|
+
...section,
|
|
361
|
+
fieldsConfig: section.fieldsConfig.filter((field) => field.required)
|
|
362
|
+
};
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* 过滤后的可见区块
|
|
368
|
+
* 根据 section.visible 函数和字段过滤结果判断是否显示
|
|
369
|
+
*/
|
|
370
|
+
const visibleSections = computed(() => {
|
|
371
|
+
return filteredSections.value.filter((section) => {
|
|
372
|
+
// 特殊区块:必填模式下隐藏
|
|
373
|
+
if (section.isSpecial) {
|
|
374
|
+
return !showRequiredOnly.value;
|
|
375
|
+
}
|
|
376
|
+
// 普通区块:有字段才显示
|
|
377
|
+
const hasFields = section.fieldsConfig.length > 0;
|
|
378
|
+
const visibleByFunc = section.visible ? section.visible() : true;
|
|
379
|
+
return hasFields && visibleByFunc;
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* 🆕 内部导航标签配置
|
|
385
|
+
* 如果外部传入则使用外部的,否则自动从 sections 生成
|
|
386
|
+
*/
|
|
387
|
+
const internalNavTabs = computed<NavTabConfig[]>(() => {
|
|
388
|
+
if (props.navTabs && props.navTabs.length > 0) {
|
|
389
|
+
return props.navTabs;
|
|
390
|
+
}
|
|
391
|
+
// 自动从 sections 生成
|
|
392
|
+
return props.sections.map((section) => ({
|
|
393
|
+
name: section.name,
|
|
394
|
+
label: section.title,
|
|
395
|
+
sectionName: section.name
|
|
396
|
+
}));
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
// ===== 方法 =====
|
|
400
|
+
/** 处理楼层导航点击 */
|
|
401
|
+
const handleNavTabClick = (tab: any) => {
|
|
402
|
+
const tabName = tab.paneName || tab.props?.name;
|
|
403
|
+
const tabConfig = internalNavTabs.value.find((t) => t.name === tabName);
|
|
404
|
+
|
|
405
|
+
if (!tabConfig?.sectionName) return;
|
|
406
|
+
|
|
407
|
+
// 展开对应的 collapse section
|
|
408
|
+
if (!activeNamesModel.value.includes(tabConfig.sectionName)) {
|
|
409
|
+
activeNamesModel.value = [...activeNamesModel.value, tabConfig.sectionName];
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// 滚动到对应区域
|
|
413
|
+
setTimeout(() => {
|
|
414
|
+
const section = props.sections.find(
|
|
415
|
+
(s) => s.name === tabConfig.sectionName
|
|
416
|
+
);
|
|
417
|
+
if (section?.id) {
|
|
418
|
+
const sectionEl = document.getElementById(section.id);
|
|
419
|
+
if (sectionEl) {
|
|
420
|
+
sectionEl.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}, 150);
|
|
424
|
+
};
|
|
425
|
+
</script>
|
|
426
|
+
|
|
427
|
+
<style scoped lang="scss">
|
|
428
|
+
@import "./index.scss";
|
|
429
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AbstractPageQueryHook,
|
|
3
|
+
BaseQueryItemDesc,
|
|
4
|
+
ActionButtonDesc,
|
|
5
|
+
TableColumnDesc
|
|
6
|
+
} from "@/types/page";
|
|
7
|
+
import { RequestMethod } from "@jhlc/types/src/request-type";
|
|
8
|
+
|
|
9
|
+
export function createPage(
|
|
10
|
+
listApi: string,
|
|
11
|
+
constQueryParam: Record<string, any>,
|
|
12
|
+
queryItemsConfig: BaseQueryItemDesc<any>[],
|
|
13
|
+
columns: TableColumnDesc<any>[],
|
|
14
|
+
requestMethod: RequestMethod
|
|
15
|
+
) {
|
|
16
|
+
let Page = new (class extends AbstractPageQueryHook {
|
|
17
|
+
constructor() {
|
|
18
|
+
super({
|
|
19
|
+
requestMethod: requestMethod,
|
|
20
|
+
url: {
|
|
21
|
+
list: listApi
|
|
22
|
+
},
|
|
23
|
+
constQueryParam: () => constQueryParam
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
queryDef(): BaseQueryItemDesc<any>[] {
|
|
28
|
+
return queryItemsConfig;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
toolbarDef(): ActionButtonDesc[] {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
columnsDef(): TableColumnDesc<any>[] {
|
|
36
|
+
return [{ type: "index", label: "序号", width: 60 }, ...columns];
|
|
37
|
+
}
|
|
38
|
+
})();
|
|
39
|
+
|
|
40
|
+
return Page.create() as any;
|
|
41
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<jh-dialog
|
|
3
|
+
v-model="visible"
|
|
4
|
+
:width="width"
|
|
5
|
+
:title="title"
|
|
6
|
+
:close-on-click-modal="false"
|
|
7
|
+
:close-on-press-escape="false"
|
|
8
|
+
>
|
|
9
|
+
<BaseQuery
|
|
10
|
+
:form="queryParam"
|
|
11
|
+
:items="queryItems"
|
|
12
|
+
:columns="queryColumns"
|
|
13
|
+
:label-width="queryLabelWidth"
|
|
14
|
+
@select="select"
|
|
15
|
+
@reset="resetQuery"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<BaseTable
|
|
19
|
+
ref="tableRef"
|
|
20
|
+
:data="list"
|
|
21
|
+
:columns="columns"
|
|
22
|
+
showToolbar
|
|
23
|
+
highlightCurrentRow
|
|
24
|
+
currentRowSelectMethod="click"
|
|
25
|
+
@row-dblclick="handleRowDblclick"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<jh-pagination
|
|
29
|
+
v-show="page.total && page.total > 0"
|
|
30
|
+
:total="page.total || 0"
|
|
31
|
+
v-model:currentPage="page.current"
|
|
32
|
+
v-model:pageSize="page.size"
|
|
33
|
+
@current-change="select"
|
|
34
|
+
@size-change="select"
|
|
35
|
+
/>
|
|
36
|
+
<template #footer v-if="showFooterButtons">
|
|
37
|
+
<div class="dialog-footer">
|
|
38
|
+
<BaseToolbar :items="cancelConfirmButtons(close, confirm)" />
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
</jh-dialog>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import { TableColumnDesc, BaseQueryItemDesc } from "@/types/page";
|
|
46
|
+
import { cancelConfirmButtons } from "@jhlc/common-core/src/components/toolbar/toolbar-data";
|
|
47
|
+
import { RequestMethod } from "@jhlc/types/src/request-type";
|
|
48
|
+
import { createPage } from "./data";
|
|
49
|
+
|
|
50
|
+
interface Props {
|
|
51
|
+
width?: string;
|
|
52
|
+
title?: string;
|
|
53
|
+
queryColumns?: number;
|
|
54
|
+
queryLabelWidth?: string;
|
|
55
|
+
queryItems?: BaseQueryItemDesc[];
|
|
56
|
+
tableColumns?: TableColumnDesc[];
|
|
57
|
+
apiPath?: string;
|
|
58
|
+
requestMethod?: RequestMethod;
|
|
59
|
+
showFooterButtons?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
63
|
+
width: "1200px",
|
|
64
|
+
title: "",
|
|
65
|
+
queryColumns: 4,
|
|
66
|
+
queryLabelWidth: "100px",
|
|
67
|
+
queryItems: () => [],
|
|
68
|
+
tableColumns: () => [],
|
|
69
|
+
apiPath: "",
|
|
70
|
+
requestMethod: RequestMethod.get,
|
|
71
|
+
showFooterButtons: true
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const emits = defineEmits(["ok"]);
|
|
75
|
+
|
|
76
|
+
// 弹窗显示状态
|
|
77
|
+
const visible = ref(false);
|
|
78
|
+
// 固定的查询参数
|
|
79
|
+
const constQueryParam = ref<Record<string, any>>({});
|
|
80
|
+
|
|
81
|
+
const Page = createPage(
|
|
82
|
+
props.apiPath,
|
|
83
|
+
constQueryParam.value,
|
|
84
|
+
props.queryItems,
|
|
85
|
+
props.tableColumns,
|
|
86
|
+
props.requestMethod
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const {
|
|
90
|
+
tableRef: tableRef,
|
|
91
|
+
page: page,
|
|
92
|
+
list: list,
|
|
93
|
+
queryParam: queryParam,
|
|
94
|
+
queryItems: queryItems,
|
|
95
|
+
columns: columns,
|
|
96
|
+
select: select,
|
|
97
|
+
resetQuery: resetQuery
|
|
98
|
+
} = Page;
|
|
99
|
+
|
|
100
|
+
// 确定函数
|
|
101
|
+
const confirm = () => {
|
|
102
|
+
const selectedRows = tableRef.value?.getSelection();
|
|
103
|
+
emits("ok", selectedRows);
|
|
104
|
+
close();
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// 双击行函数
|
|
108
|
+
const handleRowDblclick = (row: any) => {
|
|
109
|
+
if (!props.showFooterButtons) return;
|
|
110
|
+
emits("ok", row);
|
|
111
|
+
close();
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// 打开弹窗
|
|
115
|
+
const open = (params: Record<string, any>) => {
|
|
116
|
+
if (params) {
|
|
117
|
+
Object.assign(constQueryParam.value, params);
|
|
118
|
+
}
|
|
119
|
+
resetQuery();
|
|
120
|
+
visible.value = true;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// 关闭弹窗
|
|
124
|
+
const close = () => {
|
|
125
|
+
visible.value = false;
|
|
126
|
+
list.value = [];
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// 暴露方法
|
|
130
|
+
defineExpose({
|
|
131
|
+
open,
|
|
132
|
+
close
|
|
133
|
+
});
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.spliter-title {
|
|
2
|
+
width: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
background: white;
|
|
6
|
+
padding: 8px 0;
|
|
7
|
+
|
|
8
|
+
.title-bar {
|
|
9
|
+
width: 4px;
|
|
10
|
+
height: 20px;
|
|
11
|
+
background: var(--el-color-primary);
|
|
12
|
+
margin-right: 8px;
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.title-text {
|
|
17
|
+
line-height: 20px;
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
margin-right: 8px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.el-divider--horizontal {
|
|
23
|
+
margin: 18px 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="spliter-title">
|
|
3
|
+
<div class="title-bar"></div>
|
|
4
|
+
<span class="title-text">{{ title }}</span>
|
|
5
|
+
<el-divider />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
interface Props {
|
|
11
|
+
title: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
withDefaults(defineProps<Props>(), {
|
|
15
|
+
title: ""
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style scoped lang="scss">
|
|
20
|
+
@import "./index.scss";
|
|
21
|
+
</style>
|