<template>
  <div class="dailyDetails">
    <headNav title="任务详情"></headNav>

    <!-- 任务信息 -->
    <div class="missionInfo" v-if="dataList.length != 0">
      <div class="headTip FontColorInfo">任务信息</div>
      <div class="missionInfo_cardInfo">
        <!-- <div class="missionInfo_cardInfo_headCard df jfsb aic">
          <div
            class="missionInfo_location FontColorNormal"
            @click="turnToCompany(dataList.enforce_obj)"
          >
          </div>
          <div class="missionInfo_status">
            <span v-if="dataList.executeStatus == 1" class="fb FontColorError"
              >待执行</span
            >
            <span
              v-else-if="dataList.executeStatus == 3"
              class="fb FontColorOther"
              >执行中</span
            >
            <span
              v-else-if="dataList.executeStatus == 4"
              class="fb FontColorWarn"
              >待复查</span
            >
            <span
              v-else-if="dataList.executeStatus == 2"
              class="fb FontColorSuccess"
              >任务完成</span
            >
          </div>
        </div> -->
        <div class="missionInfo_cardInfo_contentCard">
          <van-cell
            title="被检查单位"
            :value="dataList.enforce_obj_name || (dataList.enforce_obj && dataList.enforce_obj.enforce_obj_name)"
            is-link
            @click="turnToCompany"
          />
          <!-- <van-cell v-if="dataList.checkType === '1'" title="检查类型" value="日常消防监督检查" />
					 <van-cell v-if="dataList.checkType === '2'" title="检查类型" value="专项行动消防检查" /> -->
          <van-cell
            title="单位地址"
            :value="dataList.enforce_obj && dataList.enforce_obj.enforce_obj_address"
          >
            <template #right-icon>
              <van-icon
                name="location"
                class="search-icon"
                color="#0066cc"
                @click="getCenter(dataList.enforce_obj)"
              />
            </template>
          </van-cell>
          <van-cell
            title="执法机构"
            :value="dataList.enforce_org_name || (dataList.enforce_org && dataList.enforce_org.enforce_org_name)"
          />
          <van-cell
            :value="getPerson(dataList.executors)"
            is-link
            @click="turnToCheckPerson"
          >
            <template #title>
              <span class="custom-title">检查成员</span>
            </template>
          </van-cell>
          <van-cell title="检查类型" :value="'日常抽查'" />
          <van-cell title="任务状态" :value="getStatus(dataList.job_status)" />
          <!-- <van-cell title="检查时间" :value="dataList.executeTime" /> -->
        </div>
        <!-- <div class="missionInfo_cardInfo_more df jfc">
          <van-button type="info" size="small" @click="moreMissionDetail"
            >更 多</van-button
          >
        </div> -->
      </div>
      <div class="more">
          <div @click="moreMissionDetail">查看更多内容</div>
          <van-icon name="arrow" />
      </div>
      <!-- 步骤条 -->
      <div class="steps">
          <van-steps :active="stepIndex" active-color="#02A7F0">
              <van-step @click.native="showAppointMessage">预约通知</van-step>
              <van-step @click.native="showExecuteTask">监督检查</van-step>
              <van-step>完成任务</van-step>
          </van-steps>
      </div>
      <!-- <van-steps :active="stepIndex" active-color="#38f">
        <van-step>待执行</van-step>
        <van-step>执行中</van-step>
        <van-step>已归档</van-step>
      </van-steps> -->
      <div class="txtInfo">
        <div class="txtInfo-box">
          <template v-if="stepIndex === 1 && txtInfo">
            <van-field
              v-model="message"
              rows="2"
              autosize
              label="信息内容"
              input-align="right"
              type="textarea"
              readonly
            />
            <van-cell title="发送时间" :value="formatDate(txtInfo.send_time)"/>
            <div class="resend">
              <span @click="resendTxt">编辑重新发送短信</span>
            </div>
          </template>
          <van-cell-group v-show="stepIndex === 1">
              <van-cell title="近期隐患" is-link :value="`${problem_num}项`" @click="showRecent" />
              <van-cell title="检查流程" is-link :value="`${nodes_num}项`" @click="showFlow" />
          </van-cell-group>
        </div>
        <div class="btns" v-show="stepIndex === 1">
            <van-button type="info" block @click="startTask">{{ dataList.job_status === 'DOING' ? '继续执行' : '执行任务' }}</van-button>
        </div>
      </div>
      <div class="missionInfo_cardInfo" v-if="stepIndex === 0 && !txtInfo">
        <van-form @submit="onSubmit">
          <van-field
            v-model="message"
            rows="2"
            autosize
            label="信息内容"
            input-align="right"
            type="textarea"
            readonly
            placeholder="请输入信息内容"
          />
          <van-field
            readonly
            input-align="right"
            clickable
            name="picker"
            :value="checkTime"
            label="检查时间"
            placeholder="请选择"
            @click="showCheckTime = true"
          />
          <van-field
            readonly
            input-align="right"
            clickable
            name="picker"
            :value="styleTxt"
            label="发送方式"
            placeholder="请选择"
            @click="showStyle = true"
          />
          <van-field
            readonly
             v-if="styleTxt==='定时发送'"
            input-align="right"
            clickable
            name="picker"
            :value="sendTime"
            label="发送时间"
            placeholder="请选择"
            @click="showSendTime = true"
          />
          <van-button block type="info" native-type="submit">{{btnTxt}}</van-button>
        </van-form>
      </div>
    </div>
    <van-popup v-model="showStyle" position="bottom">
      <van-picker
        show-toolbar
        :columns="columsSytle"
        @confirm="onConfirm"
        @cancel="showStyle = false"
      />
    </van-popup>
    <van-popup v-model="showCheckTime" position="bottom">
      <van-datetime-picker
        v-model="currentCheckDate"
        type="date"
        title="请选择"
        :min-date="minDate"
        :max-date="maxDate"
        @confirm="onCheckConfirm"
        @cancel="showCheckTime = false"
      />
    </van-popup>
    <van-popup v-model="showSendTime" position="bottom">
      <van-datetime-picker
        v-model="currentSendDate"
        type="datetime"
        title="请选择"
        :min-date="minDate"
        :max-date="maxDate"
        @confirm="onSendConfirm"
        @cancel="showSendTime = false"
      />
    </van-popup>
    <!-- 单位信息 -->
    <!-- <div class="companyInfo">
      <div class="headTip FontColorInfo">单位信息</div>

      <div class="missionInfo_cardInfo">
        <div class="missionInfo_cardInfo_contentCard">
          <van-cell title="单位名称" :value="companyInfo.companyUnitName" />
          <van-cell
            title="统一社会信用代码"
            :value="companyInfo.unitCreditCode"
          />
          <van-cell
            v-if="companyInfo.fireType === '0'"
            title="消防类型"
            value="通用"
          />
          <van-cell
            v-if="companyInfo.fireType === '1'"
            title="消防类型"
            value="火灾高危单位"
          />
          <van-cell
            v-if="companyInfo.fireType === '2'"
            title="消防类型"
            value="消防安全重点单位"
          />
          <van-cell
            v-if="companyInfo.fireType === '3'"
            title="消防类型"
            value="一般单位"
          />
          <van-cell
            v-if="companyInfo.fireType === '4'"
            title="消防类型"
            value="一般单位"
          />
          <van-cell
            v-if="companyInfo.siteType === '1'"
            title="场所类型"
            value="宾馆场所"
          />
          <van-cell
            v-if="companyInfo.siteType === '2'"
            title="场所类型"
            value="餐饮场所"
          />
          <van-cell
            v-if="companyInfo.siteType === '0'"
            title="场所类型"
            value="通用"
          />
          <van-cell
            title="面积大小"
            :value="companyInfo.measureArea ? companyInfo.measureArea : ''"
          />
        </div>
        <div class="missionInfo_cardInfo_more df jfc">
          <van-button
            type="info"
            size="small"
            @click="turnToCompany(dataList.byCheckId)"
            >更 多</van-button
          >
        </div>
      </div>
    </div> -->

    <!-- 通知文件 -->
    <!-- <div class="noticeDoc">
      <div class="headTip FontColorInfo">通知文件</div>
      <div class="pl15 pr15 bwhite">
        <div v-if="docIist.length === 0" class="noNoticeFile">暂无通知文件</div>
        <div
          class="noticeDoc_docItem"
          v-for="(item, ind) in docIist"
          :key="ind"
          @click="docContent(item)"
        >
          <div class="noticeDoc_noticeName">
            {{ item.fileName }}
          </div>
          <div class="noticeDoc_status">
            <div class="df aic">
              <div>通知时间：</div>
              <div class="mt2">
                {{ item.createdTime }}
              </div>
            </div>
            <div class="df aic">
              <div>通知状态：</div>
              <div class="FontColorError fb">
                <span class="FontColorError" v-if="item.noticeStatus == '2'"
                  >未通知</span
                >
                <span class="FontColorOther" v-else>已通知</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div> -->

    <!-- 检查内容 -->
    <!-- <div class="inspectContent">
      <div class="headTip FontColorInfo">检查内容</div>

      <div class="inspectContent_content">
        <van-cell
          title="近期隐患"
          is-link
          :value="`${contNum.recentDefect} 项`"
          @click="hiddenDanger"
        >
        </van-cell>
        <van-cell
          title="检查任务流程"
          is-link
          :value="`${contNum.checkFunNum} 项`"
          @click="startCheck(dataList.taskId)"
        >
        </van-cell>
      </div>
    </div> -->

    <!-- 检查结果 -->
    <!-- <div class="checkResult">
      <div class="headTip FontColorInfo">检查结果</div>

      <div class="unChecked" v-if="!isShowCheckResult">
        <van-empty>
          <div
            class="fz12 FontColorInfo mt10 mb10"
            v-if="dataList.executeStatus === '1'"
          >
            还没有完成检查内容, 点击快速
            <span class="FontColorOther" @click="startCheck(dataList.taskId)">
              进行检查</span
            >
          </div>
          <div
            class="fz12 FontColorInfo mt10 mb10"
            v-if="dataList.executeStatus === '3'"
          >
            还没有完成检查内容, 点击
            <span class="FontColorOther" @click="startCheck(dataList.taskId)">
              继续检查</span
            >
          </div>
        </van-empty>
      </div>
      <div class="Checked" v-else>
        <div class="checkedItem">
          <van-cell
            title="消防监督检查记录"
            is-link
            value="查看"
            @click="turnToRecord"
          ></van-cell>
          <div class="FontColorInfo fz12 mb10">
            时间：<span>{{ dataList.updatedTime }}</span>
          </div>
        </div>
        <div class="checkedItem">
          <van-cell title="监督检查结果" is-link @click="turnToResult">
            <template #default>
              <span v-if="noNeedRecheck">检查合格</span>
              <div v-else>
                <span v-if="fileList.length == 1">{{
                  fileList[0].fileName
                }}</span>
                <span v-else>责令限期改正通知书</span>
              </div>
            </template>
          </van-cell>
          <div class="FontColorInfo fz12 mb10">
            状态：
            <span v-if="hasJudge || noNeedRecheck" class="FontColorOther"
              >已确定</span
            >
            <span v-else class="FontColorError">未判断</span>
          </div>
        </div>
      </div>
    </div> -->

    <!-- 复查结果 -->
    <!-- <div class="reCheckResult">
      <div class="headTip FontColorInfo">复查结果</div>

      <div class="unChecked" v-if="dataList.executeStatus != '2'">
        <van-empty>
          <div
            class="fz12 FontColorInfo mt10 mb10"
            v-if="dataList.executeStatus === '4'"
          >
            还没有进行复查, 点击快速
            <span class="FontColorOther" @click="review"> 进行复查</span>
          </div>
          <div class="fb FontColorInfo" v-else>未查询到相关数据</div>
        </van-empty>
      </div>

      <div class="Checked" v-if="dataList.executeStatus === '2'">
        <div class="checkedItem" v-if="!noNeedRecheck">
          <van-cell
            title="消防监督检查记录"
            is-link
            @click="turnToRecheckRecord"
          >
            <template #default>
              <div>
                <span v-if="isCorrection">已改正</span>
                <span v-else class="FontColorWarn">未改正</span>
              </div>
            </template>
          </van-cell>
          <div class="FontColorInfo fz12 mb10">
            时间：<span>{{ recheckTime }}</span>
          </div>
        </div>
        <div class="checkedItem" v-else>
          <div class="noRecheck">检查项全部正常</div>
        </div>
      </div>
    </div> -->

    <!-- 执法记录 -->
    <!-- <div class="lawRecord">
      <div class="headTip FontColorInfo">执法记录</div>

      <div class="unChecked">
        <van-empty description="未查询到相关数据">
          <van-button
            v-if="startCheckBtn"
            type="info"
            @click="startCheck(dataList.taskId)"
            >开始检查</van-button
          >
        </van-empty>
      </div>

      <div class="Checked" style="display: none">
        <div class="checkedItem df FontColorInfo">
          <div>记录编号：</div>
          <span class="FontColorNormal">13289563245</span>
        </div>
        <div class="checkedItem df FontColorInfo">
          <div>记录设备：</div>
          <span class="FontColorNormal">13289563245</span>
        </div>
      </div>
    </div> -->

    <!-- 弹出地图展示 -->
    <van-popup v-model="showMap" position="bottom" :style="{ height: '450px' }">
      <div>
        <baiduMap :center="center" :zoom="zoom"></baiduMap>
      </div>
    </van-popup>

    <!-- 遮罩层 -->
    <v-mask :showOverLay="showOverLay"></v-mask>
  </div>
