From 841c8675a4fbf9fdcabf5cdc10390cb2c8e65e8f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 19 十二月 2025 14:18:47 +0800
Subject: [PATCH] 1.海川开心-材料入库出库单价价格字段复原

---
 src/views/collaborativeApproval/noticeManagement/index.vue |  183 +++++++++++++++++++++++----------------------
 1 files changed, 95 insertions(+), 88 deletions(-)

diff --git a/src/views/collaborativeApproval/noticeManagement/index.vue b/src/views/collaborativeApproval/noticeManagement/index.vue
index 16cee35..dcbbf65 100644
--- a/src/views/collaborativeApproval/noticeManagement/index.vue
+++ b/src/views/collaborativeApproval/noticeManagement/index.vue
@@ -2,30 +2,6 @@
   <div class="app-container">
     <!-- 鎼滅储琛ㄥ崟 -->
     <div class="search_form">
-      <!--      <div>-->
-      <!--        <span class="search_title">鍏憡鏍囬锛�</span>-->
-      <!--        <el-input-->
-      <!--            v-model="searchForm.title"-->
-      <!--            style="width: 240px"-->
-      <!--            placeholder="璇疯緭鍏ュ叕鍛婃爣棰樻悳绱�"-->
-      <!--            @change="handleQuery"-->
-      <!--            clearable-->
-      <!--            :prefix-icon="Search"-->
-      <!--        />-->
-      <!--        <span class="search_title ml10">鍏憡绫诲瀷锛�</span>-->
-      <!--        <el-select v-model="searchForm.type" clearable @change="handleQuery" style="width: 240px">-->
-      <!--          <el-option label="鏀惧亣閫氱煡" :value="1"/>-->
-      <!--          <el-option label="璁惧缁翠慨閫氱煡" :value="2"/>-->
-      <!--        </el-select>-->
-      <!--        <span class="search_title ml10">鐘舵�侊細</span>-->
-      <!--        <el-select v-model="searchForm.status" clearable @change="handleQuery" style="width: 240px">-->
-      <!--          <el-option label="鑽夌" :value="0"/>-->
-      <!--          <el-option label="宸插彂甯�" :value="1"/>-->
-      <!--          <el-option label="宸蹭笅绾�" :value="2"/>-->
-      <!--        </el-select>-->
-      <!--        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>-->
-      <!--        <el-button @click="resetQuery" style="margin-left: 10px">閲嶇疆</el-button>-->
-      <!--      </div>-->
       <div>
         <el-button type="primary" @click="openForm('add')">鏂板鍏憡</el-button>
         <el-button type="danger" plain @click="handleDelete" :disabled="!selectedIds.length">鍒犻櫎</el-button>
@@ -34,16 +10,17 @@
 
     <!-- 閫氱煡鍏憡鏉� -->
     <div class="notice-board">
-      <!-- 鏀惧亣閫氱煡鍖哄煙 -->
-      <div class="notice-section" v-if="holidayNoticeCount > 0">
+      <!-- 缁熶竴閫氱煡鍖哄煙 -->
+      <div class="notice-section" v-if="totalNoticeCount > 0">
         <div class="section-header">
-          <h3>馃搮 鏀惧亣閫氱煡</h3>
-          <span class="section-count">{{ holidayNoticeCount }}鏉�</span>
+          <h3>锟� 閫氱煡鍏憡</h3>
+          <span class="section-count">{{ totalNoticeCount }}鏉�</span>
         </div>
         <div class="notice-cards">
+          <!-- 鏀惧亣閫氱煡 -->
           <div
               v-for="notice in holidayNotices"
-              :key="notice.id"
+              :key="'holiday-' + notice.id"
               class="notice-card holiday-card"
               :class="{ 'urgent': notice.priority === '3' }"
           >
@@ -55,7 +32,7 @@
                 {{ notice.title }}
               </div>
               <div class="card-actions">
-                <el-button link type="primary" @click="handleEdit(notice)">缂栬緫</el-button>
+                <el-button link type="primary" @click="handleEdit(notice)" :disabled="isNoticeExpired(notice)">缂栬緫</el-button>
                 <el-button link type="danger" @click="handleDelete(notice.id)">鍒犻櫎</el-button>
               </div>
             </div>
@@ -64,16 +41,19 @@
             </div>
             <div class="card-footer">
               <div class="card-meta">
+                <span class="type" :class="'type-' + notice.type">
+                  {{ notice.type }}
+                </span>
                 <span class="priority" :class="'priority-' + notice.priority">
                   {{ getPriorityText(notice.priority) }}
                 </span>
-                <span class="status" :class="'status-' + notice.status">
-                  {{ getStatusText(notice.status) }}
+                <span class="status" :class="'status-' + getNoticeStatus(notice)">
+                  {{ getStatusText(getNoticeStatus(notice)) }}
                 </span>
               </div>
               <div class="card-info">
                 <span class="creator">{{ notice.createUserName }}</span>
