Rectify.vue 7.9 KB

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