Skip to content
approve.jsp 4.37 KiB
Newer Older
杨郁彬's avatar
杨郁彬 committed
<%--
  since: 2019/7/19 16:41
  author: shen.shaohua
  description: 延期申请审批页面
  url: ${ctx}/expire-apply/approve/{id}
--%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="cui" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
	pageContext.setAttribute("idSuffix", String.valueOf(System.currentTimeMillis()).substring(6));
%>
<style type="text/css">
	.trdiv {
		text-align: left;
		height: 30px;
		margin-top: 8px;
	}

	.trdiv .label {
		float: left;
		width: 20%;
		text-align: right;
		padding-top: 3px;
	}

	.trdiv .input {
		float: right;
		width: 78%;
		text-align: left;
	}
</style>
<cui:layout id="layout${idSuffix}" fit="true">
	<cui:layoutRegion region="center">
		<cui:form id="form${idSuffix}" heightStyle="fill" style="padding: 0px;">
			<input type="hidden" name="id"/>
			<div style="text-align: center;width: 500px;margin: 0px auto;">
				<div class="trdiv" style="margin-top: 30px;">
					<div class="label">申请人:</div>
					<div class="input">
						<cui:input name="applyUserName" readonly="true" componentCls="form-control" width="200"/>
					</div>
				</div>
				<div class="trdiv">
					<div class="label">有效时间:</div>
					<div class="input">
						<cui:datepicker name="expireDate" dateFormat="yyyy-MM-dd" width="200" readonly="true" componentCls="form-control"/>
					</div>
				</div>
				<div class="trdiv" style="height: 100px;">
					<div class="label">申请原因:</div>
					<div class="input">
						<cui:textarea name="applyReason" componentCls="form-control" height="99" readonly="true"></cui:textarea>
					</div>
				</div>
				<div class="trdiv" style="height: 100px;">
					<div class="label">审批意见:</div>
					<div class="input">
						<cui:textarea name="approveDetail" componentCls="form-control" height="99"></cui:textarea>
					</div>
				</div>
				<div class="trdiv">
					<div class="label">审批结果:</div>
					<div class="input">
						<cui:radiolist name="approveResult" repeatLayout="flow" data="expireApply_add_sample.approveResultData" value="1" required="true"/>
					</div>
				</div>
			</div>
		</cui:form>
	</cui:layoutRegion>
	<cui:layoutRegion region="south" style="overflow: hidden;">
		<div class="buttens-foot-tools">
			<a onclick="expireApply_add_sample.sure()">确定</a>
			<a onclick="expireApply_add_sample.colseD()">关闭</a>
		</div>
	</cui:layoutRegion>
</cui:layout>
<script type="text/javascript">
	var expireApply_add_fun = (function (win, $) {
		var businessId = '${id}';

		function sample() {
			this.approveResultData = [
				{text: '通过', value: '1'},
				{text: '不通过', value: '2'}
			];
		}

		var $thisDialog = $('#layout${idSuffix}').closest('.ctrl-init-dialog');
		var $form = $('#form${idSuffix}');

		initLoad();

		//关闭
		sample.prototype.colseD = function () {
			closeThisDialog();
		}

		//发送
		sample.prototype.sure = function () {
			if (!$form.form('valid')) {
				warning('表单填写不正确!');
				return;
			}
			var formData = $form.form('formData');
			//console.log(formData);
			//return;
			loading('保存中...');
			$.ajax({
				type: 'POST',
				url: '${ctx}/expire-apply/approve',
				data: formData,
				dataType: 'json',
				success: function (data) {
					hide();
					if (data.code == '0') {
						message('保存成功!');
					} else if (data.code == '-1') {
						error('保存失败!');
					}
					expireApply_approveList_sample.reloadGrid();
					closeThisDialog();
					mailReceive_view_sample.colseD();
				},
				error: function (e) {
					hide();
					error(e);
				}
			});
		}

		function closeThisDialog() {
			$thisDialog.dialog('close');
		}

		//加载
		function initLoad() {
			loading('加载中...');
			$.ajax({
				type: 'GET',
				url: '${ctx}/expire-apply/' + businessId,
				dataType: 'json',
				success: function (data) {
					hide();
					//console.log(data);
					//if (data.approveResult == '0') {
					data.approveResult = '1';
					//}
					$form.form('load', data);
				},
				error: function (e) {
					hide();
					error(e);
				}
			});
		}

		return sample;
	})(window, $);

	var expireApply_add_sample = new expireApply_add_fun();
	window['expireApply_add_fun'] = null;
	delete window['expireApply_add_fun'];
</script>