index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <div class="content-container">
  3. <el-row class="tool-bar">
  4. <el-col :span="8" class="left">
  5. <div class="content-title">
  6. {{ title }}
  7. </div>
  8. </el-col>
  9. <el-col :span="16" class="button-group">
  10. <div class="select-search right">
  11. <el-cascader
  12. v-model="conditions.reviewGroupId"
  13. :options="treeData"
  14. :props="{ checkStrictly: true, emitPath: false }"
  15. style="min-width: 160px"
  16. filterable
  17. clearable
  18. placeholder="部门"
  19. @change="handleChange"
  20. >
  21. <template slot-scope="{ node, data }">
  22. <span>{{ data.label }}</span>
  23. <span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
  24. </template>
  25. </el-cascader>
  26. <el-select v-model="conditions.reviewAccountId" style="width:100px;margin:0 10px" filterable clearable placeholder="执行人">
  27. <el-option v-for="item in userList" :key="item.accountId" :value="item.accountId" :label="item.accountName" />
  28. </el-select>
  29. <el-select v-model="conditions.hdangerLevel" style="width: 80px;" filterable placeholder="级别" clearable>
  30. <el-option :value="0" label="较低" />
  31. <el-option :value="1" label="一般" />
  32. <el-option :value="2" label="较大" />
  33. <el-option :value="3" label="重大" />
  34. </el-select>
  35. <el-select v-model="conditions.hdangerType" style="width: 110px;margin:0 10px" filterable placeholder="类型" clearable>
  36. <el-option :value="0" label="人员巡检" />
  37. <el-option :value="1" label="传感器" />
  38. </el-select>
  39. <div>
  40. <el-select v-model="conditions.goafOrebelt" style="width: 110px;" filterable placeholder="矿带" clearable @change="changeArea(1)">
  41. <el-option v-for="(item,index) in goafOrebelts" :key="index" :value="item" :label="item" />
  42. </el-select>
  43. <el-select v-model="conditions.goafOrebody" style="width: 110px;margin-left:10px" filterable placeholder="矿体" clearable @change="changeArea(2)">
  44. <el-option v-for="(item,index) in goafOrebodys" :key="index" :value="item.goafOrebody" :label="item.goafOrebody" />
  45. </el-select>
  46. <el-select v-model="conditions.goafOreheight" style="width: 110px;margin:0 10px" filterable placeholder="中段" clearable @change="changeArea(3)">
  47. <el-option v-for="(item,index) in goafOreheights" :key="index" :value="item.goafOreheight" :label="item.goafOreheight" />
  48. </el-select>
  49. <el-select v-model="conditions.goafId" style="width: 150px;" filterable placeholder="采空区编号" clearable @change="changeArea(4)">
  50. <el-option v-for="item in goafNames" :key="item.goafId" :value="item.goafId" :label="item.goafName" />
  51. </el-select>
  52. </div>
  53. <el-date-picker
  54. v-model="conditions.startSubmitTime"
  55. type="date"
  56. placeholder="开始时间"
  57. format="yyyy-MM-dd HH:mm:ss"
  58. value-format="yyyy-MM-dd HH:mm:ss"
  59. clearable
  60. style="width: 180px;margin:0 10px"
  61. />
  62. <el-date-picker
  63. v-model="conditions.endSubmitTime"
  64. type="date"
  65. placeholder="结束时间"
  66. format="yyyy-MM-dd HH:mm:ss"
  67. value-format="yyyy-MM-dd HH:mm:ss"
  68. clearable
  69. style="width: 180px;margin:0 10px"
  70. />
  71. <el-input v-model="conditions.hdangerTitle" class="search-input" placeholder="请输入内容">
  72. <el-button slot="append" icon="el-icon-search" @click="getData()" />
  73. </el-input>
  74. </div>
  75. </el-col>
  76. </el-row>
  77. <el-row class="content-body">
  78. <el-table v-loading="listLoading" class="page-table" border :data="dataList" height="calc(100vh - 350px)">
  79. <el-table-column type="index" label="序号" header-align="center" align="center" width="60" />>
  80. <el-table-column prop="hdangerTitle" label="预警名称" header-align="left" align="left">
  81. <template v-slot="{row}">
  82. <span>{{ row.hdangerTitle }}</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column prop="hdangerType" label="类型" header-align="center" align="center" min-width="120">
  86. <template v-slot="{row}">
  87. <el-tag v-if=" row.hdangerType===1" type="success" effect="plain" color="rgb(38 69 90)">传感器巡检</el-tag>
  88. <el-tag v-else effect="plain" color="rgb(38 69 90)">人员巡检</el-tag>
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="hdangerLevel" label="级别" header-align="center" align="center" width="80">
  92. <template v-slot="{row}">
  93. <span><el-tag type="success" effect="plain" color="rgb(38 69 90)">{{ row.hdangerLevel | dangerLevelFilter }}</el-tag></span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column prop="status" label="状态" header-align="center" align="center" width="80">
  97. <template v-slot="{row}">
  98. <span><el-tag type="warning" effect="plain" color="rgb(38 69 90)">{{ row.status | dangerStatusFilter }}</el-tag></span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column prop="curActivityTitle" label="当前关卡" header-align="center" align="center" width="80">
  102. <template v-slot="{row}">
  103. <span><el-tag type="danger" effect="plain" color="rgb(38 69 90)">{{ row.curActivityTitle }}</el-tag></span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column prop="curAccountName" label="当前处理人" header-align="center" align="center" width="160">
  107. <template v-slot="{row}">
  108. <span><i class="el-icon-user-solid" />{{ row.curAccountName }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="dangerDeadline" label="整改期限" header-align="center" align="center" width="165">
  112. <template v-slot="{row}">
  113. <span><i class="el-icon-timer" />{{ row.dangerDeadline }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="操作" header-align="center" align="center" width="180">
  117. <template v-slot="{row}">
  118. <el-button v-if="row.curAccountId===userData.userId" type="primary" size="mini" @click="handleDanger(row)">处理</el-button>
  119. <el-button size="mini" type="info" @click="handleDetail(row)">详情</el-button>
  120. <el-button v-if="row.submitAccountId===userData.userId" size="mini" type="danger" @click="handleDelete(row)">删除</el-button>
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. <div class="pagination-container">
  125. <pagination v-show="total>0" :total="total" :page.sync="conditions.page" :limit.sync="conditions.limit" @pagination="getData" />
  126. </div>
  127. </el-row>
  128. <submit-activity ref="submit" title="登记预警" @formSuccess="formSuccess" />
  129. <review-activity ref="review" title="预警评审" @formSuccess="formSuccess" />
  130. <rectify-activity ref="rectify" title="预警整改" @formSuccess="formSuccess" />
  131. <accept-activity ref="accept" title="预警验收" @formSuccess="formSuccess" />
  132. <danger-details ref="DangerDetails" title="预警详情" />
  133. </div>
  134. </template>
  135. <script>
  136. import Pagination from '@/components/Pagination'
  137. import { getGoafBaseInfo } from '@/api/goaf/info'
  138. import { getGroupByList } from '@/api/system/groupApi'
  139. import { getUserByPage } from '@/api/system/userApi'
  140. import { toTree } from '@/utils/build-tree'
  141. import { deleteDangerById, getDangerByPage } from '@/api/goaf/dangerApi'
  142. import DangerDetails from '@/views/goaf/danger/components/Details.vue'
  143. import { mapGetters } from 'vuex'
  144. import SubmitActivity from './activity/Submit'
  145. import ReviewActivity from './activity/Review'
  146. import RectifyActivity from './activity/Rectify'
  147. import AcceptActivity from './activity/Accept'
  148. export default {
  149. name: 'DangerList',
  150. components: { Pagination, SubmitActivity, ReviewActivity, RectifyActivity, AcceptActivity, DangerDetails },
  151. filters: {
  152. dangerLevelFilter(val) {
  153. const status = ['较低', '一般', '较大', '重大']
  154. return status[val]
  155. },
  156. dangerStatusFilter(val) {
  157. const status = ['待提交', '待评审', '待整改', '待验收', '完成']
  158. return val === -1 ? '撤销' : status[val]
  159. }
  160. },
  161. props: {
  162. title: {
  163. type: [String],
  164. default: '预警中心'
  165. }
  166. },
  167. data() {
  168. return {
  169. dataList: [],
  170. total: 0,
  171. listLoading: false,
  172. conditions: {
  173. page: 1,
  174. limit: 10,
  175. status: 1,
  176. startSubmitTime: undefined,
  177. endSubmitTime: undefined,
  178. goafId: undefined,
  179. goafOrebelt: undefined,
  180. goafOrebody: undefined,
  181. goafOreheight: undefined,
  182. reviewGroupId: undefined,
  183. reviewAccountId: undefined,
  184. hdangerLevel: undefined
  185. },
  186. goafList: [],
  187. goafOrebelts: [],
  188. goafOrebodys: [],
  189. goafOreheights: [],
  190. goafNames: [],
  191. treeData: [],
  192. userList: []
  193. }
  194. },
  195. computed: {
  196. ...mapGetters([
  197. 'userData'
  198. ])
  199. },
  200. created() {
  201. this.getData()
  202. getGoafBaseInfo().then((res) => {
  203. const goafOrebelts = res.data.map(item => item.goafOrebelt)
  204. this.goafOrebelts = [...new Set(goafOrebelts)]
  205. this.goafList = res.data
  206. })
  207. getGroupByList().then((resp) => {
  208. const { code, data } = resp
  209. if (code === 0) {
  210. const temp = toTree(
  211. data,
  212. {
  213. value: 'value',
  214. name: 'label',
  215. pValue: 'parentId'
  216. },
  217. {
  218. value: 'groupId',
  219. name: 'groupName',
  220. pValue: 'parentId'
  221. }
  222. )
  223. this.treeData = temp
  224. }
  225. })
  226. getUserByPage({
  227. page: 1,
  228. limit: 999999
  229. }).then((resp) => {
  230. const { data } = resp
  231. this.userList = data
  232. })
  233. },
  234. methods: {
  235. changeArea(type) {
  236. const goafs = this.deeepClone(this.goafList)
  237. let goafOrebodys = this.deeepClone(this.goafOrebodys)
  238. let goafOreheights = this.deeepClone(this.goafOreheights)
  239. let goafNames = this.deeepClone(this.goafNames)
  240. if (type === 1) {
  241. goafOrebodys = goafs.filter(item => item.goafOrebelt === this.conditions.goafOrebelt)
  242. this.goafOrebodys = goafOrebodys
  243. this.goafOreheights = []
  244. this.goafNames = []
  245. this.conditions.goafOrebody = ''
  246. this.conditions.goafOreheight = ''
  247. this.conditions.goafName = ''
  248. } else if (type === 2) {
  249. goafOreheights = goafs.filter(item => (item.goafOrebody === this.conditions.goafOrebody) && (item.goafOrebelt === this.conditions.goafOrebelt))
  250. this.goafOreheights = goafOreheights
  251. this.goafNames = []
  252. this.conditions.goafOreheight = ''
  253. this.conditions.goafName = ''
  254. } else if (type === 3) {
  255. goafNames = goafs.filter(item => (item.goafOreheight === this.conditions.goafOreheight) && (item.goafOrebody === this.conditions.goafOrebody) && (item.goafOrebelt === this.conditions.goafOrebelt))
  256. this.goafNames = goafNames
  257. this.conditions.goafName = ''
  258. } else {
  259. for (let i = 0; i < goafNames.length; i++) {
  260. if (this.conditions.goafId === goafNames[i].goafId) {
  261. this.conditions.goafName = goafNames[i].goafName
  262. }
  263. }
  264. }
  265. this.$forceUpdate()
  266. },
  267. handleChange(groupId) {
  268. getUserByPage({
  269. page: 1,
  270. limit: 999999,
  271. groupId
  272. }).then((resp) => {
  273. const { data } = resp
  274. this.userList = data
  275. })
  276. },
  277. // 重置查询条件
  278. resetConditions() {
  279. this.conditions.keywords = ''
  280. this.conditions.status = undefined
  281. this.conditions.submitAccountId = undefined
  282. this.conditions.handleAccountId = undefined
  283. this.conditions.curAccountId = undefined
  284. this.conditions.groupId = undefined
  285. },
  286. // 加载数据
  287. loadData(action) {
  288. this.conditions = { ...this.conditions, ...action }
  289. this.getData()
  290. },
  291. // Fetch Data
  292. getData() {
  293. this.listLoading = true
  294. for (const key in this.conditions) {
  295. if (this.conditions[key] === '' || this.conditions[key] === undefined) {
  296. delete this.conditions[key]
  297. }
  298. }
  299. getDangerByPage(this.conditions).then((resp) => {
  300. const { code, data, total, msg } = resp
  301. this.listLoading = false
  302. if (code === 0) {
  303. this.total = total
  304. this.dataList = data
  305. } else {
  306. this.$message.error(msg)
  307. }
  308. }).catch((error) => {
  309. console.log(error)
  310. })
  311. },
  312. // 流程处理
  313. handleDanger(data) {
  314. const { hdangerId, curActivityCode } = data
  315. this.$refs[curActivityCode].showModel(hdangerId, data)
  316. },
  317. // Delete Handler
  318. handleDelete(data) {
  319. const { hdangerId, hdangerTitle } = data
  320. this.$confirm(`此操作将删除该数据${hdangerTitle}, 是否继续?`, '提示', {
  321. confirmButtonText: '确定',
  322. cancelButtonText: '取消',
  323. type: 'warning'
  324. }).then(() => {
  325. deleteDangerById(hdangerId).then((resp) => {
  326. const { code, msg } = resp
  327. if (code === 0) {
  328. this.$message.success(msg)
  329. this.getData()
  330. } else {
  331. this.$message.error(msg)
  332. }
  333. }).catch((error) => {
  334. console.log(error)
  335. })
  336. }).catch(() => {
  337. this.$message({ type: 'info', message: '已取消删除' })
  338. })
  339. },
  340. // Show Details
  341. handleDetail(data) {
  342. const { hdangerId } = data
  343. this.$refs['DangerDetails'].showView(hdangerId, JSON.parse(JSON.stringify(data)))
  344. },
  345. // Update View
  346. formSuccess() {
  347. this.getData()
  348. this.$emit('actionUpdate')
  349. },
  350. // Preview Photo
  351. previewList(photos) {
  352. if (Array.isArray(photos)) {
  353. const list = photos.map((item) => {
  354. return item
  355. })
  356. return list
  357. }
  358. return [photos]
  359. },
  360. deeepClone(params) {
  361. return JSON.parse(JSON.stringify(params))
  362. }
  363. }
  364. }
  365. </script>
  366. <style lang="scss" scoped>
  367. .content-container {
  368. margin: 10px;
  369. height: calc(100vh - 95px);
  370. }
  371. .select-search {
  372. display: flex;
  373. flex-wrap: wrap;
  374. justify-content: flex-end;
  375. }
  376. </style>