Blame view

src/views/user/picuserimport.vue 13 KB
bde7e20f   周超   用户导入记录
1
  <template>
e1644c39   yangzhi   王哥起来屙尿了
2
    <div style="padding: 10px">
bde7e20f   周超   用户导入记录
3
      <div class="seetingsDiv" style="">
e1644c39   yangzhi   王哥起来屙尿了
4
        <div class="flex" style="margin-top: 10px">
bde7e20f   周超   用户导入记录
5
6
          <el-form :inline="true" class="demo-form-inline">
            <el-form-item label="关键字">
e1644c39   yangzhi   王哥起来屙尿了
7
8
9
10
              <el-input
                placeholder="输入关键字搜索"
                v-model="query.keyword"
              ></el-input>
bde7e20f   周超   用户导入记录
11
12
            </el-form-item>
  
bde7e20f   周超   用户导入记录
13
14
15
16
17
18
19
20
21
22
23
24
25
26
            <el-form-item label="最高学历">
              <el-select v-model="query.xueli" placeholder="最高学历">
                <el-option label="大专" value="dazhuan"></el-option>
                <el-option label="本科" value="benke"></el-option>
                <el-option label="博士" value="boshi"></el-option>
              </el-select>
            </el-form-item>
  
            <el-form-item label="性别">
              <el-select v-model="query.sex" placeholder="性别">
                <el-option label="男" value="1"></el-option>
                <el-option label="女" value="0"></el-option>
              </el-select>
            </el-form-item>
bde7e20f   周超   用户导入记录
27
          </el-form>
bde7e20f   周超   用户导入记录
28
        </div>
e1644c39   yangzhi   王哥起来屙尿了
29
30
31
32
33
34
35
36
37
38
        <div class="flex align-center" style="margin-top: 10px">
          <el-button type="success" @click="search">搜索</el-button>
          <el-button size="mini" @click="handleshare()" type="primary"
            >批量入库</el-button
          >
          <el-button size="mini" @click="handleAdd()" type="primary"
            >新增一行</el-button
          >
          <el-upload
            class="upload-demo"
e6276ef2   yangzhi   超哥牛批
39
            ref="uploader"
e1644c39   yangzhi   王哥起来屙尿了
40
41
42
43
44
            action="/api//UserInfo/ResumeIdentification"
            multiple
            :headers="{
              Authorization: Authorization,
            }"
e6276ef2   yangzhi   超哥牛批
45
            :limit="100"
e1644c39   yangzhi   王哥起来屙尿了
46
47
48
49
            :show-file-list="false"
            :on-exceed="handleExceed"
            :on-success="handleSuccess"
          >
e6276ef2   yangzhi   超哥牛批
50
            <el-button size="small" type="primary">上传简历</el-button>
e1644c39   yangzhi   王哥起来屙尿了
51
52
          </el-upload>
        </div>
bde7e20f   周超   用户导入记录
53
      </div>
097e5f47   yangzhi   添加了pdf预览插件
54
      <div class="main-box">
876011a8   周超   给志哥
55
56
57
58
59
60
61
62
63
64
65
66
67
        <div class="doc-view" v-if="currentFilePath">
          <iframe
            style="width: 100%; height: 100%"
            v-if="currentFilePath  && currentFilePath.indexOf('.pdf') !=-1"
            :src="
              BASE_ROOT_DOMAIN + '/pdf/web/viewer.html?file=' + BASE_ROOT_DOMAIN +currentFilePath
            "
            frameborder="0"
          ></iframe>
          <el-image  v-else :src=" BASE_ROOT_DOMAIN +currentFilePath">
  
          </el-image>
        </div>
097e5f47   yangzhi   添加了pdf预览插件
68
69
70
71
72
73
        <el-table
          ref="mytable"
          :data="table_data"
          style="width: 100%;height:calc(100vh - 260px)"
          border
          @selection-change="handleSelectionChange"
e1644c39   yangzhi   王哥起来屙尿了
74
        >
097e5f47   yangzhi   添加了pdf预览插件
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
          <el-table-column v-if="radio" type="index" width="50"></el-table-column>
          <el-table-column
            v-if="selection"
            type="selection"
            width="55"
          ></el-table-column>
          <el-table-column
            align="center"
            v-for="(item, index, key) in table_columns"
            :width="item.width"
            :item="item"
            :key="key"
            :index="index"
            :label="item.label"
          >
            <template slot-scope="scope">
              <el-input
                v-if="scope.row.edit"
                size="small"
                v-model="scope.row[item.prop]"
                :placeholder="'请输入' + item.label"
              >
              </el-input>
              <span v-if="!scope.row.edit"
04aebc72   周超   11
99
                >{{ scope.row[item.prop] }}</span
