日常巡查

master
lion 4 years ago
parent 05c65b9726
commit 8a0d748efe

@ -1,10 +1,202 @@
<template> <template>
<view class="boxContent">
</template> <view class="box-header">
</view>
<view class="list" style="padding-top: 20rpx;">
<block>
<u-card :title="lists.created_at" padding="20" margin="20rpx" :border="true">
<view class="" slot="body" @click="todetail(lists.id)">
<u-row gutter="16">
<u-col span="3">
<view class="demo-layout bg-purple">巡查项目</view>
</u-col>
<u-col span="9">
<view class="demo-layout bg-purple-light">{{lists.name}}</view>
</u-col>
</u-row>
<u-row gutter="16">
<u-col span="3">
<view class="demo-layout bg-purple">项目状态</view>
</u-col>
<u-col span="9">
<u-tag v-if="lists.status==1" text="无异常" type="primary" />
<u-tag v-if="lists.status==2" text="已现场处理" type="warning" />
<u-tag v-if="lists.status==3" text="不可现场处理" type="error" />
</u-col>
</u-row>
<u-row gutter="16">
<u-col span="3">
<view class="demo-layout bg-purple">巡查记录</view>
</u-col>
<u-col span="12">
<view class="demo-layout bg-purple-light">{{lists.content}}</view>
</u-col>
</u-row>
<u-row gutter="16">
<u-col span="3">
<view class="demo-layout bg-purple">现场图片</view>
</u-col>
<u-col span="12" v-for="(item,index) in lists.daily_inspection_files">
<u-image style="margin:20rpx 0" width="100%" height="300rpx" :src="item.files.url"></u-image>
</u-col>
</u-row>
<u-row gutter="16" v-if="lists.status==2">
<u-col span="3">
<view class="demo-layout bg-purple">处理记录</view>
</u-col>
<u-col span="12">
<view class="demo-layout bg-purple-light">{{lists.deal_content}}</view>
</u-col>
</u-row>
<u-row gutter="16" v-if="lists.status==2">
<u-col span="4">
<view class="demo-layout bg-purple">处理后照片</view>
</u-col>
<u-col span="12" v-for="(item,index) in lists.daily_inspection_deal_files">
<u-image style="margin:20rpx 0" width="100%" height="300rpx" :src="item.files.url"></u-image>
</u-col>
</u-row>
<u-row gutter="16" v-if="lists.status==3">
<u-col span="3">
<view class="demo-layout bg-purple">定位地址</view>
</u-col>
<u-col span="9">
{{lists.address}}
</u-col>
</u-row>
</view>
</u-card>
</block>
</view>
<script>
</script>
</view>
<style>
</template>
<script>
export default {
data() {
return {
lists:{}
}
},
onLoad(options) {
if(options.id){
this.loadInfo(options.id)
}
},
methods: {
loadInfo: function(id) {
var that = this;
this.util.request({
method:"get",
api: '/api/mobile/daily-inspection/show',
customLoading: false,
data: {
id:id
},
utilSuccess: function(r) {
that.lists = r
},
utilFail: function(res) {
this.util.alert(res);
}
});
}
}
}
</script>
<style>
.boxContent {
background: #f3f4f6;
min-height: 100vh;
}
.footer {
display: flex;
justify-content: flex-end;
}
.box-header {
position: fixed;
top: 0;
width: 100%;
z-index: 99;
}
.u-row {
margin: 10rpx 0;
font-size: 28rpx;
}
.u-card{
z-index: 1;
}
</style>
<style scoped lang="scss">
.overflowmask{
overflow: hidden;
}
.loadmore{
padding:24rpx!important
}
.search-wrap {
background: #007AFF;
padding: 20rpx;
}
.u-config-wrap {
padding: 30rpx;
}
.bg-purple {
font-weight: bold;
}
.slot-content {
background-color: #FFFFFF;
padding: 24rpx;
.item-box {
margin-bottom: 50rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.item {
border: 1px solid $u-type-primary;
color: $u-type-primary;
padding: 8rpx 40rpx;
border-radius: 100rpx;
margin-top: 30rpx;
}
.active {
color: #FFFFFF;
background-color: $u-type-primary;
}
}
}
</style> </style>

