<template>
	<div class="all boxMinHeight">
		<PageHead phName="员工绩效详情"></PageHead>
		<div class="flex-box-ce" style="position: absolute;right: 20px;top: 20px;z-index: 2;">
			<!--      <div style="padding-right: 10px;">
        <el-checkbox v-model="isShowOneselfScore">只看自己评分内容</el-checkbox>
      </div> -->
			<el-select v-model="headvalue" style="width: 250px;" placeholder="请选择" v-if="!isDisabled">
				<el-option v-for="item in headoptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
			</el-select>
			<div v-else class="fontColorB font-flex-word" style="width: 250px;">{{ packageName }}</div>
		</div>

		<header v-loading="staffLoad">
			<div class="flex-box-ce head">
				<div class="flex-box-ce head2User flex-1">
					<userImage class="fl" :id="remployee.id" :user_name="remployee.name" :img_url="remployee.img_url" width="50px" height="50px"></userImage>
					<div class="headTname">
						<div style="">{{ remployee.name }}</div>
						<span v-for="(item, index) in remployee.deptList" :key="index" v-if="remployee.deptList.length > 0">
							<span>{{ item.name }}</span>
							<span v-if="remployee.deptList.length - index > 1">,</span>
						</span>
					</div>
					<img v-if="has_finish" src="@/assets/image/guidang.png" class="guidang" />
				</div>
				<template v-if="!gradeBegin">
					<div class="button-width" v-if="!has_finish">
						<!-- 撤销上一次操作 -->
						<template v-if="revocationShow">
							<el-button @click="isShowCx = true" type="primary">重新评分</el-button>
						</template>

						<!-- 目标制定节点 -->
						<template v-if="isShowTargetBtn">
							<el-button @click="openFormulate()" type="primary">制定目标</el-button>
							<el-button @click="submit()" type="primary">提交</el-button>
						</template>

						<!-- 目标确认 -->
						<template v-if="isShowConfirmBtn">
							<el-button type="primary" @click="gradeOk">同意</el-button>
							<el-button class="red" type="danger" plain @click="gradeTurn" style="background-color: #fff;">驳回</el-button>
							<el-button v-if="isUpdateIndex" @click="openFormulate()">修改目标</el-button>
						</template>

						<!-- 录入结果值 -->
						<el-button v-if="resultButShow" @click="openResult()" type="primary">录入结果值</el-button>
						<!-- 审批 -->
						<template v-if="examineButShow">
							<el-button type="primary" @click="gradeOk">同意</el-button>
							<el-button class="red" type="danger" plain v-if="isAction" @click="gradeTurn" style="background-color: #fff;">驳回</el-button>
						</template>
						<!-- 评分 -->
						<el-button v-if="gradeButShow" type="primary" @click="gradeClick">评分</el-button>
						<el-button v-if="recordsManagement" @click="isTrack = true">管理记录</el-button>
						<el-button v-if="actionButShow" @click="isPlan = true">执行计划</el-button>
						<el-button v-if="feedbackBut" @click="communication = true">沟通反馈
							<el-tooltip class="item" effect="dark" content="在整个考核过程中，若有需要反馈的内容可在【沟通反馈】处留言，支持发钉钉通知" placement="top-start">
								<i class="fontColorF el-icon-warning"></i>
							</el-tooltip>
						</el-button>
						<!-- 主次管理员，被考核人上级 -->
						<template v-if="$getRole(1) || isSuperior">
							<el-dropdown style="margin-left:10px;" @command="handleCommand">
								<el-button>管理</el-button>
								<el-dropdown-menu slot="dropdown">
									<el-dropdown-item v-for="(item, index) in dropdownMenu" :key="index" :command="item.key" :divided="item.bordok" v-if="item.isShow">
										{{ item.name }}
									</el-dropdown-item>
								</el-dropdown-menu>
							</el-dropdown>
						</template>
					</div>
				</template>
			</div>
			<!-- 流程 -->
			<div class="flex-box-ce flex-d-wrap">
				<div
					v-for="(item, index) in flow"
					:key="index"
					:class="[item.status == 1 ? 'flow-item-color' : '', index == 0 ? 'flow-item-start' : 'flow-item']"
					class="flex-box-ce"
				>
					<el-tooltip effect="dark" :content="item.code == 'execution' ? execution : item.remarks" placement="top">
						<span class="flow-box">
							<span>{{ index + 1 }}.{{ item.remark }}</span>
							<span v-if="item.code == 'execution'">
								<i class="el-icon-warning-outline"></i>
								:
							</span>
							<template v-if="item.target.length > 0">
								<span v-for="(item2, index2) in item.target" :key="index2">
									{{ item2.employee_name }}
									<span v-if="item.target.length - index2 > 1">,</span>
								</span>
							</template>
						</span>
					</el-tooltip>
					<i class="el-icon-success blue" v-if="item.status == 2" style="margin-right:10px;"></i>
					<div @click.stop="processDet(item)" style="width: 20px;" class="dian" v-if="item.target.length > 0 && !gradeBegin">
						<svg-icon icon-class="detailsPonit" class="detailsPonit" />
					</div>
					<img src="@/assets/image/jt.png" class="flow-img" v-if="index != flow.length - 1 || flow[flow.length - 1].status == 2" />
				</div>

				<template v-if="flow.length > 0">
					<div class="flow-item flex-box-ce flex-center-center" v-if="flow[flow.length - 1].status == 2">
						<span class="flex-1">{{ flow.length + 1 }}.结束</span>
						<i class="el-icon-success blue" style="margin-right:10px;"></i>
					</div>
				</template>
			</div>
			<!-- 考核结果 -->
			<div class="flex-box-end flex-v-ce" style="margin-top: 20px;">
				<template v-if="dimension.length > 0">
					<div class="flex-box-ce result" v-if="dimension[0].final_point" style="margin-right: 20px;">
						<span style="padding-right: 20px;">考核结果分数：{{ dimension[0].final_point }}分</span>
						<span>等级：{{ dimension[0].final_level }}</span>
					</div>
				</template>
				<el-tooltip placement="bottom">
					<div class="popover-box" slot="content">
						<div class="popover-title">开启显示更多可浏览全部考核内容</div>
						<div class="popover-content">点击右边箭头和滑动下方滚动条都可以查看更多内容</div>
					</div>
					<el-switch v-model="isShowOneselfScore" active-text="显示更多"></el-switch>
				</el-tooltip>
			</div>

			<!-- 表格 -->
			<div class="dimensionCla" v-loading="tableLoad">
				<!-- 点击滚动 -->
				<TableBox
					:tableData="dimension"
					:isShowYd="isShowOneselfScore"
					:headerCellStyle="{ background: '#ECF5FF', textAlign: 'center' }"
					:objectSpanMethod="objectSpanMethod"
				>
					<el-table-column prop="theDimension" width="80" label="维度" align="center">
						<template slot-scope="scope">
							<span style="width: 13px;display: inline-block;">{{ scope.row.theDimension }}</span>
							<template v-if="calc_dimension && (scope.row.type == 1 || scope.row.type == 2)">
								<div v-if="!scope.row.toScore">({{ scope.row.dimension_weight }}%)</div>
							</template>
						</template>
					</el-table-column>
					<el-table-column prop="name" label="名称" min-width="220">
						<template slot-scope="scope">
							<template v-if="Number(scope.row.weight) > 0">
								<PreBox :value="scope.row.name + '(权重：' + scope.row.weight + '%)'"></PreBox>
							</template>
							<PreBox v-else :value="scope.row.name"></PreBox>
						</template>
					</el-table-column>
					<template v-if="isShowOneselfScore">
						<el-table-column prop="type" width="100" label="指标类型">
							<template slot-scope="scope">
								<span v-if="scope.row.type == 1">量化指标</span>
								<span v-if="scope.row.type == 2">非量化指标</span>
								<span v-if="scope.row.type == 3">额外加分项</span>
								<span v-if="scope.row.type == 4">额外扣分项</span>
							</template>
						</el-table-column>
					</template>

					<el-table-column prop="target" label="目标值" align="left" min-width="150" v-if="getTableItem('target')">
						  <template slot-scope="scope">
							<div v-if="scope.row.target != '-' && scope.row.target != undefined&&scope.row.target!='0'">
							  目标值：
							 <span>{{ scope.row.target + '' + scope.row.unit }}</span>
							</div>
							<span v-else>-</span>
							<div v-if="scope.row.result !== null&&scope.row.result !== ''&&scope.row.result !== undefined" class="yellow">
							  <template v-if="scope.row.type==1">
								  结果值： <span>{{ scope.row.result + '' + scope.row.unit }}</span>
							  </template>
							  <template v-if="scope.row.result_file">
