ComplaintList.module.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. var ComplaintId = "";
  2. function viewModel() {
  3. this.init = function () {
  4. $("#ComplaintList").datagrid({
  5. toolbar: "#tb",
  6. fit: true,
  7. fitcolumns: true,
  8. striped: true,
  9. pagination: true,
  10. singleSelect: true,
  11. remoteSort: false,
  12. border: false,
  13. rownumbers: true,
  14. frozenColumns: [[
  15. {
  16. field: '投诉事件', title: '投诉标题', width: 130, align: 'center'
  17. },
  18. { field: '用户姓名', title: '投诉人', width: 50, align: 'left' }
  19. ]],
  20. columns: [[
  21. { field: '名称', title: '机构', width: 100, align: 'center' },
  22. {
  23. field: '登记时间', title: '登记时间', width: 150, align: 'center', sortable: true, sorter: function (a, b) {
  24. a = a.split('/');
  25. b = b.split('/');
  26. if (a[2] == b[2]) {
  27. if (a[0] == b[0]) {
  28. return (a[1] > b[1] ? 1 : -1);
  29. } else {
  30. return (a[0] > b[0] ? 1 : -1);
  31. }
  32. } else {
  33. return (a[2] > b[2] ? 1 : -1);
  34. }
  35. }
  36. },
  37. { field: '当前处理人', title: '当前处理人', width: 80, align: 'center' },
  38. {
  39. field: '状态', title: '状态', width: 50, align: 'center', formatter: function (value, row, index) {
  40. if (value == "0") {
  41. return "<span style='color:red'>未处理</span>";
  42. }
  43. else if (value == "1") {
  44. return "<span style='color:green'>处理中</span>";
  45. }
  46. else {
  47. return "<span style='color:green'>已处理</span>";
  48. }
  49. }
  50. },
  51. {
  52. field: '是否分配渠道', title: '是否分配渠道', width: 100, align: 'center', formatter: function (value, row, index) {
  53. if (value == "0") {
  54. return "<span style='color:green'>否</span>";
  55. }
  56. else if (value == "1") {
  57. return "<span style='color:red'>是</span>";
  58. }
  59. }
  60. },
  61. { field: '显示名', title: '投诉种类', width: 100, align: 'left', halign: 'center' },
  62. { field: '科室名', title: '科室名', width: 100, align: 'center', halign: 'center' },
  63. { field: '总耗时', title: '已耗时(小时)', width: 100, align: 'center', halign: 'center' },
  64. { field: '投诉描述', hidden: true }
  65. ]],
  66. onSelect: function (rowIndex, rowData) {
  67. GetImage(rowData["ID"]);
  68. GetComplaintPerson(rowData["登记人ID"]);
  69. DealProcess(rowData["ID"]);
  70. $("#ComplaintDetail").html(rowData["投诉描述"]);
  71. GetCommunicate(rowData["ID"]);
  72. }
  73. });
  74. ///初始化投诉人详细列表
  75. $("#ComplaintPerson").datagrid({
  76. columns: [[
  77. { field: '姓名', title: '投诉人', width: 100, align: 'center', halign: 'center' },
  78. { field: '名称', title: '机构', width: 200, align: 'center', halign: 'center' },
  79. { field: '部门名', title: '科室', width: 150, align: 'center' },
  80. { field: '联系电话', title: '联系电话', width: 200, align: 'center', halign: 'center' },
  81. { field: '电子邮箱', title: '电子邮箱', width: 200, align: 'center', halign: 'center' },
  82. { field: '说明', title: '说明', width: 200, align: 'center', halign: 'center' }
  83. ]],
  84. fit: true,
  85. method: "get",
  86. fitcolumns: true,
  87. striped: true,
  88. singleSelect: true,
  89. onSelect: function (rowIndex, rowData) {
  90. }
  91. });
  92. ///初始化投诉种类Combobox
  93. $("#ComplaintType").combobox({
  94. url: '/BaseCode/GetCodeCombobox?ClassificationID=B0BF0EDD-37D7-47D4-9ED9-9D0F2DDCA6A0',
  95. valueField: 'ID',
  96. textField: '显示名',
  97. editable: false,
  98. multiple: true,
  99. onLoadSuccess: function (data) {
  100. },
  101. onChange: function () {
  102. Refresh("0");
  103. }
  104. });
  105. $.ajax({
  106. url: '/ComplaintManage/GetChannelComboTree',
  107. method: 'get',
  108. success: function (data) {
  109. if (data != null) {
  110. var all = { "id": "0", "text": "全部" }
  111. data.splice(0, 0, all);
  112. $("#Channel").combotree('loadData', data);
  113. }
  114. }
  115. })
  116. //初始化渠道信息Combobox
  117. $("#Channel").combotree({
  118. valueField: 'ID',
  119. textField: '名称',
  120. editable: false,
  121. onChange: function (newValue, oldValue) {
  122. Refresh("0");
  123. },
  124. onLoadSuccess: function (data) {
  125. $("#Channel").combotree('setValue',0);
  126. }
  127. });
  128. $("#Status").combobox({
  129. onChange: function () {
  130. Refresh("0");
  131. }
  132. });
  133. //提交沟通过程
  134. $('#SubmitCmt').textbox({
  135. icons: [{
  136. iconCls: 'fa fa-pencil',
  137. handler: function (e) {
  138. var v = $(e.data.target).textbox('getValue');
  139. if (v == "" || v == null) {
  140. mui.toast('请输入内容', { duration: 'long', type: 'div' });
  141. return;
  142. }
  143. var Node = $('#ComplaintList').datagrid("getSelected");
  144. if (Node == null) {
  145. mui.toast('请选择一条投诉记录', { duration: 'long', type: 'div' });
  146. return;
  147. }
  148. var url = "/ComplaintManage/SubmitCmt/" + Node["ID"];
  149. $.post(url, { "Content": v }, function (data) {
  150. if (data.code == 200) {
  151. top.ZLPMS.Msg(data.msg);
  152. $('#SubmitCmt').textbox('clear');
  153. GetCommunicate(Node["ID"]);
  154. } else {
  155. ZLPMS.Msg(data.msg, 2);
  156. }
  157. });
  158. }
  159. }]
  160. });
  161. //处理
  162. $('#btn-Deal').click(function () {
  163. var Node = $('#ComplaintList').datagrid("getSelected");
  164. if (Node["状态"] == 2) {
  165. top.ZLPMS.Msg("该投诉处理已完结", 0);
  166. return;
  167. }
  168. if (Node == null) {
  169. top.ZLPMS.Msg("请选择一行投诉后执行操作", 0);
  170. return;
  171. }
  172. ComplaintId = Node["ID"];
  173. top.ZLPMS.OpenWindow({
  174. title: '投诉过程受理',
  175. url: '/ComplaintManage/ComplaintDeal/' + Node["ID"] + '?Event=' + Node["投诉事件"],
  176. area: ['630px', '500px'],
  177. yes: function (index, layero) {
  178. Forms.Submit(index, layero);
  179. },
  180. });
  181. });
  182. //分配
  183. $('#btn-Distribution').click(function () {
  184. var Node = $('#ComplaintList').datagrid("getSelected");
  185. if (Node == null) {
  186. top.ZLPMS.Msg("请选择一行投诉后执行操作", 0);
  187. return;
  188. }
  189. if (Node["状态"] == 2) {
  190. top.ZLPMS.Msg("该投诉处理已完结", 0);
  191. return;
  192. }
  193. ComplaintId = Node["ID"];
  194. top.ZLPMS.OpenWindow({
  195. title: '投诉过程分配',
  196. url: '/ComplaintManage/ComplaintDistribute/' + Node["ID"] + '?Event=' + Node["投诉事件"],
  197. area: ['630px', '500px'],
  198. yes: function (index, layero) {
  199. Forms.SubmitDe(index, layero);
  200. },
  201. });
  202. });
  203. //重置
  204. $('#btn-default').click(function () {
  205. RefreshDeaf();
  206. });
  207. //状态选择事件
  208. $("#myprob").checkbox({
  209. checked: true,
  210. onChange: function (checked) {
  211. Refresh("0");
  212. }
  213. });
  214. },
  215. this.loadmenus = function () {
  216. ///初始化日期
  217. var curr_time = new Date();
  218. var str = curr_time.getFullYear() + "-";
  219. str += curr_time.getMonth() + 1 + "-";
  220. str += curr_time.getDate() + " ";
  221. str += curr_time.getHours()+":";
  222. str += curr_time.getMinutes();
  223. $('#DealTime').datetimebox('setValue', str);
  224. $('#DealPersonID').combobox({
  225. url: '/ComplaintManage/GetPerson/',
  226. valueField: 'ID',
  227. textField: '姓名',
  228. editable: true,
  229. onSelect: function (record) {
  230. $('#DealPerson').val(record.名称);
  231. },
  232. onLoadSuccess: function (data) {
  233. if (data) {
  234. $('#DealPersonID').combobox('setValue', CurrentUser);
  235. }
  236. }
  237. });
  238. }, this.loadmenusDis = function () {
  239. var curr_time = new Date();
  240. var str = curr_time.getFullYear() + "-";
  241. str += curr_time.getMonth() + 1 + "-";
  242. str += curr_time.getDate() + " ";
  243. str += curr_time.getHours() + ":";
  244. str += curr_time.getMinutes();
  245. $('#DealTime').datetimebox('setValue', str);
  246. $('#DealPersonID').combobox({
  247. valueField: 'ID',
  248. textField: '姓名',
  249. onLoadSuccess: function (data) {
  250. if (data) {
  251. $('#DealPersonID').combobox('setValue', data[0].ID);
  252. }
  253. }
  254. , onSelect: function (record) {
  255. $('#DealPerson').val(record.姓名);
  256. }
  257. });
  258. ///读取渠道
  259. $('#Channel').combotree({
  260. url: '/ComplaintManage/GetChannelComboTree',
  261. valueField: 'ID',
  262. textField: '名称',
  263. editable: false,
  264. onLoadSuccess: function () {
  265. },
  266. onChange: function (newValue, oldValue) {
  267. ///读取人员
  268. $('#DealPersonID').combobox({
  269. url: '/ComplaintManage/GetPersonByChannel/' + newValue
  270. });
  271. }
  272. });
  273. }
  274. }
  275. function Refresh(_mode) {
  276. if (_mode == "0") {
  277. var my = '2';
  278. var t = $('#myprob').checkbox('options');
  279. if ($('#myprob').checkbox('options').checked) {
  280. my = '1';
  281. }
  282. var search = $('#searchs').searchbox('getValue');
  283. var complaintType = $('#ComplaintType').combobox('getValues');
  284. var channel = $('#Channel').combobox('getValue');
  285. var status = $('#Status').combobox('getValues');
  286. var startTime = $('#StartTime').datetimebox('getValue');
  287. var endTime = $('#EndTime').datetimebox('getValue');
  288. var ctype = '';
  289. var sta = '';
  290. $(complaintType).each(function (idx, text) {
  291. ctype += text + ',';
  292. });
  293. $(status).each(function (idx, text) {
  294. sta += text + ',';
  295. });
  296. var Params = {
  297. Search: search,
  298. ComplaintType: ctype,
  299. Channel: channel,
  300. Status: sta,
  301. StartTime: startTime,
  302. EndTime: endTime,
  303. My: my
  304. }
  305. $("#ComplaintList").datagrid({
  306. url: '/ComplaintManage/GetComplaintDatagrid',
  307. method: 'GET',
  308. queryParams: Params,
  309. onLoadSuccess: function (data) {
  310. if (data.rows.length > 0) {
  311. var index = $('#ComplaintList').datagrid('getRowIndex', ComplaintId);
  312. if (index >= 0) {
  313. $('#ComplaintList').datagrid('selectRow', index);
  314. } else {
  315. $('#ComplaintList').datagrid('selectRow', 0);
  316. }
  317. }
  318. }
  319. });
  320. }
  321. }
  322. //初始化
  323. function RefreshDeaf() {
  324. $('#ComplaintType').combobox('clear');
  325. $('#Channel').combotree('setValue',0);
  326. $('#Status').combobox('clear');
  327. $('#EndTime').datebox('setValue', '')
  328. $('#StartTime').datebox('setValue', '')
  329. $('#searchs').searchbox('setValue', '');
  330. Refresh("0");
  331. }
  332. ///搜索框事件
  333. function doSearch(value) {
  334. Refresh("0");
  335. }
  336. ///获取附件
  337. function GetImage(id) {
  338. var url = "/ComplaintManage/GetComplaintFileFromFTP/" + id;
  339. $.post(url, { "id": id }, function (data) {
  340. $("#ImgBox").empty();
  341. $.each(data, function (idx, json) {
  342. $("#ImgBox").append("<img class='ItemImg' data-preview-src='' data-preview-group='1' style='height:95px;width:auto;margin:10px' src='" + json.base64ToImage + "' />")
  343. });
  344. })
  345. }
  346. ///投诉人信息
  347. function GetComplaintPerson(PID) {
  348. $("#ComplaintPerson").datagrid({
  349. url: "/ComplaintManage/GetComplaintPerson?PID=" + PID,
  350. });
  351. }
  352. ///获取投诉过程
  353. function DealProcess(ID) {
  354. $("#timeLine").empty();
  355. var url = "/ComplaintManage/GetDealProcess/" + ID;
  356. $.post(url, {}, function (data) {
  357. $.each(data, function (idx, json) {
  358. var icon = FindIcon(json.变更状态);
  359. $("#timeLine").append("<li class='layui-timeline-item'><i class='layui-icon layui-timeline-axis'></i><div class='layui-timeline-content layui-text'><h3 class='layui-timeline-title'>" + icon + json.变更状态 + "</h3><p>" + json.职务 + "-" + json.记录人 + "<br>" + json.记录时间 + "</p></div></li>");
  360. });
  361. });
  362. }
  363. ///获取过程沟通
  364. function GetCommunicate(ID) {
  365. $("#Communication").empty();
  366. var url = "/ComplaintManage/GetCommunicate/" + ID;
  367. $.post(url, {}, function (data) {
  368. $.each(data, function (idx, json) {
  369. $("#Communication").append("<div class='layui-col-md12'><div class='layui-card'><div class='layui-card-header'><img class='layui-circle' src='/Content/Images/Account/wtx.jpg' style='width:40px'>" + json.沟通人职务 + "-" + json.沟通人 + "</div><div class='layui-card-body'>" + json.沟通内容 + "<p>" + json.沟通时间 + "</p></div></div></div>")
  370. });
  371. })
  372. }
  373. ///获取流程图标
  374. function FindIcon(title) {
  375. if (title == "已登记") {
  376. return "<i class='layui-icon layui-icon-fire' style='font-size: 20px; color: #1E9FFF;margin-right:5px'></i>";
  377. } else if (title == "服务分配") {
  378. return "<i class='layui-icon layui-icon-release' style='font-size: 20px; color: #1E9FFF;margin-right:5px'></i>";
  379. } else if (title == "服务受理中") {
  380. return "<i class='layui-icon layui-icon-loading' style='font-size: 20px; color: #1E9FFF;margin-right:5px'></i>";
  381. } else if (title == "处理完成") {
  382. return "<i class='layui-icon layui-icon-ok-circle' style='font-size: 20px; color: #cc9910;margin-right:5px'></i>";
  383. } else if (title == "服务提交") {
  384. return "<i class='layui-icon layui-icon-top' style='font-size: 20px; color: #cc9910;margin-right:5px'></i>";
  385. } else {
  386. return '';
  387. }
  388. }
  389. //表单操作(投诉受理)
  390. var Forms = {
  391. //表单提交
  392. Submit: function (index, layero) {
  393. var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法:
  394. var param = iframeWin.Forms.PostData();//调用子页面的方法,得到子页面返回的ids
  395. if (param != null) {
  396. var url = '/ComplaintManage/ComplaintAccept';
  397. $.post(url, param, function (data) {
  398. if (data.code == 200) {
  399. top.ZLPMS.CloseWindow(index);
  400. top.ZLPMS.Msg(data.msg);
  401. //刷新
  402. Refresh("0");
  403. } else {
  404. ZLPMS.Msg(data.msg, 2);
  405. }
  406. });
  407. }
  408. },
  409. SubmitDe: function (index, layero) {
  410. var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法:
  411. var param = iframeWin.Forms.PostData();//调用子页面的方法,得到子页面返回的ids
  412. if (param != null) {
  413. var url = '/ComplaintManage/ComplaintDistributeSub';
  414. $.post(url, param, function (data) {
  415. if (data.code == 200) {
  416. top.ZLPMS.CloseWindow(index);
  417. top.ZLPMS.Msg(data.msg);
  418. //刷新
  419. Refresh("0");
  420. } else {
  421. ZLPMS.Msg(data.msg, 2);
  422. }
  423. });
  424. }
  425. },
  426. //加载数据
  427. Load: function (data) {
  428. $('#ff').form('load', data);
  429. },
  430. //读取数据
  431. PostData: function () {
  432. //执行提交验证
  433. var r = $('#ff').form('validate');
  434. if (r) {//post到后台
  435. var param = ZLPMS.FormToObject('ff');
  436. return param;
  437. }
  438. return null;
  439. }
  440. };