Commit 759a18ec by zhanxin liu

fix

parent 34593be7
var url = "";
var url = "http://47.94.204.226";
var addressSelectionTemp = [];
var user = {};
var sysInfo = {};
export default{
url,
addressSelectionTemp,
user
user,
sysInfo
}
\ No newline at end of file
......@@ -6,5 +6,5 @@ page {
position: relative; /* 下拉刷新区域相对自身定位 */
height: auto; /* 不可固定高度,否则overflow: hidden, 可通过设置最小高度使列表不满屏仍可下拉*/
overflow: hidden; /* 遮住顶部下拉刷新区域 */
box-sizing: border-box; /* 避免设置padding出现双滚动条的问题 */
box-sizing: border-box; /* 避免设置padding出现双滚动条的问题 */
}
\ No newline at end of file
<template>
<view class="content">
<text class="title">实验室名称:{{title}}</text>
<text class="title">位置</text>
<text class="title"> 实验室名称: {{objectData.name}}</text>
<text class="title" style="margin-top: 30rpx;">位置</text>
<view class="location-container">
<text class="title">{{location}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png">
<text class="location">{{objectData.name}}</text>
</view>
<text class="title" style="margin-top: 30rpx;">整改项详情</text>
<view style="width: 100%;">
<textarea class="detail" />
</view>
<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>
<button @click="onclick" class="camera-button">
<image class="camera" src="../../static/common/camera.png">
</button>
</view>
</view>
<textarea class="detail" />
<button @click="onclick" class="camera-button">
<image class="camera" src="../../static/common/camera.png">
</button>
<button hover-class="submithover" @click="onSubmitClick" class="submit-button">
<text class="submittext">提交</text>
</button>
......@@ -26,46 +33,121 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
export default {
data() {
return {
title: '虚拟仿真实验室',
location:"某个地址可能很长",
showActionSheet: false,
maskClosable: true,
tips: "确认清空搜索历史吗?",
itemList: [],
tips: "请选择",
color: "#9a9a9a",
size: 26,
isCancel: true,
cityInfo:[],
maxLevel:4
itemList: [{text:"打开相机"},{text:"从相册中选择"}],
objectData:{},
checkitem:{},
taskId:"",
images:[],
room:{}
}
},
onLoad() {
onLoad() {
var that = this;
uni.$on('addressSave',function(data){
console.log(this.GLOBALUTIL.addressSelectionTemp);
})
uni.$on('safeReportData',function(data){
that.objectData = data[0]
that.checkitem = data[1]
that.taskId = data[2]
})
},
onUnload(){
var that = this
uni.$off('addressSave',function(data){
this.GLOBALUTIL.addressSelectionTemp = [];
that.GLOBALUTIL.addressSelectionTemp = [];
})
uni.$on('safeReportData',function(data){
})
},
methods: {
onclick: function() {
uni.chooseImage({
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
console.log(JSON.stringify(res));
}
});
this.showActionSheet = true;
},
onSubmitClick: function() {
uni.navigateTo({
url:'../../components/address-select/index?maxLevel='+this.maxLevel
});
// uni.navigateTo({
// url:'../../components/address-select/index?maxLevel='+this.maxLevel
// });
var body = {
"check_scope":JSON.stringify(this.objectData),
"check_item_id":this.checkitem.id,
"check_list_id":this.checkitem.check_list_id,
"check_task_id":this.taskId,
"images":JSON.stringify(this.images),
"place":this.objectData.name,
"description":this.description,
"room":JSON.stringify(this.room)
}
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/danger',
method: 'POST',
body:JSON.stringify(body),
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
success: (res) => {
console.log(res)
}
})
},
itemClick: function(item) {
var that = this
if(item.index == 0){
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //相机
success: function (res) {
var imgPath = res.tempFilePaths;
that.uploadPic(imgPath);
}
});
}else{
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
var imgPath = res.tempFilePaths;
that.uploadPic(imgPath);
}
});
}
this.closeActionSheet();
},
itemClick: function() {
uploadPic(imgPath){
var currentTime = new Date().getTime();
var formData = new FormData();
let file = {uri: imgPath, type: 'application/octet-stream', name: currentTime+'.jpg'};
formData.append("file", file);
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
console.log(formData)
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/file/image',
method: 'POST',
body:formData,
header: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'user' : JSON.stringify(user)
},
success: (res) => {
console.log(res)
}
})
},
closeActionSheet: function() {
this.showActionSheet = false
......@@ -84,8 +166,6 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
......@@ -103,7 +183,7 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
}
.title {
font-size: 36rpx;
font-size: 30rpx;
color: #8f8f94;
}
.loginbtn {
......@@ -124,7 +204,7 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width:100%;
}
.arrow-right{
width:40rpx;
......@@ -150,6 +230,7 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
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;
......@@ -160,12 +241,16 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
opacity: 0.7;
}
.detail {
width:400rpx;
height:100rpx;
width:100%;
height:300rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.location{
font-size: 34rpx;
color: #000000;
}
</style>
<template>
<mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
<view class="news-li" v-for="(item,index) in dataList" :key="index">
<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>
<text>{{index}}.{{item.text}}</text>
<text>{{index}}.{{item.content}}</text>
</view>
<view style="display: flex;flex-direction: row; width: 100%;justify-content: space-between;">
<view style="display: flex;flex-direction: row;">
<view class="item-container" @click="itemClick(index,1)">
<view :class="item.status==1? 'selected' :'unselected' "></view>
<text>符合</text>
</view>
<view class="item-container" @click="itemClick(index,2)">
<view :class="item.status==2? 'selected' :'unselected' "></view>
<text>不符合</text>
</view>
<view class="item-container" @click="itemClick(index,3)">
<view :class="item.status==3? 'selected' :'unselected' "></view>
<text>不适用</text>
<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>
<button hover-class="submithover" @click="onSubmitClick" class="submit-button">
<text class="submittext">提交</text>
</button>
</mescroll-body>
</template>
......@@ -34,13 +31,36 @@
downOption: {
auto: false //是否在初始化后,自动执行downCallback; 默认true
},
dataList: [{text:"问题",status:1},{text:"问题",status:1},{text:"问题",status:1},{text:"问题",status:1}],
dataList: [],
upOption: {
use: false, // 是否启用上拉加载; 默认true
},
},
isShow:false,
checkitems:[],
objectData:{},
taskId:""
}
},
methods: {
methods: {
onLoad() {
var that = this;
uni.$on('sendCheckItem',function(data){
that.objectData = data[0]
that.taskId = data[2];
var content = data[1].children
content.map((opt)=>{
opt.status = 0;
// opt.checkitems = [];
})
that.dataList = content;
})
this.loadData();
},
onUnload(){
uni.$off('sendCheckItem',function(data){
})
},
/*下拉刷新的回调 */
downCallback() {
this.mescroll.endSuccess();
......@@ -55,12 +75,40 @@
})
},
itemClick(index,status){
this.dataList[index].status = status
this.dataList[index].status = status;
this.$forceUpdate();
},
checkItem(){
checkItem(item){
uni.navigateTo({
url:"./index"
})
uni.$emit("safeReportData",[this.objectData,item,this.taskId]);
},
loadData(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
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',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
this.dataList.map((opt)=>{
opt.checkitems = res.data.data;
})
this.checkitems = res.data.data;
this.isShow = true;
}
})
},
onSubmitClick(){
}
}
}
......@@ -75,10 +123,13 @@
text-align: center;
}
/*展示上拉加载的数据列表*/
.news-li{
.news-li{
display: flex;
flex-direction: column;
font-size: 32upx;
padding: 32upx;
border-bottom: 1upx solid #eee;
border-bottom: 1upx solid #eee;
width: 100%;
}
.news-li .new-content{
font-size: 28upx;
......@@ -113,5 +164,30 @@
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>
<mescroll-body 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">
<view class="news-li" v-for="news in dataList" :key="news.id" hover-class="hover" @click="goDetail(news)">
<view class="top-container" >
<text class="title">安全检查任务</text>
<text class="title">{{news.name}}</text>
<view class="status">
<text class="status-text">未完成 0/1</text>
<text class="status-text">{{news.taskstatus}}</text>
</view>
</view>
<view><text class="des">打我撒</text></view>
<view><image class="icon" src="../../static/security-check/safeTime.png"><text class="">2020-20123</text></view>
<view><image class="icon" src="../../static/security-check/safeSys.png"><text>城建楼宿舍</text></view>
<view><image class="icon" src="../../static/security-check/safePerson.png"><text>陆冬梅</text></view>
<view><text>自建任务</text></view>
<view><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 style="display: flex;flex-direction: row;align-items: center;">
<image class="icon" src="../../static/security-check/safeSys.png">
<view style="display: flex;flex-direction: column;" v-for="(data,index) in JSON.parse(news.check_scope)" :key="index" >
<text class="detail">{{data.name}}</text>
</view>
</view>
<view><image class="icon" src="../../static/security-check/safePerson.png"><text class="detail">陆冬梅</text></view>
<view><text class="type">自建任务</text></view>
</view>
</mescroll-body>
</template>
......@@ -25,13 +30,16 @@
downOption: {
auto: false //是否在初始化后,自动执行downCallback; 默认true
},
dataList: [1,2,3,4,5,6,6,7,8,8],
dataList: [],
upOption: {
use: false, // 是否启用上拉加载; 默认true
},
}
},
methods: {
methods: {
onLoad() {
this.loadData();
},
/*下拉刷新的回调 */
downCallback() {
this.mescroll.endSuccess();
......@@ -40,9 +48,60 @@
upCallback(page) {
},
goDetail(){
/*获取列表*/
loadData(){
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data.data;
data.map((opt)=>{
opt.taskstatus = this.handleStatus(opt);
var taskexecutor = JSON.parse(opt.excutor);
var taskexecutortext = "";
taskexecutor.map((opt)=>{
taskexecutortext = opt.name +" ";
})
opt.taskexecutor = taskexecutortext;
})
this.dataList = data;
}
})
},
handleStatus(data){
var text = "";
if(data.execute_state){
var check_scope = JSON.parse(data.check_scope);
text = "已完成" + check_scope.length +"/" + check_scope.length;
}else{
var check_scope = JSON.parse(data.check_scope);
var checked = 0;
check_scope.map((opt)=>{
if(opt.execute_state){
checked++
}
})
if(checked == check_scope.length){
text = "已完成 " + check_scope.length +"/" + check_scope.length;
}else{
text = '未完成 '+checked+'/'+check_scope.length;
}
}
return text
},
goDetail(data){
uni.navigateTo({
url:"./select-checkobject"
url:"./select-checkobject?taskId="+data.id
})
}
}
......@@ -72,6 +131,7 @@
.icon {
width:20rpx;
height:20rpx;
margin-right: 20rpx;
}
.top-container {
display: flex;
......@@ -103,5 +163,11 @@
font-weight:200;
font-size:14px;
color:#676767
}
.detail {
font-size:14px;
}
.type {
font-size:14px;
}
</style>
<template>
<view class="content">
<text class="title">检查对象</text>
<view class="location-container" @click="showPicker">
<text class="title">{{location}}</text>
<view style="width: 100%;margin-top: 20rpx;"><text class="title">检查对象</text></view>
<view class="location-container" @click="showObjectPicker">
<text class="value">{{selObjectText}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png">
</view>
<text class="title">检查项类型</text>
<view class="location-container" @click="showPicker">
<text class="title">{{location}}</text>
<view style="width: 100%;margin-top: 20rpx;"><text class="title">检查项类型</text></view>
<view class="location-container" @click="showTypePicker">
<text class="value">{{selectItemText}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png">
</view>
<button hover-class="submithover" @click="onSubmitClick" class="submit-button">
......@@ -29,23 +29,24 @@ import Picker from "@/components/w-picker/w-picker.vue";
export default {
data() {
return {
title: '虚拟仿真实验室',
location:"",
showActionSheet: false,
maskClosable: true,
tips: "确认清空搜索历史吗?",
itemList: [{label:"aaa",value:"10"}],
color: "#9a9a9a",
size: 26,
isCancel: true,
cityInfo:[],
maxLevel:4
itemList: [],
taskId:"",
selObject:"",
selObjectText:"",
selectItem:"",
selectItemText:"",
objectarr:[],
itemarr:[],
curType:"object",
objectData:[],
itemData:[]
}
},
onLoad() {
},
onLoad(option) {
this.taskId = option.taskId
this.loadTaskObject();
},
methods: {
itemClick: function() {
......@@ -54,15 +55,103 @@ import Picker from "@/components/w-picker/w-picker.vue";
this.showActionSheet = false
},
onConfirm(data){
console.log(data)
if(this.curType == "object"){
this.selObject = data.checkValue[0];
this.selObjectText = data.checkArr[0];
this.itemarr = [];
this.selectItem = "";
this.selectItemText = "";
this.loadItemData();
}else{
this.selectItem = data.checkValue[0];
this.selectItemText = data.checkArr[0];
}
},
onSubmitClick(){
var objectData = this.findObjectData();
var itemData = this.findItemData();
uni.navigateTo({
url:"security-checkitem"
})
uni.$emit("sendCheckItem",[objectData,itemData,this.taskId]);
},
showObjectPicker(){
this.itemList = this.objectarr;
this.curType = "object"
this.$refs.picker.show()
},
showTypePicker(){
if(this.selObject == ""){
return
}
this.itemList = this.itemarr;
this.curType = "item";
this.$refs.picker.show()
},
loadTaskObject(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-scope/'+this.taskId,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data;
this.objectData = data;
var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id};
})
this.objectarr = itemList;
this.itemList = itemList;
}
})
},
showPicker(){
this.$refs.picker.show()
loadItemData(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-lists/'+this.taskId+"?check_site_id="+this.selObject,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data;
this.itemData = data;
var itemList = data.map((opt)=>{
return {label:opt.content,value:opt.id};
})
this.itemarr = itemList;
}
})
},
findObjectData(){
var obj = {};
this.objectData.map((opt)=>{
if(opt.id == this.selObject){
obj = opt;
}
})
return obj;
},
findItemData(){
var obj = {};
this.itemData.map((opt)=>{
if(opt.id == this.selectItem){
obj = opt;
}
})
return obj;
}
},
......@@ -77,7 +166,6 @@ import Picker from "@/components/w-picker/w-picker.vue";
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
......@@ -95,8 +183,9 @@ import Picker from "@/components/w-picker/w-picker.vue";
}
.title {
font-size: 36rpx;
color: #8f8f94;
font-size: 30rpx;
color: #8f8f94;
width: 100%;
}
.loginbtn {
width:180rpx;
......@@ -116,7 +205,11 @@ import Picker from "@/components/w-picker/w-picker.vue";
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
justify-content: flex-end;
width: 100%;
height: 60rpx;
border-bottom: 1rpx solid #898989;
}
.arrow-right{
width:40rpx;
......@@ -142,6 +235,7 @@ import Picker from "@/components/w-picker/w-picker.vue";
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;
......@@ -159,5 +253,10 @@ import Picker from "@/components/w-picker/w-picker.vue";
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
}
.value {
font-size: 30rpx;
color: #000000;
width: 100%;
}
</style>
......@@ -46,15 +46,19 @@
return {
providerList: [],
hasProvider: false,
account: '',
password: '',
account: '20040998',
password: 'password',
positionTop: 0,
isDevtools: false,
}
},
// computed: mapState(['forcedLogin']),
methods: {
onLoad() {
const sysInfo = uni.getSystemInfoSync();
console.log(sysInfo.windowWidth)
this.GLOBALUTIL.sysInfo = sysInfo
},
initPosition() {
/**
* 使用 absolute 定位,并且设置 bottom 值进行定位。软键盘弹出时,底部会因为窗口变化而被顶上来。
......@@ -73,7 +77,7 @@
}
var bodyStr = form.join("&");
uni.request({
url: 'http://47.94.204.226/client/api', //仅为示例,并非真实接口地址。
url: this.GLOBALUTIL.url+'/client/api', //仅为示例,并非真实接口地址。
method: 'POST',
data: body,
header: {
......@@ -84,8 +88,8 @@
this.GLOBALUTIL.user = res.data.loginresponse
console.log(res.data);
this.text = 'request success';
uni.reLaunch({
url: '../Security-Check/index',
uni.navigateTo({
url: '../Security-Check/security-task-list',
});
}
})
......@@ -162,7 +166,7 @@
*/
if (this.forcedLogin) {
uni.reLaunch({
url: '../Security-Check/index',
url: '../Security-Check/security-task-list',
});
} else {
uni.navigateBack();
......
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