mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-03-16 03:51:02 +08:00
build 正常使用
This commit is contained in:
parent
d007875a43
commit
4bcd0cfc3b
@ -1,3 +1,3 @@
|
|||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
VITE_APP_BASE_API = 'http://xxx:8081/'
|
VITE_APP_BASE_API = 'http://localhost:8081/'
|
||||||
|
|
||||||
|
@ -5,8 +5,12 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<mb-table ref="magicTable" v-bind="tableOptions">
|
<mb-table ref="magicTable" v-bind="tableOptions">
|
||||||
<template v-for="col in cols" #[col.field]="{ index }">
|
<template v-for="col in cols" #[col.field]="{ index }">
|
||||||
|
<div v-if="!col.component">
|
||||||
|
{{ tableOptions.data[index][col.field] }}
|
||||||
|
</div>
|
||||||
<component
|
<component
|
||||||
:is="!col.component ? 'mb-input' : col.component.startsWith('el-') ? col.component : 'mb-' + col.component"
|
v-else
|
||||||
|
:is="col.component.startsWith('el-') ? col.component : 'mb-' + col.component"
|
||||||
v-model="tableOptions.data[index][col.field]"
|
v-model="tableOptions.data[index][col.field]"
|
||||||
v-bind="col.props"
|
v-bind="col.props"
|
||||||
@change="dataChange"
|
@change="dataChange"
|
||||||
@ -65,6 +69,7 @@ tableOptions.cols.push({
|
|||||||
})
|
})
|
||||||
|
|
||||||
watch(() => props.modelValue, (value) => {
|
watch(() => props.modelValue, (value) => {
|
||||||
|
console.log(value)
|
||||||
tableOptions.data = value
|
tableOptions.data = value
|
||||||
}, {
|
}, {
|
||||||
deep: true
|
deep: true
|
||||||
|
@ -72,29 +72,29 @@ common.renderWhere = (where) => {
|
|||||||
return newWhere
|
return newWhere
|
||||||
}
|
}
|
||||||
|
|
||||||
common.exportExcel = (options) => {
|
// common.exportExcel = (options) => {
|
||||||
var where = options.where || {}
|
// var where = options.where || {}
|
||||||
where = common.renderWhere(where)
|
// where = common.renderWhere(where)
|
||||||
where.current = 1
|
// where.current = 1
|
||||||
where.size = 99999999
|
// where.size = 99999999
|
||||||
const url = options.url
|
// const url = options.url
|
||||||
const headers = options.headers
|
// const headers = options.headers
|
||||||
const columns = options.columns
|
// const columns = options.columns
|
||||||
request({
|
// request({
|
||||||
url: url,
|
// url: url,
|
||||||
method: 'post',
|
// method: 'post',
|
||||||
params: where
|
// params: where
|
||||||
}).then(res => {
|
// }).then(res => {
|
||||||
import('@/vendor/Export2Excel').then(excel => {
|
// import('@/vendor/Export2Excel').then(excel => {
|
||||||
const data = formatJson(res.data, columns)
|
// const data = formatJson(res.data, columns)
|
||||||
excel.export_json_to_excel({
|
// excel.export_json_to_excel({
|
||||||
header: headers,
|
// header: headers,
|
||||||
data,
|
// data,
|
||||||
filename: 'table-list'
|
// filename: 'table-list'
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
common.handlerTreeData = (data, id, pid, sort, pidVal) => {
|
common.handlerTreeData = (data, id, pid, sort, pidVal) => {
|
||||||
var treeData = []
|
var treeData = []
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import request from '@/scripts/request'
|
import request from '@/scripts/request'
|
||||||
import common from '@/scripts/common'
|
import common from '@/scripts/common'
|
||||||
import { defineAsyncComponent } from 'vue'
|
|
||||||
|
const viewModules = import.meta.glob("../views/**/**.vue")
|
||||||
|
const layoutModules = import.meta.glob("../layout/**.vue")
|
||||||
|
|
||||||
export const filterAsyncRouter = (routers, level) => {
|
export const filterAsyncRouter = (routers, level) => {
|
||||||
level = level || 0
|
level = level || 0
|
||||||
@ -13,7 +15,7 @@ export const filterAsyncRouter = (routers, level) => {
|
|||||||
const component = router.component
|
const component = router.component
|
||||||
if (component === 'Layout') {
|
if (component === 'Layout') {
|
||||||
router.path = "/" + common.uuid()
|
router.path = "/" + common.uuid()
|
||||||
router.component = level > 0 ? import(`../layout/none.vue`) : loadLayoutView(component)
|
router.component = level > 0 ? layoutModules[`../layout/none.vue`] : loadLayoutView(component)
|
||||||
} else {
|
} else {
|
||||||
router.path = router.path = router.path.startsWith('/') ? router.path : '/' + router.path
|
router.path = router.path = router.path.startsWith('/') ? router.path : '/' + router.path
|
||||||
router.component = loadView(component)
|
router.component = loadView(component)
|
||||||
@ -30,12 +32,12 @@ export const filterAsyncRouter = (routers, level) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const loadLayoutView = (view) => {
|
export const loadLayoutView = (view) => {
|
||||||
return import(`../layout/layout.vue`)
|
return layoutModules[`../layout/layout.vue`]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const loadView = (view) => {
|
export const loadView = (view) => {
|
||||||
view = view.substring(0, 1) === '/' ? view : '/' + view
|
view = view.substring(0, 1) === '/' ? view : '/' + view
|
||||||
return defineAsyncComponent(() => import(`../views${view}.vue`))
|
return viewModules[`../views${view}.vue`]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateRoutes(){
|
export function generateRoutes(){
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="dashboard-container">
|
|
||||||
<div class="dashboard-text">欢迎</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { mapGetters } from 'vuex'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'Dashboard',
|
|
||||||
computed: {
|
|
||||||
...mapGetters([
|
|
||||||
'name'
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.dashboard {
|
|
||||||
&-container {
|
|
||||||
margin: 30px;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
&-text {
|
|
||||||
font-size: 30px;
|
|
||||||
line-height: 46px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -5,6 +5,7 @@ import viteSvgIcons from 'vite-plugin-svg-icons'
|
|||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
base: './',
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
viteSvgIcons({
|
viteSvgIcons({
|
||||||
@ -17,5 +18,21 @@ export default defineConfig({
|
|||||||
alias: {
|
alias: {
|
||||||
'@': path.resolve(__dirname,'src')
|
'@': path.resolve(__dirname,'src')
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
css: {//去除@charset UTF-8规则影响
|
||||||
|
postcss: {
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
postcssPlugin: 'internal:charset-removal',
|
||||||
|
AtRule: {
|
||||||
|
charset: (atRule) => {
|
||||||
|
if (atRule.name === 'charset') {
|
||||||
|
atRule.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user