1
Surpriseplus
2022-09-19 543249cc7d5dd38b9415f40e71fd576dcfc006de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
<template>
  <div class="authorityManagement_box">
    <My-bread :list="['数据管理', '元数据管理']"></My-bread>
    <el-divider />
    <div class="searchComp">
      <el-form ref="ruleForm" :model="ruleForm" :inline="true">
        <el-form-item label="关键字" prop="name">
          <el-input v-model="ruleForm.name" placeholder="请输入" />
        </el-form-item>
        <el-form-item>
          <el-button
            @click="submitForm('ruleForm')"
            icon="el-icon-search"
            type="primary"
            size="small"
            >查询</el-button
          >
          <el-button
            @click="resetForm('ruleForm')"
            icon="el-icon-refresh"
            type="info"
            size="small"
            >重置</el-button
          >
          <el-button
            @click="downFormData"
            icon="el-icon-download"
            type="success"
            size="small"
            >下载</el-button
          >
          <!-- <el-button
            @click="downFormData"
            icon="el-icon-download"
            type="success"
            size="small"
            >下载</el-button
          > -->
          <el-button
            @click="DelFormData"
            icon="el-icon-delete"
            type="danger"
            size="small"
            >删除</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="bottom">
      <div class="rightTable">
        <div class="table_box">
          <el-table
            :data="tableData"
            border
            style="width: 100%"
            fit
            @selection-change="handleSelectionChange"
            height="99%"
          >
            <el-table-column type="selection" width="55" />
            <el-table-column min-width="150" prop="name" label="数据名称" />
 
            <el-table-column
              min-width="100"
              prop="create_user"
              label="创建人员"
            />
            <el-table-column
              min-width="100"
              prop="create_time"
              label="创建时间"
            />
            <el-table-column min-width="100" prop="coor_sys" label="坐标系统" />
            <el-table-column
              min-width="100"
              prop="accuracy"
              label="比例尺/分辨率"
            />
            <el-table-column min-width="100" prop="format" label="存储格式" />
            <el-table-column min-width="100" prop="version" label="数据版本" />
            <el-table-column prop="status" label="发布" width="70%">
              <template slot-scope="scope">
                <span
                  slot="reference"
                  v-if="scope.row.s_url === '' || scope.row.s_url === null"
                >
                  <i class="dotClass" style="background-color: gray"></i>
                </span>
                <span slot="reference" v-else>
                  <i class="dotClass" style="background-color: springgreen"></i>
                </span>
              </template>
            </el-table-column>
 
            <el-table-column min-width="100" label="操作">
              <template slot-scope="scope">
                <el-link @click="showDetail(scope.$index, scope.row)"
                  >查看</el-link
                >
                <el-link
                  @click="handleEdit(scope.$index, scope.row)"
                  style="margin-left: 10px"
                  >修改</el-link
                >
                <el-link
                  v-if="scope.row.s_url === '' || scope.row.s_url === null"
                  @click="handleStart(scope.row)"
                  style="margin-left: 10px"
                  >发布</el-link
                >
                <el-link
                  v-else
                  @click="handleStop(scope.row)"
                  style="margin-left: 10px"
                  >停止</el-link
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div
          style="margin-top: 20px; margin-left: 400px"
          class="pagination_box"
        >
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[10, 20, 50, 100]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="count"
          >
          </el-pagination>
        </div>
      </div>
    </div>
    <div class="infoBox" v-show="showinfoBox">
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>详细信息</span>
          <div style="float: right; cursor: pointer" @click="closeDetial">
            <i class="el-icon-close"></i>
          </div>
        </div>
        <div class="contentBox">
          <p>数据名称:{{ itemdetail.name }}</p>
          <el-divider></el-divider>
          <p>
            数据范围:
            {{ itemdetail.x_min }}, {{ itemdetail.y_min }};
            {{ itemdetail.x_max }}, {{ itemdetail.y_max }}
          </p>
          <el-divider></el-divider>
          <p>创建时间:{{ itemdetail.create_time }}</p>
          <el-divider></el-divider>
          <p>创建人员:{{ itemdetail.create_user }}</p>
          <el-divider></el-divider>
          <p>更新时间:{{ itemdetail.up_time }}</p>
          <el-divider></el-divider>
          <p>更新人员:{{ itemdetail.up_user }}</p>
          <el-divider></el-divider>
          <p>上传单位:{{ itemdetail.up_unit }}</p>
          <el-divider></el-divider>
          <p>数据状态:{{ itemdetail.status }}</p>
          <el-divider></el-divider>
          <p>坐标系统:{{ itemdetail.coor_sys }}</p>
          <el-divider></el-divider>
          <p>比例尺/分辨率:{{ itemdetail.accuracy }}</p>
          <el-divider></el-divider>
          <p>发布地址:{{ itemdetail.s_url }}
           <el-link
              @click="ShowWindowFly(itemdetail.s_url)"
              :underline="false"
              type="primary"
              >详情</el-link
            ></p>
          <el-divider></el-divider>
          <p>数据版本:{{ itemdetail.version }}</p>
          <el-divider></el-divider>
          <p>数据类型:{{ itemdetail.type }}</p>
          <el-divider></el-divider>
          <p>数据格式:{{ itemdetail.format }}</p>
        </div>
      </el-card>
    </div>
    <el-dialog title="修改详情" :visible.sync="dialogFormVisible">
      <el-form :model="upform">
        <el-form-item label="数据名称" :label-width="formLabelWidth">
          <el-input v-model="upform.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据范围x_min" :label-width="formLabelWidth">
          <el-input v-model="upform.x_min" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据范围x_max" :label-width="formLabelWidth">
          <el-input v-model="upform.x_max" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据范围y_min" :label-width="formLabelWidth">
          <el-input v-model="upform.y_min" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据范围y_max" :label-width="formLabelWidth">
          <el-input v-model="upform.y_max" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="创建时间" :label-width="formLabelWidth">
          <el-date-picker
            v-model="upform.create_time"
            value-format="yyyy-MM-dd"
            type="date"
            placeholder="选择日期"
            style="width: 100%"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="坐标系统" :label-width="formLabelWidth">
          <el-input v-model="upform.coor_sys" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="比例尺/分辨率" :label-width="formLabelWidth">
          <el-input v-model="upform.accuracy" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据格式" :label-width="formLabelWidth">
          <el-input v-model="upform.format" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据版本" :label-width="formLabelWidth">
          <el-input v-model="upform.version" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据类型" :label-width="formLabelWidth">
          <el-input v-model="upform.type" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="updateForm">确 定</el-button>
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <div class="downloadBox" v-if="showCodeBox">
      <h4 style="padding: 20px">请输入下载包密码</h4>
 
      <el-form
        :model="codeForm"
        :rules="rules"
        ref="codeForm"
        label-width="100px"
        class="codeForm"
      >
        <el-form-item label="密码" prop="password">
          <el-input type="password" v-model="codeForm.password"></el-input>
        </el-form-item>
        <el-form-item label="确认密码" prop="repassword">
          <el-input type="password" v-model="codeForm.repassword"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="small" @click="download('codeForm')"
            >确定</el-button
          >
          <el-button type="info" size="small" @click="closeDown('codeForm')"
            >取消</el-button
          >
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
 
