@agile-team/wl-skills-ui 1.6.2
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 +207 -0
- package/README.md +623 -0
- package/SKILL.md +632 -0
- package/bin/wl-ui.js +794 -0
- package/design/spec/color.md +41 -0
- package/design/spec/spacing.md +28 -0
- package/design/spec/typography.md +29 -0
- package/design/tokens/base.css +144 -0
- package/design/tokens/index.css +8 -0
- package/dist/ag-grid-override.scss +1 -0
- package/dist/element.scss +1 -0
- package/dist/index.scss +1 -0
- package/dist/portal.scss +1 -0
- package/dist/style-override.scss +1 -0
- package/dist/tokens.css +144 -0
- package/es/chunk-GBB7LDKQ.js +261 -0
- package/es/chunk-MDI2SCUP.js +281 -0
- package/es/chunk-QDTNMM7W.js +286 -0
- package/es/chunk-YLNAFAWE.js +233 -0
- package/es/common-preset.d.ts +38 -0
- package/es/common-preset.js +157 -0
- package/es/index.d.ts +32 -0
- package/es/index.js +1 -0
- package/es/presets/security.d.ts +16 -0
- package/es/presets/security.js +99 -0
- package/es/renderers-BFRSp2BH.d.ts +51 -0
- package/es/renderers-DMZbi_Gs.d.ts +51 -0
- package/es/renderers-DWhUlI2y.d.ts +47 -0
- package/es/types-04qLKHMt.d.ts +62 -0
- package/es/types-BrCPjAH6.d.ts +62 -0
- package/es/types-QZ1gy9KX.d.ts +63 -0
- package/examples/migration-operations-to-renderOps.md +107 -0
- package/examples/wk-exempt.example.json +30 -0
- package/mcp/server.js +394 -0
- package/package.json +130 -0
- package/reference/SelectPopupCom.vue +634 -0
- package/reference/ag-cell-renders.ts +644 -0
- package/reference/define-columns.ts +185 -0
- package/reference/jhlc.d.ts +1 -0
- package/scanner/coverage.mjs +287 -0
- package/scanner/exempt.mjs +127 -0
- package/scanner/fix.mjs +216 -0
- package/scanner/index.mjs +403 -0
- package/scanner/integration.mjs +155 -0
- package/scanner/report.mjs +459 -0
- package/scanner/rules/_shared.mjs +134 -0
- package/scanner/rules/button.mjs +97 -0
- package/scanner/rules/color.mjs +118 -0
- package/scanner/rules/componentFamily.mjs +184 -0
- package/scanner/rules/dialog.mjs +42 -0
- package/scanner/rules/form.mjs +86 -0
- package/scanner/rules/index.mjs +58 -0
- package/scanner/rules/table.mjs +170 -0
- package/scanner/rules/tag.mjs +245 -0
- package/scanner/snapshot.mjs +198 -0
- package/skills/_flows/full-audit.md +65 -0
- package/skills/_flows/legacy-skin-align.md +71 -0
- package/skills/_flows/new-project-init.md +80 -0
- package/skills/_flows/progressive-migrate.md +49 -0
- package/skills/_meta/_compat/README.md +47 -0
- package/skills/_meta/_compat/editors.json +76 -0
- package/skills/_meta/_compat/headers/agents.txt +7 -0
- package/skills/_meta/_compat/headers/claude-code.txt +7 -0
- package/skills/_meta/_compat/headers/cline.txt +7 -0
- package/skills/_meta/_compat/headers/cursor-mdc.txt +5 -0
- package/skills/_meta/_compat/headers/github-copilot.txt +5 -0
- package/skills/_meta/_compat/headers/kiro.txt +4 -0
- package/skills/_meta/_compat/headers/qoder.txt +4 -0
- package/skills/_meta/_compat/headers/trae.txt +3 -0
- package/skills/_meta/_compat/headers/windsurf.txt +5 -0
- package/skills/_meta/_detection.md +81 -0
- package/skills/_meta/_registry.md +96 -0
- package/skills/element/component-family/SKILL.md +71 -0
- package/skills/element/el-dialog/SKILL.md +124 -0
- package/skills/element/el-form/SKILL.md +84 -0
- package/skills/element/el-table/SKILL.md +86 -0
- package/skills/element/el-tag/SKILL.md +127 -0
- package/skills/layouts/detail-page/SKILL.md +99 -0
- package/skills/layouts/form-dialog/SKILL.md +128 -0
- package/skills/layouts/list-page/SKILL.md +111 -0
- package/skills/layouts/tree-list/SKILL.md +108 -0
- package/skills/ops/audit/SKILL.md +109 -0
- package/skills/ops/fix/SKILL.md +52 -0
- package/skills/ops/fix/USAGE.md +24 -0
- package/skills/ops/migrate/SKILL.md +157 -0
- package/skills/ops/scan/SKILL.md +71 -0
- package/skills/ops/scan/USAGE.md +16 -0
- package/skills/runtime/design-tokens/SKILL.md +88 -0
- package/skills/runtime/design-tokens/USAGE.md +19 -0
- package/skills/runtime/migration/SKILL.md +106 -0
- package/skills/runtime/migration/USAGE.md +34 -0
- package/skills/runtime/style-align/SKILL.md +124 -0
- package/skills/runtime/style-align/USAGE.md +52 -0
- package/skills/vendors/ag-grid/SKILL.md +94 -0
- package/skills/vendors/base-table/SKILL.md +57 -0
- package/skills/vendors/c-components/SKILL.md +36 -0
- package/skills/vendors/custom-wrappers/SKILL.md +45 -0
- package/skills/vendors/jh-components/SKILL.md +42 -0
- package/skills/vendors/unknown-wrapper/SKILL.md +44 -0
- package/standards/engineering/01-import-order.md +46 -0
- package/standards/engineering/02-naming.md +54 -0
- package/standards/engineering/03-scss-structure.md +59 -0
- package/standards/ui/01-table.md +111 -0
- package/standards/ui/02-button.md +83 -0
- package/standards/ui/03-form.md +118 -0
- package/standards/ui/04-tag-status.md +110 -0
- package/standards/ui/05-dialog-pagination.md +118 -0
- package/styles/element/_card.scss +26 -0
- package/styles/element/_descriptions.scss +22 -0
- package/styles/element/_dialog.scss +43 -0
- package/styles/element/_drawer.scss +22 -0
- package/styles/element/_feedback.scss +52 -0
- package/styles/element/_form.scss +22 -0
- package/styles/element/_navigation.scss +36 -0
- package/styles/element/_overlay.scss +32 -0
- package/styles/element/_pagination.scss +16 -0
- package/styles/element/_steps.scss +32 -0
- package/styles/element/_table.scss +13 -0
- package/styles/element/_tabs.scss +40 -0
- package/styles/element/_tree.scss +27 -0
- package/styles/element/_upload.scss +34 -0
- package/styles/element/index.scss +17 -0
- package/styles/index.scss +21 -0
- package/styles/layouts/_detail-page.scss +27 -0
- package/styles/layouts/_form-dialog.scss +19 -0
- package/styles/layouts/_list-page.scss +47 -0
- package/styles/layouts/_tree-list.scss +33 -0
- package/styles/layouts/index.scss +6 -0
- package/styles/presets/element-only.scss +6 -0
- package/styles/presets/full.scss +12 -0
- package/styles/presets/security.scss +37 -0
- package/styles/presets/skin.scss +14 -0
- package/styles/presets/tokens-only.scss +7 -0
- package/styles/tokens/index.scss +79 -0
- package/styles/vendors/_ag-grid.scss +273 -0
- package/styles/vendors/_base-components.scss +480 -0
- package/styles/vendors/_base-query-toolbar.scss +253 -0
- package/styles/vendors/_base-table.scss +41 -0
- package/styles/vendors/_c-components.scss +34 -0
- package/styles/vendors/_custom-wrappers.scss +30 -0
- package/styles/vendors/_jh-drag-col.scss +63 -0
- package/styles/vendors/_jh-pagination.scss +81 -0
- package/styles/vendors/_jh-tree.scss +196 -0
- package/styles/vendors/_portal.scss +114 -0
- package/styles/vendors/index.scss +17 -0
- package/templates/ag-grid-page/TPL-AG-GRID.md +76 -0
- package/templates/form-dialog/TPL-FORM-DIALOG.md +165 -0
- package/templates/list-page/TPL-LIST.md +139 -0
- package/templates/tree-list/TPL-TREE-LIST.md +176 -0
- package/templates/ui-optimization-report/TPL-UI-OPTIM-REPORT.md +343 -0
|
@@ -0,0 +1,634 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
:modelValue="props.selectPopupVisible"
|
|
4
|
+
:width="selectPopupWidth"
|
|
5
|
+
:title="props.selectPopupTitle"
|
|
6
|
+
:before-close="dialogCancel"
|
|
7
|
+
modal-class="custom-select-dialog"
|
|
8
|
+
>
|
|
9
|
+
<!-- 弹窗头部 -->
|
|
10
|
+
<template #header>
|
|
11
|
+
<div class="header">
|
|
12
|
+
<span>{{ selectPopupTitle }}</span>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
<div class="edl-dialog-div">
|
|
16
|
+
<el-form
|
|
17
|
+
:model="queryParams"
|
|
18
|
+
ref="queryForm"
|
|
19
|
+
:inline="true"
|
|
20
|
+
@submit.native.prevent
|
|
21
|
+
>
|
|
22
|
+
<!-- label-width="60px" -->
|
|
23
|
+
<el-row :gutter="20">
|
|
24
|
+
<!-- 将父组件传输过来的数据动态挂载 -->
|
|
25
|
+
<template v-for="item in props.tableSearch" :key="item.prop">
|
|
26
|
+
<el-col :span="6">
|
|
27
|
+
<el-form-item
|
|
28
|
+
:prop="item.prop"
|
|
29
|
+
:label="item.label"
|
|
30
|
+
style="width: 100%"
|
|
31
|
+
>
|
|
32
|
+
<!-- 条件渲染表单项目类型 -->
|
|
33
|
+
<template v-if="item.type === 'input'">
|
|
34
|
+
<el-input
|
|
35
|
+
style="width: 100%"
|
|
36
|
+
:placeholder="item.placeholder"
|
|
37
|
+
size="small"
|
|
38
|
+
v-model="queryParams[item.prop]"
|
|
39
|
+
></el-input>
|
|
40
|
+
</template>
|
|
41
|
+
<template v-if="item.type === 'datePicker'">
|
|
42
|
+
<el-date-picker
|
|
43
|
+
style="width: 100%"
|
|
44
|
+
v-model="queryParams[item.prop]"
|
|
45
|
+
size="small"
|
|
46
|
+
type="daterange"
|
|
47
|
+
format="YYYY/MM/DD"
|
|
48
|
+
value-format="YYYY-MM-DD"
|
|
49
|
+
range-separator="-"
|
|
50
|
+
start-placeholder="开始时间"
|
|
51
|
+
end-placeholder="结束时间"
|
|
52
|
+
/>
|
|
53
|
+
</template>
|
|
54
|
+
<template v-if="item.type === 'select'">
|
|
55
|
+
<el-select
|
|
56
|
+
v-model="queryParams[item.prop]"
|
|
57
|
+
:placeholder="item.placeholder"
|
|
58
|
+
size="small"
|
|
59
|
+
>
|
|
60
|
+
<el-option
|
|
61
|
+
v-for="item in item.options"
|
|
62
|
+
:key="item.value"
|
|
63
|
+
:label="item.label"
|
|
64
|
+
:value="item.value"
|
|
65
|
+
/>
|
|
66
|
+
</el-select>
|
|
67
|
+
</template>
|
|
68
|
+
<template v-if="item.type === 'cascader'">
|
|
69
|
+
<el-cascader
|
|
70
|
+
v-model="queryParams[item.prop]"
|
|
71
|
+
:options="item.options"
|
|
72
|
+
:props="{
|
|
73
|
+
value: 'id',
|
|
74
|
+
label: 'deptName',
|
|
75
|
+
children: 'children',
|
|
76
|
+
emitPath: false,
|
|
77
|
+
checkStrictly: true
|
|
78
|
+
}"
|
|
79
|
+
style="width: 100%"
|
|
80
|
+
/>
|
|
81
|
+
</template>
|
|
82
|
+
<template v-if="item.type === 'radio'">
|
|
83
|
+
<el-radio-group v-model="queryParams[item.prop]">
|
|
84
|
+
<el-radio-button
|
|
85
|
+
v-for="items in item.options"
|
|
86
|
+
:key="items.value"
|
|
87
|
+
:label="items.value"
|
|
88
|
+
>
|
|
89
|
+
{{ items.label }}
|
|
90
|
+
</el-radio-button>
|
|
91
|
+
</el-radio-group>
|
|
92
|
+
</template>
|
|
93
|
+
</el-form-item>
|
|
94
|
+
</el-col>
|
|
95
|
+
</template>
|
|
96
|
+
<el-col :span="4">
|
|
97
|
+
<el-form-item>
|
|
98
|
+
<div class="flex">
|
|
99
|
+
<el-button
|
|
100
|
+
type="primary"
|
|
101
|
+
icon="Search"
|
|
102
|
+
size="small"
|
|
103
|
+
@click="handleQuery"
|
|
104
|
+
>搜索</el-button
|
|
105
|
+
>
|
|
106
|
+
<el-button icon="Refresh" size="small" @click="resetQuery"
|
|
107
|
+
>重置</el-button
|
|
108
|
+
>
|
|
109
|
+
</div>
|
|
110
|
+
</el-form-item>
|
|
111
|
+
</el-col>
|
|
112
|
+
</el-row>
|
|
113
|
+
</el-form>
|
|
114
|
+
<slot name="customContent"></slot>
|
|
115
|
+
<!-- <el-row :span="24" :gutter="10">
|
|
116
|
+
<el-col :span="20">
|
|
117
|
+
<p class="el-col-header l">列表信息</p>
|
|
118
|
+
</el-col>
|
|
119
|
+
<el-col :span="4">
|
|
120
|
+
<p class="el-col-header r">已选择</p>
|
|
121
|
+
</el-col>
|
|
122
|
+
</el-row> -->
|
|
123
|
+
<el-row :span="24" :gutter="10">
|
|
124
|
+
<el-col :span="18">
|
|
125
|
+
<!-- 利用loading重新渲染表格,放置移除不在当前数据也得数据勾选情况未取消勾选 -->
|
|
126
|
+
<el-table
|
|
127
|
+
v-loading="loading"
|
|
128
|
+
:data="tableSource"
|
|
129
|
+
:row-key="getRowKeys"
|
|
130
|
+
@row-click="rowClickEv"
|
|
131
|
+
@select="handleSelectionChange"
|
|
132
|
+
@select-all="handleSelectAll"
|
|
133
|
+
ref="popupTable"
|
|
134
|
+
:row-style="rowStyle"
|
|
135
|
+
>
|
|
136
|
+
<el-table-column
|
|
137
|
+
type="selection"
|
|
138
|
+
align="center"
|
|
139
|
+
width="55"
|
|
140
|
+
:reserve-selection="false"
|
|
141
|
+
v-if="props.tableMultiple"
|
|
142
|
+
></el-table-column>
|
|
143
|
+
<el-table-column
|
|
144
|
+
label="序号"
|
|
145
|
+
align="center"
|
|
146
|
+
type="index"
|
|
147
|
+
width="60"
|
|
148
|
+
:index="table_index"
|
|
149
|
+
/>
|
|
150
|
+
<el-table-column
|
|
151
|
+
align="center"
|
|
152
|
+
v-for="(item, i) in props.tableClumnList"
|
|
153
|
+
:key="i"
|
|
154
|
+
:label="item.label"
|
|
155
|
+
:prop="item.value"
|
|
156
|
+
show-overflow-tooltip
|
|
157
|
+
>
|
|
158
|
+
<template #default="{ row }">
|
|
159
|
+
<span v-if="item.type == 'dict'">
|
|
160
|
+
{{ getDictLabel(item.dictOptions, row[item.value]) }}
|
|
161
|
+
</span>
|
|
162
|
+
<span v-else>
|
|
163
|
+
{{ row[item.value] }}
|
|
164
|
+
</span>
|
|
165
|
+
</template>
|
|
166
|
+
</el-table-column>
|
|
167
|
+
</el-table>
|
|
168
|
+
<div class="popup-pagination">
|
|
169
|
+
<pagination
|
|
170
|
+
v-show="total > 0"
|
|
171
|
+
:total="total"
|
|
172
|
+
v-model:page="queryParams.current"
|
|
173
|
+
v-model:limit="queryParams.size"
|
|
174
|
+
@pagination="getList"
|
|
175
|
+
@handleSizeChange="handleSizeChange"
|
|
176
|
+
@handleCurrentChange="handleCurrentChange"
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
</el-col>
|
|
180
|
+
<el-col :span="6">
|
|
181
|
+
<div class="selectUl">
|
|
182
|
+
<el-tag
|
|
183
|
+
v-for="(tagItem, tagIndex) in multipleSelection"
|
|
184
|
+
:key="tagItem.id"
|
|
185
|
+
closable
|
|
186
|
+
@close="handleClose(tagItem, tagIndex)"
|
|
187
|
+
>
|
|
188
|
+
{{ tagItem[props.tagShowName] }}
|
|
189
|
+
</el-tag>
|
|
190
|
+
</div>
|
|
191
|
+
</el-col>
|
|
192
|
+
</el-row>
|
|
193
|
+
</div>
|
|
194
|
+
<template #footer>
|
|
195
|
+
<div class="dialog-footer">
|
|
196
|
+
<el-button @click="dialogCancel" size="small">取消</el-button>
|
|
197
|
+
<el-button type="primary" @click="submitForm" size="small">确认</el-button>
|
|
198
|
+
</div>
|
|
199
|
+
</template>
|
|
200
|
+
</el-dialog>
|
|
201
|
+
</template>
|
|
202
|
+
<script setup>
|
|
203
|
+
import { ElMessage } from "element-plus";
|
|
204
|
+
import { nextTick } from "vue";
|
|
205
|
+
import { getAction } from "@jhlc/common-core/src/api/action";
|
|
206
|
+
import pagination from "@/views/safe/components/Pagination/index.vue";
|
|
207
|
+
|
|
208
|
+
// 默认不传值, 为人员单选
|
|
209
|
+
const props = defineProps({
|
|
210
|
+
// 显示隐藏
|
|
211
|
+
selectPopupVisible: {
|
|
212
|
+
type: Boolean,
|
|
213
|
+
default: false
|
|
214
|
+
},
|
|
215
|
+
// 默认标题
|
|
216
|
+
selectPopupTitle: {
|
|
217
|
+
type: String,
|
|
218
|
+
default: "选择"
|
|
219
|
+
},
|
|
220
|
+
// 弹窗宽度
|
|
221
|
+
selectPopupWidth: {
|
|
222
|
+
type: String,
|
|
223
|
+
default: "70%"
|
|
224
|
+
},
|
|
225
|
+
//是否多选 默认false
|
|
226
|
+
tableMultiple: {
|
|
227
|
+
type: Boolean,
|
|
228
|
+
default: false
|
|
229
|
+
},
|
|
230
|
+
//搜索数据
|
|
231
|
+
tableSearch: {
|
|
232
|
+
type: Array,
|
|
233
|
+
default: () => [
|
|
234
|
+
{
|
|
235
|
+
type: "input",
|
|
236
|
+
placeholder: "请输入姓名查询",
|
|
237
|
+
prop: "userName"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
type: "input",
|
|
241
|
+
placeholder: "请输入工号查询",
|
|
242
|
+
prop: "userNo"
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
// 传递的参数
|
|
247
|
+
queryParam: {
|
|
248
|
+
type: Object,
|
|
249
|
+
default: function () {
|
|
250
|
+
return {};
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
// 接口默认地址(人员列表)
|
|
254
|
+
tableDataUrl: {
|
|
255
|
+
type: String,
|
|
256
|
+
default: "/integrated/aqHrUser/list"
|
|
257
|
+
},
|
|
258
|
+
// 默认展示的列
|
|
259
|
+
tableClumnList: {
|
|
260
|
+
type: Array,
|
|
261
|
+
default: () => [
|
|
262
|
+
{
|
|
263
|
+
label: "姓名",
|
|
264
|
+
value: "userName"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
label: "工号",
|
|
268
|
+
value: "userNo"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
label: "联系方式",
|
|
272
|
+
value: "mobilePhone"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
label: "所属单位",
|
|
276
|
+
value: "deptName"
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
tagShowName: {
|
|
281
|
+
type: String,
|
|
282
|
+
default: "name"
|
|
283
|
+
},
|
|
284
|
+
// 回显的数据
|
|
285
|
+
tableSelectData: {
|
|
286
|
+
type: Object,
|
|
287
|
+
default: () => []
|
|
288
|
+
},
|
|
289
|
+
// 回显勾选的标志
|
|
290
|
+
checkFlag: {
|
|
291
|
+
type: String,
|
|
292
|
+
default: "id"
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
const queryForm = ref(); //搜索
|
|
297
|
+
const popupTable = ref(); //表格
|
|
298
|
+
|
|
299
|
+
// 遮罩层
|
|
300
|
+
const loading = ref(true);
|
|
301
|
+
// 总条数
|
|
302
|
+
const total = ref(0);
|
|
303
|
+
// 表格数据
|
|
304
|
+
const tableSource = ref([]);
|
|
305
|
+
// 查询参数
|
|
306
|
+
const queryParams = ref({
|
|
307
|
+
current: 1,
|
|
308
|
+
size: 10
|
|
309
|
+
});
|
|
310
|
+
//选中的数据
|
|
311
|
+
const multipleSelection = ref([]);
|
|
312
|
+
|
|
313
|
+
const emit = defineEmits(["selectPopupBack"]);
|
|
314
|
+
|
|
315
|
+
// 查询列表数据
|
|
316
|
+
function getList() {
|
|
317
|
+
loading.value = true;
|
|
318
|
+
let params = { ...queryParams.value };
|
|
319
|
+
if (queryParams.value.timeValue) {
|
|
320
|
+
params["startTime"] = params.timeValue[0];
|
|
321
|
+
params["endTime"] = params.timeValue[1];
|
|
322
|
+
delete params.timeValue;
|
|
323
|
+
} else {
|
|
324
|
+
params["startTime"] = "";
|
|
325
|
+
params["endTime"] = "";
|
|
326
|
+
}
|
|
327
|
+
let newParams = filterObj(params);
|
|
328
|
+
getAction(props.tableDataUrl, newParams)
|
|
329
|
+
.then((response) => {
|
|
330
|
+
if (props.tableDataUrl == "hrms/user/list") {
|
|
331
|
+
let userD = response.data.records;
|
|
332
|
+
tableSource.value = userD.map((item) => {
|
|
333
|
+
let obj = {
|
|
334
|
+
id: item.user.id,
|
|
335
|
+
userNo: item.user.userNo,
|
|
336
|
+
name: item.user.name,
|
|
337
|
+
phone: item.user.phone,
|
|
338
|
+
deptName: item.dept ? item.dept.strName : "",
|
|
339
|
+
deptId: item.dept ? item.dept.id : ""
|
|
340
|
+
};
|
|
341
|
+
return obj;
|
|
342
|
+
});
|
|
343
|
+
} else {
|
|
344
|
+
tableSource.value = response.data.records;
|
|
345
|
+
}
|
|
346
|
+
total.value = response.data.total;
|
|
347
|
+
console.log("-----total", total.value);
|
|
348
|
+
loading.value = false;
|
|
349
|
+
nextTick(() => {
|
|
350
|
+
tableSource.value.forEach((item) => {
|
|
351
|
+
if (
|
|
352
|
+
multipleSelection.value.findIndex(
|
|
353
|
+
(v) => v[props.checkFlag] == item[props.checkFlag]
|
|
354
|
+
) >= 0
|
|
355
|
+
) {
|
|
356
|
+
popupTable.value.toggleRowSelection(item, true);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
})
|
|
361
|
+
.finally(() => {
|
|
362
|
+
loading.value = false;
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// 过滤空数据
|
|
367
|
+
function filterObj(obj) {
|
|
368
|
+
if (!(typeof obj == "object")) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
for (let key in obj) {
|
|
372
|
+
if (
|
|
373
|
+
obj.hasOwnProperty(key) &&
|
|
374
|
+
(obj[key] == null || obj[key] == undefined || obj[key] === "")
|
|
375
|
+
) {
|
|
376
|
+
delete obj[key];
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return obj;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// 改变页容量
|
|
383
|
+
function handleSizeChange(size) {
|
|
384
|
+
queryParams.value.size = size;
|
|
385
|
+
getList();
|
|
386
|
+
}
|
|
387
|
+
// 改变页码
|
|
388
|
+
function handleCurrentChange(page) {
|
|
389
|
+
queryParams.value.current = page;
|
|
390
|
+
getList();
|
|
391
|
+
}
|
|
392
|
+
/** 搜索按钮操作 */
|
|
393
|
+
function handleQuery() {
|
|
394
|
+
queryParams.value.current = 1;
|
|
395
|
+
getList();
|
|
396
|
+
}
|
|
397
|
+
/** 重置按钮操作 */
|
|
398
|
+
function resetQuery() {
|
|
399
|
+
queryForm.value.resetFields();
|
|
400
|
+
handleQuery();
|
|
401
|
+
}
|
|
402
|
+
//序号连续翻页
|
|
403
|
+
function table_index(index) {
|
|
404
|
+
return (queryParams.value.current - 1) * queryParams.value.size + index + 1;
|
|
405
|
+
}
|
|
406
|
+
function handleSelectionChange(selection, row) {
|
|
407
|
+
rowClickEv(row);
|
|
408
|
+
}
|
|
409
|
+
//当页全选的方法
|
|
410
|
+
function handleSelectAll(rows) {
|
|
411
|
+
if (rows.length) {
|
|
412
|
+
rows.forEach((row) => {
|
|
413
|
+
if (
|
|
414
|
+
!multipleSelection.value.find(
|
|
415
|
+
(item) => item[props.checkFlag] == row[props.checkFlag]
|
|
416
|
+
)
|
|
417
|
+
) {
|
|
418
|
+
multipleSelection.value.push(row);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
} else {
|
|
422
|
+
tableSource.value.forEach((row) => {
|
|
423
|
+
multipleSelection.value = multipleSelection.value.filter(
|
|
424
|
+
(item) => item[props.checkFlag] != row[props.checkFlag]
|
|
425
|
+
);
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function getRowKeys(row) {
|
|
431
|
+
return row[props.checkFlag];
|
|
432
|
+
}
|
|
433
|
+
// 行点击选中
|
|
434
|
+
function rowClickEv(row) {
|
|
435
|
+
if (props.tableMultiple) {
|
|
436
|
+
// 多选选中行
|
|
437
|
+
// 根据id判断当前点击的是否被选中
|
|
438
|
+
const selected = multipleSelection.value.some(
|
|
439
|
+
(item) => item[props.checkFlag] === row[props.checkFlag]
|
|
440
|
+
);
|
|
441
|
+
if (!selected) {
|
|
442
|
+
// 选择
|
|
443
|
+
multipleSelection.value.push(row);
|
|
444
|
+
popupTable.value.toggleRowSelection(row, true);
|
|
445
|
+
} else {
|
|
446
|
+
// 取消
|
|
447
|
+
var finalArr = multipleSelection.value.filter((item) => {
|
|
448
|
+
return item[props.checkFlag] !== row[props.checkFlag];
|
|
449
|
+
});
|
|
450
|
+
// 取消后剩余选中的
|
|
451
|
+
multipleSelection.value = finalArr;
|
|
452
|
+
popupTable.value.toggleRowSelection(row, false);
|
|
453
|
+
}
|
|
454
|
+
} else {
|
|
455
|
+
// 单选选中行
|
|
456
|
+
if (multipleSelection.value[0] == row) {
|
|
457
|
+
// 取消
|
|
458
|
+
multipleSelection.value = [];
|
|
459
|
+
popupTable.value.clearSelection();
|
|
460
|
+
} else {
|
|
461
|
+
// 选择
|
|
462
|
+
multipleSelection.value = [row];
|
|
463
|
+
popupTable.value.clearSelection();
|
|
464
|
+
popupTable.value.toggleRowSelection(row, true);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
// tags移除选中的
|
|
469
|
+
function handleClose(item, itemKey) {
|
|
470
|
+
//1. 获取当前页面的:data="tableSource"数据的id(回显勾选的标志)
|
|
471
|
+
const tableSelectItemId = tableSource.value.map(
|
|
472
|
+
(item0) => item0[props.checkFlag]
|
|
473
|
+
);
|
|
474
|
+
//2. 首先循环当前页的:data="tableSource"里的数据进行判断
|
|
475
|
+
for (let i = 0; i < tableSource.value.length; i++) {
|
|
476
|
+
if (tableSource.value[i][props.checkFlag] === item[props.checkFlag]) {
|
|
477
|
+
// 移除当前页选中的数据
|
|
478
|
+
popupTable.value.toggleRowSelection(tableSource.value[i]);
|
|
479
|
+
multipleSelection.value.splice(itemKey, 1);
|
|
480
|
+
} else {
|
|
481
|
+
// 移除非当前页选中的数据
|
|
482
|
+
//3. 然后在判断@select产生的数据
|
|
483
|
+
for (let j = 0; j < multipleSelection.value.length; j++) {
|
|
484
|
+
//4. 判断id是否一样 && 当前页的:data="tableSource"里面不能包含其他页的id
|
|
485
|
+
if (
|
|
486
|
+
multipleSelection.value[j][props.checkFlag] ===
|
|
487
|
+
item[props.checkFlag] &&
|
|
488
|
+
!tableSelectItemId.includes(
|
|
489
|
+
multipleSelection.value[j][props.checkFlag]
|
|
490
|
+
)
|
|
491
|
+
) {
|
|
492
|
+
popupTable.value.toggleRowSelection(multipleSelection.value[j]);
|
|
493
|
+
multipleSelection.value.splice(itemKey, 1);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
// 取消按钮
|
|
500
|
+
function dialogCancel() {
|
|
501
|
+
multipleSelection.value = []; //取消按钮的时候,置空上一次选择的数据
|
|
502
|
+
emit("update:selectPopupVisible", false);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// 确认按钮
|
|
506
|
+
function submitForm() {
|
|
507
|
+
if (multipleSelection.value.length > 0) {
|
|
508
|
+
emit("selectPopupBack", multipleSelection.value);
|
|
509
|
+
emit("update:selectPopupVisible", false);
|
|
510
|
+
queryParams.value = {
|
|
511
|
+
current: 1,
|
|
512
|
+
size: 10
|
|
513
|
+
};
|
|
514
|
+
} else {
|
|
515
|
+
ElMessage.warning("您还未选择数据");
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
// 获取数据字典标签
|
|
520
|
+
function getDictLabel(arrDict, value) {
|
|
521
|
+
for (let i in arrDict) {
|
|
522
|
+
if (arrDict[i].value == value) {
|
|
523
|
+
return arrDict[i].label;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
function rowStyle({ row }) {
|
|
528
|
+
let chekcIdList = [];
|
|
529
|
+
chekcIdList = multipleSelection.value.map((item) => item[props.checkFlag]);
|
|
530
|
+
if (chekcIdList.includes(row[props.checkFlag])) {
|
|
531
|
+
return {
|
|
532
|
+
"background-color": "rgba(94,180,251,0.5)"
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// 监听父组件传递的数据,编辑回显
|
|
538
|
+
watch(
|
|
539
|
+
() => props.tableSelectData,
|
|
540
|
+
(newValue) => {
|
|
541
|
+
// 这里如果想要访问当前页面的一个函数的话必须保证函数在watch这段代码之前,否则会抱函数underfined。如果去掉immediate: true 那么函数位置随意。但是刚进入页面的时候这个函数是不执行的,你必须在onMount里面再去访问一次这个函数。
|
|
542
|
+
if (newValue && newValue.length > 0) {
|
|
543
|
+
multipleSelection.value = newValue;
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
//可选immediate: true马上执行
|
|
547
|
+
{ deep: true, immediate: true }
|
|
548
|
+
);
|
|
549
|
+
|
|
550
|
+
// 监听搜索参数
|
|
551
|
+
watch(
|
|
552
|
+
() => props.queryParam,
|
|
553
|
+
(newValue) => {
|
|
554
|
+
if (newValue) {
|
|
555
|
+
queryParams.value = {
|
|
556
|
+
...queryParams.value,
|
|
557
|
+
...newValue
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
{ deep: true, immediate: true }
|
|
562
|
+
);
|
|
563
|
+
getList();
|
|
564
|
+
// 抛出相应属性方法
|
|
565
|
+
defineExpose({
|
|
566
|
+
getList,
|
|
567
|
+
dialogCancel,
|
|
568
|
+
handleQuery,
|
|
569
|
+
queryParams,
|
|
570
|
+
popupTable,
|
|
571
|
+
tableSource
|
|
572
|
+
});
|
|
573
|
+
</script>
|
|
574
|
+
<style lang="scss">
|
|
575
|
+
// .custom-select-dialog .el-dialog {
|
|
576
|
+
// margin-left: 40% !important;
|
|
577
|
+
// }
|
|
578
|
+
</style>
|
|
579
|
+
<style lang="scss" scoped>
|
|
580
|
+
// 修改鼠标经过表格的颜色
|
|
581
|
+
:deep(.el-table tbody tr:hover > td) {
|
|
582
|
+
// 可以选择隐藏
|
|
583
|
+
background-color: transparent !important;
|
|
584
|
+
}
|
|
585
|
+
.el-col-header {
|
|
586
|
+
line-height: 32px;
|
|
587
|
+
font-size: 14px;
|
|
588
|
+
font-weight: 600;
|
|
589
|
+
text-align: center;
|
|
590
|
+
margin: 0;
|
|
591
|
+
color: #fff;
|
|
592
|
+
background-color: var(--el-color-primary);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
.selectUl {
|
|
596
|
+
// height: 560px;
|
|
597
|
+
width: 100%;
|
|
598
|
+
overflow-y: scroll;
|
|
599
|
+
padding: 6px 0;
|
|
600
|
+
// background-color: rgba(245, 247, 250, 1);
|
|
601
|
+
border-bottom-left-radius: 6px;
|
|
602
|
+
border-bottom-right-radius: 6px;
|
|
603
|
+
/* 隐藏滚动条的整个部分 */
|
|
604
|
+
&::-webkit-scrollbar {
|
|
605
|
+
display: none;
|
|
606
|
+
}
|
|
607
|
+
:deep(.el-tag) {
|
|
608
|
+
margin: 0 !important;
|
|
609
|
+
margin-bottom: 6px !important;
|
|
610
|
+
width: 100%;
|
|
611
|
+
display: flex;
|
|
612
|
+
justify-content: space-between;
|
|
613
|
+
.el-tag__content {
|
|
614
|
+
overflow: hidden;
|
|
615
|
+
white-space: nowrap;
|
|
616
|
+
text-overflow: ellipsis;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
.edl-dialog-div {
|
|
621
|
+
// Token 由 css-var-compile.css 全局统一管理
|
|
622
|
+
}
|
|
623
|
+
.dialog-footer {
|
|
624
|
+
display: flex;
|
|
625
|
+
justify-content: flex-end;
|
|
626
|
+
align-items: center;
|
|
627
|
+
gap: 8px;
|
|
628
|
+
}
|
|
629
|
+
.popup-pagination {
|
|
630
|
+
display: flex;
|
|
631
|
+
justify-content: flex-end;
|
|
632
|
+
margin-top: 4px;
|
|
633
|
+
}
|
|
634
|
+
</style>
|