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

View File

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

View File

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

View File

@ -11,7 +11,6 @@
<van-field-check-box <van-field-check-box
title="选择操作员" title="选择操作员"
show-toolbar show-toolbar
ref="worker-picker"
:columns="showList" :columns="showList"
:select-value="defaultValue" :select-value="defaultValue"
@confirm="onConfirm" @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://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) { if (config.formState) {