| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | export function getLineInspectionList(params) { |
| | | return request({ |
| | | url: "/safeLineInspection/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | export function getLineInspectionById(id) { |
| | | return request({ |
| | | url: `/safeLineInspection/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | export function addLineInspection(data) { |
| | | return request({ |
| | | url: "/safeLineInspection", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function updateLineInspection(data) { |
| | | return request({ |
| | | url: "/safeLineInspection", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function deleteLineInspection(ids) { |
| | | const joined = Array.isArray(ids) ? ids.join(",") : String(ids || ""); |
| | | return request({ |
| | | url: `/safeLineInspection/${joined}`, |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | export function completeLineInspection(id) { |
| | | return request({ |
| | | url: `/safeLineInspection/complete/${id}`, |
| | | method: "put", |
| | | }); |
| | | } |
| | | |
| | | export function getInspectionRecords(inspectionId) { |
| | | return request({ |
| | | url: `/safeLineInspectionRecord/list/${inspectionId}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | export function addInspectionRecord(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionRecord", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function updateInspectionRecord(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionRecord", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function deleteInspectionRecord(ids) { |
| | | const joined = Array.isArray(ids) ? ids.join(",") : String(ids || ""); |
| | | return request({ |
| | | url: `/safeLineInspectionRecord/${joined}`, |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | export function batchAddInspectionRecords(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionRecord/batch", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function getInspectionHazards(params) { |
| | | return request({ |
| | | url: "/safeLineInspectionHazard/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | export function getHazardsByInspectionId(inspectionId) { |
| | | return request({ |
| | | url: `/safeLineInspectionHazard/list/${inspectionId}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | export function addInspectionHazard(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionHazard", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function updateInspectionHazard(data) { |
| | | return request({ |
| | | url: "/safeLineInspectionHazard", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function deleteInspectionHazard(ids) { |
| | | const joined = Array.isArray(ids) ? ids.join(",") : String(ids || ""); |
| | | return request({ |
| | | url: `/safeLineInspectionHazard/${joined}`, |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | export function getFacilityLedgerList(params) { |
| | | return request({ |
| | | url: "/safeFacilityLedger/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | export function getFacilityLedgerById(id) { |
| | | return request({ |
| | | url: `/safeFacilityLedger/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | export function addFacilityLedger(data) { |
| | | return request({ |
| | | url: "/safeFacilityLedger", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function updateFacilityLedger(data) { |
| | | return request({ |
| | | url: "/safeFacilityLedger", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function deleteFacilityLedger(ids) { |
| | | const joined = Array.isArray(ids) ? ids.join(",") : String(ids || ""); |
| | | return request({ |
| | | url: `/safeFacilityLedger/${joined}`, |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | export function getFacilityInspectionList(params) { |
| | | return request({ |
| | | url: "/safeFacilityInspection/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | export function getFacilityInspectionById(id) { |
| | | return request({ |
| | | url: `/safeFacilityInspection/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | export function addFacilityInspection(data) { |
| | | return request({ |
| | | url: "/safeFacilityInspection", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function updateFacilityInspection(data) { |
| | | return request({ |
| | | url: "/safeFacilityInspection", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function deleteFacilityInspection(ids) { |
| | | const joined = Array.isArray(ids) ? ids.join(",") : String(ids || ""); |
| | | return request({ |
| | | url: `/safeFacilityInspection/${joined}`, |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | | export function getFacilityRectificationList(params) { |
| | | return request({ |
| | | url: "/safeFacilityRectification/page", |
| | | method: "get", |
| | | params, |
| | | }); |
| | | } |
| | | |
| | | export function getFacilityRectificationById(id) { |
| | | return request({ |
| | | url: `/safeFacilityRectification/${id}`, |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | export function addFacilityRectification(data) { |
| | | return request({ |
| | | url: "/safeFacilityRectification", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function updateFacilityRectification(data) { |
| | | return request({ |
| | | url: "/safeFacilityRectification", |
| | | method: "put", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | export function deleteFacilityRectification(ids) { |
| | | const joined = Array.isArray(ids) ? ids.join(",") : String(ids || ""); |
| | | return request({ |
| | | url: `/safeFacilityRectification/${joined}`, |
| | | method: "delete", |
| | | data: ids, |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/lineInspection/index", |
| | | "style": { |
| | | "navigationBarTitleText": "线路巡æ£", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/lineInspection/edit", |
| | | "style": { |
| | | "navigationBarTitleText": "å·¡æ£ä»»å¡", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/lineInspection/recordList", |
| | | "style": { |
| | | "navigationBarTitleText": "å·¡æ£è®°å½", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/lineInspection/recordEdit", |
| | | "style": { |
| | | "navigationBarTitleText": "å·¡æ£è®°å½", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/lineInspection/hazardList", |
| | | "style": { |
| | | "navigationBarTitleText": "éæ£ç®¡ç", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/lineInspection/hazardEdit", |
| | | "style": { |
| | | "navigationBarTitleText": "鿣", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/lineInspection/hazardRectify", |
| | | "style": { |
| | | "navigationBarTitleText": "æ´æ¹", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/safetyFacility/index", |
| | | "style": { |
| | | "navigationBarTitleText": "å®å
¨è®¾æ½å·¡æ£", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/safetyFacility/ledgerEdit", |
| | | "style": { |
| | | "navigationBarTitleText": "设æ½å°è´¦", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/safetyFacility/inspectionEdit", |
| | | "style": { |
| | | "navigationBarTitleText": "设æ½å·¡æ£", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/safetyFacility/rectificationEdit", |
| | | "style": { |
| | | "navigationBarTitleText": "æ´æ¹", |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/safeProduction/accidentReportingRecord/index", |
| | | "style": { |
| | | "navigationBarTitleText": "äºæ
æ¥åè®°å½", |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <PageHeader :title="pageTitle" @back="goBack" /> |
| | | <up-form :model="form" label-width="110"> |
| | | <up-form-item label="å·¡æ£ç¼å·" required> |
| | | <up-input v-model="form.inspectionCode" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="å·¡æ£åç§°" required> |
| | | <up-input v-model="form.inspectionName" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="线路åç§°" required> |
| | | <up-input v-model="form.lineName" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="å·¡æ£ç±»å"> |
| | | <up-input :model-value="inspectionTypeText" placeholder="è¯·éæ©" readonly @click="showTypeSheet = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showTypeSheet = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="计åå·¡æ£æ¶é´"> |
| | | <up-input :model-value="form.planTime" placeholder="è¯·éæ©" readonly @click="showPlanTimePicker = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showPlanTimePicker = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="å·¡æ£äºº" required> |
| | | <up-input :model-value="inspectorText" placeholder="è¯·éæ©ï¼å¯å¤éï¼" readonly @click="openInspectorPopup" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="openInspectorPopup"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="夿³¨"> |
| | | <up-textarea v-model="form.remark" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | </up-form> |
| | | |
| | | <FooterButtons :loading="loading" confirmText="ä¿å" @cancel="goBack" @confirm="handleSubmit" /> |
| | | |
| | | <up-action-sheet |
| | | :show="showTypeSheet" |
| | | title="鿩巡æ£ç±»å" |
| | | :actions="typeActions" |
| | | @select="onSelectType" |
| | | @close="showTypeSheet = false" |
| | | /> |
| | | |
| | | <up-datetime-picker |
| | | :show="showPlanTimePicker" |
| | | mode="datetime" |
| | | :value="planTimeValue" |
| | | @confirm="onPlanTimeConfirm" |
| | | @cancel="showPlanTimePicker = false" |
| | | /> |
| | | |
| | | <up-popup :show="showInspectorPopup" mode="bottom" @close="showInspectorPopup = false"> |
| | | <view class="popup-container"> |
| | | <view class="popup-header"> |
| | | <text class="popup-title">鿩巡æ£äºº</text> |
| | | </view> |
| | | <scroll-view scroll-y class="popup-scroll"> |
| | | <up-checkbox-group v-model="inspectorIdsTemp"> |
| | | <up-checkbox |
| | | v-for="u in userOptions" |
| | | :key="u.value" |
| | | :name="u.value" |
| | | :label="u.label" |
| | | ></up-checkbox> |
| | | </up-checkbox-group> |
| | | </scroll-view> |
| | | <view class="popup-footer"> |
| | | <u-button size="small" @click="showInspectorPopup = false">åæ¶</u-button> |
| | | <u-button type="primary" size="small" @click="confirmInspector">ç¡®å®</u-button> |
| | | </view> |
| | | </view> |
| | | </up-popup> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, onMounted, ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import dayjs from "dayjs"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FooterButtons from "@/components/FooterButtons.vue"; |
| | | import { addLineInspection, updateLineInspection } from "@/api/safeProduction/lineInspection"; |
| | | import { userListNoPage } from "@/api/system/user"; |
| | | |
| | | const loading = ref(false); |
| | | const form = ref({ |
| | | id: null, |
| | | inspectionCode: "", |
| | | inspectionName: "", |
| | | lineName: "", |
| | | inspectionType: "", |
| | | planTime: "", |
| | | inspectorId: "", |
| | | inspectorIds: [], |
| | | remark: "", |
| | | }); |
| | | |
| | | const userOptions = ref([]); |
| | | |
| | | const showTypeSheet = ref(false); |
| | | const showPlanTimePicker = ref(false); |
| | | const showInspectorPopup = ref(false); |
| | | const inspectorIdsTemp = ref([]); |
| | | |
| | | const typeActions = [ |
| | | { name: "宿巡æ£", value: "宿巡æ£" }, |
| | | { name: "临æ¶å·¡æ£", value: "临æ¶å·¡æ£" }, |
| | | ]; |
| | | |
| | | const pageTitle = computed(() => (form.value.id ? "ç¼è¾å·¡æ£ä»»å¡" : "æ°å¢å·¡æ£ä»»å¡")); |
| | | const inspectionTypeText = computed(() => form.value.inspectionType || ""); |
| | | |
| | | const inspectorText = computed(() => { |
| | | const ids = Array.isArray(form.value.inspectorIds) ? form.value.inspectorIds : []; |
| | | if (ids.length === 0) return ""; |
| | | const map = new Map(userOptions.value.map(x => [x.value, x.label])); |
| | | const names = ids.map(id => map.get(id)).filter(Boolean); |
| | | return names.join("ï¼"); |
| | | }); |
| | | |
| | | const planTimeValue = computed(() => { |
| | | if (!form.value.planTime) return Date.now(); |
| | | const ts = dayjs(form.value.planTime).valueOf(); |
| | | return Number.isFinite(ts) ? ts : Date.now(); |
| | | }); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const onSelectType = action => { |
| | | form.value.inspectionType = action.value; |
| | | showTypeSheet.value = false; |
| | | }; |
| | | |
| | | const onPlanTimeConfirm = e => { |
| | | const ts = e?.value; |
| | | form.value.planTime = dayjs(ts).format("YYYY-MM-DD HH:mm:ss"); |
| | | showPlanTimePicker.value = false; |
| | | }; |
| | | |
| | | const openInspectorPopup = () => { |
| | | inspectorIdsTemp.value = [...(form.value.inspectorIds || [])]; |
| | | showInspectorPopup.value = true; |
| | | }; |
| | | |
| | | const confirmInspector = () => { |
| | | form.value.inspectorIds = [...(inspectorIdsTemp.value || [])]; |
| | | showInspectorPopup.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = async () => { |
| | | const inspectionCode = String(form.value.inspectionCode || "").trim(); |
| | | if (!inspectionCode) { |
| | | uni.showToast({ title: "请è¾å
¥å·¡æ£ç¼å·", icon: "none" }); |
| | | return; |
| | | } |
| | | const inspectionName = String(form.value.inspectionName || "").trim(); |
| | | if (!inspectionName) { |
| | | uni.showToast({ title: "请è¾å
¥å·¡æ£åç§°", icon: "none" }); |
| | | return; |
| | | } |
| | | const lineName = String(form.value.lineName || "").trim(); |
| | | if (!lineName) { |
| | | uni.showToast({ title: "请è¾å
¥çº¿è·¯åç§°", icon: "none" }); |
| | | return; |
| | | } |
| | | const inspectorIds = Array.isArray(form.value.inspectorIds) ? form.value.inspectorIds : []; |
| | | if (inspectorIds.length === 0) { |
| | | uni.showToast({ title: "è¯·éæ©å·¡æ£äºº", icon: "none" }); |
| | | return; |
| | | } |
| | | |
| | | const payload = { |
| | | ...form.value, |
| | | inspectionCode, |
| | | inspectionName, |
| | | lineName, |
| | | inspectorId: inspectorIds.join(","), |
| | | }; |
| | | delete payload.inspectorIds; |
| | | |
| | | loading.value = true; |
| | | const api = payload.id ? updateLineInspection : addLineInspection; |
| | | api(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: "ä¿åæå", icon: "success" }); |
| | | uni.$emit("lineInspection:refresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "ä¿å失败", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const initUsers = () => { |
| | | userListNoPage() |
| | | .then(res => { |
| | | const list = res?.data || []; |
| | | userOptions.value = list.map(u => ({ |
| | | label: u.nickName, |
| | | value: u.userId, |
| | | })); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | initUsers(); |
| | | }); |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const row = JSON.parse(decodeURIComponent(options.data)); |
| | | const inspectorIds = row?.inspectorId |
| | | ? String(row.inspectorId) |
| | | .split(",") |
| | | .map(x => Number(String(x).trim())) |
| | | .filter(n => Number.isFinite(n)) |
| | | : []; |
| | | form.value = { |
| | | ...form.value, |
| | | ...row, |
| | | inspectorIds, |
| | | }; |
| | | } catch (e) {} |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/static/scss/form-common.scss"; |
| | | |
| | | .popup-container { |
| | | background: #fff; |
| | | border-top-left-radius: 20rpx; |
| | | border-top-right-radius: 20rpx; |
| | | padding: 24rpx; |
| | | max-height: 70vh; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .popup-header { |
| | | padding-bottom: 16rpx; |
| | | } |
| | | |
| | | .popup-title { |
| | | font-size: 30rpx; |
| | | font-weight: 600; |
| | | color: #333; |
| | | } |
| | | |
| | | .popup-scroll { |
| | | flex: 1; |
| | | min-height: 0; |
| | | padding: 10rpx 0; |
| | | } |
| | | |
| | | .popup-footer { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | gap: 16rpx; |
| | | padding-top: 16rpx; |
| | | } |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <PageHeader :title="pageTitle" @back="goBack" /> |
| | | <up-form :model="form" label-width="110"> |
| | | <up-form-item label="鿣æè¿°" required> |
| | | <up-textarea v-model="form.hazardDesc" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | <up-form-item label="鿣ç级" required> |
| | | <up-input :model-value="form.hazardLevel" placeholder="è¯·éæ©" readonly @click="showLevelSheet = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showLevelSheet = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="鿣ä½ç½®" required> |
| | | <up-input v-model="form.hazardLocation" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | </up-form> |
| | | |
| | | <FooterButtons :loading="loading" confirmText="ä¿å" @cancel="goBack" @confirm="handleSubmit" /> |
| | | |
| | | <up-action-sheet |
| | | :show="showLevelSheet" |
| | | title="鿩鿣ç级" |
| | | :actions="levelActions" |
| | | @select="onSelectLevel" |
| | | @close="showLevelSheet = false" |
| | | /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FooterButtons from "@/components/FooterButtons.vue"; |
| | | import { addInspectionHazard, updateInspectionHazard } from "@/api/safeProduction/lineInspection"; |
| | | |
| | | const loading = ref(false); |
| | | const inspectionId = ref(null); |
| | | |
| | | const form = ref({ |
| | | id: null, |
| | | inspectionId: null, |
| | | hazardDesc: "", |
| | | hazardLevel: "", |
| | | hazardLocation: "", |
| | | }); |
| | | |
| | | const showLevelSheet = ref(false); |
| | | const levelActions = [ |
| | | { name: "ä¸è¬", value: "ä¸è¬" }, |
| | | { name: "é大", value: "é大" }, |
| | | ]; |
| | | |
| | | const pageTitle = computed(() => (form.value.id ? "ç¼è¾éæ£" : "䏿¥éæ£")); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const onSelectLevel = action => { |
| | | form.value.hazardLevel = action.value; |
| | | showLevelSheet.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | const hazardDesc = String(form.value.hazardDesc || "").trim(); |
| | | if (!hazardDesc) { |
| | | uni.showToast({ title: "请è¾å
¥éæ£æè¿°", icon: "none" }); |
| | | return; |
| | | } |
| | | const hazardLevel = String(form.value.hazardLevel || "").trim(); |
| | | if (!hazardLevel) { |
| | | uni.showToast({ title: "è¯·éæ©éæ£ç级", icon: "none" }); |
| | | return; |
| | | } |
| | | const hazardLocation = String(form.value.hazardLocation || "").trim(); |
| | | if (!hazardLocation) { |
| | | uni.showToast({ title: "请è¾å
¥éæ£ä½ç½®", icon: "none" }); |
| | | return; |
| | | } |
| | | |
| | | const payload = { |
| | | ...form.value, |
| | | inspectionId: inspectionId.value, |
| | | hazardDesc, |
| | | hazardLevel, |
| | | hazardLocation, |
| | | }; |
| | | |
| | | loading.value = true; |
| | | const api = payload.id ? updateInspectionHazard : addInspectionHazard; |
| | | api(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: "ä¿åæå", icon: "success" }); |
| | | uni.$emit("lineInspection:hazardsRefresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "ä¿å失败", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const obj = JSON.parse(decodeURIComponent(options.data)); |
| | | inspectionId.value = obj.inspectionId; |
| | | if (obj?.row) { |
| | | form.value = { ...form.value, ...(obj.row || {}) }; |
| | | } |
| | | } catch (e) {} |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/static/scss/form-common.scss"; |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="hazard-list"> |
| | | <PageHeader title="éæ£ç®¡ç" |
| | | @back="goBack" /> |
| | | <view class="top-actions"> |
| | | <u-button type="primary" |
| | | size="small" |
| | | :disabled="isCompleted" |
| | | @click="goAdd">䏿¥éæ£</u-button> |
| | | </view> |
| | | <scroll-view scroll-y |
| | | class="list-scroll ledger-list" |
| | | v-if="hazards.length > 0"> |
| | | <view v-for="row in hazards" |
| | | :key="row.id" |
| | | 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">{{ row.hazardCode || "鿣" }}</text> |
| | | </view> |
| | | <view class="item-right"> |
| | | <up-tag :text="row.status || '-'" |
| | | :type="statusType(row.status)" |
| | | size="mini" /> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">鿣æè¿°</text> |
| | | <text class="detail-value">{{ row.hazardDesc || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">鿣ç级</text> |
| | | <text class="detail-value">{{ row.hazardLevel || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">鿣ä½ç½®</text> |
| | | <text class="detail-value">{{ row.hazardLocation || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">æ´æ¹è´£ä»»äºº</text> |
| | | <text class="detail-value">{{ row.rectifyUserName || "-" }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="action-buttons"> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | :disabled="isCompleted" |
| | | @click.stop="goEdit(row)">ç¼è¾</u-button> |
| | | <u-button v-if="String(row.status) !== 'å·²æ´æ¹'" |
| | | size="small" |
| | | class="action-btn fixed-btn" |
| | | type="success" |
| | | :disabled="isCompleted" |
| | | @click.stop="goRectify(row)"> |
| | | æ´æ¹ |
| | | </u-button> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | <view v-else |
| | | class="no-data"> |
| | | <up-empty mode="data" |
| | | text="ææ éæ£"></up-empty> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, onMounted, ref } from "vue"; |
| | | import { onLoad, onShow } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import { getHazardsByInspectionId } from "@/api/safeProduction/lineInspection"; |
| | | |
| | | const inspectionId = ref(null); |
| | | const inspectionStatus = ref(""); |
| | | const hazards = ref([]); |
| | | |
| | | const isCompleted = computed(() => String(inspectionStatus.value) === "已宿"); |
| | | |
| | | const statusType = status => { |
| | | const map = { |
| | | å¾
æ´æ¹: "error", |
| | | æ´æ¹ä¸: "warning", |
| | | å·²æ´æ¹: "success", |
| | | }; |
| | | return map[status] || "info"; |
| | | }; |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const fetchHazards = () => { |
| | | if (!inspectionId.value) return; |
| | | uni.showLoading({ title: "å è½½ä¸...", mask: true }); |
| | | getHazardsByInspectionId(inspectionId.value) |
| | | .then(res => { |
| | | hazards.value = res?.data || []; |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "å 载失败", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | uni.hideLoading(); |
| | | }); |
| | | }; |
| | | |
| | | const goAdd = () => { |
| | | const data = encodeURIComponent( |
| | | JSON.stringify({ inspectionId: inspectionId.value }) |
| | | ); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/lineInspection/hazardEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | |
| | | const goEdit = row => { |
| | | const data = encodeURIComponent( |
| | | JSON.stringify({ inspectionId: inspectionId.value, row }) |
| | | ); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/lineInspection/hazardEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | |
| | | const goRectify = row => { |
| | | const data = encodeURIComponent(JSON.stringify({ row })); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/lineInspection/hazardRectify?data=${data}`, |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | uni.$on("lineInspection:hazardsRefresh", fetchHazards); |
| | | }); |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const obj = JSON.parse(decodeURIComponent(options.data)); |
| | | inspectionId.value = obj.inspectionId; |
| | | inspectionStatus.value = obj.inspectionStatus || ""; |
| | | } catch (e) {} |
| | | } |
| | | }); |
| | | |
| | | onShow(() => { |
| | | fetchHazards(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "../../../styles/sales-common.scss"; |
| | | |
| | | .hazard-list { |
| | | min-height: 100vh; |
| | | background: #f8f9fa; |
| | | padding-bottom: 40rpx; |
| | | } |
| | | |
| | | .top-actions { |
| | | padding: 20rpx; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .action-buttons { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | gap: 20rpx; |
| | | padding-bottom: 30rpx; |
| | | } |
| | | |
| | | .fixed-btn { |
| | | width: 160rpx; |
| | | margin: 0 !important; |
| | | } |
| | | |
| | | .no-data { |
| | | padding-top: 200rpx; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <PageHeader title="æ´æ¹" @back="goBack" /> |
| | | <up-form :model="form" label-width="110"> |
| | | <up-form-item label="æ´æ¹è¯´æ" required> |
| | | <up-textarea v-model="form.rectifyDesc" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | </up-form> |
| | | |
| | | <FooterButtons :loading="loading" confirmText="ä¿å" @cancel="goBack" @confirm="handleSubmit" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FooterButtons from "@/components/FooterButtons.vue"; |
| | | import { updateInspectionHazard } from "@/api/safeProduction/lineInspection"; |
| | | |
| | | const loading = ref(false); |
| | | const hazardId = ref(null); |
| | | |
| | | const form = ref({ |
| | | rectifyDesc: "", |
| | | }); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | const rectifyDesc = String(form.value.rectifyDesc || "").trim(); |
| | | if (!rectifyDesc) { |
| | | uni.showToast({ title: "请è¾å
¥æ´æ¹è¯´æ", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!hazardId.value) return; |
| | | |
| | | loading.value = true; |
| | | updateInspectionHazard({ id: hazardId.value, status: "å·²æ´æ¹", rectifyDesc }) |
| | | .then(() => { |
| | | uni.showToast({ title: "æ´æ¹æå", icon: "success" }); |
| | | uni.$emit("lineInspection:hazardsRefresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "æ´æ¹å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const obj = JSON.parse(decodeURIComponent(options.data)); |
| | | hazardId.value = obj?.row?.id; |
| | | } catch (e) {} |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/static/scss/form-common.scss"; |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="line-inspection"> |
| | | <PageHeader title="线路巡æ£" |
| | | @back="goBack" /> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | | <up-input class="search-text" |
| | | placeholder="请è¾å
¥å·¡æ£ç¼å·/å·¡æ£åç§°/线路åç§°" |
| | | v-model="keyword" |
| | | @change="handleQuery" |
| | | clearable /> |
| | | </view> |
| | | <view class="filter-button" |
| | | @click="handleQuery"> |
| | | <up-icon name="search" |
| | | size="24" |
| | | color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <scroll-view scroll-y |
| | | class="list-scroll ledger-list" |
| | | @scrolltolower="loadMore" |
| | | v-if="list.length > 0"> |
| | | <view v-for="row in list" |
| | | :key="row.id" |
| | | 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">{{ row.inspectionCode || "-" }}</text> |
| | | </view> |
| | | <view class="item-right"> |
| | | <up-tag :text="row.status || '-'" |
| | | :type="statusType(row.status)" |
| | | size="mini" /> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å·¡æ£åç§°</text> |
| | | <text class="detail-value">{{ row.inspectionName || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">线路åç§°</text> |
| | | <text class="detail-value">{{ row.lineName || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å·¡æ£ç±»å</text> |
| | | <text class="detail-value">{{ row.inspectionType || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">计åå·¡æ£æ¶é´</text> |
| | | <text class="detail-value">{{ row.planTime || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å·¡æ£äºº</text> |
| | | <text class="detail-value">{{ row.inspectorName || "-" }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="action-buttons action-buttons-bottom"> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | :disabled="!canEdit(row)" |
| | | @click.stop="goEdit(row)">ç¼è¾</u-button> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | type="primary" |
| | | @click.stop="goRecords(row)">å·¡æ£è®°å½</u-button> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | type="primary" |
| | | @click.stop="goHazards(row)">éæ£ç®¡ç</u-button> |
| | | <u-button v-if="String(row.status) === 'å·¡æ£ä¸'" |
| | | size="small" |
| | | class="action-btn fixed-btn" |
| | | type="success" |
| | | @click.stop="handleComplete(row)"> |
| | | å®æå·¡æ£ |
| | | </u-button> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | type="error" |
| | | :disabled="!canDelete(row)" |
| | | @click.stop="handleDelete(row)">å é¤</u-button> |
| | | </view> |
| | | </view> |
| | | <up-loadmore :status="loadStatus" /> |
| | | </scroll-view> |
| | | <view v-else |
| | | class="no-data"> |
| | | <up-empty mode="data" |
| | | text="ææ æ°æ®"></up-empty> |
| | | </view> |
| | | <view class="fab-button" |
| | | @click="goAdd"> |
| | | <up-icon name="plus" |
| | | size="24" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, reactive, ref } from "vue"; |
| | | import { onShow } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import { |
| | | completeLineInspection, |
| | | deleteLineInspection, |
| | | getLineInspectionList, |
| | | } from "@/api/safeProduction/lineInspection"; |
| | | |
| | | const keyword = ref(""); |
| | | |
| | | const page = reactive({ current: 1, size: 20, total: 0 }); |
| | | const list = ref([]); |
| | | const loadStatus = ref("loadmore"); |
| | | const loading = ref(false); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const statusType = status => { |
| | | const map = { |
| | | å¾
å·¡æ£: "info", |
| | | å·¡æ£ä¸: "warning", |
| | | 已宿: "success", |
| | | }; |
| | | return map[status] || "info"; |
| | | }; |
| | | |
| | | const canEdit = row => String(row?.status) === "å¾
å·¡æ£"; |
| | | const canDelete = row => String(row?.status) === "å¾
å·¡æ£"; |
| | | |
| | | const fetchList = () => { |
| | | if (loading.value) return; |
| | | loading.value = true; |
| | | loadStatus.value = "loading"; |
| | | const kw = String(keyword.value || "").trim(); |
| | | getLineInspectionList({ |
| | | inspectionCode: kw, |
| | | inspectionName: kw, |
| | | lineName: kw, |
| | | ...page, |
| | | }) |
| | | .then(res => { |
| | | const records = res?.data?.records || []; |
| | | const total = Number(res?.data?.total || 0); |
| | | page.total = total; |
| | | list.value = page.current === 1 ? records : [...list.value, ...records]; |
| | | loadStatus.value = |
| | | list.value.length >= page.total ? "nomore" : "loadmore"; |
| | | }) |
| | | .catch(() => { |
| | | loadStatus.value = "loadmore"; |
| | | uni.showToast({ title: "å 载失败", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | list.value = []; |
| | | fetchList(); |
| | | }; |
| | | |
| | | const loadMore = () => { |
| | | if (loadStatus.value !== "loadmore") return; |
| | | page.current++; |
| | | fetchList(); |
| | | }; |
| | | |
| | | const goAdd = () => { |
| | | uni.navigateTo({ url: "/pages/safeProduction/lineInspection/edit" }); |
| | | }; |
| | | |
| | | const goEdit = row => { |
| | | const data = encodeURIComponent(JSON.stringify(row || {})); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/lineInspection/edit?data=${data}`, |
| | | }); |
| | | }; |
| | | |
| | | const goRecords = row => { |
| | | const params = encodeURIComponent( |
| | | JSON.stringify({ inspectionId: row.id, inspectionStatus: row.status || "" }) |
| | | ); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/lineInspection/recordList?data=${params}`, |
| | | }); |
| | | }; |
| | | |
| | | const goHazards = row => { |
| | | const params = encodeURIComponent( |
| | | JSON.stringify({ inspectionId: row.id, inspectionStatus: row.status || "" }) |
| | | ); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/lineInspection/hazardList?data=${params}`, |
| | | }); |
| | | }; |
| | | |
| | | const handleDelete = row => { |
| | | if (!row?.id) return; |
| | | uni.showModal({ |
| | | title: "å é¤", |
| | | content: "确认å é¤è¯¥å·¡æ£ä»»å¡åï¼", |
| | | success: res => { |
| | | if (!res.confirm) return; |
| | | uni.showLoading({ title: "å é¤ä¸...", mask: true }); |
| | | deleteLineInspection([row.id]) |
| | | .then(() => { |
| | | uni.showToast({ title: "å 餿å", icon: "success" }); |
| | | handleQuery(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "å é¤å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | uni.hideLoading(); |
| | | }); |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | const handleComplete = row => { |
| | | if (!row?.id) return; |
| | | uni.showModal({ |
| | | title: "宿巡æ£", |
| | | content: "ç¡®è®¤å®æè¯¥å·¡æ£ä»»å¡åï¼", |
| | | success: res => { |
| | | if (!res.confirm) return; |
| | | uni.showLoading({ title: "æäº¤ä¸...", mask: true }); |
| | | completeLineInspection(row.id) |
| | | .then(() => { |
| | | uni.showToast({ title: "å·¡æ£å·²å®æ", icon: "success" }); |
| | | handleQuery(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "æä½å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | uni.hideLoading(); |
| | | }); |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | handleQuery(); |
| | | }); |
| | | |
| | | onShow(() => { |
| | | handleQuery(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "../../../styles/sales-common.scss"; |
| | | |
| | | .line-inspection { |
| | | min-height: 100vh; |
| | | background: #f8f9fa; |
| | | position: relative; |
| | | padding-bottom: 140rpx; |
| | | } |
| | | |
| | | .list-scroll { |
| | | flex: 1; |
| | | min-height: 0; |
| | | } |
| | | |
| | | .action-buttons { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | justify-content: flex-end; |
| | | gap: 20rpx; |
| | | padding-bottom: 30rpx; |
| | | } |
| | | |
| | | .fixed-btn { |
| | | width: 160rpx; |
| | | margin: 0 !important; |
| | | } |
| | | |
| | | .fab-button { |
| | | position: fixed; |
| | | right: 30rpx; |
| | | bottom: 140rpx; |
| | | width: 96rpx; |
| | | height: 96rpx; |
| | | background: #3c9cff; |
| | | border-radius: 48rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 8rpx 24rpx rgba(60, 156, 255, 0.3); |
| | | z-index: 1001; |
| | | } |
| | | |
| | | .no-data { |
| | | padding-top: 200rpx; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <PageHeader :title="pageTitle" @back="goBack" /> |
| | | <up-form :model="form" label-width="110"> |
| | | <up-form-item label="æ£æ¥ç¹" required> |
| | | <up-input v-model="form.checkPoint" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="æ£æ¥ç»æ" required> |
| | | <up-input :model-value="form.checkResult" placeholder="è¯·éæ©" readonly @click="showResultSheet = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showResultSheet = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="æ£æ¥å
容" required> |
| | | <up-textarea v-model="form.checkContent" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | <up-form-item label="æ£æ¥è¯´æ"> |
| | | <up-textarea v-model="form.checkDesc" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | <up-form-item label="æ£æ¥æ¶é´"> |
| | | <up-input :model-value="form.checkTime" placeholder="è¯·éæ©" readonly @click="showTimePicker = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showTimePicker = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | </up-form> |
| | | |
| | | <FooterButtons :loading="loading" confirmText="ä¿å" @cancel="goBack" @confirm="handleSubmit" /> |
| | | |
| | | <up-action-sheet |
| | | :show="showResultSheet" |
| | | title="éæ©æ£æ¥ç»æ" |
| | | :actions="resultActions" |
| | | @select="onSelectResult" |
| | | @close="showResultSheet = false" |
| | | /> |
| | | |
| | | <up-datetime-picker |
| | | :show="showTimePicker" |
| | | mode="datetime" |
| | | :value="checkTimeValue" |
| | | @confirm="onTimeConfirm" |
| | | @cancel="showTimePicker = false" |
| | | /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import dayjs from "dayjs"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FooterButtons from "@/components/FooterButtons.vue"; |
| | | import { addInspectionRecord, updateInspectionRecord } from "@/api/safeProduction/lineInspection"; |
| | | |
| | | const loading = ref(false); |
| | | const inspectionId = ref(null); |
| | | |
| | | const form = ref({ |
| | | id: null, |
| | | inspectionId: null, |
| | | checkPoint: "", |
| | | checkContent: "", |
| | | checkResult: "æ£å¸¸", |
| | | checkDesc: "", |
| | | checkTime: "", |
| | | }); |
| | | |
| | | const showResultSheet = ref(false); |
| | | const showTimePicker = ref(false); |
| | | |
| | | const resultActions = [ |
| | | { name: "æ£å¸¸", value: "æ£å¸¸" }, |
| | | { name: "å¼å¸¸", value: "å¼å¸¸" }, |
| | | ]; |
| | | |
| | | const pageTitle = computed(() => (form.value.id ? "ç¼è¾å·¡æ£è®°å½" : "æ°å¢å·¡æ£è®°å½")); |
| | | |
| | | const checkTimeValue = computed(() => { |
| | | if (!form.value.checkTime) return Date.now(); |
| | | const ts = dayjs(form.value.checkTime).valueOf(); |
| | | return Number.isFinite(ts) ? ts : Date.now(); |
| | | }); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const onSelectResult = action => { |
| | | form.value.checkResult = action.value; |
| | | showResultSheet.value = false; |
| | | }; |
| | | |
| | | const onTimeConfirm = e => { |
| | | const ts = e?.value; |
| | | form.value.checkTime = dayjs(ts).format("YYYY-MM-DD HH:mm:ss"); |
| | | showTimePicker.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | const checkPoint = String(form.value.checkPoint || "").trim(); |
| | | if (!checkPoint) { |
| | | uni.showToast({ title: "请è¾å
¥æ£æ¥ç¹", icon: "none" }); |
| | | return; |
| | | } |
| | | const checkContent = String(form.value.checkContent || "").trim(); |
| | | if (!checkContent) { |
| | | uni.showToast({ title: "请è¾å
¥æ£æ¥å
容", icon: "none" }); |
| | | return; |
| | | } |
| | | const checkResult = String(form.value.checkResult || "").trim(); |
| | | if (!checkResult) { |
| | | uni.showToast({ title: "è¯·éæ©æ£æ¥ç»æ", icon: "none" }); |
| | | return; |
| | | } |
| | | |
| | | const payload = { |
| | | ...form.value, |
| | | inspectionId: inspectionId.value, |
| | | checkPoint, |
| | | checkContent, |
| | | checkResult, |
| | | checkDesc: String(form.value.checkDesc || "").trim(), |
| | | checkTime: form.value.checkTime || "", |
| | | }; |
| | | |
| | | loading.value = true; |
| | | const api = payload.id ? updateInspectionRecord : addInspectionRecord; |
| | | api(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: "ä¿åæå", icon: "success" }); |
| | | uni.$emit("lineInspection:recordsRefresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "ä¿å失败", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const obj = JSON.parse(decodeURIComponent(options.data)); |
| | | inspectionId.value = obj.inspectionId; |
| | | if (obj?.row) { |
| | | form.value = { ...form.value, ...(obj.row || {}) }; |
| | | } |
| | | } catch (e) {} |
| | | } |
| | | if (!form.value.checkTime) form.value.checkTime = dayjs(Date.now()).format("YYYY-MM-DD HH:mm:ss"); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/static/scss/form-common.scss"; |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="record-list"> |
| | | <PageHeader title="å·¡æ£è®°å½" |
| | | @back="goBack" /> |
| | | <view class="top-actions"> |
| | | <u-button type="primary" |
| | | size="small" |
| | | :disabled="isCompleted" |
| | | @click="goAdd">æ°å¢è®°å½</u-button> |
| | | </view> |
| | | <scroll-view scroll-y |
| | | class="list-scroll ledger-list" |
| | | v-if="records.length > 0"> |
| | | <view v-for="row in records" |
| | | :key="row.id" |
| | | 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">{{ row.checkPoint || "-" }}</text> |
| | | </view> |
| | | <view class="item-right"> |
| | | <up-tag :text="row.checkResult || '-'" |
| | | :type="row.checkResult === 'æ£å¸¸' ? 'success' : 'error'" |
| | | size="mini" /> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">æ£æ¥å
容</text> |
| | | <text class="detail-value">{{ row.checkContent || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">æ£æ¥è¯´æ</text> |
| | | <text class="detail-value">{{ row.checkDesc || "-" }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">æ£æ¥æ¶é´</text> |
| | | <text class="detail-value">{{ row.checkTime || "-" }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="action-buttons"> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | :disabled="isCompleted" |
| | | @click.stop="goEdit(row)">ç¼è¾</u-button> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | type="error" |
| | | :disabled="isCompleted" |
| | | @click.stop="handleDelete(row)">å é¤</u-button> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | <view v-else |
| | | class="no-data"> |
| | | <up-empty mode="data" |
| | | text="ææ è®°å½"></up-empty> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, onMounted, ref } from "vue"; |
| | | import { onLoad, onShow } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import { |
| | | deleteInspectionRecord, |
| | | getInspectionRecords, |
| | | } from "@/api/safeProduction/lineInspection"; |
| | | |
| | | const inspectionId = ref(null); |
| | | const inspectionStatus = ref(""); |
| | | const records = ref([]); |
| | | |
| | | const isCompleted = computed(() => String(inspectionStatus.value) === "已宿"); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const fetchRecords = () => { |
| | | if (!inspectionId.value) return; |
| | | uni.showLoading({ title: "å è½½ä¸...", mask: true }); |
| | | getInspectionRecords(inspectionId.value) |
| | | .then(res => { |
| | | records.value = res?.data || []; |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "å 载失败", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | uni.hideLoading(); |
| | | }); |
| | | }; |
| | | |
| | | const goAdd = () => { |
| | | const data = encodeURIComponent( |
| | | JSON.stringify({ inspectionId: inspectionId.value }) |
| | | ); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/lineInspection/recordEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | |
| | | const goEdit = row => { |
| | | const data = encodeURIComponent( |
| | | JSON.stringify({ inspectionId: inspectionId.value, row }) |
| | | ); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/lineInspection/recordEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | |
| | | const handleDelete = row => { |
| | | if (!row?.id) return; |
| | | uni.showModal({ |
| | | title: "å é¤", |
| | | content: "确认å é¤è¯¥å·¡æ£è®°å½åï¼", |
| | | success: res => { |
| | | if (!res.confirm) return; |
| | | uni.showLoading({ title: "å é¤ä¸...", mask: true }); |
| | | deleteInspectionRecord([row.id]) |
| | | .then(() => { |
| | | uni.showToast({ title: "å 餿å", icon: "success" }); |
| | | fetchRecords(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "å é¤å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | uni.hideLoading(); |
| | | }); |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | uni.$on("lineInspection:recordsRefresh", fetchRecords); |
| | | }); |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const obj = JSON.parse(decodeURIComponent(options.data)); |
| | | inspectionId.value = obj.inspectionId; |
| | | inspectionStatus.value = obj.inspectionStatus || ""; |
| | | } catch (e) {} |
| | | } |
| | | }); |
| | | |
| | | onShow(() => { |
| | | fetchRecords(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "../../../styles/sales-common.scss"; |
| | | |
| | | .record-list { |
| | | min-height: 100vh; |
| | | background: #f8f9fa; |
| | | padding-bottom: 40rpx; |
| | | } |
| | | |
| | | .top-actions { |
| | | padding: 20rpx; |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .list-scroll { |
| | | flex: 1; |
| | | min-height: 0; |
| | | } |
| | | |
| | | .action-buttons { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | gap: 20rpx; |
| | | padding-bottom: 30rpx; |
| | | } |
| | | |
| | | .fixed-btn { |
| | | width: 160rpx; |
| | | margin: 0 !important; |
| | | } |
| | | |
| | | .no-data { |
| | | padding-top: 200rpx; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="safety-facility"> |
| | | <PageHeader title="å®å
¨è®¾æ½å·¡æ£" |
| | | @back="goBack" /> |
| | | <view class="tabs-section"> |
| | | <up-tabs v-model="activeTabIndex" |
| | | :list="tabList" |
| | | itemStyle="width: 33.33%;height: 80rpx;" |
| | | @change="onTabChange" /> |
| | | </view> |
| | | <view class="search-section"> |
| | | <view class="search-bar"> |
| | | <view class="search-input"> |
| | | <up-input class="search-text" |
| | | v-model="keyword" |
| | | :placeholder="searchPlaceholder" |
| | | @change="handleSearch" |
| | | clearable /> |
| | | </view> |
| | | <view class="filter-button" |
| | | @click="handleSearch"> |
| | | <up-icon name="search" |
| | | size="24" |
| | | color="#999"></up-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <scroll-view scroll-y |
| | | class="list-scroll ledger-list" |
| | | @scrolltolower="loadMore" |
| | | v-if="list.length > 0"> |
| | | <view v-for="row in list" |
| | | :key="row.id" |
| | | class="ledger-item"> |
| | | <view class="item-header" |
| | | @click="handleInspectionInfoClick(row)"> |
| | | <view class="item-left"> |
| | | <view class="document-icon"> |
| | | <up-icon name="setting-fill" |
| | | size="16" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | <text class="item-id">{{ getCardTitle(row) }}</text> |
| | | </view> |
| | | <view class="item-right"> |
| | | <text v-if="activeTab === 'ledger'" |
| | | class="item-index">{{ row.facilityCode || "-" }}</text> |
| | | <up-tag v-else |
| | | :text="row.status || '-'" |
| | | :type="activeTab === 'inspection' ? (row.status === 'å¾
å·¡æ£' ? 'info' : 'success') : rectStatusType(row.status)" |
| | | size="mini" /> |
| | | </view> |
| | | </view> |
| | | <up-divider></up-divider> |
| | | <view class="item-details" |
| | | @click="handleInspectionInfoClick(row)"> |
| | | <template v-if="activeTab === 'ledger'"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">设æ½ç±»å</text> |
| | | <text class="detail-value">{{ row.facilityType || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">è§æ ¼åå·</text> |
| | | <text class="detail-value">{{ row.facilitySpec || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å®è£
ä½ç½®</text> |
| | | <text class="detail-value">{{ row.installLocation || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å®è£
æ¶é´</text> |
| | | <text class="detail-value">{{ row.installTime || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">䏿¬¡æ£æ¥æ¶é´</text> |
| | | <text class="detail-value">{{ row.nextCheckTime || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">ç¶æ</text> |
| | | <up-tag :text="row.status || '-'" |
| | | :type="facilityStatusType(row.status)" |
| | | size="mini" /> |
| | | </view> |
| | | </template> |
| | | <template v-else-if="activeTab === 'inspection'"> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">设æ½åç§°</text> |
| | | <text class="detail-value">{{ row.facilityName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">设æ½ç¼å·</text> |
| | | <text class="detail-value">{{ row.facilityCode || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">å·¡æ£ç±»å</text> |
| | | <text class="detail-value">{{ row.inspectionType || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">计åå·¡æ£æ¶é´</text> |
| | | <text class="detail-value">{{ row.planTime || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">æ£æ¥ç»æ</text> |
| | | <text class="detail-value">{{ row.checkResult || '-' }}</text> |
| | | </view> |
| | | </template> |
| | | <template v-else> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">设æ½åç§°</text> |
| | | <text class="detail-value">{{ row.facilityName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">é®é¢æè¿°</text> |
| | | <text class="detail-value">{{ row.problemDesc || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">é®é¢ç级</text> |
| | | <text class="detail-value">{{ row.problemLevel || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">æ´æ¹è´£ä»»äºº</text> |
| | | <text class="detail-value">{{ row.rectifyUserName || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">è®¡åæ´æ¹æ¶é´</text> |
| | | <text class="detail-value">{{ row.planTime || '-' }}</text> |
| | | </view> |
| | | <view class="detail-row"> |
| | | <text class="detail-label">éªæ¶äºº</text> |
| | | <text class="detail-value">{{ row.verifyUserName || '-' }}</text> |
| | | </view> |
| | | </template> |
| | | </view> |
| | | <view class="action-buttons"> |
| | | <template v-if="activeTab === 'ledger'"> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | @click.stop="goLedgerEdit(row)">ç¼è¾</u-button> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | type="primary" |
| | | @click.stop="goInspectionAdd(row)">åèµ·å·¡æ£</u-button> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | type="error" |
| | | @click.stop="deleteLedger(row)">å é¤</u-button> |
| | | </template> |
| | | <template v-else-if="activeTab === 'inspection'"> |
| | | <u-button v-if="String(row.status) === 'å¾
å·¡æ£'" |
| | | size="small" |
| | | class="action-btn fixed-btn" |
| | | type="primary" |
| | | @click.stop="goInspectionDo(row)">å·¡æ£</u-button> |
| | | <u-button v-if="String(row.checkResult) === 'å¼å¸¸'" |
| | | size="small" |
| | | class="action-btn fixed-btn" |
| | | type="success" |
| | | @click.stop="goRectificationAdd(row)">æ´æ¹</u-button> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | type="error" |
| | | :disabled="String(row.status) !== 'å¾
å·¡æ£'" |
| | | @click.stop="deleteInspection(row)">å é¤</u-button> |
| | | </template> |
| | | <template v-else> |
| | | <u-button v-if="String(row.status) === 'å¾
æ´æ¹' || String(row.status) === 'æ´æ¹ä¸'" |
| | | size="small" |
| | | class="action-btn fixed-btn" |
| | | type="success" |
| | | @click.stop="goRectificationDo(row)">æ´æ¹</u-button> |
| | | <u-button v-if="String(row.status) === 'å·²æ´æ¹'" |
| | | size="small" |
| | | class="action-btn fixed-btn" |
| | | type="primary" |
| | | @click.stop="goRectificationVerify(row)">éªæ¶</u-button> |
| | | <u-button size="small" |
| | | class="action-btn fixed-btn" |
| | | @click.stop="goRectificationView(row)">æ¥ç</u-button> |
| | | </template> |
| | | </view> |
| | | </view> |
| | | <up-loadmore :status="loadStatus" /> |
| | | </scroll-view> |
| | | <view v-else |
| | | class="no-data"> |
| | | <up-empty mode="data" |
| | | text="ææ æ°æ®"></up-empty> |
| | | </view> |
| | | <view v-if="activeTab === 'ledger'" |
| | | class="fab-button" |
| | | @click="goLedgerAdd"> |
| | | <up-icon name="plus" |
| | | size="24" |
| | | color="#ffffff"></up-icon> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, onMounted, reactive, ref } from "vue"; |
| | | import { onShow } from "@dcloudio/uni-app"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import { |
| | | deleteFacilityInspection, |
| | | deleteFacilityLedger, |
| | | getFacilityInspectionList, |
| | | getFacilityLedgerList, |
| | | getFacilityRectificationList, |
| | | } from "@/api/safeProduction/safetyFacility"; |
| | | |
| | | const tabList = reactive([ |
| | | { name: "设æ½å°è´¦", value: "ledger" }, |
| | | { name: "设æ½å·¡æ£", value: "inspection" }, |
| | | { name: "æ´æ¹è·è¸ª", value: "rectification" }, |
| | | ]); |
| | | |
| | | const activeTabIndex = ref(0); |
| | | const activeTab = computed( |
| | | () => tabList[activeTabIndex.value]?.value || "ledger" |
| | | ); |
| | | |
| | | const keyword = ref(""); |
| | | |
| | | const page = reactive({ current: 1, size: 10, total: 0 }); |
| | | const list = ref([]); |
| | | const loadStatus = ref("loadmore"); |
| | | const loading = ref(false); |
| | | |
| | | const searchPlaceholder = computed(() => { |
| | | if (activeTab.value === "ledger") return "设æ½ç¼å·/设æ½åç§°"; |
| | | if (activeTab.value === "inspection") return "å·¡æ£ç¼å·"; |
| | | return "ç¶æï¼å¾
æ´æ¹/æ´æ¹ä¸/å·²æ´æ¹/å·²éªæ¶ï¼"; |
| | | }); |
| | | |
| | | const facilityStatusType = status => { |
| | | const map = { æ£å¸¸: "success", å¼å¸¸: "error", æ¥åº: "info" }; |
| | | return map[status] || "info"; |
| | | }; |
| | | const rectStatusType = status => { |
| | | const map = { |
| | | å¾
æ´æ¹: "error", |
| | | æ´æ¹ä¸: "warning", |
| | | å·²æ´æ¹: "success", |
| | | å·²éªæ¶: "info", |
| | | }; |
| | | return map[status] || "info"; |
| | | }; |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const getCardTitle = row => { |
| | | if (activeTab.value === "ledger") return row.facilityName || "-"; |
| | | if (activeTab.value === "inspection") return row.inspectionCode || "-"; |
| | | return row.facilityName || "-"; |
| | | }; |
| | | |
| | | const handleInspectionInfoClick = row => { |
| | | if (activeTab.value !== "inspection") return; |
| | | if (String(row?.status) === "å¾
å·¡æ£") return; |
| | | goInspectionView(row); |
| | | }; |
| | | |
| | | const resetAndQuery = () => { |
| | | page.current = 1; |
| | | page.total = 0; |
| | | list.value = []; |
| | | loadStatus.value = "loadmore"; |
| | | fetchList(); |
| | | }; |
| | | |
| | | const fetchList = () => { |
| | | if (loading.value) return; |
| | | loading.value = true; |
| | | loadStatus.value = "loading"; |
| | | |
| | | const reqPage = { current: page.current, size: page.size }; |
| | | let req; |
| | | const kw = String(keyword.value || "").trim(); |
| | | if (activeTab.value === "ledger") { |
| | | req = getFacilityLedgerList({ |
| | | facilityCode: kw, |
| | | facilityName: kw, |
| | | ...reqPage, |
| | | }); |
| | | } else if (activeTab.value === "inspection") { |
| | | req = getFacilityInspectionList({ inspectionCode: kw, ...reqPage }); |
| | | } else { |
| | | req = getFacilityRectificationList({ status: kw, ...reqPage }); |
| | | } |
| | | |
| | | req |
| | | .then(res => { |
| | | const records = res?.data?.records || []; |
| | | const total = Number(res?.data?.total || 0); |
| | | page.total = total; |
| | | list.value = page.current === 1 ? records : [...list.value, ...records]; |
| | | loadStatus.value = |
| | | list.value.length >= page.total ? "nomore" : "loadmore"; |
| | | }) |
| | | .catch(() => { |
| | | loadStatus.value = "loadmore"; |
| | | uni.showToast({ title: "å 载失败", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const handleSearch = () => { |
| | | resetAndQuery(); |
| | | }; |
| | | |
| | | const loadMore = () => { |
| | | if (loadStatus.value !== "loadmore") return; |
| | | page.current++; |
| | | fetchList(); |
| | | }; |
| | | |
| | | const onTabChange = val => { |
| | | activeTabIndex.value = val.index; |
| | | resetAndQuery(); |
| | | }; |
| | | |
| | | const goLedgerAdd = () => { |
| | | uni.navigateTo({ url: "/pages/safeProduction/safetyFacility/ledgerEdit" }); |
| | | }; |
| | | const goLedgerEdit = row => { |
| | | const data = encodeURIComponent(JSON.stringify(row || {})); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/safetyFacility/ledgerEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | const goInspectionAdd = row => { |
| | | const data = encodeURIComponent( |
| | | JSON.stringify({ mode: "add", facility: row }) |
| | | ); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/safetyFacility/inspectionEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | const goInspectionDo = row => { |
| | | const data = encodeURIComponent(JSON.stringify({ mode: "do", row })); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/safetyFacility/inspectionEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | const goInspectionView = row => { |
| | | const data = encodeURIComponent(JSON.stringify({ mode: "view", row })); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/safetyFacility/inspectionEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | const goRectificationAdd = row => { |
| | | const data = encodeURIComponent( |
| | | JSON.stringify({ mode: "add", inspection: row }) |
| | | ); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/safetyFacility/rectificationEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | const goRectificationDo = row => { |
| | | const data = encodeURIComponent(JSON.stringify({ mode: "do", row })); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/safetyFacility/rectificationEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | const goRectificationVerify = row => { |
| | | const data = encodeURIComponent(JSON.stringify({ mode: "verify", row })); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/safetyFacility/rectificationEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | const goRectificationView = row => { |
| | | const data = encodeURIComponent(JSON.stringify({ mode: "view", row })); |
| | | uni.navigateTo({ |
| | | url: `/pages/safeProduction/safetyFacility/rectificationEdit?data=${data}`, |
| | | }); |
| | | }; |
| | | |
| | | const deleteLedger = row => { |
| | | if (!row?.id) return; |
| | | uni.showModal({ |
| | | title: "å é¤", |
| | | content: "确认å é¤è¯¥è®¾æ½åï¼", |
| | | success: res => { |
| | | if (!res.confirm) return; |
| | | uni.showLoading({ title: "å é¤ä¸...", mask: true }); |
| | | deleteFacilityLedger([row.id]) |
| | | .then(() => { |
| | | uni.showToast({ title: "å 餿å", icon: "success" }); |
| | | resetAndQuery(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "å é¤å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | uni.hideLoading(); |
| | | }); |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | const deleteInspection = row => { |
| | | if (!row?.id) return; |
| | | if (String(row.status) !== "å¾
å·¡æ£") return; |
| | | uni.showModal({ |
| | | title: "å é¤", |
| | | content: "确认å é¤è¯¥å·¡æ£è®°å½åï¼", |
| | | success: res => { |
| | | if (!res.confirm) return; |
| | | uni.showLoading({ title: "å é¤ä¸...", mask: true }); |
| | | deleteFacilityInspection([row.id]) |
| | | .then(() => { |
| | | uni.showToast({ title: "å 餿å", icon: "success" }); |
| | | resetAndQuery(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "å é¤å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | uni.hideLoading(); |
| | | }); |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | uni.$on("safetyFacility:refresh", resetAndQuery); |
| | | }); |
| | | |
| | | onShow(() => { |
| | | resetAndQuery(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "../../../styles/sales-common.scss"; |
| | | |
| | | .safety-facility { |
| | | min-height: 100vh; |
| | | background: #f8f9fa; |
| | | position: relative; |
| | | padding-bottom: 140rpx; |
| | | } |
| | | |
| | | .tabs-section { |
| | | background: #fff; |
| | | } |
| | | |
| | | .list-scroll { |
| | | flex: 1; |
| | | min-height: 0; |
| | | } |
| | | |
| | | .action-buttons { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | justify-content: flex-end; |
| | | gap: 20rpx; |
| | | padding-bottom: 30rpx; |
| | | } |
| | | |
| | | .fixed-btn { |
| | | width: 160rpx; |
| | | margin: 0 !important; |
| | | } |
| | | |
| | | .fab-button { |
| | | position: fixed; |
| | | right: 30rpx; |
| | | bottom: 140rpx; |
| | | width: 96rpx; |
| | | height: 96rpx; |
| | | background: #3c9cff; |
| | | border-radius: 48rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 8rpx 24rpx rgba(60, 156, 255, 0.3); |
| | | z-index: 1001; |
| | | } |
| | | |
| | | .no-data { |
| | | padding-top: 200rpx; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <PageHeader :title="pageTitle" |
| | | @back="goBack" /> |
| | | <up-form :model="form" |
| | | label-width="110"> |
| | | <up-form-item label="设æ½åç§°"> |
| | | <up-input :model-value="facilityName" |
| | | disabled |
| | | placeholder="èªå¨å¸¦åº" /> |
| | | </up-form-item> |
| | | <up-form-item label="设æ½ç¼å·"> |
| | | <up-input :model-value="facilityCode" |
| | | disabled |
| | | placeholder="èªå¨å¸¦åº" /> |
| | | </up-form-item> |
| | | <up-form-item label="å·¡æ£ç¼å·" |
| | | required> |
| | | <up-input v-model="form.inspectionCode" |
| | | :disabled="isView" |
| | | placeholder="请è¾å
¥" |
| | | clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="å·¡æ£ç±»å"> |
| | | <up-input :model-value="form.inspectionType" |
| | | placeholder="è¯·éæ©" |
| | | readonly |
| | | :disabled="isView" |
| | | @click="openTypeSheet" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" |
| | | @click="openTypeSheet"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="计åå·¡æ£æ¶é´"> |
| | | <up-input :model-value="form.planTime" |
| | | placeholder="è¯·éæ©" |
| | | readonly |
| | | :disabled="isView" |
| | | @click="openPlanPicker" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" |
| | | @click="openPlanPicker"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <template v-if="mode === 'do' || mode === 'view'"> |
| | | <up-form-item label="å®é
å·¡æ£æ¶é´"> |
| | | <up-input :model-value="form.actualTime" |
| | | disabled |
| | | placeholder="èªå¨å¡«å
" /> |
| | | </up-form-item> |
| | | <up-form-item label="æ£æ¥ç»æ" |
| | | :required="mode === 'do'"> |
| | | <up-input :model-value="form.checkResult" |
| | | placeholder="è¯·éæ©" |
| | | readonly |
| | | :disabled="isView" |
| | | @click="openResultSheet" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" |
| | | @click="openResultSheet"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="æ£æ¥è¯´æ"> |
| | | <up-textarea v-model="form.checkDesc" |
| | | :disabled="isView" |
| | | placeholder="请è¾å
¥" |
| | | auto-height /> |
| | | </up-form-item> |
| | | </template> |
| | | </up-form> |
| | | <FooterButtons :loading="loading" |
| | | :confirmText="isView ? 'è¿å' : 'ä¿å'" |
| | | @cancel="goBack" |
| | | @confirm="handleSubmit" /> |
| | | <up-action-sheet :show="showTypeSheet" |
| | | title="鿩巡æ£ç±»å" |
| | | :actions="typeActions" |
| | | @select="onSelectType" |
| | | @close="showTypeSheet = false" /> |
| | | <up-action-sheet :show="showResultSheet" |
| | | title="éæ©æ£æ¥ç»æ" |
| | | :actions="resultActions" |
| | | @select="onSelectResult" |
| | | @close="showResultSheet = false" /> |
| | | <up-datetime-picker :show="showPlanPicker" |
| | | mode="datetime" |
| | | :value="planValue" |
| | | @confirm="onPlanConfirm" |
| | | @cancel="showPlanPicker = false" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import dayjs from "dayjs"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FooterButtons from "@/components/FooterButtons.vue"; |
| | | import { |
| | | addFacilityInspection, |
| | | updateFacilityInspection, |
| | | } from "@/api/safeProduction/safetyFacility"; |
| | | |
| | | const loading = ref(false); |
| | | const mode = ref("add"); |
| | | |
| | | const facilityName = ref(""); |
| | | const facilityCode = ref(""); |
| | | |
| | | const form = ref({ |
| | | id: null, |
| | | facilityId: null, |
| | | inspectionCode: "", |
| | | inspectionType: "宿巡æ£", |
| | | planTime: "", |
| | | checkResult: "", |
| | | checkDesc: "", |
| | | actualTime: "", |
| | | status: "", |
| | | }); |
| | | |
| | | const showTypeSheet = ref(false); |
| | | const showResultSheet = ref(false); |
| | | const showPlanPicker = ref(false); |
| | | |
| | | const typeActions = [ |
| | | { name: "宿巡æ£", value: "宿巡æ£" }, |
| | | { name: "临æ¶å·¡æ£", value: "临æ¶å·¡æ£" }, |
| | | ]; |
| | | const resultActions = [ |
| | | { name: "æ£å¸¸", value: "æ£å¸¸" }, |
| | | { name: "å¼å¸¸", value: "å¼å¸¸" }, |
| | | ]; |
| | | |
| | | const isView = computed(() => mode.value === "view"); |
| | | |
| | | const pageTitle = computed(() => { |
| | | if (mode.value === "add") return "åèµ·å·¡æ£"; |
| | | if (mode.value === "do") return "å·¡æ£"; |
| | | return "æ¥çå·¡æ£"; |
| | | }); |
| | | |
| | | const planValue = computed(() => { |
| | | if (!form.value.planTime) return Date.now(); |
| | | const ts = dayjs(form.value.planTime).valueOf(); |
| | | return Number.isFinite(ts) ? ts : Date.now(); |
| | | }); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const openTypeSheet = () => { |
| | | if (isView.value) return; |
| | | showTypeSheet.value = true; |
| | | }; |
| | | |
| | | const openPlanPicker = () => { |
| | | if (isView.value) return; |
| | | showPlanPicker.value = true; |
| | | }; |
| | | |
| | | const openResultSheet = () => { |
| | | if (isView.value) return; |
| | | showResultSheet.value = true; |
| | | }; |
| | | |
| | | const onSelectType = action => { |
| | | if (isView.value) return; |
| | | form.value.inspectionType = action.value; |
| | | showTypeSheet.value = false; |
| | | }; |
| | | |
| | | const onSelectResult = action => { |
| | | if (isView.value) return; |
| | | form.value.checkResult = action.value; |
| | | showResultSheet.value = false; |
| | | }; |
| | | |
| | | const onPlanConfirm = e => { |
| | | if (isView.value) return; |
| | | form.value.planTime = dayjs(e?.value).format("YYYY-MM-DD HH:mm:ss"); |
| | | showPlanPicker.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | if (isView.value) { |
| | | goBack(); |
| | | return; |
| | | } |
| | | |
| | | const inspectionCode = String(form.value.inspectionCode || "").trim(); |
| | | if (!inspectionCode) { |
| | | uni.showToast({ title: "请è¾å
¥å·¡æ£ç¼å·", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!form.value.facilityId) { |
| | | uni.showToast({ title: "缺å°è®¾æ½ä¿¡æ¯", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!form.value.planTime) { |
| | | uni.showToast({ title: "è¯·éæ©è®¡åå·¡æ£æ¶é´", icon: "none" }); |
| | | return; |
| | | } |
| | | if (mode.value === "do") { |
| | | const checkResult = String(form.value.checkResult || "").trim(); |
| | | if (!checkResult) { |
| | | uni.showToast({ title: "è¯·éæ©æ£æ¥ç»æ", icon: "none" }); |
| | | return; |
| | | } |
| | | form.value.status = "已巡æ£"; |
| | | form.value.actualTime = dayjs(Date.now()).format("YYYY-MM-DD HH:mm:ss"); |
| | | } |
| | | |
| | | const payload = { |
| | | ...form.value, |
| | | inspectionCode, |
| | | checkDesc: String(form.value.checkDesc || "").trim(), |
| | | }; |
| | | |
| | | loading.value = true; |
| | | const api = payload.id ? updateFacilityInspection : addFacilityInspection; |
| | | api(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: "æä½æå", icon: "success" }); |
| | | uni.$emit("safetyFacility:refresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "æä½å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const obj = JSON.parse(decodeURIComponent(options.data)); |
| | | mode.value = obj.mode || "add"; |
| | | if (obj.facility) { |
| | | const f = obj.facility; |
| | | form.value.facilityId = f.id; |
| | | facilityName.value = f.facilityName || ""; |
| | | facilityCode.value = f.facilityCode || ""; |
| | | } |
| | | if (obj.row) { |
| | | const r = obj.row; |
| | | form.value = { ...form.value, ...(r || {}) }; |
| | | facilityName.value = r.facilityName || facilityName.value; |
| | | facilityCode.value = r.facilityCode || facilityCode.value; |
| | | } |
| | | } catch (e) {} |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/static/scss/form-common.scss"; |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <PageHeader :title="pageTitle" @back="goBack" /> |
| | | <up-form :model="form" label-width="110"> |
| | | <up-form-item label="设æ½ç¼å·" required> |
| | | <up-input v-model="form.facilityCode" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="设æ½åç§°" required> |
| | | <up-input v-model="form.facilityName" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="设æ½ç±»å" required> |
| | | <up-input :model-value="form.facilityType" placeholder="è¯·éæ©" readonly @click="showTypeSheet = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showTypeSheet = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="è§æ ¼åå·"> |
| | | <up-input v-model="form.facilitySpec" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="å®è£
ä½ç½®" required> |
| | | <up-input v-model="form.installLocation" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="å®è£
æ¶é´"> |
| | | <up-input :model-value="form.installTime" placeholder="è¯·éæ©" readonly @click="showInstallPicker = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showInstallPicker = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="çäº§æ¥æ"> |
| | | <up-input :model-value="form.productionDate" placeholder="è¯·éæ©" readonly @click="showProductionPicker = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showProductionPicker = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="æææ(天)"> |
| | | <up-input v-model="form.validPeriod" type="number" placeholder="请è¾å
¥" clearable /> |
| | | </up-form-item> |
| | | <up-form-item label="䏿¬¡æ£æ¥æ¶é´"> |
| | | <up-input :model-value="nextCheckTime" placeholder="æ ¹æ®å®è£
æ¶é´+æææèªå¨è®¡ç®" disabled /> |
| | | </up-form-item> |
| | | <up-form-item label="ç¶æ"> |
| | | <up-input :model-value="form.status" placeholder="è¯·éæ©" readonly @click="showStatusSheet = true" /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="showStatusSheet = true"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="夿³¨"> |
| | | <up-textarea v-model="form.remark" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | </up-form> |
| | | |
| | | <FooterButtons :loading="loading" confirmText="ä¿å" @cancel="goBack" @confirm="handleSubmit" /> |
| | | |
| | | <up-action-sheet :show="showTypeSheet" title="éæ©è®¾æ½ç±»å" :actions="typeActions" @select="onSelectType" @close="showTypeSheet = false" /> |
| | | <up-action-sheet :show="showStatusSheet" title="éæ©ç¶æ" :actions="statusActions" @select="onSelectStatus" @close="showStatusSheet = false" /> |
| | | |
| | | <up-datetime-picker :show="showInstallPicker" mode="date" :value="installValue" @confirm="onInstallConfirm" @cancel="showInstallPicker = false" /> |
| | | <up-datetime-picker :show="showProductionPicker" mode="date" :value="productionValue" @confirm="onProductionConfirm" @cancel="showProductionPicker = false" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import dayjs from "dayjs"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FooterButtons from "@/components/FooterButtons.vue"; |
| | | import { addFacilityLedger, updateFacilityLedger } from "@/api/safeProduction/safetyFacility"; |
| | | |
| | | const loading = ref(false); |
| | | |
| | | const form = ref({ |
| | | id: null, |
| | | facilityCode: "", |
| | | facilityName: "", |
| | | facilityType: "", |
| | | facilitySpec: "", |
| | | installLocation: "", |
| | | installTime: "", |
| | | productionDate: "", |
| | | validPeriod: "", |
| | | nextCheckTime: "", |
| | | status: "æ£å¸¸", |
| | | remark: "", |
| | | }); |
| | | |
| | | const showTypeSheet = ref(false); |
| | | const showStatusSheet = ref(false); |
| | | const showInstallPicker = ref(false); |
| | | const showProductionPicker = ref(false); |
| | | |
| | | const typeActions = [ |
| | | { name: "æ¶é²å¨æ", value: "æ¶é²å¨æ" }, |
| | | { name: "å®å
¨è®¾å¤", value: "å®å
¨è®¾å¤" }, |
| | | { name: "鲿¤ç¨å", value: "鲿¤ç¨å" }, |
| | | { name: "çæ§è®¾å¤", value: "çæ§è®¾å¤" }, |
| | | ]; |
| | | const statusActions = [ |
| | | { name: "æ£å¸¸", value: "æ£å¸¸" }, |
| | | { name: "å¼å¸¸", value: "å¼å¸¸" }, |
| | | { name: "æ¥åº", value: "æ¥åº" }, |
| | | ]; |
| | | |
| | | const pageTitle = computed(() => (form.value.id ? "ç¼è¾è®¾æ½" : "æ°å¢è®¾æ½")); |
| | | |
| | | const nextCheckTime = computed(() => { |
| | | const installTime = form.value.installTime; |
| | | const validPeriod = Number(form.value.validPeriod); |
| | | if (!installTime || !Number.isFinite(validPeriod) || validPeriod <= 0) return ""; |
| | | const d = dayjs(installTime); |
| | | if (!d.isValid()) return ""; |
| | | return d.add(validPeriod, "day").format("YYYY-MM-DD"); |
| | | }); |
| | | |
| | | const installValue = computed(() => { |
| | | if (!form.value.installTime) return Date.now(); |
| | | const ts = dayjs(form.value.installTime).valueOf(); |
| | | return Number.isFinite(ts) ? ts : Date.now(); |
| | | }); |
| | | const productionValue = computed(() => { |
| | | if (!form.value.productionDate) return Date.now(); |
| | | const ts = dayjs(form.value.productionDate).valueOf(); |
| | | return Number.isFinite(ts) ? ts : Date.now(); |
| | | }); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const onSelectType = action => { |
| | | form.value.facilityType = action.value; |
| | | showTypeSheet.value = false; |
| | | }; |
| | | const onSelectStatus = action => { |
| | | form.value.status = action.value; |
| | | showStatusSheet.value = false; |
| | | }; |
| | | |
| | | const onInstallConfirm = e => { |
| | | form.value.installTime = dayjs(e?.value).format("YYYY-MM-DD"); |
| | | showInstallPicker.value = false; |
| | | }; |
| | | const onProductionConfirm = e => { |
| | | form.value.productionDate = dayjs(e?.value).format("YYYY-MM-DD"); |
| | | showProductionPicker.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | const facilityCode = String(form.value.facilityCode || "").trim(); |
| | | if (!facilityCode) { |
| | | uni.showToast({ title: "请è¾å
¥è®¾æ½ç¼å·", icon: "none" }); |
| | | return; |
| | | } |
| | | const facilityName = String(form.value.facilityName || "").trim(); |
| | | if (!facilityName) { |
| | | uni.showToast({ title: "请è¾å
¥è®¾æ½åç§°", icon: "none" }); |
| | | return; |
| | | } |
| | | const facilityType = String(form.value.facilityType || "").trim(); |
| | | if (!facilityType) { |
| | | uni.showToast({ title: "è¯·éæ©è®¾æ½ç±»å", icon: "none" }); |
| | | return; |
| | | } |
| | | const installLocation = String(form.value.installLocation || "").trim(); |
| | | if (!installLocation) { |
| | | uni.showToast({ title: "请è¾å
¥å®è£
ä½ç½®", icon: "none" }); |
| | | return; |
| | | } |
| | | |
| | | const payload = { |
| | | ...form.value, |
| | | facilityCode, |
| | | facilityName, |
| | | facilityType, |
| | | facilitySpec: String(form.value.facilitySpec || "").trim(), |
| | | installLocation, |
| | | validPeriod: form.value.validPeriod === "" ? null : Number(form.value.validPeriod), |
| | | nextCheckTime: nextCheckTime.value || null, |
| | | remark: String(form.value.remark || "").trim(), |
| | | }; |
| | | |
| | | loading.value = true; |
| | | const api = payload.id ? updateFacilityLedger : addFacilityLedger; |
| | | api(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: "ä¿åæå", icon: "success" }); |
| | | uni.$emit("safetyFacility:refresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "ä¿å失败", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const row = JSON.parse(decodeURIComponent(options.data)); |
| | | form.value = { ...form.value, ...(row || {}) }; |
| | | } catch (e) {} |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/static/scss/form-common.scss"; |
| | | </style> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="account-detail"> |
| | | <PageHeader :title="pageTitle" @back="goBack" /> |
| | | <up-form :model="form" label-width="110"> |
| | | <up-form-item label="设æ½åç§°"> |
| | | <up-input :model-value="facilityName" disabled placeholder="èªå¨å¸¦åº" /> |
| | | </up-form-item> |
| | | |
| | | <template v-if="mode !== 'verify'"> |
| | | <up-form-item label="é®é¢æè¿°" :required="mode === 'add'"> |
| | | <up-textarea v-model="form.problemDesc" :disabled="isReadOnlyProblem" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | <up-form-item label="é®é¢ç级" :required="mode === 'add'"> |
| | | <up-input |
| | | :model-value="form.problemLevel" |
| | | placeholder="è¯·éæ©" |
| | | readonly |
| | | :disabled="isReadOnlyProblem" |
| | | @click="openLevelSheet" |
| | | /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="openLevelSheet"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | <up-form-item label="è®¡åæ´æ¹æ¶é´" :required="mode === 'add'"> |
| | | <up-input |
| | | :model-value="form.planTime" |
| | | placeholder="è¯·éæ©" |
| | | readonly |
| | | :disabled="isReadOnlyProblem" |
| | | @click="openPlanPicker" |
| | | /> |
| | | <template #right> |
| | | <up-icon name="arrow-right" @click="openPlanPicker"></up-icon> |
| | | </template> |
| | | </up-form-item> |
| | | </template> |
| | | |
| | | <up-form-item v-if="mode === 'do'" label="æ´æ¹è¯´æ" required> |
| | | <up-textarea v-model="form.rectifyDesc" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | |
| | | <up-form-item v-if="mode === 'verify'" label="éªæ¶è¯´æ" required> |
| | | <up-textarea v-model="form.verifyDesc" placeholder="请è¾å
¥" auto-height /> |
| | | </up-form-item> |
| | | |
| | | <template v-if="mode === 'view'"> |
| | | <up-form-item label="æ´æ¹è¯´æ"> |
| | | <up-textarea :model-value="form.rectifyDesc" disabled auto-height /> |
| | | </up-form-item> |
| | | <up-form-item label="éªæ¶è¯´æ"> |
| | | <up-textarea :model-value="form.verifyDesc" disabled auto-height /> |
| | | </up-form-item> |
| | | </template> |
| | | </up-form> |
| | | |
| | | <FooterButtons :loading="loading" :confirmText="confirmText" @cancel="goBack" @confirm="handleSubmit" /> |
| | | |
| | | <up-action-sheet |
| | | :show="showLevelSheet" |
| | | title="éæ©é®é¢ç级" |
| | | :actions="levelActions" |
| | | @select="onSelectLevel" |
| | | @close="showLevelSheet = false" |
| | | /> |
| | | <up-datetime-picker |
| | | :show="showPlanPicker" |
| | | mode="datetime" |
| | | :value="planValue" |
| | | @confirm="onPlanConfirm" |
| | | @cancel="showPlanPicker = false" |
| | | /> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { computed, ref } from "vue"; |
| | | import { onLoad } from "@dcloudio/uni-app"; |
| | | import dayjs from "dayjs"; |
| | | import PageHeader from "@/components/PageHeader.vue"; |
| | | import FooterButtons from "@/components/FooterButtons.vue"; |
| | | import { |
| | | addFacilityRectification, |
| | | updateFacilityRectification, |
| | | } from "@/api/safeProduction/safetyFacility"; |
| | | |
| | | const loading = ref(false); |
| | | const mode = ref("add"); |
| | | const facilityName = ref(""); |
| | | |
| | | const form = ref({ |
| | | id: null, |
| | | inspectionId: null, |
| | | facilityId: null, |
| | | problemDesc: "", |
| | | problemLevel: "", |
| | | planTime: "", |
| | | rectifyDesc: "", |
| | | verifyDesc: "", |
| | | status: "", |
| | | actualTime: "", |
| | | verifyTime: "", |
| | | }); |
| | | |
| | | const showLevelSheet = ref(false); |
| | | const showPlanPicker = ref(false); |
| | | |
| | | const levelActions = [ |
| | | { name: "ä¸è¬", value: "ä¸è¬" }, |
| | | { name: "é大", value: "é大" }, |
| | | ]; |
| | | |
| | | const isReadOnlyProblem = computed(() => mode.value !== "add"); |
| | | |
| | | const pageTitle = computed(() => { |
| | | if (mode.value === "add") return "æ°å¢æ´æ¹"; |
| | | if (mode.value === "do") return "æ´æ¹"; |
| | | if (mode.value === "verify") return "éªæ¶"; |
| | | return "æ¥çæ´æ¹"; |
| | | }); |
| | | |
| | | const confirmText = computed(() => { |
| | | if (mode.value === "view") return "è¿å"; |
| | | return "ä¿å"; |
| | | }); |
| | | |
| | | const planValue = computed(() => { |
| | | if (!form.value.planTime) return Date.now(); |
| | | const ts = dayjs(form.value.planTime).valueOf(); |
| | | return Number.isFinite(ts) ? ts : Date.now(); |
| | | }); |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack(); |
| | | }; |
| | | |
| | | const openLevelSheet = () => { |
| | | if (mode.value !== "add") return; |
| | | showLevelSheet.value = true; |
| | | }; |
| | | |
| | | const openPlanPicker = () => { |
| | | if (mode.value !== "add") return; |
| | | showPlanPicker.value = true; |
| | | }; |
| | | |
| | | const onSelectLevel = action => { |
| | | if (mode.value !== "add") return; |
| | | form.value.problemLevel = action.value; |
| | | showLevelSheet.value = false; |
| | | }; |
| | | |
| | | const onPlanConfirm = e => { |
| | | if (mode.value !== "add") return; |
| | | form.value.planTime = dayjs(e?.value).format("YYYY-MM-DD HH:mm:ss"); |
| | | showPlanPicker.value = false; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | if (mode.value === "view") { |
| | | goBack(); |
| | | return; |
| | | } |
| | | |
| | | if (mode.value === "add") { |
| | | if (!form.value.inspectionId || !form.value.facilityId) { |
| | | uni.showToast({ title: "缺å°å·¡æ£ä¿¡æ¯", icon: "none" }); |
| | | return; |
| | | } |
| | | const problemDesc = String(form.value.problemDesc || "").trim(); |
| | | if (!problemDesc) { |
| | | uni.showToast({ title: "请è¾å
¥é®é¢æè¿°", icon: "none" }); |
| | | return; |
| | | } |
| | | const problemLevel = String(form.value.problemLevel || "").trim(); |
| | | if (!problemLevel) { |
| | | uni.showToast({ title: "è¯·éæ©é®é¢ç级", icon: "none" }); |
| | | return; |
| | | } |
| | | if (!form.value.planTime) { |
| | | uni.showToast({ title: "è¯·éæ©è®¡åæ´æ¹æ¶é´", icon: "none" }); |
| | | return; |
| | | } |
| | | const payload = { ...form.value, problemDesc, problemLevel }; |
| | | loading.value = true; |
| | | addFacilityRectification(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: "æä½æå", icon: "success" }); |
| | | uni.$emit("safetyFacility:refresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "æä½å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (mode.value === "do") { |
| | | if (!form.value.id) return; |
| | | const rectifyDesc = String(form.value.rectifyDesc || "").trim(); |
| | | if (!rectifyDesc) { |
| | | uni.showToast({ title: "请è¾å
¥æ´æ¹è¯´æ", icon: "none" }); |
| | | return; |
| | | } |
| | | const payload = { |
| | | ...form.value, |
| | | rectifyDesc, |
| | | status: "å·²æ´æ¹", |
| | | actualTime: dayjs(Date.now()).format("YYYY-MM-DD HH:mm:ss"), |
| | | }; |
| | | loading.value = true; |
| | | updateFacilityRectification(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: "æä½æå", icon: "success" }); |
| | | uni.$emit("safetyFacility:refresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "æä½å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (mode.value === "verify") { |
| | | if (!form.value.id) return; |
| | | const verifyDesc = String(form.value.verifyDesc || "").trim(); |
| | | if (!verifyDesc) { |
| | | uni.showToast({ title: "请è¾å
¥éªæ¶è¯´æ", icon: "none" }); |
| | | return; |
| | | } |
| | | const payload = { |
| | | ...form.value, |
| | | verifyDesc, |
| | | status: "å·²éªæ¶", |
| | | verifyTime: dayjs(Date.now()).format("YYYY-MM-DD HH:mm:ss"), |
| | | }; |
| | | loading.value = true; |
| | | updateFacilityRectification(payload) |
| | | .then(() => { |
| | | uni.showToast({ title: "æä½æå", icon: "success" }); |
| | | uni.$emit("safetyFacility:refresh"); |
| | | goBack(); |
| | | }) |
| | | .catch(() => { |
| | | uni.showToast({ title: "æä½å¤±è´¥", icon: "none" }); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | onLoad(options => { |
| | | if (options?.data) { |
| | | try { |
| | | const obj = JSON.parse(decodeURIComponent(options.data)); |
| | | mode.value = obj.mode || "add"; |
| | | if (obj.inspection) { |
| | | const ins = obj.inspection; |
| | | form.value.inspectionId = ins.id; |
| | | form.value.facilityId = ins.facilityId; |
| | | facilityName.value = ins.facilityName || ""; |
| | | } |
| | | if (obj.row) { |
| | | form.value = { ...form.value, ...(obj.row || {}) }; |
| | | facilityName.value = obj.row.facilityName || facilityName.value; |
| | | } |
| | | } catch (e) {} |
| | | } |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | @import "@/static/scss/form-common.scss"; |
| | | </style> |
| | |
| | | label: "ç¹ç§è®¾å¤ç®¡ç", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xunjianshangchuan.svg", |
| | | label: "线路巡æ£", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xunjianshangchuan.svg", |
| | | label: "å®å
¨è®¾æ½å·¡æ£", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/weixianyuan.svg", |
| | | label: "å±é©æºå°è´¦", |
| | | }, |
| | |
| | | url: "/pages/safeProduction/specialEquipmentManagement/index", |
| | | }); |
| | | break; |
| | | case "线路巡æ£": |
| | | uni.navigateTo({ |
| | | url: "/pages/safeProduction/lineInspection/index", |
| | | }); |
| | | break; |
| | | case "å®å
¨è®¾æ½å·¡æ£": |
| | | uni.navigateTo({ |
| | | url: "/pages/safeProduction/safetyFacility/index", |
| | | }); |
| | | break; |
| | | case "å±é©æºå°è´¦": |
| | | uni.navigateTo({ |
| | | url: "/pages/safeProduction/hazardSourceLedger/index", |