<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2022-12-01 15:52:40
 * @Description:
-->
<template>
  <el-dialog
    title="台差参数"
    :close-on-click-modal="false"
    :visible.sync="visible"
  >
    <el-table
      :data="dataList"
      :stripe="true"
      :header-cell-style="{
        background: '#eef1f6',
        color: '#606266',
        height: '56px'
      }"
      v-loading="dataListLoading"
      style="width: 100%;"
    >
      <el-table-column
        type="index"
        header-align="center"
        align="center"
        label="序号"
        width="50"
      >
      </el-table-column>
      <el-table-column prop="name" align="center" label="名称"> </el-table-column>
      <el-table-column prop="code" align="center" label="编码"> </el-table-column>
      <el-table-column prop="num" align="center" label="小数位数"> </el-table-column>
      <el-table-column prop="USL" align="center" label="USL"> </el-table-column>
      <el-table-column prop="SL" align="center" label="SL"> </el-table-column>
      <el-table-column prop="LSL" align="center" label="LSL"> </el-table-column>
      <el-table-column
        fixed="right"
        header-align="center"
        align="center"
        width="150"
        label="操作"
      >
        <template slot-scope="scope">
          <el-button
            type="text"
            size="small"
            @click="addOrUpdateHandle(scope.row.id)"
          >
            <el-tooltip
              class="item"
              effect="dark"
              content="修改"
              placement="top"
            >
            <svg class="icon-svg"><use xlink:href="#icon-编辑"></use></svg>
            </el-tooltip>
          </el-button>
          <el-button
            type="text"
            style="color:red"
            size="small"
            @click="deleteHandle(scope.row.id)"
          >
            <el-tooltip
              class="item"
              effect="dark"
              content="删除"
              placement="top"
            >
            <svg class="icon-svg"><use xlink:href="#icon-删除"></use></svg>
            </el-tooltip>
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
    </span>
    <add-or-update
      v-if="addOrUpdateVisible"
      ref="addOrUpdate"
      @successSubmit="getDataList"
    ></add-or-update>
  </el-dialog>
</template>

<script>
import AddOrUpdate from './toolsType-detail-add'
import basicPage from '@/mixins/basic-page'
export default {
  mixins: [basicPage],
  data() {
    return {
      urlOptions: {
        getDataListURL: '/basic/measureTool/page',
        deleteURL: '/basic/measureTool',
      },
      visible: false,
      toolsId: ''
    }
  },
  components: {
    AddOrUpdate
  },
  methods: {
    init (id) {
      this.toolsId = id || ''
      this.visible = true
      this.$nextTick(() => {})
    }
  }
}
</script>
