reptNotice.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <script setup lang="ts">
  2. import { ref } from "vue"
  3. import configs from "@/core/config/Index"
  4. import router from "@/router"
  5. import Rs from "@/core/services/RequestService"
  6. import moment from "moment"
  7. const table = ref()
  8. const cols = ref([
  9. {
  10. name: "序号",
  11. field: configs.TABLE_INDEX_FIELD,
  12. width: 60,
  13. },
  14. {
  15. name: "区域",
  16. field: "org_name",
  17. },
  18. {
  19. name: "企业名称",
  20. field: "company_name",
  21. },
  22. {
  23. name: "监测类型",
  24. field: "monitoring_type_name",
  25. },
  26. {
  27. name: "通知类型",
  28. field: "notice_type_name",
  29. },
  30. {
  31. name: "通知时间",
  32. field: "notice_time",
  33. },
  34. {
  35. name: "状态",
  36. field: "state",
  37. },
  38. {
  39. name: "操作",
  40. field: "action",
  41. width: 160,
  42. },
  43. ])
  44. const size = ref<any>("default")
  45. const dySearchSelectStyle = { width: "160px" }
  46. const companyName = ref("")
  47. const orgId = ref<string | null>(null)
  48. const monitoringType = ref("")
  49. const state = ref("")
  50. const type = ref("")
  51. const currentDate = ref<Date>(new Date())
  52. const queryParams = ref({
  53. date: moment(currentDate.value).format("YYYYMMDD"),
  54. })
  55. const jump = function (v: any) {
  56. console.log("jump", v)
  57. router.push({
  58. path: "/goLineData/oilFumeConcentration",
  59. query: {
  60. comName: v.company_name,
  61. company_id: v.company_id,
  62. back: 1,
  63. },
  64. })
  65. }
  66. function query() {
  67. const params = {
  68. org_id: orgId.value,
  69. company_name: companyName.value,
  70. monitoring_type: monitoringType.value,
  71. state: state.value,
  72. type: type.value,
  73. date: moment(currentDate.value).format("YYYYMMDD"),
  74. }
  75. const keys = Object.keys(params)
  76. keys.forEach((key) => {
  77. if (params[key] == "") {
  78. delete params[key]
  79. }
  80. })
  81. queryParams.value = params
  82. }
  83. function reset() {
  84. companyName.value = ""
  85. orgId.value = "0"
  86. monitoringType.value = ""
  87. state.value = ""
  88. type.value = ""
  89. currentDate.value = new Date()
  90. query()
  91. }
  92. const modal = ref<any>()
  93. const operationType = ref<"R" | "N">("R")
  94. const modalTitle = ref("")
  95. const details = ref<any>({})
  96. const reply = function (row: any) {
  97. operationType.value = "R"
  98. modalTitle.value = "告警通知"
  99. getDetail(row)
  100. }
  101. const notity = function (row: any) {
  102. operationType.value = "N"
  103. if (row.type == 0) {
  104. modalTitle.value = "告警通知"
  105. } else if (row.type == 1) {
  106. modalTitle.value = "清洗通知"
  107. }
  108. getDetail(row)
  109. }
  110. function getDetail(row: any) {
  111. Rs.post(`sys/notice/getNoticeDetail`, { data: row.id }).then((res) => {
  112. details.value = Object.assign({}, res.data)
  113. details.value.clear_date = moment(res.data.clear_date, "YYYYMMDD").format("YYYY-MM-DD")
  114. modal.value.show()
  115. })
  116. }
  117. </script>
  118. <template>
  119. <VbDataTable
  120. ref="table"
  121. :header="cols"
  122. url="sys/notice/selectForPage"
  123. method="post"
  124. :query-params="queryParams"
  125. :has-checkbox="false"
  126. >
  127. <template v-slot:table-tool>
  128. <el-form class="align-items-center" :inline="true">
  129. <el-form-item class="mb-0 me-5 align-items-center" label="商户名称">
  130. <el-input class="" style="width: 180px" v-model="companyName" placeholder="请输入商户名称" :size="size" />
  131. </el-form-item>
  132. <el-form-item class="mb-0 me-5 align-items-center" label="区域">
  133. <OrgSelectTree v-model:value="orgId" style="width: 180px"></OrgSelectTree>
  134. </el-form-item>
  135. <el-form-item class="mb-0 me-5 align-items-center" label="通知类型">
  136. <el-select v-model="type" :style="dySearchSelectStyle" clearable placeholder="请选择通知类型">
  137. <el-option value="0" label="告警通知"></el-option>
  138. <el-option value="1" label="清洗通知"></el-option>
  139. </el-select>
  140. </el-form-item>
  141. <el-form-item class="mb-0 me-5 align-items-center" label="状态">
  142. <el-select v-model="state" :style="dySearchSelectStyle" clearable placeholder="请选择状态">
  143. <el-option value="0" label="未回复"></el-option>
  144. <el-option value="1" label="已回复"></el-option>
  145. </el-select>
  146. </el-form-item>
  147. <el-form-item class="mb-0 me-5 align-items-center" label="时间">
  148. <el-date-picker
  149. v-model="currentDate"
  150. type="date"
  151. placeholder="请选择时间"
  152. :size="size"
  153. :style="dySearchSelectStyle"
  154. :clearable="false"
  155. />
  156. </el-form-item>
  157. <el-form-item class="mb-0 me-5 align-items-center" label="监测类型">
  158. <DySelect
  159. v-model="monitoringType"
  160. :url="'sys/dict/getCompanyMonitoringType'"
  161. :style="dySearchSelectStyle"
  162. placeholder="请选择监测类型"
  163. ></DySelect>
  164. </el-form-item>
  165. <el-form-item class="mb-0 me-0 align-items-center">
  166. <el-button class="ms-3 mt-0 btn btn-sm btn-primary" @click="query">查询</el-button>
  167. <el-button class="ms-3 mt-0 btn btn-sm btn-light-primary btn-outline" @click="reset">重置</el-button>
  168. </el-form-item>
  169. </el-form>
  170. </template>
  171. <template #company_name="{ row }">
  172. <span class="text-primary" @click="jump(row)" style="cursor: pointer">{{ row["company_name"] }}</span>
  173. </template>
  174. <template #state="{ row }">
  175. <span class="badge" :class="`badge-${row.state == 0 ? 'primary' : row.state == 1 ? 'success' : 'danger'}`">
  176. {{ row["state"] == 0 ? "未回复" : "已回复" }}
  177. </span>
  178. </template>
  179. <template #notice_time="{ row }">
  180. {{ moment(row["notice_time"], "YYYYMMDDHHmmss").format("YYYY-MM-DD HH:mm:ss") }}
  181. </template>
  182. <template #action="{ row }">
  183. <span v-if="row.state == 1" class="table-action" @click="reply(row)">查看回复</span>
  184. <span class="table-action" @click="notity(row)">查看通知</span>
  185. </template>
  186. </VbDataTable>
  187. <VbModal
  188. v-model:modal="modal"
  189. :title="modalTitle"
  190. :confirm-btn="false"
  191. close-btn-class="btn btn-primary"
  192. :modal-class="`modal-${operationType == 'R' ? 'md' : 'lg'}`"
  193. >
  194. <template #body>
  195. <el-row v-if="operationType == 'R' && details.type == 1">
  196. <el-col :span="12">
  197. <dl>
  198. <dt>是否清洗:</dt>
  199. <dd>{{ details.is_clear ? "已清洗" : "未清洗" }}</dd>
  200. </dl>
  201. </el-col>
  202. <el-col :span="12">
  203. <dl>
  204. <dt>清洗时间:</dt>
  205. <dd>{{ details.clear_date }}</dd>
  206. </dl>
  207. </el-col>
  208. <el-col :span="24">
  209. <dl>
  210. <dt>备注:</dt>
  211. <dd>{{ details.remark }}</dd>
  212. </dl>
  213. </el-col>
  214. </el-row>
  215. <el-row v-if="operationType == 'R' && details.type == 0">
  216. <el-col :span="23">
  217. <dl>
  218. <dt>设备名称:</dt>
  219. <dd>{{ details.device_name }}</dd>
  220. </dl>
  221. </el-col>
  222. <el-col :span="24">
  223. <dl>
  224. <dt>异常类型:</dt>
  225. <dd>{{ details.warn_type_name }}</dd>
  226. </dl>
  227. </el-col>
  228. <el-col :span="24">
  229. <dl>
  230. <dt>异常原因:</dt>
  231. <dd>{{ details.remark }}</dd>
  232. </dl>
  233. </el-col>
  234. <el-col :span="24">
  235. <dl>
  236. <dt>告警原因:</dt>
  237. <dd>{{ details.content }}</dd>
  238. </dl>
  239. </el-col>
  240. </el-row>
  241. <el-row v-if="operationType == 'N' && details.type == 1">
  242. <el-col :span="12">
  243. <dl>
  244. <dt>企业名称:</dt>
  245. <dd>{{ details.company_name }}</dd>
  246. </dl>
  247. </el-col>
  248. <el-col :span="12">
  249. <dl>
  250. <dt>清洗周期(天):</dt>
  251. <dd>{{ details.clean_cycle_day }}</dd>
  252. </dl>
  253. </el-col>
  254. <el-col :span="12">
  255. <dl>
  256. <dt>设施名称:</dt>
  257. <dd>{{ details.device_name }}</dd>
  258. </dl>
  259. </el-col>
  260. <el-col :span="12">
  261. <dl>
  262. <dt>清洗周期(小时):</dt>
  263. <dd>{{ details.clean_cycle_hour }}</dd>
  264. </dl>
  265. </el-col>
  266. <el-col :span="12">
  267. <dl>
  268. <dt>是否完成清洗:</dt>
  269. <dd>{{ details.is_clear ? "已清洗" : "未清洗" }}</dd>
  270. </dl>
  271. </el-col>
  272. </el-row>
  273. <el-row v-if="operationType == 'N' && details.type == 0">
  274. <el-col :span="12">
  275. <dl>
  276. <dt>企业名称:</dt>
  277. <dd>{{ details.company_name }}</dd>
  278. </dl>
  279. </el-col>
  280. <el-col :span="12">
  281. <dl>
  282. <dt>异常类型:</dt>
  283. <dd>{{ details.warn_type_name }}</dd>
  284. </dl>
  285. </el-col>
  286. <el-col :span="12">
  287. <dl>
  288. <dt>告警设备:</dt>
  289. <dd>{{ details.device_name }}</dd>
  290. </dl>
  291. </el-col>
  292. <el-col :span="12">
  293. <dl>
  294. <dt>告警时间:</dt>
  295. <dd>{{ details.warn_time }}</dd>
  296. </dl>
  297. </el-col>
  298. <el-col :span="24">
  299. <dl>
  300. <dt>通知内容:</dt>
  301. <dd>{{ details.content }}</dd>
  302. </dl>
  303. </el-col>
  304. </el-row>
  305. <div v-if="operationType == 'N'" class="separator mt-2 mb-5"></div>
  306. <el-row v-if="operationType == 'N'">
  307. <el-col :span="12">
  308. <dl>
  309. <dt>部门:</dt>
  310. <dd>{{ details.org_name }}</dd>
  311. </dl>
  312. </el-col>
  313. <el-col :span="12">
  314. <dl>
  315. <dt>通知人:</dt>
  316. <dd>{{ details.notifier }}</dd>
  317. </dl>
  318. </el-col>
  319. </el-row>
  320. </template>
  321. </VbModal>
  322. </template>