<template>
  <div>
    <el-input  style="width:200px;" :placeholder="$t('搜索')" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="clearSearchValue" size="small" class="input-with-select inline-16 layout_search__panel mt-10" clearable>
    </el-input>
    <el-table
        ref="table"
        :row-class-name="tableClassName"
        :data="tableData"
        highlight-current-row
        size="mini"
        :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
        :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"
        border
    >
      <el-table-column
          prop="createby"
          :label="$t('跟进人')"
          min-width="90">
        <template slot-scope="scope">
          <div>
            {{scope.row.createby}}
            <el-tag v-if="scope.row.resource" size="mini" style="color: #3874f6">{{$t(scope.row.resource)}}</el-tag>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          prop="createdate"
          :label="$t(`跟进时间`)"
          min-width="139">
      </el-table-column>
      <el-table-column
          v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'"
          prop="type"
          :label="$t(`跟进类型`)"
          min-width="80">
      </el-table-column>
      <el-table-column
          prop="contacts"
          v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'"
          :label="$t(`跟进对象`)"
          min-width="69">
        <template slot-scope="scope">
          <div v-for="item in scope.row.contacts" :key="item.index">
            <span v-if="item.rowindex === scope.row.contacts.length" class="span-style">
              {{item.name}}
            </span>
            <span v-else class="span-style">
              {{item.name + ','}}
            </span>
          </div>
        </template>
      </el-table-column>
      <el-table-column
          prop="content"
          :label="$t(`跟进内容`)"
          min-width="500"
          >
        <template slot-scope="scope">
          <div v-if="($route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail')">
            <div>{{$t(`目的：`)}}{{scope.row.target}}</div>
            <div>{{$t(`过程：`)}}{{scope.row.content}}</div>
            <div>{{$t(`结果：`)}}{{scope.row.results}}</div>
            <div>{{$t(`下次跟进计划：`)}}{{scope.row.nextplan}}</div>
          </div>
          <div v-else>{{scope.row.content}}</div>
        </template>
      </el-table-column>
      <el-table-column
          v-if="$route.path === '/projectChangeDetail'"
          prop="squarestage"
          :label="$t(`项目阶段`)"
          min-width="500"
      >
        <template slot-scope="scope">
          <div>{{scope.row.squarestage?scope.row.squarestage:''}}</div>
        </template>
      </el-table-column>
      <el-table-column
          prop="attcount"
          :label="$t(`附件数`)"
          min-width="69">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="showFiles(scope.row)">{{scope.row.attcount}}</el-button>
        </template>
      </el-table-column>
      <el-table-column
          v-if="$route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail'"
          prop="salesfeesamount"
          :label="$t(`营销费用`)"
          min-width="80">
        <template slot-scope="scope">
          {{scope.row.salesfeesamount?tool.formatAmount(scope.row.salesfeesamount,2,'¥'):'¥0.00'}}
        </template>
      </el-table-column>
      <el-table-column
          :label="$t(`操作`)"
          fixed="right"
          min-width="220">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="showReview(scope.row)" class="inline-16">{{$t(`评论`)}}({{scope.row.commentqty}})</el-button>
          <editLog v-if="userid === scope.row.createuserid && !disabled"  ref="edits" :data="scope.row" :ownertable="ownertable" @onSuccess="onSuccess" :isOperation="true"></editLog>
          <el-button type="text" size="small" class="inline-16" @click="onDelFollow(scope.row)" v-if="userid === scope.row.createuserid && !disabled">{{$t(`删除`)}}</el-button>
          <marketingExpenses  v-if="($route.path === '/projectChangeDetail' || $route.path === '/customerDetail' || $route.path === '/PublicCustomerDetail') && !disabled"
                              class="inline-16" ownertable="sa_customers" :ownerid="scope.row.sys_datafollowupid" :dataTime="scope.row.createdate" :userid="scope.row.createuserid" :isOperation="true"
                              @onSuccess="listData"></marketingExpenses>
        </template>
      </el-table-column>
    </el-table>
    <div  class="container normal-panel" style="text-align:right">
      <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[20, 50, 100, 200]"
          :page-size="100"
          layout="total,sizes, prev, pager, next, jumper"
          :total="total">
      </el-pagination>
    </div>
    <normalDialog ref="normalDialogFile" title="附件" >
      <template slot="content">
        <attachmentList style="margin-top: -10px;margin-bottom: 10px" :attinfos="attinfo_attachment" :onlyread="true" minWidth="80">
        </attachmentList>
      </template>
    </normalDialog>
    <normalDialog ref="normalDialogReview" title="评论" @closeDialog="closeDialog">
      <template slot="content">
        <div style="padding: 10px">
          <div style="border: 1px solid #9ca3af;padding: 10px;border-radius: 5px">
            <el-input type="textarea" style="border: none;margin-bottom: 10px" :rows="1" v-model="content" :placeholder="$t(`我评论`)+'：'"></el-input>
            <el-divider></el-divider>
            <div style="display: flex;justify-content: right">
              <el-button   type="primary" size="small" :disabled="content.length == 0" @click="onComment">{{$t(`发布`)}}</el-button>
            </div>
          </div>
        </div>
        <div style="padding: 0 10px 10px 10px">
          <div style="max-height: 360px;min-height:200px;background: #F5F5F5;border-radius: 2px;padding: 10px;overflow:auto">
            <div style="color: #333;font-size: 16px;font-weight: bold">{{$t(`评论`)}}({{commentqty}})</div>
            <div v-for="item in comment" :key="item.index" style="margin-top: 10px">
              <div style="color: #333;font-size: 14px;font-weight: bold;margin-top: 5px">{{item.createby}}</div>
              <div style="color:#666;font-size: 14px;margin-top: 5px">{{item.content}}</div>
              <div style="display: flex;justify-content: space-between;align-items: center;margin-top: -5px;margin-bottom: -5px">
                <div style="display: flex;justify-content: space-between;align-items: center">
                  <div style="font-size: 12px;color: #999">{{item.createdate}}</div>
                  <el-button type="text" size="small" class="margin-5" v-if="userid == item.createuserid"><svg style="vertical-align: middle" t="1727053625238" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11334" width="14" height="14"><path d="M343.113143 156.379429h333.897143v-73.142858H343.113143v73.142858zM677.010286 0a83.456 83.456 0 0 1 83.456 83.456v64.146286h215.917714a46.299429 46.299429 0 1 1 0 92.672h-48.64v700.196571a83.456 83.456 0 0 1-83.456 83.456H176.128a83.456 83.456 0 0 1-83.456-83.456V240.054857H47.542857a46.299429 46.299429 0 0 1 0-92.452571h212.114286v-64.146286A83.456 83.456 0 0 1 343.113143 0h333.897143z m156.525714 241.371429H186.587429v688.859428h647.021714v-689.005714zM384.877714 345.6a41.764571 41.764571 0 0 1 41.764572 41.764571v333.897143a41.764571 41.764571 0 0 1-83.456 0V387.364571a41.764571 41.764571 0 0 1 41.691428-41.764571z m250.441143 0a41.764571 41.764571 0 0 1 41.764572 41.764571v333.897143a41.764571 41.764571 0 0 1-83.456 0V387.364571a41.764571 41.764571 0 0 1 41.545142-41.764571z" fill="#999999" p-id="11335"></path></svg>
                    <span style="color: #666666;font-size: 14px;margin-left: 5px;vertical-align: middle" @click="onDel(item)">{{$t(`删除`)}}</span></el-button>
                </div>
                <div>
                  <el-button type="text"  v-if="!isContentShow" size="small" @click="isContentShow = true;sys_datacommentid = item.sys_datacommentid">
                    <svg t="1727055468269" class="icon" style="vertical-align: middle" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11646" width="14" height="14"><path d="M643.657143 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286 36.571429 0 58.514286-29.257143 58.514285-58.514286 0-36.571429-29.257143-58.514286-58.514285-58.514286-29.257143-7.314286-58.514286 21.942857-58.514286 58.514286" fill="#3874F6" p-id="11647"></path><path d="M1024 142.774857c0-43.885714-43.885714-87.771429-87.771429-87.771428H87.771429c-43.885714 0-87.771429 36.571429-87.771429 87.771428v621.714286c0 51.2 43.885714 87.771429 87.771429 87.771428h307.2l117.028571 117.028572 117.028571-117.028572h307.2c51.2 0 87.771429-43.885714 87.771429-87.771428v-621.714286z m-65.828571 592.457143c0 29.257143-21.942857 51.2-51.2 51.2H592.457143l-80.457143 80.457143-80.457143-80.457143H117.028571c-29.257143 0-51.2-21.942857-51.2-51.2v-563.2c0-29.257143 21.942857-51.2 51.2-51.2h789.942858c29.257143 0 51.2 21.942857 51.2 51.2v563.2z" fill="#3874F6" p-id="11648"></path><path d="M453.485714 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286s58.514286-29.257143 58.514286-58.514286c0-36.571429-21.942857-65.828571-58.514286-65.828572s-58.514286 29.257143-58.514286 65.828572M256 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286s58.514286-29.257143 58.514285-58.514286c0-36.571429-29.257143-58.514286-58.514285-58.514286-36.571429-7.314286-58.514286 21.942857-58.514286 58.514286" fill="#3874F6" p-id="11649"></path></svg>
                    <span style="color: #3874F6;font-size: 14px;margin-left: 5px;vertical-align: middle">{{$t(`回复`)}}</span></el-button>
                  <el-button type="text"  v-if="isContentShow " size="small" @click="isContentShow = false;sys_datacommentid = ''">
                    <svg t="1727055468269" class="icon" viewBox="0 0 1024 1024" style="vertical-align: middle" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11646" width="14" height="14"><path d="M643.657143 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286 36.571429 0 58.514286-29.257143 58.514285-58.514286 0-36.571429-29.257143-58.514286-58.514285-58.514286-29.257143-7.314286-58.514286 21.942857-58.514286 58.514286" fill="#3874F6" p-id="11647"></path><path d="M1024 142.774857c0-43.885714-43.885714-87.771429-87.771429-87.771428H87.771429c-43.885714 0-87.771429 36.571429-87.771429 87.771428v621.714286c0 51.2 43.885714 87.771429 87.771429 87.771428h307.2l117.028571 117.028572 117.028571-117.028572h307.2c51.2 0 87.771429-43.885714 87.771429-87.771428v-621.714286z m-65.828571 592.457143c0 29.257143-21.942857 51.2-51.2 51.2H592.457143l-80.457143 80.457143-80.457143-80.457143H117.028571c-29.257143 0-51.2-21.942857-51.2-51.2v-563.2c0-29.257143 21.942857-51.2 51.2-51.2h789.942858c29.257143 0 51.2 21.942857 51.2 51.2v563.2z" fill="#3874F6" p-id="11648"></path><path d="M453.485714 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286s58.514286-29.257143 58.514286-58.514286c0-36.571429-21.942857-65.828571-58.514286-65.828572s-58.514286 29.257143-58.514286 65.828572M256 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286s58.514286-29.257143 58.514285-58.514286c0-36.571429-29.257143-58.514286-58.514285-58.514286-36.571429-7.314286-58.514286 21.942857-58.514286 58.514286" fill="#3874F6" p-id="11649"></path></svg>
                    <span style="color: #3874F6;font-size: 14px;margin-left: 5px;vertical-align: middle">{{$t(`取消回复`)}}</span></el-button>
                </div>
              </div>
              <div style="border: 1px solid #9ca3af;padding: 10px;border-radius: 5px" v-if="isContentShow && sys_datacommentid == item.sys_datacommentid">
                <el-input type="textarea" style="border: none;margin-bottom: 10px" :rows="1" v-model="replyContent" :placeholder="$t('我回复')+item.createby+'：'"></el-input>
                <el-divider></el-divider>
                <div style="display: flex;justify-content: right">
                  <el-button   type="primary" size="small" :disabled="replyContent.length == 0" @click="onReply(sys_datafollowupid,item)">{{$t(`发布`)}}</el-button>
                </div>
              </div>
              <div v-if="item.subcomment.length > 0" style="margin-left: 10px;margin-top: 10px">
                <div v-for="k in item.subcomment" :key="k.index" style="margin-top: 10px">
                  <div style="display: flex;justify-content: left;align-items: center">
                    <div style="font-size: 14px;font-weight: bold;color:#333;">{{k.createby}}</div><i style="margin: 0 10px 0 10px" class="el-icon-caret-right"></i><div style="font-size: 14px;font-weight: bold;color:#333;">{{k.replyusername}}</div>
                  </div>
                  <div style="color:#666;font-size: 14px;margin-top: 5px">{{k.content}}</div>
                  <div style="display: flex;justify-content: space-between;align-items: center;margin-top: -5px;margin-bottom: -5px">
                    <div style="display: flex;justify-content: space-between;align-items: center">
                      <div style="font-size: 12px;color:#999;margin-right: 10px">{{k.createdate}}</div>
                      <el-button type="text" size="small" v-if="userid == k.createuserid"><svg style="vertical-align: middle" t="1727053625238" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11334" width="14" height="14"><path d="M343.113143 156.379429h333.897143v-73.142858H343.113143v73.142858zM677.010286 0a83.456 83.456 0 0 1 83.456 83.456v64.146286h215.917714a46.299429 46.299429 0 1 1 0 92.672h-48.64v700.196571a83.456 83.456 0 0 1-83.456 83.456H176.128a83.456 83.456 0 0 1-83.456-83.456V240.054857H47.542857a46.299429 46.299429 0 0 1 0-92.452571h212.114286v-64.146286A83.456 83.456 0 0 1 343.113143 0h333.897143z m156.525714 241.371429H186.587429v688.859428h647.021714v-689.005714zM384.877714 345.6a41.764571 41.764571 0 0 1 41.764572 41.764571v333.897143a41.764571 41.764571 0 0 1-83.456 0V387.364571a41.764571 41.764571 0 0 1 41.691428-41.764571z m250.441143 0a41.764571 41.764571 0 0 1 41.764572 41.764571v333.897143a41.764571 41.764571 0 0 1-83.456 0V387.364571a41.764571 41.764571 0 0 1 41.545142-41.764571z" fill="#999999" p-id="11335"></path></svg>
                        <span style="color: #666666;font-size: 14px;margin-left: 5px;vertical-align: middle" @click="onDel(k)">{{$t(`删除`)}}</span></el-button>
                    </div>
                    <div>
                      <el-button  type="text" v-if="!isContentShow "  size="small" @click="isContentShow = true;sys_datacommentid = k.sys_datacommentid">
                        <svg t="1727055468269" class="icon" style="vertical-align: middle" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11646" width="14" height="14"><path d="M643.657143 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286 36.571429 0 58.514286-29.257143 58.514285-58.514286 0-36.571429-29.257143-58.514286-58.514285-58.514286-29.257143-7.314286-58.514286 21.942857-58.514286 58.514286" fill="#3874F6" p-id="11647"></path><path d="M1024 142.774857c0-43.885714-43.885714-87.771429-87.771429-87.771428H87.771429c-43.885714 0-87.771429 36.571429-87.771429 87.771428v621.714286c0 51.2 43.885714 87.771429 87.771429 87.771428h307.2l117.028571 117.028572 117.028571-117.028572h307.2c51.2 0 87.771429-43.885714 87.771429-87.771428v-621.714286z m-65.828571 592.457143c0 29.257143-21.942857 51.2-51.2 51.2H592.457143l-80.457143 80.457143-80.457143-80.457143H117.028571c-29.257143 0-51.2-21.942857-51.2-51.2v-563.2c0-29.257143 21.942857-51.2 51.2-51.2h789.942858c29.257143 0 51.2 21.942857 51.2 51.2v563.2z" fill="#3874F6" p-id="11648"></path><path d="M453.485714 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286s58.514286-29.257143 58.514286-58.514286c0-36.571429-21.942857-65.828571-58.514286-65.828572s-58.514286 29.257143-58.514286 65.828572M256 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286s58.514286-29.257143 58.514285-58.514286c0-36.571429-29.257143-58.514286-58.514285-58.514286-36.571429-7.314286-58.514286 21.942857-58.514286 58.514286" fill="#3874F6" p-id="11649"></path></svg>
                        <span style="color: #3874F6;font-size: 14px;margin-left: 5px;vertical-align: middle">{{$t(`回复`)}}</span></el-button>
                      <el-button type="text" v-if="isContentShow " size="small" @click="isContentShow = false;sys_datacommentid = ''">
                        <svg t="1727055468269" style="vertical-align: middle" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11646" width="14" height="14"><path d="M643.657143 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286 36.571429 0 58.514286-29.257143 58.514285-58.514286 0-36.571429-29.257143-58.514286-58.514285-58.514286-29.257143-7.314286-58.514286 21.942857-58.514286 58.514286" fill="#3874F6" p-id="11647"></path><path d="M1024 142.774857c0-43.885714-43.885714-87.771429-87.771429-87.771428H87.771429c-43.885714 0-87.771429 36.571429-87.771429 87.771428v621.714286c0 51.2 43.885714 87.771429 87.771429 87.771428h307.2l117.028571 117.028572 117.028571-117.028572h307.2c51.2 0 87.771429-43.885714 87.771429-87.771428v-621.714286z m-65.828571 592.457143c0 29.257143-21.942857 51.2-51.2 51.2H592.457143l-80.457143 80.457143-80.457143-80.457143H117.028571c-29.257143 0-51.2-21.942857-51.2-51.2v-563.2c0-29.257143 21.942857-51.2 51.2-51.2h789.942858c29.257143 0 51.2 21.942857 51.2 51.2v563.2z" fill="#3874F6" p-id="11648"></path><path d="M453.485714 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286s58.514286-29.257143 58.514286-58.514286c0-36.571429-21.942857-65.828571-58.514286-65.828572s-58.514286 29.257143-58.514286 65.828572M256 457.289143c0 36.571429 29.257143 58.514286 58.514286 58.514286s58.514286-29.257143 58.514285-58.514286c0-36.571429-29.257143-58.514286-58.514285-58.514286-36.571429-7.314286-58.514286 21.942857-58.514286 58.514286" fill="#3874F6" p-id="11649"></path></svg>
                        <span style="color: #3874F6;font-size: 14px;margin-left: 5px;vertical-align: middle">{{$t(`取消回复`)}}</span></el-button>
                    </div>
                  </div>
                  <div style="border: 1px solid #9ca3af;padding: 10px;border-radius: 5px" v-if="isContentShow && sys_datacommentid == k.sys_datacommentid">
                    <el-input type="textarea" style="border: none;margin-bottom: 10px" :rows="1" v-model="replyContent" :placeholder="$t('我回复')+k.createby+'：'"></el-input>
                    <el-divider></el-divider>
                    <div style="display: flex;justify-content: right">
                      <el-button   type="primary" size="small" :disabled="replyContent.length == 0" @click="onReply(sys_datafollowupid,k)">{{$t(`发布`)}}</el-button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </template>
    </normalDialog>
  </div>
