刘翔宇-旅管家 4 years ago
parent 6cefaf521f
commit 424d83e55d

@ -1,66 +1,66 @@
<template>
<view class="content">
<u-form :model="form" ref="uForm">
<u-form-item label="反馈科室" label-position="top" prop="type">
<u-input placeholder="请选择反馈科室" v-model="depName" type="select" :border="true" @click="depshow = true" />
<!-- <u-picker :show="typeShow" keyName="name" :columns="rainArr.rainTypes" @confirm="confirmType"></u-picker> -->
<u-select v-model="depshow" mode="single-column" value-name="id" label-name="name" :list="rainArr.depList"
@confirm="confirmDepType"></u-select>
<u-form :model="form" ref="uForm">
<u-form-item label="反馈科室" label-position="top" prop="type">
<u-input placeholder="请选择反馈科室" v-model="depName" type="select" :border="true" @click="depshow = true" />
<!-- <u-picker :show="typeShow" keyName="name" :columns="rainArr.rainTypes" @confirm="confirmType"></u-picker> -->
<u-select v-model="depshow" mode="single-column" value-name="id" label-name="name" :list="rainArr.depList"
@confirm="confirmDepType"></u-select>
</u-form-item>
<u-form-item label="工单标题" label-position="top" prop="name" required>
<u-input v-model="form.name" type="text" :border="true" placeholder="请填写标题"/>
</u-form-item>
<u-form-item label="地址" label-position="top" required>
<!-- <text>{{form.address}}</text> -->
<u-input v-model="form.address" disabled type='text'/>
<u-button shape="square" slot='right' size="mini" @click="chooseLocation" type="info">重新获取</u-button>
</u-form-item>
<u-form-item label-position="top" label="内容" prop="content" required>
<u-input v-model="form.content" placeholder="请填写内容" type='textarea' height='100' :border="true" />
</u-form-item>
<u-form-item label-position="top" label="现场照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
: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="异常处置建议" prop="tip">
<u-input v-model="form.tip" placeholder="请填写异常处置建议" type='textarea' height='100' :border="true" />
</u-form-item>
<u-form-item labelWidth="240" label-position="left" label="是否隶属于雨管科">
<u-radio-group v-model="form.is_rain">
<u-radio
v-for="(item, index) in rainArr.rains" :key="index"
:name="item.id"
>
{{item.name}}
</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item labelWidth="240" label-position="left" label="是否现场处理">
<u-radio-group v-model="form.is_scene" @change="radioGroupChange">
<u-radio
v-for="(item, index) in rainArr.scenes" :key="index"
:name="item.id"
>
{{item.name}}
</u-radio>
</u-radio-group>
</u-form-item>
<div v-if="form.is_scene==1">
<u-form-item label-position="top" label="现场处理结果" prop="result">
<u-input v-model="form.result" type='textarea' height='100' :border="true" />
</u-form-item>
<u-form-item label-position="top" label="处理后照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
:previewFullImage="true" @on-progress="onprogress" @on-success="tosuccess" :file-list="dealFilesList" :form-data="otherData" :show-tips="false" @on-uploaded="function(lists, name) {return toupload(lists, name,'dealFilesList')}"
@on-remove="function(index, lists, name) {return toremove(index, lists, name,'dealFilesList')}">
</u-upload>
</u-form-item>
</u-form-item>
<u-form-item label="地址" label-position="top" required>
<!-- <text>{{form.address}}</text> -->
<u-input v-model="form.address" disabled type='text'/>
<u-button shape="square" slot='right' size="mini" @click="chooseLocation" type="info">重新获取</u-button>
</u-form-item>
<u-form-item label-position="top" label="内容" prop="content" required>
<u-input v-model="form.content" placeholder="请填写内容" type='textarea' height='100' :border="true" />
</u-form-item>
<u-form-item label-position="top" label="现场照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
: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="异常处置建议" prop="tip">
<u-input v-model="form.tip" placeholder="请填写异常处置建议" type='textarea' height='100' :border="true" />
</u-form-item>
<u-form-item labelWidth="240" label-position="left" label="是否隶属于雨管科">
<u-radio-group v-model="form.is_rain">
<u-radio
v-for="(item, index) in rainArr.rains" :key="index"
:name="item.id"
>
{{item.name}}
</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item labelWidth="240" label-position="left" label="是否现场处理">
<u-radio-group v-model="form.is_scene" @change="radioGroupChange">
<u-radio
v-for="(item, index) in rainArr.scenes" :key="index"
:name="item.id"
>
{{item.name}}
</u-radio>
</u-radio-group>
</u-form-item>
<div v-if="form.is_scene==1">
<u-form-item label-position="top" label="现场处理结果" prop="result">
<u-input v-model="form.result" type='textarea' height='100' :border="true" />
</u-form-item>
<u-form-item label-position="top" label="处理后照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
:previewFullImage="true" @on-progress="onprogress" @on-success="tosuccess" :file-list="dealFilesList" :form-data="otherData" :show-tips="false" @on-uploaded="function(lists, name) {return toupload(lists, name,'dealFilesList')}"
@on-remove="function(index, lists, name) {return toremove(index, lists, name,'dealFilesList')}">
</u-upload>
</u-form-item>
</div>
</u-form>
<u-button type="primary" @click="submit"></u-button>
@ -74,44 +74,44 @@
return {
otherData: {
token: ""
},
depshow:false,
depName:"",
rainArr:{
depList:[],
rains:[{
id:0,
name:"否"
},{
id:1,
name:"是"
}],
scenes:[{
id:0,
name:"否"
},{
id:1,
name:"是"
}]
},
action: "",
infoId:"",
filesList:[],
dealFilesList:[],
changeResult:"",
depshow:false,
depName:"",
rainArr:{
depList:[],
rains:[{
id:0,
name:"否"
},{
id:1,
name:"是"
}],
scenes:[{
id:0,
name:"否"
},{
id:1,
name:"是"
}]
},
action: "",
infoId:"",
filesList:[],
dealFilesList:[],
changeResult:"",
changedealFilesList:[],
form: {
form: {
feedback_department_id:"",
name:"",
content:"",
status:0,
is_rain:"",
is_scene:"",
tip:"",
result:"",
address:"",
files_list:"",
name:"",
content:"",
status:0,
is_rain:"",
is_scene:"",
tip:"",
result:"",
address:"",
files_list:"",
files_end_list:""
},
width: 300,
@ -122,23 +122,23 @@
message: '请填写标题',
//
trigger: ['blur'],
}],
content: [{
required: true,
message: '请填写内容',
//
trigger: ['blur'],
}],
content: [{
required: true,
message: '请填写内容',
//
trigger: ['blur'],
}]
}
}
},
onLoad(options) {
var that = this;
if(options.id){
this.infoId = options.id;
this.showInfo(this.infoId);
}
this.loadDep();
var that = this;
if(options.id){
this.infoId = options.id;
this.showInfo(this.infoId);
}
this.loadDep();
this.action = this.util.HOST + "/api/mobile/upload-file";
this.otherData.token = uni.getStorageSync("userInfo_token").access_token;
@ -147,17 +147,17 @@
this.$refs.uForm.setRules(this.rules);
let that = this;
uni.getLocation({
type: "gcj02",
type: "gcj02",
geocode:true,
success(res) {
const url = "https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location="+res.latitude+","+res.longitude+"&output=jsonp"
that.$jsonp(
url
).then(re => {
that.form.address = re.result.formatted_addresses.recommend
const url = "https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location="+res.latitude+","+res.longitude+"&output=jsonp"
that.$jsonp(
url
).then(re => {
that.form.address = re.result.formatted_addresses.recommend
})
}
}
})
uni.getSystemInfo({
@ -168,150 +168,150 @@
})
},
methods: {
loadDep(){
var that = this
that.util.request({
api: '/api/mobile/other/department-list',
method: "get",
data: {
is_tree:0
},
utilSuccess: function(res) {
that.rainArr.depList = res
},
utilFail: function(res) {
that.util.alert(res);
}
});
},
radioGroupChange(e){
console.log(e)
if(e==0){
this.form.result = "";
this.dealFilesList = [];
}else{
this.form.result = this.changeResult;
this.dealFilesList = this.changedealFilesList;
}
},
confirmDepType(val){
var that = this
console.log(val)
that.form.feedback_department_id = val[0].value
that.depName = val[0].label
methods: {
loadDep(){
var that = this
that.util.request({
api: '/api/mobile/other/department-list',
method: "get",
data: {
is_tree:0
},
utilSuccess: function(res) {
that.rainArr.depList = res
},
utilFail: function(res) {
that.util.alert(res);
}
});
},
radioGroupChange(e){
console.log(e)
if(e==0){
this.form.result = "";
this.dealFilesList = [];
}else{
this.form.result = this.changeResult;
this.dealFilesList = this.changedealFilesList;
}
},
confirmDepType(val){
var that = this
console.log(val)
that.form.feedback_department_id = val[0].value
that.depName = val[0].label
},
toremove(index, lists, name,whatfile) {
if(whatfile=="filesList"){
this.filesList.splice(index,1)
// this.form.files_list = list;
}
if(whatfile=="dealFilesList"){
this.dealFilesList.splice(index,1)
// this.form.files_end_list = list;
toremove(index, lists, name,whatfile) {
if(whatfile=="filesList"){
this.filesList.splice(index,1)
// this.form.files_list = list;
}
},
onprogress(res){
uni.showToast({
icon: "none",
title: "上传中",
duration: 2000
})
},
tosuccess(){
uni.showToast({
icon: "none",
title: "上传成功",
duration: 2000
})
if(whatfile=="dealFilesList"){
this.dealFilesList.splice(index,1)
// this.form.files_end_list = list;
}
},
onprogress(res){
uni.showToast({
icon: "none",
title: "上传中",
duration: 2000
})
},
toupload(lists, name, whatfile) {
tosuccess(){
uni.showToast({
icon: "none",
title: "上传成功",
duration: 2000
})
},
toupload(lists, name, whatfile) {
var that = this;
let list = [];
if(whatfile=="filesList"){
that.filesList = lists
// this.form.files_list = list;
}
if(whatfile=="dealFilesList"){
that.dealFilesList = lists;
let list = [];
if(whatfile=="filesList"){
that.filesList = lists
// this.form.files_list = list;
}
if(whatfile=="dealFilesList"){
that.dealFilesList = lists;
}
},
submit() {
let that = this;
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.files_end_list = deallist;
that.changeResult = that.form.result
that.changedealFilesList = that.deallist
console.log("form",that.form)
// return;
let that = this;
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.files_end_list = deallist;
that.changeResult = that.form.result
that.changedealFilesList = that.deallist
console.log("form",that.form)
// return;
// return;
this.$refs.uForm.validate(valid => {
if (valid) {
console.log('验证通过');
if(that.infoId){
that.util.request({
api: '/api/mobile/mobile-worksheet/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/mobile-worksheet/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);
}
});
console.log('验证通过');
if(that.infoId){
that.util.request({
api: '/api/mobile/mobile-worksheet/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/mobile-worksheet/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 {
@ -323,61 +323,61 @@
uni.redirectTo({
url: "../orderList/orderList"
})
},
showInfo(id){
var that = this;
that.util.request({
api: '/api/mobile/mobile-worksheet/show',
method: "get",
data: {
id:id
},
utilSuccess: function(result) {
that.form = result;
for(var m of that.rainArr.depList){
if(result.feedback_department_id==m.id){
console.log(m)
that.depName = m.name
}
}
let _files = [];
let _dealfiles = [];
for (var mod of result.worksheet_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.worksheet_end_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.changeResult = result.result
that.changedealFilesList = _dealfiles
// that.form.files_list = _upfiles;
},
utilFail: function(res) {
that.util.alert(res);
}
});
},
chooseLocation(e) { //
var that = this;
uni.chooseLocation({
success: res => {
that.form.address = res.name;
}
});
},
},
showInfo(id){
var that = this;
that.util.request({
api: '/api/mobile/mobile-worksheet/show',
method: "get",
data: {
id:id
},
utilSuccess: function(result) {
that.form = result;
for(var m of that.rainArr.depList){
if(result.feedback_department_id==m.id){
console.log(m)
that.depName = m.name
}
}
let _files = [];
let _dealfiles = [];
for (var mod of result.worksheet_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.worksheet_end_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.changeResult = result.result
that.changedealFilesList = _dealfiles
// that.form.files_list = _upfiles;
},
utilFail: function(res) {
that.util.alert(res);
}
});
},
chooseLocation(e) { //
var that = this;
uni.chooseLocation({
success: res => {
that.form.address = res.name;
}
});
},
}
@ -390,8 +390,8 @@
}
.popuptitle {
background: #2979ff;
background: #0385e5;
color: #fff;
padding: 20rpx 30rpx;
}
</style>
</style>

@ -50,8 +50,8 @@
location: {},
plist: [],
list: [],
listUnit: [],
filesList:[],
listUnit: [],
filesList:[],
infoId:"",
form: {
unitName: "",
@ -91,10 +91,10 @@
'number': "general_type",
}, function(res) {
that.plist = res;
});
if(options.id){
this.infoId = options.id;
this.showInfo(this.infoId);
});
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;
@ -108,12 +108,12 @@
success(res) {
that.location = res;
that.form.latitude = res.latitude;
that.form.longitude = res.longitude;
const url = "https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location="+res.latitude+","+res.longitude+"&output=jsonp"
that.$jsonp(
url
).then(re => {
that.form.address = re.result.formatted_addresses.recommend
that.form.longitude = res.longitude;
const url = "https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location="+res.latitude+","+res.longitude+"&output=jsonp"
that.$jsonp(
url
).then(re => {
that.form.address = re.result.formatted_addresses.recommend
})
}
})
@ -125,20 +125,20 @@
})
},
methods: {
onprogress(res){
uni.showToast({
icon: "none",
title: "上传中",
duration: 2000
})
},
tosuccess(){
uni.showToast({
icon: "none",
title: "上传成功",
duration: 2000
})
methods: {
onprogress(res){
uni.showToast({
icon: "none",
title: "上传中",
duration: 2000
})
},
tosuccess(){
uni.showToast({
icon: "none",
title: "上传成功",
duration: 2000
})
},
toremove(index, lists, nam) {
console.log(lists);
@ -148,9 +148,9 @@
toupload(lists, name) {
console.log(lists)
let list = [];
// for (var m of lists) {
// if(m.response){
// this.filesList.push(m)
// for (var m of lists) {
// if(m.response){
// this.filesList.push(m)
// }
// }
this.filesList = list;
@ -185,95 +185,95 @@
}
});
},
showInfo(id){
var that = this;
that.util.request({
api: '/api/mobile/common-inspection/show',
method: "get",
data: {
id:id
},
utilSuccess: function(result) {
that.form = result;
that.form.typeName = result.ask_type_detail.value;
that.form.contentName = result.ask_content_detail.value;
that.form.unitName = result.feedback_department.name
let _files = [];
for (var mod of result.common_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);
}
that.filesList = _files
// that.form.files_list = _upfiles;
},
utilFail: function(res) {
that.util.alert(res);
}
});
},
showInfo(id){
var that = this;
that.util.request({
api: '/api/mobile/common-inspection/show',
method: "get",
data: {
id:id
},
utilSuccess: function(result) {
that.form = result;
that.form.typeName = result.ask_type_detail.value;
that.form.contentName = result.ask_content_detail.value;
that.form.unitName = result.feedback_department.name
let _files = [];
for (var mod of result.common_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);
}
that.filesList = _files
// that.form.files_list = _upfiles;
},
utilFail: function(res) {
that.util.alert(res);
}
});
},
submit() {
let that = this;
let list = [];
for(var mod of that.filesList){
if( mod.response){
list.push({
upload_id: mod.response.id
})
}else{
list.push({
upload_id:mod.id
})
}
}
this.form.files_list = list
// console.log(that.form);
let that = this;
let list = [];
for(var mod of that.filesList){
if( mod.response){
list.push({
upload_id: mod.response.id
})
}else{
list.push({
upload_id:mod.id
})
}
}
this.form.files_list = list
// console.log(that.form);
// return;
this.$refs.uForm.validate(valid => {
if (valid) {
console.log('验证通过');
if(that.infoId){
that.util.request({
api: '/api/mobile/common-inspection/save',
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);
}
});
}else{
that.util.request({
api: '/api/mobile/common-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/common-inspection/save',
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);
}
});
}else{
that.util.request({
api: '/api/mobile/common-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);
}
});
}
} else {
@ -293,8 +293,8 @@
this.loadType({
pid: e[0].value
}, function(res) {
that.list = res;
that.form.ask_content_id =""
that.list = res;
that.form.ask_content_id =""
that.form.contentName =""
})
},
@ -302,18 +302,18 @@
this.form.ask_content_id = e[0].value
this.form.contentName = e[0].label
},
chooseLocation(e) { //
var that = this;
uni.chooseLocation({
longitude : that.form.longitude,
latitude : that.form.latitude,
success: res => {
that.form.address = res.name;
that.form.longitude = res.longitude;
that.form.latitude = res.latitude;
}
});
chooseLocation(e) { //
var that = this;
uni.chooseLocation({
longitude : that.form.longitude,
latitude : that.form.latitude,
success: res => {
that.form.address = res.name;
that.form.longitude = res.longitude;
that.form.latitude = res.latitude;
}
});
},
}
@ -326,8 +326,8 @@
}
.popuptitle {
background: #2979ff;
background: #0385e5;
color: #fff;
padding: 20rpx 30rpx;
}
</style>
</style>

@ -3,52 +3,52 @@
<u-form :model="form" ref="uForm">
<u-form-item label="巡查项目" label-position="top" prop="name" required>
<u-input v-model="form.name" type="text" :border="true" placeholder="请填写巡查项目"/>
</u-form-item>
<u-form-item label-position="top" label="巡查记录" prop="content">
<u-input v-model="form.content" type='textarea' height='100' :border="true" />
</u-form-item>
<u-form-item label-position="top" label="现场照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
: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="normalstatus">
<u-radio
@change="radioChange"
v-for="(item, index) in statuss" :key="index"
:name="item.id"
>
{{item.name}}
</u-radio>
</u-radio-group>
</u-form-item>
<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="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>
<u-form-item label-position="top" label="处理后照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
:previewFullImage="true" @on-progress="onprogress" @on-success="tosuccess" :file-list="dealFilesList" :form-data="otherData" :show-tips="false" @on-uploaded="function(lists, name) {return toupload(lists, name,'dealFilesList')}"
@on-remove="function(index, lists, name) {return toremove(index, lists, name,'dealFilesList')}">
</u-upload>
</u-form-item>
</div>
<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'/>
<u-button shape="square" slot='right' size="mini" @click="chooseLocation" type="info">重新获取</u-button>
</u-form-item>
</u-form-item>
<u-form-item label-position="top" label="巡查记录" prop="content">
<u-input v-model="form.content" type='textarea' height='100' :border="true" />
</u-form-item>
<u-form-item label-position="top" label="现场照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
: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="normalstatus">
<u-radio
@change="radioChange"
v-for="(item, index) in statuss" :key="index"
:name="item.id"
>
{{item.name}}
</u-radio>
</u-radio-group>
</u-form-item>
<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="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>
<u-form-item label-position="top" label="处理后照片">
<u-upload ref="uUpload" multiple :maxCount="10" :action="action" upload-text=""
:previewFullImage="true" @on-progress="onprogress" @on-success="tosuccess" :file-list="dealFilesList" :form-data="otherData" :show-tips="false" @on-uploaded="function(lists, name) {return toupload(lists, name,'dealFilesList')}"
@on-remove="function(index, lists, name) {return toremove(index, lists, name,'dealFilesList')}">
</u-upload>
</u-form-item>
</div>
<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'/>
<u-button shape="square" slot='right' size="mini" @click="chooseLocation" type="info">重新获取</u-button>
</u-form-item>
</div>
</u-form>
<u-button type="primary" @click="submit"></u-button>
@ -63,46 +63,46 @@
otherData: {
token: ""
},
showMap: false,
nextStatus:"可现场处理",
normalstatus:1,
nextStatusId:2,
showMap: false,
nextStatus:"可现场处理",
normalstatus:1,
nextStatusId:2,
nextShow:false,
action: "",
infoId:"",
slist:[
{
id:2,
name:"可现场处理"
},
{
id:3,
name:"不可现场处理"
}
],
statuss:[
{
id:1,
name:"无异常"
},
{
id:2,
name:"有异常"
}
],
filesList:[],
action: "",
infoId:"",
slist:[
{
id:2,
name:"可现场处理"
},
{
id:3,
name:"不可现场处理"
}
],
statuss:[
{
id:1,
name:"无异常"
},
{
id:2,
name:"有异常"
}
],
filesList:[],
dealFilesList:[],
form: {
name:"",
content:"",
status:1,
deal_content:"",
deal_longitude:"",
deal_latitude:"",
address:"",
files_list:"",
name:"",
content:"",
status:1,
deal_content:"",
deal_longitude:"",
deal_latitude:"",
address:"",
files_list:"",
deal_files_list:""
},
},
qqmapsdk:"",
width: 300,
height: 300,
@ -117,11 +117,11 @@
}
},
onLoad(options) {
var that = this;
if(options.id){
this.infoId = options.id;
this.showInfo(this.infoId);
}
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;
@ -130,18 +130,18 @@
this.$refs.uForm.setRules(this.rules);
let that = this;
uni.getLocation({
type: "gcj02",
type: "gcj02",
geocode:true,
success(res) {
that.form.deal_latitude = res.latitude;
that.form.deal_longitude = res.longitude;
const url = "https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location="+res.latitude+","+res.longitude+"&output=jsonp"
that.$jsonp(
url
).then(re => {
that.form.address = re.result.formatted_addresses.recommend
that.form.deal_longitude = res.longitude;
const url = "https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location="+res.latitude+","+res.longitude+"&output=jsonp"
that.$jsonp(
url
).then(re => {
that.form.address = re.result.formatted_addresses.recommend
})
}
}
})
uni.getSystemInfo({
@ -153,129 +153,129 @@
},
methods: {
toremove(index, lists, name,whatfile) {
if(whatfile=="filesList"){
this.filesList.splice(index,1)
// this.form.files_list = list;
}
if(whatfile=="dealFilesList"){
this.dealFilesList.splice(index,1)
// this.form.deal_files_list = list;
toremove(index, lists, name,whatfile) {
if(whatfile=="filesList"){
this.filesList.splice(index,1)
// this.form.files_list = list;
}
if(whatfile=="dealFilesList"){
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) {
onprogress(res){
uni.showToast({
icon: "none",
title: "上传中",
duration: 2000
})
},
tosuccess(){
uni.showToast({
icon: "none",
title: "上传成功",
duration: 2000
})
},
toupload(lists, name, whatfile) {
var that = this;
let list = [];
if(whatfile=="filesList"){
that.filesList = lists
// this.form.files_list = list;
}
if(whatfile=="dealFilesList"){
that.dealFilesList = lists;
if(whatfile=="filesList"){
that.filesList = lists
// this.form.files_list = list;
}
},
radioChange(val){
console.log(val)
},
confirmNext(e) {
console.log(e);
var that = this;
that.nextStatusId = e[0].value
that.nextStatus = e[0].label
if(whatfile=="dealFilesList"){
that.dealFilesList = lists;
}
},
radioChange(val){
console.log(val)
},
confirmNext(e) {
console.log(e);
var that = this;
that.nextStatusId = e[0].value
that.nextStatus = e[0].label
},
submit() {
let that = this;
if(that.nextStatusId==3){
that.form.status = that.nextStatusId
}else{
that.form.status = that.normalstatus;
that.form.deal_latitude = "";
that.form.deal_longitude = "";
that.form.address = "";
}
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;
let that = this;
if(that.nextStatusId==3){
that.form.status = that.nextStatusId
}else{
that.form.status = that.normalstatus;
that.form.deal_latitude = "";
that.form.deal_longitude = "";
that.form.address = "";
}
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('验证通过');
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);
}
});
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 {
@ -287,62 +287,62 @@
uni.redirectTo({
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 => {
that.form.address = res.name;
that.form.deal_longitude = res.longitude;
that.form.deal_latitude = res.latitude;
}
});
},
},
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 => {
that.form.address = res.name;
that.form.deal_longitude = res.longitude;
that.form.deal_latitude = res.latitude;
}
});
},
}
@ -355,8 +355,8 @@
}
.popuptitle {
background: #2979ff;
background: #0385e5;
color: #fff;
padding: 20rpx 30rpx;
}
</style>
</style>

@ -73,7 +73,7 @@
a.style.display = 'none';
},
onNavigationBarButtonTap(val) {
uni.navigateBack()
window.android.finish();
},
methods: {
loadInfo() {

@ -3,6 +3,7 @@
<view class="loginHeader">
<view class="loginHeaderTitle">欢迎使用巡查上报系统</view>
<view class="back" @click="back"></view>
</view>
<view class="loginBox">
<u-field v-model="username" label-width=0 icon="account" placeholder="请填写登陆名">
@ -12,7 +13,7 @@
</view>
<view class="loginFoot">
<u-button :ripple="true" @click="loginBind" ripple-bg-color="#2979ff" type="primary">登陆</u-button>
<u-button :ripple="true" @click="loginBind" ripple-bg-color="#0385e5" type="primary">登陆</u-button>
</view>
</view>
</template>
@ -31,6 +32,9 @@
},
methods: {
back: function() {
window.android.finish();
},
loginBind: function() {
let that = this;
@ -94,6 +98,11 @@
.loginHeader {
padding: 80rpx 40rpx;
background: #2979ff;
background: #0385e5;
display: flex;
justify-content: space-around;
}
.back{
color: #FFFFFF;
}
</style>

@ -698,13 +698,13 @@
</script>
<style>
.content {
padding: 20rpx;
}
.popuptitle {
background: #2979ff;
color: #fff;
padding: 20rpx 30rpx;
.content {
padding: 20rpx;
}
.popuptitle {
background: #0385e5;
color: #fff;
padding: 20rpx 30rpx;
}
</style>

@ -493,13 +493,13 @@
</script>
<style>
.content {
padding: 20rpx;
}
.popuptitle {
background: #2979ff;
color: #fff;
padding: 20rpx 30rpx;
.content {
padding: 20rpx;
}
.popuptitle {
background: #0385e5;
color: #fff;
padding: 20rpx 30rpx;
}
</style>

Loading…
Cancel
Save