<template>

  <div>
    <el-card class="box-card noborder">
      <div class="cardtitles">基本信息</div>
      <div class="baseinfo">
        <div class="row">
          <div class="con">
            <span>项目级别 ：</span>
            <div class="inputxt">
              <div class="flex" v-if="nowedit == 1">
                <el-input placeholder="待添加"></el-input>
                <div class="flex">
                  <div class="btnsmall btn_primary h28" style="width: 56px">确定</div>
                  <div class="cancels h28" @click="nowedit = -1" style="">取消</div>
                </div>
              </div>
              <span class="txt" v-else @click="nowedit = 1">{{datas.projectLevel||'待添加'}}</span>
            </div>
          </div>
          <div class="con i">
            <span>项目阶段 ：</span>

            <div class="select-popper " >
              <span class="color_text" :class="{'txt':xmjd == '待添加'}">
                {{xmjd}}
                <i class="el-icon-caret-bottom"></i>
              </span>
              <el-select v-model="xmjd" class="select-multiple" placeholder="请选择">
                <el-option v-for="(item,index) in projectStage" :key="index" :label="item.dictLabel" :value="item.dictValue"></el-option>
              </el-select>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="con i" style="width: 100%;">
            <span style="float: left;margin-top: 2px">项目标签 ：</span>
            <div class="flex tipinput">
              <div class="tips" v-for="(item,index) in tipslit">{{item}}<img @click="deltip(index)" src="@/assets/images/project/del.png"></div>
              <el-input placeholder="待添加" v-model="tipsvalue"></el-input>
              <div class="addbtn" @click="addtips"></div>
            </div>
          </div>
        </div>
      </div>
    </el-card>
    <el-card class="box-card noborder">
      <div class="cardtitles">关键企业</div>
      <div class="baseinfo" style="padding-bottom: 8px">
        <div class="row">
          <div class="con">
            <span>主管单位 ：</span>
            <div class="inputxt">
              <div class="flex" v-if="nowedit == 2">
                <el-input placeholder="待添加"></el-input>
                <div class="flex">
                  <div class="btnsmall btn_primary h28" style="width: 56px">确定</div>
                  <div class="cancels h28" @click="nowedit = -1" style="">取消</div>
                </div>
              </div>
              <span class="txt" v-else @click="nowedit = 2">待添加</span>
            </div>
          </div>
          <div class="con i">
            <span>建设单位 ：</span>
            <div class="inputxt">
              <div class="flex" v-if="nowedit == 3">
                <el-input placeholder="待添加"></el-input>
                <div class="flex">
                  <div class="btnsmall btn_primary h28" style="width: 56px">确定</div>
                  <div class="cancels h28" @click="nowedit = -1" style="">取消</div>
                </div>
              </div>
              <span class="txt" v-else @click="nowedit = 3">待添加</span>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="con">
            <span>主管单位负责人 ：</span>
            <div class="inputxt">
              <div class="flex" v-if="nowedit == 4">
                <el-input placeholder="待添加"></el-input>
                <div class="flex">
                  <div class="btnsmall btn_primary h28" style="width: 56px">确定</div>
                  <div class="cancels h28" @click="nowedit = -1" style="">取消</div>
                </div>
              </div>
              <span class="txt" v-else @click="nowedit = 4">待添加</span>
            </div>
          </div>
          <div class="con i">
            <span>建设单位负责人 ：</span>
            <div class="inputxt">
              <div class="flex" v-if="nowedit == 5">
                <el-input placeholder="待添加"></el-input>
                <div class="flex">
                  <div class="btnsmall btn_primary h28" style="width: 56px">确定</div>
                  <div class="cancels h28" @click="nowedit = -1" style="">取消</div>
                </div>
              </div>
              <span class="txt" v-else @click="nowedit = 5">待添加</span>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="con">
            <span>主管单位联系电话 ：</span>
            <div class="inputxt">
              <div class="flex" v-if="nowedit == 6">
                <el-input placeholder="待添加"></el-input>
                <div class="flex">
                  <div class="btnsmall btn_primary h28" @click="isphone" style="width: 56px">确定</div>
                  <div class="cancels h28" @click="nowedit = -1" style="">取消</div>
                </div>
              </div>
              <span class="txt" v-else @click="nowedit = 6">待添加</span>
            </div>
          </div>
          <div class="con i">
            <span>建设单位联系电话 ：</span>
            <div class="inputxt">
              <div class="flex" v-if="nowedit == 7">
                <el-input placeholder="待添加"></el-input>
                <div class="flex">
                  <div class="btnsmall btn_primary h28" @click="isphone" style="width: 56px">确定</div>
                  <div class="cancels h28" @click="nowedit = -1" style="">取消</div>
                </div>
              </div>
              <span class="txt" v-else @click="nowedit = 7">待添加</span>
            </div>
          </div>
        </div>
      </div>
    </el-card>
    <el-card class="box-card noborder">
      <div class="cardtitles">相关数据</div>
      <div class="otherdata">
        <div class="det">
          <img src="@/assets/images/project/xgsj_1.png">
          <div class="i">{{datas.contactsCount}}  个</div>
          <div class="j">联系人</div>
        </div>
        <div class="det">
          <img src="@/assets/images/project/xgsj_2.png">
          <div class="i">{{datas.followRecordCount}}  条</div>
          <div class="j">跟进记录</div>
        </div>
        <div class="det">
          <img src="@/assets/images/project/xgsj_3.png">
          <div class="i">{{datas.backlogCount}}  条</div>
          <div class="j">工作待办</div>
        </div>
        <div class="det">
          <img src="@/assets/images/project/xgsj_4.png">
          <div class="i">{{datas.fileCount}}  个</div>
          <div class="j">资料文档</div>
        </div>
        <div class="det">
          <img src="@/assets/images/project/xgsj_5.png">
          <div class="i">{{datas.relateCompanyCount}}  家</div>
          <div class="j">相关企业</div>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
  import "@/assets/styles/project.scss"
  import {getDictType,} from '@/api/main'
  import {} from '@/api/project/project'
  export default {
    name: 'xmsl',
    props:{
      datas:'',
    },
    data(){
      return{
        nowedit:-1,//当前正在编辑的文本
        tipslit:[],//项目标签
        tipsvalue:"",//标签填写内容
        xmjd:'待添加',
        projectStage:[],//项目阶段
        sldata:this.datas,
      }
    },
    created(){
      //项目阶段
      getDictType('project_stage_type').then(result=>{
        this.projectStage = result.code == 200 ? result.data:[]
      })
      this.xmjd = this.datas.projectStage
      this.tipslit = this.datas.labelList
    },
    methods:{
      //验证电话号码
      isphone(value){
        var regPartton = /1[3-8]+\d{9}/;
        var regPartton1 = /^(0[0-9]{2,3}[\-]?[2-9][0-9]{6,7}[\-]?[0-9]?)$/;
        if (!regPartton.test(value) && !regPartton1.test(value)) {
          this.$message.error("请输入正确的电话");
        } else {

        }
      },
      //标签添加、删除
      addtips(){
        if(this.tipsvalue == "")
          return false
        if(this.tipslit.length>=30){
          this.$message.error("最多能只能添加30个标签")
          return false
        }
        this.tipslit.push(this.tipsvalue)
        this.tipsvalue = ""
      },
      deltip(index){
        this.tipslit.splice(index,1)
      },
    }
  }
</script>

<style scoped>

</style>
