index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <!--硬件管理-->
  2. <template>
  3. <div class="app-container hardware">
  4. <div class="top-max-box">
  5. <div class="for-max-box" :class="pageType==VIDEO_MONITOR?'for-max-box-one':'for-max-box-two'" @click="pageClick(VIDEO_MONITOR)">
  6. <div class="for-top-box">
  7. <img src="@/assets/ZDimages/icon_1.png" v-if="pageType!=VIDEO_MONITOR">
  8. <img src="@/assets/ZDimages/icon_2.png" v-if="pageType==VIDEO_MONITOR">
  9. <p>视频监控</p>
  10. </div>
  11. <div class="for-bottom-box-one">
  12. <p>在线:{{newData.videoOnline}}</p>
  13. <p>离线:{{newData.videoOffline}}</p>
  14. </div>
  15. </div>
  16. <div class="for-max-box" :class="pageType==SWITCH?'for-max-box-one':'for-max-box-two'" @click="pageClick(SWITCH)">
  17. <div class="for-top-box">
  18. <img src="@/assets/ZDimages/icon_3.png" v-if="pageType!=SWITCH">
  19. <img src="@/assets/ZDimages/icon_4.png" v-if="pageType==SWITCH">
  20. <p>电源控制</p>
  21. </div>
  22. <div class="for-bottom-box-two">
  23. <p>开启:{{newData.powerSupplyOnline}}</p>
  24. <p>关闭:{{newData.powerSupplyPowerUps}}</p>
  25. <p>离线:{{newData.powerSupplyOffline}}</p>
  26. </div>
  27. </div>
  28. <div class="for-max-box" :class="pageType==AI_VENTILATION?'for-max-box-one':'for-max-box-two'" @click="pageClick(AI_VENTILATION)">
  29. <div class="for-top-box">
  30. <img src="@/assets/ZDimages/icon_5.png" v-if="pageType!=AI_VENTILATION">
  31. <img src="@/assets/ZDimages/icon_6.png" v-if="pageType==AI_VENTILATION">
  32. <p>智能通风</p>
  33. </div>
  34. <div class="for-bottom-box-two">
  35. <p>开启:{{newData.ventilationOnline}}</p>
  36. <p>关闭:{{newData.ventilationPowerUps}}</p>
  37. <p>离线:{{newData.ventilationOffline}}</p>
  38. </div>
  39. </div>
  40. <div class="for-max-box" :class="pageType==ONE_MACHINE?'for-max-box-one':'for-max-box-two'" @click="pageClick(ONE_MACHINE)">
  41. <div class="for-top-box">
  42. <img src="@/assets/ZDimages/icon_7.png" v-if="pageType!=ONE_MACHINE">
  43. <img src="@/assets/ZDimages/icon_8.png" v-if="pageType==ONE_MACHINE">
  44. <p>智能一体机</p>
  45. </div>
  46. <div class="for-bottom-box-one">
  47. <p>在线:{{newData.smartMachineOnline}}</p>
  48. <p>离线:{{newData.smartMachineOffline}}</p>
  49. </div>
  50. </div>
  51. </div>
  52. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" class="form-box" style="height:40px;padding:0 20px;">
  53. <el-form-item label="学院" prop="deptId">
  54. <el-select v-model="queryParams.deptId" placeholder="请选择学院" clearable @change="handleNodeClick">
  55. <el-option
  56. v-for="dict in deptOptions"
  57. :key="dict.deptId"
  58. :label="dict.deptName"
  59. :value="dict.deptId"
  60. ></el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item label="实验室" prop="subjectId">
  64. <el-select v-model="queryParams.subjectId" clearable placeholder="请选择实验室">
  65. <el-option
  66. v-for="item in subjectOptions"
  67. :key="item.id"
  68. :label="item.name"
  69. :value="item.id">
  70. </el-option>
  71. </el-select>
  72. </el-form-item>
  73. <el-form-item label="状态" prop="operate">
  74. <el-select v-model="queryParams.operate" placeholder="请选择状态" clearable size="small">
  75. <el-option label="在线" value="ONLINE" />
  76. <el-option label="离线" value="OFFLINE" />
  77. <el-option label="开启" value="OPEN" />
  78. <el-option label="关闭" value="CLOSE" />
  79. </el-select>
  80. </el-form-item>
  81. <el-form-item style="float: right;">
  82. <el-col :span="1.5">
  83. <p class="add-button-one-120"
  84. @click="handleAdd"
  85. v-hasPermi="['laboratory:hardware:add']"
  86. ><i class="el-icon-plus"></i>新增硬件</p>
  87. </el-col>
  88. </el-form-item>
  89. <el-form-item>
  90. <p class="inquire-button-one" @click="handleQuery">查询</p>
  91. <p class="reset-button-one" @click="resetQuery">重置</p>
  92. </el-form-item>
  93. </el-form>
  94. <video-surveillance ref="surveillance" v-if="pageType==VIDEO_MONITOR" :pageType="pageType" :queryParams="queryParams"></video-surveillance>
  95. <power-control ref="power" v-if="pageType==SWITCH" :pageType="pageType" :queryParams="queryParams"></power-control>
  96. <smart-ventilation ref="smart" v-if="pageType==AI_VENTILATION" :pageType="pageType" :queryParams="queryParams"></smart-ventilation>
  97. <smart-machine ref="machine" v-if="pageType==ONE_MACHINE" :pageType="pageType" :queryParams="queryParams"></smart-machine>
  98. <!--<voice-intercom v-if="pageType==5"></voice-intercom>-->
  99. </div>
  100. </template>
  101. <script>
  102. import mqtt from 'mqtt'
  103. import videoSurveillance from "./videoSurveillance.vue";
  104. import powerControl from "./powerControl.vue";
  105. import smartVentilation from "./smartVentilation.vue";
  106. import smartMachine from "./smartMachine.vue";
  107. // import voiceIntercom from "./voiceIntercom.vue";
  108. import { statisticsHardware } from "@/api/laboratory/hardware";
  109. import { listDepartments } from "@/api/system/dept";
  110. import { getSubjectDictByViolation } from '@/api/laboratory/violation'
  111. import { subjectDictList } from "@/api/laboratory/group";
  112. /*
  113. videoSurveillance
  114. powerControl
  115. smartVentilation
  116. smartMachine
  117. voiceIntercom
  118. */
  119. export default {
  120. components: {
  121. videoSurveillance,
  122. powerControl,
  123. smartVentilation,
  124. smartMachine,
  125. // voiceIntercom
  126. },
  127. name: "Hardware",
  128. data() {
  129. return {
  130. // 显示搜索条件
  131. showSearch: true,
  132. // 部门树选项
  133. deptOptions: [],
  134. subjectOptions:[],
  135. pageType:"VIDEO_MONITOR",
  136. VIDEO_MONITOR:"VIDEO_MONITOR",
  137. SWITCH:"SWITCH",
  138. AI_VENTILATION:"AI_VENTILATION",
  139. ONE_MACHINE:"ONE_MACHINE",
  140. newData:{},
  141. msg:"",
  142. client:{},
  143. // 查询参数
  144. queryParams: {
  145. pageNum: 1,
  146. pageSize:20,
  147. name: null,
  148. factory: null,
  149. type: null,
  150. hardwareNum: null,
  151. subjectId: null,
  152. deptId: null,
  153. deptName: null,
  154. operate: null,
  155. userId: null,
  156. status: null
  157. },
  158. };
  159. },
  160. created() {
  161. },
  162. mounted(){
  163. this.getStatistics()
  164. this.getDeptList();
  165. },
  166. methods: {
  167. /** 查询学院列表 */
  168. getDeptList() {
  169. listDepartments().then(response => {
  170. this.$set(this, 'deptOptions', response.data)
  171. });
  172. },
  173. // 节点单击事件
  174. handleNodeClick(data) {
  175. this.queryParams.deptId = data;
  176. // console.log("data",data);
  177. this.getSubjectDictList(data);
  178. // this.getList();
  179. },
  180. /** 查询实验室字典列表 */
  181. getSubjectDictList (deptId) {
  182. this.subjectOptions = null;
  183. this.loading = true;
  184. // this.queryParams.deptId = deptId;
  185. let params = {};
  186. params.deptId = deptId;
  187. this.queryParams.subjectId = "";
  188. getSubjectDictByViolation(params).then(response => {
  189. this.subjectOptions = response.data;
  190. this.loading = false;
  191. });
  192. },
  193. /** 搜索按钮操作 */
  194. handleQuery() {
  195. this.queryParams.pageNum = 1;
  196. if(this.pageType == 'VIDEO_MONITOR'){
  197. this.$refs.surveillance.getList();
  198. }else if(this.pageType == 'SWITCH'){
  199. this.$refs.power.getList();
  200. }else if(this.pageType == 'AI_VENTILATION'){
  201. this.$refs.smart.getList();
  202. }else if(this.pageType == 'ONE_MACHINE'){
  203. this.$refs.machine.getList();
  204. }
  205. // this.getList();
  206. },
  207. /** 重置按钮操作 */
  208. resetQuery() {
  209. this.resetForm("queryForm");
  210. this.$set(this,'subjectOptions',[]);
  211. if(this.pageType == 'VIDEO_MONITOR'){
  212. this.$refs.surveillance.handleQuery();
  213. }else if(this.pageType == 'SWITCH'){
  214. this.$refs.power.handleQuery();
  215. }else if(this.pageType == 'AI_VENTILATION'){
  216. this.$refs.smart.handleQuery();
  217. }else if(this.pageType == 'ONE_MACHINE'){
  218. this.$refs.machine.handleQuery();
  219. }
  220. // this.handleQuery();
  221. },
  222. /** 新增按钮操作 */
  223. handleAdd() {
  224. if(this.pageType == 'VIDEO_MONITOR'){
  225. this.$refs.surveillance.handleAdd();
  226. }else if(this.pageType == 'SWITCH'){
  227. this.$refs.power.handleAdd();
  228. }else if(this.pageType == 'AI_VENTILATION'){
  229. this.$refs.smart.handleAdd();
  230. }else if(this.pageType == 'ONE_MACHINE'){
  231. this.$refs.machine.handleAdd();
  232. }
  233. },
  234. /** 查询硬件统计 */
  235. getStatistics() {
  236. statisticsHardware().then(response => {
  237. this.newData = response.data;
  238. });
  239. },
  240. pageClick(type){
  241. if(this.pageType!=type){
  242. this.queryParams.pageNum = 1;
  243. this.pageType = type;
  244. }
  245. },
  246. },
  247. };
  248. </script>
  249. <style scoped lang="scss">
  250. .hardware{
  251. display: flex!important;
  252. flex-direction: column;
  253. .top-max-box{
  254. display: flex;
  255. padding-right:20px;
  256. .for-max-box{
  257. cursor:pointer;
  258. /*width:379px;*/flex:1;
  259. height:130px;
  260. margin:9px 0 20px 20px;
  261. .for-top-box{
  262. display: flex;
  263. width:139px;
  264. height:34px;
  265. margin:19px auto 0;
  266. img{
  267. display: inline-block;
  268. width:34px;
  269. height:34px;
  270. }
  271. p{
  272. font-size:18px;
  273. margin: 0;
  274. line-height:34px;
  275. width:105px;
  276. text-align: center;
  277. color:#333;
  278. }
  279. }
  280. .for-bottom-box-one{
  281. display: flex;
  282. margin-top:18px;
  283. p{
  284. font-size:14px;
  285. margin:0;
  286. text-align: center;
  287. flex:1;
  288. line-height:59px;
  289. color:#666666;
  290. }
  291. }
  292. .for-bottom-box-two{
  293. display: flex;
  294. margin-top:18px;
  295. p{
  296. font-size:14px;
  297. margin:0;
  298. text-align: center;
  299. flex:1;
  300. line-height:59px;
  301. color:#666666;
  302. }
  303. }
  304. }
  305. .for-max-box-one{
  306. box-shadow: 0 5px 9px 0 rgba(0, 69, 175, 0.25);
  307. border-radius: 10px;
  308. }
  309. .for-max-box-two{
  310. box-shadow: 0 3px 8px 1px rgba(0, 0, 0, 0.1);
  311. border-radius: 10px;
  312. }
  313. }
  314. /*display: flex!important;*/
  315. /*flex-direction: column;*/
  316. /*box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);*/
  317. /*padding:20px!important;*/
  318. /*margin:9px 20px 20px;*/
  319. }
  320. </style>