| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- /**
- * 新增或编辑工单
- * */
- //通话记录跳转过来的
- var callId = helper.request.queryString("cid");
- $(function() {
- //通话记录跳转过来的
- var cphone = helper.request.queryString("cphone");
- var cCustomerName = decodeURIComponent(helper.request.queryString("cCustomerName"));
- if(cphone) {
- $('#order_tel').val(cphone); //否 string 联系电话
- }
- if(cCustomerName) {
- $('#order_name').val(cCustomerName); //是 string 姓名/联系人
- }
- autosize($('textarea'));
- //获取工单来源
- helper.getDropList.getlistDropByDic($('#order_source'), 'GDLY').then(function() {
- $('#order_source').selectpicker('val', '468').trigger('change');
- });
- //获取业务办理
- helper.getDropList.getlistDropByDic($('#order_handle'), 'YWLX');
- //获取工单类型
- helper.getDropList.getOrderRadios($('#order_'), 'GDLX', 'inlineRadioOptions').then(function() {
- $('#order_').find('input[type="radio"]').on('change', function() {
- if($(this).val() === "107") { // 业务办理
- $('#order_handles').show();
- }else{
- $('#order_handles').hide();
- }
- });
- });
- $('#order_type').find('input[type="radio"]').on('change', function() {
- if($(this).val() === "1") { //业务办理 dispatch
- $('#order_pointment').hide();
- $('#Tousik').hide();
- $('#Tojon').hide();
- $("#insurance").hide();
- $("#dispatch").hide();
-
- $("#zhujkeshi").hide();
- $("#yukshi").hide();
- $("#yusjian").hide();
- $("#yubzhu").hide();
- $("#tration").hide();
- }else if($(this).val() === "2"){
- $('#order_pointment').show();
- $('#Tousik').hide();
- $('#Tojon').hide();
- $("#insurance").hide();
- $("#dispatch").hide();
-
- $("#zhujkeshi").hide();
- $("#yukshi").hide();
- $("#yusjian").hide();
- $("#yubzhu").hide();
- $("#tration").hide();
- }else if($(this).val() === "3"){
- $('#order_pointment').hide();
- $('#Tousik').show();
- $('#Tojon').show();
- $("#dispatch").hide();
- $("#insurance").hide();
-
- $("#zhujkeshi").show(); //tration insurance yubzhu
- $("#yukshi").hide();
- $("#yusjian").hide();
- $("#yubzhu").show();
- $("#tration").hide();
- }else if($(this).val() === "4"){
- $('#order_pointment').hide();
- $('#Tousik').hide();
- $('#Tojon').show();
- $("#insurance").hide();
- $("#dispatch").hide();
-
- $("#zhujkeshi").hide();
- $("#yukshi").hide();
- $("#yusjian").hide();
- $("#yubzhu").show();
- $("#tration").hide();
- }
- });
- // });
- //预约类别 显示内容
- $("#order_category").change(function(){
- if($("#order_category").find("option:selected").val()=="预约挂号"){
- $("#tration").show();
- $("#insurance").hide();
- $("#bunk").hide();
- $("#dispatch").hide();
-
- $("#yukshi").show();
- $("#yusjian").show();
- $("#yubzhu").show();
- $("#zhujkeshi").hide();
- }else if($("#order_category").find("option:selected").text()=="预约检查"){
- $("#tration").hide();
- $("#insurance").show();
- $("#bunk").hide();
- $("#dispatch").hide();
-
-
- $("#zhujkeshi").show();
- $("#yukshi").hide();
- $("#yusjian").hide();
- $("#yubzhu").show();
- }else if($("#order_category").find("option:selected").text()=="预约床位"){
- $("#tration").hide(); //bunk dispatch zhujkeshi
- $("#insurance").hide();
- $("#bunk").show();
- $("#dispatch").hide();
-
-
- $("#yukshi").show();
- $("#yusjian").hide();
- $("#yubzhu").show();
- $("#zhujkeshi").show();
- }else if($("#order_category").find("option:selected").text()=="预约车辆"){
- $("#tration").hide();
- $("#insurance").hide();
- $("#bunk").hide();
- $("#dispatch").show();
-
-
- $("#yukshi").show();
- $("#yusjian").hide();
- $("#yubzhu").show();
- $("#zhujkeshi").hide();
-
- }
-
- })
- //工单有效性
- $('#order_iseffective').find('input[type="radio"]').on('change', function() {
- //是否有效工单项(0有效,1无效)
- if($(this).val() === "1") { //无效
- $('.order_note').show();
- $('#order_isover_box').hide();
- $('#order_isover').find('input[type="radio"][value="1"]').prop('checked', true).trigger('change');
- } else {
- $('.order_note').hide();
- $('#order_isover_box').show();
- $('#order_isover').find('input[type="radio"][value="0"]').prop('checked', true).trigger('change');
- }
- });
-
- //立即处理
- $(".order_reception_wrapper").hide()
- $("#order_isover_box").find("input[type='radio']").on("change", function(){
- if($(this).val() === "1") {
- $(".order_reception_wrapper").show()
- } else if ($(this).val() === "0") {
- $(".order_reception_wrapper").hide()
- }
- })
- //获取接收部门
- getDepts('reginsTreeView', 'order_transfer_dept');
-
- // 立即处理
- $('#order_isover').find('input[type="radio"]').on('change', function(){
- if($(this).val() === '1'){
- $('#order_transfer_depts').hide();
- }else{
- $('#order_transfer_depts').show();
- }
- });
-
- //新增工单创建
- $('#save_order').on('click', orderSave);
-
- });
- //新建工单 保存
- function orderSave() {
- var order_handle = $('#order_handles').is(':visible') ? $('#order_handle').val() : 0,
- order_transfer_dept = $('#order_transfer_dept').attr('data-id'),//int 接收部门
- order_receiveUser = $('#order_receiveUser').val();//int 接收人
- if($('#order_isover').find('input[type="radio"]:checked').val() === '1'){
- order_transfer_dept = 0;
- order_receiveUser = 0;
- }
-
- $.post(huayi.config.callcenter_url + 'WorkOrderNew/Add', {
- TypeClass:$('#order_type').find('input[type="radio"]:checked').val(), //反馈类型
- CustomerName:$('#order_name').val(), //客户姓名
- CustomerTel:$('#order_tel').val(), //客户电话
- Gender:$('#order_sexte').find('input[type="radio"]:checked').val(), //性别
- Location:$('#order_company').val(), //客户地址
- IsOver:$('#order_isover').find('input[type="radio"]:checked').val(), //是否处理
- DealContents:$('#order_conduct').val(), //处理内容
- Problem:$('#order_reception').val(), //问题描述
- Reservation:$('#order_category').val(), //预约类型
- IDnumber:$('#order_number').val(), //身份证
- Expert:$('#order_expert').val(), //预约专家
- IsMedical:$('#order_advice').find('input[type="radio"]:checked').val(), //是否来院就医
- Project:$('#order_utilities').val(), //预约项目
- AboutcarMan:$('#order_About').val(), //约车人
- CarTel:$('#order_lephone').val(), //约车电话
- TreatmentAddress:$('#order_ocation').val(), //接诊地址
- IsCar:$('#order_chuch').find('input[type="radio"]:checked').val(), //是否出车
- Condition:$('#order_Huebig').val(), //患者病情
- Department:$('#order_office').val(), //预约科室 1111111111111111111111111111111111111
- TranDepartment:$('#order_strtil').val(), //转接科室 222222222222222222222222222
- Remarks:$('#order_strative').val(),//备注
- AppointmentTime:$('#order_time').val(),//预约时间
- DriveoutTime:$('#order_chucetime').val(),//出车时间
- ComplaintDepartment:$('#order_Betou').val(), //被投诉科室
- ComplaintTarget:$('#order_Betxia').val(), //被投诉对象
- IsRelevant:$('#order_xibum').find('input[type="radio"]:checked').val(), //是否转相关部门
- isover: $('#order_isover').find('input[type="radio"]:checked').val(), //int 是否立即处理(默认为0,立即处理为1,立即处理的工单无法指派接收人和接受部门)
- token: $.cookie("token")
- }, function(result) {
- result = $.parseJSON(result);
- if(result.state.toLowerCase() == "success") {
- cleanOrderForm();
- top.workcount();
- layer.msg("保存成功");
- }
- })
- }
- //清空表单
- function cleanOrderForm() {
- $('#order_form').find('input.form-control').val('');
- $('#order_form').find('textarea.form-control').val('');
- $('#order_form').find('select.form-control').val('0');
- $('#order_type').find("input[type='radio'][value='107']").prop("checked", true).trigger('change');
- $('#order_iseffective').find("input[type='radio'][value='0']").prop("checked", true).trigger('change');
- $('#order_transfer_dept').val('').trigger('keyup');
- $('#order_transfer_dept').attr('placeholder', '请选择部门');
- $('#order_transfer_dept').attr('data-id', 0);
- $('#order_receiveUser').selectpicker('destroy');
- $('#order_receiveUser').empty();
- $('#order_receiveUser').append('<option value="0">请选择接收人</option>');
- $('#order_receiveUser').selectpicker('refresh');
- $('#order_form').find('.selectpicker.form-control').selectpicker('val', '0').trigger('change');
- $('#order_source').selectpicker('val', '468').trigger('change');
-
- $('#order_isover').find("input[type='radio'][value='0']").prop("checked", true);
- }
- /**
- * 获取接收部门 获取投诉类型
- * el1, 树形结构元素id名 reginsTreeView
- * el2, 搜索框元素id名 order_transfer_dept
- * */
- function getDepts(el1, el2) {
- //初始化 样式
- $('#' + el2).on('focus click', function() {
- $('#' + el1).removeClass('hidden').addClass('show');
- });
- $('#' + el2).on('keyup', function() {
- if($(this).val() == '') {
- $('#' + el1).treeview('uncheckAll', {
- silent: true
- });
- $(this).attr('data-id', '0');
- }
- });
- $('#' + el2 + ' .caret').on('click', function() {
- $('#' + el1).removeClass('hidden').addClass('show');
- });
- $('#' + el1).mouseleave(function() {
- $(this).removeClass('show').addClass('hidden');
- });
-
- $.getJSON(huayi.config.callcenter_url + 'Department/GetDeptList', {
- token: $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- var defaultDatas = helper.methods.buildTree(result.data);
- var sortChildrenArr = helper.methods.objToArray(defaultDatas[0].children);
- sortChildrenArr.sort(helper.methods.compare('sort'));
- var sortChildrenObj = helper.methods.arrayToObj(sortChildrenArr);
- defaultDatas[0].children = sortChildrenObj;
- if(defaultDatas) {
- var $sTree = $('#' + el1).treeview({
- color: "#1ab394",
- selectedBackColor: '#1ab394',
- expandIcon: 'glyphicon glyphicon-chevron-right',
- collapseIcon: 'glyphicon glyphicon-chevron-down',
- nodeIcon: 'fa fa-folder-o',
- //selectedIcon: "glyphicon glyphicon-stop",
- //icon: "glyphicon glyphicon-stop",
- //emptyIcon: 'glyphicon',
- //showCheckbox: true,
- selectable: true,
- state: {
- selected: true
- },
- data: defaultDatas,
- onNodeSelected: function(event, node) {
- $sTree.treeview('clearSearch');
- $('#' + el2).val(node.text);
- $('#' + el2).attr('data-id', node.id);
- $('#' + el1).removeClass('show').addClass('hidden');
- //获取接收人员
- getReceiveUser($('#order_receiveUser'), node.id);
- },
- onNodeUnselected: function(event, node) {
- $('#' + el2).attr('data-id', 0);
- $('#' + el2).attr('placeholder', '请选择接收部门');
- $('#order_receiveUser').empty();
- $('#order_receiveUser').append('<option value="0">请选择接收人</option>');
- $('#order_receiveUser').selectpicker('refresh');
- }
- });
- // $('#' + el1).treeview('collapseAll', {
- // silent: true
- // });
- $('#' + el1).treeview('expandAll', { levels: 2, silent: true });
- var findSNodes = function() {
- return $sTree.treeview('search', [$('#' + el2).val(), {
- ignoreCase: false,
- exactMatch: false
- }]);
- };
- $('#' + el2).on('keyup focus', function(e) {
- var selectableNodes = findSNodes();
- //var m = $('#' + el1).treeview('getParent', selectableNodes);
- //$('#' + el1).treeview('selectNode', [ m, { silent: true } ]);
- });
- }
- }
- })
- }
- //获取接收人员
- function getReceiveUser(obj, deptid) {
- $.ajax({
- url: huayi.config.callcenter_url + 'UserAccount/GetDeptUserList',
- type: 'get',
- data: {
- deptid: deptid,
- token: $.cookie("token")
- },
- dataType: "json",
- async: true,
- success: function(res) {
- obj.empty();
- if(res.state.toLowerCase() === "success") {
- res = res.data;
- if(res && res.length > 0) {
- obj.append('<option value="0">请选择接收人</option>');
- res.forEach(function(v, i) {
- obj.append('<option value="' + v.F_UserId + '" data-code="'+ v.F_UserCode +'">' + v.F_UserName + '('+ v.F_UserCode +')</option>');
- });
- obj.selectpicker('refresh');
- }
- }
- },
- });
- }
|