| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-tabs v-model="activeTab" @tab-change="handleTabChange"> |
| | | <el-tab-pane label="çµåå°è´¦" name="ledger"> |
| | | <div class="search_form mb20"> |
| | | <div> |
| | | <span class="search_title">设å¤åç§°ï¼</span> |
| | | <el-input v-model="ledgerSearch.equipmentName" style="width: 240px" clearable placeholder="请è¾å
¥è®¾å¤åç§°" @change="ledgerQuery" :prefix-icon="Search" /> |
| | | <el-button type="primary" style="margin-left: 10px" @click="ledgerQuery">æç´¢</el-button> |
| | | </div> |
| | | <div style="margin-left: auto"> |
| | | <el-button type="primary" @click="openLedgerForm()">æ°å¢å°è´¦</el-button> |
| | | <el-button type="danger" plain @click="deleteLedger">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <PIMTable rowKey="id" :column="ledgerColumns" :tableData="ledgerTableData" :page="ledgerPage" :isSelection="true" @selection-change="handleLedgerSelectionChange" :tableLoading="ledgerLoading" @pagination="ledgerPagination" :total="ledgerPage.total" /> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="æ£éªç»´ä¿è®°å½" name="record"> |
| | | <div class="search_form mb20"> |
| | | <div> |
| | | <span class="search_title">è®°å½ç±»åï¼</span> |
| | | <el-select v-model="recordSearch.recordType" style="width: 180px" clearable @change="recordQuery"> |
| | | <el-option label="æ£éª" :value="1" /> |
| | | <el-option label="ç»´ä¿" :value="2" /> |
| | | </el-select> |
| | | <el-button type="primary" style="margin-left: 10px" @click="recordQuery">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openRecordForm()">æ°å¢è®°å½</el-button> |
| | | <el-button type="danger" plain @click="deleteRecord">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <PIMTable rowKey="id" :column="recordColumns" :tableData="recordTableData" :page="recordPage" :isSelection="true" @selection-change="handleRecordSelectionChange" :tableLoading="recordLoading" @pagination="recordPagination" :total="recordPage.total" /> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="éæ£æ´æ¹" name="rectification"> |
| | | <div class="search_form mb20"> |
| | | <div> |
| | | <span class="search_title">æ´æ¹ç¶æï¼</span> |
| | | <el-select v-model="rectSearch.rectificationStatus" style="width: 180px" clearable @change="rectQuery"> |
| | | <el-option label="å¾
æ´æ¹" :value="1" /> |
| | | <el-option label="æ´æ¹ä¸" :value="2" /> |
| | | <el-option label="å¾
夿 ¸" :value="3" /> |
| | | <el-option label="å·²éç¯" :value="4" /> |
| | | </el-select> |
| | | <el-button type="primary" style="margin-left: 10px" @click="rectQuery">æç´¢</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openRectForm()">æ°å¢æ´æ¹</el-button> |
| | | <el-button type="danger" plain @click="deleteRect">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <PIMTable rowKey="id" :column="rectColumns" :tableData="rectTableData" :page="rectPage" :isSelection="true" @selection-change="handleRectSelectionChange" :tableLoading="rectLoading" @pagination="rectPagination" :total="rectPage.total" /> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | <el-dialog v-model="ledgerDialogVisible" :title="ledgerDialogTitle" width="900px" :close-on-click-modal="false"> |
| | | <el-form ref="ledgerFormRef" :model="ledgerForm" label-position="top" :rules="ledgerRules"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"><el-form-item label="设å¤ç¼å·" prop="equipmentNo"><el-input v-model="ledgerForm.equipmentNo" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="设å¤åç§°" prop="equipmentName"><el-input v-model="ledgerForm.equipmentName" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"><el-form-item label="设å¤ç±»å«"><el-input v-model="ledgerForm.equipmentType" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="è§æ ¼åå·"><el-input v-model="ledgerForm.modelSpec" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"><el-form-item label="å®è£
ä½ç½®"><el-input v-model="ledgerForm.installLocation" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="使ç¨åä½"><el-input v-model="ledgerForm.useUnit" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è´è´£äºº"> |
| | | <el-select v-model="ledgerForm.managerId" filterable clearable style="width: 100%" placeholder="è¯·éæ©è´è´£äºº" @change="handleLedgerManagerChange"> |
| | | <el-option v-for="item in activeUserOptions" :key="item.userId" :label="item.nickName || item.userName" :value="item.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button type="primary" @click="submitLedgerForm">ç¡®å®</el-button> |
| | | <el-button @click="ledgerDialogVisible = false">åæ¶</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <el-dialog v-model="recordDialogVisible" :title="recordDialogTitle" width="900px" :close-on-click-modal="false"> |
| | | <el-form ref="recordFormRef" :model="recordForm" label-position="top" :rules="recordRules"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"><el-form-item label="å
³è设å¤" prop="equipmentId"><el-select v-model="recordForm.equipmentId" filterable clearable style="width: 100%" placeholder="è¯·éæ©è®¾å¤"><el-option v-for="item in activeLedgerOptions" :key="item.id" :label="item.equipmentName" :value="item.id" /></el-select></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="è®°å½ç±»å" prop="recordType"><el-select v-model="recordForm.recordType" clearable style="width: 100%" placeholder="è¯·éæ©è®°å½ç±»å"><el-option label="æ£éª" :value="1" /><el-option label="ç»´ä¿" :value="2" /></el-select></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"><el-form-item label="è®°å½ç¼å·" prop="recordNo"><el-input v-model="recordForm.recordNo" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="è®°å½æ¥æ" prop="recordDate"><el-date-picker v-model="recordForm.recordDate" value-format="YYYY-MM-DD" type="date" style="width: 100%" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ§è¡äºº" prop="executorId"> |
| | | <el-select v-model="recordForm.executorId" filterable clearable style="width: 100%" placeholder="è¯·éæ©æ§è¡äºº" @change="handleExecutorChange"> |
| | | <el-option v-for="item in activeUserOptions" :key="item.userId" :label="item.nickName || item.userName" :value="item.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"><el-form-item label="䏿¬¡å°ææ¥æ" prop="nextDueDate"><el-date-picker v-model="recordForm.nextDueDate" value-format="YYYY-MM-DD" type="date" style="width: 100%" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-form-item label="æ§è¡ç»æ" prop="executeResult"><el-input v-model="recordForm.executeResult" type="textarea" :rows="3" /></el-form-item> |
| | | <el-form-item label="é®é¢æè¿°" prop="problemDescription"><el-input v-model="recordForm.problemDescription" type="textarea" :rows="3" /></el-form-item> |
| | | <el-form-item label="å¤çæªæ½" prop="disposeMeasure"><el-input v-model="recordForm.disposeMeasure" type="textarea" :rows="3" /></el-form-item> |
| | | <el-form-item label="é件说æ" prop="attachmentRemark"><el-input v-model="recordForm.attachmentRemark" type="textarea" :rows="2" /></el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button type="primary" @click="submitRecordForm">ç¡®å®</el-button> |
| | | <el-button @click="recordDialogVisible = false">åæ¶</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <el-dialog v-model="rectDialogVisible" :title="rectDialogTitle" width="900px" :close-on-click-modal="false"> |
| | | <el-form ref="rectFormRef" :model="rectForm" label-position="top" :rules="rectRules"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"><el-form-item label="å
³è设å¤" prop="equipmentId"><el-select v-model="rectForm.equipmentId" filterable clearable style="width: 100%" placeholder="è¯·éæ©è®¾å¤"><el-option v-for="item in activeLedgerOptions" :key="item.id" :label="item.equipmentName" :value="item.id" /></el-select></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="é£é©ç级" prop="riskLevel"><el-select v-model="rectForm.riskLevel" clearable style="width: 100%" placeholder="è¯·éæ©é£é©ç级"><el-option label="ä½" value="ä½" /><el-option label="ä¸" value="ä¸" /><el-option label="é«" value="é«" /></el-select></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"><el-form-item label="åç°æ¥æ" prop="discoveredDate"><el-date-picker v-model="rectForm.discoveredDate" value-format="YYYY-MM-DD" type="date" style="width: 100%" /></el-form-item></el-col> |
| | | <el-col :span="12"><el-form-item label="æ´æ¹æé" prop="rectificationDeadline"><el-date-picker v-model="rectForm.rectificationDeadline" value-format="YYYY-MM-DD" type="date" style="width: 100%" /></el-form-item></el-col> |
| | | </el-row> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ´æ¹è´£ä»»äºº" prop="responsibleUserId"> |
| | | <el-select v-model="rectForm.responsibleUserId" filterable clearable style="width: 100%" placeholder="è¯·éæ©æ´æ¹è´£ä»»äºº" @change="handleResponsibleUserChange"> |
| | | <el-option v-for="item in activeUserOptions" :key="item.userId" :label="item.nickName || item.userName" :value="item.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"><el-form-item label="æ´æ¹ç¶æ" prop="rectificationStatus"><el-select v-model="rectForm.rectificationStatus" clearable style="width: 100%" placeholder="è¯·éæ©æ´æ¹ç¶æ"><el-option label="å¾
æ´æ¹" :value="1" /><el-option label="æ´æ¹ä¸" :value="2" /><el-option label="å¾
夿 ¸" :value="3" /><el-option label="å·²éç¯" :value="4" /></el-select></el-form-item></el-col> |
| | | </el-row> |
| | | <el-form-item label="鿣æè¿°" prop="hazardDescription"><el-input v-model="rectForm.hazardDescription" type="textarea" :rows="3" /></el-form-item> |
| | | <el-form-item label="æ´æ¹æªæ½" prop="rectificationMeasures"><el-input v-model="rectForm.rectificationMeasures" type="textarea" :rows="3" /></el-form-item> |
| | | <el-form-item label="æ´æ¹ç»æ" prop="rectificationResult"><el-input v-model="rectForm.rectificationResult" type="textarea" :rows="3" /></el-form-item> |
| | | <el-form-item label="夿³¨" prop="remarks"><el-input v-model="rectForm.remarks" type="textarea" :rows="2" /></el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button type="primary" @click="submitRectForm">ç¡®å®</el-button> |
| | | <el-button @click="rectDialogVisible = false">åæ¶</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { computed, reactive, ref, onMounted, getCurrentInstance } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import PIMTable from "@/components/PIMTable/PIMTable.vue"; |
| | | import { |
| | | specialEquipmentLedgerList, |
| | | specialEquipmentLedgerListPage, |
| | | specialEquipmentLedgerAdd, |
| | | specialEquipmentLedgerUpdate, |
| | | specialEquipmentLedgerDel, |
| | | specialEquipmentRecordListPage, |
| | | specialEquipmentRecordAdd, |
| | | specialEquipmentRecordUpdate, |
| | | specialEquipmentRecordDel, |
| | | specialEquipmentRectificationListPage, |
| | | specialEquipmentRectificationAdd, |
| | | specialEquipmentRectificationClose, |
| | | specialEquipmentRectificationDel, |
| | | } from "@/api/safeProduction/specialEquipmentManagement.js"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const activeTab = ref("ledger"); |
| | | const userOptions = ref([]); |
| | | |
| | | const ledgerSearch = reactive({ equipmentName: "" }); |
| | | const recordSearch = reactive({ recordType: "" }); |
| | | const rectSearch = reactive({ rectificationStatus: "" }); |
| | | |
| | | const ledgerPage = reactive({ current: 1, size: 10, total: 0 }); |
| | | const recordPage = reactive({ current: 1, size: 10, total: 0 }); |
| | | const rectPage = reactive({ current: 1, size: 10, total: 0 }); |
| | | const ledgerTableData = ref([]); |
| | | const recordTableData = ref([]); |
| | | const rectTableData = ref([]); |
| | | const ledgerSelection = ref([]); |
| | | const recordSelection = ref([]); |
| | | const rectSelection = ref([]); |
| | | const ledgerLoading = ref(false); |
| | | const recordLoading = ref(false); |
| | | const rectLoading = ref(false); |
| | | |
| | | const ledgerDialogVisible = ref(false); |
| | | const ledgerDialogTitle = ref(""); |
| | | const ledgerFormRef = ref(); |
| | | const ledgerForm = reactive({ |
| | | equipmentNo: "", |
| | | equipmentName: "", |
| | | equipmentType: "", |
| | | modelSpec: "", |
| | | installLocation: "", |
| | | useUnit: "", |
| | | managerId: "", |
| | | managerName: "", |
| | | }); |
| | | const ledgerRules = { |
| | | equipmentNo: [{ required: true, message: "请è¾å
¥è®¾å¤ç¼å·", trigger: "blur" }], |
| | | equipmentName: [{ required: true, message: "请è¾å
¥è®¾å¤åç§°", trigger: "blur" }], |
| | | }; |
| | | const recordDialogVisible = ref(false); |
| | | const recordDialogTitle = ref(""); |
| | | const recordFormRef = ref(); |
| | | const recordForm = reactive({ |
| | | equipmentId: "", |
| | | recordType: "", |
| | | recordNo: "", |
| | | recordDate: "", |
| | | executeResult: "", |
| | | problemDescription: "", |
| | | disposeMeasure: "", |
| | | executorId: "", |
| | | executorName: "", |
| | | nextDueDate: "", |
| | | attachmentRemark: "", |
| | | }); |
| | | const recordRules = { |
| | | equipmentId: [{ required: true, message: "è¯·éæ©å
³è设å¤", trigger: "change" }], |
| | | recordType: [{ required: true, message: "è¯·éæ©è®°å½ç±»å", trigger: "change" }], |
| | | recordNo: [{ required: true, message: "请è¾å
¥è®°å½ç¼å·", trigger: "blur" }], |
| | | recordDate: [{ required: true, message: "è¯·éæ©è®°å½æ¥æ", trigger: "change" }], |
| | | }; |
| | | const rectDialogVisible = ref(false); |
| | | const rectDialogTitle = ref(""); |
| | | const rectFormRef = ref(); |
| | | const rectForm = reactive({ |
| | | equipmentId: "", |
| | | hazardDescription: "", |
| | | riskLevel: "", |
| | | discoveredDate: "", |
| | | responsibleUserId: "", |
| | | responsibleUserName: "", |
| | | rectificationDeadline: "", |
| | | rectificationStatus: 1, |
| | | rectificationMeasures: "", |
| | | rectificationResult: "", |
| | | remarks: "", |
| | | }); |
| | | const rectRules = { |
| | | equipmentId: [{ required: true, message: "è¯·éæ©å
³è设å¤", trigger: "change" }], |
| | | hazardDescription: [{ required: true, message: "请è¾å
¥éæ£æè¿°", trigger: "blur" }], |
| | | discoveredDate: [{ required: true, message: "è¯·éæ©åç°æ¥æ", trigger: "change" }], |
| | | rectificationDeadline: [{ required: true, message: "è¯·éæ©æ´æ¹æé", trigger: "change" }], |
| | | }; |
| | | const ledgerOptions = ref([]); |
| | | const activeLedgerOptions = computed(() => ledgerOptions.value); |
| | | const activeUserOptions = computed(() => userOptions.value || []); |
| | | |
| | | const ledgerColumns = [ |
| | | { label: "设å¤ç¼å·", prop: "equipmentNo" }, |
| | | { label: "设å¤åç§°", prop: "equipmentName" }, |
| | | { label: "设å¤ç±»å«", prop: "equipmentType" }, |
| | | { label: "å®è£
ä½ç½®", prop: "installLocation" }, |
| | | { label: "è´è´£äºº", prop: "managerName" }, |
| | | { |
| | | label: "æä½", |
| | | dataType: "action", |
| | | width: "180", |
| | | operation: [ |
| | | { name: "ç¼è¾", clickFun: (row) => openLedgerForm(row) }, |
| | | { name: "å é¤", clickFun: (row) => deleteLedger(row.id) }, |
| | | ], |
| | | }, |
| | | ]; |
| | | |
| | | const recordColumns = [ |
| | | { label: "è®°å½ç¼å·", prop: "recordNo" }, |
| | | { label: "è®°å½ç±»å", prop: "recordType", formatData: { 1: "æ£éª", 2: "ç»´ä¿" } }, |
| | | { label: "è®°å½æ¥æ", prop: "recordDate" }, |
| | | { label: "æ§è¡äºº", prop: "executorName" }, |
| | | { label: "æ§è¡ç»æ", prop: "executeResult" }, |
| | | { label: "䏿¬¡å°ææ¥æ", prop: "nextDueDate" }, |
| | | { |
| | | label: "æä½", |
| | | dataType: "action", |
| | | width: "180", |
| | | operation: [ |
| | | { name: "ç¼è¾", clickFun: (row) => openRecordForm(row) }, |
| | | { name: "å é¤", clickFun: (row) => deleteRecord(row.id) }, |
| | | ], |
| | | }, |
| | | ]; |
| | | |
| | | const rectColumns = [ |
| | | { label: "鿣æè¿°", prop: "hazardDescription" }, |
| | | { label: "é£é©ç级", prop: "riskLevel" }, |
| | | { label: "åç°æ¥æ", prop: "discoveredDate" }, |
| | | { label: "责任人", prop: "responsibleUserName" }, |
| | | { label: "æ´æ¹æé", prop: "rectificationDeadline" }, |
| | | { label: "æ´æ¹ç¶æ", prop: "rectificationStatus", formatData: { 1: "å¾
æ´æ¹", 2: "æ´æ¹ä¸", 3: "å¾
夿 ¸", 4: "å·²éç¯" } }, |
| | | { |
| | | label: "æä½", |
| | | dataType: "action", |
| | | width: "220", |
| | | operation: [ |
| | | { name: "å é¤", clickFun: (row) => deleteRect(row.id) }, |
| | | ], |
| | | }, |
| | | ]; |
| | | |
| | | const ledgerQuery = async () => { |
| | | ledgerLoading.value = true; |
| | | const res = await specialEquipmentLedgerListPage({ ...ledgerSearch, ...ledgerPage }); |
| | | ledgerTableData.value = res.data?.records || res.data?.rows || []; |
| | | ledgerPage.total = res.data?.total || 0; |
| | | ledgerLoading.value = false; |
| | | }; |
| | | |
| | | const loadLedgerOptions = async () => { |
| | | const res = await specialEquipmentLedgerList({}); |
| | | ledgerOptions.value = res.data || []; |
| | | }; |
| | | |
| | | const recordQuery = async () => { |
| | | recordLoading.value = true; |
| | | const res = await specialEquipmentRecordListPage({ ...recordSearch, ...recordPage }); |
| | | recordTableData.value = res.data?.records || res.data?.rows || []; |
| | | recordPage.total = res.data?.total || 0; |
| | | recordLoading.value = false; |
| | | }; |
| | | |
| | | const rectQuery = async () => { |
| | | rectLoading.value = true; |
| | | const res = await specialEquipmentRectificationListPage({ ...rectSearch, ...rectPage }); |
| | | rectTableData.value = res.data?.records || res.data?.rows || []; |
| | | rectPage.total = res.data?.total || 0; |
| | | rectLoading.value = false; |
| | | }; |
| | | |
| | | const handleTabChange = () => { |
| | | if (activeTab.value === "ledger") ledgerQuery(); |
| | | if (activeTab.value === "record") recordQuery(); |
| | | if (activeTab.value === "rectification") rectQuery(); |
| | | }; |
| | | |
| | | const ledgerPagination = ({ page, limit }) => { ledgerPage.current = page; ledgerPage.size = limit; ledgerQuery(); }; |
| | | const recordPagination = ({ page, limit }) => { recordPage.current = page; recordPage.size = limit; recordQuery(); }; |
| | | const rectPagination = ({ page, limit }) => { rectPage.current = page; rectPage.size = limit; rectQuery(); }; |
| | | const handleLedgerSelectionChange = (rows) => (ledgerSelection.value = rows); |
| | | const handleRecordSelectionChange = (rows) => (recordSelection.value = rows); |
| | | const handleRectSelectionChange = (rows) => (rectSelection.value = rows); |
| | | |
| | | const getUserDisplayName = (userId) => { |
| | | const user = userOptions.value.find((item) => item.userId === userId); |
| | | return user ? (user.nickName || user.userName || "") : ""; |
| | | }; |
| | | |
| | | const handleLedgerManagerChange = (userId) => { |
| | | ledgerForm.managerName = getUserDisplayName(userId); |
| | | }; |
| | | |
| | | const openLedgerForm = (row = {}) => { |
| | | Object.assign(ledgerForm, { |
| | | id: "", |
| | | equipmentNo: "", |
| | | equipmentName: "", |
| | | equipmentType: "", |
| | | modelSpec: "", |
| | | installLocation: "", |
| | | useUnit: "", |
| | | managerName: "", |
| | | }); |
| | | Object.assign(ledgerForm, row); |
| | | ledgerDialogTitle.value = row.id ? "ç¼è¾å°è´¦" : "æ°å¢å°è´¦"; |
| | | ledgerDialogVisible.value = true; |
| | | }; |
| | | |
| | | const submitLedgerForm = async () => { |
| | | await ledgerFormRef.value.validate(); |
| | | const api = ledgerForm.id ? specialEquipmentLedgerUpdate : specialEquipmentLedgerAdd; |
| | | await api(ledgerForm); |
| | | ElMessage.success("ä¿åæå"); |
| | | ledgerDialogVisible.value = false; |
| | | ledgerQuery(); |
| | | }; |
| | | |
| | | const deleteLedger = async (id) => { |
| | | const ids = id ? [id] : ledgerSelection.value.map((i) => i.id); |
| | | if (!ids.length) return ElMessage.warning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | await ElMessageBox.confirm("确认å 餿éå°è´¦åï¼", "æç¤º", { type: "warning" }); |
| | | await specialEquipmentLedgerDel(ids); |
| | | ElMessage.success("å 餿å"); |
| | | ledgerQuery(); |
| | | }; |
| | | |
| | | const openRecordForm = async (row = {}) => { |
| | | Object.assign(recordForm, { |
| | | id: "", |
| | | equipmentId: "", |
| | | recordType: "", |
| | | recordNo: "", |
| | | recordDate: "", |
| | | executeResult: "", |
| | | problemDescription: "", |
| | | disposeMeasure: "", |
| | | executorId: "", |
| | | executorName: "", |
| | | nextDueDate: "", |
| | | attachmentRemark: "", |
| | | }); |
| | | Object.assign(recordForm, row); |
| | | if (!recordForm.executorId && recordForm.executorName) { |
| | | const matched = userOptions.value.find((item) => (item.nickName || item.userName) === recordForm.executorName); |
| | | recordForm.executorId = matched?.userId || ""; |
| | | } |
| | | recordDialogTitle.value = row.id ? "ç¼è¾è®°å½" : "æ°å¢è®°å½"; |
| | | recordDialogVisible.value = true; |
| | | }; |
| | | |
| | | const submitRecordForm = async () => { |
| | | await recordFormRef.value.validate(); |
| | | const api = recordForm.id ? specialEquipmentRecordUpdate : specialEquipmentRecordAdd; |
| | | await api(recordForm); |
| | | ElMessage.success("ä¿åæå"); |
| | | recordDialogVisible.value = false; |
| | | recordQuery(); |
| | | }; |
| | | |
| | | const deleteRecord = async (id) => { |
| | | const ids = id ? [id] : recordSelection.value.map((i) => i.id); |
| | | if (!ids.length) return ElMessage.warning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | await ElMessageBox.confirm("确认å 餿éè®°å½åï¼", "æç¤º", { type: "warning" }); |
| | | await specialEquipmentRecordDel(ids); |
| | | ElMessage.success("å 餿å"); |
| | | recordQuery(); |
| | | }; |
| | | |
| | | const openRectForm = (row = {}) => { |
| | | Object.assign(rectForm, { |
| | | id: "", |
| | | equipmentId: "", |
| | | hazardDescription: "", |
| | | riskLevel: "", |
| | | discoveredDate: "", |
| | | responsibleUserId: "", |
| | | responsibleUserName: "", |
| | | rectificationDeadline: "", |
| | | rectificationStatus: 1, |
| | | rectificationMeasures: "", |
| | | rectificationResult: "", |
| | | remarks: "", |
| | | }); |
| | | Object.assign(rectForm, row); |
| | | if (!rectForm.responsibleUserId && rectForm.responsibleUserName) { |
| | | const matched = userOptions.value.find((item) => (item.nickName || item.userName) === rectForm.responsibleUserName); |
| | | rectForm.responsibleUserId = matched?.userId || ""; |
| | | } |
| | | rectDialogTitle.value = "æ°å¢æ´æ¹"; |
| | | rectDialogVisible.value = true; |
| | | }; |
| | | |
| | | const submitRectForm = async () => { |
| | | await rectFormRef.value.validate(); |
| | | await specialEquipmentRectificationAdd(rectForm); |
| | | ElMessage.success("ä¿åæå"); |
| | | rectDialogVisible.value = false; |
| | | rectQuery(); |
| | | }; |
| | | |
| | | const deleteRect = async (id) => { |
| | | const ids = id ? [id] : rectSelection.value.map((i) => i.id); |
| | | if (!ids.length) return ElMessage.warning("è¯·éæ©è¦å é¤çæ°æ®"); |
| | | await ElMessageBox.confirm("确认å é¤æéæ´æ¹æ°æ®åï¼", "æç¤º", { type: "warning" }); |
| | | await specialEquipmentRectificationDel(ids); |
| | | ElMessage.success("å 餿å"); |
| | | rectQuery(); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | ledgerQuery(); |
| | | loadLedgerOptions(); |
| | | userListNoPageByTenantId() |
| | | .then((res) => { |
| | | userOptions.value = Array.isArray(res.data) ? res.data : []; |
| | | }) |
| | | .catch(() => { |
| | | userOptions.value = []; |
| | | }); |
| | | }); |
| | | |
| | | const handleExecutorChange = (userId) => { |
| | | recordForm.executorName = getUserDisplayName(userId); |
| | | }; |
| | | |
| | | const handleResponsibleUserChange = (userId) => { |
| | | rectForm.responsibleUserName = getUserDisplayName(userId); |
| | | }; |
| | | </script> |