<template>
  <div class="taskfile_box">
    <van-nav-bar :title="title" :left-text="isHome? '首页':'返回'" @click-left="routeBack" class="headerbar no-down-icon" left-arrow>
      <template slot="right">
        <div style="padding:0 0.32rem;" @click="sheet_show = true"><van-icon name="ellipsis" v-if="The_current_account" /></div>
      </template>
    </van-nav-bar>

    <div class="body_com has_header">
      <scroller>
        <van-cell
          class="efficiency_list"
          size="large"
          :title="info.employee_name"
        >
          <template slot="icon">
            <userImage :user_name="info.employee_name" :img_url="info.img_url" width="1rem" height="1rem" style="margin-right: 0.12rem;"></userImage>
          </template>
          <template slot="label">
            <span v-if="info.dept_list.length > 0" v-for="(item, index) in info.dept_list" :key="index" class="sub-title">
                <em v-if="index > 0">，</em>
                {{ item.dept_name }}
              </span>
            <span v-else>暂无部门</span>
          </template>
          <template slot="default">
            <div style="float: right;text-align: center;padding:0 0.1rem;" v-if="info.status == 4" class="sub-title">
              <span class="point-span">{{ info.point_config.review_point }}</span>
              <div style="color: #909399;">最终分</div>
            </div>
            <div style="float: right;text-align: center;padding:0 0.1rem;">
              <span class="point-span">{{ `${info.point_config.base_point} ${info.pt_name}` }}</span>
            </div>
          </template>
        </van-cell>
        <van-cell-group
          :border="false"
          class="task_detail_group"
          v-if="info.review_status === 2"
        >
          <van-cell
            :border="false"
            title-class="align_self"
            value-class="align_self"
          >
            <template slot="title">
              <div class="time">
                <span>审批结果</span>
                <span class="timeExactly red">已拒绝</span>
              </div>
            </template>
          </van-cell>
          <van-cell
            :border="false"
            title-class="align_self"
            value-class="align_self"
          >
            <template slot="title">
              <div class="time">
                <span>驳回理由</span>
                <span class="timeExactly" style="white-space: pre-line;padding-left: 10px;">{{ info.review_remark }}</span>
              </div>
            </template>
          </van-cell>
        </van-cell-group>

        <van-row justify="space-around" class="item-title">
          <van-col span="6" >任务信息</van-col>
        </van-row>
        <van-cell-group
          :border="false"
          class="task_detail_group"
          inset
        >
          <van-cell
            title-class="align_self"
            value-class="align_self"
            :border="false"
            title="审批人"
            :value="info.reviewer_name"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            :border="false"
            title="发布人"
            :value="info.publisher_name"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            :border="false"
            title="任务积分"
            :value="`${info.point_config.base_point} ${info.pt_name || ''}`"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            :border="false"
            title="内容"
            :value="info.task_name"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            v-if="info.task_remark"
            :border="false"
            title="任务备注"
            :value="info.task_remark"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            :border="false"
            title="发布时间"
            :value="info.create_time"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            v-if="info.point_config.review_point"
            :border="false"
            title="最终分"
            :value="info.point_config.review_point"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            :border="false"
            title="截止时间"
          >
            <template slot="default">
              {{ info.expire_time }} <span style="padding-left: 10px;" class="red" v-show="info.expire_day > 0">逾期{{ info.expire_day }}天</span>
            </template>
          </van-cell>
          <van-cell
            title-class="align_self"
            value-class="align_self"
            v-if="info.point_config.timeout_deduction_point > 0"
            :border="false"
            title="逾期扣分"
            :value="`${info.point_config.timeout_deduction_point} B分/天`"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            v-if="info.point_config.ahead_award_point > 0"
            :border="false"
            title="提前奖分"
            :value="`${info.point_config.ahead_award_point} B分/天`"
          />
          <van-cell
            title-class="align_self"
            value-class="align_self"
            :border="false"
            v-if="info.task_file_list.length > 0"
          >
            <template #title>
              <div class="time">
                <span>任务图片</span>
                <span>
                  <van-image v-for="(items, index) in info.task_file_list" :key="index" @click="open_image(info.task_file_list)" width="45" height="45" radius="3" :src="items" />
                </span>
              </div>
            </template>
          </van-cell>





