alarm-setting.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="setting-dialog">
  3. <div class="setting-wrapper">
  4. <div class="box-title">
  5. <div class="box-name">报警配置</div>
  6. <div class="box-close" @click="cancle">
  7. <img src="@assets/imgs/warn-close.png" />
  8. </div>
  9. </div>
  10. <div class="box-content">
  11. <el-tabs type="border-card" v-model="activeTab">
  12. <el-tab-pane
  13. v-for="(item, index) in configArray"
  14. :key="index"
  15. :name="item.id"
  16. >
  17. <template #label>
  18. <div class="alartPaneLabel">
  19. <span>{{ getAlartLevelName(item.alarmLevel) }}</span>
  20. <div class="alartBadge" :class="getAlartStatus(item)"></div>
  21. </div>
  22. </template>
  23. <el-form label-width="120px">
  24. <el-form-item label="报警弹窗:">
  25. <el-switch
  26. v-model="item.isAlart"
  27. active-text="弹出"
  28. inactive-text="不弹出"
  29. />
  30. </el-form-item>
  31. <el-form-item label="播放声音:">
  32. <el-switch
  33. v-model="item.isAlarmSound"
  34. active-text="播放"
  35. inactive-text="不播放"
  36. />
  37. </el-form-item>
  38. <el-form-item label="必须确认:">
  39. <el-switch
  40. v-model="item.isContinuousAlarm"
  41. active-text="是"
  42. inactive-text="否"
  43. />
  44. </el-form-item>
  45. </el-form>
  46. </el-tab-pane>
  47. </el-tabs>
  48. <div class="btnBox">
  49. <el-button @click="save">保存配置</el-button>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import { confirmAlart } from "@/api/zhbj/index.js";
  57. import SvgIcon from "@com/coms/icon/svg-icon.vue";
  58. import dayjs from "dayjs";
  59. export default {
  60. name: "alarmSetting", //首页标题栏
  61. props: {
  62. alarmConfigArray: {
  63. type: Array,
  64. required: true,
  65. },
  66. dialogList: {
  67. type: Array,
  68. },
  69. },
  70. components: { SvgIcon },
  71. data() {
  72. return {
  73. displaySetting: false,
  74. activeTab: "",
  75. configArray: [],
  76. };
  77. },
  78. created() {
  79. this.activeTab = this.activeTab || this.alarmConfigArray?.[0]?.id;
  80. },
  81. mounted() {},
  82. computed: {},
  83. watch: {
  84. alarmConfigArray: {
  85. handler(val) {
  86. if (val.length) {
  87. this.configArray = JSON.parse(JSON.stringify(val));
  88. }
  89. },
  90. immediate: true,
  91. deep: true,
  92. },
  93. },
  94. methods: {
  95. cancle() {
  96. this.configArray = this.alarmConfigArray;
  97. this.$emit("cancleConfig");
  98. },
  99. save() {
  100. localStorage.setItem(
  101. "alarmConfigArray",
  102. JSON.stringify(this.configArray)
  103. );
  104. this.$emit("saveConfig");
  105. this.BASE.showMsg({
  106. type: "success",
  107. msg: "修改成功",
  108. });
  109. this.$emit("cancleConfig");
  110. },
  111. getAlartStatus(alartItem) {
  112. if (
  113. alartItem.isAlart ||
  114. alartItem.isAlarmSound ||
  115. alartItem.isContinuousAlarm
  116. ) {
  117. return "badgeWork";
  118. } else {
  119. return "badgeNotworK";
  120. }
  121. },
  122. getAlartLevelName(lv) {
  123. if (lv === 1) {
  124. return "低级";
  125. } else if (lv === 2) {
  126. return "低中级";
  127. } else if (lv === 3) {
  128. return "中级";
  129. } else if (lv === 4) {
  130. return "中高级";
  131. } else if (lv === 5) {
  132. return "高级";
  133. }
  134. },
  135. },
  136. };
  137. </script>
  138. <style lang="less" scoped>
  139. .setting-dialog {
  140. position: absolute;
  141. right: -12px;
  142. bottom: -6px;
  143. z-index: 1001;
  144. width: 540px;
  145. height: 510px;
  146. .setting-wrapper {
  147. width: 100%;
  148. height: 100%;
  149. border-radius: 6px;
  150. background: #000;
  151. background: url("~@/assets/imgs/warn-border.png") no-repeat;
  152. background-size: 100% 100%;
  153. .box-title {
  154. width: 100%;
  155. height: 60px;
  156. padding: 0 22px;
  157. display: flex;
  158. align-items: center;
  159. justify-content: space-between;
  160. background: url("~@/assets/imgs/warn-top.png") no-repeat;
  161. background-size: 100% 100%;
  162. .warn-close {
  163. cursor: pointer;
  164. }
  165. }
  166. .box-content {
  167. height: calc(100% - 60px);
  168. padding: 0 10px;
  169. .btnBox {
  170. .el-button ::v-deep {
  171. width: 100px;
  172. background: url("~@/assets/imgs/confirmone.png") no-repeat;
  173. background-size: 100% 100%;
  174. height: 37px;
  175. border-radius: 5px;
  176. border-width: 0;
  177. color: #b6afaf;
  178. font-size: 16px;
  179. margin-top: 10px;
  180. opacity: 0.8;
  181. &:hover,
  182. &:focus {
  183. color: #fff;
  184. opacity: 1;
  185. background-color: transparent;
  186. border-width: 0;
  187. }
  188. &.cancle {
  189. background: #ccc;
  190. color: #3a3838;
  191. &:hover,
  192. &:focus {
  193. color: #000;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. }
  200. }
  201. .el-tabs ::v-deep {
  202. height: calc(100% - 80px);
  203. &.el-tabs--border-card {
  204. background: transparent !important;
  205. border-color: transparent !important;
  206. }
  207. &.el-tabs--border-card > .el-tabs__header {
  208. background: transparent !important;
  209. border-color: transparent !important;
  210. }
  211. &.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active,
  212. &.el-tabs--border-card > .el-tabs__header .el-tabs__item:hover {
  213. color: #fd7f00 !important;
  214. background: transparent !important;
  215. border-right-color: transparent !important;
  216. border-left-color: transparent !important;
  217. }
  218. }
  219. .el-form::v-deep {
  220. .el-form-item__label {
  221. color: #ccc;
  222. }
  223. }
  224. .el-switch::v-deep {
  225. &.is-checked .el-switch__core {
  226. border-color: #fd7f00;
  227. background-color: #fd7f00;
  228. }
  229. .el-switch__label {
  230. color: #ccc;
  231. &.is-active {
  232. color: #fd7f00;
  233. }
  234. }
  235. }
  236. </style>