<script>
import {
  queryMetaData,
  queryDataCount,
  updateMetaData,
  dltMetaDatas,
  publishMeta,
  unpublishMeta,
} from "../../api/api";
import MyBread from "../../components/MyBread.vue";
export default {
  name: "metadataManage",
  components: { MyBread },
  data() {
    var repasswordValidator = (rule, value, callback) => {
      if (value === "") {
        callback(new Error("请再次输入密码"));
      } else if (value !== this.codeForm.password) {
        callback(new Error("两次输入密码不一致!"));
      } else {
        callback();
      }
    };
    return {
      showCodeBox: false,
      value: true,
      multipleSelection: [],
      formLabelWidth: "120px",
      dialogFormVisible: false,
      InsertFormdialog: false,
      insertform: {},
      upform: {},
      showinfoBox: false,
      itemdetail: {},
      ruleForm: {
        name: "",
      },
      codeForm: {
        password: "",
        repassword: "",
      },
      rules: {
        password: [{ required: true, message: "请输入密码", trigger: "blur" }],
        repassword: [
          { required: true, message: "请输入确认密码", trigger: "blur" },
          { validator: repasswordValidator, trigger: "blur" },
        ],
      },
      tableData: [],
      count: 0,
      currentPage: 1,
      pageSize: 10,
      pageNum: 1,
      searchName: "",
    };
  },
  created() {
    this.getMetaData(10, 1, "");
    this.getMetaCount("");
  },
  methods: {
     ShowWindowFly(res) {
      console.log(res);
      if (res == "") return;
      if (res.indexOf(".xls") != -1) {
        this.showMetadata(res, true);
      } else if (res.indexOf(".doc") != -1) {
        this.showMetadata(res, true);
      } else if (res.indexOf(".png") != -1) {
        this.showMetadata(res, true);
      } else if (res.indexOf(".jpg") != -1) {
        this.showMetadata(res, true);
      } else if (res.indexOf(".pdf") != -1) {
        this.showMetadata(res, true);
      } else if (res.indexOf(".fly") != -1) {
        this.showMetadata(res, false);
      } else if (res.indexOf(".mpt") != -1) {
        this.showMetadata(res, false);
      }
    },
    showMetadata(res, flag) {
      var metaUrl;
      if (flag == true) {
        metaUrl = res;
      } else if (flag == false) {
        metaUrl = ifreamUrl + "/LFWeb/MetaPop.html?name=" + res;
      }
      window.open(
        metaUrl,
        "",
        "height=800, width=1500, top=150, left=350, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no"
      );
    },
    // 请求数据内容
    getMetaData(size, num, name) {
      queryMetaData(size, num, name).then((res) => {
        this.tableData = res.data;
      });
    },
    // 请求数据数量
    getMetaCount(name) {
      queryDataCount(name).then((res) => {
        this.count = res.data;
      });
    },
    // 关键字查询
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.searchName = this.ruleForm.name.trim();
          this.getMetaData(10, 1, this.searchName);
          this.getMetaCount(this.searchName);
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 重置查询
    resetForm(formName) {
      this.getMetaData(10, 1, "");
      this.getMetaCount("");
      this.searchName = "";
      this.$refs[formName].resetFields();
    },
    // 获取多选选中的对象
    handleSelectionChange(val) {
      this.multipleSelection = val;
      // console.log(val);
    },
    // 查看界面
    showDetail(index, row) {
      // console.log(index, row);
      this.showinfoBox = true;
      this.itemdetail = row;
    },
    // 关闭查看
    closeDetial() {
      this.showinfoBox = false;
      this.itemdetail = {};
    },
    // 修改界面
    handleEdit(index, row) {
      this.dialogFormVisible = true;
      this.upform = JSON.parse(JSON.stringify(row));
    },
    // 提交修改
    updateForm() {
      this.$confirm("是否确定编辑?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.dialogFormVisible = false;
          updateMetaData(this.upform).then((res) => {
            if (res.data == 1) {
              this.$message({
                message: "修改成功",
                type: "success",
              });
            }
            this.getMetaData(10, 1, "");
            this.getMetaCount("");
          });
        })
        .catch(() => {});
    },
 
    // 删除多条
    DelFormData() {
      var std = [];
      for (var i in this.multipleSelection) {
        std.push(this.multipleSelection[i].id);
      }
      this.$confirm("确定是否删除所选内容?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          dltMetaDatas(std).then((res) => {
            this.getMetaData(10, 1, "");
            this.getMetaCount("");
            this.$message({
              type: "success",
              message: "删除成功!",
            });
          });
        })
        .catch(() => {});
    },
    download(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let ids = "";
          this.multipleSelection.forEach((e) => {
            ids += `id=${e.id}&`;
          });
          let res = ids.substring(0, ids.length - 1);
          // console.log(res);
          let url = "http://192.168.20.106/LFServer/Meta/Downloads?" + res;
          window.open(url);
          this.closeDown();
        } else {
          console.log("下载失败");
          this.closeDown();
          return false;
        }
      });
    },
    closeDown() {
      this.showCodeBox = false;
      this.codeForm.password = "";
      this.codeForm.repassword = "";
    },
    downFormData() {
      // var std = [];
      // for (var i in this.multipleSelection) {
      //   std.push(this.multipleSelection[i].id);
      // }
      if (this.multipleSelection.length == 0) {
        alert("请先选择要下载的文件");
        return;
      }
      this.showCodeBox = true;
      // this.$prompt("请输入密码", "提示", {
      //   confirmButtonText: "确定",
      //   cancelButtonText: "取消",
      //   inputType: "password",
      //   inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/,
      //   inputErrorMessage: "输入不能为空",
      // })
      //   .then(() => {
      //     let ids = "";
      //     this.multipleSelection.forEach((e) => {
      //       ids += `id=${e.id}&`;
      //     });
      //     let res = ids.substring(0, ids.length - 1);
      //     console.log(res);
      //     let url = "http://192.168.20.106/LFServer/Meta/Downloads?" + res;
      //     window.open(url);
      //   })
      //   .catch(() => {});
    },
    handleStart(row) {
      publishMeta(row.id).then((res) => {
        console.log(res);
        this.getMetaData(10, 1, "");
        this.getMetaCount("");
      });
    },
    handleStop(row) {
      console.log(row.id);
      unpublishMeta(row.id).then((res) => {
        console.log(res);
        this.getMetaData(10, 1, "");
        this.getMetaCount("");
      });
    },
    // 条数修改
    handleSizeChange(val) {
      this.pageSize = val;
      this.getMetaData(this.pageSize, 1, this.searchName);
      this.getMetaCount(this.searchName);
    },
    // 页数修改
    handleCurrentChange(val) {
      this.pageNum = val;
      this.getMetaData(this.pageSize, this.pageNum, this.searchName);
      this.getMetaCount(this.searchName);
    },
  },
};
</script>
<style lang="less" scoped>
//@import url(); 引入公共css类
.authorityManagement_box {
  background: rgb(240, 242, 245);
  border-radius: 10px;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  .searchComp {
    margin: 10px auto;
    background: #fff;
    border-radius: 5px;
    border: 1px solid rgb(202, 201, 204);
    .el-form-item {
      margin: 5px;
    }
    .el-input {
      width: 467px;
    }
  }
  .bottom {
    width: 100%;
    height: 85%;
    .rightTable {
      height: 100%;
      width: 100%;
      .table_box {
        width: 100%;
        height: 93%;
        margin: 0 auto;
        overflow: auto;
        background: #fff;
        .el-table {
          height: 100%;
          // overflow: auto;
        }
        .el-table /deep/ .el-table__header-wrapper tr th {
          background-color: rgb(255, 255, 255) !important;
          color: rgb(0, 0, 0);
        }
        // 修改每行样式:
        .el-table /deep/ .el-table__row {
          background-color: rgba(255, 255, 255) !important;
          color: rgb(0, 0, 0);
        }
        .el-table /deep/ .el-table__body tr.current-row > td {
          background-color: rgb(211, 211, 211) !important;
        }
        .el-table /deep/ .el-table__body tr:hover > td {
          background-color: rgb(211, 211, 211) !important;
        }
        // 修改表格每行边框的样式:
        .el-table /deep/ td,
        .el-table /deep/ th.is-leaf {
          border-bottom: 1px solid #eee;
          border-right: 1px solid #eee;
        }
        .el-table /deep/ .el-table__cell {
          padding: 0;
        }
        // 设置表格每行的高度:
        .el-table /deep/ .el-table__header tr,
        .el-table /deep/ .el-table__header th {
          height: 40px;
        }
        .el-table__body tr,
        .el-table__body td {
          height: 40px;
          padding: 0;
        }
        // 设置表格边框颜色:
 
        .el-table--border::after,
        .el-table--group::after {
          width: 0;
        }
        .el-table::before {
          height: 0;
        }
        //   a {
        //     color: #000;
        //   }
      }
    }
  }
  .infoBox {
    width: 500px;
 
    border: 1px solid #eee;
    position: absolute;
    z-index: 100;
    top: 15%;
    right: 25%;
    background-color: #fff;
    .el-card {
      background-color: transparent;
      span {
        font-size: 16px;
        font-weight: 600;
      }
    }
    .contentBox {
      margin: 0 aotu 10px;
      height: 600px;
      overflow: auto;
      p {
        // background-color: #bfa;
        // margin-bottom: 10px;
        font-size: 14px;
      }
    }
  }
  /deep/ .el-dialog {
    width: 500px !important;
    margin-top: 10vh !important;
  }
 
  /deep/.el-dialog .el-input__inner {
    width: 300px;
  }
  /deep/ .el-dialog__body {
    padding: 0px 30px;
  }
  /deep/ .el-dialog__footer {
    padding-top: 0 !important;
    width: 200px;
    display: flex;
    margin: 0 auto;
    justify-content: center;
  }
  .dotClass {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: block;
    margin-left: 10px; //这个用于圆点居中
  }
  .downloadBox {
    position: absolute;
    top: 20%;
    left: 50%;
    padding: 20px;
    background-color: #fff;
    width: 20%;
    border: 1px solid #000;
    border-radius: 10px;
  }
}
</style>