<template>
  <div v-loading="loading">
    <el-form ref="ruleForm" :model="ruleForm"  label-width="150px" class="order_form">
      <el-form-item label="是否同意转移" prop="F_Name">
           <el-select v-model="ruleForm.value" placeholder="请选择(默认为同意)" @change="handle">
                <el-option label="同意" value="0"></el-option>
                <el-option label="拒绝" value="1"></el-option>
            </el-select>
        <!-- <el-input v-model="ruleForm.F_Name" placeholder="请输入新销售负责人"></el-input> -->
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { formatterContent } from '@/utils'
import { detailTransfer } from '@/api/memberManagement/memberList'
export default {
  name: "AddOrEdit",
  props: {
    rowid: {
      type: String,
      default:''
    },
    callid: {
      type: Number,
      default: 0
    },
    layerid: {
      type: String,
      default: ""
    }
  },
  data() {
    return {
      ruleForm: {
        value: "" //客户姓名
      },
      loading: false
    };
  },
  created() {
    if (this.callid) {
      this.ruleForm.unique_id = this.callid;
    }
    Promise.all([]).then(() => {
      if (this.rowid) {
      }
    });
  },
  methods: {
    submitForm() {
      this.$refs.ruleForm.validate(valid => {
        if (valid) {
          this.loading = true;
          return new Promise(resolve => {
            if (this.rowid) {
              detailTransfer(this.rowid,this.ruleForm.value)
                .then(response => {
                  this.loading = false;
                  if (response.state.toLowerCase() === "success") {
                    this.$parent.$layer.close(this.layerid);
                    this.$parent.btn_search(); // 重新加载父级数据
                    this.$message.success("恭喜你，处理成功!");
                  }
                })
                .catch(() => {
                  this.loading = false;
                });
            }
          });
        } else {
          this.$message.error("请输入有效的必填项信息!");
          return false;
        }
      });
    },
    handle(val){
        this.ruleForm.value=val
    }
  }
};
</script>

<style rel="stylesheet/scss" lang="scss">
.order_form {
  .form_select {
    width: 100%;
  }
  .form_date {
    width: 100%;
  }
  .col_select_text {
    text-align: right;
    padding-right: 15px;
  }
}
</style>