qx
4 小时以前 ad54cf427ee94e01e8c72a01f738615eb2b6569d
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
<template>
  <div class="app-container">
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" size="mini" @click="handleExport"
          >同步</el-button
        >
      </el-col>
    </el-row>
 
    <template>
      <el-table
        border
        v-loading="loading"
        :data="orderList"
        @selection-change="handleSelectionChange"
        height="560"
      >
        <el-table-column type="selection" width="40px" align="center" />
        <el-table-column label="接口名称" align="center" prop="dictName" />
        <el-table-column
          label="备注"
          align="center"
          prop="remark"
          :show-overflow-tooltip="true"
        />
      </el-table>
    </template>
  </div>
</template>
 
<script>
import { histongbulist, histongbuexec, hisexec } from "@/api/system/interface";
export default {
  name: "Interface",
  data() {
    return {
      orderList: [],
      selectionList: [],
      loading: false,
      methods: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      (this.loading = true),
        histongbulist().then((res) => {
          if (res.data) {
            this.orderList = res.data;
          }
          this.loading = false;
        });
    },
    handleSelectionChange(selection) {
      this.selectionList = selection;
    },
    handleExport() {
      if (this.selectionList.length != 0) {
        if (this.selectionList.length == this.orderList.length) {
          histongbuexec().then((res) => {
            this.$modal.msgSuccess("同步成功");
            this.getList()
          });
        } else {
          this.methods = this.selectionList.map((item) => item.dictName);
          let data = {
            methods: this.methods,
            type: false,
          };
          hisexec(data).then((res) => {
            this.$modal.msgSuccess("同步成功");
            this.getList()
          });
        }
      } else {
        this.$modal.msgError("请选择同步数据");
      }
    },
  },
};
</script>