feat:土壤类型接口对接完成

This commit is contained in:
李想 2025-03-12 11:35:36 +08:00
parent 251197c631
commit b3558d0997
10 changed files with 188 additions and 12 deletions

View File

@ -82,7 +82,7 @@ export function savePlanStage(data) {
});
}
/* ------ ------ */
/* ------ 土壤类型 ------ */
/* 获取土壤类型列表 */
export function getSoilType(params) {
@ -106,4 +106,17 @@ export function updateSoilType(data) {
data,
});
}
/* 删除土壤类型 */
export function delSoilType(id) {
return request(`/land-resource/baseInfo/soilTypeDelete/${id}`, {
method: 'GET',
});
}
/* 导出土壤类型 */
export function exportSoilType() {
return request('/land-resource/baseInfo/soilTypeExport', {
method: 'GET',
responseType: 'blob',
});
}
// #endregion

View File

@ -1,11 +1,12 @@
import Layout from '@/layouts/index.vue';
import Views from '@/layouts/Views.vue';
const inputSuppliesRoutes = [
{
path: '/sub-government-affairs-service/inputSuppliesManage',
name: 'inputSuppliesManage',
component: Layout,
redirect: '/sub-government-affairs-service/basicInfo',
redirect: '/sub-government-affairs-service/material',
meta: { title: '投入品监管平台', icon: 'Document' },
children: [
// {
@ -15,10 +16,43 @@ const inputSuppliesRoutes = [
// meta: { title: '投入品资源一张图', icon: 'Document' },
// },
{
path: '/sub-government-affairs-service/basicInfo',
name: 'basicInfo',
component: () => import('@/views/inputSuppliesManage/basicInfo/index.vue'),
path: '/sub-government-affairs-service/material',
name: 'material',
component: Views,
redirect: '/sub-government-affairs-service/material/pesticide',
meta: { title: '物资管理', icon: 'Document' },
children: [
{
path: '/sub-government-affairs-service/material/pesticide',
name: 'input-supplies-pesticide',
component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
meta: { title: '农药管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/material/fertilizer',
name: 'input-supplies-fertilizer',
component: () => import('@/views/inputSuppliesManage/material/fertilizer/index.vue'),
meta: { title: '肥料管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/material/ratPoison',
name: 'input-supplies-ratPoison',
component: () => import('@/views/inputSuppliesManage/material/ratPoison/index.vue'),
meta: { title: '兽药管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/material/farmMachinery',
name: 'input-supplies-farmMachinery',
component: () => import('@/views/inputSuppliesManage/material/farmMachinery/index.vue'),
meta: { title: '农机管理', icon: 'Document' },
},
{
path: '/sub-government-affairs-service/material/seed',
name: 'input-supplies-seed',
component: () => import('@/views/inputSuppliesManage/material/seed/index.vue'),
meta: { title: '种源管理', icon: 'Document' },
},
],
},
// {
// path: '/sub-government-affairs-service/productionDealer',

View File

@ -15,7 +15,9 @@
@row-update="handleUpdate"
>
<template #menu-left>
<el-button type="primary" @click="handleDownSoilType">导出</el-button>
<el-button type="success" @click="handleDownSoilType">
<el-icon><Download /></el-icon>导出
</el-button>
</template>
<template #menu="scope">
<custom-table-operate :actions="actions" :data="scope" />

View File

@ -1,6 +1,6 @@
import { ref, onMounted, nextTick } from 'vue';
import { CRUD_OPTIONS } from '@/config';
import { getSoilType, saveSoilType, updateSoilType } from '@/apis/baseInfo';
import { getSoilType, saveSoilType, updateSoilType, delSoilType, exportSoilType } from '@/apis/baseInfo';
import { ElMessage } from 'element-plus';
export default function useSoilTypeHook() {
@ -79,12 +79,14 @@ export default function useSoilTypeHook() {
},
]);
async function getList() {
_loading.value = true;
let params = {
current: pageData.value.currentPage,
size: pageData.value.pageSize,
...condition.value,
};
let res = await getSoilType(params);
_loading.value = false;
if (res.code == 200) {
data.value = res.data.records;
pageData.value.total = res.data.total;
@ -109,11 +111,18 @@ export default function useSoilTypeHook() {
function handleSearchReset() {
resetPage();
}
function handleEdit(row, index) {
function handleEdit({ row, index }) {
crudRef.value.rowEdit(row, index);
}
function handleDel(row) {
console.log('handleDel --- ', row);
async function handleDel({ row }) {
let res = await delSoilType(row.id);
if (res.code == 200) {
ElMessage({
type: 'success',
message: '删除成功',
});
getList();
}
}
async function handleSave(form, loading, done) {
let res = await saveSoilType(form);
@ -153,8 +162,18 @@ export default function useSoilTypeHook() {
pageData.value.pageSize = 10;
getList();
}
function handleDownSoilType() {
console.log('handleDownSoilType');
async function handleDownSoilType() {
let res = await exportSoilType();
if (res.status == 200) {
let a = document.createElement('a');
let blob = new Blob([res.data]);
let url = window.URL.createObjectURL(blob);
a.href = url;
a.download = '土壤类型.xlsx';
a.click();
window.URL.revokeObjectURL(url);
a.remove();
}
}
return {
crudRef,

View File

@ -0,0 +1,22 @@
<template>
<CustomCard>
<section>农机</section>
</CustomCard>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,22 @@
<template>
<CustomCard>
<section>肥料</section>
</CustomCard>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,21 @@
<template>
<CustomCard>
<section>农药</section>
</CustomCard>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,22 @@
<template>
<CustomCard>
<section>兽药</section>
</CustomCard>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>

View File

@ -0,0 +1,21 @@
<template>
<CustomCard>
<section>种子</section>
</CustomCard>
</template>
<script setup>
import { ref } from 'vue';
import CustomCard from '@/components/CustomCard.vue';
/* --------------- data --------------- */
// #region
// #endregion
/* --------------- methods --------------- */
// #region
// #endregion
</script>
<style lang="scss" scoped></style>