feat: rename inspection point type to personnel type and update dev proxy
This commit is contained in:
@@ -1,19 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryRef"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="巡检点" prop="inspectionPoint">
|
<el-form-item label="巡检点" prop="inspectionPoint">
|
||||||
<el-input v-model="queryParams.inspectionPoint" placeholder="请输入巡检点" clearable @keyup.enter="handleQuery" />
|
<el-input
|
||||||
|
v-model="queryParams.inspectionPoint"
|
||||||
|
placeholder="请输入巡检点"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
<el-button
|
||||||
v-hasPermi="['inspection:manage:add']">新增</el-button>
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['inspection:manage:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -36,7 +55,9 @@
|
|||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</el-col>-->
|
</el-col>-->
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="success" plain :disabled="multiple" @click="getQRCodes">批量生成二维码</el-button>
|
<el-button type="success" plain :disabled="multiple" @click="getQRCodes"
|
||||||
|
>批量生成二维码</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -47,41 +68,100 @@
|
|||||||
v-hasPermi="['inspection:manage:export']"
|
v-hasPermi="['inspection:manage:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>-->
|
</el-col>-->
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="manageList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="manageList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="序号" align="center" prop="id" />
|
<el-table-column label="序号" align="center" prop="id" />
|
||||||
<el-table-column label="巡检点" align="center" prop="inspectionPoint" />
|
<el-table-column label="巡检点" align="center" prop="inspectionPoint" />
|
||||||
<el-table-column label="巡检要求" align="center" prop="inspectionRequirements" />
|
<el-table-column
|
||||||
<!-- 新增:巡检点类型展示 -->
|
label="巡检要求"
|
||||||
<el-table-column label="巡检点类型" align="center" prop="inspectionPointType">
|
align="center"
|
||||||
|
prop="inspectionRequirements"
|
||||||
|
/>
|
||||||
|
<!-- 新增:人员类型展示 -->
|
||||||
|
<el-table-column
|
||||||
|
label="人员类型"
|
||||||
|
align="center"
|
||||||
|
prop="inspectionPointType"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="inspection_point_type" :value="scope.row.inspectionPointType" />
|
<dict-tag
|
||||||
|
:options="inspection_point_type"
|
||||||
|
:value="scope.row.inspectionPointType"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="巡检点状态" align="center" prop="inspectionStatus">
|
<el-table-column
|
||||||
|
label="巡检点状态"
|
||||||
|
align="center"
|
||||||
|
prop="inspectionStatus"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch v-model="scope.row.inspectionStatus" :active-value="'1'" :inactive-value="'0'" active-text="开"
|
<el-switch
|
||||||
inactive-text="关" class="ml-2" @change="switchChange(scope.row)"
|
v-model="scope.row.inspectionStatus"
|
||||||
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" />
|
:active-value="'1'"
|
||||||
|
:inactive-value="'0'"
|
||||||
|
active-text="开"
|
||||||
|
inactive-text="关"
|
||||||
|
class="ml-2"
|
||||||
|
@change="switchChange(scope.row)"
|
||||||
|
style="
|
||||||
|
--el-switch-on-color: #13ce66;
|
||||||
|
--el-switch-off-color: #ff4949;
|
||||||
|
"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
<el-button
|
||||||
v-hasPermi="['inspection:manage:edit']">修改</el-button>
|
link
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
type="primary"
|
||||||
v-hasPermi="['inspection:manage:remove']">删除</el-button>
|
icon="Edit"
|
||||||
<el-button link type="primary" icon="FullScreen" @click="getQRCode(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['inspection:manage:code']">生成二维码</el-button>
|
v-hasPermi="['inspection:manage:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['inspection:manage:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
icon="FullScreen"
|
||||||
|
@click="getQRCode(scope.row)"
|
||||||
|
v-hasPermi="['inspection:manage:code']"
|
||||||
|
>生成二维码</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
<pagination
|
||||||
@pagination="getList" />
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改巡检点管理对话框 -->
|
<!-- 添加或修改巡检点管理对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
@@ -90,18 +170,37 @@
|
|||||||
<el-input v-model="form.inspectionPoint" placeholder="请输入巡检点" />
|
<el-input v-model="form.inspectionPoint" placeholder="请输入巡检点" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="巡检要求" prop="inspectionRequirements">
|
<el-form-item label="巡检要求" prop="inspectionRequirements">
|
||||||
<el-input v-model="form.inspectionRequirements" placeholder="请输入巡检要求" type="textarea" />
|
<el-input
|
||||||
|
v-model="form.inspectionRequirements"
|
||||||
|
placeholder="请输入巡检要求"
|
||||||
|
type="textarea"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 新增:巡检点类型选择 -->
|
<!-- 新增:人员类型选择 -->
|
||||||
<el-form-item label="巡检点类型" prop="inspectionPointType">
|
<el-form-item label="人员类型" prop="inspectionPointType">
|
||||||
<el-select v-model="form.inspectionPointType" placeholder="请选择巡检点类型">
|
<el-select
|
||||||
<el-option v-for="dict in inspection_point_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
v-model="form.inspectionPointType"
|
||||||
|
placeholder="请选择人员类型"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in inspection_point_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="巡检点状态" prop="inspectionStatus">
|
<el-form-item label="巡检点状态" prop="inspectionStatus">
|
||||||
<el-select v-model="form.inspectionStatus" placeholder="请选择巡检点状态">
|
<el-select
|
||||||
<el-option v-for="dict in inspection_point_status" :key="dict.value" :label="dict.label"
|
v-model="form.inspectionStatus"
|
||||||
:value="dict.value"></el-option>
|
placeholder="请选择巡检点状态"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in inspection_point_status"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -112,7 +211,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<QRCodeDownloader ref="qrCodeDownloaderRef" @qrCodeGenerated="handleQRCodeGenerated"></QRCodeDownloader>
|
<QRCodeDownloader
|
||||||
|
ref="qrCodeDownloaderRef"
|
||||||
|
@qrCodeGenerated="handleQRCodeGenerated"
|
||||||
|
></QRCodeDownloader>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -122,7 +224,7 @@ import {
|
|||||||
getManage,
|
getManage,
|
||||||
delManage,
|
delManage,
|
||||||
addManage,
|
addManage,
|
||||||
updateManage
|
updateManage,
|
||||||
} from "@/api/inspection/manage";
|
} from "@/api/inspection/manage";
|
||||||
|
|
||||||
import QRCodeDownloader from "@/components/QRCode/QRCodeDownloader.vue";
|
import QRCodeDownloader from "@/components/QRCode/QRCodeDownloader.vue";
|
||||||
@@ -130,7 +232,7 @@ import { ref, onMounted, onUnmounted, nextTick } from "vue";
|
|||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { inspection_point_status } = proxy.useDict("inspection_point_status");
|
const { inspection_point_status } = proxy.useDict("inspection_point_status");
|
||||||
// 新增:巡检点类型字典
|
// 新增:人员类型字典
|
||||||
const { inspection_point_type } = proxy.useDict("inspection_point_type");
|
const { inspection_point_type } = proxy.useDict("inspection_point_type");
|
||||||
// 子组件
|
// 子组件
|
||||||
const qrCodeDownloaderRef = ref(null);
|
const qrCodeDownloaderRef = ref(null);
|
||||||
@@ -154,23 +256,23 @@ const data = reactive({
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
inspectionPoint: null
|
inspectionPoint: null,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
inspectionPoint: [
|
inspectionPoint: [
|
||||||
{ required: true, message: "巡检点不能为空", trigger: "blur" }
|
{ required: true, message: "巡检点不能为空", trigger: "blur" },
|
||||||
],
|
],
|
||||||
inspectionRequirements: [
|
inspectionRequirements: [
|
||||||
{ required: true, message: "巡检要求不能为空", trigger: "blur" }
|
{ required: true, message: "巡检要求不能为空", trigger: "blur" },
|
||||||
],
|
],
|
||||||
// 新增:类型为必填
|
// 新增:类型为必填
|
||||||
inspectionPointType: [
|
inspectionPointType: [
|
||||||
{ required: true, message: "巡检点类型不能为空", trigger: "change" }
|
{ required: true, message: "人员类型不能为空", trigger: "change" },
|
||||||
],
|
],
|
||||||
inspectionStatus: [
|
inspectionStatus: [
|
||||||
{ required: true, message: "巡检点状态不能为空", trigger: "change" }
|
{ required: true, message: "巡检点状态不能为空", trigger: "change" },
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
@@ -178,7 +280,7 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
// 开关
|
// 开关
|
||||||
function switchChange(data) {
|
function switchChange(data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
updateManage(data).then(response => {
|
updateManage(data).then((response) => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
@@ -187,7 +289,7 @@ function switchChange(data) {
|
|||||||
/** 查询巡检点管理列表 */
|
/** 查询巡检点管理列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listManage(queryParams.value).then(response => {
|
listManage(queryParams.value).then((response) => {
|
||||||
manageList.value = response.rows;
|
manageList.value = response.rows;
|
||||||
total.value = response.total;
|
total.value = response.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@@ -209,7 +311,7 @@ function reset() {
|
|||||||
// 新增:重置类型字段
|
// 新增:重置类型字段
|
||||||
inspectionPointType: null,
|
inspectionPointType: null,
|
||||||
inspectionStatus: null,
|
inspectionStatus: null,
|
||||||
inspectionQrCode: null
|
inspectionQrCode: null,
|
||||||
};
|
};
|
||||||
proxy.resetForm("manageRef");
|
proxy.resetForm("manageRef");
|
||||||
}
|
}
|
||||||
@@ -229,8 +331,8 @@ function resetQuery() {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
console.log(selection);
|
console.log(selection);
|
||||||
ids.value = selection.map(item => item.id);
|
ids.value = selection.map((item) => item.id);
|
||||||
inspectionPoint.value = selection.map(item => item.inspectionPoint);
|
inspectionPoint.value = selection.map((item) => item.inspectionPoint);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
}
|
}
|
||||||
@@ -246,7 +348,7 @@ function handleAdd() {
|
|||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset();
|
reset();
|
||||||
const _id = row.id || ids.value;
|
const _id = row.id || ids.value;
|
||||||
getManage(_id).then(response => {
|
getManage(_id).then((response) => {
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "修改巡检点管理";
|
title.value = "修改巡检点管理";
|
||||||
@@ -255,16 +357,16 @@ function handleUpdate(row) {
|
|||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["manageRef"].validate(valid => {
|
proxy.$refs["manageRef"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.id != null) {
|
if (form.value.id != null) {
|
||||||
updateManage(form.value).then(response => {
|
updateManage(form.value).then((response) => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addManage(form.value).then(response => {
|
addManage(form.value).then((response) => {
|
||||||
proxy.$modal.msgSuccess("新增成功");
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
@@ -286,7 +388,7 @@ function handleDelete(row) {
|
|||||||
getList();
|
getList();
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
})
|
})
|
||||||
.catch(() => { });
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 生成二维码 */
|
/** 生成二维码 */
|
||||||
@@ -297,7 +399,7 @@ function getQRCode(row) {
|
|||||||
) {
|
) {
|
||||||
qrCodeDownloaderRef.value.generateQRCodeWithTextAndNotifyParent(
|
qrCodeDownloaderRef.value.generateQRCodeWithTextAndNotifyParent(
|
||||||
row.id + "",
|
row.id + "",
|
||||||
row.inspectionPoint
|
row.inspectionPoint,
|
||||||
);
|
);
|
||||||
//qrCodeDownloaderRef.value.Download(row.inspectionPoint);
|
//qrCodeDownloaderRef.value.Download(row.inspectionPoint);
|
||||||
}
|
}
|
||||||
@@ -329,7 +431,7 @@ function getQRCodes() {
|
|||||||
) {
|
) {
|
||||||
qrCodeDownloaderRef.value.generateQRCodeWithTextAndNotifyParent(
|
qrCodeDownloaderRef.value.generateQRCodeWithTextAndNotifyParent(
|
||||||
String(id),
|
String(id),
|
||||||
inspectionPoint.value[index]
|
inspectionPoint.value[index],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -345,9 +447,9 @@ function handleExport() {
|
|||||||
proxy.download(
|
proxy.download(
|
||||||
"inspection/manage/export",
|
"inspection/manage/export",
|
||||||
{
|
{
|
||||||
...queryParams.value
|
...queryParams.value,
|
||||||
},
|
},
|
||||||
`manage_${new Date().getTime()}.xlsx`
|
`manage_${new Date().getTime()}.xlsx`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,72 +1,78 @@
|
|||||||
import path from 'path'
|
import path from "path";
|
||||||
import { defineConfig, loadEnv } from 'vite'
|
import { defineConfig, loadEnv } from "vite";
|
||||||
import createVitePlugins from './vite/plugins'
|
import createVitePlugins from "./vite/plugins";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode, command }) => {
|
export default defineConfig(({ mode, command }) => {
|
||||||
const env = loadEnv(mode, process.cwd())
|
const env = loadEnv(mode, process.cwd());
|
||||||
const { VITE_APP_ENV, VITE_APP_CAS_ENABLE } = env
|
const { VITE_APP_ENV, VITE_APP_CAS_ENABLE } = env;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// 部署生产环境和开发环境下的URL.
|
// 部署生产环境和开发环境下的URL.
|
||||||
// 根据 .env 中的 CAS 开关动态设置 base 路径
|
// 根据 .env 中的 CAS 开关动态设置 base 路径
|
||||||
// 注意:不要从 src/settings 引入,因为 vite 配置运行在 Node 环境,无法使用 import.meta.env
|
// 注意:不要从 src/settings 引入,因为 vite 配置运行在 Node 环境,无法使用 import.meta.env
|
||||||
base: VITE_APP_ENV === 'production' ? ((VITE_APP_CAS_ENABLE === 'true') ? '/cas/' : '/srs/') : '/',
|
base:
|
||||||
plugins: createVitePlugins(env, command === 'build'),
|
VITE_APP_ENV === "production"
|
||||||
|
? VITE_APP_CAS_ENABLE === "true"
|
||||||
|
? "/cas/"
|
||||||
|
: "/srs/"
|
||||||
|
: "/",
|
||||||
|
plugins: createVitePlugins(env, command === "build"),
|
||||||
resolve: {
|
resolve: {
|
||||||
// https://cn.vitejs.dev/config/#resolve-alias
|
// https://cn.vitejs.dev/config/#resolve-alias
|
||||||
alias: {
|
alias: {
|
||||||
'~': path.resolve(__dirname, './'),
|
"~": path.resolve(__dirname, "./"),
|
||||||
'@': path.resolve(__dirname, './src')
|
"@": path.resolve(__dirname, "./src"),
|
||||||
},
|
},
|
||||||
// https://cn.vitejs.dev/config/#resolve-extensions
|
// https://cn.vitejs.dev/config/#resolve-extensions
|
||||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: true,
|
host: true,
|
||||||
open: true,
|
open: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
// https://cn.vitejs.dev/config/#server-proxy
|
// https://cn.vitejs.dev/config/#server-proxy
|
||||||
'/dev-api': {
|
"/dev-api": {
|
||||||
// target: 'http://localhost:8080', // 测试
|
target: "http://localhost:8080", // 测试
|
||||||
target: 'http://172.16.129.101:8080', // 正式环境
|
// target: 'http://172.16.129.101:8080', // 正式环境
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
rewrite: (p) => p.replace(/^\/dev-api/, ""),
|
||||||
},
|
},
|
||||||
// 添加对第三方 API 的代理配置
|
// 添加对第三方 API 的代理配置
|
||||||
'/api/v1/jssdk/upload': {
|
"/api/v1/jssdk/upload": {
|
||||||
target: 'https://px.effirst.com',
|
target: "https://px.effirst.com",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (p) => p.replace(/^\/api\/v1\/jssdk\/upload/, '/api/v1/jssdk/upload')
|
rewrite: (p) =>
|
||||||
}
|
p.replace(/^\/api\/v1\/jssdk\/upload/, "/api/v1/jssdk/upload"),
|
||||||
}
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
|
// fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
|
||||||
css: {
|
css: {
|
||||||
postcss: {
|
postcss: {
|
||||||
plugins: [
|
plugins: [
|
||||||
{
|
{
|
||||||
postcssPlugin: 'internal:charset-removal',
|
postcssPlugin: "internal:charset-removal",
|
||||||
AtRule: {
|
AtRule: {
|
||||||
charset: (atRule) => {
|
charset: (atRule) => {
|
||||||
if (atRule.name === 'charset') {
|
if (atRule.name === "charset") {
|
||||||
atRule.remove();
|
atRule.remove();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
target: 'es2015', // 指定编译目标
|
target: "es2015", // 指定编译目标
|
||||||
minify: 'terser',
|
minify: "terser",
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
compress: {
|
compress: {
|
||||||
drop_console: true,
|
drop_console: true,
|
||||||
drop_debugger: true,
|
drop_debugger: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user