在库在用设备维保

This commit is contained in:
hongchao 2025-08-08 10:30:44 +08:00
parent fe92a1e7b0
commit c166623afb
3 changed files with 1577 additions and 0 deletions

View File

@ -0,0 +1,76 @@
import request from '@/utils/request'
//获取设备编码列表
export function GetMaCodeSelectApi(query) {
return request({
url: '/material/equipmentToRepair/getMaCodeSelect',
method: 'get',
params: query
})
}
//获取维保列表
export function getEquipmentListApi(query) {
return request({
url: '/material/equipmentToRepair/getEquipmentList',
method: 'get',
params: query
})
}
//机具设备管理--新增
export function submitEquipmentApiNew(data) {
return request({
url: '/material/equipmentToRepair/submitEquipment',
method: 'post',
contentType: 'application/json',
data: data
})
}
//机具设备管理--获取维保详细信息
export function getEquipmentInfo(params) {
return request({
url: '/material/equipmentToRepair/getEquipmentInfo',
method: 'get',
params
})
}
//机具设备管理--编辑
export function editEquipmentApiNew(data) {
return request({
url: '/material/equipmentToRepair/editEquipmentInfo',
method: 'post',
contentType: 'application/json',
data: data
})
}
// 获取 设备树
export function getDeviceTypeTreeTwo(params) {
return request({
url: '/material/select/getDeviceTypeTreeTwo',
method: 'get',
params,
})
}
//提交
export function submitStatusNew(data) {
return request({
url: '/material/equipmentToRepair/submitStatusNew',
method: 'post',
contentType: 'application/json',
data: data
})
}
// 设备维修保养记录表
export function getMaintenanceEquipmentApi(query) {
return request({
url: '/material/equipmentToRepair/getMaintenanceEquipment',
method: 'get',
params: query
})
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,484 @@
<template>
<div class="app-container" >
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="机具名称" prop="typeName">
<el-input
v-model="queryParams.typeName"
placeholder="请输入机具名称"
clearable
:maxlength="20"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规格型号" prop="typeModelName">
<el-input
v-model="queryParams.typeModelName"
placeholder="请输入规格型号"
clearable
:maxlength="20"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="维保状态" prop="repairStatus">
<el-select
v-model="queryParams.repairStatus"
placeholder="请选择维保状态"
clearable
filterable
style="width: 240px"
>
<el-option label="待提交" value="0" />
<el-option label="已提交" value="1" />
</el-select>
</el-form-item>
<el-form-item label="维保时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
>新增维保</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" :disabled="multiple" @click="handleSubmit"
>提交</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange" border>
<el-table-column type="selection" width="55" align="center" :selectable="selectable" />
<el-table-column
label="序号"
align="center"
width="80"
type="index"
:index="indexContinuation(queryParams.pageNum, queryParams.pageSize)"
>
<!-- <template slot-scope="scope">
<span>{{
(queryParams.pageNum - 1) * 10 + scope.$index + 1
}}</span>
</template> -->
</el-table-column>
<el-table-column label="机具名称" align="center" prop="typeName" show-overflow-tooltip width="150px"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" show-overflow-tooltip width="180px"/>
<el-table-column label="机具编号" align="center" prop="maCode" show-overflow-tooltip width="120px"/>
<el-table-column label="维修数量" align="center" prop="repairNum" show-overflow-tooltip width="100px"/>
<el-table-column label="维修人" align="center" prop="repairer" show-overflow-tooltip />
<el-table-column label="维修时间" align="center" prop="repairTime" show-overflow-tooltip />
<el-table-column label="维保状态" align="center" prop="repairStatus" show-overflow-tooltip >
<template slot-scope="scope">
<span v-if="scope.row.repairStatus === 1">
<el-tag type="success">
已提交
</el-tag>
</span>
<span v-if="scope.row.repairStatus === 0">
<el-tag type="warning">
待提交
</el-tag>
</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="250px" >
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handleSee(scope.row, 'see')"
>查看</el-button
>
<!-- -->
<el-button
size="mini"
type="text"
icon="el-icon-circle-check"
v-if="scope.row.repairStatus == 0"
@click="handleUpdate(scope.row, 'update')"
>编辑</el-button
>
<el-button size="mini" type="text" icon="el-icon-document" @click="openUpkeep(scope.row)"
>保养记录表</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<dialogOneForm
:dialogTitle="title"
:isShowFlag.sync="isShowOneFlag"
:priKey="priKey"
:rowObj="rowObj"
@domainChange="domainChange"
></dialogOneForm>
<!-- 维修记录表 -->
<el-dialog title="维修记录表" :visible.sync="upkeepVisible" width="50%">
<vue-easy-print tableShow ref="printRef">
<div style="padding: 0 30px">
<h2 style="text-align: center; font-size: 33px">重庆市送变电工程有限公司</h2>
<h3 style="text-align: center; font-size: 28px">设备维修保养记录表</h3>
<div style="text-align: right;font-size: 20px;margin-bottom: 10px;">维修保养时间{{ upkeepObj.repairTime }}</div>
<div
style="
border: 1px solid #000;
min-height: 820px;
line-height: 1.9;
font-size: 20px;
position: relative;
box-sizing: border-box;
width: 100%;
"
>
<!-- 第一行 -->
<div style="display: flex; border-bottom: 1px solid #000">
<div style="text-align: center; border-right: 1px solid #000; width: 20%">设备名称</div>
<div style="text-align: center; border-right: 1px solid #000; width: 20%">型号</div>
<div style="text-align: center; border-right: 1px solid #000; width: 20%">编号</div>
<div style="text-align: center; border-right: 1px solid #000; width: 10%">数量</div>
<div style="text-align: center; border-right: 1px solid #000; width: 15%">主修人</div>
<div style="text-align: center; width: 15%">验收人</div>
</div>
<!-- 第二行 -->
<div style="display: flex; border-bottom: 1px solid #000">
<div style="text-align: center; border-right: 1px solid #000; width: 20%">{{
upkeepObj.typeName || '-'
}}</div>
<div style="text-align: center; border-right: 1px solid #000; width: 20%">{{
upkeepObj.typeModelName
}}</div>
<div style="text-align: center; border-right: 1px solid #000; width: 20%">{{
upkeepObj.maCode
}}</div>
<!-- <div
style="
text-align: center;
border-right: 1px solid #000;
width: calc(18%);
white-space: pre-wrap;
word-break: break-word;
"
><span style="margin: 0 5px; font-size: 15px">{{ upkeepObj.maCode }}</span></div
> -->
<div style="text-align: center; border-right: 1px solid #000; width: 10%">{{
upkeepObj.repairNum
}}</div>
<div style="text-align: center; border-right: 1px solid #000; width: 15%">{{
upkeepObj.repairerName
}}</div>
<div style="text-align: center; width: 15%">{{ upkeepObj.auditBy }}</div>
</div>
<!-- 第三行 -->
<div style="display: flex; border-bottom: 1px solid #000">
<div style="padding-left: 10px; border-right: 1px solid #000; width: 20%">使用单位</div>
<div style="padding-left: 10px"></div>
</div>
<!-- 第四行 -->
<div style="width: 100%; min-height: 200px; border-bottom: 1px solid #000; padding-left: 10px"
>设备维修前情况: <span>{{ upkeepObj.repairContentBefore }}</span>
</div>
<!-- 第五行 -->
<div style="width: 100%; min-height: 200px; border-bottom: 1px solid #000; padding-left: 10px"
>技术鉴定情况:
<span>{{ upkeepObj.repairRemark }}</span>
</div>
<!-- 第六行 -->
<div style="width: 100%; min-height: 200px; padding-left: 10px"
>维修处理情况:
<span>{{ upkeepObj.repairContent }}</span>
</div>
<div
style="
width: 100%;
border-top: 1px solid #000;
padding-left: 10px;
position: absolute;
bottom: 20px;
left: 0;
"
> 验收情况: {{ upkeepObj.repairStatus === 0 ? '待提交' : '已通过' }}
</div>
</div>
<!-- <div style="text-align: end; font-size: 20px; margin: 20px 50px 50px 0">
<span>{{ getTime(upkeepObj.auditTime) }}</span>
</div> -->
</div>
</vue-easy-print>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="print"> </el-button>
<el-button @click="upkeepVisible = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
getEquipmentListApi,submitStatusNew,getMaintenanceEquipmentApi
} from '@/api/repairTest/equipmentToRepair'
import selectTree from '../repair/selectTree.vue'
import Tree from '@/views/repairTest/repair/tree.vue'
import vueEasyPrint from 'vue-easy-print'
import dialogOneForm from './dialogOneForm.vue'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
name: 'RepairTest/equipmentToRepair',
components: { Tree, selectTree, vueEasyPrint, dialogOneForm,Treeselect },
data() {
return {
uploadUrl: process.env.VUE_APP_BASE_API + '/system/sys/file/upload', //
headers: {
Authorization: 'Bearer ' + localStorage.getItem('token'),
},
//
loading: true,
isShowOneFlag: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
queryParams: {
pageNum: 1,
pageSize: 10,
keyword: '',
repairStatus: '',
typeName: '',
typeModelName: '',
startTime: '',
endTime: '',
},
dateRange: [],
typeList: [],
//
title: '',
total: 0,
//
open: false,
priKey: '',
rowObj: {},
upkeepVisible: false, //
upkeepObj: {},
}
},
created() {
this.getList()
},
methods: {
/** 查询字典类型列表 */
getList() {
this.loading = false
this.queryParams.startTime = this.dateRange[0]
this.queryParams.endTime = this.dateRange[1]
getEquipmentListApi(this.addDateRange(this.queryParams)).then((response) => {
this.typeList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = []
this.queryParams.typeName = ''
this.queryParams.type = ''
this.queryParams.taskStatus = ''
this.resetForm('queryForm')
this.handleQuery()
},
selectable(row) {
if (row.repairStatus == 0) {
return true
} else {
return false
}
},
// id
handleSelectionChange(selection) {
this.selectionList = selection
this.ids = selection.map((item) => item.id)
this.single = selection.length != 1
this.multiple = !selection.length
},
//
handleAdd() {
this.title = '新增维保'
// this.priKey = row.id
this.rowObj = null
this.isShowOneFlag = true
},
//
handleUpdate(row) {
this.title = '编辑维保'
this.priKey = row.id
this.rowObj = row
this.isShowOneFlag = true
},
//
handleSee(row) {
this.title = '查看维保'
this.priKey = row.id
this.rowObj = row
this.isShowOneFlag = true
},
domainChange() {
this.getList()
},
handleSubmit() {
this.$confirm('确定提交吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
submitStatusNew({ids:this.ids}).then((res) => {
this.$message.success('提交成功')
this.getList()
})
})
},
//
openUpkeep(row) {
console.log('🚀 ~ openUpkeep ~ row:', row)
this.upkeepVisible = true
this.getUpkeepList(row.id)
},
//
async getUpkeepList(id) {
try {
const res = await getMaintenanceEquipmentApi({ id })
console.log('🚀 ~ getUpkeepList ~ res:', res)
this.upkeepObj = res.data
} catch (error) {
console.log('🚀 ~ getUpkeepList ~ error:', error)
this.upkeepObj = {}
}
},
// 2025-02-11 14:52:27 --> 2025 2 11
getTime(time) {
if (!time) return ''
let date = new Date(time)
let year = date.getFullYear()
let month = date.getMonth() + 1
let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
return `${year}${month}${day}`
},
// -
print() {
this.$nextTick(() => {
this.$refs.printRef.print()
})
},
},
}
</script>
<style lang="scss" scoped>
.submit_box {
display: flex;
justify-content: flex-start;
align-items: center;
.submit_box_title {
display: flex;
flex-direction: column;
margin-left: 15px;
:first-child {
font-size: 14px;
font-weight: 600;
}
:last-child {
margin-top: 6px;
font-size: 12px;
}
}
}
.submit_box_two {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
margin-left: 40%;
.submit_box_title {
display: flex;
flex-direction: column;
margin-left: 10px;
font-size: 18px;
font-weight: 600;
}
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 70px !important;
margin-bottom: 6px;
}
.dialog-footer-btn {
display: flex;
align-items: center;
justify-content: flex-end;
}
.submit_box_openFour {
display: flex;
justify-content: center;
align-content: center;
font-size: 18px;
}
</style>