097e5f47   yangzhi   添加了pdf预览插件
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
              >
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" width="300" fixed="right">
            <template slot-scope="scope">
              <!-- 全局控制的编辑 -->
              <div
                v-if="is_edit && scope.row.add == undefined"
                style="display: inline-block"
              >
                <!-- 编辑 -->
                <el-button
                  size="mini"
                  v-if="!scope.row.edit"
                  @click="handleEdit(scope.$index, scope.row)"
                  type="primary"
                  >编辑
                </el-button>
                <!-- 保存 -->
                <el-button
                  size="mini"
                  type="success"
                  :plain="true"
                  v-if="scope.row.edit"
                  @click="handleSave(scope.$index, scope.row)"
                  >保存</el-button
                >
                <el-button
                  size="mini"
                  :plain="true"
                  v-if="scope.row.edit"
                  @click="handleCancelSave(scope.$index, scope.row)"
                  >取消</el-button
                >
              </div>
              <!-- 添加控制 -->
              <div
                v-if="scope.row.add != undefined && scope.row.add"
                style="display: inline-block"
              >
                <!-- 保存 -->
                <el-button
                  size="mini"
                  type="success"
                  :plain="true"
                  v-if="scope.row.edit"
                  @click="handleSave(scope.$index, scope.row)"
                  >保存</el-button
                >
              </div>
              <!-- 全局控制删除 -->
e1644c39   yangzhi   王哥起来屙尿了
151
152
              <el-button
                size="mini"
097e5f47   yangzhi   添加了pdf预览插件
153
                v-if="is_delete && scope.row.add == undefined"
e1644c39   yangzhi   王哥起来屙尿了
154
                :plain="true"
097e5f47   yangzhi   添加了pdf预览插件
155
156
157
158
                type="warning"
                style="margin-left: 10px"
                @click="handleshare(scope.$index, scope.row)"
                >确认入库</el-button
e1644c39   yangzhi   王哥起来屙尿了
159
              >
e1644c39   yangzhi   王哥起来屙尿了
160
161
              <el-button
                size="mini"
097e5f47   yangzhi   添加了pdf预览插件
162
                v-if="is_delete && scope.row.add == undefined"
e1644c39   yangzhi   王哥起来屙尿了
163
                :plain="true"
097e5f47   yangzhi   添加了pdf预览插件
164
165
166
167
                type="danger"
                style="margin-left: 10px"
                @click="handleDelete(scope.$index, scope.row)"
                >删除</el-button
e1644c39   yangzhi   王哥起来屙尿了
168
              >
097e5f47   yangzhi   添加了pdf预览插件
169
170
171
            </template>
          </el-table-column>
        </el-table>
876011a8   周超   给志哥
172
      
097e5f47   yangzhi   添加了pdf预览插件
173
      </div>
e1644c39   yangzhi   王哥起来屙尿了
174
      <div class="page-box">
097e5f47   yangzhi   添加了pdf预览插件
175
176
177
178
179
        <el-pagination
          background
          layout="prev, pager, next"
          :total="queryResult.totalCount"
        >
e1644c39   yangzhi   王哥起来屙尿了
180
181
        </el-pagination>
      </div>
bde7e20f   周超   用户导入记录
182
183
184
185
    </div>
  </template>
  
  <script>
