tapprove-his.vue 11 KB

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