<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta
      http-equiv="X-UA-Compatible"
      content="IE=edge"
    />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, viewprot-fit:cover"
    />
    <title>消防安全检查清单</title>
    <script
      type="text/javascript"
      src="../sdk/includeHead.js"
    ></script>
    <script
      type="text/javascript"
      src="../sdk/axios_http3.js"
    ></script>
    <script
      type="text/javascript"
      src="_check_info_data.js"
    ></script>

    <!-- <script type="text/javascript" src="_check_info_data_detail.js"></script>
		<script type="text/javascript" src="_check_info_data_detail_yh.js"></script> -->
  </head>

  <body>
    <!-- 原 HTML 主体内容保持不变 -->
    <div id="app">
      <div
        class="checklist-header"
        v-cloak
      >
        <p v-if="flag=='ADD'">
          1.不合格或不满足等选择“否”的检查项，需将问题进行拍照上传，并描述问题详情。<br />
          2.检查人员对管辖范围内企业安全情况负责，需如实上报。
        </p>
        <h5>九小场所安全检查清单</h5>
      </div>
      <div
        class="checklist-container"
        v-cloak
      >
        <div class="item_title">{{ checkData?.[checkPageIndex]?.name }}</div>
        <div
          v-for="(item, index) in checkData?.[checkPageIndex]?.['gqCheckItemList']"
          :key="item.id"
          class="check-item"
        >
          <div class="item-header">
            <!-- <div class="item-number">{{ index + 1 }}</div> -->
            <div class="item-title">{{ item.id }}.{{ item.name }}</div>
          </div>

          <!-- 单选按钮组 -->
          <van-radio-group
            v-model="item.itemAnswer"
            @change="handleSelectionChange($event, item, index)"
            :disabled="flag!=='ADD'"
            direction="horizontal"
          >
            <van-radio :name="1">是</van-radio>
            <van-radio :name="2">否</van-radio>
            <van-radio :name="3">不涉及</van-radio>
          </van-radio-group>

          <!-- 否选项扩展内容 -->
          <div
            v-show="item.itemAnswer === 2"
            class="expand-section"
          >
            <div>
              <!-- 子检查项 -->
              <div class="sub-checkbox-group">
                <van-cell v-if="item.itemType==1">
                  <van-checkbox
                    v-for="(subItem, subIndex) in item.gqCheckQuestionList"
                    :key="subIndex"
                    v-model="subItem.check"
                    shape="square"
                    :disabled="flag!=='ADD'"
                  >
                    {{ subItem.name}}
                  </van-checkbox>
                </van-cell>
                <van-cell v-if="item.itemType==2">
                  <div class="limit_date_wrapper">
                    <span>住宿人数:</span>
                    <input
                      type="text"
                      v-model="item.gqCheckQuestionList[0].content"
                      :disabled="flag!=='ADD'"
                      maxlength="3"
                      style="width: 0.8rem; height: 0.4rem; text-align: center"
                    />
                  </div>
                </van-cell>
              </div>

              <!-- 隐患描述-新增情况 -->
              <van-cell-group v-if="flag=='ADD'">
                <p class="title_require">请输入隐患描述</p>
                <van-field
                  v-model="item.description"
                  type="textarea"
                  rows="1"
                ></van-field>
              </van-cell-group>
              <!-- 隐患描述-非新增情况 -->
              <van-cell-group v-if="flag!=='ADD'">
                <p class="title_require">请输入隐患描述</p>
                <p class="yh_desc">{{item.description||'未配置安全出口指示标志'}}</p>
              </van-cell-group>

              <!-- 照片上传 -->
              <van-cell-group v-if="flag=='ADD'">
                <van-cell
                  ><span class="title_require">请上传隐患图片:</span><span style="color: red">(格式png/jpg/jpeg,最多4张)</span>
                  <div>
                    <van-uploader
                      v-model="item.photos"
                      :max-count="4"
                      :after-read="handleFileUpload"
                      class="uploader-wrapper"
                    />
                  </div>
                </van-cell>
              </van-cell-group>

              <van-cell-group v-if="flag!='ADD'">
                <van-cell>
                  <span class="">隐患图片:</span>
                  <div>
                    <ImagePreview
                      v-for="(imgItem, subIndex) in item.hiddenImageUrlList"
                      :src="imgItem"
                      alt=""
                      style="width: 1.2rem; height: 1.2rem; margin-right: 0.2rem"
                    />
                  </div>
                </van-cell>
              </van-cell-group>
              <van-cell-group v-if="item?.rectificationImageUrlList?.length">
                <van-cell
                  ><span class="">整改情况:</span>
                  <div>
                    <ImagePreview
                      v-for="(imgItem, subIndex) in item.rectificationImageUrlList"
                      :src="imgItem"
                      alt=""
                      style="width: 1.2rem; height: 1.2rem; margin-right: 0.2rem"
                    />
                  </div>
                </van-cell>
                <van-cell
                  ><span class="">整改日期:</span>
                  <div>
                    <span>{{item.rectificationDate}}</span>
                  </div>
                </van-cell>
              </van-cell-group>

              <van-cell-group v-if="(flag=='0' || flag=='3') && userType=='shop'">
                <van-cell
                  ><span class="title_require">请上传整改图片:</span><span style="color: red">(格式png/jpg/jpeg,最多4张)</span>
                  <!-- <div>
										<van-uploader style="width: 80px; height:80px;" v-model="item.photos" multiple
											:max-count="4" :after-read="handleFileUpload" class="uploader-wrapper" />
									</div> -->
                  <van-uploader
                    v-model="item.photos"
                    multiple
                    :max-count="4"
                  />
                </van-cell>
              </van-cell-group>

              <!-- 整改期限 -->
              <van-cell-group v-if="flag=='ADD'">
                <van-cell>
                  <div class="limit_date_wrapper">
                    <span class="title_require">整改期限:</span>
                    <select
                      class="day_select"
                      name=""
                      v-model="item.deadlineDays"
                      @change="handleDeadlineConfirm($event, item)"
                    >
                      <option value="1">1</option>
                      <option value="3">3</option>
                      <option value="5">5</option>
                      <option value="7">7</option>
                    </select>
                    <span> 整改截止日期: <b style="color: #148ef7">{{item.deadlineDate}}</b></span>
                  </div>
                </van-cell>
              </van-cell-group>
            </div>
          </div>
        </div>
        <van-form v-if="checkPageIndex == (checkData?.length-1)">
          <van-cell>
            <van-field
              label="检查人员"
              v-model="checkPeopleName"
              readonly
            />
          </van-cell>
          <van-cell>
            <van-field
              label="检查日期"
              v-model="checkDate"
              readonly
            />
          </van-cell>
          <van-cell v-if="flag!='ADD'&&flag!='JC_XQ'">
            <van-field
              label="整改截止日期"
              v-model="rectificationDeadline"
              readonly
            />
          </van-cell>
          <div v-if="flag=='0' || flag=='1' || flag=='3'">
            <van-cell>
              <van-field
                label="审核日期"
                v-model="reviewDate"
                readonly
              />
            </van-cell>
            <van-cell>
              <van-field
                label="审核记录"
                v-model="reviewRecord"
                readonly
              />
            </van-cell>
          </div>
        </van-form>

        <!-- 隐患详情底部栏 -->
        <!-- 	<div class="bottom_bar" v-if="flag=='3'">
					<div>
						<van-button type="primary" size="small" @click="navTo1" >上报行业主管部门</van-button>
						<van-button type="info" size="small" @click="navTo1" >限期3天整改</van-button>
					</div>
				</div> -->

        <div
          class="bottom_bar"
          v-if="(flag=='0' || flag=='3') && userType=='shop'"
        >
          <div style="display: flex; justify-content: center; gap: 1rem">
            <van-button
              type="info"
              size="small"
              @click="add4DZG_XQ"
              style="width: 2rem"
              >提交整改</van-button
            >
          </div>
        </div>

        <div
          class="bottom_bar"
          v-if="flag=='2' && userType=='wgy'"
        >
          <div style="display: flex; justify-content: center; gap: 1rem">
            <van-button
              type="danger"
              size="small"
              @click="add4DSH_XQ(0)"
              style="width: 2rem"
              >拒绝</van-button
            >
            <van-button
              type="info"
              size="small"
              @click="add4DSH_XQ(1)"
              style="width: 2rem"
              >通过</van-button
            >
          </div>
        </div>

        <!-- 新增底部栏 -->
        <div
          class="bottom_bar"
          v-if="flag=='ADD' || flag=='JC_XQ'"
        >
          <div>
            <span class="check_num">{{ notNullCount }}/{{totalItems}}</span>
            <span class="yh_num">{{noCount}} 隐患</span>
            <van-button
              type="info"
              size="small"
              @click="add4JC_XQ"
              v-show="checkPageIndex===3&&flag=='ADD'"
              >完成检查</van-button
            >
            <van-button
              v-show="checkPageIndex<3"
              type="info"
              size="small"
              @click="validRequired"
              >下一项</van-button
            >
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
