exportFile.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div>
  3. <div class="heaerCon">
  4. <div class="miniBtn">
  5. <!-- <el-button plain size="mini">导入监测数据包</el-button> -->
  6. <!-- <el-button plain size="mini">导入核查</el-button> -->
  7. <!-- <el-upload
  8. class="upload-demo"
  9. :on-change="handleChange"
  10. :auto-upload="false"
  11. :show-file-list="false"
  12. :file-list="fileList"
  13. :limit="1"
  14. accept=".zip"
  15. :action="uploadFileUrl"
  16. > -->
  17. <el-upload
  18. ref="fileUploadBtn"
  19. class="upload-demo"
  20. :action="uploadFileUrl"
  21. :before-upload="handleBeforeUpload"
  22. :on-error="handleUploadError"
  23. :on-success="handleUploadSuccess"
  24. :limit="1"
  25. accept=".zip"
  26. :file-list="fileList"
  27. :show-file-list="false"
  28. :data="additionalData"
  29. >
  30. <el-button plain size="mini">导入监测数据包</el-button>
  31. </el-upload>
  32. </div>
  33. <div class="showBtn">
  34. <span @click="showPlin(false)" v-show="showExp">数据说明</span>
  35. <span @click="showPlin(true)" v-show="!showExp" showExp="false"
  36. >退出说明</span
  37. >
  38. <!-- <span>删除记录</span> -->
  39. </div>
  40. </div>
  41. <div v-show="showExp" class="bodyCon">
  42. <el-table
  43. ref="singleTable"
  44. :data="tableData"
  45. highlight-current-row
  46. style="width: 100%"
  47. >
  48. <el-table-column type="index" label="序号" width="50">
  49. </el-table-column>
  50. <el-table-column
  51. property="name"
  52. label="导入数据包"
  53. show-overflow-tooltip
  54. >
  55. </el-table-column>
  56. <el-table-column property="uploadtime" label="导入时间">
  57. </el-table-column>
  58. <el-table-column property="uploaduser" label="操作人" width="120">
  59. </el-table-column>
  60. <el-table-column label="导入结果" width="120">
  61. <template slot-scope="scope">
  62. <span v-if="scope.row.readstatus == 0">导入成功</span>
  63. <span v-else>导入失败</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="操作" width="60">
  67. <template slot-scope="scope">
  68. <el-button type="text" size="small" @click="handleDel(scope.row)"
  69. >删除</el-button
  70. >
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <el-pagination
  75. @size-change="handleSizeChange"
  76. @current-change="handleCurrentChange"
  77. :current-page="pageNum"
  78. :page-size="pageSize"
  79. layout="total, prev, pager, next, jumper"
  80. :total="total"
  81. class="pagination"
  82. >
  83. </el-pagination>
  84. </div>
  85. <div v-show="!showExp" class="expCon bodyCon">
  86. <span
  87. >&nbsp;&nbsp;&nbsp;&nbsp;监测批次数据包括监测图斑、前期影像、后期影像,其中:前期影像放在文件夹QDOM中、后期影像放在文件夹DDOM中。同一块区域的影像命名必须一致。
  88. </span>
  89. <br />
  90. <span>
  91. 对数据要求说明:
  92. <br />(1)数据压缩包格式为.zip <br />
  93. (2)数据压缩包中包含文件夹QDOM、DDOM,shp数据文件 <br />
  94. (3)矢量数据shp和tif影像坐标系为CGCS2000<br />
  95. (4)检测图斑shp文件中必须包含字段jcbh(图斑编号),jcmj(检测面积),xmc(行政名称),qsx(前时相),hsx(后时相),qlx(前类型),hlx(后类型)
  96. </span>
  97. </div>
  98. </div>
  99. </template>
  100. <script>
  101. import { ShapeUploadV1, FileList, deletFile } from "@/api/ghss/hgxfx.js";
  102. export default {
  103. components: {},
  104. data() {
  105. return {
  106. pageNum: 1,
  107. pageSize: 5,
  108. total: 0,
  109. showExp: true,
  110. // uploadFileUrl: window.axiosURI + "/file/upload", // 上传文件服务器地址
  111. uploadFileUrl: window.axiosURI + "/file/upload/geom/v1", // 上传文件服务器地址
  112. fileList: [], //文件
  113. fileDataID: "", //存储上传文件获取到的id
  114. tableData: [],
  115. additionalData: {
  116. // file: null,
  117. fromType: 2,
  118. fromRoute: this.$route.path,
  119. storeStats: "",
  120. followup: 1,
  121. },
  122. loading:null,
  123. };
  124. },
  125. computed: {},
  126. mounted() {
  127. this.init();
  128. },
  129. methods: {
  130. showPlin(val) {
  131. this.showExp = val;
  132. },
  133. handleSizeChange(val) {
  134. this.pageSize = val;
  135. this.init();
  136. },
  137. handleCurrentChange(val) {
  138. this.pageNum = val;
  139. this.init();
  140. },
  141. init() {
  142. FileList({
  143. pageNum: this.pageNum,
  144. pageSize: this.pageSize,
  145. }).then((res) => {
  146. this.tableData = res.rows;
  147. this.total = res.total;
  148. });
  149. },
  150. handleBeforeUpload(file) {
  151. // this.additionalData.file = file;
  152. // this.$modal.loading("正在上传文件,请稍候...");
  153. this.loading = this.$loading({
  154. lock: true,
  155. text: '正在上传中...',
  156. spinner: 'el-icon-loading',
  157. background: 'rgba(0, 0, 0, 0.7)'
  158. });
  159. return true;
  160. },
  161. // 上传失败
  162. handleUploadError(err) {
  163. this.$message.error("上传文件失败,请重试");
  164. },
  165. // 上传成功回调
  166. handleUploadSuccess(res, file) {
  167. if (res.success) {
  168. this.$message({
  169. message: "导入文件成功!",
  170. type: "success",
  171. });
  172. this.loading.close();
  173. this.fileDataID = res.data.id;
  174. this.init();
  175. this.$refs.fileUploadBtn.clearFiles(); //上传成功之后清除历史记录
  176. }else{
  177. this.loading.close();
  178. this.$refs.fileUploadBtn.clearFiles(); //上传成功之后清除历史记录
  179. }
  180. },
  181. //上传文件
  182. handleChange(file, fileList) {
  183. this.fileDataID = "";
  184. // this.fileList = [];
  185. // if (fileList.length > 0) {
  186. // this.fileList = [fileList[fileList.length - 1]]; //这一步,是展示最后一次选择文件
  187. // }
  188. const formdata = new FormData();
  189. // formdata.append("file", file.raw);
  190. formdata.append("file", file.file);
  191. formdata.append("fromType", 2);
  192. formdata.append("fromRoute", this.$route.path);
  193. formdata.append("storeStats", "");
  194. formdata.append("followup", 1);
  195. ShapeUploadV1(formdata).then((res) => {
  196. if (res.success) {
  197. this.$message({
  198. message: "导入文件成功!",
  199. type: "success",
  200. });
  201. this.fileDataID = res.data.id;
  202. this.init();
  203. }
  204. });
  205. },
  206. handleDel(row) {
  207. deletFile(row.id).then((res) => {
  208. if (res.code == 200) {
  209. this.$message({
  210. message: "删除成功成功!",
  211. type: "success",
  212. });
  213. this.init();
  214. }
  215. });
  216. },
  217. },
  218. watch: {},
  219. watch: {},
  220. beforeDestroy() {},
  221. };
  222. </script>
  223. <style lang="less" scoped>
  224. .heaerCon {
  225. display: flex;
  226. justify-content: space-between;
  227. margin: 5px 0;
  228. .miniBtn {
  229. /deep/ .el-button--mini {
  230. background: #0f7ac8;
  231. border: none;
  232. border-radius: 0;
  233. color: #fff;
  234. }
  235. }
  236. .showBtn {
  237. color: #169bd5;
  238. }
  239. }
  240. /deep/.dialog-footer .el-button {
  241. background-color: #3f94f53f;
  242. border: 1px solid #3f93f5;
  243. }
  244. .expCon {
  245. color: #fff;
  246. }
  247. .bodyCon {
  248. height: 36vh;
  249. /deep/ .el-pagination button:disabled {
  250. color: #fff;
  251. background-color: rgba(75, 185, 250, 0.2) !important;
  252. cursor: not-allowed;
  253. }
  254. }
  255. </style>