index.vue 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011
  1. <!-- 首页模块 首页面 -->
  2. <template>
  3. <div class="home">
  4. <div class="body-middle" :class="{ 'body-middle-height': blockList[0].flag }">
  5. <div class="body-middle-left">
  6. <!-- 任务、消息、提醒、超期 -->
  7. <!-- <Panel :data-list="panelList" @click="gotoNewRw"></Panel> -->
  8. <div class="header">
  9. <div class="left">
  10. <img src="../../../public/img/8b2c7255e9b19c71d68b33a08f20f74.png" alt="">
  11. </div>
  12. <div class="right">
  13. <div class="top">
  14. {{ nowDate }}
  15. </div>
  16. <div class="bottom">
  17. {{ nowTime }}
  18. </div>
  19. </div>
  20. </div>
  21. <div v-show="false">
  22. <el-input v-model="param" />
  23. <el-button @click="openPort()">openPort</el-button>
  24. <el-button @click="closePort()">closePort</el-button>
  25. <div>{{text}}</div>
  26. </div>
  27. <div class="content2">
  28. <el-row class="content2-aside">
  29. <h3 class="title" @click="contract(0)">采购合同完成进度</h3>
  30. <el-col :span="12" class="chart-card">
  31. <div style="font-weight: bold;" class="">
  32. <div ref="myEchart1" style="height: 288px;" class="roseChart"></div>
  33. <div class="bottom-tip">统计单位:吨</div>
  34. </div>
  35. </el-col>
  36. <el-col :span="12" class="chart-card">
  37. <div style="font-weight: bold;">
  38. <div ref="myEchart2" style="height: 288px;" class="roseChart"></div>
  39. <div class="bottom-tip">统计单位:元</div>
  40. </div>
  41. </el-col>
  42. <el-col :span="12" class="chart-card">
  43. <div style="font-weight: bold;">
  44. <div ref="myEchart3" style="height: 288px;" class="roseChart"></div>
  45. <div class="bottom-tip">统计单位:元</div>
  46. </div>
  47. </el-col>
  48. </el-row>
  49. <div class="content2-middle">
  50. <el-row class="left">
  51. <el-col :span="12">
  52. <h3>在途信息统计</h3>
  53. <div class="left-card">
  54. <div class="item">
  55. <p>在途车辆</p>
  56. <p><span class="number">{{carCount1}}</span><span class="number-text">台</span></p>
  57. </div>
  58. <div class="item">
  59. <p>装货车辆</p>
  60. <p><span class="number" style="color:#ffa523">{{carCount2}}</span><span class="number-text">台</span>
  61. </p>
  62. </div>
  63. <div class="item">
  64. <p>卸货车辆</p>
  65. <p><span class="number" style="color:#2483ff">{{carCount3}}</span><span class="number-text">台</span>
  66. </p>
  67. </div>
  68. </div>
  69. </el-col>
  70. <el-col :span="12">
  71. <h3>粮食总储量</h3>
  72. <div ref="myEchart7" style="height: 208px;" @click="contract(3)"></div>
  73. </el-col>
  74. </el-row>
  75. <el-row>
  76. <h3 class="content2-map">库点流向分布</h3>
  77. <div class="center-map">
  78. <map-drag :listData=' mapInfo'></map-drag>
  79. </div>
  80. </el-row>
  81. <el-row>
  82. <div style="display: flex;">
  83. <h3>头寸</h3>
  84. <h3 style="margin-left: 30px;">{{position}}吨</h3>
  85. </div>
  86. <div class="content3">
  87. <div class="left">
  88. <!-- <img src="../../../public/img/1637204557176-s4AMbBA8.png" alt=""> -->
  89. <span>实际库存</span>
  90. <span class="content3-number blue">{{physicalInventory}}</span>
  91. <span style="margin-top: 10px;">吨</span>
  92. </div>
  93. <div class="left">
  94. <!-- <img src="../../../public/img/1637204557176-s4AMbBA8.png" alt=""> -->
  95. <span>采购待执行(吨)</span>
  96. <span class="content3-number blue">{{procurementPending}}</span>
  97. <span style="margin-top: 10px;">吨</span>
  98. </div>
  99. <div class="right">
  100. <!-- <img src="../../../public/img/1637204768818-70JRjz0H.png" alt=""> -->
  101. <span>销售待执行(吨)</span>
  102. <span class="content3-number yellow">{{salesPending}}</span>
  103. <span style="margin-top: 10px;">吨</span>
  104. </div>
  105. </div>
  106. </el-row>
  107. </div>
  108. <el-row class="content2-aside">
  109. <h3 class="left-title">销售合同完成进度</h3>
  110. <el-col :span="12" class="chart-card">
  111. <div style="font-weight: bold;">
  112. <div ref="myEchart4" style="height: 288px;" class="roseChart" @click="contract(1)"></div>
  113. <div class="bottom-tip">统计单位:吨</div>
  114. </div>
  115. </el-col>
  116. <el-col :span="12" class="chart-card">
  117. <div style="font-weight: bold;">
  118. <div ref="myEchart5" style="height: 288px;" class="roseChart" @click="contract(1)"></div>
  119. <div class="bottom-tip">统计单位:元</div>
  120. </div>
  121. </el-col>
  122. <el-col :span="12" class="chart-card">
  123. <div style="font-weight: bold;">
  124. <div ref="myEchart6" style="height: 288px;" class="roseChart" @click="contract(1)"></div>
  125. <div class="bottom-tip">统计单位:元</div>
  126. </div>
  127. </el-col>
  128. </el-row>
  129. </div>
  130. <!-- <el-dialog :append-to-body="true" :show-close='false' :visible.sync="dialogVisible" width="30%"
  131. :before-close="handleClose">
  132. <span>这是一段信息</span>
  133. <span slot="footer" class="dialog-footer">
  134. <el-button @click="dialogVisible = false">取 消</el-button>
  135. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  136. </span>
  137. </el-dialog> -->
  138. <!-- <img style='width:100%;margin-top:10px;' src="../../../public/img/tmt.gif" alt=""> -->
  139. </div>
  140. </div>
  141. <div id="mapXY"></div>
  142. <!-- </ws-dialog> -->
  143. <!-- 第一次登陆的租户 -->
  144. <successfulDialog v-if="successfulDialog" :phone="phone" :successfulDialog="successfulDialog"
  145. @close="successfulDialogClose">
  146. </successfulDialog>
  147. <!-- 试用租户 -->
  148. <trialNotExpired v-if="trialNotExpired" :day="day" :phone="phone" :trialNotExpired="trialNotExpired"
  149. @close="trialNotExpiredClose">
  150. </trialNotExpired>
  151. </div>
  152. </template>
  153. <script>
  154. // import serialport from 'serialport'
  155. // 统计图start
  156. import maintenance from './components/maintenance'
  157. import shipCertificate from './components/shipCertificate'
  158. import sparePartsMaterial from './components/sparePartsMaterial'
  159. import procurement from './components/procurement'
  160. import mapDrag from '@/components/mapdrag/indexMap'
  161. // 统计图end
  162. // 正式租户
  163. import successfulDialog from './components/successfulDialog'
  164. // 试用租户
  165. import trialNotExpired from './components/trialNotExpired'
  166. // 新 api
  167. import {
  168. noticeNumber,
  169. queryCircularManagementReceiveList,
  170. getStaffHomeShowList,
  171. gChartsData,
  172. getAdminId
  173. } from '@/model/home/index'
  174. import {
  175. getUserVesselList,
  176. findHottestRouting
  177. } from '@/model/indexRx'
  178. import News from './components/News'
  179. import ShipMap from './components/ShipMap'
  180. import {
  181. getCnCity,
  182. getCnWea
  183. } from './city'
  184. import {
  185. getLanguage
  186. } from '@/lang'
  187. import Panel from './components/Panel'
  188. import {
  189. getChangeLoginFlag
  190. } from '@/model/indexRx'
  191. import {
  192. zipDown
  193. } from '@/utils/batchDown'
  194. import {
  195. EventBus
  196. } from 'base-core-lib'
  197. import {
  198. mapActions,
  199. mapGetters,
  200. mapState
  201. } from 'vuex';
  202. import axios from 'axios'
  203. export default {
  204. name: 'index',
  205. components: {
  206. mapDrag,
  207. axios,
  208. News,
  209. ShipMap,
  210. Panel,
  211. successfulDialog,
  212. trialNotExpired,
  213. //统计图start
  214. maintenance,
  215. shipCertificate,
  216. sparePartsMaterial,
  217. procurement
  218. //统计图end
  219. },
  220. data() {
  221. return {
  222. physicalInventory :0,
  223. procurementPending:0,
  224. salesPending:0,
  225. position:0,
  226. mapInfo: [],
  227. totalReserves: '',
  228. carCount1: '',
  229. carCount2: '',
  230. carCount3: '',
  231. chartsData: [],
  232. nowDate: null, //存放年月日变量
  233. nowTime: null, //存放时分秒变量
  234. timer: '', //定义一个定时器的变量
  235. currentTime: new Date(), // 获取当前时间
  236. timer: '',
  237. dialogVisible: false,
  238. showEchart: false,
  239. phone: '', // 正式租户电话号码
  240. day: '', //试用租户剩余天数
  241. trialNotExpired: false, //试用租户 剩余天数
  242. successfulDialog: false, //第一次登陆的弹窗
  243. mapXY: undefined,
  244. shipService: undefined,
  245. blockList: [{
  246. name: this.$t('home.shortcutEntrance'),
  247. flag: true
  248. },
  249. {
  250. name: this.$t('home.shipMap'),
  251. flag: true
  252. }
  253. ],
  254. newList: [],
  255. noticeList: [],
  256. routeList: [],
  257. showBlockList: [],
  258. shipList: [],
  259. setFlag: false,
  260. todoCount: '-',
  261. msgCount: '-',
  262. weather: undefined,
  263. ships: [],
  264. selectShip: undefined,
  265. isFullScreen: false,
  266. number: {
  267. task: 0,
  268. remind: 0,
  269. overdue: 0,
  270. news: 0
  271. },
  272. vesselBankFlag: localStorage.getItem('ws-pf_vesselBankFlag'),
  273. shezhiVal: '',
  274. text: '数据',
  275. reader: null,
  276. param: 9600
  277. }
  278. },
  279. computed: {
  280. ...mapState({
  281. showVesslBankFlag: state => state.commonStore.showVesslBankFlag
  282. }),
  283. ...mapGetters(['userSetting']),
  284. /** 计算属性计算属性节点 */
  285. panelList() {
  286. return [{
  287. type: '0',
  288. task: this.$t('homeIndex.task'),
  289. url: require('@/assets/newhome/rw01.png'),
  290. number: this.number.task,
  291. background: require('@/assets/newhome/rw.png'),
  292. remark: '任务'
  293. },
  294. {
  295. type: 'message',
  296. task: this.$t('homeIndex.message'),
  297. url: require('@/assets/newhome/xx01.png'),
  298. number: this.number.news,
  299. background: require('@/assets/newhome/xx.png'),
  300. remark: '消息'
  301. },
  302. {
  303. type: '1',
  304. task: this.$t('homeIndex.remind'),
  305. url: require('@/assets/newhome/tx01.png'),
  306. number: this.number.remind,
  307. background: require('@/assets/newhome/tx.png'),
  308. remark: '提醒'
  309. },
  310. {
  311. type: '2',
  312. task: this.$t('homeIndex.beyond'),
  313. url: require('@/assets/newhome/cq01.png'),
  314. number: this.number.overdue,
  315. background: require('@/assets/newhome/cq.png'),
  316. remark: '超期'
  317. }
  318. ]
  319. },
  320. optionSingleHeightTime() {
  321. return {
  322. openWatch: true,
  323. limitMoveNum: -1, //启动无缝滚动最小数据量 this.dataList.length
  324. direction: 2,
  325. switchDelay: 1000
  326. }
  327. },
  328. getLanguage() {
  329. return this.$store.getters.language
  330. },
  331. isShowShipList() {
  332. return this.userSetting['shipMap'][0].showFlag && this.vesselBankFlag !== 'V' && this.permissionIf(
  333. 'map.mapManagement.view')
  334. },
  335. },
  336. activated() {
  337. // var staffId=JSON.parse(localStorage.getItem('winseaview-userInfo')).content.staffId
  338. // if ('WebSocket' in window) {
  339. // if (process.env.NODE_ENV === 'production') {
  340. // this.websocket = new WebSocket('wss://www.zthymaoyi.com/wss/websocket/'+staffId )
  341. // }
  342. // else {
  343. // // this.websocket = new WebSocket('ws://192.168.1.115:8090/commonUser/api/onOpen?adminId=84f62127b7384dcdbaeaddfe460329fc' )
  344. // this.websocket = new WebSocket('ws://192.168.1.115:8080/websocket/'+staffId )
  345. // }
  346. // this.initWebSocket()
  347. // } else {
  348. // alert('当前浏览器不支持websocket')
  349. // }
  350. },
  351. async created() {
  352. //获取快捷路口列表
  353. this.getRouteList()
  354. // this.checkUserInfoDialog()
  355. // {
  356. this.timer = setInterval(this.getTime, 1000);
  357. // }
  358. },
  359. beforeDestroy() {
  360. clearInterval(this.timer);
  361. if (this.timer) {
  362. clearInterval(this.timer); // 在Vue实例销毁前,清除定时器
  363. }
  364. },
  365. async mounted() {
  366. var staffId = JSON.parse(localStorage.getItem('winseaview-userInfo')).content.staffId
  367. // getAdminId().toPromise().then(response => {console.log(11111)})
  368. this.loading = false
  369. // WebSocket
  370. // this.$store.dispatch('setAdminId', response.data.data)
  371. if ('WebSocket' in window) {
  372. if (process.env.NODE_ENV === 'production') {
  373. this.websocket = new WebSocket('wss://www.zthymaoyi.com/wss/websocket/' + staffId)
  374. } else {
  375. // this.websocket = new WebSocket('ws://192.168.1.115:8090/commonUser/api/onOpen?adminId=84f62127b7384dcdbaeaddfe460329fc' )
  376. this.websocket = new WebSocket('ws://192.168.1.119:9100/websocket/' + staffId)
  377. }
  378. this.initWebSocket()
  379. } else {
  380. alert('当前浏览器不支持websocket')
  381. }
  382. let that = this
  383. this.getChartsData()
  384. // this.timer = setInterval(function(){
  385. // // that.getRouteList()
  386. // axios.get('https://live.eliangeyun.com/api/v1/device/channellist')
  387. // .then(resp =>{
  388. // 图表重置 myChart.setOption
  389. // that.aa = resp.data.ChannelList
  390. // for(var i=0;i<that.dataList.length;i++){
  391. // console.log('ssss',that.dataList[i].Status);
  392. // }
  393. // }).catch(err =>{
  394. // console.log(err);
  395. // });
  396. // }, 2000);
  397. //获取新闻列表
  398. // this.getNewList()
  399. gChartsData({
  400. compId: localStorage.getItem('ws-pf_compId'),
  401. seachMoth: '2021'
  402. }).toPromise().then(res => {
  403. console.log('··············', res)
  404. this.chartsData = res
  405. this.carCount1 = res[6].biViewInfoList[0].count
  406. this.carCount2 = res[6].biViewInfoList[1].count
  407. this.carCount3 = res[6].biViewInfoList[2].count
  408. this.physicalInventory = Number(res[7].biViewInfoList[0].count).toFixed(2)
  409. this.procurementPending= Number(res[7].biViewInfoList[1].count).toFixed(2)
  410. this.salesPending = Number(res[7].biViewInfoList[2].count).toFixed(2)
  411. this.position = Number(Number(this.physicalInventory)+Number(this.procurementPending) - Number(this.salesPending)).toFixed(2)
  412. this.totalReserves = res[8].biViewInfoList
  413. this.mapInfo = res[9]
  414. this.initCharts()
  415. })
  416. // if (this.vesselBankFlag !== 'V') {
  417. // EventBus.$emit('addShipScript', () => {
  418. // this.initShipMap()
  419. // })
  420. // }
  421. // setTimeout(() => {
  422. // this.showEchart = true
  423. // }, 900)
  424. // this.showBlockList = []
  425. // if (this.vesselBankFlag === 'V') {
  426. // this.$refs.noticeList.style.width = 'calc(50% - 7px)'
  427. // this.$refs.newsList.style.width = 'calc(50% - 7px)'
  428. // } else {
  429. // this.showBlockList = []
  430. // this.blockList[1].flag = false
  431. // this.$refs.noticeList.style.width = 'calc(50% - 7px)'
  432. // this.$refs.newsList.style.width = 'calc(50% - 7px)'
  433. // if (this.userSetting['shipMap'] && this.userSetting['shipMap'][0].showFlag) {
  434. // this.showBlockList.push('船舶动态')
  435. // this.blockList[1].flag = true
  436. // }
  437. // }
  438. },
  439. watch: {
  440. // getLanguage: function () {
  441. // this.getShipList()
  442. // }
  443. },
  444. methods: {
  445. ...mapActions('user', ['toSetShow', 'changeVesslBank']),
  446. getChartsData() {
  447. noticeNumber().toPromise().then(res => {
  448. const {
  449. task = 0, remind = 0, overdue = 0, news = 0
  450. } = res
  451. this.number.task = task
  452. this.number.remind = remind
  453. this.number.overdue = overdue
  454. this.number.news = news
  455. })
  456. },
  457. initWebSocket() {
  458. console.log(this.websocket)
  459. // 连接错误
  460. this.websocket.onerror = this.setErrorMessage
  461. // 连接成功
  462. this.websocket.onopen = this.setOnopenMessage
  463. // 收到消息的回调
  464. this.websocket.onmessage = this.setOnmessageMessage
  465. // 连接关闭的回调
  466. this.websocket.onclose = this.setOncloseMessage
  467. // 监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
  468. window.onbeforeunload = this.onbeforeunload
  469. },
  470. setErrorMessage() {
  471. console.log('WebSocket连接发生错误 状态码:' + this.websocket.readyState)
  472. },
  473. setOnopenMessage() {
  474. // console.log(this.websocket)
  475. console.log('WebSocket连接成功 状态码:' + this.websocket.readyState)
  476. },
  477. setOnmessageMessage(event) {
  478. // console.log(3333)
  479. // 根据服务器推送的消息做自己的业务处理
  480. console.log('服务端返回:' + event.data)
  481. var msg = event.data.split('$')
  482. var that = this
  483. this.$notify.warning({
  484. title: '新消息提醒',
  485. message: msg[0],
  486. duration: 0,
  487. onClick() {
  488. that.$router.push({
  489. path: msg[1]
  490. }) // 你要跳转的路由 还可以传参 当然也可以通过其他方式跳转
  491. }
  492. })
  493. var currentPage = that.$router.history.current.path
  494. that.$router.push({
  495. path: '/'
  496. })
  497. that.$router.push({
  498. path: currentPage
  499. })
  500. },
  501. setOncloseMessage() {
  502. // console.log(this.websocket)
  503. console.log('WebSocket连接关闭 状态码:' + this.websocket.readyState)
  504. },
  505. //跳转
  506. contract(index) {
  507. if (index == 0) {
  508. this.$router.push({
  509. name: 'buyContract'
  510. })
  511. } else if (index == 1) {
  512. this.$router.push({
  513. name: 'salesContract'
  514. })
  515. } else if (index == 3) {
  516. this.$router.push({
  517. name: 'warehouseManagementList'
  518. })
  519. }
  520. },
  521. getTime() {
  522. const date = new Date();
  523. const year = date.getFullYear();
  524. const month = date.getMonth() + 1;
  525. const day = date.getDate();
  526. const hour = date.getHours();
  527. const minute = date.getMinutes();
  528. const second = date.getSeconds();
  529. this.month = check(month);
  530. this.day = check(day);
  531. this.hour = check(hour);
  532. this.minute = check(minute);
  533. this.second = check(second);
  534. function check(i) {
  535. const num = (i < 10) ? ('0' + i) : i;
  536. return num;
  537. }
  538. this.nowDate = year + '-' + this.month + '-' + this.day;
  539. this.nowTime = this.hour + ':' + this.minute + ':' + this.second;
  540. },
  541. initCharts() {
  542. let app = this;
  543. var roseCharts = document.getElementsByClassName('roseChart');
  544. for (let i = 0; i < roseCharts.length; i++) {
  545. let myChart = app.$echarts.init(roseCharts[i]);
  546. let color = []
  547. let data = []
  548. let text = ''
  549. let formatter = ''
  550. let graphicText = ''
  551. switch (i) {
  552. case 0:
  553. // 圆环图各环节的颜色
  554. color = ['#75d1f4', '#3a3b40'];
  555. // 圆环图各环节的名称和值(系列中各数据项的名称和值)
  556. data = [{
  557. name: '已完成量',
  558. value: Number(this.chartsData[i].biViewInfoList[0].count).toFixed(2),
  559. type: '采购合同'
  560. }, {
  561. name: '待完成量',
  562. value: Number(this.chartsData[i].biViewInfoList[1].count).toFixed(2),
  563. type: '采购合同'
  564. }]
  565. text = '合同总量'
  566. formatter = '{b}{c}吨 </br> 占比{d}%'
  567. graphicText = ' \n\n总量合计\n\n' + Number(this.chartsData[i].total).toFixed(2)
  568. break;
  569. case 1:
  570. // 圆环图各环节的颜色
  571. color = ['#247ef4', '#3a3b40'];
  572. // 圆环图各环节的名称和值(系列中各数据项的名称和值)
  573. data = [{
  574. name: '已开票',
  575. value: Number(this.chartsData[i].biViewInfoList[0].count).toFixed(2),
  576. type: '采购合同'
  577. }, {
  578. name: '待开票',
  579. value: Number(this.chartsData[i].biViewInfoList[1].count).toFixed(2),
  580. type: '采购合同'
  581. }]
  582. text = '合同总额'
  583. formatter = '{b}{c}元 </br> 占比{d}%'
  584. graphicText = ' \n\n开票合计\n\n' + Number(this.chartsData[i].total).toFixed(2)
  585. break;
  586. case 2:
  587. // 圆环图各环节的颜色
  588. color = ['#f49f23', '#3a3b40'];
  589. // 圆环图各环节的名称和值(系列中各数据项的名称和值)
  590. data = [{
  591. name: '已付款',
  592. value: Number(this.chartsData[i].biViewInfoList[0].count).toFixed(2),
  593. type: '采购合同'
  594. }, {
  595. name: '待付款',
  596. value: Number(this.chartsData[i].biViewInfoList[1].count).toFixed(2),
  597. type: '采购合同'
  598. }]
  599. text = '合同总额'
  600. formatter = '{b}{c}元 </br> 占比{d}%'
  601. graphicText = ' \n\n付款合计\n\n' + Number(this.chartsData[i].total).toFixed(2)
  602. break;
  603. case 3:
  604. // 圆环图各环节的颜色
  605. color = ['#75d1f4', '#3a3b40'];
  606. // 圆环图各环节的名称和值(系列中各数据项的名称和值)
  607. data = [{
  608. name: '已完成量',
  609. value: Number(this.chartsData[i].biViewInfoList[0].count).toFixed(2),
  610. type: '销售合同'
  611. }, {
  612. name: '待完成量',
  613. value: Number(this.chartsData[i].biViewInfoList[1].count).toFixed(2),
  614. }]
  615. text = '合同总量'
  616. formatter = '{b}{c}吨 </br> 占比{d}%'
  617. graphicText = ' \n\n总量合计\n\n' + Number(this.chartsData[i].total).toFixed(2)
  618. break;
  619. case 4:
  620. // 圆环图各环节的颜色
  621. color = ['#247ef4', '#3a3b40'];
  622. // 圆环图各环节的名称和值(系列中各数据项的名称和值)
  623. data = [{
  624. name: '已开票',
  625. value: Number(this.chartsData[i].biViewInfoList[0].count).toFixed(2),
  626. }, {
  627. name: '待开票',
  628. value: Number(this.chartsData[i].biViewInfoList[1].count).toFixed(2),
  629. }]
  630. text = '合同总额'
  631. formatter = '{b}{c}元 </br> 占比{d}%'
  632. graphicText = ' \n\n开票合计\n\n' + Number(this.chartsData[i].total).toFixed(2)
  633. break;
  634. case 5:
  635. // 圆环图各环节的颜色
  636. color = ['#f49f23', '#3a3b40'];
  637. // 圆环图各环节的名称和值(系列中各数据项的名称和值)
  638. data = [{
  639. name: '已付款',
  640. value: Number(this.chartsData[i].biViewInfoList[0].count).toFixed(2),
  641. }, {
  642. name: '待付款',
  643. value: Number(this.chartsData[i].biViewInfoList[1].count).toFixed(2),
  644. }]
  645. text = '合同总额'
  646. formatter = '{b}{c}元 </br> 占比{d}%'
  647. graphicText = ' \n\n付款合计\n\n' + Number(this.chartsData[i].total).toFixed(2)
  648. break;
  649. }
  650. myChart.setOption({
  651. title: [{
  652. text: text,
  653. top: '2%',
  654. left: '3%',
  655. textStyle: {
  656. color: '#f4f4f4',
  657. fontSize: 18,
  658. }
  659. }],
  660. // 图例
  661. legend: [{
  662. selectedMode: true, // 图例选择的模式,控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 false 关闭。
  663. top: '10%',
  664. left: 'center',
  665. con: 'circle',
  666. itemWidth: 10, // 设置宽度
  667. itemHeight: 10, // 设置高度
  668. itemGap: 40, // 设置间距
  669. textStyle: { // 图例的公用文本样式。
  670. fontSize: 14,
  671. color: '#fff'
  672. },
  673. data: data
  674. }],
  675. // 提示框
  676. tooltip: {
  677. show: true, // 是否显示提示框
  678. formatter: formatter // 提示框显示内容,此处{b}表示各数据项名称,此项配置为默认显示项,{c}表示数据项的值,默认不显示,({d}%)表示数据项项占比,默认不显示。
  679. },
  680. // graphic 是原生图形元素组件。可以支持的图形元素包括:image, text, circle, sector, ring, polygon, polyline, rect, line, bezierCurve, arc, group,
  681. graphic: {
  682. type: 'text', // [ default: image ]用 setOption 首次设定图形元素时必须指定。image, text, circle, sector, ring, polygon, polyline, rect, line, bezierCurve, arc, group,
  683. top: 'center', // 描述怎么根据父元素进行定位。top 和 bottom 只有一个可以生效。如果指定 top 或 bottom,则 shape 里的 y、cy 等定位属性不再生效。『父元素』是指:如果是顶层元素,父元素是 echarts 图表容器。如果是 group 的子元素,父元素就是 group 元素。
  684. left: 'center', // 同上
  685. style: {
  686. text: graphicText, // 文本块文字。可以使用 \n 来换行。[ default: '' ]
  687. fill: '#fff', // 填充色。
  688. fontSize: 16, // 字体大小
  689. fontWeight: 'bold' // 文字字体的粗细,可选'normal','bold','bolder','lighter'
  690. }
  691. },
  692. // 系列列表
  693. series: [{
  694. name: '', // 系列名称
  695. type: 'pie', // 系列类型
  696. center: ['50%', '55%'], // 饼图的中心(圆心)坐标,数组的第一项是横坐标,第二项是纵坐标。[ default: ['50%', '50%'] ]
  697. radius: ['45%', '55%'], // 饼图的半径,数组的第一项是内半径,第二项是外半径。[ default: [0, '75%'] ]
  698. hoverAnimation: true, // 是否开启 hover 在扇区上的放大动画效果。[ default: true ]
  699. color: color, // 圆环图的颜色
  700. label: { // 饼图图形上的文本标签,可用于说明图形的一些数据信息,比如值,名称等.
  701. normal: {
  702. show: true, // 是否显示标签[ default: false ]
  703. position: 'outside', // 标签的位置。'outside'饼图扇区外侧,通过视觉引导线连到相应的扇区。'inside','inner' 同 'inside',饼图扇区内部。'center'在饼图中心位置。
  704. formatter: '{c}', // 标签内容
  705. color: '#d5d5d6',
  706. fontSize: 16,
  707. }
  708. },
  709. labelLine: { // 标签的视觉引导线样式,在 label 位置 设置为'outside'的时候会显示视觉引导线。
  710. normal: {
  711. show: true, // 是否显示视觉引导线。
  712. length: 15, // 在 label 位置 设置为'outside'的时候会显示视觉引导线。
  713. length2: 10, // 视觉引导项第二段的长度。
  714. lineStyle: { // 视觉引导线的样式
  715. //color: '#000',
  716. //width: 1
  717. }
  718. }
  719. },
  720. data: data // 系列中的数据内容数组。
  721. }]
  722. })
  723. myChart.off('click');
  724. myChart.on('click', function(params) {
  725. // var a = params.dataIndex
  726. // console.log(params, '我被点击了');
  727. // app.dialogVisible = true
  728. return
  729. })
  730. }
  731. console.log(this.totalReserves)
  732. let _x = []
  733. let _y = []
  734. for (let i = 0; i < this.totalReserves.length; i++) {
  735. _x.push(this.totalReserves[i].name)
  736. _y.push(this.totalReserves[i].count)
  737. }
  738. // 柱状图
  739. let myChart7 = app.$echarts.init(this.$refs.myEchart7);
  740. var zoption = {
  741. grid: {
  742. left: '0',
  743. right: '0',
  744. bottom: '0',
  745. top: '30',
  746. containLabel: true
  747. },
  748. // --- 提示框 ----
  749. tooltip: {
  750. show: true, // 是否显示提示框,默认为true
  751. trigger: 'item', // 数据项图形触发
  752. axisPointer: { // 指示样式
  753. type: 'shadow',
  754. axis: 'auto'
  755. },
  756. padding: 5,
  757. textStyle: { // 提示框内容的样式
  758. color: '#fff'
  759. }
  760. },
  761. // ------ X轴 ------
  762. xAxis: {
  763. axisLabel: { // 坐标轴标签
  764. show: true, // 是否显示
  765. inside: false, // 是否朝内
  766. rotate: 0, // 旋转角度
  767. margin: 10, // 刻度标签与轴线之间的距离
  768. color: '#666', // 默认取轴线的颜色
  769. interval: 0,
  770. rotate: 40
  771. },
  772. splitArea: { // 网格区域
  773. show: false // 是否显示,默认为false
  774. },
  775. data: _x
  776. },
  777. // ------ y轴 ----------
  778. yAxis: {
  779. axisLine: { // 坐标轴 轴线
  780. show: false, // 是否显示
  781. },
  782. axisLabel: { // 坐标轴的标签
  783. show: true, // 是否显示
  784. inside: false, // 是否朝内
  785. rotate: 0, // 旋转角度
  786. margin: 8, // 刻度标签与轴线之间的距离
  787. color: '#666', // 默认轴线的颜色
  788. },
  789. splitLine: { // gird 区域中的分割线
  790. show: true, // 是否显示
  791. lineStyle: {
  792. color: '#666',
  793. width: 1,
  794. type: 'dashed'
  795. }
  796. }
  797. },
  798. // ------- 内容数据 -------
  799. series: [{
  800. name: '储量', // 序列名称
  801. type: 'bar', // 类型
  802. legendHoverLink: true, // 是否启用图列 hover 时的联动高亮
  803. // label: { // 图形上的文本标签
  804. // show: false,
  805. // position: 'insideTop', // 相对位置
  806. // rotate: 0, // 旋转角度
  807. // color: '#eee'
  808. // },
  809. itemStyle: { // 图形的形状
  810. color: '#3779fd'
  811. // barBorderRadius: [18, 18, 0 ,0]
  812. },
  813. barWidth: 20, // 柱形的宽度
  814. barCategoryGap: '20%', // 柱形的间距
  815. label: {
  816. show: true,
  817. position: 'top',
  818. color: '#b0b1b3'
  819. },
  820. data: _y
  821. }]
  822. };
  823. myChart7.setOption(zoption)
  824. },
  825. handleClose(done) {
  826. this.$confirm('确认关闭?')
  827. .then(_ => {
  828. done();
  829. })
  830. .catch(_ => {});
  831. },
  832. // 下载通知通函
  833. downloadNotification(item) {
  834. zipDown({
  835. appendixIds: item.attachmentPath,
  836. baseUrl: this.$store.getters.baseInfo.fileUrl,
  837. zipName: item.theme
  838. })
  839. },
  840. /**
  841. * 校验各种弹框问题
  842. * @Desc 不是本人原意, 请不要骂我 谢谢. 请联系 "后台开发人员" 梳理逻辑
  843. */
  844. async checkUserInfoDialog() {
  845. const {
  846. statusFlag,
  847. loginInfo: {
  848. loginFlag = 0
  849. },
  850. daysRemaining,
  851. customerServiceStaffPhone
  852. } = JSON.parse(localStorage.getItem('ws_login_getTenantInfoByUser'))
  853. if (statusFlag * 1 === 3) {
  854. // 判断后台返回的是空 还是 0 是空还是 0 的时候请求后台接口 不懂啥意思 为啥要这么弄
  855. if (!loginFlag && !localStorage.getItem('isShowTryUserDialog') * 1) {
  856. let newId = JSON.parse(localStorage.getItem('ws_login_accountId'))
  857. this.phone = customerServiceStaffPhone
  858. this.successfulDialog = true
  859. localStorage.setItem('isShowTryUserDialog', '1')
  860. await getChangeLoginFlag({
  861. accountId: newId
  862. }).toPromise()
  863. }
  864. }
  865. // 试用租户
  866. const dayDialog = [30, 15, 7, 5, 3, 2, 1, 0]
  867. if (statusFlag * 1 === 2 && dayDialog.indexOf(daysRemaining) > -1 && !localStorage.getItem(
  868. 'isShowTryUserDialog') * 1) {
  869. this.day = daysRemaining
  870. this.phone = customerServiceStaffPhone
  871. this.trialNotExpired = true
  872. localStorage.setItem('isShowTryUserDialog', '1')
  873. }
  874. },
  875. trialNotExpiredClose() {
  876. this.trialNotExpired = false
  877. },
  878. //第一次登陆的弹窗
  879. successfulDialogClose() {
  880. this.successfulDialog = false
  881. },
  882. initShipMap() {
  883. var options = {
  884. ak: 'c0ed286f357b7f4c7312476637a7ab04',
  885. // 初始中心点坐标
  886. centerPoint: [30.171, 121.27],
  887. zoom: 3,
  888. minZoom: 2,
  889. maxZoom: 18,
  890. defaultMapType: 'MT_SEA', //默认海图
  891. // 公司版权信息( 支持html ),默认Elane Inc.
  892. // attribution: {
  893. // isShow: false,
  894. // emptyString: '&copy;2019 <a class="shipxy_small"></a>&nbsp;<a>WinSea Inc.</a>'
  895. // },
  896. // measureCtrl: {
  897. // isShow: false
  898. // },
  899. // mousePostionCtrl: {
  900. // isShow: false
  901. // },
  902. // zoomControlElane: {
  903. // isShow: true,
  904. // position: 'bottomright'
  905. // },
  906. // zoomviewControl: {
  907. // isShow: false,
  908. // position: 'bottomright'
  909. // },
  910. // basemapsControl: {
  911. // isShow: false,
  912. // position: 'topright'
  913. // },
  914. // scaleCtrl: {
  915. // isShow: true,
  916. // position: 'bottomleft'
  917. // }
  918. }
  919. // 创建地图示例
  920. // eslint-disable-next-line no-undef
  921. this.mapXY = new ShipxyAPI.Map('mapXY', options)
  922. // eslint-disable-next-line no-undef
  923. this.shipService = ShipxyAPI.ShipService(this.mapXY, {
  924. enableAreaShip: false,
  925. enableFleetShip: false,
  926. isAutoUpdateSrvtime: false,
  927. // delayTime: 5000,
  928. lableFont: ['500 12px Arial', '500 12px 宋体'], // 船舶名称,文字字体,默认值:["600 12px Arial", "500 12px Arial"]
  929. lableTxtColor: ['#fff', '#fff'], // 船舶名称,文字颜色,默认值:["#000","#fff"]
  930. // lableLineColor: ['rgba(1, 30, 62, 0)', 'rgba(1, 30, 62, 0)'], // 边框颜色,默认值:["#000","#000"]
  931. // lableLinefillColor: ['rgba(0, 0, 0, 0.6)', 'rgba(0, 0, 0, 0.6)'], // 框内填充颜色,默认值:[null,null]
  932. // obliqueLineColor: ['#000', '#000'], // 船舶名称,斜线颜色,默认值:[null,null]
  933. // dShipColor: '#FF6437', // D+船颜色,默认:#ff6347
  934. zoomLevel_data: 1,
  935. zoomLevel_base: 1,
  936. getAreaShipsCallBack: (call) => {
  937. // console.info(call, 'getAreaShipsCallBack')
  938. },
  939. drawShipsEndCallBack: (call) => {
  940. // console.info(call, 'drawShipsEndCallBack')
  941. }
  942. })
  943. this.shipService.setPointerEvents(true)
  944. window.shipService = this.shipService
  945. //获取船舶列表
  946. this.getShipList()
  947. },
  948. toRoute(url) {
  949. this.$router.push(url)
  950. },
  951. toSetShow() {
  952. this.showBlockList = []
  953. this.setFlag = true
  954. // getStaffHomeShowList({
  955. // staffId: localStorage.getItem('ws-pf_userId')
  956. // }).toPromise().then(data => {
  957. // for (let i = 0; i < data.length; i++) {
  958. // if (data[i].typeId === 'shipMap' && data[i].showFlag) {
  959. // this.showBlockList.push('船舶动态')
  960. // } else {
  961. // this.showBlockList = []
  962. // }
  963. // }
  964. // })
  965. },
  966. toMap() {
  967. this.$router.push('/map/trajectory_child')
  968. },
  969. goNews() {
  970. this.$router.push('/news/noticeType')
  971. },
  972. goNewsDetail(id) {
  973. this.$router.push('/news/noticeDetails?id=' + id)
  974. },
  975. goNotice(data) {
  976. this.$router.push({
  977. name: 'notificationItDetail',
  978. query: {
  979. id: data.id
  980. }
  981. })
  982. },
  983. goNoticeMore() {
  984. this.$router.push('/notice/notificationCircularReleasedIt_child')
  985. },
  986. toHide(index) {
  987. this.changeVesslBank([{
  988. id: this.userSetting['shipMap'][0].id,
  989. staffId: localStorage.getItem('ws-pf_userId'),
  990. typeId: 'shipMap',
  991. showFlag: false
  992. }])
  993. },
  994. getRouteList() {
  995. let data = {
  996. accountId: localStorage.getItem('ws-pf_userId'),
  997. pageSize: 30
  998. }
  999. findHottestRouting(data).toPromise().then(res => {
  1000. this.routeList = res
  1001. if (res.length == 0) {
  1002. this.blockList[0].flag = false
  1003. }
  1004. })
  1005. },
  1006. //获取新闻
  1007. getNewList() {
  1008. let data = {
  1009. currentPage: 1,
  1010. pageSize: 2,
  1011. loginUserId: localStorage.getItem('ws-pf_userId'),
  1012. compId: localStorage.getItem('ws-pf_compId'),
  1013. releaseFlag: 0
  1014. }
  1015. // queryHomePage(data).toPromise().then(resNewList => {
  1016. // for (let i of resNewList) {
  1017. // i.content = '<p>' + i.content.replace(/<[^>]+>/g, '') + '</p>'
  1018. // }
  1019. // this.newList = resNewList
  1020. // for (let i of this.newList) {
  1021. // if (i.ossCoverUrl && i.ossCoverUrl.length > 0) {
  1022. // } else {
  1023. // this.$set(
  1024. // i,
  1025. // 'imgUrl',
  1026. // require('@/assets/images/page/home/noImg.png')
  1027. // )
  1028. // }
  1029. // }
  1030. // })
  1031. },
  1032. //获取通知通函
  1033. // getNoticeList () {
  1034. // let pagesize = Math.floor((this.$refs.noticeList.clientHeight - 44) / 80)
  1035. // let data = {
  1036. // currentPage: 1,
  1037. // pageSize: pagesize || 3,
  1038. // vesselDeptId:
  1039. // localStorage.getItem('ws-pf_vesselBankFlag') === 'V'
  1040. // ? localStorage.getItem('ws-pf_vesselId')
  1041. // : localStorage.getItem('ws-pf_deptId'),
  1042. // compId: localStorage.getItem('ws-pf_compId')
  1043. // }
  1044. // // TODO: 【此处有问题】接口变更的不对
  1045. // queryCircularManagementReceiveList(data)
  1046. // .toPromise()
  1047. // .then(response => {
  1048. // this.noticeList = response.records
  1049. // })
  1050. // },
  1051. // 获取船舶状态
  1052. getNaviStatusStr(t) {
  1053. var array = [
  1054. this.$t('home.navistatus0'),
  1055. this.$t('home.navistatus1'),
  1056. this.$t('home.navistatus2'),
  1057. this.$t('home.navistatus3'),
  1058. this.$t('home.navistatus4'),
  1059. this.$t('home.navistatus5'),
  1060. this.$t('home.navistatus6'),
  1061. this.$t('home.navistatus7'),
  1062. this.$t('home.navistatus8')
  1063. ]
  1064. if (t >= 0 && t <= 8) {
  1065. return array[t]
  1066. }
  1067. return ''
  1068. },
  1069. // 获取船舶状态
  1070. getNaviStatusBg(t) {
  1071. var array = [
  1072. 'bg0',
  1073. 'bg1',
  1074. 'bg2',
  1075. 'bg3',
  1076. 'bg4',
  1077. 'bg5',
  1078. 'bg6',
  1079. 'bg7',
  1080. 'bg8'
  1081. ]
  1082. if (t >= 0 && t <= 8) {
  1083. return array[t]
  1084. }
  1085. return ''
  1086. },
  1087. getShipList() {
  1088. getUserVesselList({
  1089. vesselStatus: 'UNDER_CONTROL'
  1090. }).toPromise().then(res => {
  1091. this.shipList = []
  1092. let num = res.length > 10 ? 10 : res.length
  1093. let obj = {}
  1094. for (let i = 0; i < num; i++) {
  1095. if (res[i].mmsiCode && res[i].mmsiCode.length > 0) {
  1096. obj = this.shipService.getShipByMmsi(res[i].mmsiCode) ?
  1097. this.shipService.getShipByMmsi(res[i].mmsiCode) : {}
  1098. obj.vesselName = res[i].vesselName
  1099. this.shipList.push(obj)
  1100. }
  1101. }
  1102. //我想不出还有什么招了:临时解决办法
  1103. const oldList = this.shipList
  1104. for (let i = 1; i < 5; i++) {
  1105. oldList.forEach(item => {
  1106. this.shipList.push(item)
  1107. })
  1108. }
  1109. })
  1110. },
  1111. onTodoClick() {
  1112. this.$router.push({
  1113. name: 'workNotification'
  1114. })
  1115. },
  1116. onMsgClick() {
  1117. this.$router.push({
  1118. name: 'message'
  1119. })
  1120. },
  1121. onChange(list) {},
  1122. onShipMenuItemClick(ship) {
  1123. this.selectShip = ship
  1124. if (ship) {
  1125. this.$refs.shipMap.selectShip(ship.id)
  1126. } else {
  1127. this.$refs.shipMap.unSelectShip()
  1128. }
  1129. },
  1130. onFullScreen() {
  1131. this.isFullScreen = !this.isFullScreen
  1132. },
  1133. onNoticeMoreBtnClick() {
  1134. this.$router.push({
  1135. name: 'notice'
  1136. })
  1137. },
  1138. onShipSelectEvent(shipid) {
  1139. this.selectShip = this.ships.find(item => {
  1140. return item.id == shipid
  1141. })
  1142. },
  1143. getCityName(encity) {
  1144. if (getLanguage() === 'zh') {
  1145. return getCnCity(encity)
  1146. }
  1147. return encity
  1148. },
  1149. getWeaName(enwea) {
  1150. if (getLanguage() === 'zh') {
  1151. return getCnWea(enwea)
  1152. }
  1153. return enwea
  1154. },
  1155. gotoNewRw(data) {
  1156. if (data === 'message') {
  1157. this.$router.push({
  1158. name: 'message',
  1159. query: {
  1160. types: data
  1161. }
  1162. })
  1163. } else {
  1164. this.$router.push({
  1165. name: 'workNotification',
  1166. query: {
  1167. types: data
  1168. }
  1169. })
  1170. }
  1171. },
  1172. test() {
  1173. console.log('testtesttesttest');
  1174. },
  1175. async test1() {
  1176. console.log('testtesttesttest111111');
  1177. },
  1178. async openPort() {
  1179. console.log('openPort', navigator);
  1180. if ('serial' in navigator) {
  1181. // The Web Serial API is supported.
  1182. console.log('the Web Serial API is supported.');
  1183. console.log(this.param);
  1184. const port = await navigator.serial.requestPort();
  1185. await port.open({
  1186. baudRate: this.param
  1187. }); // set baud rate
  1188. this.reader = port.readable.getReader();
  1189. // 监听来自串行设备的数据
  1190. while (true) {
  1191. const {
  1192. value,
  1193. done
  1194. } = await this.reader.read();
  1195. if (done) {
  1196. // 允许稍后关闭串口。
  1197. this.reader.releaseLock();
  1198. break;
  1199. }
  1200. console.log('value:', value);
  1201. var result = '';
  1202. var flag = false;
  1203. for (var i = value.length - 1; i >= 0; i--) {
  1204. var tmp = String.fromCharCode(value[i])
  1205. if (tmp == '=') {
  1206. flag = true
  1207. }
  1208. if (flag && result.length < 9 && tmp != '=') {
  1209. result += tmp
  1210. }
  1211. }
  1212. // setTimeout(1000)
  1213. if (parseInt(result)) {
  1214. console.log('result:', result);
  1215. this.text = parseInt(result)
  1216. }
  1217. console.log('this.text:', this.text);
  1218. // value 是一个 Uint8Array
  1219. }
  1220. await port.close();
  1221. } else {
  1222. console.log('the Web Serial API is not supported.', navigator);
  1223. }
  1224. },
  1225. async closePort() {
  1226. console.log('closePort');
  1227. this.reader.cancel()
  1228. }
  1229. }
  1230. }
  1231. </script>
  1232. <style lang="scss" scoped>
  1233. .home {
  1234. padding: 10px;
  1235. overflow-y: auto;
  1236. // background-color: #eee;
  1237. width: 100%;
  1238. height: calc(100vh - 60px);
  1239. .set-img {
  1240. width: 25px;
  1241. height: 25px;
  1242. position: fixed;
  1243. right: 0;
  1244. bottom: 99px;
  1245. z-index: 1000;
  1246. }
  1247. .shortcut-entrance {
  1248. width: 100%;
  1249. height: 60px;
  1250. background: #fff;
  1251. margin-bottom: 10px;
  1252. padding: 0 20px;
  1253. line-height: 60px;
  1254. display: flex;
  1255. justify-content: space-between;
  1256. align-items: center;
  1257. .shortcut-entrance-left {
  1258. font-size: 16px;
  1259. font-weight: bold;
  1260. color: #333333;
  1261. width: 50%;
  1262. overflow: hidden;
  1263. height: 100%;
  1264. }
  1265. .shortcut-entrance-right {
  1266. width: 14px;
  1267. height: 14px;
  1268. }
  1269. }
  1270. .body-middle {
  1271. display: flex;
  1272. width: 100%;
  1273. height: calc(100vh - 60px);
  1274. .body-middle-left {
  1275. width: 100%;
  1276. // margin-right: 10px;
  1277. .panel-list {
  1278. display: flex;
  1279. color: #ffffff;
  1280. text-shadow: 0px 1px 1px rgba(111, 52, 0, 0.55);
  1281. }
  1282. .ship-list-body {
  1283. position: relative;
  1284. width: 300px;
  1285. margin-top: 10px;
  1286. .shipList-box {
  1287. width: 85%;
  1288. margin: 0 auto;
  1289. .shipList-icon {
  1290. position: absolute;
  1291. top: 6px;
  1292. left: 0px;
  1293. }
  1294. .shipList-name {
  1295. cursor: context-menu;
  1296. font-size: 16px;
  1297. font-weight: bold;
  1298. line-height: 26px;
  1299. color: #333333;
  1300. max-width: 100px;
  1301. white-space: nowrap;
  1302. overflow: hidden;
  1303. text-overflow: ellipsis;
  1304. }
  1305. .shipList-address {
  1306. cursor: context-menu;
  1307. font-size: 14px;
  1308. color: #666666;
  1309. line-height: 35px;
  1310. }
  1311. .shipList-time {
  1312. cursor: context-menu;
  1313. font-size: 14px;
  1314. color: #666666;
  1315. line-height: 20px;
  1316. }
  1317. .ship-list-status {
  1318. cursor: context-menu;
  1319. margin-left: 20px;
  1320. padding: 5px 10px;
  1321. border-radius: 20px;
  1322. color: #fff;
  1323. max-width: 90px;
  1324. white-space: nowrap;
  1325. overflow: hidden;
  1326. text-overflow: ellipsis;
  1327. }
  1328. .bg0 {
  1329. background: #7ed321;
  1330. }
  1331. .bg1 {
  1332. background: #ff8f00;
  1333. }
  1334. .bg2 {
  1335. background: #495b61;
  1336. }
  1337. .bg3 {
  1338. background: #4fc3f7;
  1339. }
  1340. .bg4 {
  1341. background: #26a69a;
  1342. }
  1343. .bg5 {
  1344. background: #9c7fee;
  1345. }
  1346. .bg6 {
  1347. background: #ff5722;
  1348. }
  1349. .bg7 {
  1350. background: #8d6e63;
  1351. }
  1352. .bg8 {
  1353. background: #fadd60;
  1354. }
  1355. }
  1356. }
  1357. .notice-list {
  1358. width: calc(50% - 7px);
  1359. background: #fff;
  1360. margin-top: 10px;
  1361. // height: calc(100% - 180px);
  1362. // min-height: 460px;
  1363. border-radius: 4px;
  1364. // float: left;
  1365. }
  1366. .news-list {
  1367. width: calc(50% - 7px);
  1368. // float: left;
  1369. background: #fff;
  1370. margin-top: 10px;
  1371. // height: calc(100% - 180px);
  1372. height: 285px;
  1373. overflow: hidden;
  1374. // min-height: 460px;
  1375. border-radius: 4px;
  1376. // margin-right: 10px;
  1377. .new-list-box {
  1378. padding: 0 10px;
  1379. .new-list-body:first-child {
  1380. padding-bottom: 20px;
  1381. border-bottom: 1px solid #eeeeee;
  1382. }
  1383. .new-list-body:last-child {
  1384. padding-top: 20px;
  1385. }
  1386. }
  1387. .new-list-body {
  1388. width: 100%;
  1389. padding: 10px 0;
  1390. display: flex;
  1391. border-bottom: 1px solid #eeeeee;
  1392. // height: 50%;
  1393. overflow: hidden;
  1394. // padding: 10px;
  1395. // display: flex;
  1396. .new-list-img {
  1397. // height: 100%;
  1398. width: 160px;
  1399. height: 100px;
  1400. position: relative;
  1401. // margin-right: 20px;
  1402. .newsTJ {
  1403. position: absolute;
  1404. width: 54px;
  1405. height: 50px;
  1406. left: 0;
  1407. top: 0;
  1408. }
  1409. img {
  1410. width: 100%;
  1411. height: 100%;
  1412. display: block;
  1413. }
  1414. }
  1415. .new-list-title {
  1416. color: #343434;
  1417. line-height: 30px;
  1418. font-size: 14px;
  1419. font-weight: bold;
  1420. overflow: hidden;
  1421. text-overflow: ellipsis;
  1422. white-space: nowrap;
  1423. span {
  1424. cursor: pointer;
  1425. display: block;
  1426. }
  1427. }
  1428. .new-list-content {
  1429. color: #666666;
  1430. font-size: 12px;
  1431. line-height: 16px;
  1432. display: -webkit-box;
  1433. -webkit-box-orient: vertical;
  1434. -webkit-line-clamp: 3;
  1435. overflow: hidden;
  1436. height: 48px;
  1437. span {
  1438. cursor: pointer;
  1439. display: block;
  1440. }
  1441. }
  1442. .new-list-date {
  1443. color: #999999;
  1444. font-size: 12px;
  1445. text-align: right;
  1446. line-height: 22px;
  1447. span {
  1448. cursor: pointer;
  1449. display: block;
  1450. }
  1451. }
  1452. }
  1453. // .new-list-body:hover {
  1454. // background: #e2edfa;
  1455. // cursor: pointer;
  1456. // }
  1457. .no-line {
  1458. border-bottom: 0px solid #eeeeee;
  1459. }
  1460. }
  1461. .v-width {
  1462. width: calc(50% - 7px);
  1463. }
  1464. }
  1465. .body-middle-right {
  1466. width: calc(30% - 10px);
  1467. .notice-list {
  1468. height: 50%;
  1469. background: #fff;
  1470. width: 100%;
  1471. min-height: 300px;
  1472. border-radius: 4px;
  1473. .notice-list-body {
  1474. border-bottom: 1px solid #eeeeee;
  1475. padding: 20px 10px;
  1476. .notice-list-title {
  1477. color: #333333;
  1478. font-size: 14px;
  1479. font-weight: bold;
  1480. line-height: 18px;
  1481. overflow: hidden;
  1482. text-overflow: ellipsis;
  1483. white-space: nowrap;
  1484. }
  1485. .notice-list-type {
  1486. margin: 9px 0 12px 0;
  1487. color: #666666;
  1488. }
  1489. .notice-list-person {
  1490. color: #666666;
  1491. font-size: 12px;
  1492. }
  1493. .notice-list-date {
  1494. color: #666666;
  1495. font-size: 12px;
  1496. margin-top: 10px;
  1497. }
  1498. }
  1499. .notice-list-body:hover {
  1500. background: #e2edfa;
  1501. cursor: pointer;
  1502. }
  1503. .notice-body-height {
  1504. height: 50%;
  1505. }
  1506. .notice-body-height1 {
  1507. height: 20%;
  1508. }
  1509. }
  1510. .notice-list-height {
  1511. height: 100%;
  1512. min-height: 638px;
  1513. }
  1514. .ship-list {
  1515. height: calc(50% - 10px);
  1516. margin-top: 10px;
  1517. background: #fff;
  1518. width: 100%;
  1519. min-height: 327px;
  1520. border-radius: 4px;
  1521. .ship-list-body {
  1522. padding: 20px 0;
  1523. border-bottom: 1px solid #eeeeee;
  1524. .ship-list-head {
  1525. display: flex;
  1526. img {
  1527. width: 14px;
  1528. height: 14px;
  1529. }
  1530. .ship-list-name {
  1531. margin: 0 20px;
  1532. font-weight: bold;
  1533. }
  1534. .ship-list-status {
  1535. border-radius: 10px;
  1536. padding: 4px 8px;
  1537. color: #ffffff;
  1538. }
  1539. .bg0 {
  1540. background: #7ed321;
  1541. }
  1542. .bg1 {
  1543. background: #ff8f00;
  1544. }
  1545. .bg2 {
  1546. background: #495b61;
  1547. }
  1548. .bg3 {
  1549. background: #4fc3f7;
  1550. }
  1551. .bg4 {
  1552. background: #26a69a;
  1553. }
  1554. .bg5 {
  1555. background: #9c7fee;
  1556. }
  1557. .bg6 {
  1558. background: #ff5722;
  1559. }
  1560. .bg7 {
  1561. background: #8d6e63;
  1562. }
  1563. .bg8 {
  1564. background: #fadd60;
  1565. }
  1566. }
  1567. .ship-list-address {
  1568. margin: 10px 0 10px 34px;
  1569. color: #666666;
  1570. }
  1571. .ship-list-date {
  1572. color: #666666;
  1573. margin-left: 34px;
  1574. }
  1575. }
  1576. /*.ship-list-body:hover{*/
  1577. /* background: #e2edfa;*/
  1578. /*}*/
  1579. }
  1580. }
  1581. }
  1582. .body-middle-height {
  1583. height: calc(100vh - 80px);
  1584. }
  1585. .list-title {
  1586. width: 100%;
  1587. // background: #f3f9fe;
  1588. background: url('~@/assets/newhome/titilebg.png') no-repeat;
  1589. background-size: 100% 100%;
  1590. height: 44px;
  1591. padding: 0 20px;
  1592. display: flex;
  1593. line-height: 44px;
  1594. justify-content: space-between;
  1595. border-radius: 4px 4px 0 0;
  1596. .list-title-name {
  1597. font-size: 16px;
  1598. font-weight: bold;
  1599. color: #333333;
  1600. }
  1601. .list-title-more {
  1602. font-size: 14px;
  1603. color: #666666;
  1604. cursor: pointer;
  1605. display: flex;
  1606. }
  1607. }
  1608. }
  1609. .el-dropdown-menu {
  1610. margin-top: -20px !important;
  1611. /*left: 1872px !important;*/
  1612. }
  1613. .seamless-warp {
  1614. // width: 100%;
  1615. width: 100%;
  1616. overflow: hidden;
  1617. margin-top: 10px;
  1618. }
  1619. .home-tzthList:nth-of-type(3) {
  1620. border: none;
  1621. }
  1622. .home-tzthList {
  1623. display: flex;
  1624. padding: 10px;
  1625. border-bottom: 1px solid #eeeeee;
  1626. .home-tzthList-type {
  1627. width: 100%;
  1628. display: flex;
  1629. font-size: 14px;
  1630. line-height: 28px;
  1631. font-weight: bold;
  1632. .home-tzthList-type-title {
  1633. color: #343434;
  1634. margin: 0;
  1635. span {
  1636. cursor: pointer;
  1637. }
  1638. }
  1639. .home-tzthList-type-theme {
  1640. color: #666666;
  1641. margin: 0;
  1642. width: 80%;
  1643. overflow: hidden;
  1644. white-space: nowrap;
  1645. text-overflow: ellipsis;
  1646. span {
  1647. cursor: pointer;
  1648. }
  1649. }
  1650. }
  1651. .home-tzthList-people {
  1652. display: flex;
  1653. justify-content: space-between;
  1654. line-height: 22px;
  1655. .home-tzthList-Personnel,
  1656. .home-tzthList-timer {
  1657. font-size: 12px;
  1658. color: #666666;
  1659. span {
  1660. cursor: pointer;
  1661. }
  1662. }
  1663. }
  1664. }
  1665. .noMore {
  1666. position: absolute;
  1667. margin: auto;
  1668. top: 0;
  1669. bottom: 0;
  1670. left: 0;
  1671. right: 0;
  1672. }
  1673. .ship-list {
  1674. width: 100%;
  1675. border-radius: 4px;
  1676. background-color: #fff;
  1677. }
  1678. //新增的图表的样式
  1679. .chart {
  1680. display: flex;
  1681. flex-wrap: wrap;
  1682. justify-content: space-between;
  1683. margin-bottom: 10px;
  1684. }
  1685. .home-tzthList-timer-left {
  1686. width: 10%;
  1687. display: flex;
  1688. align-items: center;
  1689. img {
  1690. cursor: pointer;
  1691. width: 24px;
  1692. height: 24px;
  1693. display: block;
  1694. align-items: center;
  1695. margin: 0 auto;
  1696. }
  1697. }
  1698. .header {
  1699. // background: rgb(36, 38, 45);
  1700. background: #2a2a2a;
  1701. padding: 20px;
  1702. box-sizing: border-box;
  1703. display: flex;
  1704. justify-content: space-between;
  1705. align-items: center;
  1706. .right {
  1707. color: white;
  1708. font-weight: 700;
  1709. text-align: center;
  1710. .top {
  1711. font-size: 14px;
  1712. }
  1713. .bottom {
  1714. font-size: 26px;
  1715. }
  1716. }
  1717. }
  1718. .chart-card {
  1719. // background: rgb(36, 38, 45);
  1720. position: relative;
  1721. background: #2a2a2a;
  1722. width: 350px;
  1723. margin-top: 10px;
  1724. height: 288px;
  1725. // height: 288px;
  1726. }
  1727. .title2 {
  1728. pointer-events: auto;
  1729. display: flex;
  1730. align-items: center;
  1731. justify-content: flex-start;
  1732. color: rgb(255, 255, 255);
  1733. font-weight: bold;
  1734. font-family: "Microsoft Yahei", Arial, "sans-serif";
  1735. font-size: 15px;
  1736. writing-mode: horizontal-tb;
  1737. letter-spacing: 0px;
  1738. text-overflow: ellipsis;
  1739. white-space: nowrap;
  1740. overflow: hidden;
  1741. padding: 10px;
  1742. box-sizing: border-box;
  1743. }
  1744. .content2 {
  1745. // background-color: rgb(27, 28, 30);
  1746. display: flex;
  1747. margin-top: 10px;
  1748. height: calc(100% - 170px);
  1749. h3 {
  1750. pointer-events: auto;
  1751. display: flex;
  1752. align-items: center;
  1753. justify-content: flex-start;
  1754. color: rgb(204, 204, 204);
  1755. font-weight: bold;
  1756. font-family: "Microsoft Yahei", Arial, "sans-serif";
  1757. font-size: 24px;
  1758. writing-mode: horizontal-tb;
  1759. letter-spacing: 0px;
  1760. text-overflow: ellipsis;
  1761. white-space: nowrap;
  1762. overflow: hidden;
  1763. }
  1764. .center-map {
  1765. // background: yellow;
  1766. }
  1767. .content2-aside {
  1768. width: 360px;
  1769. // height: 288px;
  1770. // background: red;
  1771. }
  1772. .content2-middle {
  1773. width: calc(100% - 720px);
  1774. margin: 0 20px 0 15px;
  1775. min-width: 910px;
  1776. .left-card {
  1777. display: flex;
  1778. // background: green;
  1779. justify-content: space-evenly;
  1780. .item {
  1781. background: #2a2a2a;
  1782. width: 28%;
  1783. height: 208px;
  1784. position: relative;
  1785. padding-left: 20px;
  1786. p:nth-of-type(1) {
  1787. color: #d5d5d5;
  1788. position: absolute;
  1789. bottom: 70px;
  1790. font-size: 16px;
  1791. }
  1792. p:nth-of-type(2) {
  1793. position: absolute;
  1794. bottom: 0px;
  1795. .number {
  1796. color: #50cad4;
  1797. font-size: 53px;
  1798. font-weight: 700;
  1799. }
  1800. .number-text {
  1801. color: #d5d5d5;
  1802. }
  1803. }
  1804. }
  1805. }
  1806. }
  1807. }
  1808. .home {
  1809. background: rgb(27, 28, 30);
  1810. padding-bottom: 20px
  1811. }
  1812. .home .body-middle-height {
  1813. height: auto;
  1814. }
  1815. .content2-map {
  1816. margin: 0;
  1817. }
  1818. .content3 {
  1819. display: flex;
  1820. justify-content: space-between;
  1821. align-items: center;
  1822. background: #2a2a2a;
  1823. padding: 10px;
  1824. .content3-number {
  1825. margin-left: 40px;
  1826. }
  1827. .blue {
  1828. font-size: 30px;
  1829. color: #50cad4;
  1830. font-weight: 600;
  1831. }
  1832. .yellow {
  1833. font-size: 30px;
  1834. color: #ffa523;
  1835. font-weight: 600;
  1836. }
  1837. .left,
  1838. .right {
  1839. display: flex;
  1840. align-items: center;
  1841. color: #d5d5d5;
  1842. }
  1843. img {
  1844. display: inline-block;
  1845. width: 35px;
  1846. height: 35px;
  1847. }
  1848. }
  1849. .bottom-tip {
  1850. position: absolute;
  1851. z-index: 11;
  1852. color: #8c8c8d;
  1853. right: 10px;
  1854. bottom: 10px;
  1855. }
  1856. </style>