<!-- 
    TODO 系统工具 / 数据同步
 -->
<template>
  <el-main class="oldsys-datasyn">
    <el-form
      ref="exchangeConvertFormRef"
      :model="oldSysDataSynForm"
      inline
      label-width="110px"
    >
      <el-row>
        <el-col
          :xs="18"
          :sm="10"
          :lg="6"
        >
          <el-form-item
            prop="dataId"
            label="数据名称："
            class="datasyn-item"
          >
            <BaseSelect
              v-model:modelValue="oldSysDataSynForm.dataType"
              class="item"
              :options="stateOldSysDataSyn.synchronizeDataType"
              :disabled="stateOldSysDataSyn.loading"
              @change="changeSynchronizeDataType"
            />
          </el-form-item>
        </el-col>
        <el-col
          :xs="6"
          :sm="6"
          :lg="6"
        >
          <el-checkbox
            v-show="stateOldSysDataSyn.isOldDataCover"
            v-model="stateOldSysDataSyn.oldDataCover"
            label="是否旧数据覆盖"
            class="old-data-cover"
          />
          <el-button
            type="primary"
            class="begin-btn"
            :loading="stateOldSysDataSyn.loading"
            :disabled="stateOldSysDataSyn.loading"
            @click="hanleOldSysDataSyn"
          >
            开始
          </el-button>
        </el-col>
      </el-row>
      <el-row>
        <el-col
          :xs="22"
          :sm="10"
          :lg="6"
        >
          <el-form-item
            prop="dataId"
            label="同步结果："
            class="datasyn-item"
          >
            <el-input
              v-model="oldSysDataSynForm.returnData"
              clearable
            />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-main>
</template>
<script lang="ts" setup name="dataSyn">
import BaseSelect from "@/components/QuerySelect/BaseSelect.vue";
import { useOldSysDataSyn } from "@/composables/dataSyn/useOldSysDataSyn";

const {
  stateOldSysDataSyn,
  oldSysDataSynForm,
  hanleOldSysDataSyn,
  changeSynchronizeDataType
} = useOldSysDataSyn();
</script>
<style lang="scss" scoped>
.oldsys-datasyn {
  .datasyn-item {
    width: 100%;
    .item {
      width: 100%;
    }
  }
  .begin-btn {
    margin-left: 15px;
  }
  .old-data-cover {
    margin-left: 10px;
  }
}
</style>
