index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <template>
  2. <div>
  3. <van-nav-bar title="审核日报" left-text="返回" @click-left="back" fixed left-arrow/>
  4. <div class="login_form">
  5. <van-sticky offset-top="1.22667rem" style="margin-bottom:10px">
  6. <van-cell title="选择日期" :value="selectDateValue" @click="selectShow = true" class="dateSelectCell">
  7. <template #extra>
  8. <van-icon v-if="selectDateValue" name="close" style="line-height:0.64rem;position:relative;left:5px;" @click.stop="selectDateClear"/>
  9. </template>
  10. </van-cell>
  11. <van-calendar v-model="selectShow" :min-date="minDate" type="range" @confirm="selectConfirm" />
  12. <van-cell title="选择人员" :value="userNameValue" @click="selectUserClick" value-class="userNameValue">
  13. <template #extra>
  14. <van-icon v-if="userNameValue" name="close" style="line-height:0.64rem;position:relative;left:5px;" @click.stop="selectUserClear"/>
  15. </template>
  16. <template #default>
  17. <span v-if="user.userNameNeedTranslate == '1'">
  18. <span v-for="item,index in userNameValue.split(',')" :key="item">
  19. <TranslationOpenDataText type='userName' :openid='item'></TranslationOpenDataText>
  20. <span v-if="index != (userNameValue.split(',').length - 1)">,</span>
  21. </span>
  22. </span>
  23. <span v-else>{{userNameValue}}</span>
  24. </template>
  25. </van-cell>
  26. <van-popup v-model="selectUserShow" position="bottom" style="height: 90%">
  27. <!-- <van-search v-model="searchInputValue" placeholder="输入员工姓名搜索" @search="userListSearch" v-if="user.userNameNeedTranslate != '1'"></van-search>
  28. <div style="minHeight:300px;">
  29. <template v-if="user.userNameNeedTranslate == '1'">
  30. <van-checkbox class="userCheckbox" v-for="(item) in showUserList" :key="item.id" v-model="item.isChecked" >
  31. <TranslationOpenDataText type='userName' :openid='item.name'></TranslationOpenDataText>
  32. </van-checkbox>
  33. </template>
  34. <template v-else>
  35. <van-checkbox class="userCheckbox" v-for="(item) in showUserList" :key="item.id" v-model="item.isChecked" >
  36. <span>{{item.name}}</span>
  37. </van-checkbox>
  38. </template>
  39. <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;" @click="selectUserConfirm()">确定</van-button>
  40. </div> -->
  41. <div class="popupDiv">
  42. <div class="popupSearch" v-if="user.userNameNeedTranslate != '1'">
  43. <van-search v-model="searchInputValue" placeholder="输入员工姓名搜索" @search="userListSearch" shape="round" background="#F4F4F4"></van-search>
  44. </div>
  45. <div class="popupCon conBorder">
  46. <div class="popupConBox" v-if="user.userNameNeedTranslate == '1'">
  47. <van-checkbox class="popupItem marginNone borderNone" v-for="(item) in showUserList" :key="item.id" v-model="item.isChecked" >
  48. <span class="userNameClass_left">
  49. <TranslationOpenDataText type='userName' :openid='item.name'></TranslationOpenDataText>
  50. </span>
  51. <span class="userNameClass_right">
  52. {{ item.jobNumber }}
  53. </span>
  54. </van-checkbox>
  55. </div>
  56. <div class="popupConBox" v-else>
  57. <van-checkbox class="popupItem marginNone borderNone" v-for="(item) in showUserList" :key="item.id" v-model="item.isChecked" >
  58. <span class="userNameClass_left">{{item.name}}</span>
  59. <span class="userNameClass_right">{{ item.jobNumber }}</span>
  60. </van-checkbox>
  61. </div>
  62. </div>
  63. <div class="popupBtn">
  64. <van-button style="width:100%;background: #1989fa;color: #ffffff;" round @click="selectUserConfirm()">确定</van-button>
  65. </div>
  66. </div>
  67. </van-popup>
  68. </van-sticky>
  69. <div class="formBatch">
  70. <van-checkbox v-model="isAllChecked" :disabled="report.length == 0" @click="allChecked" shape="square" style="padding-left:3vw"></van-checkbox>
  71. <div style="padding:1vh 2vw">
  72. <van-button @click="batchAgree(true)" :disabled="!isCanAgree || report.length == 0" type="info" size="small" style="margin-right:6vw">批量通过</van-button>
  73. <van-button @click="showBatchDenyDialog()" :disabled="!isCanAgree || report.length == 0" type="danger" size="small" style="margin-left:2vw">批量驳回</van-button>
  74. </div>
  75. </div>
  76. <van-skeleton v-for="(item,index) in report" :key="index" title avatar :row="3" :loading="false">
  77. <van-panel class="one_report">
  78. <template #header>
  79. <div class="van-cell van-panel__header">
  80. <div class="van-cell__title" style="display:flex;algin-items:center">
  81. <van-checkbox v-model="item.checked" @click="itemChecked" shape="square" style="margin-right:2vw"></van-checkbox>
  82. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName' :openid='item.name'></TranslationOpenDataText></span>
  83. <span v-else>{{item.name}}</span>
  84. </div>
  85. <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>
  86. </div>
  87. </template>
  88. <div class="form_text">
  89. <span style="margin-left:5px;">工作日期: {{item.dateStr}}</span>
  90. <span style="float:right;">
  91. <i v-if="parseFloat(item.reportTime)>parseFloat(item.calculateTime)+0.5" style="color:red;margin-right:8px;" class="fa fa-exclamation-triangle"></i>
  92. 总填报:
  93. <span :style="parseFloat(item.reportTime)>parseFloat(item.calculateTime)+0.5?'color:red':''">{{item.reportTime}}h</span>
  94. </span>
  95. <!-- <span>系统智能统计:{{item.calculateTime}}h</span> -->
  96. </div>
  97. <div v-for="(item1,index1) in item.data" :key="index1" class="one_report_data">
  98. <div class="project_title">项目:{{item1.project}}
  99. [
  100. <span v-if="user.timeType.reportAuditType == 7" >
  101. 审核人:<span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  102. :openid='item1.projectAuditorName'></TranslationOpenDataText><span v-if="item1.projectAuditState==1">√</span><span v-if="item1.deptAuditorName">、</span>
  103. <TranslationOpenDataText type='userName'
  104. :openid='item1.deptAuditorName'></TranslationOpenDataText><span v-if="item1.departmentAuditState==1">√</span>
  105. </span>
  106. <span v-else>{{ item1.projectAuditorName }}<span v-if="item1.projectAuditState==1">√</span><span v-if="item1.deptAuditorName">、</span>{{ item1.deptAuditorName }}<span v-if="item1.departmentAuditState==1">√</span></span>
  107. </span>
  108. <span v-else>
  109. <span v-if="item1.isDeptAudit==0">
  110. <span v-if="item1.projectAuditState==0">
  111. 待项目审核人<span v-if="item1.projectAuditorName != null">(
  112. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName' :openid='item1.projectAuditorName'></TranslationOpenDataText></span>
  113. <span v-else>{{item1.projectAuditorName}}</span>
  114. )</span>审核
  115. </span>
  116. <span style="color:#32CD32;" v-else-if="item1.projectAuditState==1">
  117. 项目审核人<span v-if="item1.projectAuditorName != null">(
  118. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName' :openid='item1.projectAuditorName'></TranslationOpenDataText></span>
  119. <span v-else>{{item1.projectAuditorName}}</span>
  120. )</span>审核通过
  121. </span>
  122. </span>
  123. <span v-else-if="item1.isDeptAudit==1">
  124. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='departmentName' :openid='item1.auditDeptName'></TranslationOpenDataText></span>
  125. <span v-else>{{item1.auditDeptName}}</span>
  126. 审核
  127. </span>
  128. </span>
  129. ]
  130. </div>
  131. <div class="project_title" v-if="item1.projectCode != null" >{{ user.companyId == '7030' ? '项目令号' : '项目编号' }}:{{item1.projectCode}}</div>
  132. <div class="project_title" v-if="item1.subProjectName != null && user.companyId != yuzhongCompId" >子项目:{{item1.subProjectName}}</div>
  133. <div class="project_title" v-if="user.companyId == yuzhongCompId" >角色:{{item1.extraField1?roleList.find(r=>r.value==item1.extraField1).label:''}}</div>
  134. <div class="project_title" v-if="user.company.packageProject==1&&item1.groupName != null" >任务分组:{{item1.groupName}}</div>
  135. <div class="project_title" v-if="user.companyId == yuzhongCompId" >工作职责:{{item1.extraField2?item1.extraField2Name:''}}</div>
  136. <div class="project_title" v-if="user.companyId == yuzhongCompId" >工作内容:{{item1.extraField3?item1.extraField3Name:''}}</div>
  137. <div class="project_title" v-if="user.company.packageProject==1&&item1.stage != '-' && user.companyId != yuzhongCompId" >投入阶段:{{item1.stage}}</div>
  138. <!--自定义维度 -->
  139. <div class="project_title" v-if="user.timeType.customDegreeActive == 1" >{{user.timeType.customDegreeName}}:{{item1.degreeName}}</div>
  140. <div class="project_title" v-if="user.timeType.customDataActive == 1" >{{user.timeType.customDataName}}:{{item1.customData}}</div>
  141. <div class="project_title" v-if="user.timeType.customTextActive == 1" >{{user.timeType.customTextName}}:{{item1.customText}}</div>
  142. <div class="project_title" v-if="user.company.packageEngineering == 1">
  143. 专业进度:
  144. <span style="margin-right:10px;" v-for="progressItem in item1.professionProgressList" :key="progressItem.id">{{progressItem.professionName}}({{progressItem.progress}}%)
  145. </span>
  146. </div>
  147. <div class="project_title" v-if="item1.taskId != null" >任务:{{item1.taskName}}</div>
  148. <!--根据类型选择使用的模板 -->
  149. <div v-if="item1.multiWorktime == 0">
  150. <div class="project_time">时长:
  151. <span v-if="item1.reportTimeType == 0" style="margin-right:10px;">{{fullDayTxt[item1.timeType]}}</span>
  152. <span v-if="item1.reportTimeType == 2" style="margin-right:10px;">{{item1.startTime+'-'+item1.endTime}}</span>{{item1.time.toFixed(1)}}h
  153. <div class="button" v-if="item1.isOvertime == 1">加班<span v-if="item1.overtimeHours">{{item1.overtimeHours.toFixed(1)}}h</span></div>
  154. </div>
  155. <div class="project_content">事项:<span v-html="item1.content"></span></div>
  156. </div>
  157. <div v-if="item1.multiWorktime == 1">
  158. <div>
  159. 项目时长:<span style="margin-right:10px;">{{item1.time.toFixed(1)}}h</span>
  160. <div class="button" v-if="item1.isOvertime == 1" style="width: 2.3rem">加班<span v-if="item1.overtimeHours">{{item1.overtimeHours.toFixed(1)}}h</span></div>
  161. </div>
  162. <div style="position:relative;border:#ccc 0.5px solid;padding:3px;margin:5px 0px;" v-for="(timeItem, index) in item1.worktimeList" :key="index" >
  163. <div class="project_time">时长:
  164. <!-- <span v-if="timeItem.reportTimeType == 0" style="margin-right:10px;">{{fullDayTxt[item1.timeType]}}</span> -->
  165. <span style="margin-right:10px;">{{timeItem.startTime+'-'+timeItem.endTime}}</span>{{timeItem.time.toFixed(1)}}h
  166. </div>
  167. <div class="project_content">事项:<span v-html="timeItem.content"></span></div>
  168. </div>
  169. </div>
  170. <div style="padding:5px;text-align:center;" v-if="item1.pics != null && item1.pics.length > 0">
  171. <span v-for="(p, index) in item1.pics" :key="p" style="margin-right:10px;">
  172. <img :src="p" style="width:80px; height:80px;" @click="showLargeImg(item1.pics, index)"/>
  173. </span>
  174. </div>
  175. </div>
  176. <div class="form_btn" slot="footer">
  177. <van-button size="small" type="info" @click="approve(item.userId, item)" style="margin-right: 4vw;">通过</van-button>
  178. <van-button size="small" type="danger" @click="showDenyDialog(item.userId,0,item.dateStr, item)">驳回</van-button>
  179. </div>
  180. <van-popup v-model="imgShow" position="bottom" closeable >
  181. <van-swipe class="my-swipe" indicator-color="white">
  182. <van-swipe-item v-for="(picItem, index) in tmpPics" :key="index">
  183. <img :src="picItem" style="width:100%;" />
  184. </van-swipe-item>
  185. </van-swipe>
  186. </van-popup>
  187. </van-panel>
  188. </van-skeleton>
  189. <van-popup v-model="denyReasonDialog" position="bottom" closeable >
  190. <van-cell>请输入原因</van-cell>
  191. <van-field class="form_input"
  192. v-model="denyForm.reason" name="reason" type="textarea" :placeholder="'请输入您决定'+(denyForm.i==0?'驳回':'撤销')+'的原因'"
  193. rows="3" autosize />
  194. <van-button style="width:100%;" type="info" @click="deny()" :disabled="this.user.timeType.forceRejectReason && !denyForm.reason">提交</van-button>
  195. </van-popup>
  196. <van-popup v-model="approveinDialog" v-if="approveinDialog" position="bottom" closeable >
  197. <van-cell>请输入通过评价</van-cell>
  198. <van-field class="form_input"
  199. v-model="approveinData.evaluate" name="reason" type="textarea" placeholder="请输入您决定通过的评价"
  200. rows="3" autosize />
  201. <van-button style="width:100%;" type="info" @click="batchApproveinfun()" v-if="isbatch">提交</van-button>
  202. <van-button style="width:100%;" type="info" @click="approveinfun()" v-else>提交</van-button>
  203. </van-popup>
  204. </div>
  205. </div>
  206. </template>
  207. <script>
  208. import { Dialog } from 'vant';
  209. export default {
  210. data() {
  211. return {
  212. isBatchDeny: false,
  213. yuzhongCompId: 3385,
  214. roleList:[{value: 1,label: 'CRC&LM'},{value: 2,label: 'PM'}],
  215. isAllChecked: false,
  216. fullDayTxt:['全天','上午','下午'],
  217. denyForm:{reason:null},
  218. denyReasonDialog:false,
  219. tmpPics:[],
  220. imgShow: false,
  221. user: JSON.parse(localStorage.userInfo),
  222. minDate: new Date(2010, 0, 1),
  223. maxDate: new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()),
  224. currentDate: new Date(),
  225. nowTime: this.format(new Date(new Date()),"yyyy-MM-dd"),
  226. showPicker: false,
  227. report: [],
  228. flg: false,
  229. isCanAgree: false,
  230. approveinData: null,
  231. approveinDialog: false,
  232. isbatch: false,
  233. selectDate: [],
  234. selectDateValue: '',
  235. selectShow: false,
  236. userList: [],
  237. showUserList: [],
  238. userIdList: [],
  239. userNameValue: '',
  240. searchInputValue: '',
  241. selectUserShow: false
  242. };
  243. },
  244. created() {
  245. },
  246. methods: {
  247. selectDateClear(){
  248. this.selectDate = []
  249. this.selectDateValue = ''
  250. this.getReport()
  251. },
  252. selectUserClear(){
  253. this.userNameValue = ''
  254. this.userIdList = []
  255. this.userList.forEach(item => {delete item.isChecked})
  256. this.showUserList = this.userList
  257. this.getReport()
  258. },
  259. selectUserClick(){
  260. this.selectUserShow = true
  261. this.searchInputValue = ''
  262. this.showUserList = this.userList
  263. },
  264. selectConfirm(date){
  265. const [start, end] = date;
  266. this.selectShow = false;
  267. this.selectDate = [this.getSelectDateStr(start),this.getSelectDateStr(end)]
  268. this.selectDateValue = `${this.selectDate[0]} 至 ${this.selectDate[1]}`;
  269. this.getReport()
  270. },
  271. getSelectDateStr(date){
  272. return `${date.getFullYear()}-${(date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)}-${date.getDate() < 10 ? '0' + date.getDate() : date.getDate()}`;
  273. },
  274. userListSearch(val) {
  275. this.showUserList = [];
  276. this.userList.forEach(u=>{if (u.name.startsWith(val)) {
  277. this.showUserList.push(u);
  278. }})
  279. },
  280. selectUserConfirm(){
  281. this.userNameValue = '';
  282. var that = this;
  283. that.userIdList = '';
  284. this.userList.filter(u=>u.isChecked).forEach(u=>{
  285. that.userNameValue += (u.name+',');
  286. that.userIdList += u.id + ','
  287. });
  288. if (this.userNameValue.length > 0) {
  289. this.userNameValue = this.userNameValue.substring(0, this.userNameValue.length-1);
  290. this.userIdList = this.userIdList.substring(0, this.userIdList.length-1);
  291. }
  292. this.$forceUpdate()
  293. this.selectUserShow = false
  294. this.getReport()
  295. },
  296. getUsers() {
  297. this.$axios.post("/user/getEmployeeList", {
  298. departmentId: -1,
  299. pageIndex: 1,
  300. // pageSize: 99999
  301. pageSize: -1
  302. })
  303. .then(res => {
  304. if(res.code == "ok") {
  305. this.userList = res.data.records;
  306. this.showUserList = res.data.records
  307. } else {
  308. this.$toast.fail('获取失败');
  309. }
  310. }).catch(err=> {this.$toast.clear();});
  311. },
  312. // 批量操作
  313. allChecked(){
  314. if(this.isAllChecked){
  315. for(let i in this.report){
  316. this.report[i].checked = true
  317. }
  318. this.isCanAgree = true
  319. }else{
  320. for(let i in this.report){
  321. this.report[i].checked = false
  322. }
  323. this.isCanAgree = false
  324. }
  325. },
  326. itemChecked(){
  327. let isall = true
  328. let iscan = false
  329. for(let i in this.report){
  330. if(!this.report[i].checked){
  331. isall = false
  332. }else {
  333. iscan = true
  334. }
  335. }
  336. this.isAllChecked = isall
  337. this.isCanAgree = iscan
  338. },
  339. batchAgree(bol){
  340. let ids = ''
  341. for(let i in this.report){
  342. if(this.report[i].checked){
  343. for(let m in this.report[i].data){
  344. ids += this.report[i].data[m].id + ','
  345. }
  346. }
  347. }
  348. if(ids.length > 0){
  349. ids = ids.substring(0, ids.length-1);
  350. }
  351. if(bol){
  352. Dialog.confirm({
  353. message: `确认批量通过这些的日报吗?`
  354. })
  355. .then(() => {
  356. this.isbatch = true
  357. this.approveinData = {
  358. ids: ids
  359. }
  360. if(this.user.timeType.needEvaluate == 1){
  361. this.$set(this.approveinData,'evaluate','')
  362. this.approveinDialog = true
  363. }else{
  364. const toast = this.$toast.loading({
  365. forbidClick: true,
  366. duration: 0
  367. });
  368. this.batchApproveinfun()
  369. }
  370. })
  371. .catch(() => {});
  372. }
  373. },
  374. batchApproveinfun(){
  375. let that = this
  376. this.$axios.post('/report/batchApproveReport', this.approveinData)
  377. .then(res => {
  378. if(res.code == "ok") {
  379. this.$toast.clear();
  380. setTimeout(function() {
  381. that.$toast.success('审核成功');
  382. }, 300);
  383. this.approveinDialog = false
  384. this.getReport();
  385. } else {
  386. this.$toast.clear();
  387. this.$toast.fail('批量操作失败:'+res.msg);
  388. }
  389. }).catch(err=> {this.$toast.clear();});
  390. },
  391. showLargeImg(item, index) {
  392. this.imgShow = true;
  393. this.tmpPics = item;
  394. },
  395. // 返回
  396. back() {
  397. history.back();
  398. },
  399. // 时间转换
  400. format(date, pattern) {
  401. pattern = pattern || "yyyy-MM-dd";
  402. var _this = this;
  403. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  404. switch ($0.charAt(0)) {
  405. case 'y': return _this.padding(date.getFullYear(), $0.length);
  406. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  407. case 'd': return _this.padding(date.getDate(), $0.length);
  408. case 'w': return date.getDay() + 1;
  409. case 'h': return _this.padding(date.getHours(), $0.length);
  410. case 'm': return _this.padding(date.getMinutes(), $0.length);
  411. case 's': return _this.padding(date.getSeconds(), $0.length);
  412. }
  413. });
  414. },
  415. padding(s, len) {
  416. var len = len - (s + '').length;
  417. for (var i = 0; i < len; i++) { s = '0' + s; }
  418. return s;
  419. },
  420. // 改变时间
  421. changeTime(time) {
  422. this.nowTime = this.format(new Date(time),"yyyy-MM-dd");
  423. this.currentDate = time;
  424. this.showPicker = false;
  425. this.getReport();
  426. },
  427. // 获取日报
  428. getReport() {
  429. const toast = this.$toast.loading({
  430. forbidClick: true,
  431. duration: 0
  432. });
  433. let parameter = {
  434. state: 0
  435. }
  436. if(this.selectDate.length != 0){
  437. parameter.startDate = this.selectDate[0]
  438. parameter.endDate = this.selectDate[1]
  439. }
  440. if(this.userIdList){
  441. parameter.userId = this.userIdList
  442. }
  443. this.$axios.post("/report/listByState", parameter)
  444. .then(res => {
  445. if(res.code == "ok") {
  446. this.$toast.clear();
  447. this.report = res.data;
  448. // this.isAllChecked = this.report.length == 0 ? false : true
  449. if(this.report.length == 0){
  450. this.isAllChecked = false
  451. }
  452. for(let i in this.report){
  453. this.$set(this.report[i],'checked',false)
  454. }
  455. } else {
  456. this.$toast.clear();
  457. this.$toast.fail('获取失败:'+res.msg);
  458. }
  459. }).catch(err=> {this.$toast.clear();});
  460. },
  461. approve(id, item) {
  462. Dialog.confirm({
  463. message: `确认通过${item.dateStr}的日报吗?`
  464. })
  465. .then(() => {
  466. var ids = '';
  467. var data = item.data;
  468. data.forEach(element => {
  469. if (element.id != null && element.id != '') {
  470. ids +=(element.id+',');
  471. }
  472. });
  473. this.isbatch = false
  474. this.approveinData = {
  475. id: id,
  476. date: this.nowTime,
  477. reportIds: ids
  478. }
  479. if(this.user.timeType.needEvaluate == 1){
  480. this.$set(this.approveinData,'evaluate','')
  481. this.approveinDialog = true
  482. }else{
  483. const toast = this.$toast.loading({
  484. forbidClick: true,
  485. duration: 0
  486. });
  487. this.approveinfun()
  488. }
  489. })
  490. .catch(() => {});
  491. },
  492. approveinfun(){
  493. let that = this;
  494. this.$axios.post("/report/approve", this.approveinData)
  495. .then(res => {
  496. if(res.code == "ok") {
  497. this.$toast.clear();
  498. setTimeout(function() {
  499. that.$toast.success('审核成功');
  500. }, 300);
  501. this.approveinDialog = false
  502. this.getReport();
  503. } else {
  504. this.$toast.clear();
  505. setTimeout(function() {
  506. that.$toast.fail('审核失败');
  507. }, 300);
  508. }
  509. }).catch(err=> {this.$toast.clear();});
  510. },
  511. showDenyDialog(id,i,date, item) {
  512. this.denyReasonDialog = true;
  513. this.isBatchDeny = false;
  514. var ids = '';
  515. var data = item.data;
  516. data.forEach(element => {
  517. if (element.id != null && element.id != '') {
  518. ids +=(element.id+',');
  519. }
  520. });
  521. this.denyForm = {id: id ,i:i, date: date, reportIds: ids, reason:null};
  522. },
  523. showBatchDenyDialog() {
  524. this.isBatchDeny = true;
  525. let ids = ''
  526. for(let i in this.report){
  527. if(this.report[i].checked){
  528. for(let m in this.report[i].data){
  529. ids += this.report[i].data[m].id + ','
  530. }
  531. }
  532. }
  533. if(ids.length > 0){
  534. ids = ids.substring(0, ids.length-1);
  535. }
  536. this.denyForm = {reportIds: ids, reason:null};
  537. this.denyReasonDialog = true;
  538. },
  539. deny() {
  540. const toast = this.$toast.loading({
  541. forbidClick: true,
  542. duration: 0
  543. });
  544. let that = this;
  545. if (this.isBatchDeny) {
  546. this.$axios.post('/report/batchDenyReport', {
  547. ids: this.denyForm.reportIds
  548. }).then(res => {
  549. if(res.code == "ok") {
  550. this.$toast.clear();
  551. setTimeout(function() {
  552. that.$toast.success('审核成功');
  553. }, 300);
  554. that.getReport();
  555. that.denyReasonDialog = false;
  556. } else {
  557. that.$toast.clear();
  558. that.$toast.fail('批量操作失败:'+res.msg);
  559. }
  560. }).catch(err=> {this.$toast.clear();});
  561. } else {
  562. this.$axios.post("/report/deny", this.denyForm)
  563. .then(res => {
  564. if(res.code == "ok") {
  565. this.$toast.clear();
  566. setTimeout(function() {
  567. that.$toast.success(that.denyForm.i==0?'驳回成功':'撤销成功');
  568. }, 300);
  569. this.getReport();
  570. this.denyReasonDialog = false;
  571. } else {
  572. this.$toast.clear();
  573. setTimeout(function() {
  574. that.$toast.fail(that.denyForm.i==0?'驳回失败':'撤销失败');
  575. }, 300);
  576. }
  577. }).catch(err=> {this.$toast.clear();});
  578. }
  579. }
  580. },
  581. mounted() {
  582. this.getReport();
  583. this.getUsers()
  584. var list = this.user.functionList
  585. for(var i in list) {
  586. if(list[i].name == '审核全员日报') {
  587. this.flg = true
  588. }
  589. }
  590. }
  591. };
  592. </script>
  593. <style lang="less" scoped>
  594. .dateSelectCell{
  595. display: -webkit-box;
  596. }
  597. .userCheckbox {
  598. padding: 10px;;
  599. }
  600. .userNameValue{
  601. white-space: nowrap;
  602. text-overflow: ellipsis;
  603. }
  604. .formBatch{
  605. position: fixed;
  606. bottom: 0;
  607. width: 100%;
  608. z-index: 2;
  609. background-color: #fff;
  610. display: flex;
  611. justify-content: space-between;
  612. align-items: center;
  613. height: 1.2rem;
  614. border-top: 1px solid #ebebeb;
  615. }
  616. .login_form {
  617. margin-top: 46px;
  618. margin-bottom: 65px;
  619. }
  620. .one_report {
  621. margin-bottom: 15px;
  622. font-size:14px;
  623. }
  624. .form_text {
  625. margin: 10px 0 10px;
  626. padding: 0 12px;
  627. }
  628. .form_btn {
  629. text-align: right;
  630. }
  631. .form_btn button {
  632. margin-left: 10px;
  633. }
  634. .one_report_data {
  635. margin-bottom: 10px;
  636. padding: 0 22px;
  637. div {
  638. line-height: 30px;
  639. }
  640. }
  641. </style>
  642. <style lang="less">
  643. .van-nav-bar .van-icon , .van-nav-bar__text {
  644. color: #20a0ff;
  645. }
  646. // 显示加班样式
  647. .one_span {
  648. width: 40px;
  649. height: 25px;
  650. line-height: 25px;
  651. text-align: center;
  652. box-sizing: border-box;
  653. display: inline-block;
  654. border: 1px solid #fde2e2;
  655. background: #fef0f0;
  656. color: #f56c6c;
  657. font-size: 12px;
  658. border-radius: 5px;
  659. // margin-left: 40px;
  660. float: right;
  661. }
  662. </style>