| src/api/safeProduction/hazardousMaterialsControl.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/safeProduction/dangerInvestigation/detail.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/safeProduction/hazardSourceLedger/detail.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/safeProduction/hazardousMaterialsControl/detail.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/safeProduction/hazardousMaterialsControl/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/pages/safeProduction/safeQualifications/detail.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/safeProduction/hazardousMaterialsControl.js
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,33 @@ import request from "@/utils/request"; export function safeHazardRecordListPage(query) { return request({ url: "/safeHazardRecord/page", method: "get", params: query, }); } export function safeHazardRecordDel(ids) { return request({ url: '/safeHazardRecord/' + ids, method: 'delete', data: ids }) } // æ°å¢å±é©æºå°è´¦ export function safeHazardRecordAdd(query) { return request({ url: '/safeHazardRecord/borrow', method: 'post', data: query }) } export function safeHazardRecordUpdate(query) { return request({ url: '/safeHazardRecord/return', method: 'put', data: query }) } src/pages.json
@@ -759,6 +759,27 @@ "navigationStyle": "custom" } }, { "path": "pages/safeProduction/hazardousMaterialsControl/index", "style": { "navigationBarTitleText": "å±é©ç©æ", "navigationStyle": "custom" } }, { "path": "pages/safeProduction/hazardousMaterialsControl/detail", "style": { "navigationBarTitleText": "å±é©ç©æè¯¦æ ", "navigationStyle": "custom" } }, { "path": "pages/safeProduction/hazardousMaterialsControl/view", "style": { "navigationBarTitleText": "å±é©ç©æè¯¦æ ", "navigationStyle": "custom" } }, ], "subPackages": [ { src/pages/index.vue
@@ -319,6 +319,10 @@ icon: "/static/images/icon/guzhangfenxi@2x.png", label: "éæ£ææ¥", }, { icon: "/static/images/icon/guzhangfenxi@2x.png", label: "å±é©ç©æ", }, ]); // åååå ¬åè½æ°æ® const collaborationItems = reactive([ @@ -697,6 +701,11 @@ url: "/pages/safeProduction/dangerInvestigation/index", }); break; case "å±é©ç©æ": uni.navigateTo({ url: "/pages/safeProduction/hazardousMaterialsControl/index", }); break; default: uni.showToast({ title: `ç¹å»äº${item.label}`, src/pages/safeProduction/dangerInvestigation/detail.vue
@@ -117,16 +117,19 @@ <up-action-sheet :show="hiddenTypeSheetVisible" :actions="hiddenTypeOptions" @select="handleHiddenTypeSelect" @close="hiddenTypeSheetVisible = false" title="éæ©éæ£ç±»å" /> <!-- é£é©ççº§éæ©å¨ --> <up-action-sheet :show="riskLevelSheetVisible" :actions="riskLevelOptions" @select="handleRiskLevelSelect" @close="riskLevelSheetVisible = false" title="éæ©é£é©ç级" /> <!-- æ´æ¹è´£ä»»äººéæ©å¨ --> <up-action-sheet :show="principalSheetVisible" :actions="principalOptions" @select="handlePrincipalSelect" @close="principalSheetVisible = false" title="éæ©æ´æ¹è´£ä»»äºº" /> </view> </template> src/pages/safeProduction/hazardSourceLedger/detail.vue
@@ -117,16 +117,19 @@ <up-action-sheet :show="typeSheetVisible" :actions="typeOptions" @select="handleTypeSelect" @close="typeSheetVisible = false" title="éæ©å±é©æºç±»å" /> <!-- é£é©ççº§éæ©å¨ --> <up-action-sheet :show="riskLevelSheetVisible" :actions="riskLevelOptions" @select="handleRiskLevelSelect" @close="riskLevelSheetVisible = false" title="éæ©é£é©ç级" /> <!-- 管æ§è´£ä»»äººéæ©å¨ --> <up-action-sheet :show="principalSheetVisible" :actions="principalOptions" @select="handlePrincipalSelect" @close="principalSheetVisible = false" title="éæ©ç®¡æ§è´£ä»»äºº" /> </view> </template> src/pages/safeProduction/hazardousMaterialsControl/detail.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,444 @@ <template> <view class="hazard-source-detail"> <PageHeader :title="isEdit ? 'å½è¿' : 'é¢ç¨å±é©æº'" @back="goBack" /> <u-form @submit="handleSubmit" ref="formRef" label-width="110"> <!-- å±é©æºä¿¡æ¯ --> <u-cell-group v-if="!isEdit" title="å±é©æºä¿¡æ¯"> <u-form-item v-if="!isEdit" label="å±é©æºåç§°" prop="name" required border-bottom> <u-input v-model="form.name" placeholder="è¯·éæ©å±é©æº" @click="showHazardSourceSheet" readonly /> <template #right> <up-icon name="arrow-right" @click="showHazardSourceSheet"></up-icon> </template> </u-form-item> <u-form-item label="å±é©æºç¼ç " prop="code" border-bottom> <u-input v-model="form.code" disabled placeholder="èªå¨å¸¦åº" readonly /> </u-form-item> <u-form-item v-if="!isEdit" label="å±é©æºç±»å" prop="type" border-bottom> <u-input v-model="form.type" disabled placeholder="èªå¨å¸¦åº" readonly /> </u-form-item> <u-form-item v-if="!isEdit" label="é£é©ç级" prop="riskLevel" border-bottom> <u-input v-model="form.riskLevel" disabled placeholder="èªå¨å¸¦åº" readonly /> </u-form-item> <u-form-item v-if="!isEdit" label="æå¨ä½ç½®" prop="location" border-bottom> <u-input v-model="form.location" disabled placeholder="èªå¨å¸¦åº" readonly /> </u-form-item> <u-form-item v-if="!isEdit" label="é¢ç¨æ¶é´" prop="applyTime" border-bottom> <u-input v-model="form.applyTime" disabled /> </u-form-item> <u-form-item v-if="!isEdit" label="é¢ç¨äºº" prop="applyUserName" border-bottom> <u-input v-model="form.applyUserName" disabled /> </u-form-item> <u-form-item v-if="!isEdit" label="é¢ç¨ç¨é" prop="applyPurpose" required border-bottom> <u-input v-model="form.applyPurpose" placeholder="请è¾å ¥é¢ç¨ç¨é" /> </u-form-item> <u-form-item v-if="!isEdit" label="é¢ç¨æ°é" prop="applyQty" required border-bottom> <u-input v-model="form.applyQty" type="number" @blur="validateApplyQty" min="1" placeholder="请è¾å ¥é¢ç¨æ°é" /> </u-form-item> </u-cell-group> <u-cell-group v-if="isEdit" title="å½è¿ä¿¡æ¯"> <u-form-item label="å½è¿äºº" prop="returnUserName" border-bottom> <u-input v-model="form.returnUserName" disabled /> </u-form-item> <u-form-item label="å½è¿æ¶é´" prop="returnTime" border-bottom> <u-input v-model="form.returnTime" disabled /> </u-form-item> <u-form-item label="å½è¿æ åµè¯´æ" prop="returnRemark" required border-bottom> <u-textarea v-model="form.returnRemark" placeholder="请è¾å ¥å½è¿æ åµè¯´æ" :maxlength="200" count :autoHeight="true" /> </u-form-item> </u-cell-group> <!-- æäº¤æé® --> <view class="footer-btns"> <u-button class="cancel-btn" @click="goBack">åæ¶</u-button> <u-button class="sign-btn" type="primary" @click="handleSubmit" :loading="loading">{{ isEdit ? 'å½è¿' : 'é¢ç¨' }}</u-button> </view> </u-form> <!-- å±é©æºéæ©å¨ --> <up-action-sheet :show="hazardSourceSheetVisible" :actions="hazardSourceOptions" @select="handleHazardSourceSelect" @close="hazardSourceSheetVisible = false" title="éæ©å±é©æº" /> <!-- æ¶é´éæ©å¨ --> <up-datetime-picker :show="applyTimeVisible" v-model="applyTime" @confirm="onApplyTimeConfirm" @cancel="applyTimeVisible = false" mode="datetime" /> <up-datetime-picker :show="returnTimeVisible" v-model="returnTime" @confirm="onReturnTimeConfirm" @cancel="returnTimeVisible = false" mode="date" /> </view> </template> <script setup> // æ¿æ¢ toast æ¹æ³ defineOptions({ name: "hazard-source-detail" }); const showToast = message => { uni.showToast({ title: message, icon: "none", }); }; import { ref, onMounted } from "vue"; import PageHeader from "@/components/PageHeader.vue"; import { safeHazardRecordAdd, safeHazardRecordUpdate, } from "@/api/safeProduction/hazardousMaterialsControl"; import { safeHazardListPage } from "@/api/safeProduction/hazardSourceLedger"; import useUserStore from "@/store/modules/user"; import dayjs from "dayjs"; import { onLoad } from "@dcloudio/uni-app"; const userStore = useUserStore(); // è¡¨åæ°æ® const form = ref({ name: "", code: "", type: "", riskLevel: "", location: "", applyPurpose: "", applyTime: "", applyQty: "", returnTime: "", returnRemark: "", safeHazardId: "", }); // 页é¢ç¶æ const loading = ref(false); const formRef = ref(null); const isEdit = ref(false); // å±é©æºéæ©å¨ const hazardSourceSheetVisible = ref(false); const hazardSourceOptions = ref([]); const hazardSourceList = ref([]); const showHazardSourceSheet = () => { if (hazardSourceOptions.value.length === 0) { getHazardSourceList(); } else { hazardSourceSheetVisible.value = true; } }; const stockQty = ref(0); const handleHazardSourceSelect = item => { const hazardSource = hazardSourceList.value.find(h => h.id === item.value); if (hazardSource) { form.value.name = hazardSource.name; form.value.code = hazardSource.code; form.value.type = hazardSource.type; form.value.riskLevel = hazardSource.riskLevel; form.value.location = hazardSource.location; form.value.safeHazardId = hazardSource.id; stockQty.value = hazardSource.stockQty || 0; } hazardSourceSheetVisible.value = false; }; const validateApplyQty = () => { if (!form.value.applyQty) { showToast("请è¾å ¥é¢ç¨æ°é"); return false; } if (isNaN(form.value.applyQty)) { showToast("é¢ç¨æ°éå¿ é¡»æ¯æ°å"); form.value.applyQty = 0; return false; } if (form.value.applyQty < 0) { showToast("é¢ç¨æ°éå¿ é¡»å¤§äºçäº1"); form.value.applyQty = 0; return false; } if (form.value.applyQty > stockQty.value) { showToast("é¢ç¨æ°éä¸è½å¤§äºåºåæ°é"); form.value.applyQty = 0; return false; } return true; }; // è·åå±é©æºå表 const getHazardSourceList = () => { const params = { current: -1, size: -1, }; safeHazardListPage(params).then(res => { if (res.code === 200) { hazardSourceList.value = res.records || res.data?.records || []; // è¿æ»¤æåºåæ°éå°äºçäº0çé项 const validHazardSources = hazardSourceList.value.filter( item => item.stockQty > 0 ); hazardSourceOptions.value = validHazardSources.map(item => ({ value: item.id, name: item.name, subname: `åºå: ${item.stockQty}`, })); hazardSourceSheetVisible.value = true; } }); }; // æ¶é´éæ©å¨ const applyTimeVisible = ref(false); const applyTime = ref(Date.now()); const showApplyTimePicker = () => { applyTimeVisible.value = true; }; const onApplyTimeConfirm = e => { form.value.applyTime = dayjs(e.value).format("YYYY-MM-DD HH:mm:ss"); applyTime.value = e.value; applyTimeVisible.value = false; }; const returnTimeVisible = ref(false); const returnTime = ref(Date.now()); const showReturnTimePicker = () => { returnTimeVisible.value = true; }; const onReturnTimeConfirm = e => { form.value.returnTime = dayjs(e.value).format("YYYY-MM-DD"); returnTime.value = e.value; returnTimeVisible.value = false; }; // è¿åä¸ä¸é¡µ const goBack = () => { // è¿åæ¶æ¸ 餿¬å°åå¨çæ°æ® uni.removeStorageSync("hazardousMaterialsControl"); uni.navigateBack(); }; // æäº¤è¡¨å const handleSubmit = async () => { if (!form.value.safeHazardId) { showToast("è¯·éæ©å±é©æº"); return; } if (!form.value.applyPurpose) { showToast("请è¾å ¥é¢ç¨ç¨é"); return; } if (!form.value.applyQty) { showToast("请è¾å ¥é¢ç¨æ°é"); return; } if (isEdit.value) { if (!form.value.returnTime) { showToast("è¯·éæ©å½è¿æ¶é´"); return; } if (!form.value.returnRemark) { showToast("请è¾å ¥å½è¿æ åµè¯´æ"); return; } } try { loading.value = true; // 使ç¨å®å ¨æµ æ·è´ï¼é¿å 对象å±å¼å¨æäºè¿è¡æ¶æé const source = form.value && typeof form.value === "object" ? form.value : {}; const submitData = {}; Object.keys(source).forEach(k => { submitData[k] = source[k]; }); console.log("submitData", submitData); if (isEdit.value) { const { code } = await safeHazardRecordUpdate(submitData); if (code === 200) { showToast("å½è¿æå"); setTimeout(() => { goBack(); }, 500); } else { loading.value = false; showToast("å½è¿å¤±è´¥ï¼è¯·éè¯"); } } else { const { code } = await safeHazardRecordAdd(submitData); if (code === 200) { showToast("é¢ç¨æå"); setTimeout(() => { goBack(); }, 500); } else { loading.value = false; showToast("é¢ç¨å¤±è´¥ï¼è¯·éè¯"); } } } catch (e) { loading.value = false; console.error("æäº¤å¤±è´¥:", e); showToast("æäº¤å¤±è´¥ï¼è¯·éè¯"); } }; onLoad(() => { // ç¼è¾å±é©æºæ¶ï¼ä»æ¬å°åå¨è·åæ°æ® const hazardousMaterials = uni.getStorageSync("hazardousMaterialsControl"); console.log("hazardousMaterials", hazardousMaterials); if (hazardousMaterials.id) { form.value = hazardousMaterials; isEdit.value = true; userStore.getInfo().then(res => { form.value.returnUserId = res.user.userId; form.value.returnUserName = res.user.nickName; }); console.log("form.value", form.value); } else { userStore.getInfo().then(res => { form.value.applyUserId = res.user.userId; form.value.applyUserName = res.user.nickName; }); isEdit.value = false; } }); onMounted(() => { // 设置é»è®¤æ¶é´ if (!isEdit.value) { form.value.applyTime = dayjs().format("YYYY-MM-DD"); applyTime.value = Date.now(); } else { form.value.returnTime = dayjs().format("YYYY-MM-DD"); returnTime.value = Date.now(); } }); </script> <style scoped lang="scss"> @import "@/static/scss/form-common.scss"; .client-visit { min-height: 100vh; background: #f8f9fa; padding-bottom: 5rem; } .footer-btns { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; display: flex; justify-content: space-around; align-items: center; padding: 0.75rem 0; box-shadow: 0 -0.125rem 0.5rem rgba(0, 0, 0, 0.05); z-index: 1000; } .cancel-btn { font-weight: 400; font-size: 1rem; color: #666; background: #f5f5f5; border: 1px solid #ddd; width: 45%; height: 2.5rem; border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; } .sign-btn { font-weight: 500; font-size: 1rem; color: #fff; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border: none; width: 45%; height: 2.5rem; border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; } .location-icon { color: #1989fa; font-size: 1.2rem; } </style> src/pages/safeProduction/hazardousMaterialsControl/index.vue
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,295 @@ <template> <view class="sales-accoun"> <!-- 使ç¨éç¨é¡µé¢å¤´é¨ç»ä»¶ --> <PageHeader title="å±é©ç©æç®¡æ§" @back="goBack" /> <!-- æç´¢åçéåºå --> <view class="search-section"> <view class="search-bar"> <view class="search-input"> <up-input class="search-text" placeholder="请è¾å ¥å±é©æºåç§°" v-model="customerName" @blur="getList" clearable /> </view> <view class="filter-button" @click="getList"> <u-icon name="search" size="24" color="#999"></u-icon> </view> </view> </view> <!-- æè®¿è®°å½å表 --> <view class="ledger-list" v-if="visitList.length > 0"> <view v-for="(item, index) in visitList" :key="index"> <view 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">é¢ç¨åå·ï¼{{ item.materialRecordCode }}</text> </view> </view> <up-divider></up-divider> <view class="item-details"> <view class="detail-row"> <text class="detail-label">å±é©æºåç§°</text> <text class="detail-value">{{ item.name || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">å±é©æºç¼ç </text> <text class="detail-value">{{ item.code || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">å±é©æºç±»å</text> <text class="detail-value">{{ hazard_source_type.find(i => i.value === item.type)?.label || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">é£é©ç级</text> <u-tag :type="getRiskLevelType(item.riskLevel)"> {{ item.riskLevel || '-' }} </u-tag> </view> <view class="detail-row"> <text class="detail-label">æå¨ä½ç½®</text> <text class="detail-value">{{ item.location || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">é¢ç¨ç¨é</text> <text class="detail-value">{{ item.applyPurpose || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">é¢ç¨æ¶é´</text> <text class="detail-value">{{ item.applyTime || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">é¢ç¨æ°é</text> <text class="detail-value">{{ item.applyQty || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">å½è¿æ¶é´</text> <text class="detail-value">{{ item.returnTime || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">å½è¿äºº</text> <text class="detail-value">{{ item.returnUserName || '-' }}</text> </view> <view class="detail-row"> <text class="detail-label">å½è¿æ åµè¯´æ</text> <text class="detail-value">{{ item.returnRemark || '-' }}</text> </view> </view> <!-- æé®åºå --> <view class="action-buttons"> <!-- <u-button type="info" size="small" class="action-btn" @click="viewDetail(item)"> æ¥ç详æ </u-button> --> <u-button type="primary" size="small" class="action-btn" :disabled="item.returnUserId" @click="editVisit(item)"> å½è¿ </u-button> <u-button type="error" size="small" class="action-btn" @click="deleteVisit(item)"> å é¤ </u-button> </view> </view> </view> </view> <view v-else class="no-data"> <text>ææ æè®¿è®°å½</text> </view> <!-- æµ®å¨æ°å¢æé® --> <view class="fab-button" @click="addVisit"> <up-icon name="plus" size="24" color="#ffffff"></up-icon> </view> </view> </template> <script setup> import { ref, onMounted } from "vue"; import { onShow } from "@dcloudio/uni-app"; import PageHeader from "@/components/PageHeader.vue"; import { safeHazardRecordListPage, safeHazardRecordDel, } from "@/api/safeProduction/hazardousMaterialsControl"; import useUserStore from "@/store/modules/user"; import { useDict } from "@/utils/dict"; // æ¿æ¢ toast æ¹æ³ defineOptions({ name: "client-visit-index" }); const showToast = message => { uni.showToast({ title: message, icon: "none", }); }; const getRiskLevelType = riskLevel => { const typeMap = { ä½é£é©: "info", ä¸è¬é£é©: "info", è¾å¤§é£é©: "warning", é大é£é©: "error", }; return typeMap[riskLevel] || "info"; }; import dayjs from "dayjs"; const userStore = useUserStore(); // æç´¢å ³é®è¯ const customerName = ref(""); // æè®¿è®°å½æ°æ® const visitList = ref([]); // è¿åä¸ä¸é¡µ const goBack = () => { uni.navigateBack(); }; // æ¥è¯¢å表 const getList = () => { showLoadingToast("å è½½ä¸..."); const params = { current: -1, size: -1, name: customerName.value, }; safeHazardRecordListPage(params) .then(res => { visitList.value = res.records || res.data?.records || []; closeToast(); }) .catch(() => { closeToast(); showToast("è·åæ°æ®å¤±è´¥"); }); }; // æ¾ç¤ºå è½½æç¤º const showLoadingToast = message => { uni.showLoading({ title: message, mask: true, }); }; // å ³éæç¤º const closeToast = () => { uni.hideLoading(); }; // æ°å¢å±é©æº const addVisit = () => { uni.setStorageSync("hazardousMaterialsControl", {}); uni.navigateTo({ url: "/pages/safeProduction/hazardousMaterialsControl/detail", }); }; // ç¼è¾å±é©æº const editVisit = item => { uni.setStorageSync("hazardousMaterialsControl", item); uni.navigateTo({ url: "/pages/safeProduction/hazardousMaterialsControl/detail", }); }; // å é¤å±é©æº const deleteVisit = item => { uni.showModal({ title: "å é¤ç¡®è®¤", content: `ç¡®å®è¦å é¤è¯¥å±é©æºåï¼`, success: res => { if (res.confirm) { deleteClientVisit(item.id); } }, }); }; const { hazard_source_type } = useDict("hazard_source_type"); const { risk_level } = useDict("risk_level"); // å é¤å±é©æºè®°å½ const deleteClientVisit = id => { showLoadingToast("å é¤ä¸..."); safeHazardRecordDel([id]) .then(() => { closeToast(); showToast("å 餿å"); getList(); }) .catch(() => { closeToast(); showToast("å é¤å¤±è´¥"); }); }; // æ¥ç详æ const viewDetail = item => { uni.setStorageSync("hazardSourceLedger", item); uni.navigateTo({ url: "/pages/safeProduction/hazardSourceLedger/view", }); }; onMounted(() => { getList(); }); onShow(() => { getList(); }); </script> <style scoped lang="scss"> @import "../../../styles/sales-common.scss"; // 页é¢ç¹å®çæ ·å¼è¦ç .sales-accoun { min-height: 100vh; background: #f8f9fa; position: relative; padding-bottom: 80px; } // ç¹å®ç徿 æ ·å¼ .document-icon { background: #667eea; // ä¿æé¡µé¢ç¹æçèæ¯è² } // ç¹ææ ·å¼ .visit-status { display: flex; align-items: center; } .detail-value { word-break: break-all; // ä¿ç页é¢ç¹æçææ¬æ¢è¡æ ·å¼ } // ç¹å®çæµ®å¨æé®æ ·å¼ .fab-button { background: #667eea; // ä¿æé¡µé¢ç¹æçèæ¯è² box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3); // ä¿æé¡µé¢ç¹æçé´å½±ææ } </style> src/pages/safeProduction/safeQualifications/detail.vue
@@ -83,6 +83,7 @@ <up-action-sheet :show="typeSheetVisible" :actions="typeOptions" @select="handleTypeSelect" @close="typeSheetVisible = false" title="éæ©è§ç¨èµè´¨ç±»å" /> </view> </template>