</template>

<script>
import marketingExpenses from '@/components/marketingExpenses/index'
import normalDialog from '@/template/dialogTemplate/normal'
import attachmentList from '@/components/attachment_list/index.vue'
import editLog from '../followUp/editLog'
export default {
  name: "index",
  props:['ownertable','disabled'],
  components:{marketingExpenses,normalDialog,attachmentList,editLog},
  data() {
    return {
      tableData:[],
      currentPage:0,
      total:0,
      attinfo_attachment:[],
      content:'',
      comment:[],
      commentqty:0,
      userid:JSON.parse(sessionStorage.getItem('active_account')).userid,
      isContentShow:false,
      sys_datacommentid:'',
      replyContent:'',
      sys_datafollowupid:'',
      param:{
        "id": 20220930121501,
        "content": {
          "ownertable":'',
          "ownerid":'',
          "pageNumber": 1,
          "pageSize": 50,
          "where":{
            "condition":''
          }
        }
      }
    }
  },
  methods:{
    async listData(type,id){
      this.param.content.ownerid = this.$route.query.id
      this.param.content.ownertable = this.ownertable
      const res = await this.$api.requested(this.param)
      this.tableData = res.data
      this.total = res.total
      this.currentPage = res.pageNumber
      if (type){
        this.tableData.forEach(item=>{
          if (item.sys_datafollowupid == id){
            this.comment = item.comment
            this.commentqty = item.commentqty
          }
        })
      }
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.listData()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.listData()
    },
    tableClassName({ row, rowIndex }) {
      row.index = rowIndex;
    },
    clearSearchValue () {
      this.$store.dispatch('clearSearchValue')
      this.listData(this.param.content.pageNumber = 1)
    },
    showFiles(data){
      this.$refs.normalDialogFile.dialogVisible = true
      this.attinfo_attachment = data.attinfos
    },
    showReview(data){
      this.$refs.normalDialogReview.dialogVisible = true
      this.comment = data.comment
      this.commentqty = data.commentqty
      this.sys_datafollowupid = data.sys_datafollowupid
    },
    onDel(data){
      console.log(data,'删除')
      this.$confirm(this.$t('确定删除该评论吗')+'?', this.$t('提示'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        type: 'warning'
      }).then(async() => {
        const res = await this.$api.requested({
          "id": 20240429161701,
          "content": {
            "sys_datacommentid":data.sys_datacommentid
          }
        })
        this.tool.showMessage(res,()=>{
          this.listData('删除',this.sys_datafollowupid)
          this.$emit('newFollow')
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: this.$t('已取消删除'),
        });
      });

    },
    async onReply(id,data){
      const res = await this.$api.requested({
        "id": 20240429161601,
        "content": {
          "ownertable":'sys_datafollowup',//数据表
          "ownerid":id,//数据id
          "content":this.replyContent,//内容
          "replyid":data.sys_datacommentid//被回复评论id
        }
      })
      this.tool.showMessage(res,()=>{
        this.replyContent = ''
        this.isContentShow = false
        this.sys_datacommentid = ''
        this.listData('回复',this.sys_datafollowupid)
        this.$emit('newFollow')
      })
    },
    async onComment(){
      const res = await this.$api.requested({
        "id": 20240429161601,
        "content": {
          "ownertable":'sys_datafollowup',//数据表
          "ownerid":this.sys_datafollowupid,//数据id
          "content":this.content,//内容
          "replyid":"0"//被回复评论id
        }
      })
      this.tool.showMessage(res,()=>{
        this.content = ''
        this.sys_datacommentid = ''
        this.listData('回复',this.sys_datafollowupid)
        this.$emit('newFollow')
      })
    },
    closeDialog(){
      this.content = ''
      this.replyContent = ''
      this.isContentShow = false
    },
    onSuccess(){
      this.listData()
      this.$emit('newFollow')
    },
    onDelFollow(val){
      this.$confirm(this.$t('确定删除该跟进动态吗？'), this.$t('提示'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        type: 'warning'
      }).then(async() => {
        const res = await this.$api.requested({
          "id": 20220930121701,
          "content": {
            "sys_datafollowupid":val.sys_datafollowupid
          }
        })
        this.tool.showMessage(res,()=>{
          this.listData()
          this.$emit('newFollow')
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    }
  },
  mounted() {
    this.listData()
  }
}
</script>

<style scoped>
  .table-style{
    width: 100%;
    height: calc(100vh - 390px);
  }
  /deep/ .el-table .cell.el-tooltip {
     white-space: break-spaces;
    min-width: 50px;
  }
</style>
