tapprove-his.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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/sems/approve";
  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/spec-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("spec_dev_type").then(response => {
  146. this.devTypeOptions = response.data;
  147. });
  148. this.getDicts("spec_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. this.queryParams.devId = row.id
  160. this.queryParams.devType = row.devType
  161. listHisApprove(this.queryParams).then(response => {
  162. this.approveList = response.data;
  163. this.total = response.total;
  164. this.loading = false;
  165. });
  166. },
  167. /** 查询特种设备申请列表 */
  168. getList() {
  169. },
  170. /** 查询部门下拉树结构 */
  171. getTreeselect() {
  172. treeselect().then(response => {
  173. this.deptOptions = response.data;
  174. });
  175. },
  176. // 设备类型:字典翻译
  177. devTypeFormat(row, column) {
  178. return this.selectDictLabel(this.devTypeOptions, row.devType);
  179. },
  180. // 审批类型字典翻译
  181. approveTypeFormat(row, column) {
  182. return this.selectDictLabel(this.approveTypeOptions, row.approveType);
  183. },
  184. // 审批类型字典翻译
  185. statusFormat(row, column) {
  186. return this.selectDictLabel(this.statusOptions, row.status);
  187. },
  188. // 取消按钮
  189. cancel() {
  190. this.open = false;
  191. this.reset();
  192. },
  193. // 表单重置
  194. reset() {
  195. this.form = {
  196. id: null,
  197. userId: null,
  198. devId: null,
  199. devType: null,
  200. approveType: null,
  201. content: null,
  202. fileUrls: null,
  203. reUrls: null,
  204. status: 0,
  205. creattime: null,
  206. endtime: null,
  207. processId: null,
  208. govDate: null,
  209. delayDate: null,
  210. delayReason: null,
  211. delayMeasure: null,
  212. delayNotice: null,
  213. apNo: null,
  214. checkDate: null,
  215. reportId: null,
  216. monthId: null,
  217. delFlag: null,
  218. deptId: null
  219. };
  220. this.resetForm("form");
  221. },
  222. /** 搜索按钮操作 */
  223. handleQuery() {
  224. this.queryParams.pageNum = 1;
  225. this.getList();
  226. },
  227. /** 重置按钮操作 */
  228. resetQuery() {
  229. this.resetForm("queryForm");
  230. this.handleQuery();
  231. },
  232. // 多选框选中数据
  233. handleSelectionChange(selection) {
  234. this.ids = selection.map(item => item.id)
  235. this.single = selection.length!==1
  236. this.multiple = !selection.length
  237. },
  238. /** 新增按钮操作 */
  239. handleAdd() {
  240. this.reset();
  241. this.open = true;
  242. this.title = this.$t('添加特种设备申请');
  243. },
  244. /** 修改按钮操作 */
  245. handleUpdate(row) {
  246. this.reset();
  247. const id = row.id || this.ids
  248. getApprove(id).then(response => {
  249. this.form = response.data;
  250. this.open = true;
  251. this.title =this.$t('修改特种设备申请');
  252. });
  253. },
  254. /** 提交按钮 */
  255. submitForm() {
  256. this.$refs["form"].validate(valid => {
  257. if (valid) {
  258. if (this.form.id != null) {
  259. updateApprove(this.form).then(response => {
  260. this.msgSuccess(this.$t('修改成功'));
  261. this.open = false;
  262. this.getList();
  263. });
  264. } else {
  265. addApprove(this.form).then(response => {
  266. this.msgSuccess(this.$t('新增成功'));
  267. this.open = false;
  268. this.getList();
  269. });
  270. }
  271. }
  272. });
  273. },
  274. /** 删除按钮操作 */
  275. handleDelete(row) {
  276. const ids = row.id || this.ids;
  277. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  278. confirmButtonText: this.$t('确定'),
  279. cancelButtonText: this.$t('取消'),
  280. type: "warning"
  281. }).then(function() {
  282. return delApprove(ids);
  283. }).then(() => {
  284. this.getList();
  285. this.msgSuccess(this.$t('删除成功'));
  286. })
  287. },
  288. /** 导出按钮操作 */
  289. handleExport() {
  290. const queryParams = this.queryParams;
  291. this.$confirm(this.$t('是否确认导出所有特种设备申请数据项?'), this.$t('警告'), {
  292. confirmButtonText: this.$t('确定'),
  293. cancelButtonText: this.$t('取消'),
  294. type: "warning"
  295. }).then(function() {
  296. return exportApprove(queryParams);
  297. }).then(response => {
  298. this.download(response.msg);
  299. })
  300. },
  301. /** 导入按钮操作 */
  302. handleImport() {
  303. this.upload.title = this.$t('用户导入');
  304. this.upload.open = true;
  305. },
  306. /** 下载模板操作 */
  307. importTemplate() {
  308. importTemplate().then(response => {
  309. this.download(response.msg);
  310. });
  311. },
  312. // 文件上传中处理
  313. handleFileUploadProgress(event, file, fileList) {
  314. this.upload.isUploading = true;
  315. },
  316. // 文件上传成功处理
  317. handleFileSuccess(response, file, fileList) {
  318. this.upload.open = false;
  319. this.upload.isUploading = false;
  320. this.$refs.upload.clearFiles();
  321. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  322. this.getList();
  323. },
  324. // 提交上传文件
  325. submitFileForm() {
  326. this.$refs.upload.submit();
  327. },
  328. //操作审批流程
  329. detailHandle (row) {
  330. this.specDealVisible = true
  331. this.$nextTick(() => {
  332. console.log(row.taskName)
  333. this.$refs.specDeal.init(row.id, row.taskId, row.processId,row.taskName)
  334. })
  335. },
  336. }
  337. };
  338. </script>