260 lines
6.5 KiB
Vue
260 lines
6.5 KiB
Vue
<template>
|
|
<view :class="isUps == true ? 'prevent' : ''">
|
|
<cu-custom bgColor="bg-gradual-blueness" :isBack="true" >
|
|
<block slot="backText">返回</block>
|
|
<block slot="content">离岗申请</block>
|
|
</cu-custom>
|
|
<scroll-view scroll-y="false" >
|
|
<view class="form">
|
|
<!-- <view class="cu-form-textarea">
|
|
<view class="cu-form-title text-hui">检查内容</view>
|
|
<view class="f24 text-black">
|
|
{{pd.CHECK_CONTENT}}
|
|
</view>
|
|
</view> -->
|
|
<view class="de-card-list de-list">
|
|
<!-- <view class="de-title">
|
|
<text class="text-semi">隐患验收</text>
|
|
</view> -->
|
|
<view class="cu-form-group ">
|
|
<view class="title">离岗开始时间</view>
|
|
<ruiDatePicker
|
|
:start="todayDate"
|
|
fields="day"
|
|
:value="pd.STARTTIME?pd.STARTTIME:'请选择'"
|
|
@change="changeStartDate"
|
|
></ruiDatePicker>
|
|
</view>
|
|
<view class="cu-form-group bb">
|
|
<view class="title">离岗结束时间</view>
|
|
<ruiDatePicker
|
|
:start="todayDate"
|
|
fields="day"
|
|
:value="pd.ENDTIME?pd.ENDTIME:'请选择'"
|
|
@change="changeEndDate"
|
|
></ruiDatePicker>
|
|
</view>
|
|
<view class="cu-form-textarea bb-default" style="border-top: 1upx solid #eee;" >
|
|
<view class="cu-form-title" >离岗原因</view>
|
|
<textarea maxlength="-1" v-model="pd.DESCR" placeholder="请输入离岗原因"></textarea>
|
|
</view>
|
|
<view class="cu-form-group ">
|
|
<view class="title">申请人</view>
|
|
<input name="input" disabled="true" v-model="username" placeholder="请输入申请人"></input>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="padding flex flex-direction">
|
|
<button class="cu-btn bg-blue margin-tb-sm lg" @click="$noMultipleClicks(goSubmit)">提交</button>
|
|
</view>
|
|
<view class="padding flex flex-direction">
|
|
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
basePath,corpinfoId,deptId,loginUser,formatDate,loginSession,baseImgPath,setIsRest
|
|
} from '@/common/tool.js';
|
|
import tkiTree from "@/components/select-tree/select-tree.vue"
|
|
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
|
|
export default {
|
|
components: {
|
|
tkiTree,ruiDatePicker
|
|
},
|
|
data() {
|
|
return {
|
|
isUps:false,
|
|
msg:'add',
|
|
noClick:true,
|
|
pd:[],// 数据
|
|
todayDate:'',
|
|
username:'' //当前登录用户名称
|
|
|
|
}
|
|
},
|
|
onLoad(event){
|
|
var _this = this;
|
|
this.todayDate = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
|
|
this.username = loginUser.NAME;
|
|
loginSession();
|
|
},
|
|
methods: {
|
|
//获取数据字典数据
|
|
getDict: function () {
|
|
},
|
|
changeStartDate(e) {
|
|
this.pd.STARTTIME = e
|
|
this.$forceUpdate();//强制刷新
|
|
},
|
|
changeEndDate(e) {
|
|
this.pd.ENDTIME = e
|
|
this.$forceUpdate();//强制刷新
|
|
},
|
|
/* goSubmit1(){
|
|
setIsRest(1);
|
|
var pages = getCurrentPages(); // 获取当前页面栈
|
|
var prePage = pages[pages.length - 2]; // 上二级页面
|
|
prePage.$vm.initflag = true; // A 页面 init方法 为true
|
|
uni.navigateBack({delta: 1});
|
|
uni.hideLoading();
|
|
}, */
|
|
goSubmit() {
|
|
var _this = this;
|
|
|
|
if (!_this.pd.STARTTIME || _this.pd.STARTTIME == '请选择') {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请选择离岗起始时间',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
if (!_this.pd.ENDTIME || _this.pd.ENDTIME == '请选择') {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请选择离岗结束时间',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
if(new Date(_this.pd.STARTTIME.replace(/-/g,'/')) > new Date(_this.pd.ENDTIME.replace(/-/g,'/'))){
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '离岗结束时间不能早于开始时间',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
if (!_this.pd.DESCR) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '请输入离岗原因',
|
|
duration: 1500
|
|
});
|
|
return;
|
|
}
|
|
uni.showModal({
|
|
title: '双控平台',
|
|
content: '确定要离岗么?',
|
|
cancelColor: "#000000",
|
|
cancelText: '取消',
|
|
confirmText: '确定',
|
|
success: res => {
|
|
if (res.confirm) {
|
|
uni.showLoading({
|
|
title: '请稍候'
|
|
})
|
|
uni.request({
|
|
url: basePath+'/app/offduty/'+_this.msg,
|
|
method: 'POST',
|
|
dataType: 'json',
|
|
header: {
|
|
'Content-type':'application/x-www-form-urlencoded'
|
|
},
|
|
data: {
|
|
STARTTIME:this.pd.STARTTIME,
|
|
ENDTIME:this.pd.ENDTIME,
|
|
DESCR:this.pd.DESCR,
|
|
CORPINFO_ID:corpinfoId,
|
|
USER_ID:loginUser.USER_ID,
|
|
CREATOR:this.username,
|
|
OPERATOR:this.username
|
|
},
|
|
success: (res) => {
|
|
uni.hideLoading();
|
|
if ("success" == res.data.result) {
|
|
console.info(res.data.ISREST);
|
|
setIsRest(res.data.ISREST);
|
|
uni.showToast({
|
|
icon:'none',
|
|
title: '提交申请成功',
|
|
duration: 1500
|
|
});
|
|
setTimeout(function(){
|
|
var pages = getCurrentPages(); // 获取当前页面栈
|
|
var prePage = pages[pages.length - 2]; // 上二级页面
|
|
prePage.$vm.initflag = true; // A 页面 init方法 为true
|
|
uni.navigateBack({delta: 1});
|
|
uni.hideLoading();
|
|
},1500);
|
|
}else{
|
|
uni.showToast({
|
|
icon:'none',
|
|
title: '系统错误',
|
|
duration: 2000
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
})
|
|
},
|
|
goback(){
|
|
var pages = getCurrentPages(); // 获取当前页面栈
|
|
var prePage = pages[pages.length - 2]; // 上二级页面
|
|
prePage.$vm.initflag = true; // A 页面 init方法 为true
|
|
uni.navigateBack({delta: 1});
|
|
uni.hideLoading();
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.prevent {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
overflow: hidden;
|
|
}
|
|
.cu-form-title{
|
|
padding: 20upx 0;
|
|
}
|
|
.cu-form-textarea{
|
|
background-color: #ffffff;
|
|
padding: 1upx 30upx 20upx;
|
|
min-height: 100upx;
|
|
}
|
|
.cu-form-textarea textarea {
|
|
height: 4.6em;
|
|
width: 100%;
|
|
line-height: 1.2em;
|
|
flex: 1;
|
|
font-size: 28upx;
|
|
padding: 0;
|
|
}
|
|
.selected{
|
|
display: flex;
|
|
align-items: center;
|
|
height: 100upx;
|
|
}
|
|
.selected .radio{
|
|
transform:scale(0.8);
|
|
margin-right: 10upx;
|
|
}
|
|
.group{
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.cu-form-group .title{
|
|
font-size: 28upx;
|
|
color: #000;
|
|
font-weight: bold;
|
|
}
|
|
.cu-bar .action:first-child {
|
|
font-size: 28upx;
|
|
}
|
|
.cu-form-group .picker{
|
|
color: #808080;
|
|
}
|
|
.picker-tree{
|
|
color: #808080;
|
|
}
|
|
</style>
|