index.vue 17 KB

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