检修预警优化

This commit is contained in:
bb_pan 2025-07-31 18:32:17 +08:00
parent a1497cb403
commit 2749a7df70
2 changed files with 87 additions and 13 deletions

View File

@ -4,3 +4,8 @@ import request from '@/utils/request'
export const getUseMaintenanceWarningApi = data => {
return request.get('/material/useMaintenanceWarning/list', { params: data })
}
// 获取4级类型内容
export const getMaTypeApi = data => {
return request.post('/material/select/getMaType', data)
}

View File

@ -24,16 +24,29 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="状态" prop="taskStatus">
<el-select v-model="queryParams.taskStatus" placeholder="请选择状态" clearable>
<el-form-item label="机具类型" prop="">
<el-cascader
v-model="typeIds"
:options="typeList"
:props="{ label: 'typeName', value: 'typeId' }"
filterable
clearable
@change="handleChangeType"
style="width: 240px"
></el-cascader>
</el-form-item>
<el-form-item label="规格型号" prop="typeId">
<el-select v-model="queryParams.typeId" placeholder="请选择机规格型号" style="width: 240px">
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
v-for="item in typeIdList"
:key="item.typeId"
:label="item.name"
:value="item.typeId"
filterable
clearable
></el-option>
</el-select>
</el-form-item> -->
</el-form-item>
<!-- 表单按钮 -->
<el-form-item>
@ -43,16 +56,20 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<!-- 通知暂未开发 -->
<!-- <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-chat-dot-round" size="mini" @click="onHandleNotice">
通知
</el-button>
</el-col>
</el-col> -->
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">
导出数据
</el-button>
</el-col>
<el-col :span="1.5">
<div style="color: red; font-size: 20px; font-weight: 800">总计{{ total }}</div>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -91,7 +108,8 @@
<script>
import printJS from 'print-js'
import { getLeaseTaskList, deleteLeaseTask, getLeaseTask, getCodePDF } from '@/api/business/index'
import { getUseMaintenanceWarningApi } from '@/api/warning-analysis/engineering-in-use.js'
import { getUseMaintenanceWarningApi, getMaTypeApi } from '@/api/warning-analysis/engineering-in-use.js'
import { equipmentTypeTree } from '@/api/purchase/goodsArrived'
export default {
data() {
@ -101,8 +119,11 @@ export default {
pageNum: 1,
pageSize: 10,
keyWord: '', //
thirdTypeId: '',
typeId: '',
timeRange: [] //
},
typeIds: [],
total: 0, //
//
@ -131,11 +152,14 @@ export default {
{ label: '数量', prop: 'preNum', width: '60px' },
{ label: '备注', prop: 'remark', width: '' }
],
dialogList: []
dialogList: [],
typeList: [],
typeIdList: []
}
},
created() {
this.getList()
this.getTreeList()
},
methods: {
//
@ -146,6 +170,8 @@ export default {
handleReset() {
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.typeIds = []
this.queryParams.thirdTypeId = ''
this.$refs.queryForm.resetFields()
this.getList()
},
@ -168,6 +194,49 @@ export default {
this.total = 0
}
},
//
async getTreeList() {
try {
const res = await equipmentTypeTree()
console.log('🚀 ~ getTreeList ~ res:', res)
if (res.data && res.data.length > 0) {
this.typeList = this.removeChildrenFromLevel3(res.data)
}
} catch (error) {
console.log('🚀 ~ getTreeList ~ error:', error)
}
},
removeChildrenFromLevel3(tree) {
return tree.map(node => {
const newNode = { ...node }
if (newNode.level === '3') {
// children
delete newNode.children
} else if (newNode.children && newNode.children.length > 0) {
//
newNode.children = this.removeChildrenFromLevel3(newNode.children)
}
return newNode
})
},
handleChangeType(e) {
this.typeIdList = []
this.queryParams.typeId = ''
this.queryParams.thirdTypeId = e[e.length - 1]
console.log('🚀 ~ handleChangeType ~ :', this.queryParams.thirdTypeId)
this.getMaTypeList()
},
async getMaTypeList() {
try {
const res = await getMaTypeApi({ typeId: this.queryParams.thirdTypeId })
this.typeIdList = res.data || []
} catch (error) {
console.log('🚀 ~ getMaTypeList ~ error:', error)
}
},
//
selectionChange(val) {
console.log('selectionChange', val)
@ -245,7 +314,7 @@ export default {
// console.log('🚀 ~ getDialogContent ~ res:', PDFres)
this.dialogVisible = true
this.dialogForm = {
...res.data.leaseApplyInfo,
...res.data.leaseApplyInfo
// pdfUrl: PDFres.data.url
}
this.dialogList = res.data.leaseApplyDetailsList