<!--
 * @Author: wanglj 471442253@qq.com
 * @Date: 2022-12-26 17:21:07
 * @LastEditors: wanglj
 * @LastEditTime: 2022-12-28 14:10:30
 * @Description: file content
 * @FilePath: \opms_frontend\src\views\customer\components\ToOpen.vue
-->
<template>
  <el-dialog :visible.sync="visible"
             width="30%"
             @close="handleClose"
             title="转移客户">
    <el-form :model="form"
             ref="form"
             label-width="100px">
      <el-form-item label="移入公海原因"
                    prop="remark">
        <el-input v-model="form.remark"
                  type="textarea"
                  :rows="5"
                  maxlength="300"
                  show-word-limit
                  resize="none"></el-input>
        <span>* 转移到公海后此客户数据将属于公共资源，原归属人员不能再维护跟进和更新此客户数据。</span>
      </el-form-item>
    </el-form>
    <span slot="footer">
      <el-button size="mini"
                 @click="visible = false">取消</el-button>
      <el-button size="mini"
                 type="primary"
                 @click="handleConfirm">确定</el-button>
    </span>
  </el-dialog>
</template>
<script>
import to from 'await-to-js'
import api from '@/api/customer'
export default {
  data () {
    return {
      visible: false,
      form: {
        ids: [],
        remark: ''
      }
    }
  },
  methods: {
    handleClose () {
      this.$refs.form.resetFields()
    },
    async handleConfirm () {
      const [err, res] = await to(api.moveToPubic({ ...this.form }))
      if (err) return
      this.$message.success(res.msg)
      this.visible = false
      this.$emit('refresh')
    }
  }
}
</script>

<style>
</style>