Нет описания

addOrEditWorkOrder.js 32KB

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