zhangwencui
7 小时以前 141e304a60c73dc9d6b367fff140ffba5949bb8d
隐患排查上报模块开发
已添加6个文件
已修改2个文件
1803 ■■■■■ 文件已修改
src/api/safeProduction/dangerInvestigation.js 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages.json 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/dangerInvestigation/acceptance.vue 376 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/dangerInvestigation/detail.vue 446 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/dangerInvestigation/index.vue 353 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/dangerInvestigation/rectify.vue 312 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/dangerInvestigation/view.vue 203 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/safeProduction/dangerInvestigation.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
// å‘货台账页面接口
import request from "@/utils/request";
// åˆ†é¡µæŸ¥è¯¢
export function dangerInvestigationListPage(query) {
  return request({
    url: "/safeHidden/page",
    method: "get",
    params: query,
  });
}
// æ–°å¢žå®‰å…¨è§„程与资质管理
export function safeHiddenAdd(query) {
    return request({
        url: '/safeHidden',
        method: 'post',
        data: query
    })
}
// ä¿®æ”¹å®‰å…¨è§„程与资质管理
export function safeHiddenUpdate(query) {
    return request({
        url: '/safeHidden',
        method: 'put',
        data: query
    })
}
// åˆ é™¤å®‰å…¨è§„程与资质管理
export function safeHiddenDel(ids) {
    return request({
        url: '/safeHidden/' + ids,
        method: 'delete',
        data: ids
    })
}
// æŸ¥è¯¢é™„件列表
export function fileListPage(query) {
  return request({
    url: "/safeHiddenFile/listPage",
    method: "get",
    params: query,
  });
}
// æ·»åР附件
export function safeHiddenFileAdd(query) {
    return request({
        url: '/safeHiddenFile/add',
        method: 'post',
        data: query
    })
}
// åˆ é™¤é™„ä»¶
export function safeHiddenFileDel(ids) {
    return request({
        url: '/safeHiddenFile/del',
        method: 'delete',
        data: ids
    })
}
src/pages.json
@@ -717,6 +717,41 @@
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/dangerInvestigation/index",
      "style": {
        "navigationBarTitleText": "隐患排查上报",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/dangerInvestigation/detail",
      "style": {
        "navigationBarTitleText": "隐患上报详情",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/dangerInvestigation/view",
      "style": {
        "navigationBarTitleText": "隐患详情",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/dangerInvestigation/rectify",
      "style": {
        "navigationBarTitleText": "隐患整改",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/dangerInvestigation/acceptance",
      "style": {
        "navigationBarTitleText": "隐患验收",
        "navigationStyle": "custom"
      }
    },
  ],
  "subPackages": [
    {
src/pages/index.vue
@@ -311,6 +311,14 @@
      icon: "/static/images/icon/caigoutaizhang@2x.png",
      label: "危险作业",
    },
    {
      icon: "/static/images/icon/xunjianshangchuan@2x.png",
      label: "巡检上传",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "隐患排查",
    },
  ]);
  // ååŒåŠžå…¬åŠŸèƒ½æ•°æ®
  const collaborationItems = reactive([
@@ -398,10 +406,6 @@
    {
      icon: "/static/images/icon/shbeibaoyang@2x.png",
      label: "设备保养",
    },
    {
      icon: "/static/images/icon/xunjianshangchuan@2x.png",
      label: "巡检上传",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
@@ -688,6 +692,11 @@
          url: "/pages/cooperativeOffice/collaborativeApproval/index8",
        });
        break;
      case "隐患排查":
        uni.navigateTo({
          url: "/pages/safeProduction/dangerInvestigation/index",
        });
        break;
      default:
        uni.showToast({
          title: `点击了${item.label}`,
src/pages/safeProduction/dangerInvestigation/acceptance.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,376 @@
<template>
  <view class="danger-investigation-acceptance">
    <PageHeader title="隐患验收"
                @back="goBack" />
    <view class="section">
      <view class="section-title">隐患信息</view>
      <view class="info-item">
        <text class="info-label">隐患编号</text>
        <text class="info-value">{{ form.hiddenCode || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">隐患类型</text>
        <text class="info-value">{{ hidden_danger_type.find(i => String(i.value) === String(form.type))?.label || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">风险等级</text>
        <text class="info-value">{{ form.riskLevel || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">隐患描述</text>
        <text class="info-value">{{ form.hiddenDesc || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">隐患具体位置</text>
        <text class="info-value">{{ form.location || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">上报人</text>
        <text class="info-value">{{ form.createUserName || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">上报时间</text>
        <text class="info-value">{{ form.createTime || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">整改完成期限</text>
        <text class="info-value">{{ form.rectifyTime || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">整改责任人</text>
        <text class="info-value">{{ form.rectifyUserName || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">整改责任人联系方式</text>
        <text class="info-value">{{ form.rectifyUserMobile || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">整改具体措施</text>
        <text class="info-value">{{ form.rectifyMeasures || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">实际整改完成时间</text>
        <text class="info-value">{{ form.rectifyActualTime || '-' }}</text>
      </view>
    </view>
    <u-form @submit="handleSubmit"
            ref="formRef"
            label-width="110">
      <!-- éªŒæ”¶ä¿¡æ¯ -->
      <u-cell-group title="验收信息">
        <u-form-item label="验收时间"
                     prop="verifyTime"
                     border-bottom>
          <u-input v-model="form.verifyTime"
                   placeholder="请选择验收时间"
                   disabled />
        </u-form-item>
        <u-form-item label="验收人"
                     prop="verifyUserName"
                     border-bottom>
          <u-input v-model="form.verifyUserName"
                   disabled
                   placeholder="请输入验收人" />
        </u-form-item>
        <u-form-item label="验收结果"
                     prop="verifyResult"
                     required
                     border-bottom>
          <u-input v-model="verifyResultName"
                   placeholder="请选择验收结果"
                   @click="showVerifyResultSheet"
                   readonly />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showVerifyResultSheet"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="验收意见"
                     prop="verifyRemark"
                     required
                     border-bottom>
          <u-textarea v-model="form.verifyRemark"
                      placeholder="请输入验收意见"
                      :maxlength="200"
                      count
                      :autoHeight="true" />
        </u-form-item>
      </u-cell-group>
      <!-- æäº¤æŒ‰é’® -->
      <view class="footer-btns">
        <u-button class="cancel-btn"
                  @click="goBack">取消</u-button>
        <u-button class="sign-btn"
                  type="primary"
                  @click="handleSubmit"
                  :loading="loading">提交验收</u-button>
      </view>
    </u-form>
    <!-- æ—¶é—´é€‰æ‹©å™¨ -->
    <up-datetime-picker :show="showTime"
                        v-model="currentTime"
                        @confirm="onTimeConfirm"
                        @cancel="showTime = false"
                        mode="date" />
    <!-- éªŒæ”¶ç»“果选择器 -->
    <up-action-sheet :show="verifyResultSheetVisible"
                     :actions="verifyResultOptions"
                     @select="handleVerifyResultSelect"
                     title="选择验收结果" />
  </view>
</template>
<script setup>
  // æ›¿æ¢ toast æ–¹æ³•
  defineOptions({ name: "danger-investigation-acceptance" });
  const showToast = message => {
    uni.showToast({
      title: message,
      icon: "none",
    });
  };
  import { ref, onMounted } from "vue";
  import PageHeader from "@/components/PageHeader.vue";
  import { safeHiddenUpdate } from "@/api/safeProduction/dangerInvestigation";
  import useUserStore from "@/store/modules/user";
  import dayjs from "dayjs";
  import { onLoad } from "@dcloudio/uni-app";
  import { useDict } from "@/utils/dict";
  const { hidden_danger_type } = useDict("hidden_danger_type");
  const userStore = useUserStore();
  // è¡¨å•数据
  const form = ref({
    id: "",
    hiddenCode: "",
    hiddenDesc: "",
    location: "",
    rectifyTime: "",
    rectifyActualTime: "",
    rectifyResult: "",
    verifyTime: "",
    verifyRemark: "",
    verifyResult: "",
  });
  // é¡µé¢çŠ¶æ€
  const loading = ref(false);
  const formRef = ref(null);
  // æ—¶é—´ç›¸å…³
  const currentTime = ref(Date.now());
  const showTime = ref(false);
  // éªŒæ”¶ç»“果选择器
  const verifyResultSheetVisible = ref(false);
  const verifyResultName = ref("");
  const verifyResultOptions = ref([
    { value: "通过", name: "通过" },
    { value: "不通过", name: "不通过" },
  ]);
  const showVerifyResultSheet = () => {
    verifyResultSheetVisible.value = true;
  };
  const handleVerifyResultSelect = item => {
    form.value.verifyResult = item.value;
    verifyResultName.value = item.name;
    verifyResultSheetVisible.value = false;
  };
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("dangerInvestigation");
    uni.navigateBack();
  };
  // æ˜¾ç¤ºæ—¶é—´é€‰æ‹©å™¨
  const showTimePicker = () => {
    showTime.value = true;
  };
  // ç¡®è®¤æ—¶é—´é€‰æ‹©
  const onTimeConfirm = e => {
    form.value.verifyTime = dayjs(e.value).format("YYYY-MM-DD");
    currentTime.value = e.value;
    showTime.value = false;
  };
  // æäº¤è¡¨å•
  const handleSubmit = async () => {
    if (!form.value.verifyRemark) {
      showToast("请输入验收意见");
      return;
    }
    if (!form.value.verifyResult) {
      showToast("请选择验收结果");
      return;
    }
    try {
      loading.value = true;
      // ä½¿ç”¨å®‰å…¨æµ…拷贝,避免对象展开在某些运行时抛错
      const source =
        form.value && typeof form.value === "object" ? form.value : {};
      const submitData = {};
      Object.keys(source).forEach(k => {
        submitData[k] = source[k];
      });
      console.log("submitData", submitData);
      const { code } = await safeHiddenUpdate(submitData);
      if (code === 200) {
        showToast("验收提交成功");
        setTimeout(() => {
          goBack();
        }, 500);
      } else {
        loading.value = false;
        showToast("验收提交失败,请重试");
      }
    } catch (e) {
      loading.value = false;
      console.error("提交失败:", e);
      showToast("提交失败,请重试");
    }
  };
  onLoad(() => {
    // ä»Žæœ¬åœ°å­˜å‚¨èŽ·å–éšæ‚£æ•°æ®
    const dangerInvestigation = uni.getStorageSync("dangerInvestigation");
    if (dangerInvestigation && dangerInvestigation.id) {
      form.value = dangerInvestigation;
      console.log("form.value", form.value);
    } else {
      showToast("暂无隐患数据");
    }
  });
  // åˆå§‹åŒ–页面数据
  const initPageData = () => {
    // è®¾ç½®é»˜è®¤éªŒæ”¶æ—¶é—´ä¸ºå½“前时间
    if (!form.value.verifyTime) {
      form.value.verifyTime = dayjs().format("YYYY-MM-DD");
      currentTime.value = Date.now();
    }
    // è®¾ç½®å·²é€‰éªŒæ”¶ç»“果的显示文本
    if (form.value.verifyResult) {
      verifyResultName.value =
        verifyResultOptions.value.find(
          item => item.value === form.value.verifyResult
        )?.name || "";
    }
    // è®¾ç½®éªŒæ”¶äºº
    if (!form.value.verifyUserName) {
      userStore.getInfo().then(res => {
        form.value.verifyUserId = res.user.userId;
        form.value.verifyUserName = res.user.nickName;
      });
    }
    console.log("form.value", form.value);
  };
  onMounted(() => {
    initPageData();
  });
</script>
<style scoped lang="scss">
  @import "@/static/scss/form-common.scss";
  .danger-investigation-acceptance {
    min-height: 100vh;
    background-color: #f8f9fa;
    padding-bottom: 160rpx;
  }
  .footer-btns {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.75rem 0;
    box-shadow: 0 -0.125rem 0.5rem rgba(0, 0, 0, 0.05);
    z-index: 1000;
  }
  .cancel-btn {
    font-weight: 400;
    font-size: 1rem;
    color: #666;
    background: #f5f5f5;
    border: 1px solid #ddd;
    width: 45%;
    height: 2.5rem;
    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
  }
  .sign-btn {
    font-weight: 500;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    width: 45%;
    height: 2.5rem;
    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
  }
  .section {
    background-color: #ffffff;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  .section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #f0f0f0;
  }
  .info-item {
    display: flex;
    padding: 14px 16px;
    border-bottom: 1px solid #f8f8f8;
    align-items: flex-start;
  }
  .info-item:last-child {
    border-bottom: none;
  }
  .info-label {
    font-size: 14px;
    color: #666666;
    min-width: 80px;
    flex-shrink: 0;
    line-height: 22px;
  }
  .info-value {
    font-size: 14px;
    color: #333333;
    flex: 1;
    line-height: 22px;
    text-align: right;
  }
  .multi-line {
    text-align: left;
    word-break: break-all;
    line-height: 1.6;
  }
  .remark-item {
    padding-bottom: 16px;
  }
</style>
src/pages/safeProduction/dangerInvestigation/detail.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,446 @@
<template>
  <view class="danger-investigation-detail">
    <PageHeader :title="isEdit ? '编辑隐患' : '新增隐患'"
                @back="goBack" />
    <u-form @submit="handleSubmit"
            ref="formRef"
            label-width="110">
      <!-- é𐿂£ä¿¡æ¯ -->
      <u-cell-group title="隐患信息">
        <u-form-item label="隐患编号"
                     prop="hiddenCode"
                     border-bottom>
          <u-input v-model="form.hiddenCode"
                   placeholder="系统自动生成"
                   readonly />
        </u-form-item>
        <u-form-item label="隐患类型"
                     prop="type"
                     required
                     border-bottom>
          <u-input v-model="hiddenTypeName"
                   placeholder="请选择隐患类型"
                   @click="showHiddenTypeSheet"
                   readonly />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showHiddenTypeSheet"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="风险等级"
                     prop="riskLevel"
                     required
                     border-bottom>
          <u-input v-model="riskLevelName"
                   placeholder="请选择风险等级"
                   @click="showRiskLevelSheet"
                   readonly />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showRiskLevelSheet"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="隐患描述"
                     prop="hiddenDesc"
                     required
                     border-bottom>
          <u-textarea v-model="form.hiddenDesc"
                      placeholder="请输入隐患描述"
                      :maxlength="200"
                      count
                      :autoHeight="true" />
        </u-form-item>
        <u-form-item label="隐患具体位置"
                     prop="location"
                     required
                     border-bottom>
          <u-input v-model="form.location"
                   placeholder="请输入隐患具体位置" />
        </u-form-item>
        <u-form-item label="整改完成期限"
                     prop="rectifyTime"
                     required
                     border-bottom>
          <u-input v-model="form.rectifyTime"
                   placeholder="请选择整改完成期限"
                   @click="showTimePicker" />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showTimePicker"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="整改责任人"
                     prop="rectifyUserName"
                     required
                     border-bottom>
          <u-input v-model="form.rectifyUserName"
                   placeholder="请选择整改责任人"
                   @click="showPrincipalSheet"
                   readonly />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showPrincipalSheet"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="上报人"
                     prop="createUserName"
                     border-bottom>
          <u-input v-model="form.createUserName"
                   disabled
                   placeholder="请输入上报人" />
        </u-form-item>
        <u-form-item label="上报时间"
                     prop="createTime"
                     border-bottom>
          <u-input v-model="form.createTime"
                   disabled
                   placeholder="请输入上报时间" />
        </u-form-item>
      </u-cell-group>
      <!-- æäº¤æŒ‰é’® -->
      <view class="footer-btns">
        <u-button class="cancel-btn"
                  @click="goBack">取消</u-button>
        <u-button class="sign-btn"
                  type="primary"
                  @click="handleSubmit"
                  :loading="loading">{{ isEdit ? '保存修改' : '提交' }}</u-button>
      </view>
    </u-form>
    <!-- æ—¶é—´é€‰æ‹©å™¨ -->
    <up-datetime-picker :show="showTime"
                        v-model="currentTime"
                        @confirm="onTimeConfirm"
                        @cancel="showTime = false"
                        mode="date" />
    <!-- é𐿂£ç±»åž‹é€‰æ‹©å™¨ -->
    <up-action-sheet :show="hiddenTypeSheetVisible"
                     :actions="hiddenTypeOptions"
                     @select="handleHiddenTypeSelect"
                     title="选择隐患类型" />
    <!-- é£Žé™©ç­‰çº§é€‰æ‹©å™¨ -->
    <up-action-sheet :show="riskLevelSheetVisible"
                     :actions="riskLevelOptions"
                     @select="handleRiskLevelSelect"
                     title="选择风险等级" />
    <!-- æ•´æ”¹è´£ä»»äººé€‰æ‹©å™¨ -->
    <up-action-sheet :show="principalSheetVisible"
                     :actions="principalOptions"
                     @select="handlePrincipalSelect"
                     title="选择整改责任人" />
  </view>
</template>
<script setup>
  // æ›¿æ¢ toast æ–¹æ³•
  defineOptions({ name: "danger-investigation-detail" });
  const showToast = message => {
    uni.showToast({
      title: message,
      icon: "none",
    });
  };
  import { ref, onMounted } from "vue";
  import PageHeader from "@/components/PageHeader.vue";
  import {
    safeHiddenAdd,
    safeHiddenUpdate,
  } from "@/api/safeProduction/dangerInvestigation";
  import { userListNoPageByTenantId } from "@/api/system/user";
  import useUserStore from "@/store/modules/user";
  import { useDict } from "@/utils/dict";
  import dayjs from "dayjs";
  import { onLoad } from "@dcloudio/uni-app";
  // èŽ·å–å­—å…¸æ•°æ®
  const { hidden_danger_type } = useDict("hidden_danger_type");
  const userStore = useUserStore();
  // è¡¨å•数据
  const form = ref({
    hiddenCode: "",
    type: "",
    riskLevel: "",
    hiddenDesc: "",
    location: "",
    rectifyTime: "",
    rectifyUserName: "",
    rectifyUserMobile: "",
    rectifyMeasures: "",
  });
  // é¡µé¢çŠ¶æ€
  const loading = ref(false);
  const formRef = ref(null);
  const isEdit = ref(false);
  // æ—¶é—´ç›¸å…³
  const currentTime = ref(Date.now());
  const showTime = ref(false);
  // é𐿂£ç±»åž‹é€‰æ‹©å™¨
  const hiddenTypeSheetVisible = ref(false);
  const hiddenTypeName = ref("");
  const hiddenTypeOptions = ref([]);
  const showHiddenTypeSheet = () => {
    hiddenTypeSheetVisible.value = true;
  };
  const handleHiddenTypeSelect = item => {
    form.value.type = item.value;
    hiddenTypeName.value = item.name;
    hiddenTypeSheetVisible.value = false;
  };
  // é£Žé™©ç­‰çº§é€‰æ‹©å™¨
  const riskLevelSheetVisible = ref(false);
  const riskLevelName = ref("");
  const riskLevelOptions = ref([]);
  const showRiskLevelSheet = () => {
    riskLevelSheetVisible.value = true;
  };
  const handleRiskLevelSelect = item => {
    form.value.riskLevel = item.value;
    riskLevelName.value = item.name;
    riskLevelSheetVisible.value = false;
  };
  // æ•´æ”¹è´£ä»»äººé€‰æ‹©å™¨
  const principalSheetVisible = ref(false);
  const userList = ref([]);
  const principalOptions = ref([]);
  const showPrincipalSheet = () => {
    if (principalOptions.value.length === 0) {
      getUserList();
    } else {
      principalSheetVisible.value = true;
    }
  };
  const handlePrincipalSelect = item => {
    form.value.rectifyUserId = item.value;
    form.value.rectifyUserName = item.name;
    form.value.rectifyUserMobile = item.mobile;
    principalSheetVisible.value = false;
  };
  // èŽ·å–ç”¨æˆ·åˆ—è¡¨
  const getUserList = () => {
    userListNoPageByTenantId().then(res => {
      if (res.code === 200) {
        userList.value = res.data;
        principalOptions.value = res.data.map(user => ({
          value: user.userId,
          name: user.nickName,
          mobile: user.phonenumber,
        }));
        principalSheetVisible.value = true;
      }
    });
  };
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("dangerInvestigation");
    uni.navigateBack();
  };
  // æ˜¾ç¤ºæ—¶é—´é€‰æ‹©å™¨
  const showTimePicker = () => {
    showTime.value = true;
  };
  // ç¡®è®¤æ—¶é—´é€‰æ‹©
  const onTimeConfirm = e => {
    form.value.rectifyTime = dayjs(e.value).format("YYYY-MM-DD");
    currentTime.value = e.value;
    showTime.value = false;
  };
  // æäº¤è¡¨å•
  const handleSubmit = async () => {
    console.log("form.value", form.value);
    if (!form.value.type) {
      showToast("请选择隐患类型");
      return;
    }
    if (!form.value.riskLevel) {
      showToast("请选择风险等级");
      return;
    }
    if (!form.value.hiddenDesc) {
      showToast("请输入隐患描述");
      return;
    }
    if (!form.value.location) {
      showToast("请输入隐患具体位置");
      return;
    }
    if (!form.value.rectifyTime) {
      showToast("请选择整改完成期限");
      return;
    }
    if (!form.value.rectifyUserName) {
      showToast("请选择整改责任人");
      return;
    }
    if (!form.value.rectifyUserMobile) {
      showToast("请输入整改责任人联系方式");
      return;
    }
    try {
      loading.value = true;
      // ä½¿ç”¨å®‰å…¨æµ…拷贝,避免对象展开在某些运行时抛错
      const source =
        form.value && typeof form.value === "object" ? form.value : {};
      const submitData = {};
      Object.keys(source).forEach(k => {
        submitData[k] = source[k];
      });
      console.log("submitData", submitData);
      if (isEdit.value) {
        const { code } = await safeHiddenUpdate(submitData);
        if (code === 200) {
          showToast("修改成功");
          setTimeout(() => {
            goBack();
          }, 500);
        } else {
          loading.value = false;
          showToast("修改失败,请重试");
        }
      } else {
        const { code } = await safeHiddenAdd(submitData);
        if (code === 200) {
          showToast("新增成功");
          setTimeout(() => {
            goBack();
          }, 500);
        } else {
          loading.value = false;
          showToast("新增失败,请重试");
        }
      }
    } catch (e) {
      loading.value = false;
      console.error("提交失败:", e);
      showToast("提交失败,请重试");
    }
  };
  onLoad(() => {
    // ç¼–辑隐患时,从本地存储获取数据
    const dangerInvestigation = uni.getStorageSync("dangerInvestigation");
    if (dangerInvestigation && dangerInvestigation.id) {
      form.value = dangerInvestigation;
      isEdit.value = true;
    } else {
      isEdit.value = false;
    }
    userStore.getInfo().then(res => {
      form.value.createUser = res.user.userId;
      form.value.createUserName = res.user.nickName;
    });
    form.value.createTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
  });
  // åˆå§‹åŒ–页面数据
  const initPageData = () => {
    // è®¾ç½®é»˜è®¤æ•´æ”¹å®ŒæˆæœŸé™ä¸ºå½“前时间
    if (!isEdit.value) {
      form.value.rectifyTime = dayjs().format("YYYY-MM-DD");
      currentTime.value = Date.now();
    }
  };
  onMounted(() => {
    initPageData();
    // åˆå§‹åŒ–选项数据
    hiddenTypeOptions.value = hidden_danger_type.value.map(item => ({
      value: item.value,
      name: item.label,
    }));
    riskLevelOptions.value = [
      {
        value: "重大风险",
        name: "重大风险",
      },
      {
        value: "较大风险",
        name: "较大风险",
      },
      {
        value: "一般风险",
        name: "一般风险",
      },
      {
        value: "低风险",
        name: "低风险",
      },
    ];
    // è®¾ç½®å·²é€‰å€¼çš„æ˜¾ç¤ºæ–‡æœ¬
    if (form.value.type) {
      hiddenTypeName.value =
        hiddenTypeOptions.value.find(item => item.value == form.value.type)
          ?.name || "";
    }
    if (form.value.riskLevel) {
      riskLevelName.value =
        riskLevelOptions.value.find(item => item.value == form.value.riskLevel)
          ?.name || "";
    }
  });
</script>
<style scoped lang="scss">
  @import "@/static/scss/form-common.scss";
  .danger-investigation-detail {
    min-height: 100vh;
    background-color: #f8f9fa;
  }
  .footer-btns {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.75rem 0;
    box-shadow: 0 -0.125rem 0.5rem rgba(0, 0, 0, 0.05);
    z-index: 1000;
  }
  .cancel-btn {
    font-weight: 400;
    font-size: 1rem;
    color: #666;
    background: #f5f5f5;
    border: 1px solid #ddd;
    width: 45%;
    height: 2.5rem;
    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
  }
  .sign-btn {
    font-weight: 500;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    width: 45%;
    height: 2.5rem;
    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
  }
</style>
src/pages/safeProduction/dangerInvestigation/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,353 @@
<template>
  <view class="sales-accoun">
    <!-- ä½¿ç”¨é€šç”¨é¡µé¢å¤´éƒ¨ç»„ä»¶ -->
    <PageHeader title="隐患排查上报"
                @back="goBack" />
    <!-- æœç´¢å’Œç­›é€‰åŒºåŸŸ -->
    <!-- <view class="search-section">
      <view class="search-bar">
        <view class="search-input">
          <up-input class="search-text"
                    placeholder="请输入危险源名称"
                    v-model="customerName"
                    @blur="getList"
                    clearable />
        </view>
        <view class="filter-button"
              @click="getList">
          <u-icon name="search"
                  size="24"
                  color="#999"></u-icon>
        </view>
      </view>
    </view> -->
    <!-- æ‹œè®¿è®°å½•列表 -->
    <view class="ledger-list"
          v-if="visitList.length > 0">
      <view v-for="(item, index) in visitList"
            :key="index">
        <view class="ledger-item">
          <view class="item-header">
            <view class="item-left">
              <view class="document-icon">
                <up-icon name="file-text"
                         size="16"
                         color="#ffffff"></up-icon>
              </view>
              <text class="item-id">隐患编号:{{ item.hiddenCode }}</text>
            </view>
          </view>
          <up-divider></up-divider>
          <view class="item-details"
                @click="viewDetail(item)">
            <view class="detail-row">
              <text class="detail-label">隐患描述</text>
              <text class="detail-value">{{ item.hiddenDesc || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">隐患类型</text>
              <text class="detail-value">{{ hidden_danger_type.find(i => String(i.value) === String(item.type))?.label || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">风险等级</text>
              <u-tag :type="getRiskLevelType(item.riskLevel)">
                {{ item.riskLevel || '-' }}
              </u-tag>
            </view>
            <view class="detail-row">
              <text class="detail-label">隐患具体位置</text>
              <text class="detail-value">{{ item.location || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">上报人</text>
              <text class="detail-value">{{ item.createUserName || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">上报时间</text>
              <text class="detail-value">{{ item.createTime || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">整改完成期限</text>
              <text class="detail-value">{{ item.rectifyTime || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">整改责任人</text>
              <text class="detail-value">{{ item.rectifyUserName || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">整改责任人联系方式</text>
              <text class="detail-value">{{ item.rectifyUserMobile || '-' }}</text>
            </view>
            <view v-if="item.rectifyActualTime"
                  class="detail-row">
              <text class="detail-label">整改具体措施</text>
              <text class="detail-value">{{ item.rectifyMeasures || '-' }}</text>
            </view>
            <view v-if="item.rectifyActualTime"
                  class="detail-row">
              <text class="detail-label">实际整改完成时间</text>
              <text class="detail-value">{{ item.rectifyActualTime || '-' }}</text>
            </view>
            <view v-if="item.verifyTime"
                  class="detail-row">
              <text class="detail-label">验收意见</text>
              <text class="detail-value">{{ item.verifyRemark || '-' }}</text>
            </view>
            <view v-if="item.verifyTime"
                  class="detail-row">
              <text class="detail-label">验收时间</text>
              <text class="detail-value">{{ item.verifyTime || '-' }}</text>
            </view>
            <view v-if="item.verifyTime"
                  class="detail-row">
              <text class="detail-label">验收人</text>
              <text class="detail-value">{{ item.verifyUserName || '-' }}</text>
            </view>
            <view v-if="item.verifyTime"
                  class="detail-row">
              <text class="detail-label">验收结果</text>
              <text class="detail-value">{{ item.verifyResult || '-' }}</text>
            </view>
          </view>
          <!-- æŒ‰é’®åŒºåŸŸ -->
          <view class="action-buttons">
            <!-- <u-button type="info"
                      size="small"
                      class="action-btn"
                      @click="viewDetail(item)">
              æŸ¥çœ‹è¯¦æƒ…
            </u-button> -->
            <u-button type="primary"
                      size="small"
                      class="action-btn"
                      @click="editVisit(item)">
              ç¼–辑
            </u-button>
            <u-button type="warning"
                      size="small"
                      class="action-btn"
                      :disabled="item.isRectify"
                      @click="rectifyVisit(item)">
              æ•´æ”¹
            </u-button>
            <u-button type="success"
                      size="small"
                      class="action-btn"
                      :disabled="!item.rectifyActualTime"
                      @click="acceptanceVisit(item)">
              éªŒæ”¶
            </u-button>
            <u-button type="error"
                      size="small"
                      class="action-btn"
                      @click="deleteVisit(item)">
              åˆ é™¤
            </u-button>
          </view>
        </view>
      </view>
    </view>
    <view v-else
          class="no-data">
      <text>暂无拜访记录</text>
    </view>
    <!-- æµ®åŠ¨æ–°å¢žæŒ‰é’® -->
    <view class="fab-button"
          @click="addVisit">
      <up-icon name="plus"
               size="24"
               color="#ffffff"></up-icon>
    </view>
  </view>
</template>
<script setup>
  import { ref, onMounted } from "vue";
  import { onShow } from "@dcloudio/uni-app";
  import PageHeader from "@/components/PageHeader.vue";
  import {
    dangerInvestigationListPage,
    safeHiddenDel,
  } from "@/api/safeProduction/dangerInvestigation";
  import useUserStore from "@/store/modules/user";
  import { useDict } from "@/utils/dict";
  // æ›¿æ¢ toast æ–¹æ³•
  defineOptions({ name: "client-visit-index" });
  const showToast = message => {
    uni.showToast({
      title: message,
      icon: "none",
    });
  };
  const getRiskLevelType = riskLevel => {
    const typeMap = {
      ä½Žé£Žé™©: "info",
      ä¸€èˆ¬é£Žé™©: "info",
      è¾ƒå¤§é£Žé™©: "warning",
      é‡å¤§é£Žé™©: "error",
    };
    return typeMap[riskLevel] || "info";
  };
  import dayjs from "dayjs";
  const userStore = useUserStore();
  // æœç´¢å…³é”®è¯
  const customerName = ref("");
  // æ‹œè®¿è®°å½•数据
  const visitList = ref([]);
  // è¿”回上一页
  const goBack = () => {
    uni.navigateBack();
  };
  // æŸ¥è¯¢åˆ—表
  const getList = () => {
    showLoadingToast("加载中...");
    const params = {
      current: -1,
      size: -1,
    };
    dangerInvestigationListPage(params)
      .then(res => {
        visitList.value = res.records || res.data?.records || [];
        userStore.getInfo().then(res => {
          visitList.value.forEach(item => {
            console.log(item.rectifyUserId, res.user.userId);
            if (Number(item.rectifyUserId) != Number(res.user.userId)) {
              item.isRectify = true;
            } else {
              item.isRectify = false;
            }
          });
        });
        closeToast();
      })
      .catch(() => {
        closeToast();
        showToast("获取数据失败");
      });
  };
  // æ˜¾ç¤ºåŠ è½½æç¤º
  const showLoadingToast = message => {
    uni.showLoading({
      title: message,
      mask: true,
    });
  };
  // å…³é—­æç¤º
  const closeToast = () => {
    uni.hideLoading();
  };
  // æ–°å¢žé𐿂£
  const addVisit = () => {
    uni.setStorageSync("dangerInvestigation", {});
    uni.navigateTo({
      url: "/pages/safeProduction/dangerInvestigation/detail",
    });
  };
  // ç¼–辑隐患
  const editVisit = item => {
    uni.setStorageSync("dangerInvestigation", item);
    uni.navigateTo({
      url: "/pages/safeProduction/dangerInvestigation/detail",
    });
  };
  // æ•´æ”¹é𐿂£
  const rectifyVisit = item => {
    uni.setStorageSync("dangerInvestigation", item);
    uni.navigateTo({
      url: "/pages/safeProduction/dangerInvestigation/rectify",
    });
  };
  // éªŒæ”¶é𐿂£
  const acceptanceVisit = item => {
    uni.setStorageSync("dangerInvestigation", item);
    uni.navigateTo({
      url: "/pages/safeProduction/dangerInvestigation/acceptance",
    });
  };
  // åˆ é™¤é𐿂£
  const deleteVisit = item => {
    uni.showModal({
      title: "删除确认",
      content: `确定要删除该隐患吗?`,
      success: res => {
        if (res.confirm) {
          deleteClientVisit(item.id);
        }
      },
    });
  };
  const { hidden_danger_type } = useDict("hidden_danger_type");
  // åˆ é™¤é𐿂£è®°å½•
  const deleteClientVisit = id => {
    showLoadingToast("删除中...");
    safeHiddenDel([id])
      .then(() => {
        closeToast();
        showToast("删除成功");
        getList();
      })
      .catch(() => {
        closeToast();
        showToast("删除失败");
      });
  };
  // æŸ¥çœ‹è¯¦æƒ…
  const viewDetail = item => {
    uni.setStorageSync("dangerInvestigation", item);
    uni.navigateTo({
      url: "/pages/safeProduction/dangerInvestigation/view",
    });
  };
  onMounted(() => {
    getList();
  });
  onShow(() => {
    getList();
  });
</script>
<style scoped lang="scss">
  @import "../../../styles/sales-common.scss";
  // é¡µé¢ç‰¹å®šçš„æ ·å¼è¦†ç›–
  .sales-accoun {
    min-height: 100vh;
    background: #f8f9fa;
    position: relative;
    padding-bottom: 80px;
  }
  // ç‰¹å®šçš„图标样式
  .document-icon {
    background: #667eea; // ä¿æŒé¡µé¢ç‰¹æœ‰çš„背景色
  }
  // ç‰¹æœ‰æ ·å¼
  .visit-status {
    display: flex;
    align-items: center;
  }
  .detail-value {
    word-break: break-all; // ä¿ç•™é¡µé¢ç‰¹æœ‰çš„æ–‡æœ¬æ¢è¡Œæ ·å¼
  }
  // ç‰¹å®šçš„æµ®åŠ¨æŒ‰é’®æ ·å¼
  .fab-button {
    background: #667eea; // ä¿æŒé¡µé¢ç‰¹æœ‰çš„背景色
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3); // ä¿æŒé¡µé¢ç‰¹æœ‰çš„阴影效果
  }
</style>
src/pages/safeProduction/dangerInvestigation/rectify.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,312 @@
<template>
  <view class="danger-investigation-rectify">
    <PageHeader title="隐患整改"
                @back="goBack" />
    <view class="section">
      <view class="section-title">隐患信息</view>
      <view class="info-item">
        <text class="info-label">隐患编号</text>
        <text class="info-value">{{ form.hiddenCode || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">隐患类型</text>
        <text class="info-value">{{ hidden_danger_type.find(i => String(i.value) === String(form.type))?.label || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">风险等级</text>
        <text class="info-value">{{ form.riskLevel || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">隐患描述</text>
        <text class="info-value">{{ form.hiddenDesc || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">隐患具体位置</text>
        <text class="info-value">{{ form.location || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">上报人</text>
        <text class="info-value">{{ form.createUserName || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">上报时间</text>
        <text class="info-value">{{ form.createTime || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">整改完成期限</text>
        <text class="info-value">{{ form.rectifyTime || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">整改责任人</text>
        <text class="info-value">{{ form.rectifyUserName || '-' }}</text>
      </view>
      <view class="info-item">
        <text class="info-label">整改责任人联系方式</text>
        <text class="info-value">{{ form.rectifyUserMobile || '-' }}</text>
      </view>
    </view>
    <u-form @submit="handleSubmit"
            ref="formRef"
            label-width="130">
      <!-- æ•´æ”¹ä¿¡æ¯ -->
      <u-cell-group title="整改信息">
        <u-form-item label="实际整改完成时间"
                     prop="rectifyActualTime"
                     required
                     border-bottom>
          <u-input v-model="form.rectifyActualTime"
                   placeholder="请选择实际整改完成时间"
                   @click="showTimePicker" />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showTimePicker"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="整改具体措施"
                     required
                     border-bottom>
          <u-textarea v-model="form.rectifyMeasures"
                      readonly
                      :autoHeight="true" />
        </u-form-item>
      </u-cell-group>
      <!-- æäº¤æŒ‰é’® -->
      <view class="footer-btns">
        <u-button class="cancel-btn"
                  @click="goBack">取消</u-button>
        <u-button class="sign-btn"
                  type="primary"
                  @click="handleSubmit"
                  :loading="loading">提交整改</u-button>
      </view>
    </u-form>
    <!-- æ—¶é—´é€‰æ‹©å™¨ -->
    <up-datetime-picker :show="showTime"
                        v-model="currentTime"
                        @confirm="onTimeConfirm"
                        @cancel="showTime = false"
                        mode="date" />
  </view>
</template>
<script setup>
  // æ›¿æ¢ toast æ–¹æ³•
  defineOptions({ name: "danger-investigation-rectify" });
  const showToast = message => {
    uni.showToast({
      title: message,
      icon: "none",
    });
  };
  import { ref, onMounted } from "vue";
  import PageHeader from "@/components/PageHeader.vue";
  import { safeHiddenUpdate } from "@/api/safeProduction/dangerInvestigation";
  import useUserStore from "@/store/modules/user";
  import dayjs from "dayjs";
  import { onLoad } from "@dcloudio/uni-app";
  import { useDict } from "@/utils/dict";
  const userStore = useUserStore();
  const { hidden_danger_type } = useDict("hidden_danger_type");
  // è¡¨å•数据
  const form = ref({
    id: "",
    hiddenCode: "",
    hiddenDesc: "",
    location: "",
    rectifyTime: "",
    rectifyUserName: "",
    rectifyUserMobile: "",
    rectifyMeasures: "",
    rectifyActualTime: "",
    rectifyResult: "",
  });
  // é¡µé¢çŠ¶æ€
  const loading = ref(false);
  const formRef = ref(null);
  // æ—¶é—´ç›¸å…³
  const currentTime = ref(Date.now());
  const showTime = ref(false);
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("dangerInvestigation");
    uni.navigateBack();
  };
  // æ˜¾ç¤ºæ—¶é—´é€‰æ‹©å™¨
  const showTimePicker = () => {
    showTime.value = true;
  };
  // ç¡®è®¤æ—¶é—´é€‰æ‹©
  const onTimeConfirm = e => {
    form.value.rectifyActualTime = dayjs(e.value).format("YYYY-MM-DD");
    currentTime.value = e.value;
    showTime.value = false;
  };
  // æäº¤è¡¨å•
  const handleSubmit = async () => {
    if (!form.value.rectifyActualTime) {
      showToast("请选择实际整改完成时间");
      return;
    }
    if (!form.value.rectifyMeasures) {
      showToast("请输入整改具体措施");
      return;
    }
    try {
      loading.value = true;
      // ä½¿ç”¨å®‰å…¨æµ…拷贝,避免对象展开在某些运行时抛错
      const source =
        form.value && typeof form.value === "object" ? form.value : {};
      const submitData = {};
      Object.keys(source).forEach(k => {
        submitData[k] = source[k];
      });
      console.log("submitData", submitData);
      const { code } = await safeHiddenUpdate(submitData);
      if (code === 200) {
        showToast("整改提交成功");
        setTimeout(() => {
          goBack();
        }, 500);
      } else {
        loading.value = false;
        showToast("整改提交失败,请重试");
      }
    } catch (e) {
      loading.value = false;
      console.error("提交失败:", e);
      showToast("提交失败,请重试");
    }
  };
  onLoad(() => {
    // ä»Žæœ¬åœ°å­˜å‚¨èŽ·å–éšæ‚£æ•°æ®
    const dangerInvestigation = uni.getStorageSync("dangerInvestigation");
    if (dangerInvestigation && dangerInvestigation.id) {
      form.value = dangerInvestigation;
      console.log("form.value", form.value);
    } else {
      showToast("暂无隐患数据");
    }
  });
  // åˆå§‹åŒ–页面数据
  const initPageData = () => {
    // è®¾ç½®é»˜è®¤å®žé™…整改完成时间为当前时间
    if (!form.value.rectifyActualTime) {
      form.value.rectifyActualTime = dayjs().format("YYYY-MM-DD");
      currentTime.value = Date.now();
    }
  };
  onMounted(() => {
    initPageData();
  });
</script>
<style scoped lang="scss">
  @import "@/static/scss/form-common.scss";
  .danger-investigation-rectify {
    min-height: 100vh;
    background-color: #f8f9fa;
    padding-bottom: 160rpx;
  }
  .footer-btns {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.75rem 0;
    box-shadow: 0 -0.125rem 0.5rem rgba(0, 0, 0, 0.05);
    z-index: 1000;
  }
  .cancel-btn {
    font-weight: 400;
    font-size: 1rem;
    color: #666;
    background: #f5f5f5;
    border: 1px solid #ddd;
    width: 45%;
    height: 2.5rem;
    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
  }
  .sign-btn {
    font-weight: 500;
    font-size: 1rem;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    width: 45%;
    height: 2.5rem;
    border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
  }
  .section {
    background-color: #ffffff;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  .section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #f0f0f0;
  }
  .info-item {
    display: flex;
    padding: 14px 16px;
    border-bottom: 1px solid #f8f8f8;
    align-items: flex-start;
  }
  .info-item:last-child {
    border-bottom: none;
  }
  .info-label {
    font-size: 14px;
    color: #666666;
    min-width: 80px;
    flex-shrink: 0;
    line-height: 22px;
  }
  .info-value {
    font-size: 14px;
    color: #333333;
    flex: 1;
    line-height: 22px;
    text-align: right;
  }
  .multi-line {
    text-align: left;
    word-break: break-all;
    line-height: 1.6;
  }
  .remark-item {
    padding-bottom: 16px;
  }
</style>
src/pages/safeProduction/dangerInvestigation/view.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,203 @@
<template>
  <view class="danger-investigation-view">
    <PageHeader title="隐患详情"
                @back="goBack" />
    <!-- å†…容容器 -->
    <view class="content-container">
      <!-- é𐿂£ä¿¡æ¯ -->
      <view class="section">
        <view class="section-title">隐患信息</view>
        <view class="info-item">
          <text class="info-label">隐患编号</text>
          <text class="info-value">{{ form.hiddenCode || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">隐患类型</text>
          <text class="info-value">{{ hidden_danger_type.find(i => String(i.value) === String(form.type))?.label || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">风险等级</text>
          <text class="info-value">{{ form.riskLevel || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">隐患描述</text>
          <text class="info-value">{{ form.hiddenDesc || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">隐患具体位置</text>
          <text class="info-value">{{ form.location || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">上报人</text>
          <text class="info-value">{{ form.createUserName || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">上报时间</text>
          <text class="info-value">{{ form.createTime || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">整改完成期限</text>
          <text class="info-value">{{ form.rectifyTime || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">整改责任人</text>
          <text class="info-value">{{ form.rectifyUserName || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">整改责任人联系方式</text>
          <text class="info-value">{{ form.rectifyUserMobile || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">整改具体措施</text>
          <text class="info-value">{{ form.rectifyMeasures || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">实际整改完成时间</text>
          <text class="info-value">{{ form.rectifyActualTime || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">验收时间</text>
          <text class="info-value">{{ form.verifyTime || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">验收人</text>
          <text class="info-value">{{ form.verifyUserName || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">验收结果</text>
          <text class="info-value">{{ form.verifyResult || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">验收意见</text>
          <text class="info-value">{{ form.verifyRemark || '-' }}</text>
        </view>
      </view>
    </view>
  </view>
</template>
<script setup>
  // æ›¿æ¢ toast æ–¹æ³•
  const showToast = message => {
    uni.showToast({
      title: message,
      icon: "none",
    });
  };
  import { ref, onMounted } from "vue";
  import PageHeader from "@/components/PageHeader.vue";
  import useUserStore from "@/store/modules/user";
  import { onLoad } from "@dcloudio/uni-app";
  import { useDict } from "@/utils/dict";
  const { hidden_danger_type } = useDict("hidden_danger_type");
  const userStore = useUserStore();
  // è¡¨å•数据
  const form = ref({
    hiddenCode: "",
    hiddenType: "",
    riskLevel: "",
    hiddenDesc: "",
    location: "",
    createUserName: "",
    createTime: "",
    rectifyTime: "",
    rectifyUserName: "",
    rectifyUserMobile: "",
    rectifyMeasures: "",
    rectifyActualTime: "",
    rectifyResult: "",
    acceptanceTime: "",
    acceptanceOpinion: "",
    verifyResult: "",
  });
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("dangerInvestigation");
    uni.navigateBack();
  };
  // åˆå§‹åŒ–页面数据
  const initPageData = () => {
    // ä»Žæœ¬åœ°å­˜å‚¨èŽ·å–éšæ‚£è¯¦æƒ…
    const row = uni.getStorageSync("dangerInvestigation");
    if (row) {
      form.value = { ...row };
    } else {
      showToast("暂无隐患数据");
    }
  };
  onMounted(() => {
    initPageData();
  });
</script>
<style scoped lang="scss">
  @import "@/static/scss/form-common.scss";
  .danger-investigation-view {
    min-height: 100vh;
    background-color: #f8f9fa;
  }
  .content-container {
    padding: 16px;
  }
  .section {
    background-color: #ffffff;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  .section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #f0f0f0;
  }
  .info-item {
    display: flex;
    padding: 14px 16px;
    border-bottom: 1px solid #f8f8f8;
    align-items: flex-start;
  }
  .info-item:last-child {
    border-bottom: none;
  }
  .info-label {
    font-size: 14px;
    color: #666666;
    min-width: 80px;
    flex-shrink: 0;
    line-height: 22px;
  }
  .info-value {
    font-size: 14px;
    color: #333333;
    flex: 1;
    line-height: 22px;
    text-align: right;
  }
  .multi-line {
    text-align: left;
    word-break: break-all;
    line-height: 1.6;
  }
  .remark-item {
    padding-bottom: 16px;
  }
</style>