index.vue 32 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="43">
  6. <van-cell title="时间选择" clickable :value="nowTime" @click="showPicker = true" />
  7. </van-sticky>
  8. <div v-if="user.manageDeptId != 0 || reportsCompany || reportsDept">
  9. <van-sticky :offset-top="85">
  10. <van-cell title="选择部门" clickable :value="departmentText" @click="selectDepartmentShow = true">
  11. <template #extra>
  12. <van-icon v-if="departmentText" name="close" class="clearSeach"
  13. @click.stop="selectUserClear('dept')" />
  14. </template>
  15. <template #default>
  16. <span v-if="user.userNameNeedTranslate == '1'">
  17. <span v-if="departmentText">
  18. <TranslationOpenDataText type='departmentName' :openid='departmentText'></TranslationOpenDataText>
  19. </span>
  20. </span>
  21. <span v-else>{{ departmentText }}</span>
  22. </template>
  23. </van-cell>
  24. </van-sticky>
  25. <van-sticky :offset-top="127" class="one_report_select">
  26. <van-cell title="选择人员" clickable :value="userNameValue" @click="showUserPopu()"
  27. value-class="userNameValue">
  28. <template #extra>
  29. <van-icon v-if="selectPeopleVal.name" name="close" class="clearSeach"
  30. @click.stop="selectUserClear('user')" />
  31. </template>
  32. <template #default>
  33. <span v-if="user.userNameNeedTranslate == '1'">
  34. <span v-if="selectPeopleVal.name">
  35. <TranslationOpenDataText type='userName' :openid='selectPeopleVal.name'></TranslationOpenDataText>
  36. </span>
  37. </span>
  38. <span v-else>{{ selectPeopleVal.name }}</span>
  39. </template>
  40. </van-cell>
  41. </van-sticky>
  42. </div>
  43. <van-popup v-model="showPicker" position="bottom">
  44. <van-datetime-picker v-model="currentDate" type="date" :min-date="minDate" :max-date="maxDate"
  45. @confirm="changeTime" @cancel="showPicker = false" />
  46. </van-popup>
  47. <!--分页,加载更多-->
  48. <van-pull-refresh v-model="isDownloading" @refresh="onDownRefresh">
  49. <van-list v-model="isUpLoading" :finished="upFinished" :immediate-check="false" :offset="100" finished-text="没有更多了" @load="onLoadList">
  50. <van-skeleton :v-if="report.length != 0" v-for="(item, index) in report" title avatar :row="3" :loading="false"
  51. :key="index">
  52. <van-panel class="one_report" :title="item.name" :status="statusTxt[item.state]">
  53. <template #header>
  54. <div class="van-cell van-panel__header">
  55. <div class="van-cell__title">
  56. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  57. :openid='item.name'></TranslationOpenDataText></span>
  58. <span v-else>{{ item.name }}</span>
  59. </div>
  60. <div class="van-cell__value van-panel__header-value">
  61. <span>{{ statusTxt[item.state] }}</span>
  62. </div>
  63. </div>
  64. </template>
  65. <div class="form_text" v-if="user.timeType.onlyShowPercent == 0">
  66. <span style="margin-right:20px;margin-left:5px;font-size:14px;">
  67. <span v-if="user.timeType.showCorpwxCardtime" :style="item.cardTime !=item.reportTime?'color:#ff0000;':''">考勤时长:{{item.cardTime | amounts}}h</span>
  68. 总填报时长:
  69. <span>{{ parseFloat(item.reportTime).toFixed(1) }}h</span>
  70. </span>
  71. </div>
  72. <div v-if="user.timeType.enableNewWeeklyfill == 1 && item.summary != null" style="margin-left:20px;"
  73. v-html="'<b>' + item.summaryTitle + '</b><br>' + item.summary.replace(/\r\n/g, '<br>')">
  74. </div>
  75. <div v-for="(item1, index1) in item.data" class="one_report_data" :key="index1">
  76. <div class="project_title" style="font-weight:bold;">项目:{{ item1.project }} <span
  77. :style="'color:' + statusColor[item1.state]">[
  78. <span v-if="item1.state == 0">
  79. <span v-if="user.timeType.reportAuditType == 7" >
  80. 审核人:<span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  81. :openid='item1.projectAuditorName'></TranslationOpenDataText><span v-if="item1.projectAuditState==1">√</span><span v-if="item1.deptAuditorName">、</span>
  82. <TranslationOpenDataText type='userName'
  83. :openid='item1.deptAuditorName'></TranslationOpenDataText><span v-if="item1.departmentAuditState==1">√</span>
  84. </span>
  85. <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>
  86. </span>
  87. <span v-else>
  88. <span v-if="item1.isDeptAudit == 0">
  89. <span v-if="item1.projectAuditState == 0">
  90. 待项目审核人<span v-if="item1.projectAuditorName != null">(
  91. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  92. :openid='item1.projectAuditorName'></TranslationOpenDataText></span>
  93. <span v-else>{{ item1.projectAuditorName }}</span>
  94. )</span>审核
  95. </span>
  96. <span style="color:#32CD32;" v-else-if="item1.projectAuditState == 1">
  97. 项目审核人<span v-if="item1.projectAuditorName != null">(
  98. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  99. :openid='item1.projectAuditorName'></TranslationOpenDataText></span>
  100. <span v-else>{{ item1.projectAuditorName }}</span>
  101. )</span>审核通过
  102. </span>
  103. </span>
  104. <span v-else-if="item1.isDeptAudit == 1">
  105. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='departmentName'
  106. :openid='item1.auditDeptName'></TranslationOpenDataText></span>
  107. <span v-else>{{ item1.auditDeptName }}</span>
  108. 审核
  109. </span>
  110. </span>
  111. </span>
  112. <span v-else>
  113. {{ statusTxt[item1.state] }}
  114. </span>
  115. <!-- {{statusTxt[item1.state]}} -->
  116. ] </span></div>
  117. <div style="color:red;" v-if="item1.state == 2 && item1.rejectReason != null">原因:{{
  118. item1.rejectReason }}
  119. </div>
  120. <div class="project_title" v-if="item1.subProjectName != null && user.companyId != yuzhongCompId">
  121. 子项目:{{ item1.subProjectName }}</div>
  122. <div class="project_title" v-if="user.companyId == yuzhongCompId">
  123. 角色:{{ item1.extraField1 ? roleList.find(r => r.value == item1.extraField1).label : '' }}</div>
  124. <div class="project_title" v-if="user.company.packageProject == 1 && item1.groupName != null">
  125. 任务分组:{{ item1.groupName }}</div>
  126. <div class="project_title" v-if="user.companyId == yuzhongCompId">
  127. 工作职责:{{ item1.extraField2 ? item1.extraField2Name : '' }}</div>
  128. <div class="project_title" v-if="user.companyId == yuzhongCompId">
  129. 工作内容:{{ item1.extraField3 ? item1.extraField3Name : '' }}</div>
  130. <div class="project_title" v-if="user.company.packageProject == 1 && item1.stage != '-'">
  131. 投入阶段:{{ item1.stage }}</div>
  132. <!--自定义维度 -->
  133. <div class="project_title" v-if="user.timeType.customDegreeActive == 1">
  134. {{ user.timeType.customDegreeName }}:{{ item1.degreeName }}</div>
  135. <div class="project_title" v-if="user.timeType.customDataActive == 1">
  136. {{ user.timeType.customDataName }}:{{ item1.customData }}</div>
  137. <div class="project_title" v-if="user.timeType.customTextActive == 1">
  138. {{ user.timeType.customTextName }}:{{ item1.customText }}</div>
  139. <div class="project_title" v-if="user.company.packageEngineering == 1">
  140. 专业进度:
  141. <span style="margin-right:10px;" v-for="progressItem in item1.professionProgress"
  142. :key="progressItem.id">{{ progressItem.professionName }}({{ progressItem.progress }}%)
  143. </span>
  144. </div>
  145. <div class="project_title" v-if="item1.taskId">任务:{{ item1.taskName }}</div>
  146. <!--根据类型选择使用的模板 -->
  147. <div v-if="item1.multiWorktime == 0">
  148. <div class="project_time" v-if="user.timeType.onlyShowPercent==0">时长:
  149. <span v-if="item1.reportTimeType == 0" style="margin-right:10px;">{{
  150. fullDayTxt[item1.timeType] }}</span>
  151. <span v-if="item1.reportTimeType == 2" style="margin-right:10px;">{{ item1.startTime + '-' +
  152. item1.endTime }}</span>{{ item1.time.toFixed(1) }}h
  153. <div class="button" v-if="item1.isOvertime == 1">加班<span v-if="item1.overtimeHours">{{
  154. item1.overtimeHours.toFixed(1) }}h</span></div>
  155. </div>
  156. <div class="project_time" v-else>用时占比:
  157. {{ item1.progress }}%
  158. </div>
  159. <div class="project_content">事项:<span v-html="item1.content"></span></div>
  160. </div>
  161. <div v-if="item1.multiWorktime == 1">
  162. <div>项目时长:<span style="margin-right:10px;">{{ item1.time.toFixed(1) }}h</span>
  163. <div class="button" v-if="item1.isOvertime == 1">加班<span v-if="item1.overtimeHours">{{
  164. item1.overtimeHours.toFixed(1) }}h</span></div>
  165. </div>
  166. <div style="position:relative;border:#ccc 0.5px solid;padding:3px;margin:5px 0px;"
  167. v-for="(timeItem, index) in item1.worktimeList" :key="index">
  168. <div class="project_time">时长:
  169. <!-- <span v-if="timeItem.reportTimeType == 0" style="margin-right:10px;">{{fullDayTxt[item1.timeType]}}</span> -->
  170. <span style="margin-right:10px;">{{ timeItem.startTime + '-' + timeItem.endTime
  171. }}</span>{{ timeItem.time.toFixed(1) }}h
  172. <span style="margin-left:5px;" v-if="timeItem.detail">{{ timeItem.detail }}</span>
  173. </div>
  174. <div class="project_content">事项:<span v-html="timeItem.content"></span></div>
  175. </div>
  176. </div>
  177. <div style="padding:5px;text-align:center;" v-if="item1.pics != null && item1.pics.length > 0">
  178. <span v-for="(p, index) in item1.pics" :key="p" style="margin-right:10px;">
  179. <img :src="p" style="width:80px; height:80px;" @click="showLargeImg(item1.pics, index)" />
  180. </span>
  181. </div>
  182. <van-divider />
  183. </div>
  184. <van-popup v-model="imgShow" position="bottom" closeable>
  185. <van-swipe class="my-swipe" indicator-color="white">
  186. <van-swipe-item v-for="(picItem, index) in tmpPics" :key="index">
  187. <img :src="picItem" style="width:100%;" />
  188. </van-swipe-item>
  189. </van-swipe>
  190. </van-popup>
  191. <!-- 编辑 -->
  192. <div slot="footer" class="foot">
  193. <van-button size="small" type="primary" @click="editor(item)"
  194. v-if="item.id == user.id && (item.state == 2 || item.state == 3)">编辑日报</van-button>
  195. </div>
  196. </van-panel>
  197. </van-skeleton>
  198. </van-list>
  199. </van-pull-refresh>
  200. <van-empty v-if="report.length == 0" description="暂无日报">
  201. <van-button round type="primary" class="bottom-button" @click="toWriteReport()">去填写</van-button>
  202. </van-empty>
  203. <!-- 人员选择 -->
  204. <van-popup v-model="selectUserShow" position="bottom" style="height: 90%">
  205. <div class="popupDiv">
  206. <div class="popupSearch">
  207. <van-search v-model.trim="searchInputValue" placeholder="输入员工姓名搜索" @clear="userListSearch"
  208. @search="userListSearch" shape="round" background="#F4F4F4"></van-search>
  209. </div>
  210. <div class="popupCon conBorder" style="flex: 1;background-color: #fff;">
  211. <div class="popupConBox">
  212. <van-radio-group v-model="selectPeopleVal">
  213. <van-radio v-for="uitem in showUserList" :key="uitem.id" :name="uitem" style="padding:10px"
  214. class="popupItem marginNone borderNone">
  215. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  216. :openid='uitem.name'></TranslationOpenDataText></span>
  217. <span v-else>{{ uitem.name ? uitem.name : '' }}</span>
  218. </van-radio>
  219. </van-radio-group>
  220. </div>
  221. </div>
  222. <div class="popupBtn">
  223. <van-button style="width:100%;background: #1989fa;color: #ffffff;" round
  224. @click="selectUserConfirm()">确定</van-button>
  225. </div>
  226. </div>
  227. </van-popup>
  228. <!-- 部门选择 -->
  229. <van-popup v-model="selectDepartmentShow" position="bottom" style="height: 90%">
  230. <div class="popupDiv">
  231. <div class="comPaceholder">
  232. 已选择部门:
  233. <span v-if="user.userNameNeedTranslate != '1'">
  234. {{ selectDepartmentText.length > 0 ? selectDepartmentText[0].label : '请选择部门' }}
  235. </span>
  236. <span v-else>
  237. <span v-if="selectDepartmentText.length > 0">
  238. <TranslationOpenDataText type='departmentName' :openid='selectDepartmentText[0].label'></TranslationOpenDataText>
  239. </span>
  240. <span v-else>请选择部门</span>
  241. </span>
  242. </div>
  243. <div class="popupCon conBorder comTree popupTree" style="flex: 1;">
  244. <el-tree :data="departmentList" :props="defaultProps" @node-click="treeNodeClick">
  245. <span class="custom-tree-node" slot-scope="{ node }">
  246. <span v-if="user.userNameNeedTranslate == '1'">
  247. <span>
  248. <TranslationOpenDataText type='departmentName' :openid='node.label'></TranslationOpenDataText>
  249. </span>
  250. </span>
  251. <span v-if="user.userNameNeedTranslate != '1'">
  252. {{ node.label }}
  253. </span>
  254. </span>
  255. </el-tree>
  256. </div>
  257. <div class="popupBtn">
  258. <van-button style="width:100%;background: #1989fa;color: #ffffff;" round
  259. @click="treeBtn">确定</van-button>
  260. </div>
  261. </div>
  262. </van-popup>
  263. </div>
  264. </div>
  265. </template>
  266. <script>
  267. export default {
  268. components: {},
  269. data() {
  270. return {
  271. isDownloading: false,
  272. isUpLoading: false, // 上拉加载
  273. upFinished: false, // 上拉加载完毕
  274. pageIndex: 0,
  275. hasMore: true,
  276. yuzhongCompId: 3385,
  277. roleList: [{ value: 1, label: 'CRC&LM' }, { value: 2, label: 'PM' }],
  278. tmpPics: [],
  279. imgShow: false,
  280. hasWaiting: false,
  281. state: 0,
  282. statusColor: ['orange', 'green', 'red'],
  283. user: JSON.parse(localStorage.userInfo),
  284. minDate: new Date(2010, 0, 1),
  285. maxDate: new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()),
  286. currentDate: new Date(),
  287. nowTime: this.format(new Date(new Date()), "yyyy-MM-dd"),
  288. showPicker: false,
  289. report: [],
  290. fullDayTxt: ['全天', '上午', '下午'],
  291. statusTxt: ["待审核", "已通过", "已驳回", "待提交"],
  292. selectUserShow: false,
  293. searchInputValue: '',
  294. userList: [],
  295. showUserList: [],
  296. firstUserList: [],
  297. userIdList: '',
  298. userNameValue: '',
  299. selectPeopleVal: {},
  300. selectDepartmentShow: false,
  301. selectDepartmentText: [],
  302. departmentText: '',
  303. departmentList: [],
  304. defaultProps: {
  305. children: 'children',
  306. label: 'label'
  307. },
  308. reportsCompany: false,
  309. reportsDept: false
  310. };
  311. },
  312. created() {
  313. },
  314. filters:{
  315. // 过滤
  316. amounts(value) {
  317. if(value == NaN || value == undefined || value == 'undefined' || value == null || value == 'null') {
  318. return 0
  319. }
  320. var zhi = +value + 0
  321. return zhi.toFixed(1)
  322. },
  323. },
  324. methods: {
  325. onDownRefresh() {
  326. this.pageIndex = 1
  327. this.upFinished = false // 不写这句会导致你上拉到底过后在下拉刷新将不能触发下拉加载事件
  328. this.getReport();
  329. },
  330. onLoadList() {
  331. if(!this.hasMore) {
  332. this.upFinished = true
  333. this.isUpLoading = false
  334. return
  335. }
  336. this.pageIndex++;
  337. this.requestHttpReports();
  338. },
  339. requestHttpReports() {
  340. this.hasWaiting = false;
  341. let pames = {
  342. date: this.nowTime,
  343. }
  344. if (this.selectPeopleVal.id) {
  345. pames.userId = this.selectPeopleVal.id
  346. }
  347. if (this.departmentText && this.selectDepartmentText.length > 0) {
  348. pames.deptId = this.selectDepartmentText[0].id
  349. }
  350. pames.pageIndex = this.pageIndex;
  351. this.$axios.post("/report/getReportList", pames)
  352. .then(res => {
  353. if (res.code == "ok") {
  354. this.report = this.report.concat(res.data.data);
  355. this.hasMore = res.data.hasMore;
  356. this.isUpLoading = false;
  357. this.isDownloading = false;
  358. //计算状态
  359. for (var i = 0; i < this.report.length; i++) {
  360. var item = this.report[i];
  361. if (item.state == 0) {
  362. this.hasWaiting = true;
  363. }
  364. }
  365. } else {
  366. this.$toast.clear();
  367. this.$toast.fail('获取失败:' + res.msg);
  368. }
  369. }).catch(err => { this.$toast.clear(); });
  370. },
  371. showLargeImg(item, index) {
  372. this.imgShow = true;
  373. this.tmpPics = item;
  374. },
  375. // 返回
  376. back() {
  377. history.back();
  378. },
  379. getUsers(flag = true) {
  380. let deptId = this.selectDepartmentText[0] && this.selectDepartmentText[0].id
  381. this.$axios.post("/user/getEmployeeList", {
  382. departmentId: deptId || -1,
  383. pageIndex: 1,
  384. pageSize: -1
  385. })
  386. .then(res => {
  387. if (res.code == "ok") {
  388. if(flag) {
  389. this.userList = res.data.records;
  390. this.showUserList = res.data.records
  391. this.firstUserList = res.data.records
  392. } else {
  393. this.userList = res.data.records;
  394. this.showUserList = res.data.records
  395. }
  396. } else {
  397. this.$toast.fail('获取失败');
  398. }
  399. }).catch(err => { this.$toast.clear(); });
  400. },
  401. getDepartmentList() {
  402. this.$axios.post("/department/list", {})
  403. .then(res => {
  404. if (res.code == "ok") {
  405. this.departmentList = res.data;
  406. } else {
  407. this.$toast.fail('获取失败');
  408. }
  409. }).catch(err => { this.$toast.clear(); });
  410. },
  411. userListSearch(val) {
  412. const { userNameNeedTranslate } = this.user
  413. if (!this.searchInputValue) {
  414. this.showUserList = JSON.parse(JSON.stringify(this.userList))
  415. return
  416. }
  417. if (userNameNeedTranslate != 1) {
  418. const newUserList = JSON.parse(JSON.stringify(this.userList))
  419. this.showUserList = newUserList.filter(item => item.name.indexOf(this.searchInputValue) != -1)
  420. }
  421. if (userNameNeedTranslate == 1) {
  422. let deptId = this.selectDepartmentText[0] && this.selectDepartmentText[0].id
  423. this.$axios.post("/user/getEmployeeList", {
  424. departmentId: deptId || -1,
  425. pageIndex: 1, pageSize: -1,
  426. keyword: this.searchInputValue, status: '',
  427. roleId: '', cursor: '', onlyDirect: 0, matchingType: 0
  428. })
  429. .then(res => {
  430. if (res.code == "ok") {
  431. const dataList = res.data.records
  432. const userNameList = dataList.map(item => item.name)
  433. const newUserList = JSON.parse(JSON.stringify(this.userList))
  434. this.showUserList = newUserList.filter(item => userNameList.some(uItem => uItem.includes(item.name)))
  435. console.log(userNameList)
  436. } else {
  437. this.$toast.fail('搜索失败');
  438. }
  439. }).catch(err => { this.$toast.clear(); });
  440. }
  441. },
  442. selectUserConfirm() {
  443. console.log(this.selectPeopleVal)
  444. this.selectUserShow = false
  445. this.getReport()
  446. },
  447. selectUserClear(str) {
  448. if (str == 'user') {
  449. this.selectPeopleVal = {}
  450. }
  451. if (str == 'dept') {
  452. this.departmentText = ''
  453. this.selectDepartmentText = []
  454. }
  455. this.getReport()
  456. },
  457. showUserPopu() {
  458. if (!this.departmentText) {
  459. this.showUserList = JSON.parse(JSON.stringify(this.firstUserList))
  460. } else {
  461. this.showUserList = JSON.parse(JSON.stringify(this.userList))
  462. }
  463. this.searchInputValue = ''
  464. this.selectUserShow = true
  465. },
  466. treeNodeClick(item) {
  467. this.selectDepartmentText = [item]
  468. },
  469. treeBtn() {
  470. if (this.selectDepartmentText.length <= 0) {
  471. this.$toast('请选择部门');
  472. return
  473. }
  474. this.departmentText = this.selectDepartmentText[0].label
  475. this.selectDepartmentShow = false
  476. this.getUsers(false)
  477. this.getReport()
  478. },
  479. // 时间转换
  480. format(date, pattern) {
  481. pattern = pattern || "yyyy-MM-dd";
  482. var _this = this;
  483. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  484. switch ($0.charAt(0)) {
  485. case 'y': return _this.padding(date.getFullYear(), $0.length);
  486. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  487. case 'd': return _this.padding(date.getDate(), $0.length);
  488. case 'w': return date.getDay() + 1;
  489. case 'h': return _this.padding(date.getHours(), $0.length);
  490. case 'm': return _this.padding(date.getMinutes(), $0.length);
  491. case 's': return _this.padding(date.getSeconds(), $0.length);
  492. }
  493. });
  494. },
  495. padding(s, len) {
  496. var len = len - (s + '').length;
  497. for (var i = 0; i < len; i++) { s = '0' + s; }
  498. return s;
  499. },
  500. // 改变时间
  501. changeTime(time) {
  502. this.nowTime = this.format(new Date(time), "yyyy-MM-dd");
  503. this.currentDate = time;
  504. this.showPicker = false;
  505. this.getReport();
  506. },
  507. // 获取日报
  508. getReport() {
  509. this.pageIndex = 0;
  510. this.isUpLoading = false;
  511. this.report = [];
  512. this.requestHttpReports();
  513. },
  514. // 点击编辑
  515. editor(item) {
  516. var path = '/edit';
  517. if (this.user.timeType.enableNewWeeklyfill == 1) {
  518. //物奇要填到按周填报
  519. path = '/weekEdit';
  520. }
  521. this.$router.push({
  522. path: path,
  523. query: {
  524. date: this.nowTime
  525. }
  526. });
  527. },
  528. // 去填写日报
  529. toWriteReport() {
  530. var path = '/edit';
  531. if (this.user.timeType.enableNewWeeklyfill == 1) {
  532. //物奇要填到按周填报
  533. path = '/weekEdit';
  534. }
  535. this.$router.push({
  536. path: path,
  537. query: {
  538. date: this.nowTime
  539. }
  540. });
  541. }
  542. },
  543. mounted() {
  544. if (sessionStorage.targetDate != null) {
  545. this.nowTime = sessionStorage.targetDate;
  546. sessionStorage.removeItem('targetDate');
  547. }
  548. const { functionList } = this.user
  549. for (var i in functionList) {
  550. if (functionList[i].name == '查看全公司工时') {
  551. this.reportsCompany = true
  552. }
  553. if (functionList[i].name == '查看本部门工时') {
  554. this.查看本部门工时 = true
  555. }
  556. }
  557. this.getReport();
  558. this.getUsers()
  559. this.getDepartmentList()
  560. }
  561. };
  562. </script>
  563. <style lang="less" scoped>
  564. .popupTree {
  565. font-size: 20px;
  566. padding: 20px 10px;
  567. /deep/ .el-tree-node {
  568. margin-bottom: 10px;
  569. }
  570. /deep/ .el-tree-node__content>.el-tree-node__expand-icon {
  571. font-size: 20px;
  572. }
  573. }
  574. .login_form {
  575. margin-top: 46px;
  576. }
  577. .one_report {
  578. margin-bottom: 15px;
  579. font-size: 14px;
  580. }
  581. .one_report_select {
  582. margin-bottom: 15px;
  583. }
  584. .form_text {
  585. margin: 15px 0 15px;
  586. padding: 0 12px;
  587. }
  588. .form_btn {
  589. text-align: right;
  590. }
  591. .form_btn button {
  592. margin-left: 10px;
  593. }
  594. .one_report_data {
  595. margin-bottom: 10px;
  596. padding: 0 22px;
  597. div {
  598. line-height: 30px;
  599. }
  600. }
  601. .comPaceholder {
  602. margin: 10px 15px;
  603. background: #fff;
  604. padding: 10px 10px;
  605. border-radius: 6px;
  606. font-size: 20px;
  607. color: #606266;
  608. }
  609. .comTree {
  610. background: #ffffff;
  611. }
  612. </style>
  613. <style lang="less">
  614. .van-nav-bar .van-icon,
  615. .van-nav-bar__text {
  616. color: #20a0ff;
  617. }
  618. .button {
  619. float: right;
  620. width: 80px;
  621. height: 25px;
  622. line-height: 25px;
  623. text-align: center;
  624. border: 1px solid red;
  625. color: red;
  626. box-sizing: border-box;
  627. border-radius: 10px;
  628. font-size: 14px;
  629. display: flex;
  630. justify-content: center;
  631. align-items: center;
  632. }
  633. .foot {
  634. width: 100%;
  635. display: flex;
  636. justify-content: end;
  637. }
  638. .bottom-button {
  639. width: 160px;
  640. height: 40px;
  641. background-color: rgb(53, 130, 245);
  642. border-color: rgb(53, 130, 245);
  643. }
  644. .clearSeach {
  645. line-height: 0.64rem;
  646. position: relative;
  647. left: 5px;
  648. }
  649. .userNameValue {
  650. white-space: nowrap;
  651. text-overflow: ellipsis;
  652. }
  653. </style>