<template>
  <div class="">
    <el-card class="box-card noborder">
      <div class="cardtitles">{{ title }}</div>
      <div class="baseinfo" >
        <el-input id="inputxt9" v-model="val" @focus="focusNowedit(noweditis)" class="textarea" type="textarea" :placeholder="'请输入' + title"  maxlength="500" :show-word-limit="true" ></el-input>
        <div class="flex btns" v-if="nowedit == noweditis">
          <div class="flex">
            <div class="btnsmall btn_primary h28" @click="changes(val,field)" style="width: 56px">确定</div>
            <div class="cancels h28" @click="focusNowedit(-1)" style="">取消</div>
          </div>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
import { customerUpdate } from '@/api/detail/party-a/cooperate'
export default {
  name: "elCardinput",
  props: ['infos','title','projectDetails','nowedit','noweditis','field'],
  data() {
    return {
      val: this.projectDetails
    }
  },
  created() {

  },
  methods: {
    changes(v,n){
      let data = {
        customerId: this.infos.customerId,
      }
      data[n] = v
      this.$emit("focus-nowedit", -1)
      customerUpdate(data).then(res=>{
          if (res.code == 200){
            this.$message.success('修改成功！')
          }else{
            this.$message.error(res.msg)
          }
      })
    },
    focusNowedit(e){
      this.$emit("focus-nowedit", e)
    },
  }
}
</script>

<style lang="scss" scoped>
.noborder{
  margin-bottom: 0;
}
</style>