e1644c39   yangzhi   王哥起来屙尿了
186
187
188
189
190
191
192
  import {
    UserInfo_BatchToUser,
    UserInfo_Delete,
    UserInfo_Update,
    UserInfo_List,
  } from "@/api/user";
  export default {
097e5f47   yangzhi   添加了pdf预览插件
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
    data() {
      return {
        currentFilePath: "",
        queryResult: {},
        queryModel: {
          pageIndex: 1,
          pageSize: 10,
        },
        query: {},
        new_date_json: {}, //数据结构
        multipleSelection: [], //复选框,数据
        is_edit: true, //是否可编辑
        is_delete: true, //是否可删除
        selection: true, //是否需要复选框
        radio: false, //单选变色
        space_color: true, //隔行变色
        //表头信息
        table_columns: [
          {
            prop: "FullName",
            label: "姓名",
            width: "150",
          },
          {
            prop: "PhoneNumber",
            label: "手机号",
            width: "150",
          },
          {
            prop: "DateBirth",
            label: "出生日期",
            width: "180",
          },
          {
            prop: "Gender",
            label: "性别",
            width: "80",
          },
          {
            prop: "GraduationSchool",
            label: "毕业学校",
            width: "200",
          },
          {
            prop: "GraduationMajor",
            label: "专业",
            width: "200",
          },
          {
            prop: "Education",
            label: "最高学历",
            width: "",
          },
          {
            prop: "IntendedCity",
            label: "城市",
            width: "150",
          },
        ],
        //表格数据
        table_data: [],
      };
    },
e1644c39   yangzhi   王哥起来屙尿了
256
257
258
    methods: {
      handleExceed() {},
      handleSuccess(res) {
e6276ef2   yangzhi   超哥牛批
259
        this.$refs.uploader.clearFiles();
e1644c39   yangzhi   王哥起来屙尿了
260
261
        this.search();
      },
097e5f47   yangzhi   添加了pdf预览插件
262
      search() {
e1644c39   yangzhi   王哥起来屙尿了
263
264
265
266
267
268
        this.queryModel.pageIndex = 1;
        this.getList();
      },
      getList() {
        UserInfo_List(this.queryModel).then((res) => {
          this.queryResult = res.data;
097e5f47   yangzhi   添加了pdf预览插件
269
270
271
272
273
          if (res.data.data && res.data.data.length) {
            res.data.data = res.data.data.map((t) => {
              t.DataJsonObj = JSON.parse(t.DataJson);
              return t;
            });
bde7e20f   周超   用户导入记录
274
          }
e1644c39   yangzhi   王哥起来屙尿了
275
276
277
278
279
280
281
282
283
284
285
286
287
288
          this.table_data = res.data.data;
        });
      },
      //隔行变色
      tableRowClassName() {
        //选取DOM节点
        var trs = this.$refs.mytable.$el
          .getElementsByTagName("tbody")[0]
          .getElementsByTagName("tr");
        for (var i in trs) {
          if (i % 2 == 0) {
            //当隔行变色未true时改变颜色
            if (this.space_color) {
              trs[i].style.backgroundColor = "#f0f9eb";
bde7e20f   周超   用户导入记录
289
            } else {
e1644c39   yangzhi   王哥起来屙尿了
290
              trs[i].style.backgroundColor = "";
bde7e20f   周超   用户导入记录
291
292
            }
          }
e1644c39   yangzhi   王哥起来屙尿了
293
294
        }
      },
bde7e20f   周超   用户导入记录
295
  
e1644c39   yangzhi   王哥起来屙尿了
296
297
298
299
300
      //多选框
      handleSelectionChange(val) {
        this.multipleSelection = val;
        console.log("selection:", this.multipleSelection);
      },
04aebc72   周超   11
301
  
e1644c39   yangzhi   王哥起来屙尿了
302
303
      //编辑
      handleEdit(index, row) {
097e5f47   yangzhi   添加了pdf预览插件
304
305
306
307
308
        if (row.ViewPath) {
          this.currentFilePath =  row.ViewPath;
        }else{
          this.currentFilePath = '';
        }
04aebc72   周超   11
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
        // debugger;
        // if(this.table_data)
        // this.table_data = this.table_data.map(t=>{
        //   t.edit = false;
        //   return t;
        // })
        this.table_data.forEach((o,i)=>{
          this.$set(this.table_data[i],'edit',i==index)
        });
        // this.table_data = Object.assign({},this.table_data);
        // this.table_data[index].edit = true;
        // this.table_data.push(this.table_data.pop());
        // this.$forceUpdate();
  
        // this.$set(this.table_data[index],'edit',true)
e1644c39   yangzhi   王哥起来屙尿了
324
325
326
327
      },
      //删除
      handleDelete(index, row) {
        console.log(index, row);
bde7e20f   周超   用户导入记录
328
  
e1644c39   yangzhi   王哥起来屙尿了
329
330
331
332
333
334
335
        this.table_data.splice(index, 1);
        UserInfo_Delete(row.id);
        this.$message({
          message: "删除成功!",
          type: "success",
        });
      },
bde7e20f   周超   用户导入记录
336
  
e1644c39   yangzhi   王哥起来屙尿了
337
338
339
340
341
      handleshare(index, row) {
        if (!row) {
          this.table_data = [];
        } else {
          console.log(index, row);
7cc95822   yangzhi   组卷修改
342
          
e1644c39   yangzhi   王哥起来屙尿了
343
        }
7cc95822   yangzhi   组卷修改
344
345
        UserInfo_BatchToUser(row.id).then(res=>{
          this.table_data.splice(index, 1);
e1644c39   yangzhi   王哥起来屙尿了
346
347
        });
      },
bde7e20f   周超   用户导入记录
348
  
e1644c39   yangzhi   王哥起来屙尿了
349
350
351
      //保存
      handleSave(index, row) {
        delete this.table_data[index].edit;
097e5f47   yangzhi   添加了pdf预览插件
352
        let formData = { ...row };
e1644c39   yangzhi   王哥起来屙尿了
353
354
355
356
357
358
359
360
361
        delete formData.DataJsonObj;
        UserInfo_Update(row);
        this.table_data.push(this.table_data.pop());
        this.$forceUpdate();
        this.$message({
          message: "保存成功!",
          type: "success",
        });
      },
097e5f47   yangzhi   添加了pdf预览插件
362
363
364
365
366
367
368
      handleCancelSave(index, row){
        delete this.table_data[index].edit;
        if(this.currentFilePath == row.ViewPath){
          this.currentFilePath = '';
        }
        this.table_data.push(this.table_data.pop());
      },
e1644c39   yangzhi   王哥起来屙尿了
369
370
371
372
373
374
375
376
377
      handleAdd() {
        var addDataJson = {};
        for (var key in this.new_date_json) {
          if (key === "edit") {
            delete addDataJson[key];
          } else if (key === "add") {
            delete addDataJson[key];
          } else {
            addDataJson[key] = "";
bde7e20f   周超   用户导入记录
378
          }
e1644c39   yangzhi   王哥起来屙尿了
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
        }
        addDataJson.edit = true;
        addDataJson.add = true;
        this.table_data.push(addDataJson);
      },
      //初始化编辑属性
      initEditAttribute() {
        var self = this;
        var edit = self.edit;
      },
      initAddDataJson(dataArray) {
        //新增时,初始化数据结构
        var dataJson = dataArray;
        var newDateJson = {};
        for (var key in dataJson) {
          if (key === "edit") {
            newDateJson[key] = "true";
          } else {
            newDateJson[key] = "";
bde7e20f   周超   用户导入记录
398
          }
bde7e20f   周超   用户导入记录
399
        }
e1644c39   yangzhi   王哥起来屙尿了
400
401
        newDateJson["add"] = true;
        this.new_date_json = newDateJson;
bde7e20f   周超   用户导入记录
402
      },
e1644c39   yangzhi   王哥起来屙尿了
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
    },
    created() {
      this.getList();
    },
    mounted: function () {
      this.initEditAttribute();
      //确保方法在页面渲染后调用
      this.$nextTick(function () {
        /////方法
        this.tableRowClassName();
      });
    },
    watch: {
      space_color: function () {
        //监听数据变化
bde7e20f   周超   用户导入记录
418
419
420
421
422
        this.$nextTick(function () {
          /////方法
          this.tableRowClassName();
        });
      },
e1644c39   yangzhi   王哥起来屙尿了
423
424
425
426
427
428
      table_data: function () {
        //监听数据变化f
        this.$nextTick(function () {
          /////方法
          this.tableRowClassName();
        });
bde7e20f   周超   用户导入记录
429
      },
e1644c39   yangzhi   王哥起来屙尿了
430
    },
e1644c39   yangzhi   王哥起来屙尿了
431
  };
