DeadPig.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-09-16 11:27:35
  4. * @LastEditTime: 2021-12-22 09:35:10
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: \hyyfClient\src\views\BioSafety\DeadPig.vue
  8. -->
  9. <template>
  10. <div class="dead-pig">
  11. <!-- 筛选条件 -->
  12. <query-conditions
  13. :defaultEmit="true"
  14. :formItems="formItems"
  15. :propFormData="propFormData"
  16. @getQueryParams="handleQuery"
  17. ></query-conditions>
  18. <!-- 表格 -->
  19. <new-table
  20. :title="title"
  21. :listData="listData"
  22. :tableItems="tableItems"
  23. :shows="tableShows"
  24. :height="535"
  25. >
  26. <template v-slot:alarmPicture="slotProps">
  27. <img
  28. :src="slotProps.row.alarmPicture"
  29. @click="clickImg(slotProps.row.alarmPicture)"
  30. alt="死猪图片"
  31. width="100%"
  32. />
  33. </template>
  34. <!-- 回放按钮 -->
  35. <template v-slot:handler="slotProps">
  36. <el-button size="mini" @click="clickEvent(slotProps.row)">
  37. 查看回放
  38. </el-button>
  39. </template>
  40. </new-table>
  41. <table-footer
  42. :totals="total"
  43. :size="size"
  44. @sizeChange="sizeChange"
  45. @pageChange="pageChange"
  46. >
  47. </table-footer>
  48. <el-dialog title="图片" :visible.sync="dialogVisible" width="50%">
  49. <img :src="imgUrl" alt="死猪图片" width="100%" />
  50. <span slot="footer" class="dialog-footer">
  51. <el-button @click="dialogVisible = false">取 消</el-button>
  52. <el-button type="primary" @click="dialogVisible = false"
  53. >确 定</el-button
  54. >
  55. </span>
  56. </el-dialog>
  57. <el-dialog title="回放视频" :visible.sync="videoVisible" width="50%">
  58. <div style="width: 100%; height: 600px">
  59. <iframe
  60. v-if="videoVisible"
  61. :src="'static/dahua/index.html?' + rtsp"
  62. frameborder="0"
  63. style="width: 100%; height: 100%"
  64. >
  65. </iframe>
  66. </div>
  67. <span slot="footer" class="dialog-footer">
  68. <el-button @click="videoVisible = false">取 消</el-button>
  69. <el-button type="primary" @click="videoVisible = false">
  70. 确 定
  71. </el-button>
  72. </span>
  73. </el-dialog>
  74. </div>
  75. </template>
  76. <script>
  77. import QueryConditions from "components/bioSafety/QueryConditions";
  78. import NewTable from "components/newTable/NewTable";
  79. import TableFooter from "../../components/TableFooter";
  80. import { formItems, propFormData } from "./deadPig/queryCondition.config";
  81. import { title, tableItems, tableShows } from "./deadPig/table.config";
  82. import { mapState } from "vuex";
  83. import { timeDate } from "../../utils/index";
  84. import {
  85. getCarWash,
  86. getCarWashTotal,
  87. getCarWashVideo,
  88. } from "../../utils/chenApi";
  89. export default {
  90. name: "DeadPig",
  91. components: {
  92. QueryConditions,
  93. NewTable,
  94. TableFooter,
  95. },
  96. computed: {
  97. ...mapState(["ip"]),
  98. },
  99. data() {
  100. return {
  101. formItems: [], // 传给 QueryCondition 组件的 formItems
  102. propFormData: {}, // 传给 QueryCondition 组件的 propFormData
  103. title: "", // 传给 BioTable 组件的 title
  104. listData: [], // 传给 BioTable 组件的表格展示的值 listData
  105. tableItems: [], // 传给 BioTable 组件的表格的列表 tableItems
  106. tableShows: {},
  107. // table的翻页
  108. total: 0,
  109. size: 20,
  110. pageNum: 1,
  111. selectId: "",
  112. params: {},
  113. dialogVisible: false,
  114. imgUrl: "",
  115. rtsp: "",
  116. videoVisible: false,
  117. };
  118. },
  119. mounted() {
  120. this.formItems = formItems;
  121. this.propFormData = propFormData;
  122. this.title = title;
  123. this.tableItems = tableItems;
  124. this.tableShows = tableShows;
  125. this.pigManage();
  126. this.pigTotal();
  127. },
  128. methods: {
  129. // 获取查询条件
  130. handleQuery(params) {
  131. this.params = params;
  132. this.pageNum = 1;
  133. this.pigManage();
  134. this.pigTotal();
  135. },
  136. // 修改size
  137. sizeChange(val) {
  138. this.size = val;
  139. // this.init();
  140. this.pageNum = 1;
  141. this.pigManage();
  142. },
  143. // 修改页数
  144. pageChange(val) {
  145. this.pageNum = val;
  146. // this.init();
  147. this.pigManage();
  148. },
  149. // 死猪管理
  150. pigManage() {
  151. if (!this.params.time) {
  152. this.params.time = [
  153. timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
  154. timeDate(new Date().getTime()),
  155. ];
  156. }
  157. const loading = this.$loading({
  158. lock: true,
  159. text: "加载中...",
  160. spinner: "el-icon-loading",
  161. background: "rgba(0, 0, 0, 0.7)",
  162. });
  163. let queryParams = {
  164. pageNum: this.pageNum,
  165. pageSize: this.size,
  166. alarmStartDateString: this.params.time[0] + " 00:00:00",
  167. alarmEndDateString: this.params.time[1] + " 23:59:59",
  168. nodeCodeList: [
  169. "1002874$1$0$0",
  170. "1002875$1$0$0",
  171. "1002876$1$0$0",
  172. "1002877$1$0$0",
  173. "1002878$1$0$0",
  174. "1002879$1$0$0",
  175. "1002880$1$0$0",
  176. "1002881$1$0$0",
  177. "1002882$1$0$0",
  178. "1002883$1$0$0",
  179. "1002884$1$0$0",
  180. "1002885$1$0$0",
  181. "1002886$1$0$0",
  182. "1002887$1$0$0",
  183. "1002888$1$0$0",
  184. "1002889$1$0$0",
  185. "1002890$1$0$0",
  186. "1002891$1$0$0",
  187. "1002892$1$0$0",
  188. "1002893$1$0$0",
  189. "1002894$1$0$0",
  190. "1002895$1$0$0",
  191. "1002896$1$0$0",
  192. "1002897$1$0$0",
  193. "1002898$1$0$0",
  194. "1002899$1$0$0",
  195. "1002900$1$0$0",
  196. "1002901$1$0$0",
  197. "1002902$1$0$0",
  198. "1002903$1$0$0",
  199. "1002904$1$0$0",
  200. "1002905$1$0$0",
  201. "1002906$1$0$0",
  202. "1002907$1$0$0",
  203. "1002908$1$0$0",
  204. "1002909$1$0$0",
  205. "1002910$1$0$0",
  206. "1002911$1$0$0",
  207. "1002912$1$0$0",
  208. "1002913$1$0$0",
  209. "1002939$1$0$0",
  210. "1002939$1$0$1",
  211. "1002939$1$0$2",
  212. "1002939$1$0$3",
  213. "1002939$1$0$4",
  214. "1002939$1$0$5",
  215. "1002939$1$0$6",
  216. "1002939$1$0$7",
  217. "1002939$1$0$8",
  218. "1002939$1$0$9",
  219. "1002940$1$0$0",
  220. "1002940$1$0$1",
  221. "1002940$1$0$2",
  222. "1002940$1$0$3",
  223. "1002940$1$0$4",
  224. "1002940$1$0$5",
  225. "1002940$1$0$6",
  226. "1002940$1$0$7",
  227. "1002939$1$0$10",
  228. "1002939$1$0$11",
  229. "1002939$1$0$12",
  230. "1002939$1$0$13",
  231. "1002939$1$0$14",
  232. "1002939$1$0$15",
  233. ],
  234. deviceCategory: 1,
  235. alarmType: 303,
  236. dbType: 0,
  237. };
  238. getCarWash(queryParams).then(async (res) => {
  239. if (res) {
  240. loading.close();
  241. const result = JSON.parse(res.result);
  242. this.listData = result.data.pageData;
  243. this.listData.forEach((item) => {
  244. item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}`;
  245. });
  246. }
  247. loading.close();
  248. });
  249. },
  250. // 死猪管理 - 总数
  251. async pigTotal() {
  252. if (!this.params.time) {
  253. this.params.time = [
  254. timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
  255. timeDate(new Date().getTime()),
  256. ];
  257. }
  258. let queryParams = {
  259. orgCodeList: [],
  260. nodeCodeList: [
  261. "1002874$1$0$0",
  262. "1002875$1$0$0",
  263. "1002876$1$0$0",
  264. "1002877$1$0$0",
  265. "1002878$1$0$0",
  266. "1002879$1$0$0",
  267. "1002880$1$0$0",
  268. "1002881$1$0$0",
  269. "1002882$1$0$0",
  270. "1002883$1$0$0",
  271. "1002884$1$0$0",
  272. "1002885$1$0$0",
  273. "1002886$1$0$0",
  274. "1002887$1$0$0",
  275. "1002888$1$0$0",
  276. "1002889$1$0$0",
  277. "1002890$1$0$0",
  278. "1002891$1$0$0",
  279. "1002892$1$0$0",
  280. "1002893$1$0$0",
  281. "1002894$1$0$0",
  282. "1002895$1$0$0",
  283. "1002896$1$0$0",
  284. "1002897$1$0$0",
  285. "1002898$1$0$0",
  286. "1002899$1$0$0",
  287. "1002900$1$0$0",
  288. "1002901$1$0$0",
  289. "1002902$1$0$0",
  290. "1002903$1$0$0",
  291. "1002904$1$0$0",
  292. "1002905$1$0$0",
  293. "1002906$1$0$0",
  294. "1002907$1$0$0",
  295. "1002908$1$0$0",
  296. "1002909$1$0$0",
  297. "1002910$1$0$0",
  298. "1002911$1$0$0",
  299. "1002912$1$0$0",
  300. "1002913$1$0$0",
  301. "1002939$1$0$0",
  302. "1002939$1$0$1",
  303. "1002939$1$0$2",
  304. "1002939$1$0$3",
  305. "1002939$1$0$4",
  306. "1002939$1$0$5",
  307. "1002939$1$0$6",
  308. "1002939$1$0$7",
  309. "1002939$1$0$8",
  310. "1002939$1$0$9",
  311. "1002940$1$0$0",
  312. "1002940$1$0$1",
  313. "1002940$1$0$2",
  314. "1002940$1$0$3",
  315. "1002940$1$0$4",
  316. "1002940$1$0$5",
  317. "1002940$1$0$6",
  318. "1002940$1$0$7",
  319. "1002939$1$0$10",
  320. "1002939$1$0$11",
  321. "1002939$1$0$12",
  322. "1002939$1$0$13",
  323. "1002939$1$0$14",
  324. "1002939$1$0$15",
  325. ],
  326. deviceCategory: 1,
  327. alarmStartDateString: this.params.time[0] + " 00:00:00",
  328. alarmEndDateString: this.params.time[1] + " 23:59:59",
  329. alarmType: 303,
  330. dbType: 0,
  331. };
  332. const res = await getCarWashTotal(queryParams);
  333. if (res) {
  334. this.total = JSON.parse(res.result).data.value;
  335. }
  336. // getCarWashTotal(queryParams).then((res) => {
  337. // console.log(res.result);
  338. // this.total = JSON.parse(res.result).data.value;
  339. // });
  340. },
  341. // 点击图片放大
  342. clickImg(url) {
  343. this.dialogVisible = true;
  344. this.imgUrl = url;
  345. },
  346. // 死猪回放
  347. // 车辆洗消 - 按钮
  348. clickEvent(row) {
  349. getCarWashVideo({
  350. happendTime: row.alarmDate,
  351. channelName: row.alarmPosition,
  352. }).then((res) => {
  353. if (res.code === 0) {
  354. this.rtsp = res.URL;
  355. this.videoVisible = true;
  356. } else {
  357. this.$message.error("视频获取失败");
  358. }
  359. });
  360. },
  361. },
  362. };
  363. </script>
  364. <style scoped>
  365. .dead-pig {
  366. width: 100%;
  367. height: 100%;
  368. box-sizing: border-box;
  369. padding: 20px;
  370. }
  371. </style>