1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042 |
- <template>
- <view>
- <image src="https://cczdsz.cn/app/images//background-from.png" class="background"></image>
- <view class="project-content">
- <u-form :model="form" :rules="rules" ref="form">
- <view class="small-title">输配站</view>
- <u-form-item borderBottom label="名称"ref="item1">
- <u-input v-model="form.name" :disabled="type==1"></u-input>
- </u-form-item>
- <view class="small-title">储存罐</view>
- <u-form-item borderBottom ref="item1">
- <view>压力表</view>
- <u-input v-model="WarningColumnInformation" disabled placeholder="请上传压力表照片"></u-input>
- <view class="" style="display: flex; flex-wrap: wrap; margin: 0 55rpx;">
- <image src="https://cczdsz.cn/app/images//chooseimg.png" mode=""
- style="width: 190rpx; height: 190rpx; margin: 0 12rpx; " @click="pressureGaugechoose()" v-if="type!=1">
- </image>
- <view v-for="(item,index) in pressureGaugeimgymxs" :key="index" style="position: relative;">
- <view v-if="item.type == 'image'">
- <image :src="item.url" mode="" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"
- @click="pressureGaugeshowPhoto(index)">
- </image>
- </view>
- <view v-else>
- <video :src="item" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"></video>
- </view>
- <view @click="pressureGaugeremove(index)"
- style="position: absolute; top: 0; right: 14rpx; border-radius: 50%; background-color: #FF0000;">
- <u-icon name="close" color="#FFFFFF" size="35" v-if="type!=1"></u-icon>
- </view>
- </view>
- </view>
- </u-form-item>
- <u-form-item borderBottom ref="item1">
- <view>液位计</view>
- <u-input v-model="WarningColumnInformation" disabled placeholder="请上传液位计照片"></u-input>
- <view class="" style="display: flex; flex-wrap: wrap; margin: 0 55rpx;">
- <image src="https://cczdsz.cn/app/images//chooseimg.png" mode=""
- style="width: 190rpx; height: 190rpx; margin: 0 12rpx; " @click="LevelGaugechoose()" v-if="type!=1">
- </image>
- <view v-for="(item,index) in LevelGaugeimgymxs" :key="index" style="position: relative;">
- <view v-if="item.type == 'image'">
- <image :src="item.url" mode="" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"
- @click="LevelGaugeshowPhoto(index)">
- </image>
- </view>
- <view v-else>
- <video :src="item" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"></video>
- </view>
- <view @click="LevelGaugeremove(index)"
- style="position: absolute; top: 0; right: 14rpx; border-radius: 50%; background-color: #FF0000;">
- <u-icon name="close" color="#FFFFFF" size="35" v-if="type!=1"></u-icon>
- </view>
- </view>
- </view>
- </u-form-item>
- <u-form-item borderBottom ref="item1">
- <view>流量计</view>
- <u-input v-model="WarningColumnInformation" disabled placeholder="请上传流量计照片"></u-input>
- <view class="" style="display: flex; flex-wrap: wrap; margin: 0 55rpx;">
- <image src="https://cczdsz.cn/app/images//chooseimg.png" mode=""
- style="width: 190rpx; height: 190rpx; margin: 0 12rpx; " @click="choose()" v-if="type!=1">
- </image>
- <view v-for="(item,index) in imgymxs" :key="index" style="position: relative;">
- <view v-if="item.type == 'image'">
- <image :src="item.url" mode="" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"
- @click="showPhoto(index)">
- </image>
- </view>
- <view v-else>
- <video :src="item" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"></video>
- </view>
- <view @click="remove(index)"
- style="position: absolute; top: 0; right: 14rpx; border-radius: 50%; background-color: #FF0000;">
- <u-icon name="close" color="#FFFFFF" size="35" v-if="type!=1"></u-icon>
- </view>
- </view>
- </view>
- </u-form-item>
- <!-- <u-form-item label="路段名称" borderBottom ref="item1" labelWidth="140">
- <u-input v-model="form.sectionName" :disabled="type==1" borderBottom @click="showbuilding= true&&type!=1"
- placeholder="请输入路段名称"></u-input>
- </u-form-item>
- <u-form-item label="抽检米数" labelWidth="140" borderBottom ref="item1">
- <u-input v-model="form.samplingMeterCount" :disabled="type==1" borderBottom @click="showbuilding= true&&type!=1"
- placeholder="请输入抽检米数" @input="checksamplingMeterCount()"></u-input>
- </u-form-item> -->
- <view class="small-title">输送管道</view>
- <u-form-item label=" " labelWidth="0" borderBottom ref="item1">
- <u-radio-group v-model="form.pipeline" :disabled="type==1">
- <u-radio @change="confirm"
- v-for="(item, index) in typelist.Pipeline"
- :key="index" :name="item.dictValue">
- {{item.dictLabel}}
- </u-radio>
- </u-radio-group>
- </u-form-item>
- <view class="small-title">气化器</view>
- <u-form-item label="维护" labelWidth="140" borderBottom ref="item1">
- <u-radio-group v-model="form.maintain" :disabled="type==1">
- <u-radio @change="maintainconfirm"
- v-for="(item, index) in typelist.maintain"
- :key="index" :name="item.dictValue">
- {{item.dictLabel}}
- </u-radio>
- </u-radio-group>
- <u-input v-model="maintain" v-show="form.maintain==2" placeholder="请输入其他" @blur='maintainblur' :disabled="type==1"></u-input>
- </u-form-item>
- <view class="small-title">安全设施</view>
- <u-form-item label="报警器" labelWidth="140" borderBottom ref="item1">
- <u-radio-group v-model="form.alarm" :disabled="type==1">
- <u-radio @change="Alarmconfirm"
- v-for="(item, index) in typelist.safety_facilities"
- :key="index" :name="item.dictValue">
- {{item.dictLabel}}
- </u-radio>
- </u-radio-group>
- <u-input v-model="Alarm" v-show="showAlarm" placeholder="请输入其他" @blur='Alarmblur' :disabled="type==1"></u-input>
- </u-form-item>
- <u-form-item label="紧急切断阀" labelWidth="140" borderBottom ref="item1">
- <u-radio-group v-model="form.emergency" :disabled="type==1">
- <u-radio @change="emergencyconfirm"
- v-for="(item, index) in typelist.safety_facilities"
- :key="index" :name="item.dictValue">
- {{item.dictLabel}}
- </u-radio>
- </u-radio-group>
- <u-input v-model="emergency" v-show="showemergency" placeholder="请输入其他" @blur='emergencyblur' :disabled="type==1"></u-input>
- </u-form-item>
- <u-form-item label="消防器材" labelWidth="140" borderBottom ref="item1">
- <u-radio-group v-model="form.fireEquipment" :disabled="type==1">
- <u-radio @change="fireEquipmentconfirm"
- v-for="(item, index) in typelist.safety_facilities"
- :key="index" :name="item.dictValue">
- {{item.dictLabel}}
- </u-radio>
- </u-radio-group>
- <u-input v-model="fireEquipment" v-show="showfireEquipment" placeholder="请输入其他" @blur='fireEquipmentblur' :disabled="type==1"></u-input>
- </u-form-item>
- <!-- <u-form-item label="发现时间" labelWidth="140" borderBottom ref="item1">
- <u-input v-model="form.findTime" borderBottom placeholder="请选择接警时间" disabled
- @click="showtime=true&&type!=1"></u-input>
- <u-picker v-model="showtime" mode="time" :params="params" @confirm="time()"></u-picker>
- </u-form-item>
- <u-form-item borderBottom ref="item1">
- <view>巡检照片</view>
- <u-input v-model="WarningColumnInformation" disabled placeholder="请上传巡检照片"></u-input>
- <view class="" style="display: flex; flex-wrap: wrap; margin: 0 55rpx;">
- <image src="https://cczdsz.cn/app/images//chooseimg.png" mode=""
- style="width: 190rpx; height: 190rpx; margin: 0 12rpx; " @click="choose()" v-if="type!=1">
- </image>
- <view v-for="(item,index) in imgymxs" :key="index" style="position: relative;">
- <view v-if="item.type == 'image'">
- <image :src="item.url" mode="" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"
- @click="showPhoto(index)">
- </image>
- </view>
- <view v-else>
- <video :src="item" style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"></video>
- </view>
- <view @click="remove(index)"
- style="position: absolute; top: 0; right: 14rpx; border-radius: 50%; background-color: #FF0000;">
- <u-icon name="close" color="#FFFFFF" size="35" v-if="type!=1"></u-icon>
- </view>
- </view>
- </view>
- </u-form-item> -->
- <!-- <u-form-item borderBottom ref="item1">
- <view>备注</view>
- <u-input v-model="form.remark" type="textarea" placeholder="请输入备注" :disabled="type==1"></u-input>
- </u-form-item> -->
- </u-form>
- <u-button style="background: #2d95f4;color: #fff;border-radius: 20rpx;margin-top: 20px;" @click="save()" v-if="type!=1"
- type='primary'>确认上传</u-button>
- </view>
- </view>
- </template>
- <script>
- import service from '@/api/index.js'
- export default {
- data() {
- return {
- repairType: [{
- label: '施工问题',
- value: 1
- }, {
- label: '施工问题',
- value: 2
- }, ],
- showrepairType: false,
- action: this.$HTTP.webUrl + `/obs`,
- headers: {
- MAuthorization: "wxBearer " + uni.getStorageSync('token')
- },
- url: [],
- params: {
- year: true,
- month: true,
- day: true,
- hour: true,
- minute: true,
- second: false
- },
- uploading: false,
- showmaintain:false,
- showtime:false,
- imgArr: [],
- imgymxs: [],
- pressureGaugeimgArr:[],
- pressureGaugeimgymxs:[],
- LevelGaugeimgArr: [],
- LevelGaugeimgymxs: [],
- progress: 0, //图片或视频上传百分比
- form: {pipeline:0,maintain:0,alarm:0,fireEquipment:0,emergency:0},
- typelist: [],
- causesOfFamageLabel: null,
- dictlist: ['Pipeline','maintain','safety_facilities'],
- buildingName: null,
- unit: null,
- unitName: null,
- showbuilding: false,
- showunit: false,
- buildingList: [],
- unitList: [],
- type: 2,
- id: null,
- community: null,
- createBy:null,
- maintain:null,
- fireEquipment:null,
- Alarm:null,
- emergency:null,
- showAlarm:null,
- showfireEquipment:null,
- showemergency:null
- }
- },
- onLoad(e) {
- // this.building = e.building
- // this.buildingName = e.buildingName
- // this.community = e.community
- // this.unitName = e.unitName
- // this.unit = e.unit
- this.id = e.id
- this.type = e.type
- console.log(e)
- this.getdictsysinfo()
- uni.setNavigationBarTitle({
- title: '输配站巡查'
- });
- uni.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: '#2d95f4',
- })
- // if (this.type != 1) {
- // this.getBuildingList()
- // }
- this.getUserName()
- },
- methods: {
- time(e) {
- console.log(`${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`)
- this.form.findTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`
- },
- maintainblur()
- {
- this.form.maintain=this.maintain
- },
- fireEquipmentblur()
- {
- this.form.fireEquipment=this.fireEquipment
- },
- Alarmblur()
- {
- this.form.alarm=this.Alarm
- },
- emergencyblur()
- {
- this.form.emergency=this.emergency
- },
- checksamplingMeterCount(e) {
- console.log(e)
- //正则表达试
- e = (e.match(/^\d*(\.?\d{0,10})/g)[0]) || null
- //重新赋值给input
- this.$nextTick(() => {
- this.form.samplingMeterCount= e
- })
- },
- getUserName(){
- service.getUserName().then(res=>{
- this.userId=res.id
- this.createBy=res.name
- })
- },
- showPhoto(index) {
- uni.previewImage({
- current: index,
- urls: this.imgArr,
- })
- },
- pressureGaugeshowPhoto(index) {
- uni.previewImage({
- current: index,
- urls: this.pressureGaugeimgArr,
- })
- },
- LevelGaugeshowPhoto(index) {
- uni.previewImage({
- current: index,
- urls: this.LevelGaugeimgArr,
- })
- },
- // showPhotos(index) {
- // uni.previewImage({
- // current: index,
- // urls: this.photo,
- // })
- // },
- // buildingconfirm(e) {
- // this.buildingName = e[0].label
- // this.building = e[0].value
- // console.log(this.building)
- // //this.getUnitList(e[0].value)
- // },
- // unitconfirm(e) {
- // this.unitName = e[0].label
- // this.unit = e[0].value
- // },
- // getBuildingList() {
- // const _this = this
- // service.getBuildingList({
- // areaId: this.community
- // }).then(res => {
- // _this.buildingList = res
- // })
- // },
- // getUnitList(building) {
- // const _this = this
- // service.getUnitList({
- // buildingId: building
- // }).then(res => {
- // _this.unitList = res
- // })
- // },
- save() {
- let _this = this
- this.form.flowMeter = this.imgArr
- this.form.levelGauge=this.LevelGaugeimgArr
- this.form.pressureGauge=this.pressureGaugeimgArr
- // if(this.building==null)
- // {
- // uni.showToast({
- // title: '请选择楼栋',
- // icon: 'none'
- // })
- // return
- // }
- if(this.imgArr.length==0)
- {
- uni.showToast({
- title: '请上传图片或视频!',
- icon: 'none'
- })
- return
- }
- // this.form.buildingId = this.building
- // this.form.communityId=this.community
- this.form.userId=this.userId
- this.form.createBy=this.userId
- service.savetransmissionStation(this.form).then(res => {
- console.log(res)
- _this.$UTILS.showPrompt('上报成功!')
- // setTimeout(() => {
- // console.log('跳')
- // uni.switchTab({
- // url: '/pages/index/index'
- // })
- // }, 2000)
- this.form={pipeline:0,maintain:0,alarm:0,fireEquipment:0,emergency:0}
- // this.buildingName=''
- this.imgArr=[]
- this.imgymxs=[]
- this.LevelGaugeimgArr=[]
- this.pressureGaugeimgArr=[]
- this.LevelGaugeimgymxs=[]
- this.pressureGaugeimgymxs=[]
- this.maintain=null
- this.Alarm=null
- this.fireEquipment=null
- this.emergency=null
- this.showAlarm=false
- this.showemergency=false
- this.showfireEquipment=false
- this.showmaintain=false
- })
- },
- getdictsysinfo() {
- let _this = this
- service.getDictInfoList({
- type: this.dictlist
- }).then(res => {
- if (this.type == 1) {
- let _this = this
- console.log(this.id)
- service.gettransmissionStation(this.id).then(res => {
- // console.log(_this.typelist)
- // _this.buildingName = res.buildingName
- // _this.unitName = res.unitName
- // let list = []
- // list = _this.typelist.find_problem
- // list.forEach((item) => {
- // if (item.dictValue == res.findProblem) {
- // _this.causesOfFamageLabel = item.dictLabel
- // }
- // })
- if (null != res.flowMeter) {
- res.flowMeter.forEach(item => {
- let url = {}
- url.url = item
- url.type = 'image'
- this.imgymxs.push(url)
- })
- }
- if (null != res.levelGauge) {
- res.levelGauge.forEach(item => {
- let url = {}
- url.url = item
- url.type = 'image'
- this.LevelGaugeimgymxs.push(url)
- })
- }
- if (null != res.pressureGauge) {
- res.pressureGauge.forEach(item => {
- let url = {}
- url.url = item
- url.type = 'image'
- this.pressureGaugeimgymxs.push(url)
- })
- }
- this.form = res
- if(this.form.Alarm!=0)
- {
- this.showAlarm=true
- this.Alarm=this.form.alarm
- this.form.alarm=1
- }
- if(this.form.emergency!=0)
- {
- this.showemergency=true
- this.emergency=this.form.emergency
- this.form.emergency=1
- }
- if(this.form.fireEquipment!=0)
- {
- this.showfireEquipment=true
- this.fireEquipment=this.form.fireEquipment
- this.form.fireEquipment=1
- }
- if(this.form.maintain!=0||this.form.maintain!=1)
- {
- this.showmaintain=true
- this.maintain=this.form.maintain
- this.form.maintain=2
- }
- // this.form = res
- console.log(this.form)
- })
- }
- _this.typelist = res
- })
- },
- confirm(e) {
- this.form.pipeline =e
- },
- emergencyconfirm(e) {
- if(e==1)
- {
- this.showemergency=true
- this.form.emergency=null
- }else
- {
- this.form.emergency =e
- this.showemergency=false
- }
- },
- maintainconfirm(e) {
- if(e==2)
- {
- this.showmaintain=true
- this.form.maintain=null
- }else
- {
- this.form.maintain =e
- this.showmaintain=false
- }
- console.log(e)
- },
- fireEquipmentconfirm(e) {
- if(e==1)
- {
- this.showfireEquipment=true
- this.form.fireEquipment =null
- }else
- {
- this.form.fireEquipment =e
- this.showfireEquipment=false
- }
- },
- Alarmconfirm(e) {
- if(e==1)
- {
- this.showAlarm=true
- this.form.Alarm =null
- }else
- {
- this.form.Alarm =e
- this.showAlarm=false
- }
- },
- pressureGaugechoose()
- {
- let _this = this;
- uni.showActionSheet({
- title: '上传',
- itemList: ['图片', '视频'],
- success: (res) => {
- // console.log(res)
- if (res.tapIndex == 0) {
- this.pressureGaugeimage()
- } else {
- this.pressureGaugevideo()
- }
- }
- })
- },
- LevelGaugechoose()
- {
- let _this = this;
- uni.showActionSheet({
- title: '上传',
- itemList: ['图片', '视频'],
- success: (res) => {
- // console.log(res)
- if (res.tapIndex == 0) {
- this.LevelGaugeimage()
- } else {
- this.LevelGaugevideo()
- }
- }
- })
- },
- choose() {
- let _this = this;
- uni.showActionSheet({
- title: '上传',
- itemList: ['图片', '视频'],
- success: (res) => {
- // console.log(res)
- if (res.tapIndex == 0) {
- this.chooseimage()
- } else {
- this.choosevideo()
- }
- }
- })
- },
- chooseimage() {
- console.log('图片')
- let _this = this;
- uni.chooseImage({
- sourceType: ['camera'],
- success(resp) {
- console.log('res--uni.chooseMedia', resp);
- resp.tempFiles.forEach((item, index) => {
- const task = uni.uploadFile({
- url: _this.$HTTP.webUrl + `/obs`,
- filePath: item.path,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = _this.$u.test.jsonString(res.data) ? JSON.parse(
- res.data) : res.data;
- if (![200, 201, 204].includes(res.statusCode)) {
- // this.uploadError(index, data);
- _this.$UTILS.showPrompt('选取失败!')
- } else {
- // 上传成功
- // this.lists[index].response = data;
- // this.lists[index].progress = 100;
- // this.lists[index].error = false;
- // this.$emit('on-success', data, index, this.lists, this
- // .index);
- if (_this.progress === 100) {
- // console.log('_this.progress', _this.progress)
- // console.log('data----', data)
- // console.log('res--', res)
- _this.imgymxs.push({
- url: data.data.url,
- type: 'image'
- })
- _this.imgArr.push(data.data.url)
- // console.log('imgArr', _this.imgArr)
- _this.$UTILS.showPrompt('选取成功!')
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('选取失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- _this.uploading = false;
- // _this.uploadFile(index + 1);
- // this.$emit('on-change', res, index, this.lists, this
- // .index);
- }
- });
- task.onProgressUpdate(res => {
- // if (res.progress > 0) {
- // this.lists[index].progress = res.progress;
- // this.$emit('on-progress', res, index, this.lists, this.index);
- // }
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '选取中'
- })
- });
- })
- },
- })
- },
- choosevideo() {
- let _this = this;
- console.log('视频')
- uni.chooseVideo({
- sourceType: ['camera'],
- maxDuration: 30,
- success(resp) {
- const task = uni.uploadFile({
- url: _this.$HTTP.webUrl + `/obs`,
- filePath: resp.tempFilePath,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = _this.$u.test.jsonString(res.data) ? JSON.parse(res.data) :
- res.data;
- if (![200, 201, 204].includes(res.statusCode)) {
- this.uploadError(index, data);
- } else {
- // 上传成功
- // this.lists[index].response = data;
- // this.lists[index].progress = 100;
- // this.lists[index].error = false;
- // this.$emit('on-success', data, index, this.lists, this
- // .index);
- if (_this.progress === 100) {
- console.log('_this.progress', _this.progress)
- console.log('data----', data)
- console.log('res--', res)
- // _this.imgArr.push(data.data.url)
- _this.imgymxs.push({
- url: data.data.url,
- type: 'video'
- })
- _this.imgArr.push(data.data.url)
- console.log('imgArr', _this.imgArr)
- _this.$UTILS.showPrompt('选取成功!')
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('选取失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- uni.hideLoading();
- _this.uploading = false;
- // _this.uploadFile(index + 1);
- // this.$emit('on-change', res, index, this.lists, this
- // .index);
- }
- });
- task.onProgressUpdate(res => {
- // if (res.progress > 0) {
- // this.lists[index].progress = res.progress;
- // this.$emit('on-progress', res, index, this.lists, this.index);
- // }
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '选取中'
- })
- });
- },
- })
- },
- remove(index) {
- uni.showModal({
- title: '提示',
- content: '是否删除该图片或视频?',
- success: (res) => {
- if (res.confirm) {
- this.imgArr.splice(index, 1);
- this.imgymxs.splice(index, 1);
- console.log('this.imgarr', this.imgArr)
- }
- }
- })
- },
- pressureGaugeimage() {
- console.log('图片')
- let _this = this;
- uni.chooseImage({
- sourceType: ['camera'],
- success(resp) {
- console.log('res--uni.chooseMedia', resp);
- resp.tempFiles.forEach((item, index) => {
- const task = uni.uploadFile({
- url: _this.$HTTP.webUrl + `/obs`,
- filePath: item.path,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = _this.$u.test.jsonString(res.data) ? JSON.parse(
- res.data) : res.data;
- if (![200, 201, 204].includes(res.statusCode)) {
- // this.uploadError(index, data);
- _this.$UTILS.showPrompt('选取失败!')
- } else {
- // 上传成功
- // this.lists[index].response = data;
- // this.lists[index].progress = 100;
- // this.lists[index].error = false;
- // this.$emit('on-success', data, index, this.lists, this
- // .index);
- if (_this.progress === 100) {
- // console.log('_this.progress', _this.progress)
- // console.log('data----', data)
- // console.log('res--', res)
- _this.pressureGaugeimgymxs.push({
- url: data.data.url,
- type: 'image'
- })
- _this.pressureGaugeimgArr.push(data.data.url)
- // console.log('imgArr', _this.imgArr)
- _this.$UTILS.showPrompt('选取成功!')
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('选取失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- _this.uploading = false;
- // _this.uploadFile(index + 1);
- // this.$emit('on-change', res, index, this.lists, this
- // .index);
- }
- });
- task.onProgressUpdate(res => {
- // if (res.progress > 0) {
- // this.lists[index].progress = res.progress;
- // this.$emit('on-progress', res, index, this.lists, this.index);
- // }
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '选取中'
- })
- });
- })
- },
- })
- },
- pressureGaugevideo() {
- let _this = this;
- console.log('视频')
- uni.chooseVideo({
- sourceType: ['camera'],
- maxDuration: 30,
- success(resp) {
- const task = uni.uploadFile({
- url: _this.$HTTP.webUrl + `/obs`,
- filePath: resp.tempFilePath,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = _this.$u.test.jsonString(res.data) ? JSON.parse(res.data) :
- res.data;
- if (![200, 201, 204].includes(res.statusCode)) {
- this.uploadError(index, data);
- } else {
- // 上传成功
- // this.lists[index].response = data;
- // this.lists[index].progress = 100;
- // this.lists[index].error = false;
- // this.$emit('on-success', data, index, this.lists, this
- // .index);
- if (_this.progress === 100) {
- console.log('_this.progress', _this.progress)
- console.log('data----', data)
- console.log('res--', res)
- // _this.imgArr.push(data.data.url)
- _this.pressureGaugeimgymxs.push({
- url: data.data.url,
- type: 'video'
- })
- _this.pressureGaugeimgArr.push(data.data.url)
- console.log('imgArr', _this.imgArr)
- _this.$UTILS.showPrompt('选取成功!')
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('选取失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- uni.hideLoading();
- _this.uploading = false;
- // _this.uploadFile(index + 1);
- // this.$emit('on-change', res, index, this.lists, this
- // .index);
- }
- });
- task.onProgressUpdate(res => {
- // if (res.progress > 0) {
- // this.lists[index].progress = res.progress;
- // this.$emit('on-progress', res, index, this.lists, this.index);
- // }
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '选取中'
- })
- });
- },
- })
- },
- pressureGaugeremove(index) {
- uni.showModal({
- title: '提示',
- content: '是否删除该图片或视频?',
- success: (res) => {
- if (res.confirm) {
- this.pressureGaugeimgArr.splice(index, 1);
- this.pressureGaugeimgymxs.splice(index, 1);
- console.log('this.imgarr', this.pressureGaugeimgArr)
- }
- }
- })
- },
- LevelGaugeimage() {
- console.log('图片')
- let _this = this;
- uni.chooseImage({
- sourceType: ['camera'],
- success(resp) {
- console.log('res--uni.chooseMedia', resp);
- resp.tempFiles.forEach((item, index) => {
- const task = uni.uploadFile({
- url: _this.$HTTP.webUrl + `/obs`,
- filePath: item.path,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = _this.$u.test.jsonString(res.data) ? JSON.parse(
- res.data) : res.data;
- if (![200, 201, 204].includes(res.statusCode)) {
- // this.uploadError(index, data);
- _this.$UTILS.showPrompt('选取失败!')
- } else {
- // 上传成功
- // this.lists[index].response = data;
- // this.lists[index].progress = 100;
- // this.lists[index].error = false;
- // this.$emit('on-success', data, index, this.lists, this
- // .index);
- if (_this.progress === 100) {
- // console.log('_this.progress', _this.progress)
- // console.log('data----', data)
- // console.log('res--', res)
- _this.LevelGaugeimgymxs.push({
- url: data.data.url,
- type: 'image'
- })
- _this.LevelGaugeimgArr.push(data.data.url)
- // console.log('imgArr', _this.imgArr)
- _this.$UTILS.showPrompt('选取成功!')
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('选取失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- _this.uploading = false;
- // _this.uploadFile(index + 1);
- // this.$emit('on-change', res, index, this.lists, this
- // .index);
- }
- });
- task.onProgressUpdate(res => {
- // if (res.progress > 0) {
- // this.lists[index].progress = res.progress;
- // this.$emit('on-progress', res, index, this.lists, this.index);
- // }
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '选取中'
- })
- });
- })
- },
- })
- },
- LevelGaugevideo() {
- let _this = this;
- console.log('视频')
- uni.chooseVideo({
- sourceType: ['camera'],
- maxDuration: 30,
- success(resp) {
- const task = uni.uploadFile({
- url: _this.$HTTP.webUrl + `/obs`,
- filePath: resp.tempFilePath,
- name: 'file',
- formData: {},
- header: _this.headers,
- success: res => {
- // 判断是否json字符串,将其转为json格式
- let data = _this.$u.test.jsonString(res.data) ? JSON.parse(res.data) :
- res.data;
- if (![200, 201, 204].includes(res.statusCode)) {
- this.uploadError(index, data);
- } else {
- // 上传成功
- // this.lists[index].response = data;
- // this.lists[index].progress = 100;
- // this.lists[index].error = false;
- // this.$emit('on-success', data, index, this.lists, this
- // .index);
- if (_this.progress === 100) {
- console.log('_this.progress', _this.progress)
- console.log('data----', data)
- console.log('res--', res)
- // _this.imgArr.push(data.data.url)
- _this.LevelGaugeimgymxs.push({
- url: data.data.url,
- type: 'video'
- })
- _this.LevelGaugeimgArr.push(data.data.url)
- console.log('imgArr', _this.imgArr)
- _this.$UTILS.showPrompt('选取成功!')
- }
- }
- },
- fail: e => {
- _this.$UTILS.showPrompt('选取失败!')
- this.uploadError(index, e);
- },
- complete: res => {
- uni.hideLoading();
- _this.uploading = false;
- // _this.uploadFile(index + 1);
- // this.$emit('on-change', res, index, this.lists, this
- // .index);
- }
- });
- task.onProgressUpdate(res => {
- // if (res.progress > 0) {
- // this.lists[index].progress = res.progress;
- // this.$emit('on-progress', res, index, this.lists, this.index);
- // }
- _this.progress = res.progress;
- console.log('onProgressUpdate', res)
- uni.showLoading({
- title: '选取中'
- })
- });
- },
- })
- },
- LevelGaugeremove(index) {
- uni.showModal({
- title: '提示',
- content: '是否删除该图片或视频?',
- success: (res) => {
- if (res.confirm) {
- this.LevelGaugeimgArr.splice(index, 1);
- this.LevelGaugeimgymxs.splice(index, 1);
- console.log('this.imgarr', this.LevelGaugeimgArr)
- }
- }
- })
- },
- },
- }
- </script>
- <style>
- .project-content {
- padding: 10rpx 20rpx;
- border-radius: 20rpx;
- background: #fff;
- width: 90%;
- margin: 0 auto;
- }
- .background {
- z-index: -1;
- position: fixed;
- width: 100%;
- height: 100%;
- background-size: 100% 100%;
- }
- .small-title {
- font-size: 38rpx;
- color: #2d95f4;
- margin: 20rpx 0;
- }
- </style>
|