<!-- 								<div v-if="scope.row.result_file.images.length>0">
								  <div style="margin-bottom: 3px;cursor: pointer;" class="blue" v-for="(item, index) in scope.row.result_file.images" :key="index" @click="onFilePreView(item)">{{ item.name }}</div>
								</div> -->
								<div v-if="scope.row.result_file.append.length>0">
								  <div style="margin-bottom: 3px;cursor: pointer;" class="blue" v-for="(item, index) in scope.row.result_file.append" :key="index" @click="openImg(item)">{{ item.fileName }}</div>
								</div>
							  </template>
							</div>
							<span v-else>-</span>
						  </template>
					</el-table-column>

					<template v-if="isShowOneselfScore">
						<el-table-column prop="point_limit" label="加扣分上限" align="center" width="100" v-if="getTableItem('point_limit')">
							<template slot-scope="scope">
								<span>{{scope.row.point_limit}}</span>
							</template>
						</el-table-column>
					</template>

					<el-table-column prop="per_remark" label="考核标准" min-width="200" v-if="getTableItem('per_remark')">
						<template slot-scope="scope">
							<PreBox :value="scope.row.per_remark"></PreBox>
						</template>
					</el-table-column>

					<el-table-column prop="remark" label="备注" min-width="200" v-if="isShowOneselfScore">
						<template slot-scope="scope">
							<PreBox :value="scope.row.remark"></PreBox>
						</template>
					</el-table-column>

					<el-table-column prop="schedule" label="执行计划" align="center" min-width="200" v-if="getTableItem('schedule')">
						<template slot-scope="scope">
							<div class="flex-box-ce" v-if="scope.row.schedule && scope.row.schedule.length > 0">
								<el-button type="text" class="flex-1" @click="openPlan(scope.row.planIndex)">({{ scope.row.schedule.length }}) 条执行计划</el-button>
							</div>
							<span v-else>-</span>
						</template>
					</el-table-column>

					<el-table-column prop="mamage_record" label="跟踪管理记录" align="center" min-width="200" v-if="getTableItem('mamage_record')">
						<template slot-scope="scope">
							<div class="flex-box-ce" v-if="scope.row.mamage_record && scope.row.mamage_record.length > 0">
								<el-button type="text" class="flex-1" @click="openTrack(scope.row.planIndex)">({{ scope.row.mamage_record.length }}) 条管理记录</el-button>
							</div>
							<span v-else>-</span>
						</template>
					</el-table-column>

					<el-table-column v-for="(item, index) in lingScore_infos" :key="index" min-width="200" v-if="(item.poiSco || item.poicom) && isShowOneself(item)">
						<template slot="header" slot-scope="scope">
							<el-tooltip effect="dark" :content="item.title" placement="top">
								<span>
									<div class="font-flex-word">{{ item.title }}</div>
								</span>
							</el-tooltip>
						</template>
						<el-table-column prop="title" min-width="100" v-if="item.poiSco">
							<template slot="header" slot-scope="scope">
								<span>评分</span>
							</template>
							<template slot-scope="scope">
								<div v-for="(arr, att) in scope.row.score_infos" :key="att">
									<div v-if="arr.newKey == item.newKey">
										<span v-if="arr.employee_id == item.employee_id">
											{{ initData(arr.point) }}
											<span class="blue">{{ arr.level }}</span>
										</span>
										<span v-else>-</span>
									</div>
								</div>
								<span v-if="scope.row.score_infos ? scope.row.score_infos.length == 0 : ''">-</span>
								<!-- 总分分数 -->
								<span v-if="scope.row.toScore">{{ item.totalScore }}</span>
							</template>
						</el-table-column>
						<el-table-column prop="title" min-width="100" v-if="item.poicom">
							<template slot="header" slot-scope="scope">
								<span>说明</span>
							</template>
							<template slot-scope="scope">
								<div v-for="(arr, att) in scope.row.score_infos" :key="att">
									<div v-if="arr.newKey == item.newKey">
										<span v-if="arr.employee_id == item.employee_id"><PreBox :value="initData(arr.remark)"></PreBox></span>
										<span v-else>-</span>
									</div>
								</div>
								<span v-if="scope.row.score_infos ? scope.row.score_infos.length == 0 : ''">-</span>
								<span v-if="scope.row.toScore"><PreBox :value="item.comment"></PreBox></span>
							</template>
						</el-table-column>
					</el-table-column>
					<!-- 输入框 -->
					<template v-if="gradeBegin">
						<!-- 评分输入 -->
						<el-table-column min-width="150" fixed="right">
							<template slot="header" slot-scope="scope">
								<div>{{ scoreTab.title }}</div>
							</template>
							<template slot-scope="scope">
								<div v-if="thecurrentFlow == 'score_supervisor'">
									<el-input
										v-if="ruleScore == 1 && !scope.row.totalScore"
										:rows="1"
										@blur="sgradeBlur(scope.$index)"
										@input="
											[
												sgradeInp(scope.$index, scope.row),
												(scope.row.score_grade = scope.row.score_grade.match(/\d+(\.\d{0,2})?/) ? scope.row.score_grade.match(/\d+(\.\d{0,2})?/)[0] : '')
											]
										"
										v-model="scope.row.score_grade"
										placeholder="请输入"
									></el-input>
									<span v-else-if="ruleScore == 1 && scope.row.totalScore">{{ tabTotaScore }}</span>
									<el-input
										v-else-if="ruleScore == 2 && scope.row.totalScore"
										:rows="1"
										@input="
											[
												sgradeInp(scope.$index, scope.row),
												(scope.row.score_grade = scope.row.score_grade.match(/\d+(\.\d{0,2})?/) ? scope.row.score_grade.match(/\d+(\.\d{0,2})?/)[0] : '')
											]
										"
										v-model="scope.row.score_grade"
										placeholder="请输入"
									></el-input>
									<span v-else>-</span>
								</div>
								<div v-else>
									<span v-if="scope.row.totalScore">{{ tabTotaScore }}</span>
									<el-input
										v-else
										:rows="1"
										@blur="sgradeBlur(scope.$index)"
										@input="
											[
												sgradeInp(scope.$index, scope.row),
												(scope.row.score_grade = scope.row.score_grade.match(/\d+(\.\d{0,2})?/) ? scope.row.score_grade.match(/\d+(\.\d{0,2})?/)[0] : '')
											]
										"
										v-model="scope.row.score_grade"
										placeholder="请输入"
									></el-input>
								</div>
							</template>
						</el-table-column>
						<!-- 说明 -->
						<el-table-column min-width="150" fixed="right">
							<template slot="header" slot-scope="scope">
								<div>{{ scoreTab.explain }}</div>
							</template>
							<template slot-scope="scope">
								<div style="cursor: pointer;">
									<!-- 指标评分说明 -->
									<template v-if="ruleScore == 1 && !scope.row.totalScore">
										<div @click="showPf(scope.$index, 1)">
											<PreBox :value="scope.row.score_remark" v-if="scope.row.score_remark"></PreBox>
											<div v-else class="shuru">请输入</div>
										</div>
									</template>
									<!-- 总分说明 -->
									<template v-if="ruleScore == 2 && scope.row.totalScore">
										<div @click="showPf(scope.$index, 2)">
											<PreBox :value="scope.row.total_score_comment" v-if="scope.row.total_score_comment"></PreBox>
											<div v-else class="shuru">请输入</div>
										</div>
									</template>
								</div>
							</template>
						</el-table-column>
					</template>
				</TableBox>
			</div>
			<Record :record="record"></Record>
		</header>
		<footer class="footer flex-box-end" v-if="gradeBegin">
			<el-button @click="cancel">取消</el-button>
			<el-button class="primaryBtn" @click="save(0)">暂存</el-button>
			<el-button type="primary" @click="save(1)">提交评分</el-button>
		</footer>
		<!-- 上一个 下一个 -->
		<div class="upDown-box" v-if="isDisabled && !gradeBegin">
			<div class="flex-box-ce flex-center-center fontColorB" style="height: 60px;">
				<div class="flex-1 yellow" v-if="!up.employeeID" style="text-align: center;border-right: 1px solid #f1f1f1;">已无待办</div>
				<div class="flex-1 flex-box-ce flex-center-center up-item" v-else style="border-right: 1px solid #f1f1f1;" @click="qieh(1)">
					<userImage :user_name="up.name" :img_url="up.img_url" width="40px" height="40px" fontSize="12"></userImage>
					<div class="upName font-flex-word">{{ up.name }}</div>
					<div>上一个</div>
				</div>
				<div class="flex-1 yellow" v-if="!down.employeeID" style="text-align: center;">已无待办</div>
				<div class="flex-1 flex-box-ce flex-center-center up-item" v-else @click="qieh(2)">
					<div>下一个</div>
					<div class="upName font-flex-word">{{ down.name }}</div>
					<userImage :user_name="down.name" :img_url="down.img_url" width="40px" height="40px" fontSize="12"></userImage>
				</div>
			</div>
		</div>

		<!-- 流程详情 -->
		<BrawerBox :drawerTitle="processDel.remarkDel + proNum" :footNo="false" :showDrawer.sync="isChecks">
			<template slot="main">
				<div class="processSty">
					<div v-for="(item, index) in processDel.target" :key="index" class="flex-box flex-d-center proListSty">
						<div style="width:230px;" class="flex-box flex-d-center flex-h-ce">
							<div>
								<userImage class="fl" :id="item.employee_id" :user_name="item.employee_name" width="30px" height="30px" fontSize="12"></userImage>
								<span class="proName">{{ item.employee_name }}</span>
							</div>
							<el-tag v-if="processDel.status == 0" size="mini" type="warning" color="#ffe7d3" style="color:#ff8d00;">流程未到</el-tag>
							<!-- 针对任一人处理了，其他人显示无需处理 -->
							<template v-else-if="item.status == 1">
								<template v-if="processDel.multi_executor == 2 && getStrus()">
									<el-tag size="mini">无需处理</el-tag>
								</template>
								<template v-else>
									<el-tag size="mini">处理中</el-tag>
								</template>
							</template>
							<el-tag v-else-if="item.status == 2" size="mini" type="success">已处理</el-tag>
						</div>

						<!-- 主子管理员 并且当前节点里包括登录者-->
						<template v-if="$getRole(1) || item.employee_id == userInfo.id">
							<template v-if="processDel.code == 'score_supervisor' || processDel.code == 'special_scorer'">
								<!-- 指定评分人节点 -->
								<template v-if="processDel.code == 'score_supervisor'">
									<el-button v-if="transferBut && item.status == 1 && (processDel.transfer || $getRole(1))" class="proButt" @click="careOf(item)">转交</el-button>
								</template>
								<!-- 特定指标指定评分人，因为默认是可以转交的，所有没有 transfer 字段 -->
								<template v-else>
									<el-button v-if="transferBut && item.status == 1" class="proButt" @click="careOf(item)">转交</el-button>
								</template>
							</template>
							<template v-else-if="processDel.code == 'review' || processDel.code == 'confirm'">
								<el-button
									v-if="transferBut && item.status == 1 && (processDel.action.indexOf('transfer') >= 0 || $getRole(1))"
									class="proButt"
									@click="careOf(item)"
								>
									转交
								</el-button>
							</template>
							<template v-else>
								<el-button v-if="transferBut && item.status == 1" class="proButt" @click="careOf(item)">转交</el-button>
							</template>
						</template>
					</div>
				</div>
			</template>
		</BrawerBox>
		<!-- 审批同意 -->
		<el-dialog title="意见说明" :visible.sync="examineConsent" width="500px" :close-on-click-modal="false">
			<el-input type="textarea" v-model="tDownList.comment" rows="4" placeholder="请输入意见说明（选填）"></el-input>
			<span slot="footer" class="dialog-footer">
				<el-button @click="tDlose(1)">取 消</el-button>
				<el-button type="primary" @click="tDownOk(1)">确 定</el-button>
			</span>
		</el-dialog>
		<!--驳回评分 -->
		<BrawerBox drawerTitle="驳回评分" :showDrawer.sync="turnDown">
			<template slot="main">
				<el-form label-position="top" label-width="80px" :rules="rFlowRules" :model="tDownList" ref="tDownList" class="elFrom-margin">
					<el-form-item label="重置到" prop="node_id">
						<el-select v-model="tDownList.node_id" clearable placeholder="请选择阶段" style="width:100%;">
							<el-option v-for="item in rFlowArrive" :key="item.value" :label="item.label" :value="item.value"></el-option>
						</el-select>
						<el-select v-if="rUsers.length > 0" multiple v-model="tDownList.employee_id" clearable placeholder="请选择重置人员" style="width:100%;margin-top: 10px;">
							<el-option v-for="item in rUsers" :key="item.value" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="驳回说明" :required="true">
						<el-input type="textarea" rows="7" placeholder="请输入驳回意见（必填）" v-model="tDownList.comment"></el-input>
					</el-form-item>
				</el-form>
			</template>
			<template slot="footer">
				<el-button plain size="" @click="tDlose(0)">取消</el-button>
				<el-button type="primary" @click="tDownOk(0, 'tDownList')">确认</el-button>
			</template>
		</BrawerBox>
		<!-- 重置流程 -->
		<BrawerBox drawerTitle="重置流程" :showDrawer.sync="resetFlow">
			<template slot="main">
				<el-form label-position="top" :rules="rFlowRules" :model="rFlowList" ref="rFlowList" label-width="80px" class="elFrom-margin">
					<el-form-item label="操作">
						<el-radio-group v-model="rFlowList.type">
							<el-radio :label="1">把流程重置到指定节点</el-radio>
							<el-radio :label="2">读取最新的考核模板并重置流程</el-radio>
						</el-radio-group>
					</el-form-item>
					<div v-if="rFlowList.type == 2" style="color: #666;font-size: 12px;position: relative;top: -20px;" class="red">确认后流程将重新开始，回到最开始的节点</div>
					<el-form-item label="指标处理" v-if="rFlowList.type == 2">
						<el-radio-group v-model="rFlowList.overwrite_mode">
							<el-radio :label="2">保留已制定指标</el-radio>
							<el-radio :label="1">重置指标</el-radio>
						</el-radio-group>
					</el-form-item>
					<el-form-item label="指定节点" prop="node_id" v-if="rFlowList.type == 1">
						<el-select v-model="rFlowList.node_id" clearable placeholder="请选择阶段" style="width:100%;">
							<el-option v-for="item in rFlowArrive" :key="item.value" :label="item.label" :value="item.value"></el-option>
						</el-select>
						<el-select v-if="rUsers.length > 0" multiple v-model="rFlowList.employee_id" clearable placeholder="请选择重置人员" style="width:100%;margin-top: 10px;">
							<el-option v-for="item in rUsers" :key="item.value" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item label="说明" prop="comment">
						<el-input type="textarea" rows="6" placeholder="请输入说明（必填）" v-model="rFlowList.comment" maxlength="200" show-word-limit></el-input>
					</el-form-item>
				</el-form>
			</template>
			<template slot="footer">
				<el-button plain @click="resetFlow = false">取消</el-button>
				<el-button type="primary" @click="rFlowOk('rFlowList')">确认</el-button>
			</template>
		</BrawerBox>
		<!-- 跟踪管理 -->
		<TrackManagement
			:showDrawer.sync="isTrack"
			:isCz="!isCzData"
			:recordMemberIds="recordMemberIds"
			:id="employeeID"
			:apList="apList"
			:assessId="employID"
			@confirm="employeeDet"
			:planIndex="planIndex"
		></TrackManagement>
		<!-- 执行计划 -->
		<ActionPlan :showDrawer.sync="isPlan" :isCz="!isCzData" :id="employeeID" :apList="apList" :assessId="employID" @confirm="employeeDet" :planIndex="planIndex"></ActionPlan>
		<!-- 沟通反馈 -->
		<BrawerBox drawerTitle="沟通反馈" :showDrawer.sync="communication">
			<template slot="main">
				<el-input type="textarea" v-model="communicationVal" rows="10" placeholder="请输入反馈内容（必填）" maxlength="200" show-word-limit></el-input>
				<div style="height: 20px;"></div>
				<el-checkbox v-model="ding_msg" :true-label="1" :false-label="0">发送钉钉通知</el-checkbox>
				<div class="aite" @click="selectUser = true">@</div>
				<el-tag style="margin: 0 5px;" v-for="(tag, index) in tags" :key="tag.id" closable @close="handleClose(tag, index)">{{ tag.name }}</el-tag>
			</template>
			<template slot="footer">
				<span class="dialog-footer">
					<el-button @click="communication = false">取 消</el-button>
					<el-button type="primary" @click="saveCommunication()">确 定</el-button>
				</span>
			</template>
		</BrawerBox>
		<!-- 沟通反馈 -->
		<EmployeeSelector title="选择@人员" :is_filtration_creator="false" :visible.sync="selectUser" @confirm="confirmCreator" />
		<!-- 转交 -->
		<EmployeeSelector title="选择人员" :is_filtration_creator="false" :multi="false" :isChecKedAll="false" :visible.sync="careOfSelector" @confirm="confirmcareOf" />
		<!-- 评分说明 -->
		<el-dialog title="评分说明" :visible.sync="isShowPf" width="500px" :close-on-click-modal="false">
			<el-input type="textarea" v-model="pfText" rows="4" placeholder="请输入评分说明" maxlength="100" show-word-limit></el-input>
			<span slot="footer" class="dialog-footer">
				<el-button @click="isShowPf = false">取 消</el-button>
				<el-button type="primary" @click="updateText()">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 重新评分操作 -->
		<el-dialog title="重新评分" :visible.sync="isShowCx" width="500px" :close-on-click-modal="false">
			<el-input type="textarea" v-model="cxText" rows="4" placeholder="请输入重新评分理由" maxlength="200" show-word-limit></el-input>
			<span slot="footer" class="dialog-footer">
				<el-button @click="isShowCx = false">取 消</el-button>
				<el-button type="primary" @click="revocation()">确 定</el-button>
			</span>
		</el-dialog>
		<!-- 调整目标反馈 -->
		<el-dialog title="调整目标" :visible.sync="isAdjustment" :close-on-click-modal="false" width="700px">
			<div>
				<el-radio-group v-model="radio">
					<div class="flex-box-v">
						<el-radio :label="1" style="margin-bottom: 30px;">
							仅修改指标内容，不重置流程
							<br />
							<span style="font-size: 12px;color: #C0C4CF;padding-left: 25px;padding-top: 5px;">不影响进行中的考核流程，只对指标内容和信息进行修改</span>
						</el-radio>
						<el-radio :label="2">
							修改指标，并重置考核流程
							<br />
							<span style="font-size: 12px;color: #C0C4CF;padding-left: 25px;">修改指标并按照新的流程来进行考核，已评分和已审批的记录也会被重置</span>
						</el-radio>
						>
					</div>
				</el-radio-group>
			</div>
			<span slot="footer">
				<el-button @click="isAdjustment = false">取消</el-button>
				<el-button type="primary" @click="setDataAccess">确定</el-button>
			</span>
		</el-dialog>

		<!-- 评分确认 -->
		<el-dialog title="请确认您的评分" :visible.sync="isPoint" :close-on-click-modal="false" width="700px">
			<div>
				<el-table :data="pointList" :header-cell-style="{ background: '#ECF5FF' }" border>
					<el-table-column prop="name" min-width="150" label="指标">
						<template slot="header" slot-scope="scope">
							<span>
								指标(
								<span style="color:#ff9600;">每项指标评分</span>
								)
							</span>
						</template>
					</el-table-column>
					<!-- <el-table-column prop="score_remark" label="评分说明"></el-table-column> -->
					<el-table-column prop="score" label="评分" align="left"></el-table-column>
				</el-table>
			</div>
			<span slot="footer">
				<el-button @click="isPoint = false">返回修改</el-button>
				<el-button type="primary" @click="score">确定</el-button>
			</span>
		</el-dialog>
	</div>
