修改
This commit is contained in:
@@ -48,13 +48,6 @@
|
||||
required
|
||||
:rules="[{ required: true }]"
|
||||
/>
|
||||
<!-- <van-field
|
||||
v-model="formData.clockTime"
|
||||
label="打卡时间"
|
||||
input-align="right"
|
||||
placeholder="请输入"
|
||||
readonly
|
||||
/> -->
|
||||
<van-field
|
||||
v-model="formData.remark"
|
||||
label="备注"
|
||||
@@ -75,6 +68,14 @@
|
||||
</div>
|
||||
<div class="pic">
|
||||
<Uploader
|
||||
ref="uploaderRef"
|
||||
type="text1"
|
||||
:value="text1"
|
||||
:deletable="showSubmit"
|
||||
@afterRead="afterRead"
|
||||
@delImg="delImg"
|
||||
@onUpload="onUpload" />
|
||||
<!-- <Uploader
|
||||
ref="uploaderRef"
|
||||
type="text1"
|
||||
:value="text1"
|
||||
@@ -83,7 +84,7 @@
|
||||
@afterRead="afterRead"
|
||||
@delImg="delImg"
|
||||
@onUpload="onUpload"
|
||||
/>
|
||||
/> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -102,7 +103,6 @@ import {
|
||||
getPosition,
|
||||
// chooseAlbumAndTakePhoto,
|
||||
} from '@/utils/dsbridge'
|
||||
import { format } from '@/utils/timeUtil.js'
|
||||
import { insertPositionData, getPositionData } from '@/api/api.js'
|
||||
import { downloadUrl } from '@/settings'
|
||||
export default {
|
||||
@@ -128,7 +128,6 @@ export default {
|
||||
showSubmit: false,
|
||||
taskId: '',
|
||||
customerId: '',
|
||||
animation: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -162,54 +161,62 @@ export default {
|
||||
}else{
|
||||
this.showSubmit = true
|
||||
this.getLocation()
|
||||
this.getAddress()
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取当前位置
|
||||
getLocation() {
|
||||
console.log('-------------------------getLocation');
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.formData.lgitude = 31.560001
|
||||
this.formData.ltitude = 118.708980
|
||||
this.formData.lgitude = 118.708980
|
||||
this.formData.ltitude = 31.560001
|
||||
this.formData.addressName = '江苏省南京市江宁区'
|
||||
}
|
||||
try {
|
||||
// this.formData.clockTime = format(new Date().getTime())
|
||||
} catch (error) {}
|
||||
const that = this
|
||||
getPosition((data) => {
|
||||
console.log('-------------------------位置信息', data, typeof(data));
|
||||
if (data) {
|
||||
console.log(data, '位置信息')
|
||||
this.formData.lgitude = data.longitude
|
||||
this.formData.ltitude = data.latitude
|
||||
console.log(data.longitude, 'lgitude位置信息')
|
||||
if(typeof(data) == 'string'){
|
||||
let dataArr = data.split(',')
|
||||
that.$set(that.formData, 'lgitude', dataArr[0].match(/\d+\.\d{2}/)[0])
|
||||
that.$set(that.formData, 'ltitude', dataArr[1].match(/\d+\.\d{2}/)[0])
|
||||
}else{
|
||||
that.$set(that.formData, 'lgitude', (data.longitude+'').match(/\d+\.\d{2}/)[0])
|
||||
that.$set(that.formData, 'ltitude', (data.latitude+'').match(/\d+\.\d{2}/)[0])
|
||||
}
|
||||
} else {
|
||||
Notify({ type: 'warning', message: '未获取到位置信息' })
|
||||
}
|
||||
})
|
||||
},
|
||||
getAddress(){
|
||||
const that = this
|
||||
getLocationMessage((data) => {
|
||||
console.log('-------------------------getLocationMessage', data);
|
||||
if (data) {
|
||||
this.formData.addressName = data
|
||||
that.$set(that.formData, 'addressName', data)
|
||||
} else {
|
||||
Notify({ type: 'warning', message: '未获取到定位信息' })
|
||||
}
|
||||
})
|
||||
this.animation = requestAnimationFrame(this.getLocation)
|
||||
},
|
||||
/**
|
||||
* 图片方法
|
||||
*/
|
||||
//浏览器 ios 会走这个方法
|
||||
afterRead(data, type) {
|
||||
this[type].push({
|
||||
fileName: data.original_name,
|
||||
fileId: data.attach_id,
|
||||
url: `${downloadUrl}${data.attach_id}`
|
||||
})
|
||||
|
||||
console.log('-------------------------afterRead', data, type);
|
||||
this[type] = [data.attach_id]
|
||||
this.formData.fileName = data.original_name
|
||||
this.formData.fileId = data.attach_id
|
||||
},
|
||||
//安卓会调用的方法
|
||||
onUpload(data, type) {
|
||||
this[type].push(data[0])
|
||||
console.log('-------------------------onUpload', data, type);
|
||||
// this[type].push(data[0])
|
||||
this[type] = [data[0].url]
|
||||
this.formData.fileName = data[0].fileName
|
||||
this.formData.fileId = data[0].fileId
|
||||
},
|
||||
@@ -270,12 +277,6 @@ export default {
|
||||
})
|
||||
},
|
||||
},
|
||||
beforeDestroy(){
|
||||
if(this.animation){
|
||||
cancelAnimationFrame(this.animation)
|
||||
this.animation = null
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<van-field v-model="formData.photovoltaicPhotovoltaic" required :rules="[{ required: gfShow == 1, message: '请填写总装机容量' }]" label="光伏总装机容量(kW)" placeholder="请输入" type="number" input-align="right" v-if="gfShow == 1">
|
||||
</van-field>
|
||||
<van-cell title="是否采用再生水" is-link :value="showData.reclaimedWater1" @click="showPicker5 = !showForm" />
|
||||
<van-cell title="再生水类型" is-link :value="result222" @click="showPicker6 = !showForm" v-if="formData.reclaimedWater == 1" />
|
||||
<van-cell title="再生水类型" is-link :value="result222" @click="showPicker6 = !showForm" v-if="formData.reclaimedWater == 1" required :rules="[{ required: true}]" />
|
||||
<van-cell title="再生水类型" is-link title-style="color: #999" value="无" v-else />
|
||||
</van-cell-group>
|
||||
</div>
|
||||
@@ -1635,6 +1635,11 @@ export default {
|
||||
this.formData.reclaimedWater = val.value
|
||||
this.showData.reclaimedWater1 = val.text
|
||||
this.showPicker5 = false
|
||||
if(val.value==2){
|
||||
this.result8 = []
|
||||
this.result222 = this.formData.reclaimedWaterType= ''
|
||||
|
||||
}
|
||||
},
|
||||
// 外墙结构选择
|
||||
clickRadio4(item, index) {
|
||||
@@ -1697,7 +1702,8 @@ export default {
|
||||
this.showData.itemizedMeter1 = val.text
|
||||
this.showPicker11 = false
|
||||
if (val.value == 2) {
|
||||
this.formData.itemizedMeasurementType = ''
|
||||
this.result9 = []
|
||||
this.formData.itemizedMeasurementType = this.result777 = ''
|
||||
}
|
||||
},
|
||||
// 分项计量类型
|
||||
@@ -1717,7 +1723,8 @@ export default {
|
||||
this.showData.energyPlatform1 = val.text
|
||||
this.showPicker13 = false
|
||||
if (val.value == 2) {
|
||||
this.formData.platformFeatures = ''
|
||||
this.result3 = []
|
||||
this.formData.platformFeatures = this.result888 = ''
|
||||
}
|
||||
},
|
||||
// 平台功能选择
|
||||
@@ -1813,6 +1820,9 @@ export default {
|
||||
}else if (!this.result1) {
|
||||
this.$toast('请选择已使用清洁能源')
|
||||
return
|
||||
}else if (this.formData.reclaimedWater == 1 && !this.result222) {
|
||||
this.$toast('请选择再生水类型')
|
||||
return
|
||||
}else if (this.formData.energyType.indexOf('1') === -1) {
|
||||
this.$toast('能源类型必须有勾选电')
|
||||
return
|
||||
@@ -2078,28 +2088,28 @@ export default {
|
||||
(this.fileList = []), // 图片列表
|
||||
(this.fileIds = []) // 图片id存
|
||||
},
|
||||
// 获取当前位置
|
||||
getLocation() {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.formData.buildAddr = '江苏省南京市江宁区'
|
||||
}
|
||||
getPosition( data => {
|
||||
if(data){
|
||||
console.log(data, '位置信息');
|
||||
this.formData.latitude = data.latitude
|
||||
this.formData.longitude = data.longitude
|
||||
} else {
|
||||
Notify({ type: 'warning', message: '未获取到位置信息' });
|
||||
}
|
||||
})
|
||||
getLocationMessage(data=> {
|
||||
if(data) {
|
||||
this.formData.buildAddr = data
|
||||
} else {
|
||||
Notify({ type: 'warning', message: '未获取到定位信息' });
|
||||
}
|
||||
})
|
||||
},
|
||||
// // 获取当前位置
|
||||
// getLocation() {
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
// this.formData.buildAddr = '江苏省南京市江宁区'
|
||||
// }
|
||||
// getPosition( data => {
|
||||
// if(data){
|
||||
// console.log(data, '位置信息');
|
||||
// this.formData.latitude = data.latitude
|
||||
// this.formData.longitude = data.longitude
|
||||
// } else {
|
||||
// Notify({ type: 'warning', message: '未获取到位置信息' });
|
||||
// }
|
||||
// })
|
||||
// getLocationMessage(data=> {
|
||||
// if(data) {
|
||||
// this.formData.buildAddr = data
|
||||
// } else {
|
||||
// Notify({ type: 'warning', message: '未获取到定位信息' });
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
updateUserStatus() {
|
||||
const data = JSON.parse(sessionStorage.getItem('tidCid'))
|
||||
const params = {
|
||||
|
||||
Reference in New Issue
Block a user