tapprove-his.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <el-dialog :title="$t('申请记录')" :visible.sync="visible" width="1200px" append-to-body>
  3. <el-table v-loading="loading" :data="approveList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  4. <el-table-column :label="$t('申请人')" align="center" prop="userName" :show-overflow-tooltip="true"/>
  5. <el-table-column :label="$t('审批类型')" align="center" prop="approveType" :formatter="approveTypeFormat" />
  6. <el-table-column :label="$t('内容')" align="center" prop="content" :show-overflow-tooltip="true"/>
  7. <el-table-column :label="$t('申请状态')" align="center" prop="status" :formatter="statusFormat"/>
  8. <el-table-column :label="$t('开始时间')" align="center" prop="creattime" width="100">
  9. <template slot-scope="scope">
  10. <span>{{ parseTime(scope.row.creattime, '{y}-{m}-{d}') }}</span>
  11. </template>
  12. </el-table-column>
  13. <el-table-column :label="$t('结束时间')" align="center" prop="endtime" width="100">
  14. <template slot-scope="scope">
  15. <span>{{ parseTime(scope.row.endtime, '{y}-{m}-{d}') }}</span>
  16. </template>
  17. </el-table-column>
  18. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  19. <template slot-scope="scope">
  20. <el-button
  21. size="mini"
  22. type="text"
  23. @click="detailHandle(scope.row)"
  24. >{{ $t('查看') }}</el-button>
  25. </template>
  26. </el-table-column>
  27. </el-table>
  28. <!-- <pagination-->
  29. <!-- v-show="total>0"-->
  30. <!-- :total="total"-->
  31. <!-- :page.sync="queryParams.pageNum"-->
  32. <!-- :limit.sync="queryParams.pageSize"-->
  33. <!-- @pagination="getList"-->
  34. <!-- />-->
  35. <add-or-update v-if="specDealVisible" ref="specDeal" @refreshDataList="getList"></add-or-update>
  36. </el-dialog>
  37. </template>
  38. <script>
  39. import { listApprove, getApprove,listHisApprove, delApprove, addApprove, updateApprove, exportApprove, importTemplate} from "@/api/reliability/approve";
  40. import { treeselect } from "@/api/system/dept";
  41. import { getToken } from "@/utils/auth";
  42. import Treeselect from "@riophae/vue-treeselect";
  43. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  44. import AddOrUpdate from '../../approve/approveDetail/kekao-detail';
  45. import Editor from '@/components/Editor';
  46. export default {
  47. name: "Approve",
  48. components: { Treeselect,AddOrUpdate },
  49. // components: { Editor },
  50. data() {
  51. return {
  52. // 遮罩层
  53. loading: true,
  54. visible: false,
  55. specDealVisible: false,
  56. // 选中数组
  57. ids: [],
  58. // 非单个禁用
  59. single: true,
  60. // 非多个禁用
  61. multiple: true,
  62. // 显示搜索条件
  63. showSearch: false,
  64. // 总条数
  65. total: 0,
  66. // 特种设备申请表格数据
  67. approveList: [],
  68. // 弹出层标题
  69. title: "",
  70. // 部门树选项
  71. deptOptions: undefined,
  72. clientHeight:300,
  73. // 是否显示弹出层
  74. open: false,
  75. // 设备类型:字典
  76. devTypeOptions: [],
  77. // 审批类型字典
  78. approveTypeOptions: [],
  79. statusOptions: [],
  80. // 用户导入参数
  81. upload: {
  82. // 是否显示弹出层(用户导入)
  83. open: false,
  84. // 弹出层标题(用户导入)
  85. title: "",
  86. // 是否禁用上传
  87. isUploading: false,
  88. // 是否更新已经存在的用户数据
  89. updateSupport: 0,
  90. // 设置上传的请求头部
  91. headers: { Authorization: "Bearer " + getToken() },
  92. // 上传的地址
  93. url: process.env.VUE_APP_BASE_API + "/sems/approve/importData"
  94. },
  95. // 查询参数
  96. queryParams: {
  97. pageNum: 1,
  98. pageSize: 20,
  99. userId: null,
  100. devId: null,
  101. devType: null,
  102. approveType: null,
  103. content: null,
  104. fileUrls: null,
  105. reUrls: null,
  106. status: null,
  107. creattime: null,
  108. endtime: null,
  109. processId: null,
  110. govDate: null,
  111. delayDate: null,
  112. delayReason: null,
  113. delayMeasure: null,
  114. delayNotice: null,
  115. apNo: null,
  116. checkDate: null,
  117. reportId: null,
  118. monthId: null,
  119. deptId: null
  120. },
  121. // 表单参数
  122. form: {},
  123. // 表单校验
  124. rules: {
  125. userId: [
  126. { required: true, message: this.$t('申请人')+this.$t('空格') +'id' + this.$t('不能为空'), trigger: "blur" }
  127. ],
  128. }
  129. };
  130. },
  131. watch: {
  132. // 根据名称筛选部门树
  133. deptName(val) {
  134. this.$refs.tree.filter(val);
  135. }
  136. },
  137. created() {
  138. //设置表格高度对应屏幕高度
  139. this.$nextTick(() => {
  140. this.clientHeight = document.body.clientHeight -250
  141. })
  142. this.getList();
  143. this.getTreeselect();
  144. this.getDicts("INTACT_DEVTYPE").then(response => {
  145. this.devTypeOptions = response.data;
  146. });
  147. this.getDicts("INTACT_APPROVE_TYPE").then(response => {
  148. this.approveTypeOptions = response.data;
  149. });
  150. this.getDicts("spec_approve_res").then(response => {
  151. this.statusOptions = response.data;
  152. });
  153. },
  154. methods: {
  155. init (row) {
  156. this.visible = true
  157. this.loading = true;
  158. // console.log(row.devType)
  159. this.queryParams.devId = row.id
  160. listHisApprove(this.queryParams).then(response => {
  161. this.approveList = response.data;
  162. this.total = response.total;
  163. this.loading = false;
  164. });
  165. },
  166. /** 查询特种设备申请列表 */
  167. getList() {
  168. },
  169. /** 查询部门下拉树结构 */
  170. getTreeselect() {
  171. treeselect().then(response => {
  172. this.deptOptions = response.data;
  173. });
  174. },
  175. // 设备类型:字典翻译
  176. devTypeFormat(row, column) {
  177. return this.selectDictLabel(this.devTypeOptions, row.devType);
  178. },
  179. // 审批类型字典翻译
  180. approveTypeFormat(row, column) {
  181. return this.selectDictLabel(this.approveTypeOptions, row.approveType);
  182. },
  183. // 审批类型字典翻译
  184. statusFormat(row, column) {
  185. return this.selectDictLabel(this.statusOptions, row.status);
  186. },
  187. // 取消按钮
  188. cancel() {
  189. this.open = false;
  190. this.reset();
  191. },
  192. // 表单重置
  193. reset() {
  194. this.form = {
  195. id: null,
  196. userId: null,
  197. devId: null,
  198. devType: null,
  199. approveType: null,
  200. content: null,
  201. fileUrls: null,
  202. reUrls: null,
  203. status: 0,
  204. creattime: null,
  205. endtime: null,
  206. processId: null,
  207. govDate: null,
  208. delayDate: null,
  209. delayReason: null,
  210. delayMeasure: null,
  211. delayNotice: null,
  212. apNo: null,
  213. checkDate: null,
  214. reportId: null,
  215. monthId: null,
  216. delFlag: null,
  217. deptId: null
  218. };
  219. this.resetForm("form");
  220. },
  221. /** 搜索按钮操作 */
  222. handleQuery() {
  223. this.queryParams.pageNum = 1;
  224. this.getList();
  225. },
  226. /** 重置按钮操作 */
  227. resetQuery() {
  228. this.resetForm("queryForm");
  229. this.handleQuery();
  230. },
  231. // 多选框选中数据
  232. handleSelectionChange(selection) {
  233. this.ids = selection.map(item => item.id)
  234. this.single = selection.length!==1
  235. this.multiple = !selection.length
  236. },
  237. /** 新增按钮操作 */
  238. handleAdd() {
  239. this.reset();
  240. this.open = true;
  241. this.title = this.$t('添加特种设备申请');
  242. },
  243. /** 修改按钮操作 */
  244. handleUpdate(row) {
  245. this.reset();
  246. const id = row.id || this.ids
  247. getApprove(id).then(response => {
  248. this.form = response.data;
  249. this.open = true;
  250. this.title =this.$t('修改特种设备申请');
  251. });
  252. },
  253. /** 提交按钮 */
  254. submitForm() {
  255. this.$refs["form"].validate(valid => {
  256. if (valid) {
  257. if (this.form.id != null) {
  258. updateApprove(this.form).then(response => {
  259. this.msgSuccess(this.$t('修改成功'));
  260. this.open = false;
  261. this.getList();
  262. });
  263. } else {
  264. addApprove(this.form).then(response => {
  265. this.msgSuccess(this.$t('新增成功'));
  266. this.open = false;
  267. this.getList();
  268. });
  269. }
  270. }
  271. });
  272. },
  273. /** 删除按钮操作 */
  274. handleDelete(row) {
  275. const ids = row.id || this.ids;
  276. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  277. confirmButtonText: this.$t('确定'),
  278. cancelButtonText: this.$t('取消'),
  279. type: "warning"
  280. }).then(function() {
  281. return delApprove(ids);
  282. }).then(() => {
  283. this.getList();
  284. this.msgSuccess(this.$t('删除成功'));
  285. })
  286. },
  287. /** 导出按钮操作 */
  288. handleExport() {
  289. const queryParams = this.queryParams;
  290. this.$confirm(this.$t('是否确认导出所有特种设备申请数据项?'), this.$t('警告'), {
  291. confirmButtonText: this.$t('确定'),
  292. cancelButtonText: this.$t('取消'),
  293. type: "warning"
  294. }).then(function() {
  295. return exportApprove(queryParams);
  296. }).then(response => {
  297. this.download(response.msg);
  298. })
  299. },
  300. /** 导入按钮操作 */
  301. handleImport() {
  302. this.upload.title = this.$t('用户导入');
  303. this.upload.open = true;
  304. },
  305. /** 下载模板操作 */
  306. importTemplate() {
  307. importTemplate().then(response => {
  308. this.download(response.msg);
  309. });
  310. },
  311. // 文件上传中处理
  312. handleFileUploadProgress(event, file, fileList) {
  313. this.upload.isUploading = true;
  314. },
  315. // 文件上传成功处理
  316. handleFileSuccess(response, file, fileList) {
  317. this.upload.open = false;
  318. this.upload.isUploading = false;
  319. this.$refs.upload.clearFiles();
  320. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  321. this.getList();
  322. },
  323. // 提交上传文件
  324. submitFileForm() {
  325. this.$refs.upload.submit();
  326. },
  327. //操作审批流程
  328. detailHandle (row) {
  329. this.specDealVisible = true
  330. this.$nextTick(() => {
  331. console.log(row.taskName)
  332. this.$refs.specDeal.init(row.id, row.taskId, row.processId,row.taskName)
  333. })
  334. },
  335. }
  336. };
  337. </script>