e2d28d06d81258c73e80f731475731c0.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <?php /*a:2:{s:76:"D:\phpstudy_pro\WWW\caiping\app\admin\view\project\appropriation\c_edit.html";i:1723541257;s:59:"D:\phpstudy_pro\WWW\caiping\app\admin\view\common\base.html";i:1723541257;}*/ ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="360-site-verification" content="a7c876fae8b6e3175a52ea9f19543f51" />
  9. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
  10. <script src="/static/dist/xm-select.js"></script>
  11. <link rel="mobile-prefetch" href=""/>
  12. <title><?php echo get_system_config('web','admin_title'); ?></title>
  13. <meta name="keywords" content="<?php echo get_system_config('web','keywords'); ?>"/>
  14. <meta name="description" content="<?php echo get_system_config('web','desc'); ?>"/>
  15. <link rel="stylesheet" href="/static/assets/gougu/css/gougu.css?v=<?php echo get_system_config('web','version'); ?>" media="all">
  16. <style>
  17. .fujian {
  18. display: flex;
  19. }
  20. .fujianimg img {
  21. height: 9vh !important;
  22. }
  23. .forleft {
  24. text-align: left !important;
  25. }
  26. .form-title {
  27. background-color: rgb(241, 241, 241);
  28. color: rgb(95, 95, 95);
  29. border-color: rgb(241, 241, 241);
  30. text-align: center;
  31. border-color: #e2e2e2;
  32. }
  33. .filelist{
  34. width: 100%;
  35. overflow: auto;
  36. justify-content:flex-start;
  37. align-content: space-between;
  38. flex-direction: column-reverse;
  39. flex-wrap: wrap;
  40. display: flex;
  41. }
  42. .filelist li{
  43. padding: 0.5vw 0.8vw 0.5vw 0.8vw;
  44. white-space: nowrap;
  45. overflow: hidden;
  46. text-overflow: ellipsis;
  47. display: inline-block;
  48. border-right: 1px solid #e2e2e2;
  49. float: left;
  50. }
  51. .filelist p{
  52. margin: 3px 0 5px 0;
  53. width: 7vw;
  54. overflow: hidden;
  55. text-overflow: ellipsis;
  56. text-align: center;
  57. }
  58. .footer{
  59. display: none;
  60. }
  61. #filesBox2 li{
  62. padding: 0.5vw 0.8vw 0.5vw 0.8vw;
  63. white-space: nowrap;
  64. overflow: hidden;
  65. text-overflow: ellipsis;
  66. display: inline-block;
  67. border-right: 1px solid #e2e2e2;
  68. float: left;
  69. }
  70. .layui-table th{
  71. text-align: center !important;
  72. font-weight: 500;
  73. }
  74. .layui-anim dd{
  75. text-align: left;
  76. }
  77. .layui-th-gray{
  78. background-color: rgb(241, 241, 241);
  79. }
  80. .layui-table th{
  81. border-color: #e2e2e2
  82. }
  83. .layui-btn-group span:last-child{
  84. display: none;
  85. }
  86. </style>
  87. </head>
  88. <body class="main-body">
  89. <!-- 主体 -->
  90. <div class="p-3">
  91. <table class="layui-hide" id="appropriation_add" lay-filter="appropriation_add"></table>
  92. <form class="layui-form p-4">
  93. <table class="layui-table layui-table-form">
  94. <tr>
  95. <th class="layui-th-gray" style="height:36px;">委托单位</th>
  96. <th colspan="5">
  97. <?php echo htmlentities($detail['entrust_unit_name']); ?>
  98. </th>
  99. <th class="layui-th-gray">是否开票</th>
  100. <th colspan="2">
  101. <?php if($detail['invoicing_whether']!=0): ?>是{/elseif $detail.invoicing_whether==0}}否{/else}未拨款<?php endif; ?>
  102. </th>
  103. </tr>
  104. <tr>
  105. <th class="layui-th-gray">发票编号</th>
  106. <th colspan="2">
  107. <input type="text" name="invoicing_num" readonly autocomplete="off" placeholder="请输入发票编号" class="layui-input" value="<?php echo htmlentities($detail['invoicing_num']); ?>">
  108. </th>
  109. <th class="layui-th-gray">发票类型</th>
  110. <th colspan="2">
  111. <select name="invoice_type" lay-verify="required" disabled="disabled">
  112. <option value="0"></option>
  113. <option value="1" <?php if($detail['invoice_type']==1): ?>selected<?php endif; ?>>普通发票</option>
  114. <option value="2" <?php if($detail['invoice_type']==2): ?>selected<?php endif; ?>>专用发票</option>
  115. <option value="3" <?php if($detail['invoice_type']==3): ?>selected<?php endif; ?>>电子普票</option>
  116. <option value="4" <?php if($detail['invoice_type']==4): ?>selected<?php endif; ?>>电子专票</option>
  117. </select>
  118. </th>
  119. <th class="layui-th-gray">发票金额</th>
  120. <th colspan="2">
  121. <input type="text" name="invoicing_amount" readonly autocomplete="off" placeholder="请输入发票金额" class="layui-input" value="<?php echo htmlentities($detail['invoicing_amount']); ?>">
  122. </th>
  123. </tr>
  124. <tr>
  125. <th colspan="9" class="forleft" style="text-align:left !important;">相关附件
  126. </th>
  127. </tr>
  128. <tr>
  129. <th colspan="9" class="fujianimg" style="padding: 9px 0;">
  130. <div id="filesBox2">
  131. <div class="filelist" id="filesBigBox">
  132. <ul id="filesBox" style="height: 16.2vh;">
  133. <?php echo fileCard($file_array); ?>
  134. </ul>
  135. </div>
  136. <?php if(empty($file_array) || (($file_array instanceof \think\Collection || $file_array instanceof \think\Paginator ) && $file_array->isEmpty())): ?>
  137. <div class="layui-data-none" >暂无附件</div>
  138. <?php endif; ?>
  139. </div>
  140. </th>
  141. </tr>
  142. </table>
  143. <div class="pt-3">
  144. <input type="hidden" name="id" value="<?php echo htmlentities($id); ?>">
  145. <button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="webform">通过</button>
  146. <button type="button" class="layui-btn layui-btn-danger" lay-submit lay-filter="save">拒绝</button>
  147. </div>
  148. </form>
  149. </div>
  150. <!-- /主体 -->
  151. <!-- 底部 -->
  152. <div class="footer">
  153. 逸管工程项目管理系统 © www.yiguanfep.com
  154. <img src="/static/home/images/police.png" alt="" style="width:14.5px;height:16px;">
  155. <a href="https://beian.mps.gov.cn/#/query/websearch?code=45030202000160 " rel="\&quot;noreferrer'target=\”blank\&quot;" onclick="window.open(this.href); return false;">桂公网安备45030202000160号</a>
  156. <a href="https://beian.miit.gov.cn/#/Integrated/index" onclick="window.open(this.href); return false;">桂ICP备17000971号</a>
  157. </div>
  158. <!-- /底部 -->
  159. <!-- 脚本 -->
  160. <script>
  161. var moduleInit = ['tool', 'oaTool'];
  162. function gouguInit() {
  163. var form = layui.form, tool = layui.tool, oaTool = layui.oaTool, table = layui.table, layer = layui.layer;
  164. var file_ids = [];
  165. var project_ids = [];
  166. layui.pageTable = table.render({
  167. elem: '#appropriation_add',
  168. id: "appropriation_add",
  169. title: '造价项目列表',
  170. url: '/admin/project.appropriation/c_edit?id=' + '<?php echo htmlentities($id); ?>',
  171. totalRow: true,
  172. cellMinWidth: 150,
  173. cols: [
  174. [{
  175. fixed: 'left',
  176. field: 'id',
  177. title: '编号',
  178. align: 'center',
  179. width: 80,
  180. totalRowText: "合计"
  181. }, {
  182. field: 'project_name',
  183. title: '项目名称',
  184. align: 'center',
  185. }, {
  186. field: 'sent_review_cost',
  187. title: '送审服务费',
  188. align: 'center',
  189. totalRow: true,
  190. }, {
  191. field: 'appropriation_amount',
  192. title: '请款金额',
  193. align: 'center',
  194. totalRow: true,
  195. }, {
  196. field: 'refund_amount',
  197. title: '回款金额',
  198. align: 'center',
  199. totalRow: true,
  200. // edit: true
  201. }
  202. ]
  203. ],
  204. css: [
  205. // 对开启了编辑的单元格追加样式
  206. '.layui-table-view th[data-edit]{color: #16B777;}'
  207. ].join(''),
  208. });
  209. table.on('edit(appropriation_add)', function (obj) {
  210. var field = obj.field; // 得到修改的字段
  211. var value = obj.value // 得到修改后的值
  212. var data = obj.data // 得到所在行所有键值
  213. var id = data.id;
  214. // 值的校验
  215. if (value.replace(/\s/g, '') === '') {
  216. layer.tips('值不能为空', this, {tips: 1});
  217. return obj.reedit(); // 重新编辑 -- v2.8.0 新增
  218. }
  219. let callback = function (e) {
  220. let sent_review_amount = 0;
  221. let appropriation_amount = 0;
  222. let refund_amount = 0;
  223. layui.each(layui.table.cache['appropriation_add'], function (index, row) {
  224. sent_review_amount += row.sent_review_amount;
  225. appropriation_amount += row.appropriation_amount;
  226. refund_amount += row.refund_amount
  227. });
  228. // $(".layui-table-total th[data-field=sent_review_amount]").html(sent_review_amount);
  229. // $(".layui-table-total th[data-field=appropriation_amount]").html(appropriation_amount);
  230. // $(".layui-table-total th[data-field=refund_amount]").html(`<div className="layui-table-cell laytable-cell-1-0-4" align="center">${refund_amount}</div>`);
  231. layui.pageTable.reload();
  232. layer.msg(e.msg)
  233. }
  234. tool.post("edit", {refund_amount:data.refund_amount}, callback)
  235. });
  236. let a = 1;
  237. form.on('submit(webform)', function (data) {
  238. let refund_amount = 0;
  239. layui.each(layui.table.cache['appropriation_add'], function (index, row) {
  240. refund_amount += Number(row.refund_amount)
  241. });
  242. data.field.refund_amount = refund_amount;
  243. delete data.field.file;
  244. console.log(data);
  245. if(a){
  246. let callback = function (e) {
  247. layer.msg(e.msg)
  248. parent.location.reload();
  249. if (e.code == 0) {
  250. tool.sideClose(1000);
  251. a = 1
  252. }
  253. }
  254. layer.confirm("确认是否审批通过?", function (index) {
  255. tool.post("/admin/project.appropriation/cc_edit", data.field, callback)
  256. a = 0
  257. })
  258. }
  259. return false;
  260. });
  261. form.on('submit(save)', function (data) {
  262. if(a){
  263. let callback = function (e) {
  264. layer.msg(e.msg)
  265. parent.location.reload();
  266. if (e.code == 0) {
  267. tool.sideClose(1000);
  268. a = 1
  269. }
  270. }
  271. layer.prompt({
  272. title: '请输入<span style="color: red">拒绝</span>原因',
  273. formType: 2,
  274. area: ['35vw', '15vw']
  275. }, function (text, index) {
  276. if (text == '') {
  277. layer.msg('请先完善拒绝原因');
  278. return false;
  279. } else {
  280. data.field.reason = text;
  281. tool.post("/admin/project.appropriation/disagree", data.field, callback)
  282. a = 0
  283. }
  284. })
  285. }
  286. return false;
  287. });
  288. function fileCard(item) {
  289. var host = window.location.host;
  290. var li = '';
  291. if (item.length > 0) {
  292. for (var a = 0; a < item.length; a++) {
  293. let image = ['jpg', 'jpeg', 'png', 'gif'];
  294. let doc = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf', 'zip', 'rar', '7z'];
  295. // let down = '<a href="'+item[a].filepath+'" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" download="'+item[a].name+'">下载</a>';
  296. let down = '<a href="'+ item[a]['filepath'] + '" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" download="' + item[a]['name'] + '">预览</a>';
  297. // 判断元素是否在数组中
  298. let path = '/static/home/images/icon/file.png';
  299. if (image.includes(item[a].fileext)) {
  300. path = item[a].filepath;
  301. down = '<span data-href="' + item[a].filepath + '" class="layui-btn layui-btn-xs layui-btn-normal file-view-img">预览</span>';
  302. } else if (doc.includes(item[a].fileext)) {
  303. path = '/static/home/images/icon/' + item[a].fileext + '.png';
  304. }
  305. if (item[a].fileext == 'pdf') {
  306. down = '<span data-href="' + item[a].filepath + '" class="layui-btn layui-btn-xs layui-btn-normal file-view-pdf">预览</span>';
  307. }
  308. li += '<li id="' + item[a].id + '" data-id="' + item[a].id + '" data-title="' + item[a].name + '" data-ext="' + item[a].fileext + '"><img src="' + path + '" alt="' + item[a].filename +
  309. '" style="object-fit: contain;" class="file-item"><p title="' + item[a].name + '">' + item[a].name +
  310. '</p><div class="layui-btn-group">' + down +
  311. '<span class="layui-btn layui-btn-xs layui-btn-danger file-del">删除</span></div></li>';
  312. }
  313. return li;
  314. }
  315. }
  316. $('#filesBox').on('click', '.file-del', function () {
  317. let id = $(this).parent().parent().data('id');
  318. layer.confirm('确定要删除该文件吗?', {icon: 3, title: '提示'}, function () {
  319. let callback = function (e){
  320. layer.closeAll();
  321. if (e.hasOwnProperty("msg")) {
  322. layer.msg(e.msg);
  323. }
  324. if(e.code==0){
  325. var index = file_ids.indexOf(id);
  326. if (index > -1) {
  327. file_ids.splice(index, 1);
  328. }
  329. if (file_ids.length == 0) {
  330. $("#filesBox").append('<div id="nofile" class="layui-data-none" >暂无附件</div>');
  331. }
  332. $("#" + id).remove();
  333. }
  334. }
  335. tool.delete("/admin/project.api/delete_file", {id: id}, callback)
  336. });
  337. })
  338. oaTool.addFile({
  339. type: 1,
  340. isSave: true,
  341. ajaxSave: function (res) {
  342. if(file_ids.length<1){
  343. console.log(file_ids.length)
  344. let callback = function (e) {
  345. if (e.hasOwnProperty("msg")) {
  346. layer.msg(e.msg);
  347. } else {
  348. layer.msg('上传成功!')
  349. }
  350. if (e[0].id) {
  351. file_ids.push(e[0].id)
  352. $('#nofile').remove();
  353. $("#filesBox").append(fileCard(e));
  354. }
  355. }
  356. tool.post("/admin/project.api/add_file", {
  357. 'file_id': res.data.id,
  358. }, callback);
  359. }else {
  360. layer.msg('仅可上传一份文件!')
  361. }
  362. }
  363. });
  364. }
  365. </script>
  366. <script>
  367. // 获取具有指定 ID 的 <ul> 元素
  368. var ulElement = document.getElementById("filesBox");
  369. // 检查 <ul> 元素的子元素数量
  370. if (ulElement.children.length === 0) {
  371. // 如果子元素数量为 0,隐藏 <ul> 元素
  372. ulElement.style.display = "none";
  373. }
  374. </script>
  375. <!-- /脚本 -->
  376. <!-- <script src="/static/assets/layui/layui.js"></script> -->
  377. <script src="/static/assets/layui/layui.js"></script>
  378. <script src="/static/assets/third_party/echart/echarts.min.js"></script>
  379. <script src="/static/assets/gougu/gouguInit.js"></script>
  380. <script src="https://unpkg.com/pinyin-pro"></script>
  381. <script>
  382. var { pinyin } = pinyinPro;
  383. </script>
  384. <!-- 统计代码 -->
  385. <!-- /统计代码 -->
  386. </body>
  387. </html>