<template>
  <div>
    <div class="topbar">
      <div class="topbar_left">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-fanhui"></use>
        </svg>
      </div>
      <div class="topbar_middle">
        任务
      </div>
      <div class="topbar_right">
        <!-- <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-caidan"></use>
        </svg> -->
      </div>
    </div>

    <div class="taskview_toparea" :class="colortop">
      <div class="taskview_top_type">设备维修</div>
      <div class="taskview_top_flag">{{taskflag_dt}}</div>
    </div>
    <div class="taskview_toparea_sec" :class="colortop_sec"></div>
    <div class="taskview_toparea_thr" :class="colortop_thr"></div>

    <div class="taskview">

      <div class="taskview_main">
        <div class="taskview_flex">
          <div class="taskview_title">设备编号</div>
          <div class="taskview_item">572-102</div>
        </div>
        <div class="taskview_flex">
          <div class="taskview_title">设备名称</div>
          <div class="taskview_item">2#气密机</div>
        </div>
        <div class="taskview_flex">
          <div class="taskview_title">报修人</div>
          <div class="taskview_item">王大力</div>
        </div>

        <div class="taskview_flex">
          <div class="taskview_title">报修时间</div>
          <div class="taskview_item">2019/10/25 15:23</div>
        </div>

        <div class="taskview_flex">
          <div class="taskview_title">报修项目</div>
          <div class="taskview_item">
            <div>指示灯异常</div>
            <div>机器运转有异响</div>
          </div>
        </div>


        <div class="taskview_flex">
          <div class="taskview_title">备注</div>
          <div class="taskview_item">设备启动时发出咔咔吱吱呜呜哔哔的声音，明明绿灯转眼变成红灯。</div>
        </div>

        <!-- 附件图片，直接显示缩略图 -->
        <div style="display:flex;margin:10px 0 0 20px;" v-if="tasktype==2">
          <div>
            <img src="../assets/taskview_01.jpeg"
              style="height: 60px;box-shadow: 0 2px 3px rgba(0, 0, 0, 0.302);"></img>
          </div>

          <div style="margin-left:10px">
            <img src="../assets/taskview_02.jpg" style="height: 60px;box-shadow: 0 2px 3px rgba(0, 0, 0, 0.302);"></img>
          </div>
        </div>


        <div class="liubai_dt"></div>


        <div class="taskview_flex">
          <div class="taskview_title">负责人</div>
          <div class="taskview_item">李四<span style="margin-left:20px;color:#6495ed"> <svg class="icon"
                aria-hidden="true">
                <use xlink:href="#icon-dianhua"></use>
              </svg>13600136000</span></div>
        </div>


        <div class="taskview_flex" v-if="taskflag_dt!='待接收'">
          <div class="taskview_title">接收时间</div>
          <div class="taskview_item">2019/10/25 15:27</div>
        </div>

        <div class="taskview_flex" v-if="taskflag_dt!='待接收'&&taskflag_dt!='待开工'">
          <div class="taskview_title">开工时间</div>
          <div class="taskview_item">2019/10/25 15:32</div>
        </div>

        <div class="taskview_flex" v-if="taskflag_dt=='待验收'||taskflag_dt=='完工'">
          <div class="taskview_title">完工时间</div>
          <div class="taskview_item">2019/10/25 15:50</div>
        </div>


        <div class="taskview_flex" v-if="taskflag_dt=='待验收'||taskflag_dt=='完工'">
          <div class="taskview_title">维修项目</div>
          <div class="taskview_item">
            <div>指示灯异常</div>
            <div>机器运转有异响</div>
          </div>
        </div>


        <div class="taskview_flex" v-if="taskflag_dt=='待验收'||taskflag_dt=='完工'">
          <div class="taskview_title">维修备注</div>
          <div class="taskview_item">线路接触不良，已作紧固处理</div>
        </div>


        <!-- 完工状态下才显示验收评价信息 -->
        <div v-if="taskflag_dt=='完工'">
          <div class="liubai_dt"></div>


          <div class="taskview_flex">
            <div class="taskview_title">验收时间</div>
            <div class="taskview_item">2019/10/25 15:58</div>
          </div>

          <div class="taskview_flex">
            <div class="taskview_title">评分</div>
            <div class="taskview_item" style="font-size:22px;">
              <svg class="icon" aria-hidden="true">
                <use xlink:href="#icon-xing1"></use>
              </svg>
              <svg class="icon" aria-hidden="true">
                <use xlink:href="#icon-xing1"></use>
              </svg>
              <svg class="icon" aria-hidden="true">
                <use xlink:href="#icon-xing1"></use>
              </svg>
              <svg class="icon" aria-hidden="true">
                <use xlink:href="#icon-xing"></use>
              </svg>
              <svg class="icon" aria-hidden="true">
                <use xlink:href="#icon-xing"></use>
              </svg>
            </div>
          </div>

          <div class="taskview_flex">
            <div class="taskview_title">评语</div>
            <div class="taskview_item">不及时赶赴现场,业务不熟练</div>
          </div>
        </div>
      </div>

    </div>

    <div class="quote_edit_btn_wrap" v-if="taskflag_dt!='完工'">

      <div class="quote_edit_btn" v-if="taskflag_dt!='待验收'">
        <span v-if="taskflag_dt=='待接收'">接收</span>
        <span v-if="taskflag_dt=='待开工'">开工</span>
        <span v-if="taskflag_dt=='维修中'">完成</span>
      </div>

      <!-- 待验收状态下，底部按钮是两个：【返工】|【验收】 -->
      <div class="quote_edit_btn" style="background-color: #ffb732" v-if="taskflag_dt=='待验收'">
        返工
      </div>
      <div class="quote_edit_btn" v-if="taskflag_dt=='待验收'">
        验收
      </div>
    </div>

    <!-- 完成任务、验收任务弹出界面 -->
    <div v-if="ifresponse>0">
      <div class="taskview_mask"></div>

      <div :class="response_height" class="taskview_response">
        <div style="display:flex;align-items: center;">
          <div style="font-size:15px;padding:0 20px;color:#888">
            <span v-if="ifresponse==2">任务验收</span>
            <span v-if="ifresponse==1">完成任务</span>
          </div>

          <div style="position: absolute;right: 20px;color: #ccc;font-size: 12px;">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-guanbi"></use>
            </svg>
          </div>
        </div>

        <!-- 评价星级 -->
        <div class="taskview_flex" style="margin-top:15px;" v-if="ifresponse==2">
          <div class="taskview_title">评分</div>
          <div class="taskview_item" style="font-size:22px;">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-xing1"></use>
            </svg>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-xing1"></use>
            </svg>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-xing1"></use>
            </svg>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-xing"></use>
            </svg>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-xing"></use>
            </svg>
          </div>
        </div>
        <!-- 评价任务时选择标签 -->
        <div v-if="ifresponse == 2">
          <div style="margin:10px 20px">请选择标签</div>
          <div style="display:flex;margin:10px 20px;align-items: center;">
            <div class="tip_check">不及时赶赴现场</div>
            <div style="margin-left:20px;" class="tip_nocheck">工作态度不好</div>
          </div>
          <div style="display:flex;margin:10px 20px;align-items: center;">
            <div class="tip_nocheck">维修时间太长</div>
            <div style="margin-left:20px;" class="tip_check">业务不熟练</div>
          </div>
        </div>

        <!-- 完成任务时选择维修项目 -->
        <div style="margin-top:10px;padding: 0px 20px;" v-if="ifresponse == 1">
          <div style="font-size:16px;font-weight:bold">维修项目</div>
          <div style="margin-top:0px">

            <div class="finishitem">指示灯异常
              <span style="position: absolute;right: 30px;color:#999;font-size:12px">
                <svg class="icon" aria-hidden="true">
                  <use xlink:href="#icon-guanbi"></use>
                </svg>
              </span>
            </div>

            <div class="finishitem">机器运转有异响
              <span style="position: absolute;right: 30px;color:#999;font-size:12px">
                <svg class="icon" aria-hidden="true">
                  <use xlink:href="#icon-guanbi"></use>
                </svg>
              </span>
            </div>

            <div style="color:#aaa;margin:10px 0 ">
              <span style="color:#999;font-size:15px">
                <svg class="icon" aria-hidden="true">
                  <use xlink:href="#icon-shuliangjia1"></use>
                </svg>
              </span>增加维修项目

            </div>
          </div>
        </div>

        <!-- 评语 或 汇报 录入 -->
        <div style="width: 100%;text-align: center;">
          <textarea name="banreason" rows="5" placeholder="其它意见和建议" style="width: 90%;font-size: 15px;margin: 10px;"
            v-if="ifresponse==2">
            </textarea>

          <textarea name="banreason" rows="5" placeholder="可录入维修情况" style="width: 90%;font-size: 15px;margin: 10px;"
            v-if="ifresponse==1">
            </textarea>

        </div>


        <!-- 提交按钮 -->
        <div class="quote_edit_btn_wrap">
          <div class="quote_edit_btn">
            <span v-if="ifresponse==2">验收</span>
            <span v-if="ifresponse==1">完成</span>
          </div>
        </div>

      </div>
    </div>



  </div>
</template>
<script>
  export default {
    name: 'taskview',
    data() {
      return {
        taskflag_dt: "完工", //待接收,待开工,维修中,待验收,完工
        ifresponse: 0, //弹窗 0：不弹  1：完工界面 2：验收任务界面
      }
    },
    computed: {
      colortop: function () {
        return {
          taskview_toparea_red: this.taskflag_dt == "待接收" || this.taskflag_dt == "待开工",
          taskview_toparea_green: this.taskflag_dt == "维修中" || this.taskflag_dt == "待验收",
          taskview_toparea_blue: this.taskflag_dt == "完工"
        };
      },
      colortop_sec: function () {
        return {
          taskview_toparea_red_sec: this.taskflag_dt == "待接收" || this.taskflag_dt == "待开工",
          taskview_toparea_green_sec: this.taskflag_dt == "维修中" || this.taskflag_dt == "待验收",
          taskview_toparea_blue_sec: this.taskflag_dt == "完工"
        };
      },
      colortop_thr: function () {
        return {
          taskview_toparea_red_thr: this.taskflag_dt == "待接收" || this.taskflag_dt == "待开工",
          taskview_toparea_green_thr: this.taskflag_dt == "维修中" || this.taskflag_dt == "待验收",
          taskview_toparea_blue_thr: this.taskflag_dt == "完工"
        };
      },
      response_height: function () {
        return {
          response_height_1: this.ifresponse == 1,
          response_height_2: this.ifresponse == 2
        };
      }
    }

  }

