index.vue 15 KB

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