vehInfo.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <view>
  3. <u-popup :show="isShow" @close="close" :closeOnClickOverlay="true" :overlay="false" :closeable="true">
  4. <view class="container" v-if="codeType == 'vehicle'">
  5. <template v-if="renderItem(item,'vehTypeName') == '矿卡'">
  6. <u--form label-width="auto" labelAlign="right"
  7. :labelStyle="{
  8. fontSize: '28rpx',
  9. fontWeight: '700',
  10. }"
  11. >
  12. <u-row>
  13. <u-col :span="8">
  14. <u-form-item label="车牌号:" >
  15. {{renderItem(item,'label','--')}}
  16. </u-form-item>
  17. </u-col>
  18. <!-- <u-col :span="4">
  19. <u-form-item label="速度:" >
  20. {{renderItem(item,'speed','--')}}km/h
  21. </u-form-item>
  22. </u-col> -->
  23. </u-row>
  24. <u-row>
  25. <u-col :span="6">
  26. <u-form-item label="驾驶员:" >
  27. {{renderItem(item,'driverName','--')}}
  28. </u-form-item>
  29. </u-col>
  30. <u-col :span="6">
  31. <u-form-item label="联系方式:" >
  32. {{renderItem(item,'driverTel','--')}}
  33. </u-form-item>
  34. </u-col>
  35. </u-row>
  36. <u-row>
  37. <u-col :span="6">
  38. <u-form-item label="所属单位:" >
  39. {{renderItem(item,'deptName','--')}}
  40. </u-form-item>
  41. </u-col>
  42. <u-col :span="6">
  43. <u-form-item label="车型:" >
  44. {{renderItem(item,'vehTypeName','--')}}
  45. </u-form-item>
  46. </u-col>
  47. </u-row>
  48. <u-form-item label="当前载重:" >
  49. {{renderItem(item,'','--')}}
  50. </u-form-item>
  51. <u-form-item label="位置:" >
  52. {{renderItem(item,'location','--')}}
  53. </u-form-item>
  54. </u--form>
  55. <u-row style="margin: 20rpx 0;">
  56. <u-col :span="2.5">
  57. <u-button type="primary" :plain="false"
  58. text="今日轨迹" size="small" shape="circle"
  59. @click="goHistory(item,'vehicle','today')"
  60. >
  61. </u-button>
  62. </u-col>
  63. <u-col :span="2.5" :offset="0.4">
  64. <u-button type="primary" :plain="false"
  65. text="近5h轨迹" size="small" shape="circle"
  66. @click="goHistory(item,'vehicle','five')"
  67. >
  68. </u-button>
  69. </u-col>
  70. <u-col :span="2.5" :offset="0.4" v-if="renderItem(item,'isVideo','') == 1">
  71. <u-button type="primary" :plain="false"
  72. text="实时监控" size="small" shape="circle"
  73. @click="goVideo(item)"
  74. >
  75. </u-button>
  76. </u-col>
  77. <u-col :span="2.5" :offset="0.4" v-if="renderItem(item,'isVideo','') == 1">
  78. <u-button type="primary" :plain="false"
  79. text="视频回放" size="small" shape="circle"
  80. @click="goBackVideo(item)"
  81. >
  82. </u-button>
  83. </u-col>
  84. </u-row>
  85. </template>
  86. <template v-else-if="renderItem(item,'vehTypeName') == '挖机'">
  87. <u--form label-width="auto" labelAlign="right"
  88. :labelStyle="{
  89. fontSize: '28rpx',
  90. fontWeight: '700',
  91. }"
  92. >
  93. <u-row>
  94. <u-col :span="8">
  95. <u-form-item label="车牌号:" >
  96. {{renderItem(item,'label','--')}}
  97. </u-form-item>
  98. </u-col>
  99. <!-- <u-col :span="4">
  100. <u-form-item label="速度:" >
  101. {{renderItem(item,'speed','--')}}km/h
  102. </u-form-item>
  103. </u-col> -->
  104. </u-row>
  105. <u-row>
  106. <u-col :span="6">
  107. <u-form-item label="驾驶员:" >
  108. {{renderItem(item,'driverName','--')}}
  109. </u-form-item>
  110. </u-col>
  111. <u-col :span="6">
  112. <u-form-item label="联系方式:" >
  113. {{renderItem(item,'driverTel','--')}}
  114. </u-form-item>
  115. </u-col>
  116. </u-row>
  117. <u-row>
  118. <u-col :span="6">
  119. <u-form-item label="所属单位:" >
  120. {{renderItem(item,'deptName','--')}}
  121. </u-form-item>
  122. </u-col>
  123. <u-col :span="6">
  124. <u-form-item label="车型:" >
  125. {{renderItem(item,'vehTypeName','--')}}
  126. </u-form-item>
  127. </u-col>
  128. </u-row>
  129. <u-row>
  130. <u-col :span="6">
  131. <u-form-item label="需等待时长:" >
  132. {{renderItem(info,'needTime','--')}}
  133. </u-form-item>
  134. </u-col>
  135. <u-col :span="6">
  136. <u-form-item label="附近等待车数:" >
  137. <div class="hover-click" @click="openWaitCarList(info,true)">
  138. {{renderItem(info,'waitNum','--')}}
  139. </div>
  140. </u-form-item>
  141. </u-col>
  142. </u-row>
  143. </u--form>
  144. <u-row style="margin: 20rpx 0;">
  145. <u-col :span="2.5">
  146. <u-button type="primary" :plain="false"
  147. text="今日轨迹" size="small" shape="circle"
  148. @click="goHistory(item,'vehicle','today')"
  149. >
  150. </u-button>
  151. </u-col>
  152. <u-col :span="2.5" :offset="0.4">
  153. <u-button type="primary" :plain="false"
  154. text="近5h轨迹" size="small" shape="circle"
  155. @click="goHistory(item,'vehicle','five')"
  156. >
  157. </u-button>
  158. </u-col>
  159. <u-col :span="2.5" :offset="0.4" v-if="renderItem(item,'isVideo','') == 1">
  160. <u-button type="primary" :plain="false"
  161. text="实时监控" size="small" shape="circle"
  162. @click="goVideo(item)"
  163. >
  164. </u-button>
  165. </u-col>
  166. <u-col :span="2.5" :offset="0.4" v-if="renderItem(item,'isVideo','') == 1">
  167. <u-button type="primary" :plain="false"
  168. text="视频回放" size="small" shape="circle"
  169. @click="goBackVideo(item)"
  170. >
  171. </u-button>
  172. </u-col>
  173. </u-row>
  174. </template>
  175. <template v-else>
  176. <u--form label-width="auto" labelAlign="right"
  177. :labelStyle="{
  178. fontSize: '28rpx',
  179. fontWeight: '700',
  180. }"
  181. >
  182. <u-row>
  183. <u-col :span="8">
  184. <u-form-item label="车牌号:" >
  185. {{renderItem(item,'label','--')}}
  186. </u-form-item>
  187. </u-col>
  188. <u-col :span="4">
  189. <u-form-item label="速度:" >
  190. {{renderItem(item,'speed','--')}}km/h
  191. </u-form-item>
  192. </u-col>
  193. </u-row>
  194. <u-row>
  195. <u-col :span="6">
  196. <u-form-item label="司机:" >
  197. {{renderItem(item,'driverName','--')}}
  198. <view class="my-col" style="width: 50%;display: flex;justify-content: flex-end" @click="callPhone">
  199. <image
  200. src="@/static/icon/phone.png"
  201. style="width: 30rpx; height: 30rpx"
  202. ></image>
  203. <!-- <text
  204. class="routine-text"
  205. @click="callPhone(item)"
  206. style="font-size: 32rpx"
  207. >{{ item.driverTel }}</text
  208. > -->
  209. </view>
  210. </u-form-item>
  211. </u-col>
  212. <u-col :span="3" :offset="2">
  213. <u-button type="primary" :plain="false" v-if="!intercomState"
  214. text="对讲" size="small" shape="circle"
  215. @click="handleTask(item)"
  216. >
  217. </u-button>
  218. <u-button type="warning " :plain="false" v-if="intercomState"
  219. text="挂断" size="small" shape="circle"
  220. @click="handleTask(item)"
  221. >
  222. </u-button>
  223. </u-col>
  224. </u-row>
  225. <u-form-item label="最新回传:" >
  226. {{renderItem(item,'gspTime','--')}}
  227. </u-form-item>
  228. <u-form-item label="备注:" >
  229. {{renderItem(item,'remark','--')}}
  230. <view class="my-col" style="margin-left: 20rpx; display: flex;align-items: center;">
  231. <image
  232. src="@/static/icon/edit.png"
  233. style="width: 30rpx; height: 30rpx"
  234. ></image>
  235. <text
  236. class="routine-text"
  237. style="margin-left: 5rpx;font-size: 28rpx; color: #498cff"
  238. @click="remarkEdit"
  239. >编辑</text>
  240. </view>
  241. </u-form-item>
  242. <u-form-item label="位置:" >
  243. {{renderItem(item,'location','--')}}
  244. </u-form-item>
  245. </u--form>
  246. <u-row style="margin: 20rpx 0;">
  247. <u-col :span="2.5">
  248. <u-button type="primary" :plain="false"
  249. text="今日轨迹" size="small" shape="circle"
  250. @click="goHistory(item,'vehicle','today')"
  251. >
  252. </u-button>
  253. </u-col>
  254. <u-col :span="2.5" :offset="0.4">
  255. <u-button type="primary" :plain="false"
  256. text="近5h轨迹" size="small" shape="circle"
  257. @click="goHistory(item,'vehicle','five')"
  258. >
  259. </u-button>
  260. </u-col>
  261. <u-col :span="2.5" :offset="0.4" v-if="renderItem(item,'isVideo','') == 1">
  262. <u-button type="primary" :plain="false"
  263. text="实时监控" size="small" shape="circle"
  264. @click="goVideo(item)"
  265. >
  266. </u-button>
  267. </u-col>
  268. <u-col :span="2.5" :offset="0.4" v-if="renderItem(item,'isVideo','') == 1">
  269. <u-button type="primary" :plain="false"
  270. text="视频回放" size="small" shape="circle"
  271. @click="goBackVideo(item)"
  272. >
  273. </u-button>
  274. </u-col>
  275. </u-row>
  276. </template>
  277. </view>
  278. <view class="container" v-if="codeType == 'people'">
  279. <u--form label-width="auto" labelAlign="right"
  280. :labelStyle="{
  281. fontSize: '28rpx',
  282. fontWeight: '700',
  283. }"
  284. >
  285. <u-row>
  286. <u-col :span="8">
  287. <u-form-item label="姓名:" >
  288. {{renderItem(item,'label','--')}}
  289. </u-form-item>
  290. </u-col>
  291. <u-col :span="4">
  292. <u-form-item label="速度:" >
  293. {{renderItem(item,'speed','--')}}m/h
  294. </u-form-item>
  295. </u-col>
  296. </u-row>
  297. <u-form-item label="最新回传:" >
  298. {{renderItem(item,'gspTime','--')}}
  299. </u-form-item>
  300. <u-form-item label="备注:" >
  301. {{renderItem(item,'remark','--')}}
  302. </u-form-item>
  303. <u-form-item label="位置:" >
  304. {{renderItem(item,'location','--')}}
  305. </u-form-item>
  306. </u--form>
  307. <u-row style="margin: 20rpx 0;">
  308. <u-col :span="3" :offset="1">
  309. <u-button type="primary" :plain="false"
  310. text="今日轨迹" size="small" shape="circle"
  311. @click="goHistory(item,'personnel','today')"
  312. >
  313. </u-button>
  314. </u-col>
  315. <u-col :span="3" :offset="1">
  316. <u-button type="primary" :plain="false"
  317. text="近5h轨迹" size="small" shape="circle"
  318. @click="goHistory(item,'personnel','five')"
  319. >
  320. </u-button>
  321. </u-col>
  322. </u-row>
  323. </view>
  324. </u-popup>
  325. <u-modal
  326. :show="remarkShow"
  327. title="备注信息"
  328. show-cancel-button
  329. @confirm="updateRemark"
  330. @cancel="cancelRemark"
  331. >
  332. <view class="slot-content">
  333. <u--textarea v-model="remarkValue" placeholder="请输入备注信息" class="text-warp"></u--textarea>
  334. </view>
  335. </u-modal>
  336. <vehList ref="vehListRef"></vehList>
  337. <intercom ref="intercom" @oNstate="(e)=>intercomState=e"></intercom>
  338. </view>
  339. </template>
  340. <script>
  341. import {isArray,clone,isObject } from 'lodash'
  342. import {getImages} from '@/plugins/images'
  343. import {copyProps,clearProps} from '@/utils/gdtq.js'
  344. import vehList from './vehList.vue'
  345. import { queryRangeVeh, updateVehRemark, updateCleanRemark } from '@/api/realtimeWatch.js'
  346. import Intercom from '@/components/Intercom'
  347. export default {
  348. components: {
  349. vehList,
  350. Intercom,
  351. },
  352. data() {
  353. return {
  354. isShow: false,
  355. item: null,
  356. codeType: 'vehicle',
  357. info: null,
  358. remarkShow: false,
  359. remarkValue: "",
  360. intercomState:false,//对接状态
  361. }
  362. },
  363. mounted() {
  364. },
  365. methods: {
  366. handleTask(item) {
  367. this.$refs.intercom.toIntercom(item.deviceId);//13306349381
  368. },
  369. openWaitCarList(info) {
  370. this.$refs.vehListRef.show(info)
  371. },
  372. show(e) {
  373. console.log(e,'e')
  374. let {id} = e
  375. this.getVehicleDetail(id)
  376. setTimeout(() => {
  377. this.isShow= true;
  378. this.item = e
  379. this.codeType = e.code;
  380. },50)
  381. },
  382. close() {
  383. this.isShow = false
  384. },
  385. /* 获取车辆详情 */
  386. async getVehicleDetail(vehicleId) {
  387. let {data} = await queryRangeVeh({vehicleId})
  388. this.info = data
  389. },
  390. // 跳到历史轨迹
  391. goHistory(item,tabStyleType,time) {
  392. let params = {
  393. tabStyleType
  394. }
  395. if (tabStyleType == 'vehicle') {
  396. params.vehicleId = item.id
  397. } else if (tabStyleType == 'personnel') {
  398. params.userId = item.id
  399. }
  400. if (time=='today') {
  401. let s_time = this.dayjs().format('YYYY-MM-DD')
  402. let startTime = `${s_time} 00:00`;
  403. let endTime = `${s_time} 23:59`;
  404. params.time = [startTime,endTime]
  405. } else if (time=='five') {
  406. let startTime = this.dayjs().subtract(5, 'hour').format('YYYY-MM-DD HH:mm');
  407. let endTime = this.dayjs().format('YYYY-MM-DD HH:mm');
  408. params.time = [startTime,endTime]
  409. }
  410. this.$store.dispatch('setParams',params)
  411. uni.navigateTo({
  412. url: '/pagesMap/pastRoute/pastRoute',
  413. });
  414. },
  415. goVideo(item) {
  416. const {id} = item;
  417. uni.navigateTo({
  418. url: `/pagesVideo/monitor/monitor?id=${id}`,
  419. });
  420. },
  421. goBackVideo(item) {
  422. const {id} = item;
  423. uni.navigateTo({
  424. url: `/pagesVideo/h5playback/index?vehicleId=${id}`,
  425. });
  426. },
  427. callPhone(){
  428. if(!this.info.driverTel){
  429. uni.$u.toast('号码不能为空')
  430. return;
  431. }
  432. uni.makePhoneCall({
  433. phoneNumber: this.info.driverTel //仅为示例
  434. });
  435. },
  436. remarkEdit(){
  437. // 备注编辑
  438. this.remarkShow = true;
  439. this.remarkValue = this.item.remark;
  440. },
  441. async updateRemark() {
  442. let obj = {
  443. vehicleId: this.item.id,
  444. remark: this.remarkValue,
  445. };
  446. let res = await updateVehRemark(obj)
  447. if (res.code == "0") {
  448. uni.$u.toast("修改备注成功");
  449. this.item.remark = this.remarkValue;
  450. this.cancelRemark()
  451. }
  452. },
  453. cancelRemark(){
  454. this.remarkShow = false;
  455. this.remarkValue=''
  456. }
  457. },
  458. }
  459. </script>
  460. <style lang="scss" scoped>
  461. .hover-click {
  462. cursor: pointer;
  463. color: #05C0F1;
  464. text-decoration: underline;
  465. }
  466. .container {
  467. background: #fff;
  468. padding: 60rpx 0 0 20rpx;
  469. font-size: 28rpx;
  470. }
  471. .slot-content{
  472. width: 100%;
  473. }
  474. </style>