Accept.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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" />
  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 VueScroll from 'vuescroll'
  40. import { getDangerById, handleDanger } from '@/api/goaf/dangerApi'
  41. import { WorkFlow, ActivityHandleRecord } from '@/components'
  42. import DangerInfo from '../components/DangerInfo'
  43. export default {
  44. name: 'AcceptTask',
  45. components: { VueScroll, DangerInfo, WorkFlow, ActivityHandleRecord },
  46. props: {
  47. title: {
  48. type: [String],
  49. default: '隐患验收'
  50. }
  51. },
  52. data() {
  53. return {
  54. ops: {
  55. bar: {
  56. keepShow: false,
  57. background: 'rgba(144, 147, 153, 0.4)',
  58. onlyShowBarOnScroll: false
  59. }
  60. },
  61. dialogVisible: false,
  62. tabType: 'form',
  63. viewData: {
  64. groupId: undefined,
  65. groupName: '',
  66. dangerId: undefined,
  67. dangerSource: undefined,
  68. dangerCode: '',
  69. dangerTitle: '',
  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: 'accept',
  114. dangerId: undefined,
  115. acceptRemark: '',
  116. status: 0,
  117. attachList: []
  118. },
  119. rules: { }
  120. }
  121. },
  122. methods: {
  123. previewList(photos) {
  124. if (!photos) return null
  125. if (Array.isArray(photos)) {
  126. return photos
  127. }
  128. return [photos.fileUrl]
  129. },
  130. // 显示窗口
  131. showModel(dangerId, info) {
  132. this.resetFormData()
  133. this.dialogVisible = true
  134. getDangerById(dangerId).then((resp) => {
  135. const { code, data, msg } = resp
  136. if (code === 0) {
  137. this.viewData = info || data
  138. this.$refs.WFlow.get(dangerId)
  139. this.$refs.ActivityHandleRecord.getData(dangerId)
  140. } else {
  141. this.$message.error(msg)
  142. }
  143. }).catch((error) => {
  144. console.log(error)
  145. })
  146. },
  147. resetFormData() {
  148. this.formData = {
  149. formCode: 'accept',
  150. dangerId: undefined,
  151. status: 0,
  152. attachList: []
  153. }
  154. },
  155. // 保存
  156. submitForm(formName) {
  157. this.$nextTick(() => {
  158. this.$refs.WFlow.handle({}).then((res) => {
  159. if (res === false) {
  160. this.$message.error('请检查填写信息')
  161. return false
  162. }
  163. this.handleCommand(res)
  164. }).catch((error) => {
  165. console.log(error)
  166. })
  167. })
  168. },
  169. // 处理
  170. handleCommand(flow) {
  171. this.formData.dangerId = this.viewData.dangerId
  172. this.formData.status = flow.status
  173. this.formData.acceptRemark = flow.data.actionRemark
  174. this.formData.attachList = flow.data.attachList
  175. handleDanger(this.formData).then((resp) => {
  176. const { code, msg } = resp
  177. if (code === 0) {
  178. this.dialogVisible = false
  179. this.$message.success(msg)
  180. this.formSuccess()
  181. } else {
  182. this.$message.error(msg)
  183. }
  184. }).catch((error) => {
  185. console.log(error)
  186. })
  187. },
  188. formSuccess() {
  189. this.$emit('formSuccess')
  190. },
  191. resetFormField(formName) {
  192. this.$refs[formName].resetFields()
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss">
  198. </style>
  199. <style lang="scss" scoped>
  200. .hd-info-component {
  201. margin: 15px;
  202. position: relative;
  203. height: calc(100% - 15px);
  204. .btn-group {
  205. position: absolute;
  206. bottom: 0;
  207. left: 0;
  208. width: 100%;
  209. .el-button {
  210. width: 100%;
  211. margin: 0 0 15px;
  212. }
  213. .cancel-btn {
  214. background: #004F7B;
  215. border-color: #004F7B;
  216. color: #FFF;
  217. &:hover {
  218. background: #026197;
  219. border-color: #026197;
  220. }
  221. }
  222. }
  223. .el-row {
  224. margin-bottom: 20px;
  225. margin-top: 20px;
  226. text-align: center;
  227. &:last-child {
  228. margin-bottom: 0;
  229. }
  230. .el-button {
  231. width: 10%;
  232. }
  233. }
  234. }
  235. </style>