fbtx.item.js 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216
  1. function gtTimeReleaseArticle() {
  2. lyupload();
  3. get("/article/publicRemind", true, {}, function (res) {
  4. if (res.result) {
  5. // 左边列
  6. $("#gt7d").empty();
  7. var twoWeek = res.data.twoWeek;
  8. var str = '';
  9. var depts = Object.keys(twoWeek);
  10. for (var i = 0; i < Object.keys(twoWeek).length; i++) {
  11. var deptName = depts[i];
  12. var data = twoWeek[deptName];
  13. str += '<li class="layui-collapse"> <div class="layui-colla-item">'
  14. + '<p class="messageName layui-colla-title"><a class="layui-font-blue click-hover" href="'
  15. + data.deptUrl
  16. + '" target="_blank" style="margin-left: 15px;">'
  17. + deptName
  18. + '<span class="layui-badge-dot layui-bg-blue badge">' + data.count + '</span>'
  19. + '</a><span class="dx-title click-hover click-event-dxtx" data-deptname="'
  20. + deptName
  21. + '">短信提醒</span></p><div class="layui-colla-content">';
  22. for (var j = 0; j < data.records.length; j++) {
  23. var data1 = data.records[j];
  24. str += '<p class="sameMessage">栏目:<a class="layui-font-blue click-hover" href="' + data1.lastUpdateUrl + '"' +
  25. ' target="_blank">' + data1.columnName + '</a></p>'
  26. + '<p class="sameMessage sameMessagesec">最近更新:' + data1.lastUpdate.split(' ')[0].replaceAll("-", ".") + '</p>'
  27. }
  28. str += '</div></div></li>';
  29. }
  30. $("#gt7d").html(str);
  31. // 中间列
  32. $("#gt1m").empty();
  33. var threeMonth = res.data.threeMonth;
  34. var str = '';
  35. var depts = Object.keys(threeMonth);
  36. for (var i = 0; i < Object.keys(threeMonth).length; i++) {
  37. var deptName = depts[i];
  38. var data = threeMonth[deptName];
  39. str += '<li class="layui-collapse"> <div class="layui-colla-item">'
  40. + '<p class="messageName layui-colla-title"><a class="layui-font-blue click-hover" href="'
  41. + data.deptUrl
  42. + '" target="_blank" style="margin-left: 15px;">'
  43. + deptName
  44. + '<span class="layui-badge-dot layui-bg-blue badge">' + data.count + '</span>'
  45. + '</a><span class="dx-title click-hover click-event-dxtx" data-deptname="'
  46. + deptName
  47. + '">短信提醒</span></p><div class="layui-colla-content">';
  48. for (var j = 0; j < data.records.length; j++) {
  49. var data1 = data.records[j];
  50. str += '<p class="sameMessage">栏目:<a class="layui-font-blue click-hover" href="' + data1.lastUpdateUrl + '"' +
  51. ' target="_blank">' + data1.columnName + '</a></p>'
  52. + '<p class="sameMessage sameMessagesec">最近更新:' + data1.lastUpdate.split(' ')[0].replaceAll("-", ".") + '</p>'
  53. }
  54. str += '</div></div></li>';
  55. }
  56. $("#gt1m").html(str);
  57. // 右边列
  58. $("#gt3m").empty();
  59. var sixMonth = res.data.sixMonth;
  60. var str = '';
  61. var depts = Object.keys(sixMonth);
  62. for (var i = 0; i < Object.keys(sixMonth).length; i++) {
  63. var deptName = depts[i];
  64. var data = sixMonth[deptName];
  65. str += '<li class="layui-collapse"> <div class="layui-colla-item">'
  66. + '<p class="messageName layui-colla-title"><a class="layui-font-blue click-hover" href="'
  67. + data.deptUrl
  68. + '" target="_blank" style="margin-left: 15px;">'
  69. + deptName
  70. + '<span class="layui-badge-dot layui-bg-blue badge">' + data.count + '</span>'
  71. + '</a><span class="dx-title click-hover click-event-dxtx" data-deptname="'
  72. + deptName
  73. + '">短信提醒</span></p><div class="layui-colla-content">';
  74. for (var j = 0; j < data.records.length; j++) {
  75. var data1 = data.records[j];
  76. str += '<p class="sameMessage">栏目:<a class="layui-font-blue click-hover" href="' + data1.lastUpdateUrl + '"' +
  77. ' target="_blank">' + data1.columnName + '</a></p>'
  78. + '<p class="sameMessage sameMessagesec">最近更新:' + data1.lastUpdate.split(' ')[0].replaceAll("-", ".") + '</p>'
  79. }
  80. str += '</div></div></li>';
  81. }
  82. $("#gt3m").html(str);
  83. $("#gt1y").empty();
  84. var oneYear = res.data.oneYear;
  85. var str = '';
  86. var depts = Object.keys(oneYear);
  87. for (var i = 0; i < Object.keys(oneYear).length; i++) {
  88. var deptName = depts[i];
  89. var data = oneYear[deptName];
  90. str += '<li class="layui-collapse"> <div class="layui-colla-item">'
  91. + '<p class="messageName layui-colla-title"><a class="layui-font-blue click-hover" href="'
  92. + data.deptUrl
  93. + '" target="_blank" style="margin-left: 15px;">'
  94. + deptName
  95. + '<span class="layui-badge-dot layui-bg-blue badge">' + data.count + '</span>'
  96. + '</a><span class="dx-title click-hover click-event-dxtx" data-deptname="'
  97. + deptName
  98. + '">短信提醒</span></p><div class="layui-colla-content">';
  99. for (var j = 0; j < data.records.length; j++) {
  100. var data1 = data.records[j];
  101. str += '<p class="sameMessage">栏目:<a class="layui-font-blue click-hover" href="' + data1.lastUpdateUrl + '"' +
  102. ' target="_blank">' + data1.columnName + '</a></p>'
  103. + '<p class="sameMessage sameMessagesec">最近更新:' + data1.lastUpdate.split(' ')[0].replaceAll("-", ".") + '</p>'
  104. }
  105. str += '</div></div></li>';
  106. }
  107. $("#gt1y").html(str);
  108. element.init();
  109. $(".layui-colla-title").on("click", "a", function (event) {
  110. layui.stope(event);
  111. })
  112. $(".layui-colla-title").on("click", ".click-event-dxtx", function (event) {
  113. layui.stope(event);
  114. var deptname = $(this).attr("data-deptname");
  115. var dom = $(this);
  116. $("#dxtxForm").html("");
  117. get("/api/smsmessage/getTelephoneByDeptname", true, {
  118. "deptname": deptname
  119. }, function (res) {
  120. if (res.result) {
  121. var data = res.data;
  122. // 去掉点击标识
  123. $('span[data-click="click"]').removeAttr('data-click');
  124. // 添加点击标识
  125. dom.attr("data-click", "click");
  126. openCheckPhoneWindows(data);
  127. } else {
  128. if (res.msg) {
  129. layer.msg(res.msg);
  130. } else {
  131. layer.msg("查询失败");
  132. }
  133. }
  134. }, function (err) {
  135. layer.msg("查询失败");
  136. })
  137. })
  138. }
  139. }, function (err) {
  140. })
  141. }
  142. function openCheckPhoneWindows(data) {
  143. if (!data) {
  144. layer.msg("缺失联系方式,不能发送短信");
  145. return;
  146. }
  147. var str = "";
  148. if (data.mainLeader && data.mainLeaderPhone) {
  149. str += '<div class="layui-form-item" style="margin-left:10px;height: 40px;">'
  150. + '<div class="layui-form-block">'
  151. + '<input type="checkbox" value="0" title="'
  152. + data.mainLeader + '(主要领导)(' + data.mainLeaderPhone + ')'
  153. + '" lay-skin="primary">'
  154. + '</div>'
  155. + '</div>';
  156. }
  157. if (data.leaderperson && data.leaderphone) {
  158. str += '<div class="layui-form-item" style="margin-left:10px;height: 40px;">'
  159. + '<div class="layui-form-block">'
  160. + '<input type="checkbox" value="1" title="'
  161. + data.leaderperson + '(分管领导)(' + data.leaderphone + ')'
  162. + '" lay-skin="primary">'
  163. + '</div>'
  164. + '</div>';
  165. }
  166. if (data.workperson && data.workphone) {
  167. str += '<div class="layui-form-item" style="margin-left:10px;height: 40px;" >'
  168. + '<div class="layui-form-block">'
  169. + '<input type="checkbox" value="2" title="'
  170. + data.workperson + '(工作人员)(' + data.workphone + ')'
  171. + '" lay-skin="primary">'
  172. + '</div>'
  173. + '</div>';
  174. }
  175. if (!str) {
  176. layer.msg("缺失联系方式,不能发送短信");
  177. return;
  178. }
  179. window.TELEPHONES = data;
  180. $("#dxtxForm").append(str);
  181. form.render();
  182. layer.open({
  183. type: 1,
  184. title: '短信发送的人员',
  185. content: $('#dxtxDiv'),
  186. area: ['300px'],
  187. btn: ['发送'],
  188. yes: function (index, layero) {
  189. var types = new Array();
  190. $('#dxtxForm input[type=checkbox]:checked').each(function () {
  191. types.push($(this).val());
  192. });
  193. if (types.length == 0) {
  194. layer.msg("请选择人员");
  195. return;
  196. }
  197. addMessage(types, index);
  198. },
  199. });
  200. }
  201. function addMessage(types, index) {
  202. var telephones = new Array();
  203. if (window.TELEPHONES) {
  204. var data = window.TELEPHONES;
  205. for (var i = 0; i < types.length; i++) {
  206. var type = types[i];
  207. if (type == "0") {
  208. telephones.push({
  209. "deptname": data.deptname,
  210. "telephone": data.mainLeaderPhone,
  211. "person": data.mainLeader,
  212. "type": type
  213. })
  214. } else if (type == "1") {
  215. telephones.push({
  216. "deptname": data.deptname,
  217. "telephone": data.leaderphone,
  218. "person": data.leaderperson,
  219. "type": type
  220. })
  221. } else if (type == "2") {
  222. telephones.push({
  223. "deptname": data.deptname,
  224. "telephone": data.workphone,
  225. "person": data.workperson,
  226. "type": type
  227. })
  228. }
  229. }
  230. }
  231. // 获取栏目
  232. var columnEle = $($('span[data-click="click"]').parents('div')[0]).children('div').children('p').children('a');
  233. var columns = [];
  234. columnEle.each(function () {
  235. columns.push($(this).text());
  236. })
  237. post("/api/smsmessage/add", true, {
  238. "telephones": JSON.stringify(telephones),
  239. "senduerid": sessionStorage.USERID,
  240. "columns": columns.join(',')
  241. }, function (res) {
  242. if (res.result) {
  243. layer.close(index);
  244. layer.msg("提醒成功");
  245. } else {
  246. layer.msg(res.msg);
  247. }
  248. }, function (err) {
  249. layer.msg('提醒失败');
  250. })
  251. }
  252. var initStatus = true;
  253. function lyupload() {
  254. if (initStatus) {
  255. var type = 0, deptId = 0;
  256. get("/user/selectDept", true, {}, function (res) {
  257. $('#deptIdSelect').empty();
  258. $('#deptIdSelect2').empty();
  259. if (res.result) {
  260. var html = '';
  261. for (var i = 0; i < res.data.length; i++) {
  262. html += '<option value="' + res.data[i].deptid + '">' + res.data[i].deptname + '</option>';
  263. }
  264. deptId = res.data[0].deptid;
  265. $('#deptIdSelect').append(html);
  266. $('#deptIdSelect2').append(html);
  267. form.render('select');
  268. }
  269. }, function (err) {
  270. });
  271. //发布提醒
  272. $("#publishReminder").click(function () {
  273. $(".remindList").css("display", "none");
  274. $(".clearfix").css("display", "none");
  275. $(".w-sms-record").css("display", "none");
  276. $(".sms").css("display", "none");
  277. $("#publishTable").css("display", "block");
  278. layui.use('table', function () {
  279. var table = layui.table;
  280. table.render({
  281. elem: '#publish'
  282. , method: 'get'
  283. , url: PATH + '/excelList/showExcelList'
  284. , skin: 'line'
  285. , even: true
  286. , page: {
  287. limit: 10,
  288. limits: [5, 10, 15],
  289. first: "首页", //不显示首页
  290. last: "尾页" //不显示尾页
  291. }
  292. , cols: [[
  293. {field: 'id', title: '序号', sort: true, unresize: false, type: "numbers", width: 150}
  294. , {field: 'deptname', title: '部门名称', width: 250}
  295. , {field: 'hName', title: '文档名称', width: 450}
  296. , {field: 'downloadTime', title: '下载时间', width: 258}
  297. ]], parseData: function (res) {
  298. var result = res.data;
  299. return {
  300. "code": res.code,//解析接口状态
  301. "msg": res.msg,//解析提示文本
  302. "count": res.total,//解析数据长度
  303. "data": result//解析数据列表
  304. };
  305. }
  306. });
  307. });
  308. })
  309. $("#reBack").click(function () {
  310. $(".remindList").css("display", "block");
  311. $(".clearfix").css("display", "block");
  312. $("#publishTable").css("display", "none")
  313. })
  314. // 错敏字
  315. $("#errorSensitiveWord").unbind("click");
  316. // $("#errorSensitiveWord").on('click', function() {
  317. // errorSensitive(index);
  318. // }) ;
  319. // console.log("initStatus="+initStatus)
  320. $('#errorSensitiveWord').on('click', function () {
  321. index = layer.open({
  322. type: 1,
  323. title: '错敏字上传',
  324. area: ['600px', '400px'], //宽高
  325. content: $('#ly-upload2'),
  326. success: function (layero, index) {
  327. $('#ly-upload2').removeClass('layui-hide');
  328. $('#ly-type2').val(2)
  329. type = 2;
  330. var LayuiLayerShadeLenght = $(".layui-layer-shade").length;
  331. if (LayuiLayerShadeLenght > 1) {
  332. console.log(LayuiLayerShadeLenght);
  333. $(".layui-layer-shade").css({"z-index": "9999"});
  334. }
  335. },
  336. end: function () {
  337. $('#ly-form2')[0].reset();
  338. $('#ly-upload2').addClass('layui-hide');
  339. $(".layui-layer-shade").remove();
  340. var html = $('#ly-file2').next().next();
  341. console.log(html)
  342. if (html.length > 0) {
  343. html.remove();
  344. }
  345. }
  346. });
  347. });
  348. // 报告
  349. $("#testReport").unbind("click");
  350. // $("#testReport").on('click', function() {
  351. // oneCl(index);
  352. // }) ;
  353. $('#testReport').on('click', function () {
  354. index = layer.open({
  355. type: 1,
  356. title: '测评报告上传',
  357. area: ['600px', '400px'], //宽高
  358. content: $('#ly-upload'),
  359. success: function (layero, index) {
  360. $('#ly-upload').removeClass('layui-hide');
  361. $('#ly-type').val(1)
  362. type = 1;
  363. var LayuiLayerShadeLenght = $(".layui-layer-shade").length;
  364. if (LayuiLayerShadeLenght > 1) {
  365. console.log(LayuiLayerShadeLenght);
  366. // $(".layui-layer-shade").css({"background-color":"9999"});
  367. $(".layui-layer-shade").css({"z-index": "9999"});
  368. }
  369. },
  370. end: function () {
  371. $('#ly-form')[0].reset();
  372. $('#ly-upload').addClass('layui-hide');
  373. $(".layui-layer-shade").remove();
  374. var html = $('#ly-file').next().next();
  375. console.log(html)
  376. if (html.length > 0) {
  377. html.remove();
  378. }
  379. }
  380. });
  381. });
  382. $('#ly-back').on('click', function () {
  383. layer.close(index);
  384. $('#ly-form')[0].reset();
  385. var html = $('#ly-file').next().next();
  386. console.log(html)
  387. if (html.length > 0) {
  388. html.remove();
  389. }
  390. });
  391. $('#ly-back2').on('click', function () {
  392. layer.close(index);
  393. $('#ly-form2')[0].reset();
  394. var html = $('#ly-file2').next().next();
  395. console.log(html)
  396. if (html.length > 0) {
  397. html.remove();
  398. }
  399. });
  400. $('#ly-back-sms').on('click', function () {
  401. layer.close(index);
  402. });
  403. $('#ly-ljbtn-sms').on('click', function () {
  404. let phones = []
  405. let arr = smsView.phoneSelect.getValue()
  406. for (let i = 0; i < arr.length; i++) {
  407. const p = arr[i].value.replace(/\s/g, "")
  408. if (!phones.includes(p)) {
  409. phones.push(p)
  410. }
  411. }
  412. let arr2 = $("#ly-sms-phone .layui-btn")
  413. for (let i = 0; i < arr2.length; i++) {
  414. const p = $(arr2[i]).text().replace(/\s/g, "")
  415. if (!phones.includes(p)) {
  416. phones.push(p)
  417. }
  418. }
  419. if (!phones.length) {
  420. layer.msg("请输入手机号", {icon: 5});
  421. return false;
  422. }
  423. if (!$('#ly-sms-remark').val()) {
  424. layer.msg("请输入短信内容", {icon: 5});
  425. return false;
  426. }
  427. const indexss = layer.load(2)
  428. smsView.sendMsg(phones, 0, indexss)
  429. // post("/smsmessage/sendSms", true, {
  430. // 'phone': $('#ly-sms-phone').val(),
  431. // 'content': $('#ly-sms-remark').val()
  432. // }, function (res) {
  433. // if (res.result) {
  434. // layer.close(index);
  435. // layer.msg('发送成功!');
  436. // }
  437. // }, function (err) {
  438. // });
  439. })
  440. $('#smsSendRecord').on('click', function () {
  441. reloadSmsTable();
  442. $(".remindList").css("display", "none");
  443. $(".clearfix").css("display", "none");
  444. $("#publishTable").css("display", "none");
  445. $(".w-sms-record").css("display", "block");
  446. $('.sms').css('display', 'none');
  447. });
  448. $('#modify').on('click', function () {
  449. $(".remindList").css("display", "none");
  450. $(".clearfix").css("display", "none");
  451. $("#publishTable").css("display", "none");
  452. $(".w-sms-record").css("display", "none");
  453. $(".sms").css("display", "block");
  454. updatePersonTable.reload();
  455. });
  456. $('.w-sms-tab li').on('click', function () {
  457. //$('.w-sms-tab li').each(function() {
  458. // $(this).removeClass('w-sms-tab-this');
  459. //});
  460. //$(this).addClass('w-sms-tab-this');
  461. });
  462. initSmsTable();
  463. initUp();
  464. initUp2();
  465. initStatus = false;
  466. }
  467. }
  468. function initUp() {
  469. var index1;
  470. upload.render({
  471. elem: '#ly-file'
  472. , url: PATH+'/webCore/uploadWord'
  473. , auto: false
  474. , exts: 'ppt|pptx|doc|docx|xls|xlsx|mp4'
  475. , accept: 'file'
  476. //,multiple: true
  477. , bindAction: '#ly-ljbtn',
  478. before: function (obj) {
  479. this.data = {
  480. 'type': $('#ly-type').val(),
  481. 'deptId': $('#deptIdSelect option:checked').val()
  482. }
  483. if ($('#ly-file').next().next().length == 0) {
  484. layer.msg('请选择上传文件', {icon: 5});
  485. return false;
  486. }
  487. index1 = layer.load(2);
  488. },
  489. choose: function (obj) {
  490. obj.preview(function (index, file, result) {
  491. console.log(file)
  492. var html = $('#ly-file').next().next();
  493. console.log(html)
  494. if (html.length == 0) {
  495. $('#ly-file').next().after('<span class="layui-inline layui-upload-choose">' + file.name + '</span>')
  496. }
  497. });
  498. }
  499. , done: function (res) {
  500. layer.msg('上传成功');
  501. $('#ly-type').val('');
  502. layer.close(index1);
  503. layer.close(index);
  504. }
  505. });
  506. }
  507. function initUp2() {
  508. var index2;
  509. upload.render({
  510. elem: '#ly-file2'
  511. , url: PATH+'/webCore/uploadWord'
  512. , auto: false
  513. , exts: 'xls|xlsx'
  514. , accept: 'file'
  515. //,multiple: true
  516. , bindAction: '#ly-ljbtn2',
  517. before: function (obj) {
  518. this.data = {
  519. 'type': $('#ly-type2').val(),
  520. 'deptId': $('#deptIdSelect2 option:checked').val()
  521. }
  522. if ($('#ly-file2').next().next().length == 0) {
  523. layer.msg('请选择上传文件', {icon: 5});
  524. return false;
  525. }
  526. index2 = layer.load(2);
  527. },
  528. choose: function (obj) {
  529. obj.preview(function (index, file, result) {
  530. console.log(file)
  531. var html = $('#ly-file2').next().next();
  532. console.log(html)
  533. if (html.length == 0) {
  534. $('#ly-file2').next().after('<span class="layui-inline layui-upload-choose">' + file.name + '</span>')
  535. }
  536. });
  537. }
  538. , done: function (res) {
  539. layer.msg('上传成功');
  540. $('#ly-type2').val('');
  541. layer.close(index2);
  542. layer.close(index);
  543. }
  544. });
  545. }
  546. function oneCl(index) {
  547. index = layer.open({
  548. type: 1,
  549. title: '测评报告上传',
  550. area: ['600px', '400px'], //宽高
  551. content: $('#ly-upload'),
  552. success: function (layero, index) {
  553. $('#ly-upload').removeClass('layui-hide');
  554. $('#ly-type').val(1);
  555. type = 1;
  556. $(':focus').blur();
  557. var LayuiLayerShadeLenght = $(".layui-layer-shade").length;
  558. if (LayuiLayerShadeLenght > 1) {
  559. console.log(LayuiLayerShadeLenght);
  560. // $(".layui-layer-shade").css({"background-color":"9999"});
  561. $(".layui-layer-shade").css({"z-index": "9999"});
  562. }
  563. },
  564. end: function () {
  565. $('#ly-form')[0].reset();
  566. $('#ly-upload').addClass('layui-hide');
  567. $(".layui-layer-shade").remove();
  568. var html = $('#ly-file').next().next();
  569. console.log(html)
  570. if (html.length > 0) {
  571. html.remove();
  572. }
  573. }
  574. });
  575. }
  576. function errorSensitive(index) {
  577. index = layer.open({
  578. type: 1,
  579. title: '错敏字上传',
  580. area: ['600px', '400px'], //宽高
  581. content: $('#ly-upload'),
  582. success: function (layero, index) {
  583. $('#ly-upload').removeClass('layui-hide');
  584. $('#ly-type').val(2)
  585. type = 2;
  586. $(':focus').blur();
  587. var LayuiLayerShadeLenght = $(".layui-layer-shade").length;
  588. if (LayuiLayerShadeLenght > 1) {
  589. console.log(LayuiLayerShadeLenght);
  590. // $(".layui-layer-shade").css({"background-color":"9999"});
  591. $(".layui-layer-shade").css({"z-index": "9999"});
  592. }
  593. },
  594. end: function () {
  595. $('#ly-form')[0].reset();
  596. $('#ly-upload').addClass('layui-hide');
  597. $(".layui-layer-shade").remove();
  598. var html = $('#ly-file').next().next();
  599. console.log(html)
  600. if (html.length > 0) {
  601. html.remove();
  602. }
  603. }
  604. });
  605. }
  606. $('#smsSend').on('click', function () {
  607. layer.open({
  608. type: 1,
  609. title: '短信发送',
  610. area: ['60%', '70%'], //宽高
  611. btn: ['发送', '关闭'],
  612. content: $('#ly-sms'),
  613. success: function (layero, index) {
  614. $('#ly-sms').removeClass('layui-hide');
  615. smsView.initPhones()
  616. smsView.initPhoneInput()
  617. },
  618. end: function () {
  619. $('#ly-sms').addClass('layui-hide');
  620. $('#ly-sms-phone').val('')
  621. $('#ly-sms-remark').val('')
  622. },
  623. btn1: function() {
  624. let phones = []
  625. // let arr = smsView.phoneSelect.getValue()
  626. // for (let i = 0; i < arr.length; i++) {
  627. // const p = arr[i].value.replace(/\s/g, "")
  628. // if (!phones.includes(p)) {
  629. // phones.push(p)
  630. // }
  631. // }
  632. let arr2 = $(".tags .layui-btn")
  633. for (let i = 0; i < arr2.length; i++) {
  634. const p = parseFloat($(arr2[i]).text().replace(/\s/g, ""))
  635. if (!phones.includes(p)) {
  636. phones.push(p)
  637. }
  638. }
  639. if (!phones.length) {
  640. layer.msg("请输入手机号", {icon: 5});
  641. return false;
  642. }
  643. if (!$('#ly-sms-remark').val()) {
  644. layer.msg("请输入短信内容", {icon: 5});
  645. return false;
  646. }
  647. const indexss = layer.load(2)
  648. smsView.sendMsg(phones, 0, indexss)
  649. },
  650. });
  651. });
  652. function initSmsTable() {
  653. table.render({
  654. elem: '#w-sms-wechat-table',
  655. url: PATH+'/smsmessage/getWechatSms',
  656. skin: 'line',
  657. cols: [[
  658. {width: 80, title: '序号', type: 'numbers'},
  659. {field: 'wName', title: '新媒体名称'},
  660. {field: 'wType', title: '类型'},
  661. {
  662. title: '分管领导', templet: function (d) {
  663. return d.leadName + " " + d.leadPhone;
  664. }
  665. },
  666. {
  667. title: '工作人员', templet: function (d) {
  668. return d.staffName + " " + d.staffPhone;
  669. }
  670. },
  671. {
  672. title: '提醒记录', templet: function (d) {
  673. return d.sendTime ? d.sendTime : '未提醒';
  674. }
  675. },
  676. {
  677. title: '操作', templet: function (d) {
  678. return '<a style="color:#1276ff;cursor: pointer;" onclick="initSmsTableDetail(\'' + d.staffName + '\',\'' + d.leadName + '\',\'' + (d.wType + '-' + d.wName) + '\',\'' + d.id + '\')">详情</a>' +
  679. '&nbsp&nbsp&nbsp&nbsp<a style="color:#1276ff;cursor: pointer;" onclick="xg1(\'' + d.staffName + '\',\'' + d.leadName + '\',\'' + d.leadPhone + '\',\'' + d.staffPhone + '\',\'' + d.id + '\')">修改</a>';
  680. }
  681. }
  682. ]]
  683. });
  684. //网站短信记录
  685. table.render({
  686. elem: '#w-sms-website-table',
  687. url: PATH+'/websitesms/getWebsiteSms',
  688. skin: 'line',
  689. cols: [[
  690. {width: 80, title: '序号', type: 'numbers'},
  691. {
  692. field: 'sendContent', title: '部门名称', templet: function (d) {
  693. if (d.sendType == '1') {
  694. return "短信发送";
  695. } else if (d.sendType == '0') {
  696. return d.sendContent;
  697. }
  698. }
  699. },
  700. {
  701. title: '提醒人员', templet: function (d) {
  702. return d.sendName ? d.sendName : '暂无';
  703. }
  704. },
  705. {
  706. title: '提醒号码', templet: function (d) {
  707. return d.leadPhone;
  708. }
  709. },
  710. {
  711. title: '提醒记录', templet: function (d) {
  712. return d.createTime;
  713. }
  714. },
  715. {
  716. title: '操作', templet: function (d) {
  717. return '<a style="color:#1276ff;cursor: pointer;" onclick="details(\'' + d.id + '\')">详情</a>';
  718. }
  719. }
  720. ]],
  721. page: true
  722. });
  723. //修改人员信息
  724. updatePersonTable = table.render({
  725. elem: '#w-dx-wechat-table',
  726. url: PATH+'/websitesms/getShortMessage',
  727. skin: 'line',
  728. cols: [[
  729. {width: 80, title: '序号', type: 'numbers'},
  730. {field: 'deptname', title: '部门名称'},
  731. {
  732. title: '主要领导',
  733. templet: function (d) {
  734. if (d.mainLeader && d.mainLeaderPhone) {
  735. return d.mainLeader + ' ' + d.mainLeaderPhone;
  736. }
  737. return '暂无';
  738. }
  739. },
  740. {
  741. title: '分管领导', templet: function (d) {
  742. return (d.leaderperson && d.leaderphone) ? d.leaderperson + " " + d.leaderphone : '暂无';
  743. }
  744. },
  745. {
  746. title: '工作人员', templet: function (d) {
  747. return (d.workperson && d.workphone) ? d.workperson + " " + d.workphone : '暂无'
  748. }
  749. },
  750. {
  751. title: '操作', templet: function (d) {
  752. var param = '';
  753. param += '\'' + d.mainLeader + '\'';
  754. param += ',\'' + d.mainLeaderPhone + '\'';
  755. param += ',\'' + d.leaderperson + '\'';
  756. param += ',\'' + d.leaderphone + '\'';
  757. param += ',\'' + d.workperson + '\'';
  758. param += ',\'' + d.workphone + '\'';
  759. param += ',\'' + d.deptid + '\'';
  760. return '<p style="color:#1276ff;cursor: pointer;" onclick="xg(' + param + ')">修改</p>';
  761. }
  762. }
  763. ]]
  764. });
  765. $('#w-sms-back').on('click', function () {
  766. $('#w-sms-back').addClass('layui-hide');
  767. $('.w-sms-wai-div').removeClass('layui-hide');
  768. reloadSmsTable();
  769. })
  770. $('#w-sms-tab-back').on('click', function () {
  771. $(".remindList").css("display", "block");
  772. $(".clearfix").css("display", "block");
  773. $("#publishTable").css("display", "none")
  774. $(".w-sms-record").css("display", "none")
  775. })
  776. $('#w-dx-tab-back').on('click', function () {
  777. $(".remindList").css("display", "block");
  778. $(".clearfix").css("display", "block");
  779. $("#publishTable").css("display", "none")
  780. $(".sms").css("display", "none")
  781. })
  782. }
  783. function initSmsTableDetail(staffName, leadName, wechat, id) {
  784. layer.closeAll();
  785. $('#w-sms-back').removeClass('layui-hide');
  786. $('.w-sms-wai-div').addClass('layui-hide');
  787. var smsContent = '您好,贵单位政务新媒体{wechat}已有{day}天未更新,有超期未更新风险,如不能按时更新,本月政务公开考核将扣分。如因未及时更新被市政府办公厅点名通报批评,会影响单位政务公开年终考核得分,请及时更新';
  788. table.reload('w-sms-wechat-table', {
  789. url: PATH+'/smsmessage/getWechatSmsDetail',
  790. where: {
  791. 'id': id
  792. },
  793. page: true,
  794. cols: [[
  795. {field: 'sendTime', title: '发送时间', width: '15%'},
  796. {
  797. title: '发送内容', templet: function (d) {
  798. return (d.type == 1 ? leadName : staffName) + smsContent.replace('{wechat}', wechat).replace('{day}', d.type == 1 ? '12' : '10');
  799. }
  800. },
  801. {
  802. title: '发送状态', width: '12%', templet: function (d) {
  803. return d.isSuccess == 1 ? '发送成功' : '未发送成功';
  804. }
  805. }
  806. ]]
  807. });
  808. }
  809. function reloadSmsTable() {
  810. table.reload('w-sms-wechat-table', {
  811. url: PATH+'/smsmessage/getWechatSms',
  812. page: false,
  813. cols: [[
  814. {width: 80, title: '序号', type: 'numbers'},
  815. {field: 'wName', title: '新媒体名称'},
  816. {field: 'wType', title: '类型'},
  817. {
  818. title: '分管领导', templet: function (d) {
  819. return d.leadName + " " + d.leadPhone;
  820. }
  821. },
  822. {
  823. title: '工作人员', templet: function (d) {
  824. return d.staffName + " " + d.staffPhone;
  825. }
  826. },
  827. {
  828. title: '提醒记录', templet: function (d) {
  829. return d.sendTime ? d.sendTime : '未提醒';
  830. }
  831. },
  832. {
  833. title: '操作', templet: function (d) {
  834. return '<a style="color:#1276ff;cursor: pointer;" onclick="initSmsTableDetail(\'' + d.staffName + '\',\'' + d.leadName + '\',\'' + (d.wType + '-' + d.wName) + '\',\'' + d.id + '\')">详情</a>' +
  835. '&nbsp&nbsp&nbsp&nbsp<a style="color:#1276ff;cursor: pointer;" onclick="xg1(\'' + d.staffName + '\',\'' + d.leadName + '\',\'' + d.leadPhone + '\',\'' + d.staffPhone + '\',\'' + d.id + '\')">修改</a>';
  836. }
  837. }
  838. ]]
  839. });
  840. // //网站短信记录
  841. table.reload('w-sms-website-table', {
  842. url: PATH+'/websitesms/getWebsiteSms',
  843. page: true,
  844. cols: [[
  845. {width: 80, title: '序号', type: 'numbers'},
  846. {
  847. field: 'sendContent', title: '部门名称', templet: function (d) {
  848. if (d.sendType == '1') {
  849. return "短信发送";
  850. } else if (d.sendType == '0') {
  851. return d.sendContent;
  852. }
  853. }
  854. },
  855. {
  856. title: '提醒人员', templet: function (d) {
  857. return d.sendName ? d.sendName : '暂无';
  858. }
  859. },
  860. {
  861. title: '提醒号码', templet: function (d) {
  862. return d.leadPhone;
  863. }
  864. },
  865. {
  866. title: '提醒记录', templet: function (d) {
  867. return d.createTime;
  868. }
  869. },
  870. {
  871. title: '操作', templet: function (d) {
  872. return '<a style="color:#1276ff;cursor: pointer;" onclick="details(\'' + d.id + '\')">详情</a>';
  873. }
  874. }
  875. ]],
  876. limit: 20
  877. });
  878. }
  879. function details(id) {
  880. $('#w-sms-back').removeClass('layui-hide');
  881. $('.w-sms-wai-div').addClass('layui-hide');
  882. var defaultStr = '您好,门户网站 栏目:{columns} 已长时间未更新,请尽快处理。【南岸区政务服务管理办公室】';
  883. //网站短信查看详
  884. table.reload('w-sms-website-table', {
  885. url: PATH+'/websitesms/getWebsiteSmsDetail',
  886. where: {
  887. 'id': id
  888. },
  889. page: true,
  890. cols: [[
  891. {field: 'createTime', title: '发送时间', width: '15%'},
  892. {
  893. title: '提醒部门', templet: function (d) {
  894. if (d.sendType == '0') {
  895. return defaultStr.replace('{columns}', d.columns);
  896. }
  897. if (d.sendType == '1') {
  898. return d.sendContent;
  899. }
  900. }
  901. },
  902. ]]
  903. });
  904. }
  905. function xg(mainLeader, mainLeaderPhone, leaderperson, leaderphone, workperson, workphone, deptid) {
  906. //为空或者为undefined 清空内容
  907. leaderperson = leaderperson != "undefined" ? leaderperson : '';
  908. leaderphone = leaderphone != "undefined" ? leaderphone : '';
  909. workperson = workperson != "undefined" ? workperson : '';
  910. workphone = workphone != "undefined" ? workphone : '';
  911. $('#mainLeader').attr('value', mainLeader);
  912. $('#mainLeaderPhone').attr('value', mainLeaderPhone);
  913. $('#lperson').attr("value", leaderperson);
  914. $('#lphone').attr("value", leaderphone);
  915. $('#wperson').attr("value", workperson);
  916. $('#wphone').attr("value", workphone);
  917. layer.open({
  918. type: 1,
  919. title: '短信发送的人员信息修改',
  920. content: $('#web_sitesms'),
  921. area: ['450px', '490px'],
  922. btn: ['立即修改', '取消'],
  923. yes: function (index, layero) {
  924. var ml = $('#mainLeader').val();
  925. var mlp = $('#mainLeaderPhone').val();
  926. var lperson = $('#lperson').val();
  927. var lphone = $('#lphone').val();
  928. var wperson = $('#wperson').val();
  929. var wphone = $('#wphone').val();
  930. $.ajax({
  931. url: PATH + '/websitesms/updateWebsiteSms',
  932. type: 'get',
  933. data: {
  934. "id": deptid,
  935. 'mainLeader': ml,
  936. 'mainLeaderPhone': mlp,
  937. "leaderperson": leaderperson,
  938. "leaderphone": leaderphone,
  939. "workperson": workperson,
  940. "workphone": workphone,
  941. "lperson": lperson,
  942. "lphone": lphone,
  943. "wperson": wperson,
  944. "wphone": wphone
  945. },
  946. success: function (suc) {
  947. if (suc == true) {
  948. layer.msg("修改成功", {icon: 1});
  949. updatePersonTable.reload();
  950. layer.close(index);
  951. } else {
  952. layer.msg("修改失败", {icon: 5});
  953. }
  954. }
  955. });
  956. },
  957. btn2: function (index, layero) {
  958. $("#from")[0].reset();
  959. layui.form.render();
  960. }
  961. });
  962. }
  963. function xg1(staffName ,leadName, leadPhone, staffPhone,id ) {
  964. //为空或者为undefined 清空内容
  965. leadName = leadName != "undefined" ? leadName : '';
  966. leadPhone = leadPhone != "undefined" ? leadPhone : '';
  967. staffName = staffName != "undefined" ? staffName : '';
  968. staffPhone = staffPhone != "undefined" ? staffPhone : '';
  969. $('#leadName').attr('value', leadName);
  970. $('#leadPhone').attr('value', leadPhone);
  971. $('#staffName').attr("value", staffName);
  972. $('#staffPhone').attr("value", staffPhone);
  973. layer.open({
  974. type: 1,
  975. title: '短信发送的人员信息修改',
  976. content: $('#wechatsms'),
  977. area: ['450px', '490px'],
  978. btn: ['立即修改', '取消'],
  979. yes: function (index, layero) {
  980. var lName = $('#leadName').val().trim();
  981. var lPhone = $('#leadPhone').val().trim();
  982. var sName = $('#staffName').val().trim();
  983. var sPhone = $('#staffPhone').val().trim();
  984. if (lName==null||lName===''){
  985. return layer.msg("分管领导不得为空", {icon: 5});
  986. }
  987. if (lPhone==null||lPhone===''){
  988. return layer.msg("分管领导电话不得为空", {icon: 5});
  989. }
  990. if (sName==null||sName===''){
  991. return layer.msg("工作人员不得为空", {icon: 5});
  992. }
  993. if (sPhone==null||sPhone===''){
  994. return layer.msg("工作人员电话不得为空", {icon: 5});
  995. }
  996. $.ajax({
  997. url: PATH + '/smsmessage/updateWechatSms',
  998. type: 'get',
  999. data: {
  1000. "id": id,
  1001. 'leadName': lName,
  1002. 'leadPhone': lPhone,
  1003. "staffName": sName,
  1004. "staffPhone": sPhone,
  1005. },
  1006. success: function (suc) {
  1007. console.log(suc)
  1008. if (suc.data == true) {
  1009. layer.msg("修改成功", {icon: 1});
  1010. reloadSmsTable();
  1011. layer.close(index);
  1012. } else {
  1013. layer.msg("修改失败", {icon: 5});
  1014. }
  1015. $("#wechatfrom")[0].reset();
  1016. }
  1017. });
  1018. },
  1019. btn2: function (index, layero) {
  1020. $("#wechatfrom")[0].reset();
  1021. layui.form.render();
  1022. },cancel: function(){
  1023. $("#wechatfrom")[0].reset();
  1024. }
  1025. });
  1026. }
  1027. const smsView = {
  1028. phoneSelect: null,
  1029. initPhones: function() {
  1030. const _this = this
  1031. $('#ly-sms-phones').empty()
  1032. $.ajax({
  1033. url: PATH + '/websitesms/getShortMessage',
  1034. data: {
  1035. page: 1,
  1036. limit: 10
  1037. },
  1038. type: 'get',
  1039. success: function (json) {
  1040. if (json.data && json.data.length) {
  1041. let arr = []
  1042. for (let i = 0; i < json.data.length; i++) {
  1043. if (json.data[i].leaderphone) {
  1044. arr.push({
  1045. name: json.data[i].leaderphone + '(' + json.data[i].leaderperson+':'+json.data[i].deptname + '分管领导' + ')',
  1046. value: json.data[i].leaderphone,
  1047. id:json.data[i].deptid+Math.random()
  1048. })
  1049. }
  1050. if (json.data[i].mainLeaderPhone) {
  1051. arr.push({
  1052. name: json.data[i].mainLeaderPhone + '(' +json.data[i].mainLeader+':'+ json.data[i].deptname + '主要领导' + ')',
  1053. value: json.data[i].mainLeaderPhone,
  1054. id:json.data[i].deptid+Math.random()
  1055. })
  1056. }
  1057. if (json.data[i].workphone) {
  1058. arr.push({
  1059. name: json.data[i].workphone + '(' + json.data[i].workperson+':'+json.data[i].deptname + '工作人员' + ')',
  1060. value: json.data[i].workphone,
  1061. id:json.data[i].deptid+Math.random()
  1062. })
  1063. }
  1064. }
  1065. _this.phoneSelect = layui.xmSelect.render({
  1066. el: '#ly-sms-phones',
  1067. language: 'zn',
  1068. filterable: true,
  1069. theme: {
  1070. color: '#1E9FFF',
  1071. },
  1072. data: arr,
  1073. on:function(data){
  1074. if(data.isAdd){
  1075. 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>'
  1076. .format('', data.change[0].name,data.change[0].id, data.change[0].id);
  1077. $('.tags').append(_html);
  1078. let child=$('.tags').children()
  1079. for (let i = 0; i < child.length; i++) {
  1080. const item = child[i];
  1081. item.addEventListener('click',function(e){
  1082. if(e.target.tagName==='I'){
  1083. let arr1 = smsView.phoneSelect.getValue()
  1084. let index= arr1.findIndex(o=>{
  1085. return o.id===Number($(item).attr('id'))
  1086. })
  1087. if(index!=-1){
  1088. arr1.splice(index,1)
  1089. smsView.phoneSelect.setValue(arr1)
  1090. $(item).remove()
  1091. }
  1092. }
  1093. })
  1094. }
  1095. }else{
  1096. let child=$('.tags').children()
  1097. for (let i = 0; i < child.length; i++) {
  1098. const item = child[i];
  1099. if($(item).text()===data.change[0].name){
  1100. $(item).remove()
  1101. }
  1102. }
  1103. }
  1104. }
  1105. })
  1106. }
  1107. }
  1108. });
  1109. },
  1110. initPhoneInput: function() {
  1111. $('#ly-sms-phone').empty()
  1112. layui.labelGeneration.render({
  1113. elem:'#ly-sms-phone',
  1114. isEnter:true
  1115. })
  1116. },
  1117. sendMsg: function(arr, idx, indexss) {
  1118. this.sendSms(arr, idx, indexss)
  1119. },
  1120. sendSms: function(arr, idx, indexss) {
  1121. if (idx >= arr.length) {
  1122. layer.close(indexss)
  1123. layer.msg('发送完成!')
  1124. return
  1125. }
  1126. const _this = this
  1127. post("/smsmessage/sendSms", true, {
  1128. 'phone': arr[idx],
  1129. 'content': $('#ly-sms-remark').val()
  1130. }, function (res) {
  1131. idx++;
  1132. _this.sendMsg(arr, idx, indexss)
  1133. }, function (err) {
  1134. idx++;
  1135. _this.sendMsg(arr, idx, indexss)
  1136. });
  1137. }
  1138. }