<template>
  <el-dialog v-dialogDrag title="手动旋转" :visible.sync="RectificationStatus" :close-on-click-modal="false"
    :before-close="cancel" width="35%" :append-to-body="true">
    <el-form :model="RectificationForm" :rules="rules" ref="ruleForm" size="medium" label-width="120px"
      style="padding:25px 10px">
      <el-form-item label="左旋度数：" prop="degrees">
        <el-input size="small" v-model="RectificationForm.degrees" style="width:70%"></el-input>
      </el-form-item>
      <el-form-item label="">
        <el-button @click="submit('ruleForm')" size="mini" type="primary" icon="el-icon-check">保存</el-button>
        <el-button @click="cancel" size="mini" type="primary" icon="el-icon-close">取消</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script>
  export default {
    props: {
      RectificationStatus: {
        type: Boolean,
        default: () => false,
      },
      RectificationForm: {
        type: Object,
        default: () => {},
      },
      clickRow: {
        type: Object,
        default: () => {},
      },
    },
    data() {
      return {
        rules: {
          degrees: [{
            required: true,
            message: '请输入度数',
            trigger: 'blur'
          }, ],
        }
      }
    },
    methods: {
      submit(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {

            let data = {
              filePath: this.clickRow.file_path,
              fileNameServer: this.clickRow.file_name_server,
              id: this.clickRow.id,
              angle: this.RectificationForm.degrees,
            }
            this.$store.dispatch('scanIndex/manualRotate', data).then(res => {
              this.$emit('getUPDATA')
            })
          } else {
            return false;
          }
        });
      },
      cancel() {
        this.$emit('cancel')
        this.$refs['ruleForm'].resetFields();
      }
    }
  }

</script>
<style lang="scss" scoped>

</style>
