|
|
@@ -2,6 +2,7 @@
|
|
|
<!-- istask 0 完成任务模块 1 任务模块 2 监督模块 3监督记录模块-->
|
|
|
<template name="task-details">
|
|
|
<view class="" style="padding-bottom: 40rpx;">
|
|
|
+
|
|
|
<!-- <view class="taskbtn">
|
|
|
<view class="taskbtn_item" v-if="istask==1" @click="taskfillingcom">
|
|
|
提交
|
|
|
@@ -45,7 +46,7 @@
|
|
|
</view>
|
|
|
<view class="taskbox_item2">
|
|
|
<view class="taskbox_item_l">
|
|
|
- 操作描述
|
|
|
+ 任务描述
|
|
|
</view>
|
|
|
<view class="taskbox_item_r">
|
|
|
{{taskinfo.tesk_msg}}
|
|
|
@@ -62,6 +63,9 @@
|
|
|
<u-icon size="20" name="plus" color="#409eff"></u-icon>
|
|
|
</view>
|
|
|
<view class="imgitem" v-for="item,index in urllist" :key="index">
|
|
|
+ <view class="icon" @click="deleimg(index)">
|
|
|
+ <u-icon name="close" color="#fff"></u-icon>
|
|
|
+ </view>
|
|
|
<image :src="baseUrl+item" mode="" class="img"></image>
|
|
|
<!-- <u--image :src="baseUrl+item" class="img">
|
|
|
<view slot="error" style="font-size: 24rpx;">加载失败</view>
|
|
|
@@ -80,7 +84,7 @@
|
|
|
</view>
|
|
|
<view class="imgbox_box">
|
|
|
<view class="imgitem" v-for="item,index in taskinfo.img_list" :key="index">
|
|
|
- <image :src="baseUrl+item" mode="" class="img"></image>
|
|
|
+ <image :src="baseUrl+item" mode="" class="img" @click="examine(index)"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -90,7 +94,7 @@
|
|
|
任务汇报
|
|
|
</view>
|
|
|
<view class="textareainput" v-if="taskshow">
|
|
|
- <u--textarea v-model="textareavalue" placeholder="请输入内容"></u--textarea>
|
|
|
+ <u--textarea v-model="textareavalue" placeholder="请输入内容" :maxlength="200" autoHeight count></u--textarea>
|
|
|
</view>
|
|
|
<view class="textarea" v-else>
|
|
|
{{taskinfo.report_msg || "暂无描述"}}
|
|
|
@@ -163,9 +167,10 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <kps-image-cutter @ok="onok" @cancel="oncancle" :url="kpsurlL" :fixed="false" :blob="false" :maxWidth="500"
|
|
|
+ <kps-image-cutter @ok="onok" @cancel="oncancle" :url="kpsurlL" :fixed="true" :blob="false" :maxWidth="500"
|
|
|
:maxHeight="500"></kps-image-cutter>
|
|
|
<u-loading-page loading-text="加载中..." :loading="loading" font-size="16"></u-loading-page>
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -212,19 +217,45 @@
|
|
|
}
|
|
|
this.taskfillingdraft()
|
|
|
},
|
|
|
+ kpsurlL(news, old) {
|
|
|
+ if (this.istask == 1) {
|
|
|
+ if (news != "") {
|
|
|
+ let pages = getCurrentPages();
|
|
|
+ var page = pages[pages.length - 1];
|
|
|
+ var currentWebview = page.$getAppWebview();
|
|
|
+ currentWebview.setTitleNViewButtonStyle(0, {
|
|
|
+ text: " ",
|
|
|
+ });
|
|
|
+ this.$store.state.kpsurlL = 1
|
|
|
+ } else {
|
|
|
+ let pages = getCurrentPages();
|
|
|
+ var page = pages[pages.length - 1];
|
|
|
+ var currentWebview = page.$getAppWebview();
|
|
|
+ currentWebview.setTitleNViewButtonStyle(0, {
|
|
|
+ text: "提交",
|
|
|
+ });
|
|
|
+ this.$store.state.kpsurlL = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
wornlist() {
|
|
|
- return store.state.wornlist
|
|
|
+ return this.$store.state.wornlist
|
|
|
},
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ deleimg(index) {
|
|
|
+ // console.log(this.urllist)
|
|
|
+ this.urllist.splice(index, 1)
|
|
|
+ },
|
|
|
gainimg() { //添加图片
|
|
|
uni.chooseImage({
|
|
|
count: 1, //默认9
|
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
- sourceType: ['album', 'camera'], //从相册选择
|
|
|
+ sourceType: ['camera'], //从相册选择
|
|
|
success: (res) => {
|
|
|
console.log(res)
|
|
|
// this.urllist.push(res.tempFilePaths[0])
|
|
|
@@ -257,41 +288,48 @@
|
|
|
task_id: id,
|
|
|
}
|
|
|
})
|
|
|
+ console.log(res)
|
|
|
this.taskinfo = res
|
|
|
- if(this.taskinfo.img_list == "" || this.taskinfo.img_list.length==0){
|
|
|
+ if (this.taskinfo.img_list == "" || this.taskinfo.img_list.length == 0) {
|
|
|
this.taskinfo.img_list = []
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.taskinfo.img_list = JSON.parse(this.taskinfo.img_list)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (this.taskinfo.task_type == "有害生物监测") {
|
|
|
this.task_type = true
|
|
|
} else {
|
|
|
this.task_type = false
|
|
|
}
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: this.taskinfo.task_type //这是修改后的导航栏文字
|
|
|
+ })
|
|
|
this.loading = false
|
|
|
console.log(res)
|
|
|
},
|
|
|
taskfillingcom() {
|
|
|
- console.log(this.urllist)
|
|
|
- var tf = this.taskinfo.trap_record_list.every((item)=>{
|
|
|
+ console.log(this.taskinfo.trap_record_list)
|
|
|
+ var tf = this.taskinfo.trap_record_list.every((item) => {
|
|
|
+ console.log(item.report_status)
|
|
|
return item.report_status != ""
|
|
|
})
|
|
|
// console.log(tf)
|
|
|
- if(this.urllist.length==0){
|
|
|
+ if (this.urllist.length == 0) {
|
|
|
uni.$u.toast('请拍摄图片进行签到')
|
|
|
- }else if(this.textareavalue==""){
|
|
|
+ } else if (this.textareavalue == "") {
|
|
|
uni.$u.toast('请填写任务汇报')
|
|
|
- }else if(!tf){
|
|
|
- if(this.task_type){
|
|
|
- uni.$u.toast('请完成填写设备登记')
|
|
|
- }else{
|
|
|
+ } else if (!tf) {
|
|
|
+ if (this.task_type) {
|
|
|
+ uni.$u.toast('请将所有设备全部登记后提交!')
|
|
|
+ } else {
|
|
|
+ // this.taskfillingdraft()+
|
|
|
this.taskfilling()
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
+ // this.taskfillingdraft()
|
|
|
this.taskfilling()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
async taskfilling() { //任务填报接口
|
|
|
const res = await this.$myRequest({
|
|
|
@@ -300,18 +338,21 @@
|
|
|
// task_id:id,
|
|
|
task_id: this.task_id, // 是 任务id
|
|
|
report_msg: this.textareavalue, // 是 任务汇报内容
|
|
|
- img_list: JSON.stringify(this.urllist), // 是 图片列表 ['http://www.c.com']
|
|
|
+ img_list: JSON.stringify(this
|
|
|
+ .urllist), // 是 图片列表 ['http://www.c.com']
|
|
|
}
|
|
|
})
|
|
|
+ console.log(res)
|
|
|
this.$emit('returnpage')
|
|
|
},
|
|
|
async taskfillingdraft() { //任务填报接口
|
|
|
console.log(this.draft)
|
|
|
var arr = []
|
|
|
- for(var i=0;i<this.taskinfo.trap_record_list.length;i++){
|
|
|
- if(this.taskinfo.trap_record_list[i].report_status!=""&&this.taskinfo.trap_record_list[i].id!=this.draft.record_id){
|
|
|
+ for (var i = 0; i < this.taskinfo.trap_record_list.length; i++) {
|
|
|
+ if (this.taskinfo.trap_record_list[i].report_status != "" && this.taskinfo.trap_record_list[i]
|
|
|
+ .id != this.draft.record_id) {
|
|
|
// arr.push()
|
|
|
- var obj ={
|
|
|
+ var obj = {
|
|
|
record_id: this.taskinfo.trap_record_list[i].id, // 填报记录id
|
|
|
report_status: this.taskinfo.trap_record_list[i].report_status, // 填报记录状态
|
|
|
pest_list: this.taskinfo.trap_record_list[i].pest_list
|
|
|
@@ -319,17 +360,31 @@
|
|
|
arr.push(obj)
|
|
|
}
|
|
|
}
|
|
|
+ console.log(this.draft)
|
|
|
arr.push(this.draft)
|
|
|
- const res = await this.$myRequest({
|
|
|
- url: '/api/api_gateway?method=app.task.task_filling_draft',
|
|
|
- data: {
|
|
|
- // task_id:id,
|
|
|
+ var data = {}
|
|
|
+ if (this.task_type) {
|
|
|
+ data = {
|
|
|
+ task_id: this.task_id, // 是 任务id
|
|
|
+ report_msg: this.textareavalue, // 是 任务汇报内容
|
|
|
+ img_list: JSON.stringify(this.urllist), // 是 图片列表 ['http://www.c.com']
|
|
|
+ trap_record_list: JSON.stringify(arr),
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ data = {
|
|
|
task_id: this.task_id, // 是 任务id
|
|
|
report_msg: this.textareavalue, // 是 任务汇报内容
|
|
|
- img_list: this.urllist, // 是 图片列表 ['http://www.c.com']
|
|
|
- trap_record_list: JSON.stringify(arr),// 是 害虫填报记录列表
|
|
|
+ img_list: JSON.stringify(this.urllist), // 是 图片列表 ['http://www.c.com']
|
|
|
}
|
|
|
+ }
|
|
|
+ console.log(data)
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/api/api_gateway?method=app.task.task_filling_draft',
|
|
|
+ data: data,
|
|
|
})
|
|
|
+ console.log(res)
|
|
|
+ // this.$store.state.wornlist = {}
|
|
|
+ // this.taskfilling()
|
|
|
},
|
|
|
skip() { //跳转
|
|
|
this.$emit('tosubm')
|
|
|
@@ -351,9 +406,20 @@
|
|
|
}
|
|
|
this.$emit('toinsect', JSON.stringify(obj))
|
|
|
},
|
|
|
- tolist(){
|
|
|
+ tolist() {
|
|
|
this.$emit('tolist', this.task_id)
|
|
|
- }
|
|
|
+ },
|
|
|
+ examine(index) {
|
|
|
+ var imgarr = []
|
|
|
+ for (var i = 0; i < this.taskinfo.img_list.length; i++) {
|
|
|
+ imgarr.push(this.baseUrl + this.taskinfo.img_list[i])
|
|
|
+ }
|
|
|
+ console.log(imgarr)
|
|
|
+ uni.previewImage({
|
|
|
+ urls: imgarr,
|
|
|
+ current: index
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
@@ -441,11 +507,25 @@
|
|
|
height: 140rpx;
|
|
|
margin-right: 30rpx;
|
|
|
margin-bottom: 30rpx;
|
|
|
+ position: relative;
|
|
|
|
|
|
.img {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+
|
|
|
+ .icon {
|
|
|
+ position: absolute;
|
|
|
+ top: -20rpx;
|
|
|
+ right: -20rpx;
|
|
|
+ z-index: 9;
|
|
|
+ width: 40rpx;
|
|
|
+ height: 40rpx;
|
|
|
+ border-radius: 50%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-around;
|
|
|
+ background-color: red;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -529,6 +609,7 @@
|
|
|
border-bottom: 1px solid #F6F6F6;
|
|
|
|
|
|
.basebox_info_item_l {
|
|
|
+ width: 350rpx;
|
|
|
font-size: 28rpx;
|
|
|
}
|
|
|
|