parent
da8b0208e8
commit
b35320720b
@ -0,0 +1,397 @@
|
||||
<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-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>
|
||||
</div>
|
||||
</u-form>
|
||||
<u-button type="primary" @click="submit">提交</u-button>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
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:"",
|
||||
changedealFilesList:[],
|
||||
form: {
|
||||
feedback_department_id:"",
|
||||
name:"",
|
||||
content:"",
|
||||
status:0,
|
||||
is_rain:"",
|
||||
is_scene:"",
|
||||
tip:"",
|
||||
result:"",
|
||||
address:"",
|
||||
files_list:"",
|
||||
files_end_list:""
|
||||
},
|
||||
width: 300,
|
||||
height: 300,
|
||||
rules: {
|
||||
name: [{
|
||||
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();
|
||||
|
||||
this.action = this.util.HOST + "/api/mobile/upload-file";
|
||||
this.otherData.token = uni.getStorageSync("userInfo_token").access_token;
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules);
|
||||
let that = this;
|
||||
uni.getLocation({
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
uni.getSystemInfo({
|
||||
complete(res) {
|
||||
that.width = res.screenWidth * .8
|
||||
that.height = res.screenHeight * .6
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
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;
|
||||
}
|
||||
},
|
||||
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;
|
||||
|
||||
}
|
||||
},
|
||||
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;
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('验证失败');
|
||||
}
|
||||
});
|
||||
},
|
||||
afterSubmit(res) {
|
||||
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;
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.popuptitle {
|
||||
background: #2979ff;
|
||||
color: #fff;
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue