上传多张照片
This commit is contained in:
@@ -480,12 +480,7 @@ export const errorType = (row) => post('api/pda/sb/errorType', {})
|
|||||||
// 1.6故障等级
|
// 1.6故障等级
|
||||||
export const errorLevel = (row) => post('api/pda/sb/errorLevel', {})
|
export const errorLevel = (row) => post('api/pda/sb/errorLevel', {})
|
||||||
// 1.7报修
|
// 1.7报修
|
||||||
export const repairs = (code, id, desc, level) => post('api/pda/sb/repairs', {
|
export const repairs = (data) => post2('api/pda/sb/repairs', data)
|
||||||
device_code: code,
|
|
||||||
device_faultclass_id: id,
|
|
||||||
fault_desc: desc,
|
|
||||||
fault_level: level
|
|
||||||
})
|
|
||||||
// 1.8查询设备维修执行
|
// 1.8查询设备维修执行
|
||||||
export const queryRepairs = (code, mflag) => post('api/pda/sb/queryRepairs', {
|
export const queryRepairs = (code, mflag) => post('api/pda/sb/queryRepairs', {
|
||||||
device_code: code,
|
device_code: code,
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
<nav-bar :inner="true" title="拍照"></nav-bar>
|
<nav-bar :inner="true" title="拍照"></nav-bar>
|
||||||
<section class="content mgt186">
|
<section class="content mgt186">
|
||||||
<div class="image_wraper">
|
<div class="image_wraper">
|
||||||
<div class="li_box img_box">
|
<div v-for="e in photos" class="li_box img_box relative" :key='e.num'>
|
||||||
<img>
|
<img :src="e.data">
|
||||||
|
<div class="iconfont error_icon" @click="delPhoto(e)"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="li_box iconfont add_pict_icon relative">
|
<div class="li_box iconfont add_pict_icon relative">
|
||||||
<input
|
<input
|
||||||
@@ -16,36 +17,15 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="image_wraper">
|
|
||||||
<div class="image_wraper_i">
|
|
||||||
<img v-show="unimgsrc === ''" src="../../../images/xinrui/nopict.svg">
|
|
||||||
<img v-show="unimgsrc !== ''" id="imgshow">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
<section class="submit-bar">
|
<section class="submit-bar">
|
||||||
<button class="btn submit-button" :class="{'btn-disabled': formData === ''}" :disabled="disabled" @click="_uploadPict">确认</button>
|
<button class="btn submit-button" @click="toSure">确认</button>
|
||||||
<button class="btn submit-button" @click="handleDelImg">取消</button>
|
|
||||||
<div class="btn submit-button relative">
|
|
||||||
上传
|
|
||||||
<input
|
|
||||||
type='file'
|
|
||||||
id='H5moreUp'
|
|
||||||
ref='H5moreUp'
|
|
||||||
accept='image/*'
|
|
||||||
@change="loadImg"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import NavBar from '@components/NavBar.vue'
|
import NavBar from '@components/NavBar.vue'
|
||||||
import {uploadPict, rawmaterialSava} from '@config/getData2.js'
|
|
||||||
// import {rawmaterialSava} from '@config/getData2.js'
|
|
||||||
// import axios from 'axios'
|
|
||||||
// import qs from 'qs'
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UploadPicts',
|
name: 'UploadPicts',
|
||||||
components: {
|
components: {
|
||||||
@@ -53,11 +33,8 @@ export default {
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
upImgUrl: '',
|
photos: [],
|
||||||
unimgsrc: '',
|
num: 0
|
||||||
formData: '',
|
|
||||||
disabled: false,
|
|
||||||
result: {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -71,65 +48,21 @@ export default {
|
|||||||
// 为文件读取成功设置事件
|
// 为文件读取成功设置事件
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
imgFile = e.target.result
|
imgFile = e.target.result
|
||||||
document.getElementById('imgshow').setAttribute('src', imgFile)
|
this.num = this.num + 1
|
||||||
this.unimgsrc = imgFile
|
let obj = {data: imgFile, file: file, num: this.num, photo: file.name}
|
||||||
|
this.photos.push(obj)
|
||||||
}
|
}
|
||||||
// 正式读取文件
|
// 正式读取文件
|
||||||
reader.readAsDataURL(file)
|
reader.readAsDataURL(file)
|
||||||
this.formData = new FormData()
|
|
||||||
this.formData.append('file', file)
|
|
||||||
this.formData.append('user', 'laotie')
|
|
||||||
},
|
},
|
||||||
async _uploadPict () {
|
delPhoto (e) {
|
||||||
this.disabled = true
|
this.photos = this.photos.filter(el => (el.num !== e.num))
|
||||||
if (this.formData === '') {
|
|
||||||
this.disabled = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// let uploadUrl = this.$store.getters.imgip + '/api/localStorage/pictures/'
|
|
||||||
// axios.post(this.$store.getters.imgip + '/api/localStorage/pictures/', this.formData, {
|
|
||||||
// Headers: {
|
|
||||||
// 'Content-type': 'application/x-www-form-urlencoded'
|
|
||||||
// }
|
|
||||||
// }).then(res => {
|
|
||||||
// if (res.code === '1') {
|
|
||||||
// this.toast(res.desc)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
try {
|
|
||||||
let data = {
|
|
||||||
'formData': this.formData,
|
|
||||||
'flag': true
|
|
||||||
}
|
|
||||||
let res = await uploadPict(data)
|
|
||||||
if (res.code === '1') {
|
|
||||||
// this.upImgUrl = uploadUrl + res.result.path
|
|
||||||
this.toast(res.desc)
|
|
||||||
this.result = res.result
|
|
||||||
// this.formData = ''
|
|
||||||
this._rawmaterialSava()
|
|
||||||
} else {
|
|
||||||
this.Dialog(res.desc)
|
|
||||||
}
|
|
||||||
this.disabled = false
|
|
||||||
} catch (e) {
|
|
||||||
this.disabled = false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async _rawmaterialSava () {
|
toSure () {
|
||||||
let obj = this.$store.getters.materObj !== '' ? Object.assign({}, this.$store.getters.materObj, this.result, {business_type: '01'}) : Object.assign({}, this.result, {business_type: '01'})
|
if (this.photos.length) {
|
||||||
let res = await rawmaterialSava(obj)
|
this.$store.dispatch('receivePlateArr', this.photos)
|
||||||
if (res.code === '1') {
|
|
||||||
this.$router.back()
|
|
||||||
} else {
|
|
||||||
this.Dialog(res.desc)
|
|
||||||
}
|
}
|
||||||
},
|
this.$router.back()
|
||||||
handleDelImg () {
|
|
||||||
this.unimgsrc = ''
|
|
||||||
this.formData = ''
|
|
||||||
this.$refs.H5moreUp.value = ''
|
|
||||||
document.getElementById('imgshow').removeAttribute('src')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,23 +70,28 @@ export default {
|
|||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
@import '~@style/mixin'
|
@import '~@style/mixin'
|
||||||
// >>>.content
|
|
||||||
// height calc(100% - 2rem)
|
|
||||||
.image_wraper
|
.image_wraper
|
||||||
width 100%
|
width 100%
|
||||||
padding-top .5rem
|
padding-top .5rem
|
||||||
.li_box
|
.li_box
|
||||||
|
_fj(center)
|
||||||
float left
|
float left
|
||||||
width 30%
|
_wh(2rem, 2rem)
|
||||||
.image_wraper_i
|
border .03rem dashed #c9c9c9
|
||||||
position relative
|
border-radius 3px
|
||||||
_wh(100%, 100%)
|
margin-bottom .2rem
|
||||||
overflow-y auto
|
overflow hidden
|
||||||
z-index 99
|
|
||||||
img
|
img
|
||||||
_wh(100%, auto)
|
_wh(100%, auto)
|
||||||
z-index 99
|
&:nth-child(3n+2)
|
||||||
border-radius .1rem
|
margin 0 calc((100% - 6rem) / 2)
|
||||||
|
.error_icon
|
||||||
|
position absolute
|
||||||
|
top .01rem
|
||||||
|
right .01rem
|
||||||
|
_wh(.5rem, .5rem)
|
||||||
|
line-height .5rem
|
||||||
|
background-color rgba(0,0,0,.7)
|
||||||
#H5moreUp
|
#H5moreUp
|
||||||
position absolute
|
position absolute
|
||||||
top 0
|
top 0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<section>
|
<section>
|
||||||
<nav-bar :inner="true" title="设备报修"></nav-bar>
|
<nav-bar title="设备报修"></nav-bar>
|
||||||
<section class="content mgt186">
|
<section class="content mgt186">
|
||||||
<div class="filter-wraper">
|
<div class="filter-wraper">
|
||||||
<search-box
|
<search-box
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<th>图片编号</th>
|
<th>图片编号</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-for="(e, i) in dataList" :key="i">
|
<tr v-for="(e, i) in dataList" :key="i">
|
||||||
<td>{{e.workorder_code}}</td>
|
<td>{{e.photo}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -93,15 +93,14 @@ export default {
|
|||||||
val2: '',
|
val2: '',
|
||||||
val3: '',
|
val3: '',
|
||||||
dataList: [],
|
dataList: [],
|
||||||
pkId: '',
|
|
||||||
pkObj: {},
|
|
||||||
option1: [],
|
option1: [],
|
||||||
active1: '',
|
active1: '',
|
||||||
open1: false,
|
open1: false,
|
||||||
option2: [],
|
option2: [],
|
||||||
active2: '',
|
active2: '',
|
||||||
open2: false,
|
open2: false,
|
||||||
disabled1: false
|
disabled1: false,
|
||||||
|
formData: new FormData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeRouteLeave (to, from, next) {
|
beforeRouteLeave (to, from, next) {
|
||||||
@@ -110,7 +109,14 @@ export default {
|
|||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
activated () {},
|
activated () {
|
||||||
|
if (this.$store.getters.receivePlateArr.length) {
|
||||||
|
this.dataList = this.$store.getters.receivePlateArr
|
||||||
|
this.dataList.map(el => {
|
||||||
|
this.formData.append('file', el.file)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
created () {
|
created () {
|
||||||
this._errorType()
|
this._errorType()
|
||||||
this._errorLevel()
|
this._errorLevel()
|
||||||
@@ -144,7 +150,15 @@ export default {
|
|||||||
try {
|
try {
|
||||||
let type = this.active1 !== '' ? this.option1[this.active1].value : ''
|
let type = this.active1 !== '' ? this.option1[this.active1].value : ''
|
||||||
let level = this.active2 !== '' ? this.option2[this.active2].value : ''
|
let level = this.active2 !== '' ? this.option2[this.active2].value : ''
|
||||||
let res = await repairs(this.val1, type, this.val2, level)
|
this.formData.append('device_code', this.val1)
|
||||||
|
this.formData.append('device_faultclass_id', type)
|
||||||
|
this.formData.append('fault_desc', this.val2)
|
||||||
|
this.formData.append('fault_level', level)
|
||||||
|
let data = {
|
||||||
|
'formData': this.formData,
|
||||||
|
'flag': true
|
||||||
|
}
|
||||||
|
let res = await repairs(data)
|
||||||
if (res.code === '1') {
|
if (res.code === '1') {
|
||||||
this.toast(res.desc)
|
this.toast(res.desc)
|
||||||
Object.assign(this.$data, this.$options.data())
|
Object.assign(this.$data, this.$options.data())
|
||||||
@@ -164,10 +178,6 @@ export default {
|
|||||||
query: {url: 'EquipRepair'}
|
query: {url: 'EquipRepair'}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toCheck (e) {
|
|
||||||
this.pkId = this.pkId === e.worktask_id ? '' : e.worktask_id
|
|
||||||
this.pkObj = this.pkId === e.worktask_id ? e : {}
|
|
||||||
},
|
|
||||||
toggleItem1 () {
|
toggleItem1 () {
|
||||||
if (!this.open1) {
|
if (!this.open1) {
|
||||||
this.open1 = true
|
this.open1 = true
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
label="设备"
|
label="设备"
|
||||||
v-model="val1"
|
v-model="val1"
|
||||||
@handleChange="handleChange1"
|
@handleChange="handleChange1"
|
||||||
:seaShow="false"
|
|
||||||
></search-box>
|
></search-box>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-wraper">
|
<div class="grid-wraper">
|
||||||
|
|||||||
@@ -72,9 +72,7 @@ export default {
|
|||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
activated () {
|
activated () {},
|
||||||
this._queryMaintenance(this.val1)
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
handleChange1 (e, type) {
|
handleChange1 (e, type) {
|
||||||
if (type) {
|
if (type) {
|
||||||
@@ -88,8 +86,8 @@ export default {
|
|||||||
/** 设备查询 */
|
/** 设备查询 */
|
||||||
async _queryMaintenance (e) {
|
async _queryMaintenance (e) {
|
||||||
let res = await queryMaintenance(e, '1')
|
let res = await queryMaintenance(e, '1')
|
||||||
if (res.code === '1') {
|
if (res.code === '1' && res.rows !== null) {
|
||||||
this.dataList = [...res.content.rows]
|
this.dataList = [...res.rows]
|
||||||
} else {
|
} else {
|
||||||
this.Dialog(res.desc)
|
this.Dialog(res.desc)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,11 +126,10 @@
|
|||||||
.add_pict_icon
|
.add_pict_icon
|
||||||
width 2rem
|
width 2rem
|
||||||
height 2rem
|
height 2rem
|
||||||
font-size 1rem
|
font-size .6rem
|
||||||
line-height 2rem
|
line-height 2rem
|
||||||
color #c9c9c9
|
color #c9c9c9
|
||||||
text-align center
|
text-align center
|
||||||
border: .03rem dashed
|
|
||||||
overflow hidden
|
overflow hidden
|
||||||
.add_pict_icon::before
|
.add_pict_icon::before
|
||||||
content: '\e653'
|
content: '\e653'
|
||||||
Reference in New Issue
Block a user