index.vue 34 KB

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