dialogComponent.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <el-dialog
  3. :title="dialogTitle"
  4. v-model="showDialog"
  5. width="640px"
  6. @close="closeDialog"
  7. @open="open"
  8. >
  9. <el-form
  10. ref="formInfo"
  11. :model="form"
  12. class="demo-form-inline alarmStatusDialog"
  13. label-width="100px"
  14. >
  15. <div class="topInfo underline">
  16. <el-form-item label="告警时间:" prop="soeTime">
  17. {{ itemInfo.soeTime }}
  18. </el-form-item>
  19. <!-- <el-form-item label="告警历时:" prop="stationCode">3分钟</el-form-item> -->
  20. <!-- <el-form-item label="关联告警:" prop="stationAddress">
  21. 2021-09-14 14:54:59
  22. </el-form-item> -->
  23. <!-- <div class="deviceTit"></div> -->
  24. <el-button type="success" class="lubo" style="margin-bottom: 15px">
  25. {{ itemInfo.measDesc }}
  26. </el-button>
  27. <div
  28. class="handleStatus"
  29. :style="{
  30. color:
  31. itemInfo.handlingStatus == 1
  32. ? '#8DCF6E'
  33. : itemInfo.handlingStatus == 2
  34. ? '#FF747B'
  35. : '#5c88fa',
  36. }"
  37. >
  38. {{
  39. itemInfo.handlingStatus == 0
  40. ? '未处理'
  41. : itemInfo.handlingStatus == 1
  42. ? '已处理'
  43. : itemInfo.handlingStatus == 2
  44. ? '待确认'
  45. : itemInfo.handlingStatus == 3
  46. ? '自动恢复'
  47. : '过期失效'
  48. }}
  49. </div>
  50. </div>
  51. <div class="basicTit">基本信息</div>
  52. <el-form-item label="站点名称:" prop="pointNum">
  53. {{ form.siteName }}
  54. </el-form-item>
  55. <el-form-item label="台区展示:" prop="deviceNum">
  56. {{ form.stationArea }}
  57. </el-form-item>
  58. <el-form-item label="线路:" prop="deviceNum">
  59. {{ form.route }}
  60. </el-form-item>
  61. <el-form-item label="告警信息:" prop="deviceNum">
  62. {{ itemInfo.measDesc.split(itemInfo.measDesc.slice(-2))[0] }}
  63. </el-form-item>
  64. <el-form-item label="告警状态:" prop="deviceNum">
  65. {{ itemInfo.measDesc.slice(-2) }}
  66. </el-form-item>
  67. <el-form-item label="采集终端:" prop="deviceNum">
  68. {{ form.deviceCode }}
  69. </el-form-item>
  70. <el-form-item label="站点地址:" prop="deviceNum">
  71. {{ form.siteAddress }}
  72. </el-form-item>
  73. <el-form-item label="联系人:" prop="deviceNum">
  74. {{ form.sparUserName }}
  75. </el-form-item>
  76. <el-form-item label="联系方式:" prop="deviceNum">
  77. {{ form.handlerPhone }}
  78. </el-form-item>
  79. <div class="basicTit">处理信息</div>
  80. <el-form-item
  81. label="处理内容:"
  82. prop="handlingContent"
  83. style="margin-bottom: 20px"
  84. >
  85. <el-input
  86. v-model="textarea"
  87. :rows="2"
  88. type="textarea"
  89. placeholder="请输入..."
  90. v-if="itemInfo.handlingStatus != 1"
  91. />
  92. <span v-if="itemInfo.handlingStatus == 1">
  93. {{
  94. itemInfo.handlingContent === '' ? '无' : itemInfo.handlingContent
  95. }}
  96. </span>
  97. </el-form-item>
  98. <el-form-item label="现场照片:" prop="deviceNum">
  99. <el-upload
  100. :action="uploadUrl"
  101. :on-success="handleUpAvatar"
  102. :on-remove="handleRemove"
  103. :show-file-list="true"
  104. list-type="picture-card"
  105. :limit="3"
  106. :on-preview="handlePictureCardPreview"
  107. :headers="{ accessToken: [accessToken] }"
  108. v-if="itemInfo.handlingStatus != 1"
  109. >
  110. <i class="el-icon-plus"></i>
  111. </el-upload>
  112. <el-dialog title="查看图片" v-model="dialogVisible" width="400px">
  113. <img
  114. style="width: 100%"
  115. :src="
  116. itemInfo.handlingStatus == 1
  117. ? fileImages + form.image
  118. : dialogImageUrl
  119. "
  120. alt=""
  121. />
  122. </el-dialog>
  123. <img
  124. @click="handlePictureCardPreview"
  125. v-if="itemInfo.handlingStatus == 1"
  126. style="width: 90px"
  127. :src="fileImages + form.image"
  128. alt=""
  129. />
  130. </el-form-item>
  131. <br />
  132. <br />
  133. <br />
  134. <div style="text-align: right" v-if="itemInfo.handlingStatus != 1">
  135. <el-button @click="closeDialog()">取消</el-button>
  136. <el-button type="primary" @click="submitForm()">确定</el-button>
  137. </div>
  138. </el-form>
  139. </el-dialog>
  140. </template>
  141. <script>
  142. import { useStore } from 'vuex'
  143. import { defineComponent, ref, watchEffect, reactive, toRefs } from 'vue'
  144. import * as api from '@/api/alarmManage/index'
  145. import { ElMessage } from 'element-plus'
  146. export default defineComponent({
  147. name: 'DialogComponent',
  148. emits: ['closeDialog', 'listSelect'],
  149. props: {
  150. show_Dialog: Boolean,
  151. dialogTitle: {
  152. type: String,
  153. default: '告警详情',
  154. },
  155. itemInfo: {
  156. type: Object,
  157. default: function () {
  158. return {}
  159. },
  160. },
  161. },
  162. setup(props, { emit }) {
  163. const store = useStore()
  164. const showDialog = ref(false)
  165. const formInfo = ref(null)
  166. const form = ref([])
  167. const textarea = ref('')
  168. const dialogVisible = ref(false)
  169. const accessToken = ref(store.state.user.accessToken)
  170. const dialogImageUrl = ref('')
  171. const fileImages = ref(window.PLATFROM_CONFIG.images)
  172. const image = ref('')
  173. const imageFile = ref([])
  174. const dataSet = reactive({
  175. uploadUrl:
  176. window.PLATFROM_CONFIG.baseUrl +
  177. '/patrolInspectionDevice/pictureUpload',
  178. fileList: [],
  179. })
  180. //删除照片
  181. function handleRemove(res) {
  182. Array.prototype.indexOf = function (val) {
  183. for (var i = 0; i < this.length; i++) {
  184. if (this[i] == val) return i
  185. }
  186. return -1
  187. }
  188. Array.prototype.remove = function (val) {
  189. var index = this.indexOf(val)
  190. if (index > -1) {
  191. this.splice(index, 1)
  192. }
  193. }
  194. dataSet.fileList.remove(res.name)
  195. }
  196. const handleUpAvatar = (res, file) => {
  197. image.value = res.data
  198. imageFile.value = file
  199. }
  200. const handlePictureCardPreview = (file) => {
  201. dialogImageUrl.value = file.url
  202. dialogVisible.value = true
  203. }
  204. const resetForm = () => {
  205. formInfo.value.resetFields()
  206. }
  207. const roleValid = (rule, value, callback) => {
  208. if (value.length === 0) {
  209. callback(new Error('角色不能为空'))
  210. } else {
  211. callback()
  212. }
  213. }
  214. // onSelectedDrug(event) {
  215. // this.siteList = event;
  216. // console.log(this.siteList);
  217. // },
  218. // 保存操作
  219. const submitForm = () => {
  220. api
  221. .alarmPower({
  222. id: props.itemInfo.id,
  223. handlingContent: textarea.value,
  224. image: image.value,
  225. handlingStatus: 1,
  226. })
  227. .then((requset) => {
  228. if (requset.status === 'SUCCESS') {
  229. ElMessage({
  230. message: '操作成功!',
  231. type: 'success',
  232. })
  233. textarea.value = ''
  234. closeDialog()
  235. emit('listSelect')
  236. } else {
  237. ElMessage.error(requset.msg)
  238. }
  239. })
  240. }
  241. const open = () => {
  242. api.alarmPower1(props.itemInfo.id).then((requset) => {
  243. if (requset.status === 'SUCCESS') {
  244. form.value = requset.data
  245. } else {
  246. ElMessage.error(requset.msg)
  247. }
  248. })
  249. }
  250. // 关闭弹框
  251. const closeDialog = () => {
  252. showDialog.value = false
  253. emit('closeDialog', false)
  254. }
  255. watchEffect((fn, options) => {
  256. fn, options
  257. showDialog.value = props.show_Dialog
  258. })
  259. return {
  260. open,
  261. handleUpAvatar,
  262. handleRemove,
  263. handlePictureCardPreview,
  264. resetForm,
  265. roleValid,
  266. submitForm,
  267. closeDialog,
  268. ...toRefs(dataSet),
  269. accessToken,
  270. dialogImageUrl,
  271. fileImages,
  272. image,
  273. disabled: false,
  274. dialogVisible,
  275. textarea,
  276. showDialog,
  277. form,
  278. formInfo,
  279. options: [
  280. {
  281. value: '选项1',
  282. label: '站点一',
  283. },
  284. {
  285. value: '选项2',
  286. label: '站点二',
  287. },
  288. {
  289. value: '选项3',
  290. label: '站点三',
  291. },
  292. {
  293. value: '选项4',
  294. label: '站点四',
  295. },
  296. {
  297. value: '选项5',
  298. label: '站点五',
  299. },
  300. ],
  301. }
  302. },
  303. })
  304. </script>
  305. <style scoped lang="scss">
  306. .el-input,
  307. .el-select {
  308. width: 240px;
  309. }
  310. .el-form-item {
  311. margin-left: 0 !important;
  312. }
  313. </style>
  314. <style>
  315. .alarmStatusDialog .el-form-item:not(.user-layout .el-form-item) {
  316. }
  317. </style>