diff --git a/sgzb-ui/src/main.js b/sgzb-ui/src/main.js index 090086f4..9f7dd4d3 100644 --- a/sgzb-ui/src/main.js +++ b/sgzb-ui/src/main.js @@ -12,13 +12,13 @@ import store from './store' import router from './router' import directive from './directive' // directive import plugins from './plugins' // plugins -import { download,downloadJson } from '@/utils/request' +import { download, downloadJson } from '@/utils/request' import './assets/icons' // icon import './permission' // permission control import { getDicts } from "@/api/system/dict/data"; import { getConfigKey } from "@/api/system/config"; -import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"; +import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree, indexContinuation } from "@/utils/ruoyi"; // 分页组件 import Pagination from "@/components/Pagination"; // 自定义表格工具组件 @@ -56,6 +56,7 @@ Vue.prototype.download = download Vue.prototype.downloadJson = downloadJson Vue.prototype.handleTree = handleTree Vue.prototype.globalUrl = global_ +Vue.prototype.indexContinuation = indexContinuation // 全局组件挂载 Vue.component('DictTag', DictTag) diff --git a/sgzb-ui/src/utils/ruoyi.js b/sgzb-ui/src/utils/ruoyi.js index 44bf9c40..71046879 100644 --- a/sgzb-ui/src/utils/ruoyi.js +++ b/sgzb-ui/src/utils/ruoyi.js @@ -88,7 +88,7 @@ export function selectDictLabel(datas, value) { // 回显数据字典(字符串、数组) export function selectDictLabels(datas, value, separator) { - if (value === undefined || value.length ===0) { + if (value === undefined || value.length === 0) { return ""; } if (Array.isArray(value)) { @@ -231,3 +231,8 @@ export function tansParams(params) { export function blobValidate(data) { return data.type !== 'application/json' } + +// 处理表格索引延续问题 +export function indexContinuation(num, size) { + return (num - 1) * size + 1 +} diff --git a/sgzb-ui/src/views/base/section/index.vue b/sgzb-ui/src/views/base/section/index.vue index 94ac59b1..5db0ed17 100644 --- a/sgzb-ui/src/views/base/section/index.vue +++ b/sgzb-ui/src/views/base/section/index.vue @@ -22,6 +22,9 @@ 新增 + + 导入 + 导出 @@ -121,7 +124,12 @@ - + + + + + + +
+ 将文件拖到此处,或 + 点击上传 +
+
只能上传.xlx/.xls文件
+
+
@@ -138,6 +178,7 @@ import { unitTypeList } from '@/api/base/base' import { deptTreeSelect } from '@/api/system/user' import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' +import { getToken } from '@/utils/auth' export default { name: 'Section', dicts: ['sys_normal_disable'], @@ -193,6 +234,14 @@ export default { // { required: true, message: "所属工程项目", trigger: "blur" } // ] }, + importVisible: false, + uploadAction: process.env.VUE_APP_BASE_API + '/system/sys/file/upload', // 上传地址 + headers: { + Authorization: 'Bearer ' + getToken(), + }, + uploadData: { + fileType: 'sx', + }, } }, created() { @@ -361,6 +410,31 @@ export default { this.$store.dispatch('dict/cleanDict') }) }, + + // 导入按钮 + handleImport() { + console.log('导入----') + this.importVisible = true + }, + // 上传时 + onProgress(file) { + console.log(file, '上传时的文件') + }, + // 上传成功 + onSuccess(fileList) { + console.log('上传成功!!', fileList) + }, }, } + +