DoorAdmin.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-12-17 15:50:33
  4. * @LastEditTime: 2021-12-22 09:33:53
  5. * @LastEditors: Please set LastEditors
  6. * @Description: 大门事件
  7. * @FilePath: \hyyfClient\src\views\BioSafety\DoorAdmin.vue
  8. -->
  9. <template>
  10. <div class="door-admin">
  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 "./doorAdmin/queryCondition.config";
  81. import { title, tableItems, tableShows } from "./doorAdmin/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. const loading = this.$loading({
  152. lock: true,
  153. text: "加载中...",
  154. spinner: "el-icon-loading",
  155. background: "rgba(0, 0, 0, 0.7)",
  156. });
  157. if (!this.params.time) {
  158. this.params.time = [
  159. timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
  160. timeDate(new Date().getTime()),
  161. ];
  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. eventType: 2
  169. };
  170. getCarWash(queryParams).then(async (res) => {
  171. loading.close();
  172. if (res && res.code === 0) {
  173. const result = JSON.parse(res.data);
  174. this.listData = result.data.pageData;
  175. this.listData.forEach((item) => {
  176. item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}&farmId=${localStorage.getItem('lastFarmId')}`;
  177. });
  178. this.total = parseInt(res.total);
  179. } else {
  180. res && this.$message.warning(res.message);
  181. }
  182. });
  183. },
  184. // 死猪管理 - 总数
  185. pigTotal() {
  186. // if (!this.params.time) {
  187. // this.params.time = [
  188. // timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
  189. // timeDate(new Date().getTime()),
  190. // ];
  191. // }
  192. // let queryParams = {
  193. // orgCodeList: [],
  194. // nodeCodeList: [
  195. // "1002874$1$0$0",
  196. // "1002875$1$0$0",
  197. // "1002876$1$0$0",
  198. // "1002877$1$0$0",
  199. // "1002878$1$0$0",
  200. // "1002879$1$0$0",
  201. // "1002880$1$0$0",
  202. // "1002881$1$0$0",
  203. // "1002882$1$0$0",
  204. // "1002883$1$0$0",
  205. // "1002884$1$0$0",
  206. // "1002885$1$0$0",
  207. // "1002886$1$0$0",
  208. // "1002887$1$0$0",
  209. // "1002888$1$0$0",
  210. // "1002889$1$0$0",
  211. // "1002890$1$0$0",
  212. // "1002891$1$0$0",
  213. // "1002892$1$0$0",
  214. // "1002893$1$0$0",
  215. // "1002894$1$0$0",
  216. // "1002895$1$0$0",
  217. // "1002896$1$0$0",
  218. // "1002897$1$0$0",
  219. // "1002898$1$0$0",
  220. // "1002899$1$0$0",
  221. // "1002900$1$0$0",
  222. // "1002901$1$0$0",
  223. // "1002902$1$0$0",
  224. // "1002903$1$0$0",
  225. // "1002904$1$0$0",
  226. // "1002905$1$0$0",
  227. // "1002906$1$0$0",
  228. // "1002907$1$0$0",
  229. // "1002908$1$0$0",
  230. // "1002909$1$0$0",
  231. // "1002910$1$0$0",
  232. // "1002911$1$0$0",
  233. // "1002912$1$0$0",
  234. // "1002913$1$0$0",
  235. // "1002939$1$0$0",
  236. // "1002939$1$0$1",
  237. // "1002939$1$0$2",
  238. // "1002939$1$0$3",
  239. // "1002939$1$0$4",
  240. // "1002939$1$0$5",
  241. // "1002939$1$0$6",
  242. // "1002939$1$0$7",
  243. // "1002939$1$0$8",
  244. // "1002939$1$0$9",
  245. // "1002940$1$0$0",
  246. // "1002940$1$0$1",
  247. // "1002940$1$0$2",
  248. // "1002940$1$0$3",
  249. // "1002940$1$0$4",
  250. // "1002940$1$0$5",
  251. // "1002940$1$0$6",
  252. // "1002940$1$0$7",
  253. // "1002939$1$0$10",
  254. // "1002939$1$0$11",
  255. // "1002939$1$0$12",
  256. // "1002939$1$0$13",
  257. // "1002939$1$0$14",
  258. // "1002939$1$0$15",
  259. // ],
  260. // deviceCategory: 1,
  261. // alarmStartDateString: this.params.time[0] + " 00:00:00",
  262. // alarmEndDateString: this.params.time[1] + " 23:59:59",
  263. // alarmType: 303,
  264. // dbType: 0,
  265. // };
  266. // getCarWashTotal(queryParams).then((res) => {
  267. // this.total = JSON.parse(res.result).data.value;
  268. // });
  269. },
  270. // 点击图片放大
  271. clickImg(url) {
  272. this.dialogVisible = true;
  273. this.imgUrl = url;
  274. },
  275. // 大门回放
  276. clickEvent(row) {
  277. getCarWashVideo({
  278. happendTime: row.alarmDate,
  279. channelName: row.alarmPosition,
  280. nodeCode: row.nodeCode
  281. }).then((res) => {
  282. if (res.code === 0) {
  283. this.rtsp = res.data.url;
  284. this.videoVisible = true;
  285. } else {
  286. this.$message.error("视频获取失败");
  287. }
  288. });
  289. },
  290. },
  291. };
  292. </script>
  293. <style scoped>
  294. .door-admin {
  295. width: 100%;
  296. height: 100%;
  297. box-sizing: border-box;
  298. padding: 20px;
  299. }
  300. </style>