种植产物修改

This commit is contained in:
lzc 2025-03-12 09:46:15 +08:00
parent 91c697644f
commit 89bc263f40
3 changed files with 92 additions and 13 deletions

View File

@ -3,31 +3,79 @@ import request from '@/utils/axios';
//基础信息维护——字典项管理 //基础信息维护——字典项管理
//种植产物相关 //种植产物相关
export function getPlanType(params = {}) { // #region
export function getPlanCrop(params = {}) {
return request('land-resource/baseInfo/planTypePage', { return request('land-resource/baseInfo/planTypePage', {
method: 'GET', method: 'GET',
params, params,
}); });
} }
export function savePlanType(data) { export function savePlanCrop(data) {
return request('land-resource/baseInfo/planTypeSave', { return request('land-resource/baseInfo/planTypeSave', {
method: 'POST', method: 'POST',
data, data,
}); });
} }
export function upPlanType(data = {}) { export function upPlanCrop(data = {}) {
return request('land-resource/baseInfo/planTypeEdit', { return request('land-resource/baseInfo/planTypeEdit', {
method: 'PUT', method: 'PUT',
data, data,
}); });
} }
export function exportPlanType(params = {}) { export function exportPlanCrop(params = {}) {
return request('/land-resource/baseInfo/planTypeExport', { return request('/land-resource/baseInfo/planTypeExport', {
method: 'GET', method: 'GET',
params, params,
responseType: 'blob', responseType: 'blob',
}); });
} }
export function delPlanCrop(params) {
return request('land-resource/baseInfo/planTypeDelete/' + params.id, {
method: 'DELETE',
});
}
// #endregion
//种植产物对应的种植阶段相关
// #region
// export function getPlanStage(params = {}) {
// return request('land-resource/baseInfo/planTypePage', {
// method: 'GET',
// params,
// });
// }
export function savePlanStage(data) {
return request('land-resource/baseInfo/stageTypeSave', {
method: 'POST',
data,
});
}
// export function upPlanStage(data = {}) {
// return request('land-resource/baseInfo/planTypeEdit', {
// method: 'PUT',
// data,
// });
// }
// export function exportPlanStage(params = {}) {
// return request('/land-resource/baseInfo/planTypeExport', {
// method: 'GET',
// params,
// responseType: 'blob',
// });
// }
// export function delPlanStage(params) {
// return request('land-resource/baseInfo/planTypeDelete/' + params.id, {
// method: 'DELETE',
// });
// }
// #endregion

View File

@ -5,13 +5,13 @@ export default [
path: '/sub-government-affairs-service/productOperateMain', path: '/sub-government-affairs-service/productOperateMain',
name: 'productOperateMain', name: 'productOperateMain',
component: Layout, component: Layout,
redirect: '/sub-government-affairs-service/home', redirect: '/sub-government-affairs-service/mainHome',
meta: { title: '生产经营主体', icon: 'icon-shop' }, meta: { title: '生产经营主体', icon: 'icon-shop' },
children: [ children: [
{ {
path: '/sub-government-affairs-service/home', path: '/sub-government-affairs-service/mainHome',
component: () => import('@/views/productOperateMain/home/index.vue'), component: () => import('@/views/productOperateMain/home/index.vue'),
name: 'home', name: 'mainHome',
meta: { title: '数据可视化管理', icon: 'Document' }, meta: { title: '数据可视化管理', icon: 'Document' },
}, },
{ {

View File

@ -17,6 +17,7 @@
@row-save="rowSave" @row-save="rowSave"
@row-update="rowUpdate" @row-update="rowUpdate"
@row-click="rowClick" @row-click="rowClick"
@row-del="rowDel"
> >
<template #menu-left> <template #menu-left>
<el-button type="success" icon="download" @click="onExport">导出</el-button> <el-button type="success" icon="download" @click="onExport">导出</el-button>
@ -74,7 +75,7 @@ import { CRUD_OPTIONS } from '@/config';
import { isEmpty, downloadFile } from '@/utils'; import { isEmpty, downloadFile } from '@/utils';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { compact } from 'lodash'; import { compact } from 'lodash';
import { getPlanType, savePlanType, upPlanType, exportPlanType } from '@/apis/baseInfo'; import { getPlanCrop, savePlanCrop, upPlanCrop, exportPlanCrop, delPlanCrop } from '@/apis/baseInfo';
const { VITE_APP_BASE_API } = import.meta.env; const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp(); const app = useApp();
@ -174,6 +175,11 @@ const state = reactive({
}, },
event: ({ row }) => rowStatus(row), event: ({ row }) => rowStatus(row),
}, },
{
name: '删除',
icon: 'delete',
event: ({ row }) => rowDel(row),
},
], ],
}, },
pageData: { pageData: {
@ -250,7 +256,7 @@ const stageState = reactive({
// //
const loadData = () => { const loadData = () => {
state.loading = true; state.loading = true;
getPlanType(state.query) getPlanCrop(state.query)
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
const { current, size, total, records } = res.data; const { current, size, total, records } = res.data;
@ -311,7 +317,7 @@ const rowSave = (row, done, loading) => {
planDate: row.planDate || '', planDate: row.planDate || '',
crop: row.crop || '', crop: row.crop || '',
}; };
savePlanType(parmer) savePlanCrop(parmer)
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
app.$message.success('添加成功!'); app.$message.success('添加成功!');
@ -341,7 +347,7 @@ const onExport = () => {
} }
state.loading = true; state.loading = true;
const fileName = '种植产物明细表'; const fileName = '种植产物明细表';
exportPlanType(state.query) exportPlanCrop(state.query)
.then((res) => { .then((res) => {
if (res.status === 200) { if (res.status === 200) {
downloadFile(res.data, `${fileName}.xlsx`, 'blob'); downloadFile(res.data, `${fileName}.xlsx`, 'blob');
@ -358,7 +364,7 @@ const onExport = () => {
const rowUpdate = (row, index, done, loading) => { const rowUpdate = (row, index, done, loading) => {
console.info('更新'); console.info('更新');
upPlanType(row) upPlanCrop(row)
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
app.$message.success('更新成功!'); app.$message.success('更新成功!');
@ -387,7 +393,7 @@ const rowStatus = (row) => {
...row, ...row,
status: row.status == 1 ? 0 : 1, status: row.status == 1 ? 0 : 1,
}; };
upPlanType(parmer) upPlanCrop(parmer)
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
app.$message.success('更新成功!'); app.$message.success('更新成功!');
@ -400,6 +406,31 @@ const rowStatus = (row) => {
.finally(() => {}); .finally(() => {});
}; };
const rowDel = (row, index, done) => {
if (isEmpty(row)) return;
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
console.info('删除');
delPlanCrop({ id: row.id })
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');
loadData();
done();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
})
.catch(() => {});
};
const rowClick = (row) => { const rowClick = (row) => {
state.currentRow = { ...row }; state.currentRow = { ...row };
console.info('rowClick', state.currentRow); console.info('rowClick', state.currentRow);