c_read.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <style>
  4. .footer{
  5. display: none;
  6. }
  7. .fujian {
  8. display: flex;
  9. }
  10. .fujianimg img {
  11. height: 9vh !important;
  12. }
  13. .form-title {
  14. background-color: rgb(241, 241, 241);
  15. color: rgb(95, 95, 95);
  16. border-color: rgb(241, 241, 241);
  17. text-align: center;
  18. border-color: #e2e2e2;
  19. }
  20. .filelist{
  21. width: 100%;
  22. overflow: auto;
  23. justify-content:flex-start;
  24. align-content: space-between;
  25. flex-direction: column-reverse;
  26. flex-wrap: wrap;
  27. }
  28. .filelist li{
  29. padding: 0.5vw 0.8vw 0.5vw 0.8vw;
  30. white-space: nowrap;
  31. overflow: hidden;
  32. text-overflow: ellipsis;
  33. display: inline-block;
  34. border-right: 1px solid #e2e2e2;
  35. float: left;
  36. }
  37. .filelist p{
  38. margin: 3px 0 5px 0;
  39. width: 11vw;
  40. overflow: hidden;
  41. text-overflow: ellipsis;
  42. text-align: center;
  43. }
  44. #filesBox2 li{
  45. padding: 0.5vw 0.8vw 0.5vw 0.8vw;
  46. white-space: nowrap;
  47. overflow: hidden;
  48. text-overflow: ellipsis;
  49. display: inline-block;
  50. border-right: 1px solid #e2e2e2;
  51. float: left;
  52. }
  53. .footer{
  54. display: none;
  55. }
  56. .layui-table th{
  57. text-align: center !important;
  58. font-weight: 500;
  59. }
  60. .layui-anim dd{
  61. text-align: left;
  62. }
  63. .layui-th-gray{
  64. background-color: rgb(241, 241, 241);
  65. }
  66. .layui-table th{
  67. border-color: #e2e2e2
  68. }
  69. .forleft {
  70. text-align: left !important;
  71. }
  72. .height{
  73. height: 36px;
  74. }
  75. .layui-btn-group span:last-child{
  76. display: none;
  77. }
  78. </style>
  79. {/block}
  80. <!-- 主体 -->
  81. {block name="body"}
  82. <div class="p-3">
  83. <table class="layui-hide" id="appropriation_add" lay-filter="appropriation_add"></table>
  84. <form class="layui-form p-4">
  85. <table class="layui-table layui-table-form">
  86. <tr>
  87. <th class="layui-th-gray">委托单位</th>
  88. <th colspan="5" style="text-align:left !important;padding-left:2.5vw;">
  89. {$detail.entrust_unit_name}
  90. </th>
  91. <th class="layui-th-gray">是否开票</th>
  92. <th colspan="2">
  93. <input type="radio" name="invoice_status" value="1" title="是" {if $detail.invoicing_whether!=0}checked{/if}>
  94. <input type="radio" name="invoice_status" value="0" title="否" {if $detail.invoicing_whether==0}checked{/if}>
  95. </th>
  96. </tr>
  97. <tr>
  98. <th class="layui-th-gray">发票编号</th>
  99. <th colspan="2">
  100. <input type="text" name="invoicing_num" autocomplete="off" placeholder="请输入发票编号" class="layui-input" value="{$detail.invoicing_num}">
  101. </th>
  102. <th class="layui-th-gray">发票类型</th>
  103. <th colspan="2">
  104. <select name="invoice_type" lay-verify="required">
  105. <option value="0"></option>
  106. <option value="1" {if $detail.invoice_type==1}selected{/if}>普通发票</option>
  107. <option value="2" {if $detail.invoice_type==2}selected{/if}>专用发票</option>
  108. <option value="3" {if $detail.invoice_type==3}selected{/if}>电子普票</option>
  109. <option value="4" {if $detail.invoice_type==4}selected{/if}>电子专票</option>
  110. </select>
  111. </th>
  112. <th class="layui-th-gray">发票金额</th>
  113. <th colspan="2">
  114. <input type="text" name="invoicing_amount" autocomplete="off" placeholder="请输入发票金额" class="layui-input" value="{$detail.invoicing_amount}">
  115. </th>
  116. </tr>
  117. {volist name="audit" id="vo"}
  118. <tr>
  119. <th class="layui-th-gray height">审核状态</th>
  120. <th colspan="2">
  121. {switch $vo.audit_status}
  122. {case 1}待审核{/case}
  123. {case 2}已通过{/case}
  124. {case 3}已拒绝{/case}
  125. {case 4}已作废{/case}
  126. {default /}未知
  127. {/switch}
  128. </th>
  129. <th class="layui-th-gray">审批人</th>
  130. <th colspan="2">
  131. {$vo.approver_name}
  132. </th>
  133. <th class="layui-th-gray">审批回执</th>
  134. <th colspan="2">
  135. {$vo.audit_remark}
  136. </th>
  137. </tr>
  138. <tr>
  139. <th class="layui-th-gray height">审批时间</th>
  140. <th colspan="8" style="text-align:left !important;padding-left:2.5vw;">
  141. {if $vo.audit_time!=0}{$vo.audit_time|date="Y-m-d H:i"}{/if}
  142. </th>
  143. </tr>
  144. {/volist}
  145. <tr>
  146. <th colspan="9" class="forleft" style="text-align: left !important;">相关附件</th>
  147. </tr>
  148. <tr>
  149. <th colspan="9" class="fujianimg" style="padding: 9px 0;">
  150. <div id="filesBox2">
  151. <div class="filelist" id="filesBigBox">
  152. <ul id="filesBox" style="height: 16.2vh;">
  153. {:fileCard($file_array)}
  154. </ul>
  155. </div>
  156. {empty name="$file_array" }
  157. <div class="layui-data-none" >暂无附件</div>
  158. {/empty}
  159. </div>
  160. </th>
  161. </tr>
  162. </table>
  163. </form>
  164. </div>
  165. {/block}
  166. <!-- /主体 -->
  167. <!-- 脚本 -->
  168. {block name="script"}
  169. <script>
  170. var moduleInit = ['tool', 'oaTool'];
  171. function gouguInit() {
  172. var form = layui.form, tool = layui.tool, oaTool = layui.oaTool, table = layui.table, layer = layui.layer;
  173. var file_ids = [];
  174. var project_ids = [];
  175. layui.pageTable = table.render({
  176. elem: '#appropriation_add',
  177. id: "appropriation_add",
  178. title: '造价项目列表',
  179. url: '/admin/project.appropriation/c_read?id=' + '{$id}',
  180. totalRow: true,
  181. cellMinWidth: 150,
  182. cols: [
  183. [{
  184. fixed: 'left',
  185. field: 'id',
  186. title: '编号',
  187. align: 'center',
  188. width: 80,
  189. totalRowText: "合计"
  190. }, {
  191. field: 'project_name',
  192. title: '项目名称',
  193. align: 'center',
  194. }, {
  195. field: 'sent_review_amount',
  196. title: '送审服务费',
  197. align: 'center',
  198. totalRow: true,
  199. }, {
  200. field: 'appropriation_amount',
  201. title: '请款金额',
  202. align: 'center',
  203. totalRow: true,
  204. }, {
  205. field: 'refund_amount',
  206. title: '回款金额',
  207. align: 'center',
  208. totalRow: true,
  209. // edit: true
  210. }
  211. ]
  212. ]
  213. });
  214. table.on('edit(appropriation_add)', function (obj) {
  215. var field = obj.field; // 得到修改的字段
  216. var value = obj.value // 得到修改后的值
  217. var data = obj.data // 得到所在行所有键值
  218. var id = data.id;
  219. // 值的校验
  220. if (value.replace(/\s/g, '') === '') {
  221. layer.tips('值不能为空', this, {tips: 1});
  222. return obj.reedit(); // 重新编辑 -- v2.8.0 新增
  223. }
  224. let callback = function (e) {
  225. let sent_review_amount = 0;
  226. let appropriation_amount = 0;
  227. let refund_amount = 0;
  228. layui.each(layui.table.cache['appropriation_add'], function (index, row) {
  229. sent_review_amount += row.sent_review_amount;
  230. appropriation_amount += row.appropriation_amount;
  231. refund_amount += row.refund_amount
  232. });
  233. layui.pageTable.reload();
  234. layer.msg(e.msg)
  235. }
  236. tool.post("edit", data, callback)
  237. });
  238. form.on('submit(webform)', function (data) {
  239. let refund_amount = 0;
  240. layui.each(layui.table.cache['appropriation_add'], function (index, row) {
  241. refund_amount += Number(row.refund_amount)
  242. });
  243. data.field.refund_amount = refund_amount;
  244. delete data.field.file;
  245. console.log(data);
  246. let callback = function (e) {
  247. layer.msg(e.msg)
  248. parent.location.reload();
  249. if (e.code == 0) {
  250. tool.sideClose(1000);
  251. }
  252. }
  253. tool.post("/admin/project.appropriation/cc_edit", data.field, callback)
  254. return false;
  255. });
  256. form.on('submit(save)', function (data) {
  257. let callback = function (e) {
  258. layer.msg(e.msg)
  259. parent.location.reload();
  260. if (e.code == 0) {
  261. tool.sideClose(1000);
  262. }
  263. }
  264. tool.post("/admin/project.appropriation/disagree", data.field, callback)
  265. return false;
  266. });
  267. function fileCard(item) {
  268. var host = window.location.host;
  269. var li = '';
  270. if (item.length > 0) {
  271. for (var a = 0; a < item.length; a++) {
  272. let image = ['jpg', 'jpeg', 'png', 'gif'];
  273. let doc = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf', 'zip', 'rar', '7z'];
  274. // let down = '<a href="'+item[a].filepath+'" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" download="'+item[a].name+'">下载</a>';
  275. let down = '<a href="' + item[a]['filepath'] + '" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" download="' + item[a]['name'] + '">预览</a>';
  276. // 判断元素是否在数组中
  277. let path = '/static/home/images/icon/file.png';
  278. if (image.includes(item[a].fileext)) {
  279. path = item[a].filepath;
  280. down = '<span data-href="' + item[a].filepath + '" class="layui-btn layui-btn-xs layui-btn-normal file-view-img">预览</span>';
  281. } else if (doc.includes(item[a].fileext)) {
  282. path = '/static/home/images/icon/' + item[a].fileext + '.png';
  283. }
  284. if (item[a].fileext == 'pdf') {
  285. down = '<span data-href="' + item[a].filepath + '" class="layui-btn layui-btn-xs layui-btn-normal file-view-pdf">预览</span>';
  286. }
  287. 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 +
  288. '" style="object-fit: contain;" class="file-item"><p title="' + item[a].name + '">' + item[a].name +
  289. '</p><div class="layui-btn-group">' + down +
  290. '<span class="layui-btn layui-btn-xs layui-btn-danger file-del">删除</span></div></li>';
  291. }
  292. return li;
  293. }
  294. }
  295. $('#filesBox').on('click', '.file-del', function () {
  296. let id = $(this).parent().parent().data('id');
  297. layer.confirm('确定要删除该文件吗?', {icon: 3, title: '提示'}, function () {
  298. let callback = function (e){
  299. layer.closeAll();
  300. if (e.hasOwnProperty("msg")) {
  301. layer.msg(e.msg);
  302. }
  303. if(e.code==0){
  304. var index = file_ids.indexOf(id);
  305. if (index > -1) {
  306. file_ids.splice(index, 1);
  307. }
  308. if (file_ids.length == 0) {
  309. $("#filesBox").append('<div id="nofile" class="layui-data-none" >暂无附件</div>');
  310. }
  311. $("#" + id).remove();
  312. }
  313. }
  314. tool.delete("/admin/project.api/delete_file", {id: id}, callback)
  315. });
  316. })
  317. oaTool.addFile({
  318. type: 1,
  319. isSave: true,
  320. ajaxSave: function (res) {
  321. if(file_ids.length<1){
  322. console.log(file_ids.length)
  323. let callback = function (e) {
  324. if (e.hasOwnProperty("msg")) {
  325. layer.msg(e.msg);
  326. } else {
  327. layer.msg('上传成功!')
  328. }
  329. if (e[0].id) {
  330. file_ids.push(e[0].id)
  331. $('#nofile').remove();
  332. $("#filesBox").append(fileCard(e));
  333. }
  334. }
  335. tool.post("/admin/project.api/add_file", {
  336. 'file_id': res.data.id,
  337. }, callback);
  338. }else {
  339. layer.msg('仅可上传一份文件!')
  340. }
  341. }
  342. });
  343. }
  344. </script>
  345. <script>
  346. // 获取具有指定 ID 的 <ul> 元素
  347. var ulElement = document.getElementById("filesBox");
  348. // 检查 <ul> 元素的子元素数量
  349. if (ulElement.children.length === 0) {
  350. // 如果子元素数量为 0,隐藏 <ul> 元素
  351. ulElement.style.display = "none";
  352. }
  353. </script>
  354. {/block}
  355. <!-- /脚本 -->