weekReport.jsp 44 KB

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