SaleAdmin.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-12-17 15:50:33
  4. * @LastEditTime: 2021-12-25 14:32:26
  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. getSaleAdmin,
  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.propFormData.time = [
  123. timeDate(new Date().getTime()),
  124. timeDate(new Date().getTime()),
  125. ];
  126. this.title = title;
  127. this.tableItems = tableItems;
  128. this.tableShows = tableShows;
  129. this.pigManage();
  130. this.pigTotal();
  131. },
  132. methods: {
  133. // 获取查询条件
  134. handleQuery(params) {
  135. this.params = params;
  136. this.pageNum = 1;
  137. this.pigManage();
  138. this.pigTotal();
  139. },
  140. // 修改size
  141. sizeChange(val) {
  142. this.size = val;
  143. // this.init();
  144. this.pageNum = 1;
  145. this.pigManage();
  146. },
  147. // 修改页数
  148. pageChange(val) {
  149. this.pageNum = val;
  150. // this.init();
  151. this.pigManage();
  152. },
  153. // 死猪管理
  154. pigManage() {
  155. const loading = this.$loading({
  156. lock: true,
  157. text: "加载中...",
  158. spinner: "el-icon-loading",
  159. background: "rgba(0, 0, 0, 0.7)",
  160. });
  161. if (!this.params.time) {
  162. this.params.time = [
  163. timeDate(new Date().getTime()),
  164. timeDate(new Date().getTime()),
  165. ];
  166. }
  167. let queryParams = {
  168. pageNum: this.pageNum,
  169. pageSize: this.size,
  170. alarmStartDateString: this.params.time[0] + " 00:00:00",
  171. alarmEndDateString: this.params.time[1] + " 23:59:59",
  172. };
  173. getSaleAdmin(queryParams).then(async (res) => {
  174. loading.close();
  175. if (res && res.code === 0) {
  176. const result = JSON.parse(res.data.result);
  177. this.listData = result.data.pageData;
  178. console.log(this.listData);
  179. this.listData.forEach((item) => {
  180. item.alarmPicture = `${this.ip}/video/picture/get?alarmPicture=${item.alarmPicture}`;
  181. });
  182. this.total = parseInt(res.total);
  183. } else {
  184. res && this.$message.warning(res.message);
  185. }
  186. });
  187. },
  188. // 死猪管理 - 总数
  189. pigTotal() {
  190. // if (!this.params.time) {
  191. // this.params.time = [
  192. // timeDate(new Date().getTime() - 1000 * 60 * 60 * 24),
  193. // timeDate(new Date().getTime()),
  194. // ];
  195. // }
  196. // let queryParams = {
  197. // orgCodeList: [],
  198. // nodeCodeList: [
  199. // "1002874$1$0$0",
  200. // "1002875$1$0$0",
  201. // "1002876$1$0$0",
  202. // "1002877$1$0$0",
  203. // "1002878$1$0$0",
  204. // "1002879$1$0$0",
  205. // "1002880$1$0$0",
  206. // "1002881$1$0$0",
  207. // "1002882$1$0$0",
  208. // "1002883$1$0$0",
  209. // "1002884$1$0$0",
  210. // "1002885$1$0$0",
  211. // "1002886$1$0$0",
  212. // "1002887$1$0$0",
  213. // "1002888$1$0$0",
  214. // "1002889$1$0$0",
  215. // "1002890$1$0$0",
  216. // "1002891$1$0$0",
  217. // "1002892$1$0$0",
  218. // "1002893$1$0$0",
  219. // "1002894$1$0$0",
  220. // "1002895$1$0$0",
  221. // "1002896$1$0$0",
  222. // "1002897$1$0$0",
  223. // "1002898$1$0$0",
  224. // "1002899$1$0$0",
  225. // "1002900$1$0$0",
  226. // "1002901$1$0$0",
  227. // "1002902$1$0$0",
  228. // "1002903$1$0$0",
  229. // "1002904$1$0$0",
  230. // "1002905$1$0$0",
  231. // "1002906$1$0$0",
  232. // "1002907$1$0$0",
  233. // "1002908$1$0$0",
  234. // "1002909$1$0$0",
  235. // "1002910$1$0$0",
  236. // "1002911$1$0$0",
  237. // "1002912$1$0$0",
  238. // "1002913$1$0$0",
  239. // "1002939$1$0$0",
  240. // "1002939$1$0$1",
  241. // "1002939$1$0$2",
  242. // "1002939$1$0$3",
  243. // "1002939$1$0$4",
  244. // "1002939$1$0$5",
  245. // "1002939$1$0$6",
  246. // "1002939$1$0$7",
  247. // "1002939$1$0$8",
  248. // "1002939$1$0$9",
  249. // "1002940$1$0$0",
  250. // "1002940$1$0$1",
  251. // "1002940$1$0$2",
  252. // "1002940$1$0$3",
  253. // "1002940$1$0$4",
  254. // "1002940$1$0$5",
  255. // "1002940$1$0$6",
  256. // "1002940$1$0$7",
  257. // "1002939$1$0$10",
  258. // "1002939$1$0$11",
  259. // "1002939$1$0$12",
  260. // "1002939$1$0$13",
  261. // "1002939$1$0$14",
  262. // "1002939$1$0$15",
  263. // ],
  264. // deviceCategory: 1,
  265. // alarmStartDateString: this.params.time[0] + " 00:00:00",
  266. // alarmEndDateString: this.params.time[1] + " 23:59:59",
  267. // alarmType: 303,
  268. // dbType: 0,
  269. // };
  270. // getCarWashTotal(queryParams).then((res) => {
  271. // this.total = JSON.parse(res.result).data.value;
  272. // });
  273. },
  274. // 点击图片放大
  275. clickImg(url) {
  276. this.dialogVisible = true;
  277. this.imgUrl = url;
  278. },
  279. // 大门回放
  280. clickEvent(row) {
  281. getCarWashVideo({
  282. happendTime: row.alarmDate,
  283. channelName: row.alarmPosition,
  284. }).then((res) => {
  285. if (res.code === 0) {
  286. this.rtsp = res.URL;
  287. this.videoVisible = true;
  288. } else {
  289. this.$message.error("视频获取失败");
  290. }
  291. });
  292. },
  293. },
  294. };
  295. </script>
  296. <style scoped>
  297. .door-admin {
  298. width: 100%;
  299. height: 100%;
  300. box-sizing: border-box;
  301. padding: 20px;
  302. }
  303. </style>