This commit is contained in:
gtz217 2022-08-02 07:28:08 +08:00
parent afa557a520
commit b0a5be471b
5 changed files with 143 additions and 11 deletions

View File

@ -53,3 +53,30 @@ export const getEqInsItemList = data => {
data data
}) })
} }
// 获取巡检内容列表
export const getInsList = data => {
return request({
url: '/api/equipment/equipmentinspection-inspectionitem/list',
method: 'POST',
data
})
}
// 根据设备获取巡检内容列表
export const getEqInsList = data => {
return request({
url: '/api/equipment/inspectionItem/list-WithEQ',
method: 'POST',
data
})
}
// 更新巡检内容完成状态
export const updateInsStatus = data => {
return request({
url: '/api/equipment/equipmentinspection-inspectionitem/update',
method: 'POST',
data
})
}

11
src/api/file.js Normal file
View File

@ -0,0 +1,11 @@
import request from '@/util/request'
// 文件上传
export const uploadFile = data => {
return request({
url: '/api/common/attachment/uploadFileFormData',
method: 'POST',
file: true,
data
})
}

View File

@ -19,9 +19,9 @@ import './assets/css/iconfont.css'
import './components/' import './components/'
import store from '@/store' import store from '@/store'
import { Button, Field, Icon, Dialog, Grid, GridItem, NavBar, Popup, Row, Col, Stepper, Picker, DatetimePicker, PullRefresh, Cell, CellGroup, Tag, Checkbox, CheckboxGroup, Tab, Tabs, Sticky, Calendar, Uploader } from 'vant' import { Button, Field, Icon, Dialog, Grid, GridItem, NavBar, Popup, Row, Col, Stepper, Picker, DatetimePicker, PullRefresh, Cell, CellGroup, Tag, Checkbox, CheckboxGroup, Tab, Tabs, Sticky, Calendar, Uploader, SwipeCell, Radio, RadioGroup } from 'vant'
Vue.use(Button).use(Field).use(Icon).use(Dialog).use(Grid).use(GridItem).use(NavBar).use(Popup).use(Row).use(Col).use(Stepper).use(Picker).use(DatetimePicker).use(PullRefresh).use(Cell).use(CellGroup).use(Tag).use(Checkbox).use(CheckboxGroup).use(Tab).use(Tabs).use(Sticky).use(Calendar).use(Uploader) Vue.use(Button).use(Field).use(Icon).use(Dialog).use(Grid).use(GridItem).use(NavBar).use(Popup).use(Row).use(Col).use(Stepper).use(Picker).use(DatetimePicker).use(PullRefresh).use(Cell).use(CellGroup).use(Tag).use(Checkbox).use(CheckboxGroup).use(Tab).use(Tabs).use(Sticky).use(Calendar).use(Uploader).use(SwipeCell).use(Radio).use(RadioGroup)
Vue.config.productionTip = false Vue.config.productionTip = false
fastClick.attach(document.body) fastClick.attach(document.body)

View File

@ -73,7 +73,8 @@ export default {
this.$router.push({ this.$router.push({
name: 'eqInspectionEdit', name: 'eqInspectionEdit',
query: { query: {
equipmentId: result.data.id equipmentId: result.data.id,
equipmentName: result.data.name
} }
}) })
} }

View File

