index.vue 58 KB

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