123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- var ComplaintId = "";
- function viewModel() {
- this.init = function () {
- $("#ComplaintList").datagrid({
- toolbar: "#tb",
- fit: true,
- fitcolumns: true,
- striped: true,
- pagination: true,
- singleSelect: true,
- remoteSort: false,
- border: false,
- rownumbers: true,
- frozenColumns: [[
- {
- field: '投诉事件', title: '投诉标题', width: 130, align: 'center'
- },
- { field: '用户姓名', title: '投诉人', width: 50, align: 'left' }
- ]],
- columns: [[
- { field: '名称', title: '机构', width: 100, align: 'center' },
- {
- field: '登记时间', title: '登记时间', width: 150, align: 'center', sortable: true, sorter: function (a, b) {
- a = a.split('/');
- b = b.split('/');
- if (a[2] == b[2]) {
- if (a[0] == b[0]) {
- return (a[1] > b[1] ? 1 : -1);
- } else {
- return (a[0] > b[0] ? 1 : -1);
- }
- } else {
- return (a[2] > b[2] ? 1 : -1);
- }
- }
- },
- { field: '当前处理人', title: '当前处理人', width: 80, align: 'center' },
- {
- field: '状态', title: '状态', width: 50, align: 'center', formatter: function (value, row, index) {
- if (value == "0") {
- return "<span style='color:red'>未处理</span>";
- }
- else if (value == "1") {
- return "<span style='color:green'>处理中</span>";
- }
- else {
- return "<span style='color:green'>已处理</span>";
- }
- }
- },
- {
- field: '是否分配渠道', title: '是否分配渠道', width: 100, align: 'center', formatter: function (value, row, index) {
- if (value == "0") {
- return "<span style='color:green'>否</span>";
- }
- else if (value == "1") {
- return "<span style='color:red'>是</span>";
- }
- }
- },
- { field: '显示名', title: '投诉种类', width: 100, align: 'left', halign: 'center' },
- { field: '科室名', title: '科室名', width: 100, align: 'center', halign: 'center' },
- { field: '总耗时', title: '已耗时(小时)', width: 100, align: 'center', halign: 'center' },
- { field: '投诉描述', hidden: true }
- ]],
- onSelect: function (rowIndex, rowData) {
- GetImage(rowData["ID"]);
- GetComplaintPerson(rowData["登记人ID"]);
- DealProcess(rowData["ID"]);
- $("#ComplaintDetail").html(rowData["投诉描述"]);
- GetCommunicate(rowData["ID"]);
- }
- });
- ///初始化投诉人详细列表
- $("#ComplaintPerson").datagrid({
- columns: [[
- { field: '姓名', title: '投诉人', width: 100, align: 'center', halign: 'center' },
- { field: '名称', title: '机构', width: 200, align: 'center', halign: 'center' },
- { field: '部门名', title: '科室', width: 150, align: 'center' },
- { field: '联系电话', title: '联系电话', width: 200, align: 'center', halign: 'center' },
- { field: '电子邮箱', title: '电子邮箱', width: 200, align: 'center', halign: 'center' },
- { field: '说明', title: '说明', width: 200, align: 'center', halign: 'center' }
- ]],
- fit: true,
- method: "get",
- fitcolumns: true,
- striped: true,
- singleSelect: true,
- onSelect: function (rowIndex, rowData) {
- }
- });
- ///初始化投诉种类Combobox
- $("#ComplaintType").combobox({
- url: '/BaseCode/GetCodeCombobox?ClassificationID=B0BF0EDD-37D7-47D4-9ED9-9D0F2DDCA6A0',
- valueField: 'ID',
- textField: '显示名',
- editable: false,
- multiple: true,
- onLoadSuccess: function (data) {
- },
- onChange: function () {
- Refresh("0");
- }
- });
- $.ajax({
- url: '/ComplaintManage/GetChannelComboTree',
- method: 'get',
- success: function (data) {
- if (data != null) {
- var all = { "id": "0", "text": "全部" }
- data.splice(0, 0, all);
- $("#Channel").combotree('loadData', data);
- }
- }
- })
- //初始化渠道信息Combobox
- $("#Channel").combotree({
- valueField: 'ID',
- textField: '名称',
- editable: false,
- onChange: function (newValue, oldValue) {
- Refresh("0");
- },
- onLoadSuccess: function (data) {
- $("#Channel").combotree('setValue',0);
- }
- });
- $("#Status").combobox({
- onChange: function () {
- Refresh("0");
- }
- });
- //提交沟通过程
- $('#SubmitCmt').textbox({
- icons: [{
- iconCls: 'fa fa-pencil',
- handler: function (e) {
- var v = $(e.data.target).textbox('getValue');
- if (v == "" || v == null) {
- mui.toast('请输入内容', { duration: 'long', type: 'div' });
- return;
- }
- var Node = $('#ComplaintList').datagrid("getSelected");
- if (Node == null) {
- mui.toast('请选择一条投诉记录', { duration: 'long', type: 'div' });
- return;
- }
- var url = "/ComplaintManage/SubmitCmt/" + Node["ID"];
- $.post(url, { "Content": v }, function (data) {
- if (data.code == 200) {
- top.ZLPMS.Msg(data.msg);
- $('#SubmitCmt').textbox('clear');
- GetCommunicate(Node["ID"]);
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- });
- }
- }]
- });
- //处理
- $('#btn-Deal').click(function () {
- var Node = $('#ComplaintList').datagrid("getSelected");
- if (Node["状态"] == 2) {
- top.ZLPMS.Msg("该投诉处理已完结", 0);
- return;
- }
- if (Node == null) {
- top.ZLPMS.Msg("请选择一行投诉后执行操作", 0);
- return;
- }
- ComplaintId = Node["ID"];
- top.ZLPMS.OpenWindow({
- title: '投诉过程受理',
- url: '/ComplaintManage/ComplaintDeal/' + Node["ID"] + '?Event=' + Node["投诉事件"],
- area: ['630px', '500px'],
- yes: function (index, layero) {
- Forms.Submit(index, layero);
- },
- });
- });
- //分配
- $('#btn-Distribution').click(function () {
- var Node = $('#ComplaintList').datagrid("getSelected");
- if (Node == null) {
- top.ZLPMS.Msg("请选择一行投诉后执行操作", 0);
- return;
- }
- if (Node["状态"] == 2) {
- top.ZLPMS.Msg("该投诉处理已完结", 0);
- return;
- }
- ComplaintId = Node["ID"];
- top.ZLPMS.OpenWindow({
- title: '投诉过程分配',
- url: '/ComplaintManage/ComplaintDistribute/' + Node["ID"] + '?Event=' + Node["投诉事件"],
- area: ['630px', '500px'],
- yes: function (index, layero) {
- Forms.SubmitDe(index, layero);
- },
- });
- });
- //重置
- $('#btn-default').click(function () {
- RefreshDeaf();
- });
-
- //状态选择事件
- $("#myprob").checkbox({
- checked: true,
- onChange: function (checked) {
- Refresh("0");
- }
- });
- },
- this.loadmenus = function () {
- ///初始化日期
- var curr_time = new Date();
- var str = curr_time.getFullYear() + "-";
- str += curr_time.getMonth() + 1 + "-";
- str += curr_time.getDate() + " ";
- str += curr_time.getHours()+":";
- str += curr_time.getMinutes();
- $('#DealTime').datetimebox('setValue', str);
- $('#DealPersonID').combobox({
- url: '/ComplaintManage/GetPerson/',
- valueField: 'ID',
- textField: '姓名',
- editable: true,
- onSelect: function (record) {
- $('#DealPerson').val(record.名称);
- },
- onLoadSuccess: function (data) {
- if (data) {
- $('#DealPersonID').combobox('setValue', CurrentUser);
- }
- }
- });
- }, this.loadmenusDis = function () {
- var curr_time = new Date();
- var str = curr_time.getFullYear() + "-";
- str += curr_time.getMonth() + 1 + "-";
- str += curr_time.getDate() + " ";
- str += curr_time.getHours() + ":";
- str += curr_time.getMinutes();
- $('#DealTime').datetimebox('setValue', str);
- $('#DealPersonID').combobox({
- valueField: 'ID',
- textField: '姓名',
- onLoadSuccess: function (data) {
- if (data) {
- $('#DealPersonID').combobox('setValue', data[0].ID);
- }
- }
- , onSelect: function (record) {
- $('#DealPerson').val(record.姓名);
- }
- });
- ///读取渠道
- $('#Channel').combotree({
- url: '/ComplaintManage/GetChannelComboTree',
- valueField: 'ID',
- textField: '名称',
- editable: false,
- onLoadSuccess: function () {
- },
- onChange: function (newValue, oldValue) {
- ///读取人员
- $('#DealPersonID').combobox({
- url: '/ComplaintManage/GetPersonByChannel/' + newValue
- });
- }
- });
- }
- }
- function Refresh(_mode) {
- if (_mode == "0") {
- var my = '2';
- var t = $('#myprob').checkbox('options');
- if ($('#myprob').checkbox('options').checked) {
- my = '1';
- }
- var search = $('#searchs').searchbox('getValue');
- var complaintType = $('#ComplaintType').combobox('getValues');
- var channel = $('#Channel').combobox('getValue');
- var status = $('#Status').combobox('getValues');
- var startTime = $('#StartTime').datetimebox('getValue');
- var endTime = $('#EndTime').datetimebox('getValue');
- var ctype = '';
- var sta = '';
- $(complaintType).each(function (idx, text) {
- ctype += text + ',';
- });
- $(status).each(function (idx, text) {
- sta += text + ',';
- });
- var Params = {
- Search: search,
- ComplaintType: ctype,
- Channel: channel,
- Status: sta,
- StartTime: startTime,
- EndTime: endTime,
- My: my
- }
- $("#ComplaintList").datagrid({
- url: '/ComplaintManage/GetComplaintDatagrid',
- method: 'GET',
- queryParams: Params,
- onLoadSuccess: function (data) {
- if (data.rows.length > 0) {
- var index = $('#ComplaintList').datagrid('getRowIndex', ComplaintId);
- if (index >= 0) {
- $('#ComplaintList').datagrid('selectRow', index);
- } else {
- $('#ComplaintList').datagrid('selectRow', 0);
- }
- }
- }
- });
- }
- }
- //初始化
- function RefreshDeaf() {
- $('#ComplaintType').combobox('clear');
- $('#Channel').combotree('setValue',0);
- $('#Status').combobox('clear');
- $('#EndTime').datebox('setValue', '')
- $('#StartTime').datebox('setValue', '')
- $('#searchs').searchbox('setValue', '');
- Refresh("0");
- }
- ///搜索框事件
- function doSearch(value) {
- Refresh("0");
- }
- ///获取附件
- function GetImage(id) {
- var url = "/ComplaintManage/GetComplaintFileFromFTP/" + id;
- $.post(url, { "id": id }, function (data) {
- $("#ImgBox").empty();
- $.each(data, function (idx, json) {
- $("#ImgBox").append("<img class='ItemImg' data-preview-src='' data-preview-group='1' style='height:95px;width:auto;margin:10px' src='" + json.base64ToImage + "' />")
- });
- })
- }
- ///投诉人信息
- function GetComplaintPerson(PID) {
- $("#ComplaintPerson").datagrid({
- url: "/ComplaintManage/GetComplaintPerson?PID=" + PID,
- });
- }
- ///获取投诉过程
- function DealProcess(ID) {
- $("#timeLine").empty();
- var url = "/ComplaintManage/GetDealProcess/" + ID;
- $.post(url, {}, function (data) {
- $.each(data, function (idx, json) {
- var icon = FindIcon(json.变更状态);
- $("#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>");
- });
- });
- }
- ///获取过程沟通
- function GetCommunicate(ID) {
- $("#Communication").empty();
- var url = "/ComplaintManage/GetCommunicate/" + ID;
- $.post(url, {}, function (data) {
- $.each(data, function (idx, json) {
- $("#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>")
- });
- })
- }
- ///获取流程图标
- function FindIcon(title) {
- if (title == "已登记") {
- return "<i class='layui-icon layui-icon-fire' style='font-size: 20px; color: #1E9FFF;margin-right:5px'></i>";
- } else if (title == "服务分配") {
- return "<i class='layui-icon layui-icon-release' style='font-size: 20px; color: #1E9FFF;margin-right:5px'></i>";
- } else if (title == "服务受理中") {
- return "<i class='layui-icon layui-icon-loading' style='font-size: 20px; color: #1E9FFF;margin-right:5px'></i>";
- } else if (title == "处理完成") {
- return "<i class='layui-icon layui-icon-ok-circle' style='font-size: 20px; color: #cc9910;margin-right:5px'></i>";
- } else if (title == "服务提交") {
- return "<i class='layui-icon layui-icon-top' style='font-size: 20px; color: #cc9910;margin-right:5px'></i>";
- } else {
- return '';
- }
- }
- //表单操作(投诉受理)
- var Forms = {
- //表单提交
- Submit: function (index, layero) {
- var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法:
- var param = iframeWin.Forms.PostData();//调用子页面的方法,得到子页面返回的ids
- if (param != null) {
- var url = '/ComplaintManage/ComplaintAccept';
- $.post(url, param, function (data) {
- if (data.code == 200) {
- top.ZLPMS.CloseWindow(index);
- top.ZLPMS.Msg(data.msg);
- //刷新
- Refresh("0");
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- });
- }
- },
- SubmitDe: function (index, layero) {
- var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法:
- var param = iframeWin.Forms.PostData();//调用子页面的方法,得到子页面返回的ids
- if (param != null) {
- var url = '/ComplaintManage/ComplaintDistributeSub';
- $.post(url, param, function (data) {
- if (data.code == 200) {
- top.ZLPMS.CloseWindow(index);
- top.ZLPMS.Msg(data.msg);
- //刷新
- Refresh("0");
- } else {
- ZLPMS.Msg(data.msg, 2);
- }
- });
- }
- },
- //加载数据
- Load: function (data) {
- $('#ff').form('load', data);
- },
- //读取数据
- PostData: function () {
- //执行提交验证
- var r = $('#ff').form('validate');
- if (r) {//post到后台
- var param = ZLPMS.FormToObject('ff');
- return param;
- }
- return null;
- }
- };
|