work.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <!-- 工作通知模块 任务 -->
  2. <template>
  3. <div>
  4. <!-- <ws-common-loading v-if="initLoading"></ws-common-loading> -->
  5. <div class="work-notification-container">
  6. <div class="work-notification-flex">
  7. <span class="work-notification-size">{{ $t('workNotification.busModule') }}{{$t('common.colon')}}</span>
  8. <div class="work-notification-top">
  9. <el-badge :value="number.warehouse"
  10. :hidden="number.warehouse <= 0"
  11. class="item"
  12. v-if="crewFlag">
  13. <el-button @click="switchTab(notificationType.WAREHOUSE)"
  14. size="small"
  15. :class="
  16. `notification-btn ${tabIndex === notificationType.WAREHOUSE &&
  17. 'notification-button'}`
  18. ">
  19. {{ $t('workNotification.warehouse') }}
  20. </el-button>
  21. </el-badge>
  22. <!-- 体系 -->
  23. <el-badge :value="number.sale"
  24. :hidden="number.sale <= 0"
  25. class="item"
  26. v-if="ismFlag">
  27. <el-button @click="switchTab(notificationType.SALE)"
  28. size="small"
  29. :class="
  30. `notification-btn ${tabIndex === notificationType.SALE &&
  31. 'notification-button'}`
  32. ">
  33. {{ $t('workNotification.ism') }}
  34. </el-button>
  35. </el-badge>
  36. <!-- 采购管理PROCUREMENT -->
  37. <el-badge :value="number.procurement"
  38. :hidden="number.procurement <= 0"
  39. class="item"
  40. v-if="financeFlag">
  41. <el-button @click="switchTab(notificationType.PROCUREMENT)"
  42. size="small"
  43. :class="
  44. `notification-btn ${tabIndex === notificationType.PROCUREMENT &&
  45. 'notification-button'}`
  46. ">
  47. {{ $t('workNotification.finance') }}
  48. </el-button>
  49. </el-badge>
  50. <!-- 统计报表 -->
  51. <el-badge :value="number.report"
  52. :hidden="number.report <= 0"
  53. class="item"
  54. v-if="servicerFlag">
  55. <el-button @click="switchTab(notificationType.REPORT)"
  56. size="small"
  57. :class="
  58. `notification-btn ${tabIndex === notificationType.REPORT &&
  59. 'notification-button'}`
  60. ">
  61. {{ $t('workNotification.report') }}
  62. </el-button>
  63. </el-badge>
  64. </div>
  65. </div>
  66. <div class="work-notification-time">
  67. <span class="work-notification-size1">{{ $t('workNotification.noticeTime') }}{{$t('common.colon')}}</span>
  68. <div class="block work-top">
  69. <el-date-picker v-model="dateRange"
  70. :picker-options="pickerOptions"
  71. type="daterange"
  72. range-separator="~"
  73. :start-placeholder="$t('workNotification.startPlaceholder')"
  74. :end-placeholder="$t('workNotification.endPlaceholder')"
  75. value-format="yyyy-MM-dd"
  76. @change="getWorkList" />
  77. </div>
  78. </div>
  79. </div>
  80. <div id="message"
  81. class="scroll-container"
  82. v-infinite-scroll="getWorkListAppend">
  83. <WorkNotificationItem v-for="(item, index) in workNotificationList"
  84. :key="'key' + index"
  85. :info="item"
  86. @handleLater="getWorkList" />
  87. <div v-if="workNotificationList.length === 0 && !initLoading"
  88. class="img-bg">
  89. <div class="box">
  90. <img src="../../assets/images/onData.png"
  91. alt="" />
  92. <div>{{ $t('workNotification.empty') }}</div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import WorkNotificationItem from './components/WorkNotificationItem'
  100. import { getQueryPage, countAmount } from '@/model/indexRx'
  101. import notificationType from './types/notificationType'
  102. import { EventBus } from 'base-core-lib'
  103. export default {
  104. name: 'Work',
  105. components: {
  106. WorkNotificationItem
  107. },
  108. data () {
  109. return {
  110. navigationFlag: false,
  111. materielFlag: false,
  112. sparepartFlag: false,
  113. repairFlag: false,
  114. maintainFlag: false,
  115. servicerFlag: false,
  116. oilFlag: false, //油品
  117. monitorManagerFlag: false,
  118. certificateFlag: false,
  119. purchasFlag: false,
  120. crewFlag: false,
  121. financeFlag: false,
  122. vesselNoonReportFlag: false,
  123. ismFlag: false,
  124. notificationType: notificationType,
  125. dateRange: [], // 通知时间的双向绑定
  126. tabIndex: '',
  127. // notificationType.ALL
  128. tabIndexs: [],
  129. pickerOptions: {},
  130. initLoading: false,
  131. pageSize: 20,
  132. currentPage: 1,
  133. total: 10,
  134. order: '',
  135. businessType: '',
  136. createDateStart: '',
  137. createDateEnd: '',
  138. // 动态显示角标
  139. number: {
  140. // 总数
  141. sum: 0,
  142. //通知通函
  143. circular: 0,
  144. // 船舶证书
  145. certificate: 0,
  146. // 采购管理
  147. purchas: 0,
  148. // 船员管理
  149. crew: 0,
  150. // 财务管理
  151. finance: 0,
  152. //船舶午报
  153. vesselNoonReport: 0,
  154. // 体系
  155. ism: 0,
  156. monitor: 0,
  157. //油品
  158. oil: 0,
  159. // 服务商
  160. servicer: 0,
  161. //维保
  162. maintain: 0,
  163. //修船
  164. repair: 0,
  165. //备件
  166. sparepart: 0,
  167. //物料
  168. materiel: 0,
  169. //航海
  170. navigation: 0
  171. },
  172. workNotificationList: [] // 初始化列表数组
  173. }
  174. },
  175. computed: {},
  176. mounted () {
  177. this.getAmount()
  178. this.getWorkList()
  179. },
  180. methods: {
  181. // tab切换
  182. switchTab (index) {
  183. this.tabIndex = index === 'all' ? this.tabIndexs.join(',') : index
  184. this.dateRange = []
  185. this.getWorkList()
  186. },
  187. // 通知时间的函数
  188. getWorkList () {
  189. // this.elLoading()
  190. this.initLoading = true
  191. this.currentPage = 1
  192. const time = this.nowFormatDate('YYYY-MM-DD HH:mm:ss')
  193. const params = {
  194. staffId: sessionStorage.getItem('ws-pf_userId'),
  195. currentPage: this.currentPage,
  196. pageSize: this.pageSize,
  197. acceptanceTypes: 'NEED_HANDLE,RETURN',
  198. businessType: this.tabIndex,
  199. showTime: time
  200. }
  201. // 调用时间
  202. if (this.dateRange != null && this.dateRange.length > 0) {
  203. params.createDateStart =
  204. this.dateRange[0] === undefined ? '' : this.dateRange[0] + ' 00:00:00'
  205. params.createDateEnd =
  206. this.dateRange[1] === undefined ? '' : this.dateRange[1] + ' 23:59:59'
  207. }
  208. getQueryPage(params).toPromise()
  209. .then(response => {
  210. this.initLoading = false
  211. // this.elLoading('end')
  212. this.workNotificationList = []
  213. this.total = response.total
  214. this.workNotificationList = response.records
  215. if (this.workNotificationList.length >= this.pageSize) {
  216. this.currentPage += 1
  217. }
  218. })
  219. .catch((error) => {
  220. EventBus.$emit('error', error || this.$t('common.error'))
  221. })
  222. },
  223. // 分页加载方法
  224. getWorkListAppend () {
  225. if (
  226. this.workNotificationList.length >= this.total ||
  227. this.currentPage <= 1
  228. ) {
  229. return
  230. }
  231. const time = this.nowFormatDate('YYYY-MM-DD HH:mm:ss')
  232. const params = {
  233. staffId: sessionStorage.getItem('ws-pf_userId'),
  234. currentPage: this.currentPage,
  235. pageSize: this.pageSize,
  236. acceptanceTypes: 'NEED_HANDLE,RETURN',
  237. businessType: this.tabIndex,
  238. showTime: time
  239. }
  240. // 调用时间
  241. if (this.dateRange != null && this.dateRange.length > 0) {
  242. params.createDateStart =
  243. this.dateRange[0] === undefined ? '' : this.dateRange[0] + ' 00:00:00'
  244. params.createDateEnd =
  245. this.dateRange[1] === undefined ? '' : this.dateRange[1] + ' 23:59:59'
  246. }
  247. getQueryPage(params).toPromise()
  248. .then(response => {
  249. this.total = response.total
  250. this.workNotificationList = this.workNotificationList.concat(
  251. response.records
  252. )
  253. if (this.workNotificationList.length >= this.pageSize) {
  254. this.currentPage += 1
  255. }
  256. })
  257. .catch((error) => {
  258. EventBus.$emit('error', error || this.$t('common.error'))
  259. })
  260. },
  261. // 获取工作类型 分类总数
  262. getAmount () {
  263. if (this.permissionIf('crewManagement')) {
  264. this.tabIndexs.push(notificationType.CREW)
  265. this.crewFlag = true
  266. }
  267. if (this.permissionIf('certificateManagement')) {
  268. this.tabIndexs.push(notificationType.CERTIFICATE)
  269. this.certificateFlag = true
  270. }
  271. if (this.permissionIf('procurement')) {
  272. this.tabIndexs.push(notificationType.PURCHASE)
  273. this.purchasFlag = true
  274. }
  275. if (this.permissionIf('financeManagement')) {
  276. this.tabIndexs.push(notificationType.FINANCE)
  277. this.financeFlag = true
  278. }
  279. if (this.permissionIf('dynamicRport.report.review')) {
  280. this.tabIndexs.push(notificationType.VESSEL_NOON_REPORT)
  281. this.vesselNoonReportFlag = true
  282. }
  283. if (this.permissionIf('ismManager')) {
  284. this.tabIndexs.push(notificationType.ISM)
  285. this.ismFlag = true
  286. }
  287. if (this.permissionIf('monitorManager')) {
  288. this.tabIndexs.push(notificationType.MONITOR)
  289. this.monitorManagerFlag = true
  290. }
  291. if (this.permissionIf('oil')) {
  292. this.tabIndexs.push(notificationType.OIL)
  293. this.oilFlag = true
  294. }
  295. if (this.permissionIf('servicer')) {
  296. this.tabIndexs.push(notificationType.SERVICER)
  297. this.servicerFlag = true
  298. }
  299. if (this.permissionIf('maintenanceManagement')) {
  300. this.tabIndexs.push(notificationType.MAINTAIN)
  301. this.maintainFlag = true
  302. }
  303. if (this.permissionIf('repairManager')) {
  304. this.tabIndexs.push(notificationType.REPAIR)
  305. this.repairFlag = true
  306. }
  307. if (this.permissionIf('spareParts')) {
  308. this.tabIndexs.push(notificationType.SPAREPART)
  309. this.sparepartFlag = true
  310. }
  311. if (this.permissionIf('materiel')) {
  312. this.tabIndexs.push(notificationType.MATERIEL)
  313. this.materielFlag = true
  314. }
  315. if (this.permissionIf('navigationManagement')) {
  316. this.tabIndexs.push(notificationType.NAVIGATION)
  317. this.navigationFlag = true
  318. }
  319. // 通函通知没有权限,都能看见
  320. this.tabIndexs.push(notificationType.CIRCULAR)
  321. this.tabIndex = this.tabIndexs.join(',')
  322. const time = this.nowFormatDate('YYYY-MM-DD HH:mm:ss')
  323. const params = {
  324. staffId: sessionStorage.getItem('ws-pf_userId'),
  325. acceptanceTypes: 'NEED_HANDLE,RETURN',
  326. isTask: 1,
  327. showTime: time
  328. }
  329. if (this.dateRange.length > 0) {
  330. params.createDateStart =
  331. this.dateRange[0] === undefined ? '' : this.dateRange[0] + ' 00:00:00'
  332. params.createDateEnd =
  333. this.dateRange[1] === undefined ? '' : this.dateRange[1] + ' 23:59:59'
  334. }
  335. countAmount(params).toPromise()
  336. .then(res => {
  337. // this.number.sum = res.data.sum;
  338. this.number.sum = 0
  339. const content = res.content
  340. content.forEach(item => {
  341. // // if (item.businessType === notificationType.CREW) {
  342. // // // 船员管理
  343. // // debugger
  344. // // this.number.crew = item.number;
  345. // // this.number.sum += parseInt(item.number);
  346. // // } else if (item.businessType === notificationType.FINANCE) {
  347. // // // 财务管理
  348. // // this.number.finance = item.number;
  349. // // this.number.sum += parseInt(item.number);
  350. // // } else if (item.businessType === notificationType.PURCHASE) {
  351. // // // 采购管理
  352. // // this.number.purchas = item.number;
  353. // // this.number.sum += parseInt(item.number);
  354. // // } else if (item.businessType === notificationType.CERTIFICATE) {
  355. // // // 船舶证书
  356. // // this.number.certificate = item.number;
  357. // // this.number.sum += parseInt(item.number);
  358. // // } else if (item.businessType === notificationType.VESSEL_NOON_REPORT) {
  359. // // // 船舶午报
  360. // // this.number.vesselNoonReport = item.number;
  361. // // this.number.sum += parseInt(item.number);
  362. // // }
  363. if (item.businessType === 'WAREHOUSE') {
  364. this.number.warehouse = item.number
  365. } else if (item.businessType === 'PROCUREMENT') {
  366. this.number.procuement = item.number
  367. } else if (item.businessType === 'REPORT') {
  368. this.number.report = item.number
  369. } else if (item.businessType === 'SALE') {
  370. this.number.sale = item.number
  371. }
  372. this.tabIndexs.forEach(ite => {
  373. if (item.businessType === ite) {
  374. this.number.sum += parseInt(item.number)
  375. }
  376. })
  377. })
  378. })
  379. .catch(error => {
  380. EventBus.$emit('error', error)
  381. })
  382. }
  383. }
  384. }
  385. </script>
  386. <style scoped>
  387. .work-notification-container {
  388. margin: 10px 10px 0 10px;
  389. padding: 30px 0 20px 20px;
  390. background: #fff;
  391. }
  392. .work-notification-flex {
  393. display: flex;
  394. }
  395. .work-notification-size {
  396. font-size: 14px;
  397. color: #666666;
  398. width: 100px;
  399. }
  400. .work-notification-top {
  401. margin: -20px 0 0 5px;
  402. }
  403. .notification-btn {
  404. background: #ffffff;
  405. border: none;
  406. font-size: 14px;
  407. color: #333333;
  408. width: 100px;
  409. }
  410. .notification-btn:hover {
  411. color: #1d6ced;
  412. }
  413. .notification-button {
  414. background: #eee !important;
  415. border: 1px solid #eee !important;
  416. }
  417. .work-notification-time {
  418. display: flex;
  419. }
  420. .work-notification-size1 {
  421. font-size: 14px;
  422. color: #666666;
  423. padding-top: 20px;
  424. }
  425. .work-notification-all {
  426. font-size: 14px;
  427. color: #444;
  428. position: relative;
  429. top: -12px;
  430. margin-left: 5px;
  431. }
  432. .item {
  433. margin-top: 10px;
  434. margin-right: 62px;
  435. }
  436. .el-date-editor.el-input,
  437. .el-date-editor.el-input__inner {
  438. width: 483px;
  439. height: 32px;
  440. border: 1px solid #cccccc;
  441. }
  442. .work-top {
  443. padding-top: 10px;
  444. margin-left: 5px;
  445. }
  446. .scroll-container {
  447. height: calc(100vh - 180px);
  448. overflow-y: scroll;
  449. overflow-x: hidden;
  450. padding-left: 10px;
  451. padding-right: 8px;
  452. }
  453. .img-bg {
  454. background-color: #fff;
  455. text-align: center;
  456. margin-top: 10px;
  457. height: calc(100% - 10px);
  458. line-height: 100%;
  459. position: relative;
  460. }
  461. .img-bg .box {
  462. position: absolute;
  463. top: 50%;
  464. left: 50%;
  465. margin-top: -145px;
  466. margin-left: -236px;
  467. }
  468. .img-bg .box div {
  469. margin-top: 20px;
  470. font-size: 14px;
  471. color: #333;
  472. }
  473. </style>