<!--          <van-cell :border="false">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>发布时间</span>-->
<!--                <span class="timeExactly">{{ info.create_time }}</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->
<!--          <van-cell :border="false">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>截止时间</span>-->
<!--                <span class="timeExactly">{{ info.expire_time }}</span>-->
<!--                <span style="padding-left: 10px;" class="red" v-show="info.expire_day > 0">逾期{{ info.expire_day }}天</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->
<!--          <van-cell v-if="info.point_config.ahead_award_point * 1 > 0" :border="false">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>提前奖分</span>-->
<!--                <span class="timeExactly">{{ info.point_config.ahead_award_point }}分/天</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->
<!--          <van-cell v-if="info.point_config.timeout_deduction_point * 1 > 0" :border="false">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>逾期扣分</span>-->
<!--                <span class="timeExactly">{{ info.point_config.timeout_deduction_point }}分/天</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->
<!--          <van-cell :border="false">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>任务备注</span>-->
<!--                <span class="timeExactly" style="white-space: pre-line;">{{ info.task_remark }}</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->

<!--          <van-cell :border="false">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>审批人</span>-->
<!--                <span class="timeExactly">{{ info.reviewer_name }}</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->
<!--          <van-cell :border="false" v-if="info.review_remark">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>审批意见</span>-->
<!--                <span class="timeExactly" style="white-space: pre-line;">{{ info.review_remark }}</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->

<!--          <van-cell :border="false">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>发布人</span>-->
<!--                <span class="timeExactly">{{ info.publisher_name }}</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->

<!--          <van-cell :border="false">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>积分种类</span>-->
<!--                <span class="timeExactly">{{ info.pt_name }}</span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->

