examine.js 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. function get_need_number(){
  3. $.post("qingdongams/customer/need/get_need_number",function (data){
  4. top.window.Backend.api.sidebar({
  5. 'qingdongams/customer/need/index':[data.data.number, 'red', 'badge'],
  6. 'qingdongams/customer/need':[data.data.number, 'red', 'badge'],
  7. 'qingdongams/examine/examine/index':[data.data.examine, 'red', 'badge'], //合同
  8. 'qingdongams/examine/examine/consume':[data.data.consume, 'red', 'badge'],
  9. 'qingdongams/examine/examine/receivables':[data.data.receivables, 'red', 'badge'],
  10. 'qingdongams/examine/examine/achievement':[data.data.achievement, 'red', 'badge'],
  11. 'qingdongams/examine/examine/work':[data.data.approval, 'red', 'badge'],
  12. 'qingdongams/examine/examine/parts':[data.data.partin, 'red', 'badge'],
  13. 'qingdongams/canlendar/canlendar':[data.data.eventOne, 'red', 'badge'],
  14. 'qingdongams/examine/examine/quote':[data.data.quote, 'red', 'badge'],
  15. 'qingdongams/workorder/workorder/index':[data.data.workorder, 'red', 'badge'],
  16. 'qingdongams/examine/examine/invoice':[data.data.invoice, 'red', 'badge'],
  17. });
  18. },'json');
  19. }
  20. get_need_number();
  21. var Controller = {
  22. index : function () {
  23. // 初始化表格参数配置
  24. Table.api.init();
  25. //绑定事件
  26. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  27. var panel = $($(this).attr("href"));
  28. if (panel.length > 0) {
  29. Controller.table[panel.attr("id")].call(this);
  30. $(this).on('click', function (e) {
  31. $($(this).attr("href")).find(".btn-refresh").trigger("click");
  32. });
  33. }
  34. //移除绑定的事件
  35. $(this).unbind('shown.bs.tab');
  36. });
  37. //必须默认触发shown.bs.tab事件
  38. $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
  39. },
  40. table: {
  41. first: function () {
  42. // 初始化表格参数配置
  43. Table.api.init({
  44. extend: {
  45. index_url: 'qingdongams/examine/examine/index?status=0',
  46. table: 'contact'
  47. }
  48. });
  49. // 合同
  50. var table1 = $("#table");
  51. table1.bootstrapTable({
  52. url: $.fn.bootstrapTable.defaults.extend.index_url,
  53. toolbar: '#toolbar',
  54. sortName: 'id',
  55. search: false,
  56. columns: [
  57. [
  58. {field: 'state', checkbox: true, },
  59. {field : 'contract.owner_staff.name', title : __('提交人'), operate: false},
  60. {
  61. field : 'contract.name', title : '合同名称', fixedColumns : true, formatter : function (value, row, index) {
  62. if(row.contract){
  63. return "<a href='javascript:void(0);' data-id='" + row.contract.id + "' class='show-contract'>" + value + "</a>";
  64. }
  65. return '';
  66. },operate:false
  67. },
  68. {field: 'contract.name', title: '合同名称', operate: false},
  69. {field: 'check_staff.name', title: __('审批人'), operate: false},
  70. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  71. {field: 'content', title: __('审批内容')},
  72. {field: 'check_time', title: __('审批时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  73. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  74. {field: 'operate', title: __('Operate'), table: table1, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  75. buttons: [
  76. {
  77. name: 'success',
  78. text: __('通过'),
  79. title: __('通过'),
  80. classname: 'records btn-dialog',
  81. area:'',
  82. refresh:true,
  83. url: 'qingdongams/examine/examine_record/examine?relation_type=contract&relation_id={relation_id}&status=1&noreload=1',
  84. visible: function (row) {
  85. //返回true时按钮显示,返回false隐藏
  86. return true;
  87. },
  88. success:function(data){
  89. get_need_number();
  90. $(".btn-refresh").trigger("click");
  91. }
  92. },
  93. {
  94. name: 'error',
  95. text: __('拒绝'),
  96. title: __('拒绝'),
  97. classname: 'records btn-dialog',
  98. extend: ' data-area=\'\'',
  99. refresh:true,
  100. url: 'qingdongams/examine/examine_record/examine?relation_type=contract&relation_id={relation_id}&status=2&noreload=1',
  101. error: function (data, ret) {
  102. console.log(data, ret);
  103. Layer.alert(ret.msg);
  104. return false;
  105. },
  106. success:function(data){
  107. get_need_number();
  108. $(".btn-refresh").trigger("click");
  109. }
  110. },
  111. ]
  112. }
  113. ]
  114. ],
  115. //启用普通表单搜索
  116. commonSearch: true,
  117. searchFormVisible: true,
  118. });
  119. $(document).on('click', '.show-contract', function (data) {
  120. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  121. var options = {
  122. shadeClose : false,
  123. shade : [0.3, '#393D49'],
  124. area : area,
  125. end : function (value) {
  126. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  127. // $(".btn-refresh").trigger("click");
  128. }
  129. };
  130. Fast.api.open("qingdongams/customer/contract/detail?ids=" + $(this).data('id'), '合同', options);
  131. });
  132. // 为表格1绑定事件
  133. Table.api.bindevent(table1);
  134. },
  135. second: function () {
  136. // 初始化表格参数配置
  137. Table.api.init({
  138. extend: {
  139. index_url: 'qingdongams/examine/examine/index?status=1',
  140. table: 'contact'
  141. }
  142. });
  143. // 合同
  144. var table1 = $("#table1");
  145. table1.bootstrapTable({
  146. url: $.fn.bootstrapTable.defaults.extend.index_url,
  147. toolbar: '#toolbar1',
  148. sortName: 'id',
  149. search: false,
  150. columns: [
  151. [
  152. {field: 'state', checkbox: true, },
  153. {field : 'contract.owner_staff.name', title : __('提交人'), operate: false},
  154. {
  155. field : 'contract.name', title : '合同名称', fixedColumns : true, formatter : function (value, row, index) {
  156. if(row.contract){
  157. return "<a href='javascript:void(0);' data-id='" + row.contract.id + "' class='show-contract'>" + value + "</a>";
  158. }
  159. return '';
  160. },operate:false
  161. },
  162. {field: 'contract.name', title: '合同名称', operate: false},
  163. {field: 'check_staff.name', title: __('审批人'), operate: false},
  164. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  165. {field: 'content', title: __('审批内容')},
  166. {field: 'check_time', title: __('审批时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  167. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  168. ]
  169. ],
  170. //启用普通表单搜索
  171. commonSearch: true,
  172. searchFormVisible: true,
  173. });
  174. // 为表格1绑定事件
  175. Table.api.bindevent(table1);
  176. },
  177. third: function () {
  178. // 初始化表格参数配置
  179. Table.api.init({
  180. extend: {
  181. index_url: 'qingdongams/examine/examine/consume?status=0',
  182. table: 'consume'
  183. }
  184. });
  185. // 费用
  186. var table2 = $("#table");
  187. table2.bootstrapTable({
  188. url: $.fn.bootstrapTable.defaults.extend.index_url,
  189. toolbar: '#toolbar',
  190. sortName: 'id',
  191. search: false,
  192. columns: [
  193. [
  194. {field : 'consume.staff.name', title : __('提交人'), operate: false},
  195. {field: 'consume.number', title: __('报销单号'), operate:false, formatter : function (value, row, index) {
  196. return "<a href='javascript:void(0);' class='btn-dialog' data-shade=\"0.3\"\n" +
  197. "data-url=\"qingdongams/customer/consume/detail?ids=" + row.consume.id+
  198. "\" data-title=\"费用详情\" ' >" + value + "</a>";
  199. }},
  200. {field: 'consume.submit_date', title: __('消费日期'), operate:false, addclass: 'datetimepicker',data:"data-date-format=\" YYYY-MM-DD\""},
  201. {field: 'consume.customer', title: __('关联客户'), operate:false, formatter : function (value, row, index) {
  202. if(row.consume.customer){
  203. return "<a href='javascript:void(0);' data-id='" + row.consume.customer.id + "' class='show-customer'>" + row.consume.customer.name + "</a>";
  204. }else{
  205. return '';
  206. }
  207. }},
  208. {field: 'consume.money', title: __('消费金额'),operate:false},
  209. {field: 'consume.remark', title: __('备注'),operate:false},
  210. {field: 'consume.staff.name', title: __('提交人'),operate:false},
  211. {field: 'check_staff.name', title: __('审批人'), operate: false},
  212. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  213. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  214. {field: 'operate', title: __('Operate'), table: table2, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  215. buttons: [
  216. {
  217. name: 'success',
  218. text: __('通过'),
  219. title: __('通过'),
  220. classname: 'records btn-dialog',
  221. area:'',
  222. refresh:true,
  223. icon: 'fa fa-check',
  224. url: 'qingdongams/examine/examine_record/examine?relation_type=consume&relation_id={relation_id}&status=1&noreload=1',
  225. visible: function (row) {
  226. //返回true时按钮显示,返回false隐藏
  227. return true;
  228. },
  229. success:function(data){
  230. get_need_number();
  231. $(".btn-refresh").trigger("click");
  232. }
  233. },
  234. {
  235. name: 'error',
  236. text: __('拒绝'),
  237. title: __('拒绝'),
  238. classname: 'records btn-dialog',
  239. extend: ' data-area=\'\'',
  240. refresh:true,
  241. icon: 'fa fa-close',
  242. url: 'qingdongams/examine/examine_record/examine?relation_type=consume&relation_id={relation_id}&status=2&noreload=1',
  243. error: function (data, ret) {
  244. console.log(data, ret);
  245. Layer.alert(ret.msg);
  246. return false;
  247. },
  248. success:function(data){
  249. get_need_number();
  250. $(".btn-refresh").trigger("click");
  251. }
  252. },
  253. ]
  254. }
  255. ]
  256. ],
  257. //启用普通表单搜索
  258. commonSearch: true,
  259. searchFormVisible: true,
  260. });
  261. $(document).on('click', '.show-consume', function (data) {
  262. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  263. var options = {
  264. shadeClose : false,
  265. shade : [0.3, '#393D49'],
  266. area : area,
  267. end : function (value) {
  268. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  269. console.log(value);
  270. $(".btn-refresh").trigger("click");
  271. }
  272. };
  273. Fast.api.open("qingdongams/customer/consume/detail?ids=" + $(this).data('id'), '费用详情', options);
  274. });
  275. // 为表格2绑定事件
  276. Table.api.bindevent(table2);
  277. },
  278. four: function () {
  279. // 初始化表格参数配置
  280. Table.api.init({
  281. extend: {
  282. index_url: 'qingdongams/examine/examine/consume?status=1',
  283. table: 'consume'
  284. }
  285. });
  286. // 费用
  287. var table2 = $("#table1");
  288. table2.bootstrapTable({
  289. url: $.fn.bootstrapTable.defaults.extend.index_url,
  290. toolbar: '#toolbar1',
  291. sortName: 'id',
  292. search: false,
  293. columns: [
  294. [
  295. {field : 'consume.staff.name', title : __('提交人'), operate: false},
  296. {field: 'consume.number', title: __('报销单号'), operate:false, formatter : function (value, row, index) {
  297. return "<a href='javascript:void(0);' class='btn-dialog' data-shade=\"0.3\"\n" +
  298. "data-url=\"qingdongams/customer/consume/detail?ids=" + row.consume.id+
  299. "\" data-title=\"费用详情\" ' >" + value + "</a>";
  300. }},
  301. {field: 'consume.submit_date', title: __('消费日期'), operate: false, addclass: 'datetimepicker',data:"data-date-format=\" YYYY-MM-DD\""},
  302. {field: 'consume.customer', title: __('关联客户'), operate:false, formatter : function (value, row, index) {
  303. if(row.consume.customer){
  304. return "<a href='javascript:void(0);' data-id='" + row.consume.customer.id + "' class='show-customer'>" + row.consume.customer.name + "</a>";
  305. }else{
  306. return '';
  307. }
  308. }},
  309. {field: 'consume.money', title: __('消费金额'),operate:false},
  310. {field: 'consume.remark', title: __('备注'),operate:false},
  311. {field: 'check_staff.name', title: __('审批人'), operate: false},
  312. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  313. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  314. ]
  315. ],
  316. //启用普通表单搜索
  317. commonSearch: true,
  318. searchFormVisible: true,
  319. });
  320. // 为表格2绑定事件
  321. Table.api.bindevent(table2);
  322. },
  323. five: function () {
  324. // 初始化表格参数配置
  325. Table.api.init({
  326. extend: {
  327. index_url: 'qingdongams/examine/examine/achievement?status=0',
  328. table: 'achievement'
  329. }
  330. });
  331. // 业绩目标
  332. var table4 = $("#table");
  333. table4.bootstrapTable({
  334. url: $.fn.bootstrapTable.defaults.extend.index_url,
  335. toolbar: '#toolbar',
  336. sortName: 'id',
  337. fixedColumns : true,
  338. fixedRightNumber : 1,
  339. search: false,
  340. columns: [
  341. [
  342. {field : 'check_staff.name', title : __('提交人'), operate: false},
  343. {field: 'achievement.status', title: '业绩目标类型', operate: false, formatter : Table.api.formatter.status, searchList :{1:'获客',2:'拜访',3: '合同金额', 4: '回款金额'}},
  344. {field: 'achievement.year', title: '业绩目标年份', operate: false},
  345. {field: 'achievement.yeartarget', title: '年目标', operate: false},
  346. {field : 'achievement.january', title : __('一月'), operate: false},
  347. {field : 'achievement.february', title : __('二月'), operate: false},
  348. {field : 'achievement.march', title : __('三月'), operate: false},
  349. {field : 'achievement.april', title : __('四月'), operate: false},
  350. {field : 'achievement.may', title : __('五月'), operate: false},
  351. {field : 'achievement.june', title : __('六月'), operate: false},
  352. {field : 'achievement.july', title : __('七月'), operate: false},
  353. {field : 'achievement.august', title : __('八月'), operate: false},
  354. {field : 'achievement.september', title : __('九月'), operate: false},
  355. {field : 'achievement.october', title : __('十月'), operate: false},
  356. {field : 'achievement.november', title : __('十一月'), operate: false},
  357. {field : 'achievement.december', title : __('十二月'), operate: false},
  358. {field: 'check_staff.name', title: __('审批人'), operate: false},
  359. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  360. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  361. {field: 'operate', title: __('Operate'),width:150, table: table4, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  362. buttons: [
  363. {
  364. name: 'success',
  365. text: __('通过'),
  366. title: __('通过'),
  367. classname: 'records btn-dialog',
  368. extend: ' data-area=\'\'',
  369. refresh:true,
  370. url: 'qingdongams/examine/examine_record/examine?relation_type=achievement&relation_id={relation_id}&status=1&noreload=1',
  371. visible: function (row) {
  372. //返回true时按钮显示,返回false隐藏
  373. return true;
  374. },
  375. success:function(data){
  376. get_need_number();
  377. $(".btn-refresh").trigger("click");
  378. }
  379. },
  380. {
  381. name: 'error',
  382. text: __('拒绝'),
  383. title: __('拒绝'),
  384. classname: 'records btn-dialog',
  385. extend: ' data-area=\'\'',
  386. refresh:true,
  387. url: 'qingdongams/examine/examine_record/examine?relation_type=achievement&relation_id={relation_id}&status=2&noreload=1',
  388. error: function (data, ret) {
  389. console.log(data, ret);
  390. Layer.alert(ret.msg);
  391. return false;
  392. },
  393. success:function(data){
  394. get_need_number();
  395. $(".btn-refresh").trigger("click");
  396. }
  397. },
  398. ]
  399. }
  400. ]
  401. ],
  402. //启用普通表单搜索
  403. commonSearch: true,
  404. searchFormVisible: true,
  405. });
  406. // 为表格2绑定事件
  407. Table.api.bindevent(table4);
  408. },
  409. six: function () {
  410. // 初始化表格参数配置
  411. Table.api.init({
  412. extend: {
  413. index_url: 'qingdongams/examine/examine/achievement?status=1',
  414. table: 'achievement'
  415. }
  416. });
  417. // 业绩目标
  418. var table4 = $("#table1");
  419. table4.bootstrapTable({
  420. url: $.fn.bootstrapTable.defaults.extend.index_url,
  421. toolbar: '#toolbar1',
  422. sortName: 'id',
  423. fixedColumns : true,
  424. fixedRightNumber : 1,
  425. search: false,
  426. columns: [
  427. [
  428. {field : 'check_staff.name', title : __('提交人'), operate: false},
  429. {field: 'achievement.status', title: '业绩目标类型', operate: false, formatter : Table.api.formatter.status, searchList :{1:'获客',2:'拜访',3: '合同金额', 4: '回款金额'}},
  430. {field: 'achievement.year', title: '业绩目标年份', operate: false},
  431. {field: 'achievement.yeartarget', title: '年目标', operate: false},
  432. {field : 'achievement.january', title : __('一月'), operate: false},
  433. {field : 'achievement.february', title : __('二月'), operate: false},
  434. {field : 'achievement.march', title : __('三月'), operate: false},
  435. {field : 'achievement.april', title : __('四月'), operate: false},
  436. {field : 'achievement.may', title : __('五月'), operate: false},
  437. {field : 'achievement.june', title : __('六月'), operate: false},
  438. {field : 'achievement.july', title : __('七月'), operate: false},
  439. {field : 'achievement.august', title : __('八月'), operate: false},
  440. {field : 'achievement.september', title : __('九月'), operate: false},
  441. {field : 'achievement.october', title : __('十月'), operate: false},
  442. {field : 'achievement.november', title : __('十一月'), operate: false},
  443. {field : 'achievement.december', title : __('十二月'), operate: false},
  444. {field: 'check_staff.name', title: __('审批人'), operate: false},
  445. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  446. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  447. ]
  448. ],
  449. //启用普通表单搜索
  450. commonSearch: true,
  451. searchFormVisible: true,
  452. });
  453. // 为表格2绑定事件
  454. Table.api.bindevent(table4);
  455. },
  456. seven: function () {
  457. // 初始化表格参数配置
  458. Table.api.init({
  459. extend: {
  460. index_url: 'qingdongams/examine/examine/receivables?status=0',
  461. table: 'receivables'
  462. }
  463. });
  464. // 回款
  465. var table3 = $("#table");
  466. table3.bootstrapTable({
  467. url: $.fn.bootstrapTable.defaults.extend.index_url,
  468. toolbar: '#toolbar',
  469. sortName: 'id',
  470. search: false,
  471. columns: [
  472. [
  473. {field : 'receivables.create_staff.name', title : __('提交人'), operate: false},
  474. {
  475. field : 'receivables.number', title : '回款编号', fixedColumns : true, formatter : function (value, row, index) {
  476. if(row.receivables){
  477. if(!row.receivables.number){
  478. return "<a href='javascript:void(0);' data-id='" + row.relation_id + "' class='show-receivables'>--</a>";
  479. }
  480. return "<a href='javascript:void(0);' data-id='" + row.relation_id + "' class='show-receivables'>" + row.receivables.number + "</a>";
  481. }
  482. return '';
  483. },operate:false
  484. },
  485. {field: 'receivables.return_type', title: '回款方式', operate: false},
  486. {field: 'receivables.return_time', title: '回款日期', operate: false},
  487. {field: 'receivables.money', title: '回款金额', operate: false},
  488. {field: 'check_staff.name', title: __('审批人'), operate: false},
  489. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  490. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  491. {field: 'operate', title: __('Operate'), table: table3, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  492. buttons: [
  493. {
  494. name: 'success',
  495. text: __('通过'),
  496. title: __('通过'),
  497. classname: 'records btn-dialog',
  498. extend: ' data-area=\'\'',
  499. refresh:true,
  500. url: 'qingdongams/examine/examine_record/examine?relation_type=receivables&relation_id={relation_id}&status=1&noreload=1',
  501. visible: function (row) {
  502. //返回true时按钮显示,返回false隐藏
  503. return true;
  504. },
  505. success:function(data){
  506. get_need_number();
  507. $(".btn-refresh").trigger("click");
  508. }
  509. },
  510. {
  511. name: 'error',
  512. text: __('拒绝'),
  513. title: __('拒绝'),
  514. classname: 'records btn-dialog',
  515. extend: ' data-area=\'\'',
  516. refresh:true,
  517. url: 'qingdongams/examine/examine_record/examine?relation_type=receivables&relation_id={relation_id}&status=2&noreload=1',
  518. error: function (data, ret) {
  519. console.log(data, ret);
  520. Layer.alert(ret.msg);
  521. return false;
  522. },
  523. success:function(data){
  524. get_need_number();
  525. $(".btn-refresh").trigger("click");
  526. }
  527. },
  528. ]
  529. }
  530. ]
  531. ],
  532. //启用普通表单搜索
  533. commonSearch: true,
  534. searchFormVisible: true,
  535. });
  536. $(document).on('click', '.show-receivables', function (data) {
  537. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  538. var options = {
  539. shadeClose : false,
  540. shade : [0.3, '#393D49'],
  541. area : area,
  542. end : function (value) {
  543. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  544. // $(".btn-refresh").trigger("click");
  545. }
  546. };
  547. Fast.api.open("qingdongams/customer/receivables/detail?ids=" + $(this).data('id'), '回款详情', options);
  548. });
  549. // 为表格2绑定事件
  550. Table.api.bindevent(table3);
  551. },
  552. eight: function () {
  553. // 初始化表格参数配置
  554. Table.api.init({
  555. extend: {
  556. index_url: 'qingdongams/examine/examine/receivables?status=1',
  557. table: 'receivables'
  558. }
  559. });
  560. // 回款
  561. var table3 = $("#table1");
  562. table3.bootstrapTable({
  563. url: $.fn.bootstrapTable.defaults.extend.index_url,
  564. toolbar: '#toolbar1',
  565. sortName: 'id',
  566. search: false,
  567. columns: [
  568. [
  569. {field : 'receivables.create_staff.name', title : __('提交人'), operate: false},
  570. {
  571. field : 'receivables.number', title : '回款编号', fixedColumns : true, formatter : function (value, row, index) {
  572. if(row.receivables){
  573. return "<a href='javascript:void(0);' data-id='" + row.relation_id + "' class='show-receivables'>" + row.receivables.number + "</a>";
  574. }
  575. return '';
  576. },operate:false
  577. },
  578. {field: 'receivables.return_type', title: '回款方式', operate: false},
  579. {field: 'receivables.return_time', title: '回款日期', operate: false},
  580. {field: 'receivables.money', title: '回款金额', operate: false},
  581. {field: 'check_staff.name', title: __('审批人'), operate: false},
  582. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  583. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  584. ]
  585. ],
  586. //启用普通表单搜索
  587. commonSearch: true,
  588. searchFormVisible: true,
  589. });
  590. // 为表格2绑定事件
  591. Table.api.bindevent(table3);
  592. },
  593. nine: function () {
  594. // 初始化表格参数配置
  595. Table.api.init({
  596. extend: {
  597. index_url: 'qingdongams/examine/examine/work?status=0',
  598. table: 'work'
  599. }
  600. });
  601. // 办公审批
  602. var table3 = $("#table");
  603. table3.bootstrapTable({
  604. url: $.fn.bootstrapTable.defaults.extend.index_url,
  605. toolbar: '#toolbar',
  606. sortName: 'id',
  607. search: false,
  608. columns: [
  609. [
  610. {field: 'approval_name', title: __('审批类型'), operate: false},
  611. {field : 'approval.create_staff.name', title : __('提交人'), operate: false},
  612. {field: 'check_staff.name', title: __('审批人'), operate: false},
  613. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  614. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  615. {field: 'operate', title: __('Operate'), table: table3, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  616. buttons: [
  617. {
  618. name: 'detail',
  619. text: __('详情'),
  620. classname: 'records btn-dialog',
  621. url: function (row) {
  622. return 'qingdongams/work/approval/detail?ids=' + row.approval.id;
  623. },
  624. extend: "data-area='[\"80%\", \"80%\"]'",
  625. callback: function (data) {
  626. Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  627. $(".btn-refresh").trigger("click");
  628. }
  629. },
  630. {
  631. name: 'success',
  632. text: __('通过'),
  633. title: __('通过'),
  634. classname: 'records btn-dialog',
  635. extend: ' data-area=\'\'',
  636. refresh:true,
  637. url: 'qingdongams/examine/examine_record/examine?relation_type=approval&relation_id={relation_id}&status=1&noreload=1',
  638. visible: function (row) {
  639. //返回true时按钮显示,返回false隐藏
  640. return true;
  641. },
  642. success:function(data){
  643. get_need_number();
  644. $(".btn-refresh").trigger("click");
  645. }
  646. },
  647. {
  648. name: 'error',
  649. text: __('拒绝'),
  650. title: __('拒绝'),
  651. classname: 'records btn-dialog',
  652. extend: ' data-area=\'\'',
  653. refresh:true,
  654. url: 'qingdongams/examine/examine_record/examine?relation_type=approval&relation_id={relation_id}&status=2&noreload=1',
  655. error: function (data, ret) {
  656. console.log(data, ret);
  657. Layer.alert(ret.msg);
  658. return false;
  659. },
  660. success:function(data){
  661. get_need_number();
  662. $(".btn-refresh").trigger("click");
  663. }
  664. },
  665. ]
  666. }
  667. ]
  668. ],
  669. //启用普通表单搜索
  670. commonSearch: true,
  671. searchFormVisible: true,
  672. });
  673. $(document).on('click', '.show-receivables', function (data) {
  674. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  675. var options = {
  676. shadeClose : false,
  677. shade : [0.3, '#393D49'],
  678. area : area,
  679. end : function (value) {
  680. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  681. // $(".btn-refresh").trigger("click");
  682. }
  683. };
  684. Fast.api.open("qingdongams/customer/receivables/detail?ids=" + $(this).data('id'), '回款详情', options);
  685. });
  686. // 为表格2绑定事件
  687. Table.api.bindevent(table3);
  688. },
  689. ten: function () {
  690. // 初始化表格参数配置
  691. Table.api.init({
  692. extend: {
  693. index_url: 'qingdongams/examine/examine/work?status=1',
  694. table: 'work'
  695. }
  696. });
  697. // 办公审批
  698. var table3 = $("#table1");
  699. table3.bootstrapTable({
  700. url: $.fn.bootstrapTable.defaults.extend.index_url,
  701. toolbar: '#toolbar1',
  702. sortName: 'id',
  703. search: false,
  704. columns: [
  705. [
  706. {field: 'approval_name', title: __('审批类型'), operate: false},
  707. {field : 'approval.create_staff.name', title : __('提交人'), operate: false},
  708. {field: 'check_staff.name', title: __('审批人'), operate: false},
  709. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  710. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  711. {field: 'operate', title: __('Operate'), table: table3, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  712. buttons: [
  713. {
  714. name: 'detail',
  715. text: __('详情'),
  716. classname: 'records btn-dialog',
  717. url: function (row) {
  718. return 'qingdongams/work/approval/detail?ids=' + row.approval.id;
  719. },
  720. extend: "data-area='[\"80%\", \"80%\"]'",
  721. callback: function (data) {
  722. Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  723. $(".btn-refresh").trigger("click");
  724. }
  725. },
  726. {
  727. name: 'success',
  728. text: __('通过'),
  729. title: __('通过'),
  730. classname: 'records btn-dialog',
  731. extend: ' data-area=\'\'',
  732. refresh:true,
  733. url: 'qingdongams/examine/examine_record/examine?relation_type=approval&relation_id={relation_id}&status=1&noreload=1',
  734. visible: function (row) {
  735. //返回true时按钮显示,返回false隐藏
  736. return true;
  737. },
  738. success:function(data){
  739. get_need_number();
  740. $(".btn-refresh").trigger("click");
  741. }
  742. },
  743. {
  744. name: 'error',
  745. text: __('拒绝'),
  746. title: __('拒绝'),
  747. classname: 'records btn-dialog',
  748. extend: ' data-area=\'\'',
  749. refresh:true,
  750. url: 'qingdongams/examine/examine_record/examine?relation_type=approval&relation_id={relation_id}&status=2&noreload=1',
  751. error: function (data, ret) {
  752. console.log(data, ret);
  753. Layer.alert(ret.msg);
  754. return false;
  755. },
  756. success:function(data){
  757. get_need_number();
  758. $(".btn-refresh").trigger("click");
  759. }
  760. },
  761. ]
  762. }
  763. ]
  764. ],
  765. //启用普通表单搜索
  766. commonSearch: true,
  767. searchFormVisible: true,
  768. });
  769. // 为表格2绑定事件
  770. Table.api.bindevent(table3);
  771. },
  772. quotecheck: function () {
  773. // 初始化表格参数配置
  774. Table.api.init({
  775. extend: {
  776. index_url: 'qingdongams/examine/examine/quote?status=0',
  777. table: 'work'
  778. }
  779. });
  780. // 办公审批
  781. var table = $("#table");
  782. table.bootstrapTable({
  783. url: $.fn.bootstrapTable.defaults.extend.index_url,
  784. toolbar: '#toolbar',
  785. sortName: 'id',
  786. search: false,
  787. columns: [
  788. [
  789. {field: 'state', checkbox: true, },
  790. {field : 'quote.owner_staff.name', title : __('提交人'), operate:false,searchList:$.getJSON("qingdongams/customer/customer/stafflist")},
  791. {
  792. field : 'quote.number', title : '报价单编号', fixedColumns : true, formatter : function (value, row, index) {
  793. return "<a href='javascript:void(0);' class='btn-dialog' " +
  794. "data-url='qingdongams/customer/quote/detail/ids/"+row.quote.id+"' data-shade='0.3' data-title='报价单详情' >" + value + "</a>";
  795. },operate:false
  796. },
  797. {
  798. field : 'quote.customer.name', title : '客户信息', fixedColumns : true, formatter : function (value, row, index) {
  799. return "<a href='javascript:void(0);' class='btn-dialog' " +
  800. "data-url='qingdongams/customer/customer/detail/ids/"+row.quote.customer.id+"' data-shade='0.3' data-title='客户详情' >" + row.quote.customer.name + "</a>";
  801. },operate:false
  802. },
  803. {field: 'quote.quote_amount', title: '报价金额', operate: false},
  804. {field: 'check_staff.name', title: __('审批人'), operate: false},
  805. {field: 'status', title: __('审批状态'), operate:'=', formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  806. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  807. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  808. buttons: [
  809. {
  810. name: 'success',
  811. text: __('通过'),
  812. title: __('通过'),
  813. classname: 'records btn-ajax',
  814. confirm: '确认要审核通过当前报价单?',
  815. refresh:true,
  816. url: 'qingdongams/examine/examine_record/examine?relation_type=quote&relation_id={relation_id}&status=1&noreload=1',
  817. visible: function (row) {
  818. //返回true时按钮显示,返回false隐藏
  819. return true;
  820. },
  821. success: function (data) {
  822. get_need_number()
  823. $(".btn-refresh").trigger("click");
  824. },
  825. },
  826. {
  827. name: 'error',
  828. text: __('拒绝'),
  829. title: __('拒绝'),
  830. classname: 'records btn-ajax',
  831. confirm: '确认要拒绝通过当前报价单?',
  832. refresh:true,
  833. url: 'qingdongams/examine/examine_record/examine?relation_type=quote&relation_id={relation_id}&status=2&noreload=1',
  834. error: function (data, ret) {
  835. console.log(data, ret);
  836. Layer.alert(ret.msg);
  837. return false;
  838. },
  839. success: function (data) {
  840. get_need_number()
  841. $(".btn-refresh").trigger("click");
  842. },
  843. },
  844. ]
  845. }
  846. ]
  847. ],
  848. //启用普通表单搜索
  849. commonSearch: true,
  850. searchFormVisible: true,
  851. });
  852. // 为表格2绑定事件
  853. Table.api.bindevent(table);
  854. },
  855. quotesuccess: function () {
  856. // 初始化表格参数配置
  857. Table.api.init({
  858. extend: {
  859. index_url: 'qingdongams/examine/examine/quote?status=1',
  860. table: 'work'
  861. }
  862. });
  863. // 办公审批
  864. var table = $("#table1");
  865. table.bootstrapTable({
  866. url: $.fn.bootstrapTable.defaults.extend.index_url,
  867. toolbar: '#toolbar1',
  868. sortName: 'id',
  869. search: false,
  870. columns: [
  871. [
  872. {field: 'state', checkbox: true, },
  873. {field : 'quote.owner_staff.name', title : __('提交人'), operate:false,searchList:$.getJSON("qingdongams/customer/customer/stafflist")},
  874. {
  875. field : 'quote.number', title : '报价单编号', fixedColumns : true, formatter : function (value, row, index) {
  876. return "<a href='javascript:void(0);' class='btn-dialog' " +
  877. "data-url='qingdongams/customer/quote/detail/ids/"+row.quote.id+"' data-shade='0.3' data-title='报价单详情' >" + value + "</a>";
  878. },operate:false
  879. },
  880. {
  881. field : 'quote.customer.name', title : '客户信息', fixedColumns : true, formatter : function (value, row, index) {
  882. return "<a href='javascript:void(0);' class='btn-dialog' " +
  883. "data-url='qingdongams/customer/customer/detail/ids/"+row.quote.customer.id+"' data-shade='0.3' data-title='客户详情' >" + row.quote.customer.name + "</a>";
  884. },operate:false
  885. },
  886. {field: 'quote.quote_amount', title: '报价金额', operate: false},
  887. {field: 'check_staff.name', title: __('审批人'), operate: false},
  888. {field: 'status', title: __('审批状态'), operate:'=', formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  889. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  890. ]
  891. ],
  892. //启用普通表单搜索
  893. commonSearch: true,
  894. searchFormVisible: true,
  895. });
  896. // 为表格2绑定事件
  897. Table.api.bindevent(table);
  898. },
  899. invoicecheck: function () {
  900. // 初始化表格参数配置
  901. Table.api.init({
  902. extend: {
  903. index_url: 'qingdongams/examine/examine/invoice?status=0',
  904. table: 'invoice'
  905. }
  906. });
  907. // 费用
  908. var table2 = $("#table");
  909. table2.bootstrapTable({
  910. url: $.fn.bootstrapTable.defaults.extend.index_url,
  911. toolbar: '#toolbar',
  912. sortName: 'id',
  913. search: false,
  914. columns: [
  915. [
  916. {field : 'invoice.create_staff.name', title : __('提交人'), operate: false},
  917. {field: 'invoice.number', title: __('发票编号'), operate:false, formatter : function (value, row, index) {
  918. if(!row.invoice){
  919. return '';
  920. }
  921. return "<a href='javascript:void(0);' class='btn-dialog' data-area=[\"95%\",\"95%\"] data-shade=\"0.3\"\n" +
  922. "data-url=\"qingdongams/finance/invoice/detail?ids=" + row.invoice.id+
  923. "\" data-title=\"发票详情\" ' >" + value + "</a>";
  924. }},
  925. {field: 'invoice.time', title: __('开票日期'), operate:false},
  926. {field: 'invoice.customer', title: __('客户名称'), operate:false, formatter : function (value, row, index) {
  927. if(row.customer){
  928. return "<a href='javascript:void(0);' data-id='" + row.customer.id + "' class='show-customer'>" + row.customer.name + "</a>";
  929. }else{
  930. return '';
  931. }
  932. }},
  933. {field: 'invoice.contract', title: __('合同编号'), operate:false, formatter : function (value, row, index) {
  934. if(row.contract){
  935. return "<a href='javascript:void(0);' data-id='" + row.contract.id + "' class='show-contract'>" + row.contract.name + "</a>";
  936. }else{
  937. return '';
  938. }
  939. }},
  940. {field: 'invoice.money', title: __('消费金额'),operate:false},
  941. {field: 'invoice.remark', title: __('备注'),operate:false},
  942. {field: 'check_staff.name', title: __('审批人'), operate: false},
  943. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  944. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  945. {field: 'operate', title: __('Operate'), table: table2, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  946. buttons: [
  947. {
  948. name: 'success',
  949. text: __('通过'),
  950. title: __('通过'),
  951. classname: 'records btn-dialog',
  952. area:'',
  953. refresh:true,
  954. icon: 'fa fa-check',
  955. url: 'qingdongams/examine/examine_record/examine?relation_type=invoice&relation_id={relation_id}&status=1&noreload=1',
  956. visible: function (row) {
  957. //返回true时按钮显示,返回false隐藏
  958. return true;
  959. },
  960. success:function(data){
  961. get_need_number();
  962. $(".btn-refresh").trigger("click");
  963. }
  964. },
  965. {
  966. name: 'error',
  967. text: __('拒绝'),
  968. title: __('拒绝'),
  969. classname: 'records btn-dialog',
  970. extend: ' data-area=\'\'',
  971. refresh:true,
  972. icon: 'fa fa-close',
  973. url: 'qingdongams/examine/examine_record/examine?relation_type=invoice&relation_id={relation_id}&status=2&noreload=1',
  974. error: function (data, ret) {
  975. console.log(data, ret);
  976. Layer.alert(ret.msg);
  977. return false;
  978. },
  979. success:function(data){
  980. get_need_number();
  981. $(".btn-refresh").trigger("click");
  982. }
  983. },
  984. ]
  985. }
  986. ]
  987. ],
  988. //启用普通表单搜索
  989. commonSearch: true,
  990. searchFormVisible: true,
  991. });
  992. // 为表格2绑定事件
  993. Table.api.bindevent(table2);
  994. },
  995. invoicesuccess: function () {
  996. // 初始化表格参数配置
  997. Table.api.init({
  998. extend: {
  999. index_url: 'qingdongams/examine/examine/invoice?status=1',
  1000. table: 'invoice'
  1001. }
  1002. });
  1003. // 费用
  1004. var table2 = $("#table1");
  1005. table2.bootstrapTable({
  1006. url: $.fn.bootstrapTable.defaults.extend.index_url,
  1007. toolbar: '#toolbar1',
  1008. sortName: 'id',
  1009. search: false,
  1010. columns: [
  1011. [
  1012. {field : 'invoice.create_staff.name', title : __('提交人'), operate: false},
  1013. {field: 'invoice.number', title: __('发票编号'), operate:false, formatter : function (value, row, index) {
  1014. if(!row.invoice){
  1015. return '';
  1016. }
  1017. return "<a href='javascript:void(0);' class='btn-dialog' data-area=[\"95%\",\"95%\"] data-shade=\"0.3\"\n" +
  1018. "data-url=\"qingdongams/finance/invoice/detail?ids=" + row.invoice.id+
  1019. "\" data-title=\"发票详情\" ' >" + value + "</a>";
  1020. }},
  1021. {field: 'invoice.time', title: __('开票日期'), operate:false},
  1022. {field: 'invoice.customer', title: __('关联客户'), operate:false, formatter : function (value, row, index) {
  1023. if(row.invoice.customer){
  1024. return "<a href='javascript:void(0);' data-id='" + row.invoice.customer_id + "' class='show-customer'>" + row.consume.customer.name + "</a>";
  1025. }else{
  1026. return '';
  1027. }
  1028. }},
  1029. {field: 'invoice.money', title: __('消费金额'),operate:false},
  1030. {field: 'invoice.remark', title: __('备注'),operate:false},
  1031. {field: 'check_staff.name', title: __('审批人'), operate: false},
  1032. {field: 'status', title: __('审批状态'), operate: false, formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  1033. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  1034. ]
  1035. ],
  1036. //启用普通表单搜索
  1037. commonSearch: true,
  1038. searchFormVisible: true,
  1039. });
  1040. // 为表格2绑定事件
  1041. Table.api.bindevent(table2);
  1042. },
  1043. },
  1044. consume : function () {
  1045. // 初始化表格参数配置
  1046. Table.api.init();
  1047. //绑定事件
  1048. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  1049. var panel = $($(this).attr("href"));
  1050. if (panel.length > 0) {
  1051. Controller.table[panel.attr("id")].call(this);
  1052. $(this).on('click', function (e) {
  1053. $($(this).attr("href")).find(".btn-refresh").trigger("click");
  1054. });
  1055. }
  1056. //移除绑定的事件
  1057. $(this).unbind('shown.bs.tab');
  1058. });
  1059. //必须默认触发shown.bs.tab事件
  1060. $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
  1061. $(document).on('click', '.show-customer', function (data) {
  1062. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  1063. var options = {
  1064. shadeClose : false,
  1065. shade : [0.3, '#393D49'],
  1066. area : area,
  1067. end : function (value) {
  1068. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  1069. console.log(value);
  1070. $(".btn-refresh").trigger("click");
  1071. }
  1072. };
  1073. Fast.api.open("qingdongams/customer/customer/detail?ids=" + $(this).data('id'), '客户详情', options);
  1074. });
  1075. },
  1076. receivables : function () {
  1077. // 初始化表格参数配置
  1078. Table.api.init();
  1079. //绑定事件
  1080. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  1081. var panel = $($(this).attr("href"));
  1082. if (panel.length > 0) {
  1083. Controller.table[panel.attr("id")].call(this);
  1084. $(this).on('click', function (e) {
  1085. $($(this).attr("href")).find(".btn-refresh").trigger("click");
  1086. });
  1087. }
  1088. //移除绑定的事件
  1089. $(this).unbind('shown.bs.tab');
  1090. });
  1091. //必须默认触发shown.bs.tab事件
  1092. $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
  1093. },
  1094. achievement : function () {
  1095. // 初始化表格参数配置
  1096. Table.api.init();
  1097. //绑定事件
  1098. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  1099. var panel = $($(this).attr("href"));
  1100. if (panel.length > 0) {
  1101. Controller.table[panel.attr("id")].call(this);
  1102. $(this).on('click', function (e) {
  1103. $($(this).attr("href")).find(".btn-refresh").trigger("click");
  1104. });
  1105. }
  1106. //移除绑定的事件
  1107. $(this).unbind('shown.bs.tab');
  1108. });
  1109. //必须默认触发shown.bs.tab事件
  1110. $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
  1111. },
  1112. quote: function () {
  1113. // 初始化表格参数配置
  1114. Table.api.init();
  1115. //绑定事件
  1116. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  1117. var panel = $($(this).attr("href"));
  1118. if (panel.length > 0) {
  1119. Controller.table[panel.attr("id")].call(this);
  1120. $(this).on('click', function (e) {
  1121. $($(this).attr("href")).find(".btn-refresh").trigger("click");
  1122. });
  1123. }
  1124. //移除绑定的事件
  1125. $(this).unbind('shown.bs.tab');
  1126. });
  1127. //必须默认触发shown.bs.tab事件
  1128. $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
  1129. $(document).on('click', '.show-quote', function (data) {
  1130. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  1131. var options = {
  1132. shadeClose : false,
  1133. shade : [0.3, '#393D49'],
  1134. area : area,
  1135. end : function (value) {
  1136. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  1137. console.log(value);
  1138. $(".btn-refresh").trigger("click");
  1139. }
  1140. };
  1141. Fast.api.open("qingdongams/customer/quote/detail?ids=" + $(this).data('id'), '报价单详情', options);
  1142. })
  1143. .on('click', '.show-customer', function (data) {
  1144. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  1145. var options = {
  1146. shadeClose : false,
  1147. shade : [0.3, '#393D49'],
  1148. area : area,
  1149. end : function (value) {
  1150. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  1151. console.log(value);
  1152. $(".btn-refresh").trigger("click");
  1153. }
  1154. };
  1155. Fast.api.open("qingdongams/customer/customer/detail?ids=" + $(this).data('id'), '客户详情', options);
  1156. });
  1157. },
  1158. parts : function () {
  1159. // 初始化表格参数配置
  1160. Table.api.init({
  1161. extend: {
  1162. index_url: 'qingdongams/examine/examine/parts',
  1163. table: 'examine'
  1164. }
  1165. });
  1166. var table = $("#table");
  1167. table.bootstrapTable({
  1168. url: $.fn.bootstrapTable.defaults.extend.index_url,
  1169. sortName: 'id',
  1170. columns: [
  1171. [
  1172. {field: 'state', checkbox: true, },
  1173. {field : 'parts.create_staff.name', title : __('提交人'), operate:false,searchList:$.getJSON("qingdongams/customer/customer/stafflist")},
  1174. {
  1175. field : 'parts.odd_numbers', title : '申请编号', fixedColumns : true, formatter : function (value, row, index) {
  1176. return "<a href='javascript:void(0);' data-id='" + row.parts.id + "' class='show-parts'>" + value + "</a>";
  1177. },operate:false
  1178. },
  1179. {field: 'parts.type', title: '出库/入库',operate:false, formatter: Table.api.formatter.status, searchList: { 1: __('入库'), 2: __('出库')}},
  1180. {field: 'parts.storage_time', title: '出入库时间', operate: false},
  1181. {field: 'check_staff.name', title: __('审批人'), operate: false},
  1182. {field: 'status', title: __('审批状态'), operate:'=', formatter: Table.api.formatter.status, searchList: {0: __('待审批'), 1: __('审批通过'), 2: __('审批拒绝'), 3: __('撤销')}},
  1183. {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange'},
  1184. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  1185. buttons: [
  1186. {
  1187. name: 'success',
  1188. text: __('通过'),
  1189. title: __('通过'),
  1190. classname: 'records btn-dialog',
  1191. extend: ' data-area=\'\'',
  1192. refresh:true,
  1193. url: 'qingdongams/examine/examine_record/examine?relation_type=parts&relation_id={relation_id}&status=1&noreload=1',
  1194. visible: function (row) {
  1195. //返回true时按钮显示,返回false隐藏
  1196. if (row.status == 1) {
  1197. return false;
  1198. }
  1199. return true;
  1200. },
  1201. success:function(data){
  1202. get_need_number();
  1203. $(".btn-refresh").trigger("click");
  1204. }
  1205. },
  1206. {
  1207. name: 'error',
  1208. text: __('拒绝'),
  1209. title: __('拒绝'),
  1210. classname: 'records btn-dialog',
  1211. extend: ' data-area=\'\'',
  1212. refresh:true,
  1213. url: 'qingdongams/examine/examine_record/examine?relation_type=parts&relation_id={relation_id}&status=2&noreload=1',
  1214. visible: function (row){
  1215. if (row.status == 2) {
  1216. return false;
  1217. }
  1218. return true;
  1219. },
  1220. error: function (data, ret) {
  1221. console.log(data, ret);
  1222. Layer.alert(ret.msg);
  1223. return false;
  1224. },
  1225. success:function(data){
  1226. get_need_number();
  1227. $(".btn-refresh").trigger("click");
  1228. }
  1229. },
  1230. ]
  1231. }
  1232. ]
  1233. ],
  1234. //启用普通表单搜索
  1235. commonSearch: true,
  1236. searchFormVisible: true,
  1237. });
  1238. $(document).on('click', '.show-parts', function (data) {
  1239. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  1240. var options = {
  1241. shadeClose : false,
  1242. shade : [0.3, '#393D49'],
  1243. area : area,
  1244. end : function (value) {
  1245. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  1246. console.log(value);
  1247. $(".btn-refresh").trigger("click");
  1248. }
  1249. };
  1250. Fast.api.open("qingdongams/parts/parts/log_info?ids=" + $(this).data('id'), '备件详情', options);
  1251. });
  1252. Table.api.bindevent(table);
  1253. },
  1254. work : function () {
  1255. // 初始化表格参数配置
  1256. Table.api.init();
  1257. //绑定事件
  1258. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  1259. var panel = $($(this).attr("href"));
  1260. if (panel.length > 0) {
  1261. Controller.table[panel.attr("id")].call(this);
  1262. $(this).on('click', function (e) {
  1263. $($(this).attr("href")).find(".btn-refresh").trigger("click");
  1264. });
  1265. }
  1266. //移除绑定的事件
  1267. $(this).unbind('shown.bs.tab');
  1268. });
  1269. //必须默认触发shown.bs.tab事件
  1270. $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
  1271. },
  1272. invoice : function () {
  1273. // 初始化表格参数配置
  1274. Table.api.init();
  1275. //绑定事件
  1276. $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  1277. var panel = $($(this).attr("href"));
  1278. if (panel.length > 0) {
  1279. Controller.table[panel.attr("id")].call(this);
  1280. $(this).on('click', function (e) {
  1281. $($(this).attr("href")).find(".btn-refresh").trigger("click");
  1282. });
  1283. }
  1284. //移除绑定的事件
  1285. $(this).unbind('shown.bs.tab');
  1286. });
  1287. //必须默认触发shown.bs.tab事件
  1288. $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
  1289. $(document).on('click', '.show-customer', function (data) {
  1290. var area = ['95%', '95%'];
  1291. var options = {
  1292. shadeClose : false,
  1293. shade : [0.3, '#393D49'],
  1294. area : area,
  1295. callback : function (value) {
  1296. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  1297. console.log(value);
  1298. }
  1299. };
  1300. Fast.api.open($.fn.bootstrapTable.defaults.extend.customer_url + "?ids=" + $(this).data('id'), '客户详情', options);
  1301. });
  1302. $(document).on('click', '.show-contract', function (data) {
  1303. var area = ['95%', '95%'];
  1304. var options = {
  1305. shadeClose : false,
  1306. shade : [0.3, '#393D49'],
  1307. area : area,
  1308. callback : function (value) {
  1309. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  1310. console.log(value);
  1311. }
  1312. };
  1313. Fast.api.open($.fn.bootstrapTable.defaults.extend.contract_url + "?ids=" + $(this).data('id'), '客户详情', options);
  1314. });
  1315. },
  1316. add: function () {
  1317. Controller.api.bindevent();
  1318. },
  1319. edit: function () {
  1320. Controller.api.bindevent();
  1321. },
  1322. api: {
  1323. bindevent: function () {
  1324. Form.api.bindevent($("form[role=form]"));
  1325. },
  1326. }
  1327. };
  1328. return Controller;
  1329. });