zhangwencui
6 小时以前 04d2dcd5d484e5b1a702408ed9ecd095ed7cbba8
危险物料管控模块开发
已添加3个文件
已修改5个文件
809 ■■■■■ 文件已修改
src/api/safeProduction/hazardousMaterialsControl.js 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages.json 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/index.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/dangerInvestigation/detail.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/hazardSourceLedger/detail.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/hazardousMaterialsControl/detail.vue 444 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/hazardousMaterialsControl/index.vue 295 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/safeProduction/safeQualifications/detail.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/safeProduction/hazardousMaterialsControl.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
import request from "@/utils/request";
export function safeHazardRecordListPage(query) {
  return request({
    url: "/safeHazardRecord/page",
    method: "get",
    params: query,
  });
}
export function safeHazardRecordDel(ids) {
    return request({
        url: '/safeHazardRecord/' + ids,
        method: 'delete',
        data: ids
    })
}
// æ–°å¢žå±é™©æºå°è´¦
export function safeHazardRecordAdd(query) {
    return request({
        url: '/safeHazardRecord/borrow',
        method: 'post',
        data: query
    })
}
export function safeHazardRecordUpdate(query) {
    return request({
        url: '/safeHazardRecord/return',
        method: 'put',
        data: query
    })
}
src/pages.json
@@ -759,6 +759,27 @@
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/hazardousMaterialsControl/index",
      "style": {
        "navigationBarTitleText": "危险物料",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/hazardousMaterialsControl/detail",
      "style": {
        "navigationBarTitleText": "危险物料详情",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/safeProduction/hazardousMaterialsControl/view",
      "style": {
        "navigationBarTitleText": "危险物料详情",
        "navigationStyle": "custom"
      }
    },
  ],
  "subPackages": [
    {
src/pages/index.vue
@@ -319,6 +319,10 @@
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "隐患排查",
    },
    {
      icon: "/static/images/icon/guzhangfenxi@2x.png",
      label: "危险物料",
    },
  ]);
  // ååŒåŠžå…¬åŠŸèƒ½æ•°æ®
  const collaborationItems = reactive([
@@ -697,6 +701,11 @@
          url: "/pages/safeProduction/dangerInvestigation/index",
        });
        break;
      case "危险物料":
        uni.navigateTo({
          url: "/pages/safeProduction/hazardousMaterialsControl/index",
        });
        break;
      default:
        uni.showToast({
          title: `点击了${item.label}`,
src/pages/safeProduction/dangerInvestigation/detail.vue
@@ -117,16 +117,19 @@
    <up-action-sheet :show="hiddenTypeSheetVisible"
                     :actions="hiddenTypeOptions"
                     @select="handleHiddenTypeSelect"
                     @close="hiddenTypeSheetVisible = false"
                     title="选择隐患类型" />
    <!-- é£Žé™©ç­‰çº§é€‰æ‹©å™¨ -->
    <up-action-sheet :show="riskLevelSheetVisible"
                     :actions="riskLevelOptions"
                     @select="handleRiskLevelSelect"
                     @close="riskLevelSheetVisible = false"
                     title="选择风险等级" />
    <!-- æ•´æ”¹è´£ä»»äººé€‰æ‹©å™¨ -->
    <up-action-sheet :show="principalSheetVisible"
                     :actions="principalOptions"
                     @select="handlePrincipalSelect"
                     @close="principalSheetVisible = false"
                     title="选择整改责任人" />
  </view>
</template>
src/pages/safeProduction/hazardSourceLedger/detail.vue
@@ -117,16 +117,19 @@
    <up-action-sheet :show="typeSheetVisible"
                     :actions="typeOptions"
                     @select="handleTypeSelect"
                     @close="typeSheetVisible = false"
                     title="选择危险源类型" />
    <!-- é£Žé™©ç­‰çº§é€‰æ‹©å™¨ -->
    <up-action-sheet :show="riskLevelSheetVisible"
                     :actions="riskLevelOptions"
                     @select="handleRiskLevelSelect"
                     @close="riskLevelSheetVisible = false"
                     title="选择风险等级" />
    <!-- ç®¡æŽ§è´£ä»»äººé€‰æ‹©å™¨ -->
    <up-action-sheet :show="principalSheetVisible"
                     :actions="principalOptions"
                     @select="handlePrincipalSelect"
                     @close="principalSheetVisible = false"
                     title="选择管控责任人" />
  </view>
</template>
src/pages/safeProduction/hazardousMaterialsControl/detail.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,444 @@
<template>
  <view class="hazard-source-detail">
    <PageHeader :title="isEdit ? '归还' : '领用危险源'"
                @back="goBack" />
    <u-form @submit="handleSubmit"
            ref="formRef"
            label-width="110">
      <!-- å±é™©æºä¿¡æ¯ -->
      <u-cell-group v-if="!isEdit"
                    title="危险源信息">
        <u-form-item v-if="!isEdit"
                     label="危险源名称"
                     prop="name"
                     required
                     border-bottom>
          <u-input v-model="form.name"
                   placeholder="请选择危险源"
                   @click="showHazardSourceSheet"
                   readonly />
          <template #right>
            <up-icon name="arrow-right"
                     @click="showHazardSourceSheet"></up-icon>
          </template>
        </u-form-item>
        <u-form-item label="危险源编码"
                     prop="code"
                     border-bottom>
          <u-input v-model="form.code"
                   disabled
                   placeholder="自动带出"
                   readonly />
        </u-form-item>
        <u-form-item v-if="!isEdit"
                     label="危险源类型"
                     prop="type"
                     border-bottom>
          <u-input v-model="form.type"
                   disabled
                   placeholder="自动带出"
                   readonly />
        </u-form-item>
        <u-form-item v-if="!isEdit"
                     label="风险等级"
                     prop="riskLevel"
                     border-bottom>
          <u-input v-model="form.riskLevel"
                   disabled
                   placeholder="自动带出"
                   readonly />
        </u-form-item>
        <u-form-item v-if="!isEdit"
                     label="所在位置"
                     prop="location"
                     border-bottom>
          <u-input v-model="form.location"
                   disabled
                   placeholder="自动带出"
                   readonly />
        </u-form-item>
        <u-form-item v-if="!isEdit"
                     label="领用时间"
                     prop="applyTime"
                     border-bottom>
          <u-input v-model="form.applyTime"
                   disabled />
        </u-form-item>
        <u-form-item v-if="!isEdit"
                     label="领用人"
                     prop="applyUserName"
                     border-bottom>
          <u-input v-model="form.applyUserName"
                   disabled />
        </u-form-item>
        <u-form-item v-if="!isEdit"
                     label="领用用途"
                     prop="applyPurpose"
                     required
                     border-bottom>
          <u-input v-model="form.applyPurpose"
                   placeholder="请输入领用用途" />
        </u-form-item>
        <u-form-item v-if="!isEdit"
                     label="领用数量"
                     prop="applyQty"
                     required
                     border-bottom>
          <u-input v-model="form.applyQty"
                   type="number"
                   @blur="validateApplyQty"
                   min="1"
                   placeholder="请输入领用数量" />
        </u-form-item>
      </u-cell-group>
      <u-cell-group v-if="isEdit"
                    title="归还信息">
        <u-form-item label="归还人"
                     prop="returnUserName"
                     border-bottom>
          <u-input v-model="form.returnUserName"
                   disabled />
        </u-form-item>
        <u-form-item label="归还时间"
                     prop="returnTime"
                     border-bottom>
          <u-input v-model="form.returnTime"
                   disabled />
        </u-form-item>
        <u-form-item label="归还情况说明"
                     prop="returnRemark"
                     required
                     border-bottom>
          <u-textarea v-model="form.returnRemark"
                      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="hazardSourceSheetVisible"
                     :actions="hazardSourceOptions"
                     @select="handleHazardSourceSelect"
                     @close="hazardSourceSheetVisible = false"
                     title="选择危险源" />
    <!-- æ—¶é—´é€‰æ‹©å™¨ -->
    <up-datetime-picker :show="applyTimeVisible"
                        v-model="applyTime"
                        @confirm="onApplyTimeConfirm"
                        @cancel="applyTimeVisible = false"
                        mode="datetime" />
    <up-datetime-picker :show="returnTimeVisible"
                        v-model="returnTime"
                        @confirm="onReturnTimeConfirm"
                        @cancel="returnTimeVisible = false"
                        mode="date" />
  </view>
</template>
<script setup>
  // æ›¿æ¢ toast æ–¹æ³•
  defineOptions({ name: "hazard-source-detail" });
  const showToast = message => {
    uni.showToast({
      title: message,
      icon: "none",
    });
  };
  import { ref, onMounted } from "vue";
  import PageHeader from "@/components/PageHeader.vue";
  import {
    safeHazardRecordAdd,
    safeHazardRecordUpdate,
  } from "@/api/safeProduction/hazardousMaterialsControl";
  import { safeHazardListPage } from "@/api/safeProduction/hazardSourceLedger";
  import useUserStore from "@/store/modules/user";
  import dayjs from "dayjs";
  import { onLoad } from "@dcloudio/uni-app";
  const userStore = useUserStore();
  // è¡¨å•数据
  const form = ref({
    name: "",
    code: "",
    type: "",
    riskLevel: "",
    location: "",
    applyPurpose: "",
    applyTime: "",
    applyQty: "",
    returnTime: "",
    returnRemark: "",
    safeHazardId: "",
  });
  // é¡µé¢çŠ¶æ€
  const loading = ref(false);
  const formRef = ref(null);
  const isEdit = ref(false);
  // å±é™©æºé€‰æ‹©å™¨
  const hazardSourceSheetVisible = ref(false);
  const hazardSourceOptions = ref([]);
  const hazardSourceList = ref([]);
  const showHazardSourceSheet = () => {
    if (hazardSourceOptions.value.length === 0) {
      getHazardSourceList();
    } else {
      hazardSourceSheetVisible.value = true;
    }
  };
  const stockQty = ref(0);
  const handleHazardSourceSelect = item => {
    const hazardSource = hazardSourceList.value.find(h => h.id === item.value);
    if (hazardSource) {
      form.value.name = hazardSource.name;
      form.value.code = hazardSource.code;
      form.value.type = hazardSource.type;
      form.value.riskLevel = hazardSource.riskLevel;
      form.value.location = hazardSource.location;
      form.value.safeHazardId = hazardSource.id;
      stockQty.value = hazardSource.stockQty || 0;
    }
    hazardSourceSheetVisible.value = false;
  };
  const validateApplyQty = () => {
    if (!form.value.applyQty) {
      showToast("请输入领用数量");
      return false;
    }
    if (isNaN(form.value.applyQty)) {
      showToast("领用数量必须是数字");
      form.value.applyQty = 0;
      return false;
    }
    if (form.value.applyQty < 0) {
      showToast("领用数量必须大于等于1");
      form.value.applyQty = 0;
      return false;
    }
    if (form.value.applyQty > stockQty.value) {
      showToast("领用数量不能大于库存数量");
      form.value.applyQty = 0;
      return false;
    }
    return true;
  };
  // èŽ·å–å±é™©æºåˆ—è¡¨
  const getHazardSourceList = () => {
    const params = {
      current: -1,
      size: -1,
    };
    safeHazardListPage(params).then(res => {
      if (res.code === 200) {
        hazardSourceList.value = res.records || res.data?.records || [];
        // è¿‡æ»¤æŽ‰åº“存数量小于等于0的选项
        const validHazardSources = hazardSourceList.value.filter(
          item => item.stockQty > 0
        );
        hazardSourceOptions.value = validHazardSources.map(item => ({
          value: item.id,
          name: item.name,
          subname: `库存: ${item.stockQty}`,
        }));
        hazardSourceSheetVisible.value = true;
      }
    });
  };
  // æ—¶é—´é€‰æ‹©å™¨
  const applyTimeVisible = ref(false);
  const applyTime = ref(Date.now());
  const showApplyTimePicker = () => {
    applyTimeVisible.value = true;
  };
  const onApplyTimeConfirm = e => {
    form.value.applyTime = dayjs(e.value).format("YYYY-MM-DD HH:mm:ss");
    applyTime.value = e.value;
    applyTimeVisible.value = false;
  };
  const returnTimeVisible = ref(false);
  const returnTime = ref(Date.now());
  const showReturnTimePicker = () => {
    returnTimeVisible.value = true;
  };
  const onReturnTimeConfirm = e => {
    form.value.returnTime = dayjs(e.value).format("YYYY-MM-DD");
    returnTime.value = e.value;
    returnTimeVisible.value = false;
  };
  // è¿”回上一页
  const goBack = () => {
    // è¿”回时清除本地存储的数据
    uni.removeStorageSync("hazardousMaterialsControl");
    uni.navigateBack();
  };
  // æäº¤è¡¨å•
  const handleSubmit = async () => {
    if (!form.value.safeHazardId) {
      showToast("请选择危险源");
      return;
    }
    if (!form.value.applyPurpose) {
      showToast("请输入领用用途");
      return;
    }
    if (!form.value.applyQty) {
      showToast("请输入领用数量");
      return;
    }
    if (isEdit.value) {
      if (!form.value.returnTime) {
        showToast("请选择归还时间");
        return;
      }
      if (!form.value.returnRemark) {
        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 safeHazardRecordUpdate(submitData);
        if (code === 200) {
          showToast("归还成功");
          setTimeout(() => {
            goBack();
          }, 500);
        } else {
          loading.value = false;
          showToast("归还失败,请重试");
        }
      } else {
        const { code } = await safeHazardRecordAdd(submitData);
        if (code === 200) {
          showToast("领用成功");
          setTimeout(() => {
            goBack();
          }, 500);
        } else {
          loading.value = false;
          showToast("领用失败,请重试");
        }
      }
    } catch (e) {
      loading.value = false;
      console.error("提交失败:", e);
      showToast("提交失败,请重试");
    }
  };
  onLoad(() => {
    // ç¼–辑危险源时,从本地存储获取数据
    const hazardousMaterials = uni.getStorageSync("hazardousMaterialsControl");
    console.log("hazardousMaterials", hazardousMaterials);
    if (hazardousMaterials.id) {
      form.value = hazardousMaterials;
      isEdit.value = true;
      userStore.getInfo().then(res => {
        form.value.returnUserId = res.user.userId;
        form.value.returnUserName = res.user.nickName;
      });
      console.log("form.value", form.value);
    } else {
      userStore.getInfo().then(res => {
        form.value.applyUserId = res.user.userId;
        form.value.applyUserName = res.user.nickName;
      });
      isEdit.value = false;
    }
  });
  onMounted(() => {
    // è®¾ç½®é»˜è®¤æ—¶é—´
    if (!isEdit.value) {
      form.value.applyTime = dayjs().format("YYYY-MM-DD");
      applyTime.value = Date.now();
    } else {
      form.value.returnTime = dayjs().format("YYYY-MM-DD");
      returnTime.value = Date.now();
    }
  });
</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/hazardousMaterialsControl/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,295 @@
<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.materialRecordCode }}</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.name || '-' }}</text>
            </view>
            <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.applyPurpose || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">领用时间</text>
              <text class="detail-value">{{ item.applyTime || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">领用数量</text>
              <text class="detail-value">{{ item.applyQty || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">归还时间</text>
              <text class="detail-value">{{ item.returnTime || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">归还人</text>
              <text class="detail-value">{{ item.returnUserName || '-' }}</text>
            </view>
            <view class="detail-row">
              <text class="detail-label">归还情况说明</text>
              <text class="detail-value">{{ item.returnRemark || '-' }}</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"
                      :disabled="item.returnUserId"
                      @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 {
    safeHazardRecordListPage,
    safeHazardRecordDel,
  } from "@/api/safeProduction/hazardousMaterialsControl";
  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,
    };
    safeHazardRecordListPage(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("hazardousMaterialsControl", {});
    uni.navigateTo({
      url: "/pages/safeProduction/hazardousMaterialsControl/detail",
    });
  };
  // ç¼–辑危险源
  const editVisit = item => {
    uni.setStorageSync("hazardousMaterialsControl", item);
    uni.navigateTo({
      url: "/pages/safeProduction/hazardousMaterialsControl/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("删除中...");
    safeHazardRecordDel([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/safeQualifications/detail.vue
@@ -83,6 +83,7 @@
    <up-action-sheet :show="typeSheetVisible"
                     :actions="typeOptions"
                     @select="handleTypeSelect"
                     @close="typeSheetVisible = false"
                     title="选择规程资质类型" />
  </view>
</template>