提交 2cce373a authored 作者: 刘旭's avatar 刘旭

新增字段 租户标识 租户域名

上级 392e301d
<template>
<div class="app-container">
<el-row justify="start" style="margin-bottom: 20px;">
<el-col :span="4">
<el-input v-model="searchValue" placeholder="请输入MAC地址"></el-input>
</el-col>
<el-col :span="2" style="text-align: center;">
<el-button type="primary" @click="search">搜索</el-button>
</el-col>
</el-row>
<el-button type="primary" @click="addlicInfo" style="margin-bottom: 20px;">添加信息</el-button>
<el-table :data="licInfoTable.licInfoData" border style="width: 100%" row-key="id"
v-loading="licInfoTable.loading">
<el-table-column type="expand">
<template #default="scope">
<div v-if="scope.row.dockerServices.length === 0">
<el-empty description="暂无镜像" :image-size="100">
<el-button type="primary" size="small" @click="addMirror(scope.row)">添加镜像</el-button>
</el-empty>
</div>
<div v-else style="padding: 20px 40px;">
<div style="display: flex; justify-content: space-between; margin-bottom: 20px;">
<span style="font-size: 16px; font-weight: 700;">docker镜像</span>
<el-button type="primary" size="small" @click="addMirror(scope.row)">添加镜像</el-button>
</div>
<el-table :data="scope.row.dockerServices" style="width: 100%">
<el-table-column prop="name" label="镜像名" align="center" />
<el-table-column prop="contextPath" label="服务路径" align="center" />
<el-table-column prop="version" label="版本" align="center" />
<el-table-column label="操作" width="200" align="center">
<template #default="item">
<el-button size="small" type="danger"
@click="handleServiceDelete(scope.row, item.row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="app-container">
<el-row justify="start" style="margin-bottom: 20px">
<el-col :span="4">
<el-input v-model="searchValue" placeholder="请输入MAC地址"></el-input>
</el-col>
<el-col :span="2" style="text-align: center">
<el-button type="primary" @click="search">搜索</el-button>
</el-col>
</el-row>
<el-button type="primary" @click="addlicInfo" style="margin-bottom: 20px"
>添加信息</el-button
>
<el-table
:data="licInfoTable.licInfoData"
border
style="width: 100%"
row-key="id"
v-loading="licInfoTable.loading"
>
<el-table-column type="expand">
<template #default="scope">
<div v-if="scope.row.dockerServices.length === 0">
<el-empty description="暂无镜像" :image-size="100">
<el-button
type="primary"
size="small"
@click="addMirror(scope.row)"
>添加镜像</el-button
>
</el-empty>
</div>
<div v-else style="padding: 20px 40px">
<div
style="
display: flex;
justify-content: space-between;
margin-bottom: 20px;
"
>
<span style="font-size: 16px; font-weight: 700">docker镜像</span>
<el-button
type="primary"
size="small"
@click="addMirror(scope.row)"
>添加镜像</el-button
>
</div>
<el-table :data="scope.row.dockerServices" style="width: 100%">
<el-table-column prop="name" label="镜像名" align="center" />
<el-table-column
prop="contextPath"
label="服务路径"
align="center"
/>
<el-table-column prop="version" label="版本" align="center" />
<el-table-column label="操作" width="200" align="center">
<template #default="item">
<el-button
size="small"
type="danger"
@click="handleServiceDelete(scope.row, item.row.id)"
>删除
</el-button>
</template>
</el-table-column>
<el-table-column prop="lqLicName" label="项目名称" width="200" />
<el-table-column prop="macAddress" label="MAC地址" width="200" />
<el-table-column prop="effectiveTime" label="导入文件有效时间" />
<el-table-column prop="fileEffectiveTime" label="导入后有效时间" />
<el-table-column prop="verificationInterval" label="验证间隔时间(s)" />
<el-table-column prop="moduleVerification" label="模块验证" />
<el-table-column label="操作" width="200">
<template #default="scope">
<el-button size="small" type="primary" @click="handleEdit(scope.row)">编辑</el-button>
<el-button size="small" type="danger" @click="handleDelete(scope.row.id)">删除
</el-button>
<el-button size="small" type="primary" @click="handleExport(scope.row)">导出</el-button>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-pagination v-model:currentPage="licInfoTable.pageNo" v-model:page-size="licInfoTable.pageSize"
:page-sizes="[10, 15, 20]" layout="->, total,sizes, prev, pager, next, jumper"
:total="licInfoTable.total" @size-change="handleSizeChange" @current-change="handleCurrentChange"
hide-on-single-page />
</div>
</el-table-column>
</el-table>
</div>
</template>
</el-table-column>
<el-table-column prop="lqLicName" label="项目名称" width="200" />
<el-table-column prop="macAddress" label="MAC地址" width="200" />
<el-table-column prop="effectiveTime" label="导入文件有效时间" />
<el-table-column prop="fileEffectiveTime" label="导入后有效时间" />
<el-table-column prop="verificationInterval" label="验证间隔时间(s)" />
<el-table-column prop="moduleVerification" label="模块验证" />
<el-table-column prop="tenantId" label="租户标识" />
<el-table-column prop="domainName" label="租户域名" />
<el-table-column label="操作" width="200">
<template #default="scope">
<el-button size="small" type="primary" @click="handleEdit(scope.row)"
>编辑</el-button
>
<el-button
size="small"
type="danger"
@click="handleDelete(scope.row.id)"
>删除
</el-button>
<el-button
size="small"
type="primary"
@click="handleExport(scope.row)"
>导出</el-button
>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-pagination
v-model:currentPage="licInfoTable.pageNo"
v-model:page-size="licInfoTable.pageSize"
:page-sizes="[10, 15, 20]"
layout="->, total,sizes, prev, pager, next, jumper"
:total="licInfoTable.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
hide-on-single-page
/>
</div>
</div>
<!-- 添加对话框 -->
<el-dialog v-model="licInfoForm.dialogVisible" :title="licInfoForm.title" width="30%" :before-close="handleClose">
<el-form ref="licInfoRef" :model="licInfoForm.formLicInfo" :rules="licInfoForm.rules" label-width="150px"
status-icon>
<el-form-item label="Lic名称" prop="lqLicName">
<el-input v-model="licInfoForm.formLicInfo.lqLicName" placeholder="请输入Lic名称"></el-input>
</el-form-item>
<el-form-item label="MAC地址" prop="macAddress">
<el-input v-model="licInfoForm.formLicInfo.macAddress" placeholder="请输入MAC地址"></el-input>
</el-form-item>
<el-form-item label="导入文件有效时间" prop="effectiveTime">
<el-date-picker v-model="licInfoForm.formLicInfo.effectiveTime" type="datetime" placeholder="请输入有效时间"
value-format="YYYY-MM-DD HH:mm:ss" />
</el-form-item>
<el-form-item label="导入后有效时间" prop="fileEffectiveTime">
<el-date-picker v-model="licInfoForm.formLicInfo.fileEffectiveTime" type="datetime"
placeholder="请输入有效时间" value-format="YYYY-MM-DD HH:mm:ss" />
</el-form-item>
<el-form-item label="验证间隔时间(s)" prop="verificationInterval">
<el-input v-model.number="licInfoForm.formLicInfo.verificationInterval" placeholder="请输入验证间隔时间">
</el-input>
</el-form-item>
<el-form-item label="模块验证">
<el-input v-model="licInfoForm.formLicInfo.moduleVerification" placeholder="请输入模块验证"></el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleClose">关闭</el-button>
<el-button type="primary" @click="onConfirm">确认</el-button>
</span>
</template>
</el-dialog>
<!-- 添加对话框 -->
<el-dialog
v-model="licInfoForm.dialogVisible"
:title="licInfoForm.title"
width="30%"
:before-close="handleClose"
>
<el-form
ref="licInfoRef"
:model="licInfoForm.formLicInfo"
:rules="licInfoForm.rules"
label-width="150px"
status-icon
>
<el-form-item label="Lic名称" prop="lqLicName">
<el-input
v-model="licInfoForm.formLicInfo.lqLicName"
placeholder="请输入Lic名称"
></el-input>
</el-form-item>
<el-form-item label="MAC地址" prop="macAddress">
<el-input
v-model="licInfoForm.formLicInfo.macAddress"
placeholder="请输入MAC地址"
></el-input>
</el-form-item>
<el-form-item label="导入文件有效时间" prop="effectiveTime">
<el-date-picker
v-model="licInfoForm.formLicInfo.effectiveTime"
type="datetime"
placeholder="请输入有效时间"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
<el-form-item label="导入后有效时间" prop="fileEffectiveTime">
<el-date-picker
v-model="licInfoForm.formLicInfo.fileEffectiveTime"
type="datetime"
placeholder="请输入有效时间"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
<el-form-item label="验证间隔时间(s)" prop="verificationInterval">
<el-input
v-model.number="licInfoForm.formLicInfo.verificationInterval"
placeholder="请输入验证间隔时间"
>
</el-input>
</el-form-item>
<el-form-item label="模块验证">
<el-input
v-model="licInfoForm.formLicInfo.moduleVerification"
placeholder="请输入模块验证"
></el-input>
</el-form-item>
<el-form-item label="租户标识">
<el-input
v-model="licInfoForm.formLicInfo.tenantId"
placeholder="请输入租户标识"
></el-input>
</el-form-item>
<el-form-item label="租户域名">
<el-input
v-model="licInfoForm.formLicInfo.domainName"
placeholder="请输入租户域名"
></el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="handleClose">关闭</el-button>
<el-button type="primary" @click="onConfirm">确认</el-button>
</span>
</template>
</el-dialog>
<mirror-form ref="mirrorFormRef" v-model:mirror-dialog="mirrorDialog" @mirror-data="getMirrorData" />
<mirror-form
ref="mirrorFormRef"
v-model:mirror-dialog="mirrorDialog"
@mirror-data="getMirrorData"
/>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
import { licInfoList, licInfoDelete, licInfoFileCreate, licInfoUpdate, licInfoCreate } from '@/services/api/licInformation/licInformation'
import { ref, reactive } from "vue";
import {
licInfoList,
licInfoDelete,
licInfoFileCreate,
licInfoUpdate,
licInfoCreate,
} from "@/services/api/licInformation/licInformation";
import { ElMessageBox, ElMessage } from "element-plus";
import mirrorForm from './components/mirrorForm.vue'
import mirrorForm from "./components/mirrorForm.vue";
const licInfoTable = reactive({
licInfoData: [],
total: 0,
pageNo: 1,
pageSize: 10,
loading: true
})
licInfoData: [],
total: 0,
pageNo: 1,
pageSize: 10,
loading: true,
});
const licInfoRef = ref()
const mirrorFormRef = ref()
const licInfoRef = ref();
const mirrorFormRef = ref();
const searchValue = ref()
const mirrorDialog = ref()
const searchValue = ref();
const mirrorDialog = ref();
const licInfoForm = reactive<any>({
dialogVisible: false,
title: '新增',
formLicInfo: {
dockerServices: [],
macAddress: '',
effectiveTime: '',
fileEffectiveTime: '',
verificationInterval: '',
moduleVerification: '',
lqLicName: ''
},
rules: {
macAddress: [{ required: true, message: '', trigger: 'blur' }],
lqLicName: [{ required: true, message: '', trigger: 'blur' }],
effectiveTime: [{
type: 'date',
required: true,
message: '',
trigger: 'change',
}],
fileEffectiveTime: [{
type: 'date',
required: true,
message: '',
trigger: 'change',
}],
verificationInterval: [{ required: true, message: '', trigger: 'blur' }, { type: 'number', message: '请输入数字' }],
}
})
dialogVisible: false,
title: "新增",
formLicInfo: {
dockerServices: [],
macAddress: "",
effectiveTime: "",
fileEffectiveTime: "",
verificationInterval: "",
moduleVerification: "",
lqLicName: "",
tenantId: "",
domainName: "",
},
rules: {
macAddress: [{ required: true, message: "", trigger: "blur" }],
lqLicName: [{ required: true, message: "", trigger: "blur" }],
effectiveTime: [
{
type: "date",
required: true,
message: "",
trigger: "change",
},
],
fileEffectiveTime: [
{
type: "date",
required: true,
message: "",
trigger: "change",
},
],
verificationInterval: [
{ required: true, message: "", trigger: "blur" },
{ type: "number", message: "请输入数字" },
],
},
});
const search = () => {
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize)
}
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize);
};
const addlicInfo = () => {
licInfoForm.title = '新增'
licInfoForm.dialogVisible = true
}
licInfoForm.title = "新增";
licInfoForm.dialogVisible = true;
};
const mirrorRow = ref() as any
const mirrorRow = ref() as any;
const handleEdit = (data: any) => {
licInfoForm.title = '编辑'
licInfoForm.formLicInfo = data
licInfoForm.dialogVisible = true
}
licInfoForm.title = "编辑";
licInfoForm.formLicInfo = data;
licInfoForm.dialogVisible = true;
};
// 新条数
const handleSizeChange = (val: number) => {
licInfoTable.pageSize = val;
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize)
licInfoTable.pageSize = val;
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize);
};
// 新页数
const handleCurrentChange = (val: number) => {
licInfoTable.pageNo = val;
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize)
licInfoTable.pageNo = val;
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize);
};
const onConfirm = () => {
licInfoRef.value?.validate((valid: any, fields: any) => {
if (valid) {
if (licInfoForm.title === '新增') {
licInfoCreate(licInfoForm.formLicInfo).then((res: any) => {
if (res.code === 200) {
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize)
licInfoRef.value?.resetFields()
ElMessage({ type: "success", message: "添加成功!" });
licInfoForm.dialogVisible = false
}
})
} else {
licInfoUpdate(licInfoForm.formLicInfo).then((res: any) => {
if (res.code === 200) {
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize)
licInfoRef.value?.resetFields()
ElMessage({ type: "success", message: "修改成功!" });
licInfoForm.dialogVisible = false
}
})
}
} else {
console.log("校验失败", fields);
}
})
}
licInfoRef.value?.validate((valid: any, fields: any) => {
if (valid) {
if (licInfoForm.title === "新增") {
licInfoCreate(licInfoForm.formLicInfo).then((res: any) => {
if (res.code === 200) {
initLicInfo(
searchValue.value,
licInfoTable.pageNo,
licInfoTable.pageSize
);
licInfoRef.value?.resetFields();
ElMessage({ type: "success", message: "添加成功!" });
licInfoForm.dialogVisible = false;
}
});
} else {
licInfoUpdate(licInfoForm.formLicInfo).then((res: any) => {
if (res.code === 200) {
initLicInfo(
searchValue.value,
licInfoTable.pageNo,
licInfoTable.pageSize
);
licInfoRef.value?.resetFields();
ElMessage({ type: "success", message: "修改成功!" });
licInfoForm.dialogVisible = false;
}
});
}
} else {
console.log("校验失败", fields);
}
});
};
const addMirror = (row: any) => {
mirrorDialog.value = true
mirrorFormRef.value.title = '新增镜像'
mirrorFormRef.value.initService()
mirrorRow.value = JSON.parse(JSON.stringify(row))
}
mirrorDialog.value = true;
mirrorFormRef.value.title = "新增镜像";
mirrorFormRef.value.initService();
mirrorRow.value = JSON.parse(JSON.stringify(row));
};
const getMirrorData = async (data: any) => {
mirrorRow.value.dockerServices.push(data)
const res: any = await licInfoUpdate(mirrorRow.value)
if (res.code === 200) {
ElMessage.success('添加成功')
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize)
mirrorFormRef.value.handleClose()
}
}
mirrorRow.value.dockerServices.push(data);
const res: any = await licInfoUpdate(mirrorRow.value);
if (res.code === 200) {
ElMessage.success("添加成功");
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize);
mirrorFormRef.value.handleClose();
}
};
// 删除
const handleDelete = (id: number) => {
ElMessageBox.confirm("请确认删除?", "删除", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
ElMessageBox.confirm("请确认删除?", "删除", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
licInfoDelete(id).then((res: any) => {
if (res.code === 200) {
initLicInfo();
ElMessage({
type: "success",
message: "删除成功!",
});
}
});
})
.then(() => {
licInfoDelete(id).then((res: any) => {
if (res.code === 200) {
initLicInfo();
ElMessage({
type: "success",
message: "删除成功!",
});
}
});
})
.catch(() => {
ElMessage({
type: "info",
message: "取消删除!",
});
});
}
.catch(() => {
ElMessage({
type: "info",
message: "取消删除!",
});
});
};
const handleServiceDelete = (row: any, id: number) => {
ElMessageBox.confirm("请确认删除?", "删除", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
ElMessageBox.confirm("请确认删除?", "删除", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
let index;
row.dockerServices.map((item: any, i: number) => {
if (item.id === id) {
index = i;
}
});
row.dockerServices.splice(index, 1);
const res: any = await licInfoUpdate(row);
if (res.code === 200) {
ElMessage.success("添加成功");
initLicInfo(
searchValue.value,
licInfoTable.pageNo,
licInfoTable.pageSize
);
mirrorDialog.value = false;
}
})
.then(async () => {
let index;
row.dockerServices.map((item: any, i: number) => {
if (item.id === id) {
index = i
}
})
row.dockerServices.splice(index, 1)
const res: any = await licInfoUpdate(row)
if (res.code === 200) {
ElMessage.success('添加成功')
initLicInfo(searchValue.value, licInfoTable.pageNo, licInfoTable.pageSize)
mirrorDialog.value = false
}
})
.catch(() => {
ElMessage({
type: "info",
message: "取消删除!",
});
});
}
.catch(() => {
ElMessage({
type: "info",
message: "取消删除!",
});
});
};
// 导出
const handleExport = (data: any) => {
ElMessageBox.confirm("确认导出文件?", "导出", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
ElMessageBox.confirm("确认导出文件?", "导出", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
licInfoFileCreate(data).then((res: any) => {
const content = res;
const blob = new Blob([content]);
const downloadElement = document.createElement("a");
// 创建下载的链接
const href = window.URL.createObjectURL(blob);
downloadElement.href = href;
// 下载后文件名
downloadElement.download = "lic" + data.macAddress + ".lqlic";
document.body.appendChild(downloadElement);
// 点击下载
downloadElement.click();
// 下载完成移除元素
document.body.removeChild(downloadElement);
// 释放掉blob对象
window.URL.revokeObjectURL(href);
});
})
.then(() => {
licInfoFileCreate(data).then((res: any) => {
const content = res;
const blob = new Blob([content])
const downloadElement = document.createElement('a')
// 创建下载的链接
const href = window.URL.createObjectURL(blob)
downloadElement.href = href
// 下载后文件名
downloadElement.download = 'lic' + data.macAddress + '.lqlic';
document.body.appendChild(downloadElement)
// 点击下载
downloadElement.click()
// 下载完成移除元素
document.body.removeChild(downloadElement)
// 释放掉blob对象
window.URL.revokeObjectURL(href)
});
})
.catch(() => {
ElMessage({
type: "info",
message: "取消导出!",
});
})
}
.catch(() => {
ElMessage({
type: "info",
message: "取消导出!",
});
});
};
const handleClose = () => {
licInfoRef.value?.resetFields()
licInfoForm.formLicInfo = {
dockerServices: [],
macAddress: '',
effectiveTime: '',
fileEffectiveTime: '',
verificationInterval: '',
moduleVerification: '',
lqLicName: ''
}
licInfoForm.dialogVisible = false
}
licInfoRef.value?.resetFields();
licInfoForm.formLicInfo = {
dockerServices: [],
macAddress: "",
effectiveTime: "",
fileEffectiveTime: "",
verificationInterval: "",
moduleVerification: "",
lqLicName: "",
tenantId: "",
domainName: "",
};
licInfoForm.dialogVisible = false;
};
// 列表数据 macAddress?: string, pageNo?: number, pageSize?: number
const initLicInfo = (macAddress?: string, pageNo?: number, pageSize?: number) => {
licInfoList(macAddress, pageNo, pageSize).then((res: any) => {
if (res.code === 200) {
licInfoTable.licInfoData = res.data.records
licInfoTable.total = res.data.total
licInfoTable.loading = false
}
})
}
const initLicInfo = (
macAddress?: string,
pageNo?: number,
pageSize?: number
) => {
licInfoList(macAddress, pageNo, pageSize).then((res: any) => {
if (res.code === 200) {
licInfoTable.licInfoData = res.data.records;
licInfoTable.total = res.data.total;
licInfoTable.loading = false;
}
});
};
initLicInfo()
initLicInfo();
</script>
<style lang="scss" scoped>
:deep(.el-empty) {
padding: 0;
padding: 0;
}
:deep(.el-descriptions__title) {
margin-left: 20px;
margin-left: 20px;
}
:deep(.el-descriptions__extra) {
margin-right: 20px;
margin-right: 20px;
}
:deep(.is-bordered-label) {
width: 100px;
width: 100px;
}
</style>
\ No newline at end of file
</style>
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// vite 提供的操作env配置变量的方法loadEnv
import { loadEnv } from 'vite';
import { loadEnv } from "vite";
// nodejs写法,获取项目目录
import path from 'path';
import path from "path";
//按需要加载
// import AutoImport from 'unplugin-auto-import/vite'
......@@ -11,128 +11,135 @@ import path from 'path';
// import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// import Icons from 'unplugin-icons/vite'
// import IconsResolver from 'unplugin-icons/resolver'
import Inspect from 'vite-plugin-inspect'
import { viteMockServe } from 'vite-plugin-mock'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
const pathSrc = path.resolve(__dirname, 'src')
import Inspect from "vite-plugin-inspect";
import { viteMockServe } from "vite-plugin-mock";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
const pathSrc = path.resolve(__dirname, "src");
// https://vitejs.dev/config/
export default ({ command, mode }) => {
const env = loadEnv(mode, process.cwd())
return defineConfig({
plugins: [
vue(),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]'
}),
viteMockServe({
// default
mockPath: 'mock',
}),
// AutoImport({
// // Auto import functions from Vue, e.g. ref, reactive, toRef...
// // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
// imports: ['vue'],
const env = loadEnv(mode, process.cwd());
return defineConfig({
plugins: [
vue(),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(process.cwd(), "src/assets/icons")],
// 指定symbolId格式
symbolId: "icon-[dir]-[name]",
}),
viteMockServe({
// default
mockPath: "mock",
}),
// AutoImport({
// // Auto import functions from Vue, e.g. ref, reactive, toRef...
// // 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
// imports: ['vue'],
// // Auto import functions from Element Plus, e.g. ElMessage, ElMessageBox... (with style)
// // 自动导入 Element Plus 相关函数,如:ElMessage, ElMessageBox... (带样式)
// resolvers: [
// ElementPlusResolver(),
// // Auto import functions from Element Plus, e.g. ElMessage, ElMessageBox... (with style)
// // 自动导入 Element Plus 相关函数,如:ElMessage, ElMessageBox... (带样式)
// resolvers: [
// ElementPlusResolver(),
// // Auto import icon components
// // 自动导入图标组件
// IconsResolver({
// prefix: 'Icon',
// }),
// ],
// // Auto import icon components
// // 自动导入图标组件
// IconsResolver({
// prefix: 'Icon',
// }),
// ],
// dts: path.resolve(pathSrc, 'auto-imports.d.ts'),
// }),
// dts: path.resolve(pathSrc, 'auto-imports.d.ts'),
// }),
// Components({
// resolvers: [
// // Auto register icon components
// // 自动注册图标组件
// IconsResolver({
// enabledCollections: ['ep'],
// }),
// // Auto register Element Plus components
// // 自动导入 Element Plus 组件
// ElementPlusResolver(),
// ],
// Components({
// resolvers: [
// // Auto register icon components
// // 自动注册图标组件
// IconsResolver({
// enabledCollections: ['ep'],
// }),
// // Auto register Element Plus components
// // 自动导入 Element Plus 组件
// ElementPlusResolver(),
// ],
// dts: path.resolve(pathSrc, 'components.d.ts'),
// }),
// dts: path.resolve(pathSrc, 'components.d.ts'),
// }),
// Icons({
// autoInstall: true,
// }),
// Icons({
// autoInstall: true,
// }),
Inspect(),
],
// 服务器配置
server: {
host: '0.0.0.0',
port: Number(loadEnv(mode, process.cwd()).VITE_APP_PORT),
strictPort: false, // 端口被占用直接退出
https: false, // 默认用http方式
open: true,// 在开发服务器启动时自动在浏览器中打开应用程序
proxy: { // 代理配置
// 字符串简写写法
// '/foo': '',
// 选项写法
"/lic": {
target: 'http://192.168.0.8:8090'
// rewrite: (path) => path.replace(/^\/api/, '')
},
// 正则表达式写法
// '^/fallback/.*': {
// target: 'http://jsonplaceholder.typicode.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/fallback/, '')
// },
},
hmr: {
overlay: true // 屏蔽服务器报错
}
},
resolve: { // 设置项目文件导入路径
alias: {
'@': pathSrc
}
Inspect(),
],
// 服务器配置
server: {
host: "0.0.0.0",
port: Number(loadEnv(mode, process.cwd()).VITE_APP_PORT),
strictPort: false, // 端口被占用直接退出
https: false, // 默认用http方式
open: true, // 在开发服务器启动时自动在浏览器中打开应用程序
proxy: {
// 代理配置
// 字符串简写写法
// '/foo': '',
// 选项写法
"/lic": {
target: "http://192.168.1.27:8090",
// rewrite: (path) => path.replace(/^\/api/, '')
},
css: {
// css预处理器
preprocessorOptions: {
// 引入 var.scss 这样就可以在全局中使用 var.scss中预定义的变量了
// 给导入的路径最后加上 ;
// 正则表达式写法
// '^/fallback/.*': {
// target: 'http://jsonplaceholder.typicode.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/fallback/, '')
// },
},
hmr: {
overlay: true, // 屏蔽服务器报错
},
},
resolve: {
// 设置项目文件导入路径
alias: {
"@": pathSrc,
},
},
css: {
// css预处理器
preprocessorOptions: {
// 引入 var.scss 这样就可以在全局中使用 var.scss中预定义的变量了
// 给导入的路径最后加上 ;
scss: {
charset: false,//防止样式出现警告,中文
additionalData: '@import "@/assets/styles/global.scss";'
}
}
scss: {
charset: false, //防止样式出现警告,中文
additionalData: '@import "@/assets/styles/global.scss";',
},
build: { // 分块打包配置
chunkSizeWarningLimit: 1500, // 分块打包,分解块,将大块分解成更小的块
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
return id.toString().split('node_modules/')[1].split('/')[0].toString();
}
}
}
},
terserOptions: {
compress: {
drop_console: true, // 生产环境移除console
drop_debugger: true // 生产环境移除debugger
}
},
},
build: {
// 分块打包配置
chunkSizeWarningLimit: 1500, // 分块打包,分解块,将大块分解成更小的块
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
return id
.toString()
.split("node_modules/")[1]
.split("/")[0]
.toString();
}
}
})
}
\ No newline at end of file
},
},
},
terserOptions: {
compress: {
drop_console: true, // 生产环境移除console
drop_debugger: true, // 生产环境移除debugger
},
},
},
});
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论