説明なし

xgWork.js 26KB

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