123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- // 详情弹框js start
- var pointId = '';
- var innerPage = 1;
- // 维保点位弹框
- $(document).on('click', 'a.view-detail', function() {
- let dataId = $(this).data('id'); // 单位ID
- pointId = dataId;
- queryPointDetailList = layer.open({
- type: 1,
- title: false,
- closeBtn: 0,
- shadeClose: false,
- skin: 'yourclass',
- area: [
- '700px', '500px'
- ],
- content: $(".queryPointDetailList"),
- success: function() {
- getPointDetailAjax({ "id": dataId })
- $('.clsBtn,.cancel').click(function() {
- innerPage = 1;
- layer.close(queryPointDetailList);
- })
- }
- })
- })
- // 获取列表 ajax请求
- function getPointDetailAjax(queryParam = {}, innerPage = 1) {
- queryParam.page = innerPage;
- queryParam.limit = 5; // 每页显示条数
- queryParam.start = (queryParam.page - 1) * queryParam.limit;
- ajaxRequest(RECORD_AND_POINT, "POST", queryParam, function(result) {
- let data = result.RESULT;
- let items = '';
- if (result.totalCount > 0) {
- data.forEach(function(item, key) {
- items += "<tr>" + "<td class='status'></td>" + "<td>" + item.spot_name + "</td>" + "<td>" + item.spot_address + "</td>" + "<td>" + item.wcqk +
- "</td>" + "<td>" + item.wbr + "</td>" + "<td>" + item.wc_time + "</td>" +
- "<td ><a class='pointDetail' data-id=" + item.dwid + "><img src='../../images/tupianbtn.png'></a></td>" + "<td ><a class='weibaoReport' data-id=" + item.jlid + "><img src='../../images/tupianbtn.png'></a></td>" + "</tr>"
- })
- $('#dataList2').html(items);
- } else {
- $('#dataList2').html('');
- }
- // console.log(result)
- totalPages = result.totalCount / result.limit;
- totalPages = Math.ceil(totalPages);
- $('#totalPage2').html(totalPages); // 总共多少页
- $('#dataTotal2').html(result.totalCount); // 总共多少条数据
- $('#currentPage2').val(innerPage); // 当前页面
- let pageFrom = (innerPage - 1) * result.limit + 1; // 开始
- let pageTo = result.page * result.limit; // 结束
- pageTo = pageTo > result.totalCount ? result.totalCount : pageTo;
- $('#pageFrom2').html(pageFrom);
- $('#pageTo2').html(pageTo);
- // 无数据时
- if (!result.totalCount) {
- $('.pager2.has-data').hide()
- $('.pager2.no-data').show()
- } else {
- $('.pager2.has-data').show()
- $('.pager2.no-data').hide()
- }
- if (innerPage < totalPages) {
- $('#nextPageButton2,#lastPageButton2').removeClass('disabled');
- } else {
- $('#nextPageButton2,#lastPageButton2').addClass('disabled');
- }
- if (innerPage === 1) {
- $('#firstPageButton2,#prevPageButton2').addClass('disabled');
- } else {
- $('#firstPageButton2,#prevPageButton2').removeClass('disabled');
- }
- }, function(errorMsg) {
- alert("请求数据失败!");
- }, 3)
- };
- // 分页操作
- $('#firstPageButton2').on('click', function() {
- innerPage = 1;
- getPointDetailAjax(getSearchParamObj2(), 1);
- });
- $('#lastPageButton2').on('click', function() {
- innerPage = totalPages;
- getPointDetailAjax(getSearchParamObj2(), innerPage);
- });
- $('#prevPageButton2').on('click', function() {
- innerPage -= 1;
- getPointDetailAjax(getSearchParamObj2(), innerPage);
- });
- $('#nextPageButton2').on('click', function() {
- innerPage += 1;
- getPointDetailAjax(getSearchParamObj2(), innerPage);
- })
- // 按钮搜索
- $('#buttonSearch2').on('click', function() {
- innerPage = 1;
- getPointDetailAjax(getSearchParamObj2());
- })
- // 拼接搜索条件
- function getSearchParamObj2() {
- let queryParam = {};
- let weibao = $('#weibao').val();
- queryParam.data3 = weibao;
- queryParam.id = pointId;
- return queryParam;
- }
- // 分页刷新按钮
- $('.pg-refresh2').click(resetForm);
- // 重置表单
- function resetForm() {
- innerPage = 1;
- $("#weibao").val("0");
- getPointDetailAjax(getSearchParamObj2());
- }
- //点位详情弹框
- $(document).on('click', 'a.pointDetail', function(event) {
- let dwId = $(this).data('id');
- layerDepartmentIndex = layer.open({
- type: 1,
- title: false,
- closeBtn: 0,
- shadeClose: false,
- skin: 'yourclass',
- area: [
- '400px', '400px'
- ],
- content: $(".pointDetailOut"),
- success: function() {
- ajaxRequest(RECORD_POINT_DETAIL, "POST", { "id": dwId }, function(result) {
- console.log(result.RESULT[0])
- var data = result.RESULT[0];
- $('#pointDetailUrl').attr('src', data.picture_route);
- }, function(errorMsg) {
- alert("请求数据失败!");
- }, 3);
- $('.clsBtn2,.cancel2').click(function() {
- innerPage = 1;
- layer.close(layerDepartmentIndex);
- })
- }
- })
- event.stopPropagation();
- })
- //维保报告点击
- $(document).on('click', 'a.weibaoReport', function(event) {
- let jlId = $(this).data('id'); //单位ID
- layerReportIndex = layer.open({
- type: 1,
- title: false,
- closeBtn: 0,
- shadeClose: false,
- skin: 'yourclass',
- area: [
- '400px', '400px'
- ],
- content: $(".weibaoReportOut"),
- success: function() {
- ajaxRequest(RECORD_AND_POINT, "POST", { "jlid": jlId }, function(result) {
- console.log(result.RESULT[0])
- var data = result.RESULT[0];
- if (data.wcqk == '未完成') {
- $('.weibaoReportOut .imgOut').html('<p style="margin:30px"> 未完成...</p> ')
- } else {
- $('#weibaoReportUrl').attr('src', BASEURL + data.report_photos);
- }
- }, function(errorMsg) {
- alert("请求数据失败!");
- }, 3);
- $('.clsBtn3,.cancel3').click(function() {
- innerPage = 1;
- layer.close(layerReportIndex);
- })
- }
- })
- event.stopPropagation();
- })
|