Blame view

ant-design-vue-jeecg/src/views/system/modules/DataLogModal.vue 4.71 KB
肖超群 authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<template>
  <div>
    <a-modal
      :width="modalWidth"
      :visible="visible"
      title="数据对比窗口"
      :confirmLoading="confirmLoading"
      @ok="handleOk"
      @cancel="handleCancel"
      cancelText="取消">

      <a-spin :spinning="confirmLoading">
        <a-form @submit="handleSubmit" :form="form" class="form">
          <a-row class="form-row" :gutter="24">
            <a-col :md="12" :sm="8">
肖超群 authored
16
              <a-form-item label="数据库表名" :label-col="{ span: 6 }" :wrapper-col="{ span: 15 }">
肖超群 authored
17
18
19
20
21
                <a-input placeholder="请输入数据库表名" v-decorator="[ 'dataTale', {}]" @blur="handleTableBlur" disabled/>
              </a-form-item>
            </a-col>

            <a-col :md="12" :sm="8">
肖超群 authored
22
              <a-form-item label="数据ID" :label-col="{ span: 5 }" :wrapper-col="{ span: 15 }">
肖超群 authored
23
24
25
26
27
28
29
                <a-input placeholder="请输入数据ID" v-decorator="[ 'dataId', {}]" @blur="handleIdBlur" disabled/>
              </a-form-item>
            </a-col>
          </a-row>

          <a-row class="form-row" :gutter="24">
            <a-col :md="12" :sm="8">
肖超群 authored
30
              <a-form-item label="版本号1" :label-col="{ span: 6 }" :wrapper-col="{ span: 15 }">
肖超群 authored
31
32
33
34
35
36
37
38
                <a-select placeholder="请选择版本号" v-decorator="[ 'dataVersion1', {}]" @change="handleChange1">
                  <a-select-option v-for="(log,logindex) in DataVersionList" :key="logindex.toString()" :value="log.id">
                    {{ log.dataVersion }}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
            <a-col :md="12" :sm="8">
肖超群 authored
39
              <a-form-item label="版本号2" :label-col="{ span: 5 }" :wrapper-col="{ span: 15 }">
肖超群 authored
40
41
42
43
44
45
46
47
48
49
                <a-select placeholder="请选择版本号" v-decorator="[ 'dataVersion2', {}]" @change="handleChange2">
                  <a-select-option v-for="(log,logindex) in DataVersionList" :key="logindex.toString()" :value="log.id">
                    {{ log.dataVersion }}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </a-spin>
肖超群 authored
50
      <data-log-compare-modal ref="modal" @ok="modalFormOk"></data-log-compare-modal>
肖超群 authored
51
52
53
54
55
    </a-modal>
  </div>
</template>

<script>
肖超群 authored
56
57
import {getAction} from '@/api/manage'
import DataLogCompareModal from './DataLogCompareModal'
肖超群 authored
58
肖超群 authored
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
export default {
  name: 'DataLogModal',
  components: {DataLogCompareModal},
  dataId1: '',
  dataId2: '',
  dataTable1: '',
  dataID3: '',

  data() {
    return {
      modalWidth: 700,
      modaltoggleFlag: true,
      confirmDirty: false,
      title: "操作",
      visible: false,
      model: {},
      confirmLoading: false,
      headers: {},
      form: this.$form.createForm(this),
      url: {
        queryDataVerListUrl: "/sys/dataLog/queryDataVerList",
      },
      DataVersionList: [],
    }
  },
  created() {
  },
  methods: {
    addModal(records) {
      const dataTable = records[0].dataTable
      const dataId = records[0].dataId;
      const dataVersion1 = records[0].dataVersion;
      const dataVersion2 = records[1].dataVersion;
      this.dataId1 = records[0].id;
      this.dataId2 = records[1].id;
      this.dataTable1 = records[0].dataTable
      this.dataID3 = records[0].dataId
      this.initDataVersionList();
      this.form.resetFields();
      this.visible = true;
      this.$nextTick(() => {
        this.form.setFieldsValue({
          dataTale: dataTable,
          dataId: dataId,
          dataVersion1: dataVersion1,
          dataVersion2: dataVersion2
        });
      });
肖超群 authored
107
    },
肖超群 authored
108
109
110
111
    handleOk() {
      this.close();
      this.$refs.modal.compareModal(this.dataId1, this.dataId2);
      this.$refs.modal.title = "数据比较";
肖超群 authored
112
    },
肖超群 authored
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
    handleCancel() {
      this.close()
    },
    handleSubmit() {
    },
    close() {
      this.$emit('close');
      this.visible = false;
      this.disableSubmit = false;
    },
    modalFormOk() {
    },
    initDataVersionList() {
      let that = this;
      getAction(that.url.queryDataVerListUrl, {dataTable: this.dataTable1, dataId: this.dataID3}).then((res) => {
        if (res.success) {
          this.DataVersionList = res.result;
        } else {
          this.DataVersionList = [];
          this.dataId1 = '',
            this.dataId2 = '',
肖超群 authored
134
135
            console.log(res.message);
肖超群 authored
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
        }
      });
    },
    handleChange1(value) {
      this.dataId1 = value;
    },
    handleChange2(value) {
      this.dataId2 = value;
    },
    handleTableBlur(e) {
      this.dataTable1 = e.target.value;
      this.initDataVersionList();
    },
    handleIdBlur(e) {
      this.dataID3 = e.target.value;
      this.initDataVersionList();
肖超群 authored
152
153
    }
  }
肖超群 authored
154
}
肖超群 authored
155
156
157
158
159
</script>

<style scoped>

</style>