Review.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <el-drawer
  3. :title="title"
  4. :modal-append-to-body="false"
  5. :modal="false"
  6. :wrapper-closable="false"
  7. size="99%"
  8. :visible.sync="dialogVisible"
  9. >
  10. <template slot="title">
  11. <div class="el-drawer-title">
  12. <span class="name">{{ title }}</span>
  13. <el-tabs v-model="tabType">
  14. <el-tab-pane label="基本信息" name="form" />
  15. <el-tab-pane label="历史记录" name="history" />
  16. </el-tabs>
  17. </div>
  18. </template>
  19. <div class="content-container">
  20. <el-row class="content-body">
  21. <div v-show="tabType==='form'">
  22. <Vuescroll :ops="ops" style="height: calc(100vh - 400px)">
  23. <DangerInfo :view-data="viewData" class="form" />
  24. <work-flow ref="WFlow" handle-user="整改人" />
  25. </Vuescroll>
  26. <div class="btn-group">
  27. <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
  28. <el-button @click="dialogVisible = false">取消</el-button>
  29. </div>
  30. </div>
  31. <div v-show="tabType==='history'">
  32. <ActivityHandleRecord ref="ActivityHandleRecord" />
  33. </div>
  34. </el-row>
  35. </div>
  36. </el-drawer>
  37. </template>
  38. <script>
  39. import { updateDanger, getDangerById } from '@/api/goaf/dangerApi'
  40. import Vuescroll from 'vuescroll'
  41. import { WorkFlow, ActivityHandleRecord } from '@/components'
  42. import DangerInfo from '../components/DangerInfo'
  43. export default {
  44. name: 'ReviewTask',
  45. components: { Vuescroll, DangerInfo, WorkFlow, ActivityHandleRecord },
  46. filters: {},
  47. props: {
  48. title: {
  49. type: [String],
  50. default: ''
  51. }
  52. },
  53. data() {
  54. return {
  55. ops: {
  56. bar: {
  57. keepShow: false,
  58. background: 'rgba(144, 147, 153, 0.4)',
  59. onlyShowBarOnScroll: false
  60. }
  61. },
  62. dialogVisible: false,
  63. tabType: 'form',
  64. rules: { },
  65. viewData: {
  66. hdangerId: undefined,
  67. dangerCode: '',
  68. dangerTitle: '',
  69. dangerSource: undefined,
  70. dangerDesc: '',
  71. dangerLevel: undefined,
  72. dangerCatId: undefined,
  73. dangerCatTitle: '',
  74. riskPointId: undefined,
  75. riskPointTitle: '',
  76. submitGroupId: undefined,
  77. submitGroupName: '',
  78. submitPositionId: undefined,
  79. submitPositionName: '',
  80. submitAccountId: undefined,
  81. submitAccountName: '',
  82. submitTime: '',
  83. dangerDeadLine: '',
  84. reviewGroupId: undefined,
  85. reviewGroupName: '',
  86. reviewPositionId: undefined,
  87. reviewPositionName: '',
  88. reviewAccountId: undefined,
  89. reviewAccountName: '',
  90. reviewTime: '',
  91. rectifyGroupId: undefined,
  92. rectifyGroupName: '',
  93. rectifyPositionId: undefined,
  94. rectifyPositionName: '',
  95. rectifyAccountId: undefined,
  96. rectifyAccountName: '',
  97. dangerReason: '',
  98. rectifyCat: 1,
  99. rectifyMeasure: '',
  100. rectifyRemark: '',
  101. rectifyTime: '',
  102. acceptGroupId: undefined,
  103. acceptGroupName: '',
  104. acceptPositionId: undefined,
  105. acceptPositionName: '',
  106. acceptAccountId: undefined,
  107. acceptAccountName: '',
  108. acceptTime: '',
  109. status: 0,
  110. attachList: []
  111. },
  112. formData: {
  113. formCode: 'review',
  114. hdangerId: undefined,
  115. status: 0,
  116. attachList: []
  117. }
  118. }
  119. },
  120. mounted() {
  121. },
  122. methods: {
  123. previewList(photos) {
  124. if (!photos) return null
  125. if (Array.isArray(photos)) {
  126. const list = photos.map((item) => {
  127. return item.fileUrl
  128. })
  129. return list
  130. }
  131. return [photos.fileUrl]
  132. },
  133. // 显示窗口
  134. showModel(hdangerId, info) {
  135. this.resetFormData()
  136. this.dialogVisible = true
  137. getDangerById(hdangerId).then((resp) => {
  138. const { code, data, msg } = resp
  139. if (code === 0) {
  140. this.viewData = info || data
  141. this.$refs.WFlow.get(hdangerId)
  142. this.$refs.ActivityHandleRecord.getData(hdangerId)
  143. } else {
  144. this.$message.error(msg)
  145. }
  146. }).catch((error) => {
  147. console.log(error)
  148. })
  149. },
  150. // 重置
  151. resetFormData() {
  152. this.formData = {
  153. formCode: 'review',
  154. hdangerId: undefined,
  155. status: 0,
  156. attachList: []
  157. }
  158. },
  159. // 保存
  160. submitForm(formName) {
  161. this.$nextTick(() => {
  162. this.$refs.WFlow.handle({}).then((res) => {
  163. if (res === false) {
  164. this.$message.error('请检查填写信息')
  165. return false
  166. }
  167. this.handleCommand(res)
  168. }).catch((error) => {
  169. console.log(error)
  170. })
  171. })
  172. },
  173. // 处理
  174. handleCommand(flow) {
  175. this.formData.hdangerId = this.viewData.hdangerId
  176. if (flow.curActivityCode === 'review') {
  177. this.formData.status = 1
  178. }
  179. if (flow.curActivityCode === 'rectify') {
  180. this.formData.status = 2
  181. }
  182. if (flow.curActivityCode === 'accept') {
  183. this.formData.status = 3
  184. }
  185. this.formData.reviewRemark = flow.data.actionRemark
  186. this.formData.attachList = flow.data.attachList
  187. this.formData.reviewAccountId = flow.user.accountIdTo
  188. this.formData.reviewAccountName = flow.user.accountNameTo
  189. this.formData.reviewGroupId = flow.user.groupIdTo
  190. this.formData.reviewGroupName = flow.user.groupNameTo
  191. this.formData.reviewPositionId = flow.user.positionIdTo
  192. this.formData.reviewPositionName = flow.user.positionNameTo
  193. updateDanger(this.formData).then((resp) => {
  194. const { code, msg } = resp
  195. if (code === 0) {
  196. this.dialogVisible = false
  197. this.$message.success(msg)
  198. this.$emit('formSuccess')
  199. } else {
  200. this.$message.error(msg)
  201. }
  202. }).catch((error) => {
  203. console.log(error)
  204. })
  205. },
  206. formSuccess() {
  207. this.$emit('formSuccess')
  208. },
  209. resetFormField(formName) {
  210. this.$refs[formName].resetFields()
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="scss">
  216. </style>
  217. <style lang="scss" scoped>
  218. .hd-info-component {
  219. margin: 15px;
  220. position: relative;
  221. height: calc(100% - 15px);
  222. .btn-group {
  223. position: absolute;
  224. bottom: 0;
  225. left: 0;
  226. width: 100%;
  227. .el-button {
  228. width: 100%;
  229. margin: 0 0 15px;
  230. }
  231. .cancel-btn {
  232. background: #004F7B;
  233. border-color: #004F7B;
  234. color: #FFF;
  235. &:hover {
  236. background: #026197;
  237. border-color: #026197;
  238. }
  239. }
  240. }
  241. .el-row {
  242. margin-bottom: 20px;
  243. margin-top: 20px;
  244. text-align: center;
  245. &:last-child {
  246. margin-bottom: 0;
  247. }
  248. .el-button {
  249. width: 10%;
  250. }
  251. }
  252. }
  253. </style>