listPage.vue 16 KB

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