index.vue 12 KB

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