Bez popisu

xgWork.js 22KB

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