Merge remote-tracking branch 'origin/main'

main
liutao 23 hours ago
commit 69664bf6b0

@ -21,8 +21,7 @@ module.exports = defineConfig({
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'@unocss'
'plugin:prettier/recommended'
],
rules: {
'vue/no-setup-props-destructure': 'off',
@ -68,8 +67,6 @@ module.exports = defineConfig({
],
'vue/multi-word-component-names': 'off',
'vue/no-v-html': 'off',
'prettier/prettier': 'off', // 芋艿:默认关闭 prettier 的 ESLint 校验,因为我们使用的是 IDE 的 Prettier 插件
'@unocss/order': 'off', // 芋艿:禁用 unocss 【css】顺序的提示因为暂时不需要这么严格警告也有点繁琐
'@unocss/order-attributify': 'off' // 芋艿:禁用 unocss 【属性】顺序的提示,因为暂时不需要这么严格,警告也有点繁琐
'prettier/prettier': 'off' // 芋艿:默认关闭 prettier 的 ESLint 校验,因为我们使用的是 IDE 的 Prettier 插件
}
})

@ -16,7 +16,7 @@ import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import UnoCSS from 'unocss/vite'
export function createVitePlugins() {
export function createVitePlugins(isBuild = false) {
const root = process.cwd()
// 路径查找
@ -24,7 +24,7 @@ export function createVitePlugins() {
return resolve(root, '.', dir)
}
return [
const plugins = [
Vue(),
VueJsx(),
UnoCSS(),
@ -66,10 +66,6 @@ export function createVitePlugins() {
resolvers: [ElementPlusResolver()],
globs: ["src/components/**/**.{vue, md}", '!src/components/DiyEditor/components/mobile/**']
}),
EslintPlugin({
cache: false,
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
}),
VueI18nPlugin({
runtimeOnly: true,
compositionOnly: true,
@ -97,4 +93,16 @@ export function createVitePlugins() {
promiseImportName: (i) => `__tla_${i}`
})
]
// ESLint 校验仅在开发环境启用打包时跳过以提升构建速度lint 应在开发/提交阶段单独执行)
if (!isBuild) {
plugins.push(
EslintPlugin({
cache: true,
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
})
)
}
return plugins
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 745 KiB

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 KiB

After

Width:  |  Height:  |  Size: 158 KiB

@ -2216,7 +2216,6 @@ export default {
cancelReason: '取消原因',
cancelConfirm: '确认取消选中的任务吗?',
cancelSuccess: '取消任务成功',
cancelOnlyUnworkedTip: '只有未作业状态的工单才能取消任务',
cancelFail: '取消任务失败',
cancelOnlyUnworkedTip: '只有未作业状态的工单才能取消任务',
selectAllDecisionError: '请先为所有待检测记录选择通过或不通过',

@ -41,8 +41,6 @@ import '@/plugins/tongji' // 百度统计
import Logger from '@/utils/Logger'
import VueDOMPurifyHTML from 'vue-dompurify-html' // 解决v-html 的安全隐患
import { hiPrintPlugin } from 'vue-plugin-hiprint'
import 'vue-plugin-hiprint/dist/print-lock.css'
// 创建实例
const setupAll = async () => {
@ -58,9 +56,6 @@ const setupAll = async () => {
setupFormCreate(app)
app.use(hiPrintPlugin, '$hiprint', false)
hiPrintPlugin.disAutoConnect()
setupRouter(app)
// directives 指令

@ -918,7 +918,7 @@ const bjQueryParams = reactive({
pageSize: 10,
barCode: undefined as string | undefined,
name: undefined as string | undefined,
categoryId: undefined as number | undefined
categoryType: 3
})
const iotDeviceQueryParams = reactive({
@ -1057,10 +1057,11 @@ const getList = async () => {
const bjGetList = async () => {
loading.value = true
try {
bjQueryParams.categoryId = 5
bjQueryParams.categoryType = 3
const data = await ProductApi.getProductPage(bjQueryParams)
bjList.value = data.list
bjTotal.value = data.total
beijianOptions.value = mergeSelectionOptions(beijianOptions.value, buildBeijianOptions(bjList.value))
nextTick(() => {
bjToggleSelection()
})
@ -1605,12 +1606,12 @@ const ensureOptionsLoaded = async () => {
DeviceTypeApi.getDeviceTypeTree({ pageNo: 1, pageSize: 10 }),
getSimpleUserList(),
CriticalComponentApi.getCriticalComponentList(),
ProductApi.getComponentSimpleList()
ProductApi.getProductPage({ pageNo: 1, pageSize: 10, categoryType: 3 })
])
deviceTypeTree.value = deviceTypeRes ?? []
users.value = userRes ?? []
criticalComponentOptions.value = buildCriticalComponentOptions(criticalRes ?? [])
beijianOptions.value = buildBeijianOptions(beijianRes ?? [])
beijianOptions.value = buildBeijianOptions(beijianRes?.list ?? [])
}
const bindFormData = async (detail: DeviceLedgerVO) => {

@ -20,6 +20,12 @@ export default ({command, mode}: ConfigEnv): UserConfig => {
} else {
env = loadEnv(mode, root)
}
// 打包时需要移除的语句drop_console / drop_debugger
const esbuildDrop: ('console' | 'debugger')[] = []
if (env.VITE_DROP_CONSOLE === 'true') esbuildDrop.push('console')
if (env.VITE_DROP_DEBUGGER === 'true') esbuildDrop.push('debugger')
return {
base: env.VITE_BASE_PATH,
root: root,
@ -39,7 +45,7 @@ export default ({command, mode}: ConfigEnv): UserConfig => {
},
},
// 项目使用的vite插件。 单独提取到build/vite/plugin中管理
plugins: createVitePlugins(),
plugins: createVitePlugins(isBuild),
css: {
preprocessorOptions: {
scss: {
@ -62,21 +68,59 @@ export default ({command, mode}: ConfigEnv): UserConfig => {
}
]
},
// 使用 esbuild 压缩,速度远快于 terserdrop 用于移除 console / debugger
esbuild: {
drop: esbuildDrop
},
build: {
minify: 'terser',
minify: 'esbuild',
outDir: env.VITE_OUT_DIR || 'dist',
sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false,
// brotliSize: false,
terserOptions: {
compress: {
drop_debugger: env.VITE_DROP_DEBUGGER === 'true',
drop_console: env.VITE_DROP_CONSOLE === 'true'
}
},
// 提高 chunk 体积告警阈值,避免大量无意义警告
chunkSizeWarningLimit: 2000,
rollupOptions: {
output: {
manualChunks: {
echarts: ['echarts'] // 将 echarts 单独打包,参考 https://gitee.com/yudaocode/yudao-ui-admin-vue3/issues/IAB1SX 讨论
// 将体积较大的第三方依赖拆分为独立 chunk避免全部打进入口主 chunk 导致首屏阻塞
manualChunks(id: string) {
if (!id.includes('node_modules')) {
return
}
// 打印插件(体积最大,内含 jQuery 等),单独拆分
if (id.includes('vue-plugin-hiprint')) {
return 'hiprint'
}
// 表单设计器 / 表单渲染
if (id.includes('@form-create')) {
return 'form-create'
}
// 富文本编辑器
if (id.includes('@wangeditor')) {
return 'wangeditor'
}
// 图表库(含词云、底层 zrender
if (id.includes('echarts') || id.includes('zrender')) {
return 'echarts'
}
// 图片裁剪
if (id.includes('cropperjs')) {
return 'cropperjs'
}
// Element Plus 组件库
if (id.includes('element-plus') || id.includes('@element-plus')) {
return 'element-plus'
}
// Vue 全家桶
if (
id.includes('/vue/') ||
id.includes('/vue-router/') ||
id.includes('/@vue/') ||
id.includes('/pinia/') ||
id.includes('/vue-i18n/') ||
id.includes('/@intlify/')
) {
return 'vue'
}
}
},
},

Loading…
Cancel
Save