Aucune description

addOrEditWorkOrder.js 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974
  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_QuestionTypeid); // 问题类别
  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. ZXWTLB($("#cateq")); //建议问题类别
  367. });
  368. // 客户信息里的 省/市/区/县
  369. // 咨询模块 省
  370. function LY(obj) {
  371. obj.empty();
  372. obj.append('<option selected="selected" value="">请选择</option>');
  373. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  374. "token": $.cookie("token"),
  375. F_Layer: 1,
  376. }, function(data) {
  377. if(data.state.toLowerCase() == "success") {
  378. var content = data.data;
  379. $(content).each(function(i, n) {
  380. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  381. })
  382. }
  383. })
  384. }
  385. //市
  386. function LB12(obj) {
  387. obj.empty();
  388. obj.append('<option selected="selected" value="">请选择</option>');
  389. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  390. "token": $.cookie("token"),
  391. F_Layer: 2,
  392. F_RegionName: $('#sheng').val()
  393. }, function(data) {
  394. if(data.state.toLowerCase() == "success") {
  395. var content = data.data;
  396. $(content).each(function(i, n) {
  397. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  398. })
  399. }
  400. })
  401. }
  402. // 区/县
  403. function ZT(obj) {
  404. obj.empty();
  405. obj.append('<option selected="selected" value="">请选择</option>');
  406. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  407. "token": $.cookie("token"),
  408. F_Layer: 3,
  409. F_RegionName: $('#shi').val()
  410. }, function(data) {
  411. if(data.state.toLowerCase() == "success") {
  412. var content = data.data;
  413. $(content).each(function(i, n) {
  414. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  415. })
  416. }
  417. })
  418. }
  419. // 乡
  420. function XX(obj) {
  421. obj.empty();
  422. obj.append('<option selected="selected" value="">请选择</option>');
  423. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  424. "token": $.cookie("token"),
  425. F_Layer: 4,
  426. F_RegionName: $('#quxian').val()
  427. }, function(data) {
  428. if(data.state.toLowerCase() == "success") {
  429. var content = data.data;
  430. $(content).each(function(i, n) {
  431. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo(obj);
  432. })
  433. }
  434. })
  435. }
  436. $('#sheng').on('change', function() {
  437. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  438. "token": $.cookie("token"),
  439. F_Layer: 2,
  440. F_RegionName: $('#sheng').val(),
  441. }, function(data) {
  442. if(data.state.toLowerCase() == "success") {
  443. var content = data.data;
  444. $(content).each(function(i, n) {
  445. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#shi");
  446. })
  447. LB12($("#shi"));
  448. }
  449. })
  450. });
  451. $('#shi').on('change', function() {
  452. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  453. "token": $.cookie("token"),
  454. F_Layer: 3,
  455. F_RegionName: $('#shi').val()
  456. }, function(data) {
  457. if(data.state.toLowerCase() == "success") {
  458. var content = data.data;
  459. $(content).each(function(i, n) {
  460. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#quxian");
  461. })
  462. ZT($("#quxian"));
  463. }
  464. })
  465. });
  466. $('#quxian').on('change', function() {
  467. $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetAllList", {
  468. "token": $.cookie("token"),
  469. F_Layer: 4,
  470. F_RegionName: $('#quxian').val()
  471. }, function(data) {
  472. if(data.state.toLowerCase() == "success") {
  473. var content = data.data;
  474. $(content).each(function(i, n) {
  475. $("<option value='" + n.F_RegionName + "'>" + n.F_RegionName + "</option>").appendTo("#xiang");
  476. })
  477. XX($('#xiang'));
  478. }
  479. })
  480. });
  481. //销售基地
  482. function XSJD(obj) {
  483. obj.empty();
  484. obj.append('<option selected="selected" value="">请选择</option>');
  485. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  486. "token": $.cookie("token"),
  487. flag: "XSJD",
  488. }, function(data) {
  489. if(data.state.toLowerCase() == "success") {
  490. var content = data.data;
  491. $(content).each(function(i, n) {
  492. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  493. })
  494. }
  495. })
  496. }
  497. //问题类别
  498. function ZXWTLB(obj) {
  499. obj.empty();
  500. obj.append('<option selected="selected" value="">请选择</option>');
  501. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionNameType", {
  502. "token": $.cookie("token"),
  503. type: 3,
  504. // pid:0,
  505. }, function(data) {
  506. if(data.state.toLowerCase() == "success") {
  507. var content = data.data;
  508. $(content).each(function(i, n) {
  509. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  510. })
  511. }
  512. })
  513. }
  514. function ZXCPMC(obj) {
  515. obj.empty();
  516. obj.append('<option selected="selected" value="">请选择</option>');
  517. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  518. "token": $.cookie("token"),
  519. flag: "CPZL",
  520. }, function(data) {
  521. if(data.state.toLowerCase() == "success") {
  522. var content = data.data;
  523. $(content).each(function(i, n) {
  524. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  525. })
  526. }
  527. })
  528. }
  529. function DQ(obj) {
  530. obj.empty();
  531. obj.append('<option selected="selected" value="">请选择</option>');
  532. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  533. "token": $.cookie("token"),
  534. F_Layer: 1,
  535. }, function(data) {
  536. if(data.state.toLowerCase() == "success") {
  537. var content = data.data;
  538. $(content).each(function(i, n) {
  539. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  540. })
  541. }
  542. })
  543. }
  544. function FENGONGSI(obj) {
  545. obj.empty();
  546. obj.append('<option selected="selected" value="">请选择</option>');
  547. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  548. "token": $.cookie("token"),
  549. F_Layer: 2,
  550. F_DeptName: $("#chdaqu").find("option:selected").text(),
  551. }, function(data) {
  552. if(data.state.toLowerCase() == "success") {
  553. var content = data.data;
  554. $(content).each(function(i, n) {
  555. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
  556. })
  557. }
  558. })
  559. }
  560. $('#chdaqu').on('change', function() {
  561. $.getJSON(huayi.config.callcenter_url + "Department/GetList", {
  562. "token": $.cookie("token"),
  563. F_Layer: 2,
  564. F_DeptName: $("#chdaqu").find("option:selected").text(),
  565. }, function(data) {
  566. if(data.state.toLowerCase() == "success") {
  567. var content = data.data;
  568. $(content).each(function(i, n) {
  569. $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo("#chfen");
  570. })
  571. FENGONGSI($("#chfen"));
  572. }
  573. })
  574. });
  575. //抽检问题类别
  576. function WTLBCJ(obj) {
  577. obj.empty();
  578. obj.append('<option selected="selected" value="">请选择</option>');
  579. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  580. "token": $.cookie("token"),
  581. type: 2,
  582. pid: 0,
  583. }, function(data) {
  584. if(data.state.toLowerCase() == "success") {
  585. var content = data.data;
  586. $(content).each(function(i, n) {
  587. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  588. })
  589. }
  590. })
  591. }
  592. //问题类别1
  593. function WTLB1(obj) {
  594. obj.empty();
  595. obj.append('<option selected="selected" value="">请选择</option>');
  596. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  597. "token": $.cookie("token"),
  598. type: 1,
  599. pid: 0,
  600. }, function(data) {
  601. if(data.state.toLowerCase() == "success") {
  602. var content = data.data;
  603. $(content).each(function(i, n) {
  604. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  605. })
  606. }
  607. })
  608. }
  609. //问题类别2
  610. function WTLB2(obj) {
  611. obj.empty();
  612. obj.append('<option selected="selected" value="">请选择</option>');
  613. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  614. "token": $.cookie("token"),
  615. type: 1,
  616. pid: $('#cat').val(),
  617. }, function(data) {
  618. if(data.state.toLowerCase() == "success") {
  619. var content = data.data;
  620. $(content).each(function(i, n) {
  621. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  622. })
  623. }
  624. })
  625. }
  626. // 问题类别3
  627. function WTLB3(obj) {
  628. obj.empty();
  629. obj.append('<option selected="selected" value="">请选择</option>');
  630. $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  631. "token": $.cookie("token"),
  632. type: 1,
  633. pid: $('#catego').val(),
  634. }, function(data) {
  635. if(data.state.toLowerCase() == "success") {
  636. var content = data.data;
  637. $(content).each(function(i, n) {
  638. $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
  639. })
  640. }
  641. })
  642. }
  643. $('#cat').on('change', function() {
  644. // alert($('#cat').val())
  645. WTLB2($("#catego")); //问题类型2
  646. // $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  647. // "token": $.cookie("token"),
  648. // type: 1,
  649. //
  650. // pid:$('#cat').val(),
  651. // }, function (data) {
  652. // if (data.state.toLowerCase() == "success") {
  653. // var content = data.data;
  654. // $(content).each(function (i, n) {
  655. // $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo("#catego");
  656. // })
  657. //
  658. // }
  659. // })
  660. });
  661. $('#catego').on('change', function() {
  662. // alert($("#catego").val())
  663. WTLB3($("#cate")); //问题类型3
  664. // $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetQuestionType", {
  665. // "token": $.cookie("token"),
  666. // type: 1,
  667. //
  668. // pid:$('#catego').val()
  669. // }, function (data) {
  670. // if (data.state.toLowerCase() == "success") {
  671. // var content = data.data;
  672. // $(content).each(function (i, n) {
  673. // $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo("#cate");
  674. // })
  675. //
  676. // }
  677. // })
  678. });
  679. //产品种类
  680. function CPZL(obj) {
  681. obj.empty();
  682. obj.append('<option selected="selected" value="">请选择</option>');
  683. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  684. "token": $.cookie("token"),
  685. flag: "CPZL",
  686. }, function(data) {
  687. if(data.state.toLowerCase() == "success") {
  688. var content = data.data;
  689. $(content).each(function(i, n) {
  690. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  691. })
  692. }
  693. })
  694. }
  695. //重要界别
  696. function ZYJB(obj) {
  697. obj.empty();
  698. obj.append('<option selected="selected" value="">请选择</option>');
  699. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  700. "token": $.cookie("token"),
  701. flag: "ZYJB",
  702. }, function(data) {
  703. if(data.state.toLowerCase() == "success") {
  704. var content = data.data;
  705. $(content).each(function(i, n) {
  706. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  707. })
  708. }
  709. })
  710. }
  711. //抽检模块
  712. function CJJP(obj) {
  713. obj.empty();
  714. obj.append('<option selected="selected" value="">请选择</option>');
  715. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  716. "token": $.cookie("token"),
  717. flag: "CJJP",
  718. }, function(data) {
  719. if(data.state.toLowerCase() == "success") {
  720. var content = data.data;
  721. $(content).each(function(i, n) {
  722. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  723. })
  724. }
  725. })
  726. }
  727. function CJDW(obj) {
  728. obj.empty();
  729. obj.append('<option selected="selected" value="">请选择</option>');
  730. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  731. "token": $.cookie("token"),
  732. flag: "CJDW",
  733. }, function(data) {
  734. if(data.state.toLowerCase() == "success") {
  735. var content = data.data;
  736. $(content).each(function(i, n) {
  737. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  738. })
  739. }
  740. })
  741. }
  742. //。。。。。。。。。。。。。。。。。。。。。。。
  743. function YFPP(obj) {
  744. obj.empty();
  745. obj.append('<option selected="selected" value="">请选择</option>');
  746. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  747. "token": $.cookie("token"),
  748. flag: "YFPP",
  749. }, function(data) {
  750. if(data.state.toLowerCase() == "success") {
  751. var content = data.data;
  752. $(content).each(function(i, n) {
  753. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  754. })
  755. }
  756. })
  757. }
  758. //渠道类型
  759. function QDLX(obj) {
  760. obj.empty();
  761. obj.append('<option selected="selected" value="">请选择</option>');
  762. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  763. "token": $.cookie("token"),
  764. flag: "QDLX",
  765. }, function(data) {
  766. if(data.state.toLowerCase() == "success") {
  767. var content = data.data;
  768. $(content).each(function(i, n) {
  769. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  770. })
  771. }
  772. })
  773. }
  774. //信用等级
  775. function XYDJ(obj) {
  776. obj.empty();
  777. obj.append('<option selected="selected" value="">请选择</option>');
  778. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  779. "token": $.cookie("token"),
  780. flag: "XYDJ",
  781. }, function(data) {
  782. if(data.state.toLowerCase() == "success") {
  783. var content = data.data;
  784. $(content).each(function(i, n) {
  785. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  786. })
  787. }
  788. })
  789. }
  790. //经营品牌
  791. function JYPP(obj) {
  792. obj.empty();
  793. obj.append('<option selected="selected" value="">请选择</option>');
  794. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  795. "token": $.cookie("token"),
  796. flag: "JYPP",
  797. }, function(data) {
  798. if(data.state.toLowerCase() == "success") {
  799. var content = data.data;
  800. $(content).each(function(i, n) {
  801. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  802. })
  803. }
  804. })
  805. }
  806. //产品
  807. function CAPI(obj) {
  808. obj.empty();
  809. obj.append('<option selected="selected" value="">请选择</option>');
  810. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  811. "token": $.cookie("token"),
  812. flag: "CAPI",
  813. }, function(data) {
  814. if(data.state.toLowerCase() == "success") {
  815. var content = data.data;
  816. $(content).each(function(i, n) {
  817. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  818. })
  819. }
  820. })
  821. }
  822. //工单类型点选
  823. $('.r_order_type').find('input[type="radio"]').on('change', function() {
  824. if($(this).val() === "1") { //咨询
  825. $('#PageArrival').show(); //receive
  826. $('#Duration').hide();
  827. $('#Depth').hide();
  828. $('#Page').hide();
  829. $('#wlbm').hide();
  830. $('#wlmcc').hide();
  831. } else if($(this).val() === "2") { //投诉
  832. $('#PageArrival').hide(); //receive
  833. $('#Duration').show();
  834. $('#Depth').hide();
  835. $('#Page').hide();
  836. $('#wlbm').show();
  837. $('#wlmcc').show();
  838. } else if($(this).val() === "3") { //抽检
  839. $('#PageArrival').hide(); //receive
  840. $('#Duration').hide();
  841. $('#Depth').show();
  842. $('#Page').hide();
  843. $('#wlbm').show();
  844. $('#wlmcc').show();
  845. } else if($(this).val() === "4") { //建议其他
  846. $('#PageArrival').hide(); //receive
  847. $('#Duration').hide();
  848. $('#Depth').hide();
  849. $('#Page').show();
  850. $('#wlbm').hide();
  851. $('#wlmcc').hide();
  852. }
  853. });
  854. $('#number').blur(function () {
  855. //根据客户编码获取信息
  856. $.getJSON(huayi.config.callcenter_url + "CustomerNew/GetCodeCustomer", {
  857. // id: ids, //id
  858. code:$('#number').val(),
  859. token: $.cookie("token")
  860. }, function(data) {
  861. if (data.state.toLowerCase() == "success") {
  862. data = data.data;
  863. if (data) {
  864. $('#salesman').val(data.F_Salesman);
  865. $('#telephone').val(data.F_SalesPhone);
  866. // $('#chdaqu').text(data.F_AreaName);
  867. $("#chdaqu option:selected").text(data.F_AreaName);
  868. $("#chfen option:selected").text(data.F_BranchName);
  869. $("#chfen option:selected").val(data.F_BranchName);
  870. // $('#chfen').text(data.F_BranchName);
  871. $('#manage').val(data.F_Brands);
  872. $('#order_company').val(data.F_CompanyName);
  873. }else{
  874. $('#salesman').val('');
  875. $('#telephone').val('');
  876. $('#chdaqu').find("option:selected").attr("selected", false);
  877. // $("#chdaqu").val('');
  878. $("#chfen").val('');
  879. $('#manage').val('');
  880. $('#order_company').val('');
  881. }
  882. }
  883. // alert(111111111111111);
  884. });
  885. });
  886. $('#Code').blur(function () {
  887. // alert($(this).val());
  888. // $('#material').show();
  889. //根据物料编码获取信息
  890. $.getJSON(huayi.config.callcenter_url + "MaterialManage/GetCodeModel", {
  891. // id: ids, //id
  892. code:$('#Code').val(),
  893. token: $.cookie("token")
  894. }, function(data) {
  895. if (data.state.toLowerCase() == "success") {
  896. data = data.data;
  897. if (data) {
  898. $("#material_name").val(data.model.F_MaterialName);//物料名称
  899. $("#model_number").val(data.model.F_Model),//型号
  900. $("#specifications").val(data.model.F_Specs);//规格
  901. $("#category1").val(data.model.F_Level1);//一级分类
  902. $("#category2").val(data.model.F_Level2);//二级分类
  903. $("#category3").val(data.model.F_Level3);//三级分类
  904. $('#brand_name').val(data.model.F_Brand);//品牌
  905. $('#efficiency').val(data.model.F_MaterialEffect); //复合肥肥效
  906. $('#product_line').val(data.model.F_Pipeline); //产品线tensions
  907. $("#process").val(data.model.F_Craft);//工艺
  908. $("#enter_formula").val(data.model.F_Craft);//工艺
  909. }else{
  910. $("#material_name").val('');//物料名称
  911. $("#model_number").val(''),//型号
  912. $("#specifications").val('');//规格
  913. $("#category1").val('');//一级分类
  914. $("#category2").val('');//二级分类
  915. $("#category3").val('');//三级分类
  916. $('#brand_name').val('');//品牌
  917. $('#efficiency').val(''); //复合肥肥效
  918. $('#product_line').val(''); //产品线tensions
  919. $("#process").val('');//工艺
  920. $("#enter_formula").val('');//工艺
  921. }
  922. }
  923. // alert(111111111111111);
  924. });
  925. });