<!--          <van-cell :border="false" v-if="info.task_file_list.length != 0">-->
<!--            <template slot="title">-->
<!--              <div class="time">-->
<!--                <span>任务图片</span>-->
<!--                <span>-->
<!--                  <van-image v-for="(items, index) in info.task_file_list" :key="index" @click="open_image(info.task_file_list)" width="45" height="45" radius="3" :src="items" />-->
<!--                </span>-->
<!--              </div>-->
<!--            </template>-->
<!--          </van-cell>-->
        </van-cell-group>



        <template v-if="info.item_info">
          <van-row justify="space-around" class="item-title">
            <van-col span="6" >规则依据</van-col>
          </van-row>
          <van-cell-group
            :border="false"
            class="task_detail_group"
            inset
          >
            <van-cell
              title-class="align_self"
              value-class="align_self"
              :border="false"
              title="规则"
              :value="info.item_info.remark"
            />
            <van-cell
              title-class="align_self"
              value-class="align_self"
              :border="false"
              title="积分"
              :value="pointRemark"
            />
            <van-cell
              title-class="align_self"
              value-class="align_self"
              v-if="info.item_info.has_delete"
              :border="false"
              title="规则状态"
            >
              <template slot="default">
                <van-tag type="warning">规则已删除</van-tag>
              </template>
            </van-cell>
            <van-cell
              title-class="align_self"
              value-class="align_self"
              v-if="info.rule_info"
              :border="false"
              title="分类"
              :value="info.rule_info.name"
            />
            <van-cell
              title-class="align_self"
              value-class="align_self"
              v-if="info.rule_info && info.rule_info.has_delete"
              :border="false"
              title="分类状态"
            >
              <template slot="default">
                <van-tag type="warning">分类已删除</van-tag>
              </template>
            </van-cell>
          </van-cell-group>
        </template>

        <template v-else-if="info.rule_info">
          <van-row justify="space-around" class="item-title">
            <van-col span="6" >分类依据</van-col>
          </van-row>
          <van-cell-group
            :border="false"
            class="task_detail_group"
            inset
          >
            <van-cell
              title-class="align_self"
              value-class="align_self"
              :border="false"
              title="分类"
              :value="info.rule_info.name"
            />
            <van-cell
              title-class="align_self"
              value-class="align_self"
              v-if="info.rule_info.has_delete"
              :border="false"
              title="分类状态"
            >
              <template slot="default">
                <van-tag type="warning">分类已删除</van-tag>
              </template>
            </van-cell>
          </van-cell-group>
        </template>

        <van-cell-group
          class="point"
          v-if="info.point_config.standard && info.point_config.standard.super_satisfied * 1 > 0"
          inset
        >
          <van-cell
            title-class="align_self"
            value-class="align_self"
            v-if="info.point_config.standard"
            title="评分标准"
          >
            <template slot="label">
              <van-grid slot="label" :border="false">
                <van-grid-item text="超预期">
                  <template slot="icon">
                    {{ info.point_config.standard.super_satisfied }}
                  </template>
                </van-grid-item>
                <van-grid-item text="满意">
                  <template slot="icon">
                    {{ info.point_config.standard.satisfied }}
                  </template>
                </van-grid-item>
                <van-grid-item text="合格">
                  <template slot="icon">
                    {{ info.point_config.standard.qualified }}
                  </template>
                </van-grid-item>
                <van-grid-item text="不合格">
                  <template slot="icon">
                    {{ info.point_config.standard.unqualified }}
                  </template>
                </van-grid-item>
              </van-grid>
            </template>
          </van-cell>
        </van-cell-group>

        <van-panel
          class="schedule"
          @click="info.employee_id == $userInfo().id && info.status == 1 ? $router.push({ name: 'process', query: { work_id: info.id, progress: info.progress } }) : null"
          style="margin: 0.2rem 0;"
          title="任务进度"
          :status="info.employee_id == $userInfo().id && info.status == 1 && info.progress != 100 ? '更新进度' : ''"
        >
          <div slot="default">
            <van-slider class="task_slider" v-model="info.progress" active-color="#ee0a24" bar-height="0.2rem" disabled style="opacity:1">
              <template slot="button">
                <div class="custom-button" :class="info.progress == '0' ? 'custom-button-left' : info.progress == '100' ? 'custom-button-right' : ''">{{ info.progress }}%</div>
              </template>
            </van-slider>
          </div>
        </van-panel>

        <div class="task">
          <van-row>
            <van-col span="16">
              <van-tabs v-model="active">
                <van-tab title="任务记录"></van-tab>
                <van-tab title="记分记录"></van-tab>
              </van-tabs>
            </van-col>
            <van-col span="8" style="background:#fff;border-bottom:0.02rem #efefef solid;">
              <div v-if="active === 0 && canUpdate" @click="remberOne" class="rember">+记一条</div>
              <div v-if="active !== 0 && isShowJf" @click="noteone" class="rember">记分</div>
            </van-col>
          </van-row>
          <div ref="scoringNotice" style="clear: both;">
            <van-notice-bar v-if="active != 0 && info.employee_id != $userInfo().id && info.status < 3 && novice" wrapable mode="closeable" @close="closeNotice">
              记分不会立即生效，评审时可根据此记录打分
            </van-notice-bar>
          </div>

          <van-cell-group
            v-if="info.process !== null && info.process.list !== null"
            v-for="(item, index) in info.process.list"
            :key="'record' + index"
            v-show="active == 0 && item.point == 0"
            :border="false"
          >
            <div class="task_record_list clear">
              <van-image
                class="fl"
                :src="item.img_url ? item.img_url : 'static/images/defalut_custmer_headicon.png'"
                round
                width="46px"
                height="46px"
                style="margin-right: 0.12rem;"
                type="contain"
              />
              <span class="fr" style=" width: 72vw;">
                <div class="clear">
                  <span class="fl" style="color:#606266;font-size: 16px;">{{ item.recorder }}</span>
                  <span class="fr" style="color: #909399;font-size: 14px;">{{ item.time }}</span>
                </div>
                <div style="margin: 0.2rem 0;word-break: break-all;">{{ item.remark }}</div>
              </span>

              <van-icon v-if="active == 0 && item.recorder_id == $userInfo().id"
                name="delete"
                color="#909399"
                style="float: right; position: absolute;right: 0.1rem;bottom: 0.1rem;"
                size="0.5rem"
                @click="delItem(index, 'work')"
              />
            </div>
          </van-cell-group>


          <van-cell-group style="background: none;" v-show="active == 0 && text_list.length == 0">
            <noTask src="static/images/noTask.png" detail_text="还没有任务记录去记一条吧" />
          </van-cell-group>

          <van-cell-group
            v-if="info.process !== null && info.process.list !== null"
            v-for="(item, index) in info.process.list"
            :key="'point' + index"
            v-show="info.process.list !== null && active != 0 && item.point != 0"
            :border="false"
          >
            <div style="color:#FFCC00;padding: 0.16rem 0 0 0.32rem;" v-if="index == 0">
              合计
              <template v-if="point_total > 0">
                +{{ point_total }}
              </template>
              <template v-if="point_total <= 0">
                {{ point_total }}
              </template>
            </div>

            <van-cell label-class="changsize" :title="item.recorder">
              <template slot="icon">
                <van-image
                  :src="item.img_url ? item.img_url : 'static/images/defalut_custmer_headicon.png'"
                  round
                  width="46px"
                  height="46px"
                  style="margin-right: 0.12rem;"
                  type="contain"
                />
              </template>
              <template slot="label">
                <div class="right_time">{{ item.time }}</div>
                <div v-if="item.point * 1 > 0" class="red">+{{ item.point }}</div>
                <div v-if="item.point * 1 < 0" class="green">{{ item.point }}</div>
                <div style="margin: 0.2rem 0;word-break: break-all;">{{ item.remark }}</div>
                <div v-if="active != 0 && item.recorder_id == $userInfo().id">
                  <van-icon name="delete" color="#909399" style="float: right;" size="0.5rem" @click="delItem(index, 'point')" />
                </div>
              </template>
            </van-cell>
          </van-cell-group>

          <van-cell-group style="background: none;" v-show="active != 0 && point_list.length == 0">
            <noTask src="static/images/noTask.png" detail_text="还没有记分记录去记一条吧" />
          </van-cell-group>
        </div>

        <div v-if="text_list.length != 0 || point_list.length != 0" style="height: 2rem;"></div>
      </scroller>

      <van-image-preview v-model="show" :images="imageSrc"></van-image-preview>
      <div style="padding:0.32rem;width: 90%;position: fixed;bottom: 0;" v-if="info.reviewer_id == $userInfo().id && info.status == 2&&!isShowSp">
        <van-button block type="info" @click="go_approval">去审批</van-button>
      </div>
      <div style="padding:0.4rem;width: 90%;position: fixed;bottom: 0; background-color: white;" v-if="canUpdate&&!isShowSp">
        <van-button block type="info" @click="complete_task(info)">完成</van-button>
      </div>
    </div>
    <van-action-sheet v-model="sheet_show" :actions="actions" @select="sheet_select" cancel-text="取消" close-on-click-action @cancel="sheet_show = false" />
  </div>