</template>

<script>
import headNav from "@/components/headNav.vue";
import { get, post, put } from "@/utils/http.js";
import baiduMap from "@/components/baiduMap.vue";
import mask_overLay from "@/components/overLay_xy.vue";
import {formatYYYYMMDD, isEmpty, formatDate, dateFormat} from '@/utils/tool'
import { Dialog } from 'vant'

export default {
  name: "dailyDetails",
  inject: ["reload"],
  components: {
    headNav,
    baiduMap,
    "v-mask": mask_overLay,
  },
  data() {
    return {
      docIist: [],
      fileList: "",
      dataList: {},
      companyInfo: "",
      showMap: false,
      showOverLay: false,
      zoom: 10,
      center: "重庆市",
      contNum: "",
      isShowCheckResult: false,
      startCheckBtn: false,
      hasJudge: false,
      isCorrection: false,
      recheckTime: "",
      noNeedRecheck: false,
      stepIndex: 0,
      showStyle: false,
      columsSytle: ["立即发送","定时发送"],
      styleTxt: "",
      sendTime: "",
      checkTime: "",
      showCheckTime: false,
      showSendTime: false,
      minDate: new Date(2020, 0, 1),
      maxDate: new Date(2025, 10, 1),
      currentCheckDate: new Date(),
      currentSendDate: new Date(),
      message:'',
      btnTxt:'发送通知',
      txtInfo: null,
      problem_num: 0,
      nodes_num: 0,
    };
  },
  mounted() {
    this.init();
    // if (window.history && window.history.pushState) {
    //   history.pushState(null, null, document.URL);
    //   window.addEventListener("popstate", this.goBack, false);
    // }
    this.checkTime = formatYYYYMMDD(this.currentCheckDate || new Date())
  },
  computed: {
    queryParams() {
      return this.$route.params
    }
  },
  // destroyed() {
  //   window.removeEventListener("popstate", this.goBack, false);
  // },
  methods: {
    formatDate,
    // 初始化
    init() {
      if (this.queryParams && this.queryParams.ID) {
        this.getDetailInfoApi();
      }
    },

    getSendMsg() {
      if (!this.queryParams || isEmpty(this.queryParams.ID)) {
        return;
      }
      this.$http.get(`/v2/api/enforce-job/${this.queryParams.ID}/enforce-message?page=1&size=1`).then(result => {
        const res = result.data
        if (res && res.data && res.data.length > 0) {
          this.txtInfo = res.data[0];
          if (this.txtInfo.send_time) {
            this.currentCheckDate = new Date(this.txtInfo.send_time);
            this.updateMessage();
          }
        }
      })
    },
    updateMessage() {
      if (this.dataList) {
        const name = this.dataList.enforce_obj_name || (this.dataList.enforce_obj && this.dataList.enforce_obj.enforce_obj_name);
        const date = dateFormat('YYYY年mm月dd日', this.currentCheckDate || new Date());
        this.message = `【${name}监督抽查提示函】:根据《消防法》及《消防监督检查规定》，我支队拟于${date},对您的单位履行法定消防安全职责情况实施监督检查，请做好检查前的消防安全自检程序`
      }
    },
    // 获取任务详情信息
    async getDetailInfoApi() {
      this.showOverLay = true;
      await get(`/v2/api/enforce-job/${this.queryParams.ID}`).then((res) => {
        if (res) {
          this.dataList = res;
          if (res.check_nodes) {
            this.nodes_num = res.check_nodes.length;
          }
          this.updateMessage();
          this.getSendMsg();
          const enforceId = this.objId || res.enforce_obj_id || (res.enforce_obj && res.enforce_obj.enforce_obj_id);
          if (enforceId) {
            this.getRecentItems(enforceId);
          }

          // switch (this.dataList.job_status) {
          //   case "TODO":
          //     this.stepIndex = 0;
          //     this.btnTxt='发送通知'
          //     break;
          //   case "DOING":
          //     this.stepIndex = 1;
          //     this.btnTxt='编辑/重新发送'
          //     break;
          //   case "ARCHIVED":
          //     this.stepIndex = 2;
          //     break;
          //   default:
          //     this.stepIndex = 0;
          //     break;
          // }
        }
        // this.zoom = 15;
        this.showOverLay = false;
        // 	this.center = this.dataList.taskAddr;
        // 	this.$store.commit('taskInfo/setTaskInfo', {
        // 		taskId: this.dataList.taskId,
        // 		id: this.$route.params.ID,
        // 		checkTime: this.dataList.trueCheckTime,
        // 		checkStatus: this.dataList.executeStatus,
        // 		companyId:  this.dataList.byCheckId,
        // 		executeTime: this.dataList.executeTime,
        // 		dataList: this.dataList
        // 	});
        // }
      });

      // if (this.dataList.executeStatus === '2' || this.dataList.executeStatus === '4') {
      // 	this.isShowCheckResult = true;
      // }
      // if (this.dataList.executeStatus === '1') {
      // 	this.startCheckBtn = true;
      // }
      // if (this.dataList.executeStatus === '2') {
      // 	const res = await this.getConditionApi();

      // 	if (res.success === true) {
      // 		if (res.data.length > 0) {
      // 			this.isCorrection = res.data[0].checkEndResult === '1' ? true : false;
      // 			this.recheckTime = res.data[0].createdTime;
      // 		} else {
      // 			this.noNeedRecheck = true;
      // 		}
      // 	}
      // }

      // await this.getCompanyInfoApi();
      // await this.getCheckContNumApi();
      // await this.getFileListApi();
      // await this.getCheckJudgeApi();

      // this.showOverLay = false;
    },
    showRecent() {
        // this.$router.push(`/newHiddenDanger/${this.queryParams.ID}`);
        this.$router.push(`/history/${this.queryParams.objId}`);
    },
    showFlow() {
        this.$router.push(`/dailyDetailsView/${this.queryParams.ID}`);
    },
    startTask() {
        if (this.dataList.job_status === 'DOING') {
          this.$router.push(`/executeTask/${this.queryParams.ID}/${this.queryParams.objId}`)
        }
        else {
          const vm = this
          Dialog.confirm({
              title: '温馨提示',
              message: '开始检查前请确保执法记录仪已处于开启状态',
          })
          .then(() => {
              vm.$http.put(`/v2/api/enforce-job/${vm.queryParams.ID}`, {
                job_status: 'DOING',
                start_time: new Date()
              }).then(res => {
                vm.$router.push(`/executeTask/${vm.queryParams.ID}/${vm.queryParams.objId}`)
              })
          })
        }
    },
    getRecentItems(enforceId) {
      this.$http.get(`/v2/api/enforce-job/item?page=1&size=100000&query=check_result==2;enforce_obj_id==${enforceId}`).then(res => {
        if (res.data) {
          this.problem_num = res.data.total
        }
      })
    },
    // 获取单位信息
    async getCompanyInfoApi() {
      await get(`/cdSuperObjE/get/${this.dataList.byCheckId}`).then((res) => {
        if (res.success == true) {
          this.companyInfo = res.data;
        }
      });
    },

    // 获取检查各项数量
    async getCheckContNumApi() {
      await get(`/supervision/getCheckContNum/${this.dataList.taskId}`).then(
        (res) => {
          if (res.success == true) {
            this.contNum = res.data;
          }
        }
      );
    },

    // 获取文件列表
    async getFileListApi() {
      await post("/cdsupervisionNotice/pageList", {
        taskId: this.dataList.taskId,
      }).then((res) => {
        if (res.success == true) {
          this.docIist = res.data.list;
        }
      });
    },

    async getCheckJudgeApi() {
      await get("/cdsupervisionAmend/listByCondition", {
        taskId: this.dataList.taskId,
      }).then((res) => {
        if (res.data && res.data.length > 0) {
          this.hasJudge = true;
          this.fileList = res.data;
        }
      });
    },

    async getConditionApi() {
      return get("/cdsupervisionCheckRecord/listByCondition", {
        taskId: this.dataList.taskId,
      });
    },
    // 获取本月开始 结束
    getThisMonthStart(now) {
      // var now = new Date(now);
      var nowMonth = now.getMonth(); //当前月
      var nowYear = now.getYear(); //当前年
      var nowDay = now.getDate();
      var h = now.getHours() >= 10 ? now.getHours() : "0" + now.getHours();
      var m =
        now.getMinutes() >= 10 ? now.getMinutes() : "0" + now.getMinutes();
      nowYear += nowYear < 2000 ? 1900 : 0;
      var monthStartDate = new Date(nowYear, nowMonth, 1);
      var monthEndDate = new Date(nowYear, nowMonth);
      return nowYear + "/" + (nowMonth + 1) + "/" + nowDay + " " + h + ":" + m;
    },
    // 选择发送方式
    onConfirm(value) {
      this.styleTxt = value;
      this.showStyle = false;
      if (value === '立即发送') {
        this.currentSendDate = new Date();
        this.sendTime = this.getThisMonthStart(this.currentSendDate);
      }
    },
    onCheckConfirm(value) {
      this.checkTime = this.getThisMonthStart(value);
      this.showCheckTime = false;
      this.updateMessage();
    },
    onSendConfirm(value) {
      this.sendTime = this.getThisMonthStart(value);
      this.showSendTime = false;
    },
    onSubmit() {
      if (!this.queryParams || isEmpty(this.queryParams.ID)) {
        return;
      }
      
      if (isEmpty(this.styleTxt)) {
        this.$toast.fail('请选择发送方式');
        return;
      }
      if (!this.sendTime) {
        this.$toast.fail('请选择发送时间');
        return;
      }
      const obj = {
        id:Number(this.queryParams.ID),
        obj_id: this.queryParams.objId,
        message_type:'APPOINTMENT',
        receiver_type: 'SMS',
        message_content:this.message,
        send_time:new Date(this.sendTime)
      };
      post(`/v2/api/enforce-job/${this.queryParams.ID}/enforce-message`, obj).then(res=>{
        this.getDetailInfoApi()
      })
    },
    resendTxt() {
      const name = this.dataList.enforce_obj && this.dataList.enforce_obj.enforce_obj_name;
      const params = Object.assign(this.txtInfo, {
        taskId: this.queryParams.ID,
        objId: this.queryParams.objId,
        enforceName: name
      });
      this.$router.push({
        name: 'sendTxt',
        params
      })
    },
    // 后退一个页面
    backPage() {
      this.$router.back();
    },

    goBack() {
      this.$router.back();
    },
    //任务状态
    getStatus(status) {
      let str = "";
      switch (status) {
        case "AUDIT":
          str = "审核中";
          break;
        case "REJECT":
          str = "已驳回";
          break;
        case "TODO":
          str = "待执行";
          break;
        case "DOING":
          str = "执行中";
          break;
        case "ARCHIVED":
          str = "已归档";
          break;
        default:
          str = "其他";
          break;
      }
      return str;
    },
    // 跳转单位信息
    turnToCompany() {
      if (this.dataList && this.dataList.enforce_obj_id) {
        this.$router.push(`/companyInfo/${this.dataList.enforce_obj_id}`);
      }
      // this.$router.push({
      //   name: 'companyInfo',
      //   params: this.dataList
      // })
      // this.$router.push(
      //   `/companyInfo/${JSON.stringify(info)}/${this.dataList.check_nodes.length}/${this.queryParams.ID}`
      // );
    },

    // 跳转检查人员信息
    turnToCheckPerson() {
      this.$router.push(`/checkPersonnelInfo/${this.queryParams.ID}`);
    },

    // 跳转更多任务信息
    moreMissionDetail() {
      this.$router.push(`/missionInfoDetail/${this.queryParams.ID}`);
    },
    showAppointMessage() {
      this.stepIndex = 0;
    },
    showExecuteTask() {
      this.stepIndex = 1;
    },

    // 文件详情
    docContent(item) {
      this.$router.push(`/msgDetail/${item.taskId}/${item.id}`);
    },

    // 获取地图中心位置
    getCenter(location) {
      this.showMap = true;
      var lo = {
        lng: location.longitude,
        lat: location.latitude,
      };
      this.center = lo;
    },

    // 设置主协标识
    getPerson(per) {
      if (per) {
        let str = "";
        for (let i in per) {
          if (i == 0) {
            str = str + per[i].user_name + "(主)，";
          } else {
            str = str + per[i].user_name + "(协)";
          }
        }

        return str;
      }
    },

    // 跳转隐患详情页面
    hiddenDanger() {
      // this.$router.push(
      //   `/hiddenDanger/${this.$route.params.ID}/${this.dataList.taskId}`
      // );
    },

    // 跳转消防监督检查记录
    turnToRecord() {
      this.$router.push(`/checkRecord/${this.queryParams.ID}`);
    },
    // 跳转复查监督检查记录
    turnToRecheckRecord() {
      this.$router.push(
        `/reviewRecord/${this.queryParams.ID}/${this.dataList.taskId}`
      );
    },

    // 跳转检查结果
    turnToResult() {
      if (!this.hasJudge) {
        this.$router.push(
          `/checkResult/${this.dataList.taskId}/${this.queryParams.ID}/normal`
        );
      } else {
        this.$router.push(
          `/checkResultDetail/${this.dataList.taskId}/${this.queryParams.ID}`
        );
      }
    },

    // 开始检查
    startCheck(id) {
      if (this.dataList.executeTime) {
        if (this.dataList.executeStatus === "1") {
          put("/cdsupervisionTask/simpleEdit", {
            id: this.queryParams.ID,
            executeStatus: "3",
          }).then((res) => {
            if (res.success === true) {
              this.$router.push(`/checkProcess/${id}/${this.queryParams.ID}`);
            } else {
              this.$toast.fail(`${res.msg}`);
            }
          });
        } else {
          this.$router.push(`/checkProcess/${id}/${this.queryParams.ID}`);
        }
      } else {
        this.$toast.fail("还未制定检查计划");
      }
    },

    // 复查
    review() {
      this.$router.push(
        `/review/${this.queryParams.ID}/${this.dataList.taskId}`
      );
    },
  },
};
</script>

