应用层PC端前端服务

evidenceDialog.vue 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div>
  3. <el-dialog title="修改证据" :visible="evidenceVisable" @close="cancel" center :distroy-on-close="true">
  4. <el-descriptions title="案件内容" :column="2" border>
  5. <el-descriptions-item label="案件编号">{{ evidenceData.caseNum }}</el-descriptions-item>
  6. <el-descriptions-item label="申请人(机构)">{{ evidenceData.applicantName }}</el-descriptions-item>
  7. <el-descriptions-item label="案件标的">{{ evidenceData.caseSubjectAmount }}</el-descriptions-item>
  8. <el-descriptions-item label="案件状态">
  9. <el-tag size="small">{{ evidenceData.caseStatusName }}</el-tag>
  10. </el-descriptions-item>
  11. <el-descriptions-item label="仲裁方式">{{ evidenceData.arbitratMethodName }}</el-descriptions-item>
  12. <el-descriptions-item label="申请人证据">
  13. <div style="color: #104fad;cursor:pointer" v-for="(item, index) in fileListData"
  14. @click="preview(item.annexPath)" :key="index">
  15. {{ item.annexName }}</div>
  16. </el-descriptions-item>
  17. </el-descriptions>
  18. <div style="margin-top: 30px;">
  19. <el-upload class="upload-demo" ref="upload" action="" :file-list="fileList" accept=".png,.jpg,.doc,.docx,.txt,.pdf"
  20. :auto-upload="false" :http-request="uploadFile" :on-change="beforeAvatarUpload" :before-remove="beforeRemove" multiple>
  21. <el-button type="primary"><span>选择证据</span></el-button>
  22. </el-upload>
  23. </div>
  24. <div slot="footer" class="dialog-footer">
  25. <el-button @click="cancel" class="endbutton1"><span>取 消</span></el-button>
  26. <el-button @click="upload" class="endbutton1"><span>点击上传</span></el-button>
  27. </div>
  28. </el-dialog>
  29. </div>
  30. </template>
  31. <script>
  32. import { getFileList, batchUpload } from '@/api/caseManagement/caseManagement'
  33. import { getToken } from "@/utils/auth";
  34. export default {
  35. props: ["evidenceVisable", "evidenceData"],
  36. data() {
  37. return {
  38. fileListData: [],
  39. // 上传文件的列表
  40. uploadFiles: [],
  41. // 上传文件的个数
  42. filesLength: 0,
  43. info: {
  44. annexType: 2,
  45. },
  46. fileList:[]
  47. // headers: {
  48. // Authorization: "Bearer " + getToken(),
  49. // },
  50. };
  51. },
  52. watch: {
  53. evidenceVisable(val) {
  54. this.fileList = []
  55. if (val) {
  56. this.getEvidenceList({ caseAppliId: this.evidenceData.id, annexTypeList: "2" })
  57. }
  58. }
  59. },
  60. created() {
  61. this.info.id = this.evidenceData.id;
  62. },
  63. methods: {
  64. preview(data) {
  65. window.open(
  66. window.location.origin + "/API" + data,
  67. "_blank"
  68. );
  69. },
  70. UploadUrl() {
  71. return window.location.origin + "/API/evidence/upload";
  72. },
  73. cancel() {
  74. this.$emit("cancelEvidence");
  75. },
  76. // 修改当前文件列表长度
  77. // changeFileLength(file, fileList) {
  78. // this.uploadFiles.push(file)
  79. // },
  80. // 删除文件
  81. beforeRemove(file, fileList){
  82. this.uploadFiles = fileList
  83. },
  84. // 文件上传之前处理
  85. beforeAvatarUpload(file,fileList) {
  86. console.log(file,fileList,"before");
  87. this.uploadFiles = [];
  88. // this.uploadFiles.push(file)
  89. this.uploadFiles = fileList
  90. },
  91. // 用户点击上传调用
  92. async upload() {
  93. // 触发上传 调用配置 :http-request="uploadFile"
  94. // 即触发 uploadFile函数
  95. this.uploadFile()
  96. // await this.$refs.upload.submit();
  97. // 上传完成后执行的操作 ...
  98. },
  99. // 该函数还是会被调用多次
  100. // 每次param参数传入一个文件
  101. uploadFile() {
  102. // 将文件加入需要上传的文件列表
  103. // 当uploadFiles长度等于用户需要上传的文件数时进行上传
  104. // 创建FormData上传
  105. if (this.uploadFiles.length === 0) {
  106. this.$message.warning('请选取文件')
  107. return
  108. }
  109. let fd = new FormData()
  110. // 将全部文件添加至FormData中
  111. this.uploadFiles.forEach(file => {
  112. fd.append('file', file.raw)
  113. })
  114. // // 将附加信息添加至FormData
  115. fd.append("id", this.evidenceData.id)
  116. fd.append("annexType", this.info.annexType)
  117. // 上传文件
  118. batchUpload(fd).then(res => {
  119. this.$modal.msgSuccess("上传成功");
  120. this.cancel()
  121. })
  122. },
  123. // 获取案件申请人证据列表
  124. getEvidenceList(data) {
  125. getFileList(data).then(res => {
  126. this.fileListData = res.data;
  127. })
  128. }
  129. },
  130. };
  131. </script>
  132. <style lang="scss" scoped>
  133. .steps {
  134. display: flex;
  135. flex-wrap: wrap;
  136. }
  137. </style>