@ -28,7 +28,7 @@
</van-col> </van-col>
<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.equipmentId" v-model="dataForm.equipmentName"
ref="eqCodeInput" ref="eqCodeInput"
disabled disabled
/> />
@ -65,6 +65,30 @@
</van-col> </van-col>
</van-row> </van-row>
</div> </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" />
<van-col :span="24" v-for="item in insList" :key="item.id" class="eq-main-edit-neirong-item-item">
<van-swipe-cell>
<van-cell :border="false" :title="item.inspectionItem" :label="item.inspectionContent">
<template #right-icon>
<van-checkbox v-model="item.statusBoolean" @change="updateStatus(item)" />
</template>
</van-cell>
<template #right>
<van-button square>
<van-icon name="add-o" />
<div>编辑详情</div>
</van-button>
</template>
</van-swipe-cell>
</van-col>
</van-row>
</div>
<div class="eq-main-edit-item"> <div class="eq-main-edit-item">
<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">
@ -92,7 +116,7 @@
v-model="fileList" v-model="fileList"
:max-count="1" :max-count="1"
accept=".doc,.docx,.xls,.xlsx,.pdf,image/*" accept=".doc,.docx,.xls,.xlsx,.pdf,image/*"
:after-read="uploadFile" :after-read="upload"
/> />
</van-col> </van-col>
</van-row> </van-row>
@ -102,9 +126,10 @@
</template> </template>
<script> <script>
import { detail, eqList } from '@/api/eqInspection' import { detail, eqList, getInsList, updateInsStatus } from '@/api/eqInspection'
// , getEqInsItemList import { uploadFile } from '@/api/file'
import shortLine from '@/components/shortLine.vue' import shortLine from '@/components/shortLine.vue'
import { Toast } from 'vant'
export default { export default {
name: 'eqInspectionEdit', name: 'eqInspectionEdit',
@ -116,16 +141,22 @@ export default {
id: null, id: null,
annexUrl: null, annexUrl: null,
equipmentId: null, equipmentId: null,
equipmentName: null,
inspectionDesc: null, inspectionDesc: null,
inspectionWorker: null, inspectionWorker: null,
inspectionEndTime: null, inspectionEndTime: null,
inspectionStartTime: null inspectionStartTime: null
}, },
insList: [],
insTime: null, insTime: null,
fileList: [] fileList: [],
eqId: null
} }
}, },
mounted () { mounted () {
if (this.$route.query.equipmentName) {
this.dataForm.equipmentName = this.$route.query.equipmentName
}
this.getEqList() this.getEqList()
}, },
methods: { methods: {
@ -149,17 +180,46 @@ export default {
}, },
// //
async getDetail () { async getDetail () {
this.eqId = this.$route.query.id
const result = await detail({ const result = await detail({
id: this.$route.query.id id: this.$route.query.id
}) })
if (result.success) { if (result.success) {
this.dataForm = result.data this.dataForm = result.data
console.log(result) const result1 = await getInsList({
equipmentInspectionId: this.$route.query.id
})
if (result1.success) {
this.insList = result1.data.map(item => {
item.statusBoolean = item.status === '1' ? true : false
return item
})
}
} }
}, },
// //
uploadFile (file) { async upload (file) {
console.log(file) const data = new FormData()
data.append('files', file.file)
data.append('typeCode', 'file')
setTimeout(async () => {
const result = await uploadFile(data)
}, 1000)
},
//
async updateStatus (item) {
console.log(item)
const result = await updateInsStatus({
id: item.id,
status: item.statusBoolean ? '1' : '0'
})
if (result.success) {
Toast.success({
message: '更新成功'
})
} else {
item.statusBoolean = !item.statusBoolean
}
} }
} }
} }
@ -247,6 +307,39 @@ export default {
} }
} }
} }
.eq-main-edit-neirong-item {
background: #fff;
padding-bottom: .25rem;
margin-bottom: .25rem;
.eq-field-item {
padding-top: .25rem;
line-height: .875rem;
.eq-field-item-lable {
text-indent: .375rem;
font-size: .375rem;
}
.eq-main-edit-neirong-item-item {
border-bottom: 1px solid #F6F6F6;
.van-cell__title {
font-size: .3125rem;
}
.van-cell__label {
font-size: .3125rem;
}
.van-button {
height: 100%;
border: 0;
background: #42D1A5;
color: #fff;
font-size: .3125rem;
.van-icon {
font-size: .5rem;
margin-bottom: .1rem;
}
}
}
}
}
} }
} }
</style> </style>