种植产物修改
This commit is contained in:
parent
91c697644f
commit
89bc263f40
@ -3,31 +3,79 @@ import request from '@/utils/axios';
|
||||
//基础信息维护——字典项管理
|
||||
|
||||
//种植产物相关
|
||||
export function getPlanType(params = {}) {
|
||||
// #region
|
||||
export function getPlanCrop(params = {}) {
|
||||
return request('land-resource/baseInfo/planTypePage', {
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
export function savePlanType(data) {
|
||||
export function savePlanCrop(data) {
|
||||
return request('land-resource/baseInfo/planTypeSave', {
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export function upPlanType(data = {}) {
|
||||
export function upPlanCrop(data = {}) {
|
||||
return request('land-resource/baseInfo/planTypeEdit', {
|
||||
method: 'PUT',
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export function exportPlanType(params = {}) {
|
||||
export function exportPlanCrop(params = {}) {
|
||||
return request('/land-resource/baseInfo/planTypeExport', {
|
||||
method: 'GET',
|
||||
params,
|
||||
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
|
||||
|
@ -5,13 +5,13 @@ export default [
|
||||
path: '/sub-government-affairs-service/productOperateMain',
|
||||
name: 'productOperateMain',
|
||||
component: Layout,
|
||||
redirect: '/sub-government-affairs-service/home',
|
||||
redirect: '/sub-government-affairs-service/mainHome',
|
||||
meta: { title: '生产经营主体', icon: 'icon-shop' },
|
||||
children: [
|
||||
{
|
||||
path: '/sub-government-affairs-service/home',
|
||||
path: '/sub-government-affairs-service/mainHome',
|
||||
component: () => import('@/views/productOperateMain/home/index.vue'),
|
||||
name: 'home',
|
||||
name: 'mainHome',
|
||||
meta: { title: '数据可视化管理', icon: 'Document' },
|
||||
},
|
||||
{
|
||||
|
@ -17,6 +17,7 @@
|
||||
@row-save="rowSave"
|
||||
@row-update="rowUpdate"
|
||||
@row-click="rowClick"
|
||||
@row-del="rowDel"
|
||||
>
|
||||
<template #menu-left>
|
||||
<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 { useUserStore } from '@/store/modules/user';
|
||||
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 app = useApp();
|
||||
@ -174,6 +175,11 @@ const state = reactive({
|
||||
},
|
||||
event: ({ row }) => rowStatus(row),
|
||||
},
|
||||
{
|
||||
name: '删除',
|
||||
icon: 'delete',
|
||||
event: ({ row }) => rowDel(row),
|
||||
},
|
||||
],
|
||||
},
|
||||
pageData: {
|
||||
@ -250,7 +256,7 @@ const stageState = reactive({
|
||||
// 加载
|
||||
const loadData = () => {
|
||||
state.loading = true;
|
||||
getPlanType(state.query)
|
||||
getPlanCrop(state.query)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
const { current, size, total, records } = res.data;
|
||||
@ -311,7 +317,7 @@ const rowSave = (row, done, loading) => {
|
||||
planDate: row.planDate || '',
|
||||
crop: row.crop || '',
|
||||
};
|
||||
savePlanType(parmer)
|
||||
savePlanCrop(parmer)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
app.$message.success('添加成功!');
|
||||
@ -341,7 +347,7 @@ const onExport = () => {
|
||||
}
|
||||
state.loading = true;
|
||||
const fileName = '种植产物明细表';
|
||||
exportPlanType(state.query)
|
||||
exportPlanCrop(state.query)
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
downloadFile(res.data, `${fileName}.xlsx`, 'blob');
|
||||
@ -358,7 +364,7 @@ const onExport = () => {
|
||||
|
||||
const rowUpdate = (row, index, done, loading) => {
|
||||
console.info('更新');
|
||||
upPlanType(row)
|
||||
upPlanCrop(row)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
app.$message.success('更新成功!');
|
||||
@ -387,7 +393,7 @@ const rowStatus = (row) => {
|
||||
...row,
|
||||
status: row.status == 1 ? 0 : 1,
|
||||
};
|
||||
upPlanType(parmer)
|
||||
upPlanCrop(parmer)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
app.$message.success('更新成功!');
|
||||
@ -400,6 +406,31 @@ const rowStatus = (row) => {
|
||||
.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) => {
|
||||
state.currentRow = { ...row };
|
||||
console.info('rowClick', state.currentRow);
|
||||
|
Loading…
x
Reference in New Issue
Block a user