| src/api/equipmentManagement/runManagement.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/cooperativeOffice/noticeManagement/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/equipmentManagement/runManagement/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/equipmentManagement/runManagement.js
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,16 @@ import request from "@/utils/request"; export const getLedgerPage = (params) => { return request({ url: "/device/ledger/page", method: "get", params, }); }; export const editLedger = (data) => { return request({ url: "/device/ledger", method: "put", data, }); }; src/pages.json
@@ -492,6 +492,13 @@ } }, { "path": "pages/equipmentManagement/runManagement/index", "style": { "navigationBarTitleText": "è¿è¡ç®¡ç", "navigationStyle": "custom" } }, { "path": "pages/equipmentManagement/repair/index", "style": { "navigationBarTitleText": "è®¾å¤æ¥ä¿®", src/pages/cooperativeOffice/noticeManagement/index.vue
@@ -1,6 +1,7 @@ <template> <view class="notice-page"> <PageHeader title="éç¥å ¬å" @back="goBack" /> <PageHeader title="éç¥å ¬å" @back="goBack" /> <!-- æç´¢è¡¨å --> <!-- <view class="search_form"> <up-button type="primary" size="small" @click="openForm('add')">æ°å¢å ¬å</up-button> @@ -8,27 +9,27 @@ å é¤ </up-button> </view> --> <!-- éç¥å ¬åæ¿ --> <view class="notice-board"> <!-- ç»ä¸éç¥åºå --> <view class="notice-section" v-if="totalNoticeCount > 0"> <view class="notice-section" v-if="totalNoticeCount > 0"> <view class="section-header"> <h3>� éç¥å ¬å</h3> <text class="section-count">{{ totalNoticeCount }}æ¡</text> </view> <view class="notice-cards"> <!-- æ¾åéç¥ --> <view v-for="notice in holidayNotices" <view v-for="notice in holidayNotices" :key="'holiday-' + notice.id" class="notice-card holiday-card" :class="{ 'urgent': notice.priority === '3' }" > :class="{ 'urgent': notice.priority === '3' }"> <view class="card-header"> <view class="card-title"> <view class="holiday-icon"> <up-icon name="calendar" size="18" color="#67c23a" /> <up-icon name="calendar" size="18" color="#67c23a" /> </view> <text>{{ notice.title }}</text> </view> @@ -57,57 +58,59 @@ </view> <view class="card-footer"> <view class="card-meta"> <text class="type" :class="'type-' + notice.type"> <text class="type" :class="'type-' + notice.type"> {{ notice.type }} </text> <text class="priority" :class="'priority-' + notice.priority"> <text class="priority" :class="'priority-' + notice.priority"> {{ getPriorityText(notice.priority) }} </text> <text class="status" :class="'status-' + getNoticeStatus(notice)"> <text class="status" :class="'status-' + getNoticeStatus(notice)"> {{ getStatusText(getNoticeStatus(notice)) }} </text> </view> <view class="card-info"> <text class="creator">{{ notice.createUserName }}</text> <text class="expiration" v-if="notice.expirationDate">æªæ¢æ¥æï¼{{ notice.expirationDate }}</text> <text class="expiration" v-if="notice.expirationDate">æªæ¢æ¥æï¼{{ notice.expirationDate }}</text> </view> </view> <view class="card-remark" v-if="notice.remark"> <up-icon name="info-circle" size="16" color="#409eff" /> <view class="card-remark" v-if="notice.remark"> <up-icon name="info-circle" size="16" color="#409eff" /> <text>{{ notice.remark }}</text> </view> </view> <!-- 设å¤ç»´ä¿®éç¥ --> <view v-for="notice in maintenanceNotices" <view v-for="notice in maintenanceNotices" :key="'maintenance-' + notice.id" class="notice-card maintenance-card" :class="{ 'urgent': notice.priority === '3' }" > :class="{ 'urgent': notice.priority === '3' }"> <view class="card-header"> <view class="card-title"> <view class="maintenance-icon"> <up-icon name="wrench" size="18" color="#e6a23c" /> <up-icon name="wrench" size="18" color="#e6a23c" /> </view> <text>{{ notice.title }}</text> </view> <view class="card-actions"> <up-button text <up-button text type="primary" size="mini" @click="handleEdit(notice)" :disabled="isNoticeExpired(notice)" > :disabled="isNoticeExpired(notice)"> ç¼è¾ </up-button> <up-button text <up-button text type="error" size="mini" @click="handleDelete(notice.id)" > @click="handleDelete(notice.id)"> å é¤ </up-button> </view> @@ -117,56 +120,61 @@ </view> <view class="card-footer"> <view class="card-meta"> <text class="priority" :class="'priority-' + notice.priority"> <text class="priority" :class="'priority-' + notice.priority"> {{ getPriorityText(notice.priority) }} </text> <text class="status" :class="'status-' + getNoticeStatus(notice)"> <text class="status" :class="'status-' + getNoticeStatus(notice)"> {{ getStatusText(getNoticeStatus(notice)) }} </text> </view> <view class="card-info"> <text class="creator">{{ notice.createUserName }}</text> <text class="expiration" v-if="notice.expirationDate">æªæ¢æ¥æï¼{{ notice.expirationDate }}</text> <text class="expiration" v-if="notice.expirationDate">æªæ¢æ¥æï¼{{ notice.expirationDate }}</text> </view> </view> <view class="card-remark" v-if="notice.remark"> <up-icon name="info-circle" size="16" color="#409eff" /> <view class="card-remark" v-if="notice.remark"> <up-icon name="info-circle" size="16" color="#409eff" /> <text>{{ notice.remark }}</text> </view> </view> </view> </view> <!-- ç©ºç¶æ --> <view class="empty-state" v-if="holidayNotices.length === 0 && maintenanceNotices.length === 0"> <view class="empty-state" v-if="holidayNotices.length === 0 && maintenanceNotices.length === 0"> <text>ææ éç¥å ¬å</text> </view> </view> <!-- æ°å¢/ç¼è¾å¼¹çª --> <up-popup v-model:show="dialogVisible" <up-popup v-model:show="dialogVisible" mode="bottom" :round="18" :safeAreaInsetBottom="true" @close="resetForm" > @close="resetForm"> <view class="dialog-container"> <view class="dialog-header"> <text class="dialog-title">{{ dialogTitle }}</text> </view> <view class="dialog-body"> <up-form ref="formRef" <up-form ref="formRef" :model="form" :rules="rules" labelWidth="80" > <up-form-item label="å ¬åæ é¢" prop="title"> <up-input v-model="form.title" placeholder="请è¾å ¥å ¬åæ é¢" /> labelWidth="80"> <up-form-item label="å ¬åæ é¢" prop="title"> <up-input v-model="form.title" placeholder="请è¾å ¥å ¬åæ é¢" /> </up-form-item> <up-form-item label="å ¬åç±»å" prop="type"> <up-input v-model="form.type" placeholder="请è¾å ¥å ¬åç±»å" /> <up-form-item label="å ¬åç±»å" prop="type"> <up-input v-model="form.type" placeholder="请è¾å ¥å ¬åç±»å" /> </up-form-item> <up-form-item label="ç¶æ"> <up-radio-group v-model="form.status"> @@ -174,58 +182,47 @@ <up-radio :name="1">æ£å¼åå¸</up-radio> </up-radio-group> </up-form-item> <up-form-item label="ä¼å 级" prop="priority"> <up-select v-model="form.priority" <up-form-item label="ä¼å 级" prop="priority"> <up-select v-model="form.priority" :options="priorityOptions" placeholder="è¯·éæ©ä¼å 级" /> placeholder="è¯·éæ©ä¼å 级" /> </up-form-item> <up-form-item label="è¿ææ¶é´" prop="expirationDate"> <up-datetime-picker v-model="form.expirationDate" <up-form-item label="è¿ææ¶é´" prop="expirationDate"> <up-datetime-picker v-model="form.expirationDate" mode="date" @confirm="onExpireConfirm" > <up-input :value="form.expirationDate" @confirm="onExpireConfirm"> <up-input :value="form.expirationDate" placeholder="è¯·éæ©æ¥æ" readonly /> readonly /> </up-datetime-picker> </up-form-item> <up-form-item label="å ¬åå 容" prop="content"> <up-textarea v-model="form.content" <up-form-item label="å ¬åå 容" prop="content"> <up-textarea v-model="form.content" placeholder="请è¾å ¥å ¬åå 容" :maxlength="500" count /> count /> </up-form-item> <up-form-item label="夿³¨"> <up-textarea v-model="form.remark" <up-textarea v-model="form.remark" placeholder="请è¾å ¥å¤æ³¨ä¿¡æ¯" :maxlength="200" count /> count /> </up-form-item> </up-form> </view> <view class="dialog-footer"> <up-button text="åæ¶" <up-button text="åæ¶" type="info" plain @click="dialogVisible = false" :customStyle="{ marginRight: '10px', flex: 1 }" /> <up-button text="ç¡®å®" :customStyle="{ marginRight: '10px', flex: 1 }" /> <up-button text="ç¡®å®" type="primary" @click="submitForm" :customStyle="{ flex: 1 }" /> :customStyle="{ flex: 1 }" /> </view> </view> </up-popup> @@ -242,7 +239,7 @@ delNotice, getCount, listNotice, updateNotice updateNotice, } from "@/api/collaborativeApproval/noticeManagement.js"; const userStore = useUserStore(); @@ -265,19 +262,13 @@ expirationDate: "", }, rules: { title: [ {required: true, message: "å ¬åæ é¢ä¸è½ä¸ºç©º", trigger: "blur"} ], type: [ {required: true, message: "è¯·éæ©å ¬åç±»å", trigger: "change"} ], content: [ {required: true, message: "å ¬åå 容ä¸è½ä¸ºç©º", trigger: "blur"} ], title: [{ required: true, message: "å ¬åæ é¢ä¸è½ä¸ºç©º", trigger: "blur" }], type: [{ required: true, message: "è¯·éæ©å ¬åç±»å", trigger: "change" }], content: [{ required: true, message: "å ¬åå 容ä¸è½ä¸ºç©º", trigger: "blur" }], expirationDate: [ {required: true, message: "è¯·éæ©æ¥æ", trigger: "change"} ] } { required: true, message: "è¯·éæ©æ¥æ", trigger: "change" }, ], }, }); const {searchForm, form, rules} = toRefs(data); @@ -298,25 +289,24 @@ uni.navigateBack(); }; const onExpireConfirm = (e) => { const onExpireConfirm = e => { if (!e) return; // uview-plus datetime-picker confirm äºä»¶è¿åç value const value = e.value || e; form.value.expirationDate = value; }; const getPriorityText = (priority) => { const priorityMap = {"1": "æ®é", "2": "éè¦", "3": "ç´§æ¥"}; const getPriorityText = priority => { const priorityMap = { 1: "æ®é", 2: "éè¦", 3: "ç´§æ¥" }; return priorityMap[priority] || "æ®é"; }; const getStatusText = (status) => { const statusMap = {"0": "è稿", "1": "å·²åå¸", "2": "å·²è¿æ"}; const getStatusText = status => { const statusMap = { 0: "è稿", 1: "å·²åå¸", 2: "å·²è¿æ" }; return statusMap[status] || "æªç¥"; }; const isNoticeExpired = (notice) => { const isNoticeExpired = notice => { if (!notice || !notice.expirationDate) { return false; } @@ -332,16 +322,17 @@ return new Date() > expiration; }; const getNoticeStatus = (notice) => { const normalizedStatus = notice && notice.status !== undefined && notice.status !== null const getNoticeStatus = notice => { const normalizedStatus = notice && notice.status !== undefined && notice.status !== null ? String(notice.status) : "0"; return isNoticeExpired(notice) ? "2" : normalizedStatus; }; const openForm = (type) => { if (type === 'add') { const openForm = type => { if (type === "add") { dialogTitle.value = "æ°å¢å ¬å"; form.value = { id: undefined, @@ -357,11 +348,11 @@ dialogVisible.value = true; }; const handleEdit = (row) => { const handleEdit = row => { if (isNoticeExpired(row)) { uni.showToast({ title: "å·²è¿æçå ¬åä¸å¯ç¼è¾", icon: "none" icon: "none", }); return; } @@ -370,22 +361,22 @@ dialogVisible.value = true; }; const handleDelete = (id) => { const handleDelete = id => { if (!id) return; uni.showModal({ title: "æç¤º", content: "确认å é¤è¿æ¡å ¬ååï¼", success: (res) => { success: res => { if (res.confirm) { delNotice(id).then(() => { uni.showToast({ title: "å 餿å", icon: "success" icon: "success", }); resetTable(); }); } } }, }); }; @@ -395,105 +386,108 @@ uni.showModal({ title: "æç¤º", content: "确认å é¤éä¸çå ¬ååï¼", success: (res) => { success: res => { if (res.confirm) { // æ ¹æ®selectedIdsæ§è¡æ¹éå é¤é»è¾ï¼å¯æéæ©å±ï¼ } } }, }); }; const submitForm = () => { formRef.value.validate((valid) => { formRef.value.validate(valid => { if (valid) { if (form.value.id) { // ç¼è¾æ¨¡å¼ updateNotice(form.value).then(res => { uni.showToast({ title: "ä¿®æ¹æå", icon: "success" icon: "success", }); resetTable(); }) }); } else { // æ°å¢æ¨¡å¼ addNotice(form.value).then(res => { uni.showToast({ title: "æ°å¢æå", icon: "success" icon: "success", }); resetTable(); }) }); } dialogVisible.value = false; } }); }; const totalNoticeCount = ref(0) const totalNoticeCount = ref(0); const fetchCount = () => { getCount().then(res => { totalNoticeCount.value = res.data.reduce((total, item) => total + item.count, 0); totalNoticeCount.value = res.data.reduce( (total, item) => total + item.count, 0 ); }); } }; const holidayNotices = ref([]) const maintenanceNotices = ref([]) const holidayNotices = ref([]); const maintenanceNotices = ref([]); const holidayNoticePage = ref({ total: 0, current: 1, size: 9 }) size: 9, }); const maintenanceNoticePage = ref({ total: 0, current: 1, size: 9 }) size: 9, }); const isLoadingMore = ref(false) const isLoadingMore = ref(false); const fetchHolidayNotices = (append = false) => { listNotice({...holidayNoticePage.value}).then(res => { const records = res?.data?.records || [] holidayNoticePage.value.total = res?.data?.total || 0 const records = res?.data?.records || []; holidayNoticePage.value.total = res?.data?.total || 0; if (append && holidayNotices.value.length) { holidayNotices.value = [...holidayNotices.value, ...records] holidayNotices.value = [...holidayNotices.value, ...records]; } else { holidayNotices.value = records holidayNotices.value = records; } }); }; const fetchMaintenanceNotices = (append = false) => { listNotice({...holidayNoticePage.value, type: 2}).then(res => { const records = res?.data?.records || [] maintenanceNoticePage.value.total = res?.data?.total || 0 const records = res?.data?.records || []; maintenanceNoticePage.value.total = res?.data?.total || 0; if (append && maintenanceNotices.value.length) { maintenanceNotices.value = [...maintenanceNotices.value, ...records] maintenanceNotices.value = [...maintenanceNotices.value, ...records]; } else { maintenanceNotices.value = records maintenanceNotices.value = records; } }); }; const handleCurrentChange = (val) => { holidayNoticePage.value.size = val.limit holidayNoticePage.value.current = val.page maintenanceNoticePage.value.size = val.limit maintenanceNoticePage.value.current = val.page fetchHolidayNotices() fetchMaintenanceNotices() const handleCurrentChange = val => { holidayNoticePage.value.size = val.limit; holidayNoticePage.value.current = val.page; maintenanceNoticePage.value.size = val.limit; maintenanceNoticePage.value.current = val.page; fetchHolidayNotices(); fetchMaintenanceNotices(); }; const resetTable = () => { holidayNoticePage.value.current = 1 holidayNoticePage.value.size = 9 maintenanceNoticePage.value.current = 1 maintenanceNoticePage.value.size = 9 fetchHolidayNotices() fetchMaintenanceNotices() fetchCount() holidayNoticePage.value.current = 1; holidayNoticePage.value.size = 9; maintenanceNoticePage.value.current = 1; maintenanceNoticePage.value.size = 9; fetchHolidayNotices(); fetchMaintenanceNotices(); fetchCount(); }; const resetForm = () => { @@ -502,9 +496,9 @@ // çå½å¨æ onMounted(() => { fetchCount() fetchHolidayNotices() fetchMaintenanceNotices() fetchCount(); fetchHolidayNotices(); fetchMaintenanceNotices(); }); // ä¸åå è½½æ´å¤ @@ -516,14 +510,14 @@ maintenanceNoticePage.value.current += 1; Promise.all([ new Promise((resolve) => { new Promise(resolve => { fetchHolidayNotices(true); resolve(); }), new Promise((resolve) => { new Promise(resolve => { fetchMaintenanceNotices(true); resolve(); }) }), ]).finally(() => { isLoadingMore.value = false; }); @@ -678,7 +672,9 @@ gap: 8px; } .type, .priority, .status { .type, .priority, .status { padding: 2px 8px; border-radius: 12px; font-size: 12px; src/pages/equipmentManagement/runManagement/index.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,793 @@ <template> <view class="notice-page"> <PageHeader title="è¿è¡ç®¡ç" @back="goBack" /> <!-- éç¥å ¬åæ¿ --> <view class="notice-board"> <!-- ç»ä¸éç¥åºå --> <view class="notice-section" v-if="totalNoticeCount > 0"> <view class="section-header"> <h3>设å¤è¿è¡è®°å½</h3> <!-- <text class="section-count">{{ totalNoticeCount }}æ¡</text> --> </view> <view class="notice-cards"> <!-- æ¾åéç¥ --> <view v-for="notice in holidayNotices" :key="'holiday-' + notice.id" class="notice-card holiday-card" :class="{ 'urgent': isOverdue(notice) }"> <view class="card-header"> <view class="card-title"> <view class="holiday-icon"> <up-icon name="calendar" size="18" color="#67c23a" /> </view> <text>设å¤åç§°ï¼{{ notice.deviceName }}</text> </view> <view class="card-actions warning" v-if="isOverdue(notice)"> <up-icon name="info-circle" size="16" color="#fff" /> <text>{{ 'è¶ æ¶æªå¯å¨' }}</text> </view> <view v-else class="card-actions" :class="getTagType(notice.status)"> <up-icon :name="getIconName(notice.status)" size="16" color="#fff" /> <text>{{ notice.status || 'æªç¥' }}</text> </view> </view> <view class="card-content"> <text>è§æ ¼åå·ï¼{{ notice.deviceModel || "-" }}</text> </view> <view class="card-content"> <text>计åè¿è¡æ¶é´ï¼{{ notice.planRuntimeTime || "-" }}</text> </view> <view class="card-content"> <text>å¼å§è¿è¡æ¶é´ï¼{{ notice.startRuntimeTime || "-" }}</text> </view> <view class="card-content"> <text>ç»æè¿è¡æ¶é´ï¼{{ notice.endRuntimeTime || "-" }}</text> </view> <view class="card-content"> <text>è¿è¡æ¶é¿ï¼{{ notice.runtimeDuration || "-" }}</text> </view> <up-button text v-if="isOverdue(notice)" type="warning" size="small" @click="handleEdit(notice, 'å¯å¨è¿è¡')" :disabled="isNoticeExpired(notice)"> <up-icon name="play-circle" size="16" style="margin-right: 10rpx;" color="#fff" /> ç«å³å¯å¨ </up-button> <up-button text v-else-if="notice.status" :type="getTagType2(notice.status)" size="small" @click="handleEdit(notice, notice.status === 'è¿è¡ä¸' ? '忢è¿è¡' : 'å¯å¨è¿è¡')" :disabled="isNoticeExpired(notice)"> <up-icon :name="getIconName2(notice.status)" size="16" color="#fff" /> {{ notice.status === 'è¿è¡ä¸' ? '忢è¿è¡' : 'ç«å³å¯å¨' }} </up-button> </view> </view> </view> <!-- ç©ºç¶æ --> <view class="empty-state" v-if="holidayNotices.length === 0 && maintenanceNotices.length === 0"> <text>ææ éç¥å ¬å</text> </view> </view> </view> </template> <script setup> import { onMounted, ref, reactive, toRefs } from "vue"; import { onReachBottom } from "@dcloudio/uni-app"; import PageHeader from "@/components/PageHeader.vue"; import useUserStore from "@/store/modules/user"; import { addNotice, delNotice, getCount, listNotice, updateNotice, } from "@/api/collaborativeApproval/noticeManagement.js"; import { getLedgerPage, editLedger, } from "@/api/equipmentManagement/runManagement.js"; const userStore = useUserStore(); // ååºå¼æ°æ® const data = reactive({ searchForm: { title: "", type: undefined, status: undefined, }, form: { id: undefined, title: "", type: null, content: "", status: 0, priority: 1, remark: "", expirationDate: "", }, rules: { title: [{ required: true, message: "å ¬åæ é¢ä¸è½ä¸ºç©º", trigger: "blur" }], type: [{ required: true, message: "è¯·éæ©å ¬åç±»å", trigger: "change" }], content: [{ required: true, message: "å ¬åå 容ä¸è½ä¸ºç©º", trigger: "blur" }], expirationDate: [ { required: true, message: "è¯·éæ©æ¥æ", trigger: "change" }, ], }, }); // è·åæ ç¾ç±»å const getTagType = status => { switch (status) { case "è¿è¡ä¸": return "success"; case "忢è¿è¡": return "error"; default: return "info"; } }; const getTagType2 = status => { switch (status) { case "忢è¿è¡": return "success"; case "è¿è¡ä¸": return "error"; default: return "info"; } }; // è·å徿 åç§° const getIconName = status => { switch (status) { case "è¿è¡ä¸": return "play-circle"; case "忢è¿è¡": return "pause-circle"; default: return "question-circle"; } }; // è·å徿 åç§°2 const getIconName2 = status => { switch (status) { case "忢è¿è¡": return "play-circle"; case "è¿è¡ä¸": return "pause-circle"; default: return "question-circle"; } }; const { searchForm, form, rules } = toRefs(data); // 页é¢ç¶æ const dialogVisible = ref(false); const dialogTitle = ref(""); const selectedIds = ref([]); const formRef = ref(); const priorityOptions = [ { label: "æ®é", value: 1 }, { label: "éè¦", value: 2 }, { label: "ç´§æ¥", value: 3 }, ]; const goBack = () => { uni.navigateBack(); }; const isOverdue = notice => { if ( notice.status == "è¿è¡ä¸" || !notice.planRuntimeTime || notice.startRuntimeTime ) { return false; } const planTime = new Date(notice.planRuntimeTime).getTime(); const currentTime = new Date().getTime(); return currentTime > planTime; }; const onExpireConfirm = e => { if (!e) return; // uview-plus datetime-picker confirm äºä»¶è¿åç value const value = e.value || e; form.value.expirationDate = value; }; const getPriorityText = priority => { const priorityMap = { 1: "æ®é", 2: "éè¦", 3: "ç´§æ¥" }; return priorityMap[priority] || "æ®é"; }; const getStatusText = status => { 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 => { if (type === "add") { dialogTitle.value = "æ°å¢å ¬å"; form.value = { id: undefined, title: "", type: undefined, content: "", status: 0, priority: 1, remark: "", expirationDate: "", }; } dialogVisible.value = true; }; const handleEdit = async (device, status) => { try { const currentTime = new Date() .toLocaleString("zh-CN", { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false, }) .replace(/\//g, "-"); // æ´æ°è®¾å¤ç¶æåç¸å ³æ¶é´å段 if (status === "å¯å¨è¿è¡") { device.status = "è¿è¡ä¸"; device.startRuntimeTime = currentTime; device.endRuntimeTime = null; // æ¸ ç©ºç»ææ¶é´ device.runtimeDuration = null; // æ¸ ç©ºè¿è¡æ¶é¿ } else { device.status = "忢è¿è¡"; device.endRuntimeTime = currentTime; // 计ç®è¿è¡æ¶é¿ if (device.startRuntimeTime) { const startTime = new Date(device.startRuntimeTime); const endTime = new Date(currentTime); const duration = endTime - startTime; const hours = Math.floor(duration / (1000 * 60 * 60)); const minutes = Math.floor((duration % (1000 * 60 * 60)) / (1000 * 60)); device.runtimeDuration = `${hours}å°æ¶${minutes}åé`; } } const params = { id: device.id, status: device.status, planRuntimeTime: device.planRuntimeTime, startRuntimeTime: device.startRuntimeTime, endRuntimeTime: device.endRuntimeTime, runtimeDuration: device.runtimeDuration, }; // è°ç¨APIæ´æ°è®¾å¤ç¶æ const response = await editLedger(params); if (response.code === 200) { showToast(`${device.deviceName} ${status}æå`); // å·æ°å表 await fetchHolidayNotices(); } else { showToast(response.msg || "æä½å¤±è´¥"); } } catch (error) { console.error("æ´æ°è®¾å¤ç¶æå¤±è´¥:", error); showToast("æä½å¤±è´¥"); } }; const handleDelete = id => { if (!id) return; uni.showModal({ title: "æç¤º", content: "确认å é¤è¿æ¡å ¬ååï¼", success: res => { if (res.confirm) { delNotice(id).then(() => { uni.showToast({ title: "å 餿å", icon: "success", }); resetTable(); }); } }, }); }; // é¢çæ¹éå é¤ï¼ç®åæªå®ç°éä¸é»è¾ï¼ä» å ä½ï¼ const handleDeleteBatch = () => { if (!selectedIds.value.length) return; uni.showModal({ title: "æç¤º", content: "确认å é¤éä¸çå ¬ååï¼", success: res => { if (res.confirm) { // æ ¹æ®selectedIdsæ§è¡æ¹éå é¤é»è¾ï¼å¯æéæ©å±ï¼ } }, }); }; const submitForm = () => { formRef.value.validate(valid => { if (valid) { if (form.value.id) { // ç¼è¾æ¨¡å¼ updateNotice(form.value).then(res => { uni.showToast({ title: "ä¿®æ¹æå", icon: "success", }); resetTable(); }); } else { // æ°å¢æ¨¡å¼ addNotice(form.value).then(res => { uni.showToast({ title: "æ°å¢æå", icon: "success", }); resetTable(); }); } dialogVisible.value = false; } }); }; const totalNoticeCount = ref(0); const fetchCount = () => { getCount().then(res => { totalNoticeCount.value = res.data.reduce( (total, item) => total + item.count, 0 ); }); }; const holidayNotices = ref([]); const maintenanceNotices = ref([]); const holidayNoticePage = ref({ total: 0, current: 1, size: 9, }); const maintenanceNoticePage = ref({ total: 0, current: 1, size: 9, }); const isLoadingMore = ref(false); const fetchHolidayNotices = (append = false) => { getLedgerPage({}).then(res => { holidayNotices.value = res?.data?.records || []; // const records = res?.data?.records || []; // holidayNoticePage.value.total = res?.data?.total || 0; // if (append && holidayNotices.value.length) { // holidayNotices.value = [...holidayNotices.value, ...records]; // } else { // holidayNotices.value = records; // } }); }; const fetchMaintenanceNotices = (append = false) => { listNotice({ ...holidayNoticePage.value, type: 2 }).then(res => { const records = res?.data?.records || []; maintenanceNoticePage.value.total = res?.data?.total || 0; if (append && maintenanceNotices.value.length) { maintenanceNotices.value = [...maintenanceNotices.value, ...records]; } else { maintenanceNotices.value = records; } }); }; const handleCurrentChange = val => { holidayNoticePage.value.size = val.limit; holidayNoticePage.value.current = val.page; maintenanceNoticePage.value.size = val.limit; maintenanceNoticePage.value.current = val.page; fetchHolidayNotices(); fetchMaintenanceNotices(); }; const resetTable = () => { holidayNoticePage.value.current = 1; holidayNoticePage.value.size = 9; maintenanceNoticePage.value.current = 1; maintenanceNoticePage.value.size = 9; fetchHolidayNotices(); fetchMaintenanceNotices(); fetchCount(); }; const resetForm = () => { formRef.value?.resetFields(); }; // çå½å¨æ onMounted(() => { fetchCount(); fetchHolidayNotices(); fetchMaintenanceNotices(); }); // ä¸åå è½½æ´å¤ onReachBottom(() => { if (isLoadingMore.value) return; isLoadingMore.value = true; holidayNoticePage.value.current += 1; maintenanceNoticePage.value.current += 1; Promise.all([ new Promise(resolve => { fetchHolidayNotices(true); resolve(); }), new Promise(resolve => { fetchMaintenanceNotices(true); resolve(); }), ]).finally(() => { isLoadingMore.value = false; }); }); </script> <style scoped> .notice-page { min-height: 100vh; background: #f5f7fa; padding-bottom: 16px; display: flex; flex-direction: column; } .search_form { background: #ffffff; padding: 12px 16px; margin: 8px 12px 12px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); display: flex; justify-content: flex-start; align-items: center; } .search_title { font-weight: 500; color: #333; margin-right: 8px; } .ml10 { margin-left: 10px; } .notice-board { padding: 0 12px 16px; } .notice-section { margin-bottom: 16px; } .section-header { display: flex; align-items: center; margin: 4px 4px 12px; } .section-header h3 { margin: 0; color: #303133; font-size: 16px; font-weight: 600; } .section-count { margin-left: 10px; background: #409eff; color: white; padding: 2px 8px; border-radius: 12px; font-size: 12px; } .notice-cards { display: flex; flex-direction: column; gap: 12px; } .notice-card { background: white; border-radius: 12px; padding: 14px 14px 10px; box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06); transition: all 0.3s ease; border-left: 4px solid transparent; } .notice-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); } .holiday-card { border-left-color: #bec4c3; } .maintenance-card { border-left-color: #e6a23c; } .urgent { border-left-color: #f56c6c; background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%); } .card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; } .card-title { display: flex; align-items: center; font-size: 15px; font-weight: 600; color: #303133; flex: 1; } .holiday-icon { color: #67c23a; margin-right: 8px; font-size: 18px; } .maintenance-icon { color: #e6a23c; margin-right: 8px; font-size: 18px; } .card-actions { display: flex; gap: 8px; padding: 4rpx 8rpx; border-radius: 10rpx; } .card-content { margin-bottom: 10px; } .card-content text { color: #606266; line-height: 1.6; font-size: 13px; } .card-footer { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; } .card-meta { display: flex; gap: 8px; } .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 { background: #f0f9ff; color: #0369a1; } .priority-2 { background: #fef3c7; color: #d97706; } .success { background: #67c23a; color: #fff; } .error { background: #f56c6c; color: #fff; } .info { background: #a8a9aa; color: #fff; } .warning { background: #e6a23c; color: #fff; } .priority-3 { background: #fef2f2; color: #dc2626; } .status-0 { background: #f3f4f6; color: #6b7280; } .status-1 { background: #d1fae5; color: #059669; } .status-2 { background: #fef3c7; color: #d97706; } .card-info { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: #909399; } .creator { font-weight: 500; margin-bottom: 2px; } .expiration { margin-top: 2px; } .card-remark { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #f8f9fa; border-radius: 6px; font-size: 12px; color: #606266; border-left: 3px solid #409eff; } .empty-state { text-align: center; padding: 48px 16px; color: #999; font-size: 13px; } .dialog-footer { text-align: right; } /* ç§»å¨ç«¯å¼¹çªæ ·å¼ */ .dialog-container { background: #ffffff; border-radius: 18px 18px 0 0; max-height: 80vh; display: flex; flex-direction: column; } .dialog-header { padding: 16px 20px 8px 20px; } .dialog-title { font-size: 16px; font-weight: 600; color: #303133; } .dialog-body { flex: 1; padding: 0 16px 12px 16px; overflow-y: auto; } .dialog-footer { display: flex; padding: 12px 16px 16px 16px; border-top: 1px solid #f0f0f0; } /* ååºå¼è®¾è®¡ */ @media (max-width: 768px) { .search_form { flex-direction: column; gap: 15px; align-items: flex-start; } .search_form > div { width: 100%; display: flex; gap: 10px; } } </style> src/pages/index.vue
@@ -278,18 +278,6 @@ // åååå ¬åè½æ°æ® const collaborationItems = reactive([ // { // icon: "/static/images/icon/gongchuguanli@2x.png", // label: "å ¬åºç®¡ç", // }, // { // icon: "/static/images/icon/qingjiaguanli@2x.png", // label: "请å管ç", // }, // { // icon: "/static/images/icon/chuchaiguanli@2x.png", // label: "åºå·®ç®¡ç", // }, { icon: "/static/images/icon/gongchuguanli@2x.png", label: "èå¤ç®¡ç", @@ -298,54 +286,10 @@ icon: "/static/images/icon/baoxiaoguanli.png", label: "è´¢å¡ç®¡ç", }, // { // icon: "/static/images/icon/chuchaiguanli@2x.png", // label: "æ¥é管ç", // }, // { // icon: "/static/images/icon/chuchaiguanli@2x.png", // label: "éè´ç®¡ç", // }, // { // icon: "/static/images/icon/chuchaiguanli@2x.png", // label: "æ¥ä»·ç®¡ç", // }, // { // icon: "/static/images/icon/chuchaiguanli@2x.png", // label: "åºåºç®¡ç", // }, { icon: "/static/images/icon/huiyiliebiao@2x.png", label: "ä¼è®®ç®¡ç", }, // { // icon: "/static/images/icon/qingjiaguanli@2x.png", // label: "ä¼è®®è®¾ç½®", // }, // { // icon: "/static/images/icon/qingjiaguanli@2x.png", // label: "ä¼è®®å表", // }, // { // icon: "/static/images/icon/qingjiaguanli@2x.png", // label: "ä¼è®®ç³è¯·", // }, // { // icon: "/static/images/icon/qingjiaguanli@2x.png", // label: "ä¼è®®å®¡æ¹", // }, // { // icon: "/static/images/icon/qingjiaguanli@2x.png", // label: "ä¼è®®åå¸", // }, // { // icon: "/static/images/icon/qingjiaguanli@2x.png", // label: "ä¼è®®æ»ç»", // }, // { // icon: "/static/images/icon/qingjiaguanli@2x.png", // label: "ä¼è®®çæ¿", // }, { icon: "/static/images/icon/tongzhigonggao@2x.png", label: "éç¥å ¬å", @@ -407,6 +351,10 @@ // icon: '/static/images/icon/shebeitaizhang@2x.png', // label: '设å¤å°è´¦', // }, { icon: "/static/images/icon/shbeibaoxiu@2x.png", label: "è¿è¡ç®¡ç", }, { icon: "/static/images/icon/shbeibaoxiu@2x.png", label: "è®¾å¤æ¥ä¿®", @@ -649,6 +597,11 @@ url: "/pages/equipmentManagement/ledger/index", }); break; case "è¿è¡ç®¡ç": uni.navigateTo({ url: "/pages/equipmentManagement/runManagement/index", }); break; case "è®¾å¤æ¥ä¿®": uni.navigateTo({ url: "/pages/equipmentManagement/repair/index",