|
|
|
|
@ -9,12 +9,12 @@
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label-position="top" label="现场照片">
|
|
|
|
|
<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')}">
|
|
|
|
|
</u-upload>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label-position="top" label="状态">
|
|
|
|
|
<u-radio-group v-model="form.status">
|
|
|
|
|
<u-radio-group v-model="normalstatus">
|
|
|
|
|
<u-radio
|
|
|
|
|
@change="radioChange"
|
|
|
|
|
v-for="(item, index) in statuss" :key="index"
|
|
|
|
|
@ -24,14 +24,14 @@
|
|
|
|
|
</u-radio>
|
|
|
|
|
</u-radio-group>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<div v-if="form.status==2">
|
|
|
|
|
<div v-if="normalstatus==2">
|
|
|
|
|
<u-form-item label="" label-position="top" prop="nextStatus">
|
|
|
|
|
<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"
|
|
|
|
|
@confirm="confirmNext"></u-select>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</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-input v-model="form.deal_content" type='textarea' height='100' :border="true" />
|
|
|
|
|
</u-form-item>
|
|
|
|
|
@ -43,7 +43,7 @@
|
|
|
|
|
</u-upload>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="nextStatusId==3">
|
|
|
|
|
<div v-if="normalstatus==2 && nextStatusId==3">
|
|
|
|
|
<u-form-item label="位置" label-position="top" required>
|
|
|
|
|
<!-- <text>{{form.address}}</text> -->
|
|
|
|
|
<u-input v-model="form.address" disabled type='text'/>
|
|
|
|
|
@ -65,10 +65,11 @@
|
|
|
|
|
},
|
|
|
|
|
showMap: false,
|
|
|
|
|
nextStatus:"可现场处理",
|
|
|
|
|
normalstatus:1,
|
|
|
|
|
nextStatusId:2,
|
|
|
|
|
nextShow:false,
|
|
|
|
|
action: "",
|
|
|
|
|
location: {},
|
|
|
|
|
action: "",
|
|
|
|
|
infoId:"",
|
|
|
|
|
slist:[
|
|
|
|
|
{
|
|
|
|
|
id:2,
|
|
|
|
|
@ -114,8 +115,13 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
var that = this;
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
var that = this;
|
|
|
|
|
if(options.id){
|
|
|
|
|
this.infoId = options.id;
|
|
|
|
|
this.showInfo(this.infoId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.action = this.util.HOST + "/api/mobile/upload-file";
|
|
|
|
|
this.otherData.token = uni.getStorageSync("userInfo_token").access_token;
|
|
|
|
|
},
|
|
|
|
|
@ -126,11 +132,8 @@
|
|
|
|
|
type: "gcj02",
|
|
|
|
|
geocode:true,
|
|
|
|
|
success(res) {
|
|
|
|
|
that.location = res;
|
|
|
|
|
that.form.deal_latitude = res.latitude;
|
|
|
|
|
that.form.deal_longitude = res.longitude;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
that.form.deal_longitude = res.longitude;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
uni.getSystemInfo({
|
|
|
|
|
@ -142,36 +145,44 @@
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
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
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
toremove(index, lists, name,whatfile) {
|
|
|
|
|
if(whatfile=="filesList"){
|
|
|
|
|
this.form.files_list = list;
|
|
|
|
|
this.filesList.splice(index,1)
|
|
|
|
|
// this.form.files_list = list;
|
|
|
|
|
}
|
|
|
|
|
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) {
|
|
|
|
|
console.log(lists)
|
|
|
|
|
console.log(whatfile)
|
|
|
|
|
toupload(lists, name, whatfile) {
|
|
|
|
|
var that = this;
|
|
|
|
|
let list = [];
|
|
|
|
|
for (var m of lists) {
|
|
|
|
|
list.push({
|
|
|
|
|
upload_id: m.response.id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if(whatfile=="filesList"){
|
|
|
|
|
this.form.files_list = list;
|
|
|
|
|
}
|
|
|
|
|
if(whatfile=="dealFilesList"){
|
|
|
|
|
this.form.deal_files_list = list;
|
|
|
|
|
for (var m of lists) {
|
|
|
|
|
if(m.response){
|
|
|
|
|
if(whatfile=="filesList"){
|
|
|
|
|
that.filesList.push(m);
|
|
|
|
|
// this.form.files_list = list;
|
|
|
|
|
}
|
|
|
|
|
if(whatfile=="dealFilesList"){
|
|
|
|
|
that.dealFilesList.push(m);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
radioChange(val){
|
|
|
|
|
@ -188,32 +199,80 @@
|
|
|
|
|
if(that.nextStatusId==3){
|
|
|
|
|
that.form.status = that.nextStatusId
|
|
|
|
|
}else{
|
|
|
|
|
that.form.status = that.normalstatus;
|
|
|
|
|
that.form.deal_latitude = "";
|
|
|
|
|
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;
|
|
|
|
|
this.$refs.uForm.validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
console.log('验证通过');
|
|
|
|
|
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) {
|
|
|
|
|
this.util.alert(res);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log('验证通过');
|
|
|
|
|
if(that.infoId){
|
|
|
|
|
that.util.request({
|
|
|
|
|
api: '/api/mobile/daily-inspection/save',
|
|
|
|
|
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{
|
|
|
|
|
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 {
|
|
|
|
|
console.log('验证失败');
|
|
|
|
|
}
|
|
|
|
|
@ -224,27 +283,58 @@
|
|
|
|
|
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) { //打开地图选择位置
|
|
|
|
|
var that = this;
|
|
|
|
|
uni.chooseLocation({
|
|
|
|
|
longitude : that.form.deal_longitude,
|
|
|
|
|
latitude : that.form.deal_latitude,
|
|
|
|
|
success: res => {
|
|
|
|
|
console.log('位置名称:' + res.name);
|
|
|
|
|
console.log('详细地址:' + res.address);
|
|
|
|
|
console.log('纬度:' + res.latitude);
|
|
|
|
|
console.log('经度:' + res.longitude);
|
|
|
|
|
that.form.address = res.name;
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
type: 'gcj02',
|
|
|
|
|
altitude:true,
|
|
|
|
|
geocode:true,
|
|
|
|
|
success: function(res) {
|
|
|
|
|
that.form.deal_longitude = res.longitude;
|
|
|
|
|
that.form.deal_latitude = res.latitude;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
that.form.deal_longitude = res.longitude;
|
|
|
|
|
that.form.deal_latitude = res.latitude;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|