index.vue 14 KB

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