zhangwencui
8 小时以前 4dca88c6433e3b3e370dce4ba139a3fd0287c020
安全规程与资质管理、危险源台账模块开发
已添加8个文件
已修改2个文件
1834 ■■■■■ 文件已修改
src/api/safeProduction/hazardSourceLedger.js 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/safeProduction/safeQualifications.js 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages.json 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index.vue 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/hazardSourceLedger/detail.vue 431 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/hazardSourceLedger/index.vue 291 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/hazardSourceLedger/view.vue 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/safeQualifications/detail.vue 317 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/safeQualifications/index.vue 263 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/safeQualifications/view.vue 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/safeProduction/hazardSourceLedger.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
// å‘货台账页面接口
import request from "@/utils/request";
// åˆ†é¡µæŸ¥è¯¢
export function safeHazardListPage(query) {
  return request({
    url: "/safeHazard/page",
    method: "get",
    params: query,
  });
}
// æ–°å¢žå±é™©æºå°è´¦
export function safeHazardAdd(query) {
    return request({
        url: '/safeHazard',
        method: 'post',
        data: query
    })
}
// ä¿®æ”¹å±é™©æºå°è´¦
export function safeHazardUpdate(query) {
    return request({
        url: '/safeHazard',
        method: 'put',
        data: query
    })
}
// åˆ é™¤å±é™©æºå°è´¦
export function safeHazardDel(ids) {
    return request({
        url: '/safeHazard/' + ids,
        method: 'delete',
        data: ids
    })
}
src/api/safeProduction/safeQualifications.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
// å‘货台账页面接口
import request from "@/utils/request";
// åˆ†é¡µæŸ¥è¯¢
export function qualificationsListPage(query) {
  return request({
    url: "/safeCertification/page",
    method: "get",
    params: query,
  });
}
// æ–°å¢žå®‰å…¨è§„程与资质管理
export function safeCertificationAdd(query) {
    return request({
        url: '/safeCertification',
        method: 'post',
        data: query
    })
}
// ä¿®æ”¹å®‰å…¨è§„程与资质管理
export function safeCertificationUpdate(query) {
    return request({
        url: '/safeCertification',
        method: 'put',
        data: query
    })
}
// åˆ é™¤å®‰å…¨è§„程与资质管理
export function safeCertificationDel(ids) {
    return request({
        url: '/safeCertification/' + ids,
        method: 'delete',
        data: ids
    })
}
// æŸ¥è¯¢é™„件列表
export function fileListPage(query) {
  return request({
    url: "/safeCertificationFile/listPage",
    method: "get",
    params: query,
  });
}
// æ·»åР附件
export function safeCertificationFileAdd(query) {
    return request({
        url: '/safeCertificationFile/add',
        method: 'post',
        data: query
    })
}
// åˆ é™¤é™„ä»¶
export function safeCertificationFileDel(ids) {
    return request({
        url: '/safeCertificationFile/del',
        method: 'delete',
        data: ids
    })
}
src/pages.json
@@ -667,7 +667,49 @@
        "navigationBarTitleText": "自定义出库",
        "navigationStyle": "custom"
      }
    }
    },
    {
      "path": "pages/safeProduction/safeQualifications/index",
      "style": {
        "navigationBarTitleText": "规程资质",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/safeQualifications/detail",
      "style": {
        "navigationBarTitleText": "规程资质详情",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/safeQualifications/view",
      "style": {
        "navigationBarTitleText": "规程资质详情",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/hazardSourceLedger/index",
      "style": {
        "navigationBarTitleText": "危险源台账",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/hazardSourceLedger/detail",
      "style": {
        "navigationBarTitleText": "危险源详情",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/hazardSourceLedger/view",
      "style": {
        "navigationBarTitleText": "危险源详情",
        "navigationStyle": "custom"
      }
    },
  ],
  "subPackages": [
    {
src/pages/index.vue
@@ -109,6 +109,30 @@
        </up-grid>
      </view>
    </view>
    <!-- å®‰å…¨ç”Ÿäº§æ¨¡å— -->
    <view class="common-module collaboration-module">
      <view class="module-header">
        <view class="module-title-container">
          <text class="module-title">安全生产</text>
        </view>
      </view>
      <view class="module-content">
        <up-grid :border="false"
                 col="4">
          <up-grid-item v-for="(item, index) in safetyItems"
                        :key="index"
                        @click="handleCommonItemClick(item)">
            <view class="icon-container"
                  :style="{ background: item.bgColor }">
              <up-icon :name="item.icon"
                       :size="58"
                       color="#ffffff"></up-icon>
            </view>
            <text class="item-label">{{item.label}}</text>
          </up-grid-item>
        </up-grid>
      </view>
    </view>
    <!-- ç”Ÿäº§ç®¡æŽ§æ¨¡å— -->
    <!--        <view class="common-module production-module">-->
    <!--            <view class="module-header">-->
@@ -275,7 +299,16 @@
      label: "供应商往来",
    },
  ]);
  const safetyItems = reactive([
    {
      icon: "/static/images/icon/caigoutaizhang@2x.png",
      label: "规程资质",
    },
    {
      icon: "/static/images/icon/caigoutaizhang@2x.png",
      label: "危险源管理",
    },
  ]);
  // ååŒåŠžå…¬åŠŸèƒ½æ•°æ®
  const collaborationItems = reactive([
    {
@@ -637,6 +670,16 @@
          url: "/pages/equipmentManagement/verification/index",
        });
        break;
      case "规程资质":
        uni.navigateTo({
          url: "/pages/safeProduction/safeQualifications/index",
        });
        break;
      case "危险源管理":
        uni.navigateTo({
          url: "/pages/safeProduction/hazardSourceLedger/index",
        });
        break;
      default:
        uni.showToast({
          title: `点击了${item.label}`,
src/pages/safeProduction/hazardSourceLedger/detail.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,431 @@
<template>
  <view class="hazard-source-detail">
    <PageHeader :title="isEdit ? '编辑危险源' : '新增危险源'"
                @back="goBack" />
    <u-form @submit="handleSubmit"
            ref="formRef"
            label-width="110">
      <!-- å±é™©æºä¿¡æ¯ -->
      <u-cell-group title="危险源信息">
        <u-form-item label="危险源名称"
                     prop="name"
                     required
                     border-bottom>
          <u-input v-model="form.name"
                   placeholder="请输入危险源名称" />
        </u-form-item>
        <u-form-item label="危险源编码"
                     prop="code"
                     required
                     border-bottom>
          <u-input v-model="form.code"
                   placeholder="请输入危险源编码" />
        </u-form-item>
        <u-form-item label="危险源类型"
                     prop="type"
                     required
                     border-bottom>
          <u-input v-model="typeName"
                   placeholder="请选择危险源类型"
                   @click="showTypeSheet"
                   readonly />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showTypeSheet"></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="location"
                     required
                     border-bottom>
          <u-input v-model="form.location"
                   placeholder="请输入所在位置" />
        </u-form-item>
        <u-form-item label="管控措施"
                     prop="controlMeasures"
                     required
                     border-bottom>
          <u-textarea v-model="form.controlMeasures"
                      placeholder="请输入管控措施"
                      :maxlength="200"
                      count
                      :autoHeight="true" />
        </u-form-item>
        <u-form-item label="库存数量"
                     prop="stockQty"
                     border-bottom>
          <u-input v-model="form.stockQty"
                   type="number"
                   min="0"
                   @blur="validateStockQty"
                   placeholder="请输入库存数量" />
        </u-form-item>
        <u-form-item label="管控责任人"
                     prop="principalUser"
                     required
                     border-bottom>
          <u-input v-model="form.principalUser"
                   placeholder="请选择管控责任人"
                   @click="showPrincipalSheet"
                   readonly />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showPrincipalSheet"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="责任人联系电话"
                     prop="principalMobile"
                     required
                     border-bottom>
          <u-input v-model="form.principalMobile"
                   placeholder="请输入责任人联系电话" />
        </u-form-item>
        <u-form-item label="规格 / é£Žé™©æè¿°"
                     prop="specInfo"
                     border-bottom>
          <u-textarea v-model="form.specInfo"
                      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">{{ isEdit ? '保存修改' : '提交' }}</u-button>
      </view>
    </u-form>
    <!-- å±é™©æºç±»åž‹é€‰æ‹©å™¨ -->
    <up-action-sheet :show="typeSheetVisible"
                     :actions="typeOptions"
                     @select="handleTypeSelect"
                     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: "hazard-source-detail" });
  const showToast = message => {
    uni.showToast({
      title: message,
      icon: "none",
    });
  };
  import { ref, onMounted, nextTick } from "vue";
  import PageHeader from "@/components/PageHeader.vue";
  import {
    safeHazardAdd,
    safeHazardUpdate,
  } from "@/api/safeProduction/hazardSourceLedger";
  import { userListNoPageByTenantId } from "@/api/system/user";
  import useUserStore from "@/store/modules/user";
  import { useDict } from "@/utils/dict";
  import { onLoad } from "@dcloudio/uni-app";
  // èŽ·å–å­—å…¸æ•°æ®
  const { hazard_source_type } = useDict("hazard_source_type");
  const userStore = useUserStore();
  // è¡¨å•数据
  const form = ref({
    name: "",
    code: "",
    type: "",
    riskLevel: "",
    location: "",
    controlMeasures: "",
    stockQty: "",
    principalUser: "",
    principalUserId: "",
    principalMobile: "",
    specInfo: "",
  });
  // é¡µé¢çŠ¶æ€
  const loading = ref(false);
  const formRef = ref(null);
  const isEdit = ref(false);
  // å±é™©æºç±»åž‹é€‰æ‹©å™¨
  const typeSheetVisible = ref(false);
  const typeName = ref("");
  const typeOptions = ref([]);
  const showTypeSheet = () => {
    typeSheetVisible.value = true;
  };
  const handleTypeSelect = item => {
    form.value.type = item.value;
    typeName.value = item.name;
    typeSheetVisible.value = false;
  };
  const validateStockQty = val => {
    let numVal = Number(val);
    if (isNaN(numVal)) {
      numVal = 0;
    }
    if (numVal < 0) {
      showToast("库存数量不能小于0");
      numVal = 0;
    }
    // ä½¿ç”¨ nextTick ç¡®ä¿è§†å›¾æ›´æ–°
    nextTick(() => {
      form.value.stockQty = numVal;
    });
  };
  // é£Žé™©ç­‰çº§é€‰æ‹©å™¨
  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 => {
    console.log(item, "item");
    form.value.principalUser = item.name;
    form.value.principalUserId = item.value;
    form.value.principalMobile = item.phonenumber;
    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,
          phonenumber: user.phonenumber,
        }));
        principalSheetVisible.value = true;
      }
    });
  };
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("hazardSourceLedger");
    uni.navigateBack();
  };
  // æäº¤è¡¨å•
  const handleSubmit = async () => {
    if (!form.value.name) {
      showToast("请输入危险源名称");
      return;
    }
    if (!form.value.code) {
      showToast("请输入危险源编码");
      return;
    }
    if (!form.value.type) {
      showToast("请选择危险源类型");
      return;
    }
    if (!form.value.riskLevel) {
      showToast("请选择风险等级");
      return;
    }
    if (!form.value.location) {
      showToast("请输入所在位置");
      return;
    }
    if (!form.value.controlMeasures) {
      showToast("请输入管控措施");
      return;
    }
    if (!form.value.principalUser) {
      showToast("请输入管控责任人");
      return;
    }
    if (!form.value.principalMobile) {
      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 safeHazardUpdate(submitData);
        if (code === 200) {
          showToast("修改成功");
          setTimeout(() => {
            goBack();
          }, 500);
        } else {
          loading.value = false;
          showToast("修改失败,请重试");
        }
      } else {
        const { code } = await safeHazardAdd(submitData);
        if (code === 200) {
          showToast("新增成功");
          setTimeout(() => {
            goBack();
          }, 500);
        } else {
          loading.value = false;
          showToast("新增失败,请重试");
        }
      }
    } catch (e) {
      loading.value = false;
      console.error("提交失败:", e);
      showToast("提交失败,请重试");
    }
  };
  onLoad(() => {
    // ç¼–辑危险源时,从本地存储获取数据
    const hazardSource = uni.getStorageSync("hazardSourceLedger");
    console.log("hazardSource", hazardSource);
    if (hazardSource.id) {
      form.value = hazardSource;
      isEdit.value = true;
      console.log("form.value", form.value);
    } else {
      isEdit.value = false;
    }
  });
  onMounted(() => {
    // åˆå§‹åŒ–选项数据
    typeOptions.value = hazard_source_type.value.map(item => ({
      value: item.value,
      name: item.label,
    }));
    riskLevelOptions.value = [
      { value: "低风险", name: "低风险" },
      { value: "一般风险", name: "一般风险" },
      { value: "较大风险", name: "较大风险" },
      { value: "重大风险", name: "重大风险" },
    ];
    // è®¾ç½®å·²é€‰å€¼çš„æ˜¾ç¤ºæ–‡æœ¬
    if (form.value.type) {
      typeName.value =
        typeOptions.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";
  .client-visit {
    min-height: 100vh;
    background: #f8f9fa;
    padding-bottom: 5rem;
  }
  .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;
  }
  .location-icon {
    color: #1989fa;
    font-size: 1.2rem;
  }
</style>
src/pages/safeProduction/hazardSourceLedger/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,291 @@
<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.name }}</text>
            </view>
          </view>
          <up-divider></up-divider>
          <view class="item-details">
            <view class="detail-row">
              <text class="detail-label">危险源编码</text>
              <text class="detail-value">{{ item.code || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">危险源类型</text>
              <text class="detail-value">{{ hazard_source_type.find(i => i.value === 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.controlMeasures || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">库存数量</text>
              <text class="detail-value">{{ item.stockQty || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">管控责任人</text>
              <text class="detail-value">{{ item.principalUser || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">责任人联系电话</text>
              <text class="detail-value">{{ item.principalMobile || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">规格 / é£Žé™©æè¿°</text>
              <text class="detail-value">{{ item.specInfo || '-' }}</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="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 { delCustomer } from "@/api/cooperativeOffice/clientVisit";
  import {
    qualificationsListPage,
    safeCertificationDel,
  } from "@/api/safeProduction/safeQualifications";
  import {
    safeHazardListPage,
    safeHazardDel,
  } from "@/api/safeProduction/hazardSourceLedger";
  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,
      name: customerName.value,
    };
    safeHazardListPage(params)
      .then(res => {
        visitList.value = res.records || res.data?.records || [];
        closeToast();
      })
      .catch(() => {
        closeToast();
        showToast("获取数据失败");
      });
  };
  // æ˜¾ç¤ºåŠ è½½æç¤º
  const showLoadingToast = message => {
    uni.showLoading({
      title: message,
      mask: true,
    });
  };
  // å…³é—­æç¤º
  const closeToast = () => {
    uni.hideLoading();
  };
  // æ–°å¢žå±é™©æº
  const addVisit = () => {
    uni.setStorageSync("hazardSourceLedger", {});
    uni.navigateTo({
      url: "/pages/safeProduction/hazardSourceLedger/detail",
    });
  };
  // ç¼–辑危险源
  const editVisit = item => {
    uni.setStorageSync("hazardSourceLedger", item);
    uni.navigateTo({
      url: "/pages/safeProduction/hazardSourceLedger/detail",
    });
  };
  // åˆ é™¤å±é™©æº
  const deleteVisit = item => {
    uni.showModal({
      title: "删除确认",
      content: `确定要删除该危险源吗?`,
      success: res => {
        if (res.confirm) {
          deleteClientVisit(item.id);
        }
      },
    });
  };
  const { hazard_source_type } = useDict("hazard_source_type");
  const { risk_level } = useDict("risk_level");
  // åˆ é™¤å±é™©æºè®°å½•
  const deleteClientVisit = id => {
    showLoadingToast("删除中...");
    safeHazardDel([id])
      .then(() => {
        closeToast();
        showToast("删除成功");
        getList();
      })
      .catch(() => {
        closeToast();
        showToast("删除失败");
      });
  };
  // æŸ¥çœ‹è¯¦æƒ…
  const viewDetail = item => {
    uni.setStorageSync("hazardSourceLedger", item);
    uni.navigateTo({
      url: "/pages/safeProduction/hazardSourceLedger/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/hazardSourceLedger/view.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,187 @@
<template>
  <view class="hazard-source-detail">
    <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.name || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">危险源编码</text>
          <text class="info-value">{{ form.code || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">危险源类型</text>
          <text class="info-value">{{ hazard_source_type.find(item => item.value === form.type)?.label || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">风险等级</text>
          <text class="info-value"><u-tag :type="getRiskLevelType(form.riskLevel)">
              {{ form.riskLevel || '-' }}
            </u-tag></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.controlMeasures || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">库存数量</text>
          <text class="info-value">{{ form.stockQty || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">管控责任人</text>
          <text class="info-value">{{ form.principalUser || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">责任人联系电话</text>
          <text class="info-value">{{ form.principalMobile || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">规格 / é£Žé™©æè¿°</text>
          <text class="info-value">{{ form.specInfo || '-' }}</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 { useDict } from "@/utils/dict";
  const userStore = useUserStore();
  // èŽ·å–å­—å…¸æ•°æ®
  const { hazard_source_type } = useDict("hazard_source_type");
  const { risk_level } = useDict("risk_level");
  // è¡¨å•数据
  const form = ref({
    name: "",
    code: "",
    type: "",
    riskLevel: "",
    location: "",
    controlMeasures: "",
    stockQty: "",
    principalUser: "",
    principalMobile: "",
    specInfo: "",
  });
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("hazardSourceLedger");
    uni.navigateBack();
  };
  const getRiskLevelType = riskLevel => {
    const typeMap = {
      ä½Žé£Žé™©: "info",
      ä¸€èˆ¬é£Žé™©: "info",
      è¾ƒå¤§é£Žé™©: "warning",
      é‡å¤§é£Žé™©: "error",
    };
    return typeMap[riskLevel] || "info";
  };
  // åˆå§‹åŒ–页面数据
  const initPageData = () => {
    // ä»Žæœ¬åœ°å­˜å‚¨èŽ·å–å±é™©æºè¯¦æƒ…
    const row = uni.getStorageSync("hazardSourceLedger");
    if (row) {
      form.value = { ...row };
    } else {
      showToast("暂无危险源数据");
    }
  };
  onMounted(() => {
    initPageData();
  });
</script>
<style scoped lang="scss">
  @import "@/static/scss/form-common.scss";
  .client-visit-detail {
    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>
src/pages/safeProduction/safeQualifications/detail.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,317 @@
<template>
  <view class="safe-qualifications-detail">
    <PageHeader :title="isEdit ? '编辑规程资质' : '新增规程资质'"
                @back="goBack" />
    <u-form @submit="handleSubmit"
            ref="formRef"
            label-width="110">
      <!-- è§„程资质信息 -->
      <u-cell-group title="规程资质信息">
        <u-form-item label="规程资质名称"
                     prop="name"
                     required
                     border-bottom>
          <u-input v-model="form.name"
                   placeholder="请输入规程资质名称" />
        </u-form-item>
        <u-form-item label="规程资质编号"
                     prop="code"
                     required
                     border-bottom>
          <u-input v-model="form.code"
                   placeholder="请输入规程资质编号" />
        </u-form-item>
        <u-form-item label="规程资质类型"
                     prop="type"
                     required
                     border-bottom>
          <u-input v-model="typeName"
                   placeholder="请选择规程资质类型"
                   @click="showTypeSheet"
                   readonly />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showTypeSheet"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="版本号"
                     prop="version"
                     required
                     border-bottom>
          <u-input v-model="form.version"
                   placeholder="请输入版本号" />
        </u-form-item>
        <u-form-item label="有效期"
                     prop="effectiveTime"
                     required
                     border-bottom>
          <u-input v-model="form.effectiveTime"
                   placeholder="请选择有效期"
                   @click="showTimePicker" />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showTimePicker"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="备注"
                     prop="remark"
                     border-bottom>
          <u-textarea v-model="form.remark"
                      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">{{ 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="typeSheetVisible"
                     :actions="typeOptions"
                     @select="handleTypeSelect"
                     title="选择规程资质类型" />
  </view>
</template>
<script setup>
  // æ›¿æ¢ toast æ–¹æ³•
  defineOptions({ name: "safe-qualifications-detail" });
  const showToast = message => {
    uni.showToast({
      title: message,
      icon: "none",
    });
  };
  import { ref, onMounted } from "vue";
  import PageHeader from "@/components/PageHeader.vue";
  import {
    safeCertificationAdd,
    safeCertificationUpdate,
  } from "@/api/safeProduction/safeQualifications";
  import useUserStore from "@/store/modules/user";
  import { useDict } from "@/utils/dict";
  import dayjs from "dayjs";
  import { onLoad } from "@dcloudio/uni-app";
  // èŽ·å–è§„ç¨‹èµ„è´¨ç±»åž‹å­—å…¸
  const { type_qualification } = useDict("type_qualification");
  const userStore = useUserStore();
  // è¡¨å•数据
  const form = ref({
    name: "",
    code: "",
    type: "",
    version: "",
    remark: "",
    effectiveTime: "",
  });
  // é¡µé¢çŠ¶æ€
  const loading = ref(false);
  const formRef = ref(null);
  const isEdit = ref(false);
  // æ—¶é—´ç›¸å…³
  const currentTime = ref(Date.now());
  const showTime = ref(false);
  // è§„程资质类型选择器
  const typeSheetVisible = ref(false);
  const showTypeSheet = () => {
    typeSheetVisible.value = true;
  };
  const typeName = ref("");
  const handleTypeSelect = item => {
    form.value.type = item.value;
    typeName.value = item.name;
    typeSheetVisible.value = false;
  };
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("safeQualifications");
    uni.navigateBack();
  };
  // æ˜¾ç¤ºæ—¶é—´é€‰æ‹©å™¨
  const showTimePicker = () => {
    showTime.value = true;
  };
  // ç¡®è®¤æ—¶é—´é€‰æ‹©
  const onTimeConfirm = e => {
    form.value.effectiveTime = dayjs(e.value).format("YYYY-MM-DD");
    currentTime.value = e.value;
    showTime.value = false;
  };
  // æäº¤è¡¨å•
  const handleSubmit = async () => {
    if (!form.value.name) {
      showToast("请输入规程资质名称");
      return;
    }
    if (!form.value.code) {
      showToast("请输入规程资质编号");
      return;
    }
    if (!form.value.type) {
      showToast("请输入规程资质类型");
      return;
    }
    if (!form.value.version) {
      showToast("请输入版本号");
      return;
    }
    if (!form.value.effectiveTime) {
      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 safeCertificationUpdate(submitData);
        if (code === 200) {
          showToast("修改成功");
          setTimeout(() => {
            goBack();
          }, 500);
        } else {
          loading.value = false;
          showToast("修改失败,请重试");
        }
      } else {
        const { code } = await safeCertificationAdd(submitData);
        if (code === 200) {
          showToast("新增成功");
          setTimeout(() => {
            goBack();
          }, 500);
        } else {
          loading.value = false;
          showToast("新增失败,请重试");
        }
      }
    } catch (e) {
      loading.value = false;
      console.error("提交失败:", e);
      showToast("提交失败,请重试");
    }
  };
  onLoad(() => {
    // ç¼–辑规程资质时,从本地存储获取数据
    const qualification = uni.getStorageSync("safeQualifications");
    if (qualification) {
      form.value = qualification;
      isEdit.value = true;
      console.log("form.value", form.value);
    } else {
      isEdit.value = false;
    }
  });
  // åˆå§‹åŒ–页面数据
  const initPageData = () => {
    // è®¾ç½®é»˜è®¤æœ‰æ•ˆæœŸä¸ºå½“前时间
    if (!isEdit.value) {
      form.value.effectiveTime = dayjs().format("YYYY-MM-DD");
      currentTime.value = Date.now();
    }
  };
  const typeOptions = ref([]);
  onMounted(() => {
    initPageData();
    typeOptions.value = type_qualification.value.map(item => ({
      value: item.value,
      name: item.label,
    }));
    if (form.value.type) {
      typeName.value =
        typeOptions.value.find(item => item.value == form.value.type)?.name || "";
    }
  });
</script>
<style scoped lang="scss">
  @import "@/static/scss/form-common.scss";
  .client-visit {
    min-height: 100vh;
    background: #f8f9fa;
    padding-bottom: 5rem;
  }
  .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;
  }
  .location-icon {
    color: #1989fa;
    font-size: 1.2rem;
  }
</style>
src/pages/safeProduction/safeQualifications/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,263 @@
<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.name }}</text>
            </view>
          </view>
          <up-divider></up-divider>
          <view class="item-details">
            <view class="detail-row">
              <text class="detail-label">规程资质编号</text>
              <text class="detail-value">{{ item.code || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">规程资质类型</text>
              <text class="detail-value">{{ type_qualification.find(itemItem => itemItem.value === item.type)?.label || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">版本号</text>
              <text class="detail-value">{{ item.version || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">备注</text>
              <text class="detail-value">{{ item.remark || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">有效期</text>
              <text class="detail-value">{{ item.effectiveTime || '-' }}</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="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 { delCustomer } from "@/api/cooperativeOffice/clientVisit";
  import {
    qualificationsListPage,
    safeCertificationAdd,
    safeCertificationUpdate,
    safeCertificationDel,
    fileListPage,
    safeCertificationFileAdd,
    safeCertificationFileDel,
  } from "@/api/safeProduction/safeQualifications";
  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",
    });
  };
  import dayjs from "dayjs";
  const userStore = useUserStore();
  // æœç´¢å…³é”®è¯
  const customerName = ref("");
  // æ‹œè®¿è®°å½•数据
  const visitList = ref([]);
  const { type_qualification } = useDict("type_qualification");
  // è¿”回上一页
  const goBack = () => {
    uni.navigateBack();
  };
  // æŸ¥è¯¢åˆ—表
  const getList = () => {
    showLoadingToast("加载中...");
    const params = {
      current: -1,
      size: -1,
      name: customerName.value,
    };
    qualificationsListPage(params)
      .then(res => {
        visitList.value = res.records || res.data?.records || [];
        closeToast();
      })
      .catch(() => {
        closeToast();
        showToast("获取数据失败");
      });
  };
  // æ˜¾ç¤ºåŠ è½½æç¤º
  const showLoadingToast = message => {
    uni.showLoading({
      title: message,
      mask: true,
    });
  };
  // å…³é—­æç¤º
  const closeToast = () => {
    uni.hideLoading();
  };
  // æ–°å¢žè§„程资质
  const addVisit = () => {
    uni.setStorageSync("safeQualifications", {});
    uni.navigateTo({
      url: "/pages/safeProduction/safeQualifications/detail",
    });
  };
  // ç¼–辑规程资质
  const editVisit = item => {
    uni.setStorageSync("safeQualifications", item);
    uni.navigateTo({
      url: "/pages/safeProduction/safeQualifications/detail",
    });
  };
  // åˆ é™¤è§„程资质
  const deleteVisit = item => {
    uni.showModal({
      title: "删除确认",
      content: `确定要删除该规程资质吗?`,
      success: res => {
        if (res.confirm) {
          deleteClientVisit(item.id);
        }
      },
    });
  };
  // åˆ é™¤è§„程资质记录
  const deleteClientVisit = id => {
    showLoadingToast("删除中...");
    safeCertificationDel([id])
      .then(() => {
        closeToast();
        showToast("删除成功");
        getList();
      })
      .catch(() => {
        closeToast();
        showToast("删除失败");
      });
  };
  // æŸ¥çœ‹è¯¦æƒ…
  const viewDetail = item => {
    uni.setStorageSync("safeQualifications", item);
    uni.navigateTo({
      url: "/pages/safeProduction/safeQualifications/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/safeQualifications/view.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,159 @@
<template>
  <view class="safe-qualifications-detail">
    <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.name || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">规程资质编号</text>
          <text class="info-value">{{ form.code || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">规程资质类型</text>
          <text class="info-value">{{ type_qualification.find(item => item.value === form.type)?.label || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">版本号</text>
          <text class="info-value">{{ form.version || '-' }}</text>
        </view>
        <view class="info-item">
          <text class="info-label">有效期</text>
          <text class="info-value">{{ form.effectiveTime || '-' }}</text>
        </view>
      </view>
      <!-- å¤‡æ³¨ä¿¡æ¯ -->
      <view class="section">
        <view class="section-title">备注信息</view>
        <view class="info-item remark-item">
          <text class="info-label">备注</text>
          <text class="info-value multi-line">{{ form.remark || '-' }}</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 { useDict } from "@/utils/dict";
  const userStore = useUserStore();
  // è§„程资质类型字典
  const { type_qualification } = useDict("type_qualification");
  // è¡¨å•数据
  const form = ref({
    name: "",
    code: "",
    type: "",
    version: "",
    remark: "",
    effectiveTime: "",
  });
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("safeQualifications");
    uni.navigateBack();
  };
  // åˆå§‹åŒ–页面数据
  const initPageData = () => {
    // ä»Žæœ¬åœ°å­˜å‚¨èŽ·å–è§„ç¨‹èµ„è´¨è¯¦æƒ…
    const row = uni.getStorageSync("safeQualifications");
    if (row) {
      form.value = { ...row };
    } else {
      showToast("暂无规程资质数据");
    }
  };
  onMounted(() => {
    initPageData();
  });
</script>
<style scoped lang="scss">
  @import "@/static/scss/form-common.scss";
  .client-visit-detail {
    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>