data.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. var prefix = "/datas/expertVerify";
  2. var unSelected = "#999";
  3. var selected = "#333";
  4. $(function () {
  5. $("#unitProvince").val('');
  6. //初始化 默认审核中
  7. //$('#status').val('2');
  8. load();
  9. //数据级别
  10. loadLevel();
  11. //所属行业子类
  12. // loadIndustry();
  13. //所属行业
  14. loadIndustryType();
  15. //数据类别
  16. loadType();
  17. //初始化联合审批部门
  18. load_direct_select();
  19. //省份
  20. loadProvince();
  21. //地市
  22. loadCity();
  23. loadAuditStage();
  24. //select 框切换
  25. $("#status").css("color", unSelected);
  26. $("#status").change(function () {
  27. var selItem = $(this).val();
  28. if (selItem == $(this).find('option:first').val()) {
  29. $(this).css("color", unSelected);
  30. } else {
  31. $(this).css("color", selected);
  32. }
  33. });
  34. });
  35. $('.dropdown-toggle').dropdown();
  36. var myColumns = [];
  37. myColumns.push({
  38. checkbox: true
  39. },
  40. {
  41. field: 'no',
  42. title: '序号',
  43. align: "center",
  44. width: 65,
  45. formatter: function (value, row, index) {
  46. //获取每页显示的数量
  47. var pageSize = $('#exampleTable').bootstrapTable('getOptions').pageSize;
  48. //获取当前是第几页
  49. var pageNumber = $('#exampleTable').bootstrapTable('getOptions').pageNumber;
  50. //返回序号,注意index是从0开始的,所以要加上1
  51. return pageSize * (pageNumber - 1) + index + 1;
  52. }
  53. })
  54. $.each(commonData,function (index,value){
  55. myColumns.push(value);
  56. })
  57. myColumns.push(
  58. {
  59. // 1:市级 2:省级
  60. field: 'auditStage',
  61. title: '审核阶段',
  62. titleTooltip: "审核阶段",
  63. formatter: function (item, index) {
  64. if (item == '1') {
  65. return '<span class="label label-primary">市级</span>';
  66. } else if (item == '2') {
  67. return '<span class="label label-success">省级</span>';
  68. }
  69. },
  70. width: 120,
  71. align: "center",
  72. },
  73. {
  74. // 0:正常 1:删除 2:已上报 3:通过审核 4:驳回
  75. field: 'dataStatus',
  76. title: '状态',
  77. titleTooltip: "状态",
  78. formatter: function (item, index) {
  79. if (item == '2') {
  80. return '<span class="label label-primary">审核中</span>';
  81. } else if (item == '3') {
  82. return '<span class="label label-success">通过审核</span>';
  83. } else if (item == '4') {
  84. return '<span class="label label-danger">驳回</span>';
  85. }
  86. },
  87. width: 120,
  88. align: "center",
  89. },
  90. {
  91. title: '操作',
  92. field: 'id',
  93. align: 'center',
  94. width: '200px',
  95. formatter: function (value, row, index) {
  96. var e = '<a class="btn btn-primary btn-sm ' + s_edit_h + '" href="#" mce_href="#" title="详情" onclick="edit(\''
  97. + row.id
  98. + '\')"><i class="fa fa-book"></i></a> ';
  99. var d = '<a class="btn btn-warning btn-sm ' + s_remove_h + '" href="#" title="删除" mce_href="#" onclick="remove(\''
  100. + row.id
  101. + '\')"><i class="fa fa-remove"></i></a> ';
  102. var f = '<a class="btn btn-success btn-sm ' + s_verify_h + '" href="#" title="审核" mce_href="#" onclick="verify(\''
  103. + row.id
  104. + '\')"><i class="fa fa-envelope-o"></i></a> ';
  105. var g = '<a class="btn btn-success btn-sm ' + s_rebut_h + '" href="#" title="驳回" mce_href="#" onclick="rebut(\''
  106. + row.id
  107. + '\')"><i class="fa fa-reply"></i></a> ';
  108. var h = '<a class="btn btn-success btn-sm ' + s_expertOpinion_h + '" href="#" title="专家意见" mce_href="#" onclick="expertOpinion(\''
  109. + row.id
  110. + '\')"><i class="fa fa-edit"></i></a> ';
  111. if (row.dataStatus == '3' || row.dataStatus == '4' || row.dataStatus == '5' || row.dataStatus == '6') {
  112. return e + d;
  113. } else if (row.dataStatus == '2') {
  114. return e + f + g + d + h;
  115. }
  116. }
  117. });
  118. function load() {
  119. $('#exampleTable')
  120. .bootstrapTable(
  121. {
  122. method: 'get', // 服务器数据的请求方式 get or post
  123. url: prefix + "/list", // 服务器数据的加载地址
  124. // showRefresh : true,
  125. // showToggle : true,
  126. // showColumns : true,
  127. iconSize: 'outline',
  128. toolbar: '#exampleToolbar',
  129. striped: true, // 设置为true会有隔行变色效果
  130. dataType: "json", // 服务器返回的数据类型
  131. pagination: true, // 设置为true会在底部显示分页条
  132. // queryParamsType : "limit",
  133. // //设置为limit则会发送符合RESTFull格式的参数
  134. singleSelect: false, // 设置为true将禁止多选
  135. // contentType : "application/x-www-form-urlencoded",
  136. // //发送到服务器的数据编码类型
  137. pageSize: 10, // 如果设置了分页,每页数据条数
  138. pageNumber: 1, // 如果设置了分布,首页页码
  139. //search : true, // 是否显示搜索框
  140. showColumns: true, // 是否显示内容下拉框(选择显示的列)
  141. showRefresh: true,
  142. sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
  143. // exportOptions:{
  144. // ignoreColumn: [0,1], //忽略某一列的索引
  145. // fileName: '备案数据信息', //文件名称设置
  146. // worksheetName: 'sheet1', //表格工作区名称
  147. // tableName: '备案数据表',
  148. // excelstyles: ['background-color', 'color', 'font-size', 'font-weight'],
  149. // onMsoNumberFormat: DoOnMsoNumberFormat
  150. // },
  151. queryParams: function (params) {
  152. return {
  153. //说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
  154. limit: params.limit,
  155. offset: params.offset,
  156. dataName: $('#dataName').val(),
  157. reporterUnit: $('#reporterUnit').val(),
  158. dataIndustry: $('#dataIndustry').val(),
  159. industryTypeOne: $('#industryTypeOne').val(),
  160. dataStatus: $('#status').val(),
  161. dataLevel: $('#dataLevel').val(),
  162. auditStage: $('#auditStage').val(),
  163. unitCity: $('#unitCity').val(), //市区
  164. sendVerify: '2',//送审状态
  165. unitProvince: $('#unitProvince').val(),
  166. };
  167. },
  168. onLoadSuccess: function () {
  169. //鼠标悬停显示全部内容~
  170. $('.bootstrap-table tr td').each(function () {
  171. $(this).attr("title", $(this).text());
  172. $(this).css("cursor", 'pointer');
  173. });
  174. },
  175. columns: myColumns
  176. })
  177. /*table resize*/
  178. .colResizable({
  179. liveDrag: true,
  180. gripInnerHtml: "<div class='grip'></div>",
  181. draggingClass: "dragging",
  182. resizeMode: 'fit'
  183. });
  184. }
  185. function reLoad() {
  186. // $('#exampleTable').bootstrapTable('refresh');
  187. $('#exampleTable').bootstrapTable('destroy');
  188. load();
  189. }
  190. function add() {
  191. layer.open({
  192. type: 2,
  193. title: '数据导入',
  194. maxmin: true,
  195. shadeClose: false, // 点击遮罩关闭层
  196. area: ['800px', '500px'],
  197. content: prefix + '/batchAdd' // iframe的url
  198. });
  199. }
  200. function expertOpinion(id) {
  201. layer.open({
  202. type: 2,
  203. title: '专家意见',
  204. maxmin: true,
  205. shadeClose: false, // 点击遮罩关闭层
  206. area: ['800px', '500px'],
  207. content: prefix + '/expertOpinion/'+ id // iframe的url
  208. });
  209. }
  210. function edit(id) {
  211. layer.open({
  212. type: 2,
  213. title: '详情',
  214. maxmin: true,
  215. shadeClose: false, // 点击遮罩关闭层
  216. area: ['100%', '100%'],
  217. content: prefix + '/edit/' + id // iframe的url
  218. });
  219. }
  220. function remove(id) {
  221. layer.confirm('确定要删除选中的记录?', {
  222. btn: ['确定', '取消']
  223. }, function () {
  224. $.ajax({
  225. url: prefix + "/remove",
  226. type: "post",
  227. data: {
  228. 'id': id
  229. },
  230. success: function (r) {
  231. if (r.code == 0) {
  232. layer.msg(r.msg);
  233. reLoad();
  234. } else {
  235. layer.msg(r.msg);
  236. }
  237. }
  238. });
  239. })
  240. }
  241. //重置查询条件
  242. function reset() {
  243. //重置
  244. $('.form-group').find('input,select').val("");
  245. //重置行业
  246. // $('#dataIndustry').val("--选择行业--");
  247. $("#dataIndustry").val("").trigger("chosen:updated");
  248. $("#industryTypeOne").val("").trigger("chosen:updated");
  249. $("#unitCity").val("").trigger("chosen:updated");
  250. $("#dataLevel").val("").trigger("chosen:updated");
  251. $("#auditStage").val("").trigger("chosen:updated");
  252. //置灰
  253. $("#status").css("color", unSelected);
  254. }
  255. function batchRemove() {
  256. var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组
  257. if (rows.length == 0) {
  258. layer.msg("请选择要删除的数据");
  259. return;
  260. }
  261. layer.confirm("确认要删除选中的'" + rows.length + "'条数据吗?", {
  262. btn: ['确定', '取消']
  263. // 按钮
  264. }, function () {
  265. var ids = new Array();
  266. // 遍历所有选择的行数据,取每条数据对应的ID
  267. $.each(rows, function (i, row) {
  268. ids[i] = row['id'];
  269. });
  270. $.ajax({
  271. type: 'POST',
  272. data: {
  273. "ids": ids
  274. },
  275. url: prefix + '/batchRemove',
  276. success: function (r) {
  277. if (r.code == 0) {
  278. layer.msg(r.msg);
  279. reLoad();
  280. } else {
  281. layer.msg(r.msg);
  282. }
  283. }
  284. });
  285. }, function () {
  286. });
  287. }
  288. //审核通过
  289. function verify(id) {
  290. layer.confirm('确定要审核通过选中的备案申请?', {
  291. btn: ['确定', '取消']
  292. }, function () {
  293. $.ajax({
  294. url: prefix + "/verify",
  295. type: "post",
  296. data: {
  297. 'id': id
  298. },
  299. success: function (r) {
  300. if (r.code == 0) {
  301. layer.msg(r.msg);
  302. reLoad();
  303. } else {
  304. layer.msg(r.msg);
  305. }
  306. }
  307. });
  308. })
  309. }
  310. //驳回
  311. function rebut(id) {
  312. layer.confirm('确定要驳回选中的备案申请?', {
  313. btn: ['确定', '取消']
  314. }, function () {
  315. $.ajax({
  316. url: prefix + "/rebut",
  317. type: "post",
  318. data: {
  319. 'id': id
  320. },
  321. success: function (r) {
  322. if (r.code == 0) {
  323. layer.msg(r.msg);
  324. reLoad();
  325. } else {
  326. layer.msg(r.msg);
  327. }
  328. }
  329. });
  330. })
  331. }
  332. //批量审核通过
  333. function batchVerify() {
  334. var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组
  335. if (rows.length == 0) {
  336. layer.msg("请选择要审核的备案数据");
  337. return;
  338. }
  339. layer.confirm("确认要审核通过选中的'" + rows.length + "'条备案数据吗?", {
  340. btn: ['确定', '取消']
  341. // 按钮
  342. }, function () {
  343. var ids = new Array();
  344. // 遍历所有选择的行数据,取每条数据对应的ID
  345. $.each(rows, function (i, row) {
  346. ids[i] = row['id'];
  347. });
  348. $.ajax({
  349. type: 'POST',
  350. data: {
  351. "ids": ids
  352. },
  353. url: prefix + '/batchVerify',
  354. success: function (r) {
  355. if (r.code == 0) {
  356. layer.msg(r.msg);
  357. reLoad();
  358. } else {
  359. layer.msg(r.msg);
  360. }
  361. }
  362. });
  363. }, function () {
  364. });
  365. }
  366. //批量 驳回
  367. function batchRebut() {
  368. var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组
  369. if (rows.length == 0) {
  370. layer.msg("请选择要驳回的备案数据");
  371. return;
  372. }
  373. layer.confirm("确认要驳回选中的'" + rows.length + "'条备案数据吗?", {
  374. btn: ['确定', '取消']
  375. // 按钮
  376. }, function () {
  377. var ids = new Array();
  378. // 遍历所有选择的行数据,取每条数据对应的ID
  379. $.each(rows, function (i, row) {
  380. ids[i] = row['id'];
  381. });
  382. $.ajax({
  383. type: 'POST',
  384. data: {
  385. "ids": ids
  386. },
  387. url: prefix + '/batchRebut',
  388. success: function (r) {
  389. if (r.code == 0) {
  390. layer.msg(r.msg);
  391. reLoad();
  392. } else {
  393. layer.msg(r.msg);
  394. }
  395. }
  396. });
  397. }, function () {
  398. });
  399. }
  400. //选择导出
  401. function batchExports() {
  402. var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组
  403. if (rows.length == 0) {
  404. layer.msg("请选择要导出的备案数据");
  405. return;
  406. }
  407. layer.confirm("确认要导出选中的'" + rows.length + "'条备案数据吗?", {
  408. btn: ['确定', '取消']
  409. // 按钮
  410. }, function () {
  411. var ids = new Array();
  412. // 遍历所有选择的行数据,取每条数据对应的ID
  413. $.each(rows, function (i, row) {
  414. ids[i] = row['id'];
  415. });
  416. layer.close(layer.index);
  417. location.href = prefix + "/batchExports?idValue=" + JSON.stringify(ids).replace('[', '%5B').replace(']', '%5D');
  418. }, function () {
  419. });
  420. }
  421. function nextVerify(deptId, name) {
  422. console.log("deptId:" + deptId)
  423. var rows = $('#exampleTable').bootstrapTable('getSelections'); // 返回所有选择的行,当没有选择的记录时,返回一个空数组
  424. if (rows.length == 0) {
  425. layer.msg("请选择要联合审批的备案数据");
  426. return;
  427. }
  428. layer.confirm("确认要联合审批的'" + rows.length + "'条备案数据吗?", {
  429. btn: ['确定', '取消']
  430. // 按钮
  431. }, function () {
  432. var ids = new Array();
  433. // 遍历所有选择的行数据,取每条数据对应的ID
  434. $.each(rows, function (i, row) {
  435. ids[i] = row['id'];
  436. });
  437. $.ajax({
  438. type: 'POST',
  439. data: {
  440. "ids": ids
  441. },
  442. url: prefix + '/nextVerify/' + deptId,
  443. success: function (r) {
  444. if (r.code == 0) {
  445. layer.msg(r.msg);
  446. reLoad();
  447. } else {
  448. layer.msg(r.msg);
  449. }
  450. }
  451. });
  452. }, function () {
  453. });
  454. }