-                <span class="time">{{ notice.createTime }}</span>
+              <span class="expiration" v-if="notice.expirationDate">鎴鏃ユ湡锛歿{ notice.expirationDate }}</span>
               </div>
             </div>
             <div class="card-remark" v-if="notice.remark">
@@ -83,27 +63,11 @@
               <span>{{ notice.remark }}</span>
             </div>
           </div>
-        </div>
-      </div>
-
-      <pagination
-          v-if="holidayNoticePage.total > 0"
-          :total="holidayNoticePage.total"
-          :page="holidayNoticePage.current"
-          :limit="holidayNoticePage.size"
-          @pagination="handleHolidayNoticeCurrentChange"
-      />
-
-      <!-- 璁惧缁翠慨閫氱煡鍖哄煙 -->
-      <div class="notice-section" v-if="maintenanceNoticeCount > 0">
-        <div class="section-header">
-          <h3>馃敡 璁惧缁翠慨閫氱煡</h3>
-          <span class="section-count">{{ maintenanceNoticeCount }}鏉�</span>
-        </div>
-        <div class="notice-cards">
+          
+          <!-- 璁惧缁翠慨閫氱煡 -->
           <div
               v-for="notice in maintenanceNotices"
-              :key="notice.id"
+              :key="'maintenance-' + notice.id"
               class="notice-card maintenance-card"
               :class="{ 'urgent': notice.priority === '3' }"
           >
@@ -115,7 +79,7 @@
                 {{ notice.title }}
               </div>
               <div class="card-actions">
-                <el-button link type="primary" @click="handleEdit(notice)">缂栬緫</el-button>
+                <el-button link type="primary" @click="handleEdit(notice)" :disabled="isNoticeExpired(notice)">缂栬緫</el-button>
                 <el-button link type="danger" @click="handleDelete(notice.id)">鍒犻櫎</el-button>
               </div>
             </div>
@@ -127,13 +91,13 @@
                 <span class="priority" :class="'priority-' + notice.priority">
                   {{ getPriorityText(notice.priority) }}
                 </span>
-                <span class="status" :class="'status-' + notice.status">
-                  {{ getStatusText(notice.status) }}
+                <span class="status" :class="'status-' + getNoticeStatus(notice)">
+                  {{ getStatusText(getNoticeStatus(notice)) }}
                 </span>
               </div>
               <div class="card-info">
                 <span class="creator">{{ notice.createUserName }}</span>
-                <span class="time">{{ notice.createTime }}</span>
+              <span class="expiration" v-if="notice.expirationDate">鎴鏃ユ湡锛歿{ notice.expirationDate }}</span>
               </div>
             </div>
             <div class="card-remark" v-if="notice.remark">
@@ -146,12 +110,13 @@
         </div>
       </div>
 
+      <!-- 缁熶竴鍒嗛〉 -->
       <pagination
-          v-if="maintenanceNoticePage.total > 0"
-          :total="maintenanceNoticePage.total"
-          :page="maintenanceNoticePage.current"
-          :limit="maintenanceNoticePage.size"
-          @pagination="handleMaintenanceNoticeCurrentChange"
+          v-if="(holidayNoticePage.total + maintenanceNoticePage.total) > 0"
+          :total="holidayNoticePage.total + maintenanceNoticePage.total"
+          :page="Math.max(holidayNoticePage.current, maintenanceNoticePage.current)"
+          :limit="Math.max(holidayNoticePage.size, maintenanceNoticePage.size)"
+          @pagination="handleCurrentChange"
       />
 
       <!-- 绌虹姸鎬� -->
@@ -177,10 +142,7 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="鍏憡绫诲瀷" prop="type">
-              <el-select v-model="form.type" placeholder="璇烽�夋嫨鍏憡绫诲瀷" style="width: 100%">
-                <el-option label="鏀惧亣閫氱煡" :value="1"/>
-                <el-option label="璁惧缁翠慨閫氱煡" :value="2"/>
-              </el-select>
+							<el-input v-model="form.type" placeholder="璇疯緭鍏ュ叕鍛婃爣棰�"/>
             </el-form-item>
           </el-col>
         </el-row>
@@ -189,8 +151,7 @@
             <el-form-item label="鐘舵��">
               <el-radio-group v-model="form.status">
                 <el-radio :value="0">鑽夌</el-radio>
-                <el-radio :value="1">宸插彂甯�</el-radio>
-                <el-radio :value="2">宸蹭笅绾�</el-radio>
+                <el-radio :value="1">姝e紡鍙戝竷</el-radio>
               </el-radio-group>
             </el-form-item>
           </el-col>
@@ -205,8 +166,16 @@
           </el-col>
         </el-row>
         <el-row>
+          <el-col :span="12">
+            <el-form-item label="杩囨湡鏃堕棿" prop="expirationDate">
+							<el-date-picker  v-model="form.expirationDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="date"
+															 placeholder="璇烽�夋嫨" clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
           <el-col :span="24">