<style lang="scss" scoped>
.dailyDetails {
  font-size: 14px;
  height: 100vh;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;

  .mt2 {
    margin-top: 3px;
  }

  .headTip {
    margin-bottom: 10px;
    padding: 0 15px;
  }

  .noNoticeFile {
    padding: 25px 0;
    color: #878787;
    font-weight: bold;
    text-align: center;
  }

  .noRecheck {
    padding: 25px 0;
    color: #3fbf83;
    font-weight: bold;
    text-align: center;
  }

  .missionInfo {
    margin-top: 57px;
    padding-bottom: 20px;

    .missionInfo_cardInfo {
      padding: 0 15px;
      background-color: #fff;

      .missionInfo_cardInfo_headCard {
        padding-top: 10px;
        padding-bottom: 5px;
        font-weight: bold;
      }
    }
    .missionInfo_cardInfo:last-child {
      padding: 15px;
    }
  }

  .companyInfo {
    @extend .missionInfo;
    margin-top: 10px;
  }

  .noticeDoc {
    margin-top: 10px;

    .noticeDoc_docItem {
      padding: 10px 0;
      background-color: #fff;
      color: #616161;
      border-bottom: 1px solid #eaeaea;

      &:last-child {
        border-bottom: none;
      }

      .noticeDoc_noticeName {
        padding: 5px 0;
      }

      .noticeDoc_status {
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: #787878;
        font-size: 12px;
        margin-top: 5px;
        // padding: ;
      }
    }
  }

  .inspectContent {
    margin-top: 10px;

    .inspectContent_content {
      padding: 5px 15px;
      background-color: #fff;
    }
  }

  .checkResult {
    margin-top: 10px;

    .unChecked,
    .Checked {
      padding: 5px 15px;
      background-color: #fff;

      .checkedItem {
        color: #616161;
        border-bottom: 1px solid #e8e8e8;

        &:last-child {
          border-bottom: none;
        }
      }
    }
  }

  .reCheckResult {
    margin-top: 10px;

    .unChecked,
    .Checked {
      padding: 5px 15px;
      background-color: #fff;
    }

    .unChecked {
      padding-bottom: 10px;
    }
  }

  .lawRecord {
    margin-top: 10px;

    .unChecked,
    .Checked {
      padding: 8px 15px;
      background-color: #fff;

      .checkedItem {
        padding: 8px 0;
        align-items: center;
      }
    }
  }
}
.dailyDetails::-webkit-scrollbar {
  display: none;
}
.more {
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #888888;
}
.txtInfo {
  .txtInfo-box {
    padding: 0 15px;
    background-color: #FFFFFF;
  }
  .resend {
    margin: 0 -15px;
    background-color: #F5F5F5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 0;
    &>span {
      color: #02a7f0;
      margin-right: 10px;
    }
  }
  .btns {
    margin: 20px;
  }
}
</style>

