应用层PC端前端服务

batchDialog.vue 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div>
  3. <!-- 立案申请弹框 -->
  4. <el-dialog
  5. title="批量立案"
  6. :visible="openbatch"
  7. width="600px"
  8. append-to-body
  9. @close="cancel"
  10. center
  11. >
  12. <el-form ref="form" :model="form" :rules="rules" label-width="150px">
  13. <el-row>
  14. <!-- <el-col :span="16">
  15. <el-form-item label="申请人姓名:" prop="applyName">
  16. <el-input v-model="form.jobName" placeholder="请输入姓名" />
  17. </el-form-item>
  18. </el-col>-->
  19. <el-col :span="8">
  20. <div class="download" style="margin-bottom: 20px">
  21. <span> 下载: </span>
  22. <a href="#">
  23. <el-button class="uploadlink" @click="downloadTemplate">批量导入模板</el-button>
  24. </a>
  25. </div>
  26. </el-col>
  27. <!-- <el-col :span="12">
  28. <el-form-item label="立案申请书:" prop="applybook"> </el-form-item>
  29. </el-col>
  30. <el-col :span="12"> </el-col> -->
  31. </el-row>
  32. <el-row>
  33. <el-form-item :span="24" label="批量立案信息上传:" prop="upload">
  34. <el-upload
  35. class="upload-demo"
  36. ref="uploadbatch"
  37. :limit="1"
  38. accept=".xlsx, .xls"
  39. :headers="upload.headers"
  40. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  41. :disabled="upload.isUploading"
  42. :on-progress="handleFileUploadProgress"
  43. :on-success="handleFileSuccess"
  44. :auto-upload="false"
  45. drag
  46. >
  47. <i class="el-icon-upload"></i>
  48. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  49. <!-- <el-button size="small" type="primary">点击上传</el-button> -->
  50. <div slot="tip" class="el-upload__tip">
  51. 只接收.xlsx, .xls格式文件
  52. </div>
  53. </el-upload>
  54. </el-form-item>
  55. </el-row>
  56. </el-form>
  57. <div slot="footer" class="dialog-footer">
  58. <el-button type="primary" @click="submitForm" class="endbutton"><span>确 定</span></el-button>
  59. <el-button @click="cancel" class="endbutton1"><span>取 消</span></el-button>
  60. </div>
  61. </el-dialog>
  62. </div>
  63. </template>
  64. <script>
  65. import { importTemplate } from "@/api/caseAccess/caseEntry";
  66. import { getToken } from "@/utils/auth";
  67. export default {
  68. props: ["openbatch","getcaseApply","queryParams"],
  69. data() {
  70. return {
  71. // key: value,
  72. form: {},
  73. fileList: [],
  74. rules: {
  75. upload: [
  76. { required: true, message: "批量立案文件不能为空", trigger: "blur" },
  77. ],
  78. },
  79. // 案件批量导入
  80. upload: {
  81. // 是否显示弹出层(用户导入)
  82. open: false,
  83. // 弹出层标题(用户导入)
  84. title: "",
  85. // 是否禁用上传
  86. isUploading: false,
  87. // 是否更新已经存在的用户数据
  88. updateSupport: 0,
  89. // 设置上传的请求头部
  90. headers: { Authorization: "Bearer " + getToken() },
  91. // 上传的地址
  92. url: process.env.VUE_APP_BASE_API + "/caseApplication/importData",
  93. },
  94. };
  95. },
  96. methods: {
  97. // 批量提交立案申请
  98. submitForm() {
  99. this.$refs.uploadbatch.submit();
  100. },
  101. // 取消
  102. cancel() {
  103. // this.openbatch = false;
  104. this.$emit("cancelBatch");
  105. },
  106. handleRemove(file, fileList) {},
  107. handlePreview(file) {},
  108. handleExceed(files, fileList) {
  109. this.$message.warning(
  110. `当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
  111. files.length + fileList.length
  112. } 个文件`
  113. );
  114. },
  115. beforeRemove(file, fileList) {
  116. return this.$confirm(`确定移除 ${file.name}?`);
  117. },
  118. // 下载模板 importTemplate
  119. downloadTemplate() {
  120. // console.log("下载模板");
  121. this.download(
  122. "caseApplication/importTemplate",
  123. {},
  124. `case_batch_${new Date().getTime()}.xlsx`
  125. );
  126. },
  127. // 文件上传中处理
  128. handleFileUploadProgress(event, file, fileList) {
  129. this.upload.isUploading = true;
  130. },
  131. // 文件上传成功处理
  132. handleFileSuccess(response, file, fileList) {
  133. // this.upload.open = false;
  134. this.$emit("cancelBatch");
  135. this.upload.isUploading = false;
  136. this.$refs.uploadbatch.clearFiles();
  137. this.$alert(
  138. "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
  139. response.msg +
  140. "</div>",
  141. "导入结果",
  142. { dangerouslyUseHTMLString: true }
  143. );
  144. this.getcaseApply(this.queryParams);
  145. },
  146. },
  147. };
  148. </script>
  149. <style lang="scss" scoped>
  150. .download {
  151. a {
  152. .uploadlink{
  153. border: none;
  154. color: #2092c7;
  155. }
  156. }
  157. }
  158. ::v-deep .el-dialog {
  159. width: 800px;
  160. background: #ffffff;
  161. border-radius: 20px;
  162. }
  163. .endbutton {
  164. width: 154px;
  165. height: 37px;
  166. background: #0072ff;
  167. border-radius: 19px;
  168. span {
  169. width: 96px;
  170. height: 15px;
  171. font-size: 16px;
  172. font-family: Microsoft YaHei;
  173. font-weight: 400;
  174. color: #ffffff;
  175. }
  176. }
  177. .endbutton1 {
  178. width: 154px;
  179. height: 37px;
  180. background: #ffffff;
  181. border: 1px solid #d0d0d0;
  182. border-radius: 19px;
  183. span {
  184. width: 31px;
  185. height: 13px;
  186. font-size: 16px;
  187. font-family: Microsoft YaHei;
  188. font-weight: 400;
  189. color: #959595;
  190. }
  191. }
  192. </style>