Няма описание

AddWorkOrder.js 24KB

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