-            <el-form-item label="鍏憡鍐呭" prop="noticeContent">
+            <el-form-item label="鍏憡鍐呭" prop="content">
               <el-input
                   v-model="form.content"
                   type="textarea"
@@ -274,6 +243,7 @@
     status: 0,
     priority: 1,
     remark: "",
+		expirationDate: "",
   },
   rules: {
     title: [
@@ -284,6 +254,9 @@
     ],
     content: [
       {required: true, message: "鍏憡鍐呭涓嶈兘涓虹┖", trigger: "blur"}
+    ],
+		expirationDate: [
+      {required: true, message: "璇烽�夋嫨鏃ユ湡", trigger: "change"}
     ]
   }
 });
@@ -339,8 +312,32 @@
 };
 
 const getStatusText = (status) => {
-  const statusMap = {"0": "鑽夌", "1": "宸插彂甯�", "2": "宸蹭笅绾�"};
+  const statusMap = {"0": "鑽夌", "1": "宸插彂甯�", "2": "宸茶繃鏈�"};
   return statusMap[status] || "鏈煡";
+};
+
+const isNoticeExpired = (notice) => {
+  if (!notice || !notice.expirationDate) {
+    return false;
+  }
+
+  const expiration = new Date(notice.expirationDate);
+
+  if (Number.isNaN(expiration.getTime())) {
+    return false;
+  }
+
+  expiration.setHours(23, 59, 59, 999);
+
+  return new Date() > expiration;
+};
+
+const getNoticeStatus = (notice) => {
+  const normalizedStatus = notice && notice.status !== undefined && notice.status !== null
+      ? String(notice.status)
+      : "0";
+
+  return isNoticeExpired(notice) ? "2" : normalizedStatus;
 };
 
 const openForm = (type) => {
@@ -354,12 +351,17 @@
       status: 0,
       priority: 1,
       remark: "",
+      expirationDate: "",
     };
   }
   dialogVisible.value = true;
 };
 
 const handleEdit = (row) => {
+  if (isNoticeExpired(row)) {
+    ElMessage.warning("宸茶繃鏈熺殑鍏憡涓嶅彲缂栬緫");
+    return;
+  }
   dialogTitle.value = "缂栬緫鍏憡";
   form.value = {...row};
   dialogVisible.value = true;
@@ -403,16 +405,10 @@
   });
 };
 
-const holidayNoticeCount = ref()
-const maintenanceNoticeCount = ref()
+const totalNoticeCount = ref(0)
 const fetchCount = () => {
   getCount().then(res => {
-    holidayNoticeCount.value = res.data.filter(item => {
-      return item.type === 1
-    })[0].count;
-    maintenanceNoticeCount.value = res.data.filter(item => {
-      return item.type === 2
-    })[0].count;
+    totalNoticeCount.value = res.data.reduce((total, item) => total + item.count, 0);
   });
 }
 
@@ -421,17 +417,17 @@
 const holidayNoticePage = ref({
   total: 0,
   current: 1,
-  size: 6
+  size: 9
 })
 
 const maintenanceNoticePage = ref({
   total: 0,
   current: 1,
-  size: 6
+  size: 9
 })
 
 const fetchHolidayNotices = () => {
-  listNotice({...holidayNoticePage.value, type: 1}).then(res => {
+  listNotice({...holidayNoticePage.value}).then(res => {
     holidayNotices.value = res.data.records
     holidayNoticePage.value.total = res.data.total
   });
@@ -444,23 +440,20 @@
   });
 };
 
-const handleHolidayNoticeCurrentChange = (val) => {
+const handleCurrentChange = (val) => {
   holidayNoticePage.value.size = val.limit
   holidayNoticePage.value.current = val.page
-  fetchHolidayNotices()
-};
-
-const handleMaintenanceNoticeCurrentChange = (val) => {
   maintenanceNoticePage.value.size = val.limit
   maintenanceNoticePage.value.current = val.page
+  fetchHolidayNotices()
   fetchMaintenanceNotices()
 };
 
 const resetTable = () => {
   holidayNoticePage.value.current = 1
-  holidayNoticePage.value.size = 6
+  holidayNoticePage.value.size = 9
   maintenanceNoticePage.value.current = 1
-  maintenanceNoticePage.value.size = 6
+  maintenanceNoticePage.value.size = 9
   fetchHolidayNotices()
   fetchMaintenanceNotices()
   fetchCount()
@@ -622,11 +615,21 @@
   gap: 8px;
 }
 
-.priority, .status {
+.type, .priority, .status {
   padding: 2px 8px;
   border-radius: 12px;
   font-size: 12px;
   font-weight: 500;
+}
+
+.type-1 {
+  background: #f0f9ff;
+  color: #0369a1;
+}
+
+.type-2 {
+  background: #fef3c7;
+  color: #d97706;
 }
 
 .priority-1 {
@@ -672,6 +675,10 @@
   margin-bottom: 2px;
 }
 
+.expiration {
+  margin-top: 2px;
+}
+
 .card-remark {
   display: flex;
   align-items: center;

--
Gitblit v1.9.3