Review.vue 8.1 KB

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