bde7e20f   周超   用户导入记录
432
  </script>
04aebc72   周超   11
433
434
435
436
437
  <style scoped>
   /deep/.el-table__body-wrapper{
      height:92% !important;
    }
  </style>
bde7e20f   周超   用户导入记录
438
  <style lang="scss" scoped>
04aebc72   周超   11
439
  
097e5f47   yangzhi   添加了pdf预览插件
440
441
442
443
444
445
446
447
448
449
  .main-box{
    display: flex;
  }
  .doc-view {
    margin-left: 10px;
    width: 100%;
    flex: 1;
    overflow: hidden;
  }
  .el-table__expanded-cell {
e1644c39   yangzhi   王哥起来屙尿了
450
451
    padding: 10px;
  }
097e5f47   yangzhi   添加了pdf预览插件
452
  .demo-table-expand {
e1644c39   yangzhi   王哥起来屙尿了
453
454
455
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
097e5f47   yangzhi   添加了pdf预览插件
456
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
e1644c39   yangzhi   王哥起来屙尿了
457
458
459
    padding: 20px;
    border-radius: 10px;
  }
097e5f47   yangzhi   添加了pdf预览插件
460
461
  .demo-table-expand .el-form-item {
    margin-bottom: 10px !important;
e1644c39   yangzhi   王哥起来屙尿了
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
    min-width: 20%;
    max-width: 50%;
  }
  .demo-form-inline {
    display: flex;
    align-items: center;
  }
  .el-form--inline .el-form-item {
    display: flex;
    align-items: center;
    margin-bottom: 0;
  }
  .aligin-center {
    align-items: center;
  }
  .seetingsDiv {
    display: flex;
    align-items: center;
    width: 100%;
    height: auto;
    padding: 30px;
    background: #efefef;
    /* line-height: 60px; */
    border-radius: 5px;
    box-shadow: 0 0 5px #cdcdcd;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 20px;
  }
bde7e20f   周超   用户导入记录
491
  
e1644c39   yangzhi   王哥起来屙尿了
492
493
494
495
496
497
498
499
500
501
  .seetingsDiv button {
    height: 40px;
    background-color: #304156;
    border: 0px;
    margin-left: 10px;
    box-shadow: 0 0 5px #cdcdcd;
    float: none;
    margin-right: 10px;
    margin-top: 0;
  }
bde7e20f   周超   用户导入记录
502
  </style>