riskPeopleTable.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <div class="paper-table">
  3. <el-table
  4. ref="elTable"
  5. :data="tableList"
  6. border
  7. stripe
  8. highlight-current-row
  9. header-row-class-name="exam-table-header"
  10. style="width: 100%"
  11. class="exam-table"
  12. >
  13. <el-table-column label="序号" type="index" width="80" />
  14. <el-table-column prop="bian_zhi_ren_" label="评估人" width="100">
  15. <template slot-scope="{row}">
  16. <ibps-user-selector
  17. type="user"
  18. :value="row.bian_zhi_ren_"
  19. readonly-text="text"
  20. :disabled="true"
  21. :multiple="false"
  22. />
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="bian_zhi_bu_men_" label="部门" width="140">
  26. <template slot-scope="{row}">
  27. <ibps-user-selector
  28. type="position"
  29. :value="row.bian_zhi_bu_men_"
  30. readonly-text="text"
  31. :disabled="true"
  32. :multiple="false"
  33. />
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="feng_xian_shu_" label="风险数" width="80" />
  37. <el-table-column prop="feng_xian_c_" label="风险等级分布情况" />
  38. <el-table-column prop="shi_fou_guo_shen_" label="识别状态" width="140">
  39. <template slot-scope="{row}">
  40. <el-tag :type="row.shi_fou_guo_shen_==='已完成'?'success':'danger'">{{ row.shi_fou_guo_shen_ }}</el-tag>
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="" label="操作" width="200">
  44. <template slot-scope="{row}">
  45. <el-button type="primary" size="mini" :disabled="row.shi_fou_guo_shen_!=='已完成' || (params&&params.shi_fou_guo_shen_==='已完成')" @click="goBack(row)">退回</el-button>
  46. <el-button type="primary" size="mini" @click="goDetail(row)">详情</el-button>
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <RiskDetail ref="RiskDetailRef" />
  51. </div>
  52. </template>
  53. <script>
  54. import ibpsUserSelector from '@/business/platform/org/selector'
  55. import RiskDetail from './riskDetail.vue'
  56. export default {
  57. components: {
  58. ibpsUserSelector,
  59. RiskDetail
  60. },
  61. props: {
  62. params: {
  63. type: Object,
  64. default: () => {}
  65. },
  66. peopleIds: {
  67. type: String,
  68. default: ''
  69. }
  70. },
  71. data () {
  72. return {
  73. tableList: [],
  74. detail: []
  75. }
  76. },
  77. watch: {
  78. peopleIds: {
  79. handler (val) {
  80. this.getPeopleList()
  81. }
  82. // immediate: true
  83. }
  84. },
  85. mounted () {
  86. this.getPeopleList()
  87. },
  88. methods: {
  89. // 获取人员部门
  90. getPersonPosition (id) {
  91. const userList = this.$store.getters.userList
  92. const bianzhiUserid = userList.find(i => i.userId === id)
  93. if (bianzhiUserid) {
  94. return bianzhiUserid.positionId
  95. }
  96. },
  97. getPersonStatus (id) {
  98. const tempList = this.detail.filter(i => i.bian_zhi_ren_ === id)
  99. if (tempList.length) {
  100. return tempList.every(i => i.shi_fou_guo_shen_ === '已完成') ? '已完成' : '未完成'
  101. } else {
  102. return '未完成'
  103. }
  104. },
  105. getRiskCount (id) {
  106. const tempList = this.detail.filter(i => i.bian_zhi_ren_ === id)
  107. if (tempList.length) return tempList.length
  108. },
  109. getRiskCategory (id) {
  110. const tempList = this.detail.filter(i => i.bian_zhi_ren_ === id)
  111. if (tempList.length) {
  112. const myMap = new Map()
  113. tempList.forEach(item => {
  114. const category = item.feng_xian_deng_ji
  115. if (!myMap.has(category)) {
  116. myMap.set(category, 0)
  117. }
  118. myMap.set(category, myMap.get(category) + 1)
  119. })
  120. return `低风险:${myMap.get('低风险') || 0};中风险:${myMap.get('中风险') || 0};高风险:${myMap.get('高风险') || 0};`
  121. }
  122. },
  123. async getPeopleList () {
  124. // console.log('zi', data)
  125. // this.tableList = data
  126. if (this.peopleIds) {
  127. const sql = `select * from t_fxsbpgb2 where parent_id_='${this.params.id_}'`
  128. const { variables: { data }} = await this.$common.request('sql', sql)
  129. this.detail = data
  130. // console.log(data)
  131. const people = this.peopleIds.split(',')
  132. if (people.length > 0) {
  133. this.tableList = people.map(item => {
  134. return {
  135. bian_zhi_ren_: item,
  136. bian_zhi_bu_men_: this.getPersonPosition(item),
  137. shi_fou_guo_shen_: this.getPersonStatus(item),
  138. feng_xian_shu_: this.getRiskCount(item),
  139. feng_xian_c_: this.getRiskCategory(item)
  140. }
  141. })
  142. }
  143. }
  144. },
  145. goDetail (row) {
  146. this.$refs.RiskDetailRef.open(this.params, row)
  147. },
  148. goBack (row) {
  149. this.$confirm('退回操作后评估人可再次修改识别项,是否继续?', '提示', {
  150. confirmButtonText: '继续',
  151. cancelButtonText: '取消',
  152. type: 'warning'
  153. }).then(async () => {
  154. const params = {
  155. tableName: 't_fxsbpgb2',
  156. updList: [{
  157. where: {
  158. bian_zhi_ren_: row.bian_zhi_ren_,
  159. parent_id_: this.params.id_
  160. },
  161. param: {
  162. shi_fou_guo_shen_: '编制中'
  163. }
  164. }]
  165. }
  166. console.log(params)
  167. await this.$common.request('update', params)
  168. console.log('退回成功')
  169. this.$message({
  170. type: 'success',
  171. message: '退回成功!'
  172. })
  173. this.$emit('goBack')
  174. }).catch(() => {
  175. })
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. </style>