index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template >
  2. <div class="app-container">
  3. <el-table v-loading="loading" :data="approvedangerList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  4. <el-table-column type="selection" width="55" align="center" />
  5. <el-table-column :label="$t('流程')+' '+ $t('ID')" align="center" prop="processId" :show-overflow-tooltip="true"/>
  6. <el-table-column :label="$t('流程')+' ' + $t('名称')" align="center" prop="processName" :show-overflow-tooltip="true"/>
  7. <el-table-column :label="$t('流程')+' ' + $t('创建时间')" align="center" prop="processCreateTime" :show-overflow-tooltip="true"/>
  8. <el-table-column :label="$t('待办任务')+' ' + $t('名称')" align="center" prop="taskName" :show-overflow-tooltip="true"/>
  9. <el-table-column :label="$t('待办任务')+' ' + $t('创建时间')" align="center" prop="taskCreateTime" :show-overflow-tooltip="true"/>
  10. <el-table-column :label="$t('申请编号')" align="center" prop="apNo" :show-overflow-tooltip="true">
  11. <!-- <template slot-scope="scope">-->
  12. <!-- <span v-if="scope.row.processName === ($t('事件') + $t('审批流程')) ">{{scope.row.tApproveAccident.approveNo}}</span>-->
  13. <!-- <span v-if="scope.row.processName === ($t('重大隐患') + $t('审批流程') )|| scope.row.processName === ($t('普通隐患') + $t('审批流程') )">{{scope.row.tApprove.approveNo}}</span>-->
  14. <!-- </template>-->
  15. </el-table-column>
  16. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  17. <template slot-scope="scope">
  18. <el-button
  19. size="mini"
  20. type="text"
  21. icon="el-icon-edit"
  22. @click="addOrUpdateHandle(scope.row)"
  23. >{{ $t('处理') }}</el-button>
  24. <el-button
  25. size="mini"
  26. type="text"
  27. @click="processImg(scope.row.processId)"
  28. >{{ $t('流程图') }}</el-button>
  29. </template>
  30. </el-table-column>
  31. </el-table>
  32. <pagination
  33. v-show="total>0"
  34. :total="total"
  35. :page.sync="queryParams.pageNum"
  36. :limit.sync="queryParams.pageSize"
  37. @pagination="getList"
  38. />
  39. <!-- 弹窗, 新增 / 修改 -->
  40. <div v-if="addOrUpdateVisible">
  41. <el-dialog v-dialogDrag :visible.sync="addOrUpdateVisible" :destroy-on-close="true">
  42. <add-or-update v-if="this.infoprocessName === ($t('重大隐患')+' '+ $t('审批流程') )|| this.infoprocessName === ($t('普通隐患')+' ' + $t('审批流程') )" :info="approveInfo"></add-or-update>
  43. <accident v-if="this.infoprocessName === ($t('事件')+ $t('审批流程'))" :info="approveInfo" @recordInfo="approveChange($event)"></accident>
  44. <el-form>
  45. <el-form-item :label="$t('上传措施前照片')" prop="before" v-if="this.infoTaskName === '执行人'">
  46. <el-upload
  47. ref="uploadbefore"
  48. :limit="1"
  49. :headers="uploadbefore.headers"
  50. :action="uploadbefore.url"
  51. :disabled="uploadbefore.isUploading"
  52. :on-progress="handleFileUploadProgressBefore"
  53. :on-success="handleFileSuccessBefore"
  54. :auto-upload="true"
  55. drag
  56. >
  57. <i class="el-icon-upload"></i>
  58. <div class="el-upload__text">
  59. {{ $t('将文件拖到此处,或') }}
  60. <em>{{ $t('点击上传') }}</em>
  61. </div>
  62. </el-upload>
  63. </el-form-item>
  64. <el-form-item :label="$t('上传措施后照片')" prop="after" v-if="this.infoTaskName === $t('执行人')">
  65. <el-upload
  66. ref="uploadafter"
  67. :limit="1"
  68. :headers="uploadafter.headers"
  69. :action="uploadafter.url"
  70. :disabled="uploadafter.isUploading"
  71. :on-progress="handleFileUploadProgressAfter"
  72. :on-success="handleFileSuccessAfter"
  73. drag
  74. >
  75. <i class="el-icon-upload"></i>
  76. <div class="el-upload__text">
  77. {{ $t('将文件拖到此处,或') }}
  78. <em>{{ $t('点击上传') }}</em>
  79. </div>
  80. </el-upload>
  81. </el-form-item>
  82. <el-form-item :label="$t('审批意见')" prop="comment">
  83. <el-input v-model="comment" :placeholder="$t('请输入') + $t('审批意见')" maxlength="100" show-word-limit></el-input>
  84. </el-form-item>
  85. </el-form>
  86. <span v-if="this.infoprocessName === ($t('重大隐患')+' ' + $t('审批流程') ) || this.infoprocessName === ($t('普通隐患')+' ' + $t('审批流程') )" slot="footer">
  87. <span v-if="this.infoTaskName === $t('执行人')" class="dialog-footer">
  88. <el-button type="primary" @click="dataFormSubmit(1)">{{ $t('已完成') }}</el-button>
  89. <el-button type="danger" @click="dataFormSubmit(0)">{{ $t('无法执行') }}</el-button>
  90. </span>
  91. <span v-if="this.infoTaskName === $t('验证人')" class="dialog-footer">
  92. <el-button type="primary" @click="dataFormSubmit(1)">{{ $t('通过') }}</el-button>
  93. <el-button type="danger" @click="dataFormSubmit(0)">{{ $t('无效') }}</el-button>
  94. <el-button type="warning" @click="dataFormSubmit(2)">{{ $t('未达标') }}</el-button>
  95. </span>
  96. <span v-if="this.infoTaskName === $t('记录人')" class="dialog-footer">
  97. <el-button type="primary" @click="dataFormSubmit(1)">{{ $t('重新提交') }}</el-button>
  98. </span>
  99. <span v-if="this.infoTaskName === $t('确认')" class="dialog-footer">
  100. <el-button type="primary" @click="dataFormSubmit(1)">{{ $t('确认') }}</el-button>
  101. <el-button type="danger" @click="dataFormSubmit(0)">{{ $t('确认')+' ' + $t('不通过') }}</el-button>
  102. </span>
  103. </span>
  104. <span v-if="this.infoprocessName === ($t('事件') + $t('审批流程'))" slot="footer">
  105. <span v-if="this.infoTaskName === $t('记录人')" class="dialog-footer">
  106. <el-button type="primary" @click="dataFormSubmit(1)">{{ $t('提交') }}</el-button>
  107. </span>
  108. </span>
  109. </el-dialog>
  110. </div>
  111. <add-or-update v-if="specDealVisible" ref="specDeal" @refreshDataList="getList"></add-or-update>
  112. <spec-modify v-if="specModifyDealVisible" ref="specModifyDeal" @refreshDataList="getList"></spec-modify>
  113. <process-img v-if="processImgVisible" ref="processImg" @refreshDataList="getList"></process-img>
  114. </div>
  115. </template>
  116. <script>
  117. import {getPendinglist, handleApprovedanger} from "@/api/ehs/approvedanger";
  118. import AddOrUpdate from './spec-detail';
  119. import SpecModify from './specModify-deal';
  120. import Accident from '../approveaccidentDetail/index';
  121. import ProcessImg from '../processImg/index';
  122. import {treeselect} from "@/api/system/dept";
  123. import {getToken} from "@/utils/auth";
  124. import Treeselect from "@riophae/vue-treeselect";
  125. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  126. export default {
  127. name: "Pending",
  128. components: {
  129. Treeselect,
  130. AddOrUpdate,
  131. SpecModify,
  132. Accident,
  133. ProcessImg
  134. },
  135. data() {
  136. return {
  137. // 遮罩层
  138. loading: true,
  139. //弹窗界面是否开启
  140. addOrUpdateVisible: false,
  141. processImgVisible: false,
  142. specDealVisible: false,
  143. specModifyDealVisible: false,
  144. // 选中数组
  145. ids: [],
  146. // 非单个禁用
  147. single: true,
  148. // 非多个禁用
  149. multiple: true,
  150. // 显示搜索条件
  151. showSearch: false,
  152. // 总条数
  153. total: 0,
  154. // 我的申请表格数据
  155. approvedangerList: [],
  156. // 弹出层标题
  157. title: "",
  158. // 部门树选项
  159. deptOptions: undefined,
  160. clientHeight:300,
  161. // 是否显示弹出层
  162. open: false,
  163. // 装置名称字典
  164. plantCodeOptions: [],
  165. // 查询参数
  166. queryParams: {
  167. pageNum: 1,
  168. pageSize: 20,
  169. plantCode: null,
  170. recorderId: null,
  171. hiddendangerLevel: null,
  172. hiddendangerContent: null,
  173. measures: null,
  174. completeTime: null,
  175. status: null,
  176. creattime: null,
  177. endtime: null,
  178. processId: null,
  179. approveNo: null,
  180. deptId: null,
  181. },
  182. // 措施前上传照片参数
  183. uploadbefore: {
  184. file: "",
  185. // 是否禁用上传
  186. isUploading: false,
  187. // 是否更新已经存在的用户数据
  188. updateSupport: 0,
  189. // 设置上传的请求头部
  190. headers: { Authorization: "Bearer " + getToken() },
  191. // 上传的地址
  192. url: process.env.VUE_APP_BASE_API + "/common/upload",
  193. // 报告附件上传位置编号
  194. ids: 0,
  195. commonfileList: null,
  196. },
  197. // 措施后上传照片参数
  198. uploadafter: {
  199. file: "",
  200. // 是否禁用上传
  201. isUploading: false,
  202. // 是否更新已经存在的用户数据
  203. updateSupport: 0,
  204. // 设置上传的请求头部
  205. headers: { Authorization: "Bearer " + getToken() },
  206. // 上传的地址
  207. url: process.env.VUE_APP_BASE_API + "/common/upload",
  208. // 报告附件上传位置编号
  209. ids: 0,
  210. commonfileList: null,
  211. },
  212. // 表单参数
  213. form: {},
  214. //事件记录人更新内容
  215. recordInfo: {},
  216. //处理数据传输
  217. approveInfo: null,
  218. //审批显示按键判断依据
  219. infoprocessName: null,
  220. infoTaskName: null,
  221. //上传措施前后照片url,文件名称
  222. beforeUrl: null,
  223. beforeFilename: null,
  224. afterUrl: null,
  225. afterFilename: null,
  226. //审批备注
  227. comment: null
  228. };
  229. },
  230. watch: {
  231. // 根据名称筛选部门树
  232. deptName(val) {
  233. this.$refs.tree.filter(val);
  234. }
  235. },
  236. created() {
  237. //设置表格高度对应屏幕高度
  238. this.$nextTick(() => {
  239. this.clientHeight = document.body.clientHeight -250
  240. })
  241. this.getList();
  242. this.getTreeselect();
  243. this.getDicts("PLANT_DIVIDE").then(response => {
  244. this.plantCodeOptions = response.data;
  245. });
  246. },
  247. methods: {
  248. /** 查询隐患申请列表 */
  249. getList() {
  250. this.loading = true;
  251. getPendinglist(this.queryParams).then(response => {
  252. this.approvedangerList = response.rows;
  253. this.total = response.total;
  254. this.loading = false;
  255. });
  256. },
  257. /** 查询部门下拉树结构 */
  258. getTreeselect() {
  259. treeselect().then(response => {
  260. this.deptOptions = response.data;
  261. });
  262. },
  263. // 装置名称字典翻译
  264. plantCodeFormat(row, column) {
  265. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  266. },
  267. // 取消按钮
  268. cancel() {
  269. this.addOrUpdateVisible = false;
  270. this.reset();
  271. },
  272. /** 事件子组件传值 */
  273. approveChange(value) {
  274. this.recordInfo = value
  275. },
  276. // 表单重置
  277. reset() {
  278. this.form = {
  279. id: null,
  280. plantCode: null,
  281. recorderId: null,
  282. hiddendangerLevel: null,
  283. hiddendangerContent: null,
  284. measures: null,
  285. completeTime: null,
  286. status: 0,
  287. creattime: null,
  288. endtime: null,
  289. processId: null,
  290. approveNo: null,
  291. deptId: null,
  292. delFlag: null,
  293. submitType: null,
  294. commont: null,
  295. accidentLevel: null,
  296. executorId: null
  297. };
  298. this.resetForm("form");
  299. },
  300. //操作审批流程
  301. addOrUpdateHandle (row) {
  302. if (row.processName == "特种设备审核"){
  303. this.specDealVisible = true
  304. this.$nextTick(() => {
  305. console.log(row.taskName)
  306. this.$refs.specDeal.init(row.specApprove.id, row.taskId, row.processId,row.taskName)
  307. })
  308. }else if (row.processName == "年度检查报告申请"){
  309. this.specDealVisible = true
  310. this.$nextTick(() => {
  311. console.log(row.taskName)
  312. this.$refs.specDeal.init(row.specApprove.id, row.taskId, row.processId,row.taskName)
  313. })
  314. }else if (row.processName == "月度检查"){
  315. this.specDealVisible = true
  316. this.$nextTick(() => {
  317. console.log(row.taskName)
  318. this.$refs.specDeal.init(row.specApprove.id, row.taskId, row.processId,row.taskName)
  319. })
  320. }else if (row.processName == "设备修改/删除审核"){
  321. this.specModifyDealVisible = true
  322. this.$nextTick(() => {
  323. console.log(row.taskName)
  324. this.$refs.specModifyDeal.init(row.approveSpecModify.id, row.taskId, row.processId,row.taskName)
  325. })
  326. }else {
  327. this.approveInfo = row;
  328. this.infoTaskName = row.taskName;
  329. this.infoprocessName = row.processName;
  330. this.addOrUpdateVisible = true;
  331. }
  332. },
  333. // 多选框选中数据
  334. handleSelectionChange(selection) {
  335. this.ids = selection.map(item => item.id)
  336. this.single = selection.length!==1
  337. this.multiple = !selection.length
  338. },
  339. // 表单提交
  340. dataFormSubmit (val) {
  341. //相关信息
  342. this.form = this.approveInfo
  343. this.form.submitType = val
  344. this.form.comment = this.comment
  345. // 审批确认后,申请人填写相关信息
  346. if (this.form.processName === (this.$t('事件') + this.$t('审批流程'))) {
  347. this.form.accidentLevel = this.recordInfo.accidentLevel;
  348. this.form.measures = this.recordInfo.measures;
  349. this.form.executorId = this.recordInfo.executorId;
  350. this.form.completeTime = this.recordInfo.completeTime;
  351. console.info("accidentLevel:" + this.form.accidentLevel)
  352. console.info("measures:" + this.form.measures)
  353. console.info("executorId:" + this.form.executorId)
  354. console.info("completeTime:" + this.form.completeTime)
  355. }
  356. //提交审批
  357. this.form.beforeUrl = this.beforeUrl
  358. this.form.beforeFilename = this.beforeFilename
  359. this.form.afterUrl = this.afterUrl
  360. this.form.afterFilename = this.afterFilename
  361. handleApprovedanger(this.form).then(response => {
  362. this.msgSuccess(this.$t('处理成功'));
  363. this.addOrUpdateVisible = false;
  364. this.getList();
  365. });
  366. this.$nextTick(function () {
  367. this.comment = ''
  368. })
  369. },
  370. // 文件上传中处理
  371. handleFileUploadProgressBefore(event, file, fileList) {
  372. this.uploadbefore.isUploading = true;
  373. },
  374. handleFileUploadProgressAfter(event, file, fileList) {
  375. this.uploadafter.isUploading = true;
  376. },
  377. // 文件上传成功处理
  378. handleFileSuccessBefore(response, file, fileList) {
  379. this.uploadbefore.isUploading = false;
  380. //this.$refs.uploadbefore.clearFiles();
  381. this.beforeUrl = response.url;
  382. this.beforeFilename = response.fileName;
  383. },
  384. handleFileSuccessAfter(response, file, fileList) {
  385. this.uploadafter.isUploading = false;
  386. //this.$refs.uploadafter.clearFiles();
  387. this.afterUrl = response.url;
  388. this.afterFilename = response.fileName;
  389. },
  390. // 提交上传文件
  391. submitFileForm() {
  392. this.$refs.uploadbefore.submit()
  393. this.$refs.uploadafter.submit()
  394. },
  395. processImg (processId) {
  396. this.processImgVisible = true
  397. this.$nextTick(() => {
  398. this.$refs.processImg.init(processId)
  399. })
  400. },
  401. }
  402. };
  403. </script>