</template>
<script>
import BrawerBox from '@/components/public/BrawerBox';
import PageHead from '@/components/public/PageHead'; //头部---返回
import Record from '@/components/public/Record';
import ActionPlan from '@/components/public/ActionPlan';
import TableBox from '@/components/public/TableBox';
import TrackManagement from '@/components/public/TrackManagement';
import EmployeeSelector from '@/components/public/EmployeeSelector';
export default {
	name: 'staffAssDet',
	components: {
		PageHead,
		BrawerBox,
		Record,
		ActionPlan,
		TableBox,
		TrackManagement,
		EmployeeSelector
	},
	data() {
		return {
			radio: 1,
			isAdjustment: false,

			gradeList: [],
			dropdownMenu: [{ key: 'a', name: '重置流程', isShow: true }, { key: 'b', name: '调整目标', isShow: true }],
			lingScore_infos: [],
			staffLoad: false, //loading
			tableLoad: false, //loading
			execution: '目标制定并确认完毕后，进入到【执行中】阶段，期间员工执行计划，上级跟踪过程。管理员可以点击【开始评分】后，进入结果数据收集和评分阶段',
			isChecks: false, //侧边弹窗
			headvalue: '',
			headoptions: [],
			employeeID: 0, //考核记录ID
			employID: 0, //当前角色ID
			empDetList: {},
			remployee: {}, //被考核人员信息
			flow: [], //步骤
			atPresentFlow: 0, //当前步骤ID
			dimension: [], //维度表格信息
			config: {}, //配置
			tableData: [],
			communication: false, //沟通
			communicationVal: '',
			tags: [], //沟通@人员
			selectUser: false,
			nowFLow: '', //当前的流程
			turnDown: false, //驳回开关
			tDownArrive: [], //驳回到--数据
			tDownList: {
				node_id: '', //重置到某个节点，
				employee_id: [], //重置到节点的某个用户 0表示驳回到节点
				comment: '' //审核意见
			},
			userInfo: this.$getUserData(),
			processDel: {}, //流程侧边栏
			proNum: '', //流程侧边栏头部
			calc_dimension: 0, //是否参与权重
			revocationNodeId: 1, //撤销节点ID
			isShowCx: false,
			cxText: '',
			//按钮显示隐藏
			revocationShow: false, //是否可以撤销
			gradeButShow: false, //评分
			actionButShow: true, //执行计划
			recordsManagement: true, //管理记录
			examineButShow: false, //审批
			isAction: false, //驳回控制
			resultButShow: false, //结果值录入
			gradeBegin: false, //评分确定
			scoreTab: {}, //评分表头
			record: [], //考核记录
			planIndex: [], //执行计划的下标，当点击表格查看时用到
			apList: [], //执行计划数据
			isPlan: false, //计划弹窗
			// 重置流程
			resetFlow: false,
			rFlowArrive: [], //重置节点数据
			rUsers: [], //重置用户数据
			rFlowList: {
				type: 1, //重置类型 1 流程内重置 2 重读维度流程 重置
				node_id: '', //重置到某个节点， （type 1 必填）
				employee_id: [], //重置到节点的某个用户 0表示驳回到节点 （type 1 必填）
				overwrite_mode: 2, //1 从原来考核表覆写，2 从个人考核包重置 （type 2 必填）
				comment: '' //审核意见
			},
			rFlowRules: {
				node_id: [{ required: true, message: '请选择重置节点', trigger: 'change' }],
				comment: [{ required: true, message: '请填写重置说明', trigger: 'blur' }]
			},
			feedbackBut: false, //沟通反馈按钮
			isTrack: false, //跟踪管理
			weight: '指标权重(0%)',
			packageName: '', //考核包名称 结果值录入用到
			ruleScore: 1, //1-指标均要评分 2-评分总结
			thecurrentFlow: '', //当前节点
			tabTotaScore: 0, //表格展示的总分
			mandatoryScore: false, //指标说明是否必填
			mandatoryNote: false, //总分说明是否必填（暂不做）
			scoreInfo: [], //各个节点的人评的总分
			examineConsent: false, //审批

			transferBut: false, //转交按钮
			careOfSelector: false, //转交选人
			careOfPeopleId: 0, //转交的 -- 转出ID

			isCs: false, //是否抄送人进入（抄送人能看到全部评分内容）

			isShowTargetBtn: false, // 目标制定相关
			isShowConfirmBtn: false, //目标确认按钮
			isUpdateIndex: false, //确认人是否允许修改指标
			has_finish: false, //是否归档
			// 评分说明弹窗
			isShowPf: false,
			pfText: '',
			indexText: {
				//定位评分说明
				e: 0,
				index: 0
			},

			isShowOneselfScore: false, //是否只看自己的评分内容

			// 控制上下
			isDisabled: false,
			up: {},
			down: {},
			package_id: '',
			recordMemberIds: [],
			pendingList: '',
			page: 1,
			isJz: true,
			activeName: '', //待办带进来的节点类型

			// 评分确认列表
			pointList: [],
			pointData: {},
			isPoint: false,

			publicity: 0,

			isSuperior: false,
			ding_msg:0
		};
	},
	computed: {
		isCzData() {
			if (this.gradeBegin) {
				return true;
			}
			if (this.has_finish) {
				return true;
			}
			return false;
		},
		isShowOneself() {
			return function(value) {
				if (!this.isShowOneselfScore) {
					if (value.employee_id == this.userInfo.id) {
						return true;
					} else {
						return false;
					}
				} else {
					return true;
				}
			};
		}
	},
	watch: {
		isAdjustment(val) {
			if (!val) {
				this.radio = 1;
			}
		},
		isShowOneselfScore() {
			this.tableLoad = true;
			setTimeout(() => {
				this.tableLoad = false;
			}, 500);
		},
		examineConsent(val) {
			if (!val) {
				this.tDownList = {
					node_id: '', //重置到某个节点，
					employee_id: [], //重置到节点的某个用户 0表示驳回到节点
					comment: '' //审核意见
				};
			}
		},
		isChecks(val) {
			if (!val) {
				this.transferBut = false;
			}
		},
		headvalue(id) {
			this.headoptions.some(item => {
				if (item.id == id) {
					this.packageName = item.name;
					return true;
				}
			});
			// let data = {
			// 	//缓存的数据用于录入结果后返回页面复原数据
			// 	employeeID: this.employeeID,
			// 	employID: this.employID,
			// 	assID: id
			// };
			// this.$setCache('staffAssDet', data);
			if (this.pendingList) {
				this.employeeDet();
			} else {
				this.employeeDet(true);
			}
		},
		resetFlow(val) {
			if (!val) {
				this.rFlowList = {
					type: 1, //重置类型 1 流程内重置 2 重读维度流程 重置
					node_id: '', //重置到某个节点， （type 1 必填）
					employee_id: [], //重置到节点的某个用户 0表示驳回到节点 （type 1 必填）
					overwrite_mode: 1, //1 从原来考核表覆写，2 从个人考核包重置 （type 2 必填）
					comment: '' //审核意见
				};
				this.$nextTick(() => {
					this.$refs.rFlowList.resetFields();
				});
			}
		},
		'rFlowList.node_id'(val) {
			if (!val) {
				this.rUsers = [];
				return false;
			}
			this.rFlowArrive.some(item => {
				if (val == item.id) {
					let users = [];
					item.target.map(item2 => {
						if (item2.status == 2) {
							users.push({ value: item2.employee_id, label: item2.employee_name });
						}
					});
					this.rUsers = users;
					return true;
				}
			});
		},
		'tDownList.node_id'(val) {
			if (!val) {
				this.rUsers = [];
				return false;
			}
			this.rFlowArrive.some(item => {
				if (val == item.id) {
					let users = [];
					item.target.map(item2 => {
						if (item2.status == 2) {
							users.push({ value: item2.employee_id, label: item2.employee_name });
						}
					});
					this.rUsers = users;
					return true;
				}
			});
		},
		flow(val) {
			//重置要用到
			let executionIndex = 0; //执行中下标
			let targetIndex = 0; //目标下标（处理中的）
			let isNoe = true; //是否完成了整个流程
			val.forEach((item, index) => {
				item.index = index + 1;
				if (item.status == 1) {
					targetIndex = index;
					isNoe = false;
				}
			});
			if (targetIndex == 0 && isNoe) {
				//当流程执行完会是0
				targetIndex = val.length;
			}
			let rFlowArrive = val.slice(executionIndex, targetIndex);
			// 过滤掉 抄送与执行中节点,还有节点人员为空的节点
			var arrs = [];
			rFlowArrive.forEach((item, index) => {
				item.value = item.id;
				item.label = item.index + '.' + item.remarks;
				if (item.code == 'cc' || item.code == 'execution' || item.target.length == 0) {
					return;
				}
				arrs.push(item);
			});

			this.rFlowArrive = arrs;
		},
		communication(val) {
			if (!val) {
				this.tags = [];
				this.communicationVal = '';
			}
		},
		isFlow(val) {
			if (!val) {
				this.target = [];
			}
		},
		isShowPf(val) {
			if (!val) {
				this.pfText = '';
				this.indexText = { e: 0, index: 0 };
			}
		}
	},
	created() {
		// let staffAssDet = this.$getCache('staffAssDet'); //缓存的数据
		// if (staffAssDet) {
		// 	this.employeeID = staffAssDet.employeeID; //个人记录ID
		// 	this.employID = staffAssDet.employID; //被考核人ID
		// 	this.assList(staffAssDet.assID);
		// } else {
			this.employeeID = Number(this.$route.query.employeeID); //个人记录ID
			this.employID = Number(this.$route.query.employeeIDs); //被考核人ID
			this.assList(this.$route.query.assID);
		// }
		// 是否显示上下人
		if (this.$route.query.pendingList) {
			this.pendingList = JSON.parse(this.$route.query.pendingList);
			this.activeName = this.$route.query.activeName;
			this.page = this.$route.query.page || 1;
			this.isDisabled = true;
		} else {
			this.isDisabled = false;
			this.activeName = '';
		}
	},
	methods: {
		openImg(item) {
			let corpId = this.$getCache('corpId');
			let loading = this.$loading({
				lock: true,
				text: 'Loading',
				spinner: 'el-icon-loading'
			});
			if (item) {
				this.$axios('get', 'api/drive/grant', { file_id: item.fileId })
					.then(res => {
						this.$dd.ready(() => {
							this.$dd.biz.cspace.preview({
								corpId: corpId,
								spaceId: item.spaceId,
								fileId: item.fileId,
								fileName: item.fileName,
								fileSize: item.fileSize,
								fileType: item.fileType,
								onSuccess: function(res) {
									console.log(JSON.stringify(res));
								},
								onFail: function(err) {
									console.log(JSON.stringify(err));
								}
							});
						});
					})
					.finally(() => {
						loading.close();
					});
			}
		},
		// 获取待办数据
		getAgency() {
			if (!this.isJz) {
				return false;
			}
			this.page = this.page + 1;
			this.$axios('get', '/api/per/package/msg/agency', { node_type: this.activeName, status: 0, page: this.page, page_size: 10 }).then(res => {
				let list = res.data.data.list;
				let pendingList = [];
				list.forEach(item => {
					if (item.remark.employee_id) {
						//被考核人
						let userInfo = this.$getEmployeeList()[item.remark.employee_id];
						item.userInfo = userInfo;
						pendingList.push({ name: userInfo.name, img_url: userInfo.img_url, employeeID: item.remark.packageEmployee_id, package_name: item.remark.package_name });
					}
				});
				if (list.length < 10) {
					this.isJz = false;
				}
				this.pendingList.push(...pendingList);
			});
		},
		//撤销
		revocation() {
			let params = {
				id: this.employeeID,
				node_id: this.revocationNodeId,
				comment: this.cxText
			};
			this.$axios('post', '/api/per/package/revoke', params)
				.then(res => {
					if (res.data.code == 1) {
						this.$message.success('撤销成功');
						this.employeeDet();
					}
				})
				.finally(() => {
					this.isShowCx = false;
					this.cxText = '';
				});
		},
		// 判断是否能点击列表打开管理记录
		isShowGl() {
			if ((this.$getRole(2) || this.$getRole(3)) && this.recordMemberIds.indexOf(this.$getUserData().id) >= 0) {
				return false;
			} else {
				return true;
			}
		},
		qieh(index) {
			this.employeeID = index == 1 ? this.up.employeeID : this.down.employeeID;
			this.employeeDet('', () => {
				let data = {
					//缓存的数据用于录入结果后返回页面复原数据
					employeeID: this.employeeID,
					employID: this.remployee.id,
					assID: this.package_id
				};
				this.$setCache('staffAssDet', data);
			});
		},
		updateText() {
			let list = this.dimension[this.indexText.e];
			this.indexText.index == 1 ? (list.score_remark = this.pfText) : (list.total_score_comment = this.pfText);
			this.$set(this.dimension, this.indexText.e, list);
			this.isShowPf = false;
		},
		// 填写评分说明
		showPf(e, index) {
			let list = this.dimension[e];
			let text = index == 1 ? list.score_remark : list.total_score_comment; //判断是指标说明，还是总分说明
			this.indexText = { e: e, index: index };
			this.pfText = text;
			this.isShowPf = true;
		},
		// 目标确认-提交
		submit() {
			this.$confirm('请确认提交制定的指标，提交后不能再自行修改！', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消'
			})
				.then(() => {
					let data = {
						id: this.employeeID,
						node_id: this.atPresentFlow,
						submit: 1,
						dimension: JSON.stringify(this.apList)
					};
					this.$axios('post', '/api/per/package/target_set', data).then(res => {
						if (res.data.code == 1) {
							this.$message.success('提交成功');
							this.employeeDet();
						}
					});
				})
				.catch(() => {
					console.log('取消');
				});
		},
		// 判断是否当前被考核人的上级
		getSuperior() {
			this.$axios('get', '/api/per/user/manager_list', { id_code: this.$returnCode(this.remployee.id) }).then(res => {
				let superiorList = res.data.data; //被考核人上级
				superiorList.some(item => {
					if (item.id == this.userInfo.id) {
						this.isSuperior = true;
						return true;
					}
				});
			});
		},
		//判断当有一个人完成，其他显示无需操作
		getStrus() {
			let is = false;
			if (this.processDel.multi_executor == 2) {
				this.processDel.target.some(item => {
					if (item.status == 2) {
						is = true;
						return true;
					}
				});
				return is;
			} else {
				return false;
			}
		},
		//转交
		careOf(data) {
			this.careOfPeopleId = data.employee_id;
			this.careOfSelector = true;
		},
		//转交选人
		confirmcareOf(list) {
			let data = {
				id: this.employeeID, //个人考核记录ID
				node_id: this.processDel.id, //节点ID
				to_employee_id_code: this.$returnCode(list.employee[0].id), //接收用户ID
				from_employee_id_code: this.$returnCode(this.careOfPeopleId) //转出用户ID
			};
			this.$axios('post', '/api/per/package/transfer', data).then(res => {
				if (res.data.code == 1) {
					this.$message.success('转交成功');
					this.isChecks = false;
					this.employeeDet();
				}
			});
		},
		// 打开结果值录入
		openResult() {
			this.$router.push({
				name: 'resultSet',
				query: { id: this.employeeID, packageName: this.packageName }
			});
		},
		// 打开目标制定
		openFormulate() {
			this.$router.push({
				name: 'formulate',
				query: { id: this.employeeID, packageName: this.packageName, nodeId: this.atPresentFlow }
			});
		},
		//打开管理记录
		openTrack(index) {
			this.planIndex = index;
			this.isTrack = true;
		},
		//打开执行计划
		openPlan(index) {
			this.planIndex = index;
			this.isPlan = true;
		},
		//评分--取消
		cancel() {
			this.$confirm('是否暂存当前页面内容?', '提示', {
				confirmButtonText: '暂存',
				cancelButtonText: '不暂存'
			})
				.then(() => {
					this.save(0);
				})
				.catch(() => {
					this.employeeDet();
					this.gradeBegin = false;
				});
		},
		//评分提交
		save(num) {
			let data = {
				id: this.employeeID, //个人考核包ID
				is_submit: num, //是否提交 0否（暂存） 1 是
				node_id: this.atPresentFlow //当前节点
			};
			let point_info = []; //各项评分数据
			let sumData = {
				//总分数据
				total_score: '',
				total_score_comment: ''
			};
			this.dimension.forEach(item => {
				let resultInfo = {};
				if (this.ruleScore == 1 && !item.totalScore) {
					//各项评分
					resultInfo = {
						//评分信息--只评总分不需要
						score: item.score_grade ? item.score_grade : '', //单项目结果值
						score_remark: item.score_remark,
						dimension_key: item.dimension_key, //维度索引
						index_key: item.index_key, //指标索引
						index_id: item.id, //指标ID
						name: item.name,

						// 用于计算分数
						d_weight: item.dimension_weight, //维度权重
						weight: item.weight, //指标权重
						type: item.type //所属指标种类 1-量化指标 2-行为价值观指标 3-额外加分项 4-额外扣分项
					};
					point_info.push(resultInfo);
				} else {
					//等于2：只评总分
					if (item.totalScore) {
						sumData = {
							total_score: item.score_grade ? item.score_grade : '',
							total_score_comment: item.total_score_comment
						};
					}
				}
			});
			let isMust = true,isExplain = true; //isMust验证评分，isExplain验证说明
			if (num == 1) {
				//提交验证必填
				if (this.ruleScore == 1) {
					//各项评分
					point_info.forEach(item => {
						if (this.mandatoryScore) {
							//评分说明必填
							if (!item.score_remark) {
								isExplain = false;
							}
						}
						if (!item.score) {
							isMust = false;
						}
					});
					if (!isMust) {
						this.$message.warning('请输入所有评分');
						return false;
					}
					if (!isExplain) {
						this.$message.warning('请输入所有评分说明');
						return false;
					}
				} else {
					//总分
					if (!sumData.total_score) {
						this.$message.warning('请输入评分总分');
						return false;
					}
					if (this.mandatoryScore) {
						if (!sumData.total_score_comment){
							this.$message.warning('请输入总分说明');
							return false;
						}
					}
				}
			}
			if (this.ruleScore == 1) {
				data.total_score = this.fomatFloat(this.totalPointsCount(point_info), 2); //计算的个人评出的总分（保留小数后两位）
			} else {
				data.total_score = this.fomatFloat(sumData.total_score, 2); //计算的个人评出的总分（保留小数后两位）
				data.total_score_comment = sumData.total_score_comment;
			}
			data.point_info = JSON.stringify(point_info); // 评分信息 --  填所有评分时必须的字段（传入某指标的分数、说明、维度索引、制表索引、指标ID）
			data.num=num;//判断是暂存还是提交
			let pointList = JSON.parse(JSON.stringify(point_info));
			pointList.push({
				name: '总分',
				score: data.total_score,
				score_remark: data.total_score_comment
			});
			this.pointList = pointList;
			this.pointData = data;
			if (this.ruleScore == 1&&num) {
				//只评总分不需要弹窗
				this.isPoint = true;
			} else {
				this.score();
			}
		},
		score() {
			this.$axios('post', '/api/per/package/submit_score', this.pointData).then(res => {
				this.$message.success(this.pointData.num==0? '暂存成功':'评分成功');
				this.gradeBegin = false;
				this.isPoint = false;
				this.employeeDet();
			});
		},
		fomatFloat(src, pos) {
			return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);
		},
		//计算总分
		totalPointsCount(data) {
			let ct = this.empDetList.calc_type; //1-加和计算 2-加权计算
			let cd = this.empDetList.calc_dimension; //是否维度权重参与计算 1-是 0-否
			let num = 0;
			data.forEach(item => {
				if (item.score) {
					if (item.type == 3) {
						//3-额外加分项
						num += Number(item.score);
					} else if (item.type == 4) {
						//4-额外扣分项    不计算
						num -= Number(item.score);
					} else {
						if (ct == 1 && cd == 0) {
							//加和
							num += Number(item.score);
						} else if (ct == 1 && cd == 1) {
							//加和--维度权重参与计算
							num += Number(item.score) * Number(item.d_weight / 100);
						} else if (ct == 2 && cd == 0) {
							//加权
							num += Number(item.score) * Number(item.weight / 100);
						} else if (ct == 2 && cd == 1) {
							//加权--维度权重参与计算
							num += Number(item.score) * Number(item.d_weight / 100) * Number(item.weight / 100);
						}
					}
				}
			});

			return num;
		},

		sgradeBlur(e) {
			let list = this.dimension[e];
			let tPoints = [];
			this.dimension.forEach(item => {
				if (item.score_grade) {
					tPoints.push({
						score: item.score_grade, //分值
						d_weight: item.dimension_weight, //维度权重
						weight: item.weight, //指标权重
						type: item.type //所属指标种类 1-量化指标 2-行为价值观指标 3-额外加分项 4-额外扣分项
					});
				}
			});
			this.tabTotaScore = this.fomatFloat(this.totalPointsCount(tPoints), 2);
		},
		sgradeInp(e, item) {
			//e当前行 ,item用于判断当前输入是否超过评分上限
			let list = this.dimension[e];
			if (item) {
				if (item.type == 3 || item.type == 4) {
					if (item.point_limit != '-') {
						if (item.score_grade > Number(item.point_limit)) {
							this.$message.error('评分超过上限');
							list.score_grade = '';
							this.$set(this.dimension, e, list);
							return false;
						}
					}
				}
			}
			this.$set(this.dimension, e, list);
		},
		//绩效包列表
		assList(assID) {
			let params = {
				page: 0, //当期页
				employee_id_code: this.$returnCode(this.employID),
			};
			this.staffLoad = true;
			this.$axios('get', '/api/per/package/list', params).then(res => {
				if (res.data.code == 1) {
					this.headoptions = res.data.data.list;
					this.headvalue = Number(assID);
				}
			});
		},
		setUpD() {
			let pendingList = this.pendingList;
			this.up = {};
			this.down = {};
			pendingList.some((item, index) => {
				if (this.employeeID == item.employeeID) {
					this.packageName = item.package_name;
					if (pendingList[index - 1]) {
						this.up = pendingList[index - 1];
					}
					if (pendingList[index + 1]) {
						this.down = pendingList[index + 1];
					}
					if (index == pendingList.length - 2 && pendingList.length >= 10) {
						//如果当点击到待办人员的倒数第二个，加载剩余的
						this.getAgency();
					}
					return true;
				}
			});
		},
		// 绩效考核详情
		employeeDet(is, func = function() {}) {
			let params = {};
			// 重置按钮状态
			(this.revocationShow = false), (this.gradeButShow = false);
			this.examineButShow = false;
			this.isAction = false;
			this.resultButShow = false;
			this.isShowTargetBtn = false;
			this.isShowConfirmBtn = false;
			this.isUpdateIndex = false;
			this.atPresentFlow = 0;
			this.nowFLow = '';
			if (is) {
				params.package_id = this.headvalue;
				params.employee_id_code = this.$returnCode(this.employID); //用户ID
			} else {
				params.id = this.employeeID; //个人考核记录ID
			}
			this.staffLoad = true;
			this.$axios('get', '/api/per/package/employee/info', params)
				.then(res => {
					if (res.data.code == 1) {
						let data = res.data.data;
						this.has_finish = data.has_finish;
						this.recordMemberIds = data.record_member_ids;
						this.empDetList = data;
						this.employeeID = data.id; //考核记录id
						this.package_id = data.package_id;
						this.publicity = data.publicity;
						if (this.pendingList) {
							this.setUpD();
						}
						this.remployee = this.$getEmployeeList()[data.relevance_employee.id]; //被考核人员信息
						this.remployee.deptList = data.relevance_employee.dept_list; //部门
						data.flow.map(item => {
							if (item.target && item.target.length > 0) {
								item.target.map(item2 => {
									item2.employee_name = this.$getEmployeeList()[item2.employee_id].name;
								});
							}
						});
						this.flow = data.flow; //流程
						this.config = data.config;
						this.calc_dimension = data.calc_dimension; //是否参与权重
						this.apList = JSON.parse(JSON.stringify(data.dimension));
						this.scoreInfo = data.score_info; //各个节点的人评的总分
						// 沟通反馈是否启用
						this.feedbackBut = data.config.assessment.feedback == '1' ? true : false;
						let point_scope = data.config.assessment.point_scope; //评分可见权限
						let point_comment = data.config.assessment.point_comment; //说明可见权限
						let executor = {}; //与当前登录账号相同的执行人
						let review = {}; //与当前登录账号相同的审批人
						data.flow.forEach((item, index) => {
							if (item.code == 'execution') {
								//查找 已开始或已结束的执行节点中有无当前账号
								if (item.status != 0) {
									item.target.forEach(tar => {
										if (tar.employee_id == this.userInfo.id) {
											executor = tar; //存入与当前登录账号相同的执行人
											executor.newCode = 'employee'; //保存执行人节点code
										}
									});
								}
							}
							if (item.code == 'review') {
								//查找 已开始或已结束的审批节点中有无当前账号
								if (item.status != 0) {
									item.target.forEach(tar => {
										if (tar.employee_id == this.userInfo.id) {
											review = tar; //存入与当前登录账号相同的审批人
											review.newCode = 'reviewer'; //保存审批人节点code
										}
									});
								}
							}
							//当前步骤
							if (item.status == 1) {
								// 判断是否显示撤销按钮
								if (item.code != 'cc') {
									this.isRevocation(item, data.flow[index - 1]);
								}
								this.nowFLow = item.code;
								this.atPresentFlow = item.id;
								
								this.setBtn(item); //其他按钮控制
								if (item.code == 'target' || item.code == 'confirm') {
									//当是目标制定，目标确认时，隐藏调整目标按钮
									this.dropdownMenu[1].isShow = false;
								} else {
									this.dropdownMenu[1].isShow = true;
								}
								//审批按钮
								if (item.code == 'review') {
									let reviewif = false;
									item.target.forEach(tar => {
										if (tar.employee_id == this.userInfo.id && tar.status == 1) {
											reviewif = true;
										}
									});
									this.examineButShow = reviewif ? true : false;
									this.isAction = item.action.indexOf('refuse') >= 0 ? true : false;
								}
							}
							let remName = item.remark;
							item.target.forEach((add, att) => {
								remName += add.employee_name;
								remName += item.target.length - att > 1 ? ',' : '';
							});
							item.remarks = remName;
							item.remarkDel = item.remark.split('：')[0];
						});
						
						if (this.atPresentFlow == 0) {
							//如果当前节点id为0，代表此考核详情已完毕，把最后一个节点作为当前节点
							this.atPresentFlow = data.flow[data.flow.length - 1].id;
							// 判断抄送节点里是否包含当前登录者
							let cs = data.flow[data.flow.length - 1];
							cs.target.some(item => {
								if (item.employee_id == this.userInfo.id) {
									this.isCs = true;
									return true;
								}
							});
						}

						//整合表格格式
						let dimension = data.dimension;
						let dimeTab = [];
						let gradeTab = [];
						let weight = 0; //权重统计
						dimension.forEach((item, keys) => {
							item.index.forEach((arr, index) => {
								weight += Number(arr.weight);
								arr.wdLeg = 0; //其他这个指标集合的指标给值为0
								item.index[0].wdLeg = item.index.length; //找出这个指标集合的第一个并给与他的长度
								arr.theDimension = item.name;
								arr.dimension_weight = item.dimension_weight; //维度权重
								arr.score_infos = [];
								arr.planIndex = [keys, index]; //当打开执行计划时的下标
								arr.per_remark = this.initData(arr.per_remark);
								arr.remark = this.initData(arr.remark);
								arr.target = this.initData(arr.target);
								arr.result = this.initData(arr.result);
								arr.point_limit = this.initData(arr.point_limit);
								if (item.index_type == 3 || item.index_type == 4) {
									arr.weight = this.initData(Number(arr.weight));
								}
								// 权限区分
								arr.score_info.forEach((list, auto) => {
									if (list.id <= this.atPresentFlow) {
										//atPresentFlow为当前节点id。。数据-id <= 当前节点id .   :筛选出当前节点及之前的评分节点的数据
										list.employees.forEach(emplo => {
											//获取code
											data.flow.forEach(codes => {
												if (codes.id == list.id) {
													emplo.code = codes.code;
													codes.target.some(tar => {
														//找到每个评分人获取评分状态
														if (tar.employee_id == emplo.employee_id) {
															emplo.status = tar.status;
															return true;
														}
													});
												}
											});
											emplo.id = list.id;
											emplo.newKey = Number(emplo.id + '' + emplo.employee_id); //给一个唯一key，目的：找到不同节点的相同的人    去重
											arr.score_infos.push(emplo);
											gradeTab.push(emplo);
										});
									}
								});
								dimeTab.push(arr);
							});
						});
						this.weight = '指标权重(' + weight + '%)';
						let poiSco = data.config.assessment.point_scope; //评分可见权限
						let poicom = data.config.assessment.point_comment; //说明可见权限
						let duplicat = this.duplicateRemoval(gradeTab, 'newKey');
						duplicat.forEach(item => {
							if (item.code == 'review') {
								//审批
								item.newCode = 'reviewer';
							} else if (item.code == 'execution') {
								//执行中
								item.newCode = 'employee';
							} else if (item.code == 'score_supervisor') {
								//指定上级
								item.newCode = 'manager';
							} else if (item.code == 'special_scorer') {
								//特定上级
								item.newCode = 'special';
							}
							//item为评分数据，数据内只有两个节点：指定（score_supervisor，权限名：manager）  特定上级（special_scorer，权限名：special）
							//poiSco    评分权限
							//poicom    说明权限
							//executor  执行人中的当前登陆账号
							//review    审批人中的当前登陆账号
							if (executor.employee_id) {
								//若有数据，那么当前登录账号必定在执行人中并且执行节点正在执行或已结束（哪怕正在执行也无所谓，前方已经过滤评分数据，会得到[]）
								if (poiSco[executor.newCode] == '2') {
									//已有数据并且为2 ‘查看所有的’ ，那就可以将所有的评分权限都改为 ‘2’
									for (let i in poiSco) {
										poiSco[i] = '2';
									}
								}
								if (poicom[executor.newCode] == '2') {
									//说明同上
									for (let i in poicom) {
										poicom[i] = '2';
									}
								}
							}
							if (review.employee_id) {
								//审批节点--同上  （审批节点默认为2，可以直接全部变成2）
								if (poiSco[review.newCode] == '2') {
									for (let i in poiSco) {
										poiSco[i] = '2';
									}
								}
								if (poicom[review.newCode] == '2') {
									//说明同上
									for (let i in poicom) {
										poicom[i] = '2';
									}
								}
							}
							if (item.employee_id == executor.employee_id) {
								//判断当前评分数据是否 与 执行节点的当前帐号一致
								if (poiSco[executor.newCode] == '2') {
									//如果一致并且执行节点为‘2’即查看所有，那么就修改当前 评分数据 的权限也为‘2’
									poiSco[item.newCode] = '2';
								}
								if (poicom[executor.newCode] == '2') {
									//执行中的 -- 说明权限-同上
									poicom[item.newCode] = '2';
								}
							}
							if (item.employee_id == review.employee_id) {
								//判断当前评分数据是否 与 审批节点的当前帐号一致
								if (poiSco[review.newCode] == '2') {
									poiSco[item.newCode] = '2';
								}
								if (poicom[review.newCode] == '2') {
									//审批的 -- 说明权限-同上
									poicom[item.newCode] = '2';
								}
							}
						});
						let poiSOk = false; //评分--为true时所有评分可看
						let poiCOk = false; //说明--为true时所有说明可看
						duplicat.forEach(item => {
							if (poiSco[item.newCode] == '1' && item.employee_id == this.userInfo.id) {
								item.poiSco = true;
							} else if (poiSco[item.newCode] == '2') {
								
								//当前 评分 数据权限等于2时并且 （当前数据id为登陆账号  或  执行中权限等于2（代表当前登陆账号为执行中的一员 或 审批权限等于2（代表当前登陆账号为审批中的一员）） 时，所有评分都可见
								if (item.employee_id == this.userInfo.id || poiSco[executor.newCode] == '2' || poiSco[review.newCode] == '2') {
									poiSOk = true;
								}
							}
							//说明可见权限。
							if (poicom[item.newCode] == '1' && item.employee_id == this.userInfo.id) {
								//说明--同上
								item.poicom = true;
							} else if (poicom[item.newCode] == '2') {
								if (item.employee_id == this.userInfo.id || poicom[executor.newCode] == '2' || poicom[review.newCode] == '2') {
									poiCOk = true;
								}
							}
						});
						duplicat.forEach(item => {
							if (poiSOk || this.$getRole(1) || this.isCs) {
								item.poiSco = true;
							}
							if (poiCOk || this.$getRole(1) || this.isCs) {
								item.poicom = true;
							}
						});
						//遍历列表总分
						let scoreListInfo = [];
						let totSco = false;
						let points = []; //最终显示评分
						this.scoreInfo.forEach(item => {
							item.employees.forEach(arr => {
								arr.newKey = Number(item.id + '' + arr.employee_id);
								arr.codeId = item.id;
								scoreListInfo.push(arr);
							});
						});
						duplicat.forEach((item, index) => {
							scoreListInfo.forEach(arr => {
								if (item.newKey == arr.newKey) {
									item.totalScore = arr.point;
									item.comment = arr.comment;
									if (arr.point) {
										totSco = true;
									}
								}
							});
							if (item.status != 2 && item.id != this.atPresentFlow) {
								delete duplicat[index]
							} else {
								points.push(item);
							}
						});
						points.sort(this.rule('id')); //跟距ID排序
						
						this.lingScore_infos = points; //表格   评分、说明    头部

						let toScore = {
							theDimension: '总分',
							wdLeg: 0,
							toScore: true
						};
						if (totSco) {
							let poiScoDimeTab = false;
							duplicat.forEach(item => {
								if (item.poiSco) {
									poiScoDimeTab = true;
								}
							});
							if (poiScoDimeTab) {
								dimeTab.push(toScore);
								this.$nextTick(() => {
									//刷新总分--行
									dimeTab.forEach((item, index) => {
										if (item.toScore) {
											this.sgradeInp(index);
										}
									});
								});
							}
						}
						//流程结束后的判断
						this.pdLc();
						if (data.publicity == 1 && (!this.nowFLow || this.nowFLow == 'review')) {
							//判断是否公开，并且是审批节点或者流程结束，（流程结束nowFLow为空）
							dimeTab[0].final_point = data.final_point; //考核结果--总分
							dimeTab[0].final_level = data.final_level; //考核结果--等级
							dimeTab[0].doing_id = 11;
							dimeTab[0].zfLeg = dimeTab.length;
						}
						this.dimension = dimeTab; //表格数据
						//记录
						let record = res.data.data.record;
						record.forEach(item => {
							item.userData = this.$getEmployeeList()[item.employee_id];
						});
						this.record = record;
						func();
					}
				})
				.finally(() => {
					this.staffLoad = false;
					this.getSuperior();
				});
		},
		// 判断是否显示撤销按钮
		isRevocation(dqItem, upItem) {
			// 当前只需要评分节点需要撤回
			//当前节点包含自己并且其他任意一人未完成的显示按钮
			if (dqItem.code == 'score_supervisor' || dqItem.code == 'special_scorer') {
				dqItem.target.some((item, index) => {
					if (item.employee_id == this.userInfo.id && item.status == 2) {
						dqItem.target.some((item2, index2) => {
							if (item2.status == 1) {
								this.revocationNodeId = dqItem.id;
								this.revocationShow = true;
								return true;
							}
						});
					}
				});
			}
			let is = true; //判断当前节点人员是否有完成的
			//上一节点中包含登录者并且是完成的状态显示按钮
			if (upItem) {
				dqItem.target.some((item, index) => {
					if (item.status == 2) {
						is = false;
					}
				});
				if (upItem.code == 'score_supervisor' || upItem.code == 'special_scorer') {
					upItem.target.some((item, index) => {
						if (item.employee_id == this.userInfo.id && item.status == 2 && is) {
							this.revocationNodeId = upItem.id;
							this.revocationShow = true;
							return true;
						}
					});
				}
			}
		},
		pdLc() {
			let flow = JSON.parse(JSON.stringify(this.flow)).reverse(); //反转流程，找第一个评分节点
			//流程结束，但是最后一个“评分”节点里有自己显示撤销
			if (this.publicity == 1) {
				flow.some(item => {
					if (item.code == 'review' || item.code == 'cc') {
						return true;
					}
					if (item.code == 'score_supervisor' || item.code == 'special_scorer') {
						item.target.some(e => {
							if (e.employee_id == this.userInfo.id && e.status == 2) {
								this.revocationNodeId = item.id;
								this.revocationShow = true;
								return true;
							}
						});
						return true;
					}
				});
			}
		},
		// 各按钮控制
		setBtn(item) {
			// console.log(item,this.userInfo.id)
			// 目标制定
			if (item.code == 'target') {
				item.target.forEach(tar => {
					if (tar.employee_id == this.userInfo.id && tar.status == 1) {
						this.isShowTargetBtn = true;
					}
				});
				return;
			}
			// 目标确认
			if (item.code == 'confirm') {
				item.target.forEach(tar => {
					if (tar.employee_id == this.userInfo.id && tar.status == 1) {
						this.isShowConfirmBtn = true;
					}
				});
				this.isUpdateIndex = item.action.indexOf('index') >= 0 ? true : false;
				return;
			}
			//评分按钮
			if (item.code == 'score_self' || item.code == 'score_mutual' || item.code == 'score_supervisor' || item.code == 'special_scorer') {
				item.target.forEach(tar => {
					if (tar.employee_id == this.userInfo.id && tar.status == 1) {
						this.gradeButShow = true;
					}
				});
				return;
			}
			//结果值录入按钮
			if (item.code == 'result_value') {
				item.target.forEach(tar => {
					if (tar.employee_id == this.userInfo.id) {
						this.resultButShow = true;
					}
				});
				return;
			}
		},
		//去重
		duplicateRemoval(data, name) {
			let bbt = {};
			let abbts = data.reduce((cur, next) => {
				bbt[next[name]] ? '' : (bbt[next[name]] = true && cur.push(next));
				return cur;
			}, []);
			return abbts;
		},
		//跟距ID排序
		rule(key) {
			return function(a, b) {
				// sort 默认接受a,b两个参数表示数组中的值
				var value1 = a[key];
				var value2 = b[key];
				return value1 - value2;
			};
		},
		groupBy(data, params) {
			const groups = {};
			data.forEach(v => {
				const group = JSON.stringify(v[params]);
				groups[group] = groups[group] || [];
				groups[group].push(v);
			});
			return Object.values(groups);
		},
		//数据初始化，没有值或者空数组的显示-
		initData(str) {
			if (str == null) {
				return str ? str : '-';
			}
			if (typeof str == 'object') {
				return str.length > 0 ? str : '-';
			} else {
				return str ? str : '-';
			}
		},
		// 根据数据结构显示table,
		getTableItem(str) {
			let dimension = this.dimension;
			let is = false;
			dimension.some(item => {
				for (var key in item) {
					if (str == key) {
						if (typeof item[key] == 'object') {
							//是数组并且长度大于0
							if (item[key].length > 0) {
								is = true;
								return true;
							}
						} else {
							if (key == 'target') {
								if (item[key] != '0' && item[key] != '-') {
									//是有数据并且！= -
									is = true;
									return true;
								}
							} else {
								if (item[key] != '-') {
									//是有数据并且！= -
									is = true;
									return true;
								}
							}
						}
					}
				}
			});
			return is;
		},
		//流程点击
		processDet(data) {
			// console.log(JSON.stringify(data))
			this.processDel = data;
			this.isChecks = true;
			if (data.target.length == 0) {
				this.proNum = '';
			} else {
				let arr = 0;
				data.target.forEach((item, index) => {
					if (item.status == 2) {
						arr++;
					}
				});
				this.proNum = '（' + arr + '/' + data.target.length + '）';
			}
			let code = this.processDel.code;
			if (this.processDel.status == 1) {
				//当是目标制定，目标确认 结果值录入，上级评分，指定人评分，审批时显示转交按钮
				if (code == 'target' || code == 'confirm' || code == 'score_supervisor' || code == 'special_scorer' || code == 'result_value' || code == 'review') {
					this.transferBut = true;
				} //当上级评分，指定人评分，判断是否具有转交权限
			}
		},
		handleCommand(val) {
			//管理选项
			if (val == 'a') {
				//重置流程
				this.resetFlow = true;
			} else if (val == 'b') {
				this.isAdjustment = true;
			}
		},
		//
		setDataAccess() {
			this.isAdjustment = false;
			if (this.radio == 2) {
				//调整目标
				this.$router.push({
					name: 'adjustment',
					query: { id: this.employeeID }
				});
			} else {
				//调整目标
				this.$router.push({
					name: 'adjustment2',
					query: { id: this.employeeID }
				});
			}
		},
		// 沟通反馈
		saveCommunication() {
			if (!this.communicationVal) {
				this.$message.error('请输入沟通内容');
				return false;
			}
			let target_id = this.tags.map(item => {
				return item.id;
			});
			this.$axios('post', '/api/per/package/negotiation', {
				id: this.employeeID,
				content: this.communicationVal,
				target_id: JSON.stringify(target_id),
				ding_msg:this.ding_msg,
			}).then(res => {
				this.$message.success('已沟通');
				this.employeeDet();
				this.ding_msg=0;
				this.communication = false;
			});
		},
		confirmCreator(e) {
			this.tags = e.employee;
		},
		handleClose(tag, index) {
			this.tags.splice(index, 1);
		},
		//评分按钮
		gradeClick() {
			this.gradeBegin = true;
			let dnsion = [];
			this.dimension.forEach(item => {
				if (!item.toScore) {
					item.score_infos.forEach(arr => {
						if (arr.employee_id == this.userInfo.id && arr.id == this.atPresentFlow) {
							item.score_grade = arr.point; //某指标的分数
							item.score_remark = arr.remark; //评分说明
							dnsion.push(item);
						}
					});
				}
			});
			let data = {};
			dnsion.forEach(item => {
				item.wdLeg = 0;
			});
			let totalScore = {
				theDimension: '总分',
				wdLeg: 0,
				totalScore: true
			};
			this.flow.forEach(item => {
				if (item.code == 'score_supervisor' && item.status == 1) {
					this.ruleScore = item.rule == 2 ? 2 : 1; //1-指标均要评分 2-评分总结
					this.thecurrentFlow = 'score_supervisor';
					totalScore.codeId = item.id;
				} else if (item.code == 'special_scorer' && item.status == 1) {
					this.ruleScore = 1;
				}
				if ((item.code == 'score_supervisor' && item.status == 1) || (item.code == 'special_scorer' && item.status == 1)) {
					//上级评分，特定评分     评分人必填项
					item.action.forEach(arr => {
						this.mandatoryScore = arr == 'comment' ? true : false; //指标说明是否必填
					});
				}
			});
			this.scoreInfo.forEach(item => {
				item.employees.forEach(arr => {
					if (arr.employee_id == this.userInfo.id) {
						this.tabTotaScore = arr.point ? arr.point : 0;
						if (item.id == totalScore.codeId && this.ruleScore == 2) {
							totalScore.score_grade = arr.point;
							totalScore.total_score_comment = arr.comment ? arr.comment : '';
						}
					}
				});
			});
			let dimenList = [];
			let users = []; //当前节点的自己的信息
			this.flow.forEach(item => {
				//根据流程当前节点，找节点的人员中的登陆者
				if (item.status == 1) {
					item.target.some(arr => {
						if (arr.employee_id == this.userInfo.id) {
							arr.flowStatusId = item.id; //当前节点的ID
							users = arr;
							return true;
						}
					});
				}
			});
			users.list.forEach(att => {
				//获取当前节点审批人员中的登陆者
				dnsion.forEach((add, index) => {
					if (att.index_id == add.id && att.dimension_key == add.planIndex[0] && att.index_key == add.planIndex[1]) {
						//因为不同维度下可能存在相同的指标，所以也要判断他的维度是否一致
						add.dimension_key = att.dimension_key; //维度索引
						add.index_key = att.index_key; //指标索引
						add.score_infos.forEach(user => {
							//显示的文案，找到当前登录人
							if (user.id == users.flowStatusId) {
								if (user.employee_id == this.userInfo.id) {
									this.scoreTab.title = user.title;
									this.scoreTab.explain = user.title.split('：')[0] + '说明';
								}
							}
						});
						dimenList.push(add);
					}
				});
			});
			dimenList.push(totalScore);
			this.$nextTick(() => {
				this.dimension = dimenList;
			});
		},
		gradeTurn() {
			//评分驳回按钮
			this.turnDown = true;
		},
		gradeOk() {
			//评分驳回按钮
			this.examineConsent = true;
		},
		tDownOk(num, formName) {
			let tDownList = this.tDownList;
			if (num == 1) {
				let data = {
					id: this.employeeID, //个人考核包ID
					agree: 1, //同意1    驳回0
					c_node_id: this.atPresentFlow, //当前节点ID
					comment: tDownList.comment //审核意见
				};
				this.tDownHttpJx(1, data);
			} else if (num == 0) {
				//驳回
				this.$refs[formName].validate(valid => {
					if (valid) {
						if (tDownList.employee_id.length == 0) {
							this.$message.error('至少选择一名重置人员');
							return false;
						}
						if (!tDownList.comment) {
							this.$message.error('请输入驳回说明');
							return false;
						}
						this.$confirm('流程将驳回到选中节点，已完成的节点需要重新进行处理，确认重置流程？', '提示', {
							confirmButtonText: '确定',
							cancelButtonText: '取消',
							type: 'warning'
						})
							.then(() => {
								let data = {
									id: this.employeeID, //个人考核包ID
									agree: 0, //同意1    驳回0
									node_id: tDownList.node_id, //重置到某个节点， （type 1 必填）
									c_node_id: this.atPresentFlow, //当前节点ID
									employee_id_code: this.$returnCode(tDownList.employee_id), //重置到节点的某个用户 string(JSOn)
									comment: tDownList.comment //审核意见
								};
								this.tDownHttpJx(0, data);
							})
							.catch(() => {});
					} else {
						return false;
					}
				});
			}
		},
		tDownHttpJx(num, data) {
			this.$axios('post', '/api/per/package/review', data).then(res => {
				this.$message.success('提交成功');
				this.tDlose(num);
				this.employeeDet();
			});
		},
		tDlose(num) {
			//驳回侧边栏关闭
			if (num == 0) {
				this.turnDown = false;
			} else if (num == 1) {
				this.examineConsent = false;
			}
		},
		//重置确定
		rFlowOk(formName) {
			this.$refs[formName].validate(valid => {
				if (valid) {
					let rFlowList = this.rFlowList;
					if (rFlowList.type == 1) {
						if (rFlowList.employee_id.length == 0) {
							this.$message.error('至少选择一名重置人员');
							return false;
						}
					}
					this.$confirm('流程将重置，已完成的节点需要重新进行处理，确认重置流程？', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					})
						.then(() => {
							let data;
							if (rFlowList.type == 1) {
								data = {
									id: this.employeeID, //个人考核包ID
									type: rFlowList.type, //重置类型 1 流程内重置 2 重读维度流程 重置
									node_id: rFlowList.node_id, //重置到某个节点， （type 1 必填）
									employee_id_code: this.$returnCode(rFlowList.employee_id), //重置到节点的某个用户 string(JSOn)
									comment: rFlowList.comment //审核意见
								};
							} else {
								data = {
									id: this.employeeID, //个人考核包ID
									type: rFlowList.type, //重置类型 1 流程内重置 2 重读维度流程 重置
									overwrite_mode: rFlowList.overwrite_mode, //1 从原来考核表覆写，2 从个人考核包重置 （type 2 必填）
									comment: rFlowList.comment //审核意见
								};
							}
							this.$axios('post', 'api/per/package/reset_flow', data).then(res => {
								this.$message.success('提交成功');
								this.resetFlow = false;
								this.employeeDet();
							});
						})
						.catch(() => {});
				} else {
					return false;
				}
			});
		},
		objectSpanMethod({ row, column, rowIndex, columnIndex }) {
			if (!this.gradeBegin && !row.toScore) {
				if (columnIndex === 0) {
					return {
						rowspan: row.wdLeg,
						colspan: 1
					};
				}
			}
			if (row.zfLeg) {
				//考核结果、绩效等级
				if (column.label == '考核结果' || column.label == '绩效等级') {
					if (rowIndex != 1) {
						return {
							rowspan: row.zfLeg,
							colspan: 1
						};
					} else {
						return {
							rowspan: 0,
							colspan: 0
						};
					}
				}
			}
		}
	},
	beforeRouteLeave(to, from, next) {
		if (to.name != 'formulate' && to.name != 'resultSet') {
			localStorage.removeItem('staffAssDet');
		}
		next();
	}
};
</script>
<style scoped lang="scss">
.guidang {
	margin-left: 20px;
	width: 70px;
	animation: example 1s;
}
@keyframes example {
	from {
		transform: scale(1.4);
	}
	to {
		transform: scale(1);
	}
}
.popover-box {
	opacity: 1;
	border-radius: 4px;
	width: 250px;
}
.popover-title {
	font-size: 14px;
	font-family: PingFang SC;
	font-weight: 400;
	text-align: center;
	color: #ffcb00;
	margin-bottom: 10px;
}
.popover-content {
	font-size: 14px;
	font-family: PingFang SC;
	font-weight: 400;
	opacity: 1;
	color: #fff;
}
.result {
	border: 2px solid #ff9600;
	padding: 5px 10px;
	color: #ff9600;
	text-align: center;
}
.flow-img {
	width: 20px;
	position: absolute;
	right: -30px;
}
.all {
	position: relative;
	font-size: 14px;
	background-color: #fff;
	padding: 20px;
	header {
		margin-bottom: 60px;
		.head {
			border-top: 1px solid #e6e6e6;
			border-bottom: 1px solid #e6e6e6;
			padding: 20px 0;
			margin-top: 10px;
		}
		.head2User {
			.headTname {
				padding: 7px 0 0 15px;
				div {
					padding: 0 0 3px 0;
					font-size: 15px;
				}
				span {
					font-size: 13px;
					color: #969696;
				}
			}
		}
	}
}
.upDown-box {
	position: fixed;
	bottom: 10px;
	left: 50%;
	background-color: #fff;
	z-index: 100;
	width: 370px;
	height: 60px;
	border-radius: 100px;
	margin-left: -185px;
	box-shadow: 0 0 5px #999999;
}
.upName {
	width: 80px;
	text-align: center;
	padding: 0 5px;
	font-weight: 600;
}
.up-item {
	cursor: pointer;
}
.up-item:hover {
	cursor: pointer;
	color: #238dfa;
}
.shuru {
	border-bottom: 1px solid #dcdfe6;
	cursor: pointer;
	color: #c0c4cc;
	line-height: 36px;
	height: 36px;
}
.aite {
	padding: 10px;
	font-size: 16px;
	cursor: pointer;
	width: 40px;
}
.aite:hover {
	color: #26a2ff;
}
.flow-item-start,
.flow-item {
	background-color: #ecf5ff;
	height: 60px;
	min-width: 280px;
	position: relative;
	margin-right: 40px;
	margin-top: 20px;
	padding: 0 10px;
	border-radius: 5px;
}
.flow-box {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	width: 230px;
	display: inline-block;
}
// .flow-item-start::after {
//   position: absolute;
//   content: '';
//   width: 0;
//   height: 0;
//   border-top: 18px solid transparent;
//   border-left: 20px solid #f4f6f9;
//   border-bottom: 18px solid transparent;
//   border-radius: 2px;
//   top: 0;
//   right: -20px;
// }
// .flow-item::before {
//   content: '';
//   position: absolute;
//   width: 0;
//   height: 0;
//   border-top: 18px solid transparent;
//   border-left: 20px solid #fff;
//   border-bottom: 18px solid transparent;
//   border-radius: 2px;
//   top: 0;
//   left: 0px;
// }
// .flow-item::after {
//   content: '';
//   position: absolute;
//   width: 0;
//   height: 0;
//   border-top: 18px solid transparent;
//   border-left: 20px solid #f4f6f9;
//   border-bottom: 18px solid transparent;
//   border-radius: 2px;
//   top: 0;
//   right: -20px;
// }
.el-icon-warning-outline {
	color: #848484;
	position: relative;
	top: 1px;
}
.flow-item-color {
	background-color: #409eff;
	color: #fff;
	.detailsPonit {
		color: #ffffff;
	}
	.el-icon-warning-outline {
		color: #ffffff;
	}
}
.detailsPonit {
	margin-left: 10px;
	font-size: 14px;
	color: #848484;
	cursor: pointer;
}
.flow-item-color::after {
	border-left: 20px solid #409eff;
}

.feedDoalog {
	::v-deep .el-dialog__body {
		padding: 0 20px 30px;
	}
}

.mentSty {
	max-width: 300px;
	height: 23px;
	display: inline-block;
}
// .button-width {
//   button {
//     width: 80px;
//   }
// }
.elFrom-margin {
	::v-deep .el-form-item__label {
		padding: 0;
	}
	padding: 0 20px 0 0;
}

.processSty {
	margin-top: -20px;
	.proListSty {
		border-bottom: 1px solid #e2e2e2;
		padding: 17px 0;
		.proButt {
			color: #4799ff;
			border: 1px solid #78a1ff;
			font-size: 14px;
			padding: 0px 10px;
			height: 30px;
		}
		.proName {
			font-size: 15px;
			line-height: 30px;
			padding-left: 8px;
		}
	}
}

.footer {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	background-color: #fff;
	border-top: 1px solid #e8e8e8;
	padding: 12px 30px;
	z-index: 100;
}
.dian {
	position: absolute;
	right: 10px;
}
</style>
