Brak opisu

addOrEditWorkOrder.js 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. /**
  2. * 修改工单
  3. * */
  4. //获取 id
  5. var oid = helper.request.queryString("oid");
  6. $(function() {
  7. autosize($('textarea'));
  8. $.when(helper.getDropList.getlistDropByDic($('#order_source'), 'GDLY'),
  9. helper.getDropList.getlistDropByDic($('#order_handle'), 'YWLX'),
  10. helper.getDropList.getOrderRadios($('#order_type'), 'GDLX', 'inlineRadioOptions'))
  11. .then(function() {
  12. if(oid) {
  13. getWorkOrderDetails(oid); //获取工单信息
  14. }
  15. });
  16. });
  17. //**所有input去掉自动填充
  18. $(function(){          
  19. $('input:not([autocomplete]),textarea:not([autocomplete]),select:not([autocomplete])').attr('autocomplete', 'off'); 
  20. });
  21. function clearInter() {
  22. clearInterval(timer);
  23. }
  24. var callId = helper.request.queryString("cid");
  25. //保存按钮
  26. $('#save_order').click(function() {
  27. orderSave();
  28. });
  29. //投诉和抽检客户 物料编号清空
  30. function emptyct() {
  31. $('#number').val('');
  32. $('#salesman').val('');
  33. $('#telephone').val('');
  34. $('#District').val('');
  35. $('#Branice').val('');
  36. $('#manage').val('');
  37. $('#Code').val('');
  38. $('#material_name').val('');
  39. $('#model_number').val('');
  40. $('#specifications').val('');
  41. $('#category1').val('');
  42. $('#category2').val('');
  43. $('#category3').val('');
  44. $('#brand_name').val('');
  45. $('#efficiency').val('');
  46. $('#product_line').val('');
  47. $('#process').val('');
  48. $('#enter_formula').val('');
  49. }
  50. var catt; //问题类别
  51. var cttt; //投诉问题类别
  52. var comdi; //产品名称
  53. var coint; //销售基地
  54. var stion; //问题数量
  55. var shengch; //生产批次号
  56. var jyppai;
  57. var daqu;
  58. var fengo;
  59. var orderIsover;
  60. function typePro() {
  61. orderIsover = $('input:radio[name="type"]:checked').val();
  62. if(orderIsover === '1') {
  63. catt = $('#category').val(); //问题类别
  64. comdi = $('#ProductName').val(); //产品名称
  65. stion = $('#Product_Quantity').val(); //问题数量
  66. coint = $('#xiaoshou').val(); //销售基地
  67. daqu = '';
  68. fengo = '';
  69. jyppai = '';
  70. cttt = '';
  71. shengch = '';
  72. emptyct()
  73. $('#wlbm').hide();
  74. $('#wlmcc').hide();
  75. $('#clie').hide();
  76. $('#mate').hide();
  77. } else if(orderIsover === '2') {
  78. daqu = $('#chdaqu').val();
  79. fengo = $('#chfen').val();
  80. jyppai = $('#brand_name').val();
  81. comdi = $('#product_name').val(); //产品名称
  82. cttt = $("#cate").val();
  83. // if($("#catego").val()){
  84. // cttt = $("#cat").val()+"|"+$("#catego").val();
  85. // if($("#cate").val()){
  86. // cttt = $("#cat").val()+"|"+$("#catego").val()+"|"+$("#cate").val();
  87. // }
  88. // }
  89. catt = $("#cate").val();
  90. shengch = $('#Batch_number').val(); //生产批次号
  91. stion = $('#quantity').val(); //问题数量
  92. coint = $('#Sales_base').val(); //销售基地
  93. } else if(orderIsover === '3') {
  94. daqu = $('#District').val();
  95. fengo = $('#Branice').val();
  96. jyppai = $('#brand_name').val();
  97. shengch = $('#batch_num').val(); //生产批次号
  98. catt = $('#chou_wtlb').val();
  99. // cttt=$('#chou_wtlb').val();
  100. comdi = '';
  101. coint = '';
  102. stion = '';
  103. } else if(orderIsover === '4') {
  104. catt = $('#cateq').val(); //问题类别
  105. comdi = $('#Produ_ctName').val(); //产品名称
  106. stion = $('#Product_Quantity').val(); //问题数量
  107. coint = $('#xiaosh').val(); //销售基地
  108. daqu = '';
  109. fengo = '';
  110. jyppai = '';
  111. cttt = '';
  112. shengch = '';
  113. emptyct()
  114. $('#wlbm').hide();
  115. $('#wlmcc').hide();
  116. $('#clie').hide();
  117. $('#mate').hide();
  118. // alert(catt)
  119. }
  120. }
  121. // 保存
  122. function orderSave() {
  123. typePro();
  124. var oid = helper.request.queryString("oid");
  125. var isDetail = helper.request.queryString("isDetail");
  126. // if(!regexs.userNameReg.test($.trim($('#order_name').val()))) {
  127. // layer.confirm('请输入有效的客户姓名(2-20位汉字可以包含·•)!', {
  128. // icon: 2,
  129. // btn: ['确定']
  130. // });
  131. // return;
  132. // }
  133. var order_handle = $('#order_handles').is(':visible') ? $('#order_handle').val() : 0;
  134. $.post(huayi.config.callcenter_url + "WorkOrderNew/Update", {
  135. F_ID: oid, //int 工单id;
  136. F_Source: $('#godanlx').val(), // 工单来源
  137. F_WorkOrderCode: $('#gdbian').val(), // 工单编号
  138. F_CompanyName: $('#order_company').val(),// 公司名称
  139. F_Type: $('#order_isover').find('input[type="radio"]:checked').val(), //工单类型
  140. //公共字段
  141. F_CusName: $('#kehuxing').val(), //客户姓名
  142. F_CusPhone: $('#kehudian').val(), //客户电话
  143. F_CompanyName: $('#gonsi').val(), //公司名称
  144. F_IncidentProvince: $('#sheng').val(), //string 事发地
  145. F_IncidentCity: $('#shi').val(), // 市
  146. F_IncidentCountry: $('#quxian').val(), //区/县
  147. F_IncidentTownship: $('#xiang').val(), //乡
  148. F_IncidentDetailed: $('#xiangxi').val(), //详细地址
  149. F_Description: $('#reception').val(), //问题描述
  150. //咨询模块
  151. F_QuestionType: catt, //问题类别
  152. F_TS_Category: comdi, //产品名称
  153. F_ZX_Quantity: $('#Product_Quantity').val(), //问题数量
  154. F_SalesBase: coint, //销售基地
  155. //投诉模块
  156. F_BatchNumber: shengch, //生产批号
  157. F_TS_Formula: $('#formula').val(), //配方
  158. F_TS_Quantity: $('#quantity').val(), //问题数量(吨)
  159. F_TS_Level: $('#level').val(), //重要界别
  160. F_CustomerID: $('#number').val(), //客户编号
  161. F_Salesman: $('#salesman').val(),//业务员
  162. F_SalesPhone: $('#telephone').val(),//电话
  163. F_AreaName: $('#chdaqu').val(),//大区
  164. F_BranchName: $('#chfen').val(),//分公司
  165. F_Brands: $('#manage').val(),//经营品牌
  166. F_WorkerBrand:$("#ord_pait").val(), // 品牌
  167. F_MaterialID: $('#Code').val(), //客户编号
  168. F_CustomerID: $('#number').val(), //客户编号
  169. F_Model: $('#model_number').val(), //型号
  170. F_Specs: $('#specifications').val(), //规格
  171. F_Level1: $('#category1').val(), //一级分类
  172. F_Level2: $('#category2').val(), //二级分类
  173. F_Level3: $('#category3').val(), //三级分类
  174. F_Brand: $('#brand_name').val(), //品牌
  175. F_MaterialEffect: $('#efficiency').val(), //复合肥肥效
  176. F_Pipeline: $('#product_line').val(), //产品线
  177. F_Craft: $('#process').val(), //工艺
  178. F_Formula: $('#enter_formula').val(), //配方
  179. //抽检模块
  180. // F_CusName: $('#kxing').val(),//客户姓名
  181. // F_CusPhone: $('#kdian').val(),//客户电话
  182. // F_QuestionType:catt, //问题类别
  183. F_CJ_Time: $('#der_time').val(), //抽检时间
  184. F_CJ_Level: $('#der_level').val(), //抽检级别
  185. F_CJ_Unit: $('#der_Company').val(), //抽检单位
  186. F_CJ_TestUnit: $('#der_Test').val(), //化验单位
  187. F_CJ_Tonnage: $('#der_Tonnage').val(), //抽检吨数
  188. F_CJ_BagNo: $('#der_Ton').val(), //抽检袋数
  189. F_CJ_Outlay: $('#der_Amount').val(), //公关费用金额
  190. token: $.cookie("token")
  191. }, function(result) {
  192. result = $.parseJSON(result);
  193. if(result.state.toLowerCase() == "success") {
  194. if(isDetail === "true") {
  195. parent.parent.layer.closeAll();
  196. parent.parent.$('#derlist').bootstrapTable('refresh');
  197. parent.parent.layer.msg("修改成功");
  198. } else {
  199. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  200. parent.layer.close(index); //再执行关闭
  201. parent.$('#workorderlist').bootstrapTable('refresh');
  202. parent.$('.Closed').trigger('click');
  203. parent.layer.msg("保存成功");
  204. }
  205. // top.workcount();
  206. }
  207. })
  208. }
  209. //获取工单详情
  210. function getWorkOrderDetails(oid) {
  211. $.getJSON(huayi.config.callcenter_url + 'WorkOrderNew/GetDetails', {
  212. id: oid,
  213. "token": $.cookie("token")
  214. }, function(result) {
  215. if(result.state.toLowerCase() == "success") {
  216. if(result.rows && result.rows.length > 0) {
  217. var data = result.rows[0];
  218. $("#lygon").val(data.F_SourceName); //工单来源
  219. $('#gdbian').val(data.F_WorkOrderCode); // 工单编号
  220. // 咨询模块
  221. $("#category option:selected").text(data.F_QuestionType); // 问题类别
  222. $("#category option:selected").val(data.F_QuestionType); //问题类别
  223. $("#ProductName option:selected").text(data.F_TS_Category); // 产品名称
  224. $("#ProductName option:selected").val(data.F_TS_Category); //产品名称
  225. $('#Product_Quantity').val(data.F_ZX_Quantity); //问题数量
  226. $("#xiaoshou option:selected").text(data.F_SalesBase); // 销售基地
  227. $("#xiaoshou option:selected").val(data.F_SalesBase); //销售基地
  228. // 投诉模块
  229. $("#product_name option:selected").text(data.F_TS_Category); // 产品名称
  230. $("#product_name option:selected").val(data.F_TS_Category); // 产品名称
  231. $('#quantity').val(data.F_TS_Quantity); //问题数量
  232. $('#Batch_number').val(data.F_BatchNumber); //生产批次
  233. $("#Sales_base option:selected").text(data.F_SalesBase); // 销售基地
  234. $("#Sales_base option:selected").val(data.F_SalesBase); // 销售基地
  235. $("#level option:selected").text(data.F_TS_Level); // 重要级别
  236. $("#level option:selected").val(data.F_TS_Level); // 重要级别
  237. $("#ord_pait").val(data.F_WorkerBrand); // 重要级别
  238. $("#cat option:selected").text(data.F_QuestionTypeone); // 问题类别1
  239. $("#cat option:selected").val(data.F_QuestionTypeone); // 问题类别1
  240. $("#catego option:selected").text(data.F_QuestionTypetwo); // 问题类别2
  241. $("#catego option:selected").val(data.F_QuestionTypetwo); // 问题类别2
  242. $("#cate option:selected").text(data.F_QuestionType); // 问题类别3
  243. $("#cate option:selected").val(data.F_QuestionType); // 问题类别3
  244. // 抽检模块
  245. // $("#chou_wtlb option:selected").text(data.F_QuestionType); // 问题类别
  246. // $("#chou_wtlb option:selected").val(data.F_QuestionType); // 问题类别
  247. $("#der_level option:selected").text(data.F_CJ_Level); // 抽检级别
  248. $("#der_level option:selected").val(data.F_CJ_Level); // 抽检级别
  249. $('#batch_num').val(data.F_BatchNumber); //生产批次号位
  250. $("#der_Company option:selected").text(data.F_CJ_Unit); // 抽检单位
  251. $("#der_Company option:selected").val(data.F_CJ_Unit); // 抽检单位
  252. $('#der_Test').val(data.F_CJ_TestUnit); //化验单位
  253. $('#der_Tonnage').val(data.F_CJ_Tonnage); //抽检吨数
  254. $('#der_Ton').val(data.F_CJ_BagNo); //抽检袋数
  255. $('#der_Amount').val(data.F_CJ_Outlay); //公关费用金额
  256. $('#der_time').val(data.F_CJ_Time); //抽检时间
  257. // 建议及其他
  258. $("#cateq option:selected").text(data.F_QuestionType); // 问题类别
  259. $("#cateq option:selected").val(data.F_QuestionType); // 问题类别
  260. $("#Produ_ctName option:selected").text(data.F_TS_Category); // 产品名称
  261. $("#Produ_ctName option:selected").val(data.F_TS_Category); // 产品名称
  262. $('#Product_Quan').val(); //问题数量
  263. $("#xiaosh option[value='" + data.F_SalesBase + "']").attr("selected", "selected"); // 销售基地
  264. // 公共模块
  265. $('#number').val(data.F_CustomerID); //客户编码
  266. $('#salesman').val(data.F_Salesman); //业务员
  267. $('#telephone').val(data.F_SalesPhone); //电话
  268. $("#chdaqu option:selected").text(data.F_AreaName); // 大区
  269. $("#chdaqu option:selected").val(data.F_AreaName); // 大区
  270. $("#chfen option:selected").text(data.F_BranchName); // 分公司
  271. $("#chfen option:selected").val(data.F_BranchName); // 分公司
  272. $('#manage').val(data.F_Brand); //经营品牌
  273. //物料
  274. $('#Code').val(data.F_MaterialID); //物料编码
  275. $('#material_name').val(data.F_MaterialName); //物料名称
  276. $('#model_number').val(data.F_Model); //型号
  277. $('#specifications').val(data.F_Specs); //规格
  278. $('#category1').val(data.F_Level1); //一级分类
  279. $('#category2').val(data.F_Level2); //二级分类
  280. $('#category3').val(data.F_Level3); //三级分类
  281. $('#brand_name').val(data.F_Brand); //品牌
  282. $('#efficiency').val(data.F_MaterialEffect); //复合肥肥效
  283. $('#product_line').val(data.F_Pipeline); //产品线
  284. $('#process').val(data.F_Craft); //工艺
  285. $('#enter_formula').val(data.F_TS_Formula); //配方
  286. $('#kehuxing').val(data.F_CusName); //客户姓名
  287. $('#kehudian').val(data.F_CusPhone); //客户电话
  288. $('#order_company').val(data.F_CompanyName), //公司名称
  289. $("#sheng option:selected").text(data.F_IncidentProvince); // 省
  290. $("#sheng option:selected").val(data.F_IncidentProvince); // 省
  291. $("#shi option:selected").val(data.F_IncidentCity); // 市
  292. $("#shi option:selected").text(data.F_IncidentCity); // 市
  293. $("#quxian option:selected").val(data.F_IncidentCountry); //县
  294. $("#quxian option:selected").text(data.F_IncidentCountry); //县
  295. $("#xiang option:selected").val(data.F_IncidentTownship); //乡镇
  296. $("#xiang option:selected").text(data.F_IncidentTownship); //乡镇
  297. $("#xiangxi").val(data.F_IncidentDetailed); //详细
  298. $('#reception').val(data.F_Description); //问题描述
  299. if(data.F_TypeName === "咨询") {
  300. $("input[type=radio][value='1']").prop("checked", true);
  301. $('#PageArrival').show(); //receive
  302. $('#Duration').hide();
  303. $('#Depth').hide();
  304. $('#Page').hide();
  305. $('#wlbm').hide();
  306. $('#wlmcc').hide();
  307. } else if(data.F_TypeName === "投诉") {
  308. $("input[type=radio][value='2']").prop("checked", true);
  309. $('#PageArrival').hide(); //receive
  310. $('#Duration').show();
  311. $('#Depth').hide();
  312. $('#Page').hide();
  313. $('#wlbm').show();
  314. $('#wlmcc').show();
  315. } else if(data.F_TypeName === "抽检") {
  316. $("input[type=radio][value='3']").prop("checked", true);
  317. $('#PageArrival').hide(); //receive
  318. $('#Duration').hide();
  319. $('#Depth').show();
  320. $('#Page').hide();
  321. $('#wlbm').show();
  322. $('#wlmcc').show();
  323. } else if(data.F_TypeName === "建议及其他") {
  324. $("input[type=radio][value='4']").prop("checked", true);
  325. $('#PageArrival').hide(); //receive
  326. $('#Duration').hide();
  327. $('#Depth').hide();
  328. $('#Page').show();
  329. $('#wlbm').hide();
  330. $('#wlmcc').hide();
  331. }
  332. }
  333. }
  334. });
  335. }
  336. //三级联动下拉
  337. $(document).ready(function() {
  338. var wid = helper.request.queryString("wid");
  339. LY($("#sheng")); //省
  340. XSJD($("#xiaoshou")); //销售基地
  341. XSJD($("#xiaosh")); //建议及其他销售基地
  342. XSJD($("#Sales_base")); //建议及其他销售基地
  343. ZXWTLB($("#category")); //咨询问题类别
  344. // ZXWTLB($("#categg")); //问题类别
  345. ZXCPMC($("#ProductName"));
  346. // ZXCPMC($("#ProductName"));
  347. ZXCPMC($("#product_name"));
  348. ZXCPMC($("#Produ_ctName")); //建议及其他产品名称
  349. DQ($("#chdaqu"));
  350. //投诉模块
  351. WTLB1($("#cat")); //问题类型1
  352. CPZL($("#Product_Category")); //产品名称
  353. WTLBCJ($("#chou_wtlb")); //抽检问题类型
  354. ZYJB($("#level")); //重要级别
  355. CJJP($("#der_level")); //抽检级别
  356. CJDW($("#der_Company")); //抽检单位
  357. // DQQ($("#customer_comaddress")); //大区
  358. QDLX($("#customer_taxPointDes")); //添加客户渠道类型
  359. QDLX($("#channel")); //来电弹屏渠道类型
  360. XYDJ($("#customer_invoiceRange"));
  361. JYPP($("#customer_Qualification"));
  362. JYPP($("#management"));
  363. CAPI($("#customer_FinancialManager"));
  364. YFPP($("#customer_feeEx"));
  365. YFPP($("#fertilizer"));
  366. });
  367. // 客户信息里的 省/市/区/县
  368. // 咨询模块 省
  369. function LY(obj) {
  370. obj.empty();
  371. obj.append('<option selected="selected" value="">请选择</option>');
  372. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  373. "token": $.cookie("token"),
  374. F_Layer: 1,
  375. }, function(data) {
  376. if(data.state.toLowerCase() == "success") {
  377. var content = data.data;
  378. $(content).each(function(i, n) {
  379. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  380. })
  381. }
  382. })
  383. }
  384. //市
  385. function LB12(obj) {
  386. obj.empty();
  387. obj.append('<option selected="selected" value="">请选择</option>');
  388. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  389. "token": $.cookie("token"),
  390. F_Layer: 2,
  391. F_RegionName: $('#sheng').val()
  392. }, function(data) {
  393. if(data.state.toLowerCase() == "success") {
  394. var content = data.data;
  395. $(content).each(function(i, n) {
  396. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  397. })
  398. }
  399. })
  400. }
  401. // 区/县
  402. function ZT(obj) {
  403. obj.empty();
  404. obj.append('<option selected="selected" value="">请选择</option>');
  405. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  406. "token": $.cookie("token"),
  407. F_Layer: 3,
  408. F_RegionName: $('#shi').val()
  409. }, function(data) {
  410. if(data.state.toLowerCase() == "success") {
  411. var content = data.data;
  412. $(content).each(function(i, n) {
  413. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  414. })
  415. }
  416. })
  417. }
  418. // 乡
  419. function XX(obj) {
  420. obj.empty();
  421. obj.append('<option selected="selected" value="">请选择</option>');
  422. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  423. "token": $.cookie("token"),
  424. F_Layer: 4,
  425. F_RegionName: $('#quxian').val()
  426. }, function(data) {
  427. if(data.state.toLowerCase() == "success") {
  428. var content = data.data;
  429. $(content).each(function(i, n) {
  430. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  431. })
  432. }
  433. })
  434. }
  435. $('#sheng').on('change', function() {
  436. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  437. "token": $.cookie("token"),
  438. F_Layer: 2,
  439. F_RegionName: $('#sheng').val(),
  440. }, function(data) {
  441. if(data.state.toLowerCase() == "success") {
  442. var content = data.data;
  443. $(content).each(function(i, n) {
  444. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#shi");
  445. })
  446. LB12($("#shi"));
  447. }
  448. })
  449. });
  450. $('#shi').on('change', function() {
  451. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  452. "token": $.cookie("token"),
  453. F_Layer: 3,
  454. F_RegionName: $('#shi').val()
  455. }, function(data) {
  456. if(data.state.toLowerCase() == "success") {
  457. var content = data.data;
  458. $(content).each(function(i, n) {
  459. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#quxian");
  460. })
  461. ZT($("#quxian"));
  462. }
  463. })
  464. });
  465. $('#quxian').on('change', function() {
  466. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  467. "token": $.cookie("token"),
  468. F_Layer: 4,
  469. F_RegionName: $('#quxian').val()
  470. }, function(data) {
  471. if(data.state.toLowerCase() == "success") {
  472. var content = data.data;
  473. $(content).each(function(i, n) {
  474. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#xiang");
  475. })
  476. XX($('#xiang'));
  477. }
  478. })
  479. });
  480. //销售基地
  481. function XSJD(obj) {
  482. obj.empty();
  483. obj.append('<option selected="selected" value="">请选择</option>');
  484. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  485. "token": $.cookie("token"),
  486. flag: "XSJD",
  487. }, function(data) {
  488. if(data.state.toLowerCase() == "success") {
  489. var content = data.data;
  490. $(content).each(function(i, n) {
  491. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  492. })
  493. }
  494. })
  495. }
  496. //问题类别
  497. function ZXWTLB(obj) {
  498. obj.empty();
  499. obj.append('<option selected="selected" value="">请选择</option>');
  500. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionNameType", {
  501. "token": $.cookie("token"),
  502. type: 3,
  503. // pid:0,
  504. }, function(data) {
  505. if(data.state.toLowerCase() == "success") {
  506. var content = data.data;
  507. $(content).each(function(i, n) {
  508. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  509. })
  510. }
  511. })
  512. }
  513. function ZXCPMC(obj) {
  514. obj.empty();
  515. obj.append('<option selected="selected" value="">请选择</option>');
  516. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  517. "token": $.cookie("token"),
  518. flag: "CPZL",
  519. }, function(data) {
  520. if(data.state.toLowerCase() == "success") {
  521. var content = data.data;
  522. $(content).each(function(i, n) {
  523. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  524. })
  525. }
  526. })
  527. }
  528. function DQ(obj) {
  529. obj.empty();
  530. obj.append('<option selected="selected" value="">请选择</option>');
  531. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  532. "token": $.cookie("token"),
  533. F_Layer: 1,
  534. }, function(data) {
  535. if(data.state.toLowerCase() == "success") {
  536. var content = data.data;
  537. $(content).each(function(i, n) {
  538. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  539. })
  540. }
  541. })
  542. }
  543. function FENGONGSI(obj) {
  544. obj.empty();
  545. obj.append('<option selected="selected" value="">请选择</option>');
  546. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  547. "token": $.cookie("token"),
  548. F_Layer: 2,
  549. F_DeptName: $("#chdaqu").find("option:selected").text(),
  550. }, function(data) {
  551. if(data.state.toLowerCase() == "success") {
  552. var content = data.data;
  553. $(content).each(function(i, n) {
  554. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  555. })
  556. }
  557. })
  558. }
  559. $('#chdaqu').on('change', function() {
  560. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  561. "token": $.cookie("token"),
  562. F_Layer: 2,
  563. F_DeptName: $("#chdaqu").find("option:selected").text(),
  564. }, function(data) {
  565. if(data.state.toLowerCase() == "success") {
  566. var content = data.data;
  567. $(content).each(function(i, n) {
  568. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo("#chfen");
  569. })
  570. FENGONGSI($("#chfen"));
  571. }
  572. })
  573. });
  574. //抽检问题类别
  575. function WTLBCJ(obj) {
  576. obj.empty();
  577. obj.append('<option selected="selected" value="">请选择</option>');
  578. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  579. "token": $.cookie("token"),
  580. type: 2,
  581. pid: 0,
  582. }, function(data) {
  583. if(data.state.toLowerCase() == "success") {
  584. var content = data.data;
  585. $(content).each(function(i, n) {
  586. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  587. })
  588. }
  589. })
  590. }
  591. //问题类别1
  592. function WTLB1(obj) {
  593. obj.empty();
  594. obj.append('<option selected="selected" value="">请选择</option>');
  595. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  596. "token": $.cookie("token"),
  597. type: 1,
  598. pid: 0,
  599. }, function(data) {
  600. if(data.state.toLowerCase() == "success") {
  601. var content = data.data;
  602. $(content).each(function(i, n) {
  603. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  604. })
  605. }
  606. })
  607. }
  608. //问题类别2
  609. function WTLB2(obj) {
  610. obj.empty();
  611. obj.append('<option selected="selected" value="">请选择</option>');
  612. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  613. "token": $.cookie("token"),
  614. type: 1,
  615. pid: $('#cat').val(),
  616. }, function(data) {
  617. if(data.state.toLowerCase() == "success") {
  618. var content = data.data;
  619. $(content).each(function(i, n) {
  620. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  621. })
  622. }
  623. })
  624. }
  625. // 问题类别3
  626. function WTLB3(obj) {
  627. obj.empty();
  628. obj.append('<option selected="selected" value="">请选择</option>');
  629. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  630. "token": $.cookie("token"),
  631. type: 1,
  632. pid: $('#catego').val(),
  633. }, function(data) {
  634. if(data.state.toLowerCase() == "success") {
  635. var content = data.data;
  636. $(content).each(function(i, n) {
  637. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  638. })
  639. }
  640. })
  641. }
  642. $('#cat').on('change', function() {
  643. // alert($('#cat').val())
  644. WTLB2($("#catego")); //问题类型2
  645. // $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  646. // "token": $.cookie("token"),
  647. // type: 1,
  648. //
  649. // pid:$('#cat').val(),
  650. // }, function (data) {
  651. // if (data.state.toLowerCase() == "success") {
  652. // var content = data.data;
  653. // $(content).each(function (i, n) {
  654. // $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo("#catego");
  655. // })
  656. //
  657. // }
  658. // })
  659. });
  660. $('#catego').on('change', function() {
  661. // alert($("#catego").val())
  662. WTLB3($("#cate")); //问题类型3
  663. // $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  664. // "token": $.cookie("token"),
  665. // type: 1,
  666. //
  667. // pid:$('#catego').val()
  668. // }, function (data) {
  669. // if (data.state.toLowerCase() == "success") {
  670. // var content = data.data;
  671. // $(content).each(function (i, n) {
  672. // $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo("#cate");
  673. // })
  674. //
  675. // }
  676. // })
  677. });
  678. //产品种类
  679. function CPZL(obj) {
  680. obj.empty();
  681. obj.append('<option selected="selected" value="">请选择</option>');
  682. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  683. "token": $.cookie("token"),
  684. flag: "CPZL",
  685. }, function(data) {
  686. if(data.state.toLowerCase() == "success") {
  687. var content = data.data;
  688. $(content).each(function(i, n) {
  689. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  690. })
  691. }
  692. })
  693. }
  694. //重要界别
  695. function ZYJB(obj) {
  696. obj.empty();
  697. obj.append('<option selected="selected" value="">请选择</option>');
  698. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  699. "token": $.cookie("token"),
  700. flag: "ZYJB",
  701. }, function(data) {
  702. if(data.state.toLowerCase() == "success") {
  703. var content = data.data;
  704. $(content).each(function(i, n) {
  705. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  706. })
  707. }
  708. })
  709. }
  710. //抽检模块
  711. function CJJP(obj) {
  712. obj.empty();
  713. obj.append('<option selected="selected" value="">请选择</option>');
  714. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  715. "token": $.cookie("token"),
  716. flag: "CJJP",
  717. }, function(data) {
  718. if(data.state.toLowerCase() == "success") {
  719. var content = data.data;
  720. $(content).each(function(i, n) {
  721. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  722. })
  723. }
  724. })
  725. }
  726. function CJDW(obj) {
  727. obj.empty();
  728. obj.append('<option selected="selected" value="">请选择</option>');
  729. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  730. "token": $.cookie("token"),
  731. flag: "CJDW",
  732. }, function(data) {
  733. if(data.state.toLowerCase() == "success") {
  734. var content = data.data;
  735. $(content).each(function(i, n) {
  736. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  737. })
  738. }
  739. })
  740. }
  741. //。。。。。。。。。。。。。。。。。。。。。。。
  742. function YFPP(obj) {
  743. obj.empty();
  744. obj.append('<option selected="selected" value="">请选择</option>');
  745. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  746. "token": $.cookie("token"),
  747. flag: "YFPP",
  748. }, function(data) {
  749. if(data.state.toLowerCase() == "success") {
  750. var content = data.data;
  751. $(content).each(function(i, n) {
  752. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  753. })
  754. }
  755. })
  756. }
  757. //渠道类型
  758. function QDLX(obj) {
  759. obj.empty();
  760. obj.append('<option selected="selected" value="">请选择</option>');
  761. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  762. "token": $.cookie("token"),
  763. flag: "QDLX",
  764. }, function(data) {
  765. if(data.state.toLowerCase() == "success") {
  766. var content = data.data;
  767. $(content).each(function(i, n) {
  768. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  769. })
  770. }
  771. })
  772. }
  773. //信用等级
  774. function XYDJ(obj) {
  775. obj.empty();
  776. obj.append('<option selected="selected" value="">请选择</option>');
  777. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  778. "token": $.cookie("token"),
  779. flag: "XYDJ",
  780. }, function(data) {
  781. if(data.state.toLowerCase() == "success") {
  782. var content = data.data;
  783. $(content).each(function(i, n) {
  784. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  785. })
  786. }
  787. })
  788. }
  789. //经营品牌
  790. function JYPP(obj) {
  791. obj.empty();
  792. obj.append('<option selected="selected" value="">请选择</option>');
  793. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  794. "token": $.cookie("token"),
  795. flag: "JYPP",
  796. }, function(data) {
  797. if(data.state.toLowerCase() == "success") {
  798. var content = data.data;
  799. $(content).each(function(i, n) {
  800. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  801. })
  802. }
  803. })
  804. }
  805. //产品
  806. function CAPI(obj) {
  807. obj.empty();
  808. obj.append('<option selected="selected" value="">请选择</option>');
  809. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  810. "token": $.cookie("token"),
  811. flag: "CAPI",
  812. }, function(data) {
  813. if(data.state.toLowerCase() == "success") {
  814. var content = data.data;
  815. $(content).each(function(i, n) {
  816. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  817. })
  818. }
  819. })
  820. }
  821. //工单类型点选
  822. $('.r_order_type').find('input[type="radio"]').on('change', function() {
  823. if($(this).val() === "1") { //咨询
  824. $('#PageArrival').show(); //receive
  825. $('#Duration').hide();
  826. $('#Depth').hide();
  827. $('#Page').hide();
  828. $('#wlbm').hide();
  829. $('#wlmcc').hide();
  830. } else if($(this).val() === "2") { //投诉
  831. $('#PageArrival').hide(); //receive
  832. $('#Duration').show();
  833. $('#Depth').hide();
  834. $('#Page').hide();
  835. $('#wlbm').show();
  836. $('#wlmcc').show();
  837. } else if($(this).val() === "3") { //抽检
  838. $('#PageArrival').hide(); //receive
  839. $('#Duration').hide();
  840. $('#Depth').show();
  841. $('#Page').hide();
  842. $('#wlbm').show();
  843. $('#wlmcc').show();
  844. } else if($(this).val() === "4") { //建议其他
  845. $('#PageArrival').hide(); //receive
  846. $('#Duration').hide();
  847. $('#Depth').hide();
  848. $('#Page').show();
  849. $('#wlbm').hide();
  850. $('#wlmcc').hide();
  851. }
  852. });
  853. $('#number').blur(function () {
  854. //根据客户编码获取信息
  855. $.getJSON(huayi.config.callcenter_url + "CustomerNew/GetCodeCustomer", {
  856. // id: ids, //id
  857. code:$('#number').val(),
  858. token: $.cookie("token")
  859. }, function(data) {
  860. if (data.state.toLowerCase() == "success") {
  861. data = data.data;
  862. if (data) {
  863. $('#salesman').val(data.F_Salesman);
  864. $('#telephone').val(data.F_SalesPhone);
  865. // $('#chdaqu').text(data.F_AreaName);
  866. $("#chdaqu option:selected").text(data.F_AreaName);
  867. $("#chfen option:selected").text(data.F_BranchName);
  868. // $('#chfen').text(data.F_BranchName);
  869. $('#manage').val(data.F_Brands);
  870. }else{
  871. $('#salesman').val('');
  872. $('#telephone').val('');
  873. $('#chdaqu').find("option:selected").attr("selected", false);
  874. // $("#chdaqu").val('');
  875. $("#chfen").val('');
  876. $('#manage').val('');
  877. }
  878. }
  879. // alert(111111111111111);
  880. });
  881. });
  882. $('#Code').blur(function () {
  883. // alert($(this).val());
  884. // $('#material').show();
  885. //根据物料编码获取信息
  886. $.getJSON(huayi.config.callcenter_url + "MaterialManage/GetCodeModel", {
  887. // id: ids, //id
  888. code:$('#Code').val(),
  889. token: $.cookie("token")
  890. }, function(data) {
  891. if (data.state.toLowerCase() == "success") {
  892. data = data.data;
  893. if (data) {
  894. $("#material_name").val(data.model.F_MaterialName);//物料名称
  895. $("#model_number").val(data.model.F_Model),//型号
  896. $("#specifications").val(data.model.F_Specs);//规格
  897. $("#category1").val(data.model.F_Level1);//一级分类
  898. $("#category2").val(data.model.F_Level2);//二级分类
  899. $("#category3").val(data.model.F_Level3);//三级分类
  900. $('#brand_name').val(data.model.F_Brand);//品牌
  901. $('#efficiency').val(data.model.F_MaterialEffect); //复合肥肥效
  902. $('#product_line').val(data.model.F_Pipeline); //产品线tensions
  903. $("#process").val(data.model.F_Craft);//工艺
  904. $("#enter_formula").val(data.model.F_Craft);//工艺
  905. }else{
  906. $("#material_name").val('');//物料名称
  907. $("#model_number").val(''),//型号
  908. $("#specifications").val('');//规格
  909. $("#category1").val('');//一级分类
  910. $("#category2").val('');//二级分类
  911. $("#category3").val('');//三级分类
  912. $('#brand_name').val('');//品牌
  913. $('#efficiency').val(''); //复合肥肥效
  914. $('#product_line').val(''); //产品线tensions
  915. $("#process").val('');//工艺
  916. $("#enter_formula").val('');//工艺
  917. }
  918. }
  919. // alert(111111111111111);
  920. });
  921. });