| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629 |
- <!DOCTYPE HTML>
- <html xmlns:th="http://www.thymeleaf.org"
- xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
- layout:decorate="~{admin/common/common}">
- <head>
- <title>添加</title>
- <style>
- .ke-container-default {
- width: 100% !important
- }
- .ke-swfupload-body {
- height: 265px
- }
- .ke-dialog-body {
- height: 340px !important;
- }
- .ke-dialog-default {
- height: 410px !important;
- }
- .error {
- color: red;
- }
- multiple:hover .dropdown-clear-all, .dropdown-single:hover .dropdown-clear-all {
- display: none;
- }
- </style>
- </head>
- <body layout:fragment="content">
- <article class="page-container">
- <form class="form form-horizontal" id="form-add">
- <!--<div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目大类:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select class="select" th:name="project_type" id="project_type" required>
- <option value="">-- 请选择项目大类 --</option>
- <option th:each="item : ${projectTypeList}" th:value="${item.value}" th:text="${item.name}"
- th:selected="${item.value==project.project_type}">
- </select>
- </span>
- </div>
- </div>-->
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>填报项:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <div class="select-box autocomplete">
- <select style="display:none" class="select" th:name="project_service_type"
- th:id="project_service_type" required th:placeholder="请输入填报项关键词">
- <option value="" th:if="${#arrays.length(projectServiceTypeList)<=0}"></option>
- <!--<option th:each="item : ${projectServiceTypeList}" th:value="${item.id}"
- th:text="${item.service_type_name}"
- th:selected="${#strings.append(item.id,'')==project.project_service_type}">-->
- </select>
- </div>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目来源:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <span class="select-box">
- <select class="select" th:name="project_source" id="project_source" required>
- <option value="">-- 请选择项目来源 --</option>
- <option th:value="1" th:text="国家" th:selected="${'1'==project.project_source}"></option>
- <option th:value="2" th:text="江苏省" th:selected="${'2'==project.project_source}"></option>
- <option th:value="3" th:text="苏州市" th:selected="${'3'==project.project_source}"></option>
- <option th:value="4" th:text="高新区" th:selected="${'4'==project.project_source}"></option>
- </select>
- </span>
- </div>
- </div>
- <!--<div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目责任单位:</label>
- <div class="formControls col-xs-8 col-sm-3">
- <span class="select-box">
- <select class="select" th:name="department_id" id="department_id" required>
- <option value="">-- 请选择项目责任单位 --</option>
- <option th:each="item : ${departmentList}" th:value="${item.id}"
- th:text="${item.name}" th:selected="${item.id==project.department_id}">
- </option>
- </select>
- </span>
- </div>
- </div>-->
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>对应年份:</label>
- <div class="formControls col-xs-8 col-sm-3">
- <span class="select-box">
- <select class="select" th:name="year" id="year" required>
- <option value="">-- 请选年份 --</option>
- <option th:value="2028" th:text="2028" th:selected="${'2028'==project.year}"></option>
- <option th:value="2027" th:text="2027" th:selected="${'2027'==project.year}"></option>
- <option th:value="2026" th:text="2026" th:selected="${'2026'==project.year}"></option>
- <option th:value="2025" th:text="2025" th:selected="${'2025'==project.year}"></option>
- <option th:value="2024" th:text="2024" th:selected="${'2024'==project.year}"></option>
- <option th:value="2023" th:text="2023" th:selected="${'2023'==project.year}"></option>
- <option th:value="2022" th:text="2022" th:selected="${'2022'==project.year}"></option>
- <option th:value="2021" th:text="2021" th:selected="${'2021'==project.year}"></option>
- <option th:value="2020" th:text="2020" th:selected="${'2020'==project.year}"></option>
- <option th:value="2019" th:text="2019" th:selected="${'2019'==project.year}"></option>
- <option th:value="2018" th:text="2018" th:selected="${'2018'==project.year}"></option>
- </select>
- </span>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2">对应季月:</label>
- <div class="formControls col-xs-8 col-sm-3">
- <span class="select-box">
- <select class="select" th:name="season_or_month" th:id="season_or_month">
- <option value="">-- 请选择季度或月度 --</option>
- <option th:value="J" th:text="季度" th:selected="${'J'==project.season_or_month}"></option>
- <option th:value="Y" th:text="月度" th:selected="${'Y'==project.season_or_month}"></option>
- </select>
- </span>
- </div>
- <div class="formControls col-xs-8 col-sm-3 season" th:hidden="${'J'!=project.season_or_month}">
- <span class="select-box season" th:hidden="${''==project.season}">
- <select class="select" th:name="season" id="season">
- <option value="">-- 请选择季度 --</option>
- <option th:value="1" th:text="第一季度" th:selected="${'1'==project.season}"></option>
- <option th:value="2" th:text="第二季度" th:selected="${'2'==project.season}"></option>
- <option th:value="3" th:text="第三季度" th:selected="${'3'==project.season}"></option>
- <option th:value="4" th:text="第四季度" th:selected="${'4'==project.season}"></option>
- </select>
- </span>
- </div>
- <div class="formControls col-xs-8 col-sm-3 month" th:hidden="${'Y'!=project.season_or_month}">
- <span class="select-box month" th:hidden="${''==project.month}">
- <select class="select" th:name="month" id="month">
- <option value="">-- 请选择月份 --</option>
- <option th:value="1" th:text="一月" th:selected="${'1'==project.month}"></option>
- <option th:value="2" th:text="二月" th:selected="${'2'==project.month}"></option>
- <option th:value="3" th:text="三月" th:selected="${'3'==project.month}"></option>
- <option th:value="4" th:text="四月" th:selected="${'4'==project.month}"></option>
- <option th:value="5" th:text="五月" th:selected="${'5'==project.month}"></option>
- <option th:value="6" th:text="六月" th:selected="${'6'==project.month}"></option>
- <option th:value="7" th:text="七月" th:selected="${'7'==project.month}"></option>
- <option th:value="8" th:text="八月" th:selected="${'8'==project.month}"></option>
- <option th:value="9" th:text="九月" th:selected="${'9'==project.month}"></option>
- <option th:value="10" th:text="十月" th:selected="${'10'==project.month}"></option>
- <option th:value="11" th:text="十一月" th:selected="${'11'==project.month}"></option>
- <option th:value="12" th:text="十二月" th:selected="${'12'==project.month}"></option>
- </select>
- </span>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目内容:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <textarea id="project_content" name="project_content" th:utext="*{project.project_content}"></textarea>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span>上传附件:</span></label>
- <div class="formControls col-xs-8 col-sm-9">
- <div class="uploader-thum-container">
- <div id="fileListPre" class="uploader-list">
- <th:block th:unless="${project.fileDown.file_url} == null">
- <a th:href=" ${fileUrl} + ${project.fileDown.file_url}" id="fileName" target="_blank">[[${project.fileDown.file_name}]]</a>
- </th:block>
- </div>
- <div id="filePicker">上传</div>
- <input type="hidden" name="fileDown.file_id" id="files" th:value="${project.fileDown.file_id}">
- </div>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>填报开始时间:</label>
- <div class="formControls col-xs-4 col-sm-1">
- <input class="Wdate input-text" type="text" th:id="apply_startdateIE" th:name="apply_startdate"
- style="float:left; width: 150px;"
- onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'apply_enddateIE\')}',isShowClear:true,readOnly:true})"/>
- <input type="text" class="input-text" th:id="apply_startdate" th:name="apply_startdate" th:value="${project.apply_startdate}"
- style="float:left; width: 150px;"/>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>填报结束时间:</label>
- <div class="formControls col-xs-4 col-sm-1">
- <input class="Wdate input-text" type="text" th:id="apply_enddateIE" th:name="apply_enddate"
- style="float:left; width: 150px;"
- onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'apply_startdateIE\')}',isShowClear:true,readOnly:true})"/>
- <input type="text" class="input-text pull-left" th:id="apply_enddate" th:name="apply_enddate" th:value="${project.apply_enddate}"
- style="float:left; width: 150px;"/>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>显示在门户:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <input type="radio" id="is_public1" name="is_public" th:value="1" checked>是
- <input type="radio" id="is_public2" name="is_public" th:value="0">否
- </div>
- </div>
- <div class="row cl push">
- <label class="form-label col-xs-4 col-sm-2"><span>推送对象:</span></label>
- <div class="formControls col-xs-8 col-sm-9">
- <a class="btn btn-primary radius"
- th:onclick="'javascript:notify_addPush(\'推送\',\'/projectFilling/addPush\',\'800\',\'500\');'"><i
- class="Hui-iconfont"></i>选择</a>
- <input id="pushCompanyIds" name="push_company_ids" type="hidden" th:value="${project.push_company_ids}"/>
- <input id="id" name="id" type="hidden" th:value="${project.id}"/>
- </div>
- <label class="form-label col-xs-4 col-sm-2"><span>已添加单位:</span></label>
- <div class="formControls col-xs-8 col-sm-9">
- <span id="pushNames" th:text="${project.push_company_names}">
- </span>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span>摘要:</span></label>
- <div class="formControls col-xs-8 col-sm-9">
- <textarea id="summary" class="input-text" name="summary">[[${project?.summary}]]</textarea>
- </div>
- </div>
- <!--<div class="row cl push" hidden th:hidden="${project.project_type == '1'}">
- <label class="form-label col-xs-4 col-sm-2"><span>推送对象:</span></label>
- <div class="formControls col-xs-8 col-sm-9">
- <a class="btn btn-primary radius"
- th:onclick="'javascript:notify_addPush(\'推送\',\'/government/projectProvinces/addPush\',\'800\',\'500\');'"><i
- class="Hui-iconfont"></i>添加</a>
- <input id="pushStreetIds" name="push_street_ids" type="hidden" th:value="${project.push_street_ids}"/>
- <input id="pushBuildIds" name="push_build_ids" type="hidden" th:value="${project.push_build_ids}"/>
- <input id="pushCompanyIds" name="push_company_ids" type="hidden"
- th:value="${project.push_company_ids}"/>
- <input id="pushStreetNames" name="push_street_names" type="hidden"
- th:value="${project.push_street_names}"/>
- <input id="pushBuildNames" name="push_build_names" type="hidden"
- th:value="${project.push_build_names}"/>
- <input id="pushCompanyNames" name="push_company_names" type="hidden"
- th:value="${project.push_company_names}"/>
- <input id="id" name="id" type="hidden" th:value="${project.id}"/>
- <input type="hidden" id="isPush">
- </div>
- <label class="form-label col-xs-4 col-sm-2"><span>已添加单位:</span></label>
- <div class="formControls col-xs-8 col-sm-9">
- <span id="pushNames" th:text="${project.push_company_names}">
- </span>
- </div>
- </div>-->
- <div class="row cl">
- <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
- <a th:if="${project.status=='0'}" type="submit" onclick="save()" class="btn btn-secondary radius"><i
- class="Hui-iconfont"></i>保存草稿
- </a>
- <a th:onclick="'javascript:preview(\'项目申报预览\',\'/projectDeclaration/preview\',\'800\',\'600\');'"
- class="btn btn-secondary radius"><i class="Hui-iconfont"></i>预览
- </a>
- <a class="btn btn-primary radius" onclick="release()"><i class="Hui-iconfont"></i>发布
- </a>
- <a onClick="removeIframe();" class="btn btn-default radius" type="button"> 取消 </a>
- </div>
- </div>
- </form>
- </article>
- <script type="text/javascript" th:src="@{/h-ui/lib/webuploader/0.1.5/webuploader.min.js}"></script>
- <script th:inline="javascript">
- //富文本kindeditor初始化
- var editor;
- KindEditor.ready(function (K) {
- editor = K.create('#project_content', {
- uploadJson: pagePath + '/upload/kindEditorUpload',
- allowFileManager: false,
- allowUpload: true,
- width: "100%",
- height: "350px",
- items: array,
- syncType: "auto",
- filterMode: false,
- afterBlur: function () {
- this.sync();
- }
- });
- });
- $(function () {
- // 初始化上传
- var options = {
- uploadBtnId: '#filePicker',
- picturePreId: 'fileListPre',
- hiddenPictureUrl: 'img',
- hiddenPictureName: 'imgName',
- width: 81,
- height: 81,
- fileSizeLimit: 100 * 1024 * 1024,
- fileSingleSizeLimit: 100 * 1024 * 1024
- };
- var webUploadDoc = new $WebUploadDoc(options);
- webUploadDoc.init();
- var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
- var isOpera = userAgent.indexOf("Opera") > -1;
- //判断是否IE浏览器
- if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
- $("#apply_startdate").remove();
- $("#apply_enddate").remove();
- } else {
- $("#apply_startdateIE").remove();
- $("#apply_enddateIE").remove();
- var startDate = laydate.render({
- elem: '#apply_startdate',
- type: 'datetime',
- done: function (value, date) {
- setTimeout(function () {
- $("#form-add").validate().element($("#apply_startdate"));
- }, 100)
- if (value !== '') {
- endDate.config.min.year = date.year;
- endDate.config.min.month = date.month - 1;
- endDate.config.min.date = date.date;
- endDate.config.min.hours = date.hours;
- endDate.config.min.minutes = date.minutes;
- endDate.config.min.seconds = date.seconds;
- } else {
- endDate.config.min.year = '1900';
- endDate.config.min.month = '0';
- endDate.config.min.date = '1';
- endDate.config.min.hours = '0';
- endDate.config.min.minutes = '0';
- endDate.config.min.seconds = '0';
- }
- }
- });
- var endDate = laydate.render({
- elem: '#apply_enddate',
- type: 'datetime',
- done: function (value, date) {
- setTimeout(function () {
- $("#form-add").validate().element($("#apply_enddate"));
- }, 100)
- if (value !== '') {
- startDate.config.max.year = date.year;
- startDate.config.max.month = date.month - 1;
- startDate.config.max.date = date.date;
- startDate.config.max.hours = date.hours;
- startDate.config.max.minutes = date.minutes;
- startDate.config.max.seconds = date.seconds;
- } else {
- startDate.config.max.year = '2100';
- startDate.config.max.month = '0';
- startDate.config.max.date = '1';
- startDate.config.max.hours = '0';
- startDate.config.max.minutes = '0';
- startDate.config.max.seconds = '0';
- }
- }
- });
- }
- });
- var project = [[${project}]];
- var list = [[${projectServiceTypeList}]];
- var typeArrs = new Array();
- for (var i = 0; i < list.length; i++) {
- if (project.project_service_type == list[i].id) {
- var type = {
- "name": list[i].service_type_name,
- "id": list[i].id,
- "selected": true
- }
- } else {
- var type = {
- "name": list[i].service_type_name,
- "id": list[i].id,
- "selected": false
- }
- }
- typeArrs.push(type)
- }
- //自动联想
- $('.autocomplete').dropdown({
- readOnly: true,
- data: typeArrs,
- input: '<input type="text" maxLength="20" placeholder="请输入搜索">',
- choice: function () {
- //$("span.placeholder").html($(".dropdown-chose")[0].innerText);
- $("#project_service_type").val($(".dropdown-chose").attr("data-value"));
- }
- });
- function getProjectServicetype(id) {
- $.ajax({
- url: pagePath + "/projectFilling/getProjectServicetype/" + id,
- type: "get",
- dataType: "json",
- data: {
- timeStamp: new Date()
- },
- success: function (result) {
- if (result.success) {
- var obj = result.obj;
- var typeArr = new Array();
- if (obj) {
- for (var i = 0; i < obj.length; i++) {
- var type = {
- "name": obj[i].service_type_name,
- "id": obj[i].id,
- "disabled": false,
- //"groupName": '分组名',
- //"groupId": 1,
- "selected": false
- }
- typeArr.push(type);
- }
- }
- //autoComplete(typeArr);
- $('.autocomplete').data('dropdown').update(typeArr, true);
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- $("#project_type").change(function () {
- getProjectServicetype($("#project_type").val())
- })
- /**
- * 取消
- */
- function removeIframe() {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- }
- var state = '0';
- $("#form-add").validate({
- rules: {
- project_type: {
- required: true
- },
- project_service_type: {
- required: true
- },
- project_source: {
- required: true
- },
- department_id: {
- required: true
- },
- year: {
- required: true
- },
- project_content: {
- required: true
- //maxlength: 2000
- },
- apply_startdate: {
- required: true
- },
- apply_enddate: {
- required: true
- }
- },
- onkeyup: false,
- focusCleanup: true,
- focusInvalid: false,
- success: "valid",
- submitHandler: function (form) {
- if (editor.isEmpty()) {
- errorMessage('请输入项目内容');
- return false;
- } else if (editor.text().length > 2000) {
- //errorMessage('项目内容最多2000字');
- // return false;
- }
- if (state == '1') {
- if ($('input[name="is_open"]:checked').val() == 0) {
- if ($("#pushNames").text().length <= 0) {
- errorMessage('请选择推送对象');
- return false;
- }
- }
- }
- $(form).ajaxSubmit({
- type: 'post',
- url: pagePath + "/projectFilling/update",
- dataType: "json",
- data: {
- state: state
- },
- success: function (result) {
- if (result.success) {
- succeedMessage(result.message);
- setTimeClose();
- } else {
- // $(form).find(":submit").attr("disabled", false);
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
- }
- });
- function release() {
- state = "1";
- $("#form-add").submit();
- }
- function save() {
- state = "0";
- $("#form-add").ajaxSubmit({
- type: 'post',
- url: pagePath + "/projectFilling/update",
- dataType: "json",
- data: {
- state: state
- },
- success: function (data) {
- if (data.success) {
- succeedMessage(data.message);
- setTimeClose();
- } else {
- // $(form).find(":submit").attr("disabled", false);
- errorMessage(data.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- $(function () {
- $("#allBuilds").click(function () {
- if (this.checked) {
- $("#pushBuildsList :checkbox").prop("checked", true);
- } else {
- $("#pushBuildsList :checkbox").prop("checked", false);
- }
- });
- });
- function sendNotify() {
- $("#isPush").val(true);
- if ($("#pushStreetIds").val() == "" && $("#pushBuildIds").val() == "" && $("#pushCompanyIds").val() == "") {
- sadMessage("请选择推送单位!");
- return false;
- }
- }
- function clearPush() {
- $("#isPush").val(false);
- }
- function getPushBuildsIds() {
- var chlength = $('#pushBuildsList').find('input[type="checkbox"]:checked').length;
- var build_ids = '';
- $('#pushBuildsList').find('input[type="checkbox"]:checked').each(function (i, item) {
- build_ids = build_ids + $(this).attr("value") + ",";
- });
- build_ids = build_ids.substring(0, build_ids.length - 1);
- return build_ids;
- }
- /*
- 参数解释:
- title 标题
- url 请求的url
- id 需要操作的数据id
- w 弹出层宽度(缺省调默认值)
- h 弹出层高度(缺省调默认值)
- */
- /*管理员-*/
- function notify_addPush(title, url, w, h) {
- var targetUrl = pagePath + url+"?pushCompanyIds="+$("#pushCompanyIds").val();
- var index = layer_show(title, targetUrl, w, h);
- layer.full(index);
- }
- function preview(title, url, w, h) {
- layer_show(title, pagePath + url, w, h);
- }
- $("#season_or_month").change(function () {
- if ($('#season_or_month option:selected').val() == "J") {
- $(".season").show();
- $(".month").hide();
- } else if ($('#season_or_month option:selected').val() == "Y") {
- $(".month").show()
- $(".season").hide();
- } else {
- $(".month").hide()
- $(".season").hide();
- }
- });
- $("#project_type").change(function () {
- if ($('#project_type option:selected').val() == "1") {
- $(".push").hide();
- } else if ($('#project_type option:selected').val() == "2") {
- $(".push").show()
- }
- });
- </script>
- </body>
- </html>
|