事件上报

This commit is contained in:
liuye
2023-05-05 11:53:21 +08:00
parent 748b62a684
commit 46d7d85e29
2 changed files with 212 additions and 6 deletions

View File

@@ -12,7 +12,7 @@
<div class="line"></div>
<u-form-item label="上报位置" prop="mapInfo" required :border-bottom="false" right-icon="arrow-right" class="border">
<span @click="show = true" class="right-span" :style="forms.mapInfo.name ? '' : 'color:#999;'">{{ forms.mapInfo.name || '请选择上报位置' }}</span>
<span @click="toMap" class="right-span" :style="forms.mapInfo.address ? '' : 'color:#999;'">{{ forms.mapInfo.address || '请选择上报位置' }}</span>
</u-form-item>
<u-form-item label="所属网格" prop="girdName" required :border-bottom="false">
<AiPagePicker type="gird" v-model="forms.girdId" @change="confirmGird" valueObj nodeKey="id" formType="2" class="right-span">
@@ -45,6 +45,7 @@
</template>
<script>
import {mapState} from 'vuex'
export default {
name: 'Add',
data() {
@@ -53,7 +54,7 @@ export default {
groupName: '',
groupId: '',
content: '',
mapInfo: {},
mapInfo: {address: ''},
girdId: '',
girdName: '',
files: [],
@@ -65,11 +66,19 @@ export default {
myList: []
}
},
computed: {
...mapState(['user']),
},
onLoad() {
this.typeList()
},
onShow() {
document.title = '事件添加'
this.forms.name = this.user.name
this.forms.phone = this.user.phone
uni.$on('chooseLat', res => {
this.forms.mapInfo = {...res}
})
},
methods: {
typeList() {
@@ -92,11 +101,40 @@ export default {
this.forms.girdId = v.id
this.forms.girdName = v.girdName
},
toMap() {
uni.navigateTo({url: `./Map`})
},
confirm() {
// if (this.status == 1 && !this.forms.name) {
// //return this.$u.toast('请选择转交对象')
// }
if(this.flag) return
if (!this.forms.groupName) {
return this.$u.toast('请选择事件类型')
}
if (!this.forms.content) {
return this.$u.toast('请输入事件描述')
}
if (!this.forms.mapInfo.address) {
return this.$u.toast('请选择上报位置')
}
if (!this.forms.girdName) {
return this.$u.toast('请选择所属网格')
}
if (!this.forms.name) {
return this.$u.toast('请输入姓名')
}
if (!this.forms.phone) {
return this.$u.toast('请输入手机号')
}
this.flag = true
this.$http.post(``).then((res) => {
if (res.code == 0) {
this.$u.toast('事件添加成功')
uni.$emit('getListInit')
setTimeout(() => {
uni.navigateBack()
}, 600)
}
})
},