arms-app 1.0.68 → 1.0.69
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/package.json +1 -1
- package/view/{5.vue → index.vue} +18 -47
- package/view/1.js +0 -23
- package/view/1.vue +0 -117
- package/view/111.js +0 -35
- package/view/2.js +0 -90
- package/view/2.vue +0 -129
- package/view/3.js +0 -289
- package/view/3.vue +0 -289
- package/view/4.vue +0 -473
- package/view/555.vue +0 -196
- package/view/CallRecordDetail.vue +0 -101
- package/view/ListedCompaniesView copy.vue +0 -238
- package/view/ListedCompaniesView.vue +0 -224
- package/view/ListedEnterprisesView.vue +0 -206
- package/view/ListedIncrementalEnterprisesView.vue +0 -195
- package/view/index.html +0 -51
- package/view//345/205/250/345/261/217.png +0 -0
- package/view//351/200/200/345/207/272/345/205/250/345/261/217.png +0 -0
package/view/4.vue
DELETED
|
@@ -1,473 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 人员信息表页面 -->
|
|
3
|
-
<section class="person-table-page">
|
|
4
|
-
<!-- 页面标题 -->
|
|
5
|
-
<h1>人员信息表</h1>
|
|
6
|
-
<!-- 工具栏:新增按钮 -->
|
|
7
|
-
<div class="toolbar">
|
|
8
|
-
<el-button type="primary" size="mini" @click="onOpenAdd">新增</el-button>
|
|
9
|
-
</div>
|
|
10
|
-
<!-- 人员信息表格 -->
|
|
11
|
-
<el-table
|
|
12
|
-
:data="rows"
|
|
13
|
-
border
|
|
14
|
-
stripe
|
|
15
|
-
size="small"
|
|
16
|
-
style="width: 100%"
|
|
17
|
-
>
|
|
18
|
-
<!-- 序号列 -->
|
|
19
|
-
<el-table-column type="index" label="序号" width="60" align="center" header-align="center" />
|
|
20
|
-
<!-- 基础信息列 -->
|
|
21
|
-
<el-table-column prop="name" label="人员姓名" min-width="100" align="center" header-align="center" />
|
|
22
|
-
<el-table-column label="性别" width="80" align="center" header-align="center">
|
|
23
|
-
<template slot-scope="scope">
|
|
24
|
-
{{ formatSex(scope.row.sex) }}
|
|
25
|
-
</template>
|
|
26
|
-
</el-table-column>
|
|
27
|
-
<el-table-column prop="postName" label="岗位" min-width="80" align="center" header-align="center" />
|
|
28
|
-
<el-table-column prop="happenPerio" label="入行日期" min-width="110" align="center" header-align="center" />
|
|
29
|
-
<el-table-column prop="telNo" label="联系方式" min-width="130" align="center" header-align="center" />
|
|
30
|
-
<el-table-column prop="dtlAddr" label="现居住地" min-width="120" align="center" header-align="center" />
|
|
31
|
-
<el-table-column prop="emergContactPersonName" label="紧急联系人" min-width="100" align="center" header-align="center" />
|
|
32
|
-
<el-table-column prop="emergContactPhoneNo" label="紧急联系方式" min-width="130" align="center" header-align="center" />
|
|
33
|
-
<el-table-column prop="birthDt" label="出生日期" min-width="110" align="center" header-align="center" />
|
|
34
|
-
<el-table-column prop="最高EduDegreeDesc" label="最高学历" min-width="90" align="center" header-align="center" />
|
|
35
|
-
<el-table-column prop="createTm" label="创建日期" min-width="110" align="center" header-align="center" />
|
|
36
|
-
<el-table-column prop="rmk" label="备注" min-width="120" align="center" header-align="center" />
|
|
37
|
-
<!-- 操作列:详情、编辑、删除 -->
|
|
38
|
-
<el-table-column label="操作" width="200" align="center" header-align="center">
|
|
39
|
-
<template slot-scope="scope">
|
|
40
|
-
<el-button type="text" size="mini" @click="onView(scope.row)">详情</el-button>
|
|
41
|
-
<el-button type="text" size="mini" @click="onEdit(scope.row)">编辑</el-button>
|
|
42
|
-
<el-button type="text" size="mini" @click="onRemove(scope.row)">删除</el-button>
|
|
43
|
-
</template>
|
|
44
|
-
</el-table-column>
|
|
45
|
-
</el-table>
|
|
46
|
-
|
|
47
|
-
<!-- 新增/编辑/查看 弹窗 -->
|
|
48
|
-
<el-dialog
|
|
49
|
-
:title="dialogTitle"
|
|
50
|
-
:visible.sync="dialogVisible"
|
|
51
|
-
width="720px"
|
|
52
|
-
>
|
|
53
|
-
<!-- 人员信息表单 -->
|
|
54
|
-
<el-form
|
|
55
|
-
ref="addForm"
|
|
56
|
-
:model="form"
|
|
57
|
-
:rules="rules"
|
|
58
|
-
label-width="90px"
|
|
59
|
-
size="small"
|
|
60
|
-
>
|
|
61
|
-
<!-- 第一行:姓名、岗位 -->
|
|
62
|
-
<el-row :gutter="16">
|
|
63
|
-
<el-col :span="12">
|
|
64
|
-
<el-form-item label="人员姓名" prop="name">
|
|
65
|
-
<el-input v-model="form.name" placeholder="请输入" :disabled="isView" />
|
|
66
|
-
</el-form-item>
|
|
67
|
-
</el-col>
|
|
68
|
-
<el-col :span="12">
|
|
69
|
-
<el-form-item label="岗位" prop="postName">
|
|
70
|
-
<el-select v-model="form.postName" placeholder="请选择" style="width: 100%" :disabled="isView">
|
|
71
|
-
<el-option
|
|
72
|
-
v-for="opt in postOptions"
|
|
73
|
-
:key="opt"
|
|
74
|
-
:label="opt"
|
|
75
|
-
:value="opt"
|
|
76
|
-
/>
|
|
77
|
-
</el-select>
|
|
78
|
-
</el-form-item>
|
|
79
|
-
</el-col>
|
|
80
|
-
</el-row>
|
|
81
|
-
<!-- 第二行:入行日期、性别 -->
|
|
82
|
-
<el-row :gutter="16">
|
|
83
|
-
<el-col :span="12">
|
|
84
|
-
<el-form-item label="入行日期" prop="happenPerio">
|
|
85
|
-
<el-date-picker
|
|
86
|
-
v-model="form.happenPerio"
|
|
87
|
-
type="date"
|
|
88
|
-
placeholder="请选择"
|
|
89
|
-
value-format="yyyy-MM-dd"
|
|
90
|
-
style="width: 100%"
|
|
91
|
-
:disabled="isView"
|
|
92
|
-
/>
|
|
93
|
-
</el-form-item>
|
|
94
|
-
</el-col>
|
|
95
|
-
<el-col :span="12">
|
|
96
|
-
<el-form-item label="性别" prop="sex">
|
|
97
|
-
<el-select v-model="form.sex" placeholder="请选择" style="width: 100%" :disabled="isView">
|
|
98
|
-
<el-option label="男" value="1" />
|
|
99
|
-
<el-option label="女" value="2" />
|
|
100
|
-
</el-select>
|
|
101
|
-
</el-form-item>
|
|
102
|
-
</el-col>
|
|
103
|
-
</el-row>
|
|
104
|
-
<!-- 第三行:联系方式、出生日期 -->
|
|
105
|
-
<el-row :gutter="16">
|
|
106
|
-
<el-col :span="12">
|
|
107
|
-
<el-form-item label="联系方式" prop="telNo">
|
|
108
|
-
<el-input v-model="form.telNo" placeholder="请输入" :disabled="isView" />
|
|
109
|
-
</el-form-item>
|
|
110
|
-
</el-col>
|
|
111
|
-
<el-col :span="12">
|
|
112
|
-
<el-form-item label="出生日期" prop="birthDt">
|
|
113
|
-
<el-date-picker
|
|
114
|
-
v-model="form.birthDt"
|
|
115
|
-
type="date"
|
|
116
|
-
placeholder="请选择"
|
|
117
|
-
value-format="yyyy-MM-dd"
|
|
118
|
-
style="width: 100%"
|
|
119
|
-
:disabled="isView"
|
|
120
|
-
/>
|
|
121
|
-
</el-form-item>
|
|
122
|
-
</el-col>
|
|
123
|
-
</el-row>
|
|
124
|
-
<!-- 第四行:家庭住址 -->
|
|
125
|
-
<el-row :gutter="16">
|
|
126
|
-
<el-col :span="24">
|
|
127
|
-
<el-form-item label="家庭住址" prop="dtlAddr">
|
|
128
|
-
<el-input v-model="form.dtlAddr" placeholder="请输入" :disabled="isView" />
|
|
129
|
-
</el-form-item>
|
|
130
|
-
</el-col>
|
|
131
|
-
</el-row>
|
|
132
|
-
<!-- 第五行:紧急联系人及联系方式 -->
|
|
133
|
-
<el-row :gutter="16">
|
|
134
|
-
<el-col :span="12">
|
|
135
|
-
<el-form-item label="紧急联系人" prop="emergContactPersonName">
|
|
136
|
-
<el-input v-model="form.emergContactPersonName" placeholder="请输入" :disabled="isView" />
|
|
137
|
-
</el-form-item>
|
|
138
|
-
</el-col>
|
|
139
|
-
<el-col :span="12">
|
|
140
|
-
<el-form-item label="紧急联系方式" prop="emergContactPhoneNo">
|
|
141
|
-
<el-input v-model="form.emergContactPhoneNo" placeholder="请输入" :disabled="isView" />
|
|
142
|
-
</el-form-item>
|
|
143
|
-
</el-col>
|
|
144
|
-
</el-row>
|
|
145
|
-
<!-- 第六行:最高学历、备注 -->
|
|
146
|
-
<el-row :gutter="16">
|
|
147
|
-
<el-col :span="12">
|
|
148
|
-
<el-form-item label="最高学历" prop="highestEduDegreeDesc">
|
|
149
|
-
<el-select v-model="form.highestEduDegreeDesc" placeholder="请选择" style="width: 100%" :disabled="isView">
|
|
150
|
-
<el-option
|
|
151
|
-
v-for="opt in eduOptions"
|
|
152
|
-
:key="opt"
|
|
153
|
-
:label="opt"
|
|
154
|
-
:value="opt"
|
|
155
|
-
/>
|
|
156
|
-
</el-select>
|
|
157
|
-
</el-form-item>
|
|
158
|
-
</el-col>
|
|
159
|
-
<el-col :span="12">
|
|
160
|
-
<el-form-item label="备注" prop="rmk">
|
|
161
|
-
<el-input
|
|
162
|
-
v-model="form.rmk"
|
|
163
|
-
type="textarea"
|
|
164
|
-
:rows="3"
|
|
165
|
-
maxlength="100"
|
|
166
|
-
show-word-limit
|
|
167
|
-
placeholder="请输入"
|
|
168
|
-
:disabled="isView"
|
|
169
|
-
/>
|
|
170
|
-
</el-form-item>
|
|
171
|
-
</el-col>
|
|
172
|
-
</el-row>
|
|
173
|
-
<!-- 第七行:附件上传 -->
|
|
174
|
-
<el-row :gutter="16">
|
|
175
|
-
<el-col :span="24">
|
|
176
|
-
<el-form-item label="选择文件">
|
|
177
|
-
<el-upload
|
|
178
|
-
class="upload-block"
|
|
179
|
-
drag
|
|
180
|
-
action="#"
|
|
181
|
-
:auto-upload="false"
|
|
182
|
-
:file-list="fileList"
|
|
183
|
-
:on-change="onFileChange"
|
|
184
|
-
:on-remove="onFileRemove"
|
|
185
|
-
:disabled="isView"
|
|
186
|
-
>
|
|
187
|
-
<el-button type="primary" plain>上传文件</el-button>
|
|
188
|
-
<div slot="tip" class="el-upload__tip">
|
|
189
|
-
支持格式:png/jpg/docx/pdf,单个文件不能超过10mb
|
|
190
|
-
</div>
|
|
191
|
-
</el-upload>
|
|
192
|
-
</el-form-item>
|
|
193
|
-
</el-col>
|
|
194
|
-
</el-row>
|
|
195
|
-
</el-form>
|
|
196
|
-
<!-- 弹窗底部按钮 -->
|
|
197
|
-
<span slot="footer" class="dialog-footer">
|
|
198
|
-
<el-button @click="dialogVisible = false">取消</el-button>
|
|
199
|
-
<el-button
|
|
200
|
-
v-if="dialogMode !== 'view'"
|
|
201
|
-
type="primary"
|
|
202
|
-
@click="onSave"
|
|
203
|
-
>
|
|
204
|
-
保存
|
|
205
|
-
</el-button>
|
|
206
|
-
</span>
|
|
207
|
-
</el-dialog>
|
|
208
|
-
</section>
|
|
209
|
-
</template>
|
|
210
|
-
|
|
211
|
-
<script>
|
|
212
|
-
export default {
|
|
213
|
-
name: "PersonTableView",
|
|
214
|
-
data() {
|
|
215
|
-
return {
|
|
216
|
-
// 表格数据源:人员列表
|
|
217
|
-
rows: [
|
|
218
|
-
{
|
|
219
|
-
// 唯一标识
|
|
220
|
-
id: 3286648151643648,
|
|
221
|
-
// 人员姓名
|
|
222
|
-
name: "李白",
|
|
223
|
-
// 性别:1-男,2-女
|
|
224
|
-
sex: "1",
|
|
225
|
-
// 岗位名称
|
|
226
|
-
postName: "保洁",
|
|
227
|
-
// 入行日期(yyyy-MM-dd)
|
|
228
|
-
happenPerio: "2002-02-02",
|
|
229
|
-
// 联系电话
|
|
230
|
-
telNo: "18966541247",
|
|
231
|
-
// 现居住地
|
|
232
|
-
dtlAddr: "北京",
|
|
233
|
-
// 紧急联系人姓名
|
|
234
|
-
emergContactPersonName: "王安石",
|
|
235
|
-
// 紧急联系人电话
|
|
236
|
-
emergContactPhoneNo: "15466257489",
|
|
237
|
-
// 出生日期(yyyy-MM-dd)
|
|
238
|
-
birthDt: "2000-02-02",
|
|
239
|
-
// 最高学历说明
|
|
240
|
-
highestEduDegreeDesc: "硕士",
|
|
241
|
-
// 创建日期(yyyy-MM-dd)
|
|
242
|
-
createTm: "2025-12-25",
|
|
243
|
-
// 备注信息
|
|
244
|
-
rmk: "好人",
|
|
245
|
-
// 所属机构号
|
|
246
|
-
beloOrgNO: "000291",
|
|
247
|
-
// 创建人工号
|
|
248
|
-
creatorNo: "022171",
|
|
249
|
-
// 删除标识:0-正常 1-删除
|
|
250
|
-
delFlag: "0",
|
|
251
|
-
},
|
|
252
|
-
],
|
|
253
|
-
// 弹窗显隐状态
|
|
254
|
-
dialogVisible: false,
|
|
255
|
-
// 弹窗模式:add 新增 / edit 编辑 / view 查看
|
|
256
|
-
dialogMode: "add",
|
|
257
|
-
// 当前编辑或查看的人员ID
|
|
258
|
-
editingId: null,
|
|
259
|
-
// 表单数据模型
|
|
260
|
-
form: {
|
|
261
|
-
// 人员姓名
|
|
262
|
-
name: "",
|
|
263
|
-
// 性别:1-男,2-女
|
|
264
|
-
sex: "",
|
|
265
|
-
// 岗位名称
|
|
266
|
-
postName: "",
|
|
267
|
-
// 入行日期
|
|
268
|
-
happenPerio: "",
|
|
269
|
-
// 联系电话
|
|
270
|
-
telNo: "",
|
|
271
|
-
// 家庭住址
|
|
272
|
-
dtlAddr: "",
|
|
273
|
-
// 紧急联系人姓名
|
|
274
|
-
emergContactPersonName: "",
|
|
275
|
-
// 紧急联系人电话
|
|
276
|
-
emergContactPhoneNo: "",
|
|
277
|
-
// 出生日期
|
|
278
|
-
birthDt: "",
|
|
279
|
-
// 最高学历说明
|
|
280
|
-
highestEduDegreeDesc: "",
|
|
281
|
-
// 备注信息
|
|
282
|
-
rmk: "",
|
|
283
|
-
},
|
|
284
|
-
// 表单校验规则
|
|
285
|
-
rules: {
|
|
286
|
-
name: [{ required: true, message: "请输入人员姓名", trigger: "blur" }],
|
|
287
|
-
postName: [{ required: true, message: "请选择岗位", trigger: "change" }],
|
|
288
|
-
sex: [{ required: true, message: "请选择性别", trigger: "change" }],
|
|
289
|
-
happenPerio: [{ required: true, message: "请选择入行日期", trigger: "change" }],
|
|
290
|
-
telNo: [{ required: true, message: "请输入联系方式", trigger: "blur" }],
|
|
291
|
-
emergContactPersonName: [{ required: true, message: "请输入紧急联系人", trigger: "blur" }],
|
|
292
|
-
emergContactPhoneNo: [{ required: true, message: "请输入紧急联系方式", trigger: "blur" }],
|
|
293
|
-
},
|
|
294
|
-
// 岗位下拉选项
|
|
295
|
-
postOptions: ["保洁", "柜员", "客户经理", "运营专员"],
|
|
296
|
-
// 学历下拉选项
|
|
297
|
-
eduOptions: ["大专", "本科", "硕士", "博士"],
|
|
298
|
-
// 上传的附件列表
|
|
299
|
-
fileList: [],
|
|
300
|
-
};
|
|
301
|
-
},
|
|
302
|
-
computed: {
|
|
303
|
-
// 弹窗标题文案
|
|
304
|
-
dialogTitle() {
|
|
305
|
-
if (this.dialogMode === "edit") return "编辑";
|
|
306
|
-
if (this.dialogMode === "view") return "详情";
|
|
307
|
-
return "新增";
|
|
308
|
-
},
|
|
309
|
-
// 是否为只读查看模式
|
|
310
|
-
isView() {
|
|
311
|
-
return this.dialogMode === "view";
|
|
312
|
-
},
|
|
313
|
-
},
|
|
314
|
-
methods: {
|
|
315
|
-
// 性别字段格式化显示
|
|
316
|
-
formatSex(v) {
|
|
317
|
-
if (v === "1" || v === 1) return "男";
|
|
318
|
-
if (v === "2" || v === 2) return "女";
|
|
319
|
-
return "";
|
|
320
|
-
},
|
|
321
|
-
// 打开新增弹窗
|
|
322
|
-
onOpenAdd() {
|
|
323
|
-
this.dialogVisible = true;
|
|
324
|
-
this.dialogMode = "add";
|
|
325
|
-
this.editingId = null;
|
|
326
|
-
this.resetForm();
|
|
327
|
-
},
|
|
328
|
-
// 打开编辑弹窗并回显数据
|
|
329
|
-
onEdit(row) {
|
|
330
|
-
this.dialogMode = "edit";
|
|
331
|
-
this.editingId = row.id;
|
|
332
|
-
this.dialogVisible = true;
|
|
333
|
-
this.form = {
|
|
334
|
-
name: row.name || "",
|
|
335
|
-
sex: row.sex || "",
|
|
336
|
-
postName: row.postName || "",
|
|
337
|
-
happenPerio: row.happenPerio || "",
|
|
338
|
-
telNo: row.telNo || "",
|
|
339
|
-
dtlAddr: row.dtlAddr || "",
|
|
340
|
-
emergContactPersonName: row.emergContactPersonName || "",
|
|
341
|
-
emergContactPhoneNo: row.emergContactPhoneNo || "",
|
|
342
|
-
birthDt: row.birthDt || "",
|
|
343
|
-
highestEduDegreeDesc: row.highestEduDegreeDesc || "",
|
|
344
|
-
rmk: row.rmk || "",
|
|
345
|
-
createTm: row.createTm || "",
|
|
346
|
-
};
|
|
347
|
-
this.fileList = [];
|
|
348
|
-
if (this.$refs.addForm) {
|
|
349
|
-
this.$refs.addForm.clearValidate();
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
// 打开详情弹窗(只读)
|
|
353
|
-
onView(row) {
|
|
354
|
-
this.dialogMode = "view";
|
|
355
|
-
this.editingId = row.id;
|
|
356
|
-
this.dialogVisible = true;
|
|
357
|
-
this.form = {
|
|
358
|
-
name: row.name || "",
|
|
359
|
-
sex: row.sex || "",
|
|
360
|
-
postName: row.postName || "",
|
|
361
|
-
happenPerio: row.happenPerio || "",
|
|
362
|
-
telNo: row.telNo || "",
|
|
363
|
-
dtlAddr: row.dtlAddr || "",
|
|
364
|
-
emergContactPersonName: row.emergContactPersonName || "",
|
|
365
|
-
emergContactPhoneNo: row.emergContactPhoneNo || "",
|
|
366
|
-
birthDt: row.birthDt || "",
|
|
367
|
-
highestEduDegreeDesc: row.highestEduDegreeDesc || "",
|
|
368
|
-
rmk: row.rmk || "",
|
|
369
|
-
createTm: row.createTm || "",
|
|
370
|
-
};
|
|
371
|
-
this.fileList = [];
|
|
372
|
-
if (this.$refs.addForm) {
|
|
373
|
-
this.$refs.addForm.clearValidate();
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
// 重置表单数据及校验
|
|
377
|
-
resetForm() {
|
|
378
|
-
this.form = {
|
|
379
|
-
name: "",
|
|
380
|
-
sex: "",
|
|
381
|
-
postName: "",
|
|
382
|
-
happenPerio: "",
|
|
383
|
-
telNo: "",
|
|
384
|
-
dtlAddr: "",
|
|
385
|
-
emergContactPersonName: "",
|
|
386
|
-
emergContactPhoneNo: "",
|
|
387
|
-
birthDt: "",
|
|
388
|
-
highestEduDegreeDesc: "",
|
|
389
|
-
rmk: "",
|
|
390
|
-
};
|
|
391
|
-
this.fileList = [];
|
|
392
|
-
if (this.$refs.addForm) {
|
|
393
|
-
this.$refs.addForm.clearValidate();
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
// 文件选择变更回调
|
|
397
|
-
onFileChange(file, fileList) {
|
|
398
|
-
this.fileList = fileList.slice();
|
|
399
|
-
},
|
|
400
|
-
// 文件移除回调
|
|
401
|
-
onFileRemove(file, fileList) {
|
|
402
|
-
this.fileList = fileList.slice();
|
|
403
|
-
},
|
|
404
|
-
// 保存(新增或编辑)人员信息
|
|
405
|
-
onSave() {
|
|
406
|
-
if (!this.$refs.addForm) return;
|
|
407
|
-
this.$refs.addForm.validate((valid) => {
|
|
408
|
-
if (!valid) return;
|
|
409
|
-
const now = new Date();
|
|
410
|
-
const createTm =
|
|
411
|
-
this.form.createTm ||
|
|
412
|
-
`${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(
|
|
413
|
-
now.getDate()
|
|
414
|
-
).padStart(2, "0")}`;
|
|
415
|
-
const base = {
|
|
416
|
-
name: this.form.name,
|
|
417
|
-
sex: this.form.sex,
|
|
418
|
-
postName: this.form.postName,
|
|
419
|
-
happenPerio: this.form.happenPerio,
|
|
420
|
-
telNo: this.form.telNo,
|
|
421
|
-
dtlAddr: this.form.dtlAddr,
|
|
422
|
-
emergContactPersonName: this.form.emergContactPersonName,
|
|
423
|
-
emergContactPhoneNo: this.form.emergContactPhoneNo,
|
|
424
|
-
birthDt: this.form.birthDt,
|
|
425
|
-
highestEduDegreeDesc: this.form.highestEduDegreeDesc,
|
|
426
|
-
createTm,
|
|
427
|
-
rmk: this.form.rmk,
|
|
428
|
-
beloOrgNO: "",
|
|
429
|
-
creatorNo: "",
|
|
430
|
-
delFlag: "0",
|
|
431
|
-
};
|
|
432
|
-
if (this.dialogMode === "edit" && this.editingId) {
|
|
433
|
-
// 编辑模式:更新原有记录
|
|
434
|
-
this.rows = this.rows.map((r) =>
|
|
435
|
-
r.id === this.editingId
|
|
436
|
-
? Object.assign({}, r, base, { id: r.id })
|
|
437
|
-
: r
|
|
438
|
-
);
|
|
439
|
-
} else {
|
|
440
|
-
// 新增模式:追加新记录
|
|
441
|
-
const row = Object.assign({}, base, { id: Date.now() });
|
|
442
|
-
this.rows = this.rows.concat(row);
|
|
443
|
-
}
|
|
444
|
-
this.dialogVisible = false;
|
|
445
|
-
});
|
|
446
|
-
},
|
|
447
|
-
// 删除人员信息
|
|
448
|
-
onRemove(row) {
|
|
449
|
-
if (!row || !row.id) return;
|
|
450
|
-
this.$confirm("确认删除该人员吗?", "提示", { type: "warning" })
|
|
451
|
-
.then(() => {
|
|
452
|
-
this.rows = this.rows.filter((r) => r.id !== row.id);
|
|
453
|
-
})
|
|
454
|
-
.catch(() => {});
|
|
455
|
-
},
|
|
456
|
-
},
|
|
457
|
-
};
|
|
458
|
-
</script>
|
|
459
|
-
|
|
460
|
-
<style scoped>
|
|
461
|
-
.person-table-page {
|
|
462
|
-
padding: 24px;
|
|
463
|
-
}
|
|
464
|
-
.toolbar {
|
|
465
|
-
margin-bottom: 12px;
|
|
466
|
-
}
|
|
467
|
-
.upload-block {
|
|
468
|
-
width: 100%;
|
|
469
|
-
}
|
|
470
|
-
.dialog-footer {
|
|
471
|
-
text-align: center;
|
|
472
|
-
}
|
|
473
|
-
</style>
|
package/view/555.vue
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 列拖拽示例页面 -->
|
|
3
|
-
<section class="draggable-columns-table-page">
|
|
4
|
-
<!-- 标题与说明 -->
|
|
5
|
-
<h1>列拖拽表格</h1>
|
|
6
|
-
<p class="desc">通过拖拽表头,使用 sortablejs 实现列换位。</p>
|
|
7
|
-
|
|
8
|
-
<!-- 表格:通过 columns 数组驱动列配置 -->
|
|
9
|
-
<el-table
|
|
10
|
-
ref="draggableTable"
|
|
11
|
-
:key="tableKey"
|
|
12
|
-
:data="rows"
|
|
13
|
-
border
|
|
14
|
-
stripe
|
|
15
|
-
style="width: 100%"
|
|
16
|
-
height="420"
|
|
17
|
-
>
|
|
18
|
-
<!-- 固定的序号列,不参与拖拽换位 -->
|
|
19
|
-
<el-table-column type="index" label="#" width="60" />
|
|
20
|
-
|
|
21
|
-
<!-- 动态业务列:所有可拖拽的列 -->
|
|
22
|
-
<el-table-column
|
|
23
|
-
v-for="col in columns"
|
|
24
|
-
:key="col.prop"
|
|
25
|
-
:prop="col.prop"
|
|
26
|
-
:label="col.label"
|
|
27
|
-
:width="col.width"
|
|
28
|
-
:min-width="col.minWidth"
|
|
29
|
-
:align="col.align || 'left'"
|
|
30
|
-
:header-align="col.headerAlign || col.align || 'left'"
|
|
31
|
-
>
|
|
32
|
-
<!-- 表头插槽:添加拖拽手柄,作为 sortablejs 的 handle -->
|
|
33
|
-
<template slot="header">
|
|
34
|
-
<div class="header-draggable">
|
|
35
|
-
<span class="header-label">{{ col.label }}</span>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
<!-- 单元格内容:根据列配置动态渲染字段 -->
|
|
39
|
-
<template slot-scope="scope">
|
|
40
|
-
<span>{{ scope.row[col.prop] }}</span>
|
|
41
|
-
</template>
|
|
42
|
-
</el-table-column>
|
|
43
|
-
</el-table>
|
|
44
|
-
</section>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
import Sortable from "sortablejs";
|
|
49
|
-
|
|
50
|
-
export default {
|
|
51
|
-
name: "DraggableColumnsTableView",
|
|
52
|
-
data() {
|
|
53
|
-
return {
|
|
54
|
-
// 表格行数据:示例客户信息
|
|
55
|
-
rows: [
|
|
56
|
-
{
|
|
57
|
-
id: 1,
|
|
58
|
-
name: "王小虎",
|
|
59
|
-
customerTag: "重点客户",
|
|
60
|
-
manager: "张三",
|
|
61
|
-
contribution: 12000,
|
|
62
|
-
pass1: 98,
|
|
63
|
-
pass2: 87,
|
|
64
|
-
pass3: 93,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
id: 2,
|
|
68
|
-
name: "李小虎",
|
|
69
|
-
customerTag: "潜在客户",
|
|
70
|
-
manager: "李四",
|
|
71
|
-
contribution: 8600,
|
|
72
|
-
pass1: 88,
|
|
73
|
-
pass2: 90,
|
|
74
|
-
pass3: 85,
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: 3,
|
|
78
|
-
name: "赵六",
|
|
79
|
-
customerTag: "普通客户",
|
|
80
|
-
manager: "王五",
|
|
81
|
-
contribution: 5400,
|
|
82
|
-
pass1: 76,
|
|
83
|
-
pass2: 80,
|
|
84
|
-
pass3: 79,
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
// 列配置:用于驱动 el-table-column 渲染,同时作为拖拽排序的数据源
|
|
88
|
-
columns: [
|
|
89
|
-
{ prop: "name", label: "姓名", width: 160, align: "center" },
|
|
90
|
-
{ prop: "customerTag", label: "客户标签", width: 120, align: "center" },
|
|
91
|
-
{ prop: "manager", label: "客户人", width: 160, align: "center" },
|
|
92
|
-
{ prop: "contribution", label: "贡献积分", width: 120, align: "right", headerAlign: "center" },
|
|
93
|
-
{ prop: "pass1", label: "通关1", width: 100, align: "center" },
|
|
94
|
-
{ prop: "pass2", label: "通关2", width: 100, align: "center" },
|
|
95
|
-
{ prop: "pass3", label: "通关3", width: 100, align: "center" },
|
|
96
|
-
],
|
|
97
|
-
// sortablejs 实例,用于在组件销毁时释放
|
|
98
|
-
headerSortable: null,
|
|
99
|
-
// 用于强制重建 el-table,确保列顺序与数据完全同步
|
|
100
|
-
tableKey: 0,
|
|
101
|
-
isDestroyed: false,
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
mounted() {
|
|
105
|
-
// 表格渲染完成后,初始化表头拖拽能力
|
|
106
|
-
this.$nextTick(() => {
|
|
107
|
-
this.initColumnDrag();
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
beforeDestroy() {
|
|
111
|
-
// 组件销毁前销毁 sortable 实例,避免内存泄露
|
|
112
|
-
this.isDestroyed = true;
|
|
113
|
-
if (this.headerSortable && this.headerSortable.destroy) {
|
|
114
|
-
this.headerSortable.destroy();
|
|
115
|
-
this.headerSortable = null;
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
methods: {
|
|
119
|
-
// 初始化列拖拽:绑定在 ElementUI 表格头部行上
|
|
120
|
-
initColumnDrag() {
|
|
121
|
-
if (this.isDestroyed) return;
|
|
122
|
-
// 已存在实例时先销毁,避免重复绑定和内存泄漏
|
|
123
|
-
if (this.headerSortable && this.headerSortable.destroy) {
|
|
124
|
-
this.headerSortable.destroy();
|
|
125
|
-
this.headerSortable = null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const table = this.$refs.draggableTable;
|
|
129
|
-
if (!table || !table.$el) return;
|
|
130
|
-
|
|
131
|
-
// ElementUI 表头 DOM:thead 里的第一行 tr
|
|
132
|
-
const headerRow = table.$el.querySelector(".el-table__header-wrapper thead tr");
|
|
133
|
-
if (!headerRow) return;
|
|
134
|
-
|
|
135
|
-
this.headerSortable = Sortable.create(headerRow, {
|
|
136
|
-
// 拖拽动画时长(毫秒)
|
|
137
|
-
animation: 150,
|
|
138
|
-
// 只允许拖拽 header-draggable 区域作为手柄
|
|
139
|
-
handle: ".header-draggable",
|
|
140
|
-
// 可被拖动的元素类型:表头单元格 th
|
|
141
|
-
draggable: "th",
|
|
142
|
-
// 拖拽结束时回调:根据新旧索引更新 columns 顺序
|
|
143
|
-
onEnd: (evt) => {
|
|
144
|
-
const { oldIndex, newIndex } = evt;
|
|
145
|
-
if (oldIndex == null || newIndex == null) return;
|
|
146
|
-
|
|
147
|
-
// 第 0 列是 index 序号列,从第 1 列开始才对应 columns[0]
|
|
148
|
-
const from = oldIndex - 1;
|
|
149
|
-
const to = newIndex - 1;
|
|
150
|
-
if (from < 0 || to < 0 || from >= this.columns.length || to >= this.columns.length) return;
|
|
151
|
-
|
|
152
|
-
// 交换 columns 中两列的位置,实现“换列”
|
|
153
|
-
const list = this.columns.slice();
|
|
154
|
-
[list[from], list[to]] = [list[to], list[from]];
|
|
155
|
-
this.columns = list;
|
|
156
|
-
|
|
157
|
-
// 强制重建表格组件,避免 ElementUI 内部列状态与 DOM 拖拽产生偏差,
|
|
158
|
-
// 重建后在下一个 tick 重新绑定 sortable
|
|
159
|
-
this.tableKey += 1;
|
|
160
|
-
this.$nextTick(() => {
|
|
161
|
-
this.initColumnDrag();
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
});
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
</script>
|
|
169
|
-
|
|
170
|
-
<style scoped>
|
|
171
|
-
.draggable-columns-table-page {
|
|
172
|
-
padding: 24px;
|
|
173
|
-
}
|
|
174
|
-
h1 {
|
|
175
|
-
margin: 0 0 12px;
|
|
176
|
-
font-size: 20px;
|
|
177
|
-
}
|
|
178
|
-
.desc {
|
|
179
|
-
margin: 0 0 16px;
|
|
180
|
-
color: #666;
|
|
181
|
-
}
|
|
182
|
-
.header-draggable {
|
|
183
|
-
display: inline-flex;
|
|
184
|
-
align-items: center;
|
|
185
|
-
cursor: move;
|
|
186
|
-
user-select: none;
|
|
187
|
-
}
|
|
188
|
-
.drag-icon {
|
|
189
|
-
margin-right: 4px;
|
|
190
|
-
font-size: 14px;
|
|
191
|
-
color: #999;
|
|
192
|
-
}
|
|
193
|
-
.header-label {
|
|
194
|
-
white-space: nowrap;
|
|
195
|
-
}
|
|
196
|
-
</style>
|