upload
This commit is contained in:
@@ -26,6 +26,10 @@
|
||||
<div class="menu-col fxrow" @click="goInner('/EquipRepair')"><p class="fxcol">设备报修</p></div>
|
||||
<div class="menu-col fxrow" @click="goInner('/EquipRepairExecute')"><p class="fxcol">设备维修执行</p></div>
|
||||
<div class="menu-col fxrow" @click="goInner('/EquipRepairConfirm')"><p class="fxcol">设备维修确认</p></div>
|
||||
<div class="menu-col fxrow" @click="goInner('/SparePartInstore')"><p class="fxcol">备件入库</p></div>
|
||||
<div class="menu-col fxrow" @click="goInner('/SparePartOutstore')"><p class="fxcol">备件出库</p></div>
|
||||
<div class="menu-col fxrow" @click="goInner('/UseReturn')"><p class="fxcol">领用还回</p></div>
|
||||
<div class="menu-col fxrow" @click="goInner('/RunLogFill')"><p class="fxcol">运行记录填报</p></div>
|
||||
<!-- <div class="menu-col fxrow" @click="goInner('/ProcessMakePowder')"><p class="fxcol">配粉工序</p></div>
|
||||
<div class="menu-col fxrow" @click="goInner('/ProcessGrindBall')"><p class="fxcol">球磨工序</p></div>
|
||||
<div class="menu-col fxrow" @click="goInner('/ProcessSpray')"><p class="fxcol">喷雾工序</p></div>
|
||||
@@ -129,7 +133,7 @@ export default {
|
||||
},
|
||||
toPage2 (e) {
|
||||
let name = e.path.substr(2)
|
||||
if (name === 'ProcedureInspection' || name === 'SoftWasteBarrelPrint' || name === 'NewMaterInStoreGroup' || name === 'SoftWasteInStoreGroup' || name === 'FinishProdBarrelPrint' || name === 'ChengPinBarrelPrint' || name === 'BarrelBagUpdate' || name === 'ReworkBarrelPrint' || name === 'SoftWasteBagPrint' || name === 'ChaipanManage' || name === 'RawMaterCheck' || name === 'ProductInstore' || name === 'PeifenOutStore' || name === 'ReturnMaterOutStore' || name === 'OtherOutStore' || name === 'CheckOutStore' || name === 'SaleOutStore' || name === 'SoftWasteCleanOutStore' || name === 'CleaningGroupBarrel' || name === 'PeifenBarrelPrint' || name === 'AbnormalBarrelPrint' || name === 'SoftWasteCleanInStore' || name === 'ProcessMakePowder' || name === 'ProcessGrindBall' || name === 'ProcessSpray' || name === 'ProcessMix' || name === 'ProcessDry' || name === 'ProcessSeDry' || name === 'ProcessChuimo' || name === 'ProcessYatuan' || name === 'ProcessGranulation' || name === 'ProcessWipe' || name === 'MaintainExecution' || name === 'MaintainConfirm' || name === 'EquipRepair' || name === 'EquipRepairExecute' || name === 'EquipRepairConfirm') {
|
||||
if (name === 'ProcedureInspection' || name === 'SoftWasteBarrelPrint' || name === 'NewMaterInStoreGroup' || name === 'SoftWasteInStoreGroup' || name === 'FinishProdBarrelPrint' || name === 'ChengPinBarrelPrint' || name === 'BarrelBagUpdate' || name === 'ReworkBarrelPrint' || name === 'SoftWasteBagPrint' || name === 'ChaipanManage' || name === 'RawMaterCheck' || name === 'ProductInstore' || name === 'PeifenOutStore' || name === 'ReturnMaterOutStore' || name === 'OtherOutStore' || name === 'CheckOutStore' || name === 'SaleOutStore' || name === 'SoftWasteCleanOutStore' || name === 'CleaningGroupBarrel' || name === 'PeifenBarrelPrint' || name === 'AbnormalBarrelPrint' || name === 'SoftWasteCleanInStore' || name === 'ProcessMakePowder' || name === 'ProcessGrindBall' || name === 'ProcessSpray' || name === 'ProcessMix' || name === 'ProcessDry' || name === 'ProcessSeDry' || name === 'ProcessChuimo' || name === 'ProcessYatuan' || name === 'ProcessGranulation' || name === 'ProcessWipe' || name === 'MaintainExecution' || name === 'MaintainConfirm' || name === 'EquipRepair' || name === 'EquipRepairExecute' || name === 'EquipRepairConfirm' || name === 'SparePartInstore' || name === 'SparePartOutstore' || name === 'UseReturn' || name === 'RunLogFill') {
|
||||
this.$store.dispatch('setKeepAlive', [name])
|
||||
}
|
||||
this.$router.push(e.path.substr(2))
|
||||
@@ -149,7 +153,7 @@ export default {
|
||||
},
|
||||
goInner (path) {
|
||||
let name = path.substr(1)
|
||||
if (name === 'ProcedureInspection' || name === 'SoftWasteBarrelPrint' || name === 'NewMaterInStoreGroup' || name === 'SoftWasteInStoreGroup' || name === 'FinishProdBarrelPrint' || name === 'ChengPinBarrelPrint' || name === 'BarrelBagUpdate' || name === 'ReworkBarrelPrint' || name === 'SoftWasteBagPrint' || name === 'ChaipanManage' || name === 'RawMaterCheck' || name === 'ProductInstore' || name === 'PeifenOutStore' || name === 'ReturnMaterOutStore' || name === 'OtherOutStore' || name === 'CheckOutStore' || name === 'SaleOutStore' || name === 'SoftWasteCleanOutStore' || name === 'CleaningGroupBarrel' || name === 'PeifenBarrelPrint' || name === 'AbnormalBarrelPrint' || name === 'SoftWasteCleanInStore' || name === 'ProcessMakePowder' || name === 'ProcessGrindBall' || name === 'ProcessSpray' || name === 'ProcessMix' || name === 'ProcessDry' || name === 'ProcessSeDry' || name === 'ProcessChuimo' || name === 'ProcessYatuan' || name === 'ProcessGranulation' || name === 'ProcessWipe' || name === 'MaintainExecution' || name === 'MaintainConfirm' || name === 'EquipRepair' || name === 'EquipRepairExecute' || name === 'EquipRepairConfirm') {
|
||||
if (name === 'ProcedureInspection' || name === 'SoftWasteBarrelPrint' || name === 'NewMaterInStoreGroup' || name === 'SoftWasteInStoreGroup' || name === 'FinishProdBarrelPrint' || name === 'ChengPinBarrelPrint' || name === 'BarrelBagUpdate' || name === 'ReworkBarrelPrint' || name === 'SoftWasteBagPrint' || name === 'ChaipanManage' || name === 'RawMaterCheck' || name === 'ProductInstore' || name === 'PeifenOutStore' || name === 'ReturnMaterOutStore' || name === 'OtherOutStore' || name === 'CheckOutStore' || name === 'SaleOutStore' || name === 'SoftWasteCleanOutStore' || name === 'CleaningGroupBarrel' || name === 'PeifenBarrelPrint' || name === 'AbnormalBarrelPrint' || name === 'SoftWasteCleanInStore' || name === 'ProcessMakePowder' || name === 'ProcessGrindBall' || name === 'ProcessSpray' || name === 'ProcessMix' || name === 'ProcessDry' || name === 'ProcessSeDry' || name === 'ProcessChuimo' || name === 'ProcessYatuan' || name === 'ProcessGranulation' || name === 'ProcessWipe' || name === 'MaintainExecution' || name === 'MaintainConfirm' || name === 'EquipRepair' || name === 'EquipRepairExecute' || name === 'EquipRepairConfirm' || name === 'SparePartInstore' || name === 'SparePartOutstore' || name === 'UseReturn' || name === 'RunLogFill') {
|
||||
this.$store.dispatch('setKeepAlive', [name])
|
||||
}
|
||||
this.$router.push(path)
|
||||
|
||||
164
src/pages/xinrui/common/UploadPicts.vue
Normal file
164
src/pages/xinrui/common/UploadPicts.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<section>
|
||||
<nav-bar :inner="true" title="拍照"></nav-bar>
|
||||
<section class="content mgt186">
|
||||
<div class="image_wraper">
|
||||
<div class="li_box img_box">
|
||||
<img>
|
||||
</div>
|
||||
<div class="li_box iconfont add_pict_icon relative">
|
||||
<input
|
||||
type='file'
|
||||
id='H5moreUp'
|
||||
ref='H5moreUp'
|
||||
accept='image/*'
|
||||
@change="loadImg"
|
||||
/>
|
||||
</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 class="submit-bar">
|
||||
<button class="btn submit-button" :class="{'btn-disabled': formData === ''}" :disabled="disabled" @click="_uploadPict">确认</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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 {
|
||||
name: 'UploadPicts',
|
||||
components: {
|
||||
NavBar
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
upImgUrl: '',
|
||||
unimgsrc: '',
|
||||
formData: '',
|
||||
disabled: false,
|
||||
result: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadImg () {
|
||||
// 获取文件
|
||||
let file = document.getElementById('H5moreUp').files[0]
|
||||
// 创建读取文件的对象
|
||||
let reader = new FileReader()
|
||||
// 创建文件读取相关的变量
|
||||
let imgFile
|
||||
// 为文件读取成功设置事件
|
||||
reader.onload = (e) => {
|
||||
imgFile = e.target.result
|
||||
document.getElementById('imgshow').setAttribute('src', imgFile)
|
||||
this.unimgsrc = imgFile
|
||||
}
|
||||
// 正式读取文件
|
||||
reader.readAsDataURL(file)
|
||||
this.formData = new FormData()
|
||||
this.formData.append('file', file)
|
||||
this.formData.append('user', 'laotie')
|
||||
},
|
||||
async _uploadPict () {
|
||||
this.disabled = true
|
||||
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 () {
|
||||
let obj = this.$store.getters.materObj !== '' ? Object.assign({}, this.$store.getters.materObj, this.result, {business_type: '01'}) : Object.assign({}, this.result, {business_type: '01'})
|
||||
let res = await rawmaterialSava(obj)
|
||||
if (res.code === '1') {
|
||||
this.$router.back()
|
||||
} else {
|
||||
this.Dialog(res.desc)
|
||||
}
|
||||
},
|
||||
handleDelImg () {
|
||||
this.unimgsrc = ''
|
||||
this.formData = ''
|
||||
this.$refs.H5moreUp.value = ''
|
||||
document.getElementById('imgshow').removeAttribute('src')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~@style/mixin'
|
||||
// >>>.content
|
||||
// height calc(100% - 2rem)
|
||||
.image_wraper
|
||||
width 100%
|
||||
padding-top .5rem
|
||||
.li_box
|
||||
float left
|
||||
width 30%
|
||||
.image_wraper_i
|
||||
position relative
|
||||
_wh(100%, 100%)
|
||||
overflow-y auto
|
||||
z-index 99
|
||||
img
|
||||
_wh(100%, auto)
|
||||
z-index 99
|
||||
border-radius .1rem
|
||||
#H5moreUp
|
||||
position absolute
|
||||
top 0
|
||||
left 0
|
||||
_wh(100%, 100%)
|
||||
opacity 0
|
||||
z-index 100
|
||||
</style>
|
||||
@@ -160,7 +160,7 @@ export default {
|
||||
},
|
||||
UploadPict () {
|
||||
this.$router.push({
|
||||
path: '/UploadPict',
|
||||
path: '/UploadPicts',
|
||||
query: {url: 'EquipRepair'}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -122,4 +122,15 @@
|
||||
text-align center
|
||||
overflow hidden
|
||||
.error_icon::before
|
||||
content: '\e60f'
|
||||
content: '\e60f'
|
||||
.add_pict_icon
|
||||
width 2rem
|
||||
height 2rem
|
||||
font-size 1rem
|
||||
line-height 2rem
|
||||
color #c9c9c9
|
||||
text-align center
|
||||
border: .03rem dashed
|
||||
overflow hidden
|
||||
.add_pict_icon::before
|
||||
content: '\e653'
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user