Review.vue 8.2 KB

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