index.vue 57 KB

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