dev_oa/app/oa/view/approve/add_yongche.html

377 lines
19 KiB
HTML
Raw Normal View History

{extend name="../../base/view/common/base" /}
{block name="style"}
{include file="/approve/add_style" /}
{/block}
<!-- 主体 -->
{block name="body"}
2022-06-08 15:13:48 +08:00
<form class="layui-form p-4">
<h3 class="pb-3">用车审批</h3>
{eq name="$id" value="0"}
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">开始时间<font>*</font></td>
<td>
<input id="start_time_a" name="start_time_a" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间">
</td>
<td>
<select lay-filter="time_b" id="start_time_b" name="start_time_b">
<option value="">--请选择--</option>
<option value="00:00">00:00</option>
<option value="00:30">00:30</option>
<option value="01:00">01:00</option>
<option value="01:30">01:30</option>
<option value="02:00">02:00</option>
<option value="02:30">02:30</option>
<option value="03:00">03:00</option>
<option value="03:30">03:30</option>
<option value="04:00">04:00</option>
<option value="04:30">04:30</option>
<option value="05:00">05:00</option>
<option value="05:30">05:30</option>
<option value="06:00">06:00</option>
<option value="06:30">06:30</option>
<option value="07:00">07:00</option>
<option value="07:30">07:30</option>
<option value="08:00">08:00</option>
<option value="08:30">08:30</option>
<option value="09:00">09:00</option>
<option value="09:30">09:30</option>
<option value="10:00">10:00</option>
<option value="10:30">10:30</option>
<option value="11:00">11:00</option>
<option value="11:30">11:30</option>
<option value="12:00">12:00</option>
<option value="13:30">13:30</option>
<option value="14:00">14:00</option>
<option value="14:30">14:30</option>
<option value="15:00">15:00</option>
<option value="15:30">15:30</option>
<option value="16:00">16:00</option>
<option value="16:30">16:30</option>
<option value="17:00">17:00</option>
<option value="17:30">17:30</option>
<option value="18:00">18:00</option>
<option value="18:30">18:30</option>
<option value="19:00">19:00</option>
<option value="19:30">19:30</option>
<option value="20:00">20:00</option>
<option value="20:30">20:30</option>
<option value="21:00">21:00</option>
<option value="21:30">21:30</option>
<option value="22:00">22:00</option>
<option value="22:30">22:30</option>
<option value="23:00">23:00</option>
<option value="23:30">23:30</option>
</select>
</td>
<td class="layui-td-gray">结束时间<font>*</font></td>
<td>
<input id="end_time_a" name="end_time_a" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间">
</td>
<td>
<input type="hidden" name="duration" value="">
<select lay-filter="time_b" id="end_time_b" name="end_time_b">
<option value="">--请选择--</option>
<option value="00:00">00:00</option>
<option value="00:30">00:30</option>
<option value="01:00">01:00</option>
<option value="01:30">01:30</option>
<option value="02:00">02:00</option>
<option value="02:30">02:30</option>
<option value="03:00">03:00</option>
<option value="03:30">03:30</option>
<option value="04:00">04:00</option>
<option value="04:30">04:30</option>
<option value="05:00">05:00</option>
<option value="05:30">05:30</option>
<option value="06:00">06:00</option>
<option value="06:30">06:30</option>
<option value="07:00">07:00</option>
<option value="07:30">07:30</option>
<option value="08:00">08:00</option>
<option value="08:30">08:30</option>
<option value="09:00">09:00</option>
<option value="09:30">09:30</option>
<option value="10:00">10:00</option>
<option value="10:30">10:30</option>
<option value="11:00">11:00</option>
<option value="11:30">11:30</option>
<option value="12:00">12:00</option>
<option value="13:30">13:30</option>
<option value="14:00">14:00</option>
<option value="14:30">14:30</option>
<option value="15:00">15:00</option>
<option value="15:30">15:30</option>
<option value="16:00">16:00</option>
<option value="16:30">16:30</option>
<option value="17:00">17:00</option>
<option value="17:30">17:30</option>
<option value="18:00">18:00</option>
<option value="18:30">18:30</option>
<option value="19:00">19:00</option>
<option value="19:30">19:30</option>
<option value="20:00">20:00</option>
<option value="20:30">20:30</option>
<option value="21:00">21:00</option>
<option value="21:30">21:30</option>
<option value="22:00">22:00</option>
<option value="22:30">22:30</option>
<option value="23:00">23:00</option>
<option value="23:30">23:30</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">用车时长</td>
<td colspan="5" id="duration">-</td>
</tr>
<tr>
2022-06-08 15:13:48 +08:00
<td class="layui-td-gray-2">用车目的地<font>*</font></td>
<td colspan="2"><input type="text" name="address" value="" autocomplete="off" placeholder="请输入用车目的地" lay-verify="required" lay-reqText="请输入用车目的地" class="layui-input"></td>
<td class="layui-td-gray">车辆选择<font>*</font></td>
<td colspan="2">
<select name="detail_type" lay-verify="required" lay-reqText="请选择">
<option value="">--请选择--</option>
{volist name=":oa_car_cate()" id="vo"}
<option value="{$vo.id}">{$vo.title}[{$vo.name}]</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">用车事由<font>*</font></td>
<td colspan="5">
<textarea name="content" placeholder="请输入用车事由" class="layui-textarea" lay-verify="required" lay-reqText="请输入用车事由"></textarea>
</td>
</tr>
</table>
{else/}
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">开始时间<font>*</font></td>
<td>
<input id="start_time_a" name="start_time_a" autocomplete="off" class="layui-input" value="{$detail.start_time_a}" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间">
</td>
<td>
<select lay-filter="time_b" id="start_time_b" name="start_time_b" lay-verify="required" lay-reqText="请选择具体时间">
<option value="">--请选择--</option>
<option value="00:00" {eq name="$detail.start_time_b" value="00:00"}selected=""{/eq}>09:00</option>
<option value="00:30" {eq name="$detail.start_time_b" value="00:30"}selected=""{/eq}>00:30</option>
<option value="01:00" {eq name="$detail.start_time_b" value="01:00"}selected=""{/eq}>01:00</option>
<option value="01:30" {eq name="$detail.start_time_b" value="01:30"}selected=""{/eq}>01:30</option>
<option value="02:00" {eq name="$detail.start_time_b" value="02:00"}selected=""{/eq}>02:00</option>
<option value="02:30" {eq name="$detail.start_time_b" value="02:30"}selected=""{/eq}>02:30</option>
<option value="03:00" {eq name="$detail.start_time_b" value="03:00"}selected=""{/eq}>03:00</option>
<option value="03:30" {eq name="$detail.start_time_b" value="03:30"}selected=""{/eq}>03:30</option>
<option value="04:00" {eq name="$detail.start_time_b" value="04:00"}selected=""{/eq}>04:00</option>
<option value="04:30" {eq name="$detail.start_time_b" value="04:30"}selected=""{/eq}>04:30</option>
<option value="05:00" {eq name="$detail.start_time_b" value="05:00"}selected=""{/eq}>05:00</option>
<option value="05:30" {eq name="$detail.start_time_b" value="05:30"}selected=""{/eq}>05:30</option>
<option value="06:00" {eq name="$detail.start_time_b" value="06:00"}selected=""{/eq}>06:00</option>
<option value="06:30" {eq name="$detail.start_time_b" value="06:30"}selected=""{/eq}>06:30</option>
<option value="07:00" {eq name="$detail.start_time_b" value="07:00"}selected=""{/eq}>07:00</option>
<option value="07:30" {eq name="$detail.start_time_b" value="07:30"}selected=""{/eq}>07:30</option>
<option value="08:00" {eq name="$detail.start_time_b" value="08:00"}selected=""{/eq}>08:00</option>
<option value="08:30" {eq name="$detail.start_time_b" value="08:30"}selected=""{/eq}>08:30</option>
<option value="09:00" {eq name="$detail.start_time_b" value="09:00"}selected=""{/eq}>09:00</option>
<option value="09:30" {eq name="$detail.start_time_b" value="09:30"}selected=""{/eq}>09:30</option>
<option value="10:00" {eq name="$detail.start_time_b" value="10:00"}selected=""{/eq}>10:00</option>
<option value="10:30" {eq name="$detail.start_time_b" value="10:30"}selected=""{/eq}>10:30</option>
<option value="11:00" {eq name="$detail.start_time_b" value="11:00"}selected=""{/eq}>11:00</option>
<option value="11:30" {eq name="$detail.start_time_b" value="11:30"}selected=""{/eq}>11:30</option>
<option value="12:00" {eq name="$detail.start_time_b" value="12:00"}selected=""{/eq}>12:00</option>
<option value="13:30" {eq name="$detail.start_time_b" value="13:30"}selected=""{/eq}>13:30</option>
<option value="14:00" {eq name="$detail.start_time_b" value="14:00"}selected=""{/eq}>14:00</option>
<option value="14:30" {eq name="$detail.start_time_b" value="14:30"}selected=""{/eq}>14:30</option>
<option value="15:00" {eq name="$detail.start_time_b" value="15:00"}selected=""{/eq}>15:00</option>
<option value="15:30" {eq name="$detail.start_time_b" value="15:30"}selected=""{/eq}>15:30</option>
<option value="16:00" {eq name="$detail.start_time_b" value="16:00"}selected=""{/eq}>16:00</option>
<option value="16:30" {eq name="$detail.start_time_b" value="16:30"}selected=""{/eq}>16:30</option>
<option value="17:00" {eq name="$detail.start_time_b" value="17:00"}selected=""{/eq}>17:00</option>
<option value="17:30" {eq name="$detail.start_time_b" value="17:30"}selected=""{/eq}>17:30</option>
<option value="18:00" {eq name="$detail.start_time_b" value="18:00"}selected=""{/eq}>18:00</option>
<option value="18:30" {eq name="$detail.start_time_b" value="18:30"}selected=""{/eq}>18:30</option>
<option value="19:00" {eq name="$detail.start_time_b" value="19:00"}selected=""{/eq}>19:00</option>
<option value="19:30" {eq name="$detail.start_time_b" value="19:30"}selected=""{/eq}>19:30</option>
<option value="20:00" {eq name="$detail.start_time_b" value="20:00"}selected=""{/eq}>20:00</option>
<option value="20:30" {eq name="$detail.start_time_b" value="20:30"}selected=""{/eq}>20:30</option>
<option value="21:00" {eq name="$detail.start_time_b" value="21:00"}selected=""{/eq}>21:00</option>
<option value="21:30" {eq name="$detail.start_time_b" value="21:30"}selected=""{/eq}>21:30</option>
<option value="22:00" {eq name="$detail.start_time_b" value="22:00"}selected=""{/eq}>22:00</option>
<option value="22:30" {eq name="$detail.start_time_b" value="22:30"}selected=""{/eq}>22:30</option>
<option value="23:00" {eq name="$detail.start_time_b" value="23:00"}selected=""{/eq}>23:00</option>
<option value="23:30" {eq name="$detail.start_time_b" value="23:30"}selected=""{/eq}>23:30</option>
</select>
</td>
<td class="layui-td-gray">结束时间<font>*</font></td>
<td>
<input id="end_time_a" name="end_time_a" autocomplete="off" class="layui-input" value="{$detail.end_time_a}" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间">
</td>
<td>
<input type="hidden" name="duration" value="{$detail.duration}">
<select lay-filter="time_b" id="end_time_b" name="end_time_b" lay-verify="required" lay-reqText="请选择具体时间">
<option value="">--请选择--</option>
<option value="00:00" {eq name="$detail.end_time_b" value="00:00"}selected=""{/eq}>09:00</option>
<option value="00:30" {eq name="$detail.end_time_b" value="00:30"}selected=""{/eq}>00:30</option>
<option value="01:00" {eq name="$detail.end_time_b" value="01:00"}selected=""{/eq}>01:00</option>
<option value="01:30" {eq name="$detail.end_time_b" value="01:30"}selected=""{/eq}>01:30</option>
<option value="02:00" {eq name="$detail.end_time_b" value="02:00"}selected=""{/eq}>02:00</option>
<option value="02:30" {eq name="$detail.end_time_b" value="02:30"}selected=""{/eq}>02:30</option>
<option value="03:00" {eq name="$detail.end_time_b" value="03:00"}selected=""{/eq}>03:00</option>
<option value="03:30" {eq name="$detail.end_time_b" value="03:30"}selected=""{/eq}>03:30</option>
<option value="04:00" {eq name="$detail.end_time_b" value="04:00"}selected=""{/eq}>04:00</option>
<option value="04:30" {eq name="$detail.end_time_b" value="04:30"}selected=""{/eq}>04:30</option>
<option value="05:00" {eq name="$detail.end_time_b" value="05:00"}selected=""{/eq}>05:00</option>
<option value="05:30" {eq name="$detail.end_time_b" value="05:30"}selected=""{/eq}>05:30</option>
<option value="06:00" {eq name="$detail.end_time_b" value="06:00"}selected=""{/eq}>06:00</option>
<option value="06:30" {eq name="$detail.end_time_b" value="06:30"}selected=""{/eq}>06:30</option>
<option value="07:00" {eq name="$detail.end_time_b" value="07:00"}selected=""{/eq}>07:00</option>
<option value="07:30" {eq name="$detail.end_time_b" value="07:30"}selected=""{/eq}>07:30</option>
<option value="08:00" {eq name="$detail.end_time_b" value="08:00"}selected=""{/eq}>08:00</option>
<option value="08:30" {eq name="$detail.end_time_b" value="08:30"}selected=""{/eq}>08:30</option>
<option value="09:00" {eq name="$detail.end_time_b" value="09:00"}selected=""{/eq}>09:00</option>
<option value="09:30" {eq name="$detail.end_time_b" value="09:30"}selected=""{/eq}>09:30</option>
<option value="10:00" {eq name="$detail.end_time_b" value="10:00"}selected=""{/eq}>10:00</option>
<option value="10:30" {eq name="$detail.end_time_b" value="10:30"}selected=""{/eq}>10:30</option>
<option value="11:00" {eq name="$detail.end_time_b" value="11:00"}selected=""{/eq}>11:00</option>
<option value="11:30" {eq name="$detail.end_time_b" value="11:30"}selected=""{/eq}>11:30</option>
<option value="12:00" {eq name="$detail.end_time_b" value="12:00"}selected=""{/eq}>12:00</option>
<option value="13:30" {eq name="$detail.end_time_b" value="13:30"}selected=""{/eq}>13:30</option>
<option value="14:00" {eq name="$detail.end_time_b" value="14:00"}selected=""{/eq}>14:00</option>
<option value="14:30" {eq name="$detail.end_time_b" value="14:30"}selected=""{/eq}>14:30</option>
<option value="15:00" {eq name="$detail.end_time_b" value="15:00"}selected=""{/eq}>15:00</option>
<option value="15:30" {eq name="$detail.end_time_b" value="15:30"}selected=""{/eq}>15:30</option>
<option value="16:00" {eq name="$detail.end_time_b" value="16:00"}selected=""{/eq}>16:00</option>
<option value="16:30" {eq name="$detail.end_time_b" value="16:30"}selected=""{/eq}>16:30</option>
<option value="17:00" {eq name="$detail.end_time_b" value="17:00"}selected=""{/eq}>17:00</option>
<option value="17:30" {eq name="$detail.end_time_b" value="17:30"}selected=""{/eq}>17:30</option>
<option value="18:00" {eq name="$detail.end_time_b" value="18:00"}selected=""{/eq}>18:00</option>
<option value="18:30" {eq name="$detail.end_time_b" value="18:30"}selected=""{/eq}>18:30</option>
<option value="19:00" {eq name="$detail.end_time_b" value="19:00"}selected=""{/eq}>19:00</option>
<option value="19:30" {eq name="$detail.end_time_b" value="19:30"}selected=""{/eq}>19:30</option>
<option value="20:00" {eq name="$detail.end_time_b" value="20:00"}selected=""{/eq}>20:00</option>
<option value="20:30" {eq name="$detail.end_time_b" value="20:30"}selected=""{/eq}>20:30</option>
<option value="21:00" {eq name="$detail.end_time_b" value="21:00"}selected=""{/eq}>21:00</option>
<option value="21:30" {eq name="$detail.end_time_b" value="21:30"}selected=""{/eq}>21:30</option>
<option value="22:00" {eq name="$detail.end_time_b" value="22:00"}selected=""{/eq}>22:00</option>
<option value="22:30" {eq name="$detail.end_time_b" value="22:30"}selected=""{/eq}>22:30</option>
<option value="23:00" {eq name="$detail.end_time_b" value="23:00"}selected=""{/eq}>23:00</option>
<option value="23:30" {eq name="$detail.end_time_b" value="23:30"}selected=""{/eq}>23:30</option>
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">用车时长</td>
<td colspan="5" id="duration">共{$detail.duration}小时</td>
</tr>
<tr>
2022-06-08 15:13:48 +08:00
<td class="layui-td-gray-2">用车目的地<font>*</font></td>
<td colspan="2"><input type="text" name="address" value="{$detail.address}" autocomplete="off" placeholder="请输入用车目的地" lay-verify="required" lay-reqText="请输入用车目的地" class="layui-input"></td>
<td class="layui-td-gray">车辆选择<font>*</font></td>
<td colspan="2">
<select name="detail_type" lay-verify="required" lay-reqText="请选择">
<option value="">--请选择--</option>
{volist name=":oa_car_cate()" id="vo"}
<option value="{$vo.id}" {eq name="$detail.detail_type" value="$vo.id"}selected=""{/eq}>{$vo.title}[{$vo.name}]</option>
{/volist}
</select>
</td>
</tr>
<tr>
<td class="layui-td-gray">用车事由<font>*</font></td>
<td colspan="5">
<textarea name="content" placeholder="请输入用车理由" class="layui-textarea" lay-verify="required" lay-reqText="请输入用车理由">{$detail.content}</textarea>
</td>
</tr>
</table>
{/eq}
{include file="/approve/add_flow" /}
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
/**
* 工时计算
*/
function leaveTime() {
var data_1 = $('#start_time_a').val();
var data_1_1 = $('#start_time_b').val();
var data_2 = $('#end_time_a').val();
var data_2_1 = $('#end_time_b').val();
if(data_1=='' || data_1_1=='' || data_2=='' || data_2_1==''){
return 0;
}
var start = new Date(data_1+' '+data_1_1);
var end = new Date(data_2+' '+data_2_1);
var diff=end.getTime() - start.getTime();//时间差的毫秒数
if(diff<0){
return 0;
}
//计算出小时数
var hours=diff/(3600*1000);
console.log(hours);
return hours;
}
const moduleInit = ['tool','employeepicker'];
2022-06-08 15:13:48 +08:00
function gouguInit() {
var form = layui.form,tool=layui.tool, employeepicker = layui.employeepicker,laydate = layui.laydate;
if (typeof (flowStep) == "function") {
flowStep();
}
//日期时间范围
laydate.render({
elem: '#start_time_a',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false,
done:function(){
var hours = leaveTime();
if(hours == 0){
$('#duration').html('-');
}
else{
$('#duration').html('共'+hours+'小时');
}
$('[name="duration"]').val(hours);
}
});
//日期时间范围
laydate.render({
elem: '#end_time_a',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false,
done:function(){
var hours = leaveTime();
if(hours == 0){
$('#duration').html('-');
}
else{
$('#duration').html('共'+hours+'小时');
}
$('[name="duration"]').val(hours);
}
});
form.on('select(time_b)', function(data){
var hours = leaveTime();
if(hours == 0){
$('#duration').html('-');
}
else{
$('#duration').html('共'+hours+'小时');
}
$('[name="duration"]').val(hours);
});
}
</script>
{/block}
<!-- /脚本 -->