xbot
This commit is contained in:
253
src/apps/AppWorkOrderXbot/Edit.vue
Normal file
253
src/apps/AppWorkOrderXbot/Edit.vue
Normal file
@@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<div class="Edit">
|
||||
<div class="contents">
|
||||
<u-form :model="forms" ref="uForm" label-width="auto" :border-bottom="false">
|
||||
<u-form-item label="事件描述" prop="content" required :border-bottom="false" label-position="top" class="contents">
|
||||
<u-input v-model="forms.content" placeholder="请输入事件描述..." type="textarea" auto-height height="100" maxlength="500"/>
|
||||
</u-form-item>
|
||||
<u-form-item label="事件类型" prop="type" required :border-bottom="false" right-icon="arrow-right">
|
||||
<span @click="show = true" class="right-span" :style="forms.typeName ? '' : 'color:#999;'">{{ forms.typeName || '请选择事件类型' }}</span>
|
||||
<u-select v-model="show" :list="$dict.getDict('xbotReportEventType')" value-name="dictValue" label-name="dictName" @confirm="selectFl"></u-select>
|
||||
</u-form-item>
|
||||
<div class="line"></div>
|
||||
<u-form-item label="所属网格" prop="girdName" :border-bottom="false">
|
||||
<!-- <AiPagePicker type="gird" v-model="forms.girdId" @change="confirmGird" nodeKey="id" formType="2" class="right-span">
|
||||
<AiMore v-model="forms.girdName" placeholder="请选择所属网格"/>
|
||||
</AiPagePicker> -->
|
||||
<AiPagePicker type="gird" v-model="selectGird" valueObj nodeKey="id" formType="2" class="right-span">
|
||||
<AiMore v-model="selectGird.girdName"/>
|
||||
</AiPagePicker>
|
||||
</u-form-item>
|
||||
<u-form-item label="联系方式" prop="phone" :border-bottom="false" >
|
||||
<u-input v-model="forms.phone" placeholder="请输入联系方式" />
|
||||
</u-form-item>
|
||||
<u-form-item label="上报位置" prop="mapInfo" :border-bottom="false" right-icon="arrow-right" class="border">
|
||||
<span @click="toMap" class="right-span" :style="forms.mapInfo.address ? '' : 'color:#999;'">{{ forms.mapInfo.address || '请选择上报位置' }}</span>
|
||||
</u-form-item>
|
||||
<div class="line"></div>
|
||||
<u-form-item label="图片上传(最多9张)" prop="files" :border-bottom="false" class="avatars" label-position="top">
|
||||
<AiUploader :def.sync="forms.files" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
|
||||
</u-form-item>
|
||||
|
||||
<div class="line"></div>
|
||||
|
||||
</u-form>
|
||||
</div>
|
||||
|
||||
<div class="btn" @click="confirm">
|
||||
<span>提交</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from 'vuex'
|
||||
export default {
|
||||
name: 'Edit',
|
||||
data() {
|
||||
return {
|
||||
forms: {
|
||||
groupName: '',
|
||||
groupId: '',
|
||||
content: '',
|
||||
mapInfo: {address: ''},
|
||||
girdId: '',
|
||||
girdName: '',
|
||||
files: [],
|
||||
name: '',
|
||||
phone: '',
|
||||
type: ''
|
||||
},
|
||||
flag: false,
|
||||
show: false,
|
||||
flList: [],
|
||||
id: '',
|
||||
selectGird: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id
|
||||
this.$dict.load('xbotReportEventType').then(() => {
|
||||
this.getDetail()
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
document.title = '事件编辑'
|
||||
uni.$on('chooseLat', res => {
|
||||
this.forms.mapInfo = {...res}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getDetail() {
|
||||
this.$http.post(`/app/appsessionarchivereportinfo/queryDetailById?id=${this.id}`).then((res) => {
|
||||
if (res?.data) {
|
||||
this.forms = res.data
|
||||
this.forms.mapInfo = {
|
||||
lat: res.data.lat,
|
||||
lng: res.data.lng,
|
||||
address: res.data.address,
|
||||
}
|
||||
this.forms.typeName = res.data.type
|
||||
var list = this.$dict.getDict('xbotReportEventType')
|
||||
list.map((item) => {
|
||||
if(item.dictValue == res.data.type) {
|
||||
this.forms.typeName = item.dictName
|
||||
}
|
||||
})
|
||||
this.selectGird = { girdId: res.data.girdId|| '', girdName: res.data.girdName || ''}
|
||||
}
|
||||
})
|
||||
},
|
||||
selectFl(e) {
|
||||
this.forms.type = e[0].value
|
||||
this.forms.typeName = e[0].label
|
||||
},
|
||||
confirmGird(v) {
|
||||
console.log(v)
|
||||
this.forms.girdId = v.id
|
||||
this.forms.girdName = v.girdName
|
||||
},
|
||||
toMap() {
|
||||
uni.navigateTo({url: `./Map`})
|
||||
},
|
||||
confirm() {
|
||||
if(this.flag) return
|
||||
|
||||
if (!this.forms.content) {
|
||||
return this.$u.toast('请输入事件描述')
|
||||
}
|
||||
if (!this.forms.type) {
|
||||
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.forms.girdId = this.selectGird.girdId
|
||||
this.forms.girdName = this.selectGird.girdName
|
||||
this.$http.post(`/app/appsessionarchivereportinfo/update`, {...this.forms, ...this.forms.mapInfo}).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.$u.toast('事件编辑成功')
|
||||
uni.$emit('getListInit')
|
||||
uni.$emit('updateDeatil')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.Edit {
|
||||
height: 100%;
|
||||
|
||||
.contents {
|
||||
padding-bottom: 140px;
|
||||
|
||||
::v-deep .u-form {
|
||||
.u-form-item {
|
||||
// padding: 0 45px !important;
|
||||
|
||||
.u-form-item__body {
|
||||
.u-form-item--right__content__slot {
|
||||
padding-bottom: 0;
|
||||
|
||||
.u-input {
|
||||
text-align: right !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.u-form-item:first-child {
|
||||
.u-form-item__body {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
height: 24px;
|
||||
background: #f3f6f9;
|
||||
}
|
||||
|
||||
.contents {
|
||||
padding-bottom: 20px !important;
|
||||
|
||||
.u-form-item__body {
|
||||
.u-form-item--right__content__slot {
|
||||
.u-input {
|
||||
text-align: left !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.avatars {
|
||||
padding-bottom: 20px !important;
|
||||
|
||||
.u-form-item__body {
|
||||
// .default {
|
||||
// width: 160px;
|
||||
// height: 160px;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.border {
|
||||
::v-deep .u-form-item__body {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
background: #3975c6;
|
||||
padding: 34px 0;
|
||||
text-align: center;
|
||||
font-size: 32px;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.right-span {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
|
||||
::v-deep .u-icon__label {
|
||||
font-size: 28px!important;
|
||||
}
|
||||
|
||||
::v-deep .uicon-arrow-right{
|
||||
color: #c0c4cc!important;
|
||||
}
|
||||
}
|
||||
::v-deep .uni-input-placeholder {
|
||||
color: #999!important;
|
||||
font-size: 28px!important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user