Merge branch 'develop' of http://192.168.18.88:8077/sznyb/daimp-front into develop
This commit is contained in:
commit
1130f4f036
@ -1,5 +1,4 @@
|
|||||||
# 开发环境
|
# 开发环境
|
||||||
VITE_PORT = 9000
|
|
||||||
VITE_APP_NAME = 'daimp-front-main'
|
VITE_APP_NAME = 'daimp-front-main'
|
||||||
VITE_APP_TITLE = '数字农业产业管理平台'
|
VITE_APP_TITLE = '数字农业产业管理平台'
|
||||||
VITE_APP_SUB_OS = '//localhost:8090/sub-operation-service/'
|
VITE_APP_SUB_OS = '//localhost:8090/sub-operation-service/'
|
||||||
|
@ -18,9 +18,6 @@ actions.onGlobalStateChange((newState, prev) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 有key,表示取globalState下的某个子级对象
|
|
||||||
// 无key,表示取全部
|
|
||||||
|
|
||||||
actions.getGlobalState = (key) => {
|
actions.getGlobalState = (key) => {
|
||||||
return key ? initialState[key] : initialState;
|
return key ? initialState[key] : initialState;
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,6 @@ export const usePermissionStore = defineStore({
|
|||||||
actions: {
|
actions: {
|
||||||
generateRoutes(roles) {
|
generateRoutes(roles) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
// 在这判断是否有权限,哪些角色拥有哪些权限
|
|
||||||
const UserStore = useUserStore();
|
const UserStore = useUserStore();
|
||||||
this.asyncRoutes = createAsyncRoutes(getTree(UserStore.getMenus()));
|
this.asyncRoutes = createAsyncRoutes(getTree(UserStore.getMenus()));
|
||||||
let accessedRoutes;
|
let accessedRoutes;
|
||||||
|
@ -1,64 +1,12 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { CONSTANTS } from '@/config';
|
|
||||||
|
|
||||||
export const useSettingStore = defineStore({
|
export const useSettingStore = defineStore({
|
||||||
id: 'settingStore',
|
id: 'settingStore',
|
||||||
state: () => ({
|
state: () => ({
|
||||||
// menu 是否收缩
|
|
||||||
isCollapse: true,
|
|
||||||
//
|
|
||||||
withoutAnimation: false,
|
|
||||||
device: 'desktop',
|
|
||||||
// 刷新当前页
|
|
||||||
isReload: true,
|
isReload: true,
|
||||||
// 主题设置
|
|
||||||
themeConfig: {
|
|
||||||
// 显示设置
|
|
||||||
showSetting: false,
|
|
||||||
// 菜单展示模式 默认 vertical horizontal / vertical /columns
|
|
||||||
mode: 'vertical',
|
|
||||||
// tagsView 是否展示 默认展示
|
|
||||||
showTag: true,
|
|
||||||
// 页脚
|
|
||||||
footer: true,
|
|
||||||
// 深色模式 切换暗黑模式
|
|
||||||
isDark: false,
|
|
||||||
// 显示侧边栏Logo
|
|
||||||
showLogo: true,
|
|
||||||
// 主题颜色
|
|
||||||
primary: CONSTANTS.PRIMARY,
|
|
||||||
// element组件大小
|
|
||||||
globalComSize: 'default',
|
|
||||||
// 是否只保持一个子菜单的展开
|
|
||||||
uniqueOpened: true,
|
|
||||||
// 固定header
|
|
||||||
fixedHeader: true,
|
|
||||||
// 灰色模式
|
|
||||||
gray: false,
|
|
||||||
// 色弱模式
|
|
||||||
weak: false,
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
// 设置主题
|
|
||||||
setThemeConfig({ key, val }) {
|
|
||||||
this.themeConfig[key] = val;
|
|
||||||
},
|
|
||||||
// 切换 Collapse
|
|
||||||
setCollapse(value) {
|
|
||||||
this.isCollapse = value;
|
|
||||||
this.withoutAnimation = false;
|
|
||||||
},
|
|
||||||
// 关闭侧边栏
|
|
||||||
closeSideBar({ withoutAnimation }) {
|
|
||||||
this.isCollapse = false;
|
|
||||||
this.withoutAnimation = withoutAnimation;
|
|
||||||
},
|
|
||||||
toggleDevice(device) {
|
|
||||||
this.device = device;
|
|
||||||
},
|
|
||||||
// 刷新
|
|
||||||
setReload() {
|
setReload() {
|
||||||
this.isReload = false;
|
this.isReload = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -34,9 +34,10 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
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 });
|
return next({ ...to, replace: true });
|
||||||
} else {
|
} else {
|
||||||
if (from.path.includes('/sub') && !to.path.includes('/sub')) {
|
if (from.path.includes('/sub') && (!to.path.includes('/sub') || to.path.includes('/platform'))) {
|
||||||
|
NProgress.done();
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -36,22 +36,15 @@ import actions from '@/micro/actions';
|
|||||||
import { getAssetsFile } from '@/utils';
|
import { getAssetsFile } from '@/utils';
|
||||||
|
|
||||||
const gotoPage = (row) => {
|
const gotoPage = (row) => {
|
||||||
// const curentApp = microApps.find((item) => row.name === item.name);
|
|
||||||
// actions.setGlobalState({
|
|
||||||
// curentApp,
|
|
||||||
// });
|
|
||||||
// console.log('===', actions.getGlobalState('user'));
|
|
||||||
// if (row.name !== 'sub-government-affairs-service') return;
|
|
||||||
window.history.pushState({}, row.name, row.activeRule);
|
window.history.pushState({}, row.name, row.activeRule);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.platform {
|
.platform {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
min-height: 100%;
|
||||||
background-image: url('@/assets/images/platform/bg.png');
|
background-image: url('@/assets/images/platform/bg.png');
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
// background-position: center;
|
|
||||||
|
|
||||||
&-title {
|
&-title {
|
||||||
width: 1200px;
|
width: 1200px;
|
||||||
|
@ -21,30 +21,6 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
target: 'ESNext',
|
target: 'ESNext',
|
||||||
outDir: 'dist',
|
outDir: 'dist',
|
||||||
minify: 'terser',
|
minify: 'terser',
|
||||||
terserOptions: {
|
|
||||||
compress: {
|
|
||||||
drop_console: true,
|
|
||||||
drop_debugger: true,
|
|
||||||
pure_funcs: ['console.log'],
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
comments: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
reportCompressedSize: false,
|
|
||||||
chunkSizeWarningLimit: 2000,
|
|
||||||
rollupOptions: {
|
|
||||||
output: {
|
|
||||||
manualChunks(id) {
|
|
||||||
if (id.includes('node_modules')) {
|
|
||||||
return id.toString().split('node_modules/')[1].split('/')[1].toString();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
chunkFileNames: 'assets/js/[name]-[hash].js',
|
|
||||||
entryFileNames: 'assets/js/[name]-[hash].js',
|
|
||||||
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
@ -119,5 +95,13 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
if (mode === 'production') {
|
||||||
|
config.build.terserOptions = {
|
||||||
|
compress: {
|
||||||
|
drop_console: true,
|
||||||
|
drop_debugger: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<title>政务服务</title>
|
<title>政务服务</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="sub-app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/main.js"></script>
|
<script type="module" src="/src/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @Author: zenghua.wang
|
* @Author: zenghua.wang
|
||||||
* @Date: 2024-01-24 18:54:01
|
* @Date: 2024-01-24 18:54:01
|
||||||
* @LastEditors: zenghua.wang
|
* @LastEditors: zenghua.wang
|
||||||
* @LastEditTime: 2024-01-26 22:57:34
|
* @LastEditTime: 2025-02-28 11:31:12
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<el-config-provider :size="size" :locale="zhCn">
|
<el-config-provider :size="size" :locale="zhCn">
|
||||||
|
@ -2,7 +2,7 @@ import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
|||||||
const { VITE_APP_MIAN, VITE_APP_NAME } = import.meta.env;
|
const { VITE_APP_MIAN, VITE_APP_NAME } = import.meta.env;
|
||||||
|
|
||||||
export const GenKey = (key, prefix = VITE_APP_NAME) => {
|
export const GenKey = (key, prefix = VITE_APP_NAME) => {
|
||||||
prefix = qiankunWindow.__POWERED_BY_QIANKUN__ ? VITE_APP_MIAN : VITE_APP_NAME;
|
prefix = qiankunWindow.__POWERED_BY_QIANKUN__ ? VITE_APP_MIAN : VITE_APP_MIAN;
|
||||||
return prefix ? `${prefix}_` + key : key;
|
return prefix ? `${prefix}_` + key : key;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
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 VueAMap, { initAMapApiLoader } from '@vuemap/vue-amap';
|
||||||
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';
|
||||||
@ -15,11 +15,12 @@ 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 './utils/permission';
|
import { registerMicroApps } from './plugins/micro';
|
||||||
import VueAMap, { initAMapApiLoader } from '@vuemap/vue-amap';
|
|
||||||
initAMapApiLoader({
|
initAMapApiLoader({
|
||||||
key: 'c843a50db7157faf295c6fa37c48719f',
|
key: 'c843a50db7157faf295c6fa37c48719f',
|
||||||
securityJsCode: 'f09302d3ed65110614bdb26e44717ddf', // 新版key需要配合安全密钥使用
|
securityJsCode: 'f09302d3ed65110614bdb26e44717ddf', // 新版key需要配合安全密钥使用
|
||||||
@ -27,37 +28,10 @@ initAMapApiLoader({
|
|||||||
// version: '2.0.0'
|
// version: '2.0.0'
|
||||||
//} // 如果需要使用loca组件库,需要加载Loca
|
//} // 如果需要使用loca组件库,需要加载Loca
|
||||||
});
|
});
|
||||||
const registerMicroApps = () => {
|
|
||||||
let app = null;
|
const app = createApp(App);
|
||||||
const initQiankun = () => {
|
|
||||||
renderWithQiankun({
|
|
||||||
bootstrap() {
|
|
||||||
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));
|
|
||||||
app = createApp(App);
|
|
||||||
app.use(pinia).use(router).use(ElementPlus).use(Avue).use(VueAMap);
|
app.use(pinia).use(router).use(ElementPlus).use(Avue).use(VueAMap);
|
||||||
registerGlobalComponents(app);
|
registerGlobalComponents(app);
|
||||||
registerElIcons(app);
|
registerElIcons(app);
|
||||||
registerDirective(app);
|
registerDirective(app);
|
||||||
registerMicroApps(app);
|
registerMicroApps(app);
|
||||||
app.mount(container.querySelector('#sub-app') || '#sub-app');
|
|
||||||
};
|
|
||||||
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQiankun() : render({});
|
|
||||||
};
|
|
||||||
|
|
||||||
registerMicroApps();
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
import { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
||||||
|
|
||||||
export const registerMicroApps = (app) => {
|
export const registerMicroApps = async (app) => {
|
||||||
const initQiankun = () => {
|
const initQiankun = () => {
|
||||||
renderWithQiankun({
|
renderWithQiankun({
|
||||||
bootstrap() {
|
bootstrap() {
|
||||||
@ -20,11 +20,7 @@ export const registerMicroApps = (app) => {
|
|||||||
};
|
};
|
||||||
const render = async ({ container }) => {
|
const render = async ({ container }) => {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
if (!container) {
|
app.mount(container ? container.querySelector('#app') : '#app');
|
||||||
console.error('挂载容器不存在');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
app.mount(container.querySelector('#sub-app') || '#sub-app');
|
|
||||||
};
|
};
|
||||||
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQiankun() : render({});
|
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQiankun() : render({});
|
||||||
};
|
};
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
* @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-18 11:22:07
|
* @LastEditTime: 2025-02-28 13:50:00
|
||||||
*/
|
*/
|
||||||
import { createRouter, createWebHistory } from 'vue-router';
|
import { createRouter, createWebHistory } from 'vue-router';
|
||||||
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
|
||||||
import Layout from '@/layouts/index.vue';
|
import Layout from '@/layouts/index.vue';
|
||||||
|
|
||||||
import resourceRouter from './modules/resource';
|
import resourceRouter from './modules/resource';
|
||||||
@ -15,40 +14,28 @@ import landsRoutes from './modules/lands';
|
|||||||
import annualplanRoutes from './modules/annualplan';
|
import annualplanRoutes from './modules/annualplan';
|
||||||
import statisticsRoutes from './modules/statistics';
|
import statisticsRoutes from './modules/statistics';
|
||||||
|
|
||||||
const { VITE_APP_NAME } = import.meta.env;
|
|
||||||
|
|
||||||
export const constantRoutes = [
|
export const constantRoutes = [
|
||||||
{
|
{
|
||||||
path: '/404',
|
path: '/sub-government-affairs-service/404',
|
||||||
name: '404',
|
name: '404',
|
||||||
component: () => import('@/views/error/404.vue'),
|
component: () => import('@/views/error/404.vue'),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/403',
|
path: '/sub-government-affairs-service/403',
|
||||||
name: '403',
|
name: '403',
|
||||||
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: '/sub-government-affairs-service',
|
||||||
name: 'layout',
|
name: 'layout',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/home',
|
redirect: '/sub-government-affairs-service/home',
|
||||||
meta: { title: '政务服务', icon: 'House' },
|
meta: { title: '政务服务', icon: 'House' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/home',
|
path: '/sub-government-affairs-service/home',
|
||||||
component: () => import('@/views/home/index.vue'),
|
component: () => import('@/views/home/index.vue'),
|
||||||
name: 'home',
|
name: 'home',
|
||||||
meta: { title: '首页', icon: 'House' },
|
meta: { title: '首页', icon: 'House' },
|
||||||
@ -66,13 +53,13 @@ export const constantRoutes = [
|
|||||||
* @Title notFoundRouter(找不到路由)
|
* @Title notFoundRouter(找不到路由)
|
||||||
*/
|
*/
|
||||||
export const notFoundRouter = {
|
export const notFoundRouter = {
|
||||||
path: '/:pathMatch(.*)',
|
path: '/sub-government-affairs-service/:pathMatch(.*)',
|
||||||
name: 'notFound',
|
name: 'notFound',
|
||||||
redirect: '/404',
|
redirect: '/sub-government-affairs-service/404',
|
||||||
};
|
};
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(qiankunWindow.__POWERED_BY_QIANKUN__ ? `/${VITE_APP_NAME}/` : '/'), // history
|
history: createWebHistory(),
|
||||||
routes: constantRoutes,
|
routes: constantRoutes,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,20 +2,20 @@ import Layout from '@/layouts/index.vue';
|
|||||||
|
|
||||||
const annualplanRoutes = [
|
const annualplanRoutes = [
|
||||||
{
|
{
|
||||||
path: '/annualPlan',
|
path: '/sub-government-affairs-service/annualPlan',
|
||||||
name: 'annualPlan',
|
name: 'annualPlan',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/annualPlans',
|
redirect: '/sub-government-affairs-service/annualPlans',
|
||||||
meta: { title: '年度计划', icon: 'Document' },
|
meta: { title: '年度计划', icon: 'Document' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/annualPlans',
|
path: '/sub-government-affairs-service/annualPlans',
|
||||||
name: 'annualPlans',
|
name: 'annualPlans',
|
||||||
component: () => import('@/views/annualPlan/component/annualPlans/index.vue'),
|
component: () => import('@/views/annualPlan/component/annualPlans/index.vue'),
|
||||||
meta: { title: '年度计划', icon: 'Document' },
|
meta: { title: '年度计划', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/plantings',
|
path: '/sub-government-affairs-service/plantings',
|
||||||
name: 'plantings',
|
name: 'plantings',
|
||||||
component: () => import('@/views/annualPlan/component/plantings/index.vue'),
|
component: () => import('@/views/annualPlan/component/plantings/index.vue'),
|
||||||
meta: { title: '网格种植进度', icon: 'Document' },
|
meta: { title: '网格种植进度', icon: 'Document' },
|
||||||
|
@ -2,38 +2,38 @@ import Layout from '@/layouts/index.vue';
|
|||||||
|
|
||||||
const landsRoutes = [
|
const landsRoutes = [
|
||||||
{
|
{
|
||||||
path: '/landManage',
|
path: '/sub-government-affairs-service/landManage',
|
||||||
name: 'landManage',
|
name: 'landManage',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/landsManage',
|
redirect: '/sub-government-affairs-service/landsManage',
|
||||||
meta: { title: '土地管理', icon: 'Document' },
|
meta: { title: '土地管理', icon: 'Document' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/landsManage',
|
path: '/sub-government-affairs-service/landsManage',
|
||||||
name: 'landsManage',
|
name: 'landsManage',
|
||||||
component: () => import('@/views/landManage/component/landsManage/index.vue'),
|
component: () => import('@/views/landManage/component/landsManage/index.vue'),
|
||||||
meta: { title: '土地管理', icon: 'Document' },
|
meta: { title: '土地管理', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/plantPlan',
|
path: '/sub-government-affairs-service/plantPlan',
|
||||||
name: 'plantPlan',
|
name: 'plantPlan',
|
||||||
component: () => import('@/views/landManage/component/plantPlan/index.vue'),
|
component: () => import('@/views/landManage/component/plantPlan/index.vue'),
|
||||||
meta: { title: '种植规划', icon: 'Document' },
|
meta: { title: '种植规划', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/landPartol',
|
path: '/sub-government-affairs-service/landPartol',
|
||||||
name: 'landPartol',
|
name: 'landPartol',
|
||||||
component: () => import('@/views/landManage/component/landPartol/index.vue'),
|
component: () => import('@/views/landManage/component/landPartol/index.vue'),
|
||||||
meta: { title: '土地巡查', icon: 'Document' },
|
meta: { title: '土地巡查', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/illegalHandle',
|
path: '/sub-government-affairs-service/illegalHandle',
|
||||||
name: 'illegalHandle',
|
name: 'illegalHandle',
|
||||||
component: () => import('@/views/landManage/component/illegalHandle/index.vue'),
|
component: () => import('@/views/landManage/component/illegalHandle/index.vue'),
|
||||||
meta: { title: '土地违法处理', icon: 'Document' },
|
meta: { title: '土地违法处理', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/operationRecord',
|
path: '/sub-government-affairs-service/operationRecord',
|
||||||
name: 'operationRecord',
|
name: 'operationRecord',
|
||||||
component: () => import('@/views/landManage/component/operationRecord/index.vue'),
|
component: () => import('@/views/landManage/component/operationRecord/index.vue'),
|
||||||
meta: { title: '作业记录', icon: 'Document' },
|
meta: { title: '作业记录', icon: 'Document' },
|
||||||
|
@ -3,27 +3,27 @@ import Views from '@/layouts/Views.vue';
|
|||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: '/plantingAndBreeding',
|
path: '/sub-government-affairs-service/plantingAndBreeding',
|
||||||
name: 'plantingAndBreeding',
|
name: 'plantingAndBreeding',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/breeding',
|
redirect: '/sub-government-affairs-service/breeding',
|
||||||
meta: { title: '种养殖管理', icon: 'Document' },
|
meta: { title: '种养殖管理', icon: 'Document' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/planting',
|
path: '/sub-government-affairs-service/planting',
|
||||||
name: 'planting',
|
name: 'planting',
|
||||||
component: Views,
|
component: Views,
|
||||||
meta: { title: '种植档案', icon: 'Document' },
|
meta: { title: '种植档案', icon: 'Document' },
|
||||||
redirect: '/planting-base',
|
redirect: '/sub-government-affairs-service/planting-base',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/planting-base',
|
path: '/sub-government-affairs-service/planting-base',
|
||||||
component: () => import('@/views/trace/planting/base/index.vue'),
|
component: () => import('@/views/trace/planting/base/index.vue'),
|
||||||
name: 'planting-base',
|
name: 'planting-base',
|
||||||
meta: { title: '基地档案', icon: 'Document' },
|
meta: { title: '基地档案', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/planting-seed',
|
path: '/sub-government-affairs-service/planting-seed',
|
||||||
component: () => import('@/views/trace/planting/seed/index.vue'),
|
component: () => import('@/views/trace/planting/seed/index.vue'),
|
||||||
name: 'planting-seed',
|
name: 'planting-seed',
|
||||||
meta: { title: '种子档案', icon: 'Document' },
|
meta: { title: '种子档案', icon: 'Document' },
|
||||||
@ -31,20 +31,20 @@ export default [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/breeding',
|
path: '/sub-government-affairs-service/breeding',
|
||||||
name: 'breeding',
|
name: 'breeding',
|
||||||
component: Views,
|
component: Views,
|
||||||
meta: { title: '农事管理', icon: 'Document' },
|
meta: { title: '农事管理', icon: 'Document' },
|
||||||
redirect: '/breeding-coding',
|
redirect: '/sub-government-affairs-service/breeding-coding',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/breeding-coding',
|
path: '/sub-government-affairs-service/breeding-coding',
|
||||||
component: () => import('@/views/trace/breeding/coding/index.vue'),
|
component: () => import('@/views/trace/breeding/coding/index.vue'),
|
||||||
name: 'breeding-coding',
|
name: 'breeding-coding',
|
||||||
meta: { title: '采收与赋码管理', icon: 'Document' },
|
meta: { title: '采收与赋码管理', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/breeding-quality',
|
path: '/sub-government-affairs-service/breeding-quality',
|
||||||
component: () => import('@/views/trace/breeding/quality/index.vue'),
|
component: () => import('@/views/trace/breeding/quality/index.vue'),
|
||||||
name: 'breeding-quality',
|
name: 'breeding-quality',
|
||||||
meta: { title: '产品质检管理', icon: 'Document' },
|
meta: { title: '产品质检管理', icon: 'Document' },
|
||||||
@ -54,20 +54,20 @@ export default [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/trace',
|
path: '/sub-government-affairs-service/trace',
|
||||||
name: 'trace',
|
name: 'trace',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/trace-search',
|
redirect: '/sub-government-affairs-service/trace-search',
|
||||||
meta: { title: '溯源查询', icon: 'Document' },
|
meta: { title: '溯源查询', icon: 'Document' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/trace-search',
|
path: '/sub-government-affairs-service/trace-search',
|
||||||
name: 'trace-search',
|
name: 'trace-search',
|
||||||
component: () => import('@/views/trace/search/index.vue'),
|
component: () => import('@/views/trace/search/index.vue'),
|
||||||
meta: { title: '溯源查询', icon: 'Document' },
|
meta: { title: '溯源查询', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/trace-info',
|
path: '/sub-government-affairs-service/trace-info',
|
||||||
name: 'trace-info',
|
name: 'trace-info',
|
||||||
component: () => import('@/views/trace/search/info.vue'),
|
component: () => import('@/views/trace/search/info.vue'),
|
||||||
meta: { title: '溯源详情', icon: 'Document' },
|
meta: { title: '溯源详情', icon: 'Document' },
|
||||||
|
@ -3,14 +3,14 @@ import Views from '@/layouts/Views.vue';
|
|||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: '/resource',
|
path: '/sub-government-affairs-service/resource',
|
||||||
name: 'resource',
|
name: 'resource',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/grid',
|
redirect: '/sub-government-affairs-service/grid',
|
||||||
meta: { title: '土地资源管理', icon: 'icon-test' },
|
meta: { title: '土地资源管理', icon: 'icon-test' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/grid',
|
path: '/sub-government-affairs-service/grid',
|
||||||
component: () => import('@/views/resource/grid/index.vue'),
|
component: () => import('@/views/resource/grid/index.vue'),
|
||||||
name: 'grid',
|
name: 'grid',
|
||||||
meta: { title: '网格化管理', icon: 'Document' },
|
meta: { title: '网格化管理', icon: 'Document' },
|
||||||
|
@ -2,26 +2,26 @@ import Layout from '@/layouts/index.vue';
|
|||||||
|
|
||||||
const statisticsRoutes = [
|
const statisticsRoutes = [
|
||||||
{
|
{
|
||||||
path: '/statistics',
|
path: '/sub-government-affairs-service/statistics',
|
||||||
name: 'statistics',
|
name: 'statistics',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/utilizePlan',
|
redirect: '/sub-government-affairs-service/utilizePlan',
|
||||||
meta: { title: '统计分析', icon: 'Document' },
|
meta: { title: '统计分析', icon: 'Document' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/utilizePlan',
|
path: '/sub-government-affairs-service/utilizePlan',
|
||||||
name: 'utilizePlan',
|
name: 'utilizePlan',
|
||||||
component: () => import('@/views/statistics/component/utilizePlan/index.vue'),
|
component: () => import('@/views/statistics/component/utilizePlan/index.vue'),
|
||||||
meta: { title: '土地利用与规划分析', icon: 'Document' },
|
meta: { title: '土地利用与规划分析', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/agriculture',
|
path: '/sub-government-affairs-service/agriculture',
|
||||||
name: 'agriculture',
|
name: 'agriculture',
|
||||||
component: () => import('@/views/statistics/component/agriculture/index.vue'),
|
component: () => import('@/views/statistics/component/agriculture/index.vue'),
|
||||||
meta: { title: '农业生产效率分析', icon: 'Document' },
|
meta: { title: '农业生产效率分析', icon: 'Document' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/environment',
|
path: '/sub-government-affairs-service/environment',
|
||||||
name: 'environment',
|
name: 'environment',
|
||||||
component: () => import('@/views/statistics/component/environment/index.vue'),
|
component: () => import('@/views/statistics/component/environment/index.vue'),
|
||||||
meta: { title: '环境影响与经济效益分析', icon: 'Document' },
|
meta: { title: '环境影响与经济效益分析', icon: 'Document' },
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { CONSTANTS } from '@/config';
|
import { CONSTANTS } from '@/config';
|
||||||
|
import { GenKey } from '@/config';
|
||||||
|
|
||||||
export const useSettingStore = defineStore({
|
export const useSettingStore = defineStore({
|
||||||
id: 'settingStore',
|
id: GenKey('settingStore'),
|
||||||
state: () => ({
|
state: () => ({
|
||||||
// menu 是否收缩
|
// menu 是否收缩
|
||||||
isCollapse: true,
|
isCollapse: true,
|
||||||
|
@ -34,8 +34,12 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
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 });
|
return next({ ...to, replace: true });
|
||||||
} else {
|
} else {
|
||||||
|
if (from.path.includes('/sub') && to.path.includes('/platform')) {
|
||||||
|
window.location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -0,0 +1,407 @@
|
|||||||
|
<template>
|
||||||
|
<CustomCard>
|
||||||
|
<el-form ref="searchRef" :model="searchCondition">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="计划名称:" prop="planName">
|
||||||
|
<el-input v-model="searchCondition.planName" placeholder="请输入"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-button type="primary" @click="getList()">查询</el-button>
|
||||||
|
<el-button type="" @click="handleResetSearch">重置</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div class="options_btns">
|
||||||
|
<el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" @click="item.method">
|
||||||
|
{{ item.label }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table :data="list">
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column type="index"> </el-table-column>
|
||||||
|
<el-table-column label="计划编号" prop="id" show-overflow-tooltip />
|
||||||
|
<el-table-column label="计划名称" prop="planName" show-overflow-tooltip />
|
||||||
|
<el-table-column label="种植面积" prop="plantingArea" show-overflow-tooltip />
|
||||||
|
<el-table-column label="种植月份" prop="plantingMonths" show-overflow-tooltip />
|
||||||
|
<el-table-column label="生长周期" prop="growthCycle" show-overflow-tooltip />
|
||||||
|
<el-table-column label="备注" prop="note" show-overflow-tooltip />
|
||||||
|
<el-table-column label="计划进度" prop="planProgress" show-overflow-tooltip />
|
||||||
|
<el-table-column label="状态" prop="planStatus" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag v-if="row.planStatus == '1'" type="warning" size="small">待提交</el-tag>
|
||||||
|
<el-tag v-if="row.planStatus == '2'" type="primary" size="small">审核中</el-tag>
|
||||||
|
<el-tag v-if="row.planStatus == '3'" type="success" size="small">通过</el-tag>
|
||||||
|
<el-tag v-if="row.planStatus == '4'" type="danger" size="small">拒绝</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column fixed="right" label="操作" width="280" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" size="small" @click="doExam(row)">审核</el-button>
|
||||||
|
<el-button type="primary" size="small" @click="doEdit(row)">编辑</el-button>
|
||||||
|
<el-button type="primary" size="small" @click="doDetail(row)">详情</el-button>
|
||||||
|
<el-button type="danger" size="small" @click="doDel(row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagina :page-data="pageData" />
|
||||||
|
<el-dialog v-model="infoVisible" title="年度种植计划" width="1000" center>
|
||||||
|
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="计划名称:" prop="planName">
|
||||||
|
<el-input v-model="infoData.planName" placeholder="请输入" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="种植面积" prop="plantingArea">
|
||||||
|
<el-input-number v-model="infoData.plantingArea" :min="1" :max="10000">
|
||||||
|
<template #suffix>
|
||||||
|
<span>亩</span>
|
||||||
|
</template>
|
||||||
|
</el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="适宜种植月份" prop="plantingMonths">
|
||||||
|
<el-select v-model="infoData.plantingMonths" placeholder="请选择月份" style="width: 240px" :clearable="true" :multiple="true">
|
||||||
|
<el-option v-for="item in monthsOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="生厂周期" prop="growthCycleVal">
|
||||||
|
<el-input-number v-model="infoData.growthCycleVal[0]" :min="1" :max="30">
|
||||||
|
<template #suffix>
|
||||||
|
<span>周</span>
|
||||||
|
</template>
|
||||||
|
</el-input-number>
|
||||||
|
-
|
||||||
|
<el-input-number v-model="infoData.growthCycleVal[1]" :min="1" :max="30">
|
||||||
|
<template #suffix>
|
||||||
|
<span>周</span>
|
||||||
|
</template>
|
||||||
|
</el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="备注" prop="note">
|
||||||
|
<el-input v-model="infoData.note" type="textarea" placeholder="请输入备注" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="infoCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="subMitInfo(infoRef)"> 确认 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog v-model="examVisible" title="审核计划" width="500" center>
|
||||||
|
<!-- <el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="备注" prop="note">
|
||||||
|
<el-input v-model="infoData.note" type="textarea" placeholder="请输入备注" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form> -->
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="danger" @click="examCancel">审核拒绝</el-button>
|
||||||
|
<el-button type="primary" @click="examPast"> 审核通过 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</CustomCard>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
|
import Pagina from '@/components/pagina.vue';
|
||||||
|
import CustomCard from '@/components/CustomCard.vue';
|
||||||
|
import { getAnnualList, saveAnnual, editAnnual, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import { isEmpty, imageToBase64, getAssetsFile, downloadFile } from '@/utils';
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
|
||||||
|
/* --------------- data --------------- */
|
||||||
|
// #region
|
||||||
|
const app = useApp();
|
||||||
|
const searchRef = ref();
|
||||||
|
|
||||||
|
const searchCondition = reactive({
|
||||||
|
planName: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const pageData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
total: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const infoVisible = ref(false);
|
||||||
|
const infoRef = ref();
|
||||||
|
const list = ref([]);
|
||||||
|
|
||||||
|
const state = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
const btns = reactive([
|
||||||
|
{
|
||||||
|
label: '新增年度规划',
|
||||||
|
loading: false,
|
||||||
|
method: function () {
|
||||||
|
console.log('add');
|
||||||
|
infoVisible.value = true;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '导出',
|
||||||
|
disabled: true,
|
||||||
|
method: function () {
|
||||||
|
if (isEmpty(state.data)) {
|
||||||
|
app.$message.error('当前暂时没有可供导出的数据!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.loading = true;
|
||||||
|
const fileName = '年度规划明细表';
|
||||||
|
exportAnnua(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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
let infoData = reactive({
|
||||||
|
planName: '',
|
||||||
|
plantingArea: 0,
|
||||||
|
plantingMonths: [],
|
||||||
|
growthCycle: '',
|
||||||
|
note: '',
|
||||||
|
growthCycleVal: [0, 0],
|
||||||
|
});
|
||||||
|
|
||||||
|
const infoRules = reactive({
|
||||||
|
planName: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
|
||||||
|
plantingArea: [{ required: true, message: '请输入种植面积', trigger: 'blur' }],
|
||||||
|
plantingMonths: [{ required: true, message: '请选择种植月份', trigger: 'blur' }],
|
||||||
|
growthCycleVal: [{ required: true, message: '请输入生长周期', trigger: 'blur' }],
|
||||||
|
note: [{ required: true, message: '请输入备注', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
const monthsOptions = reactive([
|
||||||
|
{ 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月' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const examVisible = ref(false);
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
/* --------------- methods --------------- */
|
||||||
|
// #region
|
||||||
|
|
||||||
|
async function getList() {
|
||||||
|
const params = { current: pageData.page, size: pageData.size };
|
||||||
|
let { code, data, msg } = await getAnnualList(params);
|
||||||
|
//console.log('res ---------', data);
|
||||||
|
list.value = data.records || [];
|
||||||
|
pageData.total = data.total;
|
||||||
|
state.data = data.records;
|
||||||
|
state.pageData = {
|
||||||
|
currentPage: data.current || 1,
|
||||||
|
pageSize: data.size || 10,
|
||||||
|
total: data.total,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchRef.value && searchRef.value.resetFields();
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
function doEdit(row) {
|
||||||
|
infoVisible.value = true;
|
||||||
|
// eslint-disable-next-line no-const-assign
|
||||||
|
|
||||||
|
infoData = reactive({
|
||||||
|
...row,
|
||||||
|
plantingMonths: row.plantingMonths.split(','),
|
||||||
|
growthCycleVal: row.growthCycle.split(',').map((m) => {
|
||||||
|
return Number(m.replace(/[^0-9]/gi, ''));
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function doDel(row) {
|
||||||
|
// console.info('删除');
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
// delAnnual({ ids: ids.join(',') })
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// app.$message.success('删除成功!');
|
||||||
|
// getList();
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// });
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
const doExam = (row) => {
|
||||||
|
examVisible.value = true;
|
||||||
|
infoData = reactive({
|
||||||
|
...row,
|
||||||
|
plantingMonths: row.plantingMonths.split(','),
|
||||||
|
growthCycleVal: row.growthCycle.split(',').map((m) => {
|
||||||
|
return Number(m.replace(/[^0-9]/gi, ''));
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const subMitInfo = (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let parmer = {
|
||||||
|
...infoData,
|
||||||
|
plantingMonths: infoData.plantingMonths.toString(),
|
||||||
|
growthCycle: infoData.growthCycleVal[0] + '周' + ',' + infoData.growthCycleVal[1] + '周',
|
||||||
|
};
|
||||||
|
|
||||||
|
parmer.growthCycleVal && delete parmer.growthCycleVal;
|
||||||
|
console.info('新增年度规划参数', parmer);
|
||||||
|
if (parmer.id) {
|
||||||
|
editAnnual(parmer)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('编辑成功!');
|
||||||
|
getList();
|
||||||
|
infoHide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
} else {
|
||||||
|
saveAnnual(parmer)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('添加成功!');
|
||||||
|
getList();
|
||||||
|
infoHide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('error submit!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoCancel = () => {
|
||||||
|
infoHide();
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoHide = () => {
|
||||||
|
infoRef.value && infoRef.value.resetFields();
|
||||||
|
infoVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const examCancel = () => {
|
||||||
|
console.log('审核不通过');
|
||||||
|
examVisible.value = true;
|
||||||
|
toDoexam(infoData.id, '4', '审核不通过');
|
||||||
|
};
|
||||||
|
|
||||||
|
const examPast = (row) => {
|
||||||
|
console.log('审核通过');
|
||||||
|
toDoexam(infoData.id, '3', '审核通过');
|
||||||
|
};
|
||||||
|
|
||||||
|
const toDoexam = (id, status, tips) => {
|
||||||
|
app
|
||||||
|
.$confirm(`确定` + tips + `吗?`, '温馨提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
examineAnnual({ id: id, planStatus: status })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('审核提交成功!');
|
||||||
|
getList();
|
||||||
|
examHide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
const examHide = () => {
|
||||||
|
examVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.container {
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,51 +1,40 @@
|
|||||||
<template>
|
<template>
|
||||||
<CustomCard>
|
<div class="custom-page">
|
||||||
<el-form ref="searchRef" :model="searchCondition">
|
<avue-crud
|
||||||
<el-row :gutter="20">
|
ref="crudRef"
|
||||||
<el-col :span="6">
|
v-model="state.form"
|
||||||
<el-form-item label="计划名称:" prop="planName">
|
v-model:search="state.query"
|
||||||
<el-input v-model="searchCondition.planName" placeholder="请输入"></el-input>
|
v-model:page="state.pageData"
|
||||||
</el-form-item>
|
:table-loading="state.loading"
|
||||||
</el-col>
|
:data="state.data"
|
||||||
<el-col :span="6">
|
:option="state.options"
|
||||||
<el-button type="primary" @click="getList()">查询</el-button>
|
@refresh-change="refreshChange"
|
||||||
<el-button type="" @click="handleResetSearch">重置</el-button>
|
@search-reset="searchChange"
|
||||||
</el-col>
|
@search-change="searchChange"
|
||||||
</el-row>
|
@selection-change="selectionChange"
|
||||||
</el-form>
|
@current-change="currentChange"
|
||||||
<div class="options_btns">
|
@size-change="sizeChange"
|
||||||
<el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" @click="item.method">
|
@row-save="rowSave"
|
||||||
{{ item.label }}
|
@row-update="rowUpdate"
|
||||||
</el-button>
|
@row-del="rowDel"
|
||||||
</div>
|
>
|
||||||
<el-table :data="list">
|
<template #menu-left>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-button type="primary" icon="Plus" @click="onAdd">新增</el-button>
|
||||||
<el-table-column type="index"> </el-table-column>
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
<el-table-column label="计划编号" prop="id" show-overflow-tooltip />
|
</template>
|
||||||
<el-table-column label="计划名称" prop="planName" show-overflow-tooltip />
|
|
||||||
<el-table-column label="种植面积" prop="plantingArea" show-overflow-tooltip />
|
<template #planStatus="{ row }">
|
||||||
<el-table-column label="种植月份" prop="plantingMonths" show-overflow-tooltip />
|
|
||||||
<el-table-column label="生长周期" prop="growthCycle" show-overflow-tooltip />
|
|
||||||
<el-table-column label="备注" prop="note" show-overflow-tooltip />
|
|
||||||
<el-table-column label="计划进度" prop="planProgress" show-overflow-tooltip />
|
|
||||||
<el-table-column label="状态" prop="planStatus" show-overflow-tooltip>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-tag v-if="row.planStatus == '1'" type="warning" size="small">待提交</el-tag>
|
<el-tag v-if="row.planStatus == '1'" type="warning" size="small">待提交</el-tag>
|
||||||
<el-tag v-if="row.planStatus == '2'" type="primary" size="small">审核中</el-tag>
|
<el-tag v-if="row.planStatus == '2'" type="primary" size="small">审核中</el-tag>
|
||||||
<el-tag v-if="row.planStatus == '3'" type="success" size="small">通过</el-tag>
|
<el-tag v-if="row.planStatus == '3'" type="success" size="small">通过</el-tag>
|
||||||
<el-tag v-if="row.planStatus == '4'" type="danger" size="small">拒绝</el-tag>
|
<el-tag v-if="row.planStatus == '4'" type="danger" size="small">拒绝</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
|
||||||
<el-table-column fixed="right" label="操作" width="280" show-overflow-tooltip>
|
<template #menu="scope">
|
||||||
<template #default="{ row }">
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
<el-button type="primary" size="small" @click="doExam(row)">审核</el-button>
|
|
||||||
<el-button type="primary" size="small" @click="doEdit(row)">编辑</el-button>
|
|
||||||
<el-button type="primary" size="small" @click="doDetail(row)">详情</el-button>
|
|
||||||
<el-button type="danger" size="small" @click="doDel(row)">删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</avue-crud>
|
||||||
</el-table>
|
|
||||||
<Pagina :page-data="pageData" />
|
|
||||||
<el-dialog v-model="infoVisible" title="年度种植计划" width="1000" center>
|
<el-dialog v-model="infoVisible" title="年度种植计划" width="1000" center>
|
||||||
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
@ -71,7 +60,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="生厂周期" prop="growthCycleVal">
|
<el-form-item label="生长周期" prop="growthCycleVal">
|
||||||
<el-input-number v-model="infoData.growthCycleVal[0]" :min="1" :max="30">
|
<el-input-number v-model="infoData.growthCycleVal[0]" :min="1" :max="30">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span>周</span>
|
<span>周</span>
|
||||||
@ -117,89 +106,63 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</CustomCard>
|
|
||||||
|
<el-dialog v-model="detailVisible" title="年度计划详情" width="800" center>
|
||||||
|
<el-descriptions :title="currentRow.planName || ''">
|
||||||
|
<el-descriptions-item label="计划编号">{{ currentRow.id || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计划名称">{{ currentRow.planName || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="种植面积">{{ currentRow.plantingArea || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="种植月份">{{ currentRow.plantingMonths || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="生长周期">{{ currentRow.growthCycle || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注">{{ currentRow.note || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="计划进度">{{ currentRow.planProgress || '--' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="状态">
|
||||||
|
<el-tag v-if="currentRow.planStatus == '1'" type="warning" size="small">待提交</el-tag>
|
||||||
|
<el-tag v-if="currentRow.planStatus == '2'" type="primary" size="small">审核中</el-tag>
|
||||||
|
<el-tag v-if="currentRow.planStatus == '3'" type="success" size="small">通过</el-tag>
|
||||||
|
<el-tag v-if="currentRow.planStatus == '4'" type="danger" size="small">拒绝</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="toBack"> 返回 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import Pagina from '@/components/pagina.vue';
|
|
||||||
import CustomCard from '@/components/CustomCard.vue';
|
|
||||||
import { getAnnualList, saveAnnual, editAnnual, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
|
|
||||||
import { useApp } from '@/hooks';
|
import { useApp } from '@/hooks';
|
||||||
import { isEmpty, imageToBase64, getAssetsFile, downloadFile } from '@/utils';
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
onMounted(() => {
|
import { isEmpty, downloadFile } from '@/utils';
|
||||||
getList();
|
import { useUserStore } from '@/store/modules/user';
|
||||||
});
|
import { compact } from 'lodash';
|
||||||
|
import { GetEntityList, AddEntity, UpdateEntity, DeleteEntity, ExportEntity } from '@/apis/grid';
|
||||||
|
import { getAnnualList, saveAnnual, editAnnual, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
|
||||||
|
|
||||||
/* --------------- data --------------- */
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
// #region
|
|
||||||
const app = useApp();
|
const app = useApp();
|
||||||
const searchRef = ref();
|
const UserStore = useUserStore();
|
||||||
|
const crudRef = ref(null);
|
||||||
const searchCondition = reactive({
|
|
||||||
planName: '',
|
|
||||||
});
|
|
||||||
|
|
||||||
const pageData = reactive({
|
|
||||||
page: 1,
|
|
||||||
size: 10,
|
|
||||||
total: 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
const infoVisible = ref(false);
|
const infoVisible = ref(false);
|
||||||
const infoRef = ref();
|
const infoRef = ref();
|
||||||
const list = ref([]);
|
const monthsOptions = reactive([
|
||||||
|
{ label: '1月份', value: '1月' },
|
||||||
const state = reactive({
|
{ label: '2月份', value: '2月' },
|
||||||
loading: false,
|
{ label: '3月份', value: '3月' },
|
||||||
query: {
|
{ label: '4月份', value: '4月' },
|
||||||
current: 1,
|
{ label: '5月份', value: '5月' },
|
||||||
size: 10,
|
{ label: '6月份', value: '6月' },
|
||||||
},
|
{ label: '7月份', value: '7月' },
|
||||||
pageData: {
|
{ label: '8月份', value: '8月' },
|
||||||
total: 0,
|
{ label: '9月份', value: '9月' },
|
||||||
currentPage: 1,
|
{ label: '10月份', value: '10月' },
|
||||||
pageSize: 10,
|
{ label: '11月份', value: '11月' },
|
||||||
},
|
{ label: '12月份', value: '12月' },
|
||||||
data: [],
|
|
||||||
currentRow: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
const btns = reactive([
|
|
||||||
{
|
|
||||||
label: '新增年度规划',
|
|
||||||
loading: false,
|
|
||||||
method: function () {
|
|
||||||
console.log('add');
|
|
||||||
infoVisible.value = true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '导出',
|
|
||||||
disabled: true,
|
|
||||||
method: function () {
|
|
||||||
if (isEmpty(state.data)) {
|
|
||||||
app.$message.error('当前暂时没有可供导出的数据!');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
state.loading = true;
|
|
||||||
const fileName = '年度规划明细表';
|
|
||||||
exportAnnua(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;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let infoData = reactive({
|
let infoData = reactive({
|
||||||
planName: '',
|
planName: '',
|
||||||
plantingArea: 0,
|
plantingArea: 0,
|
||||||
@ -216,50 +179,145 @@ const infoRules = reactive({
|
|||||||
growthCycleVal: [{ required: true, message: '请输入生长周期', trigger: 'blur' }],
|
growthCycleVal: [{ required: true, message: '请输入生长周期', trigger: 'blur' }],
|
||||||
note: [{ required: true, message: '请输入备注', trigger: 'blur' }],
|
note: [{ required: true, message: '请输入备注', trigger: 'blur' }],
|
||||||
});
|
});
|
||||||
const monthsOptions = reactive([
|
|
||||||
{ 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月' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const examVisible = ref(false);
|
const examVisible = ref(false);
|
||||||
|
const detailVisible = ref(false);
|
||||||
|
let currentRow = reactive({});
|
||||||
|
|
||||||
// #endregion
|
const state = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtnText: '',
|
||||||
|
addBtn: false,
|
||||||
|
column: [
|
||||||
|
{ label: '计划编号', prop: 'id', width: '200px', showOverflowTooltip: true },
|
||||||
|
{ label: '计划名称', prop: 'planName', width: '200px', showOverflowTooltip: true, search: true },
|
||||||
|
{ label: '种植面积', prop: 'plantingArea' },
|
||||||
|
{ label: '种植月份', prop: 'plantingMonths', width: '120px' },
|
||||||
|
{ label: '生长周期', prop: 'growthCycle', width: '120px' },
|
||||||
|
{ label: '备注', prop: 'note', width: '180px', showOverflowTooltip: true },
|
||||||
|
{ label: '计划进度', prop: 'planProgress' },
|
||||||
|
{ label: '状态', prop: 'planStatus' },
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '审核',
|
||||||
|
icon: 'Stamp',
|
||||||
|
event: ({ row }) => doExam(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => rowEdit(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '详情',
|
||||||
|
icon: 'List',
|
||||||
|
event: ({ row }) => doDetail(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => rowDel(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
|
||||||
/* --------------- methods --------------- */
|
// 加载
|
||||||
// #region
|
const loadData = () => {
|
||||||
|
state.loading = true;
|
||||||
async function getList() {
|
getAnnualList(state.query)
|
||||||
const params = { current: pageData.page, size: pageData.size };
|
.then((res) => {
|
||||||
let { code, data, msg } = await getAnnualList(params);
|
if (res.code === 200) {
|
||||||
//console.log('res ---------', data);
|
const { current, size, total, records } = res.data;
|
||||||
list.value = data.records || [];
|
state.data = records;
|
||||||
pageData.total = data.total;
|
|
||||||
state.data = data.records;
|
|
||||||
state.pageData = {
|
state.pageData = {
|
||||||
currentPage: data.current || 1,
|
currentPage: current || 1,
|
||||||
pageSize: data.size || 10,
|
pageSize: size || 10,
|
||||||
total: data.total,
|
total: total,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
state.data = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function handleResetSearch() {
|
loadData();
|
||||||
searchRef.value && searchRef.value.resetFields();
|
|
||||||
getList();
|
// 页数
|
||||||
|
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 setCity = (row) => {
|
||||||
|
if (!isEmpty(row.cities)) {
|
||||||
|
row.provinceCode = row?.cities[0] ?? null;
|
||||||
|
row.cityCode = row?.cities[1] ?? null;
|
||||||
|
row.gridAreaCode = row?.cities[2] ?? null;
|
||||||
|
row.townCode = row?.cities[3] ?? null;
|
||||||
|
row.village = row?.cities[3] ?? null;
|
||||||
}
|
}
|
||||||
function doEdit(row) {
|
};
|
||||||
infoVisible.value = true;
|
|
||||||
// eslint-disable-next-line no-const-assign
|
|
||||||
|
|
||||||
|
const onAdd = () => {
|
||||||
|
infoVisible.value = true;
|
||||||
|
};
|
||||||
|
// 新增
|
||||||
|
const rowSave = (row, done, loading) => {
|
||||||
|
console.info('新增');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const rowEdit = (row) => {
|
||||||
|
console.info('编辑');
|
||||||
|
// crudRef.value.rowEdit(row);
|
||||||
infoData = reactive({
|
infoData = reactive({
|
||||||
...row,
|
...row,
|
||||||
plantingMonths: row.plantingMonths.split(','),
|
plantingMonths: row.plantingMonths.split(','),
|
||||||
@ -267,10 +325,30 @@ function doEdit(row) {
|
|||||||
return Number(m.replace(/[^0-9]/gi, ''));
|
return Number(m.replace(/[^0-9]/gi, ''));
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
infoVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
function doDel(row) {
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
// console.info('删除');
|
console.info('更新');
|
||||||
|
// 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
|
app
|
||||||
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@ -278,11 +356,13 @@ function doDel(row) {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// delAnnual({ ids: ids.join(',') })
|
console.info('删除');
|
||||||
|
// delAnnual({ id: row.id })
|
||||||
// .then((res) => {
|
// .then((res) => {
|
||||||
// if (res.code === 200) {
|
// if (res.code === 200) {
|
||||||
// app.$message.success('删除成功!');
|
// app.$message.success('删除成功!');
|
||||||
// getList();
|
// done();
|
||||||
|
// loadData();
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
// .catch((err) => {
|
// .catch((err) => {
|
||||||
@ -290,7 +370,30 @@ function doDel(row) {
|
|||||||
// });
|
// });
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
const onExport = () => {
|
||||||
|
if (isEmpty(state.data)) {
|
||||||
|
app.$message.error('当前暂时没有可供导出的数据!');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
state.loading = true;
|
||||||
|
const fileName = '年度计划明细表';
|
||||||
|
exportAnnua(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;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const doExam = (row) => {
|
const doExam = (row) => {
|
||||||
examVisible.value = true;
|
examVisible.value = true;
|
||||||
@ -303,6 +406,10 @@ const doExam = (row) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const doDetail = (row) => {
|
||||||
|
detailVisible.value = true;
|
||||||
|
currentRow = reactive({ ...row });
|
||||||
|
};
|
||||||
const subMitInfo = (formEl) => {
|
const subMitInfo = (formEl) => {
|
||||||
if (!formEl) return;
|
if (!formEl) return;
|
||||||
formEl.validate((valid) => {
|
formEl.validate((valid) => {
|
||||||
@ -314,13 +421,12 @@ const subMitInfo = (formEl) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
parmer.growthCycleVal && delete parmer.growthCycleVal;
|
parmer.growthCycleVal && delete parmer.growthCycleVal;
|
||||||
console.info('新增年度规划参数', parmer);
|
|
||||||
if (parmer.id) {
|
if (parmer.id) {
|
||||||
editAnnual(parmer)
|
editAnnual(parmer)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
app.$message.success('编辑成功!');
|
app.$message.success('编辑成功!');
|
||||||
getList();
|
loadData();
|
||||||
infoHide();
|
infoHide();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -333,7 +439,7 @@ const subMitInfo = (formEl) => {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
app.$message.success('添加成功!');
|
app.$message.success('添加成功!');
|
||||||
getList();
|
loadData();
|
||||||
infoHide();
|
infoHide();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -380,7 +486,7 @@ const toDoexam = (id, status, tips) => {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
app.$message.success('审核提交成功!');
|
app.$message.success('审核提交成功!');
|
||||||
getList();
|
loadData();
|
||||||
examHide();
|
examHide();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -396,12 +502,7 @@ const examHide = () => {
|
|||||||
examVisible.value = false;
|
examVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// #endregion
|
const toBack = () => {
|
||||||
|
detailVisible.value = false;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.container {
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<div>网格种植进度</div>
|
||||||
|
</template>
|
@ -0,0 +1,663 @@
|
|||||||
|
<!-- eslint-disCustomCardnst-assign -->
|
||||||
|
<template>
|
||||||
|
<CustomCard>
|
||||||
|
<el-form ref="searchRef" :model="searchCondition">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="地块名:" prop="landName">
|
||||||
|
<el-input v-model="searchCondition.landName" placeholder="请输入"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="种植产物" prop="crop">
|
||||||
|
<el-input v-model="searchCondition.crop" placeholder="请输入"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="产权人" prop="owner">
|
||||||
|
<el-input v-model="searchCondition.owner" placeholder="请输入"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-button type="primary" @click="getList()">查询</el-button>
|
||||||
|
<el-button type="" @click="handleResetSearch">重置</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div class="options_btns">
|
||||||
|
<el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" :loading="item.loading" @click="item.method">
|
||||||
|
{{ item.label }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table :data="list" @selection-change="selectionChange" @row-click="rowClick">
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column type="index"> </el-table-column>
|
||||||
|
<el-table-column label="地块名" prop="landName" width="240" show-overflow-tooltip />
|
||||||
|
<el-table-column label="地址" prop="address" show-overflow-tooltip />
|
||||||
|
<el-table-column label="产权人" prop="owner" show-overflow-tooltip />
|
||||||
|
<el-table-column label="农用地分类" prop="landClassificationType" width="120" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag type="primary" :hit="true" size="small" effect="plain">{{ landClassificationType[row.landClassificationType] }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="面积" prop="area" show-overflow-tooltip />
|
||||||
|
<el-table-column label="坐标" prop="coordinate" show-overflow-tooltip />
|
||||||
|
<el-table-column label="土壤类型" prop="soilType" show-overflow-tooltip />
|
||||||
|
<el-table-column label="种植产物" prop="crop" show-overflow-tooltip />
|
||||||
|
<el-table-column label="种子供应商" prop="seedSupplier" show-overflow-tooltip />
|
||||||
|
<el-table-column label="年度计划" prop="planName" show-overflow-tooltip />
|
||||||
|
<el-table-column label="种植日期" prop="planDate" show-overflow-tooltip />
|
||||||
|
<el-table-column fixed="right" label="操作" width="160" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" size="small" @click="doEdit(row)">编辑</el-button>
|
||||||
|
<el-button type="danger" size="small" @click="doDel(row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagina :page-data="pageData" @page-change="pageChange" />
|
||||||
|
<el-dialog v-model="infoVisible" title="种植规划" width="1000" center>
|
||||||
|
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<!--<el-col :span="12">
|
||||||
|
<el-form-item label="地块:" prop="landId">
|
||||||
|
<CustomSelect
|
||||||
|
v-model:value="infoData.landId"
|
||||||
|
:set="{
|
||||||
|
url: 'land-resource/landManage/page',
|
||||||
|
props: {
|
||||||
|
value: 'id',
|
||||||
|
label: 'landName',
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
placeholder="请选择地块"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="面积" prop="gridName">
|
||||||
|
<el-input v-model="infoData.gridName" placeholder="请输入面积" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col> -->
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="种植产物" prop="crop">
|
||||||
|
<el-input v-model="infoData.crop" placeholder="请输入种植产物" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="种植日期" prop="planDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="infoData.planDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="请选择种植日期"
|
||||||
|
:disabled-date="disabledDate"
|
||||||
|
format="YYYY/MM/DD"
|
||||||
|
value-format="YYYY/MM/DD"
|
||||||
|
:size="size"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="种子供应商" prop="seedSupplier">
|
||||||
|
<el-input v-model="infoData.seedSupplier" placeholder="请输入种子供应商" style="width: 240px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="年度计划" prop="planId">
|
||||||
|
<CustomSelect
|
||||||
|
v-model:value="infoData.planId"
|
||||||
|
:set="{
|
||||||
|
url: 'land-resource/annualManage/page',
|
||||||
|
props: {
|
||||||
|
value: 'id',
|
||||||
|
label: 'planName',
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
placeholder="请选择种植计划"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="infoCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="subMitInfo(infoRef)"> 确认 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
<div>
|
||||||
|
<el-text class="mx-1" size="large">种植阶段详情</el-text>
|
||||||
|
<div style="margin-top: 16px">
|
||||||
|
<el-form ref="stageRef" :model="stageInfo">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-button type="primary" @click="addSub">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="所属阶段" prop="gridName">
|
||||||
|
<el-select v-model="stageInfo.stage" placeholder="请选择所属阶段" style="width: 240px" :clearable="true">
|
||||||
|
<el-option v-for="item in stageOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-button type="primary" @click="handleSearchStage">查询</el-button>
|
||||||
|
<el-button type="" @click="handleResetStage">重置</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<el-table :data="sublist">
|
||||||
|
<el-table-column type="index"> </el-table-column>
|
||||||
|
<el-table-column label="所属阶段" prop="stage">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag size="small">{{ stageObj[row.stage] }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="作业计划" prop="operationType" show-overflow-tooltip />
|
||||||
|
<el-table-column label="作业时间" prop="operationDate" show-overflow-tooltip />
|
||||||
|
<el-table-column label="结束时间" prop="createTime" show-overflow-tooltip />
|
||||||
|
<el-table-column fixed="right" label="操作" width="200" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button type="primary" size="small" @click="doSubEdit(row)">编辑</el-button>
|
||||||
|
<el-button type="danger" size="small" @click="doSubDel(row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<Pagina :page-data="subPageData" />
|
||||||
|
<el-dialog v-model="stageInfoVisible" title="种植阶段" width="800" center>
|
||||||
|
<el-form ref="stageInfoRef" :model="stageInfoData" :rules="stageInfoRules">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="地块:" prop="landName">
|
||||||
|
<el-input v-model="stageInfoData.landName" placeholder="请输入地块" style="width: 240px" :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="种植产物" prop="crop">
|
||||||
|
<el-input v-model="stageInfoData.crop" placeholder="请输入种植产物" style="width: 240px" :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="种植阶段" prop="stage">
|
||||||
|
<CustomSelect
|
||||||
|
v-model:value="stageInfoData.stage"
|
||||||
|
:set="{
|
||||||
|
url: '',
|
||||||
|
options: stageOptions,
|
||||||
|
props: {
|
||||||
|
value: 'value',
|
||||||
|
label: 'label',
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
placeholder="请选择种植阶段"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="作业计划" prop="workId">
|
||||||
|
<CustomSelect
|
||||||
|
v-model:value="stageInfoData.workId"
|
||||||
|
:set="{
|
||||||
|
url: '',
|
||||||
|
options: workOptions,
|
||||||
|
props: {
|
||||||
|
value: 'id',
|
||||||
|
label: 'planName',
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
placeholder="请选择作业计划"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="infoCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="subMitStateInfo(stageInfoRef)"> 确认 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</CustomCard>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
|
import Pagina from '@/components/pagina.vue';
|
||||||
|
import {
|
||||||
|
getPlanList,
|
||||||
|
savePlan,
|
||||||
|
exportPlan,
|
||||||
|
editAlan,
|
||||||
|
delPlan,
|
||||||
|
getPlantingStage,
|
||||||
|
savePlantingStage,
|
||||||
|
editPlantingStage,
|
||||||
|
delPlantingStage,
|
||||||
|
} from '@/apis/land.js';
|
||||||
|
import CustomCard from '@/components/CustomCard.vue';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
import CustomSelect from '@/components/CustomSelect.vue';
|
||||||
|
import { isEmpty, imageToBase64, getAssetsFile, downloadFile } from '@/utils';
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
|
||||||
|
/* --------------- data --------------- */
|
||||||
|
// #region
|
||||||
|
const app = useApp();
|
||||||
|
const searchRef = ref();
|
||||||
|
|
||||||
|
const searchCondition = reactive({
|
||||||
|
landName: '',
|
||||||
|
owner: '',
|
||||||
|
crop: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const pageData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
total: 0,
|
||||||
|
});
|
||||||
|
const landClassificationType = reactive({
|
||||||
|
0: '耕地',
|
||||||
|
1: '果园',
|
||||||
|
2: '茶园',
|
||||||
|
3: '其他园地',
|
||||||
|
4: '林地',
|
||||||
|
5: '草地',
|
||||||
|
6: '其他农用地',
|
||||||
|
7: '农村宅基地',
|
||||||
|
});
|
||||||
|
|
||||||
|
let selectIds = ref('');
|
||||||
|
const infoVisible = ref(false);
|
||||||
|
const infoRef = ref();
|
||||||
|
const list = ref([]);
|
||||||
|
const state = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
const btns = reactive([
|
||||||
|
{
|
||||||
|
label: '新增种植规划',
|
||||||
|
loading: false,
|
||||||
|
method: function () {
|
||||||
|
console.log('add');
|
||||||
|
if (selectIds.value.length <= 0) {
|
||||||
|
app.$message.error('请先选择地块');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
infoVisible.value = true;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '导入',
|
||||||
|
disabled: false,
|
||||||
|
loading: false,
|
||||||
|
method: function () {
|
||||||
|
console.log('import');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '导出',
|
||||||
|
disabled: true,
|
||||||
|
loading: state.loading,
|
||||||
|
method: function () {
|
||||||
|
if (isEmpty(state.data)) {
|
||||||
|
app.$message.error('当前暂时没有可供导出的数据!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.loading = true;
|
||||||
|
const fileName = '种植计划明细表';
|
||||||
|
exportPlan(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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
let infoData = reactive({
|
||||||
|
landId: [], //土地主键id
|
||||||
|
planId: '', //种植规划主键id
|
||||||
|
crop: '', //种植产物
|
||||||
|
seedSupplier: '', //供应商
|
||||||
|
planDate: '', //种植时间
|
||||||
|
});
|
||||||
|
|
||||||
|
const infoRules = reactive({
|
||||||
|
crop: [{ required: true, message: '请输入种植产物', trigger: 'blur' }],
|
||||||
|
planId: [{ required: true, message: '请选择种植计划', trigger: 'blur' }],
|
||||||
|
seedSupplier: [{ required: true, message: '请输入供应商', trigger: 'blur' }],
|
||||||
|
planDate: [{ required: true, message: '请选择种植时间', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
const workOptions = reactive([
|
||||||
|
{ value: '作业计划1', label: 'Option1' },
|
||||||
|
{ value: '作业计划2', label: 'Option2' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const subPageData = reactive({
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
total: 0,
|
||||||
|
});
|
||||||
|
const sublist = ref([]);
|
||||||
|
const stageInfo = reactive({
|
||||||
|
stage: '',
|
||||||
|
});
|
||||||
|
const stageRef = ref();
|
||||||
|
const stageOptions = reactive([
|
||||||
|
{ value: '0', label: '苗期' },
|
||||||
|
{ value: '1', label: '花果期' },
|
||||||
|
{ value: '2', label: '采收期' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
let currentRow = reactive({});
|
||||||
|
const stageObj = reactive({
|
||||||
|
0: '苗期',
|
||||||
|
1: '花果期',
|
||||||
|
2: '采收期',
|
||||||
|
});
|
||||||
|
|
||||||
|
let stageInfoVisible = ref(false);
|
||||||
|
const stageInfoRef = ref();
|
||||||
|
let stageInfoData = reactive({
|
||||||
|
landId: '', //土地主键id
|
||||||
|
planId: '', //种植规划主键id
|
||||||
|
crop: '', //种植产物
|
||||||
|
stage: '', //所属阶段
|
||||||
|
workId: '', //作业计划Id
|
||||||
|
landName: '', //地块
|
||||||
|
});
|
||||||
|
|
||||||
|
const stageInfoRules = reactive({
|
||||||
|
stage: [{ required: true, message: '请选择所属阶段', trigger: 'blur' }],
|
||||||
|
workId: [{ required: true, message: '请选择作业计划', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
/* --------------- methods --------------- */
|
||||||
|
// #region
|
||||||
|
|
||||||
|
async function getList() {
|
||||||
|
const params = { current: pageData.page, size: pageData.size, ...searchCondition };
|
||||||
|
let { code, data, msg } = await getPlanList(params);
|
||||||
|
//console.log('res ---------', data);
|
||||||
|
list.value = data.records || [];
|
||||||
|
pageData.total = data.total;
|
||||||
|
state.data = data.records;
|
||||||
|
state.pageData = {
|
||||||
|
currentPage: data.current || 1,
|
||||||
|
pageSize: data.size || 10,
|
||||||
|
total: data.total,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchRef.value && searchRef.value.resetFields();
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectionChange = (data) => {
|
||||||
|
let datalist = data.map((m) => {
|
||||||
|
return { landId: m.landId, landName: m.landName };
|
||||||
|
});
|
||||||
|
|
||||||
|
let selectIdlist = uniqueObjects(datalist, 'landId');
|
||||||
|
let selectIdsVal = selectIdlist.map((n) => {
|
||||||
|
return n.landId;
|
||||||
|
});
|
||||||
|
|
||||||
|
selectIds.value = selectIdsVal.toString();
|
||||||
|
console.info('selectionChange', selectIds.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const pageChange = (data) => {
|
||||||
|
console.info('pageChange', data);
|
||||||
|
pageData.page = data;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
function uniqueObjects(arr, key) {
|
||||||
|
return arr.reduce((acc, current) => {
|
||||||
|
const duplicate = acc.find((element) => element[key] === current[key]);
|
||||||
|
if (!duplicate) {
|
||||||
|
acc.push(current);
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doEdit(row) {
|
||||||
|
infoVisible.value = true;
|
||||||
|
infoData = reactive({
|
||||||
|
...row,
|
||||||
|
});
|
||||||
|
console.info('编辑', infoData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doDel(row) {
|
||||||
|
console.info('删除');
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
delPlan({ id: row.id })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('删除成功!');
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
const subMitInfo = (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let parmer = {
|
||||||
|
...infoData,
|
||||||
|
landId: selectIds.value || '',
|
||||||
|
};
|
||||||
|
|
||||||
|
console.info('新增种植计划', parmer);
|
||||||
|
|
||||||
|
if (parmer.id) {
|
||||||
|
editAlan(parmer)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('编辑成功!');
|
||||||
|
getList();
|
||||||
|
infoHide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
} else {
|
||||||
|
savePlan(parmer)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
getList();
|
||||||
|
infoHide();
|
||||||
|
app.$message.success('添加成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('error submit!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoCancel = () => {
|
||||||
|
infoHide();
|
||||||
|
};
|
||||||
|
|
||||||
|
const infoHide = () => {
|
||||||
|
infoVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const addSub = () => {
|
||||||
|
console.log('新增阶段');
|
||||||
|
if (!currentRow.id) {
|
||||||
|
app.$message.error('请选择种植规划');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
stageInfoData.landName = currentRow.landName || '';
|
||||||
|
stageInfoData.crop = currentRow.crop || '';
|
||||||
|
stageInfoVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getStageList() {
|
||||||
|
const params = { current: subPageData.page, size: subPageData.size, planId: currentRow.id };
|
||||||
|
let { code, data, msg } = await getPlantingStage(params);
|
||||||
|
sublist.value = data.records || [];
|
||||||
|
subPageData.total = data.total;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleResetStage() {
|
||||||
|
stageRef.value && stageRef.value.resetFields();
|
||||||
|
stageInfo.stage = '';
|
||||||
|
console.info('重置所属阶段筛选条件');
|
||||||
|
getStageList();
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSearchStage = () => {
|
||||||
|
if (!currentRow.id) {
|
||||||
|
app.$message.error('请选择种植规划');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowClick = (row) => {
|
||||||
|
currentRow = reactive({ ...row });
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const doSubEdit = (row) => {
|
||||||
|
console.log('编辑sub');
|
||||||
|
stageInfoData.landName = row.landName || '';
|
||||||
|
stageInfoData.crop = row.crop || '';
|
||||||
|
stageInfoVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const doSubDel = (row) => {
|
||||||
|
console.log('删除sub');
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
delPlantingStage({ id: row.id })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('删除成功!');
|
||||||
|
getStageList();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
const stageinfoHide = () => {
|
||||||
|
stageInfoRef.value && stageInfoRef.value.resetFields();
|
||||||
|
stageInfoVisible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const subMitStateInfo = (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let parmer = {
|
||||||
|
planId: currentRow.id || '', //种植规划主键id
|
||||||
|
stage: stageInfoData.stage || 0, //种植阶段:0->苗期,1>花果期,2->采收期
|
||||||
|
workId: stageInfoData.workId || '',
|
||||||
|
};
|
||||||
|
|
||||||
|
console.info('新增种植阶段', parmer);
|
||||||
|
|
||||||
|
if (parmer.id) {
|
||||||
|
editPlantingStage(parmer)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('编辑成功!');
|
||||||
|
getStageList();
|
||||||
|
stageinfoHide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
} else {
|
||||||
|
savePlantingStage(parmer)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
getStageList();
|
||||||
|
stageinfoHide();
|
||||||
|
app.$message.success('添加成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
})
|
||||||
|
.finally(() => {});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('error submit!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.container {
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,61 +1,42 @@
|
|||||||
<!-- eslint-disCustomCardnst-assign -->
|
|
||||||
<template>
|
<template>
|
||||||
<CustomCard>
|
<div class="custom-page">
|
||||||
<el-form ref="searchRef" :model="searchCondition">
|
<avue-crud
|
||||||
<el-row :gutter="20">
|
ref="crudRef"
|
||||||
<el-col :span="6">
|
v-model="state.form"
|
||||||
<el-form-item label="地块名:" prop="landName">
|
v-model:search="state.query"
|
||||||
<el-input v-model="searchCondition.landName" placeholder="请输入"></el-input>
|
v-model:page="state.pageData"
|
||||||
</el-form-item>
|
:table-loading="state.loading"
|
||||||
</el-col>
|
:data="state.data"
|
||||||
<el-col :span="6">
|
:option="state.options"
|
||||||
<el-form-item label="种植产物" prop="crop">
|
@refresh-change="refreshChange"
|
||||||
<el-input v-model="searchCondition.crop" placeholder="请输入"></el-input>
|
@search-reset="searchChange"
|
||||||
</el-form-item>
|
@search-change="searchChange"
|
||||||
</el-col>
|
@selection-change="selectionChange"
|
||||||
<el-col :span="6">
|
@current-change="currentChange"
|
||||||
<el-form-item label="产权人" prop="owner">
|
@size-change="sizeChange"
|
||||||
<el-input v-model="searchCondition.owner" placeholder="请输入"></el-input>
|
@row-save="rowSave"
|
||||||
</el-form-item>
|
@row-update="rowUpdate"
|
||||||
</el-col>
|
@row-del="rowDel"
|
||||||
<el-col :span="6">
|
@row-click="rowClick"
|
||||||
<el-button type="primary" @click="getList()">查询</el-button>
|
>
|
||||||
<el-button type="" @click="handleResetSearch">重置</el-button>
|
<template #menu-left>
|
||||||
</el-col>
|
<el-button type="primary" icon="Plus" @click="onAdd">新增</el-button>
|
||||||
</el-row>
|
<el-button type="primary" icon="Upload" @click="onImport">导入</el-button>
|
||||||
</el-form>
|
<el-button type="success" icon="download" @click="onExport">导出</el-button>
|
||||||
<div class="options_btns">
|
|
||||||
<el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" :loading="item.loading" @click="item.method">
|
|
||||||
{{ item.label }}
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
<el-table :data="list" @selection-change="selectionChange" @row-click="rowClick">
|
|
||||||
<el-table-column type="selection" width="55" />
|
|
||||||
<el-table-column type="index"> </el-table-column>
|
|
||||||
<el-table-column label="地块名" prop="landName" width="240" show-overflow-tooltip />
|
|
||||||
<el-table-column label="地址" prop="address" show-overflow-tooltip />
|
|
||||||
<el-table-column label="产权人" prop="owner" show-overflow-tooltip />
|
|
||||||
<el-table-column label="农用地分类" prop="landClassificationType" width="120" show-overflow-tooltip>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-tag type="primary" :hit="true" size="small" effect="plain">{{ landClassificationType[row.landClassificationType] }}</el-tag>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="面积" prop="area" show-overflow-tooltip />
|
<template #landClassificationType="{ row }">
|
||||||
<el-table-column label="坐标" prop="coordinate" show-overflow-tooltip />
|
<el-tag type="primary" :hit="true" size="small" effect="plain">
|
||||||
<el-table-column label="土壤类型" prop="soilType" show-overflow-tooltip />
|
{{ landClassificationType[row.landClassificationType] || '未知' }}
|
||||||
<el-table-column label="种植产物" prop="crop" show-overflow-tooltip />
|
</el-tag>
|
||||||
<el-table-column label="种子供应商" prop="seedSupplier" show-overflow-tooltip />
|
|
||||||
<el-table-column label="年度计划" prop="planName" show-overflow-tooltip />
|
|
||||||
<el-table-column label="种植日期" prop="planDate" show-overflow-tooltip />
|
|
||||||
<el-table-column fixed="right" label="操作" width="160" show-overflow-tooltip>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-button type="primary" size="small" @click="doEdit(row)">编辑</el-button>
|
|
||||||
<el-button type="danger" size="small" @click="doDel(row)">删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
<template #menu="scope">
|
||||||
<Pagina :page-data="pageData" @page-change="pageChange" />
|
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||||
<el-dialog v-model="infoVisible" title="种植规划" width="1000" center>
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
|
||||||
|
<el-dialog v-model="infoVisible" title="种植规划" width="800" center>
|
||||||
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
<el-form ref="infoRef" :model="infoData" :rules="infoRules">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<!--<el-col :span="12">
|
<!--<el-col :span="12">
|
||||||
@ -125,45 +106,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<div>
|
|
||||||
<el-text class="mx-1" size="large">种植阶段详情</el-text>
|
<el-text class="mx-1" size="large">种植阶段详情</el-text>
|
||||||
<div style="margin-top: 16px">
|
<div style="margin-top: 16px">
|
||||||
<el-form ref="stageRef" :model="stageInfo">
|
<avue-crud
|
||||||
<el-row :gutter="20">
|
ref="crudRef"
|
||||||
<el-col :span="6">
|
v-model="stageState.form"
|
||||||
<el-button type="primary" @click="addSub">新增</el-button>
|
v-model:search="stageState.query"
|
||||||
</el-col>
|
v-model:page="stageState.pageData"
|
||||||
<el-col :span="6">
|
:table-loading="stageState.loading"
|
||||||
<el-form-item label="所属阶段" prop="gridName">
|
:data="stageState.data"
|
||||||
<el-select v-model="stageInfo.stage" placeholder="请选择所属阶段" style="width: 240px" :clearable="true">
|
:option="stageState.options"
|
||||||
<el-option v-for="item in stageOptions" :key="item.value" :label="item.label" :value="item.value" />
|
@refresh-change="stageRefresh"
|
||||||
</el-select>
|
@search-reset="stageSearch"
|
||||||
</el-form-item>
|
@search-change="stageSearch"
|
||||||
</el-col>
|
@selection-change="stageSelection"
|
||||||
<el-col :span="6">
|
@current-change="stageCurrent"
|
||||||
<el-button type="primary" @click="handleSearchStage">查询</el-button>
|
@size-change="stageSize"
|
||||||
<el-button type="" @click="handleResetStage">重置</el-button>
|
@row-del="stageRowDel"
|
||||||
</el-col>
|
>
|
||||||
</el-row>
|
<template #menu-left>
|
||||||
</el-form>
|
<el-button type="primary" icon="Plus" @click="onStateAdd">新增</el-button>
|
||||||
<el-table :data="sublist">
|
</template>
|
||||||
<el-table-column type="index"> </el-table-column>
|
|
||||||
<el-table-column label="所属阶段" prop="stage">
|
<template #stage="{ row }">
|
||||||
<template #default="{ row }">
|
|
||||||
<el-tag size="small">{{ stageObj[row.stage] }}</el-tag>
|
<el-tag size="small">{{ stageObj[row.stage] }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="作业计划" prop="operationType" show-overflow-tooltip />
|
<template #menu="scope">
|
||||||
<el-table-column label="作业时间" prop="operationDate" show-overflow-tooltip />
|
<custom-table-operate :actions="stageState.options.actions" :data="scope" />
|
||||||
<el-table-column label="结束时间" prop="createTime" show-overflow-tooltip />
|
|
||||||
<el-table-column fixed="right" label="操作" width="200" show-overflow-tooltip>
|
|
||||||
<template #default="{ row }">
|
|
||||||
<el-button type="primary" size="small" @click="doSubEdit(row)">编辑</el-button>
|
|
||||||
<el-button type="danger" size="small" @click="doSubDel(row)">删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</avue-crud>
|
||||||
</el-table>
|
|
||||||
<Pagina :page-data="subPageData" />
|
|
||||||
<el-dialog v-model="stageInfoVisible" title="种植阶段" width="800" center>
|
<el-dialog v-model="stageInfoVisible" title="种植阶段" width="800" center>
|
||||||
<el-form ref="stageInfoRef" :model="stageInfoData" :rules="stageInfoRules">
|
<el-form ref="stageInfoRef" :model="stageInfoData" :rules="stageInfoRules">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
@ -213,19 +186,20 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="infoCancel">取消</el-button>
|
<el-button @click="stageCancel">取消</el-button>
|
||||||
<el-button type="primary" @click="subMitStateInfo(stageInfoRef)"> 确认 </el-button>
|
<el-button type="primary" @click="subMitStateInfo(stageInfoRef)"> 确认 </el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CustomCard>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import Pagina from '@/components/pagina.vue';
|
import { useApp } from '@/hooks';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
import { compact } from 'lodash';
|
||||||
import {
|
import {
|
||||||
getPlanList,
|
getPlanList,
|
||||||
savePlan,
|
savePlan,
|
||||||
@ -238,29 +212,184 @@ import {
|
|||||||
delPlantingStage,
|
delPlantingStage,
|
||||||
} from '@/apis/land.js';
|
} from '@/apis/land.js';
|
||||||
import CustomCard from '@/components/CustomCard.vue';
|
import CustomCard from '@/components/CustomCard.vue';
|
||||||
import { useApp } from '@/hooks';
|
|
||||||
import CustomSelect from '@/components/CustomSelect.vue';
|
import CustomSelect from '@/components/CustomSelect.vue';
|
||||||
import { isEmpty, imageToBase64, getAssetsFile, downloadFile } from '@/utils';
|
import { isEmpty, imageToBase64, getAssetsFile, downloadFile } from '@/utils';
|
||||||
onMounted(() => {
|
|
||||||
getList();
|
|
||||||
});
|
|
||||||
|
|
||||||
/* --------------- data --------------- */
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
// #region
|
|
||||||
const app = useApp();
|
const app = useApp();
|
||||||
const searchRef = ref();
|
const UserStore = useUserStore();
|
||||||
|
const crudRef = ref(null);
|
||||||
|
const stageOptions = reactive([
|
||||||
|
{ value: '0', label: '苗期' },
|
||||||
|
{ value: '1', label: '花果期' },
|
||||||
|
{ value: '2', label: '采收期' },
|
||||||
|
]);
|
||||||
|
|
||||||
const searchCondition = reactive({
|
const state = reactive({
|
||||||
landName: '',
|
loading: false,
|
||||||
owner: '',
|
query: {
|
||||||
crop: '',
|
current: 1,
|
||||||
});
|
|
||||||
|
|
||||||
const pageData = reactive({
|
|
||||||
page: 1,
|
|
||||||
size: 10,
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
selection: [],
|
||||||
|
tableClumn: [
|
||||||
|
{
|
||||||
|
label: '地块名',
|
||||||
|
type: 'input',
|
||||||
|
prop: 'landName',
|
||||||
|
disabled: true,
|
||||||
|
search: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: '地址', prop: 'address', width: '240px', showOverflowTooltip: true, disabled: true },
|
||||||
|
{
|
||||||
|
label: '种植产物',
|
||||||
|
type: 'input',
|
||||||
|
prop: 'crop',
|
||||||
|
disabled: true,
|
||||||
|
search: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '产权人',
|
||||||
|
type: 'input',
|
||||||
|
prop: 'owner',
|
||||||
|
disabled: true,
|
||||||
|
search: true,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '农用地分类',
|
||||||
|
prop: 'landClassificationType',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '面积',
|
||||||
|
prop: 'area',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{ label: '坐标', prop: 'coordinate', disabled: true, width: '120px', showOverflowTooltip: true },
|
||||||
|
{
|
||||||
|
label: '土壤类型',
|
||||||
|
prop: 'soilType',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种植产物',
|
||||||
|
prop: 'crop',
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请输入',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种子供应商',
|
||||||
|
prop: 'seedSupplier',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '年度计划',
|
||||||
|
prop: 'planName',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '种植日期',
|
||||||
|
prop: 'planDate',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtn: false,
|
||||||
|
column: [],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => rowEdit(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => rowDel(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
total: 0,
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const stageState = reactive({
|
||||||
|
loading: false,
|
||||||
|
query: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
},
|
||||||
|
form: {},
|
||||||
|
options: {
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtn: false,
|
||||||
|
selection: false,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: '所属阶段',
|
||||||
|
prop: 'stage',
|
||||||
|
type: 'select',
|
||||||
|
search: true,
|
||||||
|
dicData: stageOptions,
|
||||||
|
rules: {
|
||||||
|
required: true,
|
||||||
|
message: '请选择',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: '作业计划', prop: 'area', disabled: true },
|
||||||
|
{ label: '作业时间', prop: 'coordinate', disabled: true },
|
||||||
|
{ label: '结束时间', prop: 'createTime', disabled: true },
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => stageRowEdit(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => stageRowDel(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
pageData: {
|
||||||
|
total: 0,
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
currentRow: {},
|
||||||
|
});
|
||||||
|
|
||||||
const landClassificationType = reactive({
|
const landClassificationType = reactive({
|
||||||
0: '耕地',
|
0: '耕地',
|
||||||
1: '果园',
|
1: '果园',
|
||||||
@ -272,73 +401,8 @@ const landClassificationType = reactive({
|
|||||||
7: '农村宅基地',
|
7: '农村宅基地',
|
||||||
});
|
});
|
||||||
|
|
||||||
let selectIds = ref('');
|
|
||||||
const infoVisible = ref(false);
|
const infoVisible = ref(false);
|
||||||
const infoRef = ref();
|
const infoRef = ref();
|
||||||
const list = ref([]);
|
|
||||||
const state = reactive({
|
|
||||||
loading: false,
|
|
||||||
query: {
|
|
||||||
current: 1,
|
|
||||||
size: 10,
|
|
||||||
},
|
|
||||||
pageData: {
|
|
||||||
total: 0,
|
|
||||||
currentPage: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
},
|
|
||||||
data: [],
|
|
||||||
currentRow: {},
|
|
||||||
});
|
|
||||||
const btns = reactive([
|
|
||||||
{
|
|
||||||
label: '新增种植规划',
|
|
||||||
loading: false,
|
|
||||||
method: function () {
|
|
||||||
console.log('add');
|
|
||||||
if (selectIds.value.length <= 0) {
|
|
||||||
app.$message.error('请先选择地块');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
infoVisible.value = true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '导入',
|
|
||||||
disabled: false,
|
|
||||||
loading: false,
|
|
||||||
method: function () {
|
|
||||||
console.log('import');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '导出',
|
|
||||||
disabled: true,
|
|
||||||
loading: state.loading,
|
|
||||||
method: function () {
|
|
||||||
if (isEmpty(state.data)) {
|
|
||||||
app.$message.error('当前暂时没有可供导出的数据!');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
state.loading = true;
|
|
||||||
const fileName = '种植计划明细表';
|
|
||||||
exportPlan(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;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
let infoData = reactive({
|
let infoData = reactive({
|
||||||
landId: [], //土地主键id
|
landId: [], //土地主键id
|
||||||
planId: '', //种植规划主键id
|
planId: '', //种植规划主键id
|
||||||
@ -353,33 +417,16 @@ const infoRules = reactive({
|
|||||||
seedSupplier: [{ required: true, message: '请输入供应商', trigger: 'blur' }],
|
seedSupplier: [{ required: true, message: '请输入供应商', trigger: 'blur' }],
|
||||||
planDate: [{ required: true, message: '请选择种植时间', trigger: 'blur' }],
|
planDate: [{ required: true, message: '请选择种植时间', trigger: 'blur' }],
|
||||||
});
|
});
|
||||||
const workOptions = reactive([
|
|
||||||
{ value: '作业计划1', label: 'Option1' },
|
|
||||||
{ value: '作业计划2', label: 'Option2' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const subPageData = reactive({
|
|
||||||
page: 1,
|
|
||||||
size: 10,
|
|
||||||
total: 0,
|
|
||||||
});
|
|
||||||
const sublist = ref([]);
|
|
||||||
const stageInfo = reactive({
|
|
||||||
stage: '',
|
|
||||||
});
|
|
||||||
const stageRef = ref();
|
|
||||||
const stageOptions = reactive([
|
|
||||||
{ value: '0', label: '苗期' },
|
|
||||||
{ value: '1', label: '花果期' },
|
|
||||||
{ value: '2', label: '采收期' },
|
|
||||||
]);
|
|
||||||
|
|
||||||
let currentRow = reactive({});
|
|
||||||
const stageObj = reactive({
|
const stageObj = reactive({
|
||||||
0: '苗期',
|
0: '苗期',
|
||||||
1: '花果期',
|
1: '花果期',
|
||||||
2: '采收期',
|
2: '采收期',
|
||||||
});
|
});
|
||||||
|
const workOptions = reactive([
|
||||||
|
{ planName: '作业计划1', id: '000001' },
|
||||||
|
{ planName: '作业计划2', id: '000002' },
|
||||||
|
]);
|
||||||
|
|
||||||
let stageInfoVisible = ref(false);
|
let stageInfoVisible = ref(false);
|
||||||
const stageInfoRef = ref();
|
const stageInfoRef = ref();
|
||||||
@ -397,32 +444,186 @@ const stageInfoRules = reactive({
|
|||||||
workId: [{ required: true, message: '请选择作业计划', trigger: 'blur' }],
|
workId: [{ required: true, message: '请选择作业计划', trigger: 'blur' }],
|
||||||
});
|
});
|
||||||
|
|
||||||
// #endregion
|
// 加载
|
||||||
|
const loadData = () => {
|
||||||
/* --------------- methods --------------- */
|
state.loading = true;
|
||||||
// #region
|
state.options.column = JSON.parse(JSON.stringify(state.tableClumn));
|
||||||
|
getPlanList(state.query)
|
||||||
async function getList() {
|
.then((res) => {
|
||||||
const params = { current: pageData.page, size: pageData.size, ...searchCondition };
|
if (res.code === 200) {
|
||||||
let { code, data, msg } = await getPlanList(params);
|
const { current, size, total, records } = res.data;
|
||||||
//console.log('res ---------', data);
|
state.data = records;
|
||||||
list.value = data.records || [];
|
|
||||||
pageData.total = data.total;
|
|
||||||
state.data = data.records;
|
|
||||||
state.pageData = {
|
state.pageData = {
|
||||||
currentPage: data.current || 1,
|
currentPage: current || 1,
|
||||||
pageSize: data.size || 10,
|
pageSize: size || 10,
|
||||||
total: data.total,
|
total: total,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
state.data = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function handleResetSearch() {
|
loadData();
|
||||||
searchRef.value && searchRef.value.resetFields();
|
|
||||||
getList();
|
// 页数
|
||||||
|
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 setCity = (row) => {
|
||||||
|
if (!isEmpty(row.cities)) {
|
||||||
|
row.provinceCode = row?.cities[0] ?? null;
|
||||||
|
row.cityCode = row?.cities[1] ?? null;
|
||||||
|
row.gridAreaCode = row?.cities[2] ?? null;
|
||||||
|
row.townCode = row?.cities[3] ?? null;
|
||||||
|
row.village = row?.cities[3] ?? null;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const selectionChange = (data) => {
|
// 新增
|
||||||
let datalist = data.map((m) => {
|
const rowSave = (row, done, loading) => {
|
||||||
|
state.options.column = JSON.parse(JSON.stringify(state.tableClumn));
|
||||||
|
console.info('新增');
|
||||||
|
// savePlan(row)
|
||||||
|
// .then((res) => {
|
||||||
|
// if (res.code === 200) {
|
||||||
|
// app.$message.success('添加成功!');
|
||||||
|
// done();
|
||||||
|
// loadData();
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// app.$message.error(err.msg);
|
||||||
|
// })
|
||||||
|
// .finally(() => {
|
||||||
|
// loading();
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
const rowEdit = (row) => {
|
||||||
|
infoVisible.value = true;
|
||||||
|
infoData = reactive({
|
||||||
|
...row,
|
||||||
|
});
|
||||||
|
// console.info('编辑');
|
||||||
|
// row.cities = compact([row.provinceCode, row.cityCode, row.gridAreaCode ?? '', row.townCode ?? '', row.village ?? '']);
|
||||||
|
// crudRef.value.rowEdit(row);
|
||||||
|
};
|
||||||
|
const rowUpdate = (row, index, done, loading) => {
|
||||||
|
console.info('更新');
|
||||||
|
// editAlan(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(() => {
|
||||||
|
console.info('删除');
|
||||||
|
delPlan({ id: row.id })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
app.$message.success('删除成功!');
|
||||||
|
done();
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
//导入
|
||||||
|
const onImport = () => {};
|
||||||
|
// 导出
|
||||||
|
const onExport = () => {
|
||||||
|
if (isEmpty(state.data)) {
|
||||||
|
app.$message.error('当前暂时没有可供导出的数据!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state.loading = true;
|
||||||
|
const fileName = '种植记录明细表';
|
||||||
|
// exportPlan(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;
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAdd = () => {
|
||||||
|
infoVisible.value = true;
|
||||||
|
};
|
||||||
|
const subMitInfo = (formEl) => {
|
||||||
|
if (!formEl) return;
|
||||||
|
formEl.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let parmer = {
|
||||||
|
...infoData,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!parmer.id) {
|
||||||
|
let datalist = state.selection.map((m) => {
|
||||||
return { landId: m.landId, landName: m.landName };
|
return { landId: m.landId, landName: m.landName };
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -431,65 +632,8 @@ const selectionChange = (data) => {
|
|||||||
return n.landId;
|
return n.landId;
|
||||||
});
|
});
|
||||||
|
|
||||||
selectIds.value = selectIdsVal.toString();
|
parmer.landId = selectIdsVal.toString() || '';
|
||||||
console.info('selectionChange', selectIds.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const pageChange = (data) => {
|
|
||||||
console.info('pageChange', data);
|
|
||||||
pageData.page = data;
|
|
||||||
getList();
|
|
||||||
};
|
|
||||||
|
|
||||||
function uniqueObjects(arr, key) {
|
|
||||||
return arr.reduce((acc, current) => {
|
|
||||||
const duplicate = acc.find((element) => element[key] === current[key]);
|
|
||||||
if (!duplicate) {
|
|
||||||
acc.push(current);
|
|
||||||
}
|
}
|
||||||
return acc;
|
|
||||||
}, []);
|
|
||||||
}
|
|
||||||
|
|
||||||
function doEdit(row) {
|
|
||||||
infoVisible.value = true;
|
|
||||||
infoData = reactive({
|
|
||||||
...row,
|
|
||||||
});
|
|
||||||
console.info('编辑', infoData);
|
|
||||||
}
|
|
||||||
|
|
||||||
function doDel(row) {
|
|
||||||
console.info('删除');
|
|
||||||
app
|
|
||||||
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
delPlan({ id: row.id })
|
|
||||||
.then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
app.$message.success('删除成功!');
|
|
||||||
getList();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
app.$message.error(err.msg);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
}
|
|
||||||
|
|
||||||
const subMitInfo = (formEl) => {
|
|
||||||
if (!formEl) return;
|
|
||||||
formEl.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
let parmer = {
|
|
||||||
...infoData,
|
|
||||||
landId: selectIds.value || '',
|
|
||||||
};
|
|
||||||
|
|
||||||
console.info('新增种植计划', parmer);
|
console.info('新增种植计划', parmer);
|
||||||
|
|
||||||
@ -498,7 +642,7 @@ const subMitInfo = (formEl) => {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
app.$message.success('编辑成功!');
|
app.$message.success('编辑成功!');
|
||||||
getList();
|
loadData();
|
||||||
infoHide();
|
infoHide();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -510,7 +654,7 @@ const subMitInfo = (formEl) => {
|
|||||||
savePlan(parmer)
|
savePlan(parmer)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
getList();
|
loadData();
|
||||||
infoHide();
|
infoHide();
|
||||||
app.$message.success('添加成功!');
|
app.$message.success('添加成功!');
|
||||||
}
|
}
|
||||||
@ -534,53 +678,74 @@ const infoHide = () => {
|
|||||||
infoVisible.value = false;
|
infoVisible.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addSub = () => {
|
function uniqueObjects(arr, key) {
|
||||||
console.log('新增阶段');
|
return arr.reduce((acc, current) => {
|
||||||
if (!currentRow.id) {
|
const duplicate = acc.find((element) => element[key] === current[key]);
|
||||||
app.$message.error('请选择种植规划');
|
if (!duplicate) {
|
||||||
return;
|
acc.push(current);
|
||||||
}
|
}
|
||||||
stageInfoData.landName = currentRow.landName || '';
|
return acc;
|
||||||
stageInfoData.crop = currentRow.crop || '';
|
}, []);
|
||||||
stageInfoVisible.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
async function getStageList() {
|
|
||||||
const params = { current: subPageData.page, size: subPageData.size, planId: currentRow.id };
|
|
||||||
let { code, data, msg } = await getPlantingStage(params);
|
|
||||||
sublist.value = data.records || [];
|
|
||||||
subPageData.total = data.total;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleResetStage() {
|
//种植阶段相关
|
||||||
stageRef.value && stageRef.value.resetFields();
|
// 刷新
|
||||||
stageInfo.stage = '';
|
const stageRefresh = () => {
|
||||||
console.info('重置所属阶段筛选条件');
|
// loadData();
|
||||||
getStageList();
|
app.$message.success('刷新成功');
|
||||||
}
|
|
||||||
|
|
||||||
const handleSearchStage = () => {
|
|
||||||
if (!currentRow.id) {
|
|
||||||
app.$message.error('请选择种植规划');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getStageList();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const rowClick = (row) => {
|
const rowClick = (row) => {
|
||||||
currentRow = reactive({ ...row });
|
state.currentRow = { ...row };
|
||||||
|
console.info('rowClick', state.currentRow);
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
async function getStageList() {
|
||||||
|
stageState.loading = true;
|
||||||
|
getPlantingStage({ ...stageState.query, planId: state.currentRow.id })
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
const { current, size, total, records } = res.data;
|
||||||
|
stageState.data = records || [];
|
||||||
|
stageState.pageData = {
|
||||||
|
currentPage: current || 1,
|
||||||
|
pageSize: size || 10,
|
||||||
|
total: total,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
stageState.data = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
stageState.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const stageSearch = (params, done) => {
|
||||||
|
if (done) done();
|
||||||
|
stageState.query = params;
|
||||||
|
stageState.query.current = 1;
|
||||||
getStageList();
|
getStageList();
|
||||||
};
|
};
|
||||||
|
|
||||||
const doSubEdit = (row) => {
|
const stageSelection = (rows) => {
|
||||||
console.log('编辑sub');
|
stageState.selection = rows;
|
||||||
stageInfoData.landName = row.landName || '';
|
|
||||||
stageInfoData.crop = row.crop || '';
|
|
||||||
stageInfoVisible.value = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const doSubDel = (row) => {
|
const stageCurrent = (current) => {
|
||||||
console.log('删除sub');
|
stageState.query.current = current;
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const stageSize = (size) => {
|
||||||
|
stageState.query.size = size;
|
||||||
|
getStageList();
|
||||||
|
};
|
||||||
|
|
||||||
|
const stageRowDel = (row, index, done) => {
|
||||||
|
if (isEmpty(row)) return;
|
||||||
app
|
app
|
||||||
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
@ -588,11 +753,13 @@ const doSubDel = (row) => {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
console.info('删除');
|
||||||
delPlantingStage({ id: row.id })
|
delPlantingStage({ id: row.id })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
app.$message.success('删除成功!');
|
app.$message.success('删除成功!');
|
||||||
getStageList();
|
getStageList();
|
||||||
|
done();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@ -601,6 +768,13 @@ const doSubDel = (row) => {
|
|||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
const stageRowEdit = (row) => {
|
||||||
|
stageInfoData.landName = row.landName ? row.landName : state.currentRow.landName || '';
|
||||||
|
stageInfoData.landId = row.landId ? row.landId : state.currentRow.landId || '';
|
||||||
|
stageInfoData.crop = row.crop ? row.crop : state.currentRow.crop || '';
|
||||||
|
stageInfoData.stage = row.stage.toString() || '0';
|
||||||
|
stageInfoVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
const stageinfoHide = () => {
|
const stageinfoHide = () => {
|
||||||
stageInfoRef.value && stageInfoRef.value.resetFields();
|
stageInfoRef.value && stageInfoRef.value.resetFields();
|
||||||
@ -612,7 +786,7 @@ const subMitStateInfo = (formEl) => {
|
|||||||
formEl.validate((valid) => {
|
formEl.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let parmer = {
|
let parmer = {
|
||||||
planId: currentRow.id || '', //种植规划主键id
|
planId: state.currentRow.id || '', //种植规划主键id
|
||||||
stage: stageInfoData.stage || 0, //种植阶段:0->苗期,1>花果期,2->采收期
|
stage: stageInfoData.stage || 0, //种植阶段:0->苗期,1>花果期,2->采收期
|
||||||
workId: stageInfoData.workId || '',
|
workId: stageInfoData.workId || '',
|
||||||
};
|
};
|
||||||
@ -652,12 +826,13 @@ const subMitStateInfo = (formEl) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// #endregion
|
const onStateAdd = () => {
|
||||||
</script>
|
if (!state.currentRow.id) {
|
||||||
|
app.$message.error('请选择种植规划');
|
||||||
<style lang="scss" scoped>
|
return;
|
||||||
.container {
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
}
|
||||||
</style>
|
stageInfoData.landName = state.currentRow.landName || '';
|
||||||
|
stageInfoData.crop = state.currentRow.crop || '';
|
||||||
|
stageInfoVisible.value = true;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
<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 }">
|
<!-- <template #id="{ row }">
|
||||||
<el-image style="width: 50px; height: 50px; cursor: pointer" :src="row.orCodeUrl" fit="cover" lazy @click="onViewCode(row)" />
|
<el-image style="width: 50px; height: 50px; cursor: pointer" :src="row.orCodeUrl" fit="cover" lazy @click="onViewCode(row)" />
|
||||||
</template>
|
</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">
|
||||||
|
@ -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-27 09:16:00
|
* @LastEditTime: 2025-02-28 11:04:41
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { defineConfig, loadEnv } from 'vite';
|
import { defineConfig, loadEnv } from 'vite';
|
||||||
@ -30,30 +30,6 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
target: 'ESNext',
|
target: 'ESNext',
|
||||||
outDir: 'dist',
|
outDir: 'dist',
|
||||||
minify: 'terser',
|
minify: 'terser',
|
||||||
terserOptions: {
|
|
||||||
compress: {
|
|
||||||
drop_console: true,
|
|
||||||
drop_debugger: true,
|
|
||||||
pure_funcs: ['console.log'],
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
comments: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
reportCompressedSize: false,
|
|
||||||
chunkSizeWarningLimit: 2000,
|
|
||||||
rollupOptions: {
|
|
||||||
output: {
|
|
||||||
manualChunks(id) {
|
|
||||||
if (id.includes('node_modules')) {
|
|
||||||
return id.toString().split('node_modules/')[1].split('/')[1].toString();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
chunkFileNames: 'assets/js/[name]-[hash].js',
|
|
||||||
entryFileNames: 'assets/js/[name]-[hash].js',
|
|
||||||
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
@ -128,5 +104,13 @@ 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