| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650 |
- var typeSmall;
- $(document).ready(function () {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep",
- dataType: 'json',
- async: false,
- data: {
- token: $.cookie("token")
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {
- if(data.data.groname == '思念组') {
- $(".snRmove").remove();
-
- $(".dkRmove").show();
- } else {
- $(".snRmove").show();
- $(".complainDiv2").hide();
- $(".dkRmove").remove();
- }
- }
- }
- });
- var groupcode = $('#groupcode', top.document).val();
- if (groupcode == 'SCZ') {
- $("#usedate").text("饮用日期:");
- $("#vipid").text("对接人:");
- $("#vipphone").text("对接人电话:");
- }
- var id = helper.request.queryString("id");
- var phone = helper.request.queryString("phone");
- var name = helper.request.queryString("name");
-
- // laydate.render({
- // elem: '#productDate',
- // theme: '#1ab394',
- // calendar: 'true'
- // });
- // 产品代码
- getProductType();
- // 问题代码
- getProblemCode();
- // 重要级别
- getDealTimely();
- //生产厂家
- getProductFactory();
- // 区域
- // getArea($("#customer_area"));
- // 省 办事处
- LAISHENG($("#source"));//省
- CHOUDQ($("#customer_comaddress")); //大区
- //普通工单禁止选择原因
- $('#reason').attr("disabled", "disabled");
-
- ////编辑器配置 客服部
- //KindEditor.ready(function(K) {
- // window.changeEditor = K.create('#feedBackCon'); //修改弹出框编辑器
- //})
- ////编辑器配置 市场部 备注
- //KindEditor.ready(function(K) {
- // window.marketEditor = K.create('#remark_market');
- //})
- //保存
- $('.customerSubmit').click(function() {
- saveCustomer();
- })
- if(id) {
- $("#CallID").val(id);
- $("#tel").val(phone);
- $("#tel_market").val(phone);
- if(unescape(decodeURI(name)) != 'null' && unescape(decodeURI(name)) != 'undefined') {
- $("#name_market").val(unescape(decodeURI(name)));
- $("#name").val(unescape(decodeURI(name)));
- }
- }
- $('.areaDown').click(function () {
- if ($('.treeList1').css('display') == 'block') {
- $('.treeList1').css('display', 'none')
- } else {
- $('.treeList1').css('display', 'block')
- }
- })
- $('#typeclass').click(function () {
- $('.treeList1').css('display', 'block')
- })
- $('.treeList1').mouseleave(function () {
- $(this).css('display', 'none')
- })
- $(".orderType").change(function () {
-
- if ($(".orderType option:selected").text() != "投诉") {
- $(".complainDiv2").show();
- typeSmall =$(".complaintType2").val();
- $(".complainDiv").hide();
- } else {
- $(".complainDiv2").hide();
- $(".complainDiv").show();
- typeSmall =$(".complaintType1").val();
- }
- });
- $(".complaintType2").change(function () {
- typeSmall=$(".complaintType2").val();
- });
- $(".complaintType1").change(function () {
- typeSmall=$(".complaintType1").val();
- });
- //获取专员手机号
- $("#vipName").change(function () {
- $("#vipTel").val($("#vipName option:selected").attr("index"));
- if ($("#vipName option:selected").attr("province")==undefined) {
- $("#typeclass").val("");
- } else {
- $("#typeclass").val($("#vipName option:selected").attr("province") + "/" + $("#vipName option:selected").attr("city"));
- $(".inps2").val($("#vipName option:selected").attr("province"));
- $(".inps3").val($("#vipName option:selected").attr("city"));
- }
-
- });
-
- //重复工单
- $('#order_isover').find('input[type="radio"]').on('change', function() {
- if($(this).val() === '3') {
- radioRepeat();
- $("#order_isover input[name='type'][value='1']").prop("checked","checked"); //咨询
- }
- });
-
- })
- //大区
- //function getArea(obj) {
- // obj.empty();
- // obj.append('<option selected="selected" value="">请选择</option>');
- // $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
- // "token": $.cookie("token"),
- // pid: 1,
- // F_Layer: 1,
- // }, function (data) {
- // if (data.state.toLowerCase() == "success") {
- // var content = data.data;
- // $(content).each(function (i, n) {
- // $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- // })
- // }
- // })
- //}
- //办事处
- //function getOffice(obj) {
- // obj.empty();
- // obj.append('<option selected="selected" value="">请选择</option>');
- // $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
- // "token": $.cookie("token"),
- // F_Layer:2,
- // pid:$("#customer_area").val(),
- // }, function (data) {
- // if (data.state.toLowerCase() == "success") {
- // var content = data.data;
- // $(content).each(function (i, n) {
- // $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- // })
- // }
- // })
- //}
- // 获取所在区域办事处
- //$("#customer_area").on("change", function() {
- // getOffice($("#customer_office"))
- //})
- //省 市 区/县
- //省
- function LAISHENG(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- pid: 0,
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
- })
- }
- //市
- function LAISHI(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- pid:$('#source').val(),
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
-
- })
- }
- // 区/县
- function LAIQU(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- pid:$('#type').val(),
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
- })
- }
- $('#source').on('change',function(){
- LAISHI($("#type"));
- });
- $('#type').on('change',function(){
- LAIQU($("#keyid"));
- });
- //大区 提交人
- function CHOUDQ(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
- "token": $.cookie("token"),
- pid: 1,
- F_Layer: 1,
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- })
- }
- })
- }
- // 提交人
- function getSubmitter(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="" deptId="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "UserAccount/GetList", {
- "token": $.cookie("token"),
- type: 1,
- dptid: $("#customer_comaddress").val(),
- pagesize: 100,
- }, function (data) {
- var content = data.rows;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_UserId + "'deptId='" + n.F_DeptId + "'>" + n.F_DeptName + " - " + n.F_UserName + "</option>").appendTo(obj);
- })
- })
- }
- // 获取提交人
- $('#customer_comaddress').on('change',function(){
- getSubmitter($('#customer_submitter'));
- });
- //产品代码
- function getProductType() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "CPDM"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#productType"));
- })
- }
- });
- }
- // 问题代码
- function getProblemCode() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "WTDM"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#problemCode"));
- })
- }
- });
- }
- // 重要级别
- function getDealTimely() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "GDDJ"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#dealTimely"));
- })
- }
- });
- }
- // 重要级别原因(Ⅰ级)
- function getReasonOne() {
- $("#reason").empty();
- $("#reason").append("<option value='' selected='selected'>请选择</option>");
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "YJYY"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#reason"));
- })
- }
- });
- }
- // 重要级别原因(Ⅱ级)
- function getReasonTwo() {
- $("#reason").empty();
- $("#reason").append("<option value='' selected='selected'>请选择</option>");
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "EJYY"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Name + '">' + n.F_Name + '</option>').appendTo($("#reason"));
- })
- }
- });
- }
- // 生产厂家
- function getProductFactory() {
- $("#productFactoryDataList").empty();
- $("#productFactoryDataList").append('<option value="请选择"></option>');
- $("#productFactoryDataList").append('<option value="不清"></option>');
- $.getJSON(huayi.config.callcenter_url + "EquipmentNumber/GetList", {
- "token": $.cookie("token"),
- keywords: "",
- pageindex: "1",
- pagesize: "200",
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.rows;
- $(content).each(function (i, n) {
- $("#productFactoryDataList").append('<option value="'+ n.F_Production + '">');
- })
- }
- })
- }
- // 重要级别显示原因
- $('#dealTimely').on('change',function(){
- if ($('#dealTimely').val() === 'Ⅰ级'){
- $('#reason').val('');
- $('#reason').removeAttr("disabled");
- getReasonOne();
- } else if ($('#dealTimely').val() === 'Ⅱ级' ){
- $('#reason').val('');
- $('#reason').removeAttr("disabled");
- getReasonTwo();
- } else {
- $('#reason').val('');
- $('#reason').attr("disabled", "disabled");
- }
- })
- // 指派事件
- $('#isAssign').on('change', function(){
- if($('#isAssign input[name="isAssign"]:checked').val() === '1'){
- $('.comaddressTitle').show();
- $('.comaddressSelect').show();
- $('.submitterTitle').show();
- $('.submitterSelect').show();
- } else if ($('#isAssign input[name="isAssign"]:checked').val() === '0'){
- $('.comaddressTitle').hide();
- $('.comaddressSelect').hide();
- $('.submitterTitle').hide();
- $('.submitterSelect').hide();
- }
- })
- // 地址(省+市+区/县)
- function detailedAddress() {
- if($('#source').val() === ""){
- var province = '';
- } else {
- var province = $('#source').find("option:selected").text()
- }
- if($('#type').val() === ""){
- var city = '';
- } else {
- var city = $('#type').find("option:selected").text()
- }
- if($('#keyid').val() === ""){
- var county = '';
- } else {
- var county = $('#keyid').find("option:selected").text()
- }
- if($('#addressDescription').val === ""){
- var addressDescription = '';
- } else {
- var addressDescription = $('#addressDescription').val();
- }
- var address = province + '-' + city + '-' + county + '-' + addressDescription;
- return address;
- }
- var setting = {
- data: {
- key: {
- name: "F_AreaName"
- },
- simpleData: {
- enable: true,
- idKey: "F_Id",
- pIdKey: "F_ParentId",
- rootPId: 0
- }
- },
- callback: {
- onClick: changeTreeClick
- }
- }
- function changeTreeClick(event, treeId, treeNode) {
- var areaParent = treeNode.getPath();
- if (areaParent[1]) {
- areaParent1=areaParent[0].F_AreaName
- areaParent2=areaParent[1].F_AreaName
-
- $('#typeclass').val(areaParent1+"/"+areaParent2);
- $('.inps2').val(areaParent1);
- $('.inps3').val(areaParent2);
- ComplaintVip();
-
- }else{
- layer.msg("请选择最下级菜单");
- }
- $('.addTree1').hide();
-
- };
- //工单来源
- function getOrderSource(obj) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "GDLY"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
- })
- }
- });
- }
- //客诉专员
- function ComplaintVip() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Customer/GetAllList",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- type: 2,
- province: $('.inps2').val(), //省
- city: $('.inps3').val() //市
- },
- success: function(data) {
- $("#vipName").empty();
- var Count = data.data;
- $('<option value="">请选择专员</option>').appendTo($("#vipName"));
- $(Count).each(function (i, n) {
- $('<option value="' + n.F_Id
- + '" index="' + n.F_Phone
- + '" areaText="' + n.F_Area
- + '" province="' + n.F_Province
- + '" city="' + n.F_City + '">' + n.F_Name
- + '</option>').appendTo($("#vipName"));
- })
- }
- });
- }
- //保存
- function saveCustomer() {
- if(!$('#name').val()) {
- layer.confirm('请输入姓名!', {
- icon: 2,
- btn: ['确定']
- });
- return;
- }
- if(!$('#tel').val()) {
- layer.confirm('请输入电话!', {
- icon: 2,
- btn: ['确定']
- });
- return;
- }
- if(!$('#qualityProblem').val()) {
- layer.confirm('请输入质量问题!', {
- icon: 2,
- btn: ['确定']
- });
- return;
- }
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/AddWorkOrder",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('.customerSubmit').attr("disabled", true);
- $('.customerSubmit').text('保存中...');
- },
- data: {
- token: $.cookie("token"),
- IsAssign: $('#isAssign input[name="isAssign"]:checked').val(),//是否指派
- clbm: $('#customer_submitter').find("option:selected").attr("deptId"), //提交部门
- clid: $('#customer_submitter').val(), //提交人
- // cont: $('#cont').val(), //提交内容
- F_Type: $('#order_isover input[name="type"]:checked').val(), //工单类型
- // F_Area: $('#customer_area').val(), //大区
- F_Area: "",
- // F_Office: $('#customer_office').val(), //办事处
- F_Office: "",
- F_DealTimely: $('#dealTimely').val(), //重要级别
- F_Reason: $('#reason').val(), //原因
- F_CusName: $('#name').val(), //姓名
- F_CusPhone: $('#tel').val(), //号码
- F_AddRess: detailedAddress(),//地址
- F_ProductType: $('#productType').val(), //产品代码
- F_ProductName: $('#productName').val(), //产品名称
- F_Specifications: $('#specification').val(), //规格
- F_ProductDate: $('#productDate').val(), //生产日期
- F_BatchNumber: $('#productNumber').val(), //产品编码
- F_Manufacturer: $('#productFactory').val(), //生产厂家
- F_ProblemCode: $('#problemCode').val(), //问题代码
- F_QualityProblem: $('#qualityProblem').val(), //质量问题
- F_Content: $('#remark').val(), //备注
- F_Duplicate: $('#duplicate input[name="duplicate"]:checked').val(), //重复工单
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('保存');
- layer.msg("保存成功!");
- clear();
- setTimeout("window.location.reload()", 1000); //页面刷新
- } else {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('保存');
- }
- }
- });
- }
- function clear() {
- $('#name').val('');
- $('#tel').val(''); //号码
- // $('#customer_area').val('');
- $('#source').val('');
- $('#type').val('');
- $('#keyid').val('');
- $('#productType').val('');
- $('#productName').val('');
- $('#specification').val('');
- $('#productDate').val('');
- $('#productNumber').val('');
- $('#productFactory').val('');
- $('#problemCode').val('');
- $('#qualityProblem').val('');
- $('#dealTimely').val('');
- $('#reason').val('');
- $('#customer_comaddress').val('');
- $('#customer_submitter').val('');
- // $('#cont').val('');
- $('#remark').val('');
- }
- // 重复工单
- function radioRepeat(id){
- layer.open({
- type: 2,
- title: '重复工单',
- maxmin: true, //开启最大化最小化按钮
- area: ['80%', '90%'],
- content: "../WorkOrder/WorkOrderRepeat.html?id=" + id
- });
- }
|