listPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. <template>
  2. <!-- v-loading="loadingbox" -->
  3. <div>
  4. <!-- table切换 -->
  5. <ul class="table-box">
  6. <!-- 任务 -->
  7. <li :class="typeShow === '0' ? 'table-bottom' : ''"
  8. @click="typeApiFun('0')">
  9. {{ $t('homeIndex.task') }}
  10. </li>
  11. <!-- 提醒 -->
  12. <!-- <li :class="typeShow === '1' ? 'table-bottom' : ''"
  13. @click="typeApiFun('1')">
  14. {{ $t('homeIndex.remind') }}
  15. </li> -->
  16. <!-- 超期 -->
  17. <!-- <li :class="typeShow === '2' ? 'table-bottom' : ''"
  18. @click="typeApiFun('2')">
  19. {{ $t('homeIndex.beyond') }}
  20. </li> -->
  21. <div class="search-time">
  22. <el-date-picker style="float:right"
  23. v-model="Datevalue"
  24. type="datetimerange"
  25. :start-placeholder="$t('common.startDate')"
  26. :end-placeholder="$t('common.endDate')"
  27. @change="dateSearch">
  28. </el-date-picker>
  29. </div>
  30. <div class="clear-both"></div>
  31. </ul>
  32. <!-- end table切换 -->
  33. <!-- 分类 -->
  34. <ul class="taskType"
  35. ref="taskTypeShow">
  36. <li v-for="(item, index) in taskTypeList"
  37. :key="index"
  38. @click="clickSearch(item, index)"
  39. :class="{ active: categoryIndex == index }">
  40. <p>
  41. <!-- 类型名称 -->
  42. {{ getLanguage !== 'en' ? $t(item.businessTypeName) : $t(item.businessTypeNameEn)}}
  43. <!-- 类型个数 -->
  44. <span>( {{ item.amount }} )</span>
  45. </p>
  46. </li>
  47. <div class="clear-both"></div>
  48. </ul>
  49. <!-- end 分类 -->
  50. <!-- 内容部分 -->
  51. <div class="taskList-box"
  52. style="overflow:auto;"
  53. ref="taskListBoxshow">
  54. <ul class="taskList"
  55. v-infinite-scroll="noticeListFun"
  56. infinite-scroll-disabled="scrollDisabled"
  57. infinite-scroll-distance="30">
  58. <li v-for="(i, index) in listShow"
  59. :key="index"
  60. class="list-item"
  61. @click="goPath(i)">
  62. <!-- 图标 -->
  63. <div class="taskList-icon">
  64. <!-- CERTIFICATE 证书
  65. CREW 船员
  66. FINANCE 财务
  67. ISM 体系
  68. MAINTAIN 维保
  69. MATERIEL 物料
  70. NAVIGATION 航海资料
  71. NCOMPATIBLE
  72. OIL 油品
  73. PURCHASE 采购
  74. REPAIR 修船
  75. SERVICER 服务商
  76. SYSTEM
  77. VOYAGE-->
  78. <!-- 出入库 -->
  79. <img v-show="i.businessType === 'WAREHOUSE'"
  80. src="@/assets/newTaks/churuku.png" />
  81. <!-- 采购 -->
  82. <img v-if="i.businessType === 'PROCUREMENT'"
  83. src="@/assets/newTaks/caigou.png" />
  84. <!-- 统计报表 -->
  85. <img v-if="i.businessType === 'REPORT'"
  86. src="@/assets/newTaks/baobiao.png" />
  87. <!-- 销售 -->
  88. <img v-if="i.businessType === 'SALE'"
  89. src="@/assets/newTaks/xiaoshou.png" />
  90. <!-- 体系 -->
  91. <img v-if="i.businessType === 'ISM'"
  92. src="@/assets/newTaks/txgl.png" />
  93. <img v-if="i.businessType === 'INS'"
  94. src="@/assets/newTaks/txgl.png" />
  95. <!-- 维保 -->
  96. <img v-if="i.businessType === 'MAINTAIN'"
  97. src="@/assets/newTaks/wxby.png" />
  98. <!-- 物料 -->
  99. <img v-if="i.businessType === 'MATERIEL'"
  100. src="@/assets/newTaks/wlgl.png" />
  101. <!-- 备件 -->
  102. <img v-if="i.businessType === 'SPAREPART'"
  103. src="@/assets/newTaks/bj.png" />
  104. <!-- 航海资料 -->
  105. <img v-if="i.businessType === 'NAVIGATION'"
  106. src="@/assets/newTaks/hhzlgl.png" />
  107. <!-- 油品 -->
  108. <img v-if="i.businessType === 'OIL'"
  109. src="@/assets/newTaks/ypgl.png" />
  110. <!-- 采购 -->
  111. <img v-if="i.businessType === 'PURCHASE'"
  112. src="@/assets/newTaks/cggl.png" />
  113. <!-- 修船 -->
  114. <img v-if="i.businessType === 'REPAIR'"
  115. src="@/assets/newTaks/xcgl.png" />
  116. <!-- 服务商 -->
  117. <img v-if="i.businessType === 'SERVICER'"
  118. src="@/assets/newTaks/fwsgl.png" />
  119. </div>
  120. <!-- 标题 -->
  121. <div class="taskList-font">
  122. <p :title="i.messageContent">
  123. <!-- 类型 -->
  124. <b>{{ getLanguage !== 'en' ? i.messageTitle : i.messageTitleEn}}</b>
  125. {{ i.messageContent }}
  126. </p>
  127. </div>
  128. <!-- 时间 -->
  129. <div class="taskList-timer">{{ isToday(i.createDate) }}</div>
  130. <!-- 按钮 -->
  131. <div class="taskList-btn">
  132. <p>
  133. <span class="el-icon-s-order"
  134. style="font-size:16px; margin-right:10px;"></span>{{$t('workNotification.handle')}}
  135. </p>
  136. </div>
  137. </li>
  138. <div class="footer-box">
  139. <div class="footer"
  140. v-if="loading">{{$t('common.onLoading')}}</div>
  141. <div class="footer"
  142. v-if="noMore">{{$t('common.noMore')}}</div>
  143. </div>
  144. <div class="clear-both"></div>
  145. </ul>
  146. </div>
  147. <!-- end 内容部分 -->
  148. <el-backtop target=".taskList-box"></el-backtop>
  149. </div>
  150. </template>
  151. <script>
  152. // TaskTypeAmount:任务类型数据
  153. // noticeTasks:任务列表数据
  154. // RemindTypeAmount:提醒
  155. // noticeReminds:提醒列表数据
  156. // OverdueTypeAmount:超期
  157. // noticeOverdues:超期列表数据
  158. import {
  159. TaskTypeAmount,
  160. RemindTypeAmount,
  161. OverdueTypeAmount,
  162. noticeTasks,
  163. noticeReminds,
  164. noticeOverdues,
  165. } from '@/model/indexRx'
  166. import { EventBus, formatDate, dayjs } from 'base-core-lib'
  167. import * as utils from '@/views/workNotification/utils/index.js'
  168. export default {
  169. name: 'newtask',
  170. data () {
  171. return {
  172. activeName: 'second',
  173. listShow: [],
  174. taskTypeList: [], // 类型数据容器
  175. typeAllnum: 0, // 所有分类总条数
  176. typeShow: '0', //分类得类型 0:任务 1:提醒 2:超期
  177. scrollbarPage: 0,
  178. scrollbarLimit: 20,
  179. scrollbarTotal: 1,
  180. loading: false,
  181. pageList: [1],
  182. Datevalue: '',
  183. loadingbox: false,
  184. fl: '',
  185. dateCreat: '',
  186. dateEnd: '',
  187. categoryIndex: 0,
  188. }
  189. },
  190. computed: {
  191. noMore () {
  192. return this.pageList.length === 0
  193. },
  194. scrollDisabled () {
  195. return this.loading || this.noMore
  196. },
  197. getLanguage () {
  198. return this.$store.getters.language
  199. }
  200. },
  201. created () {
  202. let typeData = this.$route.query.types
  203. if (typeData) {
  204. this.typeShow = typeData
  205. this.typeApiFun(typeData)
  206. } else {
  207. this.typeApiFun()
  208. }
  209. },
  210. mounted () { },
  211. methods: {
  212. // 判断类型
  213. typeApiFun (data) {
  214. this.categoryIndex = 0
  215. this.fl = ''
  216. this.pageList = [1]
  217. this.listShow = []
  218. this.scrollbarPage = 0
  219. this.taskTypeList = []
  220. this.loadingbox = true
  221. if (data) {
  222. this.typeShow = data
  223. if (this.typeShow === '0') {
  224. TaskTypeAmount().toPromise().then((data) => {
  225. this.typeDataFun(data)
  226. })
  227. } else if (this.typeShow === '1') {
  228. RemindTypeAmount().toPromise().then((data) => {
  229. this.typeDataFun(data, this.typeShow)
  230. })
  231. } else if (this.typeShow === '2') {
  232. OverdueTypeAmount().toPromise().then((data) => {
  233. this.typeDataFun(data, this.typeShow)
  234. })
  235. }
  236. } else {
  237. this.typeShow = '0'
  238. TaskTypeAmount().toPromise().then((data) => {
  239. this.typeDataFun(data)
  240. })
  241. }
  242. this.noticeListFun()
  243. },
  244. typeDataFun (data) {
  245. this.typeAllnum = 0
  246. // TODO 临时解决后端问题
  247. const hiddenList = []
  248. this.taskTypeList = data.filter(
  249. (item) => hiddenList.indexOf(item.businessTypeName.trim()) == -1
  250. )
  251. if (this.taskTypeList && this.taskTypeList.length) {
  252. for (let i = 0; i < this.taskTypeList.length; i++) {
  253. this.typeAllnum += parseInt(this.taskTypeList[i].amount)
  254. }
  255. }
  256. this.taskTypeList.unshift({
  257. businessTypeName: 'common.all',
  258. businessTypeNameEn: 'common.all',
  259. amount: this.typeAllnum,
  260. })
  261. this.$nextTick(function () {
  262. this.$refs.taskListBoxshow.style.height = `calc(100vh - ${this.$refs.taskTypeShow.offsetHeight}px)`
  263. })
  264. },
  265. noticeListFun () {
  266. this.loadingbox = true
  267. this.loading = true
  268. // noticeTaskStatus: 待处理 TO_BE_PROCESSED, 已处理 PROCESSED
  269. // businessType: 工作通知分类类型 例: CERTIFICATE 证书
  270. // compId: 公司id
  271. // createDateStart:开始时间
  272. // createDateEnd: 结束时间
  273. // pageSize: 分页大小(默认10)
  274. // currentPage: 页码(默认为1)
  275. this.scrollbarPage += 1
  276. let searchList = {
  277. businessType: this.fl,
  278. createDateStart: this.dateCreat,
  279. createDateEnd: this.dateEnd,
  280. compId: '',
  281. pageSize: this.scrollbarLimit,
  282. currentPage: this.scrollbarPage,
  283. }
  284. // if (data) {
  285. // this.listShow = []
  286. // this.scrollbarPage = 1
  287. // searchList.currentPage = 1
  288. // if (data === 'all') {
  289. // this.fl = ''
  290. // }else{
  291. // this.fl = data.businessType
  292. // }
  293. // searchList.businessType = this.fl
  294. // }
  295. if (this.typeShow === '0') {
  296. this.pageList = [1]
  297. noticeTasks(searchList).toPromise().then((res) => {
  298. this.loadingbox = false
  299. this.loading = false
  300. this.pageList = res.records
  301. this.scrollbarTotal = res.total
  302. let list = res.records
  303. if (list.length > 0) {
  304. this.dataAssembly(list)
  305. } else {
  306. this.loadingbox = false
  307. }
  308. })
  309. } else if (this.typeShow === '1') {
  310. this.pageList = [1]
  311. noticeReminds(searchList).toPromise().then((res) => {
  312. this.loadingbox = false
  313. this.loading = false
  314. this.pageList = res.records
  315. this.scrollbarTotal = res.total
  316. let list = res.records
  317. if (list.length > 0) {
  318. this.dataAssembly(list)
  319. } else {
  320. this.loadingbox = false
  321. }
  322. })
  323. } else if (this.typeShow === '2') {
  324. this.pageList = [1]
  325. noticeOverdues(searchList).toPromise().then((res) => {
  326. this.loadingbox = false
  327. this.loading = false
  328. this.pageList = res.records
  329. this.scrollbarTotal = res.total
  330. let list = res.records
  331. if (list.length > 0) {
  332. this.dataAssembly(list)
  333. } else {
  334. this.loadingbox = false
  335. }
  336. })
  337. }
  338. },
  339. dataAssembly (list) {
  340. if (list && list.length) {
  341. for (let i = 0; i < list.length; i++) {
  342. this.listShow.push(list[i])
  343. }
  344. if (this.typeShow === 0) {
  345. const newArr = this.listShow.reduce(
  346. (all, next) =>
  347. all.some((item) => item['id'] == next['id'])
  348. ? all
  349. : [...all, next],
  350. []
  351. )
  352. this.listShow = newArr
  353. }
  354. this.loadingbox = false
  355. }
  356. },
  357. clickSearch (data, index) {
  358. this.categoryIndex = index
  359. this.listShow = []
  360. this.scrollbarPage = 0
  361. if (data) {
  362. this.fl = data.businessType
  363. }
  364. this.noticeListFun()
  365. },
  366. dateSearch (data) {
  367. if (data !== null) {
  368. // this.dateCreat = formatDate(new Date(data[0])) + ' 00:00:00'
  369. // this.dateEnd = formatDate(new Date(data[1])) + ' 23:59:59'
  370. this.dateCreat = formatDate(dayjs(data[0])) + ' 00:00:00'
  371. this.dateEnd = formatDate(dayjs(data[1])) + ' 23:59:59'
  372. } else {
  373. this.dateCreat = ''
  374. this.dateEnd = ''
  375. }
  376. this.clickSearch()
  377. },
  378. goPath (data) {
  379. console.log(data, 1234444)
  380. if (data.businessCode === 'PURCHASE-MA-APPL-REMIND') {
  381. this.$router.push({ name: 'sparepartMa' })
  382. } else {
  383. const url = utils.code2Url(
  384. data.businessType,
  385. data.businessCode,
  386. data.noticeTaskStatus,
  387. this.typeShow
  388. )
  389. if (!url) {
  390. EventBus.$emit('error', this.$t('workNotification.noRelatedType'))
  391. } else {
  392. this.$router.push({
  393. name: url
  394. })
  395. // 产品 船舶检查
  396. }
  397. }
  398. },
  399. isToday (str) {
  400. if (str !== null) {
  401. let d = new Date(str.replace(/-/g, '/'))
  402. let todaysDate = new Date()
  403. if (d.setHours(0, 0, 0, 0) == todaysDate.setHours(0, 0, 0, 0)) {
  404. return formatDate(str, 'HH:mm:ss')
  405. } else {
  406. return str
  407. }
  408. }
  409. },
  410. },
  411. }
  412. </script>
  413. <style lang="scss" scoped>
  414. ul,
  415. li {
  416. list-style: none;
  417. margin: 0px;
  418. padding: 0px;
  419. }
  420. .clear-both {
  421. clear: both;
  422. }
  423. .boxShow {
  424. width: 100%;
  425. padding: 10px;
  426. position: absolute;
  427. top: 0;
  428. right: 0;
  429. bottom: 0px;
  430. }
  431. .table-box {
  432. width: 100%;
  433. background-color: #fff;
  434. height: 50px;
  435. li {
  436. float: left;
  437. position: relative;
  438. width: 60px;
  439. height: 50px;
  440. line-height: 50px;
  441. margin-left: 30px;
  442. text-align: center;
  443. font-size: 14px;
  444. }
  445. .table-bottom:before {
  446. content: '';
  447. width: 100%;
  448. position: absolute;
  449. background-color: #1d6ced;
  450. height: 2px;
  451. left: 0;
  452. bottom: 0;
  453. }
  454. .search-time {
  455. width: 350px;
  456. float: right;
  457. margin: 10px 0px;
  458. margin-right: 30px;
  459. }
  460. }
  461. .taskType {
  462. width: 100%;
  463. background-color: #fff;
  464. margin-top: 2px;
  465. margin-bottom: 10px;
  466. // padding-bottom: 20px;
  467. li {
  468. float: left;
  469. border: 1px solid #6ea0f3;
  470. border-radius: 5px;
  471. max-width: 190px;
  472. padding: 0 5px;
  473. text-align: center;
  474. margin-top: 20px;
  475. margin-left: 20px;
  476. cursor: pointer;
  477. font-size: 14px;
  478. p {
  479. margin: 8px 0px;
  480. span {
  481. color: #e74c3c;
  482. }
  483. }
  484. }
  485. li:hover {
  486. background-color: #e4eeff;
  487. color: #1d6ced;
  488. }
  489. }
  490. .taskList-box {
  491. background-color: #fff;
  492. width: 100%;
  493. // height: calc(100% - 135px);
  494. height: 100%;
  495. }
  496. .taskList {
  497. height: 100%;
  498. overflow-y: auto;
  499. li {
  500. height: 64px;
  501. width: 100%;
  502. background-color: #f8f8f8;
  503. float: left;
  504. padding: 10px 30px;
  505. cursor: pointer;
  506. .taskList-icon {
  507. width: 34px;
  508. height: 34px;
  509. float: left;
  510. margin-top:5px;
  511. margin-right: 20px;
  512. }
  513. .taskList-font {
  514. width: calc(100% - 317px);
  515. float: left;
  516. height: 44px;
  517. margin-right: 30px;
  518. p {
  519. overflow: hidden;
  520. text-overflow: ellipsis;
  521. white-space: nowrap;
  522. color: #666666;
  523. font-size: 14px;
  524. b {
  525. color: #333333;
  526. font-size: 16px;
  527. // margin-right: 40px;
  528. display: inline-block;
  529. min-width: 150px;
  530. max-width: 290px;
  531. }
  532. }
  533. }
  534. .taskList-timer {
  535. width: 100px;
  536. height: 44px;
  537. line-height: 44px;
  538. float: left;
  539. margin-right: 23px;
  540. color: #999999;
  541. overflow: hidden;
  542. }
  543. .taskList-btn {
  544. width: 100px;
  545. height: 44px;
  546. float: left;
  547. line-height: 44px;
  548. p {
  549. text-align: center;
  550. font-size: 16px;
  551. font-weight: bold;
  552. color: rgba(30, 107, 237, 0.6);
  553. margin: 0px;
  554. }
  555. }
  556. }
  557. li:nth-child(odd) {
  558. background-color: #fff;
  559. }
  560. li:hover {
  561. background-color: #f2f7ff;
  562. }
  563. li:hover .taskList-btn p {
  564. color: rgba(30, 107, 237, 1);
  565. }
  566. }
  567. .footer {
  568. width: 95%;
  569. text-align: center;
  570. margin: 0 auto;
  571. font-size: 14px;
  572. color: #999999;
  573. }
  574. .footer-box {
  575. width: 100%;
  576. height: 30px;
  577. line-height: 30px;
  578. padding: 15px 0px;
  579. }
  580. .active {
  581. background-color: #e4eeff;
  582. color: #1d6ced;
  583. }
  584. </style>