Nav apraksta

AddWorkOrder.js 24KB

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