fix:sug-gas
This commit is contained in:
parent
f1721d8b71
commit
f1e6740b0d
@ -2,6 +2,7 @@
|
|||||||
VITE_PORT = 9528
|
VITE_PORT = 9528
|
||||||
VITE_MODE = 'DEV'
|
VITE_MODE = 'DEV'
|
||||||
VITE_APP_MIAN = 'daimp-front-main'
|
VITE_APP_MIAN = 'daimp-front-main'
|
||||||
|
VITE_APP_MIAN_URL = 'http://localhost:9000'
|
||||||
VITE_APP_NAME = 'sub-government-affairs-service'
|
VITE_APP_NAME = 'sub-government-affairs-service'
|
||||||
VITE_APP_BASE_API = '/apis'
|
VITE_APP_BASE_API = '/apis'
|
||||||
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# 生产环境
|
# 生产环境
|
||||||
VITE_MODE = 'PRO'
|
VITE_MODE = 'PRO'
|
||||||
VITE_APP_MIAN = 'daimp-front-main'
|
VITE_APP_MIAN = 'daimp-front-main'
|
||||||
|
VITE_APP_MIAN_URL = 'http://192.168.18.99:88'
|
||||||
VITE_APP_NAME = 'sub-government-affairs-service'
|
VITE_APP_NAME = 'sub-government-affairs-service'
|
||||||
# 接口
|
# 接口
|
||||||
VITE_APP_BASE_API = '/apis'
|
VITE_APP_BASE_API = '/apis'
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<title>政务服务</title>
|
<title>政务服务</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="sub-app"></div>
|
||||||
<script type="module" src="/src/main.js"></script>
|
<script type="module" src="/src/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --mode development",
|
"dev": "vite --mode development",
|
||||||
"build": "vite build --mode production",
|
"build": "vite build --mode production",
|
||||||
"build:dev": "vite build --mode dev",
|
"test": "vite build --mode test",
|
||||||
"build:qa": "vite build --mode qa",
|
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"format": "prettier --write 'src/**/*.{vue,ts,tsx,js,jsx,css,less,scss,json,md}'",
|
"format": "prettier --write 'src/**/*.{vue,ts,tsx,js,jsx,css,less,scss,json,md}'",
|
||||||
"eslint": "npx eslint --init",
|
"eslint": "npx eslint --init",
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
import request from '@/utils/axios';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Title: 登录
|
|
||||||
*/
|
|
||||||
export function Login(params, token) {
|
|
||||||
return request('/store/login', {
|
|
||||||
method: 'POST',
|
|
||||||
data: null,
|
|
||||||
params: params,
|
|
||||||
headers: {
|
|
||||||
'fairies-auth-token': token,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Title: 登出
|
|
||||||
*/
|
|
||||||
export function LogOut() {
|
|
||||||
return request('/store/logout', {
|
|
||||||
method: 'POST',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Title: 验证码
|
|
||||||
*/
|
|
||||||
export function GetCaptcha() {
|
|
||||||
return request('/store/login-captcha', {
|
|
||||||
method: 'GET',
|
|
||||||
responseType: 'arraybuffer',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Title: 获取菜单
|
|
||||||
*/
|
|
||||||
export function GetMenus() {
|
|
||||||
return request('/store/self/menu', {
|
|
||||||
method: 'GET',
|
|
||||||
});
|
|
||||||
}
|
|
61
sub-government-affairs-service/src/apis/plan.js
Normal file
61
sub-government-affairs-service/src/apis/plan.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import request from '@/utils/axios';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title: 列表
|
||||||
|
*/
|
||||||
|
export function GetEntityList(params = {}) {
|
||||||
|
return request('/land-resource/annualManage/page', {
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title: 新增
|
||||||
|
*/
|
||||||
|
export function AddEntity(data = {}) {
|
||||||
|
return request('/land-resource/annualManage/save', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title: 修改
|
||||||
|
*/
|
||||||
|
export function UpdateEntity(data = {}) {
|
||||||
|
return request('/land-resource/annualManage/edit', {
|
||||||
|
method: 'PUT',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title: 审核
|
||||||
|
*/
|
||||||
|
export function AuditEntity(data = {}) {
|
||||||
|
return request('/land-resource/annualManage/exam', {
|
||||||
|
method: 'PUT',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title: 删除
|
||||||
|
*/
|
||||||
|
export function DeleteEntity(params = {}) {
|
||||||
|
return request(`/land-resource/annualManage/delete/${params.id}`, {
|
||||||
|
method: 'DELETE',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title: 导出
|
||||||
|
*/
|
||||||
|
export function ExportEntity(params = {}) {
|
||||||
|
return request('/land-resource/annualManage/export', {
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
responseType: 'blob',
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="state.visible"
|
||||||
|
draggable
|
||||||
|
title="溯源码"
|
||||||
|
width="40%"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
@close="onClose"
|
||||||
|
>
|
||||||
|
<div class="code-panel">
|
||||||
|
<div class="code-panel-picture">
|
||||||
|
<el-image style="width: 200px; height: 200px" :src="row.orCodeUrl" fit="cover" lazy />
|
||||||
|
</div>
|
||||||
|
<el-button type="primary" @click="downloadFile(row.orCodeUrl, `${row.productName}-溯源码.png`, 'image')"> 下载溯源码</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script setup name="code-dialog">
|
||||||
|
import { reactive } from 'vue';
|
||||||
|
import { downloadFile } from '@/utils';
|
||||||
|
const props = defineProps({
|
||||||
|
row: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['on-close']);
|
||||||
|
|
||||||
|
const state = reactive({
|
||||||
|
visible: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const onClose = () => {
|
||||||
|
state.visible = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show: () => {
|
||||||
|
state.visible = true;
|
||||||
|
},
|
||||||
|
hide: () => {
|
||||||
|
onClose();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.code {
|
||||||
|
&-panel {
|
||||||
|
padding-bottom: 40px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -3,7 +3,7 @@
|
|||||||
* @Author: zenghua.wang
|
* @Author: zenghua.wang
|
||||||
* @Date: 2023-06-20 14:29:45
|
* @Date: 2023-06-20 14:29:45
|
||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2025-02-14 11:39:56
|
* @LastEditTime: 2025-02-18 09:48:18
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<el-dropdown class="layout-avatar">
|
<el-dropdown class="layout-avatar">
|
||||||
@ -33,7 +33,7 @@ import { useUserStore } from '@/store/modules/user';
|
|||||||
import { useTagsViewStore } from '@/store/modules/tagsView';
|
import { useTagsViewStore } from '@/store/modules/tagsView';
|
||||||
import { usePermissionStore } from '@/store/modules/permission';
|
import { usePermissionStore } from '@/store/modules/permission';
|
||||||
import { getAssetsFile } from '@/utils';
|
import { getAssetsFile } from '@/utils';
|
||||||
import { LogOut } from '@/apis/login';
|
import { Logout } from '#/apis/login';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const UserStore = useUserStore();
|
const UserStore = useUserStore();
|
||||||
@ -49,7 +49,7 @@ const logOut = async () => {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
LogOut().then((res) => {
|
Logout().then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
UserStore.logout();
|
UserStore.logout();
|
||||||
TagsViewStore.clearVisitedView();
|
TagsViewStore.clearVisitedView();
|
||||||
|
@ -7,22 +7,55 @@
|
|||||||
*/
|
*/
|
||||||
import 'virtual:svg-icons-register';
|
import 'virtual:svg-icons-register';
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
|
import { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
import router from './router';
|
import router from './router';
|
||||||
import pinia from './store';
|
import pinia from './store';
|
||||||
import ElementPlus from 'element-plus';
|
import ElementPlus from 'element-plus';
|
||||||
import 'element-plus/dist/index.css';
|
import 'element-plus/dist/index.css';
|
||||||
import Avue from '@smallwei/avue';
|
// import Avue from '@smallwei/avue';
|
||||||
import '@smallwei/avue/lib/index.css';
|
// import '@smallwei/avue/lib/index.css';
|
||||||
import './utils/permission';
|
|
||||||
import { registerDirective } from './directives';
|
import { registerDirective } from './directives';
|
||||||
import { registerGlobalComponents } from './plugins/globalComponents';
|
import { registerGlobalComponents } from './plugins/globalComponents';
|
||||||
import { registerElIcons } from './plugins/icon';
|
import { registerElIcons } from './plugins/icon';
|
||||||
import { registerMicroApps } from './plugins/micro';
|
// import { registerMicroApps } from './plugins/micro';
|
||||||
|
import './utils/permission';
|
||||||
|
|
||||||
const app = createApp(App);
|
const registerMicroApps = () => {
|
||||||
app.use(pinia).use(router).use(ElementPlus).use(Avue);
|
let app = null;
|
||||||
registerGlobalComponents(app);
|
const initQiankun = () => {
|
||||||
registerElIcons(app);
|
renderWithQiankun({
|
||||||
registerDirective(app);
|
bootstrap() {
|
||||||
registerMicroApps(app);
|
console.log('bootstrap');
|
||||||
|
},
|
||||||
|
mount(props) {
|
||||||
|
console.log('mount', props);
|
||||||
|
render(props);
|
||||||
|
},
|
||||||
|
update(props) {
|
||||||
|
console.log('update', props);
|
||||||
|
},
|
||||||
|
unmount(props) {
|
||||||
|
console.log('unmount', props);
|
||||||
|
app = null;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const render = async ({ container }) => {
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
// if (!container) {
|
||||||
|
// console.error('挂载容器不存在');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
app = createApp(App);
|
||||||
|
app.use(pinia).use(router).use(ElementPlus);
|
||||||
|
registerGlobalComponents(app);
|
||||||
|
registerElIcons(app);
|
||||||
|
registerDirective(app);
|
||||||
|
registerMicroApps(app);
|
||||||
|
app.mount(container.querySelector('#sub-app') || '#sub-app');
|
||||||
|
};
|
||||||
|
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQiankun() : render({});
|
||||||
|
};
|
||||||
|
|
||||||
|
registerMicroApps();
|
||||||
|
@ -24,7 +24,7 @@ export const registerMicroApps = (app) => {
|
|||||||
console.error('挂载容器不存在');
|
console.error('挂载容器不存在');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
app.mount(container.querySelector('#app') || '#app');
|
app.mount(container.querySelector('#sub-app') || '#sub-app');
|
||||||
};
|
};
|
||||||
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQiankun() : render({});
|
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQiankun() : render({});
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Author: zenghua.wang
|
* @Author: zenghua.wang
|
||||||
* @Date: 2023-06-20 11:48:41
|
* @Date: 2023-06-20 11:48:41
|
||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2025-02-17 11:47:53
|
* @LastEditTime: 2025-02-18 11:22:07
|
||||||
*/
|
*/
|
||||||
import { createRouter, createWebHistory } from 'vue-router';
|
import { createRouter, createWebHistory } from 'vue-router';
|
||||||
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
||||||
@ -27,6 +27,16 @@ export const constantRoutes = [
|
|||||||
component: () => import('@/views/error/403.vue'),
|
component: () => import('@/views/error/403.vue'),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// path: '/login',
|
||||||
|
// name: 'login',
|
||||||
|
// component: () => import('@/views/error/404.vue'),
|
||||||
|
// hidden: true,
|
||||||
|
// meta: {
|
||||||
|
// title: '登录',
|
||||||
|
// icon: 'Login',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
name: 'layout',
|
name: 'layout',
|
||||||
@ -42,7 +52,7 @@ export const constantRoutes = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// ...resourceRouter,
|
...resourceRouter,
|
||||||
...plantingAndBreedingRouter,
|
...plantingAndBreedingRouter,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -50,9 +60,9 @@ export const constantRoutes = [
|
|||||||
* @Title notFoundRouter(找不到路由)
|
* @Title notFoundRouter(找不到路由)
|
||||||
*/
|
*/
|
||||||
export const notFoundRouter = {
|
export const notFoundRouter = {
|
||||||
// path: '/:pathMatch(.*)',
|
path: '/:pathMatch(.*)',
|
||||||
// name: 'notFound',
|
name: 'notFound',
|
||||||
// redirect: '/404',
|
redirect: '/404',
|
||||||
};
|
};
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
@ -15,12 +15,12 @@ export default [
|
|||||||
name: 'grid',
|
name: 'grid',
|
||||||
meta: { title: '网格化管理', icon: 'Document' },
|
meta: { title: '网格化管理', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: '/grid2',
|
// path: '/annual-plan',
|
||||||
component: () => import('@/views/resource/grid/index.vue'),
|
// component: () => import('@/views/resource/plan/index.vue'),
|
||||||
name: 'grid2',
|
// name: 'annual-plan',
|
||||||
meta: { title: '网格化管理2', icon: 'Document' },
|
// meta: { title: '年度计划', icon: 'Document' },
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -3,7 +3,7 @@ import { GenKey } from '@/config';
|
|||||||
import { isEmpty, encode, decode } from '@/utils';
|
import { isEmpty, encode, decode } from '@/utils';
|
||||||
|
|
||||||
export const useUserStore = defineStore({
|
export const useUserStore = defineStore({
|
||||||
id: GenKey('user_store'),
|
id: GenKey('userStore'),
|
||||||
state: () => ({
|
state: () => ({
|
||||||
token: null,
|
token: null,
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
@ -52,14 +52,14 @@ export const useUserStore = defineStore({
|
|||||||
this.currentOrg = null;
|
this.currentOrg = null;
|
||||||
this.orgList = [];
|
this.orgList = [];
|
||||||
this.menus = [];
|
this.menus = [];
|
||||||
localStorage.removeItem(GenKey('user_store'));
|
localStorage.removeItem(GenKey('userStore'));
|
||||||
},
|
},
|
||||||
clear() {
|
clear() {
|
||||||
localStorage.removeItem(GenKey('user_store'));
|
localStorage.removeItem(GenKey('userStore'));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
persist: {
|
persist: {
|
||||||
key: GenKey('user_store'),
|
key: GenKey('userStore'),
|
||||||
storage: window.localStorage,
|
storage: window.localStorage,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Author: zenghua.wang
|
* @Author: zenghua.wang
|
||||||
* @Date: 2022-02-23 21:12:37
|
* @Date: 2022-02-23 21:12:37
|
||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2025-02-13 14:47:02
|
* @LastEditTime: 2025-02-18 09:47:41
|
||||||
*/
|
*/
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ElNotification } from 'element-plus';
|
import { ElNotification } from 'element-plus';
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2024-02-26 13:54:43
|
* @LastEditTime: 2024-02-26 13:54:43
|
||||||
*/
|
*/
|
||||||
|
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
||||||
import NProgress from 'nprogress';
|
import NProgress from 'nprogress';
|
||||||
import 'nprogress/nprogress.css';
|
import 'nprogress/nprogress.css';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
@ -13,8 +14,8 @@ import { usePermissionStore } from '@/store/modules/permission';
|
|||||||
|
|
||||||
NProgress.configure({ showSpinner: false });
|
NProgress.configure({ showSpinner: false });
|
||||||
|
|
||||||
const whiteList = ['/login', '/auth-redirect']; // 设置白名单
|
const { VITE_APP_MIAN_URL } = import.meta.env;
|
||||||
|
const whiteList = [];
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
if (typeof to.meta.title === 'string') {
|
if (typeof to.meta.title === 'string') {
|
||||||
@ -26,28 +27,30 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
console.log('sub', hasToken);
|
console.log('sub', hasToken);
|
||||||
if (hasToken) {
|
if (hasToken) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
// 如果已登录,请重定向到主页
|
|
||||||
next({ path: '/' });
|
next({ path: '/' });
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
const PermissionStore = usePermissionStore();
|
const PermissionStore = usePermissionStore();
|
||||||
// 路由添加进去了没有及时更新 需要重新进去一次拦截
|
|
||||||
if (!PermissionStore.routes.length) {
|
if (!PermissionStore.routes.length) {
|
||||||
// 获取权限列表进行接口访问 因为这里页面要切换权限
|
|
||||||
const accessRoutes = await PermissionStore.generateRoutes(userStore.roles);
|
const accessRoutes = await PermissionStore.generateRoutes(userStore.roles);
|
||||||
accessRoutes.forEach((item) => router.addRoute(item)); // 动态添加访问路由表
|
accessRoutes.forEach((item) => router.addRoute(item));
|
||||||
next({ ...to, replace: true }); // 这里相当于push到一个页面 不在进入路由拦截
|
next({ ...to, replace: true });
|
||||||
} else {
|
} else {
|
||||||
next(); // 如果不传参数就会重新执行路由拦截,重新进到这里
|
next();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
next(`/login?redirect=${to.path}`);
|
next(`/login?redirect=${to.path}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
NProgress.done();
|
||||||
if (whiteList.indexOf(to.path) !== -1) {
|
if (whiteList.indexOf(to.path) !== -1) {
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
|
if (qiankunWindow.__POWERED_BY_QIANKUN__) {
|
||||||
|
window.location.href = VITE_APP_MIAN_URL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
next(`/login?redirect=${to.path}`);
|
next(`/login?redirect=${to.path}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,13 +129,13 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '省',
|
label: '省',
|
||||||
prop: 'province',
|
prop: 'provinceCode',
|
||||||
hide: true,
|
hide: true,
|
||||||
display: false,
|
display: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '市',
|
label: '市',
|
||||||
prop: 'city',
|
prop: 'cityCode',
|
||||||
hide: true,
|
hide: true,
|
||||||
display: false,
|
display: false,
|
||||||
},
|
},
|
||||||
@ -165,11 +165,6 @@ const state = reactive({
|
|||||||
rows: 4,
|
rows: 4,
|
||||||
overHidden: true,
|
overHidden: true,
|
||||||
width: 200,
|
width: 200,
|
||||||
rules: {
|
|
||||||
required: true,
|
|
||||||
message: '请输入',
|
|
||||||
trigger: 'blur',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '创建时间',
|
label: '创建时间',
|
||||||
@ -272,9 +267,10 @@ const rowView = (row) => {
|
|||||||
|
|
||||||
const setCity = (row) => {
|
const setCity = (row) => {
|
||||||
if (!isEmpty(row.cities)) {
|
if (!isEmpty(row.cities)) {
|
||||||
row.province = row?.cities[0] ?? null;
|
row.provinceCode = row?.cities[0] ?? null;
|
||||||
row.city = row?.cities[1] ?? null;
|
row.cityCode = row?.cities[1] ?? null;
|
||||||
row.county = row?.cities[2] ?? null;
|
row.gridAreaCode = row?.cities[2] ?? null;
|
||||||
|
row.townCode = row?.cities[3] ?? null;
|
||||||
row.village = row?.cities[3] ?? null;
|
row.village = row?.cities[3] ?? null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -300,7 +296,7 @@ const rowSave = (row, done, loading) => {
|
|||||||
|
|
||||||
// 编辑
|
// 编辑
|
||||||
const rowEdit = (row) => {
|
const rowEdit = (row) => {
|
||||||
row.cities = compact([row.province, row.city, row.county ?? '', row.village ?? '']);
|
row.cities = compact([row.provinceCode, row.cityCode, row.gridAreaCode ?? '', row.townCode ?? '', row.village ?? '']);
|
||||||
crudRef.value.rowEdit(row);
|
crudRef.value.rowEdit(row);
|
||||||
};
|
};
|
||||||
const rowUpdate = (row, index, done, loading) => {
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
|
383
sub-government-affairs-service/src/views/resource/plan/index.vue
Normal file
383
sub-government-affairs-service/src/views/resource/plan/index.vue
Normal file
@ -0,0 +1,383 @@
|
|||||||
|
<template>
|
||||||
|
<div class="custom-page">
|
||||||
|
<avue-crud
|
||||||
|
ref="crudRef"
|
||||||
|
v-model="state.form"
|
||||||
|
v-model:search="state.query"
|
||||||
|
v-model:page="state.pageData"
|
||||||
|
:table-loading="state.loading"
|
||||||
|
:data="state.data"
|
||||||
|
:option="state.options"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@search-reset="searchChange"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@row-save="rowSave"
|
||||||
|
@row-update="rowUpdate"
|
||||||
|
@row-del="rowDel"
|
||||||
|
>
|
||||||
|
<template #menu-left>
|
||||||
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import { isEmpty, downloadFile } from '@/utils';
|
||||||
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
import { compact } from 'lodash';
|
||||||
|
import { GetEntityList, AddEntity, AuditEntity, UpdateEntity, DeleteEntity, ExportEntity } from '@/apis/plan';
|
||||||
|
|
||||||
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
|
const app = useApp();
|
||||||
|
const UserStore = useUserStore();
|
||||||
|
const crudRef = ref(null);
|
||||||
|
const state = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtnText: '添加计划',
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: '计划编号',
|
||||||
|
prop: 'id',
|
||||||
|
search: true,
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: true,
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '计划名称',
|
||||||
|
prop: 'planName',
|
||||||
|
search: true,
|
||||||
|
width: 200,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种植面积(亩)',
|
||||||
|
prop: 'plantingArea',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
formatter: (row) => {
|
||||||
|
return row?.plantingArea ? row.plantingArea + '亩' : '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种植月份',
|
||||||
|
prop: 'plantingMonths',
|
||||||
|
type: 'select',
|
||||||
|
dicData: [
|
||||||
|
{ label: '1月', value: '1月' },
|
||||||
|
{ label: '2月', value: '2月' },
|
||||||
|
{ label: '3月', value: '3月' },
|
||||||
|
{ label: '4月', value: '4月' },
|
||||||
|
{ label: '5月', value: '5月' },
|
||||||
|
{ label: '6月', value: '6月' },
|
||||||
|
{ label: '7月', value: '7月' },
|
||||||
|
{ label: '8月', value: '8月' },
|
||||||
|
{ label: '9月', value: '9月' },
|
||||||
|
{ label: '10月', value: '10月' },
|
||||||
|
{ label: '11月', value: '11月' },
|
||||||
|
{ label: '12月', value: '12月' },
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '生长周期',
|
||||||
|
prop: 'growthCycle',
|
||||||
|
labelTip: '如:10周-12周',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '计划进度',
|
||||||
|
prop: 'planProgress',
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '状态',
|
||||||
|
prop: 'planStatus',
|
||||||
|
type: 'select',
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: true,
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: '待提交',
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '已提交',
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '审核通过',
|
||||||
|
value: 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '审核拒绝',
|
||||||
|
value: 4,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '备注',
|
||||||
|
prop: 'note',
|
||||||
|
type: 'textarea',
|
||||||
|
span: 24,
|
||||||
|
rows: 4,
|
||||||
|
overHidden: true,
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '查看',
|
||||||
|
icon: 'view',
|
||||||
|
event: ({ row }) => rowView(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => rowEdit(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => rowDel(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '审核通过',
|
||||||
|
type: 'success',
|
||||||
|
icon: 'check',
|
||||||
|
event: ({ row }) => rowCheck(row, 4),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '审核拒绝',
|
||||||
|
type: 'danger',
|
||||||
|
icon: 'close',
|
||||||
|
event: ({ row }) => rowCheck(row, 3),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
minWeek: null,
|
||||||
|
maxWeek: null,
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 加载
|
||||||
|
const loadData = () => {
|
||||||
|
state.loading = true;
|
||||||
|
GetEntityList(state.query)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
const { current, size, total, records } = res.data;
|
||||||
|
state.data = records;
|
||||||
|
state.pageData = {
|
||||||
|
currentPage: current || 1,
|
||||||
|
pageSize: size || 10,
|
||||||
|
total: total,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
state.data = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
loadData();
|
||||||
|
|
||||||
|
// 页数
|
||||||
|
const currentChange = (current) => {
|
||||||
|
state.query.current = current;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 条数
|
||||||
|
const sizeChange = (size) => {
|
||||||
|
state.query.size = size;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const searchChange = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
state.query = params;
|
||||||
|
state.query.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 刷新
|
||||||
|
const refreshChange = () => {
|
||||||
|
loadData();
|
||||||
|
app.$message.success('刷新成功');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
const selectionChange = (rows) => {
|
||||||
|
state.selection = rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查看
|
||||||
|
const rowView = (row) => {
|
||||||
|
// state.currentRow = row;
|
||||||
|
crudRef.value.rowView(row);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const rowSave = (row, done, loading) => {
|
||||||
|
AddEntity(row)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('添加成功!');
|
||||||
|
done();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const rowEdit = (row) => {
|
||||||
|
crudRef.value.rowEdit(row);
|
||||||
|
};
|
||||||
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
|
UpdateEntity(row)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('更新成功!');
|
||||||
|
done();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
const rowDel = (row, index, done) => {
|
||||||
|
if (isEmpty(row)) return;
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
DeleteEntity({ id: row.id })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('删除成功!');
|
||||||
|
done();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 审核
|
||||||
|
const rowCheck = (row, status) => {
|
||||||
|
const data = { id: row.id, planStatus: status };
|
||||||
|
AuditEntity(data)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('操作成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loadData();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
const onExport = () => {
|
||||||
|
if (isEmpty(state.data)) {
|
||||||
|
app.$message.error('当前暂时没有可供导出的数据!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.loading = true;
|
||||||
|
const fileName = '年度计划明细表';
|
||||||
|
ExportEntity(state.query)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
downloadFile(res.data, `${fileName}.xlsx`, 'blob');
|
||||||
|
app.$message.success('导出成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error('导出失败!');
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
@ -24,6 +24,10 @@
|
|||||||
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #id="{ row }">
|
||||||
|
<el-image style="width: 50px; height: 50px; cursor: pointer" :src="row.orCodeUrl" fit="cover" lazy @click="onViewCode(row)" />
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #productUrl-form="{ column }">
|
<template #productUrl-form="{ column }">
|
||||||
<el-upload class="custom-form__uploader" action="#" :show-file-list="false" accept="image/*" :limit="1" :http-request="rowUploadPicture">
|
<el-upload class="custom-form__uploader" action="#" :show-file-list="false" accept="image/*" :limit="1" :http-request="rowUploadPicture">
|
||||||
<img v-if="state.form.base64" :src="state.form.base64" class="custom-form__uploader__img" />
|
<img v-if="state.form.base64" :src="state.form.base64" class="custom-form__uploader__img" />
|
||||||
@ -47,6 +51,8 @@
|
|||||||
@on-confirm="onUploadExcel"
|
@on-confirm="onUploadExcel"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<code-dialog ref="codeRef" :row="state.currentRow" />
|
||||||
|
|
||||||
<custom-quality-add ref="qualityAddRef" :row="state.currentRow" />
|
<custom-quality-add ref="qualityAddRef" :row="state.currentRow" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -68,6 +74,7 @@ const UserStore = useUserStore();
|
|||||||
const crudRef = ref(null);
|
const crudRef = ref(null);
|
||||||
const importExcelRef = ref(null);
|
const importExcelRef = ref(null);
|
||||||
const qualityAddRef = ref(null);
|
const qualityAddRef = ref(null);
|
||||||
|
const codeRef = ref(null);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
query: {
|
query: {
|
||||||
@ -87,7 +94,6 @@ const state = reactive({
|
|||||||
addDisplay: false,
|
addDisplay: false,
|
||||||
editDisplay: false,
|
editDisplay: false,
|
||||||
viewDisplay: true,
|
viewDisplay: true,
|
||||||
width: 200,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '采收批次',
|
label: '采收批次',
|
||||||
@ -273,7 +279,7 @@ const state = reactive({
|
|||||||
label: '原产地详细地址',
|
label: '原产地详细地址',
|
||||||
prop: 'originAddressDetail',
|
prop: 'originAddressDetail',
|
||||||
hide: true,
|
hide: true,
|
||||||
// span: 24,
|
viewDisplay: false,
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// label: '经营主体',
|
// label: '经营主体',
|
||||||
@ -607,4 +613,9 @@ const onExport = () => {
|
|||||||
state.loading = false;
|
state.loading = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onViewCode = (row) => {
|
||||||
|
state.currentRow = row;
|
||||||
|
codeRef?.value && codeRef.value.show();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
<el-button type="danger" icon="delete" @click="onDel(state.selection)">批量删除</el-button>
|
<el-button type="danger" icon="delete" @click="onDel(state.selection)">批量删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #harvestId="{ row }">
|
||||||
|
<el-image style="width: 50px; height: 50px; cursor: pointer" :src="row.orCodeUrl" fit="cover" lazy @click="onViewCode(row)" />
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #qualityReportUrl="{ row }">
|
<template #qualityReportUrl="{ row }">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="row.qualityReportUrl"
|
v-if="row.qualityReportUrl"
|
||||||
@ -45,6 +49,8 @@
|
|||||||
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
</template>
|
</template>
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
|
|
||||||
|
<code-dialog ref="codeRef" :row="state.currentRow" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -57,6 +63,7 @@ import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity } from '@/apis/qua
|
|||||||
|
|
||||||
const app = useApp();
|
const app = useApp();
|
||||||
const crudRef = ref(null);
|
const crudRef = ref(null);
|
||||||
|
const codeRef = ref(null);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
query: {
|
query: {
|
||||||
@ -74,7 +81,6 @@ const state = reactive({
|
|||||||
prop: 'harvestId',
|
prop: 'harvestId',
|
||||||
search: true,
|
search: true,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
width: 200,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '采收批次',
|
label: '采收批次',
|
||||||
@ -249,6 +255,7 @@ const state = reactive({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
},
|
},
|
||||||
data: [],
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 加载
|
// 加载
|
||||||
@ -405,4 +412,9 @@ const onDel = (rows = []) => {
|
|||||||
const rowDel = (row, index, done) => {
|
const rowDel = (row, index, done) => {
|
||||||
onDel([row]);
|
onDel([row]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onViewCode = (row) => {
|
||||||
|
state.currentRow = row;
|
||||||
|
codeRef?.value && codeRef.value.show();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Author: zenghua.wang
|
* @Author: zenghua.wang
|
||||||
* @Date: 2022-09-18 21:24:29
|
* @Date: 2022-09-18 21:24:29
|
||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2025-02-17 10:58:12
|
* @LastEditTime: 2025-02-27 09:16:00
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { defineConfig, loadEnv } from 'vite';
|
import { defineConfig, loadEnv } from 'vite';
|
||||||
@ -23,46 +23,37 @@ import { resolve } from 'path';
|
|||||||
const useDevMode = true;
|
const useDevMode = true;
|
||||||
|
|
||||||
export default defineConfig(({ command, mode }) => {
|
export default defineConfig(({ command, mode }) => {
|
||||||
const {
|
const { VITE_PORT, VITE_APP_NAME, VITE_APP_BASE_API, VITE_APP_BASE_URL, VITE_APP_UPLOAD_API, VITE_APP_UPLOAD_URL } = loadEnv(mode, process.cwd());
|
||||||
VITE_PORT,
|
|
||||||
VITE_APP_NAME,
|
|
||||||
VITE_APP_BASE_API,
|
|
||||||
VITE_APP_BASE_URL,
|
|
||||||
VITE_APP_UPLOAD_API,
|
|
||||||
VITE_APP_UPLOAD_URL,
|
|
||||||
VITE_APP_SYSTEM_API,
|
|
||||||
VITE_APP_SYSTEM_URL,
|
|
||||||
} = loadEnv(mode, process.cwd());
|
|
||||||
const config = {
|
const config = {
|
||||||
base: '/sub-government-affairs-service/',
|
base: '/sub-government-affairs-service/',
|
||||||
build: {
|
build: {
|
||||||
target: 'ESNext',
|
target: 'ESNext',
|
||||||
outDir: 'dist',
|
outDir: 'dist',
|
||||||
minify: 'terser',
|
minify: 'terser',
|
||||||
// terserOptions: {
|
terserOptions: {
|
||||||
// compress: {
|
compress: {
|
||||||
// drop_console: true,
|
drop_console: true,
|
||||||
// drop_debugger: true,
|
drop_debugger: true,
|
||||||
// pure_funcs: ['console.log'],
|
pure_funcs: ['console.log'],
|
||||||
// },
|
},
|
||||||
// output: {
|
output: {
|
||||||
// comments: true,
|
comments: true,
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// reportCompressedSize: false,
|
reportCompressedSize: false,
|
||||||
// chunkSizeWarningLimit: 2000,
|
chunkSizeWarningLimit: 2000,
|
||||||
// rollupOptions: {
|
rollupOptions: {
|
||||||
// output: {
|
output: {
|
||||||
// manualChunks(id) {
|
manualChunks(id) {
|
||||||
// if (id.includes('node_modules')) {
|
if (id.includes('node_modules')) {
|
||||||
// return id.toString().split('node_modules/')[1].split('/')[1].toString();
|
return id.toString().split('node_modules/')[1].split('/')[1].toString();
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// chunkFileNames: 'assets/js/[name]-[hash].js',
|
chunkFileNames: 'assets/js/[name]-[hash].js',
|
||||||
// entryFileNames: 'assets/js/[name]-[hash].js',
|
entryFileNames: 'assets/js/[name]-[hash].js',
|
||||||
// assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
|
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
@ -83,11 +74,6 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/uploadApis/, ''),
|
rewrite: (path) => path.replace(/^\/uploadApis/, ''),
|
||||||
},
|
},
|
||||||
[VITE_APP_SYSTEM_API]: {
|
|
||||||
target: VITE_APP_SYSTEM_URL,
|
|
||||||
changeOrigin: true,
|
|
||||||
rewrite: (path) => path.replace(/^\/systemApis/, ''),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
@ -142,13 +128,5 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
if (mode === 'production') {
|
|
||||||
config.build.terserOptions = {
|
|
||||||
compress: {
|
|
||||||
drop_console: true,
|
|
||||||
drop_debugger: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user