update: 修改Upload文件名;优化CardBox样式
This commit is contained in:
parent
5352ef782a
commit
ce9ce6ff4a
|
@ -1 +1,2 @@
|
|||
ENV=develop
|
||||
VITE_APP_BASE_API=/api
|
|
@ -1 +1,2 @@
|
|||
ENV=production
|
||||
VITE_APP_BASE_API=/api
|
|
@ -0,0 +1,49 @@
|
|||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
const rootPath = path.resolve(__dirname, '../')
|
||||
|
||||
function optimizeAntdComponents(moduleName: string): string[] {
|
||||
const moduleESPath = `${moduleName}/es`
|
||||
const nodeModulePath = `./node_modules/${moduleESPath}`
|
||||
const includes: string[] = [moduleESPath]
|
||||
|
||||
const folders = fs.readdirSync(
|
||||
path.resolve(rootPath, nodeModulePath)
|
||||
)
|
||||
|
||||
folders.map(name => {
|
||||
const folderName = path.resolve(
|
||||
rootPath,
|
||||
nodeModulePath,
|
||||
name
|
||||
)
|
||||
let stat = fs.lstatSync(folderName)
|
||||
if (stat.isDirectory()) {
|
||||
let styleFolder = path.resolve(folderName, 'style')
|
||||
if (fs.existsSync((styleFolder))) {
|
||||
let _stat = fs.lstatSync(styleFolder)
|
||||
if (_stat.isDirectory()) {
|
||||
includes.push(`${moduleESPath}/${name}/style`)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return includes
|
||||
}
|
||||
|
||||
export function optimizeDeps() {
|
||||
return {
|
||||
name: "optimizeDeps",
|
||||
configResolved: async (config) => {
|
||||
const components = [
|
||||
...optimizeAntdComponents('ant-design-vue'),
|
||||
...optimizeAntdComponents('jetlinks-ui-components')
|
||||
]
|
||||
let concat = config.optimizeDeps.include.concat(components)
|
||||
config.optimizeDeps.include = Array.from(new Set(concat))
|
||||
console.log(config.optimizeDeps.include)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
const color = {
|
||||
'processing': '64, 169, 255',
|
||||
'error': '247, 79, 70',
|
||||
'success': '74, 234, 220',
|
||||
'warning': '250, 178, 71',
|
||||
'default': '63, 73, 96'
|
||||
}
|
||||
export const getHexColor = (code: string, pe: number = 0.3) => {
|
||||
const _color = color[code] || color.default
|
||||
if (code === 'default') {
|
||||
pe = 0.1
|
||||
}
|
||||
return `rgba(${_color}, ${pe})`
|
||||
}
|
||||
|
||||
export default color
|
|
@ -1,12 +1,13 @@
|
|||
<template>
|
||||
<j-badge
|
||||
:status="statusNames ? statusNames[status] : 'default'"
|
||||
:color="_color"
|
||||
:text="text"
|
||||
></j-badge>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// import { StatusColorEnum } from '@/utils/consts.ts';
|
||||
import { getHexColor } from './color'
|
||||
const props = defineProps({
|
||||
text: {
|
||||
type: String,
|
||||
|
@ -26,6 +27,18 @@ const props = defineProps({
|
|||
* 0: 'error'
|
||||
* }
|
||||
*/
|
||||
statusNames: { type: Object },
|
||||
statusNames: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
'success': 'success',
|
||||
'warning': 'warning',
|
||||
'error': 'error',
|
||||
'default': 'default',
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
const _color = computed(() => {
|
||||
return getHexColor(props.statusNames[props.status], 1)
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
<div
|
||||
v-if="showStatus"
|
||||
class="card-state"
|
||||
:class="statusNames ? statusNames[status] : ''"
|
||||
:style='{
|
||||
backgroundColor: getHexColor(statusNames[status])
|
||||
}'
|
||||
>
|
||||
<div class="card-state-content">
|
||||
<BadgeStatus
|
||||
|
@ -68,9 +70,10 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts" name='CardBox'>
|
||||
import BadgeStatus from '@/components/BadgeStatus/index.vue';
|
||||
import type { ActionsType } from '@/components/Table/index.vue';
|
||||
import { getHexColor } from '../BadgeStatus/color'
|
||||
import type { ActionsType } from '@/components/Table';
|
||||
import { PropType } from 'vue';
|
||||
|
||||
type EmitProps = {
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
<script lang="ts" setup name='JProUpload'>
|
||||
import { message, UploadChangeParam, UploadProps } from 'ant-design-vue';
|
||||
import { FILE_UPLOAD } from '@/api/comm';
|
||||
import { TOKEN_KEY } from '@/utils/variable';
|
|
@ -1,6 +1,6 @@
|
|||
<!-- 参数类型输入组件 -->
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<div class="value-item-warp">
|
||||
<j-select
|
||||
v-if="typeMap.get(itemType) === 'select'"
|
||||
v-model:value="myValue"
|
||||
|
@ -92,7 +92,7 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts" name='ValueItem'>
|
||||
import { PropType } from 'vue';
|
||||
import { UploadChangeParam, UploadFile } from 'ant-design-vue';
|
||||
import { DefaultOptionType } from 'ant-design-vue/lib/select';
|
||||
|
@ -102,6 +102,7 @@ import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
|
|||
import { LocalStore } from '@/utils/comm';
|
||||
import { ItemData, ITypes } from './types';
|
||||
import { FILE_UPLOAD } from '@/api/comm';
|
||||
import { Upload } from 'jetlinks-ui-components'
|
||||
|
||||
type Emits = {
|
||||
(e: 'update:modelValue', data: string | number | boolean): void;
|
||||
|
|
|
@ -8,7 +8,7 @@ import CardBox from './CardBox/index.vue';
|
|||
import Search from './Search'
|
||||
import NormalUpload from './NormalUpload/index.vue'
|
||||
import FileFormat from './FileFormat/index.vue'
|
||||
import JProUpload from './JUpload/index.vue'
|
||||
import JProUpload from './Upload/index.vue'
|
||||
import { BasicLayoutPage, BlankLayoutPage } from './Layout'
|
||||
import { PageContainer, AIcon } from 'jetlinks-ui-components'
|
||||
import Ellipsis from './Ellipsis/index.vue'
|
||||
|
|
|
@ -4,13 +4,10 @@ import store from './store'
|
|||
import components from './components'
|
||||
import router from './router'
|
||||
import './style.less'
|
||||
// import jComponents from 'jetlinks-ui-components'
|
||||
// import 'jetlinks-ui-components/es/style.js'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(store)
|
||||
.use(router)
|
||||
.use(components)
|
||||
// .use(jComponents)
|
||||
.mount('#app')
|
||||
|
|
|
@ -11,7 +11,7 @@ export const getComponent = (type: string): string => {
|
|||
case 'long':
|
||||
case 'float':
|
||||
case 'double':
|
||||
return 'number'
|
||||
return type
|
||||
case 'metric':
|
||||
case 'enum':
|
||||
case 'boolean':
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<ValueItem
|
||||
v-else
|
||||
v-model:modelValue='myValue'
|
||||
:itemType='getComponent(item.component)'
|
||||
:itemType='item.component'
|
||||
:options='item.key === "upper" ? metricOption : options'
|
||||
@change='valueItemChange'
|
||||
/>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
interface ImportMetaEnv {
|
||||
readonly VITE_APP_BASE_API: string;
|
||||
readonly VITE_APP_WS_URL: string;
|
||||
readonly MODE: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
|
|
@ -12,12 +12,13 @@ import * as path from 'path'
|
|||
import monacoEditorPlugin from 'vite-plugin-monaco-editor';
|
||||
// import { JetlinksVueResolver } from 'jetlinks-ui-components/lib/plugin/resolve'
|
||||
import { JetlinksVueResolver } from './plugin/jetlinks'
|
||||
import { optimizeDeps } from './plugin/optimize'
|
||||
import copy from 'rollup-plugin-copy';
|
||||
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ mode}) => {
|
||||
const env: Partial<ImportMetaEnv> = loadEnv(mode, process.cwd());
|
||||
|
||||
return {
|
||||
base: './',
|
||||
resolve: {
|
||||
|
@ -53,6 +54,7 @@ export default defineConfig(({ mode}) => {
|
|||
vue(),
|
||||
monacoEditorPlugin({}),
|
||||
vueJsx(),
|
||||
optimizeDeps(),
|
||||
Components({
|
||||
resolvers: [JetlinksVueResolver({ importStyle: 'less' }), VueAmapResolver()],
|
||||
directoryAsNamespace: true
|
||||
|
@ -110,6 +112,9 @@ export default defineConfig(({ mode}) => {
|
|||
javascriptEnabled: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ['pinia', 'vue-router', 'axios', 'lodash-es', '@vueuse/core', 'echarts'],
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue