weekReport.jsp 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8" %>
  3. <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
  4. <%@ page isELIgnored="false" %>
  5. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  6. <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
  7. <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <meta charset="utf-8"/>
  12. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  13. <meta name="viewport"
  14. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
  15. <title>项目周报</title>
  16. <jsp:include page="../common/common-meta-include.jsp"></jsp:include>
  17. <jsp:include page="../common/common-js-include.jsp"></jsp:include>
  18. <jsp:include page="../common/common-css-include.jsp"></jsp:include>
  19. <style>
  20. .layui-table-body::-webkit-scrollbar {
  21. width: 0px;
  22. /*height: 10px;*/
  23. }
  24. .pop_info .layui-icon {
  25. background: none;
  26. }
  27. .pop_info .layui-form-item {
  28. display: flex;
  29. }
  30. .pop_info .layui-input-block {
  31. width: unset;
  32. flex: 1;
  33. }
  34. .table_box .img_ls .img .layui-icon {
  35. font-size: 16px;
  36. }
  37. .table_box,
  38. .table_box .table_process {
  39. overflow: visible;
  40. }
  41. .layui-table-view .layui-table td > div>span {
  42. /*min-height: 85px !important;*/
  43. /*white-space: normal;*/
  44. line-height: 22px !important;
  45. display: -webkit-box !important; /* 使用旧版的弹性盒子布局 */
  46. -webkit-box-orient: vertical; /* 设置为垂直方向排列 */
  47. overflow: hidden; /* 隐藏溢出内容 */
  48. text-overflow: ellipsis; /* 使用省略号表示溢出内容 */
  49. -webkit-line-clamp: 2; /* 显示的行数 */
  50. }
  51. .table_box .img_ls{
  52. padding: 0;
  53. }
  54. .table_box .img_ls li{
  55. margin-left: 0;
  56. }
  57. .layui-table-body .layui-table-cell{
  58. padding: 5px !important;
  59. height: 64px !important;
  60. }
  61. .layui-table-header .layui-table-cell{
  62. height: 42px !important;
  63. }
  64. </style>
  65. <style>
  66. .hiddenParam,
  67. .hiddenParams {
  68. display: none;
  69. }
  70. </style>
  71. </head>
  72. <body>
  73. <div id="app"></div>
  74. <template id="template">
  75. <div>
  76. <div>
  77. <div class="layui-layout layui-layout-admin pd0">
  78. <!-- 内容区域 -->
  79. <div class="right_title">
  80. <div class="txt">项目周报<div class="top-breadcrumb"></div></div>
  81. <div class="layui-collapse search_form">
  82. <div class="layui-colla-item">
  83. <%-- <h2 class="layui-colla-title">筛选</h2>--%>
  84. <div class="layui-colla-content layui-show">
  85. <form class="layui-form">
  86. <div class="layui-row">
  87. <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
  88. <div class="layui-form-item">
  89. <label class="layui-form-label">项目名称</label>
  90. <div class="layui-input-block time_box">
  91. <input type="text" name="proName" placeholder="请输入" autocomplete="off"
  92. class="layui-input">
  93. </div>
  94. </div>
  95. </div>
  96. <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
  97. <div class="layui-form-item">
  98. <label class="layui-form-label ">项目属地</label>
  99. <div class="layui-input-block">
  100. <select name="jsdd">
  101. <option value="">请选择</option>
  102. <c:forEach items="${JSDD }" var="js">
  103. <option value="${js.code }">${js.title }</option>
  104. </c:forEach>
  105. </select>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="layui-col-xs6 layui-col-sm6 layui-col-md4 hiddenParams">
  110. <div class="layui-form-item">
  111. <label class="layui-form-label">项目状态</label>
  112. <div class="layui-input-block">
  113. <select name="projStatus" lay-verify="required">
  114. <option value="0">所有</option>
  115. <option value="1">已开工</option>
  116. <option value="2">已停工</option>
  117. </select>
  118. </div>
  119. <span class="morePan" id="toggleMore">
  120. <a id="moreText">更多</a>
  121. <a id="lessText">收起</a>
  122. </span>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="layui-form-item">
  127. <div class="layui-col-xs6 layui-col-sm6 layui-col-md4 hiddenParam">
  128. <div class="layui-form-item">
  129. <label class="layui-form-label">周报期间</label>
  130. <div class="layui-input-block time_box">
  131. <input type="text" id="startTime" name="title" placeholder="请选择开始时间"
  132. autocomplete="off" class="layui-input" style="width: 200px;">
  133. <span class="split_txt"></span>
  134. <input type="text" id="endTime" name="title" placeholder="请选择结束时间"
  135. autocomplete="off" class="layui-input" style="width: 200px;">
  136. </div>
  137. </div>
  138. </div>
  139. <div class="layui-col-xs6 layui-col-sm6 layui-col-md4 hiddenParam">
  140. <div class="layui-form-item">
  141. <label class="layui-form-label">周报状态</label>
  142. <div class="layui-input-block">
  143. <select name="isDo">
  144. <option value="0">所有</option>
  145. <option value="1">已做</option>
  146. <option value="2">未做</option>
  147. </select>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. <div class="layui-form-item">
  153. <div class="layui-col-xs6 layui-col-sm6 layui-col-md5">
  154. <div class="layui-form-item">
  155. <button type="button" class="layui-btn layui-btn-normal" @click="onSearch">
  156. 查询
  157. </button>
  158. <button type="button" class="layui-btn layui-btn-export" @click="exportExcel">导出</button>
  159. </div>
  160. </div>
  161. </div>
  162. </form>
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. <div class="table_box" style="padding-top: 0;">
  168. <div class="table_process" style="position: relative">
  169. <table id="table1" lay-filter="test"></table>
  170. <div class="pagination-box" id="pagination"></div>
  171. </div>
  172. </div>
  173. </div>
  174. <div style="height: 20px;"></div>
  175. </div>
  176. <div class="pop_info" id="popInfo">
  177. <div class="pop_con_form" style="width:100%;padding:0 40px;box-sizing:border-box;">
  178. <form class="layui-form">
  179. <div class="layui-form-item">
  180. <label class="layui-form-label" style="width:95px;"><span class="red">*</span>周报期间</label>
  181. <div class="layui-input-block">
  182. <input type="text" name="kjMonth" disabled class="layui-input"
  183. style="background-color: #F6F6F6; color: #ccc;">
  184. </div>
  185. </div>
  186. <div class="layui-form-item">
  187. <label class="layui-form-label" style="width:95px;"><span class="red">*</span>项目名称</label>
  188. <div class="layui-input-block">
  189. <input type="text" name="projName" disabled class="layui-input"
  190. style="background-color: #F6F6F6; color: #ccc;">
  191. </div>
  192. </div>
  193. <!-- <div class="layui-form-item">
  194. <label class="layui-form-label" style="width:95px;">当前阶段</label>
  195. <div class="layui-input-block">
  196. <select name="subPlanId" lay-filter="subPlanId" id="subPlanId">
  197. <option value="">--请选择--</option>
  198. <option v-for="(item,index) in currPlan" :index="index" :value="item.id">{{item.beginDate}}{{item.endDate}}</option>
  199. </select>
  200. </div>
  201. </div>
  202. <div class="layui-form-item" v-if="currPlanIndex != null">
  203. <label class="layui-form-label" style="width:95px;">计划内容</label>
  204. <div class="layui-input-block">
  205. <textarea class="layui-textarea" readonly="readonly">{{currPlan[currPlanIndex-1].content}}</textarea>
  206. </div>
  207. </div> -->
  208. <div class="layui-form-item">
  209. <label class="layui-form-label" style="width:95px;"><span class="red">*</span>进度比例(%)</label>
  210. <div class="layui-input-block">
  211. <input type="number" name="numBl" min="0" max="100" placeholder="请输入比例范围在0-100 单位%"
  212. class="layui-input">
  213. </div>
  214. </div>
  215. <!-- <div class="layui-form-item">
  216. <label class="layui-form-label" style="width:95px;"><span class="red">*</span>本实周际投资(万元)</label>
  217. <div class="layui-input-block">
  218. <input type="number" name="amt" placeholder="请输入金额" class="layui-input">
  219. </div>
  220. </div> -->
  221. <div class="layui-form-item">
  222. <label class="layui-form-label" style="width:95px;"><span class="red">*</span>项目进展情况</label>
  223. <div class="layui-input-block">
  224. <textarea placeholder="请输入内容" style="height: 80px" name="ybContent" class="layui-textarea">{{yuebaoInfo.content}}</textarea>
  225. </div>
  226. </div>
  227. <div class="layui-form-item">
  228. <label class="layui-form-label" style="width:95px;"><span class="red"></span>项目延期原因</label>
  229. <div class="layui-input-block">
  230. <textarea placeholder="请输入内容" style="height: 80px" name="ybReason" class="layui-textarea">{{yuebaoInfo.reason}}</textarea>
  231. </div>
  232. </div>
  233. <div class="layui-form-item">
  234. <div class="table_box">
  235. <div class="layui-form-label required" style="width:95px;">附件信息</div>
  236. <ul class="img_ls">
  237. <li v-for="(item, index) in imgLs" :key="index">
  238. <div class="img" id="attachDiv" :title="showTitle(item)">
  239. <%-- //:layer-src="picShow1(item.fileAddre)"--%>
  240. <img :id="item.fileAddre" :src="picShow(item.fileAddre,item.fileType)"
  241. @click="showImage(item.fileAddre,item.fileType, item.createTime)"
  242. :alt="item.fileName"/>
  243. <div class="download_icon" @click="download(item.fileAddre,item.fileName)"></div>
  244. <i class="layui-icon layui-icon-close-fill" @click="delPic(index)"></i>
  245. </div>
  246. {{item.fileName}}
  247. </li>
  248. <li class="add" id="addPic">
  249. <div class="bg"><i class="layui-icon layui-icon-add-circle"></i></div>
  250. </li>
  251. </ul>
  252. </div>
  253. </div>
  254. </form>
  255. </div>
  256. </div>
  257. </div>
  258. </template>
  259. <script>
  260. new Vue({
  261. el: "#app",
  262. template: "#template",
  263. data: {
  264. winH: 0,
  265. collapse: false,
  266. tabActive: 1,
  267. startMonth: "",
  268. endMonth: "",
  269. startAmt: "",
  270. endAmt: "",
  271. currPlan: [],
  272. yuebaoInfo: {},
  273. active: 7, // 左侧菜单选中项
  274. // imgLs: 10,
  275. currWeekStart: "",
  276. currWeekEnd: "",
  277. pageNo: 1,
  278. orderType: "",
  279. pageSize: 20,
  280. currPlanIndex: null,
  281. opinions: [],
  282. imgLs: [],
  283. imgLsDel: []
  284. },
  285. mounted() {
  286. this.init()
  287. },
  288. methods: {
  289. init() {
  290. this.winH = document.body.clientHeight
  291. const {laydate, table, laypage, util} = layui;
  292. var self = this;
  293. var beginWeek = self.genTime(-1);
  294. self.startMonth = beginWeek.split(" ~ ")[0];
  295. var endWeek = self.genTime(0);
  296. self.endMonth = endWeek.split(" ~ ")[0];
  297. App.common.utils.uploadFile('#addPic', App.getUrl('/static/file/uploadFgw'), {
  298. acceptMime: 'image/png,video/mp4,image/jpg,image/jpeg,application/pdf,application/msword,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  299. , exts: 'png|jpg|jpeg|pdf|xls|xlsx|doc|docx|mp4'
  300. }, null, function (res) {
  301. for (var i = 0; i < res.resultList.length; i++) {
  302. var pic = {};
  303. pic.fileAddre = res.resultList[i].id;
  304. pic.fileName = res.resultList[i].name;
  305. pic.fileType = res.resultList[i].ftype;
  306. pic.logicDeleteFlag = 0;
  307. self.imgLs.push(pic);
  308. }
  309. });
  310. laydate.render({
  311. elem: '#startTime',
  312. format: "yyyy-MM-dd ~ yyyy-MM-dd",
  313. value: beginWeek,
  314. btns: ['clear', 'confirm'],
  315. done: function (value) {
  316. var start = self.setTimeData(value, $("#startTime"));
  317. if (start != "") {
  318. self.startMonth = start.split(" ~ ")[0];
  319. } else {
  320. self.startMonth = "";
  321. }
  322. }
  323. });
  324. laydate.render({
  325. elem: '#endTime',
  326. format: "yyyy-MM-dd ~ yyyy-MM-dd",
  327. value: endWeek,
  328. btns: ['clear', 'confirm'],
  329. done: function (value) {
  330. var end = self.setTimeData(value, $("#endTime"));
  331. if (end != "") {
  332. self.endMonth = end.split(" ~ ")[0];
  333. } else {
  334. self.endMonth = "";
  335. }
  336. }
  337. });
  338. layui.form.on("select(subPlanId)", function (data) {
  339. if (data.value == "") {
  340. self.currPlanIndex = null;
  341. } else {
  342. self.currPlanIndex = $("#subPlanId").prop("selectedIndex");
  343. }
  344. setTimeout(() => {
  345. layui.form.render();
  346. }, 500);
  347. });
  348. this.onSearch()
  349. window.detail = this.detail;
  350. window.onEdit = this.onEdit;
  351. window.showImage = this.showImage;
  352. var check = "${isSfgw}";
  353. if (check !== "false") {
  354. this.getData();
  355. } else {
  356. self.loadTable([]);
  357. }
  358. window.addEventListener('message', this.receiveMessage, false);
  359. window.parent.postMessage('init loaded')
  360. $('.hiddenParams').show();
  361. $('#lessText').hide();
  362. },
  363. showTitle(obj) {
  364. return "附件名称:" + obj.fileName;
  365. },
  366. delPic(index) {
  367. this.imgLs[index].logicDeleteFlag = 1;
  368. this.imgLsDel.push(this.imgLs[index]);
  369. this.imgLs.splice(index, 1);
  370. },
  371. download(fileId, fileName) {
  372. var url = "static/file/download/" + fileId;
  373. App.common.utils.downFile(App.getUrl(url));
  374. },
  375. showImage: function (fileId, type, createTime) {
  376. var imageUrl = "";
  377. var realUrl = "";
  378. var mp4Url = "";
  379. if (type == 8) {
  380. imageUrl = "${domain}/static/file/" + fileId + "/showfileFgw";
  381. } else if (type == null || type == "") {
  382. } else if (type == 101 || type == 102 || type == 103 || type == 104 || type == 105) {
  383. imageUrl = "${domain}/static/file/" + fileId + "/showfileFgw";
  384. } else if (type == 4 || type == 5) {
  385. imageUrl = "${WebSite.asset}/css/images/excel.png";
  386. realUrl = "/static/file/download/" + fileId + "";
  387. } else if (type == 2 || type == 3) {
  388. imageUrl = "${WebSite.asset}/css/images/word.png";
  389. realUrl = "/static/file/download/" + fileId + "";
  390. } else {
  391. imageUrl = '<video width="100%" height="100%" controls="controls" autobuffer="autobuffer" autoplay="autoplay" loop="loop"><source src="${domain}/static/file/' + fileId + '/showfile" type="video/mp4"></source></video>';
  392. }
  393. if (imageUrl) {
  394. if (type == 2 || type == 3 || type == 4 || type == 5) {
  395. window.location.href = App.getUrl(realUrl);
  396. } else if (type == 203) {
  397. layer.open({
  398. type: 1,
  399. title: '播放视频',
  400. content: imageUrl,
  401. offset: 'auto',
  402. area: ['60%', '60%'],
  403. shade: 0.5,
  404. shadeClose: true
  405. });
  406. } else {
  407. if (type == 8) {
  408. // var pdfIndex = layer.open({
  409. // type: 2,
  410. // content: imageUrl,
  411. // area: ['80%', '80%'],
  412. // offset: 'auto'
  413. // });
  414. // layer.full(pdfIndex);
  415. window.open(imageUrl)
  416. } else {
  417. App.common.utils.imageWater(imageUrl, createTime, function (image) {
  418. layer.photos({
  419. photos: {
  420. "title": "",
  421. "id": fileId,
  422. "start": 0,
  423. "data": [
  424. {
  425. "alt": "",
  426. "pid": fileId,
  427. "src": image,
  428. "thumb": imageUrl
  429. }
  430. ]
  431. },
  432. anim: 5
  433. });
  434. });
  435. }
  436. }
  437. }
  438. },
  439. picShow(fileId, type) {
  440. var tempId = "#" + fileId;
  441. if (type == 8) {
  442. return "${WebSite.asset}/css/images/pdf.png";
  443. } else if (type == null || type == "") {
  444. } else if (type == 101 || type == 102 || type == 103 || type == 104 || type == 105) {
  445. return "${domain}/static/file/" + fileId + "/showfileFgw";
  446. } else if (type == 4 || type == 5) {
  447. return "${WebSite.asset}/css/images/excel.png";
  448. } else if (type == 2 || type == 3) {
  449. return "${WebSite.asset}/css/images/word.png";
  450. } else if (type == 203) {
  451. return "${WebSite.asset}/css/images/video.png";
  452. }
  453. },
  454. picShow1(fileId) {
  455. return "${domain}/static/file/" + fileId + "/showfileFgw";
  456. },
  457. setTimeData(value, ele) {
  458. if (value != "" && value.length > 0) {
  459. let today = new Date(value.substring(0, 10));
  460. let weekday = today.getDay();
  461. let monday;
  462. let sunday;
  463. if (weekday == 0) {
  464. monday = new Date(1000 * 60 * 60 * 24 * (weekday - 6) + today.getTime());
  465. } else {
  466. monday = new Date(1000 * 60 * 60 * 24 * (1 - weekday) + today.getTime());
  467. }
  468. if (weekday == 0) {
  469. sunday = today;
  470. } else {
  471. sunday = new Date(1000 * 60 * 60 * 24 * (7 - weekday) + today.getTime());
  472. }
  473. let month = monday.getMonth() + 1;
  474. if (month < 10) {
  475. month = "0" + month;
  476. }
  477. let day1 = monday.getDate();
  478. if (day1 < 10) {
  479. day1 = "0" + day1;
  480. }
  481. let start = "" + monday.getFullYear() + "-" + month + "-" + day1;
  482. let month2 = sunday.getMonth() + 1;
  483. if (month2 < 10) {
  484. month2 = "0" + month2;
  485. }
  486. let day2 = sunday.getDate();
  487. if (day2 < 10) {
  488. day2 = "0" + day2;
  489. }
  490. let end = "" + sunday.getFullYear() + "-" + month2 + "-" + day2;
  491. ele.val(start + " ~ " + end);
  492. return start + " ~ " + end;
  493. } else {
  494. ele.val('');
  495. }
  496. return "";
  497. },
  498. genTime: function (weekNum) {
  499. if (!weekNum) {
  500. weekNum = 0;
  501. }
  502. let today = new Date().addWeeks(weekNum);
  503. let weekday = today.getDay();
  504. let monday;
  505. let sunday;
  506. if (weekday == 0) {
  507. monday = new Date(1000 * 60 * 60 * 24 * (weekday - 6) + today.getTime());
  508. } else {
  509. monday = new Date(1000 * 60 * 60 * 24 * (1 - weekday) + today.getTime());
  510. }
  511. if (weekday == 0) {
  512. sunday = today;
  513. } else {
  514. sunday = new Date(1000 * 60 * 60 * 24 * (7 - weekday) + today.getTime());
  515. }
  516. let month = monday.getMonth() + 1;
  517. if (month < 10) {
  518. month = "0" + month;
  519. }
  520. let day1 = monday.getDate();
  521. if (day1 < 10) {
  522. day1 = "0" + day1;
  523. }
  524. let start = "" + monday.getFullYear() + "-" + month + "-" + day1;
  525. let month2 = sunday.getMonth() + 1;
  526. if (month2 < 10) {
  527. month2 = "0" + month2;
  528. }
  529. let day2 = sunday.getDate();
  530. if (day2 < 10) {
  531. day2 = "0" + day2;
  532. }
  533. let end = "" + sunday.getFullYear() + "-" + month2 + "-" + day2;
  534. return start + " ~ " + end;
  535. },
  536. loadTable(data) {
  537. var self = this;
  538. layui.table.render({
  539. elem: '#table1', // 指定原始表格元素选择器(推荐id选择器)
  540. even: true,
  541. autoSort: false,
  542. limit: data.length,
  543. fixed:true,
  544. cols: [[ // 设置表头
  545. {type: 'numbers', fixed: 'left', align: 'center', width: 50, title: '序号'},
  546. {
  547. field: 'sub_name', title: '项目名称', minWidth: 310, fixed: 'left', templet: function (row) {
  548. if (row.sub_name != null) {
  549. return "<a title=" + row.sub_name + ">" + row.sub_name + "</a>";
  550. }
  551. return "";
  552. }
  553. },
  554. {field: 'amt', title: '总投资', minWidth: 100, templet : function(row){
  555. if(row.amt){
  556. return '<span>'+row.amt+'万元</span>';
  557. }else{
  558. return "";
  559. }
  560. }},
  561. {
  562. field: 'kj_month', title: '周报期间', minWidth: 200, templet: function (row) {
  563. if (row.kj_month != null) {
  564. return '<span title="' + row.kj_month + '">' + row.kj_month + '</span>';
  565. }
  566. return "";
  567. }
  568. },
  569. {field: 'unit_name', title: '项目单位',width: 200,templet: function(row) {
  570. if(row.unit_name != null) {
  571. return '<span title="' + row.unit_name + '">' + row.unit_name + '</span>';
  572. }
  573. return "";
  574. }},
  575. {
  576. field: 'content', title: '项目进展情况', minWidth: 320, templet: function (row) {
  577. if (row.content != null) {
  578. return '<span title="' + row.content + '">' + row.content + '</span>';
  579. }else{
  580. return "";
  581. }
  582. }
  583. },
  584. {
  585. field: 'num_bl', title: '完成比例', sort: true, minWidth: 100, templet: function (row) {
  586. if (row.num_bl != null && row.num_bl != '') {
  587. return row.num_bl + "%";
  588. } else {
  589. return "";
  590. }
  591. }
  592. },
  593. {
  594. field: 'reason', title: '项目延期原因', minWidth: 150, templet: function (row) {
  595. if (row.reason != null) {
  596. return '<span title="' + row.reason + '">' + row.reason + '</span>';
  597. }
  598. return "";
  599. }
  600. },
  601. {
  602. title: '操作', width: 130,type:'string', align: 'center', fixed: 'right', templet: function (row) {
  603. if (row.unit_id === '${unitId}') {
  604. return '<div class="toolBar"><span onClick=\'onEdit(' + JSON.stringify(row) + ')\'>项目信息</span></div>';
  605. } else {
  606. return '<div class="toolBar"><span onClick=\'detail(' + JSON.stringify(row) + ')\'>项目信息</span></div>';
  607. }
  608. }
  609. }
  610. ]],
  611. data: data,
  612. done: function (res, curr, count) {
  613. /* res.data.forEach(function(item, index) {
  614. //1.当前行的背景颜色cur_color
  615. // if (item.usersub == 1) {
  616. // $('.layui-table').find('tr[data-index="' + index + '"]').find("td").css('background-color', "#0a99eb");
  617. // }
  618. // }); */
  619. res.data.forEach(function(item, index) {
  620. //1.当前行的背景颜色cur_color
  621. // if (item.usersub == 1) {
  622. // $('.layui-table').find('tr[data-index="' + index + '"]').find("td").css('background-color', "#0a99eb");
  623. // }
  624. $(".layui-table-body tr").resize(function () {
  625. $(".layui-table-body tr").each(function (index, val) {
  626. $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
  627. });
  628. });
  629. //初始化高度,使得冻结行表体高度一致
  630. $(".layui-table-body tr").each(function (index, val) {
  631. $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
  632. });
  633. });
  634. }
  635. });
  636. layui.table.reload("table1", {
  637. initSort: {
  638. field: 'num_bl',
  639. type: self.orderType
  640. }
  641. })
  642. layui.table.on("sort(test)", function (obj) {
  643. self.orderType = obj.type;
  644. self.getData();
  645. });
  646. },
  647. getData() {
  648. var self = this;
  649. if (this.startMonth == "") {
  650. layui.layer.msg("必须选择周报期间");
  651. return;
  652. }
  653. if (this.endMonth == "") {
  654. layui.layer.msg("必须选择周报期间");
  655. return;
  656. }
  657. /* var sm = this.startMonth.replace(/\-/g, "");
  658. var em = this.endMonth.replace(/\-/g, ""); */
  659. var param = {
  660. varkind:$("[name='projStatus']").val(),
  661. varbegin:self.startMonth,
  662. varend:self.endMonth,
  663. vardesc:$("[name='proName']").val(),
  664. varstatus:$("[name='isDo']").val(),
  665. varjsdd: $("[name='jsdd']").val(),
  666. pageNo: self.pageNo,
  667. pageSize: self.pageSize,
  668. outtotal: 1,
  669. };
  670. App.postJson("/api/weekReport/queryReport", param, function (res) {
  671. if (res.success) {
  672. console.log(res.data);
  673. self.loadTable(res.rows);
  674. self.loadPage(res.total);
  675. }
  676. });
  677. },
  678. loadPage: function (totalCount) {
  679. var self = this;
  680. layui.laypage.render({
  681. elem: 'pagination',
  682. count: totalCount,
  683. curr: self.pageNo,
  684. limit: self.pageSize,
  685. layout: ['count', 'prev', 'page', 'next', 'skip'],
  686. jump: function (obj, first) {
  687. //首次不执行
  688. if (!first) {
  689. self.pageNo = obj.curr;
  690. self.getData();
  691. }
  692. }
  693. });
  694. },
  695. exportExcel: function () {
  696. if (this.startMonth == "") {
  697. layui.layer.msg("必须选择周报期间");
  698. return;
  699. }
  700. if (this.endMonth == "") {
  701. layui.layer.msg("必须选择周报期间");
  702. return;
  703. }
  704. if (this.startAmt=="" || this.startAmt==undefined){
  705. startAmt=""
  706. }else {
  707. startAmt=this.startAmt
  708. }
  709. if (this.endAmt=="" || this.endAmt==undefined){
  710. endAmt=""
  711. }else {
  712. endAmt=this.endAmt
  713. }
  714. /* var sm = this.startMonth.replace(/\-/g, "");
  715. var em = this.endMonth.replace(/\-/g, ""); */
  716. var param = {
  717. varkind:$("[name='projStatus']").val(),
  718. varbegin:"2024-10-21",
  719. varend:"2024-10-21",
  720. vardesc:$("[name='proName']").val(),
  721. varstatus:$("[name='isDo']").val(),
  722. varjsdd: $("[name='jsdd']").val(),
  723. varlogin:"admin",
  724. varpage: 1,
  725. varnum: 10000,
  726. outtotal: 1,
  727. };
  728. App.common.utils.downFile(App.getUrl("/weekReport/exportExcel"), "GET", param, "项目周报.xlsx", "项目周报导出失败");
  729. //window.location.href=App.getUrl("?startMonth="+param.startMonth+"&endMonth="+param.endMonth+"&status="+param.status+"&subName="+param.subName+"&isDo="+param.isDo+"&startAmt="+param.startAmt+"&endAmt="+param.endAmt+"&hyfl="+param.hyfl);
  730. },
  731. detail: function (row) {
  732. $("#popInfo").find("input").attr("readOnly", true);
  733. $("#popInfo").find("select").attr("disabled", "disabled");
  734. $("#popInfo").find("textarea").attr("readOnly", true);
  735. this.setEditPlanValue(row);
  736. this.setFileValue(row);
  737. layer.open({
  738. type: 1,
  739. title: '周报信息',
  740. skin: 'pop_info_class',
  741. id: 'layerPop', //防止重复弹出
  742. content: $('#popInfo'),
  743. area: ['700px', '630px']
  744. })
  745. },
  746. setEditPlanValue: function (row) {
  747. var self = this;
  748. this.yuebaoInfo.subId = row.sub_id;
  749. /* if (row.sub_plan_id==undefined){
  750. this.yuebaoInfo.subPlanId ="";
  751. self.currPlanIndex = null;
  752. }else{
  753. this.yuebaoInfo.subPlanId = row.sub_plan_id;
  754. } */
  755. this.yuebaoInfo.subName = row.sub_name;
  756. if (row.content != undefined) {
  757. this.yuebaoInfo.content = row.content;
  758. } else {
  759. this.yuebaoInfo.content = "";
  760. }
  761. if (row.reason != undefined) {
  762. this.yuebaoInfo.reason = row.reason;
  763. } else {
  764. this.yuebaoInfo.reason = "";
  765. }
  766. if (row.num_bl == undefined) {
  767. this.yuebaoInfo.numBl = "";
  768. } else {
  769. this.yuebaoInfo.numBl = row.num_bl;
  770. }
  771. //this.yuebaoInfo.amt = row.amt;
  772. /* App.postJson("/api/subPlan/getPlanBySub", {subId: row.sub_id}, function(res){
  773. self.currPlan = res.data;
  774. setTimeout(() => {
  775. if (res.data.length!=0){
  776. if(row.sub_plan_id!=undefined) {
  777. $("#subPlanId").val(row.sub_plan_id);
  778. self.currPlanIndex = $("#subPlanId").prop("selectedIndex");
  779. } else {
  780. self.currPlanIndex = null;
  781. }
  782. }else{
  783. self.currPlanIndex = null;
  784. }
  785. layui.form.render();
  786. }, 500);
  787. }); */
  788. this.setValueEdit(row);
  789. },
  790. setFileValue: function (row) {
  791. var self = this;
  792. var subId = row.sub_id;
  793. var year = row.year;
  794. var beginDate = row.begin_date;
  795. App.postJson("/api/weekReport/getByInfoFgw", {
  796. subId: subId,
  797. year: year,
  798. startDate: beginDate
  799. }, function (res) {
  800. setTimeout(() => {
  801. self.imgLs = res.data || [];
  802. layui.form.render();
  803. }, 300);
  804. });
  805. },
  806. onEdit(row) {
  807. var self = this;
  808. const {layer} = layui
  809. const $ = layui.jquery;
  810. $("#popInfo").find("input").attr("readOnly", false);
  811. $("#popInfo").find("select").attr("disabled", false);
  812. $("#popInfo").find("textarea").attr("readOnly", false);
  813. if (row.status == '1') {
  814. layer.msg("该项目未开工,无需填写周报!");
  815. return;
  816. }
  817. if (row.status == '9') {
  818. layer.msg("该项目已竣工,无需填写周报!");
  819. return;
  820. }
  821. this.setEditPlanValue(row);
  822. this.setFileValue(row);
  823. layer.open({
  824. type: 1,
  825. title: '周报信息',
  826. skin: 'pop_info_class',
  827. id: 'layerPop', //防止重复弹出
  828. content: $('#popInfo'),
  829. area: ['700px', '630px'],
  830. btn: ['取消', '提交'],
  831. btnAlign: 'c', //按钮居中
  832. yes() {
  833. layer.closeAll();
  834. },
  835. btn2() {
  836. self.yuebaoInfo.content = $("[name='ybContent']").val();
  837. self.yuebaoInfo.reason = $("[name='ybReason']").val();
  838. //self.yuebaoInfo.amt = $("[name='amt']").val();
  839. self.yuebaoInfo.numBl = $("[name='numBl']").val();
  840. /* self.yuebaoInfo.subPlanId = $("[name='subPlanId']").val(); */
  841. self.yuebaoInfo.year = row.year;
  842. self.yuebaoInfo.beginDate = row.kj_month.split("至")[0];
  843. self.yuebaoInfo.endDate = row.kj_month.split("至")[1];
  844. for (var i = 0; i < self.imgLsDel.length; i++) {
  845. self.imgLs.push(self.imgLsDel[i]);
  846. }
  847. self.yuebaoInfo.listFile = self.imgLs;
  848. /* if(self.yuebaoInfo.subPlanId == ""){
  849. App.msg.warn("请选择当前阶段");
  850. return false;
  851. } */
  852. /* if(!self.isNum(self.yuebaoInfo.amt)){
  853. App.msg.warn("请输入正数的投资金额");
  854. return false;
  855. } */
  856. if (!self.isNum(self.yuebaoInfo.numBl) || Number(self.yuebaoInfo.numBl) < 0 || Number(self.yuebaoInfo.numBl) > 100) {
  857. App.msg.warn("请输入0到100的进度比例");
  858. return false;
  859. }
  860. if (self.yuebaoInfo.content == "") {
  861. layer.msg("请先填写周报内容");
  862. return false;
  863. } else {
  864. // console.log("self.yuebaoInfo");
  865. // console.log(self.yuebaoInfo);
  866. App.postJson("/api/weekReport/saveReport", self.yuebaoInfo, function (res) {
  867. if (res.success) {
  868. layer.msg("保存成功");
  869. self.getData();
  870. }
  871. });
  872. }
  873. },
  874. cancel() {
  875. layer.closeAll();
  876. }
  877. })
  878. },
  879. isNum(num) {
  880. var regPos = /^\d+(\.\d+)?$/;
  881. if (regPos.test(num)) {
  882. return true;
  883. } else {
  884. return false;
  885. }
  886. },
  887. setValueEdit(row) {
  888. $("[name='kjMonth']").val(row.kj_month);
  889. $("[name='projName']").val(row.sub_name);
  890. $("[name='ybContent']").val(row.content);
  891. //$("[name='amt']").val(row.amt);
  892. $("[name='numBl']").val(row.num_bl);
  893. },
  894. onSearch() {
  895. this.pageNo = 1;
  896. this.getData();
  897. },
  898. receiveMessage (e) {
  899. console.log('cb receiveMessage: ', e.data)
  900. if (e.data.topBreadcrumb) {
  901. $(".top-breadcrumb").html(e.data.topBreadcrumb)
  902. }
  903. }
  904. }
  905. })
  906. $(document).ready(function() {
  907. var showMoreFlag = false; // 定义一个变量来控制显示/隐藏状态
  908. $('#toggleMore').click(function() {
  909. // 切换显示/隐藏状态
  910. showMoreFlag = !showMoreFlag;
  911. // 根据状态更新文本和图标
  912. if (showMoreFlag) {
  913. $('#moreText').hide();
  914. $('.hiddenParam').show();
  915. $('#lessText').show();
  916. } else {
  917. $('#lessText').hide();
  918. $('.hiddenParam').hide();
  919. $('#moreText').show();
  920. }
  921. });
  922. });
  923. </script>
  924. </body>
  925. </html>