From 1940c1e6bfdf406bc052acb32f7ae707f4497799 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 22 一月 2026 16:53:06 +0800
Subject: [PATCH] Merge branch 'dev_new' of http://114.132.189.42:9002/r/product-inventory-APP-before into dev_new
---
src/pages/managementMeetings/rulesRegulationsManagement/detail.vue | 455 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 455 insertions(+), 0 deletions(-)
diff --git a/src/pages/managementMeetings/rulesRegulationsManagement/detail.vue b/src/pages/managementMeetings/rulesRegulationsManagement/detail.vue
new file mode 100644
index 0000000..363d665
--- /dev/null
+++ b/src/pages/managementMeetings/rulesRegulationsManagement/detail.vue
@@ -0,0 +1,455 @@
+<template>
+ <view class="client-visit-detail">
+ <PageHeader :title="detailType === 1 ? '鍙戝竷鍒跺害' : '鍒跺害璇︽儏'"
+ @back="goBack" />
+ <u-form ref="formRef"
+ label-width="90">
+ <!-- 瀹㈡埛淇℃伅 -->
+ <!-- <u-cell-group title="鐭ヨ瘑淇℃伅"> -->
+ <u-form-item label="鍒跺害缂栧彿"
+ prop="regulationNum"
+ required
+ border-bottom>
+ <u-input v-model="form.regulationNum"
+ :readonly="readonly"
+ placeholder="璇疯緭鍏ュ埗搴︾紪鍙�" />
+ </u-form-item>
+ <u-form-item label="鍒跺害鏍囬"
+ prop="title"
+ required
+ border-bottom>
+ <u-input v-model="form.title"
+ :readonly="readonly"
+ placeholder="璇疯緭鍏ュ埗搴︽爣棰�" />
+ </u-form-item>
+ <u-form-item label="鍒跺害鍒嗙被"
+ prop="type"
+ required
+ border-bottom>
+ <u-input v-model="equipmentname"
+ readonly
+ placeholder="璇烽�夋嫨鍒跺害鍒嗙被"
+ @click="showEquipmentSheet = true" />
+ <template v-if="!readonly"
+ #right>
+ <up-icon name="arrow-right"
+ @click="openEquipmentSheet"></up-icon>
+ </template>
+ </u-form-item>
+ <u-form-item label="鍒跺害鍐呭"
+ prop="scenario"
+ required
+ border-bottom>
+ <u-textarea v-model="form.content"
+ type="textarea"
+ rows="4"
+ :disabled="readonly"
+ placeholder="璇疯緭鍏ュ埗搴﹀唴瀹�" />
+ </u-form-item>
+ <u-form-item label="鍒跺害鐗堟湰"
+ prop="title"
+ border-bottom>
+ <u-input v-model="form.version"
+ :readonly="readonly"
+ placeholder="璇疯緭鍏ュ埗搴︾増鏈�" />
+ </u-form-item>
+ <u-form-item label="鐢熸晥鏃堕棿"
+ prop="status"
+ required
+ border-bottom>
+ <u-input v-model="form.effectiveTime"
+ readonly
+ placeholder="璇烽�夋嫨鐢熸晥鏃堕棿"
+ @click="showEffectiveTimeSheet = true" />
+ <template v-if="!readonly"
+ #right>
+ <up-icon name="arrow-right"
+ @click="showEffectiveTimeSheet = true"></up-icon>
+ </template>
+ </u-form-item>
+ <u-form-item label="閫傜敤鑼冨洿"
+ required
+ prop="remark"
+ border-bottom>
+ <up-checkbox-group v-model="form.scope"
+ :disabled="readonly"
+ placement="column"
+ @change="checkboxChange">
+ <up-checkbox :customStyle="{marginBottom: '8px'}"
+ v-for="(item, index) in checkboxList1"
+ :key="index"
+ :label="item.name"
+ :name="item.value">
+ </up-checkbox>
+ </up-checkbox-group>
+ </u-form-item>
+ <u-form-item label="闇�瑕佺‘璁�"
+ prop="solution"
+ border-bottom>
+ <up-switch :disabled="readonly"
+ v-model="form.requireConfirm"></up-switch>
+ </u-form-item>
+ <!-- </u-cell-group> -->
+ <!-- 鎻愪氦鎸夐挳 -->
+ <view v-if="!readonly"
+ 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-action-sheet :show="showEquipmentSheet"
+ :actions="equipmentOptions"
+ @select="handleEquipmentChange"
+ @close="showEquipmentSheet = false" />
+ <!-- 鐘舵�侀�夋嫨鍣� -->
+ <up-action-sheet :show="showStatusSheet"
+ :actions="statusOptions"
+ @select="onStatusSelect"
+ @close="showStatusSheet = false" />
+ <up-datetime-picker :show="showEffectiveTimeSheet"
+ @confirm="handleEffectiveTimeConfirm"
+ @cancel="showEffectiveTimeSheet = false"
+ v-model="effectiveTime"
+ mode="datetime"></up-datetime-picker>
+ </view>
+</template>
+
+<script setup>
+ // 鏇挎崲 toast 鏂规硶
+ defineOptions({ name: "meeting-settings-detail" });
+ const showToast = message => {
+ uni.showToast({
+ title: message,
+ icon: "none",
+ });
+ };
+
+ import { ref, onMounted, computed } from "vue";
+ import PageHeader from "@/components/PageHeader.vue";
+ import useUserStore from "@/store/modules/user";
+ import { onLoad } from "@dcloudio/uni-app";
+ import {
+ addRuleManagement,
+ updateRuleManagement,
+ } from "@/api/managementMeetings/rulesRegulationsManagement";
+ import dayjs from "dayjs";
+ const userStore = useUserStore();
+ const showEffectiveTimeSheet = ref(false);
+ const effectiveTime = ref(new Date());
+ // 琛ㄥ崟鏁版嵁
+ const form = ref({
+ id: "",
+ regulationNum: "",
+ title: "",
+ category: "",
+ content: "",
+ version: "",
+ status: "active",
+ readCount: 0,
+ effectiveTime: "",
+ scope: [],
+ requireConfirm: false,
+ });
+ const checkboxList1 = ref([
+ { name: "鍏ㄤ綋鍛樺伐", value: "all" },
+ { name: "绠$悊灞�", value: "manager" },
+ { name: "浜轰簨閮ㄩ棬", value: "hr" },
+ { name: "璐㈠姟閮ㄩ棬", value: "finance" },
+ { name: "鎶�鏈儴闂�", value: "tech" },
+ ]);
+ const equipmentOptions = ref([
+ { value: "hr", name: "浜轰簨鍒跺害" },
+ { value: "finance", name: "璐㈠姟鍒跺害" },
+ { value: "safety", name: "瀹夊叏鍒跺害" },
+ { value: "tech", name: "鎶�鏈埗搴�" },
+ ]);
+ const statusOptions = ref([
+ { value: "high", name: "鏄捐憲鎻愬崌" },
+ { value: "medium", name: "涓�鑸彁鍗�" },
+ { value: "low", name: "杞诲井鎻愬崌" },
+ ]);
+ //// 椤甸潰鐘舵��
+ const loading = ref(false);
+ const formRef = ref(null);
+ const showEquipmentSheet = ref(false);
+ const showStatusSheet = ref(false);
+ const openEquipmentSheet = () => {
+ showEquipmentSheet.value = true;
+ };
+ // 杩斿洖涓婁竴椤�
+ const goBack = () => {
+ uni.navigateBack();
+ };
+ const statusname = ref("");
+ // 鐘舵�侀�夋嫨
+ const onStatusSelect = action => {
+ form.value.efficiency = action.value;
+ statusname.value = action.name;
+ showStatusSheet.value = false;
+ };
+ const equipmentname = ref("");
+ const handleEffectiveTimeConfirm = () => {
+ form.value.effectiveTime = dayjs(effectiveTime.value).format(
+ "YYYY-MM-DD HH:mm:ss"
+ );
+ showEffectiveTimeSheet.value = false;
+ };
+ // 鍒跺害鍒嗙被閫夋嫨
+ const handleEquipmentChange = val => {
+ form.value.category = val.value;
+ equipmentname.value = val.name;
+ showEquipmentSheet.value = false;
+ };
+ // 鎻愪氦琛ㄥ崟
+ const handleSubmit = async () => {
+ if (!form.value.regulationNum) {
+ showToast("璇疯緭鍏ュ埗搴︾紪鍙�");
+ return;
+ }
+
+ if (!form.value.title) {
+ showToast("璇疯緭鍏ュ埗搴︽爣棰�");
+ return;
+ }
+
+ if (!form.value.category) {
+ showToast("璇烽�夋嫨鍒跺害鍒嗙被");
+ return;
+ }
+ if (!form.value.content) {
+ showToast("璇疯緭鍏ュ埗搴﹀唴瀹�");
+ return;
+ }
+ if (!form.value.effectiveTime) {
+ showToast("璇烽�夋嫨鐢熸晥鏃堕棿");
+ return;
+ }
+ if (!form.value.scope.length) {
+ showToast("璇烽�夋嫨鐢熸晥鑼冨洿");
+ return;
+ }
+ try {
+ loading.value = true;
+ if (detailType.value === 1) {
+ addRuleManagement(form.value).then(res => {
+ if (res.code !== 200) {
+ showToast("淇濆瓨澶辫触锛岃閲嶈瘯");
+ return;
+ }
+ loading.value = false;
+ showToast("淇濆瓨鎴愬姛");
+ setTimeout(() => {
+ goBack();
+ }, 500);
+ });
+ } else if (detailType.value === 2) {
+ updateRuleManagement(form.value).then(res => {
+ if (res.code !== 200) {
+ showToast("淇濆瓨澶辫触锛岃閲嶈瘯");
+ return;
+ }
+ loading.value = false;
+ showToast("淇濆瓨鎴愬姛");
+ setTimeout(() => {
+ goBack();
+ }, 500);
+ });
+ }
+ } catch (e) {
+ loading.value = false;
+ console.error("淇濆瓨澶辫触:", e);
+ showToast("淇濆瓨澶辫触锛岃閲嶈瘯");
+ }
+ };
+
+ // 鍒濆鍖栭〉闈㈡暟鎹�
+ const initPageData = () => {
+ // 浠庢湰鍦板瓨鍌ㄤ腑鑾峰彇浼氳 room 鏁版嵁
+ const meetingRoom = uni.getStorageSync("meetingRoom");
+ if (meetingRoom) {
+ form.value = JSON.parse(JSON.stringify(meetingRoom));
+ if (meetingRoom.equipment) {
+ if (Array.isArray(meetingRoom.equipment)) {
+ form.value.equipment = meetingRoom.equipment;
+ } else {
+ form.value.equipment = meetingRoom.equipment.split(",");
+ }
+ }
+ statusname.value = meetingRoom.status === 1 ? "鍚敤" : "绂佺敤";
+
+ // 娓呴櫎鏈湴瀛樺偍涓殑鏁版嵁锛岄伩鍏嶄笅娆℃墦寮�鏃朵粛鐒舵樉绀�
+ uni.removeStorageSync("meetingRoom");
+ }
+ };
+ const readonly = ref(false);
+ const detailType = ref(1);
+ const knowledgeId = ref("");
+
+ onLoad(options => {
+ detailType.value = Number(options.detailType);
+ knowledgeId.value = options.id || "";
+
+ // 鏌ョ湅妯″紡璁剧疆鍙
+ if (detailType.value === 3) {
+ readonly.value = true;
+ }
+ });
+ // 閲嶇疆琛ㄥ崟
+ const resetForm = () => {
+ form.value = {
+ id: "",
+ regulationNum: "",
+ title: "",
+ category: "",
+ content: "",
+ version: "",
+ status: "active",
+ readCount: 0,
+ effectiveTime: "",
+ scope: [],
+ requireConfirm: false,
+ };
+ equipmentname.value = "";
+ statusname.value = "";
+ };
+ onMounted(() => {
+ console.log(effectiveTime.value, "鐢熸晥鏃堕棿");
+
+ // 浠庢湰鍦板瓨鍌ㄤ腑鑾峰彇鐭ヨ瘑鏁版嵁
+ const rulesRegulations = uni.getStorageSync("rulesRegulations");
+ initPageData();
+ if (rulesRegulations) {
+ form.value = JSON.parse(JSON.stringify(rulesRegulations));
+ }
+
+ if (detailType.value === 1) {
+ resetForm();
+ }
+
+ if (detailType.value != 1) {
+ equipmentname.value =
+ equipmentOptions.value.find(item => item.value == form.value.category)
+ ?.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;
+ }
+
+ .selector-container {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ width: 100%;
+ height: 100%;
+ }
+
+ .selector-text {
+ font-size: 14px;
+ color: #333;
+ }
+
+ .popup-content {
+ padding: 20rpx;
+ }
+
+ .popup-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+ }
+
+ .popup-title {
+ font-size: 16px;
+ font-weight: bold;
+ color: #333;
+ }
+
+ .close-icon {
+ font-size: 20px;
+ color: #999;
+ }
+
+ .popup-body {
+ max-height: 60vh;
+ overflow-y: auto;
+ margin-bottom: 20rpx;
+ }
+
+ .checkbox-item {
+ margin-bottom: 15rpx;
+ font-size: 14px;
+ }
+
+ .popup-footer {
+ display: flex;
+ justify-content: space-between;
+ gap: 15rpx;
+ }
+
+ .cancel-btn-popup {
+ flex: 1;
+ border-radius: 8rpx;
+ }
+
+ .confirm-btn-popup {
+ flex: 1;
+ border-radius: 8rpx;
+ }
+ .checkbox-item {
+ margin-top: 40rpx;
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.3