1 line
13 KiB
JSON
1 line
13 KiB
JSON
|
{"ast":null,"code":"import _createForOfIteratorHelper from \"D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js\";\nimport \"core-js/modules/es.number.to-fixed.js\";\nimport \"core-js/modules/es.array.map.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nexport default {\n name: \"File\",\n created: function created() {\n this.load();\n },\n data: function data() {\n return {\n tableData: [],\n total: 0,\n pageSize: 5,\n currentPage: 1,\n fileName: '',\n multipleSelection: []\n };\n },\n methods: {\n handleSizeChange: function handleSizeChange(pageSize) {\n this.pageSize = pageSize;\n this.load();\n },\n handleCurrentPage: function handleCurrentPage(currentPage) {\n this.currentPage = currentPage;\n this.load();\n },\n handleSelectionChange: function handleSelectionChange(val) {\n this.multipleSelection = val;\n },\n handleFileUploadSuccess: function handleFileUploadSuccess() {\n this.$message.success(\"上传成功\");\n this.load();\n },\n handleEnable: function handleEnable(row) {\n var _this = this;\n\n this.request.get(\"/file/enable\", {\n params: {\n \"id\": row.id,\n \"enable\": row.enable\n }\n }).then(function (res) {\n if (res.code === '200') {\n _this.$message({\n type: \"success\",\n message: \"修改成功\",\n duration: 3000\n });\n\n _this.load();\n } else {\n _this.$message.error(res.msg);\n }\n });\n },\n load: function load() {\n var _this2 = this;\n\n this.request.get(\"/file/page\", {\n params: {\n pageNum: this.currentPage,\n pageSize: this.pageSize,\n fileName: this.fileName\n }\n }).then(function (res) {\n if (res.code === '200') {\n _this2.tableData = res.data.records;\n\n var _iterator = _createForOfIteratorHelper(_this2.tableData),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var s = _step.value;\n var size = s.size;\n\n if (size < 1024) {\n s.size = size + ' Kb';\n } else if (size > 1024 && size < 1024 * 1024) {\n s.size = (size / 1024).toFixed(2) + ' Mb';\n } else {\n s.size = size / 1024 / 1024 .toFixed(2) + ' Gb';\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n _this2.total = res.data.total;\n }\n });\n },\n search: function search() {\n this.currentPage = 1;\n this.load();\n },\n reload: function reload() {\n this.fileName = '';\n this.load();\n },\n // //编辑\n // handleEdit(row){\n // this.user = JSON.parse(JSON.stringify(row));\n // this.dialogTitle='编辑用户';\n // this.dialogFormVisible = true;\n // },\n //删除\n handleDelete: function handleDelete(id) {\n var _this3 = this;\n\n this.$confirm('确认删除该文件吗?', '提示', {\n confirmButtonText: '确定',\n cancelButtonText: '取消',\n type: 'warning'\n }).then(function () {\n _this3.request.delete(\"/file/\" + id).then(function (res) {\n if (res.code === '200') {\n _this3.$message({\n type: \"success\",\n message: \"删除成功\",\n duration: 3000\n });\n\n _this3.load();\n } else {\n _this3.$message.error(res.msg);\n }\n });\n });\n
|