index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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="(flg || user.id == item.data[0].projectAuditorId)&&item.state == 0" size="small" type="info" @click="approve(item.id, item)">通过</van-button>
  75. <van-button v-if="(flg || user.id == item.data[0].projectAuditorId)&&item.state == 0" size="small" type="danger" @click="showDenyDialog(item.id,0,item.dateStr, item)">驳回</van-button>
  76. <van-button v-if="(flg || 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. flg: false
  114. };
  115. },
  116. created() {
  117. },
  118. methods: {
  119. showLargeImg(item, index) {
  120. this.imgShow = true;
  121. this.tmpPics = item;
  122. },
  123. // 返回
  124. back() {
  125. history.back();
  126. },
  127. // 时间转换
  128. format(date, pattern) {
  129. pattern = pattern || "yyyy-MM-dd";
  130. var _this = this;
  131. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  132. switch ($0.charAt(0)) {
  133. case 'y': return _this.padding(date.getFullYear(), $0.length);
  134. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  135. case 'd': return _this.padding(date.getDate(), $0.length);
  136. case 'w': return date.getDay() + 1;
  137. case 'h': return _this.padding(date.getHours(), $0.length);
  138. case 'm': return _this.padding(date.getMinutes(), $0.length);
  139. case 's': return _this.padding(date.getSeconds(), $0.length);
  140. }
  141. });
  142. },
  143. padding(s, len) {
  144. var len = len - (s + '').length;
  145. for (var i = 0; i < len; i++) { s = '0' + s; }
  146. return s;
  147. },
  148. // 改变时间
  149. changeTime(time) {
  150. this.nowTime = this.format(new Date(time),"yyyy-MM-dd");
  151. this.currentDate = time;
  152. this.showPicker = false;
  153. this.getReport();
  154. },
  155. // 获取日报
  156. getReport() {
  157. const toast = this.$toast.loading({
  158. forbidClick: true,
  159. duration: 0
  160. });
  161. this.$axios.post("/report/listByState", {state: 0})
  162. .then(res => {
  163. if(res.code == "ok") {
  164. toast.clear();
  165. this.report = res.data;
  166. } else {
  167. toast.clear();
  168. this.$toast.fail('获取失败:'+res.msg);
  169. }
  170. }).catch(err=> {toast.clear();});
  171. },
  172. approve(id, item) {
  173. const toast = this.$toast.loading({
  174. forbidClick: true,
  175. duration: 0
  176. });
  177. var ids = '';
  178. var data = item.data;
  179. data.forEach(element => {
  180. if (element.id != null && element.id != '') {
  181. ids +=(element.id+',');
  182. }
  183. });
  184. let that = this;
  185. this.$axios.post("/report/approve", {id: id , date: this.nowTime, reportIds: ids})
  186. .then(res => {
  187. if(res.code == "ok") {
  188. toast.clear();
  189. setTimeout(function() {
  190. that.$toast.success('审核成功');
  191. }, 300);
  192. this.getReport();
  193. } else {
  194. toast.clear();
  195. setTimeout(function() {
  196. that.$toast.fail('审核失败');
  197. }, 300);
  198. }
  199. }).catch(err=> {toast.clear();});
  200. },
  201. showDenyDialog(id,i,date, item) {
  202. console.log(id, i, date, item)
  203. this.denyReasonDialog = true;
  204. var ids = '';
  205. var data = item.data;
  206. data.forEach(element => {
  207. if (element.id != null && element.id != '') {
  208. ids +=(element.id+',');
  209. }
  210. });
  211. this.denyForm = {id: id ,i:i, date: date, reportIds: ids, reason:null};
  212. console.log(this.denyForm)
  213. },
  214. deny() {
  215. const toast = this.$toast.loading({
  216. forbidClick: true,
  217. duration: 0
  218. });
  219. let that = this;
  220. this.$axios.post("/report/deny", this.denyForm)
  221. .then(res => {
  222. if(res.code == "ok") {
  223. toast.clear();
  224. setTimeout(function() {
  225. that.$toast.success(that.denyForm.i==0?'驳回成功':'撤销成功');
  226. }, 300);
  227. this.getReport();
  228. this.denyReasonDialog = false;
  229. } else {
  230. toast.clear();
  231. setTimeout(function() {
  232. that.$toast.fail(that.denyForm.i==0?'驳回失败':'撤销失败');
  233. }, 300);
  234. }
  235. }).catch(err=> {toast.clear();});
  236. }
  237. },
  238. mounted() {
  239. this.getReport();
  240. var list = this.user.functionList
  241. for(var i in list) {
  242. if(list[i].name == '审核全员日报') {
  243. this.flg = true
  244. }
  245. }
  246. }
  247. };
  248. </script>
  249. <style lang="less" scoped>
  250. .login_form {
  251. margin-top: 46px;
  252. }
  253. .one_report {
  254. margin-bottom: 15px;
  255. font-size:14px;
  256. }
  257. .form_text {
  258. margin: 10px 0 10px;
  259. padding: 0 12px;
  260. }
  261. .form_btn {
  262. text-align: right;
  263. }
  264. .form_btn button {
  265. margin-left: 10px;
  266. }
  267. .one_report_data {
  268. margin-bottom: 10px;
  269. padding: 0 22px;
  270. div {
  271. line-height: 30px;
  272. }
  273. }
  274. </style>
  275. <style lang="less">
  276. .van-nav-bar .van-icon , .van-nav-bar__text {
  277. color: #20a0ff;
  278. }
  279. // 显示加班样式
  280. .one_span {
  281. width: 40px;
  282. height: 25px;
  283. line-height: 25px;
  284. text-align: center;
  285. box-sizing: border-box;
  286. display: inline-block;
  287. border: 1px solid #fde2e2;
  288. background: #fef0f0;
  289. color: #f56c6c;
  290. font-size: 12px;
  291. border-radius: 5px;
  292. // margin-left: 40px;
  293. float: right;
  294. }
  295. </style>