@ -9,12 +9,12 @@
</u-form-item> </u-form-item>
<u-form-item label-position="top" label="现场照片"> <u-form-item label-position="top" label="现场照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text="" <u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
:previewFullImage="true" :file-list="filesList" :form-data="otherData" :show-tips="false" @on-uploaded="function(lists, name) {return toupload(lists, name,'filesList')}" :previewFullImage="true" @on-progress="onprogress" @on-success="tosuccess" :file-list="filesList" :form-data="otherData" :show-tips="false" @on-uploaded="function(lists, name) {return toupload(lists, name,'filesList')}"
@on-remove="function(index, lists, name) {return toremove(index, lists, name,'filesList')}"> @on-remove="function(index, lists, name) {return toremove(index, lists, name,'filesList')}">
</u-upload> </u-upload>
</u-form-item> </u-form-item>
<u-form-item label-position="top" label="状态"> <u-form-item label-position="top" label="状态">
<u-radio-group v-model="form.status"> <u-radio-group v-model="normalstatus">
<u-radio <u-radio
@change="radioChange" @change="radioChange"
v-for="(item, index) in statuss" :key="index" v-for="(item, index) in statuss" :key="index"
@ -24,14 +24,14 @@
</u-radio> </u-radio>
</u-radio-group> </u-radio-group>
</u-form-item> </u-form-item>
<div v-if="form.status==2"> <div v-if="normalstatus==2">
<u-form-item label="" label-position="top" prop="nextStatus"> <u-form-item label="" label-position="top" prop="nextStatus">
<u-input v-model="nextStatus" type="select" :border="true" @click="nextShow = true" /> <u-input v-model="nextStatus" type="select" :border="true" @click="nextShow = true" />
<u-select v-model="nextShow" mode="single-column" value-name="id" label-name="name" :list="slist" <u-select v-model="nextShow" mode="single-column" value-name="id" label-name="name" :list="slist"
@confirm="confirmNext"></u-select> @confirm="confirmNext"></u-select>
</u-form-item> </u-form-item>
</div> </div>
<div v-if="form.status==2 && nextStatusId==2"> <div v-if="normalstatus==2 && nextStatusId==2">
<u-form-item label-position="top" label="处理记录" prop="deal_content"> <u-form-item label-position="top" label="处理记录" prop="deal_content">
<u-input v-model="form.deal_content" type='textarea' height='100' :border="true" /> <u-input v-model="form.deal_content" type='textarea' height='100' :border="true" />
</u-form-item> </u-form-item>
@ -43,7 +43,7 @@
</u-upload> </u-upload>
</u-form-item> </u-form-item>
</div> </div>
<div v-if="nextStatusId==3"> <div v-if="normalstatus==2 && nextStatusId==3">
<u-form-item label="位置" label-position="top" required> <u-form-item label="位置" label-position="top" required>
<!-- <text>{{form.address}}</text> --> <!-- <text>{{form.address}}</text> -->
<u-input v-model="form.address" disabled type='text'/> <u-input v-model="form.address" disabled type='text'/>
@ -65,10 +65,11 @@
}, },
showMap: false, showMap: false,
nextStatus:"可现场处理", nextStatus:"可现场处理",
normalstatus:1,
nextStatusId:2, nextStatusId:2,
nextShow:false, nextShow:false,
action: "", action: "",
location: {}, infoId:"",
slist:[ slist:[
{ {
id:2, id:2,
@ -114,8 +115,13 @@
} }
} }
}, },
onLoad() { onLoad(options) {
var that = this; var that = this;
if(options.id){
this.infoId = options.id;
this.showInfo(this.infoId);
}
this.action = this.util.HOST + "/api/mobile/upload-file"; this.action = this.util.HOST + "/api/mobile/upload-file";
this.otherData.token = uni.getStorageSync("userInfo_token").access_token; this.otherData.token = uni.getStorageSync("userInfo_token").access_token;
}, },
@ -126,11 +132,8 @@
type: "gcj02", type: "gcj02",
geocode:true, geocode:true,
success(res) { success(res) {
that.location = res;
that.form.deal_latitude = res.latitude; that.form.deal_latitude = res.latitude;
that.form.deal_longitude = res.longitude; that.form.deal_longitude = res.longitude;
} }
}) })
uni.getSystemInfo({ uni.getSystemInfo({
@ -142,36 +145,44 @@
}, },
methods: { methods: {
toremove(index, lists, name,whatfile) { toremove(index, lists, name,whatfile) {
console.log(lists);
console.log(whatfile);
let list = [];
for (var m of lists) {
list.push({
upload_id: m.response.id
})
}
if(whatfile=="filesList"){ if(whatfile=="filesList"){
this.form.files_list = list; this.filesList.splice(index,1)
// this.form.files_list = list;
} }
if(whatfile=="dealFilesList"){ if(whatfile=="dealFilesList"){
this.form.deal_files_list = list; this.dealFilesList.splice(index,1)
// this.form.deal_files_list = list;
} }
},
onprogress(res){
uni.showToast({
icon: "none",
title: "上传中",
duration: 2000
})
},
tosuccess(){
uni.showToast({
icon: "none",
title: "上传成功",
duration: 2000
})
}, },
toupload(lists, name,whatfile) { toupload(lists, name, whatfile) {
console.log(lists) var that = this;
console.log(whatfile)
let list = []; let list = [];
for (var m of lists) { for (var m of lists) {
list.push({ if(m.response){
upload_id: m.response.id if(whatfile=="filesList"){
}) that.filesList.push(m);
} // this.form.files_list = list;
if(whatfile=="filesList"){ }
this.form.files_list = list; if(whatfile=="dealFilesList"){
} that.dealFilesList.push(m);
if(whatfile=="dealFilesList"){
this.form.deal_files_list = list; }
}
} }
}, },
radioChange(val){ radioChange(val){
@ -188,32 +199,80 @@
if(that.nextStatusId==3){ if(that.nextStatusId==3){
that.form.status = that.nextStatusId that.form.status = that.nextStatusId
}else{ }else{
that.form.status = that.normalstatus;
that.form.deal_latitude = ""; that.form.deal_latitude = "";
that.form.deal_longitude = ""; that.form.deal_longitude = "";
} }
// console.log(that.form); let list = [];
let deallist=[];
for(var mod of that.filesList){
if( mod.response){
list.push({
upload_id: mod.response.id
})
}else{
list.push({
upload_id:mod.id
})
}
}
for(var mod of that.dealFilesList){
if( mod.response){
deallist.push({
upload_id: mod.response.id
})
}else{
deallist.push({
upload_id: mod.id
})
}
}
that.form.files_list = list;
that.form.deal_files_list = deallist;
// return; // return;
this.$refs.uForm.validate(valid => { this.$refs.uForm.validate(valid => {
if (valid) { if (valid) {
console.log('验证通过'); console.log('验证通过');
that.util.request({ if(that.infoId){
api: '/api/mobile/daily-inspection/store', that.util.request({
method: "POST", api: '/api/mobile/daily-inspection/save',
data: that.form, method: "POST",
utilSuccess: function(res) { data: that.form,
uni.showToast({ utilSuccess: function(res) {
icon: "none", uni.showToast({
title: "提交成功", icon: "none",
complete() { title: "提交成功",
that.afterSubmit(res); complete() {
}, that.afterSubmit(res);
duration: 2000 },
}) duration: 2000
}, })
utilFail: function(res) { },
this.util.alert(res); utilFail: function(res) {
} that.util.alert(res);
}); }
});
}else{
that.util.request({
api: '/api/mobile/daily-inspection/store',
method: "POST",
data: that.form,
utilSuccess: function(res) {
uni.showToast({
icon: "none",
title: "提交成功",
complete() {
that.afterSubmit(res);
},
duration: 2000
})
},
utilFail: function(res) {
that.util.alert(res);
}
});
}
} else { } else {
console.log('验证失败'); console.log('验证失败');
} }
@ -224,27 +283,58 @@
url: "../dailyList/dailyList" url: "../dailyList/dailyList"
}) })
}, },
showInfo(id){
var that = this;
that.util.request({
api: '/api/mobile/daily-inspection/show',
method: "get",
data: {
id:id
},
utilSuccess: function(result) {
that.form = result;
that.normalstatus = result.status;
if(result.status==3){
that.nextStatusId = 3;
that.normalstatus = 2;
that.nextStatus = "不可现场处理"
}
let _files = [];
let _dealfiles = [];
for (var mod of result.daily_inspection_files) {
let m = Object.assign({}, mod);
m.url = mod.files.url;
m.id = mod.files.id;
m.name = mod.files.original_name;
_files.push(m);
}
for (var mod of result.daily_inspection_deal_files) {
let m = Object.assign({}, mod);
m.url = mod.files.url;
m.id = mod.files.id;
m.name = mod.files.original_name;
_dealfiles.push(m);
}
that.filesList = _files
that.dealFilesList = _dealfiles
// that.form.files_list = _upfiles;
},
utilFail: function(res) {
that.util.alert(res);
}
});
},
chooseLocation(e) { // chooseLocation(e) { //
var that = this; var that = this;
uni.chooseLocation({ uni.chooseLocation({
longitude : that.form.deal_longitude,
latitude : that.form.deal_latitude,
success: res => { success: res => {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
that.form.address = res.name; that.form.address = res.name;
uni.getLocation({ that.form.deal_longitude = res.longitude;
type: 'gcj02', that.form.deal_latitude = res.latitude;
altitude:true,
geocode:true,
success: function(res) {
that.form.deal_longitude = res.longitude;
that.form.deal_latitude = res.latitude;
}
});
} }
}); });
}, },

@ -19,7 +19,7 @@
</u-dropdown> </u-dropdown>
<block v-for="(item, index) in dataList"> <block v-for="(item, index) in dataList">
<u-card :title="item.created_at" padding="20" margin="20rpx" :border="true" <u-card :title="item.created_at" padding="20" margin="20rpx" :border="true"
:sub-title="item.created_at" :thumb="thumb" thumb-width="36"> :thumb="thumb" thumb-width="36">
<view class="" slot="body" @click="todetail(item.id)"> <view class="" slot="body" @click="todetail(item.id)">
<u-row gutter="16"> <u-row gutter="16">
<u-col span="3"> <u-col span="3">
@ -124,7 +124,6 @@
onReachBottom: function(e) { onReachBottom: function(e) {
console.log(this.currentPage,this.lastPage);
if(this.currentPage>=this.lastPage){ if(this.currentPage>=this.lastPage){
this.loadStatus = "nomore" this.loadStatus = "nomore"
return; return;
@ -133,7 +132,7 @@
}, },
onPullDownRefresh: function(e) { onPullDownRefresh: function(e) {
this.loadStatus = 'loadmore'; this.loadStatus = 'loadmore';
console.log("bbb") console.log("onPullDownRefresh")
this.loadPage(1); this.loadPage(1);
}, },
onShow: function() { onShow: function() {
@ -178,8 +177,7 @@
}, },
loadPage: function(page) { loadPage: function(page) {
uni.hideKeyboard() uni.hideKeyboard()
var that = this; var that = this;
console.log(page)
this.util.request({ this.util.request({
bindThis: that, bindThis: that,
api: '/api/mobile/daily-inspection/index', api: '/api/mobile/daily-inspection/index',
@ -217,7 +215,6 @@
for (var m of dataList) { for (var m of dataList) {
m.created_at = m.created_at.split("T")[0] m.created_at = m.created_at.split("T")[0]
} }
console.log(dataList)
that.currentPage = page; that.currentPage = page;
that.dataList = dataList; that.dataList = dataList;
@ -249,10 +246,13 @@
id:id id:id
}, },
utilSuccess: function(r) { utilSuccess: function(r) {
that.$refs.uToast.show({ uni.showToast({
title: '删除成功', icon: "none",
duration: 2000, title: "提交成功",
url: '/packageB/pages/dailyList/dailyList' complete() {
that.loadPage(1)
},
duration: 2000
}) })
}, },
utilFail:function(r) { utilFail:function(r) {

@ -78,7 +78,8 @@
"style": { "style": {
"navigationBarTitleText": "日常监管巡查", "navigationBarTitleText": "日常监管巡查",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "disableScroll": true
} }
}] }]
}], }],

Loading…
Cancel
Save