Commit ce425d2d by liuzhanxin

提交整改项修改

parent 6f06f9ee
...@@ -15,6 +15,12 @@ var commonHeader = { ...@@ -15,6 +15,12 @@ var commonHeader = {
"tenant-id":undefined "tenant-id":undefined
}; };
import moment from "./moment.js" import moment from "./moment.js"
var guid2 = ()=> {
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}
export default{ export default{
url, url,
addressSelectionTemp, addressSelectionTemp,
...@@ -23,5 +29,6 @@ export default{ ...@@ -23,5 +29,6 @@ export default{
moment, moment,
token, token,
commonHeader, commonHeader,
intelligent_access_url intelligent_access_url,
guid2
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<view :style="{ top: positionTop + 'upx' }" class="days"> <view :style="{ top: positionTop + 'upx' }" class="days">
<view class="item" v-for="(item, index) in dates" :key="index"> <view class="item" v-for="(item, index) in dates" :key="index">
<view class="day" @click="selectOne(item, $event)" :class="{ choose: choose == handleDate(item.year,item.month+1,item.date), nolm: !item.lm }">{{ item.date }}</view> <view class="day" @click="selectOne(item, $event)" :class="{ choose: choose == handleDate(item.year,item.month+1,item.date), nolm: !item.lm }">{{ item.date }}</view>
<view class="sign" v-if="isSigned(item.year, item.month + 1, item.date)"></view> <view :class="isSigned(item.year, item.month + 1, item.date).isOvertime? 'can-not-sign' : 'sign' " v-if="isSigned(item.year, item.month + 1, item.date).signState" ></view>
</view> </view>
</view> </view>
</view> </view>
...@@ -126,17 +126,42 @@ export default { ...@@ -126,17 +126,42 @@ export default {
} }
return dates return dates
}, },
getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year + seperator1 + month + seperator1 + strDate;
return currentdate;
},
// 已经签到处理 // 已经签到处理
isSigned(y, m, d) { isSigned(y, m, d) {
let flag = false let flag = false
let isOvertime = false;
for (let i = 0; i < this.signeddates.length; i++) { for (let i = 0; i < this.signeddates.length; i++) {
let dy = this.handleDate(y,m,d); let dy = this.handleDate(y,m,d);
if (this.signeddates[i] == dy) { if (this.signeddates[i] == dy) {
flag = true flag = true
let now = this.getNowFormatDate();
if(now > dy){
isOvertime = true;
}
break break
} }
} }
return flag
var res = {
signState:flag,
isOvertime:isOvertime
}
return res
}, },
isToday(y, m, d) { isToday(y, m, d) {
let date = new Date() let date = new Date()
...@@ -295,6 +320,19 @@ export default { ...@@ -295,6 +320,19 @@ export default {
pointer-events: none; pointer-events: none;
} }
.can-not-sign {
font-style: normal;
width: 20upx;
height: 20upx;
background: #999999;
border-radius: 10upx;
position: absolute;
left: 50%;
margin-left: -10upx;
bottom: 0;
pointer-events: none;
}
.today-text { .today-text {
position: absolute; position: absolute;
font-size: 20upx; font-size: 20upx;
......
...@@ -136,6 +136,7 @@ ...@@ -136,6 +136,7 @@
header: this.GLOBALUTIL.commonHeader, header: this.GLOBALUTIL.commonHeader,
body: null, body: null,
success: (res) => { success: (res) => {
console.log(res)
var calendarData = res.data.data; var calendarData = res.data.data;
var signeddates = calendarData.map((opt)=>{ var signeddates = calendarData.map((opt)=>{
var dt = opt.date.split(" ")[0] var dt = opt.date.split(" ")[0]
...@@ -167,6 +168,13 @@ ...@@ -167,6 +168,13 @@
opt.checked = false; opt.checked = false;
return opt return opt
}) })
this.currentCalendarData.sort((a,b)=>{
if(a.startTime > b.startTime){
return 1
}else{
return -1
}
})
} }
}) })
}, },
...@@ -192,10 +200,18 @@ ...@@ -192,10 +200,18 @@
}, },
onNavigationBarButtonTap() { onNavigationBarButtonTap() {
var timetableUuids = []; var timetableUuids = [];
var flag = false
this.currentCalendarData.map((opt)=>{ this.currentCalendarData.map((opt)=>{
if(opt.checked){ if(opt.checked){
timetableUuids.push(opt.calendarId); timetableUuids.push(opt.calendarId);
} }
if(opt.date){
var curDate = this.GLOBALUTIL.moment().format("YYYY-MM-DD")
var dt = opt.date.split(" ")[0]
if(dt < curDate ){
flag = true
}
}
}) })
if(timetableUuids.length == 0){ if(timetableUuids.length == 0){
this.$refs.popup.open({ this.$refs.popup.open({
...@@ -206,6 +222,15 @@ ...@@ -206,6 +222,15 @@
}); });
return return
} }
if(flag){
this.$refs.popup.open({
type:'err',
content:'已过期的时间不可预约',
timeout:1000,
isClick:false
});
return
}
uni.navigateTo({ uni.navigateTo({
url:"./write-confirm", url:"./write-confirm",
}) })
...@@ -215,11 +240,20 @@ ...@@ -215,11 +240,20 @@
}, },
submit(){ submit(){
var timetableUuids = []; var timetableUuids = [];
var flag = false
this.currentCalendarData.map((opt)=>{ this.currentCalendarData.map((opt)=>{
if(opt.checked){ if(opt.checked){
timetableUuids.push(opt.calendarId); timetableUuids.push(opt.calendarId);
} }
if(opt.date){
var curDate = this.GLOBALUTIL.moment().fomat("YYYY-MM-DD")
var dt = opt.date.split(" ")[0]
if(dt < curDate ){
flag = true
}
}
}) })
if(timetableUuids.length == 0){ if(timetableUuids.length == 0){
this.$refs.popup.open({ this.$refs.popup.open({
type:'err', type:'err',
...@@ -229,6 +263,15 @@ ...@@ -229,6 +263,15 @@
}); });
return return
} }
if(flag){
this.$refs.popup.open({
type:'err',
content:'已过期的时间不可预约',
timeout:1000,
isClick:false
});
return
}
var body = { var body = {
"openLab": this.settingData.labUuid, "openLab": this.settingData.labUuid,
"openProject": {}, "openProject": {},
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<MescrollBody class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" <MescrollBody class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
@up="upCallback"> @up="upCallback">
<view class="news-li" v-for="news in dataList" :key="news.id" > <view class="news-li" v-for="news in dataList" :key="news.id" >
<view class="ori" style="height:300upx;border-bottom: 1px solid #EEEEEE;"> <view class="ori" style="height:300upx;border-bottom: 1px solid #EEEEEE;padding-left: 20upx;">
<image mode="scaleToFill" class="cover" src="../../static/lab-share/cover.jpg" /> <image mode="scaleToFill" class="cover" src="../../static/lab-share/cover.jpg" />
<view style="flex-direction: column;"> <view style="flex-direction: column;">
<view> <view>
...@@ -39,8 +39,11 @@ ...@@ -39,8 +39,11 @@
<text class="detail">审核状态:</text> <text class="detail">审核状态:</text>
<text class="detail">{{news.statusName}}</text> <text class="detail">{{news.statusName}}</text>
</view> </view>
<view class="signin" hover-class="hover" @click="signIn(news)"> <view v-if="news.signIn" class="signed" hover-class="hover">
<text class="detail" style="color:#ffffff">签到</text> <text class="detail" style="color:#898989">已签到</text>
</view>
<view v-if="!news.signIn" class="signin" hover-class="hover" @click="signIn(news)">
<text class="detail" style="color:#ffffff">已签到</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -66,7 +69,8 @@ ...@@ -66,7 +69,8 @@
upOption: { upOption: {
use: false, // 是否启用上拉加载; 默认true use: false, // 是否启用上拉加载; 默认true
}, },
submitShow:false submitShow:false,
curSign:""
} }
}, },
methods: { methods: {
...@@ -94,6 +98,7 @@ ...@@ -94,6 +98,7 @@
method: 'GET', method: 'GET',
header: this.GLOBALUTIL.commonHeader, header: this.GLOBALUTIL.commonHeader,
success: (res) => { success: (res) => {
console.log(res)
var finalData = res.data.data; var finalData = res.data.data;
finalData.map((opt)=>{ finalData.map((opt)=>{
opt.labName = opt.labInfo == null?"":opt.labInfo.name opt.labName = opt.labInfo == null?"":opt.labInfo.name
...@@ -114,6 +119,8 @@ ...@@ -114,6 +119,8 @@
}) })
}, },
signIn(data) { signIn(data) {
console.log(data)
this.curSign = data;
this.submitShow = true; this.submitShow = true;
}, },
cancel:function(){ cancel:function(){
...@@ -122,14 +129,12 @@ ...@@ -122,14 +129,12 @@
onSubmitClick(){ onSubmitClick(){
this.submitShow = false; this.submitShow = false;
uni.request({ uni.request({
url: '', url:this.GLOBALUTIL.url +'/openlab/v2/signIn/'+this.curSign.id,
method: 'GET', method: 'GET',
data: {}, header: this.GLOBALUTIL.commonHeader,
success: res => { success: res => {
console.log(res)
}, },
fail: () => {},
complete: () => {}
}); });
this.$refs.popup.open({ this.$refs.popup.open({
type:'success', type:'success',
...@@ -137,6 +142,7 @@ ...@@ -137,6 +142,7 @@
timeout:1000, timeout:1000,
isClick:false isClick:false
}); });
this.loadData();
} }
}, },
components: { components: {
...@@ -161,13 +167,6 @@ ...@@ -161,13 +167,6 @@
margin-top:30rpx; margin-top:30rpx;
} }
.news-li .new-content {
font-size: 28upx;
margin-top: 10upx;
margin-left: 20upx;
color: #666;
}
.icon { .icon {
width: 20rpx; width: 20rpx;
height: 20rpx; height: 20rpx;
...@@ -267,4 +266,14 @@ ...@@ -267,4 +266,14 @@
align-items: center; align-items: center;
margin-right: 40upx; margin-right: 40upx;
} }
.signed {
width:200upx;
height:60upx;
background-color: #f5f5f5;
display: flex;
justify-content: center;
align-items: center;
margin-right: 40upx;
}
</style> </style>
...@@ -30,10 +30,29 @@ ...@@ -30,10 +30,29 @@
var that = this var that = this
uni.$on('rectificationListData', function(data) { uni.$on('rectificationListData', function(data) {
var detailData = data[0] var detailData = data[0]
that.roomName = JSON.parse(detailData.room).name console.log(detailData.room)
if(that.isJSON(detailData.room)){
that.roomName =JSON.parse(detailData.room).name
}else{
that.roomName = detailData.room
}
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)
uni.request({
url: that.GLOBALUTIL.url+'/basis/attachments/fileInfos?belongId='+that.detailData.id,
method: 'GET',
header:that.GLOBALUTIL.commonHeader,
success: res => {
if(res.statusCode == 200){
var data = res.data;
var url = data.map((opt)=>{
return that.GLOBALUTIL.url+"/basis/attachments/files/preview/"+opt.id+"?token="+that.GLOBALUTIL.commonHeader["x-auth-token"]
})
that.imgUrl = url;
}
},
});
that.$forceUpdate(); that.$forceUpdate();
}) })
}, },
...@@ -54,8 +73,27 @@ ...@@ -54,8 +73,27 @@
uni.navigateTo({ uni.navigateTo({
url: "../Security-Check/index?mod=put" url: "../Security-Check/index?mod=put"
}) })
setTimeout(()=>{
uni.$emit("rectificationEdit", [this.detailData]) uni.$emit("rectificationEdit", [this.detailData])
},300)
}, },
isJSON(str) {
if (typeof str == 'string') {
try {
var obj=JSON.parse(str);
if(typeof obj == 'object' && obj ){
return true;
}else{
return false;
}
} catch(e) {
// console.log('error:'+str+'!!!'+e);
return false;
}
}
// console.log('It is not a string!')
}
} }
} }
</script> </script>
......
...@@ -205,10 +205,13 @@ ...@@ -205,10 +205,13 @@
} }
}, },
goDetail(data) { goDetail(data) {
console.log(data)
uni.navigateTo({ uni.navigateTo({
url: "./detail" url: "./detail"
}) })
setTimeout(()=>{
uni.$emit("rectificationListData", [data]) uni.$emit("rectificationListData", [data])
},300)
}, },
showStatusPicker() { showStatusPicker() {
this.curType = "status" this.curType = "status"
......
<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">
...@@ -60,6 +60,7 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -60,6 +60,7 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
submitMethod:"POST", submitMethod:"POST",
baseBody:{}, baseBody:{},
submitShow:false, submitShow:false,
dataId:''
} }
}, },
...@@ -68,14 +69,17 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -68,14 +69,17 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
this.submitMethod = "PUT" this.submitMethod = "PUT"
} }
var that = this; var that = this;
uni.$on('addressSave',function(data){ this.dataId = this.GLOBALUTIL.guid2();
console.log(JSON.stringify(that.GLOBALUTIL.addressSelectionTemp)) uni.$on('labEntitySave',function(data){
var roomData = {}; // console.log(JSON.stringify(that.GLOBALUTIL.addressSelectionTemp))
roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code; // var roomData = {};
roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id; // roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code;
roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name; // roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id;
that.room = roomData // roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].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; // 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 = data[0].name
that.room = data[0];
}) })
uni.$on('safeReportData',function(data){ uni.$on('safeReportData',function(data){
that.objectData = data[0] that.objectData = data[0]
...@@ -107,16 +111,10 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -107,16 +111,10 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
}) })
}, },
onUnload(){ onUnload(){
var that = this uni.$off('labEntitySave')
uni.$off('addressSave',function(data){ uni.$off('safeReportData')
that.GLOBALUTIL.addressSelectionTemp = []; uni.$off('rectificationEdit')
}) uni.$off('securitySubmitPicChange')
uni.$off('safeReportData',function(data){
})
uni.$off('rectificationEdit',function(data){
})
uni.$off('securitySubmitPicChange',function(data){
})
}, },
methods: { methods: {
showAddressSel(){ showAddressSel(){
...@@ -124,13 +122,12 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -124,13 +122,12 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
return return
} }
uni.navigateTo({ uni.navigateTo({
url:"../../components/address-select/index?maxLevel=4" url:"../../components/lab-select/index?experimentCenterId="+this.objectData.id
}) })
}, },
onclick: function() { onclick: function() {
console.log(this.textvalue) console.log(this.textvalue)
this.showActionSheet = true; this.showActionSheet = true;
}, },
onPhotoClick:function(index){ onPhotoClick:function(index){
uni.navigateTo({ uni.navigateTo({
...@@ -145,7 +142,8 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -145,7 +142,8 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
"check_item_id":this.checkitem.id, "check_item_id":this.checkitem.id,
"check_list_id":this.checkitem.check_list_id, "check_list_id":this.checkitem.check_list_id,
"check_task_id":this.taskId, "check_task_id":this.taskId,
"images":JSON.stringify(this.images), // "images":JSON.stringify(this.images),
"id":this.dataId,
"place":this.objectData.name, "place":this.objectData.name,
"description":this.description, "description":this.description,
"room":JSON.stringify(this.room) "room":JSON.stringify(this.room)
...@@ -219,17 +217,24 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -219,17 +217,24 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
} }
}); });
uni.uploadFile({ uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image', url: this.GLOBALUTIL.url+'/basis/attachments/files',
files:imgs, files:imgs,
filePath:imgPath[0], filePath:imgPath[0],
name:"file", name:"file",
header: { formData: {
'belongId': this.dataId
},
header:{
"x-auth-token":this.GLOBALUTIL.commonHeader["x-auth-token"], "x-auth-token":this.GLOBALUTIL.commonHeader["x-auth-token"],
// '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); console.log(res)
console.log(JSON.stringify(res))
imgPath.map((opt)=>{
that.images.push(opt)
})
} }
}) })
}, },
......
...@@ -33,12 +33,13 @@ ...@@ -33,12 +33,13 @@
<image class="tip" src="../../static/common/arrow_right_gray.png"> <image class="tip" src="../../static/common/arrow_right_gray.png">
</view> </view>
</view> </view>
<view class="item" hover-class="hover" @click="showAddressSel"> <view class="item">
<text class="title" style="margin-top: 30rpx;">位置</text> <text class="title" style="margin-top: 30rpx;">位置</text>
<view class="selcontent"> <input style="margin-top:10rpx;" v-model="address" focus placeholder="请输入位置" />
<!-- <view class="selcontent">
<text class="datacontent">{{address}}</text> <text class="datacontent">{{address}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png"> <image class="tip" src="../../static/common/arrow_right_gray.png">
</view> </view> -->
</view> </view>
<view style="margin-top: 20px;"> <view style="margin-top: 20px;">
<text class="title">整改项详情</text> <text class="title">整改项详情</text>
...@@ -114,11 +115,12 @@ import FormAlert from "@/components/form-alert/h-form-alert.vue" ...@@ -114,11 +115,12 @@ import FormAlert from "@/components/form-alert/h-form-alert.vue"
description:"", description:"",
room:{}, room:{},
submitShow:false, submitShow:false,
dataId:''
} }
}, },
onLoad() { onLoad() {
var that = this; var that = this;
this.dataId = this.GLOBALUTIL.guid2();
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;
...@@ -163,9 +165,10 @@ import FormAlert from "@/components/form-alert/h-form-alert.vue" ...@@ -163,9 +165,10 @@ import FormAlert from "@/components/form-alert/h-form-alert.vue"
"check_item_id":this.curItem.value, "check_item_id":this.curItem.value,
"check_list_id":this.curItemType.value, "check_list_id":this.curItemType.value,
"check_task_id":this.curTask.value, "check_task_id":this.curTask.value,
"images":JSON.stringify(this.images), // "images":JSON.stringify(this.images),
"id":this.dataId,
"description":this.description, "description":this.description,
"room":JSON.stringify(this.room) "room":this.address//JSON.stringify(this.room)
} }
console.log(JSON.stringify(body)) console.log(JSON.stringify(body))
// console.log(this.GLOBALUTIL.url) // console.log(this.GLOBALUTIL.url)
...@@ -231,19 +234,24 @@ import FormAlert from "@/components/form-alert/h-form-alert.vue" ...@@ -231,19 +234,24 @@ import FormAlert from "@/components/form-alert/h-form-alert.vue"
} }
}); });
uni.uploadFile({ uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image', url: this.GLOBALUTIL.url+'/basis/attachments/files',
files:imgs, files:imgs,
filePath:imgPath[0], filePath:imgPath[0],
name:"file", name:"file",
header: { formData: {
'user' : JSON.stringify(user), 'belongId': this.dataId
'Content-Type': 'multipart/form-data', },
header:{
"x-auth-token":this.GLOBALUTIL.commonHeader["x-auth-token"],
// '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(res)
console.log(JSON.stringify(res)) console.log(JSON.stringify(res))
that.images.push(uri); imgPath.map((opt)=>{
that.images.push(opt)
})
} }
}) })
}, },
......
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