</script>
<style>
  body {
    margin: 0;
    padding: 0;
    background-color: #fff;
    font-family: "微软雅黑";
    font-size: 14px;
  }

  .taskview_iffg {
    background-color: #fdd1cd;
    color: #ff6f61;
    font-size: 12px;
    margin: 0 4px 0 0;
    padding: 3px 8px;
    border-radius: 15px;
    text-align: center;
  }

  .response_height_1 {
    height: 370px;
  }

  .response_height_2 {
    height: 370px;
  }

  .taskview_mask {
    height: 100%;
    width: 100%;
    background-color: #1d1d1d;
    opacity: 0.8;
    position: fixed;
    top: 0px;
    z-index: 9998;
  }

  .taskview_response {
    z-index: 9999;
    background-color: #ffffff;
    position: fixed;
    bottom: 0px;
    /* height: 330px; */
    width: 100%;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    padding: 10px 0;
  }

  .topbar {
    min-height: 44px;
    border-bottom: 1px solid #e5e5e5;
    background: #fff;
    position: fixed;
    width: 100%;
    z-index: 9997;
    display: flex;
    font-size: 18px;
    align-items: center;
  }

  .topbar_left {
    flex: 0 0 20px;
    margin-left: 10px;
  }

  .topbar_middle {
    /* text-align: center; */
    padding: 0 0 0 10px;
    flex: 0 0 89%;
  }

  .topbar_right {
    flex: 0 0 20px;
    position: absolute;
    right: 10px;
  }

  .taskview_info {
    font-size: 16px;
    padding: 5px 20px;
  }

  .taskview_toparea {
    position: absolute;
    top: 44px;
    width: 100%;
    display: flex;
    color: #fff;
    background-color: #fc4e2c;
    font-size: 16px;
    font-weight: bold;
    align-items: center;
    height: 35px;
  }

  .taskview_toparea_red {
    background-color: #fc4e2c;
  }

  .taskview_toparea_green {
    background-color: #8dc026;
  }

  .taskview_toparea_blue {
    background-color: #46a4da;
  }

  .taskview_toparea_sec {
    position: absolute;
    top: 79px;
    height: 5px;
    background-color: #fd8e78;
    width: 100%;
  }

  .taskview_toparea_red_sec {
    background-color: #fd8e78;
  }

  .taskview_toparea_green_sec {
    background-color: #bbe26e;
  }

  .taskview_toparea_blue_sec {
    background-color: #90cef1;
  }

  .taskview_toparea_thr {
    position: absolute;
    top: 84px;
    height: 5px;
    background-color: #ffdbd4;
    width: 100%;
  }

  .taskview_toparea_red_thr {
    background-color: #ffdbd4;
  }

  .taskview_toparea_green_thr {
    background-color: #e3f8b8;
  }

  .taskview_toparea_blue_thr {
    background-color: #d1edfd;
  }

  .taskview_top_type {
    padding: 0 0 0 20px;
  }

  .taskview_top_flag {
    position: absolute;
    right: 20px;
  }

  .taskview_top_delay {
    position: absolute;
    right: 80px;
    font-size: 12px;
    height: 24px;
    line-height: 24px;
    background-color: #fdd1cd;
    color: #ff6f61;
    width: 45px;
    border-radius: 15px;
    text-align: center;
  }

  .taskview_finish_delay {
    margin: 0 0 0 10px;
    font-size: 12px;
    height: 18px;
    line-height: 18px;
    background-color: #fdd1cd;
    color: #ff6f61;
    width: 40px;
    border-radius: 15px;
    text-align: center;
  }

  .taskview {
    position: absolute;
    top: 90px;
    width: 100%;
    margin-bottom: 80px;
  }

  .taskview_main {
    padding: 0px 0px;
  }

  .taskview_flex {
    display: flex;
    line-height: 25px;
    align-items: flex-start;
    padding: 0px 20px;
  }


  .taskview_title {
    font-size: 14px;
    font-weight: bold;
    flex: 0 0 60px;
    text-align: justify;
    text-align-last: justify;
  }

  .taskview_check_title {
    font-size: 14px;
    font-weight: bold;
    padding: 5px 0 0 20px;
  }

  .taskview_check_dscrp {
    color: #777;
    padding: 0 20px;
  }

  .taskview_item {
    /* flex: 0 0 80%; */
    /* border-bottom: 1px solid #e5e5e5; */
    margin: 0 0 0 10px;
    color: #777
  }

  .taskview_pzbtn {
    /* position: absolute;
    right: 20px; */
    margin-left: 20px;
    color: #ccc;
    font-size: 16px;
  }

  .taskview_date {
    position: absolute;
    right: 40px;
    color: #777
  }

  .taskview_dscrp {
    padding: 10px;
    line-height: 20px;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    margin: 5px 0 5px 10px;
    height: 100px;
    color: #777;
    width: 100%
  }

  .color_sub {
    color: #999
  }

  .quote_edit_btn_wrap {
    display: flex;
    position: fixed;
    bottom: 0;
    /* background-color: #fc4e2c; */
    width: 100%;
    z-index: 9990;
    align-items: center;
    justify-content: center;
    /* padding: 5px 0 2px 0; */
    box-shadow: 0 -1px 3px #f1f1f1;
  }

  .quote_edit_btn {
    /* background-color: #ffb732; */
    background-color: #fc4e2c;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    width: 100%;
  }

  .taskview_fjarea {
    margin: 10px 20px;
    color: #777
  }

  .taskview_fjlist {
    padding: 0px 0 0 20px;
    align-items: center;
    display: flex;
    font-size: 14px;
    height: 25px;
    line-height: 25px;
  }

  .taskview_fjsize {
    font-size: 14px;
    color: #aaa;
    margin-left: 10px;
  }

  .taskview_fjdel {
    font-size: 15px;
    color: #fc4e2c;
    position: absolute;
    right: 20px;
  }

  .taskview_addpic {
    margin: 0 0 20px 15px;
    background-color: #f6f6f6;
    color: #bbb;
    height: 100px;
    flex: 0 0 100px;
    text-align: center;
    line-height: 100px;
    font-size: 30px;
  }

  .liubai_dt {
    width: 100%;
    height: 10px;
    background-color: #f6f6f6;
    margin: 10px 0;
  }

  .finishitem {
    line-height: 40px;
    border-bottom: 1px solid #f5f5f5;
    color: #666
  }

  .tip_check {
    padding: 3px 10px;
    background-color: #fc4e2c;
    color: #fff;
    font-weight: bold;
    border-radius: 15px;
  }

  .tip_nocheck {
    padding: 3px 10px;
    border-radius: 15px;
    border: 1px solid #e5e5e5;
    color: #aaa
  }

</style>
