<template>
  <div>
    <el-row>
      <el-form ref="changeInfoRef" :model="changeInfoForm" label-width="70px">
        <el-col :span="24">
          <el-form-item label="状态">
            <el-select clearable v-model="changeInfoForm.state" placeholder="请选择状态" width="">
              <el-option label="启动" value="0"></el-option>
              <el-option label="暂停" value="1"></el-option>
              <el-option label="终止" value="2"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-button type="primary" style="margin-left:50%" @click="submit">保存</el-button>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>
import { mediaState } from '@/api/mediaCenter/mediaInformation'
export default {
  props: {
    rowid: {
      type: String,
      default: ""
    },
    layerid: {
      type: String,
      default: ""
    }
  },
  data() {
    return {
      changeInfoForm: {
        state: "" //变更状态
      }
    };
  },
  methods: {
    submit(){
        return new Promise(resolve=>{
            const params={
                id:this.rowid,
                state:this.changeInfoForm.state,//状态
            }
            mediaState(params).then(response=>{
                if(response.state.toLowerCase()==='success'){
                    this.$parent.$layer.close(this.layerid)
                    this.$parent.getList()
                    this.$message.success('恭喜你，操作成功!')
                }
            }).catch(result=>{
                this.$message.error(result)
            })
        })
    }
  }
};
</script>
<style lang="scss" scoped>
</style>