<!-- 客户管理 -->
<template>
      <div class="datamanage-wrapper">
		  <div class="search-wrapper">
		    <el-input
			  type="number"
		      v-model="tel"
		      style="width:130px; margin-left: 10px"
		      placeholder="请输入电话"
			  clearable
		    />
			<el-select
			  v-model="className"
			  placeholder="请选择类别"
			  filterable
			  clearable
			  allow-create
			  style="width:180px; margin-left: 15px;"
			>
			  <el-option
				v-for="item in typeManage.dropData"
				:key="item.id"
				:label="item.name"
				:value="item.name"
			  />
			</el-select>
			<el-input
			  v-model="salesName"
			  type="text"
			  style="width:150px; margin-left: 15px"
			  placeholder="请输入销售人员"
			  clearable
			/>
			<el-select
			  v-model="giveUp"
			  placeholder="请选择是否废弃"
			  filterable
			  clearable
			  allow-create
			  style="width:160px;margin-left: 15px;"
			>
			  <el-option
				v-for="item in validornotData"
				:label="item.name"
				:value="item.value"
			  />
			</el-select>
			<el-select
			  v-model="dealStatus"
			  placeholder="是否成交"
			  filterable
			  clearable
			  allow-create
			  style="width:120px;margin-left: 15px;"
			>
				<el-option v-for="item in Dict.dealStatus" :label="item.name" :value="item.value"/>
			</el-select>
			<el-date-picker
			 :default-time="['00:00:00', '23:59:59']"
		      style="width: 200px !important;margin-left: 15px;"
			  v-model="searchTime"
			  type="datetimerange"
			  range-separator="至"
			  start-placeholder="开始日期"
			  end-placeholder="结束日期"
			  clearable
			/>
		    <el-button
		      type="success"
		      style="margin-left: 15px"
			    icon="el-icon-search"
		      @click="toSearch"
		      >搜索</el-button
		    >
			 <el-button type="primary"
			 style="margin-left: 15px"
			 icon="el-icon-circle-plus"
			  @click="newlyAdd('add')">
			  新增</el-button>

			  <el-button type="warning"
			 style="margin-left: 15px"
			 icon="el-icon-circle-plus"
			  @click="reqExportExcel()">
			  导出</el-button>
        <el-button
        	type="info"
        	icon="el-icon-setting"
        	@click="resetTable"
        	style="margin-left: 20px;"
        >重置</el-button>
		  </div>
		<!-- 获取全部 -->
        <div class="table-wrapper">
          <el-table
           :data="typeManage.tableData"
            style="width: 100%"
          >
            <el-table-column type="index"  label="序号" width="60" />
            <el-table-column prop="name" label="姓名" width="120" />
            <el-table-column prop="giveUp" label="是否废弃" width="130">
            <template slot-scope="scope">
               <span v-if="scope.row.giveUp === 0" style="color: #67c23a;">有效</span>
               <span v-else style="color:#f56c6c;">无效</span>
            </template>
          </el-table-column>
            <el-table-column prop="saleidStr" label="销售人员" width="120" />
            <el-table-column prop="company" label="公司名称" width="180" />
            <el-table-column prop="updatetime" label="最后跟进时间" width="180" />
		    <el-table-column prop="dealStatus" label="成交状态" width="150">
				<template slot-scope="scope">
				   <span v-if="scope.row.dealStatus===0" style="color:#f56c6c;">未成交</span>
				   <span v-else style="color: #67c23a;">已成交</span>
				</template>
			</el-table-column>
			<el-table-column prop="itemCompletedQuantity" label="成交数量"/>
			<el-table-column prop="classidStr" label="信息分类" width="150" />
			<el-table-column prop="inforSourceVo" label="客户来源" width="150" />
			<el-table-column prop="custLevel" label="客户级别" width="150" />
			<el-table-column prop="custType" label="客户类型" width="150" />
			<el-table-column prop="tel" label="电话" width="140" />
            <el-table-column prop="custAddr" label="地址" width="140" />
            <el-table-column prop="qqnub" label="QQ" width="140" />
            <el-table-column prop="weixin" label="微信" width="140" />
			<el-table-column prop="priorSaleidStr" label="原销售" width="100"  v-if="yxs"/>
			<el-table-column label="操作" fixed="right" width="280">
				<template slot-scope="scope">
					<el-button
						size="mini"
						type="primary"
						icon="el-icon-view"
						@click="see($event, scope.$index, scope.row)"
						>查看</el-button
					>
					<el-button
						size="mini"
						type="primary"
						icon="el-icon-edit"
						@click="newlyAdd('edit', $event, scope.$index, scope.row)"
						>编辑</el-button
					>
					<el-button
						size="mini"
						type="warning"
						icon="el-icon-edit"
						:disabled="!scope.row.giveUp"
						@click="restartConfig(scope.row)"
            v-if="showfp"
						>重分配</el-button
					>
				</template>
			</el-table-column>
          </el-table>
          <el-pagination
            :page-sizes="[10, 20, 30, 40]"
            layout="total, sizes, prev, pager, next, jumper"
            :total="typeManage.total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            style="margin-top: 20px;"
          />
		  <!-- drawer打开抽屉 -->
			<el-drawer
			  title="信息查看"
			  :visible.sync="drawer"
			  :with-header="false"
			  :size="size"
			  >
			  <div class="box">
				  <div class="box_top">
					  <div class="top-content">
						  <div>客户来源:<span>{{this.addFormInfo.from.inforSourceVo}}</span></div>
						  <div>信息分类:<span>{{this.addFormInfo.from.classidStr}}</span></div>
						  <div>客户级别:<span>{{this.addFormInfo.from.custLevel}}</span></div>
					  </div>
					  <div class="top-content1">
						  <div>销售人员:<span>{{this.addFormInfo.from.saleidStr}}</span></div>
						  <div>成交状态:
						  <span>
							  <template >
							     <span v-if="this.addFormInfo.from.dealStatus===0" >未成交</span>
							     <span v-else>已成交</span>
							  </template>
						  </span>
						  </div>
							<el-button
							  type="primary"
							  @click="handOver">转交给销售人员
							</el-button>
					  </div>
				  </div>
				  <div class="box_bottom">
					  <div class="box_left">
						   <el-tabs v-model="activeName"  style="width:100%">
						      <el-tab-pane
							  label="客户信息" name="first">
								  <div class="content-box">
									  <div class="content-text">基础信息</div>
									  <div class="content-top">
										  <div class="content-center">
											  <div>公司名称:<span>{{this.addFormInfo.from.company}}</span></div>
											    <div>
												   联系人姓名:<span>{{this.addFormInfo.from.name}}</span>
											    </div>
										  </div>
										  <div class="content-center">
											  <div>电话:<span>{{this.addFormInfo.from.tel}}</span></div>
											  <div >qq:<span>{{this.addFormInfo.from.qqnub}}</span></div>
											  <div>微信号:<span>{{this.addFormInfo.from.weixin}}</span></div>
										  </div>
										  <div class="content-center">
											  <div>需求描述:<span>{{this.addFormInfo.from.remarks}}</span></div>
											  <div>客户地址:<span>{{this.addFormInfo.from.custAddr}}</span></div>
										  </div>
									  </div>
								  </div>
								  <div class="content-message">
									  <div class="bandonment-text">
										  客户废弃信息
										  <el-button
										  	size="mini"
										  	type="danger"
										  	icon="el-icon-close"
										  	style="margin-right:30px"
										  	@click="bandonment"
										  	>废弃</el-button>
									</div>
									  <div class="content-top">
										<div class="content-reason">
											客户废弃原因:
										<span>{{this.addFormInfo.from.giveUpResult}}</span>
										</div>
									  </div>
								  </div>
								  <div class="content-list">
									 <div class="title">
										  <div class="content-title">项目信息</div>
										 <el-button type="primary" @click="newProject">新增项目</el-button>
									 </div>
									   <el-table
									       :data="addManage.addManagedata"
										    max-height="285"
									        style="width: 100%;"
										    @row-click="singleElection"
										    highlight-current-row
										   >
										  <el-table-column align="center" width="55" label="选择">
										         <template slot-scope="scope">
										           <!-- 可以手动的修改label的值，从而控制选择哪一项 -->
										           <el-radio class="radio" v-model="templateSelection" :label="scope.row.id"
										             >&nbsp;</el-radio
										           >
										         </template>
										    </el-table-column>
									       <el-table-column
									         prop="projectName"
									         label="项目名称"
									         width="180">
									       </el-table-column>
									       <el-table-column
									         prop="projectRemarks"
									         label="项目描述"
									         width="180">
									       </el-table-column>
									       <el-table-column
									         prop="dealStatus"
									         label="成交状态"
											 width="100"
											 >
											 <template slot-scope="scope">
											    <span v-if="scope.row.dealStatus===0" style="color:#f56c6c;">未成交</span>
											    <span v-else style="color: #67c23a;">已成交</span>
											 </template>
									       </el-table-column>
										   <el-table-column
										     prop="addtime"
											  width="180"
										     label="时间">
										   </el-table-column>
										   <el-table-column
											   fixed="right"
											   label="操作"
											   >
											   <template slot-scope="scope">
												 <el-button
												   @click="renew($event, scope.$index, scope.row)"
												   type="text"
												   size="small">
												   修改
												 </el-button>
											   </template>
											 </el-table-column>
									     </el-table>
										 <el-pagination
										   :page-sizes="[10, 20, 30, 40]"
										   layout="total, sizes, prev, pager, next, jumper"
										   :total="addManage.total"
										   @size-change="addSizeChange"
										   @current-change="addCurrentChange"
										   style="margin-top: 20px;"
										 />
								       </div>
									   <!-- 新增项目 -->
									   <el-dialog title="新增项目" :visible.sync="addDialog" append-to-body>
									       <el-form
									         ref="addData"
									         :model="addEntry"
									         :rules="addrules"
									       >
									   	  <el-form-item prop="entryName" label="项目名称" style="margin-left: 30px;">
									   	   <el-input v-model="addEntry.entryName" type="text" clearable
										   style="width: 200px !important;"/>
									   	 </el-form-item>
										 <el-form-item prop="erpOrderNo" label="ERP单号" style="margin-left: 30px;">
													<el-input v-model="addEntry.erpOrderNo" type="text" clearable style="width:200px !important;" placeholder="请输入ERP单号"/>
												</el-form-item>
									    <el-form-item label="需求描述:" autosize  prop="specific"
										style="margin-left: 30px;margin-top:10px;">
									    <el-input type="textarea"
										v-model="addEntry.specific"
									   	:rows="5"
									   	style="width:50%!important;">
										</el-input>
									     </el-form-item>
									       </el-form>
									       <div slot="footer">
									         <el-button type="primary" @click="upate" :loading="addEntry.flag === 0">确定</el-button>
									       </div>
									    </el-dialog>
										<!-- 更新项目 -->
										<el-dialog title="修改项目" :visible.sync="renewDialog" append-to-body>
										    <el-form
										      ref="renewData"
										      :model="renewEntry"
										      :rules="renewrules"
										    >
												<el-form-item prop="entryName" label="项目名称" style="margin-left: 30px;">
													<el-input v-model="renewEntry.entryName" type="text" clearable style="width: 200px !important;"/>
												</el-form-item>
												<el-form-item prop="erpOrderNo" label="ERP单号" style="margin-left: 30px;">
													<el-input v-model="renewEntry.erpOrderNo" type="text" clearable style="width:200px !important;" placeholder="请输入ERP单号"/>
												</el-form-item>
												<el-form-item label="需求描述:" autosize  prop="specific"
												style="margin-left: 30px;margin-top:10px;">
													<el-input type="textarea" v-model="renewEntry.specific" :rows="5" style="width:50%!important;" />
												</el-form-item>
										    </el-form>
										    <div slot="footer">
												<el-button type="primary" @click="renewUpate">确定</el-button>
										    </div>
										 </el-dialog>
										 <!-- 废弃弹窗 -->
										 <el-dialog title="废弃信息" :visible.sync="bandonmentDialog" append-to-body>
										     <el-form
										       ref="bandonmentData"
										       :model="bandonmentEntry"
										       :rules="bandonmentrules"
										     >
										  <el-form-item label="废弃原因:" autosize  prop="specific"
										 	style="margin-left: 30px;margin-top:10px;">
										  <el-input type="textarea"
										 	v-model="bandonmentEntry.reason"
										 	:rows="5"
										 	style="width:50%!important;">
										 	</el-input>
										   </el-form-item>
										     </el-form>
										     <div slot="footer">
										       <el-button type="primary" @click="bandonmentUpate">确定</el-button>
										     </div>
										  </el-dialog>
							  </el-tab-pane>
							  <!-- 售前技术支持 -->
						      <el-tab-pane label="售前技术支持" name="second">
								  <div style="margin:20px 20px 20px 30px">
										<el-select
										 v-model="support.record"
										 placeholder="请选择项目名称"
										 @change="supportChange">
										  <el-option
											 v-for="item in support.supportList"
											 :key="item.id"
											:label="item.projectName"
											:value="item.projectName"
										     />
										</el-select>
									   <el-button type="primary" @click="saleAssign"
									   style="margin-left: 30px;">指派售前人员</el-button>
								  </div>
								  <el-table
								      :data="support.supportData"
								      style="width: 100%">
								      <el-table-column
								        prop="chargePersonName"
								        label="售前人员"
								        width="80">
								      </el-table-column>
								      <el-table-column
								        prop="description"
								        label="说明信息"
								        width="140">
								      </el-table-column>
								      <el-table-column
								        prop="fileOriginalName"
								        label="售前技术方案"
										width="180"
										>
								      </el-table-column>
									   <el-table-column
										 prop="remarks"
										 label="备注">
									   </el-table-column>
									   <el-table-column
										 prop="addTime"
										 label="时间">
									   </el-table-column>
									   <el-table-column
										   fixed="right"
										   label="操作"
										   >
										   <template slot-scope="scope">
											 <el-button
											   @click.native.prevent="editSupport(scope.$index, tableData)"
											   type="text"
											   size="small">
											   编辑
											 </el-button>
											 <el-button
											   @click.native.prevent="deleteSupport(scope.row)"
											   type="text"
											   size="small">
											   删除
											 </el-button>
										   </template>
										</el-table-column>
								    </el-table>
							  </el-tab-pane>
							  <!-- 项目成交记录 -->
						      <el-tab-pane label="项目成交记录" name="third">
								  <el-table
								      :data="projectTransaction.tableTwoData"
								      style="width: 100%">
									  <el-table-column
									    prop="projectName"
									    label="项目名称"
									    >
									  </el-table-column>
								      <el-table-column
								        prop="saleName"
								        label="销售人员"
								        >
								      </el-table-column>
									  <el-table-column
									    prop="followResult"
									    label="跟进结果"
									    >
									  </el-table-column>
								      <el-table-column
								        prop="dealStatus"
								        label="是否成交"
										>
								      </el-table-column>
									   <el-table-column
										 prop="addTime"
										 label="下次提醒时间">
									   </el-table-column>
								    </el-table>
									<el-pagination
									  :page-sizes="[10, 20, 30, 40]"
									  layout="total, sizes, prev, pager, next, jumper"
									  :total="projectTransaction.total"
									  @size-change="projectTransactionChange"
									  @current-change="projectTransactionCurrentChange"
									  style="margin-top: 20px;"
									/>
							  </el-tab-pane>
						    </el-tabs>
					  </div>
					  <div class="box_right">
							<div class="right_content">
								<div class="right-title">跟进记录</div>
								 <el-select
								  v-model="flowup.from.projectId"
								  clearable
								  placeholder="请选择项目名称"
								  @change="towerChange">
								   <el-option
										 v-for="item in flowup.flowupData"
										 :key="item.id"
										:label="item.projectName"
										:value="item.id"
								      />
								 </el-select>
								<el-button type="primary" @click="modifyRelease('add')" :disabled="modifyReleasedisabled">
									发布跟进记录
								</el-button>
							</div>
							<div>
								<el-table
								    :data="flowupManage.flowupManagedata"
									 max-height="700"
								    style="width: 100%"
									:row-class-name="tableRowClassName"
									>
								    <el-table-column
								      prop="followStatus"
								      label="跟进状态"
								      width="100">
									<template slot-scope="scope">
									   <span v-if="scope.row.followStatus===1">首次跟进</span>
									   <span v-else-if ="scope.row.followStatus===2" >多次跟进</span>
									   <span v-else-if="scope.row.followStatus===3" style="color: #67c23a;">成交</span>
									   <span v-else="scope.row.followStatus===4" >成交后跟进</span>
									</template>
								    </el-table-column>
								    <el-table-column
								      prop="followResult"
									  width="140"
								      label="跟进结果">
								    </el-table-column>
								   <el-table-column
									 prop="remindTime"
									width="150"
									 label="下次提醒时间">
								   </el-table-column>
								   <el-table-column
								    prop="addtime"
								    width="150"
								    label="添加时间">
								   </el-table-column>
								   <el-table-column prop="aaaaa" width="100" label="提示">
								   	<template slot-scope="scope">
								   		{{getTimePart(scope.row.addtime)}}
								   	</template>
								   </el-table-column>
								   <el-table-column
								    prop="followFiles"
								   	width="150"
								    label="文件">
									<template slot-scope="scope">
										{{scope.row.followFiles}}
									</template>
								   </el-table-column>
								   <el-table-column
								       width="150"
									   fixed="right"
									   label="操作"
									   >
									   <template slot-scope="scope">
										 <el-button
										   @click.native.prevent="upateFile(scope.row.fileName)"
										   type="text"
										   size="small">
										   下载
										 </el-button>
										 <el-button
										   @click.native.prevent="modifyRelease('eidt', scope.row)"
										   type="text"
										   size="small">
										   编辑
										 </el-button>
										 <el-button
										   @click.native.prevent="deleteRelease(scope.row)"
										   type="text"
										   size="small">
										   删除
										 </el-button>
									   </template>
									 </el-table-column>
								  </el-table>
								  <el-pagination
								    :page-sizes="[10, 20, 30, 40]"
								    layout="total, sizes, prev, pager, next, jumper"
								    :total="flowupManage.total"
								    @size-change="flowupSizeChange"
								    @current-change="flowupCurrentChange"
								    style="margin-top: 20px;"
								  />
							</div>
					  </div>
				  </div>
			  </div>
			</el-drawer>
        </div>
        <el-dialog :title="addFormInfo.title" :visible.sync="typeManage.addDialog">
          <el-form
            ref="addDataForm"
            :model="addFormInfo.from"
            :rules="rules"
          >
		    <div class="contact">
			  <el-form-item prop="inforSourceVo" label="客户来源" :label-width="'120px'">
			  <el-select
				   v-model="addFormInfo.from.inforSourceVo"
				   placeholder="请选择客户来源"
				   clearable
				   :disabled="showinforSourceVo"
				 >
				   <el-option
					 v-for="item in customerSourceList"
					:label="item.name"
					:value="item.value"
				   />
				 </el-select>
			   </el-form-item>
			   <el-form-item prop="custLevel" label="客户级别" :label-width="'120px'">
			   <el-select
					v-model="addFormInfo.from.custLevel"
					placeholder="请选择客户级别"
					clearable
				  >
					<el-option
					v-for="item in customerLevelList"
					:label="item.name"
					:value="item.value"
					/>
				  </el-select>
				</el-form-item>
			</div>
			  <div class="contact">
				  <el-form-item prop="custIndustry" label="所属行业" :label-width="'120px'">
				  <el-select
						v-model="addFormInfo.from.custIndustry"
						placeholder="请选择所属行业"
						clearable
					  >
						<el-option
						v-for="item in industryList"
						:label="item.name"
						:value="item.value"
						/>
					  </el-select>
					</el-form-item>
					<el-form-item prop="classidStr" label="信息分类" :label-width="'120px'">
					 <el-select
						  v-model="addFormInfo.from.classidStr"
						  placeholder="请选择类别"
						  allow-create
						>
						  <el-option
						v-for="item in typeManage.dropData"
						:key="item.id"
						:label="item.name"
						:value="item.name"
						  />
						</el-select>
					</el-form-item>
			  </div>
			  <el-form-item prop="custType" label="客户类型" :label-width="'120px'"
			   style="margin-left: 70px;">
			  <el-select
					v-model="addFormInfo.from.custType"
					placeholder="请选择客户类型"
					clearable
				  >
					<el-option
					v-for="item in typeList"
					:label="item.name"
					:value="item.value"
					/>
				  </el-select>
				</el-form-item>
             <div class="contact">
				  <el-form-item prop="name" label="联系人姓名">
				   <el-input v-model="addFormInfo.from.name" type="text" clearable/>
				 </el-form-item>
				 <el-form-item prop="qqnub" label="QQ号" >
				   <el-input v-model="addFormInfo.from.qqnub" type="number" clearable />
				 </el-form-item>
             </div>
			<div class="contact">
				<div>
					 <el-form-item prop="tel" label="电话" >
					   <el-input
					    v-model="addFormInfo.from.tel"
					    type="number" clearable/>
					 </el-form-item>
				</div>
				<div>
					<el-form-item prop="weixin" label="微信号">
					  <el-input v-model="addFormInfo.from.weixin" type="text" clearable/>
					</el-form-item>
				</div>
			</div>
            <el-form-item prop="company" label="公司名称"
			style="margin-left: 67px;margin-top:10px;">
              <el-input v-model="addFormInfo.from.company" type="text" clearable
			   style="width: 80%!important;"/>
            </el-form-item>
			 <el-form-item label="需求描述:" autosize  prop="remarks"
			 style="margin-left: 67px;margin-top:10px;">
			    <el-input type="textarea"
				 v-model="addFormInfo.from.remarks"
				:rows="5"
				style="width: 80%!important;">
				</el-input>
			  </el-form-item>
				<el-form-item label="所在省份:" prop="companyCounty"  style="margin-left: 67px;margin-top:10px;">
				  <!-- 省 -->
				  <el-select v-model="addFormInfo.from.province" @change="getSelectCity($event, 'city', 2)" clearable>
					<el-option
					  v-for="(item, index) in Dict.province"
					  :key="index"
					  :label="item.name"
					  :value="item.code"
					/>
				  </el-select>
				  <!-- 市 -->
				 <el-select v-model="addFormInfo.from.city" @change="getSelectArea($event, 'area', 3)" clearable>
					<el-option
					  v-for="(item, index) in Dict.city"
					  :key="index"
					  :label="item.name"
					  :value="item.code"
					/>
				 </el-select>
				  <!-- 区 -->
				<el-select v-model="addFormInfo.from.area" clearable>
					<el-option
					  v-for="(item, index) in Dict.area"
					  :key="index"
					  :label="item.name"
					  :value="item.code"
					/>
				</el-select>
				</el-form-item>
			   <el-form-item prop="custAddr" label="客户地址:"
			   style="margin-left: 67px;margin-top:10px;">
			     <el-input v-model="addFormInfo.from.custAddr"
				 clearable
				  type="text"
			      style="width: 80%!important;"/>
			   </el-form-item>
          </el-form>
          <div slot="footer">
            <el-button type="primary" @click="submitForm" :loading="addFormInfo.flag === 0">确定</el-button>
          </div>
        </el-dialog>
		<!-- 转交销售人员 -->
		<el-dialog title="转交销售人员" :visible.sync="handoverDialog" append-to-body>
		    <el-form
		       ref="handpeopleRef"
		      :model="salesPersonnelfrom"
		      :rules="handoverSalemanrules"
		    >
			  <el-form-item prop="changesalesman" label="选择销售人员" style="margin-left: 30px;">
			  <el-select v-model="salesPersonnelfrom.changesalesman" clearable placeholder="请选择销售人员">
			    <el-option
			      v-for="item in salesPersonnelfrom.deliverAssign"
			      :key="item.nickName"
			      :label="item.nickName"
			      :value="item.userId">
			    </el-option>
			  </el-select>
			 </el-form-item>
		    </el-form>
		    <div slot="footer">
		      <el-button type="primary" @click="deliverUpate">确定</el-button>
		    </div>
		</el-dialog>
		<!-- 发布跟进记录 -->
		<el-dialog :title="flowup.title" :visible.sync="modifyreleaseDialog" append-to-body >
			<el-form
		        ref="fileForm"
		        :model="flowup.from"
		  		max-height="500"
		        :rules="releaserules"
			>
				<el-form-item prop="followStatus" label="跟进状态:" style="margin-left: 30px;">
					<el-select v-model="flowup.from.followStatus" clearable placeholder="请选择跟进状态" @change="isErpOnchange">
						<el-option
						  v-for="item in Dict.followUpList"
						  :key="item.value"
						  :label="item.name"
						  :value="item.value"
						  :disabled="item.followdisabled"
						  >
						</el-option>
					</el-select>
				</el-form-item>
				<el-form-item prop="erpOrderNo" label="ERP单号" style="margin-left:30px;" v-if="flowup.isErpOrderNo">
					<el-input v-model="flowup.from.erpOrderNo" style="width:200px;" type="text" placeholder="请输入ERP单号"/>
				</el-form-item>
		  		<el-form-item prop="remindTime" label="下次提醒时间:" style="margin-left: 30px;">
		  			<el-date-picker
		  				v-model="flowup.from.remindTime"
		  				type="datetime"
		  				clearable
		  				placeholder="选择日期">
		  			</el-date-picker>
		  		</el-form-item>
		  		<el-form-item label="跟进结果:" autosize  prop="followResult" style="margin-left: 30px;margin-top:10px;">
		  			<el-input type="textarea"
						v-model="flowup.from.followResult"
						:rows="5"
						clearable
						style="width: 80%!important;">
					</el-input>
		  		</el-form-item>
		  		<el-form-item prop="followFiles" label="文件名称" :label-width="'120px'">
					<div v-if="showPrise">{{this.flowup.from.followFiles}}</div>
					<el-upload
						class="upload"
						name="file"
						ref="fileRef"
						:limit="1"
						:on-change="handleBeforeUpload"
						:auto-upload="false"
						:before-remove="removeFileCallback"
					  >
						<el-button type="text" size="small" icon="el-icon-upload">点击上传</el-button>
					</el-upload>
		  		</el-form-item>
			</el-form>
			<div slot="footer">
				<el-button type="primary" @click="emodifyupate">确定</el-button>
			</div>
		</el-dialog>
		<!-- 指派售前人员 -->
		<el-dialog title="售前技术支持" :visible.sync="assignDialog" append-to-body>
		      <el-form
		        ref="saleEngineerRef"
		        :model="handoverSalemanfrom"
		        :rules="saleEngineerrules"
		      >
		  	  <el-form-item prop="salesman" label="售前技术总监" style="margin-left: 30px;">
		  	  <el-select v-model="handoverSalemanfrom.salesman" clearable placeholder="请选择售前技术总监">
		  	    <el-option
		  	      v-for="item in assignData"
		  	      :key="item.label"
		  	      :label="item.label"
		  	      :value="item.leaderId">
		  	    </el-option>
		  	  </el-select>
		  	 </el-form-item>
			 <el-form-item prop="entryName" label="项目名称" style="margin-left: 58px;">
			  <el-select v-model="handoverSalemanfrom.entryName" clearable placeholder="请选择项目名称">
			    <el-option
			      v-for="item in this.handoverSalemanfrom.handleoverList"
			      :key="item.id"
			      :label="item.projectName"
			      :value="item.id">
			    </el-option>
			  </el-select>
			 </el-form-item>
			 <el-form-item label="说明:" autosize  prop="description"
			 style="margin-left: 80px;margin-top:10px;">
			    <el-input type="textarea"
				 v-model="handoverSalemanfrom.description"
				:rows="5"
				style="width: 80%!important;">
				</el-input>
			  </el-form-item>
		      </el-form>
		      <div slot="footer">
		        <el-button type="primary" @click="salesmanUpate">提交</el-button>
		      </div>
		</el-dialog>
      </div>
