<template>
|
<view class="">
|
<view class="content bgc-ff">
|
<u-form labelPosition="left" :model="info" :rules="rules" ref="form" labelWidth="90"
|
:labelStyle="{fontSize:'28rpx'}">
|
|
<u-form-item label="隐患类型" prop="hiddenDangerType" borderBottom ref="phone" v-if="info.type == 1"
|
@click="showPicker = true">
|
<u-input v-model="troubleTypeValue" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
|
inputAlign="right" disabled disabledColor="#ffffff"></u-input>
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
</u-form-item>
|
<u-form-item label="描述" prop="remark" borderBottom ref="remark" required>
|
<u-textarea v-model="info.remark" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
|
inputAlign="right"></u-textarea>
|
</u-form-item>
|
</u-form>
|
</view>
|
|
<view class="upload bgc-ff">
|
<view class="f-28 mb-20">照片</view>
|
<!-- <u-textarea v-model="info.remark" placeholder="请输入内容" border="none"
|
placeholderClass="c-99 f-26"></u-textarea> -->
|
<view class="mt-20">
|
<u-upload :fileList="form.images" :previewFullImage="uploadConfig.previewFullImage"
|
:accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple" :maxCount="uploadConfig.maxCount"
|
:capture="uploadConfig.capture" @afterRead="afterReadImg" @delete="deletePic">
|
<view class="upload-item upload-icon flex_base">
|
<u-icon name="/static/icon/upload.png" width="60rpx" height="60rpx"></u-icon>
|
</view>
|
</u-upload>
|
</view>
|
</view>
|
|
|
<button class="submit-btn" @click="sumitInfo">提交</button>
|
<button class="list-btn" @click="navigatorPage">提交记录</button>
|
|
|
<u-picker :defaultIndex="troubleTypeIndex" :closeOnClickOverlay="true" :show="showPicker"
|
:columns="[troubleTypeList]" @close="showPicker = false" @cancel="showPicker = false" keyName="name"
|
@confirm="confirmPicker"></u-picker>
|
|
|
</view>
|
</template>
|
|
<script>
|
import uploadMixin from "@/mixin/uploadMixin";
|
import {
|
addTroubleReport
|
} from "@/api/school/school.js";
|
import {
|
bizDictionary,
|
bizDictionaryTree
|
} from '@/api/system/dict.js'
|
export default {
|
mixins: [uploadMixin],
|
data() {
|
return {
|
form: {
|
images: []
|
},
|
info: {
|
type: "",
|
hiddenDangerType: "",
|
remark: ""
|
},
|
rules: {
|
'remark': {
|
type: 'string',
|
required: true,
|
message: '请输入描述',
|
trigger: ['blur', 'change']
|
}
|
},
|
desc: "",
|
title: "",
|
curSelectSite: {},
|
troubleTypeList: [],
|
troubleTypeIndex: [0],
|
showPicker: false,
|
troubleTypeValue: ""
|
}
|
},
|
onLoad(option) {
|
if (option.type) {
|
uni.setStorageSync("troubleType", option.type)
|
this.info.type = option.type
|
}
|
if (uni.getStorageSync('troubleType')) {
|
this.info.type = uni.getStorageSync('troubleType')
|
}
|
if (this.info.type == 1) {
|
uni.setNavigationBarTitle({
|
title: '安全隐患' // 设置为你想要显示的标题
|
});
|
|
} else {
|
uni.setNavigationBarTitle({
|
title: '纠纷矛盾排查' // 设置为你想要显示的标题
|
});
|
}
|
this.getAllBizDict()
|
},
|
onShow() {
|
if (uni.getStorageSync('troubleType')) {
|
this.info.type = uni.getStorageSync('troubleType')
|
}
|
// this.info.addressCode = this.curSelectSite.houseCode
|
},
|
methods: {
|
async getAllBizDict() {
|
await this.getBizDict('hiddenDangerType', this.troubleTypeList);
|
},
|
|
// 获取业务字典
|
async getBizDict(code, list) {
|
const param = {
|
code: code
|
}
|
const res = await bizDictionary(param)
|
res.data.forEach(e => {
|
list.push({
|
name: e.dictValue,
|
value: Number(e.dictKey)
|
})
|
})
|
},
|
|
|
//选择隐患类型
|
confirmPicker(e) {
|
this.troubleTypeIndex = e.indexs;
|
this.troubleTypeValue = e.value[0].name;
|
this.info.hiddenDangerType = e.value[0].value;
|
this.showPicker = false;
|
},
|
|
sumitInfo() {
|
this.$refs.form.validate().then(valid => {
|
if (this.form.images.length > 0) {
|
let urls = []
|
this.form.images.forEach(e => {
|
urls.push(e.name)
|
})
|
this.info.images = urls.join(",")
|
}
|
this.info.houseCode = uni.getStorageSync("siteInfo").houseCode;
|
if (uni.getStorageSync("activeRole").roleAlias == "xyty") {
|
this.$set(this.info, "confirmFlag", 4)
|
} else {
|
this.$set(this.info, "isReporting", 1)
|
}
|
addTroubleReport(this.info).then(res => {
|
this.$showTips("提交成功", "success")
|
setTimeout(() => {
|
uni.navigateBack()
|
}, 300)
|
})
|
})
|
},
|
navigatorPage() {
|
let url = `troubleList?type=${this.info.type}`
|
this.$u.func.globalNavigator(url, "navTo")
|
}
|
}
|
}
|
</script>
|
|
<style lang="less">
|
page {
|
background-color: #F5F5F5;
|
}
|
|
.content {
|
margin: 20rpx 30rpx;
|
padding: 0 30rpx;
|
}
|
|
.site-box {
|
padding: 30rpx;
|
margin: 20rpx 30rpx;
|
border-radius: 4rpx;
|
|
.c-aa {
|
color: #aaa;
|
}
|
|
.address {
|
width: 60%;
|
margin-left: 25rpx;
|
}
|
}
|
|
.upload-item {
|
width: 140rpx;
|
height: 140rpx;
|
border: 1px solid #EEEEEE;
|
}
|
|
.upload {
|
margin: 0 30rpx;
|
padding: 30rpx;
|
|
|
}
|
|
.submit-btn {
|
width: 690rpx;
|
height: 78rpx;
|
line-height: 78rpx;
|
background: linear-gradient(163deg, #01BDFC 0%, #017BFC 100%);
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
font-size: 32rpx;
|
color: #fff;
|
margin-top: 50rpx;
|
}
|
|
.list-btn {
|
width: 690rpx;
|
height: 78rpx;
|
line-height: 78rpx;
|
background: linear-gradient(163deg, #c7d7dc 0%, #c3cdd8 100%);
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
font-size: 32rpx;
|
color: #fff;
|
margin-top: 50rpx;
|
}
|
|
.address-row {
|
flex: 1;
|
justify-content: flex-end;
|
align-items: center;
|
}
|
|
.address-content {
|
width: calc(100% - 116rpx - 20rpx);
|
margin-right: 20rpx;
|
text-align: right;
|
}
|
|
.location-btn {
|
width: 116rpx;
|
height: 46rpx;
|
line-height: 46rpx;
|
border-radius: 4rpx;
|
border: 1px solid currentColor;
|
padding: 0;
|
background-color: #fff;
|
text-align: center;
|
}
|
</style>
|