DangerList.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div class="content-container">
  3. <el-row class="tool-bar">
  4. <el-col :span="12" class="left">
  5. <div class="content-title">
  6. {{ title }}
  7. </div>
  8. </el-col>
  9. <el-col :span="12" class="button-group">
  10. <div class="select-search right">
  11. <el-input v-model="conditions.keywords" class="search-input" placeholder="请输入内容">
  12. <el-button slot="append" icon="el-icon-search" @click="getData()" />
  13. </el-input>
  14. </div>
  15. </el-col>
  16. </el-row>
  17. <el-row class="content-body">
  18. <el-table v-loading="listLoading" class="page-table" border :data="dataList" height="calc(100vh - 230px)">
  19. <el-table-column type="index" label="序号" header-align="center" align="center" width="60" />
  20. <el-table-column prop="scenePhoto" label="照片" header-align="center" align="center" width="60">
  21. <template v-slot="{row}">
  22. <div class="custom-avatar">
  23. <el-image
  24. :src="row.sceneIcon"
  25. :preview-src-list="previewList(row.scenePhoto)"
  26. />
  27. </div>
  28. </template>
  29. </el-table-column>
  30. <el-table-column prop="dangerTitle" label="隐患名称" header-align="left" align="left">
  31. <template v-slot="{row}">
  32. <span>{{ row.dangerTitle }}</span>
  33. </template>
  34. </el-table-column>
  35. <el-table-column prop="dangerCatTitle" label="类别" header-align="center" align="center" width="100">
  36. <template v-slot="{row}">
  37. <span>{{ row.dangerCatTitle }}</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="dangerLevel" label="级别" header-align="center" align="center" width="80">
  41. <template v-slot="{row}">
  42. <span><el-tag type="success" effect="plain" color="rgb(38 69 90)">{{ row.dangerLevel | dangerLevelFilter }}</el-tag></span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="status" label="状态" header-align="center" align="center" width="80">
  46. <template v-slot="{row}">
  47. <span><el-tag type="warning" effect="plain" color="rgb(38 69 90)">{{ row.status | dangerStatusFilter }}</el-tag></span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="curActivityTitle" label="当前关卡" header-align="center" align="center" width="80">
  51. <template v-slot="{row}">
  52. <span v-if="row.status!==0">-</span>
  53. <!-- color="rgb(38 69 90)" -->
  54. <span v-else><el-tag type="danger" effect="plain" color="rgb(38 69 90)">{{ row.curActivityTitle }}</el-tag></span>
  55. </template>
  56. </el-table-column>
  57. <el-table-column prop="curAccountName" label="当前处理人" header-align="center" align="center" width="160">
  58. <template v-slot="{row}">
  59. <span v-if="row.status!==0">-</span>
  60. <span v-else><i class="el-icon-user-solid" />{{ row.curAccountName }}( {{ row.curPositionName }} )</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="expectedEndTime" label="整改期限" header-align="center" align="center" width="165">
  64. <template v-slot="{row}">
  65. <span><i class="el-icon-timer" />{{ row.dangerDeadLine }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="操作" header-align="center" align="center" width="180">
  69. <template v-slot="{row}">
  70. <el-button v-if="row.status === 0 && row.curAccountId===userData.userId" type="primary" size="mini" @click="handleDanger(row)">处理</el-button>
  71. <el-button size="mini" type="info" @click="handleDetail(row)">详情</el-button>
  72. <el-button v-if="row.submitAccountId===userData.userId" size="mini" type="danger" @click="handleDelete(row)">删除</el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <div class="pagination-container">
  77. <pagination v-show="total>0" :total="total" :page.sync="conditions.page" :limit.sync="conditions.limit" @pagination="getData" />
  78. </div>
  79. </el-row>
  80. <submit-activity ref="submit" title="登记隐患" @formSuccess="formSuccess" />
  81. <review-activity ref="review" title="隐患评审" @formSuccess="formSuccess" />
  82. <rectify-activity ref="rectify" title="隐患整改" @formSuccess="formSuccess" />
  83. <accept-activity ref="accept" title="隐患验收" @formSuccess="formSuccess" />
  84. <danger-details ref="DangerDetails" title="隐患详情" />
  85. </div>
  86. </template>
  87. <script>
  88. import Pagination from '@/components/Pagination'
  89. import { deleteDangerById, getDangerByPage } from '@/api/goaf/dangerApi'
  90. import SubmitActivity from '../activity/Submit'
  91. import ReviewActivity from '../activity/Review'
  92. import RectifyActivity from '../activity/Rectify'
  93. import AcceptActivity from '../activity/Accept'
  94. import DangerDetails from './Details'
  95. import { dangerLevel, dangerStatus } from '@/utils'
  96. import { mapGetters } from 'vuex'
  97. export default {
  98. name: 'DangerList',
  99. components: { Pagination, SubmitActivity, ReviewActivity, RectifyActivity, AcceptActivity, DangerDetails },
  100. filters: {
  101. dangerLevelFilter(val) {
  102. return dangerLevel(val)
  103. },
  104. dangerStatusFilter(val) {
  105. return dangerStatus(val)
  106. },
  107. dangerDeadlineFilter(val) {
  108. }
  109. },
  110. data() {
  111. return {
  112. title: '',
  113. dataList: [],
  114. total: 0,
  115. listLoading: false,
  116. conditions: {
  117. page: 1,
  118. limit: 10,
  119. keywords: '',
  120. status: undefined,
  121. day: undefined,
  122. submitAccountId: undefined,
  123. handleAccountId: undefined,
  124. curAccountId: undefined,
  125. startDate: undefined,
  126. endDate: undefined,
  127. groupId: undefined
  128. },
  129. action: ''
  130. }
  131. },
  132. computed: {
  133. ...mapGetters([
  134. 'userData'
  135. ])
  136. },
  137. mounted() {
  138. // this.getData()
  139. },
  140. methods: {
  141. // 重置查询条件
  142. resetConditions() {
  143. this.conditions.keywords = ''
  144. this.conditions.status = undefined
  145. this.conditions.submitAccountId = undefined
  146. this.conditions.handleAccountId = undefined
  147. this.conditions.curAccountId = undefined
  148. this.conditions.groupId = undefined
  149. },
  150. // 加载数据
  151. loadData(action) {
  152. this.action = action
  153. const groupId = this.userData.groupId
  154. const userId = this.userData.userId
  155. switch (action) {
  156. case 'MyCreated':
  157. this.title = '我提交的隐患'
  158. this.resetConditions()
  159. this.conditions.submitAccountId = userId
  160. break
  161. case 'MyHandling':
  162. this.title = '我的待处理隐患'
  163. this.resetConditions()
  164. this.conditions.status = 0
  165. this.conditions.curAccountId = userId
  166. break
  167. case 'MyHandled':
  168. this.title = '我处理完的隐患'
  169. this.resetConditions()
  170. this.conditions.handleAccountId = userId
  171. break
  172. case 'MyCanceled':
  173. this.title = '我撤消的隐患'
  174. this.resetConditions()
  175. this.conditions.submitAccountId = userId
  176. this.conditions.status = -1
  177. break
  178. case 'GroupHandling':
  179. this.title = '部门待处理的隐患'
  180. this.resetConditions()
  181. this.conditions.curGroupId = groupId
  182. this.conditions.status = 0
  183. break
  184. case 'GroupSubmit':
  185. this.title = '部门提交的隐患'
  186. this.resetConditions()
  187. this.conditions.submitGroupId = groupId
  188. break
  189. case 'GroupReview':
  190. this.title = '部门参与评审的隐患'
  191. this.resetConditions()
  192. this.conditions.reviewGroupId = groupId
  193. break
  194. case 'GroupRectify':
  195. this.title = '部门整改的隐患'
  196. this.resetConditions()
  197. this.conditions.rectifyGroupId = groupId
  198. break
  199. case 'GroupAccept':
  200. this.title = '部门参与验收的隐患'
  201. this.resetConditions()
  202. this.conditions.acceptGroupId = groupId
  203. break
  204. }
  205. this.getData()
  206. },
  207. // Fetch Data
  208. getData() {
  209. this.listLoading = true
  210. const conditions = {
  211. page: 1,
  212. limit: 10
  213. }
  214. getDangerByPage(conditions).then((resp) => {
  215. const { code, data, total, msg } = resp
  216. this.listLoading = false
  217. if (code === 0) {
  218. this.total = total
  219. this.dataList = data
  220. } else {
  221. this.$message.error(msg)
  222. }
  223. }).catch((error) => {
  224. console.log(error)
  225. })
  226. },
  227. // 流程处理
  228. handleDanger(data) {
  229. const { curActivityCode, dangerId } = data
  230. this.$refs[curActivityCode].showModel(dangerId)
  231. },
  232. // Delete Handler
  233. handleDelete(data) {
  234. const { dangerId, dangerTitle } = data
  235. this.$confirm(`此操作将删除该数据${dangerTitle}, 是否继续?`, '提示', {
  236. confirmButtonText: '确定',
  237. cancelButtonText: '取消',
  238. type: 'warning'
  239. }).then(() => {
  240. deleteDangerById(dangerId).then((resp) => {
  241. const { code, msg } = resp
  242. if (code === 0) {
  243. this.$message.success(msg)
  244. this.getData()
  245. } else {
  246. this.$message.error(msg)
  247. }
  248. }).catch((error) => {
  249. console.log(error)
  250. })
  251. }).catch(() => {
  252. this.$message({ type: 'info', message: '已取消删除' })
  253. })
  254. },
  255. // Show Details
  256. handleDetail(data) {
  257. const { dangerId } = data
  258. this.$refs['DangerDetails'].showView(dangerId)
  259. },
  260. // Update View
  261. formSuccess() {
  262. this.getData()
  263. this.$emit('actionUpdate')
  264. },
  265. // Preview Photo
  266. previewList(photos) {
  267. if (Array.isArray(photos)) {
  268. const list = photos.map((item) => {
  269. return item
  270. })
  271. return list
  272. }
  273. return [photos]
  274. }
  275. }
  276. }
  277. </script>
  278. <style lang="scss" scoped>
  279. .content-container {
  280. margin: 10px 10px 10px 0;
  281. height: calc(100vh - 95px);
  282. }
  283. </style>