DataLogModal.vue 4.8 KB
Newer Older
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
<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">
              <a-form-item label="数据库表名"  :label-col="{ span: 6 }" :wrapper-col="{ span: 15 }">
                <a-input placeholder="请输入数据库表名" v-decorator="[ 'dataTale', {}]" @blur="handleTableBlur" disabled/>
              </a-form-item>
            </a-col>

            <a-col :md="12" :sm="8">
              <a-form-item label="数据ID"  :label-col="{ span: 5 }" :wrapper-col="{ span: 15 }">
                <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">
              <a-form-item label="版本号1"  :label-col="{ span: 6 }" :wrapper-col="{ span: 15 }">
                <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">
              <a-form-item label="版本号2"  :label-col="{ span: 5 }" :wrapper-col="{ span: 15 }">
                <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>
      <data-log-compare-modal ref="modal" @ok="modalFormOk" ></data-log-compare-modal>
    </a-modal>
  </div>
</template>

<script>
  import { getAction } from '@/api/manage'
  import DataLogCompareModal from './DataLogCompareModal'
  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});
        });
      },
      handleOk () {
        this.close();
        this.$refs.modal.compareModal(this.dataId1  ,this.dataId2);
        this.$refs.modal.title="数据比较";
      },
      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='',
            console.log(res.message);

          }
        });
      },
      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();
      }
    }
  }
</script>

<style scoped>

</style>