index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <div>
  3. <van-nav-bar title="审核日报" left-text="返回" @click-left="back" fixed left-arrow/>
  4. <div class="login_form">
  5. <div class="formBatch">
  6. <van-checkbox v-model="isAllChecked" @click="allChecked" shape="square" style="padding-left:3vw"></van-checkbox>
  7. <div style="padding:1vh 2vw">
  8. <van-button @click="batchAgree(true)" :disabled="!isCanAgree" type="info" size="small">批量通过</van-button>
  9. <van-button @click="batchAgree(false)" :disabled="!isCanAgree" type="danger" size="small" style="margin-left:2vw">批量驳回</van-button>
  10. </div>
  11. </div>
  12. <van-skeleton v-for="(item,index) in report" :key="index" title avatar :row="3" :loading="false">
  13. <van-panel class="one_report">
  14. <template #header>
  15. <div class="van-cell van-panel__header">
  16. <div class="van-cell__title" style="display:flex;algin-items:center">
  17. <van-checkbox v-model="item.checked" @click="itemChecked" shape="square" style="margin-right:2vw"></van-checkbox>
  18. <span>{{item.name}}</span>
  19. </div>
  20. <div class="van-cell__value van-panel__header-value">{{item.state==0?(user.company.packageEngineering == 1 ? (item.data[0].departmentAuditState==-1?'待专业审核': (item.data[0].departmentAuditState==0?'待部门审核': '待项目经理审核')) : '待审核'):item.state==1?'已通过':'已驳回'}}</div>
  21. </div>
  22. </template>
  23. <div class="form_text">
  24. <span style="margin-left:5px;">工作日期: {{item.dateStr}}</span>
  25. <span style="float:right;">
  26. <i v-if="parseFloat(item.reportTime)>parseFloat(item.calculateTime)+0.5" style="color:red;margin-right:8px;" class="fa fa-exclamation-triangle"></i>
  27. 总填报:
  28. <span :style="parseFloat(item.reportTime)>parseFloat(item.calculateTime)+0.5?'color:red':''">{{item.reportTime}}h</span>
  29. </span>
  30. <!-- <span>系统智能统计:{{item.calculateTime}}h</span> -->
  31. </div>
  32. <div v-for="(item1,index1) in item.data" :key="index1" class="one_report_data">
  33. <div class="project_title">项目:{{item1.project}}
  34. [
  35. <span v-if="item1.isDeptAudit==0">
  36. <span v-if="item1.projectAuditState==0">
  37. 待项目审核人<span v-if="item1.projectAuditorName != null">({{item1.projectAuditorName}})</span>审核
  38. </span>
  39. <span style="color:#32CD32;" v-else-if="item1.projectAuditState==1">
  40. 项目审核人<span v-if="item1.projectAuditorName != null">({{item1.projectAuditorName}})</span>审核通过
  41. </span>
  42. </span>
  43. <span v-else-if="item1.isDeptAudit==1">
  44. {{('待'+item1.auditDeptName+'审核')}}
  45. </span>
  46. ]
  47. </div>
  48. <div class="project_title" v-if="item1.subProjectName != null" >子项目:{{item1.subProjectName}}</div>
  49. <div class="project_title" v-if="user.company.packageProject==1&&item1.groupName != null" >任务分组:{{item1.groupName}}</div>
  50. <div class="project_title" v-if="user.company.packageProject==1&&item1.stage != '-'" >投入阶段:{{item1.stage}}</div>
  51. <!--自定义维度 -->
  52. <div class="project_title" v-if="user.timeType.customDegreeActive == 1" >{{user.timeType.customDegreeName}}:{{item1.degreeName}}</div>
  53. <div class="project_title" v-if="user.timeType.customDataActive == 1" >{{user.timeType.customDataName}}:{{item1.customData}}</div>
  54. <div class="project_title" v-if="user.timeType.customTextActive == 1" >{{user.timeType.customTextName}}:{{item1.customText}}</div>
  55. <div class="project_title" v-if="user.company.packageEngineering == 1">
  56. 专业进度:
  57. <span style="margin-right:10px;" v-for="progressItem in item1.professionProgressList" :key="progressItem.id">{{progressItem.professionName}}({{progressItem.progress}}%)
  58. </span>
  59. </div>
  60. <div class="project_title" v-if="item1.taskId != null" >任务:{{item1.taskName}}</div>
  61. <!--根据类型选择使用的模板 -->
  62. <div v-if="item1.multiWorktime == 0">
  63. <div class="project_time">时长:
  64. <span v-if="item1.reportTimeType == 0" style="margin-right:10px;">{{fullDayTxt[item1.timeType]}}</span>
  65. <span v-if="item1.reportTimeType == 2" style="margin-right:10px;">{{item1.startTime+'-'+item1.endTime}}</span>{{item1.time.toFixed(1)}}h
  66. <div class="button" v-if="item1.isOvertime == 1">加班<span v-if="item1.overtimeHours">{{item1.overtimeHours.toFixed(1)}}h</span></div>
  67. </div>
  68. <div class="project_content">事项:<span v-html="item1.content"></span></div>
  69. </div>
  70. <div v-if="item1.multiWorktime == 1">
  71. <div>
  72. 项目时长:<span style="margin-right:10px;">{{item1.time.toFixed(1)}}h</span>
  73. <div class="button" v-if="item1.isOvertime == 1">加班<span v-if="item1.overtimeHours">{{item1.overtimeHours.toFixed(1)}}h</span></div>
  74. </div>
  75. <div style="position:relative;border:#ccc 0.5px solid;padding:3px;margin:5px 0px;" v-for="(timeItem, index) in item1.worktimeList" :key="index" >
  76. <div class="project_time">时长:
  77. <!-- <span v-if="timeItem.reportTimeType == 0" style="margin-right:10px;">{{fullDayTxt[item1.timeType]}}</span> -->
  78. <span style="margin-right:10px;">{{timeItem.startTime+'-'+timeItem.endTime}}</span>{{timeItem.time.toFixed(1)}}h
  79. </div>
  80. <div class="project_content">事项:<span v-html="timeItem.content"></span></div>
  81. </div>
  82. </div>
  83. <div style="padding:5px;text-align:center;" v-if="item1.pics != null && item1.pics.length > 0">
  84. <span v-for="(p, index) in item1.pics" :key="p" style="margin-right:10px;">
  85. <img :src="p" style="width:80px; height:80px;" @click="showLargeImg(item1.pics, index)"/>
  86. </span>
  87. </div>
  88. </div>
  89. <div class="form_btn" slot="footer">
  90. <van-button size="small" type="info" @click="approve(item.id, item)">通过</van-button>
  91. <van-button size="small" type="danger" @click="showDenyDialog(item.id,0,item.dateStr, item)">驳回</van-button>
  92. </div>
  93. <van-popup v-model="imgShow" position="bottom" closeable >
  94. <van-swipe class="my-swipe" indicator-color="white">
  95. <van-swipe-item v-for="(picItem, index) in tmpPics" :key="index">
  96. <img :src="picItem" style="width:100%;" />
  97. </van-swipe-item>
  98. </van-swipe>
  99. </van-popup>
  100. </van-panel>
  101. </van-skeleton>
  102. <van-popup v-model="denyReasonDialog" position="bottom" closeable >
  103. <van-cell>请输入原因</van-cell>
  104. <van-field class="form_input"
  105. v-model="denyForm.reason" name="reason" type="textarea" :placeholder="'请输入您决定'+(denyForm.i==0?'驳回':'撤销')+'的原因'"
  106. rows="3" autosize />
  107. <van-button style="width:100%;" type="info" @click="deny()">提交</van-button>
  108. </van-popup>
  109. </div>
  110. </div>
  111. </template>
  112. <script>
  113. export default {
  114. data() {
  115. return {
  116. isAllChecked: false,
  117. fullDayTxt:['全天','上午','下午'],
  118. denyForm:{reason:null},
  119. denyReasonDialog:false,
  120. tmpPics:[],
  121. imgShow: false,
  122. user: JSON.parse(localStorage.userInfo),
  123. minDate: new Date(2010, 0, 1),
  124. maxDate: new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()),
  125. currentDate: new Date(),
  126. nowTime: this.format(new Date(new Date()),"yyyy-MM-dd"),
  127. showPicker: false,
  128. report: [],
  129. flg: false,
  130. isCanAgree: false
  131. };
  132. },
  133. created() {
  134. },
  135. methods: {
  136. // 批量操作
  137. allChecked(){
  138. if(this.isAllChecked){
  139. for(let i in this.report){
  140. this.report[i].checked = true
  141. }
  142. this.isCanAgree = true
  143. }else{
  144. for(let i in this.report){
  145. this.report[i].checked = false
  146. }
  147. this.isCanAgree = false
  148. }
  149. },
  150. itemChecked(){
  151. let isall = true
  152. let iscan = false
  153. for(let i in this.report){
  154. if(!this.report[i].checked){
  155. isall = false
  156. }else {
  157. iscan = true
  158. }
  159. }
  160. this.isAllChecked = isall
  161. this.isCanAgree = iscan
  162. },
  163. batchAgree(bol){
  164. const toast = this.$toast.loading({
  165. forbidClick: true,
  166. duration: 0
  167. });
  168. let ids = ''
  169. for(let i in this.report){
  170. if(this.report[i].checked){
  171. for(let m in this.report[i].data){
  172. ids += this.report[i].data[m].id + ','
  173. }
  174. }
  175. }
  176. if(ids.length > 0){
  177. ids = ids.substring(0, ids.length-1);
  178. }
  179. let that = this
  180. this.$axios.post(bol?'/report/batchApproveReport':'/report/batchDenyReport', {
  181. ids: ids
  182. }).then(res => {
  183. if(res.code == "ok") {
  184. this.$toast.clear();
  185. setTimeout(function() {
  186. that.$toast.success('审核成功');
  187. }, 300);
  188. this.getReport();
  189. } else {
  190. this.$toast.clear();
  191. this.$toast.fail('批量操作失败:'+res.msg);
  192. }
  193. }).catch(err=> {this.$toast.clear();});
  194. },
  195. showLargeImg(item, index) {
  196. this.imgShow = true;
  197. this.tmpPics = item;
  198. },
  199. // 返回
  200. back() {
  201. history.back();
  202. },
  203. // 时间转换
  204. format(date, pattern) {
  205. pattern = pattern || "yyyy-MM-dd";
  206. var _this = this;
  207. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  208. switch ($0.charAt(0)) {
  209. case 'y': return _this.padding(date.getFullYear(), $0.length);
  210. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  211. case 'd': return _this.padding(date.getDate(), $0.length);
  212. case 'w': return date.getDay() + 1;
  213. case 'h': return _this.padding(date.getHours(), $0.length);
  214. case 'm': return _this.padding(date.getMinutes(), $0.length);
  215. case 's': return _this.padding(date.getSeconds(), $0.length);
  216. }
  217. });
  218. },
  219. padding(s, len) {
  220. var len = len - (s + '').length;
  221. for (var i = 0; i < len; i++) { s = '0' + s; }
  222. return s;
  223. },
  224. // 改变时间
  225. changeTime(time) {
  226. this.nowTime = this.format(new Date(time),"yyyy-MM-dd");
  227. this.currentDate = time;
  228. this.showPicker = false;
  229. this.getReport();
  230. },
  231. // 获取日报
  232. getReport() {
  233. const toast = this.$toast.loading({
  234. forbidClick: true,
  235. duration: 0
  236. });
  237. this.$axios.post("/report/listByState", {state: 0})
  238. .then(res => {
  239. if(res.code == "ok") {
  240. this.$toast.clear();
  241. this.report = res.data;
  242. for(let i in this.report){
  243. this.$set(this.report[i],'checked',false)
  244. }
  245. } else {
  246. this.$toast.clear();
  247. this.$toast.fail('获取失败:'+res.msg);
  248. }
  249. }).catch(err=> {this.$toast.clear();});
  250. },
  251. approve(id, item) {
  252. const toast = this.$toast.loading({
  253. forbidClick: true,
  254. duration: 0
  255. });
  256. var ids = '';
  257. var data = item.data;
  258. data.forEach(element => {
  259. if (element.id != null && element.id != '') {
  260. ids +=(element.id+',');
  261. }
  262. });
  263. let that = this;
  264. this.$axios.post("/report/approve", {id: id , date: this.nowTime, reportIds: ids})
  265. .then(res => {
  266. if(res.code == "ok") {
  267. this.$toast.clear();
  268. setTimeout(function() {
  269. that.$toast.success('审核成功');
  270. }, 300);
  271. this.getReport();
  272. } else {
  273. this.$toast.clear();
  274. setTimeout(function() {
  275. that.$toast.fail('审核失败');
  276. }, 300);
  277. }
  278. }).catch(err=> {this.$toast.clear();});
  279. },
  280. showDenyDialog(id,i,date, item) {
  281. console.log(id, i, date, item)
  282. this.denyReasonDialog = true;
  283. var ids = '';
  284. var data = item.data;
  285. data.forEach(element => {
  286. if (element.id != null && element.id != '') {
  287. ids +=(element.id+',');
  288. }
  289. });
  290. this.denyForm = {id: id ,i:i, date: date, reportIds: ids, reason:null};
  291. console.log(this.denyForm)
  292. },
  293. deny() {
  294. const toast = this.$toast.loading({
  295. forbidClick: true,
  296. duration: 0
  297. });
  298. let that = this;
  299. this.$axios.post("/report/deny", this.denyForm)
  300. .then(res => {
  301. if(res.code == "ok") {
  302. this.$toast.clear();
  303. setTimeout(function() {
  304. that.$toast.success(that.denyForm.i==0?'驳回成功':'撤销成功');
  305. }, 300);
  306. this.getReport();
  307. this.denyReasonDialog = false;
  308. } else {
  309. this.$toast.clear();
  310. setTimeout(function() {
  311. that.$toast.fail(that.denyForm.i==0?'驳回失败':'撤销失败');
  312. }, 300);
  313. }
  314. }).catch(err=> {this.$toast.clear();});
  315. }
  316. },
  317. mounted() {
  318. this.getReport();
  319. var list = this.user.functionList
  320. for(var i in list) {
  321. if(list[i].name == '审核全员日报') {
  322. this.flg = true
  323. }
  324. }
  325. }
  326. };
  327. </script>
  328. <style lang="less" scoped>
  329. .formBatch{
  330. position: fixed;
  331. bottom: 0;
  332. width: 100%;
  333. z-index: 2;
  334. background-color: #fff;
  335. display: flex;
  336. justify-content: space-between;
  337. align-items: center;
  338. height: 1.2rem;
  339. border-top: 1px solid #ebebeb;
  340. }
  341. .login_form {
  342. margin-top: 46px;
  343. padding-bottom: 1.2rem;
  344. }
  345. .one_report {
  346. margin-bottom: 15px;
  347. font-size:14px;
  348. }
  349. .form_text {
  350. margin: 10px 0 10px;
  351. padding: 0 12px;
  352. }
  353. .form_btn {
  354. text-align: right;
  355. }
  356. .form_btn button {
  357. margin-left: 10px;
  358. }
  359. .one_report_data {
  360. margin-bottom: 10px;
  361. padding: 0 22px;
  362. div {
  363. line-height: 30px;
  364. }
  365. }
  366. </style>
  367. <style lang="less">
  368. .van-nav-bar .van-icon , .van-nav-bar__text {
  369. color: #20a0ff;
  370. }
  371. // 显示加班样式
  372. .one_span {
  373. width: 40px;
  374. height: 25px;
  375. line-height: 25px;
  376. text-align: center;
  377. box-sizing: border-box;
  378. display: inline-block;
  379. border: 1px solid #fde2e2;
  380. background: #fef0f0;
  381. color: #f56c6c;
  382. font-size: 12px;
  383. border-radius: 5px;
  384. // margin-left: 40px;
  385. float: right;
  386. }
  387. </style>