1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216 |
- function gtTimeReleaseArticle() {
- lyupload();
- get("/article/publicRemind", true, {}, function (res) {
- if (res.result) {
- // 左边列
- $("#gt7d").empty();
- var twoWeek = res.data.twoWeek;
- var str = '';
- var depts = Object.keys(twoWeek);
- for (var i = 0; i < Object.keys(twoWeek).length; i++) {
- var deptName = depts[i];
- var data = twoWeek[deptName];
- str += '<li class="layui-collapse"> <div class="layui-colla-item">'
- + '<p class="messageName layui-colla-title"><a class="layui-font-blue click-hover" href="'
- + data.deptUrl
- + '" target="_blank" style="margin-left: 15px;">'
- + deptName
- + '<span class="layui-badge-dot layui-bg-blue badge">' + data.count + '</span>'
- + '</a><span class="dx-title click-hover click-event-dxtx" data-deptname="'
- + deptName
- + '">短信提醒</span></p><div class="layui-colla-content">';
- for (var j = 0; j < data.records.length; j++) {
- var data1 = data.records[j];
- str += '<p class="sameMessage">栏目:<a class="layui-font-blue click-hover" href="' + data1.lastUpdateUrl + '"' +
- ' target="_blank">' + data1.columnName + '</a></p>'
- + '<p class="sameMessage sameMessagesec">最近更新:' + data1.lastUpdate.split(' ')[0].replaceAll("-", ".") + '</p>'
- }
- str += '</div></div></li>';
- }
- $("#gt7d").html(str);
- // 中间列
- $("#gt1m").empty();
- var threeMonth = res.data.threeMonth;
- var str = '';
- var depts = Object.keys(threeMonth);
- for (var i = 0; i < Object.keys(threeMonth).length; i++) {
- var deptName = depts[i];
- var data = threeMonth[deptName];
- str += '<li class="layui-collapse"> <div class="layui-colla-item">'
- + '<p class="messageName layui-colla-title"><a class="layui-font-blue click-hover" href="'
- + data.deptUrl
- + '" target="_blank" style="margin-left: 15px;">'
- + deptName
- + '<span class="layui-badge-dot layui-bg-blue badge">' + data.count + '</span>'
- + '</a><span class="dx-title click-hover click-event-dxtx" data-deptname="'
- + deptName
- + '">短信提醒</span></p><div class="layui-colla-content">';
- for (var j = 0; j < data.records.length; j++) {
- var data1 = data.records[j];
- str += '<p class="sameMessage">栏目:<a class="layui-font-blue click-hover" href="' + data1.lastUpdateUrl + '"' +
- ' target="_blank">' + data1.columnName + '</a></p>'
- + '<p class="sameMessage sameMessagesec">最近更新:' + data1.lastUpdate.split(' ')[0].replaceAll("-", ".") + '</p>'
- }
- str += '</div></div></li>';
- }
- $("#gt1m").html(str);
- // 右边列
- $("#gt3m").empty();
- var sixMonth = res.data.sixMonth;
- var str = '';
- var depts = Object.keys(sixMonth);
- for (var i = 0; i < Object.keys(sixMonth).length; i++) {
- var deptName = depts[i];
- var data = sixMonth[deptName];
- str += '<li class="layui-collapse"> <div class="layui-colla-item">'
- + '<p class="messageName layui-colla-title"><a class="layui-font-blue click-hover" href="'
- + data.deptUrl
- + '" target="_blank" style="margin-left: 15px;">'
- + deptName
- + '<span class="layui-badge-dot layui-bg-blue badge">' + data.count + '</span>'
- + '</a><span class="dx-title click-hover click-event-dxtx" data-deptname="'
- + deptName
- + '">短信提醒</span></p><div class="layui-colla-content">';
- for (var j = 0; j < data.records.length; j++) {
- var data1 = data.records[j];
- str += '<p class="sameMessage">栏目:<a class="layui-font-blue click-hover" href="' + data1.lastUpdateUrl + '"' +
- ' target="_blank">' + data1.columnName + '</a></p>'
- + '<p class="sameMessage sameMessagesec">最近更新:' + data1.lastUpdate.split(' ')[0].replaceAll("-", ".") + '</p>'
- }
- str += '</div></div></li>';
- }
- $("#gt3m").html(str);
- $("#gt1y").empty();
- var oneYear = res.data.oneYear;
- var str = '';
- var depts = Object.keys(oneYear);
- for (var i = 0; i < Object.keys(oneYear).length; i++) {
- var deptName = depts[i];
- var data = oneYear[deptName];
- str += '<li class="layui-collapse"> <div class="layui-colla-item">'
- + '<p class="messageName layui-colla-title"><a class="layui-font-blue click-hover" href="'
- + data.deptUrl
- + '" target="_blank" style="margin-left: 15px;">'
- + deptName
- + '<span class="layui-badge-dot layui-bg-blue badge">' + data.count + '</span>'
- + '</a><span class="dx-title click-hover click-event-dxtx" data-deptname="'
- + deptName
- + '">短信提醒</span></p><div class="layui-colla-content">';
- for (var j = 0; j < data.records.length; j++) {
- var data1 = data.records[j];
- str += '<p class="sameMessage">栏目:<a class="layui-font-blue click-hover" href="' + data1.lastUpdateUrl + '"' +
- ' target="_blank">' + data1.columnName + '</a></p>'
- + '<p class="sameMessage sameMessagesec">最近更新:' + data1.lastUpdate.split(' ')[0].replaceAll("-", ".") + '</p>'
- }
- str += '</div></div></li>';
- }
- $("#gt1y").html(str);
- element.init();
- $(".layui-colla-title").on("click", "a", function (event) {
- layui.stope(event);
- })
- $(".layui-colla-title").on("click", ".click-event-dxtx", function (event) {
- layui.stope(event);
- var deptname = $(this).attr("data-deptname");
- var dom = $(this);
- $("#dxtxForm").html("");
- get("/api/smsmessage/getTelephoneByDeptname", true, {
- "deptname": deptname
- }, function (res) {
- if (res.result) {
- var data = res.data;
- // 去掉点击标识
- $('span[data-click="click"]').removeAttr('data-click');
- // 添加点击标识
- dom.attr("data-click", "click");
- openCheckPhoneWindows(data);
- } else {
- if (res.msg) {
- layer.msg(res.msg);
- } else {
- layer.msg("查询失败");
- }
- }
- }, function (err) {
- layer.msg("查询失败");
- })
- })
- }
- }, function (err) {
- })
- }
- function openCheckPhoneWindows(data) {
- if (!data) {
- layer.msg("缺失联系方式,不能发送短信");
- return;
- }
- var str = "";
- if (data.mainLeader && data.mainLeaderPhone) {
- str += '<div class="layui-form-item" style="margin-left:10px;height: 40px;">'
- + '<div class="layui-form-block">'
- + '<input type="checkbox" value="0" title="'
- + data.mainLeader + '(主要领导)(' + data.mainLeaderPhone + ')'
- + '" lay-skin="primary">'
- + '</div>'
- + '</div>';
- }
- if (data.leaderperson && data.leaderphone) {
- str += '<div class="layui-form-item" style="margin-left:10px;height: 40px;">'
- + '<div class="layui-form-block">'
- + '<input type="checkbox" value="1" title="'
- + data.leaderperson + '(分管领导)(' + data.leaderphone + ')'
- + '" lay-skin="primary">'
- + '</div>'
- + '</div>';
- }
- if (data.workperson && data.workphone) {
- str += '<div class="layui-form-item" style="margin-left:10px;height: 40px;" >'
- + '<div class="layui-form-block">'
- + '<input type="checkbox" value="2" title="'
- + data.workperson + '(工作人员)(' + data.workphone + ')'
- + '" lay-skin="primary">'
- + '</div>'
- + '</div>';
- }
- if (!str) {
- layer.msg("缺失联系方式,不能发送短信");
- return;
- }
- window.TELEPHONES = data;
- $("#dxtxForm").append(str);
- form.render();
- layer.open({
- type: 1,
- title: '短信发送的人员',
- content: $('#dxtxDiv'),
- area: ['300px'],
- btn: ['发送'],
- yes: function (index, layero) {
- var types = new Array();
- $('#dxtxForm input[type=checkbox]:checked').each(function () {
- types.push($(this).val());
- });
- if (types.length == 0) {
- layer.msg("请选择人员");
- return;
- }
- addMessage(types, index);
- },
- });
- }
- function addMessage(types, index) {
- var telephones = new Array();
- if (window.TELEPHONES) {
- var data = window.TELEPHONES;
- for (var i = 0; i < types.length; i++) {
- var type = types[i];
- if (type == "0") {
- telephones.push({
- "deptname": data.deptname,
- "telephone": data.mainLeaderPhone,
- "person": data.mainLeader,
- "type": type
- })
- } else if (type == "1") {
- telephones.push({
- "deptname": data.deptname,
- "telephone": data.leaderphone,
- "person": data.leaderperson,
- "type": type
- })
- } else if (type == "2") {
- telephones.push({
- "deptname": data.deptname,
- "telephone": data.workphone,
- "person": data.workperson,
- "type": type
- })
- }
- }
- }
- // 获取栏目
- var columnEle = $($('span[data-click="click"]').parents('div')[0]).children('div').children('p').children('a');
- var columns = [];
- columnEle.each(function () {
- columns.push($(this).text());
- })
- post("/api/smsmessage/add", true, {
- "telephones": JSON.stringify(telephones),
- "senduerid": sessionStorage.USERID,
- "columns": columns.join(',')
- }, function (res) {
- if (res.result) {
- layer.close(index);
- layer.msg("提醒成功");
- } else {
- layer.msg(res.msg);
- }
- }, function (err) {
- layer.msg('提醒失败');
- })
- }
- var initStatus = true;
- function lyupload() {
- if (initStatus) {
- var type = 0, deptId = 0;
- get("/user/selectDept", true, {}, function (res) {
- $('#deptIdSelect').empty();
- $('#deptIdSelect2').empty();
- if (res.result) {
- var html = '';
- for (var i = 0; i < res.data.length; i++) {
- html += '<option value="' + res.data[i].deptid + '">' + res.data[i].deptname + '</option>';
- }
- deptId = res.data[0].deptid;
- $('#deptIdSelect').append(html);
- $('#deptIdSelect2').append(html);
- form.render('select');
- }
- }, function (err) {
- });
- //发布提醒
- $("#publishReminder").click(function () {
- $(".remindList").css("display", "none");
- $(".clearfix").css("display", "none");
- $(".w-sms-record").css("display", "none");
- $(".sms").css("display", "none");
- $("#publishTable").css("display", "block");
- layui.use('table', function () {
- var table = layui.table;
- table.render({
- elem: '#publish'
- , method: 'get'
- , url: PATH + '/excelList/showExcelList'
- , skin: 'line'
- , even: true
- , page: {
- limit: 10,
- limits: [5, 10, 15],
- first: "首页", //不显示首页
- last: "尾页" //不显示尾页
- }
- , cols: [[
- {field: 'id', title: '序号', sort: true, unresize: false, type: "numbers", width: 150}
- , {field: 'deptname', title: '部门名称', width: 250}
- , {field: 'hName', title: '文档名称', width: 450}
- , {field: 'downloadTime', title: '下载时间', width: 258}
- ]], parseData: function (res) {
- var result = res.data;
- return {
- "code": res.code,//解析接口状态
- "msg": res.msg,//解析提示文本
- "count": res.total,//解析数据长度
- "data": result//解析数据列表
- };
- }
- });
- });
- })
- $("#reBack").click(function () {
- $(".remindList").css("display", "block");
- $(".clearfix").css("display", "block");
- $("#publishTable").css("display", "none")
- })
- // 错敏字
- $("#errorSensitiveWord").unbind("click");
- // $("#errorSensitiveWord").on('click', function() {
- // errorSensitive(index);
- // }) ;
- // console.log("initStatus="+initStatus)
- $('#errorSensitiveWord').on('click', function () {
- index = layer.open({
- type: 1,
- title: '错敏字上传',
- area: ['600px', '400px'], //宽高
- content: $('#ly-upload2'),
- success: function (layero, index) {
- $('#ly-upload2').removeClass('layui-hide');
- $('#ly-type2').val(2)
- type = 2;
- var LayuiLayerShadeLenght = $(".layui-layer-shade").length;
- if (LayuiLayerShadeLenght > 1) {
- console.log(LayuiLayerShadeLenght);
- $(".layui-layer-shade").css({"z-index": "9999"});
- }
- },
- end: function () {
- $('#ly-form2')[0].reset();
- $('#ly-upload2').addClass('layui-hide');
- $(".layui-layer-shade").remove();
- var html = $('#ly-file2').next().next();
- console.log(html)
- if (html.length > 0) {
- html.remove();
- }
- }
- });
- });
- // 报告
- $("#testReport").unbind("click");
- // $("#testReport").on('click', function() {
- // oneCl(index);
- // }) ;
- $('#testReport').on('click', function () {
- index = layer.open({
- type: 1,
- title: '测评报告上传',
- area: ['600px', '400px'], //宽高
- content: $('#ly-upload'),
- success: function (layero, index) {
- $('#ly-upload').removeClass('layui-hide');
- $('#ly-type').val(1)
- type = 1;
- var LayuiLayerShadeLenght = $(".layui-layer-shade").length;
- if (LayuiLayerShadeLenght > 1) {
- console.log(LayuiLayerShadeLenght);
- // $(".layui-layer-shade").css({"background-color":"9999"});
- $(".layui-layer-shade").css({"z-index": "9999"});
- }
- },
- end: function () {
- $('#ly-form')[0].reset();
- $('#ly-upload').addClass('layui-hide');
- $(".layui-layer-shade").remove();
- var html = $('#ly-file').next().next();
- console.log(html)
- if (html.length > 0) {
- html.remove();
- }
- }
- });
- });
- $('#ly-back').on('click', function () {
- layer.close(index);
- $('#ly-form')[0].reset();
- var html = $('#ly-file').next().next();
- console.log(html)
- if (html.length > 0) {
- html.remove();
- }
- });
- $('#ly-back2').on('click', function () {
- layer.close(index);
- $('#ly-form2')[0].reset();
- var html = $('#ly-file2').next().next();
- console.log(html)
- if (html.length > 0) {
- html.remove();
- }
- });
- $('#ly-back-sms').on('click', function () {
- layer.close(index);
- });
- $('#ly-ljbtn-sms').on('click', function () {
- let phones = []
- let arr = smsView.phoneSelect.getValue()
- for (let i = 0; i < arr.length; i++) {
- const p = arr[i].value.replace(/\s/g, "")
- if (!phones.includes(p)) {
- phones.push(p)
- }
- }
- let arr2 = $("#ly-sms-phone .layui-btn")
- for (let i = 0; i < arr2.length; i++) {
- const p = $(arr2[i]).text().replace(/\s/g, "")
- if (!phones.includes(p)) {
- phones.push(p)
- }
- }
- if (!phones.length) {
- layer.msg("请输入手机号", {icon: 5});
- return false;
- }
- if (!$('#ly-sms-remark').val()) {
- layer.msg("请输入短信内容", {icon: 5});
- return false;
- }
- const indexss = layer.load(2)
- smsView.sendMsg(phones, 0, indexss)
- // post("/smsmessage/sendSms", true, {
- // 'phone': $('#ly-sms-phone').val(),
- // 'content': $('#ly-sms-remark').val()
- // }, function (res) {
- // if (res.result) {
- // layer.close(index);
- // layer.msg('发送成功!');
- // }
- // }, function (err) {
- // });
- })
- $('#smsSendRecord').on('click', function () {
- reloadSmsTable();
- $(".remindList").css("display", "none");
- $(".clearfix").css("display", "none");
- $("#publishTable").css("display", "none");
- $(".w-sms-record").css("display", "block");
- $('.sms').css('display', 'none');
- });
- $('#modify').on('click', function () {
- $(".remindList").css("display", "none");
- $(".clearfix").css("display", "none");
- $("#publishTable").css("display", "none");
- $(".w-sms-record").css("display", "none");
- $(".sms").css("display", "block");
- updatePersonTable.reload();
- });
- $('.w-sms-tab li').on('click', function () {
- //$('.w-sms-tab li').each(function() {
- // $(this).removeClass('w-sms-tab-this');
- //});
- //$(this).addClass('w-sms-tab-this');
- });
- initSmsTable();
- initUp();
- initUp2();
- initStatus = false;
- }
- }
- function initUp() {
- var index1;
- upload.render({
- elem: '#ly-file'
- , url: PATH+'/webCore/uploadWord'
- , auto: false
- , exts: 'ppt|pptx|doc|docx|xls|xlsx|mp4'
- , accept: 'file'
- //,multiple: true
- , bindAction: '#ly-ljbtn',
- before: function (obj) {
- this.data = {
- 'type': $('#ly-type').val(),
- 'deptId': $('#deptIdSelect option:checked').val()
- }
- if ($('#ly-file').next().next().length == 0) {
- layer.msg('请选择上传文件', {icon: 5});
- return false;
- }
- index1 = layer.load(2);
- },
- choose: function (obj) {
- obj.preview(function (index, file, result) {
- console.log(file)
- var html = $('#ly-file').next().next();
- console.log(html)
- if (html.length == 0) {
- $('#ly-file').next().after('<span class="layui-inline layui-upload-choose">' + file.name + '</span>')
- }
- });
- }
- , done: function (res) {
- layer.msg('上传成功');
- $('#ly-type').val('');
- layer.close(index1);
- layer.close(index);
- }
- });
- }
- function initUp2() {
- var index2;
- upload.render({
- elem: '#ly-file2'
- , url: PATH+'/webCore/uploadWord'
- , auto: false
- , exts: 'xls|xlsx'
- , accept: 'file'
- //,multiple: true
- , bindAction: '#ly-ljbtn2',
- before: function (obj) {
- this.data = {
- 'type': $('#ly-type2').val(),
- 'deptId': $('#deptIdSelect2 option:checked').val()
- }
- if ($('#ly-file2').next().next().length == 0) {
- layer.msg('请选择上传文件', {icon: 5});
- return false;
- }
- index2 = layer.load(2);
- },
- choose: function (obj) {
- obj.preview(function (index, file, result) {
- console.log(file)
- var html = $('#ly-file2').next().next();
- console.log(html)
- if (html.length == 0) {
- $('#ly-file2').next().after('<span class="layui-inline layui-upload-choose">' + file.name + '</span>')
- }
- });
- }
- , done: function (res) {
- layer.msg('上传成功');
- $('#ly-type2').val('');
- layer.close(index2);
- layer.close(index);
- }
- });
- }
- function oneCl(index) {
- index = layer.open({
- type: 1,
- title: '测评报告上传',
- area: ['600px', '400px'], //宽高
- content: $('#ly-upload'),
- success: function (layero, index) {
- $('#ly-upload').removeClass('layui-hide');
- $('#ly-type').val(1);
- type = 1;
- $(':focus').blur();
- var LayuiLayerShadeLenght = $(".layui-layer-shade").length;
- if (LayuiLayerShadeLenght > 1) {
- console.log(LayuiLayerShadeLenght);
- // $(".layui-layer-shade").css({"background-color":"9999"});
- $(".layui-layer-shade").css({"z-index": "9999"});
- }
- },
- end: function () {
- $('#ly-form')[0].reset();
- $('#ly-upload').addClass('layui-hide');
- $(".layui-layer-shade").remove();
- var html = $('#ly-file').next().next();
- console.log(html)
- if (html.length > 0) {
- html.remove();
- }
- }
- });
- }
- function errorSensitive(index) {
- index = layer.open({
- type: 1,
- title: '错敏字上传',
- area: ['600px', '400px'], //宽高
- content: $('#ly-upload'),
- success: function (layero, index) {
- $('#ly-upload').removeClass('layui-hide');
- $('#ly-type').val(2)
- type = 2;
- $(':focus').blur();
- var LayuiLayerShadeLenght = $(".layui-layer-shade").length;
- if (LayuiLayerShadeLenght > 1) {
- console.log(LayuiLayerShadeLenght);
- // $(".layui-layer-shade").css({"background-color":"9999"});
- $(".layui-layer-shade").css({"z-index": "9999"});
- }
- },
- end: function () {
- $('#ly-form')[0].reset();
- $('#ly-upload').addClass('layui-hide');
- $(".layui-layer-shade").remove();
- var html = $('#ly-file').next().next();
- console.log(html)
- if (html.length > 0) {
- html.remove();
- }
- }
- });
- }
- $('#smsSend').on('click', function () {
- layer.open({
- type: 1,
- title: '短信发送',
- area: ['60%', '70%'], //宽高
- btn: ['发送', '关闭'],
- content: $('#ly-sms'),
- success: function (layero, index) {
- $('#ly-sms').removeClass('layui-hide');
- smsView.initPhones()
- smsView.initPhoneInput()
-
- },
- end: function () {
- $('#ly-sms').addClass('layui-hide');
- $('#ly-sms-phone').val('')
- $('#ly-sms-remark').val('')
- },
- btn1: function() {
- let phones = []
- // let arr = smsView.phoneSelect.getValue()
- // for (let i = 0; i < arr.length; i++) {
- // const p = arr[i].value.replace(/\s/g, "")
- // if (!phones.includes(p)) {
- // phones.push(p)
- // }
- // }
- let arr2 = $(".tags .layui-btn")
-
- for (let i = 0; i < arr2.length; i++) {
- const p = parseFloat($(arr2[i]).text().replace(/\s/g, ""))
- if (!phones.includes(p)) {
- phones.push(p)
- }
- }
- if (!phones.length) {
- layer.msg("请输入手机号", {icon: 5});
- return false;
- }
- if (!$('#ly-sms-remark').val()) {
- layer.msg("请输入短信内容", {icon: 5});
- return false;
- }
- const indexss = layer.load(2)
- smsView.sendMsg(phones, 0, indexss)
- },
- });
- });
- function initSmsTable() {
- table.render({
- elem: '#w-sms-wechat-table',
- url: PATH+'/smsmessage/getWechatSms',
- skin: 'line',
- cols: [[
- {width: 80, title: '序号', type: 'numbers'},
- {field: 'wName', title: '新媒体名称'},
- {field: 'wType', title: '类型'},
- {
- title: '分管领导', templet: function (d) {
- return d.leadName + " " + d.leadPhone;
- }
- },
- {
- title: '工作人员', templet: function (d) {
- return d.staffName + " " + d.staffPhone;
- }
- },
- {
- title: '提醒记录', templet: function (d) {
- return d.sendTime ? d.sendTime : '未提醒';
- }
- },
- {
- title: '操作', templet: function (d) {
- return '<a style="color:#1276ff;cursor: pointer;" onclick="initSmsTableDetail(\'' + d.staffName + '\',\'' + d.leadName + '\',\'' + (d.wType + '-' + d.wName) + '\',\'' + d.id + '\')">详情</a>' +
- '    <a style="color:#1276ff;cursor: pointer;" onclick="xg1(\'' + d.staffName + '\',\'' + d.leadName + '\',\'' + d.leadPhone + '\',\'' + d.staffPhone + '\',\'' + d.id + '\')">修改</a>';
- }
- }
- ]]
- });
- //网站短信记录
- table.render({
- elem: '#w-sms-website-table',
- url: PATH+'/websitesms/getWebsiteSms',
- skin: 'line',
- cols: [[
- {width: 80, title: '序号', type: 'numbers'},
- {
- field: 'sendContent', title: '部门名称', templet: function (d) {
- if (d.sendType == '1') {
- return "短信发送";
- } else if (d.sendType == '0') {
- return d.sendContent;
- }
- }
- },
- {
- title: '提醒人员', templet: function (d) {
- return d.sendName ? d.sendName : '暂无';
- }
- },
- {
- title: '提醒号码', templet: function (d) {
- return d.leadPhone;
- }
- },
- {
- title: '提醒记录', templet: function (d) {
- return d.createTime;
- }
- },
- {
- title: '操作', templet: function (d) {
- return '<a style="color:#1276ff;cursor: pointer;" onclick="details(\'' + d.id + '\')">详情</a>';
- }
- }
- ]],
- page: true
- });
- //修改人员信息
- updatePersonTable = table.render({
- elem: '#w-dx-wechat-table',
- url: PATH+'/websitesms/getShortMessage',
- skin: 'line',
- cols: [[
- {width: 80, title: '序号', type: 'numbers'},
- {field: 'deptname', title: '部门名称'},
- {
- title: '主要领导',
- templet: function (d) {
- if (d.mainLeader && d.mainLeaderPhone) {
- return d.mainLeader + ' ' + d.mainLeaderPhone;
- }
- return '暂无';
- }
- },
- {
- title: '分管领导', templet: function (d) {
- return (d.leaderperson && d.leaderphone) ? d.leaderperson + " " + d.leaderphone : '暂无';
- }
- },
- {
- title: '工作人员', templet: function (d) {
- return (d.workperson && d.workphone) ? d.workperson + " " + d.workphone : '暂无'
- }
- },
- {
- title: '操作', templet: function (d) {
- var param = '';
- param += '\'' + d.mainLeader + '\'';
- param += ',\'' + d.mainLeaderPhone + '\'';
- param += ',\'' + d.leaderperson + '\'';
- param += ',\'' + d.leaderphone + '\'';
- param += ',\'' + d.workperson + '\'';
- param += ',\'' + d.workphone + '\'';
- param += ',\'' + d.deptid + '\'';
- return '<p style="color:#1276ff;cursor: pointer;" onclick="xg(' + param + ')">修改</p>';
- }
- }
- ]]
- });
- $('#w-sms-back').on('click', function () {
- $('#w-sms-back').addClass('layui-hide');
- $('.w-sms-wai-div').removeClass('layui-hide');
- reloadSmsTable();
- })
- $('#w-sms-tab-back').on('click', function () {
- $(".remindList").css("display", "block");
- $(".clearfix").css("display", "block");
- $("#publishTable").css("display", "none")
- $(".w-sms-record").css("display", "none")
- })
- $('#w-dx-tab-back').on('click', function () {
- $(".remindList").css("display", "block");
- $(".clearfix").css("display", "block");
- $("#publishTable").css("display", "none")
- $(".sms").css("display", "none")
- })
- }
- function initSmsTableDetail(staffName, leadName, wechat, id) {
- layer.closeAll();
- $('#w-sms-back').removeClass('layui-hide');
- $('.w-sms-wai-div').addClass('layui-hide');
- var smsContent = '您好,贵单位政务新媒体{wechat}已有{day}天未更新,有超期未更新风险,如不能按时更新,本月政务公开考核将扣分。如因未及时更新被市政府办公厅点名通报批评,会影响单位政务公开年终考核得分,请及时更新';
- table.reload('w-sms-wechat-table', {
- url: PATH+'/smsmessage/getWechatSmsDetail',
- where: {
- 'id': id
- },
- page: true,
- cols: [[
- {field: 'sendTime', title: '发送时间', width: '15%'},
- {
- title: '发送内容', templet: function (d) {
- return (d.type == 1 ? leadName : staffName) + smsContent.replace('{wechat}', wechat).replace('{day}', d.type == 1 ? '12' : '10');
- }
- },
- {
- title: '发送状态', width: '12%', templet: function (d) {
- return d.isSuccess == 1 ? '发送成功' : '未发送成功';
- }
- }
- ]]
- });
- }
- function reloadSmsTable() {
- table.reload('w-sms-wechat-table', {
- url: PATH+'/smsmessage/getWechatSms',
- page: false,
- cols: [[
- {width: 80, title: '序号', type: 'numbers'},
- {field: 'wName', title: '新媒体名称'},
- {field: 'wType', title: '类型'},
- {
- title: '分管领导', templet: function (d) {
- return d.leadName + " " + d.leadPhone;
- }
- },
- {
- title: '工作人员', templet: function (d) {
- return d.staffName + " " + d.staffPhone;
- }
- },
- {
- title: '提醒记录', templet: function (d) {
- return d.sendTime ? d.sendTime : '未提醒';
- }
- },
- {
- title: '操作', templet: function (d) {
- return '<a style="color:#1276ff;cursor: pointer;" onclick="initSmsTableDetail(\'' + d.staffName + '\',\'' + d.leadName + '\',\'' + (d.wType + '-' + d.wName) + '\',\'' + d.id + '\')">详情</a>' +
- '    <a style="color:#1276ff;cursor: pointer;" onclick="xg1(\'' + d.staffName + '\',\'' + d.leadName + '\',\'' + d.leadPhone + '\',\'' + d.staffPhone + '\',\'' + d.id + '\')">修改</a>';
- }
- }
- ]]
- });
- // //网站短信记录
- table.reload('w-sms-website-table', {
- url: PATH+'/websitesms/getWebsiteSms',
- page: true,
- cols: [[
- {width: 80, title: '序号', type: 'numbers'},
- {
- field: 'sendContent', title: '部门名称', templet: function (d) {
- if (d.sendType == '1') {
- return "短信发送";
- } else if (d.sendType == '0') {
- return d.sendContent;
- }
- }
- },
- {
- title: '提醒人员', templet: function (d) {
- return d.sendName ? d.sendName : '暂无';
- }
- },
- {
- title: '提醒号码', templet: function (d) {
- return d.leadPhone;
- }
- },
- {
- title: '提醒记录', templet: function (d) {
- return d.createTime;
- }
- },
- {
- title: '操作', templet: function (d) {
- return '<a style="color:#1276ff;cursor: pointer;" onclick="details(\'' + d.id + '\')">详情</a>';
- }
- }
- ]],
- limit: 20
- });
- }
- function details(id) {
- $('#w-sms-back').removeClass('layui-hide');
- $('.w-sms-wai-div').addClass('layui-hide');
- var defaultStr = '您好,门户网站 栏目:{columns} 已长时间未更新,请尽快处理。【南岸区政务服务管理办公室】';
- //网站短信查看详
- table.reload('w-sms-website-table', {
- url: PATH+'/websitesms/getWebsiteSmsDetail',
- where: {
- 'id': id
- },
- page: true,
- cols: [[
- {field: 'createTime', title: '发送时间', width: '15%'},
- {
- title: '提醒部门', templet: function (d) {
- if (d.sendType == '0') {
- return defaultStr.replace('{columns}', d.columns);
- }
- if (d.sendType == '1') {
- return d.sendContent;
- }
- }
- },
- ]]
- });
- }
- function xg(mainLeader, mainLeaderPhone, leaderperson, leaderphone, workperson, workphone, deptid) {
- //为空或者为undefined 清空内容
- leaderperson = leaderperson != "undefined" ? leaderperson : '';
- leaderphone = leaderphone != "undefined" ? leaderphone : '';
- workperson = workperson != "undefined" ? workperson : '';
- workphone = workphone != "undefined" ? workphone : '';
- $('#mainLeader').attr('value', mainLeader);
- $('#mainLeaderPhone').attr('value', mainLeaderPhone);
- $('#lperson').attr("value", leaderperson);
- $('#lphone').attr("value", leaderphone);
- $('#wperson').attr("value", workperson);
- $('#wphone').attr("value", workphone);
- layer.open({
- type: 1,
- title: '短信发送的人员信息修改',
- content: $('#web_sitesms'),
- area: ['450px', '490px'],
- btn: ['立即修改', '取消'],
- yes: function (index, layero) {
- var ml = $('#mainLeader').val();
- var mlp = $('#mainLeaderPhone').val();
- var lperson = $('#lperson').val();
- var lphone = $('#lphone').val();
- var wperson = $('#wperson').val();
- var wphone = $('#wphone').val();
- $.ajax({
- url: PATH + '/websitesms/updateWebsiteSms',
- type: 'get',
- data: {
- "id": deptid,
- 'mainLeader': ml,
- 'mainLeaderPhone': mlp,
- "leaderperson": leaderperson,
- "leaderphone": leaderphone,
- "workperson": workperson,
- "workphone": workphone,
- "lperson": lperson,
- "lphone": lphone,
- "wperson": wperson,
- "wphone": wphone
- },
- success: function (suc) {
- if (suc == true) {
- layer.msg("修改成功", {icon: 1});
- updatePersonTable.reload();
- layer.close(index);
- } else {
- layer.msg("修改失败", {icon: 5});
- }
- }
- });
- },
- btn2: function (index, layero) {
- $("#from")[0].reset();
- layui.form.render();
- }
- });
- }
- function xg1(staffName ,leadName, leadPhone, staffPhone,id ) {
- //为空或者为undefined 清空内容
- leadName = leadName != "undefined" ? leadName : '';
- leadPhone = leadPhone != "undefined" ? leadPhone : '';
- staffName = staffName != "undefined" ? staffName : '';
- staffPhone = staffPhone != "undefined" ? staffPhone : '';
- $('#leadName').attr('value', leadName);
- $('#leadPhone').attr('value', leadPhone);
- $('#staffName').attr("value", staffName);
- $('#staffPhone').attr("value", staffPhone);
- layer.open({
- type: 1,
- title: '短信发送的人员信息修改',
- content: $('#wechatsms'),
- area: ['450px', '490px'],
- btn: ['立即修改', '取消'],
- yes: function (index, layero) {
- var lName = $('#leadName').val().trim();
- var lPhone = $('#leadPhone').val().trim();
- var sName = $('#staffName').val().trim();
- var sPhone = $('#staffPhone').val().trim();
- if (lName==null||lName===''){
- return layer.msg("分管领导不得为空", {icon: 5});
- }
- if (lPhone==null||lPhone===''){
- return layer.msg("分管领导电话不得为空", {icon: 5});
- }
- if (sName==null||sName===''){
- return layer.msg("工作人员不得为空", {icon: 5});
- }
- if (sPhone==null||sPhone===''){
- return layer.msg("工作人员电话不得为空", {icon: 5});
- }
- $.ajax({
- url: PATH + '/smsmessage/updateWechatSms',
- type: 'get',
- data: {
- "id": id,
- 'leadName': lName,
- 'leadPhone': lPhone,
- "staffName": sName,
- "staffPhone": sPhone,
- },
- success: function (suc) {
- console.log(suc)
- if (suc.data == true) {
- layer.msg("修改成功", {icon: 1});
- reloadSmsTable();
- layer.close(index);
- } else {
- layer.msg("修改失败", {icon: 5});
- }
- $("#wechatfrom")[0].reset();
- }
- });
- },
- btn2: function (index, layero) {
- $("#wechatfrom")[0].reset();
- layui.form.render();
- },cancel: function(){
- $("#wechatfrom")[0].reset();
- }
- });
- }
- const smsView = {
- phoneSelect: null,
- initPhones: function() {
- const _this = this
- $('#ly-sms-phones').empty()
- $.ajax({
- url: PATH + '/websitesms/getShortMessage',
- data: {
- page: 1,
- limit: 10
- },
- type: 'get',
- success: function (json) {
- if (json.data && json.data.length) {
- let arr = []
- for (let i = 0; i < json.data.length; i++) {
- if (json.data[i].leaderphone) {
- arr.push({
- name: json.data[i].leaderphone + '(' + json.data[i].leaderperson+':'+json.data[i].deptname + '分管领导' + ')',
- value: json.data[i].leaderphone,
- id:json.data[i].deptid+Math.random()
- })
- }
- if (json.data[i].mainLeaderPhone) {
- arr.push({
- name: json.data[i].mainLeaderPhone + '(' +json.data[i].mainLeader+':'+ json.data[i].deptname + '主要领导' + ')',
- value: json.data[i].mainLeaderPhone,
- id:json.data[i].deptid+Math.random()
- })
- }
- if (json.data[i].workphone) {
- arr.push({
- name: json.data[i].workphone + '(' + json.data[i].workperson+':'+json.data[i].deptname + '工作人员' + ')',
- value: json.data[i].workphone,
- id:json.data[i].deptid+Math.random()
- })
- }
- }
- _this.phoneSelect = layui.xmSelect.render({
- el: '#ly-sms-phones',
- language: 'zn',
- filterable: true,
- theme: {
- color: '#1E9FFF',
- },
- data: arr,
- on:function(data){
- if(data.isAdd){
- var _html = '<div class="layui-btn layui-btn-normal {0} none-transition" id="{2}" ng-index="{3}" ng-color="{0}">{1}<i class="layui-icon layui-icon-close"></i></div>'
- .format('', data.change[0].name,data.change[0].id, data.change[0].id);
- $('.tags').append(_html);
- let child=$('.tags').children()
- for (let i = 0; i < child.length; i++) {
- const item = child[i];
- item.addEventListener('click',function(e){
- if(e.target.tagName==='I'){
- let arr1 = smsView.phoneSelect.getValue()
- let index= arr1.findIndex(o=>{
- return o.id===Number($(item).attr('id'))
- })
- if(index!=-1){
- arr1.splice(index,1)
- smsView.phoneSelect.setValue(arr1)
- $(item).remove()
- }
- }
- })
- }
- }else{
- let child=$('.tags').children()
- for (let i = 0; i < child.length; i++) {
- const item = child[i];
- if($(item).text()===data.change[0].name){
- $(item).remove()
- }
- }
- }
- }
- })
-
- }
-
- }
- });
- },
- initPhoneInput: function() {
- $('#ly-sms-phone').empty()
- layui.labelGeneration.render({
- elem:'#ly-sms-phone',
- isEnter:true
- })
- },
- sendMsg: function(arr, idx, indexss) {
-
- this.sendSms(arr, idx, indexss)
- },
- sendSms: function(arr, idx, indexss) {
- if (idx >= arr.length) {
- layer.close(indexss)
- layer.msg('发送完成!')
- return
- }
- const _this = this
- post("/smsmessage/sendSms", true, {
- 'phone': arr[idx],
- 'content': $('#ly-sms-remark').val()
- }, function (res) {
- idx++;
- _this.sendMsg(arr, idx, indexss)
- }, function (err) {
- idx++;
- _this.sendMsg(arr, idx, indexss)
- });
- }
- }
|