| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404 |
- <!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>
- </head>
- <body layout:fragment="content">
- <style>
- dl dd label {
- display: inline-block;
- padding: 5px 20px;
- }
- input[type="checkbox"] {
- margin-right: 5px;
- }
- </style>
- <article class="page-container">
- <form class="form form-horizontal" id="form-notify-addPush" th:action="@{/projectFilling/addPushSearch}">
- <input type="hidden" id="notify_id" th:name="id" th:value="${id}"/>
- <input type="hidden" id="notify_detail_id" th:name="notify_detail_id" th:value="${notify_detail_id}"/>
- <input type="hidden" name="directPush" th:name="directPush" th:value="${directPush}"/>
- <input type="hidden" name="firstAdd" th:name="firstAdd" th:value="${firstAdd}"/>
- <div class="row cl">
- <input type="hidden" name="street_ids" id="street_ids"/>
- <dl class="cl permission-list" th:if="${userType}=='0'">
- <dt>
- <label class=""><input onchange="setTimeout(function(){getStreet_ids();getBuilds();},200);"
- type="checkbox">街道</label>
- </dt>
- <dd class="pushStreetsList">
- <label class="" th:each="street,iterStat:${streetList}" th:object="${street}">
- <input type="checkbox" th:value="*{id}" th:id="*{id}" th:streetName="*{name}" th:text="*{name}"
- th:checked="*{isChecked}" onchange="getStreet_ids();getBuilds();">
- <span class="c-red" th:if="*{isPush}">已推送</span>
- </label>
- </dd>
- </dl>
- </div>
- <div class="row cl">
- <input type="hidden" name="build_ids" id="build_ids"/>
- <dl class="cl permission-list" th:if="${userType}=='0'">
- <dt>
- <label class=""><input type="checkbox"
- onchange="setTimeout(function(){getBuild_ids();getCompanys();},200);">园区</label>
- </dt>
- <dd class="pushBuildsList">
- <label class="" th:each="build,iterStat:${buildList}" th:object="${build}">
- <input type="checkbox" th:value="*{id}" th:buildName="*{name}" th:name="builds" th:id="*{id}"
- th:text="*{name}"
- th:checked="*{isChecked}" onchange="getBuild_ids();getCompanys();">
- <span class="c-red" th:if="*{isPush}">已推送</span>
- </label>
- </dd>
- </dl>
- <dl class="cl permission-list" th:if="${userType}=='4'">
- <dt>
- <label class=""><input type="checkbox" onchange="getBuild_ids();getCompanys();">园区</label>
- </dt>
- <dd class="pushBuildsList">
- <label class="" th:each="build,iterStat:${buildList}" th:object="${build}">
- <input type="checkbox" th:value="*{id}" th:buildName="*{name}" th:name="builds" th:id="*{id}"
- th:text="*{name}"
- th:checked="*{isChecked}" onchange="getBuild_ids();getCompanys();">
- <span class="c-red" th:if="*{isPush}">已推送</span>
- </label>
- </dd>
- </dl>
- </div>
- <div class="row cl">
- <input type="hidden" name="company_ids" id="company_ids"/>
- <div style="margin:10px;">
- <input th:name="company_name" th:value="${searchCompany.company_name}" type="text" class="input-text"
- style="width:250px" placeholder="输入企业名称"/>
- <label>企业性质:</label>
- <span class="select-box" style="width:250px">
- <select class="select" th:name="type">
- <option value="">--请选择--</option>
- <option th:selected="${searchCompany.type}==*{value}"
- th:each="type,iterStat:${companyTypeList}" th:object="${type}"
- th:value="*{value}" th:text="*{name}"></option>
- </select>
- </span>
- <button class="btn btn-success" type="submit">
- <i class="Hui-iconfont"></i>搜索
- </button>
- </div>
- <table id="companyTb" class="table table-border table-bordered table-bg table-hover">
- <thead>
- <tr class="text-c">
- <th><input type="checkbox" id="all" name="" value=""/></th>
- <th>企业名称</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- <tbody class="pushCompanyList" id="pushCompanyList">
- <tr class="text-c" th:each="company,iterStat:${companyList}"
- th:object="${company}">
- <td><input type="checkbox" th:companyName="*{company_name}" th:checked="*{isChecked}" th:id="*{id}"
- th:value="*{id}" onchange="getCompany_ids()"/></td>
- <td>
- <span th:name="company_name" th:text="*{company_name}"></span>
- <span class="c-red" th:if="*{isPush}">已推送</span>
- </td>
- </tr>
- </tbody>
- </table>
- <div th:replace="admin/common/page :: page"></div>
- </div>
- <div class="row cl">
- <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2" th:if="${directPush}">
- <a class="btn btn-primary radius" title="推送" href="javascript:;" onclick="send()"
- style="text-decoration:none;padding: 4px 16px">推送</a>
- <button onClick="removeIframe();" class="btn btn-default radius" type="button"> 取消 </button>
- </div>
- <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2" th:unless="*{directPush}">
- <button class="btn btn-primary radius" type="submit" onClick="savePush();"><i class="Hui-iconfont"></i>
- 保存
- </button>
- <button onClick="removeIframe();" class="btn btn-default radius" type="button"> 取消 </button>
- </div>
- </div>
- </form>
- </article>
- <script type="text/javascript" th:src="@{/js/common/page.js}"></script>
- <script th:inline="javascript">
- $(function () {
- $(".permission-list dt input:checkbox").click(function () {
- $(this).closest("dl").find("dd input:checkbox").prop("checked", $(this).prop("checked"));
- //$(this).trigger('change');
- });
- $(".permission-list dd input:checkbox").click(function () {
- var l = $(this).parent().parent().find("input:checked").length;
- if ($(this).prop("checked")) {
- $(this).closest("dl").find("dt input:checkbox").prop("checked", true);
- if (l == $(this).parent().parent().find("input").length) {
- //$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked", true);
- $(this).closest("dl").find("dt input:checkbox").prop("checked", true);
- }
- else {
- $(this).closest("dl").find("dt input:checkbox").prop("checked", false);
- }
- }
- else {
- $(this).closest("dl").find("dt input:checkbox").prop("checked", false);
- //if (l == 0) {
- // $(this).closest("dl").find("dt input:checkbox").prop("checked", false);
- //}
- }
- });
- //
- $(".permission-list").find("dt input:checkbox").each(function () {
- var length = $(this).parents(".permission-list").find("dd input:checkbox").length;
- var checkedLength = $(this).parents(".permission-list").find("dd input:checked").length;
- if (length > 0 && length == checkedLength) {
- $(this).prop("checked", true);
- }
- });
- //添加页面根据父页面数据回显
- if ($('input[name="directPush"]').val() == "false" && $('input[name="firstAdd"]').val() == "true") {
- loadSelectedItems();
- }
- //
- getStreet_ids();
- getBuild_ids();
- getCompany_ids();
- });
- /**
- * 取消
- */
- function removeIframe() {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- }
- function getBuilds() {
- var chlength = $('.pushStreetsList').find('input[type="checkbox"]:checked').length;
- var street_ids = '';
- $('.pushStreetsList').find('input[type="checkbox"]:checked').each(function (i, item) {
- street_ids = street_ids + $(this).attr("value") + ",";
- });
- street_ids = street_ids.substring(0, street_ids.length - 1);
- if (street_ids.length > 0) {
- $.ajax({
- url: pagePath + "/projectFilling/getBuildsByStreetIds",
- type: "post",
- data: {
- 'street_ids': street_ids,
- 'id': $("#notify_id").val()
- },
- dataType: "json",
- success: function (result) {
- if (result.success) {
- //smileMessage(result.message)
- var buildList = result.obj;
- bindBuild(buildList);
- getCompanys();
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- } else {
- $(".pushBuildsList").empty();
- $("#companyTb").find("tbody tr").remove();
- $("#paging").hide();
- }
- }
- function bindBuild(buildList) {
- $(".pushBuildsList").empty();
- for (var i = 0; i < buildList.length; i++) {
- var label = '<label class="">';
- label += '<input type="checkbox" value="' + buildList[i].id + '" buildName="' + buildList[i].name + '" id="' + buildList[i].id + '" onchange="getBuild_ids();getCompanys();">';
- label += buildList[i].name;
- //label += '<span class="c-red" th:if="*{isPush}">已推送</span>';
- label += '</label>';
- if (buildList[i].isPush) {
- label += '<span class="c-red" >已推送</span>';
- }
- $(".pushBuildsList").append(label);
- }
- getBuild_ids();
- }
- function getCompanys() {
- $("#form-notify-addPush").submit();
- }
- function getStreet_ids() {
- var street_ids = '';
- $('.pushStreetsList').find('input[type="checkbox"]:checked').each(function (i, item) {
- street_ids = street_ids + $(this).attr("value") + ",";
- });
- street_ids = street_ids.substring(0, street_ids.length - 1);
- $("#street_ids").val(street_ids);
- return street_ids;
- }
- function getBuild_ids() {
- 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);
- $("#build_ids").val(build_ids);
- return build_ids;
- }
- function getCompany_ids() {
- var company_ids = '';
- $('.pushCompanyList').find('input[type="checkbox"]:checked').each(function (i, item) {
- company_ids = company_ids + $(this).attr("value") + ",";
- });
- company_ids = company_ids.substring(0, company_ids.length - 1);
- $("#company_ids").val(company_ids);
- return company_ids;
- }
- /**
- * 保存推送单位
- * */
- function savePush() {
- var chlength = $('.pushStreetsList').find('input[type="checkbox"]:checked').length;
- var street_ids = '';
- var street_names = '';
- $('.pushStreetsList').find('input[type="checkbox"]:checked').each(function (i, item) {
- street_ids = street_ids + $(this).attr("value") + ",";
- street_names = street_names += $(this).attr("streetName") + ",";
- });
- street_ids = street_ids.substring(0, street_ids.length - 1);
- street_names = street_names.substring(0, street_names.length - 1);
- var chlength = $('.pushBuildsList').find('input[type="checkbox"]:checked').length;
- var build_ids = '';
- var build_names = '';
- $('.pushBuildsList').find('input[type="checkbox"]:checked').each(function (i, item) {
- build_ids = build_ids + $(this).attr("value") + ",";
- build_names = build_names + $(this).attr("buildName") + ",";
- });
- build_ids = build_ids.substring(0, build_ids.length - 1);
- build_names = build_names.substring(0, build_names.length - 1);
- var chlength = $('.pushCompanyList').find('input[type="checkbox"]:checked').length;
- var company_ids = '';
- var company_names = '';
- $('.pushCompanyList').find('input[type="checkbox"]:checked').each(function (i, item) {
- company_ids = company_ids + $(this).attr("value") + ",";
- company_names = company_names + $(this).attr("companyName") + ",";
- });
- company_ids = company_ids.substring(0, company_ids.length - 1);
- company_names = company_names.substring(0, company_names.length - 1);
- parent.$("#pushStreetIds").val(street_ids);
- parent.$("#pushBuildIds").val(build_ids);
- parent.$("#pushCompanyIds").val(company_ids);
- parent.$("#pushStreetNames").val(street_names);
- parent.$("#pushBuildNames").val(build_names);
- parent.$("#pushCompanyNames").val(company_names);
- /*parent.$("#pushNames").text(street_names+" "+build_names+" "+company_names);*/
- parent.$("#pushNames").text(company_names);
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- }
- /***
- * 直接推送
- * */
- function send() {
- var chlength = $('.pushStreetsList').find('input[type="checkbox"]:checked').length;
- var street_ids = '';
- var street_names = '';
- $('.pushStreetsList').find('input[type="checkbox"]:checked').each(function (i, item) {
- street_ids = street_ids + $(this).attr("value") + ",";
- street_names = street_names += $(this).attr("streetName") + ",";
- });
- street_ids = street_ids.substring(0, street_ids.length - 1);
- street_names = street_names.substring(0, street_names.length - 1);
- var chlength = $('.pushBuildsList').find('input[type="checkbox"]:checked').length;
- var build_ids = '';
- var build_names = '';
- $('.pushBuildsList').find('input[type="checkbox"]:checked').each(function (i, item) {
- build_ids = build_ids + $(this).attr("value") + ",";
- build_names = build_names + $(this).attr("buildName") + ",";
- });
- build_ids = build_ids.substring(0, build_ids.length - 1);
- build_names = build_names.substring(0, build_names.length - 1);
- var chlength = $('.pushCompanyList').find('input[type="checkbox"]:checked').length;
- var company_ids = '';
- var company_names = '';
- $('.pushCompanyList').find('input[type="checkbox"]:checked').each(function (i, item) {
- company_ids = company_ids + $(this).attr("value") + ",";
- company_names = company_names + $(this).attr("companyName") + ",";
- });
- company_ids = company_ids.substring(0, company_ids.length - 1);
- company_names = company_names.substring(0, company_names.length - 1);
- if (street_ids == '' && build_ids == '' && company_ids == '') {
- sadMessage("请选择推送单位!");
- return false;
- }
- $.ajax({
- url: pagePath + "/projectFilling/send",
- type: "post",
- data: {
- 'id': $("#notify_id").val(),
- 'notify_detail_id': $("#notify_detail_id").val(),
- 'street_ids': street_ids,
- 'street_names': street_names,
- 'build_ids': build_ids,
- 'build_names': build_names,
- 'company_ids': company_ids,
- 'company_names': company_names,
- },
- dataType: "json",
- success: function (result) {
- if (result.success) {
- smileMessage(result.message)
- setTimeClose();
- } else {
- errorMessage(result.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- function loadSelectedItems() {
- var selectedStreets = parent.$("#pushStreetIds").val();
- var selectedBuilds = parent.$("#pushBuildIds").val();
- var selectedCompanys = parent.$("#pushCompanyIds").val();
- $("#street_ids").val(selectedStreets);
- $("#build_ids").val(selectedBuilds);
- $("#company_ids").val(selectedCompanys);
- $("#form-notify-addPush").submit();
- }
- </script>
- </body>
- </html>
|