暫無描述

xgWork.js 26KB

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