</template>

<script>
import axios from "axios";
import {
	getAllCategory,getAllcustomer,addcustomer,getAllProvince,allData,addPop,toUpdate,
	editcustomer,getCode,releaseFollowuprecord,followupData,searchContent,deleteFollowuprecord,modifyFollowuprecord,selectvalue,read,technicalDirector, exportExcel
} from "@/api/customer.js";
import {getAllsupport,deliverList,changeMan,assignPresales,findWhereDeal,bandonmentRequest} from "@/api/newCustomer.js";
import { parseTime } from "../../utils";
import { friendlyDate } from "@/assets/js/Utils";
export default {
  data() {
    return {
        yxs:false,
        showfp:false,
		   // 当前选择的行的数据
		    templateSelection: "",
		    checkList: [],
		   // 废弃弹窗
		    bandonmentDialog:false,
			bandonmentEntry:{
				reason:''
			},
		    modifyReleasedisabled:false,
			// 跳转传参数
			id: '',
			// 抽屉
			activeName:'first',
			drawer: false,
			size: '1500px',
		    addDialog:false,
		   // 新增项目返显
			addManage:{
			  page:1,
			  size:10,
			  total:0,
			  addManagedata:[],
			},
			//新增项目新增
		   addEntry:{
			  entryName:'',//项目名称
			  erpOrderNo:'',//erp单号
			  specific:'',//需求描述
			  clientId:'',//客户id
			  flag:1
		   },

		   renewEntry:{
			  entryName:'',//项目名称
			  erpOrderNo:'',//erp单号
			  specific:'',//需求描述
			  clientId:''//客户id
		   },
		   renewDialog:false,
		   // 获取其他页数据
		   newManage:{
		     page:1,
		     size:10,
		     total:0,
		     newdata:[],

		   },
		//1.获取全部信息分类
		typeManage:{
		  page:1,
		  size:10,
		  total:0,
		  tableData:[],
		  dropData:[],
		  addDialog:false,//新增弹窗
		  editDialog:false,//编辑弹窗
		  type:'add',
		},
		//2.根据名称获取信息分类
		tel: '',//电话
		className:'',//信息分类
		salesName:'',//销售人员
		searchTime: "",//时间
		giveUp:null,// 是否有效
		giveorValid:"",
		dealStatus:"",		// 是否成交
		// 新增
		addFormInfo:{
			title:'新增客户',
			from:{
			},
			 flag:1,
			Addr:{
				province:[],
				city:[],
				area:[],
			},
		},
		showinforSourceVo:false,
		Dict:{
			putdata:[],
			province:[],
			city:[],
			area:[],
			cityLevelList:['province','city','area',],
			options:[],
			dealStatus:[
				{name:'未成交', value:'0'},
				{name:'成交', value:'1'}
			],
			followUpList: [],
		},

		    // 客户来源
		customerSourceList: [
			{
				name: "客户介绍",
				value: "客户介绍",
			},
			{
				name: "电话营销",
				value: "电话营销",
			},
			{
				name: "独立开发",
				value:"独立开发",
			},
			{
				name: "自动分配",
				value:"自动分配",
			}
		],
			// 所属行业
			industryList: [
			  {
				name: "教育/培训",
				value: "教育/培训",
			  },
			  {
				name: "生活服务",
				value: "生活服务",
			  },
			  {
				name: "IT互联网",
				value: "IT互联网",
			  },
			  {
				name: "制造业",
				value: "制造业",
			  }
			],
			// 客户级别
			customerLevelList: [
			  {
				name: "重要",
				value:"重要",
			  },
			  {
				name: "普通",
				value:"普通",
			  },
			  {
				name: "一般",
				value: "一般",
			  }
			],
			// 客户类型
			typeList: [
			  {
				name: "直接客户",
				value:"直接客户",
			  },
			  {
				name: "中间商",
				value: "中间商",
			  }
			],
			validornotData: [
				{
					name: "有效",
					value: '0',
				},
				{
					name: "无效",
					value: '1',
				},
			],

		// 4.编辑信息分类
		editFormInfo: {
			from:{
				name:'',
				telephone:'',
				qq:'',
				wechatNumber:'',
				corporate:'',
				description:'',
				userId:'',
				id:'',
				listid:'',
				pushdata:[],
			},
		},
		// 转交给销售人员弹窗
		handoverDialog:false,
		flowup:{
			from:{
			  followStatus:'',//跟进状态
			  remindTime:'',//时间
			  followResult:'',//结果
			  followFiles:null,//文件
			  projectId:'',//项目id
			  file:'',
			  id:'',
			  ifFileExist:0,
			  followdisabled:false
			},
			reqType:'add',
			title:"新增客户信息",
		    flowupData:[],
		    record:'',
		    formItem:{},
		    timeDifference:{},
			isErpOrderNo:false,
		},
		// 跟进状态全部表格返显
		 flowupManage:{
			  page:1,
			  size:10,
			  total:0,
			  flowupManagedata:[],
			},
		// 售前技术支持表格
		support:{
		  page:1,
		  size:10,
		  total:0,
		  supportData:[],
		  projectName:'',
		  record:'',
		  formItem:{},
		  supportList:[]
		},
		// 指派跟踪记录弹窗
		assignDialog:false,
		assignData:[],
		// 修改跟踪记录
		modifyreleaseDialog:false,
		showPrise:false,
		// 转交给销售人员
		salesPersonnelfrom:{
			deliverAssign:[],
			changesalesman:''
		},
		// 指派售前人员弹窗
		handoverSalemanfrom:{
			saleman:"",
			handleoverList:[],
			entryName:"",
			description:"",
			userId:""
		},
		// 项目成交记录
		projectTransaction:{
			page:1,
			size:10,
		    total:0,
			tableTwoData:[],
		},
		// 验证
		rules:{
			name: [{ required: true, message: "请输入姓名", trigger: "blur"}],
			tel: [
				// { required: true, message: "请输入正确的联系方式"},
			{pattern:/^1[3456789]\d{9}$/, message: "请输入正确的联系方式",trigger: "blur"}],
			 qqnub: [
			     // { required: true, message: 'QQ号码', trigger: 'change' },
			     { pattern: /^[1-9][0-9]{0,12}$/, message: 'QQ号只可输入5-11位数字', trigger: 'change' },
			     { pattern: /^\d{5,12}$/, message: 'QQ号只可输入5-11位数字', trigger: 'change' }
			],
			weixin: [
				// { required: true, message: "请输入正确的微信号码"},
			   {message: "请输入正确的微信号码",trigger: "blur"},
			],
			inforSourceVo: [{ required: true, message: "请选择客户来源", trigger: "blur"}],
			custLevel: [{ required: true, message: "请选择客户级别", trigger: "blur"}],
			custIndustry: [{ required: true, message: "请选择所属行业", trigger: "blur"}],
			classidStr: [{ required: true, message: "请选择信息分类", trigger: "blur"}],
			custType: [{ required: true, message: "请选择客户类型", trigger: "blur"}],
			custAddr: [{ required: true, message: "请输入客户地址", trigger: "blur"}],
			// company: [{ required: true, message: "请输入公司名称", trigger: "blur"}],

		},
		addrules:{
			entryName: [{ required: true, message: "请输入项目名称", trigger: "blur"}],
			specific: [{ required: true, message: "请输入需求描述", trigger: "blur"}],
		},
		renewrules:{
			entryName: [{ required: true, message: "请输入项目名称", trigger: "blur"}],
			specific: [{ required: true, message: "请输入需求描述", trigger: "blur"}],
		},

		releaserules:{
			followStatus: [{ required: true, message: "请选择跟进状态", trigger: "blur"}],
			//erpOrderNo: [{ required: true, message: "请选择ERP单号", trigger: "blur"}],
			// followFiles: [{ required: true, message: "请上传文件", trigger: "blur"}],
			remindTime: [{ required: true, message: "请选择时间", trigger: "blur"}],
			followResult: [{ required: true, message: "请输入跟进结果", trigger: "blur"}],
		},
		handoverSalemanrules:{
			changesalesman: [{ required: true, message: "请选择销售人员", trigger: "change"}],
		},
		saleEngineerrules:{
			salesman: [{ required: true, message: "请选择销售总监", trigger: "change"}],
		},
		bandonmentrules:{
			reason: [{ required: true, message: "请输入废弃原因", trigger: "change"}],
		},
    };
  },
  // 售前技术支持下拉框设置默认选项
  mounted() {
    if(this.$store.getters.user.dept.name === '财务部'
    ||this.$store.getters.user.dept.name === '财务总监'
    ||this.$store.getters.user.dept.name === '研发部'){
      this.showfp =true;
      this.yxs = true;
    }
    this.allcustomer();
	this.classification()
	this.reqSelectCity(0, 'province');
	// 发布跟进记录下拉列表
	selectvalue().then(function(res){
		var body = res.object || [];
		this.Dict.followUpList = body;
	}.bind(this));
	// 售前技术总监下拉列表
	technicalDirector().then(function(res){
		var technical=res.object||[];
		this.assignData=technical
	}.bind(this));
	// 转交销售人员列表
	deliverList().then(function(res){
		var deliverData=res.object||[]
		 this.salesPersonnelfrom.deliverAssign=deliverData
	}.bind(this));
	this.getSelectInfo()
  },
  methods: {
	// 获取分类下拉列表
	getSelectInfo(){
		var typeM = this.typeManage;
		var params = {
			page:1,
			pageSize:999,
		};
		getAllCategory(params).then((res) => {
			var dropDown = res.object.records || [];
			typeM.dropData = dropDown;
		});
	},
	  // 表格加深颜色样式
	 tableRowClassName({row, rowIndex}) {
		  if (row.followStatus === 3) {
			return 'success-row';
		  }else{
			return '';
		  }
		},
	  // 获取信息分类
	  classification(params){
	  		var params = {
	  		  page:this.newManage.page,
	  		  pageSize:this.newManage.size,
	  		};
	  		getAllCategory(params).then((res) => {
	  		 var newlist = res.object.records || [];
	  		 this.newManage.newdata = newlist;
	  		for(var i=0;i<this.newManage.newdata.length;i++){
	  		this.Dict.putdata.push(this.newManage.newdata[i].name);
	  		this.editFormInfo.from.pushdata.push(this.newManage.newdata[i].name);
	  		}
	  	});
	  },
	  //1.获取全部信息管理
		allcustomer(){
			var typeM = this.typeManage;
			var params = {
				page:typeM.page,
				pageSize:typeM.size,
			};
			searchContent(params).then((res) => {
				var records = res.object.records || [];
				typeM.tableData = records;
				typeM.total = res.object.total;
			});
		},
		handleSizeChange(val) {
			this.typeManage.size = val;
			this.toSearch();
		},
		handleCurrentChange(val) {

			// 当前是多少页
		  this.typeManage.page = val;
			this.toSearch();
		},
    //2.根据名称获取信息分类
    toSearch() {
    var typeM = this.typeManage;
    var param = {
       page:this.typeManage.page,
       pageSize: this.typeManage.size,
       giveUp:this.giveUp,
    };
	  	this.tel && (param.tel = this.tel);
			this.salesName && (param.salesName = this.salesName);
			this.className && (param.className = this.className);
			this.dealStatus && (param.dealStatus = this.dealStatus);
			// 时间
			if (this.searchTime instanceof Array) {
			  param.startTime = parseTime(new Date(this.searchTime[0]));
			  param.endTime = parseTime(new Date(this.searchTime[1]));
			}

      searchContent(param).then((res) => {
        var selectlist = res.object.records || [];
        typeM.tableData = selectlist;
        typeM.total = res.object.total;
      });
    },
    //重置
    resetTable(){
    	this.tel= '';//电话
      this.className='';//信息分类
      this.salesName='';//销售人员
      this.searchTime="";//时间
      this.giveUp= "";// 是否有效
      this.giveorValid="";
      this.dealStatus="";	// 是否成交
    	this.allcustomer()
    },
	   // 新增编辑客户信息
	   newlyAdd(type, e, index, item){
		   if(type === 'edit'){
			    //编辑
				this.addFormInfo.title = '编辑客户信息';
				this.typeManage.addDialog = true;
			    this.addFormInfo.from = Object.assign({}, item);
				// 设置select下拉自动分配则禁用
				if(this.addFormInfo.from.inforSourceVo=='自动分配'){
					this.showinforSourceVo=true
				}else{
					this.showinforSourceVo=false
				}
			    var addrArr = this.addFormInfo.from.custAddrno.split('_');
			    this.$set(this.addFormInfo.from, 'province', addrArr[0]);
			    this.$set(this.addFormInfo.from, 'city', addrArr[1]);
			    this.$set(this.addFormInfo.from, 'area', addrArr[2]);
			   var len = this.Dict.cityLevelList.length;
			   for(var i=0; i<2; i++){
					var cityName = this.Dict.cityLevelList[i+1];
					this.reqSelectCity(addrArr[i], cityName, i+2)
			   }
		   }else{
			   this.addFormInfo.title = '新增客户信息';
			   this.typeManage.addDialog = true;
			   this.addFormInfo.from = {};
		   };
		   this.typeManage.type = type;
		   this.addFormInfo.from.user=this.$store.getters.user.username;
		   // userId
		   this.addFormInfo.from.useridStr=this.$store.getters.user.id;
		},
		// 提交表单
		submitForm(){
			if(this.addFormInfo.flag){
				this.addFormInfo.flag = 0;
				this.$refs.addDataForm.validate((valid) => {
					if (valid) {
						var self = this;
						var params = this.addFormInfo.from;
						params.custAddrno = params.province + '_' + params.city + '_' +params.area;
						if(this.typeManage.type === 'edit'){
							editcustomer(params).then((res) => {
								this.typeManage.addDialog=false
								this.allcustomer();
								setTimeout(function(){
									self.addFormInfo.flag = 1;
								}, 300);
								self.$message({
								  type: "success",
								  message: "编辑成功",
								});
							 });
						}else{
							addcustomer(params).then((res) => {
								this.typeManage.addDialog = false;
								this.allcustomer();
								setTimeout(function(){
									self.addFormInfo.flag = 1;
								}, 300);
								self.$message({
								  type: "success",
								  message: "新增成功",
								});
							 });
						}
					}
				});
			}
		},
		// 地址代码
		reqSelectCity(code, city, type){
			var that = this;
			city = city || 'province';
			var params = {code:code, type:type || 1};
			getAllProvince(params).then((res) => {
				that.$set(that.Dict, city, res.object);

			});
		},
		// 选择省清空市、区
		getSelectCity(code, city, type){
			this.addFormInfo.from.city = '';
			this.addFormInfo.from.area = '';
			this.reqSelectCity(code, city, type)
		},
		// 选择市清空、区
		getSelectArea(code, city, type){
			this.addFormInfo.from.area = '';
			this.reqSelectCity(code, city, type)
		},
		//抽屉内容  setData
		see(e, index, item){
			this.flowup.from.projectId=null;

			this.addEntry.clientId=item.id

			this.drawer=true;
			this.addFormInfo.from = Object.assign({}, item);
			// 置空项目跟踪记录表格数据
			this.flowup.record='';
			this.flowupManage.flowupManagedata = [];
			this.flowupManage.total=0;
			this.alldataShow(item)
			this.changeRead()
			// 置空售前支持项目信息表格
			this.support.record='';
			this.support.supportList = [];
			this.support.supportData=[];
			// 置空项目成交记录表格
			this.projectTransaction.tableTwoData=[];
			this.projectTransaction.total=0
			// 售前技术支持选择项目名称列表
			this.saledropDown(item)
			//项目成交记录
			this.projectTransactionRecord()
		},
		// 已读成功接口
		changeRead(){
			var params = {
			  id:this.addEntry.clientId,
			};
			read(params).then((res) => {
				this.$store.state.settings.Allnotice();
			});
		},
		// 新增项目全部数据返显
		alldataShow(item){
			var params = {
			  page:this.addManage.page,
			  pageSize:this.addManage.size,
			  customerId:this.addEntry.clientId,
			};
			this.addManage.addManagedata = [];
			allData(params).then((res) => {
				if(res.code === 200){
					this.addManage.addManagedata = res.object.records || [];
					this.addManage.total = res.object.total;
				}
				var newArr=this.addManage.addManagedata
				this.flowup.flowupData=newArr;
				this.flowup.from.projectId = newArr[0].id;
				this.followDisplay()
			});
		},
		//获取全部信息管理分页
		addSizeChange(val) {
		// 每页多少条
		this.addManage.size =val ;
		this.alldataShow();
		},
		addCurrentChange(val) {
		// 当前是多少页
		this.addManage.page = val;
		this.alldataShow();
		},
		// 新增项目
		newProject(){
			this.addDialog = true;
			this.addEntry.entryName ='';
			this.addEntry.specific= '';
		},
		upate(){
			if(this.addEntry.flag){
				this.addEntry.flag = 0;
				this.$refs.addData.validate((valid) => {
					  if (valid) {
						 var params = {
							 project_name:this.addEntry.entryName,
							 erpOrderNo:this.addEntry.erpOrderNo,
							 project_remarks:this.addEntry.specific,
							 customerid:this.addEntry.clientId+''
						 };
						var self = this;
						 addPop(params).then((res) => {
							this.addDialog = false;
							this.alldataShow();
							setTimeout(function(){
								self.addEntry.flag = 1;
							}, 300);
							if(res.code === 200){
								self.$message({
								  type: "success",
								  message: "新增成功",
								});
							}
						});
					}
				})
			}
		 },
		//新增项目修改
		renew(e, index, item){
			this.renewDialog = true;
			this.renewEntry.clientId=item.id//客户id
			this.renewEntry.entryName=item.projectName//项目名称
			this.renewEntry.erpOrderNo=item.erpOrderNo//erp
			this.renewEntry.specific=item.projectRemarks//需求描述
		},
		renewUpate(){
			 this.$refs.renewData.validate((valid) => {
				  if (valid) {
				var params = {
					 project_name:this.renewEntry.entryName,
					 erpOrderNo:this.renewEntry.erpOrderNo,
					 project_remarks:this.renewEntry.specific,
					 id:this.renewEntry.clientId
				};
				  var self = this;
					 toUpdate(params).then((res) => {
						this.renewDialog = false;
						this.alldataShow();
						self.$message({
						  type: "success",
						  message: "修改成功",
						});
					});
				}
			})
		},
		// 格式化时间
			toolformatTime(date1) {
			let year = 0;
			let month = 0;
			let day = 0;
			let hour = 0;
			let minute = 0;
			let second = 0;
			year = date1.getFullYear();
			month =
			  date1.getMonth() + 1 < 10
				? "0" + (date1.getMonth() + 1)
				: date1.getMonth() + 1;
			day = date1.getDate() < 10 ? "0" + date1.getDate() : date1.getDate();
			hour = date1.getHours() < 10 ? "0" + date1.getHours() : date1.getHours();
			minute =
			  date1.getMinutes() < 10 ? "0" + date1.getMinutes() : date1.getMinutes();
			second =
			  date1.getSeconds() < 10 ? "0" + date1.getSeconds() : date1.getSeconds();
			return (
			  year +
			  "-" +
			  month +
			  "-" +
			  day +
			  " " +
			  hour +
			  ":" +
			  minute +
			  ":" +
			  second
			);
		},
		// 发布跟进纪录change事件
		towerChange(e){
			if(e!=''){
				for(var item of this.flowup.flowupData){
					if(item.id === e){
						this.flowup.formItem = item
					}
				}
				this.flowup.from.projectId=e;
				this.flowupManage.page=0;
				this.followDisplay()
			}
		},
		// 发布跟进纪录表格返显
		followDisplay(){
			var params = {
			  page:this.flowupManage.page,
			  pageSize:this.flowupManage.size,
			  projectId:this.flowup.from.projectId+'',
			};
			this.flowupManage.flowupManagedata = [];
			followupData(params).then((res) => {
				if(res.code === 200){
					this.flowupManage.flowupManagedata = res.object.records || [];
					this.flowupManage.total = res.object.total;
					this.timeDifc()
				}
			});
		},
	   //计算时间差
	   timeDifc(start,end){
			var startTime, endTime;
			if(this.flowupManage.flowupManagedata!=null){
				var array=this.flowupManage.flowupManagedata
				array.forEach((item,index,array) => {
					startTime=item.addtime
					endTime=item.remindTime
				})
			}
         },
	   // 友好时间提示
		getTimePart(time){
			return friendlyDate(new Date(time).getTime())
		},
		// 发布跟进纪录分页
		flowupSizeChange(val) {
		// 每页多少条
		this.flowupManage.size =val;
		this.followDisplay();
		},
		flowupCurrentChange(val) {
		// 当前是多少页
		this.flowupManage.page = val;
		this.followDisplay();
		},

		// 编辑跟踪记录
		modifyRelease(type, item){
			if(this.flowup.from.projectId){
				this.flowup.reqType = type;
				for(var i=0; i<this.Dict.followUpList.length;i++){
					if(i<3){
						this.Dict.followUpList[i].followdisabled=this.flowup.formItem.dealStatus
					}
				}
				if(type === 'add'){
					this.flowup.title = '新增客户信息';
					var projectId = this.flowup.from.projectId;
					this.flowup.from = {
						projectId:projectId,
						followFiles:null,
						remindTime:'',
						followStatus:'',
						followResult:'',
					};
					this.modifyreleaseDialog=true;
					this.$nextTick(function(){
						// 清空文件
						this.$refs.fileRef.clearFiles()
					});
					this.flowup.isErpOrderNo = false;
				}else{
					this.flowup.title = '编辑客户信息';
					this.modifyreleaseDialog=true;
					this.flowup.from = Object.assign({}, item);
					this.showPrise=true
					this.flowup.from.ifFileExist = 0;
					this.flowup.isErpOrderNo = (this.flowup.from.followStatus === 3);

				}
			}
			else{
				this.$message({
				  type: "error",
				  message: "请选择项目名称",
				});

			}

		},
		emodifyupate(){
			var self = this;
			if(this.flowup.reqType === 'add'){
				this.$refs.fileForm.validate((valid) => {
					if (valid) {
						var params = new FormData();
						 params.append('projectId', this.flowup.from.projectId+'');//项目id
						 this.flowup.from.erpOrderNo && params.append('erpOrderNo', this.flowup.from.erpOrderNo);
						 if(!this.flowup.from.followFiles){
							 delete params.followFiles
						 }else{
							params.append('followFiles',this.flowup.from.followFiles);//状态
						 }
						 params.append('followStatus',this.flowup.from.followStatus);//状态
						 params.append('followResult',this.flowup.from.followResult);//结果
						 params.append('saleId',this.$store.getters.user.id);//当前用户id
						 // 时间
						 this.flowup.from.remindTime = this.toolformatTime(
						   new Date(this.flowup.from.remindTime)
						 );
						 params.append('remindTime', this.flowup.from.remindTime);//时间


						releaseFollowuprecord(params).then((res) => {
							this.modifyreleaseDialog= false;
							this.followDisplay();
							this.alldataShow();
							this.allcustomer();
							self.$message({
							  type: "success",
							  message: "发布跟进记录成功",
							});
						});
					}
				})
			}else{
				var params = new FormData();
				params.append('id', this.flowup.from.id+'');//项目id
				this.flowup.from.erpOrderNo && params.append('erpOrderNo', this.flowup.from.erpOrderNo);
				if(this.flowup.from.ifFileExist===0){
					delete params.followFiles
				}else{
					params.append('followFiles', this.flowup.from.followFiles); //文件.
				}
				params.append('followStatus',this.flowup.from.followStatus);//状态
				params.append('followResult',this.flowup.from.followResult);//结果
				params.append('ifFileExist',this.flowup.from.ifFileExist);//文件状态

				// 时间
				this.flowup.from.remindTime = this.toolformatTime(
				new Date(this.flowup.from.remindTime)
				);
				params.append('remindTime', this.flowup.from.remindTime);//时间

				modifyFollowuprecord(params).then((res) => {
					this.modifyreleaseDialog = false;
					this.followDisplay();
					this.alldataShow();
					this.allcustomer();
					self.$message({
					  type: "success",
					  message: "修改跟进记录成功",
					});
				})
			}
		},
		// 上传文件 file(二进制)
		 handleBeforeUpload(file) {
				if(file!=''){
					this.flowup.from.ifFileExist=1

				}else{
					this.flowup.from.ifFileExist=0

				}
			     this.showPrise=false;
				 file = file.raw || file;
				  var uploadLimit = 2
				  var uploadTypes = ['jpg', 'png', 'jpeg', 'pdf','doc','xlsx','xls']
				  var isRightSize = (file.size || 0) / 1024 / 1024 < uploadLimit
				  if(file.type === 'image/jpeg' || file.type === 'image/png' ||
				   file.type === 'image/jpg'||file.type === 'application/pdf'||file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'||file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'||file.type === 'application/vnd.ms-excel'){
					  this.flowup.from.followFiles = file;
					  this.$refs.fileForm.validate();
				  }else{
					  this.$refs.fileRef.clearFiles();
					  if(!isRightSize){
						  this.$message.error('文件大小超过 ' + uploadLimit + 'MB')
					  }else{
						this.$message.warning({message: '请上传后缀名为jpg、png、pdf、jpeg、doc、xlsx、xls、的附件'});
					  };return false
				  };
		    },
			removeFileCallback(){
				this.flowup.from.followFiles = '';
			},

			// 删除跟踪记录
			deleteRelease(item) {
				var id = item.id;
			  this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
			    confirmButtonText: "确定",
			    cancelButtonText: "取消",
			    type: "warning",
			  }).then(() => {
			    deleteFollowuprecord({id:id}).then(
			      (res) => {
			        this.$message({
			          message: "删除成功",
			          type: "success",
			        });
			       this.followDisplay();
				   this.alldataShow();
				   this.allcustomer()
			      },
			      () => {
			        this.$message.error("删除失败");
			      }
			    );
			  });
			},
			// 选择售前支持项目名称
			supportChange(e){
				this.support.record =e;
				var params = {
				  page:this.support.page,
				  pageSize:this.support.size,
				  projectName:e
				};
				getAllsupport(params).then((res) => {
					this.support.supportData=res.object.records|| []
				    this.support.total=res.object.total
				});
			},

			// 售前技术支持选择项目名称列表
			saledropDown(item){
				var params = {
				  page:this.addManage.page,
				  pageSize:this.addManage.size,
				  customerId:this.addEntry.clientId,
				};
				allData(params).then((res) => {
					var records = res.object.records;
					this.support.supportList=records;
					this.handoverSalemanfrom.handleoverList = records
					this.supportChange(records[0].projectName)
				});
			},
			// 转交销售人员弹窗
			handOver(){
				this.handoverDialog=true
			},
			deliverUpate(){
				this.$refs.handpeopleRef.validate((valid) => {
					if (valid) {

						var params = {
						  id:this.addEntry.clientId,
						  newUserId:this.salesPersonnelfrom.changesalesman,
						};
						var self = this;
						changeMan(params).then((res) => {
							this.handoverDialog = false;
							self.$message({
							  type: "success",
							  message: "转交销售人员成功",
							});
							  window.location.reload();
						},
						  () => {
							this.$message.error("转交销售人员失败");
						  }
						);
					}
				})
		},
		//指派售前人员弹窗
		saleAssign(){
			this.assignDialog = true;
		},
		salesmanUpate(){
			this.$refs.saleEngineerRef.validate((valid) => {
				 if (valid) {
			this.handoverSalemanfrom.userId=this.$store.getters.user.id;
			var params = {
				userId:this.handoverSalemanfrom.userId,
				leaderId:this.handoverSalemanfrom.salesman,
				projectId:this.handoverSalemanfrom.entryName,
				description:this.handoverSalemanfrom.description,
			};
			var self = this;
			assignPresales(params).then((res) => {
				this.assignDialog = false;
				self.$message({
				  type: "success",
				  message: "指派售前人员成功",
				},
				() => {
				  this.$message.error("指派售前人员失败");
				}
				);
			});
			}
		 })
		},
		// 项目成交记录接口
		projectTransactionRecord(){
			var params = {
				page:this.projectTransaction.page,
				pageSize:this.projectTransaction.size,
				customerId:this.addEntry.clientId
			};
			findWhereDeal(params).then((res) => {
				this.projectTransaction.tableTwoData=res.object.records
				this.projectTransaction.total=res.object.total
			});
		},
		//获取全部信息管理分页
		projectTransactionChange(val) {
		// 每页多少条
		  this.projectTransaction.size =val ;
		  this.projectTransactionRecord();
		},
		projectTransactionCurrentChange(val) {
		// 当前是多少页
		  this.projectTransaction.page = val;
		  this.projectTransactionRecord();
		},
		// 废弃弹窗
		bandonment(){
			this.bandonmentDialog = true;
		},
		bandonmentUpate(){
			this.$refs.bandonmentData.validate((valid) => {
				if (valid) {
					var params = {
						id:this.addEntry.clientId,
						giveUpResult:this.bandonmentEntry.reason,
					};
					var self = this;
					bandonmentRequest(params).then((res) => {
						this.bandonmentDialog = false;
             this.$router.go(0);
						self.$message({
						  type: "success",
						  message: "废弃成功",
						},
						() => {
						  this.$message.error("废弃失败");
						}
					);
				});
			}
		 })
	   },
	   // 默认勾选
	   singleElection(row) {
		  this.templateSelection = row.id
		  this.checkList = this.addManage.addManagedata.filter((item) => item.id === row.id)
		  this.flowup.from.projectId =row.id;
		  this.followDisplay()
	   },
	   // 文件下载与图片预览
		upateFile(val){
		   if(val){
			   window.open('http://oa.gemho.cn:8004/project_follow_file/'+val);
		   }else{
			   this.$notify({
				title: '未找到文件或图片!',
				type: 'error',
				duration: 3500
			   });
		   }
		},

		reqExportExcel(){
			var param = {
				tel:this.tel,
				className:this.className,
				salesName:this.salesName,
				dealStatus:this.dealStatus,
				giveUp:this.giveUp,
				page:this.typeManage.page,
				pageSize:this.typeManage.size,
			};

			 // 时间
			 if (this.searchTime instanceof Array) {
			   param.startTime = parseTime(new Date(this.searchTime[0]));
			   param.endTime = parseTime(new Date(this.searchTime[1]));
			 }


			exportExcel(param).then((res) => {
				if(res.code === 200){
					window.open('oa.gemho.cn:8004/customer_follow_form/'+res.object);
				}else{
					this.$message.error("导出异常!");
				};

				/* var downloadFile = function(obj, name, suffix){
					var url = window.URL.createObjectURL(new Blob([obj]));
					var link = document.createElement('a');
					link.style.display = 'none';
					link.href = url;
					var fileName = name + '.' + suffix;
					link.setAttribute('download', fileName);
					document.body.appendChild(link);
					link.click();
					document.body.removeChild(link);
				};
				var name = '客户信息管理' + new Date().getTime();
				downloadFile(res, name, 'xlsx') */
			});
		},

		// 重新分配
		restartConfig(row){

			this.addEntry.clientId = row.id;
			/* var params = {
			  id:this.addEntry.clientId,
			  newUserId:this.salesPersonnelfrom.changesalesman,
			}; */


			this.handoverDialog=true
		},

		isErpOnchange(e){
			this.flowup.isErpOrderNo = (e === 3)


		},
  },
};
</script>
<style lang="scss" scoped>
	.search-wrapper {
	  display: flex;
	  margin: 20px 0;
	}
	.tools-wrapper {
	  display: flex;
	  margin: 20px 0;
	}
	.upload-file-wrapper {
	  display: flex;
	  .file-wrapper {
		width: 240px;
		height: 100px;
		background: aliceblue;
	  }
	}
	.datamanage-wrapper {
		width: 100%;
		height:100%;
	  padding: 10px;
	  border-radius: 5px;
		background-color: #f5f6fb;

	  .tool-wrapper {
		padding: 10px;
		border-radius: 5px;
		margin: 10px 10px;
		background: #fff;
	  }
	  .search-wrapper {
		padding: 10px;
		border-radius: 5px;
		margin: 10px 10px;
		background: #fff;
	  }
	  .table-wrapper {
		padding: 10px;
		border-radius: 5px;
		margin: 10px 10px;
		background: #fff;
	  }
	}
	.contact{
		width: 100%;
		display: flex;
		justify-content: space-around;
	}
	::v-deep input::-webkit-outer-spin-button,
	::v-deep input::-webkit-inner-spin-button {
	-webkit-appearance: none !important;
	}
	::v-deep input[type=‘number’] {
	-moz-appearance: textfield !important;
	}
	// 抽屉内容
	.box{
		margin: 0px;
		padding: 0px;
		overflow-y: hidden;
		width:100%;
		height: 100%;
		display: flex;
		flex-direction: column;
	}
	.box_top{
		width: 100%;
		height: 13%;
		border: 1px solid rgba(121, 121, 121, 1);

	}
	.top-content{
		width: 76%;
		height: 50%;
		display: flex;
		justify-content: space-around;
		align-items: center;
	}

	.top-content1{
		width: 77%;
		height: 50%;
		display: flex;
		justify-content: space-around;
		align-items: center;
	}
	span{
		margin-left: 15px;
	}
	.box_bottom{
		width: 100%;
		height: 87%;
		display: flex;
	}
	.box_left{
		width: 50%;
		height: 100%;
		border: 1px solid rgba(121, 121, 121, 1);
		}
	.box_right{
		width: 50%;
		height: 100%;
		 border: 1px solid rgba(121, 121, 121, 1);
		}
	.content-box{
		width: 100%;
		display: flex;
		flex-direction: column;
	}
	.content-message{
		width: 100%;
		display: flex;
		flex-direction: column;
	}
	.content-text{
		width: 95%;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		font-family: 'Arial Normal', 'Arial';
		font-weight: bold;
		font-size: 18px;
		margin:30px 0px 20px 30px

	}
	.bandonment-text{
		width: 92%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-family: 'Arial Normal', 'Arial';
		font-weight: bold;
		font-size: 18px;
		margin:30px 30px 30px 30px;
	}
	.content-title{
		font-family: 'Arial Normal', 'Arial';
		font-weight: bold;
		font-size: 18px;
	}
	.content-top{
		width: 100%;
		display: flex;
		flex-direction: column;
		border-bottom:1px solid rgba(121, 121, 121, 1);
	}
	.content-center{
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: start;
		align-items: center;

	}
	.content-center div{
		margin: 20px 0px 20px 40px;
	}
	.content-list{
		width: 100%;
		display: flex;
		flex-direction: column;

	}
	.content-reason{
		width:100%;
		display: flex;
		margin:20px 0px 20px 30px;
	}

	.content-reason span{
		width:79%;
		word-wrap:break-word
	}
	.title{
		width:88%;
		display: flex;
		justify-content: space-between;
		align-items: center;
	    margin:30px 0px 20px 30px

	}
	.right-title{
		display: flex;
		justify-content: flex-start;
		align-items: center;
		font-family: 'Arial Normal', 'Arial';
		font-weight: bold;
		font-size: 18px;
		margin: 30px 0px 20px 30px;

	}
	.right_content{
		width: 100%;
		display: flex;
		justify-content: space-around;
		align-items: center;
	    border-bottom:1px solid rgba(121, 121, 121, 1);

	}
	.upload-file-wrapper {
	  display: flex;
	  .file-wrapper {
	    width: 240px;
	    height: 100px;
	    background: aliceblue;
	  }
	}
</style>
<style>
	  .el-table .warning-row {
		background: oldlace;
	  }

	  .el-table .success-row {
		background: #f0f9eb;
	  }
</style>
