ZhiYeJianKang/职业健康平台后端/target/dzzyb/webpage/modules/zyb/addqypjxx.jsp
2025-02-20 15:25:59 +08:00

1582 lines
42 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<html>
<head>
<title>添加企业评价列表</title>
<meta name="decorator" content="default"/>
<%-- 引入layui的css--%>
<link rel="stylesheet" href="${ctxStatic}/layui-v2.4.5/layui/css/layui.css" media="all">
<style type="text/css">
.xline {
border-bottom: solid 2px #7A378B;
height: 5px;
}
</style>
<style type="text/css">
/* 纵向布局 */
.j-column {
display: flex;
flex-direction: column;
}
/* 横向布局 */
.j-row {
display: flex;
flex-direction: row;
}
/* 横向布局 元素靠左*/
.j-row-left {
display: flex;
flex-direction: row;
justify-content: flex-start;
}
/* 横向布局 元素靠右*/
.j-row-right {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
/* 横向布局 元素居中*/
.j-row-center {
display: flex;
flex-direction: row;
justify-content: center;
}
/* 横向布局 元素两端对齐*/
.j-row-between {
display: flex;
flex-direction: row;
justify-content: space-between;
}
/* 横向布局 元素两端有空隙*/
.j-row-around {
display: flex;
flex-direction: row;
justify-content: space-around;
}
/* 纵向布局 元素靠上 */
.j-column-top {
display: flex;
flex-direction: column;
justify-content: flex-start;
}
/* 纵向布局 元素靠下*/
.j-column-bottom {
display: flex;
flex-direction: column;
justify-content: flex-end;
}
/* 纵向布局 元素居中*/
.j-column-center {
display: flex;
flex-direction: column;
justify-content: center;
}
/* 交叉轴居上*/
.j-ai-top {
align-items: flex-start;
}
/* 交叉轴居下*/
.j-ai-bottom {
align-items: flex-end;
}
/* 交叉轴居中*/
.j-ai-center {
align-items: center;
}
/* 上外边距*/
.j-mt {
margin-top: 10px;
}
/* 下外边距*/
.j-mb {
margin-bottom: 10px;
}
/* 左外边距*/
.j-ml {
margin-left: 10px;
}
/* 右外边距*/
.j-mr {
margin-right: 10px;
}
/* 不换行*/
.j-nowrap {
white-space: nowrap;
}
/* 内容超出长度后出现滚动条*/
.j-overflow {
overflow: auto;
}
/* 内容溢出换行*/
.j-wrap-wrap {
flex-wrap: wrap;
}
/* 吸顶 */
.j-suctionTop {
position: -webkit-sticky;
position: sticky;
top: 0;
}
/* 边框 */
.j-border {
border: solid 0.8px #e8e8e8;
/* box-shadow:rgba(0, 0, 0, 0.3) 0px 0px 5px; */
}
/* 下边框 */
.j-border-bottom {
border-bottom: solid 1px #e8e8e8;
border-radius: 0px !important;
/* box-shadow:rgba(0, 0, 0, 0.3) 0px 0px 5px; */
}
/* 宽100栅格*/
.j-w-0 {
width: 0
}
.j-w-1 {
width: 1%;
}
.j-w-2 {
width: 2%;
}
.j-w-3 {
width: 3%;
}
.j-w-4 {
width: 4%;
}
.j-w-5 {
width: 5%;
}
.j-w-6 {
width: 6%;
}
.j-w-7 {
width: 7%;
}
.j-w-8 {
width: 8%;
}
.j-w-9 {
width: 9%;
}
.j-w-10 {
width: 10%;
}
.j-w-11 {
width: 11%;
}
.j-w-12 {
width: 12%;
}
.j-w-13 {
width: 13%;
}
.j-w-14 {
width: 14%;
}
.j-w-15 {
width: 15%;
}
.j-w-16 {
width: 16%;
}
.j-w-17 {
width: 17%;
}
.j-w-18 {
width: 18%;
}
.j-w-19 {
width: 19%;
}
.j-w-20 {
width: 20%;
}
.j-w-21 {
width: 21%;
}
.j-w-22 {
width: 22%;
}
.j-w-23 {
width: 23%;
}
.j-w-24 {
width: 24%;
}
.j-w-25 {
width: 25%;
}
.j-w-26 {
width: 26%;
}
.j-w-27 {
width: 27%;
}
.j-w-28 {
width: 28%;
}
.j-w-29 {
width: 29%;
}
.j-w-30 {
width: 30%;
}
.j-w-31 {
width: 31%;
}
.j-w-32 {
width: 32%;
}
.j-w-33 {
width: 33%;
}
.j-w-34 {
width: 34%;
}
.j-w-35 {
width: 35%;
}
.j-w-36 {
width: 36%;
}
.j-w-37 {
width: 37%;
}
.j-w-38 {
width: 38%;
}
.j-w-39 {
width: 39%;
}
.j-w-40 {
width: 40%;
}
.j-w-41 {
width: 41%;
}
.j-w-42 {
width: 42%;
}
.j-w-43 {
width: 43%;
}
.j-w-44 {
width: 44%;
}
.j-w-45 {
width: 45%;
}
.j-w-46 {
width: 46%;
}
.j-w-47 {
width: 47%;
}
.j-w-48 {
width: 48%;
}
.j-w-49 {
width: 49%;
}
.j-w-50 {
width: 50%;
}
.j-w-501 {
position: absolute;
width: 50%;
margin-left: 50%;
margin-top: -1%;
}
.j-w-502 {
position: absolute;
width: 50%;
margin-left: 2%;
margin-top: -1%;
}
.j-w-503 {
position: absolute;
width: 50%;
margin-left: -50%;
margin-top: -1%;
}
.j-w-504 {
margin-top: 10%;
}
.j-w-51 {
width: 51%;
}
.j-w-52 {
width: 52%;
}
.j-w-53 {
width: 53%;
}
.j-w-54 {
width: 54%;
}
.j-w-55 {
width: 55%;
}
.j-w-56 {
width: 56%;
}
.j-w-57 {
width: 57%;
}
.j-w-58 {
width: 58%;
}
.j-w-59 {
width: 59%;
}
.j-w-60 {
width: 60%;
}
.j-w-61 {
width: 61%;
}
.j-w-62 {
width: 62%;
}
.j-w-63 {
width: 63%;
}
.j-w-64 {
width: 64%;
}
.j-w-65 {
width: 65%;
}
.j-w-66 {
width: 66%;
}
.j-w-67 {
width: 67%;
}
.j-w-68 {
width: 68%;
}
.j-w-69 {
width: 69%;
}
.j-w-70 {
width: 70%;
}
.j-w-71 {
width: 71%;
}
.j-w-72 {
width: 72%;
}
.j-w-73 {
width: 73%;
}
.j-w-74 {
width: 74%;
}
.j-w-75 {
width: 75%;
}
.j-w-76 {
width: 76%;
}
.j-w-77 {
width: 77%;
}
.j-w-78 {
width: 78%;
}
.j-w-79 {
width: 79%;
}
.j-w-80 {
width: 80%;
}
.j-w-81 {
width: 81%;
}
.j-w-82 {
width: 82%;
}
.j-w-83 {
width: 83%;
}
.j-w-84 {
width: 84%;
}
.j-w-85 {
width: 85%;
}
.j-w-86 {
width: 86%;
}
.j-w-87 {
width: 87%;
}
.j-w-88 {
width: 88%;
}
.j-w-89 {
width: 89%;
}
.j-w-90 {
width: 90%;
}
.j-w-91 {
width: 91%;
}
.j-w-92 {
width: 92%;
}
.j-w-93 {
width: 93%;
}
.j-w-94 {
width: 94%;
}
.j-w-95 {
width: 95%;
}
.j-w-96 {
width: 96%;
}
.j-w-97 {
width: 97%;
}
.j-w-98 {
width: 98%;
}
.j-w-99 {
width: 99%;
}
.j-w-100 {
width: 100% !important;
}
/* 高100栅格*/
.j-h-0 {
height: 0
}
.j-h-1 {
height: 1%;
}
.j-h-2 {
height: 2%;
}
.j-h-3 {
height: 3%;
}
.j-h-4 {
height: 4%;
}
.j-h-5 {
height: 5%;
}
.j-h-6 {
height: 6%;
}
.j-h-7 {
height: 7%;
}
.j-h-8 {
height: 8%;
}
.j-h-9 {
height: 9%;
}
.j-h-10 {
height: 10%;
}
.j-h-11 {
height: 11%;
}
.j-h-12 {
height: 12%;
}
.j-h-13 {
height: 13%;
}
.j-h-14 {
height: 14%;
}
.j-h-15 {
height: 15%;
}
.j-h-16 {
height: 16%;
}
.j-h-17 {
height: 17%;
}
.j-h-18 {
height: 18%;
}
.j-h-19 {
height: 19%;
}
.j-h-20 {
height: 20%;
}
.j-h-21 {
height: 21%;
}
.j-h-22 {
height: 22%;
}
.j-h-23 {
height: 23%;
}
.j-h-24 {
height: 24%;
}
.j-h-25 {
height: 25%;
}
.j-h-26 {
height: 26%;
}
.j-h-27 {
height: 27%;
}
.j-h-28 {
height: 28%;
}
.j-h-29 {
height: 29%;
}
.j-h-30 {
height: 30%;
}
.j-h-31 {
height: 31%;
}
.j-h-32 {
height: 32%;
}
.j-h-33 {
height: 33%;
}
.j-h-34 {
height: 34%;
}
.j-h-35 {
height: 35%;
}
.j-h-36 {
height: 36%;
}
.j-h-37 {
height: 37%;
}
.j-h-38 {
height: 38%;
}
.j-h-39 {
height: 39%;
}
.j-h-40 {
height: 40%;
}
.j-h-41 {
height: 41%;
}
.j-h-42 {
height: 42%;
}
.j-h-43 {
height: 43%;
}
.j-h-44 {
height: 44%;
}
.j-h-45 {
height: 45%;
}
.j-h-46 {
height: 46%;
}
.j-h-47 {
height: 47%;
}
.j-h-48 {
height: 48%;
}
.j-h-49 {
height: 49%;
}
.j-h-50 {
height: 50%;
}
.j-h-51 {
height: 51%;
}
.j-h-52 {
height: 52%;
}
.j-h-53 {
height: 53%;
}
.j-h-54 {
height: 54%;
}
.j-h-55 {
height: 55%;
}
.j-h-56 {
height: 56%;
}
.j-h-57 {
height: 57%;
}
.j-h-58 {
height: 58%;
}
.j-h-59 {
height: 59%;
}
.j-h-60 {
height: 60%;
}
.j-h-61 {
height: 61%;
}
.j-h-62 {
height: 62%;
}
.j-h-63 {
height: 63%;
}
.j-h-64 {
height: 64%;
}
.j-h-65 {
height: 65%;
}
.j-h-66 {
height: 66%;
}
.j-h-67 {
height: 67%;
}
.j-h-68 {
height: 68%;
}
.j-h-69 {
height: 69%;
}
.j-h-70 {
height: 70%;
}
.j-h-71 {
height: 71%;
}
.j-h-72 {
height: 72%;
}
.j-h-73 {
height: 73%;
}
.j-h-74 {
height: 74%;
}
.j-h-75 {
height: 75%;
}
.j-h-76 {
height: 76%;
}
.j-h-77 {
height: 77%;
}
.j-h-78 {
height: 78%;
}
.j-h-79 {
height: 79%;
}
.j-h-80 {
height: 80%;
}
.j-h-81 {
height: 81%;
}
.j-h-82 {
height: 82%;
}
.j-h-83 {
height: 83%;
}
.j-h-84 {
height: 84%;
}
.j-h-85 {
height: 85%;
}
.j-h-86 {
height: 86%;
}
.j-h-87 {
height: 87%;
}
.j-h-88 {
height: 88%;
}
.j-h-89 {
height: 89%;
}
.j-h-90 {
height: 90%;
}
.j-h-91 {
height: 91%;
}
.j-h-92 {
height: 92%;
}
.j-h-93 {
height: 93%;
}
.j-h-94 {
height: 94%;
}
.j-h-95 {
height: 95%;
}
.j-h-96 {
height: 96%;
}
.j-h-97 {
height: 97%;
}
.j-h-98 {
height: 98%;
}
.j-h-99 {
height: 99%;
}
.j-h-100 {
height: 100%;
}
.j-w-h-100 {
height: 100%;
width: 100% !important;
}
.select-search-input {
position: absolute;
z-index: 2;
width: 80%;
}
</style>
</head>
<body>
<!-- 添加和修改的弹出层开始 -->
<div style="padding: 20px" id="saveOrUpdateDiv">
<form class="layui-form" method="post" lay-filter="formTest" action="${ctx}/zyb/logon/${url}">
<input type="hidden" name="id" value="${zybPjxx.id}">
<input type="hidden" name="enterpriseid" value="${zybPjxx.enterpriseid}">
<%-- <input hidden name="eName" id="eName" value="${enterprisename}">--%>
<div class="j-column-center j-w-h-100">
<div class="j-row-center">
<div class="layui-form-item j-w-50">
<label class="layui-form-label j-nowrap">评价名称</label>
<div class="layui-input-block">
<input lay-reqtext="请填写报告名称" lay-verify="required" type="text" name="pjname" id="pjname"
lay-verify="title"
autocomplete="off" placeholder="{企业简称首字母}-{企业全名}-{年月日}-{序列号}"
class="layui-input isDisabled" value="${zybPjxx. pjname}">
</div>
</div>
<div class="layui-form-item j-w-50">
<label class="layui-form-label j-nowrap">评价机构名称</label>
<div class="layui-input-block">
<input type="text" name="selectInputUser" id="selectInputUser" lay-verify="required"
class="layui-input select-search-input isDisabled" onkeyup="search();"
autocomplete="off" value="${zybPjxx. pjjgname}">
<select id="selectUser" lay-filter="selectUser" autocomplete="off"
class="layui-select isDisabled" lay-search>
</select>
</div>
</div>
</div>
<div class="j-row-center">
<div class="layui-form-item j-w-50">
<label class="layui-form-label j-nowrap">评价时间</label>
<div class="layui-input-block">
<input type="text" lay-verify="required" name="pjtime" id="pjtime" readonly="readonly"
autocomplete="off" class="layui-input isDisabled"
value="<fmt:formatDate value="${zybPjxx.pjtime}" pattern="yyyy-MM-dd"/>">
</div>
</div>
<div class="layui-form-item j-w-50">
<label class="layui-form-label j-nowrap">下次评价时间</label>
<%-- <div class="layui-input-block">
<input type="text" lay-verify="required" name="nextpjtime" id="nextpjtime" readonly="readonly"
autocomplete="off" class="layui-input isDisabled"
value="<fmt:formatDate value="${zybPjxx.nextpjtime}" pattern="yyyy-MM-dd"/>">
</div>--%>
<div class="layui-input-block">
<input id="radio1" type="radio" name="radioReportPeriod" lay-filter="radioReportPeriod"
value="半年" title="半年">
<input id="radio2" type="radio" name="radioReportPeriod" lay-filter="radioReportPeriod"
value="一年" title="一年">
<input id="radio3" type="radio" name="radioReportPeriod" lay-filter="radioReportPeriod"
value="两年" title="两年">
<input id="radio4" type="radio" name="radioReportPeriod" lay-filter="radioReportPeriod"
value="三年" title="三年">
<input type="hidden" id="reportPeriod" name="reportPeriod" value="">
<%-- <input type="text" lay-verify="required" name="nextpjtime" id="nextpjtime" readonly="readonly"--%>
<%-- autocomplete="off" class="layui-input isDisabled" value="<fmt:formatDate value="${zybqy.nexttjtime}" pattern="yyyy-MM-dd" />">--%>
<div style="margin-top: 5px">
<input type="text"
style="border-width:0px; font-size:16px;color: #009688; font-weight: bold"
lay-filter="nextpjtime" name="nextpjtime" id="nextpjtime" value=""
readonly="readonly" class="layui-input isDisabled"/></div>
</div>
</div>
</div>
<div class="j-row-center">
<div class="layui-form-item j-w-50 j-w-503">
<label class="layui-form-label j-nowrap">职业病危害现状评价报告</label>
<div class="layui-input-block">
<button type="button" class="layui-btn isDisabled" id="uploadfile" value="123"
style="margin-left: 20px;">
<i class="layui-icon"></i>上传文件
</button>
<!-- 隐藏的input,一个隐藏的input(用于保存文件url) -->
<input type="hidden" lay-verify="required" id="file_url" class="isDisabled" name="file_url"
value="${zybPjxx.bgcontent}"/>
</div>
</div>
<%-- <div class="layui-form-item j-w-502" id="casea1" style="display:none">--%>
<div class="layui-form-item j-w-502" id="casea1">
<label class="layui-form-label j-nowrap">是否同步检测</label>
<div class="layui-input-block">
<input id="radio5" type="radio" name="check"
value="是" title="是" lay-filter="check">
<input id="radio6" type="radio" name="check"
value="否" title="否" lay-filter="check" checked>
<%-- <input type="text" lay-verify="required" name="nextpjtime" id="nextpjtime" readonly="readonly"--%>
<%-- autocomplete="off" class="layui-input isDisabled" value="<fmt:formatDate value="${zybqy.nexttjtime}" pattern="yyyy-MM-dd" />">--%>
<div style="margin-top: 5px">
<input type="text"
style="border-width:0px; font-size:16px;color: #009688; font-weight: bold"
/></div>
</div>
</div>
<div class="layui-form-item j-w-501" id="casea" style="display:none">
<label class="layui-form-label j-nowrap">下次检测时间</label>
<div class="layui-input-block">
<input id="radio1" type="radio" name="radioReport1" lay-filter="radioReport1"
value="半年" title="半年">
<input id="radio2" type="radio" name="radioReport1" lay-filter="radioReport1"
value="一年" title="一年">
<input id="radio3" type="radio" name="radioReport1" lay-filter="radioReport1"
value="两年" title="两年">
<input id="radio44" type="radio" name="radioReport1" lay-filter="radioReport1"
value="三年" title="三年">
<input type="hidden" id="reportPeriod22" name="reportPeriod1" value="">
<%-- <input type="text" lay-verify="required" name="nextpjtime" id="nextpjtime" readonly="readonly"--%>
<%-- autocomplete="off" class="layui-input isDisabled" value="<fmt:formatDate value="${zybqy.nexttjtime}" pattern="yyyy-MM-dd" />">--%>
<div style="margin-top: 5px">
<input type="text"
style="border-width:0px; font-size:16px;color: #009688; font-weight: bold"
lay-filter="nextpjtime2" name="nextpjtime2" id="nextpjtime2" value=""
readonly="readonly" class="layui-input isDisabled"/></div>
</div>
</div>
</div>
<div class="j-row-center j-w-504">
<div class="layui-form-item">
<div class="layui-input-block">
<%-- <input lay-filter="zwkzCheckBox" type="checkbox" id="zwkz0" name="zwkz" lay-skin="primary"
title="暂未开展" value="1" <c:if test="${zybPjxx.zwkz == '1'}">checked</c:if>>--%>
<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</div>
</div>
</form>
</div>
<script src="${ctxStatic}/layui-v2.4.5/layui/layui.js"></script>
<script src="${ctxStatic}/common/dayjs.min.js"></script>
<script type="text/javascript">
// function showCont() {
//
// switch ($("input[name=check]:checked").attr("id")) {
//
// case "是":
//
// $("#casea").show();
// break;
// case "否":
//
// $("#casea").hide();
// break;
//
// default:
// break;
//
// }
//
// }
layui.use(['table', 'layer', 'form', 'laydate', 'upload'], function () {
judge = null
reportPeriod = null
nextpjtime = null
$ = layui.jquery;
var layer = layui.layer;
var form = layui.form;
var laydate = layui.laydate;
var upload = layui.upload;
$(function () {
<c:if test="${zybPjxx.bgcontent != null}">
$("#file_url").after("<i class=\"layui-icon layui-icon-ok\" style=\"color: #24bcff; font-size: 30px;\"></i>");
</c:if>
<%-- <c:if test="${zybPjxx.bgcontent = null}">--%>
<%-- $("#file_url").after("wo");--%>
<%-- </c:if>--%>
// 如果为修改页面,则判断有没有
/* <c:if test="${zybPjxx.zwkz == '1'}">
$("#file_url").next().remove();
$("#saveOrUpdateDiv").find(".isDisabled").addClass("layui-disabled").prop({'disabled': true}).attr('lay-verify', '').val("");
</c:if>*/
<c:if test="${zybPjxx.id != null}">
document.getElementById("casea1").style.display = "none";
</c:if>
<c:if test="${zybPjxx.id == null}">
$("input[id='radio4']").attr('checked', true);
setZq();
function setZq() {
form.val("formTest", {
"radioReportPeriod": `三年`,
"reportPeriod": `三年`
});
}
</c:if>
<c:if test="${zybPjxx.id != null}">
InitBasicInfo();
function InitBasicInfo() {
form.val("formTest", {
"radioReportPeriod": `${zybPjxx.reportPeriod}`,
"reportPeriod": `${zybPjxx.reportPeriod}`,
"nextpjtime": '<fmt:formatDate value="${zybPjxx.nextpjtime}" pattern="yyyy-MM-dd" />'
});
}
</c:if>
$.ajax({
//提交数据的类型 POST GET
type: "POST",
//提交的网址
url: "${ctx}/zyb/logon/pjjgListno",
//提交的数据
//返回数据的格式
datatype: "json",//“xml”, “html”, “script”, “json”, “jsonp”, “text”.
//成功返回之后调用的函数
success: function (data) {
$.each(data, function (index, item) {
$('#selectUser').append(new Option(item.companyName, item.id, '${zybPjxx.enterpriseid}' !== ''));// 下拉菜单里添加元素
});
layui.form.render("select");
},
error: function () {
alert("查询机构失败!!!")
}
})
});
//绑定时间选择器
laydate.render({
elem: '#pjtime',
trigger: 'click',
max: 'nowTime'
, done: function (value, date, endDate) { // 选择完毕的回调
if ($("#reportPeriod").val() == "")
return false;
//计算日期
CalcNextDate($("#reportPeriod").val(), value);
// if ($("#reportPeriod22").val() == "")
// return false;
// //计算日期
// CalcNextDate2($("#reportPeriod22").val(), value);
}
});
/* laydate.render({
elem: '#nextpjtime', trigger: 'click'
});*/
form.on('radio(radioReportPeriod)', function (data) {
console.log(data);
$("#reportPeriod").val(data.value);
//报告日期为空,不计算
var dataValue = $("#pjtime").val();
if ($("#pjtime").val() == "")
return false;
// top.layer.msg("体检日期不能为空!");
//计算日期
CalcNextDate(data.value, dataValue);
});
form.on('radio(radioReport1)', function (data) {
console.log(data);
$("#reportPeriod22").val(data.value);
//报告日期为空,不计算
var dataValue = $("#pjtime").val();
if ($("#pjtime").val() == "")
return false;
// top.layer.msg("体检日期不能为空!");
//计算日期
CalcNextDate2(data.value, dataValue);
});
form.on('radio(check)', function (data) {
console.log('data', data);
var judge = data.value
if (judge == '是') {
document.getElementById("casea").style.display = "block";
} else {
document.getElementById("casea").style.display = "none";
}
});
function CalcNextDate(dateType, selectDate) {
var currentReportDate = selectDate;
if (dateType == "半年") {
$("#nextpjtime").val(dayjs(currentReportDate).add(6, 'month').format("YYYY-MM-DD"));
} else if (dateType == "一年") {
$("#nextpjtime").val(dayjs(currentReportDate).add(1, 'year').format("YYYY-MM-DD"));
} else if (dateType == "两年") {
$("#nextpjtime").val(dayjs(currentReportDate).add(2, 'year').format("YYYY-MM-DD"));
} else if (dateType == "三年") {
$("#nextpjtime").val(dayjs(currentReportDate).add(3, 'year').format("YYYY-MM-DD"));
}
}
function CalcNextDate2(dateType, selectDate) {
var currentReportDate = selectDate;
if (dateType == "半年") {
$("#nextpjtime2").val(dayjs(currentReportDate).add(6, 'month').format("YYYY-MM-DD"));
} else if (dateType == "一年") {
$("#nextpjtime2").val(dayjs(currentReportDate).add(1, 'year').format("YYYY-MM-DD"));
} else if (dateType == "两年") {
$("#nextpjtime2").val(dayjs(currentReportDate).add(2, 'year').format("YYYY-MM-DD"));
} else if (dateType == "三年") {
$("#nextpjtime2").val(dayjs(currentReportDate).add(3, 'year').format("YYYY-MM-DD"));
}
}
form.on('select(selectUser)', function (data) { //选择并赋值给input框
// value:data.value
// 文本:data.elem[data.elem.selectedIndex].text;
var txt = data.elem[data.elem.selectedIndex].text;
$("#selectInputUser").val(txt);
$("#selectUser").next().find("dl").css({"display": "none"});
form.render();
});
form.on('checkbox(zwkzCheckBox)', function (data) {
if (data.elem.checked) {
$("#file_url").next().remove();
$("#saveOrUpdateDiv").find(".isDisabled").addClass("layui-disabled")
.prop({'disabled': true}).attr('lay-verify', '').val("");
} else {
$("#saveOrUpdateDiv").find(".isDisabled").removeClass("layui-disabled")
.prop({'disabled': false}).attr('lay-verify', 'required');
$("#saveOrUpdateDiv").find("button.isDisabled").attr('lay-verify', '');
}
form.render('select');
});
window.search = function () {
var value = $("#selectInputUser").val();
$("#selectUser").val(value);
form.render("select");
$("#selectUser").next().find("dl").css({"display": "block"});
var dl = $("#selectUser").next().find("dl").children();
var j = -1;
for (var i = 0; i < dl.length; i++) {
if (dl[i].innerHTML.indexOf(value) <= -1) {
dl[i].style.display = "none";
j++;
}
if (j == dl.length - 1) {
$("#selectUser").next().find("dl").css({"display": "none"});
}
}
};
form.on('submit(demo1)', function (data) {
// debugger
var judge = data.field.check
var enterpriseid = data.field.radioReport1
var nextpjtime = data.field.nextpjtime2
console.log(enterpriseid);
//判断judge是否
if (judge === '是') {
console.log(data);
let pjxx = data.field;
pjxx["pjjgname"] = $("#selectInputUser").val();
pjxx["pjjgid"] = $("#selectUser").find("option:selected").val();
pjxx["bgcontent"] = data.field.file_url;
pjxx["zwkz"] = data.field.zwkz === undefined ? 0 : data.field.zwkz;
console.log('aaa', pjxx)
var jcxx = {
id: $("#id").val(),
bgname: data.field.pjname,
jcjgname: $("#selectInputUser").val(),
enterpriseName: $("#eName").val(),
jcjgid: $("#selectUser").find("option:selected").val(),
reportPeriod: data.field.reportPeriod1,
jhysId: data.field.jhysId,
bgtime: data.field.pjtime,
nextjctime: data.field.nextpjtime2,
bgcontent: data.field.file_url,
// reportPeriod: data.field.reportPeriod
};
console.log('bbb', jcxx)
$.ajax({
// url: data.form.action, //请求的url地址
url: data.form.action, //请求的url地址
dataType: "json",
async: false,//请求是否异步,默认为异步,这也是ajax重要特性
data: pjxx, //参数值
type: "POST", //请求方式
success: function (req) {
alert(req.mess);
var index1 = top.layer.getFrameIndex(window.name); //获取窗口索引
if (top.frames[top.getActiveTab().attr("name")].active2
&& top.frames[top.getActiveTab().attr("name")].active2.AddComplete2) {
top.frames[top.getActiveTab().attr("name")].active2.AddComplete2(index1);
} else {
window.parent.location.reload();//刷新父页面
var index2 = parent.layer.getFrameIndex(window.name); //获取窗口索引
parent.layer.close(index2)
}
},
complete: function () {
//请求完成的处理
},
error: function (error) {
}
});
$.ajax({
url: "${ctx}/zyb/logon/insertJcxxno", //请求的url地址
dataType: "json",
async: false,//请求是否异步,默认为异步,这也是ajax重要特性
data: jcxx, //参数值
type: "POST", //请求方式
success: function (req) {
// console.log(req)
// /* alert("fdsfsd")*/
// alert(req.mess)
// var index1 = top.layer.getFrameIndex(window.name); //获取窗口索引
// if(top.frames[top.getActiveTab().attr("name")].active2
// && top.frames[top.getActiveTab().attr("name")].active2.AddComplete2) {
// top.frames[top.getActiveTab().attr("name")].active2.AddComplete2(index1);
// }
// else
// {
// window.parent.location.reload();//刷新父页面
// var index2 = parent.layer.getFrameIndex(window.name); //获取窗口索引
// parent.layer.close(index2)
// }
//
// //刷新父页面
// return false;
},
complete: function () {
//请求完成的处理
},
error: function (error) {
}
});
} else {
let pjxx = data.field;
pjxx["pjjgname"] = $("#selectInputUser").val();
pjxx["pjjgid"] = $("#selectUser").find("option:selected").val();
pjxx["bgcontent"] = data.field.file_url;
pjxx["zwkz"] = data.field.zwkz === undefined ? 0 : data.field.zwkz;
console.log(pjxx)
$.ajax({
// url: data.form.action, //请求的url地址
url: data.form.action, //请求的url地址
dataType: "json",
async: false,//请求是否异步,默认为异步,这也是ajax重要特性
data: pjxx, //参数值
type: "POST", //请求方式
success: function (req) {
alert(req.mess);
var index1 = top.layer.getFrameIndex(window.name); //获取窗口索引
if (top.frames[top.getActiveTab().attr("name")].active2
&& top.frames[top.getActiveTab().attr("name")].active2.AddComplete2) {
top.frames[top.getActiveTab().attr("name")].active2.AddComplete2(index1);
} else {
window.parent.location.reload();//刷新父页面
var index2 = parent.layer.getFrameIndex(window.name); //获取窗口索引
parent.layer.close(index2)
}
},
complete: function () {
//请求完成的处理
},
error: function (error) {
}
});
}
/**
* 执行新增
*/
//刷新父页面
return false;
});
/* form.on('submit(demo1)', function (data) {
// debugger
console.log(data);
let pjxx = data.field;
pjxx["pjjgname"] = $("#selectInputUser").val();
pjxx["pjjgid"] = $("#selectUser").find("option:selected").val();
pjxx["bgcontent"] = data.field.file_url;
pjxx["zwkz"] = data.field.zwkz === undefined ? 0 : data.field.zwkz;
console.log(pjxx)
/!**
* 执行新增
*!/
$.ajax({
url: "
${ctx}/zyb/logon/insertPjxxno", //请求的url地址
dataType: "json",
async: false,//请求是否异步,默认为异步,这也是ajax重要特性
data: pjxx, //参数值
type: "POST", //请求方式
success: function (req) {
alert(req.mess);
var index1 = top.layer.getFrameIndex(window.name); //获取窗口索引
if (top.frames[top.getActiveTab().attr("name")].active2
&& top.frames[top.getActiveTab().attr("name")].active2.AddComplete2) {
top.frames[top.getActiveTab().attr("name")].active2.AddComplete2(index1);
} else {
window.parent.location.reload();//刷新父页面
var index2 = parent.layer.getFrameIndex(window.name); //获取窗口索引
parent.layer.close(index2)
}
},
complete: function () {
//请求完成的处理
},
error: function (error) {
}
});
//刷新父页面
return false;
});*/
//上传uploadFile
upload.render({
elem: '#uploadfile'
, url: '${ctx}/zyb/ar/uploadFile'
, accept: 'file',//文件
//, exts: 'pdf|docx|doc', //文件
before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading
}, done: function (res) {
layer.closeAll('loading');
//如果上传失败
if (res.code > 0) {
alert("上传失败" + res.data.src);
$("#file_url").after("<i class=\"layui-icon layui-icon-close\" style=\"color: #24bcff; font-size: 30px;\"></i>");
return layer.msg('上传失败');
}
//上传成功
// alert("上传成功"+res.data.src);
document.getElementById("file_url").value = res.data.src;
$('#icon').remove()
$("#file_url").after("<i class=\"layui-icon layui-icon-ok\" id='icon' style=\"color: #24bcff; font-size: 30px;\" ></i>");
return layer.msg('上传成功');
}, error: function (index, upload) {
$("#file_url").after("<i class=\"layui-icon layui-icon-close\" style=\"color: #24bcff; font-size: 30px;\"></i>");
return layer.msg('上传失败');
}
});
});
</script>
</body>
</html>