DealMultiDialog.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <base-drag-bg-dialog
  3. :dialogConfig="baseDialogConfig"
  4. @handleClose="handleClose"
  5. @onActivated="onActivated"
  6. >
  7. <!-- 弹窗内容 -->
  8. <div class="dialog_box">
  9. <!-- 内容 -->
  10. <div class="dialog_content_box">
  11. <div class="detail-box">
  12. <el-form
  13. ref="form"
  14. :model="form"
  15. size="small"
  16. label-width="100px"
  17. inline
  18. >
  19. <el-form-item label="处理方式:" prop="dataType">
  20. <el-radio-group v-model="form.dataType">
  21. <el-radio :label="0" style="color: #fff !important"
  22. >正常</el-radio
  23. >
  24. <el-radio :label="1" style="color: #fff !important"
  25. >误报</el-radio
  26. >
  27. <el-radio :label="2" style="color: #fff !important"
  28. >测试</el-radio
  29. >
  30. </el-radio-group>
  31. </el-form-item>
  32. <el-form-item label="处理信息:" prop="dealContent">
  33. <el-input
  34. ref="dealContent"
  35. v-model="form.dealContent"
  36. type="textarea"
  37. rows="5"
  38. size="small"
  39. style="width: 330px"
  40. />
  41. </el-form-item>
  42. </el-form>
  43. <div class="btn-box">
  44. <el-button class="btn-cancel" size="mini" @click="handleClose"
  45. >取消</el-button
  46. >
  47. <el-button class="btn-handle" size="mini" @click="handleDeal"
  48. >处理</el-button
  49. >
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </base-drag-bg-dialog>
  55. </template>
  56. <script>
  57. // 调度指令窗口,全局展示
  58. import BaseDragBgDialog from "@/views/components/base/BaseDragBgDialog.vue";
  59. import { dealMultiAlarm } from "@/API/alarm.js";
  60. export default {
  61. name: "DealMultiDialog",
  62. components: { BaseDragBgDialog },
  63. props: {
  64. dialogConfig: {
  65. type: Object,
  66. default: () => {
  67. return {
  68. dialogId: "",
  69. show: false, //是否显示
  70. title: "新窗口-请指定URL",
  71. width: 500, //px宽度
  72. height: 320, //px高度
  73. left: 0, //
  74. top: 0, //
  75. bottom: 0, //
  76. right: 0, //
  77. center: true, //是否居中定位
  78. data: {
  79. eventTime: "",
  80. content: "",
  81. },
  82. zIndex: 5,
  83. };
  84. },
  85. },
  86. },
  87. data() {
  88. return {
  89. baseDialogConfig: {
  90. dialogId: "",
  91. show: false,
  92. title: "调度指令",
  93. width: 500,
  94. height: 320,
  95. center: true,
  96. zIndex: 10,
  97. },
  98. form: {
  99. dealContent: "",
  100. dataType: 0,
  101. },
  102. };
  103. },
  104. computed: {},
  105. watch: {
  106. "dialogConfig.show": {
  107. handler(newVal) {
  108. if (newVal) {
  109. this.baseDialogConfig = Object.assign(
  110. this.baseDialogConfig,
  111. this.dialogConfig
  112. );
  113. } else {
  114. this.baseDialogConfig.show = false;
  115. }
  116. },
  117. // deep: true,
  118. immediate: true,
  119. },
  120. },
  121. methods: {
  122. handleClose() {
  123. this.dialogConfig.show = false;
  124. },
  125. async handleDeal() {
  126. try {
  127. let p = {
  128. ids: this.dialogConfig.data.ids,
  129. dealContent: this.form.dealContent,
  130. dataType: this.form.dataType,
  131. };
  132. console.log(p);
  133. const { code, msg } = await dealMultiAlarm(p);
  134. this.$message({
  135. type: code == 20000 ? "success" : "danger",
  136. message: msg,
  137. });
  138. this.$parent.getAlarmDataList();
  139. this.handleClose();
  140. } catch (error) {
  141. console.log(error);
  142. }
  143. },
  144. onActivated() {
  145. console.log("aaa");
  146. this.$nextTick(() => {
  147. this.$refs.dealContent.focus()
  148. });
  149. },
  150. },
  151. };
  152. </script>
  153. <style lang="less" scoped>
  154. .dialog_box {
  155. width: 100%;
  156. height: 100%;
  157. box-sizing: border-box;
  158. .dialog_content_box {
  159. height: 2.083333rem /* 400/192 */;
  160. padding: 0.104167rem /* 20/192 */ 0;
  161. box-sizing: border-box;
  162. color: #fff;
  163. .detail-box {
  164. ::v-deep .el-form-item__label {
  165. color: #fff;
  166. }
  167. .btn-box {
  168. width: 100%;
  169. height: 0.15625rem /* 30/192 */;
  170. text-align: center;
  171. position: absolute;
  172. bottom: 0.15625rem /* 30/192 */;
  173. left: 50%;
  174. transform: translate(-50%, 0);
  175. .el-button {
  176. width: 0.40625rem /* 78/192 */;
  177. height: 0.145833rem /* 28/192 */;
  178. box-sizing: border-box;
  179. margin-top: 0.015625rem /* 3/192 */;
  180. color: #fff;
  181. padding: 0;
  182. border-color: #fff9de;
  183. border-radius: 0;
  184. &:hover {
  185. border-color: #ccc;
  186. }
  187. }
  188. .btn-handle.el-button {
  189. // background: url('../../../../assets/out/imgs/popup/button_bg.png') center no-repeat;
  190. background: rgba(4, 42, 47, 0.6);
  191. }
  192. .btn-cancel.el-button {
  193. background: rgba(13, 35, 64, 0.1);
  194. }
  195. }
  196. }
  197. }
  198. }
  199. </style>