index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <DragWindow
  3. ref="ref_warning"
  4. v-if="show"
  5. @onClose="$emit('update:show', false)"
  6. title="预警记录(0000条)"
  7. v-model:layout="state.layout"
  8. close
  9. expend
  10. >
  11. <template #buttons>
  12. <div class="warning-open __hover" :class="{active: ShipMapStore.warningOpen}" @click="ShipMapStore.$patch((state) => state.warningOpen = !state.warningOpen)">
  13. 预警助手
  14. <div class="bg"/>
  15. </div>
  16. </template>
  17. <div class="warning" v-if="show" v-loading="state.loading">
  18. <CusForm
  19. labelWidth="60px"
  20. class="__cus-form_map"
  21. @handleEnter="onSearch()"
  22. >
  23. <CusFormColumn
  24. :span="16"
  25. labelWidth="0px"
  26. v-model:param="state.query.form.targetName"
  27. class="search"
  28. >
  29. <template #append>
  30. <div class="search-btn __hover" @click="onSearch">搜索</div>
  31. </template>
  32. </CusFormColumn>
  33. <div class="reset-button __hover" @click="onReset">重置</div>
  34. <div class="more-button __hover" @click="onMore">更多</div>
  35. </CusForm>
  36. <div class="new-msg">xx条新预警,点击<span class="__hover">刷新列表</span></div>
  37. <div class="list">
  38. <div class="list-content">
  39. <template v-for="item in state.query.result.data">
  40. <div class="item">
  41. <template v-for="ship in item.dynamicShipList">
  42. <div class="target">
  43. <SvgIcon name="warning" color="#FF0D0D"/>
  44. {{ ship.targetName || ship.mergeTarget }}
  45. <SvgIcon name="focus" color="#ffffff" class="__hover" style="margin-left: auto"/>
  46. </div>
  47. </template>
  48. <div class="info">
  49. <div class="info-img">
  50. <img src="@/assets/images/web/tools-warning.png"/>
  51. </div>
  52. <div class="info-detail">
  53. <div class="info-item">预警名称:{{item.ruleName}}</div>
  54. <div class="info-item">预警时间:{{item.warnTime}}</div>
  55. <div class="info-item">预警区域:{{item.areaName}}<span style="color: #1CFEFF; margin-left: 10px">查看区域</span></div>
  56. </div>
  57. </div>
  58. </div>
  59. </template>
  60. </div>
  61. <div class="list-page __cus-page_map">
  62. <CusPage
  63. :page-num="state.query.page.pageNum"
  64. :page-size="state.query.page.pageSize"
  65. :page-sizes="[10, 20, 30]"
  66. :total="state.query.result.total"
  67. @page="onPage"
  68. />
  69. </div>
  70. </div>
  71. </div>
  72. </DragWindow>
  73. <DragWindow
  74. v-if="show && state.more.show"
  75. @onClose="state.more.show = false"
  76. title="船舶预警高级查询"
  77. v-model:layout="state.more.layout"
  78. close
  79. expend
  80. >
  81. <div class="more" v-if="show && state.more.show">
  82. <div class="form">
  83. <CusForm
  84. labelWidth="100px"
  85. class="__cus-form_map"
  86. @handleEnter="onSearch()"
  87. >
  88. <CusFormColumn
  89. :span="24"
  90. label="预警开始时间"
  91. v-model:param="state.query.form.startTime"
  92. link="datetime"
  93. />
  94. <CusFormColumn
  95. :span="24"
  96. label="预警结束时间"
  97. v-model:param="state.query.form.endTime"
  98. link="datetime"
  99. />
  100. <CusFormColumn
  101. :span="24"
  102. label="预警模型"
  103. v-model:param="state.query.form.modelId"
  104. link="select"
  105. :options="DictionaryStore.warningModelList"
  106. />
  107. <CusFormColumn
  108. :span="24"
  109. label="预警规则"
  110. v-model:param="state.query.form.ruleName"
  111. />
  112. <CusFormColumn
  113. :span="24"
  114. label="船名号"
  115. v-model:param="state.query.form.targetName"
  116. />
  117. <CusFormColumn
  118. :span="24"
  119. label="融合批次号"
  120. v-model:param="state.query.form.mergeTarget"
  121. />
  122. <CusFormColumn
  123. :span="24"
  124. label="北斗终端号"
  125. v-model:param="state.query.form.beidouId"
  126. />
  127. <CusFormColumn
  128. :span="24"
  129. label="MMSI"
  130. v-model:param="state.query.form.mmsi"
  131. />
  132. <CusFormColumn
  133. :span="24"
  134. label="雷达批次号"
  135. v-model:param="state.query.form.radarTargetId"
  136. />
  137. </CusForm>
  138. </div>
  139. <div class="more-buttons">
  140. <div class="cancel __hover" @click="onReset">重置</div>
  141. <div class="submit __hover" @click="onSearch">搜索</div>
  142. </div>
  143. </div>
  144. </DragWindow>
  145. </template>
  146. <script setup lang="ts">
  147. import {computed, getCurrentInstance, markRaw, onMounted, reactive, ref, watch} from "vue";
  148. import DragWindow from '../components/drag-window.vue'
  149. import {warnModelRuleTree} from "@/api/modules/web/model";
  150. import {useDictionaryStore, useShipMapStore} from "@/stores";
  151. import {warnRecordList} from "@/api/modules/web/record";
  152. import {ElMessage} from "element-plus";
  153. const DictionaryStore = useDictionaryStore()
  154. const ShipMapStore = useShipMapStore()
  155. const {proxy} = getCurrentInstance()
  156. const props = defineProps({
  157. show: {},
  158. mapFunc: {}
  159. })
  160. const state: any = reactive({
  161. layout: {
  162. width: 400,
  163. left: 85,
  164. top: 110
  165. },
  166. query: {
  167. loading: false,
  168. page: {
  169. pageNum: 1,
  170. pageSize: 10
  171. },
  172. form: {
  173. },
  174. formReal: {},
  175. result: {
  176. total: 0,
  177. data: []
  178. }
  179. },
  180. more: {
  181. show: false,
  182. layout: {
  183. width: 400,
  184. left: 585,
  185. top: 110
  186. }
  187. }
  188. })
  189. const ref_warning = ref()
  190. watch(() => props.show, (n) => {
  191. if (n) {
  192. onSearch()
  193. }
  194. })
  195. const onPage = (pageNum, pageSize) => {
  196. state.query.page = {
  197. pageNum: pageNum,
  198. pageSize: pageSize
  199. }
  200. const params = {
  201. pageNum: state.query.page.pageNum,
  202. pageSize: state.query.page.pageSize,
  203. }
  204. // 添加表单参数
  205. for (const [k, v] of Object.entries(state.query.formReal)) {
  206. if (proxy.$util.isValue(v)) {
  207. params[k] = v
  208. }
  209. }
  210. state.query.loading = true
  211. warnRecordList(params).then(res => {
  212. if (res.code == 0) {
  213. state.query.result.total = res.total
  214. state.query.result.data = res.rows
  215. state.query.loading = false
  216. } else {
  217. ElMessage.error(res.msg)
  218. }
  219. })
  220. }
  221. const onSearch = () => {
  222. state.query.formReal = JSON.parse(JSON.stringify(state.query.form))
  223. onPage(1, state.query.page.pageSize)
  224. }
  225. const onReset = () => {
  226. state.query.page = {
  227. pageNum: 1,
  228. pageSize: 10
  229. }
  230. state.query.form = {}
  231. onSearch()
  232. }
  233. const onMore = () => {
  234. state.more.layout.top = state.layout.top
  235. state.more.layout.left = state.layout.width + state.layout.left + 20
  236. state.more.show = true
  237. }
  238. onMounted(() => {
  239. warnModelRuleTree().then(res => {
  240. DictionaryStore.initOtherDict('warningModel', res.data.map(v => {
  241. v.dictLabel = v.name
  242. v.dictValue = v.id
  243. return v
  244. }))
  245. })
  246. })
  247. </script>
  248. <style lang="scss" scoped>
  249. $mapHeight: var(--easy-map-height);
  250. .warning {
  251. height: calc($mapHeight - 250px);
  252. padding: 20px 24px;
  253. display: flex;
  254. flex-direction: column;
  255. .__cus-form_map {
  256. margin-bottom: 10px;
  257. :deep(.search) {
  258. .el-input-group__append {
  259. padding: 0;
  260. background-color: transparent;
  261. box-shadow: none;
  262. .search-btn {
  263. width: 80px;
  264. height: 100%;
  265. background: linear-gradient(150deg, #2FBCCD, #2467EB);
  266. font-weight: 400;
  267. font-size: 16px;
  268. color: #FFFFFF;
  269. display: flex;
  270. align-items: center;
  271. justify-content: center;
  272. border-radius: 0px 4px 4px 0px;
  273. }
  274. }
  275. }
  276. .reset-button {
  277. width: 64px;
  278. height: 40px;
  279. background: #6FA2EA;
  280. border-radius: 4px;
  281. font-weight: 400;
  282. font-size: 16px;
  283. color: #FFFFFF;
  284. display: flex;
  285. align-items: center;
  286. justify-content: center;
  287. margin-left: 8px;
  288. }
  289. .more-button {
  290. font-weight: 400;
  291. font-size: 16px;
  292. color: #FFFFFF;
  293. line-height: 40px;
  294. margin: 0 auto;
  295. }
  296. }
  297. .new-msg {
  298. margin-bottom: 10px;
  299. font-weight: 400;
  300. font-size: 14px;
  301. color: #FFFFFF;
  302. >span {
  303. color: #1CFEFF;
  304. }
  305. }
  306. .list {
  307. flex: 1;
  308. overflow: hidden;
  309. display: flex;
  310. flex-direction: column;
  311. .list-content {
  312. flex: 1;
  313. overflow-y: auto;
  314. gap: 10px;
  315. display: flex;
  316. flex-direction: column;
  317. .item {
  318. display: flex;
  319. flex-direction: column;
  320. border-bottom: 3px solid rgba(255, 255, 255, 0.2);
  321. padding: 24px 0;
  322. &:first-child {
  323. padding-top: 0;
  324. }
  325. .target {
  326. height: 48px;
  327. display: flex;
  328. align-items: center;
  329. background: rgba(88,148,235,0.2);
  330. border-radius: 8px;
  331. padding: 0 12px;
  332. font-weight: 400;
  333. font-size: 20px;
  334. color: #FFFFFF;
  335. .svg-icon:first-child {
  336. margin-right: 12px;
  337. }
  338. &:not(&:first-child) {
  339. margin-top: 8px;
  340. }
  341. }
  342. .info {
  343. display: flex;
  344. margin-top: 16px;
  345. .info-img {
  346. width: 144px;
  347. height: 100px;
  348. margin-right: 15px;
  349. border-radius: 4px;
  350. border: 1px solid #AED0FF;
  351. >img {
  352. width: 100%;
  353. height: 100%;
  354. }
  355. }
  356. .info-detail {
  357. font-weight: 400;
  358. font-size: 16px;
  359. color: #FFFFFF;
  360. display: flex;
  361. flex-direction: column;
  362. gap: 16px;
  363. }
  364. }
  365. }
  366. }
  367. .list-page {
  368. display: flex;
  369. justify-content: flex-end;
  370. }
  371. }
  372. }
  373. .more {
  374. padding: 26px 24px;
  375. .form {
  376. background: rgba(88, 148, 235, 0.2);
  377. border-radius: 8px;
  378. padding: 26px 54px 10px 0;
  379. .cus-form-column {
  380. margin-bottom: 16px;
  381. }
  382. }
  383. .more-buttons {
  384. width: 100%;
  385. display: flex;
  386. align-items: center;
  387. justify-content: center;
  388. gap: 16px;
  389. margin-top: 22px;
  390. >div {
  391. width: 65px;
  392. height: 40px;
  393. background: #6FA2EA;
  394. border-radius: 4px;
  395. font-weight: 400;
  396. font-size: 16px;
  397. color: #FFFFFF;
  398. display: flex;
  399. align-items: center;
  400. justify-content: center;
  401. &.submit {
  402. background-color: #4996FF;
  403. }
  404. }
  405. }
  406. }
  407. .warning-open {
  408. margin-left: auto;
  409. width: 94px;
  410. height: 32px;
  411. display: flex;
  412. align-items: center;
  413. justify-content: center;
  414. font-weight: bold;
  415. font-size: 16px;
  416. color: #FFFFFF;
  417. margin-right: 8px;
  418. position: relative;
  419. .bg {
  420. border-radius: 4px;
  421. z-index: -1;
  422. position: absolute;
  423. width: 100%;
  424. height: 100%;
  425. transform: skew(-10deg);
  426. background-image: linear-gradient(0deg, rgb(255, 255, 255, 0.3), rgb(255, 255, 255, 0.3));
  427. }
  428. &.active {
  429. .bg {
  430. background-image: linear-gradient(0deg, rgba(47, 188, 205, 1), rgba(148, 214, 180, 1));
  431. }
  432. }
  433. }
  434. </style>