| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546 |
- <!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-6">
- <div class="select-box autocomplete">
- <select style="display:none" class="select" th:name="project_service_type"
- th:id="project_service_type" th:placeholder="请选择">
- <option value=""></option>
- </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-3">
- <span class="select-box">
- <select class="select" th:name="project_source" id="project_source">
- <option value="">-- 请选择项目来源 --</option>
- <option th:each="item : ${projectSourceList}" th:value="${item.value}" th:text="${item.name}">
- </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">
- <input type="radio" id="is_comprehensive1" name="is_comprehensive" th:value="1"
- onclick="changeDepartment()" checked>是
- <input type="radio" id="is_comprehensive2" name="is_comprehensive" th:value="0"
- onclick="changeDepartment()">否
- </div>
- </div>
- <div class="row cl" id="is_serial_btn" hidden>
- <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_serial1" name="is_serial" th:value="1"
- onclick="changeDepartment()" checked>是
- <input type="radio" id="is_serial2" name="is_serial" th:value="0"
- onclick="changeDepartment()">否
- </div>
- </div>
- <div class="row cl" id="department" hidden>
- <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}">
- </option>
- </select>
- </span>
- </div>
- </div>
- <div class="row cl" id="department_two" hidden>
- <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_first" id="department_id_first" required>
- <option value="">-- 请选择先审核责任单位 --</option>
- <option th:each="item : ${departmentList}" th:value="${item.id}"
- th:text="${item.name}">
- </option>
- </select>
- </span>
- </div>
- <div class="formControls col-xs-8 col-sm-3">
- <span class="select-box">
- <select class="select" th:name="department_id_second" id="department_id_second" required>
- <option value="">-- 请选择后审核责任单位 --</option>
- <option th:each="item : ${departmentList}" th:value="${item.id}"
- th:text="${item.name}">
- </option>
- </select>
- </span>
- </div>
- </div>
- <div class="row cl" id="departmentAndType" hidden>
- <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">
- <div><i class="Hui-iconfont" style="cursor: pointer;" onclick="addLine()"></i></div>
- <table class="table table-border table-bordered table-bg table-hover">
- <thead>
- <tr class="text-c">
- <th width="200">项目大类</th>
- <th width="200">项目小类</th>
- <th width="200">责任单位</th>
- <th width="100">操作</th>
- </tr>
- </thead>
- <tbody class="add_floor_line">
- <tr class="text-c ">
- <td><input type="text" class="name1" name="projectServiceCategory[0].project_type_name1"
- style="width: 100%;" required></td>
- <td><input type="text" class="name2" name="projectServiceCategory[0].project_type_name2"
- style="width: 100%;" required></td>
- <td>
- <div class="formControls col-sm-12 text-left">
- <span class="select-box">
- <select class="select department" name="projectServiceCategory[0].department_id"
- required>
- <option value="">-- 请选择项目责任单位 --</option>
- <option th:each="item : ${departmentList}" th:value="${item.id}"
- th:text="${item.name}" required></option>
- </select>
- </span>
- </div>
- </td>
- <td class="icon_font"></td>
- </tr>
- </tbody>
- </table>
- </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_street_audit1" name="is_street_audit" th:value="1" checked>是
- <input type="radio" id="is_street_audit2" name="is_street_audit" th:value="0">否
- </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">
- <option value="">-- 请选年份 --</option>
- <option th:value="2028" th:text="2028"></option>
- <option th:value="2027" th:text="2027"></option>
- <option th:value="2026" th:text="2026"></option>
- <option th:value="2025" th:text="2025"></option>
- <option th:value="2024" th:text="2024"></option>
- <option th:value="2023" th:text="2023"></option>
- <option th:value="2022" th:text="2022"></option>
- <option th:value="2021" th:text="2021"></option>
- <option th:value="2020" th:text="2020"></option>
- <option th:value="2019" th:text="2019"></option>
- <option th:value="2018" th:text="2018"></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="季度"></option>
- <option th:value="Y" th:text="月度"></option>
- </select>
- </span>
- </div>
- <div class="formControls col-xs-8 col-sm-3 season" hidden>
- <span class="select-box season" hidden>
- <select class="select" th:name="season" id="season" required>
- <option value="">-- 请选择季度 --</option>
- <option th:value="1" th:text="第一季度"></option>
- <option th:value="2" th:text="第二季度"></option>
- <option th:value="3" th:text="第三季度"></option>
- <option th:value="4" th:text="第四季度"></option>
- </select>
- </span>
- </div>
- <div class="formControls col-xs-8 col-sm-3 month" hidden>
- <span class="select-box month" hidden>
- <select class="select" th:name="month" id="month" required>
- <option value="">-- 请选择月份 --</option>
- <option th:value="1" th:text="一月"></option>
- <option th:value="2" th:text="二月"></option>
- <option th:value="3" th:text="三月"></option>
- <option th:value="4" th:text="四月"></option>
- <option th:value="5" th:text="五月"></option>
- <option th:value="6" th:text="六月"></option>
- <option th:value="7" th:text="七月"></option>
- <option th:value="8" th:text="八月"></option>
- <option th:value="9" th:text="九月"></option>
- <option th:value="10" th:text="十月"></option>
- <option th:value="11" th:text="十一月"></option>
- <option th:value="12" th:text="十二月"></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">
- <input type="text" class="input-text" placeholder="请输入项目标题" id="project_name" name="project_name"/>
- </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="content" name="content" required></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"></div>
- <div id="filePicker">选择文件</div>
- </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">
- <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">
- <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
- <a type="submit" onclick="save()" class="btn btn-secondary radius"><i class="Hui-iconfont"></i>保存草稿</a>
- <a th:onclick="'javascript:preview(\'项目申报预览\',\'/government/projectMatters/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('#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();
- });
- //自动联想
- $('.autocomplete').dropdown({
- readOnly: true,
- //data: datas,
- 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"));
- }
- });
- getServiceType()
- function getServiceType() {
- $.ajax({
- url: pagePath + "/government/projectMatters/getProjectServicetype/3",
- 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('系统错误!');
- }
- });
- }
- //取消
- function removeIframe() {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- }
- //默认状态为草稿
- var state = '0';
- $("#form-add").validate({
- rules: {
- project_service_type: {
- required: true,
- },
- project_source: {
- required: true,
- },
- is_comprehensive: {
- required: true,
- },
- is_street_audit: {
- required: true,
- },
- project_name: {
- required: true,
- },
- year: {
- required: true,
- },
- content: {
- required: true,
- },
- start_time: {
- required: true,
- },
- end_time: {
- required: true,
- },
- next_step: {
- required: true,
- },
- is_public: {
- required: true,
- },
- },
- onkeyup: false,
- focusCleanup: true,
- focusInvalid: false,
- success: "valid",
- submitHandler: function (form) {
- if ($("#project_service_type").val() == null) {
- errorMessage('请选择申报项');
- return false;
- }
- if (editor.isEmpty()) {
- errorMessage('请输入项目内容');
- return false;
- } else if (editor.text().length > 2000) {
- //errorMessage('项目内容最多2000字');
- //return false;
- }
- /*if (state == '1') {
- if ($('input[name="is_public"]:checked').val() == 0) {
- if ($("#pushNames").text().length <= 0) {
- errorMessage('请选择推送对象');
- return false;
- }
- }
- }*/
- $(form).ajaxSubmit({
- type: 'post',
- url: pagePath + "/government/projectMatters/save",
- 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 + "/government/projectMatters/save",
- 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 preview(title, url, w, h) {
- layer_show(title, pagePath + url, w, h);
- }
- //是否综合
- $('#departmentAndType').show()
- function changeDepartment() {
- if ($("input[name='is_comprehensive']:checked").val() == 1) {
- $('#is_serial_btn').hide();
- $('#department').hide();
- $('#department_two').hide();
- $('#departmentAndType').show()
- } else if ($("input[name='is_comprehensive']:checked").val() == 0) {
- $('#departmentAndType').hide()
- $('#is_serial_btn').show();
- if ($("input[name='is_serial']:checked").val() == 1) {
- $('#department').hide();
- $('#department_two').show();
- } else {
- $('#department_two').hide();
- $('#department').show();
- }
- }
- }
- //添加属地相关
- function addLine(projectService) {
- if (projectService) {
- if (projectService.length > 0) {
- for (var i = 0; i < projectService.length; i++) {
- var length = i;
- var html = "<i class='Hui-iconfont' onclick='removeLine(this)'></i>";
- $(".add_floor_line tr:eq(0)").clone().insertAfter($('.add_floor_line>tr').eq(-1))
- .find(".name1").removeAttr("name").attr("name", "projectServiceCategory[" + i + "].project_type_name1").end()
- .find(".name1").val(projectService[i].project_type_name1).end()
- .find(".name2").removeAttr("name").attr("name", "projectServiceCategory[" + i + "].project_type_name2").end()
- .find(".name2").val(projectService[i].project_type_name2).end()
- .find(".department").removeAttr("name").attr("name", "projectServiceCategory[" + i + "].department_id").end()
- .find(".icon_font").html(html).end();
- $(".add_floor_line tr:eq(" + (i + 1) + ")").find("option[value='" + projectService[i].department_id + "']").attr("selected", true);
- }
- $(".add_floor_line tr:eq(0)").remove();
- }
- } else {
- var length = $(".add_floor_line tr").length;
- var html = "<i class='Hui-iconfont' onclick='removeLine(this)'></i>";
- $(".add_floor_line tr:eq(0)").clone().insertAfter($('.add_floor_line>tr').eq(-1))
- .find(".name1").removeAttr("name").attr("name", "projectServiceCategory[" + length + "].project_type_name1").end()
- .find(".name1").val("").end()
- .find(".name2").removeAttr("name").attr("name", "projectServiceCategory[" + length + "].project_type_name2").end()
- .find(".name2").val("").end()
- .find(".department").removeAttr("name").attr("name", "projectServiceCategory[" + length + "].department_id").end()
- .find(".icon_font").html(html).end();
- $('#layui-layer2').height(48);
- }
- }
- function removeLine(obj) {
- if ($(".add_floor_line").find("tr").length == 1) {
- errorMessage("至少添加一个类目");
- } else {
- $(obj).parent().parent().remove();
- }
- }
- </script>
- </body>
- </html>
|