</template>
<script>

import Vue from 'vue'
import noTask from '@/components/noTask'
import { Image, Panel, Tab, Tabs, Progress, Slider, ImagePreview, Col, Row, ActionSheet, NoticeBar } from 'vant'
Vue.use(Image)
  .use(Panel)
  .use(Tab)
  .use(Tabs)
  .use(Progress)
  .use(Slider)
  .use(ImagePreview)
  .use(Col)
  .use(Row)
  .use(ActionSheet)
  .use(NoticeBar)
export default {
  components: { noTask},
  // 数据
  data () {
    return {
      userInfo:this.$userInfo(),
      The_current_account: false,
      active: 0,
      numberslider: 0,
      active1: 'running',
      title: '任务详情',
      filter: {
        page: 1,
        type: 'all',
        status: 'waiting'
      },
      info: {
        date: 0,
        employee_id: 0,
        employee_name: '',
        expire_time: '',
        id: 0,
        dept_list: [],
        month: 0,
        performance_data: [],
        point_config: {},
        process: [],
        progress: 0,
        pt_id: 0,
        pt_name: '',
        publisher_id: 0,
        publisher_name: '',
        reviewer_id: 0,
        reviewer_name: '',
        source_type: 0,
        source_type_mark: '',
        status: 0,
        status_mark: '',
        task_file_list: [],
        task_name: '',
        task_remark: '',
        rule_id:0,
        rule_info:{},
        item_id:0,
        item_info:{}
      },
      process: [],
      checked: false,
      point_total: 0,
      point_list: [],
      text_list: [],
      types_list: {},
      imageSrc: [],
      show: false,
      sheet_show: false,
      actions: [],
      novice: false,
      isShowSp:false,

      isShowJf:false,//是否显示记分
      isHome:false,//微信信息点击进来

    }
  },
  created () {
    if (this.$route.query.task_id) {
      this.info.id = this.$route.query.task_id
      this.isShowSp = this.$route.query.isShowSp
      this.get_point_types()
    }
    if(this.$route.query.isHome){
       this.isHome = true;
    }else{
      this.isHome = false;
    }
  },
  activated() {
  	if (this.$route.query.task_id) {
      this.info.id = this.$route.query.task_id
  	  this.getList()
  	}
    if(this.$route.query.isHome){
       this.isHome = true;
    }else{
      this.isHome = false;
    }
  },
  methods: {
    routeBack(){
      this.isHome? this.$router.replace({ name: 'home' }):this.$route_back();
    },

    // 完成任务
    complete_task (item) {
      this.$router.push({ name: 'process', query: { work_id: item.id, progress: 100 } })
    },

    getLocalStorage () {
      if (!localStorage.getItem('taskFileNotice') || (window.plus && !plus.storage.getItem('taskFileNotice'))) {
        this.novice = true
      } else {
        this.novice = false
      }
    },
    closeNotice () {
      window.plus ? plus.storage.setItem('taskFileNotice') : localStorage.setItem('taskFileNotice', true)
      this.getLocalStorage()
    },

    sheet_select (action, index) {
      if (action.name == '更新任务') {
        if (this.$route.query.isJx) {
          // 编辑 从上一个页面传过来一些参数
          this.$router.push({
            name: 'compile_efficiency',
            query: {
              info: JSON.stringify(this.info),
              base_point: this.$route.query.base_point,
              surplus: this.$route.query.surplus
            }
          })
        } else {
          this.$router.push({name:'WorkEdit',params:{workId:this.$route.query.task_id.toString()}})
          // this.$router.push({ name: 'compile_task', query: { info: JSON.stringify(this.info) } })
        }
      }
      if (action.name == '撤销任务') {
        this.$dialog
          .confirm({
            title: '撤销任务',
            message: '任务撤销后将不可恢复，确认撤销吗？'
          })
          .then(() => {
            this.delete_task(0)
          })
      }
      if (action.name == '删除任务') {
        this.$dialog
          .confirm({
            title: '删除任务',
            message: '删除此任务将会删除其相关记录和积分数据，确认删除吗？'
          })
          .then(() => {
            this.delete_task(1)
          })
      }
    },
    // 撤销任务---删除任务
    delete_task (e) {
      this.$toast.loading({
        loadingType: 'spinner',
        message: '正在处理'
      })
      this.$axiosUser(
        e == 0 ? 'post' : 'DELETE',
        e == 0 ? '/api/pro/integral/work' : '/api/pro/integral/work',
        e == 0 ? { work_id: this.info.id, status: 'refuse' } : { work_id: this.info.id }
      ).then(res => {
        this.$route_back()
      })
    },
    open_image (index) {
      this.imageSrc = index
      this.show = true
    },
    get_point_types () {
      var types = this.$getTypes
      for (let i in types) {
        this.types_list[types[i].id] = types[i].name
      }
    },
    go_approval () {
      if (this.info.pt_id == 1) { // 如果是绩效类型
        this.$router.push({ name: 'performanceAudit', query: { review_id: this.info.review_id, task_id: this.$route.query.task_id } })
      } else {
        this.$router.push({ name: 'integralAudit', query: { review_id: this.info.review_id } })
      }
    },
    noteone () {
      if (this.info.process.list) {
        localStorage.setItem('task_process_array', JSON.stringify(this.info.process.list))
      } else {
        localStorage.setItem('task_process_array', JSON.stringify([]))
      }
      this.$router.push({ name: 'integral_noteone', query: { work_id: this.info.id, employee_name: this.info.employee_name } })
    },
    remberOne () {
      if (this.info.process.list) {
        localStorage.setItem('task_process_array', JSON.stringify(this.info.process.list))
      } else {
        localStorage.setItem('task_process_array', JSON.stringify([]))
      }
      this.$router.push({ name: 'remberOne', query: { work_id: this.info.id } })
    },
    showLoading () {
      this.$toast.loading({
        loadingType: 'spinner',
        message: '正在处理'
      })
    },

    // 判断当前账号与发布工作者是否同一人；
    current_none (data) {
      // APP PC 兼容写法(如果下方无效 用这个)
      var userInfo = this.$userInfo()
      if (data.publisher_id == userInfo.id) {
        this.The_current_account = true
      } else {
        this.The_current_account = false
      }
      this.actions = []
      // 这里比较复杂，因为团队绩效的工作详情跟我的发布的工作详情都调用这个页面
      if (data.status == 1) {
        if (data.pt_id != 1) {
          this.actions.push({ name: '更新任务' })
          this.actions.push({ name: '删除任务' })
        } else if (data.pt_id == 1 && this.$route.query.isJx) {
          this.actions.push({ name: '更新任务' })
          this.actions.push({ name: '删除任务' })
        } else {
          this.actions.push({ name: '删除任务' })
        }
      } else {
        this.actions.push({ name: '删除任务' })
      }
    },
    keepTheScore(data){
      if(![1,2,6].includes(data.status)){
        return false
      }
      if(this.userInfo.id === data.reviewer_id){
        return true
      }
      let info=this.$getEmployeeMapItem(data.employee_id)
      if(info){
        return info.employee_detail.superior_list.some(x =>{
          if(this.userInfo.id === x.id){
            return true
          }
        })
      }
    },
    getList () {
      this.showLoading()
      this.$axiosUser('get', '/api/pro/integral/work', { work_id: this.info.id }).then(res => {
          this.current_none(res.data.data) // 传入当前任务的信息，包含发布者
          this.info = res.data.data;
          this.isShowJf=this.keepTheScore(res.data.data);
          let text_list = []
          let point_list = []
          this.point_total = 0
          if (this.info.process.list && this.info.process.list.length > 0) {
            for (let i in this.info.process.list) {
              this.point_total += this.info.process.list[i].point * 1
              if (this.info.process.list[i].point != 0) {
                point_list.push(this.info.process.list[i])
              } else {
                text_list.push(this.info.process.list[i])
              }
            }
          }
          this.text_list = text_list
          this.point_list = point_list
      }).finally(()=>{
        this.$toast.clear()
      })
    },
    delItem (index, type) {
      let self = this
      this.$dialog
        .confirm({
          title: '提示',
          message: '确定永久删除此项?'
        })
        .then(() => {
          let data = {
            work_id: this.info.id,
            process: JSON.parse(JSON.stringify(this.info.process.list))||'[]'
          }
          data.process.splice(index, 1)
          if(data.process.length==0){
            data.process='[]'
          }
          this.$axiosUser('post', '/api/pro/integral/work', data)
            .then(res => {
              if (res.data.code == 1) {
                self.info.process.list.splice(index, 1)
                self.getTotalData()
              } else {
                self.$toast(res.data.msg)
              }
            })
            .catch(e => {
              self.$toast.clear()
            })
        })
    },
    getTotalData () {
      let self = this
      this.$axiosUser('get', '/api/pro/integral/work', { work_id: self.info.id }).then(res => {
        if (res.data.code == '1') {
          const info = res.data.data
          if (info.process !== null) {
            self.point_total = info.process.total
          }
        }
      })
    }
  },
  computed:{
    canUpdate(){
      return this.info.employee_id === this.userInfo.id && [1,6].includes(this.info.status)
    },
    pointRemark(){
      if (!(this.info && this.info.item_info)) return ''
      return this.info.item_info.range_type === 1 ? `${this.info.item_info.min_point} ${this.$getTypesName(this.info.item_info.pt_id)}` : `${this.info.item_info.min_point} -- ${this.info.item_info.max_point} ${this.$getTypesName(this.info.item_info.pt_id)}`
    }
  },
  mounted () {
    this.getLocalStorage()
  },
}
</script>
<style rel="stylesheet/less" lang="less" scoped>
.body_com {
  height: calc(100% - 1rem);
  position: relative;
}
.add_btn {
  background-color: #26a2ff;
  border-radius: 50%;
  width: 1.12rem;
  height: 1.12rem;
  position: fixed;
  right: 0.48rem;
  bottom: 1.04rem;
  text-align: center;
  .van-icon {
    line-height: 1.12rem;
  }
}
.van-cell__value {
  text-align: right;
}
.time {
  color: #909399;
  font-size: 0.28rem;
  display: flex;
  span {
    display: table-cell;
    vertical-align: middle;
    word-wrap: break-word;
    word-break: break-all;
    white-space: nowrap;
    font-size: inherit;
  }
  .van-image {
    border: 1px #ccc solid;
    margin-left: 0.2rem;
  }
}
.timeExactly {
  color: #303133;
  padding-left: 0.16rem;
  font-size: 0.28rem;
}
.date {
  color: #303133;
  font-size: 18px;
}
.van-panel__header-value {
  color: #26a2ff;
  font-size: 0.28rem;
}
.van-progress {
  width: 100%;
  margin: 0 auto;
}
.van-tabs__line {
  background-color: #26a2ff;
}
.changsize {
  font-size: 0.32rem;
  color: #303133;
  word-break: break-all;
}
.rember {
  font-size: 0.28rem;
  height: 1rem;
  line-height: 1rem;
  color: #26a2ff;
  float: right;
  padding-right: 0.32rem;
}
.taskfile_box /deep/ .efficiency_list .van-cell__value .team_info {
  display: table-cell;
  text-align: left;
  padding-left: 0.12rem;
}
/deep/ .efficiency_list .van-cell__value .team_record {
  display: table-cell;
  text-align: right;
}
.taskfile_box .team {
  padding: 0.1rem 0 0.2rem;
}
.taskfile_box .head_title {
  color: #303133;
  padding: 0.24rem 0.32rem 0rem 0.24rem;
}
.taskfile_box .head_title:after {
  border: none;
}
.taskfile_box .schedule /deep/ .van-progress {
  margin: 0.24rem auto;
  font-size: 0.28rem;
}
.taskfile_box .review /deep/ .van-cell__title span {
  line-height: 0.8rem;
}
.taskfile_box .task {
  margin: 0.24rem 0;
}
.taskfile_box .task /deep/ .van-tabs__wrap {
  height: 1rem;
  line-height: 1rem;
}
.taskfile_box .task /deep/ .van-col {
  height: 1rem;
  line-height: 1rem;
}
.taskfile_box .task /deep/ .van-row .van-col .van-ellipsis {
  width: 2rem;
  line-height: 1rem;
}
.taskfile_box .task /deep/ .van-row .van-col .van-ellipsis .van-tab__text {
  font-size: 0.32rem;
}
.taskfile_box .task /deep/ .van-tabs__line {
  width: 2rem !important;
}
.taskfile_box .task /deep/ .van-cell__title {
  position: relative;
}
.taskfile_box .task .right_time {
  float: right;
  position: absolute;
  top: 0;
  right: 0;
  color: #999;
}
.taskfile_box .point /deep/ .van-grid {
  margin: 0.32rem 0rem;
}
.taskfile_box .point /deep/ .van-grid .van-grid-item .van-grid-item__content {
  margin: 0;
  padding: 0;
  border-right: 0.02rem #efefef solid;
}
.taskfile_box .point /deep/ .van-grid .van-grid-item:nth-last-child(1) .van-grid-item__content {
  border-right: none;
}
.taskfile_box .schedule /deep/ .van-panel__header:after {
  border-bottom: none;
}
.van-panel__content {
  padding: 0 0.32rem 0.5rem;
}
.taskfile_box .task_slider {
  position: relative;
  display: inline-block;
}
.taskfile_box .task_slider /deep/ .van-slider__bar {
  // background-image: linear-gradient(45deg,#4ECFFF, #26A2FF) !important;
  background-color: #26a2ff !important;
}
.taskfile_box .task_slider /deep/ .van-slider__bar .custom-button {
  width: 1rem;
  margin-top: 0.4rem;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  background: #26a2ff;
  border-radius: 100px;
}
.taskfile_box .task_slider /deep/ .van-slider__bar .custom-button-left {
  margin-top: 0;
  margin-left: 1rem;
}
.taskfile_box .task_slider /deep/ .van-slider__bar .custom-button-right {
  margin-top: 0;
  margin-right: 1rem;
}
.taskfile_box .task_slider /deep/ .van-slider__bar .custom-button-font {
  font-size: 0.26rem;
  text-align: center;
  color: #323233;
  padding: 0.3rem 1.4rem 0 0;
}
.taskfile_box .task_slider /deep/ .van-slider__bar .custom-button-font-show {
  display: block;
}
.taskfile_box .task_slider /deep/ .van-slider__bar .custom-button-font-hide {
  display: none;
}
/deep/ .van-grid-item__icon-wrapper {
  font-size: 0.4rem;
  color: #323233;
  font-weight: normal;
  line-height: 0.5rem;
}
/deep/ .van-grid-item__text {
  font-size: 0.28rem;
  color: rgb(144, 147, 153);
  font-size: 0.24rem;
}
.point-span {
  font-size: 0.36rem;
  color: #646566;
}
.task_detail_group .van-cell {
  padding: 0.1rem 0.32rem 0.1rem;
}
.task_detail_group .name {
  padding-bottom: 0.2rem;
}
.task_detail_group {
  padding: 0.16rem 0;
}
.task_record_list {
  padding: 0.24rem 0.32rem 0.32rem;
  font-size: 0.32rem;
  position: relative;
}
.reviewer_info_title {
  padding-left: 0.32rem;
  padding-top: 0.2rem;
  position: relative;
  // border-bottom: 1px #ebedf0 solid;
  &&::after {
    position: absolute;
    box-sizing: border-box;
    content: ' ';
    pointer-events: none;
    top: -50%;
    right: -50%;
    bottom: -50%;
    left: -50%;
    border: 0 solid #ebedf0;
    -webkit-transform: scale(0.5);
    transform: scale(0.5);
  }
}
.reviewer_info {
  line-height: 0.8rem;
  span {
    color: chocolate;
    margin-left: 0.2rem;
  }
}
.company_dept_img {
  width: 1.4rem;
  height: 1.4rem;
}
[class*='van-hairline']::after {
  position: absolute;
  box-sizing: border-box;
  content: ' ';
  pointer-events: none;
  top: -50%;
  right: -50%;
  bottom: -50%;
  left: -50%;
  border: none;
  -webkit-transform: scale(0.5);
  transform: scale(0.5);
}
.item-title{
  text-align: center;
  margin-top: 10px;
  font-size: 0.25rem;
  line-height: 0.5rem;
  color: #969799;
}
.sub-title{
  font-size: 0.25rem;
  line-height: 0.25rem;
  color: #969799;
}
.align_self{
  align-self: center;
}
</style>
