enterprise_list.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. var Enterprise = {
  2. id: "table", //表格id
  3. seItem: null, //选中的条目
  4. table: null,
  5. layerIndex: -1
  6. };
  7. Enterprise.initColumn = function(){
  8. var type = $("#type").val();
  9. var isShow = true;
  10. if(type==2){
  11. isShow = false;
  12. };
  13. return [
  14. {field: 'selectItem', radio: true},
  15. {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
  16. {title: '账号', field: 'username',visible: true, align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  17. {title: '机构名称', field: 'name',visible: true, align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  18. {title: '统一社会信用代码', field: 'idCard',visible: true, align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  19. {title: '产业领域', field: 'industryFieldNewName',visible: isShow, align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  20. {title: '机构类型', field: 'type', align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip',
  21. formatter : function(value,row,index){
  22. if(value==1){
  23. return "晋江市现代产业体系人才";
  24. }
  25. if(value==2){
  26. return "集成电路优秀人才";
  27. }
  28. }
  29. },
  30. {title: '单位标签', field: 'enterpriseTagName', visible: isShow,align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  31. {title: '法人代表', field: 'legal', align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  32. {title: '单位电话', field: 'ephone', align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  33. {title: '人才联络员', field: 'agentName', align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  34. {title: '人才联络员电话', field: 'agentPhone', align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  35. {title: '审核状态', field: 'checkState', align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip',
  36. formatter: function (value, row, index){
  37. if (value==null || value==''){
  38. return "";
  39. } else if (value == 1){
  40. return "未审核";
  41. }else if(value == 2){
  42. return "审核驳回";
  43. }else if(value == 3){
  44. return "审核通过";
  45. }else if(value == 4){
  46. return "重新提交";
  47. }
  48. },
  49. cellStyle: function(value, row, index) {
  50. if (value==null || value===''){
  51. return {css:{}};
  52. } else if (value === 1){
  53. return {css:{"background-color":"LightGrey"}};
  54. }else if(value === 3){
  55. return {css:{'background-color':'LightGreen'}};
  56. } else if(value === 2){
  57. return {css:{"background-color":"Orange"}};
  58. } else {
  59. return {css:{}};
  60. }
  61. }
  62. },
  63. {title: '账号状态', field: 'active', align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip',
  64. formatter: function (value, row, index){
  65. if (value==null || value==''){
  66. return "";
  67. } else if (value == 1){
  68. return "账号有效";
  69. }else if(value == 2){
  70. return "拉黑/冻结";
  71. }
  72. },
  73. cellStyle: function(value, row, index) {
  74. if (value==null || value===''){
  75. return {css:{}};
  76. } else if(value === 1){
  77. return {css:{'background-color':'LightGreen'}};
  78. } else if(value === 2){
  79. return {css:{"background-color":"Orange"}};
  80. } else {
  81. return {css:{}};
  82. }
  83. }
  84. },
  85. {title: '注册时间', field: 'createTime', align: 'center', width:120, valign: 'middle', 'class': 'uitd_showTip'},
  86. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',width:"80px",
  87. formatter : function (value,row,index){
  88. return "<span class='label label-success' onclick=\"Enterprise.showLog('"+value+"')\" >" +
  89. "<i class=\"fa fa-book\"></i>日志" +
  90. "</span>";
  91. }
  92. }
  93. ];
  94. };
  95. Enterprise.formParam = function(){
  96. var queryData = {};
  97. queryData['name'] = $("#name").val();
  98. queryData['idCard'] = $("#idCard").val();
  99. queryData['legal'] = $("#legal").val();
  100. queryData['ephone'] = $("#ephone").val();
  101. queryData['agentName'] = $("#agentName").val();
  102. queryData['agentPhone'] = $("#agentPhone").val();
  103. queryData['checkState'] = $("#checkState").val();
  104. queryData['active'] = $("#active").val();
  105. queryData['street'] = $("#street").val();
  106. queryData['enterpriseTag'] = $("#enterpriseTag").val();
  107. queryData['industryFieldNew'] = $("#industryFieldNew").val();
  108. return queryData;
  109. }
  110. Enterprise.search = function() {
  111. Enterprise.table.refresh({"query": Enterprise.formParam()});
  112. };
  113. Enterprise.reset = function() {
  114. $("#name").val("");
  115. $("#idCard").val("");
  116. $("#legal").val("");
  117. $("#ephone").val("");
  118. $("#agentName").val("");
  119. $("#agentPhone").val("");
  120. $("#checkState").val("");
  121. $("#active").val("");
  122. $("#street").val("");
  123. $("#talentType").val("");
  124. $("#industryField").val("");
  125. };
  126. Enterprise.gotoEnterpriseDetailPage = function() {
  127. if (!Enterprise.check()) {
  128. return;
  129. }
  130. var index = layer.open({
  131. type: 2,
  132. title: '查看详情',
  133. area: ['830px', '450px'], //宽高
  134. fix: false, //不固定
  135. maxmin: true,
  136. content: Feng.ctxPath + '/admin/enterprise/gotoEnterpriseDetailPage?id='+Enterprise.seItem.id,
  137. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;审核','<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  138. btnAlign: 'c',
  139. yes: function (index, layero) {
  140. Enterprise.doExamine();
  141. }
  142. });
  143. layer.full(index);
  144. Enterprise.layerIndex = index;
  145. };
  146. Enterprise.setActive = function() {
  147. if (!Enterprise.check()) {
  148. return;
  149. }
  150. var index = layer.open({
  151. type: 2,
  152. title: '设置冻结',
  153. area: ['830px', '500px'], //宽高
  154. fix: false, //不固定
  155. maxmin: true,
  156. content: Feng.ctxPath + '/admin/enterprise/gotoActivePage?id='+Enterprise.seItem.id,
  157. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;提交','<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  158. btnAlign: 'c',
  159. yes: function (index, layero) {
  160. //按钮【按钮一】的回调
  161. var iframeWin = window[layero.find('iframe')[0]['name']];
  162. iframeWin.EpActive.addSubmit();
  163. }
  164. });
  165. // layer.full(index);
  166. Enterprise.layerIndex = index;
  167. };
  168. Enterprise.doExamine = function() {
  169. if (!Enterprise.check()) {
  170. return;
  171. }
  172. var index = layer.open({
  173. type: 2,
  174. title: '审核',
  175. area: ['830px', '500px'], //宽高
  176. fix: false, //不固定
  177. maxmin: true,
  178. content: Feng.ctxPath + '/admin/enterprise/gotoExaminePage?id='+Enterprise.seItem.id,
  179. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  180. btnAlign: 'c',
  181. yes: function (index, layero) {
  182. //按钮【按钮一】的回调
  183. var iframeWin = window[layero.find('iframe')[0]['name']];
  184. iframeWin.EpExam.addSubmit();
  185. }
  186. });
  187. // layer.full(index);
  188. };
  189. Enterprise.delEnterprise = function() {
  190. if (!Enterprise.check()) {
  191. return;
  192. }
  193. if (!Enterprise.check()) {
  194. return;
  195. }
  196. Feng.confirm(
  197. "确定删除吗?",
  198. function(){
  199. var ajax = new $ax(Feng.ctxPath + "/enterprise/delEnterprise?id="+Enterprise.seItem.id, function(data){
  200. Feng.info(data.msg);
  201. if(data.code == 200){
  202. Enterprise.table.refresh();
  203. }
  204. },function(data){
  205. Feng.error("操作失败!");
  206. });
  207. ajax.set(null);
  208. ajax.start();
  209. }
  210. );
  211. };
  212. Enterprise.resetPassword = function() {
  213. if (!Enterprise.check()) {
  214. return;
  215. }
  216. Feng.confirm(
  217. "确定要重置密码吗?",
  218. function(){
  219. var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/resetPassword?id="+Enterprise.seItem.id, function(data){
  220. Feng.info(data.msg);
  221. // if(data.code == 200){
  222. // Enterprise.table.refresh();
  223. // }
  224. },function(data){
  225. Feng.error("操作失败!");
  226. });
  227. ajax.set(null);
  228. ajax.start();
  229. }
  230. );
  231. };
  232. Enterprise.doExport = function() {
  233. var name = $("#name").val();
  234. var idCard = $("#idCard").val();
  235. var legal = $("#legal").val();
  236. var ephone = $("#ephone").val();
  237. var agentName = $("#agentName").val();
  238. var agentPhone = $("#agentPhone").val();
  239. var checkState = $("#checkState").val();
  240. var active = $("#active").val();
  241. var street = $("#street").val();
  242. var talentType = $("#talentType").val();
  243. var industryField = $("#industryField").val();
  244. var arr = {"name":name, "idCard":idCard, "legal":legal, "ephone":ephone, "agentName":agentName,
  245. "agentPhone":agentPhone, "checkState":checkState, "active":active,"street":street,"talentType":talentType,"industryField":industryField};
  246. window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterprise/export", arr);
  247. }
  248. /**
  249. * 批量获取人才联络员手机号码
  250. */
  251. Enterprise.getPhones = function(){
  252. var ajax = new $ax(Feng.ctxPath + "/enterprise/getPhones", function(data){
  253. if(data.code == 200){
  254. layer.open({
  255. type: 1,
  256. title:"手机号码",
  257. area: ['830px', '500px'], //宽高
  258. fix: false, //不固定
  259. maxmin: true,
  260. content: "<span style='word-break:break-all'>"+data.obj+"</span>"
  261. });
  262. }else{
  263. Feng.info(data.msg);
  264. }
  265. },function(data){
  266. Feng.error("操作失败!");
  267. });
  268. ajax.setData(Enterprise.formParam());
  269. ajax.start();
  270. }
  271. Enterprise.check = function () {
  272. var selected = $('#' + Enterprise.id).bootstrapTable('getSelections');
  273. if(selected.length == 0){
  274. Feng.info("请先选中表格中的某一记录!");
  275. return false;
  276. }else{
  277. Enterprise.seItem = selected[0];
  278. return true;
  279. }
  280. };
  281. Enterprise.showLog = function(id){
  282. layer.open({
  283. type: 1,
  284. title:"日志",
  285. fixed:false,
  286. content: '<table id="'+id+'"></table>',
  287. area: ['80%', '80%'],
  288. maxmin: true,
  289. success :function (layero, index) {
  290. Feng.getCheckLog(id,{"type":10,"mainId":id,"typeFileId":"","active":1})
  291. }
  292. });
  293. }
  294. $(function () {
  295. var defaultColunms = Enterprise.initColumn();
  296. var table = new BSTable(Enterprise.id, "/admin/enterprise/findEnterpriseByPage", defaultColunms);
  297. table.setPaginationType("server");
  298. Enterprise.table = table.init();
  299. var arr = [
  300. {"name":"street","code":"street"},
  301. {"name":"enterpriseTag","code":"enterprise_tag"},
  302. {"name":"industryFieldNew","code":"industry_field"},
  303. {"name":"enterpriseType","code":"enterprise_type"}];
  304. Feng.findChildDictBatch(JSON.stringify(arr));
  305. // Feng.addAjaxSelect({
  306. // "id": "street",
  307. // "displayCode": "code",
  308. // "displayName": "name",
  309. // "type": "GET",
  310. // "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_street"
  311. // });
  312. });