<template>
  <el-dialog title="设定比例尺" :visible.sync="dialogVis" width="500px" id="scaleDialog" :close-on-click-modal='false'>
    <el-row>
      <div style="line-height:32px;">设定比例尺长度 : </div>
      <div style="width:70%">
        <el-input-number v-model="scaleInput" controls-position="right" :min="0"></el-input-number> mm
      </div>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button size="small" @click="dialogVis=false">取消</el-button>
      <el-button size="small" type="primary" @click="confirm">确认</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { createRelationInFloor } from "@/api/scan/request";
export default {
  data() {
    return {
      dialogVis: false,
      scaleInput: '',
      item: '', // 当前修改的item
    }
  },
  methods: {
    showDialog(v) {
      this.dialogVis = true
      this.item = v;
      this.scaleInput = v.text.substring(0, v.text.length - 3);
    },
    confirm() {
      this.item.text = this.scaleInput + ' mm';
      this.item.update()
      this.$emit('textChange', this.scaleInput)
      this.dialogVis = false
    }
  }
}
</script>
<style lang="less" scoped>
#scaleDialog {
  .el-row{
    height: 50px;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .el-row > div {
    float: left;
  }
  .el-row > div + div {
    margin-left: 10px;
  }
  /deep/ .el-input__inner {
    vertical-align: baseline;
  }
}
</style>