Commit 4d5adf1c by liuzhanxin

fix

parent 03e8028f
<template> <template>
<view class="top-container" > <view class="top-container">
<view class="detailtext"><text class="titletext">整改项详情</text><text class="contenttext">{{description}}</text></view> <view class="detailtext"><text class="titletext">整改项详情</text><text class="contenttext">{{description}}</text></view>
<view class="detailtext"><text class="titletext">位置</text><text class="contenttext">{{roomName}}</text></view> <view class="detailtext"><text class="titletext">位置</text><text class="contenttext">{{roomName}}</text></view>
<view class="detailtext"><text class="titletext">实验室</text><text class="contenttext">{{roomName}}</text></view> <view class="detailtext"><text class="titletext">实验室</text><text class="contenttext">{{roomName}}</text></view>
<view class="detailtext"><text class="titletextlong">整改项照片</text></view> <view class="detailtext"><text class="titletextlong">整改项照片</text></view>
<view v-if="imgUrl.length==0" class="detailtext"><text class="remind">未上传整改项照片</text></view> <view v-if="imgUrl.length==0" class="detailtext"><text class="remind">未上传整改项照片</text></view>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;flex-direction: row;"> <view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;flex-direction: row;">
<view style="margin-right: 30rpx;" v-for="(item,index) in imgUrl" :key="index"> <view style="margin-right: 30rpx;" v-for="(item,index) in imgUrl" :key="index">
<button class="camera-button"> <button class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" /> <image mod="scaleToFill" class="camera-button" :src="item" />
</button> </button>
</view> </view>
</view>
</view> </view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
imgUrl:[], imgUrl: [],
roomName:"", roomName: "",
description:"", description: "",
detailData:{} detailData: {}
} }
}, },
methods: { methods: {
onLoad() { onLoad() {
var that = this var that = this
uni.$on('rectificationListData',function(data){ uni.$on('rectificationListData', function(data) {
console.log("@@@@@@@@@@@@@@@"+JSON.stringify(data)) console.log("@@@@@@@@@@@@@@@" + JSON.stringify(data))
var detailData = data[0] var detailData = data[0]
that.roomName = JSON.parse(detailData.room).name that.roomName = JSON.parse(detailData.room).name
that.description = detailData.description; that.description = detailData.description;
that.detailData = detailData; that.detailData = detailData;
that.imgUrl = JSON.parse(detailData.images) that.imgUrl = JSON.parse(detailData.images)
that.$forceUpdate(); that.$forceUpdate();
}) })
}, },
onUnload(){ onUnload() {
uni.$off('rectificationListData',function(data){ uni.$off('rectificationListData', function(data) {
}) })
}, },
/*下拉刷新的回调 */ /*下拉刷新的回调 */
downCallback() { downCallback() {
this.mescroll.endSuccess(); this.mescroll.endSuccess();
}, },
/*上拉加载的回调 */ /*上拉加载的回调 */
upCallback(page) { upCallback(page) {
}, },
onNavigationBarButtonTap(){ onNavigationBarButtonTap() {
uni.navigateTo({ uni.navigateTo({
url:"../Security-Check/index?mod=put" url: "../Security-Check/index?mod=put"
}) })
uni.$emit("rectificationEdit",[this.detailData]) uni.$emit("rectificationEdit", [this.detailData])
}, },
} }
} }
</script> </script>
<style> <style>
.top-container { .top-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
padding-left: 20rpx; padding-left: 20rpx;
margin-top: 10rpx; margin-top: 10rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.title {
font-size: 16px; .title {
color: #333333; font-size: 16px;
} color: #333333;
.containter{ }
display: flex;
width: 100%; .containter {
background-color: #F5F5F5; display: flex;
padding: 20rpx; width: 100%;
} background-color: #F5F5F5;
.statuspic{ padding: 20rpx;
width:80rpx; }
height:80rpx;
} .statuspic {
.titletext{ width: 80rpx;
font-size:28rpx; height: 80rpx;
color: #666666; }
margin-right: 78rpx;
flex:1 .titletext {
} font-size: 28rpx;
.titletextlong{ color: #666666;
font-size:28rpx; margin-right: 78rpx;
color: #666666; flex: 1
margin-right: 50rpx; }
flex:1
} .titletextlong {
.contenttext{ font-size: 28rpx;
font-size:28rpx; color: #666666;
color: #333333; margin-right: 50rpx;
flex:3 flex: 1
} }
.pic {
width:80rpx; .contenttext {
height:80rpx; font-size: 28rpx;
} color: #333333;
.remind { flex: 3
font-size:32rpx; }
color: #CDCDCD;
} .pic {
.detailtext { width: 80rpx;
display: flex; height: 80rpx;
flex-direction: row; }
margin-top: 20rpx;
} .remind {
.camera-button { font-size: 32rpx;
display:flex; color: #CDCDCD;
flex-direction: row; }
align-items: center;
justify-content: center; .detailtext {
width:200rpx; display: flex;
height: 200rpx; flex-direction: row;
padding: 0; margin-top: 20rpx;
}
.camera-button {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 200rpx;
height: 200rpx;
padding: 0;
} }
</style> </style>
<template> <template>
<Mescroll style="background-color: #F5F5F5;" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback"> <Mescroll style="background-color: #F5F5F5;" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption"
<view class="news-li" v-for="news in dataList" :key="news.id" hover-class="hover" @click="goDetail(news)"> @down="downCallback" @up="upCallback">
<view style="width: auto;background-color: #FFFFFF;"> <view class="news-li" v-for="news in dataList" :key="news.id" hover-class="hover" @click="goDetail(news)">
<image class="statuspic" :src="news.imgsrc"> <view style="width: auto;background-color: #FFFFFF;">
<view class="top-container" > <image class="statuspic" :src="news.imgsrc">
<text class="title">{{news.description}}</text> <view class="top-container">
<view class="detailtext"><text class="titletext">实验室</text><text class="contenttext">{{JSON.parse(news.check_scope).name}}</text></view> <text class="title">{{news.description}}</text>
<view class="detailtext"><text class="titletext">负责人</text><text class="contenttext">{{news.manager?JSON.parse(news.manager).name:""}}</text></view> <view class="detailtext"><text class="titletext">实验室</text><text class="contenttext">{{JSON.parse(news.check_scope).name}}</text></view>
<view class="detailtext"><text class="titletext">创建人</text><text class="contenttext">{{news.creator?JSON.parse(news.creator).name:""}}</text></view> <view class="detailtext"><text class="titletext">负责人</text><text class="contenttext">{{news.manager?JSON.parse(news.manager).name:""}}</text></view>
<view class="detailtext"><text class="titletextlong">创建时间</text><text class="contenttext">{{news.createTime}}</text></view> <view class="detailtext"><text class="titletext">创建人</text><text class="contenttext">{{news.creator?JSON.parse(news.creator).name:""}}</text></view>
<view class="detailtext"><text class="titletextlong">检查任务</text><text class="contenttext">{{news.check_task_code_name?news.check_task_code_name:""}}</text></view> <view class="detailtext"><text class="titletextlong">创建时间</text><text class="contenttext">{{news.createTime}}</text></view>
</view> <view class="detailtext"><text class="titletextlong">检查任务</text><text class="contenttext">{{news.check_task_code_name?news.check_task_code_name:""}}</text></view>
</view> </view>
</view> </view>
<Drawer mode="left" :visible="showDrawer" @close="closeDrawer"> </view>
<view class="d-container"> <Drawer mode="left" :visible="showDrawer" @close="closeDrawer">
<view style="width: 100%; height:100%;padding:10px"> <view class="d-container">
<view hover-class="hover" @click="close" style="width: auto;display: flex;flex-direction: row; justify-content: flex-end;padding-right: 20px;"> <view style="width: 100%; height:100%;padding:10px">
<image class="tip" src="../../static/rectification-item/close.png"> <view hover-class="hover" @click="close" style="width: auto;display: flex;flex-direction: row; justify-content: flex-end;padding-right: 20px;">
</view> <image class="tip" src="../../static/rectification-item/close.png">
<text style="font-size: 24px; line-height:33px;margin-top: 50px;">过滤条件</text> </view>
<view class="item" hover-class="hover" @click="showStatusPicker"> <text style="font-size: 24px; line-height:33px;margin-top: 50px;">过滤条件</text>
<text class="title" style="margin-top: 30upx;">状态</text> <view class="item" hover-class="hover" @click="showStatusPicker">
<view class="selcontent"> <text class="title" style="margin-top: 30upx;">状态</text>
<text class="datacontent">{{curStatus.name}}</text> <view class="selcontent">
<image class="tip" src="../../static/common/arrow_right_gray.png"> <text class="datacontent">{{curStatus.name}}</text>
</view> <image class="tip" src="../../static/common/arrow_right_gray.png">
</view> </view>
<view class="item" hover-class="hover" @click="showTaskPicker"> </view>
<text class="title" style="margin-top: 30upx;">检查任务</text> <view class="item" hover-class="hover" @click="showTaskPicker">
<view class="selcontent"> <text class="title" style="margin-top: 30upx;">检查任务</text>
<text class="datacontent">{{curTask.name}}</text> <view class="selcontent">
<image class="tip" src="../../static/common/arrow_right_gray.png"> <text class="datacontent">{{curTask.name}}</text>
</view> <image class="tip" src="../../static/common/arrow_right_gray.png">
</view> </view>
<view class="item" hover-class="hover" @click="showLabPicker"> </view>
<text class="title" style="margin-top: 30upx;">实验室</text> <view class="item" hover-class="hover" @click="showLabPicker">
<view class="selcontent"> <text class="title" style="margin-top: 30upx;">实验室</text>
<text class="datacontent">{{curLab.name}}</text> <view class="selcontent">
<image class="tip" src="../../static/common/arrow_right_gray.png"> <text class="datacontent">{{curLab.name}}</text>
</view> <image class="tip" src="../../static/common/arrow_right_gray.png">
</view> </view>
<view class="datetime" hover-class="hover" @click="showStartTimePicker"> </view>
<text class="title" style="margin-left: 15upx;" >开始日期</text> <view class="datetime" hover-class="hover" @click="showStartTimePicker">
<view class="selcontent-time"> <text class="title" style="margin-left: 15upx;">开始日期</text>
<text class="datacontent">{{startTime!=""?startTime:"请选择开始时间"}}</text> <view class="selcontent-time">
<image class="tip" src="../../static/common/arrow_right_gray.png"> <text class="datacontent">{{startTime!=""?startTime:"请选择开始时间"}}</text>
</view> <image class="tip" src="../../static/common/arrow_right_gray.png">
</view> </view>
<view class="datetime" hover-class="hover" @click="showEndTimePicker"> </view>
<text class="title" style="margin-left: 15upx;">结束日期</text> <view class="datetime" hover-class="hover" @click="showEndTimePicker">
<view class="selcontent-time"> <text class="title" style="margin-left: 15upx;">结束日期</text>
<text class="datacontent">{{endTime !=""?endTime:"请选择开始时间"}}</text> <view class="selcontent-time">
<image class="tip" src="../../static/common/arrow_right_gray.png"> <text class="datacontent">{{endTime !=""?endTime:"请选择开始时间"}}</text>
</view> <image class="tip" src="../../static/common/arrow_right_gray.png">
</view> </view>
</view>
<view style="display: flex;justify-content: center;align-items: center;width: 100%;margin-top: 80px;"> <view style="display: flex;justify-content: center;align-items: center;width: 100%;margin-top: 80px;">
<view hover-class="submithover" @click="onSubmitClick" class="submit-button"> <view hover-class="submithover" @click="onSubmitClick" class="submit-button">
<text class="submittext" >提交</text> <text class="submittext">提交</text>
</view> </view>
</view> </view>
</view>
</view>
</view> </Drawer>
</view> <Picker :mode="pickerMod" @confirm="onConfirm" ref="picker" themeColor="#f00" :selectList="itemList"></Picker>
</Drawer> </Mescroll>
<Picker </template>
:mode="pickerMod"
@confirm="onConfirm" <script>
ref="picker" import Mescroll from "../../components/mescroll-uni/mescroll-body.vue"
themeColor="#f00" import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
:selectList="itemList" import Drawer from '@/components/uni-drawer/uni-drawer.vue'
></Picker> import Picker from "@/components/w-picker/w-picker.vue";
</Mescroll> const sortFunction = (x, y) => {
</template> if (x.created > y.created) {
return -1;
<script> } else {
import Mescroll from "../../components/mescroll-uni/mescroll-body.vue" return 1;
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; }
import Drawer from '@/components/uni-drawer/uni-drawer.vue' }
import Picker from "@/components/w-picker/w-picker.vue"; export default {
const sortFunction = (x,y)=>{ mixins: [MescrollMixin],
if(x.created > y.created){ data() {
return -1; return {
}else { downOption: {
return 1; auto: false //是否在初始化后,自动执行downCallback; 默认true
} },
} dataList: [],
export default { upOption: {
mixins: [MescrollMixin], use: false,
data() { },
return { showDrawer: false,
downOption: { drawer: {
auto: false //是否在初始化后,自动执行downCallback; 默认true status: "fckkk"
}, },
dataList: [], itemList: [],
upOption: { statusData: [{
use: false, label: "待确定",
}, value: "unconfirmed"
showDrawer:false, }, {
drawer:{status:"fckkk"}, label: "待处理",
itemList:[], value: "pend"
statusData : [{label:"待确定",value:"unconfirmed"}, {label:"待处理",value:"pend"}, {label:"待整改",value:"correct"},{label:"整改中",value:"processed"},{label:"已处理",value:"finish"}, {label:'已取消',value:'cancel'}], }, {
curType:"", label: "待整改",
labData:[], value: "correct"
taskData:[], }, {
filterBody:"", label: "整改中",
pickerMod:"selector", value: "processed"
curTask:{}, }, {
curStatus:{}, label: "已处理",
curLab:{}, value: "finish"
startTime:"", }, {
endTime:"", label: '已取消',
} value: 'cancel'
}, }],
curType: "",
components: { labData: [],
Drawer, taskData: [],
Picker, filterBody: "",
Mescroll pickerMod: "selector",
}, curTask: {},
methods: { curStatus: {},
closeDrawer(){ curLab: {},
}, startTime: "",
close(){ endTime: "",
this.showDrawer = false; }
}, },
onNavigationBarButtonTap(){
this.showDrawer = true; components: {
}, Drawer,
onLoad() { Picker,
this.loadData(); Mescroll
this.getTaskList(); },
this.getLabList(); methods: {
}, closeDrawer() {},
/*下拉刷新的回调 */ close() {
downCallback() { this.showDrawer = false;
this.mescroll.endSuccess(); },
}, onNavigationBarButtonTap() {
/*上拉加载的回调 */ this.showDrawer = true;
upCallback(page) { },
onLoad() {
}, this.loadData();
/*获取列表*/ this.getTaskList();
loadData(){ this.getLabList();
var body = {}; },
var user = {}; /*下拉刷新的回调 */
user.id = this.GLOBALUTIL.user.userid; downCallback() {
user.name = encodeURI(this.GLOBALUTIL.user.username); this.mescroll.endSuccess();
uni.request({ },
url: this.GLOBALUTIL.url+'/safety/v1/dangers?page_number=1&page_size=200'+this.filterBody, /*上拉加载的回调 */
method: 'GET', upCallback(page) {
header: {
'Accept': 'application/json', },
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', /*获取列表*/
'user' : JSON.stringify(user) loadData() {
}, var body = {};
body:null, var user = {};
success: (res) => { user.id = this.GLOBALUTIL.user.userid;
var data = res.data.data; user.name = encodeURI(this.GLOBALUTIL.user.username);
data.map((opt)=>{ uni.request({
opt.createTime = this.GLOBALUTIL.moment(opt.created).format("YYYY-MM-DD HH:mm:ss") url: this.GLOBALUTIL.url + '/safety/v1/dangers?page_number=1&page_size=200' + this.filterBody,
opt.imgsrc = this.handleStatus(opt) method: 'GET',
}) header: {
data.sort(sortFunction); 'Accept': 'application/json',
this.dataList = data; 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
// console.log(JSON.stringify(data)) 'user': JSON.stringify(user)
} },
}) body: null,
}, success: (res) => {
handleStatus(opt) { var data = res.data.data;
switch (opt.status) { data.map((opt) => {
case 'unconfirmed': opt.createTime = this.GLOBALUTIL.moment(opt.created).format("YYYY-MM-DD HH:mm:ss")
return "../../static/rectification-item/daiqueding.png" opt.imgsrc = this.handleStatus(opt)
case 'pend': })
return "../../static/rectification-item/daichuli.png" data.sort(sortFunction);
case 'correct': this.dataList = data;
return "../../static/rectification-item/daizhenggai.png" // console.log(JSON.stringify(data))
case 'processed': }
return "../../static/rectification-item/zhenggaizhong.png" })
case 'finish': },
return "../../static/rectification-item/yiwancheng.png" handleStatus(opt) {
case 'cancel': switch (opt.status) {
return "../../static/rectification-item/cancel.png" case 'unconfirmed':
default: return "../../static/rectification-item/daiqueding.png"
return"../../static/rectification-item/daiqueding.png" case 'pend':
} return "../../static/rectification-item/daichuli.png"
}, case 'correct':
goDetail(data){ return "../../static/rectification-item/daizhenggai.png"
uni.navigateTo({ case 'processed':
url:"./detail" return "../../static/rectification-item/zhenggaizhong.png"
}) case 'finish':
uni.$emit("rectificationListData",[data]) return "../../static/rectification-item/yiwancheng.png"
}, case 'cancel':
showStatusPicker(){ return "../../static/rectification-item/cancel.png"
this.curType = "status" default:
this.pickerMod = "selector"; return "../../static/rectification-item/daiqueding.png"
this.itemList = this.statusData; }
this.$refs.picker.show() },
}, goDetail(data) {
showTaskPicker(){ uni.navigateTo({
this.curType = "task" url: "./detail"
this.pickerMod = "selector"; })
this.itemList = this.taskData; uni.$emit("rectificationListData", [data])
this.$refs.picker.show() },
}, showStatusPicker() {
showLabPicker(){ this.curType = "status"
this.curType = "lab" this.pickerMod = "selector";
this.pickerMod = "selector"; this.itemList = this.statusData;
this.itemList = this.labData; this.$refs.picker.show()
this.$refs.picker.show() },
}, showTaskPicker() {
showStartTimePicker(){ this.curType = "task"
this.curType = "startTime"; this.pickerMod = "selector";
this.pickerMod = "date"; this.itemList = this.taskData;
this.$refs.picker.show() this.$refs.picker.show()
}, },
showEndTimePicker(){ showLabPicker() {
this.curType = "endTime"; this.curType = "lab"
this.pickerMod = "date"; this.pickerMod = "selector";
this.$refs.picker.show() this.itemList = this.labData;
}, this.$refs.picker.show()
onConfirm(data){ },
console.log(JSON.stringify(data)) showStartTimePicker() {
if(this.curType == "status"){ this.curType = "startTime";
this.curStatus = {"name":data.checkArr.label,value:data.checkArr.value} this.pickerMod = "date";
}else if(this.curType == "task"){ this.$refs.picker.show()
this.curTask = {"name":data.checkArr.label,value:data.checkArr.value} },
}else if(this.curType == "lab"){ showEndTimePicker() {
this.curLab = {"name":data.checkArr.label,value:data.checkArr.value} this.curType = "endTime";
} this.pickerMod = "date";
else if(this.curType == "startTime"){ this.$refs.picker.show()
this.startTime = data.result },
}else{ onConfirm(data) {
this.endTime = data.result console.log(JSON.stringify(data))
} if (this.curType == "status") {
//this.curTask = {"name":data.checkArr[0],value:data.checkValue[0]} this.curStatus = {
}, "name": data.checkArr.label,
getTaskList(){ value: data.checkArr.value
var body = {}; }
var user = {}; } else if (this.curType == "task") {
user.id = this.GLOBALUTIL.user.userid; this.curTask = {
user.name = encodeURI(this.GLOBALUTIL.user.username); "name": data.checkArr.label,
uni.request({ value: data.checkArr.value
url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1', }
method: 'GET', } else if (this.curType == "lab") {
header: { this.curLab = {
'Accept': 'application/json', "name": data.checkArr.label,
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', value: data.checkArr.value
'user' : JSON.stringify(user) }
}, } else if (this.curType == "startTime") {
body:null, this.startTime = data.result
success: (res) => { } else {
var data = res.data.data; this.endTime = data.result
console.log(data.length) }
var itemList = data.map((opt)=>{ //this.curTask = {"name":data.checkArr[0],value:data.checkValue[0]}
return {label:opt.name,value:opt.id}; },
}) getTaskList() {
this.taskData = itemList; var body = {};
} var user = {};
}) user.id = this.GLOBALUTIL.user.userid;
}, user.name = encodeURI(this.GLOBALUTIL.user.username);
getLabList(){ uni.request({
var body = {}; url: this.GLOBALUTIL.url + '/safety/v1/check-tasks?page_size=200&page_number=1',
var user = {}; method: 'GET',
user.id = this.GLOBALUTIL.user.userid; header: {
user.name = encodeURI(this.GLOBALUTIL.user.username); 'Accept': 'application/json',
uni.request({ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
url: this.GLOBALUTIL.url+'/education-manage/v1/experiment-centers?page_number=1&page_size=100&_=1539337073882', 'user': JSON.stringify(user)
method: 'GET', },
header: { body: null,
'Accept': 'application/json', success: (res) => {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', var data = res.data.data;
'user' : JSON.stringify(user) console.log(data.length)
}, var itemList = data.map((opt) => {
body:null, return {
success: (res) => { label: opt.name,
var data = res.data.data; value: opt.id
var itemList = data.map((opt)=>{ };
return {label:opt.name,value:opt.id}; })
}) this.taskData = itemList;
this.labData = itemList; }
} })
}) },
}, getLabList() {
onSubmitClick(){ var body = {};
this.filterBody = ""; var user = {};
if(this.curTask.value){ user.id = this.GLOBALUTIL.user.userid;
this.filterBody = this.filterBody +'&check_task_id='+this.curTask.value user.name = encodeURI(this.GLOBALUTIL.user.username);
} uni.request({
if(this.curLab.value){ url: this.GLOBALUTIL.url + '/education-manage/v1/experiment-centers?page_number=1&page_size=100&_=1539337073882',
this.filterBody = this.filterBody +'&check_scope='+this.curLab.value method: 'GET',
} header: {
if(this.curStatus.value){ 'Accept': 'application/json',
this.filterBody = this.filterBody +'&status='+this.curStatus.value 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
} 'user': JSON.stringify(user)
if(this.startTime){ },
this.filterBody = this.filterBody+'&check_start_date='+this.startTime body: null,
} success: (res) => {
if(this.endTime){ var data = res.data.data;
this.filterBody = this.filterBody+'&check_end_date='+this.endTime var itemList = data.map((opt) => {
} return {
this.showDrawer = false; label: opt.name,
this.loadData(); value: opt.id
} };
} })
} this.labData = itemList;
</script> }
})
<style> },
/*说明*/ onSubmitClick() {
.notice{ this.filterBody = "";
font-size: 30upx; if (this.curTask.value) {
padding: 40upx 0; this.filterBody = this.filterBody + '&check_task_id=' + this.curTask.value
border-bottom: 1upx solid #eee; }
text-align: center; if (this.curLab.value) {
} this.filterBody = this.filterBody + '&check_scope=' + this.curLab.value
/*展示上拉加载的数据列表*/ }
.news-li{ if (this.curStatus.value) {
widht:auto; this.filterBody = this.filterBody + '&status=' + this.curStatus.value
font-size: 32upx; }
padding-top: 20upx; if (this.startTime) {
padding-left: 20upx; this.filterBody = this.filterBody + '&check_start_date=' + this.startTime
padding-right: 20upx; }
padding-bottom: 0upx; if (this.endTime) {
background-color: #F5F5F5; this.filterBody = this.filterBody + '&check_end_date=' + this.endTime
} }
.news-li .new-content{ this.showDrawer = false;
font-size: 28upx; this.loadData();
margin-top: 10upx; }
margin-left: 20upx; }
color: #666; }
} </script>
.icon {
width:20upx; <style>
height:20upx; /*说明*/
margin-right: 20upx; .notice {
} font-size: 30upx;
.top-container { padding: 40upx 0;
display: flex; border-bottom: 1upx solid #eee;
flex-direction: column; text-align: center;
width: auto; }
padding-left: 50upx;
margin-top: -35upx; /*展示上拉加载的数据列表*/
padding-bottom: 30upx; .news-li {
} widht: auto;
.status { font-size: 32upx;
width:170upx; padding-top: 20upx;
height:35upx; padding-left: 20upx;
background-color: rgba(242,115,115,0.10); padding-right: 20upx;
border-radius: 50upx; padding-bottom: 0upx;
display: flex; background-color: #F5F5F5;
justify-content: center; }
align-items: center;
margin-left: 35upx; .news-li .new-content {
} font-size: 28upx;
.status-text{ margin-top: 10upx;
color: #F27373; margin-left: 20upx;
font-size: 11px; color: #666;
} }
.hover{
opacity: 0.7; .icon {
} width: 20upx;
.title { height: 20upx;
font-size: 16px; margin-right: 20upx;
color: #333333; }
}
.des { .top-container {
font-weight:200; display: flex;
font-size:14px; flex-direction: column;
color:#676767 width: auto;
} padding-left: 50upx;
.detail { margin-top: -35upx;
font-size:14px; padding-bottom: 30upx;
} }
.type {
font-size:14px; .status {
} width: 170upx;
.statuspic{ height: 35upx;
width:80upx; background-color: rgba(242, 115, 115, 0.10);
height:80upx; border-radius: 50upx;
} display: flex;
.titletext{ justify-content: center;
font-size:28upx; align-items: center;
color: #666666; margin-left: 35upx;
margin-right: 78upx; }
}
.titletextlong{ .status-text {
font-size:28upx; color: #F27373;
color: #666666; font-size: 11px;
margin-right: 50upx; }
}
.contenttext{ .hover {
font-size:28upx; opacity: 0.7;
color: #333333; }
},
.selcontent { .title {
display: flex; font-size: 16px;
flex-direction: row; color: #333333;
align-items: center; }
margin-top: 20px;
} .des {
.selcontent-time { font-weight: 200;
display: flex; font-size: 14px;
flex-direction: row; color: #676767
align-items: center; }
}
.item { .detail {
border-bottom: 1upx solid #D0D0D0; font-size: 14px;
width: auto; }
margin-top: 20upx;
margin-left: 20upx; .type {
margin-right: 40upx; font-size: 14px;
padding-bottom: 10upx; }
}
.datacontent { .statuspic {
width: 100%; width: 80upx;
font-size: 16px; height: 80upx;
color: #4F4F4F; }
}
.hover { .titletext {
opacity: 0.7; font-size: 28upx;
} color: #666666;
.tip { margin-right: 78upx;
width: 30upx; }
height:30upx
} .titletextlong {
.submit-button { font-size: 28upx;
display: flex; color: #666666;
width:500upx; margin-right: 50upx;
height:60upx; }
align-items: center;
justify-content: center; .contenttext {
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%); font-size: 28upx;
border-radius: 15upx; color: #333333;
margin-left: 0; }
margin-right: 0;
margin-bottom: 40upx; ,
} .selcontent {
.submittext { display: flex;
font-size: 14px; flex-direction: row;
color: #FFFFFF; align-items: center;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; margin-top: 20px;
} }
.submithover{
opacity: 0.7; .selcontent-time {
} display: flex;
.d-container { flex-direction: row;
width: 600upx; align-items: center;
} }
.datetime{
width: auto; .item {
display: flex; border-bottom: 1upx solid #D0D0D0;
flex-direction: row; width: auto;
justify-content: space-between; margin-top: 20upx;
align-items: center; margin-left: 20upx;
margin-top:20px; margin-right: 40upx;
} padding-bottom: 10upx;
.detailtext{ }
padding-right: 20px;
} .datacontent {
width: 100%;
font-size: 16px;
color: #4F4F4F;
}
.hover {
opacity: 0.7;
}
.tip {
width: 30upx;
height: 30upx
}
.submit-button {
display: flex;
width: 500upx;
height: 60upx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15upx;
margin-left: 0;
margin-right: 0;
margin-bottom: 40upx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover {
opacity: 0.7;
}
.d-container {
width: 600upx;
}
.datetime {
width: auto;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-top: 20px;
}
.detailtext {
padding-right: 20px;
}
</style> </style>
<template> <template>
<view class="content"> <view class="content">
<text class="title"> 实验室名称: {{objectData.name}}</text> <text class="title"> 实验室名称: {{objectData.name}}</text>
<text class="title" style="margin-top: 30rpx;">位置</text> <text class="title" style="margin-top: 30rpx;">位置</text>
<view class="location-container" hover-class="hover" @click="showAddressSel"> <view class="location-container" hover-class="hover" @click="showAddressSel">
<text class="location">{{address}}</text> <text class="location">{{address}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png"> <image class="tip" src="../../static/common/arrow_right_gray.png">
</view> </view>
<text class="title" style="margin-top: 30rpx;">整改项详情</text> <text class="title" style="margin-top: 30rpx;">整改项详情</text>
<view style="width: 100%;"> <view style="width: 100%;">
<textarea class="detail" :value="description" @blur="changeTextValue" /> <textarea class="detail" :value="description" @blur="changeTextValue" />
</view> </view>
<text class="title" style="margin-top: 30rpx;">整改项照片</text> <text class="title" style="margin-top: 30rpx;">整改项照片</text>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;"> <view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;">
<view style="margin-right: 30rpx;" v-for="(item,index) in images" :key="index"> <view style="margin-right: 30rpx;" v-for="(item,index) in images" :key="index">
<button @click="onPhotoClick(index)" class="camera-button"> <button @click="onPhotoClick(index)" class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" /> <image mod="scaleToFill" class="camera-button" :src="item" />
</button> </button>
</view> </view>
<view class="photo"> <view class="photo">
<button @click="onclick" class="camera-button"> <button @click="onclick" class="camera-button">
<image class="camera" src="../../static/common/camera.png"> <image class="camera" src="../../static/common/camera.png">
</button> </button>
</view> </view>
</view> </view>
<button hover-class="submithover" @click="showModal" class="submit-button"> <button hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext" >提交</text> <text class="submittext" >提交</text>
</button> </button>
<ActionSheet :show="showActionSheet" :tips="tips" :item-list="itemList" :mask-closable="maskClosable" <ActionSheet :show="showActionSheet" :tips="tips" :item-list="itemList" :mask-closable="maskClosable"
:color="color" :size="size" :is-cancel="isCancel" @click="itemClick" @cancel="closeActionSheet"></ActionSheet> :color="color" :size="size" :is-cancel="isCancel" @click="itemClick" @cancel="closeActionSheet"></ActionSheet>
<form-alert v-if="submitShow" name="检查对象" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert> <form-alert v-if="submitShow" name="检查对象" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp> <PopUp ref="popup" :isdistance="true"></PopUp>
</view> </view>
</template> </template>
<script> <script>
import ActionSheet from "@/components/actionsheet/actionsheet.vue" import ActionSheet from "@/components/actionsheet/actionsheet.vue"
import AddressSelect from "@/components/multi-select/cityChiden.vue" import AddressSelect from "@/components/multi-select/cityChiden.vue"
import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
export default { export default {
data() { data() {
return { return {
showActionSheet: false, showActionSheet: false,
maskClosable: true, maskClosable: true,
tips: "请选择", tips: "请选择",
color: "#9a9a9a", color: "#9a9a9a",
size: 26, size: 26,
isCancel: true, isCancel: true,
itemList: [{text:"打开相机"},{text:"从相册中选择"}], itemList: [{text:"打开相机"},{text:"从相册中选择"}],
objectData:{}, objectData:{},
checkitem:{}, checkitem:{},
taskId:"", taskId:"",
images:[], images:[],
room:{}, room:{},
description:"", description:"",
address:"", address:"",
addressType:"", addressType:"",
submitMethod:"POST", submitMethod:"POST",
baseBody:{}, baseBody:{},
submitShow:false, submitShow:false,
} }
}, },
onLoad(option) { onLoad(option) {
if(option.mod){ if(option.mod){
this.submitMethod = "PUT" this.submitMethod = "PUT"
} }
var that = this; var that = this;
uni.$on('addressSave',function(data){ uni.$on('addressSave',function(data){
console.log(JSON.stringify(that.GLOBALUTIL.addressSelectionTemp)) console.log(JSON.stringify(that.GLOBALUTIL.addressSelectionTemp))
var roomData = {}; var roomData = {};
roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code; roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code;
roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id; roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id;
roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name; roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
that.room = roomData that.room = roomData
that.address = that.GLOBALUTIL.addressSelectionTemp[0].name + that.GLOBALUTIL.addressSelectionTemp[1].name+that.GLOBALUTIL.addressSelectionTemp[2].name + that.GLOBALUTIL.addressSelectionTemp[3].name; that.address = that.GLOBALUTIL.addressSelectionTemp[0].name + that.GLOBALUTIL.addressSelectionTemp[1].name+that.GLOBALUTIL.addressSelectionTemp[2].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
}) })
uni.$on('safeReportData',function(data){ uni.$on('safeReportData',function(data){
that.objectData = data[0] that.objectData = data[0]
that.checkitem = data[1] that.checkitem = data[1]
that.taskId = data[2] that.taskId = data[2]
that.room = that.objectData that.room = that.objectData
if(that.objectData.type == "site"){ if(that.objectData.type == "site"){
that.addressType = "site"; that.addressType = "site";
that.address = that.objectData.name that.address = that.objectData.name
} }
}) })
uni.$on('rectificationEdit',function(data){ uni.$on('rectificationEdit',function(data){
var baseData = data[0]; var baseData = data[0];
that.baseBody = baseData; that.baseBody = baseData;
that.objectData = JSON.parse(baseData.check_scope) that.objectData = JSON.parse(baseData.check_scope)
that.checkitem = baseData.check_item that.checkitem = baseData.check_item
that.taskId = baseData.check_task_id ; that.taskId = baseData.check_task_id ;
that.description = baseData.description ; that.description = baseData.description ;
that.images = JSON.parse(baseData.images); that.images = JSON.parse(baseData.images);
that.room = JSON.parse(baseData.room); that.room = JSON.parse(baseData.room);
if(that.objectData.type == "site"){ if(that.objectData.type == "site"){
that.addressType = "site"; that.addressType = "site";
that.address = that.objectData.name that.address = that.objectData.name
} }
}) })
uni.$on('securitySubmitPicChange',function(data){ uni.$on('securitySubmitPicChange',function(data){
that.images = data[0]; that.images = data[0];
})
},
onUnload(){
var that = this
uni.$off('addressSave',function(data){
that.GLOBALUTIL.addressSelectionTemp = [];
})
uni.$off('safeReportData',function(data){
})
uni.$off('rectificationEdit',function(data){
})
uni.$off('securitySubmitPicChange',function(data){
}) })
},
onUnload(){
var that = this
uni.$off('addressSave',function(data){
that.GLOBALUTIL.addressSelectionTemp = [];
})
uni.$off('safeReportData',function(data){
})
uni.$off('rectificationEdit',function(data){
})
uni.$off('securitySubmitPicChange',function(data){
})
}, },
methods: { methods: {
showAddressSel(){ showAddressSel(){
if(this.addressType == "site"){ if(this.addressType == "site"){
return return
} }
uni.navigateTo({ uni.navigateTo({
url:"../../components/address-select/index?maxLevel=4" url:"../../components/address-select/index?maxLevel=4"
}) })
},
onclick: function() {
console.log(this.textvalue)
this.showActionSheet = true;
},
onPhotoClick:function(index){
uni.navigateTo({
url:"../../components/image-preview/image-preview"
})
uni.$emit("previewPhoto",[this.images,index])
}, },
onclick: function() { onSubmitClick: function() {
console.log(this.textvalue) this.submitShow = false;
this.showActionSheet = true;
},
onPhotoClick:function(index){
uni.navigateTo({
url:"../../components/image-preview/image-preview"
})
uni.$emit("previewPhoto",[this.images,index])
},
onSubmitClick: function() {
this.submitShow = false;
var body = { var body = {
"check_scope":JSON.stringify(this.objectData), "check_scope":JSON.stringify(this.objectData),
"check_item_id":this.checkitem.id, "check_item_id":this.checkitem.id,
...@@ -147,112 +147,112 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -147,112 +147,112 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
"place":this.objectData.name, "place":this.objectData.name,
"description":this.description, "description":this.description,
"room":JSON.stringify(this.room) "room":JSON.stringify(this.room)
} }
if(this.submitMethod == "PUT"){ if(this.submitMethod == "PUT"){
body = this.baseBody body = this.baseBody
body.description = this.description body.description = this.description
} }
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
console.log(JSON.stringify(body)) console.log(JSON.stringify(body))
uni.request({ uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/danger', url: this.GLOBALUTIL.url+'/safety/v1/danger',
method: this.submitMethod, method: this.submitMethod,
data:JSON.stringify(body), data:JSON.stringify(body),
header: { header: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'user' : JSON.stringify(user) 'user' : JSON.stringify(user)
}, },
success: (res) => { success: (res) => {
console.log(JSON.stringify(res)) console.log(JSON.stringify(res))
if(res.statusCode == 200){ if(res.statusCode == 200){
if(this.submitMethod == "PUT"){ if(this.submitMethod == "PUT"){
uni.$emit("rectificationListData",[this.baseBody]) uni.$emit("rectificationListData",[this.baseBody])
} }
this.$refs.popup.open({ this.$refs.popup.open({
type:'success', type:'success',
content:'提交成功!', content:'提交成功!',
timeout:1000, timeout:1000,
isClick:false isClick:false
}); });
setTimeout(()=>{ setTimeout(()=>{
uni.navigateBack({ uni.navigateBack({
delta:1 delta:1
}) })
},1000) },1000)
} }
} }
}) })
}, },
itemClick: function(item) { itemClick: function(item) {
var that = this var that = this
if(item.index == 0){ if(item.index == 0){
uni.chooseImage({ uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有 sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //相机 sourceType: ['camera'], //相机
success: function (res) { success: function (res) {
var imgPath = res.tempFilePaths; var imgPath = res.tempFilePaths;
that.uploadPic(imgPath); that.uploadPic(imgPath);
} }
}); });
}else{ }else{
uni.chooseImage({ uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有 sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择 sourceType: ['album'], //从相册选择
success: function (res) { success: function (res) {
var imgPath = res.tempFilePaths; var imgPath = res.tempFilePaths;
that.uploadPic(imgPath); that.uploadPic(imgPath);
} }
}); });
} }
this.closeActionSheet(); this.closeActionSheet();
}, },
uploadPic(imgPath){ uploadPic(imgPath){
var user = {}; var user = {};
var that = this; var that = this;
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
let imgs = imgPath.map((value, index) => { let imgs = imgPath.map((value, index) => {
return { return {
name: "file", name: "file",
uri: value uri: value
} }
}); });
uni.uploadFile({ uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image', url: this.GLOBALUTIL.url+'/safety/v1/file/image',
files:imgs, files:imgs,
filePath:imgPath[0], filePath:imgPath[0],
name:"file", name:"file",
header: { header: {
'user' : JSON.stringify(user), 'user' : JSON.stringify(user),
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
}, },
success: (res) => { success: (res) => {
var uri = JSON.parse(res.data).data; var uri = JSON.parse(res.data).data;
that.images.push(uri); that.images.push(uri);
} }
}) })
}, },
closeActionSheet: function() { closeActionSheet: function() {
this.showActionSheet = false this.showActionSheet = false
}, },
changeTextValue:function(e){ changeTextValue:function(e){
this.description = e.detail.value; this.description = e.detail.value;
}, },
cancel:function(){ cancel:function(){
this.submitShow = false; this.submitShow = false;
}, },
showModal:function(){ showModal:function(){
this.submitShow = true; this.submitShow = true;
}, },
}, },
components: { components: {
ActionSheet, ActionSheet,
AddressSelect, AddressSelect,
uniNavBar uniNavBar
}, },
} }
</script> </script>
...@@ -280,81 +280,81 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -280,81 +280,81 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
.title { .title {
font-size: 30rpx; font-size: 30rpx;
color: #8f8f94; color: #8f8f94;
} }
.loginbtn { .loginbtn {
width:180rpx; width:180rpx;
height:200rpx; height:200rpx;
} }
.login-hover { .login-hover {
width:200rpx; width:200rpx;
height:200rpx; height:200rpx;
background-color:#00CE47; background-color:#00CE47;
} }
.testview { .testview {
width:209rpx; width:209rpx;
height:200rpx; height:200rpx;
background-color:linear-gradient(red, yellow, blue); background-color:linear-gradient(red, yellow, blue);
} }
.location-container{ .location-container{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
width:100%; width:100%;
} }
.arrow-right{ .arrow-right{
width:40rpx; width:40rpx;
height:40rpx; height:40rpx;
} }
.camera-button { .camera-button {
display:flex; display:flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width:200rpx; width:200rpx;
height: 200rpx; height: 200rpx;
padding:0 ; padding:0 ;
} }
.camera { .camera {
width:50rpx; width:50rpx;
height:50rpx; height:50rpx;
} }
.submit-button { .submit-button {
display: flex; display: flex;
width:600rpx; width:600rpx;
height:60rpx; height:60rpx;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%); background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx; border-radius: 15rpx;
margin-top: 80rpx; margin-top: 80rpx;
} }
.submittext { .submittext {
font-size: 14px; font-size: 14px;
color: #FFFFFF; color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
} }
.submithover{ .submithover{
opacity: 0.7; opacity: 0.7;
} }
.detail { .detail {
width:100%; width:100%;
height:300rpx; height:300rpx;
border: 1rpx solid #000000; border: 1rpx solid #000000;
} }
.status_bar { .status_bar {
height: var(--status-bar-height); height: var(--status-bar-height);
width: 100%; width: 100%;
} }
.location{ .location{
font-size: 34rpx; font-size: 34rpx;
color: #000000; color: #000000;
} }
.tip { .tip {
width: 30rpx; width: 30rpx;
height:30rpx height:30rpx
} }
.hover { .hover {
opacity: 0.7; opacity: 0.7;
} }
</style> </style>
<template> <template>
<mescroll-body class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback"> <mescroll-body class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
@up="upCallback">
<view v-if="isShow" class="news-li" v-for="(item,index) in dataList" :key="index"> <view v-if="isShow" class="news-li" v-for="(item,index) in dataList" :key="index">
<view> <view>
<text>{{index}}.{{item.content}}</text> <text>{{index}}.{{item.content}}</text>
</view>
<view style="display: flex;flex-direction: row; width:690rpx;justify-content: space-between;margin-top:20rpx;">
<view style="display: flex;flex-direction: row;justify-content: flex-start;">
<view v-for="(obj,index1) in checkitems" :key="index1">
<view class="item-container" @click="itemClick(index,index1)">
<view :class="item.status==index1? 'selected' :'unselected' "></view>
<text>{{obj.name}}</text>
</view>
</view>
</view>
<view ><image @click="checkItem(item)" class="icon" src="../../static/security-check/safeEdit.png"></view>
</view> </view>
</view> <view style="display: flex;flex-direction: row; width:690rpx;justify-content: space-between;margin-top:20rpx;">
<button hover-class="submithover" @click="showModal" class="submit-button"> <view style="display: flex;flex-direction: row;justify-content: flex-start;">
<text class="submittext">提交</text> <view v-for="(obj,index1) in checkitems" :key="index1">
</button> <view class="item-container" @click="itemClick(index,index1)">
<form-alert v-if="submitShow" name="检查对象" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert> <view :class="item.status==index1? 'selected' :'unselected' "></view>
<PopUp ref="popup" :isdistance="true"></PopUp> <text>{{obj.name}}</text>
</view>
</view>
</view>
<view>
<image @click="checkItem(item)" class="icon" src="../../static/security-check/safeEdit.png">
</view>
</view>
</view>
<button hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext">提交</text>
</button>
<form-alert v-if="submitShow" name="检查对象" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp>
</mescroll-body> </mescroll-body>
</template> </template>
...@@ -33,149 +36,150 @@ ...@@ -33,149 +36,150 @@
downOption: { downOption: {
auto: false //是否在初始化后,自动执行downCallback; 默认true auto: false //是否在初始化后,自动执行downCallback; 默认true
}, },
dataList: [], dataList: [],
upOption: { upOption: {
use: false, // 是否启用上拉加载; 默认true use: false, // 是否启用上拉加载; 默认true
}, },
isShow:false, isShow: false,
checkitems:[], checkitems: [],
objectData:{}, objectData: {},
taskId:"", taskId: "",
checkResult:[], checkResult: [],
submitShow:false submitShow: false
} }
}, },
methods: { methods: {
cancel:function(){ cancel: function() {
this.submitShow = false; this.submitShow = false;
}, },
showModal:function(){ showModal: function() {
this.submitShow = true; this.submitShow = true;
}, },
onLoad() { onLoad() {
var that = this; var that = this;
uni.$on('sendCheckItem',function(data){ uni.$on('sendCheckItem', function(data) {
that.objectData = data[0] that.objectData = data[0]
that.taskId = data[2]; that.taskId = data[2];
var content = data[1].children var content = data[1].children
content.map((opt)=>{ content.map((opt) => {
opt.status = 0; opt.status = 0;
// opt.checkitems = []; // opt.checkitems = [];
}) })
that.dataList = content; that.dataList = content;
}) })
this.loadData(); this.loadData();
}, },
onUnload(){ onUnload() {
uni.$off('sendCheckItem',function(data){ uni.$off('sendCheckItem', function(data) {
}) })
}, },
/*下拉刷新的回调 */ /*下拉刷新的回调 */
downCallback() { downCallback() {
this.mescroll.endSuccess(); this.mescroll.endSuccess();
}, },
/*上拉加载的回调 */ /*上拉加载的回调 */
upCallback(page) { upCallback(page) {
}, },
goDetail(){ goDetail() {
uni.navigateTo({ uni.navigateTo({
url:"./select-checkobject" url: "./select-checkobject"
}) })
}, },
itemClick(index,status){ itemClick(index, status) {
this.dataList[index].status = status; this.dataList[index].status = status;
var res = { var res = {
name:this.checkitems[status].name, name: this.checkitems[status].name,
code:this.checkitems[status].code, code: this.checkitems[status].code,
id:this.checkitems[status].id id: this.checkitems[status].id
} }
this.checkResult[index].result_type = JSON.stringify(res); this.checkResult[index].result_type = JSON.stringify(res);
this.$forceUpdate(); this.$forceUpdate();
console.log(JSON.stringify(this.checkResult)) console.log(JSON.stringify(this.checkResult))
}, },
checkItem(item){ checkItem(item) {
uni.navigateTo({ uni.navigateTo({
url:"./index" url: "./index"
}) })
uni.$emit("safeReportData",[this.objectData,item,this.taskId]); uni.$emit("safeReportData", [this.objectData, item, this.taskId]);
}, },
loadData(){ loadData() {
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({ uni.request({
url: this.GLOBALUTIL.url+'/base-data/v1/dict-items?sort_property=ID&sort_direction=ASC&dict_code=JCJG&page_number=1&page_size=10', url: this.GLOBALUTIL.url +
method: 'GET', '/base-data/v1/dict-items?sort_property=ID&sort_direction=ASC&dict_code=JCJG&page_number=1&page_size=10',
header: { method: 'GET',
'Accept': 'application/json', header: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Accept': 'application/json',
'user' : JSON.stringify(user) 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
}, 'user': JSON.stringify(user)
body:null, },
success: (res) => { body: null,
this.dataList.map((opt)=>{ success: (res) => {
opt.checkitems = res.data.data; this.dataList.map((opt) => {
}) opt.checkitems = res.data.data;
this.checkitems = res.data.data; })
this.isShow = true; this.checkitems = res.data.data;
// console.log(JSON.stringify(this.objectData)) this.isShow = true;
// console.log(JSON.stringify(this.dataList)) // console.log(JSON.stringify(this.objectData))
// console.log(JSON.stringify(this.checkitems)) // console.log(JSON.stringify(this.dataList))
this.checkResult = []; // console.log(JSON.stringify(this.checkitems))
this.dataList.map((opt)=>{ this.checkResult = [];
var res = { this.dataList.map((opt) => {
name:this.checkitems[0].name, var res = {
id:this.checkitems[0].id, name: this.checkitems[0].name,
code:this.checkitems[0].code id: this.checkitems[0].id,
} code: this.checkitems[0].code
var item = { }
"result_type":JSON.stringify(res), var item = {
"check_item_id":opt.id, "result_type": JSON.stringify(res),
"check_list_id":opt.check_list_id, "check_item_id": opt.id,
"check_task_id":this.taskId, "check_list_id": opt.check_list_id,
"lab_id":this.objectData.id "check_task_id": this.taskId,
} "lab_id": this.objectData.id
this.checkResult.push(item) }
}) this.checkResult.push(item)
} })
}) }
})
},
onSubmitClick(){ },
this.submitShow = false; onSubmitClick() {
var user = {}; this.submitShow = false;
user.id = this.GLOBALUTIL.user.userid; var user = {};
user.name = encodeURI(this.GLOBALUTIL.user.username); user.id = this.GLOBALUTIL.user.userid;
var body = this.checkResult user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({ var body = this.checkResult
url: this.GLOBALUTIL.url+'/safety/v1/check-result', uni.request({
method: 'POST', url: this.GLOBALUTIL.url + '/safety/v1/check-result',
data:JSON.stringify(body), method: 'POST',
header: { data: JSON.stringify(body),
'Accept': 'application/json', header: {
'Content-Type': 'application/json', 'Accept': 'application/json',
'user' : JSON.stringify(user) 'Content-Type': 'application/json',
}, 'user': JSON.stringify(user)
success: (res) => { },
console.log(JSON.stringify(res)) success: (res) => {
if(res.statusCode == 200){ console.log(JSON.stringify(res))
uni.$emit("refreshTaskList") if (res.statusCode == 200) {
this.$refs.popup.open({ uni.$emit("refreshTaskList")
type:'success', this.$refs.popup.open({
content:'提交成功!', type: 'success',
timeout:1000, content: '提交成功!',
isClick:false timeout: 1000,
}); isClick: false
setTimeout(()=>{ });
uni.navigateBack({ setTimeout(() => {
delta:2 uni.navigateBack({
}) delta: 2
},1000) })
} }, 1000)
} }
}) }
})
} }
} }
} }
...@@ -183,78 +187,91 @@ ...@@ -183,78 +187,91 @@
<style> <style>
/*说明*/ /*说明*/
.notice{ .notice {
font-size: 30upx; font-size: 30upx;
padding: 40upx 0; padding: 40upx 0;
border-bottom: 1upx solid #eee; border-bottom: 1upx solid #eee;
text-align: center; text-align: center;
} }
/*展示上拉加载的数据列表*/ /*展示上拉加载的数据列表*/
.news-li{ .news-li {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-size: 32upx; font-size: 32upx;
padding: 32upx; padding: 32upx;
border-bottom: 1upx solid #eee; border-bottom: 1upx solid #eee;
width: 100%; width: 100%;
} }
.news-li .new-content{
.news-li .new-content {
font-size: 28upx; font-size: 28upx;
margin-top: 10upx; margin-top: 10upx;
margin-left: 20upx; margin-left: 20upx;
color: #666; color: #666;
}
.icon {
width:30rpx;
height:30rpx;
}
.top-container {
display: flex;
flex-direction: row;
align-items: center;
}
.hover{
opacity: 0.7;
}
.item-container{
display: flex;
flex-direction: row;
margin-right: 30rpx;
}
.selected {
width:40rpx;
height:40rpx;
background-color: #00CE47;
},
.unselected {
width:40rpx;
height:40rpx;
background-color: #FFFFFF;
border: 1rpx solid #00CE47 ;
}
.containter{
display: flex;
width: 100%;
}
.submit-button {
display: flex;
width:600rpx;
height:60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
position: absolute;
left: 50%;
bottom: 60rpx;
margin-left: -300rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
} }
</style>
.icon {
width: 30rpx;
height: 30rpx;
}
.top-container {
display: flex;
flex-direction: row;
align-items: center;
}
.hover {
opacity: 0.7;
}
.item-container {
display: flex;
flex-direction: row;
margin-right: 30rpx;
}
.selected {
width: 40rpx;
height: 40rpx;
background-color: #00CE47;
}
,
.unselected {
width: 40rpx;
height: 40rpx;
background-color: #FFFFFF;
border: 1rpx solid #00CE47;
}
.containter {
display: flex;
width: 100%;
}
.submit-button {
display: flex;
width: 600rpx;
height: 60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
position: absolute;
left: 50%;
bottom: 60rpx;
margin-left: -300rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover {
opacity: 0.7;
}
</style>
<template> <template>
<mescroll-body class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback"> <mescroll-body class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
@up="upCallback">
<view class="news-li" v-for="news in dataList" :key="news.id" hover-class="hover" @click="goDetail(news)"> <view class="news-li" v-for="news in dataList" :key="news.id" hover-class="hover" @click="goDetail(news)">
<view class="top-container" > <view class="top-container">
<view style="width: 500rpx;"><text class="title">{{news.name}}</text></view> <view style="width: 500rpx;"><text class="title">{{news.name}}</text></view>
<view :class="news.color=='finish' ? 'status-finish' : 'status' "> <view :class="news.color=='finish' ? 'status-finish' : 'status' ">
<text :class="news.color=='finish' ? 'status-finish-text' : 'status-text' ">{{news.taskstatus}}</text> <text :class="news.color=='finish' ? 'status-finish-text' : 'status-text' ">{{news.taskstatus}}</text>
</view> </view>
</view> </view>
<view style="width: 700rpx;" ><text class="des">{{news.check_point}}</text></view> <view style="width: 700rpx;"><text class="des">{{news.check_point}}</text></view>
<view><image class="icon" src="../../static/security-check/safeTime.png"><text class="detail">{{JSON.parse(news.schedule).startdate}}~{{JSON.parse(news.schedule).enddate}}</text></view> <view>
<view style="display: flex;flex-direction: row;align-items: center;"> <image class="icon" src="../../static/security-check/safeTime.png"><text class="detail">{{JSON.parse(news.schedule).startdate}}~{{JSON.parse(news.schedule).enddate}}</text>
<view style="width: 20rpx;margin-right:20rpx;"><image class="icon" src="../../static/security-check/safeSys.png"></view> </view>
<view style="display:flex;flex-direction: row; -webkit-flex-wrap: wrap;flex-wrap: wrap"> <view style="display: flex;flex-direction: row;align-items: center;">
<view style="display: flex;margin-right:30px" v-for="(data,index) in JSON.parse(news.check_scope)" :key="index" > <view style="width: 20rpx;margin-right:20rpx;">
<text class="detail">{{data.name}}</text> <image class="icon" src="../../static/security-check/safeSys.png">
</view> </view>
</view> <view style="display:flex;flex-direction: row; -webkit-flex-wrap: wrap;flex-wrap: wrap">
</view> <view style="display: flex;margin-right:30px" v-for="(data,index) in JSON.parse(news.check_scope)" :key="index">
<view><image class="icon" src="../../static/security-check/safePerson.png"><text class="detail">{{news.taskexecutor}}</text></view> <text class="detail">{{data.name}}</text>
</view>
</view>
</view>
<view>
<image class="icon" src="../../static/security-check/safePerson.png"><text class="detail">{{news.taskexecutor}}</text>
</view>
<view><text class="type">{{news.taskTypeTitle}}</text></view> <view><text class="type">{{news.taskTypeTitle}}</text></view>
</view> </view>
</mescroll-body> </mescroll-body>
...@@ -32,94 +39,96 @@ ...@@ -32,94 +39,96 @@
downOption: { downOption: {
auto: false //是否在初始化后,自动执行downCallback; 默认true auto: false //是否在初始化后,自动执行downCallback; 默认true
}, },
dataList: [], dataList: [],
upOption: { upOption: {
use: false, // 是否启用上拉加载; 默认true use: false, // 是否启用上拉加载; 默认true
}, },
} }
}, },
methods: { methods: {
onLoad() { onLoad() {
var that = this; var that = this;
uni.$on('refreshTaskList',function(data){ uni.$on('refreshTaskList', function(data) {
that.loadData(); that.loadData();
}) })
this.loadData(); this.loadData();
}, },
onUnload(){ onUnload() {
uni.$off('refreshTaskList',function(data){ uni.$off('refreshTaskList', function(data) {})
})
}, },
/*下拉刷新的回调 */ /*下拉刷新的回调 */
downCallback() { downCallback() {
this.mescroll.endSuccess(); this.mescroll.endSuccess();
}, },
/*上拉加载的回调 */ /*上拉加载的回调 */
upCallback(page) { upCallback(page) {
}, },
/*获取列表*/ /*获取列表*/
loadData(){ loadData() {
var body = {}; var body = {};
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({ uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1', url: this.GLOBALUTIL.url + '/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET', method: 'GET',
header: { header: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user) 'user': JSON.stringify(user)
}, },
body:null, body: null,
success: (res) => { success: (res) => {
console.log(JSON.stringify(res)) console.log(JSON.stringify(res))
var data = res.data.data; var data = res.data.data;
data.map((opt)=>{ data.map((opt) => {
opt.taskstatus = (this.handleStatus(opt)).text; opt.taskstatus = (this.handleStatus(opt)).text;
opt.color = (this.handleStatus(opt)).color; opt.color = (this.handleStatus(opt)).color;
var taskexecutor = JSON.parse(opt.excutor); var taskexecutor = JSON.parse(opt.excutor);
var taskexecutortext = ""; var taskexecutortext = "";
taskexecutor.map((opt)=>{ taskexecutor.map((opt) => {
taskexecutortext = opt.name +" "; taskexecutortext = opt.name + " ";
}) })
opt.taskexecutor = taskexecutortext; opt.taskexecutor = taskexecutortext;
opt.taskTypeTitle = opt.auto_task?"上级下发":"自建任务" opt.taskTypeTitle = opt.auto_task ? "上级下发" : "自建任务"
}) })
this.dataList = data; this.dataList = data;
} }
}) })
}, },
handleStatus(data){ handleStatus(data) {
var text = ""; var text = "";
var color = "" var color = ""
if(data.execute_state){ if (data.execute_state) {
var check_scope = JSON.parse(data.check_scope); var check_scope = JSON.parse(data.check_scope);
text = "已完成" + check_scope.length +"/" + check_scope.length; text = "已完成" + check_scope.length + "/" + check_scope.length;
color = "finish" color = "finish"
}else{ } else {
var check_scope = JSON.parse(data.check_scope); var check_scope = JSON.parse(data.check_scope);
var checked = 0; var checked = 0;
check_scope.map((opt)=>{ check_scope.map((opt) => {
if(opt.execute_state){ if (opt.execute_state) {
checked++ checked++
} }
}) })
if(checked == check_scope.length){ if (checked == check_scope.length) {
text = "已完成 " + check_scope.length +"/" + check_scope.length; text = "已完成 " + check_scope.length + "/" + check_scope.length;
color = "finish" color = "finish"
}else{ } else {
text = '未完成 '+checked+'/'+check_scope.length; text = '未完成 ' + checked + '/' + check_scope.length;
color = "unfinish" color = "unfinish"
} }
} }
return {text:text,color:color} return {
}, text: text,
goDetail(data){ color: color
uni.navigateTo({ }
url:"./select-checkobject?taskId="+data.id },
}) goDetail(data) {
uni.navigateTo({
url: "./select-checkobject?taskId=" + data.id
})
} }
} }
} }
...@@ -127,85 +136,99 @@ ...@@ -127,85 +136,99 @@
<style> <style>
/*说明*/ /*说明*/
.notice{ .notice {
font-size: 30upx; font-size: 30upx;
padding: 40upx 0; padding: 40upx 0;
border-bottom: 1upx solid #eee; border-bottom: 1upx solid #eee;
text-align: center; text-align: center;
} }
/*展示上拉加载的数据列表*/ /*展示上拉加载的数据列表*/
.news-li{ .news-li {
font-size: 32upx; font-size: 32upx;
padding: 32upx; padding: 32upx;
border-bottom: 1upx solid #eee; border-bottom: 1upx solid #eee;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.news-li .new-content{
.news-li .new-content {
font-size: 28upx; font-size: 28upx;
margin-top: 10upx; margin-top: 10upx;
margin-left: 20upx; margin-left: 20upx;
color: #666; color: #666;
} }
.icon {
width:20rpx; .icon {
height:20rpx; width: 20rpx;
margin-right: 20rpx; height: 20rpx;
} margin-right: 20rpx;
.top-container { }
display: flex;
flex-direction: row; .top-container {
align-items: center; display: flex;
} flex-direction: row;
.status { align-items: center;
width:170rpx; }
height:35rpx;
background-color: rgba(242,115,115,0.10); .status {
border-radius: 50rpx; width: 170rpx;
display: flex; height: 35rpx;
justify-content: center; background-color: rgba(242, 115, 115, 0.10);
align-items: center; border-radius: 50rpx;
margin-left: 35rpx; display: flex;
} justify-content: center;
.status-finish { align-items: center;
width:170rpx; margin-left: 35rpx;
height:35rpx; }
background-color: rgba(47,190,178,0.10);
border-radius: 50rpx; .status-finish {
display: flex; width: 170rpx;
justify-content: center; height: 35rpx;
align-items: center; background-color: rgba(47, 190, 178, 0.10);
margin-left: 35rpx; border-radius: 50rpx;
} display: flex;
.status-text{ justify-content: center;
color: #F27373; align-items: center;
font-size: 11px; margin-left: 35rpx;
} }
.status-finish-text{
color: #2FBEB2; .status-text {
font-size: 11px; color: #F27373;
} font-size: 11px;
.hover{ }
opacity: 0.7;
} .status-finish-text {
.title { color: #2FBEB2;
font-size: 17px; font-size: 11px;
font-weight: 300; }
}
.des { .hover {
font-weight:200; opacity: 0.7;
font-size:14px; }
color:#676767
} .title {
.detail { font-size: 17px;
font-size:14px; font-weight: 300;
} }
.type {
font-size:14px; .des {
} font-weight: 200;
.containter{ font-size: 14px;
display: flex; color: #676767
width: 100%; }
}
</style> .detail {
font-size: 14px;
}
.type {
font-size: 14px;
}
.containter {
display: flex;
width: 100%;
}
</style>
<template> <template>
<view class="content"> <view class="content">
<view style="width: 100%;margin-top: 20rpx;"><text class="title">检查对象</text></view> <view style="width: 100%;margin-top: 20rpx;"><text class="title">检查对象</text></view>
<view class="location-container" @click="showObjectPicker"> <view class="location-container" @click="showObjectPicker">
<text class="value">{{selObjectText}}</text> <text class="value">{{selObjectText}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png"> <image class="arrow-right" src="../../static/common/arrow_right_gray.png">
</view> </view>
<view style="width: 100%;margin-top: 20rpx;"><text class="title">检查项类型</text></view> <view style="width: 100%;margin-top: 20rpx;"><text class="title">检查项类型</text></view>
<view class="location-container" @click="showTypePicker"> <view class="location-container" @click="showTypePicker">
<text class="value">{{selectItemText}}</text> <text class="value">{{selectItemText}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png"> <image class="arrow-right" src="../../static/common/arrow_right_gray.png">
</view> </view>
<button hover-class="submithover" @click="onSubmitClick" class="submit-button"> <button hover-class="submithover" @click="onSubmitClick" class="submit-button">
<text class="submittext">开始检查</text> <text class="submittext">开始检查</text>
</button> </button>
<Picker <Picker mode="selector" @confirm="onConfirm" ref="picker" themeColor="#f00" :selectList="itemList"></Picker>
mode="selector"
@confirm="onConfirm"
ref="picker"
themeColor="#f00"
:selectList="itemList"
></Picker>
</view> </view>
</template> </template>
<script> <script>
import Picker from "@/components/w-picker/w-picker.vue"; import Picker from "@/components/w-picker/w-picker.vue";
export default { export default {
data() { data() {
return { return {
showActionSheet: false, showActionSheet: false,
itemList: [], itemList: [],
taskId:"", taskId: "",
selObject:"", selObject: "",
selObjectText:"", selObjectText: "",
selectItem:"", selectItem: "",
selectItemText:"", selectItemText: "",
objectarr:[], objectarr: [],
itemarr:[], itemarr: [],
curType:"object", curType: "object",
objectData:[], objectData: [],
itemData:[] itemData: []
} }
}, },
onLoad(option) { onLoad(option) {
this.taskId = option.taskId this.taskId = option.taskId
this.loadTaskObject(); this.loadTaskObject();
}, },
methods: { methods: {
itemClick: function() { itemClick: function() {
}, },
closeActionSheet: function() { closeActionSheet: function() {
this.showActionSheet = false this.showActionSheet = false
}, },
onConfirm(data){ onConfirm(data) {
if(this.curType == "object"){ if (this.curType == "object") {
this.selObject = data.checkArr.value; this.selObject = data.checkArr.value;
this.selObjectText = data.checkArr.label; this.selObjectText = data.checkArr.label;
this.itemarr = []; this.itemarr = [];
this.selectItem = ""; this.selectItem = "";
this.selectItemText = ""; this.selectItemText = "";
this.loadItemData(); this.loadItemData();
}else{ } else {
this.selectItem = data.checkArr.value; this.selectItem = data.checkArr.value;
this.selectItemText = data.checkArr.label; this.selectItemText = data.checkArr.label;
} }
}, },
onSubmitClick(){ onSubmitClick() {
var objectData = this.findObjectData(); var objectData = this.findObjectData();
var itemData = this.findItemData(); var itemData = this.findItemData();
uni.navigateTo({ uni.navigateTo({
url:"security-checkitem" url: "security-checkitem"
}) })
uni.$emit("sendCheckItem",[objectData,itemData,this.taskId]); uni.$emit("sendCheckItem", [objectData, itemData, this.taskId]);
}, },
showObjectPicker(){ showObjectPicker() {
this.itemList = this.objectarr; this.itemList = this.objectarr;
this.curType = "object" this.curType = "object"
this.$refs.picker.show() this.$refs.picker.show()
}, },
showTypePicker(){ showTypePicker() {
if(this.selObject == ""){ if (this.selObject == "") {
return return
} }
this.itemList = this.itemarr; this.itemList = this.itemarr;
this.curType = "item"; this.curType = "item";
this.$refs.picker.show() this.$refs.picker.show()
}, },
loadTaskObject(){ loadTaskObject() {
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({ uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-scope/'+this.taskId, url: this.GLOBALUTIL.url + '/safety/v1/check-task-scope/' + this.taskId,
method: 'GET', method: 'GET',
header: { header: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user) 'user': JSON.stringify(user)
}, },
body:null, body: null,
success: (res) => { success: (res) => {
var data = res.data; var data = res.data;
this.objectData = data; this.objectData = data;
var itemList = data.map((opt)=>{ var itemList = data.map((opt) => {
var status = opt.execute_state?"(已完成)":"" var status = opt.execute_state ? "(已完成)" : ""
return {label:opt.name+status,value:opt.id}; return {
}) label: opt.name + status,
this.objectarr = itemList; value: opt.id
this.itemList = itemList; };
} })
}) this.objectarr = itemList;
}, this.itemList = itemList;
loadItemData(){ }
var user = {}; })
user.id = this.GLOBALUTIL.user.userid; },
user.name = encodeURI(this.GLOBALUTIL.user.username); loadItemData() {
uni.request({ var user = {};
url: this.GLOBALUTIL.url+'/safety/v1/check-task-lists/'+this.taskId+"?check_site_id="+this.selObject, user.id = this.GLOBALUTIL.user.userid;
method: 'GET', user.name = encodeURI(this.GLOBALUTIL.user.username);
header: { uni.request({
'Accept': 'application/json', url: this.GLOBALUTIL.url + '/safety/v1/check-task-lists/' + this.taskId + "?check_site_id=" + this.selObject,
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', method: 'GET',
'user' : JSON.stringify(user) header: {
}, 'Accept': 'application/json',
body:null, 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
success: (res) => { 'user': JSON.stringify(user)
var data = res.data; },
this.itemData = data; body: null,
var itemList = data.map((opt)=>{ success: (res) => {
var status = opt.execute_state?"(已完成)":"" var data = res.data;
return {label:opt.content+status,value:opt.id}; this.itemData = data;
}) var itemList = data.map((opt) => {
this.itemarr = itemList; var status = opt.execute_state ? "(已完成)" : ""
} return {
}) label: opt.content + status,
}, value: opt.id
findObjectData(){ };
var obj = {}; })
this.objectData.map((opt)=>{ this.itemarr = itemList;
if(opt.id == this.selObject){ }
obj = opt; })
} },
}) findObjectData() {
return obj; var obj = {};
}, this.objectData.map((opt) => {
findItemData(){ if (opt.id == this.selObject) {
var obj = {}; obj = opt;
this.itemData.map((opt)=>{ }
if(opt.id == this.selectItem){ })
obj = opt; return obj;
} },
}) findItemData() {
return obj; var obj = {};
} this.itemData.map((opt) => {
if (opt.id == this.selectItem) {
}, obj = opt;
components: { }
Picker })
return obj;
}
},
components: {
Picker
}, },
} }
</script> </script>
...@@ -186,79 +186,92 @@ import Picker from "@/components/w-picker/w-picker.vue"; ...@@ -186,79 +186,92 @@ import Picker from "@/components/w-picker/w-picker.vue";
.title { .title {
font-size: 30rpx; font-size: 30rpx;
color: #8f8f94; color: #8f8f94;
width: 100%;
}
.loginbtn {
width: 180rpx;
height: 200rpx;
}
.login-hover {
width: 200rpx;
height: 200rpx;
background-color: #00CE47;
}
.testview {
width: 209rpx;
height: 200rpx;
background-color: linear-gradient(red, yellow, blue);
}
.location-container {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
width: 100%;
height: 60rpx;
border-bottom: 1rpx solid #898989;
}
.arrow-right {
width: 40rpx;
height: 40rpx;
}
.camera-button {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 200rpx;
height: 200rpx;
}
.camera {
width: 50rpx;
height: 50rpx;
}
.submit-button {
display: flex;
width: 600rpx;
height: 60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
margin-top: 80rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover {
opacity: 0.7;
}
.detail {
width: 400rpx;
height: 100rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.value {
font-size: 30rpx;
color: #000000;
width: 100%; width: 100%;
}
.loginbtn {
width:180rpx;
height:200rpx;
}
.login-hover {
width:200rpx;
height:200rpx;
background-color:#00CE47;
}
.testview {
width:209rpx;
height:200rpx;
background-color:linear-gradient(red, yellow, blue);
}
.location-container{
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
width: 100%;
height: 60rpx;
border-bottom: 1rpx solid #898989;
}
.arrow-right{
width:40rpx;
height:40rpx;
}
.camera-button {
display:flex;
flex-direction: row;
align-items: center;
justify-content: center;
width:200rpx;
height: 200rpx;
}
.camera {
width:50rpx;
height:50rpx;
}
.submit-button {
display: flex;
width:600rpx;
height:60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
margin-top: 80rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
}
.detail {
width:400rpx;
height:100rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.value {
font-size: 30rpx;
color: #000000;
width: 100%;
} }
</style> </style>
<template> <template>
<view style="width: 100%;height: 100%;padding: 10px;"> <view style="width: 100%;height: 100%;padding: 10px;">
<scroll-view scroll-y="true" class="scroll-Y" show-scrollbar="false" > <scroll-view scroll-y="true" class="scroll-Y" show-scrollbar="false">
<view style="display: flex;flex-direction: row;border-bottom: 1rpx solid #4BBC9A;align-items: center;"> <view style="display: flex;flex-direction: row;border-bottom: 1rpx solid #4BBC9A;align-items: center;">
<image class="tip" src="../../static/security-submit/tip.png"> <image class="tip" src="../../static/security-submit/tip.png">
<text class="toptitle">整改项提交</text> <text class="toptitle">整改项提交</text>
</view>
<view class="item" hover-class="hover" @click="showTaskPicker">
<text class="title" style="margin-top: 30rpx;">检查任务</text>
<view class="selcontent">
<text class="datacontent">{{curTask.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showObjectPicker">
<text class="title" style="margin-top: 30rpx;">检查对象</text>
<view class="selcontent">
<text class="datacontent">{{curObject.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showItemTypePicker">
<text class="title" style="margin-top: 30rpx;">检查项类型</text>
<view class="selcontent">
<text class="datacontent">{{curItemType.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showItemPicker">
<text class="title" style="margin-top: 30rpx;">检查项</text>
<view class="selcontent">
<text class="datacontent">{{curItem.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showAddressSel">
<text class="title" style="margin-top: 30rpx;">位置</text>
<view class="selcontent">
<text class="datacontent">{{address}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view style="margin-top: 20px;">
<text class="title">整改项详情</text>
<view style="width: auto;margin-top: 10px;">
<textarea class="detail" @blur="changeTextValue" />
</view>
</view> </view>
<view class="item" hover-class="hover" @click="showTaskPicker"> <view style="margin-top: 20px;">
<text class="title" style="margin-top: 30rpx;">检查任务</text> <text class="title" style="margin-top: 30rpx;">整改项照片</text>
<view class="selcontent"> <view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;flex-direction: row;">
<text class="datacontent">{{curTask.name}}</text> <view style="margin-right: 30rpx;" v-for="(item,index) in images" :key="index">
<image class="tip" src="../../static/common/arrow_right_gray.png"> <button @click="onPhotoClick(index)" class="camera-button">
</view> <image mod="scaleToFill" class="camera-button" :src="item" />
</view> </button>
<view class="item" hover-class="hover" @click="showObjectPicker"> </view>
<text class="title" style="margin-top: 30rpx;">检查对象</text> <view class="photo">
<view class="selcontent"> <button @click="onclick" class="camera-button">
<text class="datacontent">{{curObject.name}}</text> <image class="camera" src="../../static/common/camera.png">
<image class="tip" src="../../static/common/arrow_right_gray.png"> </button>
</view> </view>
</view> </view>
<view class="item" hover-class="hover" @click="showItemTypePicker"> </view>
<text class="title" style="margin-top: 30rpx;">检查项类型</text> <view style="display: flex;justify-content: center;align-items: center;width: 100%;margin-top: 40px;">
<view class="selcontent"> <view hover-class="submithover" @click="showModal" class="submit-button">
<text class="datacontent">{{curItemType.name}}</text> <text class="submittext" >提交</text>
<image class="tip" src="../../static/common/arrow_right_gray.png"> </view>
</view> </view>
</view> <view style="width: 100%;height: 40px;">
<view class="item" hover-class="hover" @click="showItemPicker">
<text class="title" style="margin-top: 30rpx;">检查项</text> </view>
<view class="selcontent"> </scroll-view>
<text class="datacontent">{{curItem.name}}</text> <ActionSheet :show="showActionSheet" :tips="tips" :item-list="actionList" :mask-closable="maskClosable"
<image class="tip" src="../../static/common/arrow_right_gray.png"> :color="color" :size="size" :is-cancel="isCancel" @click="itemClick" @cancel="closeActionSheet"></ActionSheet>
</view> <Picker
</view> mode="linkage"
<view class="item" hover-class="hover" @click="showAddressSel"> :level="1"
<text class="title" style="margin-top: 30rpx;">位置</text> @confirm="onConfirm"
<view class="selcontent"> ref="picker"
<text class="datacontent">{{address}}</text> :linkList="itemList"
<image class="tip" src="../../static/common/arrow_right_gray.png"> themeColor="#f00"
</view> ></Picker>
</view> <form-alert v-if="submitShow" name="整改项提交" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<view style="margin-top: 20px;"> <PopUp ref="popup" :isdistance="true"></PopUp>
<text class="title">整改项详情</text> </view>
<view style="width: auto;margin-top: 10px;">
<textarea class="detail" @blur="changeTextValue" />
</view>
</view>
<view style="margin-top: 20px;">
<text class="title" style="margin-top: 30rpx;">整改项照片</text>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;flex-direction: row;">
<view style="margin-right: 30rpx;" v-for="(item,index) in images" :key="index">
<button @click="onPhotoClick(index)" class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" />
</button>
</view>
<view class="photo">
<button @click="onclick" class="camera-button">
<image class="camera" src="../../static/common/camera.png">
</button>
</view>
</view>
</view>
<view style="display: flex;justify-content: center;align-items: center;width: 100%;margin-top: 40px;">
<view hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext" >提交</text>
</view>
</view>
<view style="width: 100%;height: 40px;">
</view>
</scroll-view>
<ActionSheet :show="showActionSheet" :tips="tips" :item-list="actionList" :mask-closable="maskClosable"
:color="color" :size="size" :is-cancel="isCancel" @click="itemClick" @cancel="closeActionSheet"></ActionSheet>
<Picker
mode="linkage"
:level="1"
@confirm="onConfirm"
ref="picker"
:linkList="itemList"
themeColor="#f00"
></Picker>
<form-alert v-if="submitShow" name="整改项提交" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp>
</view>
</template> </template>
<script> <script>
import ActionSheet from "@/components/actionsheet/actionsheet.vue" import ActionSheet from "@/components/actionsheet/actionsheet.vue"
import AddressSelect from "@/components/multi-select/cityChiden.vue" import AddressSelect from "@/components/multi-select/cityChiden.vue"
import Picker from "@/components/w-picker/w-picker.vue"; import Picker from "@/components/w-picker/w-picker.vue";
export default { export default {
data() { data() {
return { return {
showActionSheet: false, showActionSheet: false,
maskClosable: true, maskClosable: true,
tips: "请选择", tips: "请选择",
color: "#9a9a9a", color: "#9a9a9a",
size: 26, size: 26,
isCancel: true, isCancel: true,
actionList: [{text:"打开相机"},{text:"从相册中选择"}], actionList: [{text:"打开相机"},{text:"从相册中选择"}],
objectData:{}, objectData:{},
checkitem:{}, checkitem:{},
taskId:"", taskId:"",
images:[], images:[],
textvalue:"kk", textvalue:"kk",
itemList:[], itemList:[],
curPicker:"", curPicker:"",
curTask:{}, curTask:{},
curObject:{}, curObject:{},
curItemType:{}, curItemType:{},
curItem:{}, curItem:{},
taskList:[], taskList:[],
objectList:[], objectList:[],
itemTypeList:[], itemTypeList:[],
checkItemList:[], checkItemList:[],
address:"", address:"",
addressType:"", addressType:"",
description:"", description:"",
room:{}, room:{},
submitShow:false, submitShow:false,
} }
}, },
onLoad() { onLoad() {
var that = this; var that = this;
uni.$on('addressSave',function(data){ uni.$on('addressSave',function(data){
var roomData = {}; var roomData = {};
roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code; roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code;
roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id; roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id;
roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name; roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
that.room = roomData that.room = roomData
that.address = that.GLOBALUTIL.addressSelectionTemp[0].name + that.GLOBALUTIL.addressSelectionTemp[1].name+that.GLOBALUTIL.addressSelectionTemp[2].name + that.GLOBALUTIL.addressSelectionTemp[3].name; that.address = that.GLOBALUTIL.addressSelectionTemp[0].name + that.GLOBALUTIL.addressSelectionTemp[1].name+that.GLOBALUTIL.addressSelectionTemp[2].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
}) })
uni.$on('securitySubmitPicChange',function(data){ uni.$on('securitySubmitPicChange',function(data){
that.images = data[0]; that.images = data[0];
}) })
this.getTaskList(); this.getTaskList();
},
onUnload(){
var that = this;
uni.$off('addressSave',function(data){
that.GLOBALUTIL.addressSelectionTemp = [];
})
uni.$off('securitySubmitPicChange',function(data){
})
}, },
methods: { onUnload(){
cancel:function(){ var that = this;
this.submitShow = false; uni.$off('addressSave',function(data){
}, that.GLOBALUTIL.addressSelectionTemp = [];
showModal:function(){ })
this.submitShow = true; uni.$off('securitySubmitPicChange',function(data){
})
},
methods: {
cancel:function(){
this.submitShow = false;
},
showModal:function(){
this.submitShow = true;
}, },
onclick: function() { onclick: function() {
this.showActionSheet = true; this.showActionSheet = true;
}, },
onPhotoClick:function(index){ onPhotoClick:function(index){
uni.navigateTo({ uni.navigateTo({
url:"../../components/image-preview/image-preview" url:"../../components/image-preview/image-preview"
}) })
uni.$emit("previewPhoto",[this.images,index]) uni.$emit("previewPhoto",[this.images,index])
}, },
onSubmitClick: function() { onSubmitClick: function() {
this.submitShow = false; this.submitShow = false;
var body = { var body = {
"check_scope":JSON.stringify(this.curCheckScope), "check_scope":JSON.stringify(this.curCheckScope),
"check_item_id":this.curItem.value, "check_item_id":this.curItem.value,
...@@ -171,238 +171,238 @@ import Picker from "@/components/w-picker/w-picker.vue"; ...@@ -171,238 +171,238 @@ import Picker from "@/components/w-picker/w-picker.vue";
"images":JSON.stringify(this.images), "images":JSON.stringify(this.images),
"description":this.description, "description":this.description,
"room":JSON.stringify(this.room) "room":JSON.stringify(this.room)
} }
console.log(JSON.stringify(body)) console.log(JSON.stringify(body))
// console.log(this.GLOBALUTIL.url) // console.log(this.GLOBALUTIL.url)
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
var bd = JSON.stringify(body); var bd = JSON.stringify(body);
uni.request({ uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/danger', url: this.GLOBALUTIL.url+'/safety/v1/danger',
method: 'POST', method: 'POST',
data:bd, data:bd,
header: { header: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'user' : JSON.stringify(user) 'user' : JSON.stringify(user)
}, },
success: (res) => { success: (res) => {
if(res.statusCode == 200){ if(res.statusCode == 200){
this.$refs.popup.open({ this.$refs.popup.open({
type:'success', type:'success',
content:'提交成功!', content:'提交成功!',
timeout:1000, timeout:1000,
isClick:false isClick:false
}); });
setTimeout(()=>{ setTimeout(()=>{
uni.navigateBack({ uni.navigateBack({
delta:1 delta:1
}) })
},1000) },1000)
} }
} }
}) })
}, },
itemClick: function(item) { itemClick: function(item) {
var that = this var that = this
if(item.index == 0){ if(item.index == 0){
uni.chooseImage({ uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有 sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //相机 sourceType: ['camera'], //相机
success: function (res) { success: function (res) {
var imgPath = res.tempFilePaths; var imgPath = res.tempFilePaths;
that.uploadPic(imgPath); that.uploadPic(imgPath);
} }
}); });
}else{ }else{
uni.chooseImage({ uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有 sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择 sourceType: ['album'], //从相册选择
success: function (res) { success: function (res) {
var imgPath = res.tempFilePaths; var imgPath = res.tempFilePaths;
that.uploadPic(imgPath); that.uploadPic(imgPath);
} }
}); });
} }
this.closeActionSheet(); this.closeActionSheet();
}, },
uploadPic(imgPath){ uploadPic(imgPath){
var user = {}; var user = {};
var that = this; var that = this;
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
let imgs = imgPath.map((value, index) => { let imgs = imgPath.map((value, index) => {
return { return {
name: "file", name: "file",
uri: value uri: value
} }
}); });
uni.uploadFile({ uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image', url: this.GLOBALUTIL.url+'/safety/v1/file/image',
files:imgs, files:imgs,
filePath:imgPath[0], filePath:imgPath[0],
name:"file", name:"file",
header: { header: {
'user' : JSON.stringify(user), 'user' : JSON.stringify(user),
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
}, },
success: (res) => { success: (res) => {
var uri = JSON.parse(res.data).data; var uri = JSON.parse(res.data).data;
console.log(uri) console.log(uri)
console.log(JSON.stringify(res)) console.log(JSON.stringify(res))
that.images.push(uri); that.images.push(uri);
} }
}) })
}, },
closeActionSheet: function() { closeActionSheet: function() {
this.showActionSheet = false this.showActionSheet = false
}, },
changeTextValue:function(e){ changeTextValue:function(e){
this.description = e.detail.value; this.description = e.detail.value;
}, },
showTaskPicker(){ showTaskPicker(){
this.curPicker = "task"; this.curPicker = "task";
this.itemList = this.taskList this.itemList = this.taskList
this.$refs.picker.show() this.$refs.picker.show()
}, },
showObjectPicker(){ showObjectPicker(){
this.curPicker = "object"; this.curPicker = "object";
this.itemList = this.objectList this.itemList = this.objectList
this.$refs.picker.show() this.$refs.picker.show()
}, },
showItemTypePicker(){ showItemTypePicker(){
this.curPicker = "type"; this.curPicker = "type";
this.itemList = this.itemTypeList this.itemList = this.itemTypeList
this.$refs.picker.show() this.$refs.picker.show()
}, },
showItemPicker(){ showItemPicker(){
this.curPicker = "item"; this.curPicker = "item";
this.itemTypeList.map((opt)=>{ this.itemTypeList.map((opt)=>{
if(opt.value == this.curItemType.value){ if(opt.value == this.curItemType.value){
this.checkItemList = opt.children this.checkItemList = opt.children
var itemlist = [] var itemlist = []
this.checkItemList.map((opt)=>{ this.checkItemList.map((opt)=>{
itemlist.push({label:opt.content,value:opt.id}) itemlist.push({label:opt.content,value:opt.id})
}) })
this.itemList = itemlist this.itemList = itemlist
} }
}) })
this.$refs.picker.show() this.$refs.picker.show()
}, },
onConfirm(data){ onConfirm(data){
console.log(JSON.stringify(data)) console.log(JSON.stringify(data))
if(this.curPicker == "task"){ if(this.curPicker == "task"){
this.curTask = {"name":data.checkArr[0],value:data.checkValue[0]} this.curTask = {"name":data.checkArr[0],value:data.checkValue[0]}
this.loadTaskObject(); this.loadTaskObject();
}else if(this.curPicker == "object"){ }else if(this.curPicker == "object"){
this.curObject = {"name":data.checkArr[0],value:data.checkValue[0]} this.curObject = {"name":data.checkArr[0],value:data.checkValue[0]}
this.objectData.map((opt)=>{ this.objectData.map((opt)=>{
if(opt.id == this.curObject.value){ if(opt.id == this.curObject.value){
if(opt.type == "site"){ if(opt.type == "site"){
this.addressType = "site"; this.addressType = "site";
this.address = opt.name this.address = opt.name
} }
this.curCheckScope = opt; this.curCheckScope = opt;
this.room = opt this.room = opt
} }
}) })
this.loadItemTypeData(); this.loadItemTypeData();
}else if (this.curPicker == "type"){ }else if (this.curPicker == "type"){
this.curItemType = {"name":data.checkArr[0],value:data.checkValue[0]} this.curItemType = {"name":data.checkArr[0],value:data.checkValue[0]}
}else{ }else{
this.curItem = {"name":data.checkArr[0],value:data.checkValue[0]} this.curItem = {"name":data.checkArr[0],value:data.checkValue[0]}
} }
}, },
showAddressSel(){ showAddressSel(){
if(this.addressType == "site"){ if(this.addressType == "site"){
return return
} }
uni.navigateTo({ uni.navigateTo({
url:"../../components/address-select/index?maxLevel=4" url:"../../components/address-select/index?maxLevel=4"
}) })
}, },
//任务列表 //任务列表
getTaskList(){ getTaskList(){
var body = {}; var body = {};
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({ uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1', url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET', method: 'GET',
header: { header: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user) 'user' : JSON.stringify(user)
}, },
body:null, body:null,
success: (res) => { success: (res) => {
var data = res.data.data; var data = res.data.data;
var itemList = data.map((opt)=>{ var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id}; return {label:opt.name,value:opt.id};
}) })
this.tasklist = itemList; this.tasklist = itemList;
this.itemList = itemList; this.itemList = itemList;
} }
}) })
}, },
//任务对象 //任务对象
loadTaskObject(){ loadTaskObject(){
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({ uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-scope/'+this.curTask.value, url: this.GLOBALUTIL.url+'/safety/v1/check-task-scope/'+this.curTask.value,
method: 'GET', method: 'GET',
header: { header: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user) 'user' : JSON.stringify(user)
}, },
body:null, body:null,
success: (res) => { success: (res) => {
var data = res.data; var data = res.data;
this.objectData = data; this.objectData = data;
var itemList = data.map((opt)=>{ var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id}; return {label:opt.name,value:opt.id};
}) })
this.objectList = itemList; this.objectList = itemList;
this.itemList = itemList; this.itemList = itemList;
} }
}) })
}, },
loadItemTypeData(){ loadItemTypeData(){
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({ uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-lists/'+this.curTask.value+"?check_site_id="+this.selObject, url: this.GLOBALUTIL.url+'/safety/v1/check-task-lists/'+this.curTask.value+"?check_site_id="+this.selObject,
method: 'GET', method: 'GET',
header: { header: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user) 'user' : JSON.stringify(user)
}, },
body:null, body:null,
success: (res) => { success: (res) => {
var data = res.data; var data = res.data;
this.itemData = data; this.itemData = data;
var itemList = data.map((opt)=>{ var itemList = data.map((opt)=>{
return {label:opt.content,value:opt.id,children:opt.children}; return {label:opt.content,value:opt.id,children:opt.children};
}) })
this.itemarr = itemList; this.itemarr = itemList;
this.itemTypeList = itemList; this.itemTypeList = itemList;
} }
}) })
}, },
}, },
components: { components: {
ActionSheet, ActionSheet,
AddressSelect, AddressSelect,
Picker, Picker,
}, },
} }
</script> </script>
...@@ -410,7 +410,7 @@ import Picker from "@/components/w-picker/w-picker.vue"; ...@@ -410,7 +410,7 @@ import Picker from "@/components/w-picker/w-picker.vue";
<style> <style>
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: #F5F5F5; background-color: #F5F5F5;
} }
...@@ -431,109 +431,109 @@ import Picker from "@/components/w-picker/w-picker.vue"; ...@@ -431,109 +431,109 @@ import Picker from "@/components/w-picker/w-picker.vue";
.title { .title {
font-size: 30rpx; font-size: 30rpx;
color: #8f8f94; color: #8f8f94;
} }
.loginbtn { .loginbtn {
width:180rpx; width:180rpx;
height:200rpx; height:200rpx;
} }
.login-hover { .login-hover {
width:200rpx; width:200rpx;
height:200rpx; height:200rpx;
background-color:#00CE47; background-color:#00CE47;
} }
.testview { .testview {
width:209rpx; width:209rpx;
height:200rpx; height:200rpx;
background-color:linear-gradient(red, yellow, blue); background-color:linear-gradient(red, yellow, blue);
} }
.location-container{ .location-container{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
width:100%; width:100%;
} }
.arrow-right{ .arrow-right{
width:40rpx; width:40rpx;
height:40rpx; height:40rpx;
} }
.camera-button { .camera-button {
display:flex; display:flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width:200rpx; width:200rpx;
height: 200rpx; height: 200rpx;
padding: 0; padding: 0;
} }
.camera { .camera {
width:50rpx; width:50rpx;
height:50rpx; height:50rpx;
} }
.submit-button { .submit-button {
display: flex; display: flex;
width:600rpx; width:600rpx;
height:60rpx; height:60rpx;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%); background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx; border-radius: 15rpx;
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.submittext { .submittext {
font-size: 14px; font-size: 14px;
color: #FFFFFF; color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
} }
.submithover{ .submithover{
opacity: 0.7; opacity: 0.7;
} }
.detail { .detail {
width:auto; width:auto;
height:300rpx; height:300rpx;
border: 1rpx solid #000000; border: 1rpx solid #000000;
} }
.status_bar { .status_bar {
height: var(--status-bar-height); height: var(--status-bar-height);
width: 100%; width: 100%;
} }
.location{ .location{
font-size: 34rpx; font-size: 34rpx;
color: #000000; color: #000000;
} }
.tip { .tip {
width: 30rpx; width: 30rpx;
height:30rpx height:30rpx
} }
.toptitle { .toptitle {
color: #666666; color: #666666;
font-size: 17px; font-size: 17px;
} }
.selcontent { .selcontent {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
margin-top: 20rpx; margin-top: 20rpx;
} }
.item { .item {
border-bottom: 1rpx solid #D0D0D0; border-bottom: 1rpx solid #D0D0D0;
width: 100%; width: 100%;
margin-top: 20rpx; margin-top: 20rpx;
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
.datacontent { .datacontent {
width: 100%; width: 100%;
font-size: 16px; font-size: 16px;
color: #4F4F4F; color: #4F4F4F;
} }
.hover { .hover {
opacity: 0.7; opacity: 0.7;
} }
.scroll-Y{ .scroll-Y{
height: 100%; height: 100%;
} }
.photo{ .photo{
margin-right: 30rpx; margin-right: 30rpx;
} }
</style> </style>
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
} }
}, },
methods:{ methods:{
clickSubmit(){ clickSubmit(){
uni.navigateTo({ uni.navigateTo({
url:"../Security-Submit/index" url:"../Security-Submit/index"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment