<template>
  <div>
      <el-dialog
        v-dialogDrag
        :visible.sync="showDetailModal"
        width="700px"
        title="编号规则详情"
      >
      <div class="maxHeight">
        <table class="tableClass">
          <tbody>
            <tr>
              <th>前缀</th>
              <td>{{obj.pre}}</td>
            </tr>
            <tr>
              <th>规则</th>
              <td>{{obj.rule}}</td>
            </tr>
            <tr>
              <th>长度</th>
              <td>{{obj.length}}</td>
            </tr>
            <tr>
              <th>编号截取长度</th>
              <td>{{obj.sublength}}</td>
            </tr>
            <tr>
              <th>允许重复</th>
              <td>{{obj.repeat === 0 ? '否' : '是'}}</td>
            </tr>
            <tr>
              <th>类型</th>
              <td>{{obj.type?obj.type.display:''}}</td>
            </tr>
          </tbody>
        </table>
      </div>
      </el-dialog>
  </div>
</template>
<script>
/**
 * 编号规则详情
 */
import { codeRule } from '../../../api'

export default {
  data() {
    return {
      obj: {},
      showDetailModal: false
    }
  },
  methods: {
    _open: async function(id) {
      this.showDetailModal = true
      this.obj = await codeRule.getById(id)
    }
  }
}
</script>
