148 lines
5.1 KiB
Plaintext
148 lines
5.1 KiB
Plaintext
<%@ page language="java" pageEncoding="UTF-8"%>
|
|
<%@page import="com.sipai.entity.work.ProductionIndexPlanNameData"%>
|
|
<% request.setAttribute("Type_Year", ProductionIndexPlanNameData.Type_Year);%>
|
|
<% request.setAttribute("Type_Month", ProductionIndexPlanNameData.Type_Month);%>
|
|
<% request.setAttribute("Type_Day", ProductionIndexPlanNameData.Type_Day);%>
|
|
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
|
|
// $('#daytimeId').datepicker({
|
|
// format: 'yyyy-mm-dd',
|
|
// weekStart: 1,
|
|
// autoclose: true,
|
|
// startView: 0,
|
|
// minViewMode: 0,
|
|
// maxViewMode: 2,
|
|
// forceParse: false,
|
|
// language: 'zh-CN'
|
|
// }).on('changeDate',chaDate);
|
|
|
|
$('#monthtimeId').datepicker({
|
|
format: 'yyyy-mm',
|
|
weekStart: 1,
|
|
autoclose: true,
|
|
startView: 1,
|
|
minViewMode: 1,
|
|
maxViewMode: 2,
|
|
forceParse: false,
|
|
language: 'zh-CN'
|
|
}).on('changeDate',chaDate);
|
|
|
|
$('#yeartimeId').datepicker({
|
|
format: 'yyyy',
|
|
weekStart: 1,
|
|
autoclose: true,
|
|
startView: 2,
|
|
minViewMode: 2,
|
|
maxViewMode: 2,
|
|
forceParse: false,
|
|
language: 'zh-CN'
|
|
}).on('changeDate',chaDate);
|
|
|
|
doDateType();
|
|
$.post(ext.contextPath + '/work/productionIndexPlanNameData/getConfigureJson.do',{unitId:unitId},function(data) {
|
|
if(data.length>0){
|
|
var html="";
|
|
for(var i=0;i<data.length;i++){
|
|
html+="<div class=\"form-group\">";
|
|
html+="<label class=\"col-sm-4 control-label\">"+data[i].name+"</label>";
|
|
html+="<div class=\"col-sm-6\">";
|
|
html+="<input type=\"number\" class=\"form-control\" id=\""+data[i].id+"\" name =\""+data[i].id+"\" value=\"0\">";
|
|
html+="</div>";
|
|
html+="</div>";
|
|
}
|
|
$('#fillIn').html(html);
|
|
}
|
|
},'json');
|
|
});
|
|
|
|
function doDateType(){
|
|
var type=$('#type').val();
|
|
if(type=='${Type_Month}'){
|
|
$("#monthtimeId").attr('type','text');
|
|
$("#yeartimeId").attr('type','hidden');
|
|
}else if(type=='${Type_Year}'){
|
|
$("#monthtimeId").attr('type','hidden');
|
|
$("#yeartimeId").attr('type','text');
|
|
}
|
|
}
|
|
|
|
function chaDate(){
|
|
}
|
|
|
|
function doSave() {
|
|
var type=$('#type').val();
|
|
if(type=='${Type_Month}'){
|
|
if( $("#monthtimeId").val()==''){
|
|
showAlert('d','请选择日期');
|
|
return;
|
|
}
|
|
}
|
|
if(type=='${Type_Year}'){
|
|
if( $("#yeartimeId").val()==''){
|
|
showAlert('d','请选择日期');
|
|
return;
|
|
}
|
|
}
|
|
|
|
$.post(ext.contextPath + "/work/productionIndexPlanNameData/dosave.do",$("#subForm").serialize(),function(result) {
|
|
if (result>0) {
|
|
$("#table").bootstrapTable('refresh');
|
|
closeModal('subModal');
|
|
}else if(result==-1){
|
|
showAlert('d','该时间数据已存在,无需重复添加!');
|
|
}else{
|
|
showAlert('d','保存失败');
|
|
}
|
|
//打开已打开的子表
|
|
setTimeout(doExpend, 500);
|
|
},'json');
|
|
}
|
|
|
|
</script>
|
|
<div class="modal fade" id="subModal">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span></button>
|
|
<h4 class="modal-title">新增</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<!-- 新增界面formid强制为subForm -->
|
|
<form class="form-horizontal" id="subForm">
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|
<input type="hidden" class="form-control" id="unitId" name ="unitId" value="${param.unitId}">
|
|
<div id="alertDiv"></div>
|
|
<div class="form-group">
|
|
<label class="col-sm-4 control-label">类型</label>
|
|
<div class="col-sm-6">
|
|
<select id ="type" name="type" class="form-control select2" onchange="doDateType();">
|
|
<option value="${Type_Month}" >月度指标</option>
|
|
<option value="${Type_Year}" >年度指标</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-4 control-label">日期</label>
|
|
<div class="col-sm-6">
|
|
<input class="form-control date-picker" id="monthtimeId" name="monthtimeId" autocomplete="off" type="text" placeholder="点击选择" style="background-color:#FFFFFF;height:100%;" value=""/>
|
|
<input class="form-control date-picker" id="yeartimeId" name="yeartimeId" autocomplete="off" type="hidden" placeholder="点击选择" style="background-color:#FFFFFF;height:100%;" value=""/>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div id="fillIn"></div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
|
<button type="button" class="btn btn-primary" onclick="doSave()" id="btn_save">保存</button>
|
|
</div>
|
|
</div>
|
|
<!-- /.modal-content -->
|
|
</div>
|
|
<!-- /.modal-dialog -->
|
|
</div>
|