<template>
  <!-- 设备运行状态修改 -->
  <el-dialog
    :visible.sync="visible"
    title="设置运行状态"
    width="400px"
    @close="cancel"
  >
    <el-row :gutter="20">
      <el-col :span="8" class="el-col"
        ><el-radio v-model="status" :label="'START'">启动</el-radio></el-col
      >
      <el-col :span="8" class="el-col"
        ><el-radio v-model="status" :label="'RUN'">运行</el-radio></el-col
      >
      <el-col :span="8" class="el-col"
        ><el-radio v-model="status" :label="'STOP'">停机</el-radio></el-col
      >
      <el-col :span="8" class="el-col"
        ><el-radio v-model="status" :label="'IDLE'">空闲</el-radio></el-col
      >
      <el-col :span="8" class="el-col"
        ><el-radio v-model="status" :label="'TOBE_MATERIAL'"
          >待料</el-radio
        ></el-col
      >
      <el-col :span="8" class="el-col"
        ><el-radio v-model="status" :label="'FAULT'">故障</el-radio></el-col
      >
      <el-col :span="8" class="el-col"
        ><el-radio v-model="status" :label="'REPAIR'">检修</el-radio></el-col
      >
    </el-row>
    <div slot="footer">
      <el-button type="primary" @click="submit" :loading="loading"
        >确认</el-button
      >
      <el-button type="primary" plain @click="cancel">取消</el-button>
    </div>
  </el-dialog>
</template>

<script>
  // import { setupdateStatus } from '@/api/ledgerAssets/equipment.js';
  export default {
    props: {
      id: [Number, String]
    },
    data() {
      return {
        loading: false,
        visible: false,
        status: null
      };
    },
    methods: {
      open(row) {
        this.visible = true;
      },
      cancel() {
        this.status = null;
        this.visible = false;
      },
      //
      submit() {
        if (this.status === null) {
          this.$message.error('请选择运行状态');
          return;
        }
        let par = {
          id: this.id,
          status: this.status
        };
        // setupdateStatus(par).then((res) => {
        //   this.$emit('succeed');
        //   this.cancel();
        // });
      }
    }
  };
</script>
<style lang="scss" scoped>
  .el-col {
    margin-bottom: 10px;
  }
</style>
