This commit is contained in:
gtz 2022-08-15 17:12:13 +08:00
parent d221b5ebeb
commit a551d6e61b
6 changed files with 104 additions and 19 deletions

View File

@ -53,6 +53,15 @@ export const eqList = data => {
})
}
// 获取巡检项目列表
export const itemList = data => {
return request({
url: '/api/equipment/inspectionItem/list',
method: 'POST',
data
})
}
// 获取设备信息
export const getEqInfo = data => {
return request({
@ -72,7 +81,7 @@ export const getEqInsItemList = data => {
})
}
// 获取巡检内容列表
// 获取巡检项目列表
export const getInsList = data => {
return request({
url: '/api/equipment/equipmentinspection-inspectionitem/list',
@ -81,7 +90,7 @@ export const getInsList = data => {
})
}
// 根据设备获取巡检内容列表
// 根据设备获取巡检项目列表
export const getEqInsList = data => {
return request({
url: '/api/equipment/inspectionItem/list-WithEQ',
@ -90,7 +99,7 @@ export const getEqInsList = data => {
})
}
// 更新巡检内容完成状态
// 更新巡检项目完成状态
export const updateInsStatus = data => {
return request({
url: '/api/equipment/equipmentinspection-inspectionitem/update',
@ -99,7 +108,7 @@ export const updateInsStatus = data => {
})
}
// 获取巡检内容详情
// 获取巡检项目详情
export const detailIns = data => {
return request({
url: '/api/equipment/equipmentinspection-inspectionitem/get',
@ -108,7 +117,7 @@ export const detailIns = data => {
})
}
// 更新巡检内容详情
// 更新巡检项目详情
export const updateIns = data => {
return request({
url: '/api/equipment/equipmentinspection-inspectionitem/update',

View File

@ -179,3 +179,11 @@ export default {
}
}
</style>
<style lang="scss">
.dh-field {
.van-cell__title, .van-picker__confirm, .van-picker__cancel {
font-size: .36rem;
}
}
</style>

View File

@ -24,7 +24,7 @@
<van-row class="eq-field-item">
<van-col :span="12" class="eq-field-item-lable">
<short-line />
巡检内容
巡检项目
</van-col>
<van-col :span="11" style="text-align: right">
{{ dataForm.inspectionContent }}
@ -33,7 +33,7 @@
<van-row class="eq-field-item">
<van-col :span="12" class="eq-field-item-lable">
<short-line />
巡检内容编码
巡检项目编码
</van-col>
<van-col :span="11" style="text-align: right">
{{ dataForm.inspectionItem }}

View File

@ -29,7 +29,6 @@
<van-col :span="15" :offset="1" class="eq-field-item-input">
<van-field
v-model="dataForm.equipmentName"
ref="eqCodeInput"
class="canInput"
disabled
/>
@ -43,7 +42,6 @@
<van-col :span="15" :offset="1" class="eq-field-item-input">
<van-field
v-model="dataForm.inspectionWorker"
ref="eqCodeInput"
clearable
placeholder="填写巡检人员以逗号隔开"
/>
@ -57,7 +55,6 @@
<van-col :span="15" :offset="1" class="eq-field-item-input">
<van-field
v-model="insTime"
ref="eqCodeInput"
clearable
clear-trigger="always"
disabled
@ -67,12 +64,28 @@
/>
</van-col>
</van-row>
<van-row class="eq-field-item" v-if="!eqId">
<van-col :span="7" class="eq-field-item-lable">
<short-line />
巡检项目
</van-col>
<van-col :span="15" :offset="1" class="eq-field-item-input">
<van-field
v-model="itemShow"
class="canInput"
clearable
disabled
placeholder="请选择巡检项目"
@click="handleItem"
/>
</van-col>
</van-row>
</div>
<div class="eq-main-edit-neirong-item" v-if="eqId">
<van-row class="eq-field-item">
<van-col :span="7" class="eq-field-item-lable">
<short-line />
巡检内容
巡检项目
</van-col>
<van-col :span="15" :offset="1" />
<template v-if="insList && insList.length">
@ -151,20 +164,32 @@
@cancel="show = false; dateType = 0"
/>
</van-popup>
<van-popup v-model="showItem" position="bottom">
<van-field-check-box
title="选择巡检项目"
show-toolbar
ref="worker-picker"
:columns="showList"
:select-value="dataForm.itemList"
@confirm="setItem"
@cancel="showItem = false"
/>
</van-popup>
</div>
</template>
<script>
import moment from 'moment'
import { detail, eqList, getInsList, updateInsStatus, add, update } from '@/api/eqInspection'
import { detail, eqList, itemList, getInsList, updateInsStatus, add, update } from '@/api/eqInspection'
import { uploadFile, downloadFile } from '@/api/file'
import { blobToBase64 } from '@/util/utils'
import shortLine from '@/components/shortLine.vue'
import VanFieldCheckBox from '@/components/VanFieldCheckBox'
import { Toast } from 'vant'
export default {
name: 'eqInspectionEdit',
components: { shortLine },
components: { shortLine, VanFieldCheckBox },
data () {
return {
eqList: [],
@ -177,36 +202,52 @@ export default {
inspectionWorker: null,
inspectionEndTime: null,
inspectionStartTime: null,
source: 3
source: 3,
itemList: []
},
itemList: [],
itemObj: {},
itemShow: null,
insList: [],
insTime: null,
fileList: [],
eqId: null,
show: false,
showItem: false,
currentDate: null,
minDate: new Date(2020, 0, 1),
dateType: 0
}
},
computed: {
showList: function () {
return this.itemList.map(item => {
return { label: item.inspectionItem, value: item.id }
})
}
},
mounted () {
if (this.$route.query.equipmentName) {
this.dataForm.equipmentName = this.$route.query.equipmentName
}
this.getEqList()
if (!(this.$route.query.id)) {
this.getItemList()
}
},
methods: {
//
onClickLeft () {
this.$router.goBack()
},
//
async getEqList () {
const result = await eqList({
current: 1,
size: 999
})
if (result.success) {
this.eqList = result.data.records
this.eqList = result.data
if (this.$route.query.id) {
this.getDetail()
} else {
@ -214,6 +255,20 @@ export default {
}
}
},
//
async getItemList () {
const result = await itemList({
current: 1,
size: 999,
type: 1
})
if (result.success) {
this.itemList = result.data
result.data.map(item => {
this.itemObj[item.id] = item.inspectionItem
})
}
},
//
async getDetail () {
this.eqId = this.$route.query.id
@ -268,7 +323,7 @@ export default {
oversize () {
this.$toast.fail('文件不能超过10M')
},
//
//
async updateStatus (item) {
const result = await updateInsStatus({
id: item.id,
@ -302,6 +357,20 @@ export default {
handleDate () {
this.show = true
},
//
handleItem () {
this.showItem = true
},
//
setItem (v) {
if (v && v.length) {
this.dataForm.itemList = v
this.itemShow = v.map(item => {
return this.itemObj[item]
}).join(',')
this.showItem = false
}
},
//
async handleSubmit () {
let result = {}
@ -321,7 +390,7 @@ export default {
})
}
},
//
//
toInsDetail (item) {
this.$router.push({
name: 'eqInspectionDetail',

View File

@ -11,7 +11,6 @@
<van-field-check-box
title="选择操作员"
show-toolbar
ref="worker-picker"
:columns="showList"
:select-value="defaultValue"
@confirm="onConfirm"

View File

@ -40,7 +40,7 @@ service.interceptors.request.use((config) => {
// 线上版本
// config.url = 'http://hfxny.mes.picaiba.com' + config.url
// 本地版本
config.url = 'http://192.168.0.88' + config.url
// config.url = 'http://192.168.0.88' + config.url
// ***************
if (config.formState) {