timeline.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div class="contrl-bar">
  3. <el-timeline style="max-width: 600px">
  4. <el-timeline-item :timestamp="p.state?'已完成':'未完成'" placement="top" :color="p.state?'#ff6154':'#dae1eb'"
  5. v-for="(p , index) in processes">
  6. <el-card shadow="never" @click="goto(p.router)" class="timeline-card report-item">
  7. <h4>{{ p.name }}</h4>
  8. <p v-if="p.state" >更新时间:{{ p.updateDate }}</p>
  9. <el-button type="text" v-if="p.state" @click="openPageoffice(p.docUrl)">文档预览</el-button>
  10. </el-card>
  11. </el-timeline-item>
  12. <el-timeline-item :timestamp="finalDoc.docUrl?'已完成':'未完成'" v-if="lastNode" placement="top">
  13. <el-card shadow="never" class="timeline-card report-item">
  14. <h4>合并文档</h4>
  15. <p v-if="finalDoc.docUrl" >更新时间:{{ finalDoc.updateTime}}</p>
  16. <el-button type="text" @click="mergeDoc()">合并</el-button>
  17. <el-button type="text" v-if="finalDoc.docUrl">下载完整报告</el-button>
  18. </el-card>
  19. </el-timeline-item>
  20. </el-timeline>
  21. </div>
  22. </template>
  23. <script>
  24. import houseGuaranty from '@/api/houseGuaranty';
  25. import { POBrowser } from 'js-pageoffice'
  26. export default {
  27. props: {
  28. processParentId:{
  29. type:Number,
  30. required:false,
  31. },
  32. documentId:{
  33. type:Number,
  34. required:false,
  35. },
  36. businessId:{
  37. type:Number,
  38. required:false,
  39. },
  40. },
  41. watch:{
  42. processParentId:{
  43. handler(nv){
  44. this.getProcesses();
  45. }
  46. },
  47. documentId:{
  48. handler(nv){
  49. this.getFinalyDoc();
  50. }
  51. }
  52. },
  53. created(){
  54. this.getProcesses();
  55. },
  56. data() {
  57. return {
  58. processes:[],
  59. lastNode:false,
  60. finalDoc:{
  61. url:null,
  62. created:null
  63. }
  64. }
  65. },
  66. methods:{
  67. goto(path) {
  68. if (this.documentId){
  69. this.$router.push(`/home/houseWorkbench/${path}?id=${this.documentId}&businessId=${this.businessId}`)
  70. }
  71. },
  72. getProcesses(){
  73. houseGuaranty.getProcesses(this.processParentId).then(res=>{
  74. if (res.code === 200){
  75. this.processes = res.data;
  76. let nodes = this.processes.filter(item=>item.state==null);
  77. this.lastNode = !nodes.length>0;
  78. }
  79. })
  80. },
  81. openPageoffice(fileUrl) {
  82. let paramJson={};
  83. paramJson.fileName="";
  84. paramJson.fileUrl=fileUrl;
  85. let paramString=JSON.stringify(paramJson);
  86. POBrowser.openWindow('/prod/showDoc', 'width=1150px;height=900px;',paramString);
  87. },
  88. mergeDoc(){
  89. const loading = this.$loading();
  90. houseGuaranty.mergeDoc(this.processParentId).then(res=>{
  91. if (res.code === 200){
  92. ElMessage({
  93. message: '文档已合并',
  94. type: 'success',
  95. plain: true
  96. })
  97. loading.close();
  98. }
  99. })
  100. },
  101. getFinalyDoc(){
  102. if (this.documentId){
  103. houseGuaranty.getFinalyDoc(this.documentId).then(res=>{
  104. if (res.code === 200){
  105. this.finalDoc = res.data;
  106. }
  107. })
  108. }
  109. }
  110. }
  111. }
  112. </script>
  113. <style scoped>
  114. .contrl-bar{
  115. height: 600px;
  116. width: 20%;
  117. position:fixed;
  118. top:160px;
  119. right: 150px;
  120. }
  121. .timeline-card:hover{
  122. cursor: pointer;
  123. }
  124. :deep(.el-button--text:hover){
  125. color:#ff6154;
  126. }
  127. :deep(.el-button--text){
  128. color:#ff6154;
  129. }
  130. </style>