list_approving.html 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  6. <title>全部费用申请(审批完成)</title>
  7. <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
  8. <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
  9. <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
  10. </head>
  11. <body>
  12. <div class="layuimini-container">
  13. <div class="layuimini-main">
  14. <fieldset class="table-search-fieldset">
  15. <legend>搜索信息(<b>收起-展开</b>)</legend>
  16. <div id="search-div" style="margin: 5px 10px -10px 0px">
  17. <form class="layui-form" action="" lay-filter="search-form">
  18. <div class="layui-form-item" >
  19. <div class="layui-inline">
  20. <label class="layui-form-label" style="width: 60px">项目名称</label>
  21. <div class="layui-input-inline" style="width: 200px">
  22. <input type="text" id="xmmc" name="xmmc" autocomplete="off" class="layui-input">
  23. </div>
  24. </div>
  25. <div class="layui-inline">
  26. <label class="layui-form-label" style="width: 30px">编号</label>
  27. <div class="layui-input-inline" style="width: 150px">
  28. <input type="text" id="bh" name="bh" autocomplete="off" class="layui-input">
  29. </div>
  30. </div>
  31. <div class="layui-inline">
  32. <label class="layui-form-label" style="width: 60px">ERP编号</label>
  33. <div class="layui-input-inline" style="width: 150px">
  34. <input type="text" id="erpbh" name="erpbh" autocomplete="off" class="layui-input">
  35. </div>
  36. </div>
  37. <div class="layui-inline">
  38. <label class="layui-form-label" style="width: 60px">项目类型</label>
  39. <div class="layui-input-inline" style="width: 225px">
  40. <select name="xmlx" id="xmlx" lay-filter="status">
  41. <option value="">全部</option>
  42. <option th:each="item:${xmlxList}" th:text="${item.name}" th:value="${item.code}"></option>
  43. </select>
  44. </div>
  45. </div>
  46. <!-- <div class="layui-inline">-->
  47. <!-- <label class="layui-form-label" style="width: 70px">是否备用金</label>-->
  48. <!-- <div class="layui-input-inline" style="width: 150px">-->
  49. <!-- <select name="sfbyj" id="sfbyj" lay-filter="status">-->
  50. <!-- <option value="">全部</option>-->
  51. <!-- <option value="1">是</option>-->
  52. <!-- <option value="0">否</option>-->
  53. <!-- </select>-->
  54. <!-- </div>-->
  55. <!-- </div>-->
  56. <!-- <br>-->
  57. <div class="layui-inline">
  58. <label class="layui-form-label" style="width: 90px">电科院负责人</label>
  59. <div class="layui-input-inline" style="width: 200px">
  60. <input type="hidden" id="dkyfzr" name="dkyfzr" class="layui-input">
  61. <input type="text" id="dkyfzrxm" name="dkyfzrxm" placeholder="可多选" class="layui-input" readonly>
  62. </div>
  63. </div>
  64. <br>
  65. <div class="layui-inline">
  66. <label class="layui-form-label" style="width: 60px">审批状态</label>
  67. <div class="layui-input-inline" style="width: 200px">
  68. <select name="spzt" id="spzt" lay-filter="status">
  69. <option value="">全部</option>
  70. <option th:each="item:${approveList}" th:text="${item.name}" th:value="${item.name}"></option>
  71. </select>
  72. </div>
  73. </div>
  74. <div class="layui-inline">
  75. <label class="layui-form-label" style="width: 30px">年份</label>
  76. <div class="layui-input-inline" style="width: 150px">
  77. <select name="nf" id="nf" lay-filter="status">
  78. <option value="">全部</option>
  79. <option th:each="item:${yearList}" th:text="${item.nf}" th:value="${item.nf}"></option>
  80. </select>
  81. </div>
  82. </div>
  83. <div class="layui-inline">
  84. <label class="layui-form-label" style="width: 60px">所属部门</label>
  85. <div class="layui-input-inline" style="width: 150px">
  86. <input type="text" id="ssbmmc" name="ssbmmc" autocomplete="off" class="layui-input">
  87. </div>
  88. </div>
  89. <div class="layui-inline">
  90. <label class="layui-form-label" style="width: 60px">申请时间</label>
  91. <div class="layui-input-inline" style="width: 100px">
  92. <input type="text" name="sqsj1" id="sqsj1" placeholder="开始时间" class="layui-input" readonly>
  93. </div>
  94. <div class="layui-form-mid">-</div>
  95. <div class="layui-input-inline" style="width: 100px">
  96. <input type="text" name="sqsj2" id="sqsj2" placeholder="终止时间" class="layui-input" readonly>
  97. </div>
  98. </div>
  99. <div class="layui-inline" style="margin-left: 0px">
  100. <button type="submit" class="layui-btn" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
  101. <button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-reset-btn"><i class="layui-icon layui-icon-refresh"></i> 重 置 </button>
  102. </div>
  103. </div>
  104. </form>
  105. </div>
  106. </fieldset>
  107. <script type="text/html" id="toolbarDemo">
  108. <div class="layui-btn-container">
  109. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="edit">
  110. <i class="layui-icon layui-icon-edit" style="font-size: 10px;"></i>编辑
  111. </button>
  112. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="view">
  113. <i class="layui-icon layui-icon-file" style="font-size: 10px;"></i>查看
  114. </button>
  115. <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delete">
  116. <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>删除
  117. </button>
  118. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="spOption">
  119. <i class="layui-icon layui-icon-edit" style="font-size: 10px;"></i>审核
  120. </button>
  121. <button class="layui-btn layui-btn-sm data-add-btn" lay-event="tjrevokeApprove">
  122. <i class="layui-icon layui-icon-edit" style="font-size: 10px;"></i>撤销审批
  123. </button>
  124. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="spList">
  125. <i class="layui-icon layui-icon-list" style="font-size: 10px;"></i>审批列表
  126. </button>
  127. <!-- <button class="layui-btn layui-btn-sm" lay-event="exportExcel">-->
  128. <!-- <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>导出-->
  129. <!-- </button>-->
  130. </div>
  131. </script>
  132. <!-- <input type="hidden" id="userId" name="userId" class="layui-input" th:value="${userId}">-->
  133. <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
  134. </div>
  135. </div>
  136. <script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
  137. <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
  138. <script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
  139. <script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
  140. <script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
  141. <script th:inline="javascript" type="text/javascript">
  142. AjaxUtil.ctx = /*[[@{/}]]*/'';
  143. var updateflag = 0;
  144. var fyApproval = {};
  145. layui.use(['form', 'table', 'tableSelect', 'laydate'], function () {
  146. var form = layui.form,
  147. tableSelect = layui.tableSelect,
  148. laydate = layui.laydate,
  149. table = layui.table;
  150. var userId = $("#userId").val();
  151. var sqsj1 = '',
  152. sqsj2 = '';
  153. //申请时间
  154. laydate.render({
  155. elem: '#sqsj1',
  156. done: function (value, date, endDate) {
  157. sqsj1 = $("#sqsj1").val();
  158. sqsj2 = $("#sqsj2").val();
  159. if (sqsj1 != "" && sqsj2 != "") {
  160. if (sqsj1 > sqsj2) {
  161. Message.warning("起始时间不能晚于终止时间!", 1500);
  162. $("#sqsj1").val("");
  163. }
  164. }
  165. }
  166. });
  167. laydate.render({
  168. elem: '#sqsj2',
  169. done: function (value, date, endDate) {
  170. sqsj1 = $("#sqsj1").val();
  171. sqsj2 = $("#sqsj2").val();
  172. if (sqsj1 != "" && sqsj2 != "") {
  173. if (sqsj1 > sqsj2) {
  174. Message.warning("终止时间不能早于开始时间!", 1500);
  175. $("#sqsj2").val("");
  176. }
  177. }
  178. }
  179. });
  180. //电科院负责人
  181. tableSelect.render({
  182. elem: '#dkyfzrxm',
  183. checkedKey: 'id',
  184. searchKey: 'xm',
  185. searchPlaceholder: '搜索姓名',
  186. table: {
  187. url: AjaxUtil.ctx + 'basePerson/rylist',
  188. cols: [
  189. [
  190. {type: "checkbox", fixed: 'left'},
  191. {type: 'numbers', align: 'center'},
  192. {field: 'xm', width: '15%', title: '姓名', align: 'left'},
  193. {field: 'dwmc', title: '公司/单位', align: 'left'}
  194. ]
  195. ]
  196. },
  197. done: function (elem, data) {
  198. var NEWJSON = [];
  199. var NEWJSON1 = [];
  200. layui.each(data.data, function (index, item) {
  201. NEWJSON.push(item.xm);
  202. NEWJSON1.push(item.id);
  203. })
  204. elem.val(NEWJSON.join(","));
  205. $("#dkyfzr").val(NEWJSON1.join(","));
  206. }
  207. });
  208. var currTable = table.render({
  209. elem: '#currentTableId',
  210. url: AjaxUtil.ctx + 'staBudgetapproval/list_approving',
  211. method: 'post',
  212. toolbar: '#toolbarDemo',
  213. // defaultToolbar: ['filter', 'print'],
  214. cols: [
  215. [
  216. {type: "checkbox", fixed: 'left'},
  217. {type: 'numbers', align: 'center', fixed: 'left'},
  218. {field: 'spzt', width: '9%', title: '审批状态', sort: true},
  219. {field: 'bh', width: '8%', title: '编号'},
  220. {field: 'xmmc', width: '20%', title: '项目名称'},
  221. // {field: 'sqmc', width: '25%', title: '申请名称'},
  222. {field: 'erpbh', width: '9%', title: 'ERP编号'},
  223. {field: 'xmlxmc', width: '10%', title: '项目类型'},
  224. {field: 'fylbmc', width: '7%', title: '费用类别'},
  225. {field: 'sqje', width: '7%', title: '申请金额(元)'},
  226. // {
  227. // field: 'sfbyj', width: '8%', title: '是否备用金', align: 'center', templet: function (d) {
  228. // if (1 == d.sfbyj) {
  229. // return '<span class="layui-badge layui-bg-blue">是</span>';
  230. // } else {
  231. // return '<span class="layui-badge layui-bg-orange">否</span>';
  232. // }
  233. // }
  234. // },
  235. {field: 'sqrxm', width: '5%', title: '申请人'},
  236. {field: 'dkyfzrxm', width: '8%', title: '电科院负责人'},
  237. {field: 'ssbmmc', width: '8%', title: '所属部门'},
  238. {field: 'nf', width: '5%', title: '年份'},
  239. {field: 'sqsj', width: '8%', title: '申请时间', align: 'center'}
  240. ]
  241. ],
  242. autoSort: false,
  243. limits: [10, 15, 20, 25, 50, 100],
  244. limit: 10,
  245. page: true,
  246. skin: 'grid',
  247. parseData: function (res) { //res 即为原始返回的数据
  248. return {
  249. "code": res.code, //解析接口状态
  250. "msg": res.message, //解析提示文本
  251. "count": res.data.total, //解析数据长度
  252. "data": res.data.rows //解析数据列表
  253. };
  254. },
  255. done: function (res, curr, count) { // done为数据渲染完的回调
  256. // 测试打印出后端返回的权限列表
  257. // let permissionSet = [[${permissionSet}]];
  258. // console.log(JSON.stringify(permissionSet));
  259. }
  260. });
  261. // 监听搜索操作
  262. form.on('submit(data-search-btn)', function (data) {
  263. // 执行搜索重载
  264. currTable.reload({
  265. page: {
  266. curr: 1 // 页码从1开始
  267. },
  268. where: form.val("search-form")
  269. });
  270. return false;
  271. });
  272. // 监听重置操作
  273. form.on('submit(data-reset-btn)', function (data) {
  274. form.val("search-form", {
  275. "bh": '',
  276. "erpbh": '',
  277. "xmlx": '',
  278. "sfbyj": '',
  279. "xmmc": '',
  280. "ssbmmc": '',
  281. "nf": '',
  282. "spzt": '',
  283. "sfbz": '',
  284. "dkyfzr": ''
  285. });
  286. // 执行搜索重载
  287. currTable.reload({
  288. page: {
  289. curr: 1
  290. },
  291. where: form.val("search-form")
  292. });
  293. return false;
  294. });
  295. // 监听工具栏事件
  296. table.on('toolbar(currentTableFilter)', function (obj) {
  297. if (obj.event === 'add') { // 监听添加操作
  298. layer.open({
  299. title: '新建费用申请',
  300. type: 2,
  301. shade: 0.3,
  302. maxmin: true,
  303. area: ['1020px', layerheight + 'px'],
  304. content: AjaxUtil.ctx + 'staBudgetapproval/forApplyAdd',
  305. end: function (index) {
  306. // 重载表格
  307. if(updateflag == 1)
  308. currTable.reload();
  309. updateflag =0;
  310. }
  311. });
  312. }
  313. else if (obj.event == 'edit') {
  314. var dataApproval = table.cache["currentTableId"];
  315. if(dataApproval.length == 0)
  316. return;
  317. var checkStatus = table.checkStatus('currentTableId')
  318. , data = checkStatus.data;
  319. if (data == null || data.length === 0) {
  320. Message.warning("请选择要编辑的费用申请!", 1500);
  321. } else if (data.length > 1) {
  322. Message.warning("请选择一条记录进行编辑!", 1500);
  323. } else if (data[0].spzt == "作废") {
  324. Message.warning("该费用申请已作废!", 1500);
  325. } else if (data[0].spzt == "审批结束") {
  326. Message.warning("该费用申请已审批结束,不能修改!", 1500);
  327. } else if (data[0].spzt != null && data[0].spzt.indexOf("未提交") < 0) {
  328. Message.warning("该费用申请审批中,不能修改!", 1500);
  329. } else {
  330. layer.open({
  331. title: '编辑费用申请',
  332. type: 2,
  333. shade: 0.3,
  334. maxmin: true,
  335. shadeClose: true,
  336. area: ['1020px', layerheight + 'px'],
  337. content: AjaxUtil.ctx + 'staBudgetapproval/forApplyUpdate/' + data[0].id,
  338. end: function (index) {
  339. if(updateflag == 1)
  340. currTable.reload();
  341. updateflag =0;
  342. }
  343. });
  344. // layer.full(index);
  345. }
  346. }
  347. else if (obj.event == 'view') {
  348. var dataApproval = table.cache["currentTableId"];
  349. if(dataApproval.length == 0)
  350. return;
  351. var checkStatus = table.checkStatus('currentTableId')
  352. , data = checkStatus.data;
  353. if (data == null || data.length === 0) {
  354. Message.warning("请选择要查看的费用申请!", 1500);
  355. } else if (data.length > 1) {
  356. Message.warning("请选择一条记录进行查看!", 1500);
  357. } else {
  358. layer.open({
  359. title: '浏览费用申请',
  360. type: 2,
  361. shade: 0.3,
  362. maxmin: true,
  363. shadeClose: true,
  364. area: ['1020px', layerheight + 'px'],
  365. content: AjaxUtil.ctx + 'staBudgetapproval/forApplyView/' + data[0].id,
  366. end: function (index) {
  367. layer.close(index);
  368. }
  369. });
  370. // layer.full(index);
  371. }
  372. }
  373. else if (obj.event === 'delete') { // 监听删除操作
  374. var dataApproval = table.cache["currentTableId"];
  375. if(dataApproval.length == 0)
  376. return;
  377. var checkStatus = table.checkStatus('currentTableId')
  378. ,data = checkStatus.data;
  379. if (data == null || data.length === 0) {
  380. Message.warning("请选择要删除的费用申请!", 1500);
  381. return;
  382. } else {
  383. for(let item of data) {
  384. if(item.spzt != "未提交") {
  385. if(item.spzt == "审批结束")
  386. Message.warning("存在已审批结束的费用申请,不能直接删除!", 2000);
  387. else if (data[0].spzt != null)
  388. Message.warning("存在审批中的费用申请,不能直接删除!", 2000);
  389. return;
  390. }
  391. }
  392. }
  393. layer.confirm('确定批量删除费用申请吗?', function (index) {
  394. layer.close(index);
  395. AjaxUtil.post({
  396. url: AjaxUtil.ctx + "staBudgetapproval/batchDelete",
  397. contentType: "application/json",
  398. data: JSON.stringify(data),
  399. success: function (res) {
  400. if (res.code === 0) {
  401. Message.success(1500, res.message, function () {
  402. // 重载表格
  403. currTable.reload();
  404. });
  405. } else {
  406. Message.error(res.message, 1000);
  407. }
  408. },
  409. error: function (error) {
  410. }
  411. });
  412. });
  413. }
  414. else if (obj.event === 'tjApprove') {
  415. var projects = table.cache["currentTableId"];
  416. if (projects.length == 0)
  417. return;
  418. var checkStatus = table.checkStatus('currentTableId')
  419. , data = checkStatus.data;
  420. if (data == null || data.length === 0) {
  421. Message.warning("请选择要提交审批的费用申请!", 2000);
  422. } else if (data.length > 1) {
  423. Message.warning("请选择一条记录进行提交!", 1500);
  424. } else if (data[0].spzt == "审批结束") {
  425. Message.warning("该费用申请已审批结束!", 1500);
  426. } else if (data[0].spzt == "作废") {
  427. Message.warning("该费用申请已作废!", 1500);
  428. } else if (data[0].spzt != null && data[0].spzt.indexOf("未提交") < 0) {
  429. Message.warning("该费用申请正在审批中……", 1500);
  430. } else {
  431. xmApproval = {
  432. "xmid": data[0].id,
  433. "xm": data[0].sqmc,
  434. "zt": data[0].spzt,
  435. "sqje": data[0].sqje
  436. };
  437. if(data[0].spzt == null) {
  438. xmApproval.zt = "未提交";
  439. data[0].spzt = "未提交";
  440. }
  441. var content = AjaxUtil.ctx + 'staBudgetapproval/forApproveAdd';
  442. if (data[0].spzt != "未提交")
  443. content = AjaxUtil.ctx + 'staBudgetapproval/forApproveUpdate/' + data[0].id + '/' + data[0].sqje + '?spzt=' + data[0].spzt;
  444. var index = layer.open({
  445. title: '提交审批',
  446. type: 2,
  447. shade: 0.3,
  448. maxmin: true,
  449. shadeClose: true,
  450. area: ['1025px', layerheight + 'px'],
  451. content: content,
  452. end: function () {
  453. if (updateflag == 1)
  454. currTable.reload();
  455. updateflag = 0;
  456. layer.close(index);
  457. }
  458. });
  459. }
  460. }
  461. else if (obj.event === 'spOption') {
  462. var projects = table.cache["currentTableId"];
  463. if (projects.length == 0)
  464. return;
  465. var checkStatus = table.checkStatus('currentTableId')
  466. , data = checkStatus.data;
  467. if (data == null || data.length === 0) {
  468. Message.warning("请选择要审批的费用申请!", 2000);
  469. } else if (data.length > 1) {
  470. Message.warning("请选择一条记录进行审批!", 1500);
  471. } else if (data[0].spzt == null || data[0].spzt.indexOf("未提交") >= 0) {
  472. Message.warning("该费用申请尚未提交审批!", 1500);
  473. } else if (data[0].spzt == "审批结束") {
  474. Message.warning("该费用申请已审批结束!", 2000);
  475. } else if (data[0].spzt == "作废") {
  476. Message.warning("该费用申请已作废!", 1500);
  477. } else {
  478. xmApproval = {
  479. "xmid": data[0].id,
  480. "xm": data[0].sqmc,
  481. "zt": data[0].spzt,
  482. "sqje": data[0].sqje
  483. };
  484. var content = AjaxUtil.ctx + 'staBudgetapproval/forApproveAdd';
  485. if (data[0].spzt != "未提交")
  486. content = AjaxUtil.ctx + 'staBudgetapproval/forApproveUpdate/' + data[0].id + '/' + data[0].sqje + '?spzt=' + data[0].spzt;
  487. layer.open({
  488. title: '审批意见',
  489. type: 2,
  490. shade: 0.3,
  491. maxmin: true,
  492. shadeClose: true,
  493. area: ['1025px', layerheight + 'px'],
  494. content: content,
  495. end: function (index) {
  496. if (updateflag == 1)
  497. currTable.reload();
  498. updateflag = 0;
  499. }
  500. });
  501. }
  502. }
  503. else if (obj.event === 'spList') {
  504. var projects = table.cache["currentTableId"];
  505. if (projects.length == 0)
  506. return;
  507. var checkStatus = table.checkStatus('currentTableId')
  508. , data = checkStatus.data;
  509. if (data == null || data.length === 0) {
  510. Message.warning("请选择要查看审批列表的费用申请!", 1500);
  511. } else if (data.length > 1) {
  512. Message.warning("请选择一条记录进行查看!", 1500);
  513. } else if (data[0].spzt == null || data[0].spzt == "未提交") {
  514. Message.warning("该备费用申请尚未提交审批!", 1500);
  515. } else {
  516. xmApproval = {
  517. "xmid": data[0].id,
  518. "xm": data[0].sqmc,
  519. "zt": data[0].spzt,
  520. "sqje": data[0].sqje
  521. };
  522. var index = layer.open({
  523. title: '审批列表',
  524. type: 2,
  525. shade: 0.3,
  526. maxmin: true,
  527. shadeClose: true,
  528. area: ['1300px', layerheight + 'px'],
  529. content: AjaxUtil.ctx + 'staBudgetapproval/forApproveList',
  530. end: function () {
  531. layer.close(index);
  532. }
  533. });
  534. }
  535. }
  536. else if (obj.event === 'reimburse') {
  537. var projects = table.cache["currentTableId"];
  538. if (projects.length == 0)
  539. return;
  540. var checkStatus = table.checkStatus('currentTableId')
  541. , data = checkStatus.data;
  542. if (data == null || data.length === 0) {
  543. Message.warning("请选择要报账的费用申请!", 1500);
  544. } else if (data.length > 1) {
  545. Message.warning("请选择一条记录进行报账!", 1500);
  546. } else if (data[0].spzt == "作废") {
  547. Message.warning("该费用申请已作废!", 1500);
  548. } else if (data[0].spzt.indexOf("未提交") >= 0) {
  549. Message.warning("该费用申请尚未提交审批!", 1500);
  550. } else if (data[0].spzt != "审批结束") {
  551. Message.warning("该费用申请正在审批中……", 1500);
  552. } else if (data[0].sfbz == 1) {
  553. Message.warning("该费用申请已报账", 1500);
  554. } else {
  555. var index = layer.open({
  556. title: '新建报账',
  557. type: 2,
  558. shade: 0.3,
  559. maxmin: true,
  560. shadeClose: true,
  561. area: ['970px', '750px'],
  562. content: AjaxUtil.ctx + "staReimbursement/forAdd/" +data[0].id,
  563. end: function () {
  564. if (updateflag == 1)
  565. currTable.reload();
  566. updateflag = 0;
  567. layer.close(index);
  568. }
  569. });
  570. }
  571. } else if (obj.event === 'nullify') { // 监听作废操作
  572. var projects = table.cache["currentTableId"];
  573. if (projects.length == 0)
  574. return;
  575. var checkStatus = table.checkStatus('currentTableId')
  576. , data = checkStatus.data;
  577. if (data == null || data.length === 0)
  578. Message.warning("请选择要作废的费用申请!", 1000);
  579. else {
  580. layer.confirm('确定批量作废费用申请吗?', function (index) {
  581. layer.close(index);
  582. AjaxUtil.post({
  583. url: AjaxUtil.ctx + "staBudgetapproval/batchNullify",
  584. contentType: "application/json",
  585. data: JSON.stringify(data),
  586. success: function (res) {
  587. if (res.code === 0) {
  588. Message.success(1500, res.message, function () {
  589. // 重载表格
  590. currTable.reload();
  591. });
  592. } else {
  593. Message.error(res.message, 1000);
  594. }
  595. },
  596. error: function (error) {
  597. }
  598. });
  599. });
  600. }
  601. }
  602. else if(obj.event==='tjrevokeApprove'){
  603. var projects = table.cache["currentTableId"];
  604. if (projects.length == 0)
  605. return;
  606. var checkStatus = table.checkStatus('currentTableId')
  607. , data = checkStatus.data;
  608. if (data == null || data.length === 0) {
  609. Message.warning("请选择要撤销的任务书!", 1500);
  610. } else if (data.length > 1) {
  611. Message.warning("请选择一条记录进行撤销!", 1500);
  612. } else if (data[0].spzt == "审批结束") {
  613. Message.warning("该任务书已审批结束!", 1500);
  614. } else if (data[0].cjr != userId) {
  615. Message.error("您不是该任务书的创建人!", 1500);
  616. } else {
  617. xmApproval = {
  618. "xmid": data[0].id,
  619. "xm": data[0].zwmc,
  620. "zt": "未提交"
  621. };
  622. if(data[0].spzt == null) {
  623. xmApproval.zt = "未提交";
  624. data[0].spzt = "未提交";
  625. }
  626. var project = {
  627. "id": xmApproval.xmid,
  628. "spzt": '未提交'
  629. }
  630. layer.confirm('确定撤销项目任务书吗?', function (index) {
  631. layer.close(index);
  632. AjaxUtil.post({
  633. url: AjaxUtil.ctx + "prjProject/TJrevokeApprove",
  634. contentType: "application/json",
  635. data: JSON.stringify(project),
  636. success: function (res) {
  637. if (res.code === 0) {
  638. Message.success(1500, res.message, function () {
  639. // 重载表格
  640. currTable.reload();
  641. });
  642. } else {
  643. Message.error(res.message, 1000);
  644. }
  645. },
  646. error: function (error) {
  647. }
  648. });
  649. });
  650. }
  651. }
  652. });
  653. //双击
  654. table.on('rowDouble(currentTableFilter)', function (obj) {
  655. var data = obj.data;
  656. layer.open({
  657. title: '浏览费用申请',
  658. type: 2,
  659. shade: 0.3,
  660. maxmin: true,
  661. shadeClose: true,
  662. area: ['1020px', layerheight + 'px'],
  663. content: AjaxUtil.ctx + 'staBudgetapproval/forApplyView/' + data.id,
  664. end: function (index) {
  665. layer.close(index);
  666. }
  667. });
  668. });
  669. });
  670. function setUpdateFlag() {
  671. updateflag = 1;
  672. }
  673. function getXmApproval() {
  674. return xmApproval;
  675. }
  676. </script>
  677. </body>
  678. </html>