Accept.vue 6.7 KB

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