From 6e1cb1b850f3536eb91b3247f2b5e6aadf6805c9 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期二, 03 二月 2026 16:52:43 +0800
Subject: [PATCH] 样式修改

---
 src/pages/safeProduction/dangerInvestigation/detail.vue |  449 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 449 insertions(+), 0 deletions(-)

diff --git a/src/pages/safeProduction/dangerInvestigation/detail.vue b/src/pages/safeProduction/dangerInvestigation/detail.vue
new file mode 100644
index 0000000..1e0c8c4
--- /dev/null
+++ b/src/pages/safeProduction/dangerInvestigation/detail.vue
@@ -0,0 +1,449 @@
+<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="璇疯緭鍏ラ殣鎮f弿杩�"
+                      :maxlength="200"
+                      count
+                      :autoHeight="true" />
+        </u-form-item>
+        <u-form-item label="闅愭偅鍏蜂綋浣嶇疆"
+                     prop="location"
+                     required
+                     border-bottom>
+          <u-input v-model="form.location"
+                   placeholder="璇疯緭鍏ラ殣鎮e叿浣撲綅缃�" />
+        </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="鏁存敼璐d换浜�"
+                     prop="rectifyUserName"
+                     required
+                     border-bottom>
+          <u-input v-model="form.rectifyUserName"
+                   placeholder="璇烽�夋嫨鏁存敼璐d换浜�"
+                   @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"
+                     @close="hiddenTypeSheetVisible = false"
+                     title="閫夋嫨闅愭偅绫诲瀷" />
+    <!-- 椋庨櫓绛夌骇閫夋嫨鍣� -->
+    <up-action-sheet :show="riskLevelSheetVisible"
+                     :actions="riskLevelOptions"
+                     @select="handleRiskLevelSelect"
+                     @close="riskLevelSheetVisible = false"
+                     title="閫夋嫨椋庨櫓绛夌骇" />
+    <!-- 鏁存敼璐d换浜洪�夋嫨鍣� -->
+    <up-action-sheet :show="principalSheetVisible"
+                     :actions="principalOptions"
+                     @select="handlePrincipalSelect"
+                     @close="principalSheetVisible = false"
+                     title="閫夋嫨鏁存敼璐d换浜�" />
+  </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;
+  };
+
+  // 鏁存敼璐d换浜洪�夋嫨鍣�
+  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("璇疯緭鍏ラ殣鎮f弿杩�");
+      return;
+    }
+
+    if (!form.value.location) {
+      showToast("璇疯緭鍏ラ殣鎮e叿浣撲綅缃�");
+      return;
+    }
+
+    if (!form.value.rectifyTime) {
+      showToast("璇烽�夋嫨鏁存敼瀹屾垚鏈熼檺");
+      return;
+    }
+
+    if (!form.value.rectifyUserName) {
+      showToast("璇烽�夋嫨鏁存敼璐d换浜�");
+      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>
\ No newline at end of file

--
Gitblit v1.9.3