deviceWarning.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div class="container">
  3. <div class="left-pane">
  4. <el-input placeholder="告警类别" v-model="filterText" class="left-input">
  5. </el-input>
  6. <el-tree
  7. ref="tree"
  8. :data="data"
  9. :props="defaultProps"
  10. node-key="id"
  11. default-expand-all
  12. :filter-node-method="filterNode"
  13. @node-click="handleNodeClick"
  14. >
  15. <span slot-scope="{node,data}">
  16. <el-image :src="data.url"></el-image>
  17. <span style="padding-left: 10px; vertical-align: text-bottom;">{{ node.label }}</span>
  18. <span class="operate_btns">
  19. <dropdown :events="data.id ? menuEvents : subMenuEvents" :data="{ node, data }"
  20. @itemClick="dropDownClick"></dropdown>
  21. </span>
  22. </span>
  23. </el-tree>
  24. <el-button class="newWarning" style="color: #fff; background: #3da0d6" @click="newAlarmType"
  25. ><i class="el-icon-s-order"></i>新建告警类别</el-button
  26. >
  27. </div>
  28. <div class="right-pane">
  29. <div class="right-pane-inner">
  30. <div class="top">
  31. <el-button @click="batchDelete" class="delete-btn"
  32. >批量删除</el-button
  33. >
  34. <el-input
  35. class="search-input"
  36. v-model="searchInput"
  37. placeholder="请输入搜索内容"
  38. >
  39. <template slot="append">
  40. <i
  41. class="el-icon-search"
  42. style="cursor: pointer"
  43. @click="searchEvent"
  44. ></i>
  45. </template>
  46. </el-input>
  47. </div>
  48. <div class="center">
  49. <el-table
  50. ref="multipleTable"
  51. :data="tableData"
  52. tooltip-effect="dark"
  53. :header-cell-style="{ textAlign: 'center' }"
  54. :cell-style="{ textAlign: 'center' }"
  55. style="width: 100%"
  56. height="500"
  57. @selection-change="handleSelectionChange"
  58. >
  59. <el-table-column type="selection" width="50"> </el-table-column>
  60. <el-table-column type="index" width="80" label="序号">
  61. </el-table-column>
  62. <el-table-column prop="deviceType" label="设备类别">
  63. </el-table-column>
  64. <el-table-column prop="devicewarningType" label="涵盖设备警告类别">
  65. </el-table-column>
  66. <el-table-column prop="Respon" label="责任人"> </el-table-column>
  67. <el-table-column prop="operation" label="操作">
  68. <el-button size="mini" type="text" style="color: #2ea8e6"
  69. >查看</el-button
  70. >
  71. <el-button size="mini" type="text" style="color: #2ea8e6"
  72. >编辑</el-button
  73. >
  74. <el-button size="mini" type="text" style="color: #2ea8e6"
  75. >删除</el-button
  76. >
  77. </el-table-column>
  78. </el-table>
  79. </div>
  80. <div class="bottom">
  81. <page :paginationData="paginationData"></page>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import checkbox from "@/components/Checkbox/index";
  89. import page from "@/components/pagination/index";
  90. import dropdown from '@/components/Dropdown/index';
  91. export default {
  92. components: { checkbox, page, dropdown },
  93. data() {
  94. return {
  95. searchInput: "",
  96. filterText: "",
  97. input: "",
  98. data: [
  99. {
  100. id:1,
  101. label: "紧急告警",
  102. children: [],
  103. },
  104. {
  105. id:2,
  106. label: "重要告警",
  107. },
  108. {
  109. id:3,
  110. label: "一般告警",
  111. },
  112. ],
  113. menuEvents: [
  114. { label: '新建', funcName: 'addNode' }
  115. ],
  116. subMenuEvents: [
  117. { label: '新建', funcName: 'addNode' },
  118. { label: '上移', funcName: 'moveUp' },
  119. { label: '下移', funcName: 'moveDown' },
  120. { label: '编辑', funcName: 'editNode' },
  121. { label: '删除', funcName: 'removeNode' }
  122. ],
  123. defaultProps: {
  124. children: "children",
  125. label: "label",
  126. },
  127. tableData: [
  128. {
  129. deviceType: "摄像头",
  130. devicewarningType: "[设备离线][设备xxx]",
  131. Respon: "张三",
  132. },
  133. {
  134. deviceType: "摄像头",
  135. devicewarningType: "[设备离线][设备xxx]",
  136. Respon: "张三",
  137. },
  138. {
  139. deviceType: "摄像头",
  140. devicewarningType: "[设备离线][设备xxx]",
  141. Respon: "张三",
  142. },
  143. ],
  144. multipleSelection: [],
  145. show: true,
  146. paginationData: {
  147. pageSize: 10,
  148. pagerCount: 5,
  149. currentPage: 1,
  150. pageSizes: [5, 10, 20, 30],
  151. total: 30,
  152. currentChange: (val) => {
  153. this.getTableData(val);
  154. },
  155. handleSizeChange: (val) => {
  156. this.handleSizeChange(val);
  157. },
  158. },
  159. };
  160. },
  161. watch: {
  162. filterText(val) {
  163. this.$refs.tree.filter(val);
  164. },
  165. },
  166. methods: {
  167. // 新建告警类别
  168. newAlarmType() {},
  169. handleClick() {
  170. //
  171. },
  172. filterNode(value, data) {
  173. if (!value) return true;
  174. return data.label.indexOf(value) !== -1;
  175. },
  176. handleNodeClick() {
  177. //
  178. },
  179. handleSelectionChange() {
  180. //
  181. },
  182. getTableData() {},
  183. handleSizeChange() {},
  184. batchDelete() {},
  185. searchEvent() {
  186. console.log("查询");
  187. },
  188. },
  189. };
  190. </script>
  191. <style lang="less" scoped>
  192. .container {
  193. width: 100%;
  194. height: 100%;
  195. background-color: rgba(255, 255, 255, 1);
  196. color: rgba(16, 16, 16, 1);
  197. font-size: 14px;
  198. // text-align: center;
  199. box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.15);
  200. display: flex;
  201. align-items: center;
  202. .left-pane {
  203. width: 300px;
  204. padding: 15px;
  205. height: calc(100% - 30px);
  206. .el-tree {
  207. margin-top: 10px;
  208. height: calc(98% - 30px);
  209. background-color: #FAFAFA;
  210. /deep/.el-tree-node__content {
  211. align-items: center;
  212. height: 30px;
  213. cursor: pointer;
  214. font-size: 16px;
  215. position: relative;
  216. color: #999999;
  217. padding-top: 10px;
  218. padding-left: 30px !important;
  219. .operate_btns {
  220. position: absolute;
  221. right: 20px;
  222. display: none;
  223. }
  224. &:hover,
  225. :focus-within {
  226. background-color: #f7fbff;
  227. .operate_btns {
  228. display: inline;
  229. }
  230. }
  231. }
  232. /deep/.el-tree-node__children {
  233. .el-tree-node__content {
  234. padding-left: 60px !important;
  235. }
  236. }
  237. }
  238. }
  239. .newWarning{
  240. position: relative;
  241. bottom: 50px;
  242. width: 250px;
  243. text-align: center;
  244. font-size: 16px;
  245. color: #fff;
  246. background: #3da0d6;
  247. }
  248. .right-pane {
  249. width: calc(100% - 300px);
  250. height: 100%;
  251. display: flex;
  252. align-items: center;
  253. justify-content: center;
  254. &-inner {
  255. width: calc(100% - 15px);
  256. height: calc(100% - 15px);
  257. .top {
  258. height: 80px;
  259. width: 100%;
  260. position: relative;
  261. .add-btn,
  262. .import-btn,
  263. .delete-btn {
  264. color: #fff;
  265. }
  266. .add-btn {
  267. position: absolute;
  268. background: #2ea8e6;
  269. top: 20px;
  270. left: 20px;
  271. }
  272. .import-btn {
  273. position: absolute;
  274. background: #2ea8e6;
  275. top: 20px;
  276. left: 130px;
  277. }
  278. .delete-btn {
  279. position: absolute;
  280. background: #b3b3b3;
  281. top: 20px;
  282. left: 20px;
  283. }
  284. .search-input {
  285. position: absolute;
  286. top: 20px;
  287. right: 30px;
  288. width: 300px;
  289. }
  290. }
  291. .center {
  292. width: 100%;
  293. height: calc(100% - 150px);
  294. .el-table {
  295. // height: 100%;
  296. border: 1px solid #f0f2f2;
  297. margin-top: 10px;
  298. font-size: 0.95rem;
  299. font-family: PingFang SC;
  300. font-weight: 500;
  301. color: #b2b2b2;
  302. background: rgba(255, 255, 255, 0.8);
  303. /deep/th {
  304. background: #f7fbff;
  305. }
  306. /deep/.el-checkbox {
  307. color: #b2b2b2;
  308. .el-checkbox__input.is-checked + .el-checkbox__label {
  309. color: #2ea8e6;
  310. }
  311. .el-checkbox__input.is-checked .el-checkbox__inner::after {
  312. width: 70%;
  313. height: 70%;
  314. background: #2ea8e6;
  315. border-radius: 0;
  316. transform: rotate(0deg) scaleY(1);
  317. position: static;
  318. // border: 1px solid #8DD9FF;
  319. }
  320. .el-checkbox__inner {
  321. border: 1px solid #8dd9ff;
  322. background: rgba(0, 170, 255, 0);
  323. display: flex;
  324. align-items: center;
  325. justify-content: center;
  326. position: static;
  327. &::after {
  328. transition: 0ms;
  329. }
  330. }
  331. .el-checkbox__label {
  332. padding-left: 0;
  333. font-size: 15px;
  334. position: absolute;
  335. top: 1px;
  336. left: 25px;
  337. }
  338. }
  339. }
  340. }
  341. .bottom {
  342. height: 70px;
  343. width: 100%;
  344. position: relative;
  345. }
  346. }
  347. }
  348. }
  349. </style>