Aucune description

xgWork.js 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. var typeSmall;
  2. var id = helper.request.queryString("id");
  3. $(document).ready(function () {
  4. $.ajax({
  5. type: "get",
  6. url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep",
  7. dataType: 'json',
  8. async: false,
  9. data: {
  10. token: $.cookie("token")
  11. },
  12. success: function(data) {
  13. if(data.state.toLowerCase() == 'success') {
  14. if(data.data.groname == '思念组') {
  15. $(".snRmove").remove();
  16. $(".dkRmove").show();
  17. } else {
  18. $(".snRmove").show();
  19. $(".complainDiv2").hide();
  20. $(".dkRmove").remove();
  21. $(".ns-2").remove();
  22. }
  23. }
  24. }
  25. });
  26. var groupcode = $('#groupcode', top.document).val();
  27. if (groupcode == 'SCZ') {
  28. $("#usedate").text("饮用日期:");
  29. $("#vipid").text("对接人:");
  30. $("#vipphone").text("对接人电话:");
  31. }
  32. // laydate.render({
  33. // elem: '.userDate',
  34. // theme: '#1ab394',
  35. // calendar: 'true'
  36. // });
  37. // laydate.render({
  38. // elem: '.buyDate',
  39. // theme: '#1ab394',
  40. // calendar: 'true'
  41. // });
  42. // laydate.render({
  43. // elem: '#productDate',
  44. // theme: '#1ab394',
  45. // calendar: 'true'
  46. // });
  47. $.ajaxSettings.async = false;
  48. // 产品代码
  49. getProductType();
  50. // 问题代码
  51. getProblemCode();
  52. // 重要级别
  53. getDealTimely();
  54. // 重要级别原因
  55. getReason();
  56. //大区
  57. getArea($("#customer_area"));
  58. // 省 办事处
  59. LAISHENG($("#source"));//省
  60. CHOUDQ($("#customer_comaddress")); //办事处
  61. // 隐藏重要级别原因
  62. $('.reasonTitle').hide();
  63. $('.reasonInput').hide();
  64. //客诉专员
  65. ComplaintVip();
  66. //保存
  67. $('.customerSubmit').click(function() {
  68. saveCustomer();
  69. });
  70. $.ajaxSettings.async = true;
  71. var id = helper.request.queryString("id");
  72. $.ajax({
  73. type: "get",
  74. url: huayi.config.callcenter_url + "WorkOrder/GetDetails",
  75. dataType: 'json',
  76. async: true,
  77. cache: false,
  78. data: {
  79. id: id,
  80. token: $.cookie("token")
  81. },
  82. success: function(result) {
  83. if (result.rows.length > 0) {
  84. var data = result.rows[0];
  85. $("#workOrderId").val(data.F_WorkOrderId); //工单编号
  86. // $("#order_isover").val(data.F_Type); // 工单类别
  87. $("#customer_area option:selected").text(data.F_AreaName); // 大区名称
  88. $("#customer_area option:selected").val(data.F_Area); // 大区
  89. $("#customer_office option:selected").text(data.F_OfficName); //办事处名称
  90. $("#customer_office option:selected").val(data.F_Office); //办事处
  91. // $("#detailCreateTime").text(data.F_CreateTime); // 投诉时间
  92. $("#name").val(data.F_CusName); // 姓名
  93. $("#tel").val(data.F_CusPhone); // 电话
  94. $("#productName").val(data.F_ProductName); // 产品名称
  95. $('#specification').val(data.F_Specifications); // 规格
  96. $("#productDate").val(data.F_ProductDate); // 生产日期
  97. $("#productNumber").val(data.F_BatchNumber); // 产品编码
  98. $("#productFactory").val(data.F_Manufacturer); // 产品厂家
  99. $("#problemCode").find("option:selected").text(data.F_ProblemCode); // 问题代码
  100. $("#productType").find("option:selected").text(data.F_ProductType); // 产品代码
  101. $("#qualityProblem").val(data.F_QualityProblem); // 质量问题
  102. $("#duplicate").val(data.F_Duplicate); // 重复工单
  103. $("#remark").val(data.F_Content); // 备注
  104. //工单类型
  105. $("#order_isover input[type=radio][name=type][value="+data.F_Type+"]").attr("checked",'checked');
  106. //重复工单
  107. $("#duplicate input[type=radio][name=duplicate][value="+data.duplicate+"]").attr("checked",'checked');
  108. // 工单来源
  109. workOrderSourceDisplay(data);
  110. // 重要级别
  111. dealTimelyDisplay(data);
  112. // 重要级别原因
  113. dealTimelyReasonDisplay(data);
  114. // 省市县
  115. provinceCity(data)
  116. }
  117. }
  118. });
  119. $(".complaintType2").change(function () {
  120. typeSmall=$(".complaintType2").val();
  121. });
  122. $(".complaintType1").change(function () {
  123. typeSmall=$(".complaintType1").val();
  124. });
  125. $('.areaDown').click(function() {
  126. if ($('.treeList1').css('display') == 'block') {
  127. $('.treeList1').css('display', 'none')
  128. } else {
  129. $('.treeList1').css('display', 'block')
  130. }
  131. })
  132. $('#typeclass').click(function() {
  133. $('.treeList1').css('display', 'block')
  134. })
  135. $('.treeList1').mouseleave(function() {
  136. $(this).css('display', 'none')
  137. })
  138. //获取专员手机号
  139. $("#vipName").change(function() {
  140. $("#vipTel").val($("#vipName option:selected").attr("index"));
  141. //$("#areaInps").val($("#vipName option:selected").attr("areaText"));
  142. $("#typeclass").val($("#vipName option:selected").attr("province") + "/" + $("#vipName option:selected").attr("city"));
  143. $(".inps2").val($("#vipName option:selected").attr("province"));
  144. $(".inps3").val($("#vipName option:selected").attr("city"));
  145. });
  146. })
  147. // 工单来源显示
  148. function workOrderSourceDisplay(data) {
  149. if (data.F_Source === 1) {
  150. $("#workOrderSource").val("PC")
  151. } else if (data.F_Source === 2){
  152. $("#workOrderSource").val("APP")
  153. } else if (data.F_Source === 3) {
  154. $("#workOrderSource").val("微信")
  155. } else {
  156. $("#workOrderSource").val("")
  157. }
  158. }
  159. // 重要级别显示
  160. function dealTimelyDisplay(data) {
  161. if (data.F_DealTimely === 506) {
  162. $("#dealTimely option:selected").text("Ⅰ级");
  163. $("#dealTimely option:selected").val(506);
  164. } else if (data.F_DealTimely === 507) {
  165. $("#dealTimely option:selected").text("Ⅱ级");
  166. $("#dealTimely option:selected").val(507);
  167. } else if (data.F_DealTimely === 508) {
  168. $("#dealTimely option:selected").text("普通工单");
  169. $("#dealTimely option:selected").val(508);
  170. }
  171. }
  172. // 重要级别原因显示
  173. function dealTimelyReasonDisplay(data) {
  174. if (data.F_DealTimely === 506) {
  175. $('.reasonTitle').show();
  176. $('.reasonInput').show();
  177. if (data.F_Reason === "509") {
  178. $("#reason option:selected").text("涉媒");
  179. $("#reason option:selected").val(509);
  180. } else if (data.F_Reason === "510") {
  181. $("#reason option:selected").text("政府");
  182. $("#reason option:selected").val(510);
  183. } else if (data.F_Reason === "511") {
  184. $("#reason option:selected").text("恶性杂志");
  185. $("#reason option:selected").val(511);
  186. }
  187. } else {
  188. $("#reason option:selected").text("请选择");
  189. $("#reason option:selected").val("");
  190. }
  191. }
  192. //省市县回显
  193. function provinceCity(data){
  194. var provinceCityArr = data.F_AddRess.split("-");
  195. $("#source option:selected").text(provinceCityArr[0]);
  196. $("#type option:selected").text(provinceCityArr[1]);
  197. $("#keyid option:selected").text(provinceCityArr[2]);
  198. }
  199. // 大区
  200. function getArea(obj) {
  201. obj.empty();
  202. obj.append('<option selected="selected" value="">请选择</option>');
  203. $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
  204. "token": $.cookie("token"),
  205. pid: 1,
  206. F_Layer: 1,
  207. }, function (data) {
  208. if (data.state.toLowerCase() == "success") {
  209. var content = data.data;
  210. $(content).each(function (i, n) {
  211. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  212. })
  213. }
  214. })
  215. }
  216. //办事处
  217. function getOffice(obj) {
  218. obj.empty();
  219. obj.append('<option selected="selected" value="">请选择</option>');
  220. $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
  221. "token": $.cookie("token"),
  222. F_Layer:2,
  223. pid:$("#customer_area").val(),
  224. }, function (data) {
  225. if (data.state.toLowerCase() == "success") {
  226. var content = data.data;
  227. $(content).each(function (i, n) {
  228. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  229. })
  230. }
  231. })
  232. }
  233. // 获取所在大区办事处
  234. $("#customer_area").on("change", function() {
  235. getOffice($("#customer_office"))
  236. })
  237. //省 市 区/县
  238. //省
  239. function LAISHENG(obj) {
  240. obj.empty();
  241. obj.append('<option selected="selected" value="">请选择</option>');
  242. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
  243. "token": $.cookie("token"),
  244. pid: 0,
  245. }, function (data) {
  246. if (data.state.toLowerCase() == "success") {
  247. var content = data.data;
  248. $(content).each(function (i, n) {
  249. $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  250. })
  251. }
  252. })
  253. }
  254. //市
  255. function LAISHI(obj) {
  256. obj.empty();
  257. obj.append('<option selected="selected" value="">请选择</option>');
  258. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
  259. "token": $.cookie("token"),
  260. pid:$('#source').val(),
  261. }, function (data) {
  262. if (data.state.toLowerCase() == "success") {
  263. var content = data.data;
  264. $(content).each(function (i, n) {
  265. $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  266. })
  267. }
  268. })
  269. }
  270. // 区/县
  271. function LAIQU(obj) {
  272. obj.empty();
  273. obj.append('<option selected="selected" value="">请选择</option>');
  274. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
  275. "token": $.cookie("token"),
  276. pid:$('#type').val(),
  277. }, function (data) {
  278. if (data.state.toLowerCase() == "success") {
  279. var content = data.data;
  280. $(content).each(function (i, n) {
  281. $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  282. })
  283. }
  284. })
  285. }
  286. $('#source').on('change',function(){
  287. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
  288. "token": $.cookie("token"),
  289. F_Layer: 2,
  290. F_RegionName:$('#source').val(),
  291. }, function (data) {
  292. if (data.state.toLowerCase() == "success") {
  293. var content = data.data;
  294. $(content).each(function (i, n) {
  295. $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo("#type");
  296. })
  297. LAISHI($("#type"));
  298. }
  299. })
  300. });
  301. $('#type').on('change',function(){
  302. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
  303. "token": $.cookie("token"),
  304. F_Layer: 3,
  305. F_RegionName:$('#type').val()
  306. }, function (data) {
  307. if (data.state.toLowerCase() == "success") {
  308. var content = data.data;
  309. $(content).each(function (i, n) {
  310. $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo("#keyid");
  311. })
  312. LAIQU($("#keyid"));
  313. }
  314. })
  315. });
  316. $('#keyid').on('change',function(){
  317. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
  318. "token": $.cookie("token"),
  319. F_Layer: 4,
  320. F_RegionName:$('#keyid').val()
  321. }, function (data) {
  322. if (data.state.toLowerCase() == "success") {
  323. var content = data.data;
  324. $(content).each(function (i, n) {
  325. $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo("#input_area");
  326. })
  327. LAIXIANG($('#input_area'));
  328. }
  329. })
  330. });
  331. //办事处 提交人
  332. function CHOUDQ(obj) {
  333. obj.empty();
  334. obj.append('<option selected="selected" value="">请选择</option>');
  335. $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
  336. "token": $.cookie("token"),
  337. pid: 1,
  338. F_Layer: 1,
  339. }, function (data) {
  340. if (data.state.toLowerCase() == "success") {
  341. var content = data.data;
  342. $(content).each(function (i, n) {
  343. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  344. })
  345. }
  346. })
  347. }
  348. //办事处
  349. function CHOUFEN(obj) {
  350. obj.empty();
  351. obj.append('<option selected="selected" value="">请选择</option>');
  352. $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
  353. "token": $.cookie("token"),
  354. F_Layer:2,
  355. pid:$("#customer_comaddress").val(),
  356. }, function (data) {
  357. if (data.state.toLowerCase() == "success") {
  358. var content = data.data;
  359. $(content).each(function (i, n) {
  360. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  361. })
  362. }
  363. })
  364. }
  365. // 提交人
  366. function getSubmitter(obj) {
  367. obj.empty();
  368. obj.append('<option selected="selected" value="" deptId="">请选择</option>');
  369. $.getJSON(huayi.config.callcenter_url + "UserAccount/GetList", {
  370. "token": $.cookie("token"),
  371. type: 1,
  372. dptid: $("#customer_comaddress").val(),
  373. }, function (data) {
  374. console.log('123123123')
  375. var content = data.rows;
  376. $(content).each(function (i, n) {
  377. $("<option value='" + n.F_UserId + "'deptId='" + n.F_DeptId + "'>" + n.F_UserName + "</option>").appendTo(obj);
  378. })
  379. })
  380. }
  381. // 获取提交人
  382. $('#customer_comaddress').on('change',function(){
  383. getSubmitter($('#customer_submitter'));
  384. });
  385. //产品代码
  386. function getProductType() {
  387. $.ajax({
  388. type: "get",
  389. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  390. dataType: 'json',
  391. async: true,
  392. data: {
  393. token: $.cookie("token"),
  394. flag: "CPDM"
  395. },
  396. success: function(data) {
  397. var Count = data.data;
  398. $(Count).each(function(i, n) {
  399. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#productType"));
  400. })
  401. }
  402. });
  403. }
  404. // 问题代码
  405. function getProblemCode() {
  406. $.ajax({
  407. type: "get",
  408. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  409. dataType: 'json',
  410. async: true,
  411. data: {
  412. token: $.cookie("token"),
  413. flag: "WTDM"
  414. },
  415. success: function(data) {
  416. var Count = data.data;
  417. $(Count).each(function(i, n) {
  418. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#problemCode"));
  419. })
  420. }
  421. });
  422. }
  423. // 重要级别
  424. function getDealTimely() {
  425. $.ajax({
  426. type: "get",
  427. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  428. dataType: 'json',
  429. async: true,
  430. data: {
  431. token: $.cookie("token"),
  432. flag: "GDDJ"
  433. },
  434. success: function(data) {
  435. var Count = data.data;
  436. $(Count).each(function(i, n) {
  437. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#dealTimely"));
  438. })
  439. }
  440. });
  441. }
  442. // 重要级别原因
  443. function getReason() {
  444. $.ajax({
  445. type: "get",
  446. url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
  447. dataType: 'json',
  448. async: true,
  449. data: {
  450. token: $.cookie("token"),
  451. flag: "YJYY"
  452. },
  453. success: function(data) {
  454. var Count = data.data;
  455. $(Count).each(function(i, n) {
  456. $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#reason"));
  457. })
  458. }
  459. });
  460. }
  461. // 重要级别为一级时显示原因
  462. $('#dealTimely').on('change',function(){
  463. console.log('1111',$('#dealTimely').val());
  464. if ($('#dealTimely').val() !== '506'){
  465. $('#reason').val('');
  466. $('.reasonTitle').hide();
  467. $('.reasonInput').hide();
  468. } else {
  469. $('.reasonTitle').show();
  470. $('.reasonInput').show();
  471. }
  472. })
  473. // 指派事件
  474. $('#isAssign').on('change', function(){
  475. if($('#isAssign input[name="isAssign"]:checked').val() === '1'){
  476. $('.comaddressTitle').show();
  477. $('.comaddressSelect').show();
  478. $('.submitterTitle').show();
  479. $('.submitterSelect').show();
  480. } else if ($('#isAssign input[name="isAssign"]:checked').val() === '2'){
  481. $('.comaddressTitle').hide();
  482. $('.comaddressSelect').hide();
  483. $('.submitterTitle').hide();
  484. $('.submitterSelect').hide();
  485. }
  486. })
  487. // 地址(省+市+区/县)
  488. function detailedAddress() {
  489. if($('#source').val() === ""){
  490. var province = '';
  491. } else {
  492. var province = $('#source').find("option:selected").text()
  493. }
  494. if($('#type').val() === ""){
  495. var city = '';
  496. } else {
  497. var city = $('#type').find("option:selected").text()
  498. }
  499. if($('#keyid').val() === ""){
  500. var county = '';
  501. } else {
  502. var county = $('#keyid').find("option:selected").text()
  503. }
  504. var address = province + '-' + city + '-' + county;
  505. return address;
  506. }
  507. //处理状态
  508. dealState();
  509. function dealState() {
  510. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  511. "token": $.cookie("token"),
  512. flag: "CLZT"
  513. }, function(result) {
  514. result = $.parseJSON(result);
  515. var Count = result.data;
  516. $(Count).each(function(i, n) {
  517. $('<label style="font-weight: normal; margin-right: 15px;">'+
  518. '<input type="radio" value="' + n.F_DictionaryValueId
  519. + '" name="ltype"/>' + n.F_Name
  520. + '</label>').appendTo($(".disposeST"));
  521. })
  522. $('.disposeST input:radio:first').attr('checked', 'checked');
  523. });
  524. }
  525. //响应状态
  526. responseState();
  527. function responseState() {
  528. $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
  529. "token": $.cookie("token"),
  530. flag: "XYZT"
  531. }, function(result) {
  532. result = $.parseJSON(result);
  533. var Count = result.data;
  534. $(Count).each(function(i, n) {
  535. $('<label style="font-weight: normal; margin-right: 15px;">'+
  536. '<input type="radio" value="' + n.F_DictionaryValueId
  537. + '" name="response"/>' + n.F_Name
  538. + '</label>').appendTo($(".responseST"));
  539. })
  540. $('.responseST input:radio:first').attr('checked', 'checked');
  541. });
  542. }
  543. var setting = {
  544. data: {
  545. key: {
  546. name: "F_AreaName"
  547. },
  548. simpleData: {
  549. enable: true,
  550. idKey: "F_Id",
  551. pIdKey: "F_ParentId",
  552. rootPId: 0
  553. }
  554. },
  555. callback: {
  556. onClick: changeTreeClick
  557. }
  558. }
  559. function changeTreeClick(event, treeId, treeNode) {
  560. var areaParent = treeNode.getPath();
  561. if (areaParent[1]) {
  562. areaParent1 = areaParent[0].F_AreaName
  563. areaParent2 = areaParent[1].F_AreaName
  564. $('#typeclass').val(areaParent1 + "/" + areaParent2);
  565. $('.inps2').val(areaParent1);
  566. $('.inps3').val(areaParent2);
  567. ComplaintVip();
  568. } else {
  569. layer.msg("请选择最下级菜单");
  570. }
  571. $('.addTree1').hide();
  572. };
  573. //客诉专员
  574. function ComplaintVip() {
  575. $.ajax({
  576. type: "get",
  577. url: huayi.config.callcenter_url + "Customer/GetAllList",
  578. dataType: 'json',
  579. async: true,
  580. data: {
  581. token: $.cookie("token"),
  582. type: 2,
  583. province: $('.inps2').val(), //省
  584. city: $('.inps3').val() //市
  585. },
  586. success: function(data) {
  587. $("#vipName").empty();
  588. var Count = data.data;
  589. $('<option value="">请选择专员</option>').appendTo($("#vipName"));
  590. $(Count).each(function(i, n) {
  591. $('<option value="' + n.F_Id
  592. + '" index="' + n.F_Phone
  593. + '" areaText="' + n.F_Area
  594. + '" province="' + n.F_Province
  595. + '" city="' + n.F_City + '">' + n.F_Name
  596. + '</option>').appendTo($("#vipName"));
  597. })
  598. }
  599. });
  600. }
  601. //保存
  602. function saveCustomer() {
  603. var val = $("input[name='ltype']:checked").val();
  604. var valRes = $("input[name='response']:checked").val();
  605. var dealCost;
  606. if (isNaN($("#dealCost").val())) {
  607. dealCost="";
  608. }else{
  609. dealCost=$("#dealCost").val();
  610. }
  611. if (!$('#name').val()) {
  612. layer.confirm('请输入姓名!', {
  613. icon: 2,
  614. btn: ['确定']
  615. });
  616. return;
  617. }
  618. if (!$('#tel').val()) {
  619. layer.confirm('请输入电话!', {
  620. icon: 2,
  621. btn: ['确定']
  622. });
  623. return;
  624. }
  625. if(!$('#qualityProblem').val()) {
  626. layer.confirm('请输入质量问题!', {
  627. icon: 2,
  628. btn: ['确定']
  629. });
  630. return;
  631. }
  632. $.ajax({
  633. type: "post",
  634. url: huayi.config.callcenter_url + "WorkOrder/UpdateWorkOrder",
  635. dataType: 'json',
  636. async: true,
  637. beforeSend: function() { //触发ajax请求开始时执行
  638. $('.customerSubmit').attr("disabled", true);
  639. $('.customerSubmit').text('保存中...');
  640. },
  641. data: {
  642. token: $.cookie("token"),
  643. F_Id: id,
  644. F_Type: $('#order_isover input[name="type"]:checked').val(), //工单类型
  645. F_Area: $('#customer_area').val(), //大区
  646. F_Office: $('#customer_office').val(), //办事处
  647. F_DealTimely: $('#dealTimely').val(), //重要级别
  648. F_Reason: $('#reason').val(), //原因
  649. F_CusName: $('#name').val(), //姓名
  650. F_CusPhone: $('#tel').val(), //号码
  651. F_AddRess: detailedAddress(),//地址
  652. F_ProductType: $('#productType').find("option:selected").text() === '请选择' ? '' : $('#productType').find("option:selected").text(), //产品代码
  653. F_ProductName: $('#productName').val(), //产品名称
  654. F_Specifications: $('#specification').val(), //规格
  655. F_ProductDate: $('#productDate').val(), //生产日期
  656. F_BatchNumber: $('#productNumber').val(), //产品编码
  657. F_Manufacturer: $('#productFactory').val(), //产品厂家
  658. F_ProblemCode: $('#problemCode').find("option:selected").text() === '请选择' ? '' : $('#problemCode').find("option:selected").text(), //问题代码
  659. F_QualityProblem: $('#qualityProblem').val(), //质量问题
  660. F_Content: $('#remark').val(), //备注
  661. F_Duplicate: $('#duplicate input[name="duplicate"]:checked').val(), //重复工单
  662. },
  663. success: function(data) {
  664. if (data.state.toLowerCase() == 'success') {
  665. $('.customerSubmit').attr("disabled", false);
  666. $('.customerSubmit').text('保存');
  667. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  668. parent.layer.close(index); //再执行关闭
  669. parent.layer.msg("保存成功!");
  670. parent.$('#workorderlist').bootstrapTable('refresh');
  671. parent.$('#orderlist').bootstrapTable('refresh');
  672. } else {
  673. $('.customerSubmit').attr("disabled", false);
  674. $('.customerSubmit').text('保存');
  675. }
  676. }
  677. });
  678. }