index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  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. <span style="margin-left:5px;" v-if="timeItem.detail">{{ timeItem.detail }}</span>
  167. </div>
  168. <div class="project_content">事项:<span v-html="timeItem.content"></span></div>
  169. </div>
  170. </div>
  171. <div style="padding:5px;text-align:center;" v-if="item1.pics != null && item1.pics.length > 0">
  172. <span v-for="(p, index) in item1.pics" :key="p" style="margin-right:10px;">
  173. <img :src="p" style="width:80px; height:80px;" @click="showLargeImg(item1.pics, index)"/>
  174. </span>
  175. </div>
  176. </div>
  177. <div class="form_btn" slot="footer">
  178. <van-button size="small" type="info" @click="approve(item.userId, item)" style="margin-right: 4vw;">通过</van-button>
  179. <van-button size="small" type="danger" @click="showDenyDialog(item.userId,0,item.dateStr, item)">驳回</van-button>
  180. </div>
  181. <van-popup v-model="imgShow" position="bottom" closeable >
  182. <van-swipe class="my-swipe" indicator-color="white">
  183. <van-swipe-item v-for="(picItem, index) in tmpPics" :key="index">
  184. <img :src="picItem" style="width:100%;" />
  185. </van-swipe-item>
  186. </van-swipe>
  187. </van-popup>
  188. </van-panel>
  189. </van-skeleton>
  190. <van-popup v-model="denyReasonDialog" position="bottom" closeable >
  191. <van-cell>请输入原因</van-cell>
  192. <van-field class="form_input"
  193. v-model="denyForm.reason" name="reason" type="textarea" :placeholder="'请输入您决定'+(denyForm.i==0?'驳回':'撤销')+'的原因'"
  194. rows="3" autosize />
  195. <van-button style="width:100%;" type="info" @click="deny()" :disabled="(Boolean(user.timeType.forceRejectReason) && !denyForm.reason)">提交</van-button>
  196. </van-popup>
  197. <van-popup v-model="approveinDialog" v-if="approveinDialog" position="bottom" closeable >
  198. <van-cell>请输入通过评价</van-cell>
  199. <van-field class="form_input"
  200. v-model="approveinData.evaluate" name="reason" type="textarea" placeholder="请输入您决定通过的评价"
  201. rows="3" autosize />
  202. <van-button style="width:100%;" type="info" @click="batchApproveinfun()" v-if="isbatch">提交</van-button>
  203. <van-button style="width:100%;" type="info" @click="approveinfun()" v-else>提交</van-button>
  204. </van-popup>
  205. </div>
  206. </div>
  207. </template>
  208. <script>
  209. import { Dialog } from 'vant';
  210. export default {
  211. data() {
  212. return {
  213. isBatchDeny: false,
  214. yuzhongCompId: 3385,
  215. roleList:[{value: 1,label: 'CRC&LM'},{value: 2,label: 'PM'}],
  216. isAllChecked: false,
  217. fullDayTxt:['全天','上午','下午'],
  218. denyForm:{reason:null},
  219. denyReasonDialog:false,
  220. tmpPics:[],
  221. imgShow: false,
  222. user: JSON.parse(localStorage.userInfo),
  223. minDate: new Date(2010, 0, 1),
  224. maxDate: new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()),
  225. currentDate: new Date(),
  226. nowTime: this.format(new Date(new Date()),"yyyy-MM-dd"),
  227. showPicker: false,
  228. report: [],
  229. flg: false,
  230. isCanAgree: false,
  231. approveinData: null,
  232. approveinDialog: false,
  233. isbatch: false,
  234. selectDate: [],
  235. selectDateValue: '',
  236. selectShow: false,
  237. userList: [],
  238. showUserList: [],
  239. userIdList: [],
  240. userNameValue: '',
  241. searchInputValue: '',
  242. selectUserShow: false
  243. };
  244. },
  245. created() {
  246. },
  247. methods: {
  248. selectDateClear(){
  249. this.selectDate = []
  250. this.selectDateValue = ''
  251. this.getReport()
  252. },
  253. selectUserClear(){
  254. this.userNameValue = ''
  255. this.userIdList = []
  256. this.userList.forEach(item => {delete item.isChecked})
  257. this.showUserList = this.userList
  258. this.getReport()
  259. },
  260. selectUserClick(){
  261. this.selectUserShow = true
  262. this.searchInputValue = ''
  263. this.showUserList = this.userList
  264. },
  265. selectConfirm(date){
  266. const [start, end] = date;
  267. this.selectShow = false;
  268. this.selectDate = [this.getSelectDateStr(start),this.getSelectDateStr(end)]
  269. this.selectDateValue = `${this.selectDate[0]} 至 ${this.selectDate[1]}`;
  270. this.getReport()
  271. },
  272. getSelectDateStr(date){
  273. return `${date.getFullYear()}-${(date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)}-${date.getDate() < 10 ? '0' + date.getDate() : date.getDate()}`;
  274. },
  275. userListSearch(val) {
  276. this.showUserList = [];
  277. this.userList.forEach(u=>{if (u.name.startsWith(val)) {
  278. this.showUserList.push(u);
  279. }})
  280. },
  281. selectUserConfirm(){
  282. this.userNameValue = '';
  283. var that = this;
  284. that.userIdList = '';
  285. this.userList.filter(u=>u.isChecked).forEach(u=>{
  286. that.userNameValue += (u.name+',');
  287. that.userIdList += u.id + ','
  288. });
  289. if (this.userNameValue.length > 0) {
  290. this.userNameValue = this.userNameValue.substring(0, this.userNameValue.length-1);
  291. this.userIdList = this.userIdList.substring(0, this.userIdList.length-1);
  292. }
  293. this.$forceUpdate()
  294. this.selectUserShow = false
  295. this.getReport()
  296. },
  297. getUsers() {
  298. this.$axios.post("/user/getEmployeeList", {
  299. departmentId: -1,
  300. pageIndex: 1,
  301. // pageSize: 99999
  302. pageSize: -1
  303. })
  304. .then(res => {
  305. if(res.code == "ok") {
  306. this.userList = res.data.records;
  307. this.showUserList = res.data.records
  308. } else {
  309. this.$toast.fail('获取失败');
  310. }
  311. }).catch(err=> {this.$toast.clear();});
  312. },
  313. // 批量操作
  314. allChecked(){
  315. if(this.isAllChecked){
  316. for(let i in this.report){
  317. this.report[i].checked = true
  318. }
  319. this.isCanAgree = true
  320. }else{
  321. for(let i in this.report){
  322. this.report[i].checked = false
  323. }
  324. this.isCanAgree = false
  325. }
  326. },
  327. itemChecked(){
  328. let isall = true
  329. let iscan = false
  330. for(let i in this.report){
  331. if(!this.report[i].checked){
  332. isall = false
  333. }else {
  334. iscan = true
  335. }
  336. }
  337. this.isAllChecked = isall
  338. this.isCanAgree = iscan
  339. },
  340. batchAgree(bol){
  341. let ids = ''
  342. for(let i in this.report){
  343. if(this.report[i].checked){
  344. for(let m in this.report[i].data){
  345. ids += this.report[i].data[m].id + ','
  346. }
  347. }
  348. }
  349. if(ids.length > 0){
  350. ids = ids.substring(0, ids.length-1);
  351. }
  352. if(bol){
  353. Dialog.confirm({
  354. message: `确认批量通过这些的日报吗?`
  355. })
  356. .then(() => {
  357. this.isbatch = true
  358. this.approveinData = {
  359. ids: ids
  360. }
  361. if(this.user.timeType.needEvaluate == 1){
  362. this.$set(this.approveinData,'evaluate','')
  363. this.approveinDialog = true
  364. }else{
  365. const toast = this.$toast.loading({
  366. forbidClick: true,
  367. duration: 0
  368. });
  369. this.batchApproveinfun()
  370. }
  371. })
  372. .catch(() => {});
  373. }
  374. },
  375. batchApproveinfun(){
  376. let that = this
  377. this.$axios.post('/report/batchApproveReport', this.approveinData)
  378. .then(res => {
  379. if(res.code == "ok") {
  380. this.$toast.clear();
  381. setTimeout(function() {
  382. that.$toast.success('审核成功');
  383. }, 300);
  384. this.approveinDialog = false
  385. this.getReport();
  386. } else {
  387. this.$toast.clear();
  388. this.$toast.fail('批量操作失败:'+res.msg);
  389. }
  390. }).catch(err=> {this.$toast.clear();});
  391. },
  392. showLargeImg(item, index) {
  393. this.imgShow = true;
  394. this.tmpPics = item;
  395. },
  396. // 返回
  397. back() {
  398. history.back();
  399. },
  400. // 时间转换
  401. format(date, pattern) {
  402. pattern = pattern || "yyyy-MM-dd";
  403. var _this = this;
  404. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  405. switch ($0.charAt(0)) {
  406. case 'y': return _this.padding(date.getFullYear(), $0.length);
  407. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  408. case 'd': return _this.padding(date.getDate(), $0.length);
  409. case 'w': return date.getDay() + 1;
  410. case 'h': return _this.padding(date.getHours(), $0.length);
  411. case 'm': return _this.padding(date.getMinutes(), $0.length);
  412. case 's': return _this.padding(date.getSeconds(), $0.length);
  413. }
  414. });
  415. },
  416. padding(s, len) {
  417. var len = len - (s + '').length;
  418. for (var i = 0; i < len; i++) { s = '0' + s; }
  419. return s;
  420. },
  421. // 改变时间
  422. changeTime(time) {
  423. this.nowTime = this.format(new Date(time),"yyyy-MM-dd");
  424. this.currentDate = time;
  425. this.showPicker = false;
  426. this.getReport();
  427. },
  428. // 获取日报
  429. getReport() {
  430. const toast = this.$toast.loading({
  431. forbidClick: true,
  432. duration: 0
  433. });
  434. let parameter = {
  435. state: 0
  436. }
  437. if(this.selectDate.length != 0){
  438. parameter.startDate = this.selectDate[0]
  439. parameter.endDate = this.selectDate[1]
  440. }
  441. if(this.userIdList){
  442. parameter.userId = this.userIdList
  443. }
  444. this.$axios.post("/report/listByState", parameter)
  445. .then(res => {
  446. if(res.code == "ok") {
  447. this.$toast.clear();
  448. this.report = res.data;
  449. // this.isAllChecked = this.report.length == 0 ? false : true
  450. if(this.report.length == 0){
  451. this.isAllChecked = false
  452. }
  453. for(let i in this.report){
  454. this.$set(this.report[i],'checked',false)
  455. }
  456. } else {
  457. this.$toast.clear();
  458. this.$toast.fail('获取失败:'+res.msg);
  459. }
  460. }).catch(err=> {this.$toast.clear();});
  461. },
  462. approve(id, item) {
  463. Dialog.confirm({
  464. message: `确认通过${item.dateStr}的日报吗?`
  465. })
  466. .then(() => {
  467. var ids = '';
  468. var data = item.data;
  469. data.forEach(element => {
  470. if (element.id != null && element.id != '') {
  471. ids +=(element.id+',');
  472. }
  473. });
  474. this.isbatch = false
  475. this.approveinData = {
  476. id: id,
  477. date: this.nowTime,
  478. reportIds: ids
  479. }
  480. if(this.user.timeType.needEvaluate == 1){
  481. this.$set(this.approveinData,'evaluate','')
  482. this.approveinDialog = true
  483. }else{
  484. const toast = this.$toast.loading({
  485. forbidClick: true,
  486. duration: 0
  487. });
  488. this.approveinfun()
  489. }
  490. })
  491. .catch(() => {});
  492. },
  493. approveinfun(){
  494. let that = this;
  495. this.$axios.post("/report/approve", this.approveinData)
  496. .then(res => {
  497. if(res.code == "ok") {
  498. this.$toast.clear();
  499. setTimeout(function() {
  500. that.$toast.success('审核成功');
  501. }, 300);
  502. this.approveinDialog = false
  503. this.getReport();
  504. } else {
  505. this.$toast.clear();
  506. setTimeout(function() {
  507. that.$toast.fail('审核失败');
  508. }, 300);
  509. }
  510. }).catch(err=> {this.$toast.clear();});
  511. },
  512. showDenyDialog(id,i,date, item) {
  513. this.denyReasonDialog = true;
  514. this.isBatchDeny = false;
  515. var ids = '';
  516. var data = item.data;
  517. data.forEach(element => {
  518. if (element.id != null && element.id != '') {
  519. ids +=(element.id+',');
  520. }
  521. });
  522. this.denyForm = {id: id ,i:i, date: date, reportIds: ids, reason:null};
  523. },
  524. showBatchDenyDialog() {
  525. this.isBatchDeny = true;
  526. let ids = ''
  527. for(let i in this.report){
  528. if(this.report[i].checked){
  529. for(let m in this.report[i].data){
  530. ids += this.report[i].data[m].id + ','
  531. }
  532. }
  533. }
  534. if(ids.length > 0){
  535. ids = ids.substring(0, ids.length-1);
  536. }
  537. this.denyForm = {reportIds: ids, reason:null};
  538. this.denyReasonDialog = true;
  539. },
  540. deny() {
  541. const toast = this.$toast.loading({
  542. forbidClick: true,
  543. duration: 0
  544. });
  545. let that = this;
  546. if (this.isBatchDeny) {
  547. this.$axios.post('/report/batchDenyReport', {
  548. ids: this.denyForm.reportIds
  549. }).then(res => {
  550. if(res.code == "ok") {
  551. this.$toast.clear();
  552. setTimeout(function() {
  553. that.$toast.success('审核成功');
  554. }, 300);
  555. that.getReport();
  556. that.denyReasonDialog = false;
  557. } else {
  558. that.$toast.clear();
  559. that.$toast.fail('批量操作失败:'+res.msg);
  560. }
  561. }).catch(err=> {this.$toast.clear();});
  562. } else {
  563. this.$axios.post("/report/deny", this.denyForm)
  564. .then(res => {
  565. if(res.code == "ok") {
  566. this.$toast.clear();
  567. setTimeout(function() {
  568. that.$toast.success(that.denyForm.i==0?'驳回成功':'撤销成功');
  569. }, 300);
  570. this.getReport();
  571. this.denyReasonDialog = false;
  572. } else {
  573. this.$toast.clear();
  574. setTimeout(function() {
  575. that.$toast.fail(that.denyForm.i==0?'驳回失败':'撤销失败');
  576. }, 300);
  577. }
  578. }).catch(err=> {this.$toast.clear();});
  579. }
  580. }
  581. },
  582. mounted() {
  583. this.getReport();
  584. this.getUsers()
  585. var list = this.user.functionList
  586. for(var i in list) {
  587. if(list[i].name == '审核全员日报') {
  588. this.flg = true
  589. }
  590. }
  591. }
  592. };
  593. </script>
  594. <style lang="less" scoped>
  595. .dateSelectCell{
  596. display: -webkit-box;
  597. }
  598. .userCheckbox {
  599. padding: 10px;;
  600. }
  601. .userNameValue{
  602. white-space: nowrap;
  603. text-overflow: ellipsis;
  604. }
  605. .formBatch{
  606. position: fixed;
  607. bottom: 0;
  608. width: 100%;
  609. z-index: 2;
  610. background-color: #fff;
  611. display: flex;
  612. justify-content: space-between;
  613. align-items: center;
  614. height: 1.2rem;
  615. border-top: 1px solid #ebebeb;
  616. }
  617. .login_form {
  618. margin-top: 46px;
  619. margin-bottom: 65px;
  620. }
  621. .one_report {
  622. margin-bottom: 15px;
  623. font-size:14px;
  624. }
  625. .form_text {
  626. margin: 10px 0 10px;
  627. padding: 0 12px;
  628. }
  629. .form_btn {
  630. text-align: right;
  631. }
  632. .form_btn button {
  633. margin-left: 10px;
  634. }
  635. .one_report_data {
  636. margin-bottom: 10px;
  637. padding: 0 22px;
  638. div {
  639. line-height: 30px;
  640. }
  641. }
  642. </style>
  643. <style lang="less">
  644. .van-nav-bar .van-icon , .van-nav-bar__text {
  645. color: #20a0ff;
  646. }
  647. // 显示加班样式
  648. .one_span {
  649. width: 40px;
  650. height: 25px;
  651. line-height: 25px;
  652. text-align: center;
  653. box-sizing: border-box;
  654. display: inline-block;
  655. border: 1px solid #fde2e2;
  656. background: #fef0f0;
  657. color: #f56c6c;
  658. font-size: 12px;
  659. border-radius: 5px;
  660. // margin-left: 40px;
  661. float: right;
  662. }
  663. </style>