riskPeopleTable.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 v-if="isZuZhang" 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. const { userId } = this.$store.getters
  73. return {
  74. tableList: [],
  75. detail: [],
  76. isZuZhang: false,
  77. userId: userId
  78. }
  79. },
  80. watch: {
  81. peopleIds: {
  82. handler (val) {
  83. this.getPeopleList()
  84. }
  85. // immediate: true
  86. }
  87. },
  88. mounted () {
  89. this.getPeopleList()
  90. },
  91. methods: {
  92. // 获取人员部门
  93. getPersonPosition (id) {
  94. const userList = this.$store.getters.userList
  95. const bianzhiUserid = userList.find(i => i.userId === id)
  96. if (bianzhiUserid) {
  97. return bianzhiUserid.positionId
  98. }
  99. },
  100. getPersonStatus (id) {
  101. const tempList = this.detail.filter(i => i.bian_zhi_ren_ === id)
  102. if (tempList.length) {
  103. return tempList.every(i => i.shi_fou_guo_shen_ === '已完成') ? '已完成' : '未完成'
  104. } else {
  105. return '未完成'
  106. }
  107. },
  108. getRiskCount (id) {
  109. const tempList = this.detail.filter(i => i.bian_zhi_ren_ === id)
  110. if (tempList.length) return tempList.length
  111. },
  112. getRiskCategory (id) {
  113. const tempList = this.detail.filter(i => i.bian_zhi_ren_ === id)
  114. if (tempList.length) {
  115. const myMap = new Map()
  116. tempList.forEach(item => {
  117. const category = item.feng_xian_deng_ji
  118. if (!myMap.has(category)) {
  119. myMap.set(category, 0)
  120. }
  121. myMap.set(category, myMap.get(category) + 1)
  122. })
  123. let result = ''
  124. myMap.forEach((value, key) => {
  125. result += `${key}:${value || 0};`
  126. })
  127. return result
  128. }
  129. },
  130. async getPeopleList () {
  131. // console.log('zi', data)
  132. // this.tableList = data
  133. this.isZuZhang = this.userId === this.params.zu_chang_id_
  134. if (this.peopleIds) {
  135. const sql = `select * from t_fxsbpgb2 where parent_id_='${this.params.id_}'`
  136. const { variables: { data }} = await this.$common.request('sql', sql)
  137. this.detail = data
  138. // console.log(data)
  139. const people = this.peopleIds.split(',')
  140. if (people.length > 0) {
  141. this.tableList = people.map(item => {
  142. return {
  143. bian_zhi_ren_: item,
  144. bian_zhi_bu_men_: this.getPersonPosition(item),
  145. shi_fou_guo_shen_: this.getPersonStatus(item),
  146. feng_xian_shu_: this.getRiskCount(item),
  147. feng_xian_c_: this.getRiskCategory(item)
  148. }
  149. })
  150. }
  151. }
  152. },
  153. goDetail (row) {
  154. this.$refs.RiskDetailRef.open(this.params, row)
  155. },
  156. goBack (row) {
  157. this.$confirm('退回操作后评估人可再次修改识别项,是否继续?', '提示', {
  158. confirmButtonText: '继续',
  159. cancelButtonText: '取消',
  160. type: 'warning'
  161. }).then(async () => {
  162. const params = {
  163. tableName: 't_fxsbpgb2',
  164. updList: [{
  165. where: {
  166. bian_zhi_ren_: row.bian_zhi_ren_,
  167. parent_id_: this.params.id_
  168. },
  169. param: {
  170. shi_fou_guo_shen_: '编制中'
  171. }
  172. }]
  173. }
  174. console.log(params)
  175. await this.$common.request('update', params)
  176. // 发消息给评估人退回消息
  177. await this.$common.sendMsg({
  178. subject: '风险评估与措施表单退回提醒',
  179. content: `您有一份评估与措施表单已退回,请前往-风险控制-风险评估与措施页面重新提交,计划编号:${this.params.ji_hua_bian_hao_},组长:${this.params.zu_chang_}。`,
  180. receiverId: row.bian_zhi_ren_,
  181. canreplay: '0',
  182. skipTypeMsg: JSON.stringify({
  183. skipType: 3,
  184. pathInfo: '/tygl/fxkzV2/fxpgycslb' // 路由
  185. })
  186. })
  187. console.log('退回提醒成功')
  188. console.log('退回成功')
  189. this.$message({
  190. type: 'success',
  191. message: '退回成功!'
  192. })
  193. this.$emit('goBack')
  194. }).catch(() => {
  195. })
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. </style>