list_allapply.html 38 KB

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