<style lang="scss">
.steps {
    padding: 10px 20px;
    .van-steps {
        background-color: transparent !important;

        .van-step__circle-container {
            background-color: transparent !important;
        }
    }
}
</style>

<style lang="scss">
.dailyDetails {
  .van-cell {
    padding: 8px 0;
    border-bottom: 1px solid #f9f9f9;
    font-size: 12px;

    &::after {
      border: none;
    }

    &:last-child {
      border-bottom: none;
    }

    .van-cell__title {
      color: #565656;
    }
  }

  .missionInfo {
    .missionInfo_cardInfo {
      .search-icon.van-icon.van-icon-location {
        display: flex;
        align-items: center;
        color: #00f;
        margin-left: 10px;
      }

      .van-icon.van-icon-arrow.van-cell__right-icon {
        margin-left: 10px;
      }
    }
  }

  .missionInfo_cardInfo_more {
    .van-button.van-button--info.van-button--small {
      padding: 5px 20px;
      height: auto;
      margin-bottom: 5px;
      background-color: transparent;
      border: none;
      color: #448fff;
      font-size: 13px;
      font-weight: bold;
    }
  }

  .inspectContent_content {
    .van-cell__value {
      color: #02a7f0;

      span {
        font-size: 9px;
      }
    }

    .van-icon.van-icon-arrow.van-cell__right-icon {
      color: #02a7f0;
      font-size: 12px;
    }
  }

  .van-empty {
    padding: 0;
    padding-bottom: 10px;
  }

  .van-empty__description {
    color: #878787;
    font-weight: bold;
  }

  .checkResult,
  .reCheckResult {
    .unChecked,
    .Checked {
      .checkedItem {
        .van-cell,
        .van-cell.van-cell--clickable {
          border: none;

          &::after {
            border: none;
          }
        }

        .van-cell__value {
          color: #02a7f0;

          span {
            font-size: 9px;
          }
        }

        .van-icon.van-icon-arrow.van-cell__right-icon {
          color: #02a7f0;
          font-size: 12px;
        }
      }
    }
  }

  .van-empty__image {
    width: 140px;
    height: 130px;
  }

  .van-empty__bottom {
    margin-top: 5px;

    .van-button.van-button--info.van-button--normal {
      width: 120px;
      height: 40px;
      border-radius: 5px;
    }
  }
}
</style>