投入品使用监管,补贴管理模块展示列表开发
This commit is contained in:
parent
93378aa67b
commit
d60ada871c
@ -0,0 +1,76 @@
|
|||||||
|
import request from '@/utils/axios';
|
||||||
|
|
||||||
|
/* 种子补贴-列表 */
|
||||||
|
export function getSeedSubsidyRecords(params) {
|
||||||
|
return request('/inputGoods/subsidy/provenance/page', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 种子补贴-新增 */
|
||||||
|
export function seedSubsidySave(data) {
|
||||||
|
return request('/inputGoods/subsidy/provenance/save', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 种子补贴-编辑 */
|
||||||
|
export function editSeedSubsidy(data) {
|
||||||
|
return request('/inputGoods/subsidy/provenance/edit', {
|
||||||
|
data,
|
||||||
|
method: 'PUT',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 种子补贴-删除 */
|
||||||
|
export function delSeedSubsidy(ids) {
|
||||||
|
return request(`/inputGoods/subsidy/provenance/delete/${ids}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 肥料补贴-列表 */
|
||||||
|
export function getFertilizeSubsidyRecords(params) {
|
||||||
|
return request('/inputGoods/subsidy/fertilize/page', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 肥料补贴-新增 */
|
||||||
|
export function fertilizeSubsidySave(data) {
|
||||||
|
return request('/inputGoods/subsidy/fertilize/save', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 肥料补贴-编辑 */
|
||||||
|
export function editFertilizeSubsidy(data) {
|
||||||
|
return request('/inputGoods/subsidy/fertilize/edit', {
|
||||||
|
data,
|
||||||
|
method: 'PUT',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 肥料补贴-删除 */
|
||||||
|
export function delFertilizeSubsidy(ids) {
|
||||||
|
return request(`/inputGoods/subsidy/fertilize/delete/${ids}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 农药补贴-列表 */
|
||||||
|
export function getPesticideSubsidyRecords(params) {
|
||||||
|
return request('/inputGoods/subsidy/pesticide/page', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 农药补贴-新增 */
|
||||||
|
export function pesticideSubsidySave(data) {
|
||||||
|
return request('/inputGoods/subsidy/pesticide/save', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 农药补贴-编辑 */
|
||||||
|
export function editPesticideSubsidy(data) {
|
||||||
|
return request('/inputGoods/subsidy/pesticide/edit', {
|
||||||
|
data,
|
||||||
|
method: 'PUT',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 农药补贴-删除 */
|
||||||
|
export function delPesticideSubsidy(ids) {
|
||||||
|
return request(`/inputGoods/subsidy/pesticide/delete/${ids}`);
|
||||||
|
}
|
@ -54,3 +54,28 @@ export function editFertilizeUseRegulatory(data) {
|
|||||||
export function delFertilizeUseRegulatory(ids) {
|
export function delFertilizeUseRegulatory(ids) {
|
||||||
return request(`/inputGoods/supervise/fertilize/delete/${ids}`);
|
return request(`/inputGoods/supervise/fertilize/delete/${ids}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 农药使用监管-列表 */
|
||||||
|
export function getPesticideUseRegulatoryRecords(params) {
|
||||||
|
return request('/inputGoods/supervise/pesticide/page', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 农药使用监管-新增 */
|
||||||
|
export function pesticideUseRegulatorySave(data) {
|
||||||
|
return request('/inputGoods/supervise/pesticide/save', {
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 农药使用监管-编辑 */
|
||||||
|
export function editPesticideUseRegulatory(data) {
|
||||||
|
return request('/inputGoods/supervise/pesticide/edit', {
|
||||||
|
data,
|
||||||
|
method: 'PUT',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* 农药使用监管-删除 */
|
||||||
|
export function delPesticideUseRegulatory(ids) {
|
||||||
|
return request(`/inputGoods/supervise/pesticide/delete/${ids}`);
|
||||||
|
}
|
||||||
|
@ -75,6 +75,38 @@ const inputSuppliesRoutes = [
|
|||||||
component: () => import('@/views/inputSuppliesManage/supervisionOfInputs/fertilizerRegulation.vue'),
|
component: () => import('@/views/inputSuppliesManage/supervisionOfInputs/fertilizerRegulation.vue'),
|
||||||
meta: { title: '肥料使用监管', icon: '' },
|
meta: { title: '肥料使用监管', icon: '' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/sub-government-affairs-service/supervisionOfInputs/pesticideRegulation',
|
||||||
|
name: 'pesticideRegulation',
|
||||||
|
component: () => import('@/views/inputSuppliesManage/supervisionOfInputs/pesticideRegulation.vue'),
|
||||||
|
meta: { title: '农药使用监管', icon: '' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/sub-government-affairs-service/subsidyManage',
|
||||||
|
name: 'subsidyManage',
|
||||||
|
redirect: '/sub-government-affairs-service/subsidyManage/seedSubsidy',
|
||||||
|
meta: { title: '补贴管理', icon: 'Connection' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '/sub-government-affairs-service/subsidyManage/seedSubsidy',
|
||||||
|
name: 'seedSubsidy',
|
||||||
|
component: () => import('@/views/inputSuppliesManage/subsidyManage/seedSubsidy.vue'),
|
||||||
|
meta: { title: '种子补贴', icon: '' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/sub-government-affairs-service/subsidyManage/fertilizerSubsidy',
|
||||||
|
name: 'fertilizerSubsidy',
|
||||||
|
component: () => import('@/views/inputSuppliesManage/subsidyManage/fertilizerSubsidy.vue'),
|
||||||
|
meta: { title: '肥料补贴', icon: '' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/sub-government-affairs-service/subsidyManage/pesticideSubsidy',
|
||||||
|
name: 'pesticideSubsidy',
|
||||||
|
component: () => import('@/views/inputSuppliesManage/subsidyManage/pesticideSubsidy.vue'),
|
||||||
|
meta: { title: '农药补贴', icon: '' },
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
|
padding-right: 20px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
.table-cont {
|
.table-cont {
|
||||||
|
@ -0,0 +1,426 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="container-custom">
|
||||||
|
<h2 class="custom-h2">肥料补贴</h2>
|
||||||
|
<div ref="searchBarRef" class="search-box">
|
||||||
|
<div class="search-bar">
|
||||||
|
<div class="search-bar-left">
|
||||||
|
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||||
|
<el-form-item label="关键字" prop="name">
|
||||||
|
<el-input v-model="formInline.name" placeholder="请输入" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="分类" prop="seedTypeId">
|
||||||
|
<el-select v-model="formInline.seedTypeId" placeholder="请选择" clearable @change="seedTypeChange">
|
||||||
|
<el-option v-for="item in seedTypeList" :key="item.id" :value="item.id" :label="item.dataName" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="">
|
||||||
|
<el-button type="primary" icon="Search" @click="onSubmit">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetForm">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table-toolbar">
|
||||||
|
<!-- <el-button type="primary" icon="plus" @click="addItem()">新增</el-button> -->
|
||||||
|
<el-tabs v-model="formInline.status" class="demo-tabs" @tab-click="handleChangeStatus">
|
||||||
|
<el-tab-pane label="已通过" :name="1" :value="1"></el-tab-pane>
|
||||||
|
<el-tab-pane label="已驳回" :name="2" :value="2"></el-tab-pane>
|
||||||
|
<el-tab-pane label="待审核" :name="3" :value="3"></el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
<div class="table-cont">
|
||||||
|
<tableComponent
|
||||||
|
:table-data="tableData"
|
||||||
|
:columns="columns"
|
||||||
|
:show-selection="false"
|
||||||
|
:loading="tableLoading"
|
||||||
|
:total="tableTotal"
|
||||||
|
:current-page="formInline.current"
|
||||||
|
:page-size="formInline.size"
|
||||||
|
:show-sort="false"
|
||||||
|
@page-change="handlePaginationChange"
|
||||||
|
>
|
||||||
|
<!-- 自定义-操作 -->
|
||||||
|
<template #action="slotProps">
|
||||||
|
<el-button type="primary" @click="seeDetails(slotProps.row)">查看</el-button>
|
||||||
|
<el-button type="primary" @click="handleEdit(slotProps.row)">编辑</el-button>
|
||||||
|
<el-button @click="handleDelete(slotProps.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</tableComponent>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="800" :close-on-click-modal="false">
|
||||||
|
<el-form
|
||||||
|
ref="dialogRef"
|
||||||
|
:model="dialogForm"
|
||||||
|
:inline="true"
|
||||||
|
:label-width="'120'"
|
||||||
|
:rules="dialogFormRules"
|
||||||
|
:disabled="formDisabled"
|
||||||
|
class="dialog-form-container"
|
||||||
|
>
|
||||||
|
<el-form-item label="种子种苗名称" prop="seedName" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.seedName" clearable placeholder="请输入种子种苗名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品种名称" prop="varietyName" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.varietyName" clearable placeholder="请输入品种名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品牌" prop="brand" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.brand" clearable placeholder="请输入品牌" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="生产厂家" prop="manufacturer" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.manufacturer" clearable placeholder="请输入生产厂家" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="蔬菜种苗" prop="classifyId" class="dialog-form-item">
|
||||||
|
<el-cascader
|
||||||
|
v-model="dialogForm.classifyId"
|
||||||
|
:options="seedTypeDialogList"
|
||||||
|
:props="cascaderProps"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="handleCascaderChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产品规格" prop="productUnit" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.productUnit" clearable placeholder="请输入产品规格" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<div style="display: flex">
|
||||||
|
<div style="width: 50%; display: inline-block">
|
||||||
|
<el-form-item label="种子种苗主图" prop="photoUrl" class="dialog-form-item" style="width: 100%">
|
||||||
|
<FileUploader v-model="dialogForm.photoUrl" :limit="1" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div style="width: 50%; display: inline-block">
|
||||||
|
<el-form-item label="种子种苗详情图" prop="photoUrlDetail" class="dialog-form-item" style="width: 100%">
|
||||||
|
<FileUploader v-model="dialogForm.photoUrlDetail" :limit="1" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button v-if="!formDisabled" type="primary" @click="onSaveCategory">保存</el-button>
|
||||||
|
<el-button v-if="!formDisabled" @click="cancelDialog">取消</el-button>
|
||||||
|
<el-button v-else @click="cancelDialog">关闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
||||||
|
import tableComponent from '@/components/tableComponent.vue';
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||||
|
const { getMaterailTypes } = inputSuppliesApi;
|
||||||
|
import { getFertilizeSubsidyRecords, fertilizeSubsidySave, editFertilizeSubsidy, delFertilizeSubsidy } from '@/apis/inputSuppliesApi/subsidyManage';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
const app = useApp();
|
||||||
|
|
||||||
|
// 查询条件
|
||||||
|
const formInline = reactive({
|
||||||
|
name: '',
|
||||||
|
status: 1,
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
});
|
||||||
|
const searchForm = ref(null);
|
||||||
|
const onSubmit = () => {
|
||||||
|
formInline.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
const resetForm = () => {
|
||||||
|
searchForm.value.resetFields();
|
||||||
|
};
|
||||||
|
const handleChangeStatus = () => {
|
||||||
|
formInline.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref([]);
|
||||||
|
const selectedIds = ref([]);
|
||||||
|
const tableLoading = ref(false);
|
||||||
|
const tableTotal = ref(0);
|
||||||
|
const columns = ref([
|
||||||
|
{ prop: 'name', label: '申请人姓名' },
|
||||||
|
{ prop: 'idCard', label: '身份证号' },
|
||||||
|
{ prop: 'gridName', label: '所属网格' },
|
||||||
|
{ prop: 'phone', label: '联系方式' },
|
||||||
|
{ prop: 'bankAccount', label: '银行账户信息' },
|
||||||
|
{ prop: 'applicantType', label: '申请人身份' },
|
||||||
|
{ prop: 'landNumber', label: '地块编号' },
|
||||||
|
{ prop: 'planLocation', label: '种植地点' },
|
||||||
|
{ prop: 'cropType', label: '种植作物种类' },
|
||||||
|
{ prop: 'planArea', label: '种植面积(亩)' },
|
||||||
|
// { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
|
||||||
|
]);
|
||||||
|
const handlePaginationChange = ({ page, pageSize }) => {
|
||||||
|
formInline.current = page;
|
||||||
|
formInline.size = pageSize;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
const loadData = async () => {
|
||||||
|
tableLoading.value = true;
|
||||||
|
try {
|
||||||
|
let response = await getFertilizeSubsidyRecords(formInline);
|
||||||
|
tableLoading.value = false;
|
||||||
|
if (response.code == 200) {
|
||||||
|
tableData.value = response.data.records;
|
||||||
|
tableTotal.value = response.data.total;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
tableLoading.value = false;
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const extractThirdLevelChildren = (dataArray) => {
|
||||||
|
let result = [];
|
||||||
|
// 遍历第一层数组
|
||||||
|
for (const level1 of dataArray) {
|
||||||
|
// 检查第一层是否有children且是数组
|
||||||
|
if (level1.children && Array.isArray(level1.children)) {
|
||||||
|
// 遍历第二层数组
|
||||||
|
for (const level2 of level1.children) {
|
||||||
|
// 检查第二层是否有children且是数组
|
||||||
|
if (level2.children && Array.isArray(level2.children)) {
|
||||||
|
// 将第三层的所有对象添加到结果数组中
|
||||||
|
result.push(...level2.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
const seedTypeChange = () => {
|
||||||
|
console.log(formInline.seedTypeId);
|
||||||
|
// 重新获取表格数据,需添加参数
|
||||||
|
};
|
||||||
|
|
||||||
|
const dialogFormVisible = ref(false);
|
||||||
|
const dialogRef = ref(null);
|
||||||
|
const dialogTitle = ref('新增');
|
||||||
|
const formDisabled = ref(false);
|
||||||
|
const dialogForm = reactive({
|
||||||
|
id: '',
|
||||||
|
seedName: '', //种子种苗名称
|
||||||
|
varietyName: '', //品种名称
|
||||||
|
brand: '', //品牌
|
||||||
|
manufacturer: '', //生产厂家
|
||||||
|
classifyId: '', //蔬菜种苗id
|
||||||
|
classifyName: '', //蔬菜种苗名称
|
||||||
|
productSpecification: '', //产品规格(number)
|
||||||
|
productUnit: '', //产品规格单位
|
||||||
|
productAttributes: '', //自定义商品属性
|
||||||
|
photoUrl: '', //种子种苗主图
|
||||||
|
photoUrlDetail: '', //种子种苗详情图
|
||||||
|
});
|
||||||
|
const dialogFormRules = ref({
|
||||||
|
seedName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
|
||||||
|
varietyName: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
|
||||||
|
brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
|
||||||
|
manufacturer: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
|
||||||
|
classifyId: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择蔬菜种苗',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
const addItem = async () => {
|
||||||
|
ElMessage.success('点击新增!');
|
||||||
|
// restDialogForm();
|
||||||
|
// dialogTitle.value = '新增';
|
||||||
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const seeDetails = async (row) => {
|
||||||
|
ElMessage.success('点击查看详情!');
|
||||||
|
// dialogTitle.value = '详情';
|
||||||
|
// setDialogForm(row);
|
||||||
|
// formDisabled.value = true;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const handleEdit = (row) => {
|
||||||
|
ElMessage.success('点击编辑!');
|
||||||
|
// console.log('要编辑的行: ', row);
|
||||||
|
// dialogTitle.value = '编辑';
|
||||||
|
// setDialogForm(row);
|
||||||
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const setDialogForm = (row) => {
|
||||||
|
dialogForm.id = row.id;
|
||||||
|
dialogForm.seedName = row.seedName;
|
||||||
|
dialogForm.varietyName = row.varietyName;
|
||||||
|
dialogForm.brand = row.brand;
|
||||||
|
dialogForm.manufacturer = row.manufacturer;
|
||||||
|
dialogForm.classifyId = row.classifyId;
|
||||||
|
dialogForm.classifyName = row.classifyName;
|
||||||
|
dialogForm.productSpecification = row.productSpecification;
|
||||||
|
dialogForm.productUnit = row.productUnit;
|
||||||
|
dialogForm.productAttributes = row.productAttributes;
|
||||||
|
dialogForm.photoUrl = row.photoUrl;
|
||||||
|
dialogForm.photoUrlDetail = row.photoUrlDetail;
|
||||||
|
};
|
||||||
|
const handleDelete = (row) => {
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
deleteGoods(row.id)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
onSubmit();
|
||||||
|
app.$message.success('删除成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
const deleteGoods = async (ids) => {
|
||||||
|
try {
|
||||||
|
let res = await delFertilizeSubsidy(ids);
|
||||||
|
return res;
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const onSaveCategory = () => {
|
||||||
|
console.log(dialogForm);
|
||||||
|
dialogRef.value.validate(async (valid, fields) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
let param = { ...dialogForm };
|
||||||
|
param.classifyId = dialogForm.classifyId.join(',');
|
||||||
|
param.classifyName = dialogForm.classifyName.join(',');
|
||||||
|
console.log(param);
|
||||||
|
let response;
|
||||||
|
if (dialogTitle.value == '新增') {
|
||||||
|
response = await fertilizeSubsidySave(param);
|
||||||
|
} else {
|
||||||
|
response = await editFertilizeSubsidy(param);
|
||||||
|
}
|
||||||
|
if (response.code == 200) {
|
||||||
|
cancelDialog();
|
||||||
|
onSubmit();
|
||||||
|
if (dialogTitle.value == '新增') {
|
||||||
|
ElMessage.success('新增成功!');
|
||||||
|
} else {
|
||||||
|
ElMessage.success('编辑成功!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response.msg);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const cancelDialog = async () => {
|
||||||
|
restDialogForm();
|
||||||
|
dialogFormVisible.value = false;
|
||||||
|
};
|
||||||
|
const restDialogForm = () => {
|
||||||
|
Object.assign(dialogForm, {
|
||||||
|
id: '',
|
||||||
|
seedName: '', //种子种苗名称
|
||||||
|
varietyName: '', //品种名称
|
||||||
|
brand: '', //品牌
|
||||||
|
manufacturer: '', //生产厂家
|
||||||
|
classifyId: '', //蔬菜种苗id
|
||||||
|
classifyName: '', //蔬菜种苗名称
|
||||||
|
productSpecification: '', //产品规格(number)
|
||||||
|
productUnit: '', //产品规格单位
|
||||||
|
productAttributes: '', //自定义商品属性
|
||||||
|
photoUrl: '', //种子种苗主图
|
||||||
|
photoUrlDetail: '', //种子种苗详情图
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const seedTypeList = ref([]);
|
||||||
|
const seedTypeDialogList = ref([]);
|
||||||
|
const getSeedTypeList = async () => {
|
||||||
|
try {
|
||||||
|
let response = await getMaterailTypes({ moduleType: '4' });
|
||||||
|
console.log(response);
|
||||||
|
if (response.code == 200) {
|
||||||
|
if (response.data?.length > 0) {
|
||||||
|
seedTypeDialogList.value = response.data[0].children;
|
||||||
|
let result = extractThirdLevelChildren(response.data);
|
||||||
|
seedTypeList.value = result;
|
||||||
|
console.log(seedTypeDialogList.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 级联选择器配置
|
||||||
|
const cascaderProps = ref({
|
||||||
|
label: 'dataName', // 选项标签字段名
|
||||||
|
value: 'id', // 选项值字段名
|
||||||
|
children: 'children', // 子选项字段名
|
||||||
|
emitPath: true,
|
||||||
|
expandTrigger: 'hover',
|
||||||
|
});
|
||||||
|
const handleCascaderChange = () => {
|
||||||
|
const selectedNames = getSelectedNames(dialogForm.classifyId);
|
||||||
|
console.log('对应的名称:', selectedNames); // 例如: ['花草类种子', '具体种子名称']
|
||||||
|
// 如果需要,可以将名称也保存到表单数据中
|
||||||
|
dialogForm.classifyName = selectedNames;
|
||||||
|
};
|
||||||
|
const getSelectedNames = (ids) => {
|
||||||
|
if (!ids || !ids.length) return [];
|
||||||
|
|
||||||
|
let names = [];
|
||||||
|
let currentLevel = seedTypeDialogList.value;
|
||||||
|
|
||||||
|
for (const id of ids) {
|
||||||
|
const foundItem = currentLevel.find((item) => item.id === id);
|
||||||
|
if (!foundItem) break;
|
||||||
|
|
||||||
|
names.push(foundItem.dataName);
|
||||||
|
currentLevel = foundItem.children || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return names;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
onSubmit();
|
||||||
|
// getSeedTypeList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.dialog-form-item {
|
||||||
|
:deep(.el-upload--picture-card) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.file-uploader__upload) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-upload-list__item) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,426 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="container-custom">
|
||||||
|
<h2 class="custom-h2">农药补贴</h2>
|
||||||
|
<div ref="searchBarRef" class="search-box">
|
||||||
|
<div class="search-bar">
|
||||||
|
<div class="search-bar-left">
|
||||||
|
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||||
|
<el-form-item label="关键字" prop="name">
|
||||||
|
<el-input v-model="formInline.name" placeholder="请输入" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="分类" prop="seedTypeId">
|
||||||
|
<el-select v-model="formInline.seedTypeId" placeholder="请选择" clearable @change="seedTypeChange">
|
||||||
|
<el-option v-for="item in seedTypeList" :key="item.id" :value="item.id" :label="item.dataName" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="">
|
||||||
|
<el-button type="primary" icon="Search" @click="onSubmit">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetForm">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table-toolbar">
|
||||||
|
<!-- <el-button type="primary" icon="plus" @click="addItem()">新增</el-button> -->
|
||||||
|
<el-tabs v-model="formInline.status" class="demo-tabs" @tab-click="handleChangeStatus">
|
||||||
|
<el-tab-pane label="已通过" :name="1" :value="1"></el-tab-pane>
|
||||||
|
<el-tab-pane label="已驳回" :name="2" :value="2"></el-tab-pane>
|
||||||
|
<el-tab-pane label="待审核" :name="3" :value="3"></el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
<div class="table-cont">
|
||||||
|
<tableComponent
|
||||||
|
:table-data="tableData"
|
||||||
|
:columns="columns"
|
||||||
|
:show-selection="false"
|
||||||
|
:loading="tableLoading"
|
||||||
|
:total="tableTotal"
|
||||||
|
:current-page="formInline.current"
|
||||||
|
:page-size="formInline.size"
|
||||||
|
:show-sort="false"
|
||||||
|
@page-change="handlePaginationChange"
|
||||||
|
>
|
||||||
|
<!-- 自定义-操作 -->
|
||||||
|
<template #action="slotProps">
|
||||||
|
<el-button type="primary" @click="seeDetails(slotProps.row)">查看</el-button>
|
||||||
|
<el-button type="primary" @click="handleEdit(slotProps.row)">编辑</el-button>
|
||||||
|
<el-button @click="handleDelete(slotProps.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</tableComponent>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="800" :close-on-click-modal="false">
|
||||||
|
<el-form
|
||||||
|
ref="dialogRef"
|
||||||
|
:model="dialogForm"
|
||||||
|
:inline="true"
|
||||||
|
:label-width="'120'"
|
||||||
|
:rules="dialogFormRules"
|
||||||
|
:disabled="formDisabled"
|
||||||
|
class="dialog-form-container"
|
||||||
|
>
|
||||||
|
<el-form-item label="种子种苗名称" prop="seedName" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.seedName" clearable placeholder="请输入种子种苗名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品种名称" prop="varietyName" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.varietyName" clearable placeholder="请输入品种名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品牌" prop="brand" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.brand" clearable placeholder="请输入品牌" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="生产厂家" prop="manufacturer" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.manufacturer" clearable placeholder="请输入生产厂家" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="蔬菜种苗" prop="classifyId" class="dialog-form-item">
|
||||||
|
<el-cascader
|
||||||
|
v-model="dialogForm.classifyId"
|
||||||
|
:options="seedTypeDialogList"
|
||||||
|
:props="cascaderProps"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="handleCascaderChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产品规格" prop="productUnit" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.productUnit" clearable placeholder="请输入产品规格" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<div style="display: flex">
|
||||||
|
<div style="width: 50%; display: inline-block">
|
||||||
|
<el-form-item label="种子种苗主图" prop="photoUrl" class="dialog-form-item" style="width: 100%">
|
||||||
|
<FileUploader v-model="dialogForm.photoUrl" :limit="1" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div style="width: 50%; display: inline-block">
|
||||||
|
<el-form-item label="种子种苗详情图" prop="photoUrlDetail" class="dialog-form-item" style="width: 100%">
|
||||||
|
<FileUploader v-model="dialogForm.photoUrlDetail" :limit="1" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button v-if="!formDisabled" type="primary" @click="onSaveCategory">保存</el-button>
|
||||||
|
<el-button v-if="!formDisabled" @click="cancelDialog">取消</el-button>
|
||||||
|
<el-button v-else @click="cancelDialog">关闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
·
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
||||||
|
import tableComponent from '@/components/tableComponent.vue';
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||||
|
const { getMaterailTypes } = inputSuppliesApi;
|
||||||
|
import { getPesticideSubsidyRecords, pesticideSubsidySave, editPesticideSubsidy, delPesticideSubsidy } from '@/apis/inputSuppliesApi/subsidyManage';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
const app = useApp();
|
||||||
|
|
||||||
|
// 查询条件
|
||||||
|
const formInline = reactive({
|
||||||
|
name: '',
|
||||||
|
status: 1,
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
});
|
||||||
|
const searchForm = ref(null);
|
||||||
|
const onSubmit = () => {
|
||||||
|
formInline.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
const resetForm = () => {
|
||||||
|
searchForm.value.resetFields();
|
||||||
|
};
|
||||||
|
const handleChangeStatus = () => {
|
||||||
|
formInline.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref([]);
|
||||||
|
const selectedIds = ref([]);
|
||||||
|
const tableLoading = ref(false);
|
||||||
|
const tableTotal = ref(0);
|
||||||
|
const columns = ref([
|
||||||
|
{ prop: 'name', label: '申请人姓名' },
|
||||||
|
{ prop: 'idCard', label: '身份证号' },
|
||||||
|
{ prop: 'gridName', label: '所属网格' },
|
||||||
|
{ prop: 'phone', label: '联系方式' },
|
||||||
|
{ prop: 'bankAccount', label: '银行账户信息' },
|
||||||
|
{ prop: 'applicantType', label: '申请人身份' },
|
||||||
|
{ prop: 'landNumber', label: '地块编号' },
|
||||||
|
{ prop: 'planLocation', label: '种植地点' },
|
||||||
|
{ prop: 'cropType', label: '种植作物种类' },
|
||||||
|
{ prop: 'planArea', label: '种植面积(亩)' },
|
||||||
|
// { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
|
||||||
|
]);
|
||||||
|
const handlePaginationChange = ({ page, pageSize }) => {
|
||||||
|
formInline.current = page;
|
||||||
|
formInline.size = pageSize;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
const loadData = async () => {
|
||||||
|
tableLoading.value = true;
|
||||||
|
try {
|
||||||
|
let response = await getPesticideSubsidyRecords(formInline);
|
||||||
|
tableLoading.value = false;
|
||||||
|
if (response.code == 200) {
|
||||||
|
tableData.value = response.data.records;
|
||||||
|
tableTotal.value = response.data.total;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
tableLoading.value = false;
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const extractThirdLevelChildren = (dataArray) => {
|
||||||
|
let result = [];
|
||||||
|
// 遍历第一层数组
|
||||||
|
for (const level1 of dataArray) {
|
||||||
|
// 检查第一层是否有children且是数组
|
||||||
|
if (level1.children && Array.isArray(level1.children)) {
|
||||||
|
// 遍历第二层数组
|
||||||
|
for (const level2 of level1.children) {
|
||||||
|
// 检查第二层是否有children且是数组
|
||||||
|
if (level2.children && Array.isArray(level2.children)) {
|
||||||
|
// 将第三层的所有对象添加到结果数组中
|
||||||
|
result.push(...level2.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
const seedTypeChange = () => {
|
||||||
|
console.log(formInline.seedTypeId);
|
||||||
|
// 重新获取表格数据,需添加参数
|
||||||
|
};
|
||||||
|
|
||||||
|
const dialogFormVisible = ref(false);
|
||||||
|
const dialogRef = ref(null);
|
||||||
|
const dialogTitle = ref('新增');
|
||||||
|
const formDisabled = ref(false);
|
||||||
|
const dialogForm = reactive({
|
||||||
|
id: '',
|
||||||
|
seedName: '', //种子种苗名称
|
||||||
|
varietyName: '', //品种名称
|
||||||
|
brand: '', //品牌
|
||||||
|
manufacturer: '', //生产厂家
|
||||||
|
classifyId: '', //蔬菜种苗id
|
||||||
|
classifyName: '', //蔬菜种苗名称
|
||||||
|
productSpecification: '', //产品规格(number)
|
||||||
|
productUnit: '', //产品规格单位
|
||||||
|
productAttributes: '', //自定义商品属性
|
||||||
|
photoUrl: '', //种子种苗主图
|
||||||
|
photoUrlDetail: '', //种子种苗详情图
|
||||||
|
});
|
||||||
|
const dialogFormRules = ref({
|
||||||
|
seedName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
|
||||||
|
varietyName: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
|
||||||
|
brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
|
||||||
|
manufacturer: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
|
||||||
|
classifyId: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择蔬菜种苗',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
const addItem = async () => {
|
||||||
|
ElMessage.success('点击新增!');
|
||||||
|
// restDialogForm();
|
||||||
|
// dialogTitle.value = '新增';
|
||||||
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const seeDetails = async (row) => {
|
||||||
|
ElMessage.success('点击查看详情!');
|
||||||
|
// dialogTitle.value = '详情';
|
||||||
|
// setDialogForm(row);
|
||||||
|
// formDisabled.value = true;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const handleEdit = (row) => {
|
||||||
|
ElMessage.success('点击编辑!');
|
||||||
|
console.log('要编辑的行: ', row);
|
||||||
|
// dialogTitle.value = '编辑';
|
||||||
|
// setDialogForm(row);
|
||||||
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const setDialogForm = (row) => {
|
||||||
|
dialogForm.id = row.id;
|
||||||
|
dialogForm.seedName = row.seedName;
|
||||||
|
dialogForm.varietyName = row.varietyName;
|
||||||
|
dialogForm.brand = row.brand;
|
||||||
|
dialogForm.manufacturer = row.manufacturer;
|
||||||
|
dialogForm.classifyId = row.classifyId;
|
||||||
|
dialogForm.classifyName = row.classifyName;
|
||||||
|
dialogForm.productSpecification = row.productSpecification;
|
||||||
|
dialogForm.productUnit = row.productUnit;
|
||||||
|
dialogForm.productAttributes = row.productAttributes;
|
||||||
|
dialogForm.photoUrl = row.photoUrl;
|
||||||
|
dialogForm.photoUrlDetail = row.photoUrlDetail;
|
||||||
|
};
|
||||||
|
const handleDelete = (row) => {
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
deleteGoods(row.id)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
onSubmit();
|
||||||
|
app.$message.success('删除成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
const deleteGoods = async (ids) => {
|
||||||
|
try {
|
||||||
|
let res = await delPesticideSubsidy(ids);
|
||||||
|
return res;
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const onSaveCategory = () => {
|
||||||
|
console.log(dialogForm);
|
||||||
|
dialogRef.value.validate(async (valid, fields) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
let param = { ...dialogForm };
|
||||||
|
param.classifyId = dialogForm.classifyId.join(',');
|
||||||
|
param.classifyName = dialogForm.classifyName.join(',');
|
||||||
|
console.log(param);
|
||||||
|
let response;
|
||||||
|
if (dialogTitle.value == '新增') {
|
||||||
|
response = await pesticideSubsidySave(param);
|
||||||
|
} else {
|
||||||
|
response = await editPesticideSubsidy(param);
|
||||||
|
}
|
||||||
|
if (response.code == 200) {
|
||||||
|
cancelDialog();
|
||||||
|
onSubmit();
|
||||||
|
if (dialogTitle.value == '新增') {
|
||||||
|
ElMessage.success('新增成功!');
|
||||||
|
} else {
|
||||||
|
ElMessage.success('编辑成功!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response.msg);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const cancelDialog = async () => {
|
||||||
|
restDialogForm();
|
||||||
|
dialogFormVisible.value = false;
|
||||||
|
};
|
||||||
|
const restDialogForm = () => {
|
||||||
|
Object.assign(dialogForm, {
|
||||||
|
id: '',
|
||||||
|
seedName: '', //种子种苗名称
|
||||||
|
varietyName: '', //品种名称
|
||||||
|
brand: '', //品牌
|
||||||
|
manufacturer: '', //生产厂家
|
||||||
|
classifyId: '', //蔬菜种苗id
|
||||||
|
classifyName: '', //蔬菜种苗名称
|
||||||
|
productSpecification: '', //产品规格(number)
|
||||||
|
productUnit: '', //产品规格单位
|
||||||
|
productAttributes: '', //自定义商品属性
|
||||||
|
photoUrl: '', //种子种苗主图
|
||||||
|
photoUrlDetail: '', //种子种苗详情图
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const seedTypeList = ref([]);
|
||||||
|
const seedTypeDialogList = ref([]);
|
||||||
|
const getSeedTypeList = async () => {
|
||||||
|
try {
|
||||||
|
let response = await getMaterailTypes({ moduleType: '4' });
|
||||||
|
console.log(response);
|
||||||
|
if (response.code == 200) {
|
||||||
|
if (response.data?.length > 0) {
|
||||||
|
seedTypeDialogList.value = response.data[0].children;
|
||||||
|
let result = extractThirdLevelChildren(response.data);
|
||||||
|
seedTypeList.value = result;
|
||||||
|
console.log(seedTypeDialogList.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 级联选择器配置
|
||||||
|
const cascaderProps = ref({
|
||||||
|
label: 'dataName', // 选项标签字段名
|
||||||
|
value: 'id', // 选项值字段名
|
||||||
|
children: 'children', // 子选项字段名
|
||||||
|
emitPath: true,
|
||||||
|
expandTrigger: 'hover',
|
||||||
|
});
|
||||||
|
const handleCascaderChange = () => {
|
||||||
|
const selectedNames = getSelectedNames(dialogForm.classifyId);
|
||||||
|
console.log('对应的名称:', selectedNames); // 例如: ['花草类种子', '具体种子名称']
|
||||||
|
// 如果需要,可以将名称也保存到表单数据中
|
||||||
|
dialogForm.classifyName = selectedNames;
|
||||||
|
};
|
||||||
|
const getSelectedNames = (ids) => {
|
||||||
|
if (!ids || !ids.length) return [];
|
||||||
|
|
||||||
|
let names = [];
|
||||||
|
let currentLevel = seedTypeDialogList.value;
|
||||||
|
|
||||||
|
for (const id of ids) {
|
||||||
|
const foundItem = currentLevel.find((item) => item.id === id);
|
||||||
|
if (!foundItem) break;
|
||||||
|
|
||||||
|
names.push(foundItem.dataName);
|
||||||
|
currentLevel = foundItem.children || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return names;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
onSubmit();
|
||||||
|
// getSeedTypeList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.dialog-form-item {
|
||||||
|
:deep(.el-upload--picture-card) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.file-uploader__upload) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-upload-list__item) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,426 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="container-custom">
|
||||||
|
<h2 class="custom-h2">种子补贴</h2>
|
||||||
|
<div ref="searchBarRef" class="search-box">
|
||||||
|
<div class="search-bar">
|
||||||
|
<div class="search-bar-left">
|
||||||
|
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||||
|
<el-form-item label="关键字" prop="name">
|
||||||
|
<el-input v-model="formInline.name" placeholder="请输入" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="分类" prop="seedTypeId">
|
||||||
|
<el-select v-model="formInline.seedTypeId" placeholder="请选择" clearable @change="seedTypeChange">
|
||||||
|
<el-option v-for="item in seedTypeList" :key="item.id" :value="item.id" :label="item.dataName" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="">
|
||||||
|
<el-button type="primary" icon="Search" @click="onSubmit">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetForm">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table-toolbar">
|
||||||
|
<!-- <el-button type="primary" icon="plus" @click="addItem()">新增</el-button> -->
|
||||||
|
<el-tabs v-model="formInline.status" class="demo-tabs" @tab-click="handleChangeStatus">
|
||||||
|
<el-tab-pane label="已通过" :name="1" :value="1"></el-tab-pane>
|
||||||
|
<el-tab-pane label="已驳回" :name="2" :value="2"></el-tab-pane>
|
||||||
|
<el-tab-pane label="待审核" :name="3" :value="3"></el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
<div class="table-cont">
|
||||||
|
<tableComponent
|
||||||
|
:table-data="tableData"
|
||||||
|
:columns="columns"
|
||||||
|
:show-selection="false"
|
||||||
|
:loading="tableLoading"
|
||||||
|
:total="tableTotal"
|
||||||
|
:current-page="formInline.current"
|
||||||
|
:page-size="formInline.size"
|
||||||
|
:show-sort="false"
|
||||||
|
@page-change="handlePaginationChange"
|
||||||
|
>
|
||||||
|
<!-- 自定义-操作 -->
|
||||||
|
<template #action="slotProps">
|
||||||
|
<el-button type="primary" @click="seeDetails(slotProps.row)">查看</el-button>
|
||||||
|
<el-button type="primary" @click="handleEdit(slotProps.row)">编辑</el-button>
|
||||||
|
<el-button @click="handleDelete(slotProps.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</tableComponent>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="800" :close-on-click-modal="false">
|
||||||
|
<el-form :inline="true" :label-width="'auto'">
|
||||||
|
<el-form-item label="地块编号" prop="seedName">
|
||||||
|
<el-input v-model="dialogForm.id" placeholder="请输入地块编号" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="">
|
||||||
|
<el-button type="primary" icon="Search" @click="getDetails">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-descriptions title="地块信息" border>
|
||||||
|
<el-descriptions-item label="地块">kooriookami</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="所属行政区">18100000000</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="所属网格">Suzhou</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<el-descriptions title="经营主体信息" border>
|
||||||
|
<el-descriptions-item label="姓名">kooriookami</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="联系方式">18100000000</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<el-form
|
||||||
|
ref="dialogRef"
|
||||||
|
:model="dialogForm"
|
||||||
|
:inline="true"
|
||||||
|
:label-width="'80'"
|
||||||
|
:rules="dialogFormRules"
|
||||||
|
:disabled="formDisabled"
|
||||||
|
class="dialog-form-container"
|
||||||
|
>
|
||||||
|
<div class="dialog-form-title">农药用药详情</div>
|
||||||
|
<el-form-item label="种子编号" prop="name" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.name" clearable placeholder="请输入姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="种子名称" prop="phone" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.phone" clearable placeholder="请输入联系方式" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用量" required prop="useNumber" class="dialog-form-item">
|
||||||
|
<el-input-number v-model="dialogForm.useNumber" :min="1" :controls="false" placeholder="请输入用药量" style="width: 150px" />
|
||||||
|
<el-select v-model="dialogForm.useUnit" placeholder="请选择" style="width: 80px">
|
||||||
|
<el-option v-for="el in unitList" :key="el.unit" :value="el.unit" :label="el.unit" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="使用时间" prop="detectionTime" class="dialog-form-item">
|
||||||
|
<el-date-picker v-model="dialogForm.detectionTime" :clearable="false" type="date" value-format="YYYY-MM-DD" placeholder="请选择使用时间" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button v-if="!formDisabled" type="primary" @click="onSaveCategory">保存</el-button>
|
||||||
|
<el-button v-if="!formDisabled" @click="cancelDialog">取消</el-button>
|
||||||
|
<el-button v-else @click="cancelDialog">关闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
||||||
|
import tableComponent from '@/components/tableComponent.vue';
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||||
|
const { getMaterailTypes } = inputSuppliesApi;
|
||||||
|
import { getSeedSubsidyRecords, seedSubsidySave, editSeedSubsidy, delSeedSubsidy } from '@/apis/inputSuppliesApi/subsidyManage';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
const app = useApp();
|
||||||
|
|
||||||
|
// 查询条件
|
||||||
|
const formInline = reactive({
|
||||||
|
name: '',
|
||||||
|
status: 1,
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
});
|
||||||
|
const searchForm = ref(null);
|
||||||
|
const onSubmit = () => {
|
||||||
|
formInline.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
const resetForm = () => {
|
||||||
|
searchForm.value.resetFields();
|
||||||
|
};
|
||||||
|
const handleChangeStatus = () => {
|
||||||
|
formInline.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref([]);
|
||||||
|
const selectedIds = ref([]);
|
||||||
|
const tableLoading = ref(false);
|
||||||
|
const tableTotal = ref(0);
|
||||||
|
const columns = ref([
|
||||||
|
{ prop: 'name', label: '申请人姓名' },
|
||||||
|
{ prop: 'idCard', label: '身份证号' },
|
||||||
|
{ prop: 'gridName', label: '所属网格' },
|
||||||
|
{ prop: 'phone', label: '联系方式' },
|
||||||
|
{ prop: 'bankAccount', label: '银行账户信息' },
|
||||||
|
{ prop: 'applicantType', label: '申请人身份' },
|
||||||
|
{ prop: 'landNumber', label: '地块编号' },
|
||||||
|
{ prop: 'planLocation', label: '种植地点' },
|
||||||
|
{ prop: 'cropType', label: '种植作物种类' },
|
||||||
|
{ prop: 'planArea', label: '种植面积(亩)' },
|
||||||
|
// { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
|
||||||
|
]);
|
||||||
|
const handlePaginationChange = ({ page, pageSize }) => {
|
||||||
|
formInline.current = page;
|
||||||
|
formInline.size = pageSize;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
const loadData = async () => {
|
||||||
|
tableLoading.value = true;
|
||||||
|
try {
|
||||||
|
let response = await getSeedSubsidyRecords(formInline);
|
||||||
|
tableLoading.value = false;
|
||||||
|
if (response.code == 200) {
|
||||||
|
tableData.value = response.data.records;
|
||||||
|
tableTotal.value = response.data.total;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
tableLoading.value = false;
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const extractThirdLevelChildren = (dataArray) => {
|
||||||
|
let result = [];
|
||||||
|
// 遍历第一层数组
|
||||||
|
for (const level1 of dataArray) {
|
||||||
|
// 检查第一层是否有children且是数组
|
||||||
|
if (level1.children && Array.isArray(level1.children)) {
|
||||||
|
// 遍历第二层数组
|
||||||
|
for (const level2 of level1.children) {
|
||||||
|
// 检查第二层是否有children且是数组
|
||||||
|
if (level2.children && Array.isArray(level2.children)) {
|
||||||
|
// 将第三层的所有对象添加到结果数组中
|
||||||
|
result.push(...level2.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
const seedTypeChange = () => {
|
||||||
|
console.log(formInline.seedTypeId);
|
||||||
|
// 重新获取表格数据,需添加参数
|
||||||
|
};
|
||||||
|
|
||||||
|
const dialogFormVisible = ref(false);
|
||||||
|
const dialogRef = ref(null);
|
||||||
|
const dialogTitle = ref('新增');
|
||||||
|
const formDisabled = ref(false);
|
||||||
|
const dialogForm = reactive({
|
||||||
|
id: '',
|
||||||
|
seedName: '', //种子种苗名称
|
||||||
|
varietyName: '', //品种名称
|
||||||
|
brand: '', //品牌
|
||||||
|
manufacturer: '', //生产厂家
|
||||||
|
classifyId: '', //蔬菜种苗id
|
||||||
|
classifyName: '', //蔬菜种苗名称
|
||||||
|
productSpecification: '', //产品规格(number)
|
||||||
|
productUnit: '', //产品规格单位
|
||||||
|
productAttributes: '', //自定义商品属性
|
||||||
|
photoUrl: '', //种子种苗主图
|
||||||
|
photoUrlDetail: '', //种子种苗详情图
|
||||||
|
});
|
||||||
|
const dialogFormRules = ref({
|
||||||
|
seedName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
|
||||||
|
varietyName: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
|
||||||
|
brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
|
||||||
|
manufacturer: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
|
||||||
|
classifyId: [{ required: true, message: '请选择蔬菜种苗', trigger: ['change', 'blur'] }],
|
||||||
|
productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
const addItem = async () => {
|
||||||
|
ElMessage.success('点击新增!');
|
||||||
|
// restDialogForm();
|
||||||
|
// dialogTitle.value = '新增';
|
||||||
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const seeDetails = async (row) => {
|
||||||
|
console.log('查看详情: ', row);
|
||||||
|
ElMessage.success('点击查看详情!');
|
||||||
|
// dialogTitle.value = '详情';
|
||||||
|
// setDialogForm(row);
|
||||||
|
// formDisabled.value = true;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const handleEdit = (row) => {
|
||||||
|
console.log('要编辑的行: ', row);
|
||||||
|
ElMessage.success('点击编辑!');
|
||||||
|
// dialogTitle.value = '编辑';
|
||||||
|
// setDialogForm(row);
|
||||||
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const setDialogForm = (row) => {
|
||||||
|
dialogForm.id = row.id;
|
||||||
|
dialogForm.seedName = row.seedName;
|
||||||
|
dialogForm.varietyName = row.varietyName;
|
||||||
|
dialogForm.brand = row.brand;
|
||||||
|
dialogForm.manufacturer = row.manufacturer;
|
||||||
|
dialogForm.classifyId = row.classifyId;
|
||||||
|
dialogForm.classifyName = row.classifyName;
|
||||||
|
dialogForm.productSpecification = row.productSpecification;
|
||||||
|
dialogForm.productUnit = row.productUnit;
|
||||||
|
dialogForm.productAttributes = row.productAttributes;
|
||||||
|
dialogForm.photoUrl = row.photoUrl;
|
||||||
|
dialogForm.photoUrlDetail = row.photoUrlDetail;
|
||||||
|
};
|
||||||
|
const handleDelete = (row) => {
|
||||||
|
console.log('删除操作: ', row);
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
deleteGoods(row.id)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
onSubmit();
|
||||||
|
app.$message.success('删除成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
const deleteGoods = async (ids) => {
|
||||||
|
try {
|
||||||
|
let res = await delSeedSubsidy(ids);
|
||||||
|
return res;
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const onSaveCategory = () => {
|
||||||
|
console.log(dialogForm);
|
||||||
|
dialogRef.value.validate(async (valid, fields) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
let param = { ...dialogForm };
|
||||||
|
param.classifyId = dialogForm.classifyId.join(',');
|
||||||
|
param.classifyName = dialogForm.classifyName.join(',');
|
||||||
|
console.log(param);
|
||||||
|
let response;
|
||||||
|
if (dialogTitle.value == '新增') {
|
||||||
|
response = await seedSubsidySave(param);
|
||||||
|
} else {
|
||||||
|
response = await editSeedSubsidy(param);
|
||||||
|
}
|
||||||
|
if (response.code == 200) {
|
||||||
|
cancelDialog();
|
||||||
|
onSubmit();
|
||||||
|
if (dialogTitle.value == '新增') {
|
||||||
|
ElMessage.success('新增成功!');
|
||||||
|
} else {
|
||||||
|
ElMessage.success('编辑成功!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response.msg);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const cancelDialog = async () => {
|
||||||
|
restDialogForm();
|
||||||
|
dialogFormVisible.value = false;
|
||||||
|
};
|
||||||
|
const restDialogForm = () => {
|
||||||
|
Object.assign(dialogForm, {
|
||||||
|
id: '',
|
||||||
|
seedName: '', //种子种苗名称
|
||||||
|
varietyName: '', //品种名称
|
||||||
|
brand: '', //品牌
|
||||||
|
manufacturer: '', //生产厂家
|
||||||
|
classifyId: '', //蔬菜种苗id
|
||||||
|
classifyName: '', //蔬菜种苗名称
|
||||||
|
productSpecification: '', //产品规格(number)
|
||||||
|
productUnit: '', //产品规格单位
|
||||||
|
productAttributes: '', //自定义商品属性
|
||||||
|
photoUrl: '', //种子种苗主图
|
||||||
|
photoUrlDetail: '', //种子种苗详情图
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const seedTypeList = ref([]);
|
||||||
|
const seedTypeDialogList = ref([]);
|
||||||
|
const getSeedTypeList = async () => {
|
||||||
|
try {
|
||||||
|
let response = await getMaterailTypes({ moduleType: '4' });
|
||||||
|
console.log(response);
|
||||||
|
if (response.code == 200) {
|
||||||
|
if (response.data?.length > 0) {
|
||||||
|
seedTypeDialogList.value = response.data[0].children;
|
||||||
|
let result = extractThirdLevelChildren(response.data);
|
||||||
|
seedTypeList.value = result;
|
||||||
|
console.log(seedTypeDialogList.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 级联选择器配置
|
||||||
|
const cascaderProps = ref({
|
||||||
|
label: 'dataName', // 选项标签字段名
|
||||||
|
value: 'id', // 选项值字段名
|
||||||
|
children: 'children', // 子选项字段名
|
||||||
|
emitPath: true,
|
||||||
|
expandTrigger: 'hover',
|
||||||
|
});
|
||||||
|
const handleCascaderChange = () => {
|
||||||
|
const selectedNames = getSelectedNames(dialogForm.classifyId);
|
||||||
|
console.log('对应的名称:', selectedNames); // 例如: ['花草类种子', '具体种子名称']
|
||||||
|
// 如果需要,可以将名称也保存到表单数据中
|
||||||
|
dialogForm.classifyName = selectedNames;
|
||||||
|
};
|
||||||
|
const getSelectedNames = (ids) => {
|
||||||
|
if (!ids || !ids.length) return [];
|
||||||
|
|
||||||
|
let names = [];
|
||||||
|
let currentLevel = seedTypeDialogList.value;
|
||||||
|
|
||||||
|
for (const id of ids) {
|
||||||
|
const foundItem = currentLevel.find((item) => item.id === id);
|
||||||
|
if (!foundItem) break;
|
||||||
|
|
||||||
|
names.push(foundItem.dataName);
|
||||||
|
currentLevel = foundItem.children || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return names;
|
||||||
|
};
|
||||||
|
|
||||||
|
const unitList = ref([
|
||||||
|
{ id: '1', unit: 'kg' },
|
||||||
|
{ id: '2', unit: 'g' },
|
||||||
|
{ id: '3', unit: 'L' },
|
||||||
|
{ id: '4', unit: 'ml' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
onSubmit();
|
||||||
|
// getSeedTypeList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.dialog-form-item {
|
||||||
|
:deep(.el-upload--picture-card) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.file-uploader__upload) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-upload-list__item) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -7,7 +7,7 @@
|
|||||||
<div class="search-bar-left">
|
<div class="search-bar-left">
|
||||||
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||||
<el-form-item label="关键字" prop="name">
|
<el-form-item label="关键字" prop="name">
|
||||||
<el-input v-model="formInline.name" placeholder="请输入姓名" clearable />
|
<el-input v-model="formInline.name" placeholder="请输入" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="分类" prop="seedTypeId">
|
<!-- <el-form-item label="分类" prop="seedTypeId">
|
||||||
<el-select v-model="formInline.seedTypeId" placeholder="请选择" clearable @change="seedTypeChange">
|
<el-select v-model="formInline.seedTypeId" placeholder="请选择" clearable @change="seedTypeChange">
|
||||||
@ -143,13 +143,13 @@ const selectedIds = ref([]);
|
|||||||
const tableLoading = ref(false);
|
const tableLoading = ref(false);
|
||||||
const tableTotal = ref(0);
|
const tableTotal = ref(0);
|
||||||
const columns = ref([
|
const columns = ref([
|
||||||
{ prop: 'regionName', label: '所属行政区域' },
|
{ prop: 'regionCode', label: '行政区域编码' },
|
||||||
{ prop: 'regionCode', label: '行政区域编号' },
|
{ prop: 'regionName', label: '行政区域名称' },
|
||||||
|
{ prop: 'gridId', label: '网格编码' },
|
||||||
|
{ prop: 'gridName', label: '网格名称' },
|
||||||
|
{ prop: 'landId', label: '地块编码' },
|
||||||
{ prop: 'landName', label: '地块名称' },
|
{ prop: 'landName', label: '地块名称' },
|
||||||
{ prop: 'landId', label: '地块编号' },
|
{ prop: 'name', label: '姓名' },
|
||||||
{ prop: 'gridName', label: '所属网格' },
|
|
||||||
{ prop: 'gridId', label: '网格编号' },
|
|
||||||
{ prop: 'name', label: '负责人姓名' },
|
|
||||||
{ prop: 'phone', label: '联系方式' },
|
{ prop: 'phone', label: '联系方式' },
|
||||||
{ prop: 'fertilizeId', label: '化肥编号' },
|
{ prop: 'fertilizeId', label: '化肥编号' },
|
||||||
{ prop: 'fertilizeName', label: '化肥名称' },
|
{ prop: 'fertilizeName', label: '化肥名称' },
|
||||||
@ -231,27 +231,27 @@ const dialogFormRules = ref({
|
|||||||
productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
|
productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
|
||||||
});
|
});
|
||||||
|
|
||||||
// 新增操作
|
|
||||||
const addItem = async () => {
|
const addItem = async () => {
|
||||||
restDialogForm();
|
ElMessage.success('点击新增!');
|
||||||
dialogTitle.value = '新增';
|
// restDialogForm();
|
||||||
formDisabled.value = false;
|
// dialogTitle.value = '新增';
|
||||||
dialogFormVisible.value = true;
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
};
|
};
|
||||||
// 查看详情
|
|
||||||
const seeDetails = async (row) => {
|
const seeDetails = async (row) => {
|
||||||
dialogTitle.value = '详情';
|
ElMessage.success('点击查看详情!');
|
||||||
setDialogForm(row);
|
// dialogTitle.value = '详情';
|
||||||
formDisabled.value = true;
|
// setDialogForm(row);
|
||||||
dialogFormVisible.value = true;
|
// formDisabled.value = true;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
};
|
};
|
||||||
// 编辑操作
|
|
||||||
const handleEdit = (row) => {
|
const handleEdit = (row) => {
|
||||||
console.log('要编辑的行: ', row);
|
ElMessage.success('点击编辑!');
|
||||||
dialogTitle.value = '编辑';
|
// console.log('要编辑的行: ', row);
|
||||||
setDialogForm(row);
|
// dialogTitle.value = '编辑';
|
||||||
formDisabled.value = false;
|
// setDialogForm(row);
|
||||||
dialogFormVisible.value = true;
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
};
|
};
|
||||||
const setDialogForm = (row) => {
|
const setDialogForm = (row) => {
|
||||||
dialogForm.id = row.id;
|
dialogForm.id = row.id;
|
||||||
@ -267,7 +267,6 @@ const setDialogForm = (row) => {
|
|||||||
dialogForm.photoUrl = row.photoUrl;
|
dialogForm.photoUrl = row.photoUrl;
|
||||||
dialogForm.photoUrlDetail = row.photoUrlDetail;
|
dialogForm.photoUrlDetail = row.photoUrlDetail;
|
||||||
};
|
};
|
||||||
// 删除操作
|
|
||||||
const handleDelete = (row) => {
|
const handleDelete = (row) => {
|
||||||
app
|
app
|
||||||
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
@ -0,0 +1,421 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<div class="container-custom">
|
||||||
|
<h2 class="custom-h2">农药使用监管</h2>
|
||||||
|
<div ref="searchBarRef" class="search-box">
|
||||||
|
<div class="search-bar">
|
||||||
|
<div class="search-bar-left">
|
||||||
|
<el-form ref="searchForm" :inline="true" :model="formInline" class="demo-form-inline" :label-width="'auto'">
|
||||||
|
<el-form-item label="关键字" prop="name">
|
||||||
|
<el-input v-model="formInline.name" placeholder="请输入" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="分类" prop="seedTypeId">
|
||||||
|
<el-select v-model="formInline.seedTypeId" placeholder="请选择" clearable @change="seedTypeChange">
|
||||||
|
<el-option v-for="item in seedTypeList" :key="item.id" :value="item.id" :label="item.dataName" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="">
|
||||||
|
<el-button type="primary" icon="Search" @click="onSubmit">查询</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetForm">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table-toolbar">
|
||||||
|
<el-button type="primary" icon="plus" @click="addItem()">新增</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="table-cont">
|
||||||
|
<tableComponent
|
||||||
|
:table-data="tableData"
|
||||||
|
:columns="columns"
|
||||||
|
:show-selection="false"
|
||||||
|
:loading="tableLoading"
|
||||||
|
:total="tableTotal"
|
||||||
|
:current-page="formInline.current"
|
||||||
|
:page-size="formInline.size"
|
||||||
|
:show-sort="false"
|
||||||
|
@page-change="handlePaginationChange"
|
||||||
|
>
|
||||||
|
<!-- 自定义-操作 -->
|
||||||
|
<template #action="slotProps">
|
||||||
|
<el-button type="primary" @click="seeDetails(slotProps.row)">查看</el-button>
|
||||||
|
<el-button type="primary" @click="handleEdit(slotProps.row)">编辑</el-button>
|
||||||
|
<el-button @click="handleDelete(slotProps.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</tableComponent>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="800" :close-on-click-modal="false">
|
||||||
|
<el-form
|
||||||
|
ref="dialogRef"
|
||||||
|
:model="dialogForm"
|
||||||
|
:inline="true"
|
||||||
|
:label-width="'120'"
|
||||||
|
:rules="dialogFormRules"
|
||||||
|
:disabled="formDisabled"
|
||||||
|
class="dialog-form-container"
|
||||||
|
>
|
||||||
|
<el-form-item label="种子种苗名称" prop="seedName" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.seedName" clearable placeholder="请输入种子种苗名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品种名称" prop="varietyName" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.varietyName" clearable placeholder="请输入品种名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品牌" prop="brand" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.brand" clearable placeholder="请输入品牌" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="生产厂家" prop="manufacturer" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.manufacturer" clearable placeholder="请输入生产厂家" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="蔬菜种苗" prop="classifyId" class="dialog-form-item">
|
||||||
|
<el-cascader
|
||||||
|
v-model="dialogForm.classifyId"
|
||||||
|
:options="seedTypeDialogList"
|
||||||
|
:props="cascaderProps"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="handleCascaderChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产品规格" prop="productUnit" class="dialog-form-item">
|
||||||
|
<el-input v-model="dialogForm.productUnit" clearable placeholder="请输入产品规格" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<div style="display: flex">
|
||||||
|
<div style="width: 50%; display: inline-block">
|
||||||
|
<el-form-item label="种子种苗主图" prop="photoUrl" class="dialog-form-item" style="width: 100%">
|
||||||
|
<FileUploader v-model="dialogForm.photoUrl" :limit="1" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div style="width: 50%; display: inline-block">
|
||||||
|
<el-form-item label="种子种苗详情图" prop="photoUrlDetail" class="dialog-form-item" style="width: 100%">
|
||||||
|
<FileUploader v-model="dialogForm.photoUrlDetail" :limit="1" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button v-if="!formDisabled" type="primary" @click="onSaveCategory">保存</el-button>
|
||||||
|
<el-button v-if="!formDisabled" @click="cancelDialog">取消</el-button>
|
||||||
|
<el-button v-else @click="cancelDialog">关闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive, computed, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
||||||
|
import tableComponent from '@/components/tableComponent.vue';
|
||||||
|
import { ElMessage } from 'element-plus';
|
||||||
|
import inputSuppliesApi from '@/apis/inputSuppliesApi';
|
||||||
|
const { getMaterailTypes } = inputSuppliesApi;
|
||||||
|
import {
|
||||||
|
getPesticideUseRegulatoryRecords,
|
||||||
|
pesticideUseRegulatorySave,
|
||||||
|
editPesticideUseRegulatory,
|
||||||
|
delPesticideUseRegulatory,
|
||||||
|
getRowDetails,
|
||||||
|
} from '@/apis/inputSuppliesApi/supervisionOfInputs';
|
||||||
|
import { useApp } from '@/hooks';
|
||||||
|
const app = useApp();
|
||||||
|
|
||||||
|
// 查询条件
|
||||||
|
const formInline = reactive({
|
||||||
|
name: '',
|
||||||
|
seedTypeId: '',
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
});
|
||||||
|
const searchForm = ref(null);
|
||||||
|
const onSubmit = () => {
|
||||||
|
formInline.current = 1;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
const resetForm = () => {
|
||||||
|
searchForm.value.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref([]);
|
||||||
|
const selectedIds = ref([]);
|
||||||
|
const tableLoading = ref(false);
|
||||||
|
const tableTotal = ref(0);
|
||||||
|
const columns = ref([
|
||||||
|
{ prop: 'name', label: '姓名' },
|
||||||
|
{ prop: 'phone', label: '联系方式' },
|
||||||
|
{ prop: 'landName', label: '用药地块' },
|
||||||
|
{ prop: 'landId', label: '地块编码' },
|
||||||
|
{ prop: 'detectionTime', label: '检测时间' },
|
||||||
|
{ prop: 'detectionResult', label: '检测结果' },
|
||||||
|
{ prop: 'detectionUnit', label: '检测单位' },
|
||||||
|
{ prop: 'isUpload', label: '检测报告(是否上传)' },
|
||||||
|
// { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
|
||||||
|
]);
|
||||||
|
const handlePaginationChange = ({ page, pageSize }) => {
|
||||||
|
formInline.current = page;
|
||||||
|
formInline.size = pageSize;
|
||||||
|
loadData();
|
||||||
|
};
|
||||||
|
const loadData = async () => {
|
||||||
|
tableLoading.value = true;
|
||||||
|
try {
|
||||||
|
let response = await getPesticideUseRegulatoryRecords(formInline);
|
||||||
|
tableLoading.value = false;
|
||||||
|
if (response.code == 200) {
|
||||||
|
tableData.value = response.data.records;
|
||||||
|
tableTotal.value = response.data.total;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
tableLoading.value = false;
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const extractThirdLevelChildren = (dataArray) => {
|
||||||
|
let result = [];
|
||||||
|
// 遍历第一层数组
|
||||||
|
for (const level1 of dataArray) {
|
||||||
|
// 检查第一层是否有children且是数组
|
||||||
|
if (level1.children && Array.isArray(level1.children)) {
|
||||||
|
// 遍历第二层数组
|
||||||
|
for (const level2 of level1.children) {
|
||||||
|
// 检查第二层是否有children且是数组
|
||||||
|
if (level2.children && Array.isArray(level2.children)) {
|
||||||
|
// 将第三层的所有对象添加到结果数组中
|
||||||
|
result.push(...level2.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
const seedTypeChange = () => {
|
||||||
|
console.log(formInline.seedTypeId);
|
||||||
|
// 重新获取表格数据,需添加参数
|
||||||
|
};
|
||||||
|
|
||||||
|
const dialogFormVisible = ref(false);
|
||||||
|
const dialogRef = ref(null);
|
||||||
|
const dialogTitle = ref('新增');
|
||||||
|
const formDisabled = ref(false);
|
||||||
|
const dialogForm = reactive({
|
||||||
|
id: '',
|
||||||
|
seedName: '', //种子种苗名称
|
||||||
|
varietyName: '', //品种名称
|
||||||
|
brand: '', //品牌
|
||||||
|
manufacturer: '', //生产厂家
|
||||||
|
classifyId: '', //蔬菜种苗id
|
||||||
|
classifyName: '', //蔬菜种苗名称
|
||||||
|
productSpecification: '', //产品规格(number)
|
||||||
|
productUnit: '', //产品规格单位
|
||||||
|
productAttributes: '', //自定义商品属性
|
||||||
|
photoUrl: '', //种子种苗主图
|
||||||
|
photoUrlDetail: '', //种子种苗详情图
|
||||||
|
});
|
||||||
|
const dialogFormRules = ref({
|
||||||
|
seedName: [{ required: true, message: '请输入种子种苗名称', trigger: 'blur' }],
|
||||||
|
varietyName: [{ required: true, message: '请输入品种名称', trigger: 'blur' }],
|
||||||
|
brand: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
|
||||||
|
manufacturer: [{ required: true, message: '请输入品牌', trigger: 'blur' }],
|
||||||
|
classifyId: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择蔬菜种苗',
|
||||||
|
trigger: ['change', 'blur'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
|
||||||
|
});
|
||||||
|
|
||||||
|
const addItem = async () => {
|
||||||
|
ElMessage.success('点击新增!');
|
||||||
|
// restDialogForm();
|
||||||
|
// dialogTitle.value = '新增';
|
||||||
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const seeDetails = async (row) => {
|
||||||
|
ElMessage.success('点击查看详情!');
|
||||||
|
// dialogTitle.value = '详情';
|
||||||
|
// setDialogForm(row);
|
||||||
|
// formDisabled.value = true;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const handleEdit = (row) => {
|
||||||
|
ElMessage.success('点击编辑!');
|
||||||
|
console.log('要编辑的行: ', row);
|
||||||
|
// dialogTitle.value = '编辑';
|
||||||
|
// setDialogForm(row);
|
||||||
|
// formDisabled.value = false;
|
||||||
|
// dialogFormVisible.value = true;
|
||||||
|
};
|
||||||
|
const setDialogForm = (row) => {
|
||||||
|
dialogForm.id = row.id;
|
||||||
|
dialogForm.seedName = row.seedName;
|
||||||
|
dialogForm.varietyName = row.varietyName;
|
||||||
|
dialogForm.brand = row.brand;
|
||||||
|
dialogForm.manufacturer = row.manufacturer;
|
||||||
|
dialogForm.classifyId = row.classifyId;
|
||||||
|
dialogForm.classifyName = row.classifyName;
|
||||||
|
dialogForm.productSpecification = row.productSpecification;
|
||||||
|
dialogForm.productUnit = row.productUnit;
|
||||||
|
dialogForm.productAttributes = row.productAttributes;
|
||||||
|
dialogForm.photoUrl = row.photoUrl;
|
||||||
|
dialogForm.photoUrlDetail = row.photoUrlDetail;
|
||||||
|
};
|
||||||
|
const handleDelete = (row) => {
|
||||||
|
app
|
||||||
|
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
deleteGoods(row.id)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
onSubmit();
|
||||||
|
app.$message.success('删除成功!');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
app.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
const deleteGoods = async (ids) => {
|
||||||
|
try {
|
||||||
|
let res = await delPesticideUseRegulatory(ids);
|
||||||
|
return res;
|
||||||
|
} catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const onSaveCategory = () => {
|
||||||
|
console.log(dialogForm);
|
||||||
|
dialogRef.value.validate(async (valid, fields) => {
|
||||||
|
if (valid) {
|
||||||
|
try {
|
||||||
|
let param = { ...dialogForm };
|
||||||
|
param.classifyId = dialogForm.classifyId.join(',');
|
||||||
|
param.classifyName = dialogForm.classifyName.join(',');
|
||||||
|
console.log(param);
|
||||||
|
let response;
|
||||||
|
if (dialogTitle.value == '新增') {
|
||||||
|
response = await pesticideUseRegulatorySave(param);
|
||||||
|
} else {
|
||||||
|
response = await editPesticideUseRegulatory(param);
|
||||||
|
}
|
||||||
|
if (response.code == 200) {
|
||||||
|
cancelDialog();
|
||||||
|
onSubmit();
|
||||||
|
if (dialogTitle.value == '新增') {
|
||||||
|
ElMessage.success('新增成功!');
|
||||||
|
} else {
|
||||||
|
ElMessage.success('编辑成功!');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.error(response.msg);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const cancelDialog = async () => {
|
||||||
|
restDialogForm();
|
||||||
|
dialogFormVisible.value = false;
|
||||||
|
};
|
||||||
|
const restDialogForm = () => {
|
||||||
|
Object.assign(dialogForm, {
|
||||||
|
id: '',
|
||||||
|
seedName: '', //种子种苗名称
|
||||||
|
varietyName: '', //品种名称
|
||||||
|
brand: '', //品牌
|
||||||
|
manufacturer: '', //生产厂家
|
||||||
|
classifyId: '', //蔬菜种苗id
|
||||||
|
classifyName: '', //蔬菜种苗名称
|
||||||
|
productSpecification: '', //产品规格(number)
|
||||||
|
productUnit: '', //产品规格单位
|
||||||
|
productAttributes: '', //自定义商品属性
|
||||||
|
photoUrl: '', //种子种苗主图
|
||||||
|
photoUrlDetail: '', //种子种苗详情图
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const seedTypeList = ref([]);
|
||||||
|
const seedTypeDialogList = ref([]);
|
||||||
|
const getSeedTypeList = async () => {
|
||||||
|
try {
|
||||||
|
let response = await getMaterailTypes({ moduleType: '4' });
|
||||||
|
console.log(response);
|
||||||
|
if (response.code == 200) {
|
||||||
|
if (response.data?.length > 0) {
|
||||||
|
seedTypeDialogList.value = response.data[0].children;
|
||||||
|
let result = extractThirdLevelChildren(response.data);
|
||||||
|
seedTypeList.value = result;
|
||||||
|
console.log(seedTypeDialogList.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 级联选择器配置
|
||||||
|
const cascaderProps = ref({
|
||||||
|
label: 'dataName', // 选项标签字段名
|
||||||
|
value: 'id', // 选项值字段名
|
||||||
|
children: 'children', // 子选项字段名
|
||||||
|
emitPath: true,
|
||||||
|
expandTrigger: 'hover',
|
||||||
|
});
|
||||||
|
const handleCascaderChange = () => {
|
||||||
|
const selectedNames = getSelectedNames(dialogForm.classifyId);
|
||||||
|
console.log('对应的名称:', selectedNames); // 例如: ['花草类种子', '具体种子名称']
|
||||||
|
// 如果需要,可以将名称也保存到表单数据中
|
||||||
|
dialogForm.classifyName = selectedNames;
|
||||||
|
};
|
||||||
|
const getSelectedNames = (ids) => {
|
||||||
|
if (!ids || !ids.length) return [];
|
||||||
|
|
||||||
|
let names = [];
|
||||||
|
let currentLevel = seedTypeDialogList.value;
|
||||||
|
|
||||||
|
for (const id of ids) {
|
||||||
|
const foundItem = currentLevel.find((item) => item.id === id);
|
||||||
|
if (!foundItem) break;
|
||||||
|
|
||||||
|
names.push(foundItem.dataName);
|
||||||
|
currentLevel = foundItem.children || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return names;
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
onSubmit();
|
||||||
|
getSeedTypeList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.dialog-form-item {
|
||||||
|
:deep(.el-upload--picture-card) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.file-uploader__upload) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-upload-list__item) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -139,16 +139,18 @@ const selectedIds = ref([]);
|
|||||||
const tableLoading = ref(false);
|
const tableLoading = ref(false);
|
||||||
const tableTotal = ref(0);
|
const tableTotal = ref(0);
|
||||||
const columns = ref([
|
const columns = ref([
|
||||||
{ prop: 'regionName', label: '所属行政区域' },
|
{ prop: 'regionCode', label: '行政区域编码' },
|
||||||
{ prop: 'regionCode', label: '行政区域编号' },
|
{ prop: 'regionName', label: '行政区域名称' },
|
||||||
|
{ prop: 'gridId', label: '网格编码' },
|
||||||
|
{ prop: 'gridName', label: '网格名称' },
|
||||||
|
{ prop: 'landId', label: '地块编码' },
|
||||||
{ prop: 'landName', label: '地块名称' },
|
{ prop: 'landName', label: '地块名称' },
|
||||||
{ prop: 'landId', label: '地块编号' },
|
|
||||||
{ prop: 'gridName', label: '所属网格' },
|
|
||||||
{ prop: 'gridId', label: '网格编号' },
|
|
||||||
{ prop: 'name', label: '负责人姓名' },
|
|
||||||
{ prop: 'phone', label: '联系方式' },
|
|
||||||
{ prop: 'provenanceId', label: '种子编号' },
|
{ prop: 'provenanceId', label: '种子编号' },
|
||||||
{ prop: 'provenanceName', label: '种子名称' },
|
{ prop: 'provenanceName', label: '种子名称' },
|
||||||
|
{ prop: 'provenanceId', label: '使用量' },
|
||||||
|
{ prop: 'provenanceName', label: '使用时间' },
|
||||||
|
{ prop: 'phone', label: '生产经营主体编码' },
|
||||||
|
{ prop: 'name', label: '生产经营主体名称' },
|
||||||
// { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
|
// { prop: 'action', label: '操作', slotName: 'action', width: 230, fixed: 'right' },
|
||||||
]);
|
]);
|
||||||
const handlePaginationChange = ({ page, pageSize }) => {
|
const handlePaginationChange = ({ page, pageSize }) => {
|
||||||
@ -221,7 +223,6 @@ const dialogFormRules = ref({
|
|||||||
productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
|
productUnit: [{ required: true, message: '请输入产品规格', trigger: 'blur' }],
|
||||||
});
|
});
|
||||||
|
|
||||||
// 新增操作
|
|
||||||
const addItem = async () => {
|
const addItem = async () => {
|
||||||
ElMessage.success('点击新增!');
|
ElMessage.success('点击新增!');
|
||||||
// restDialogForm();
|
// restDialogForm();
|
||||||
@ -229,7 +230,6 @@ const addItem = async () => {
|
|||||||
// formDisabled.value = false;
|
// formDisabled.value = false;
|
||||||
// dialogFormVisible.value = true;
|
// dialogFormVisible.value = true;
|
||||||
};
|
};
|
||||||
// 查看详情
|
|
||||||
const seeDetails = async (row) => {
|
const seeDetails = async (row) => {
|
||||||
console.log('查看详情: ', row);
|
console.log('查看详情: ', row);
|
||||||
ElMessage.success('点击查看详情!');
|
ElMessage.success('点击查看详情!');
|
||||||
@ -238,7 +238,6 @@ const seeDetails = async (row) => {
|
|||||||
// formDisabled.value = true;
|
// formDisabled.value = true;
|
||||||
// dialogFormVisible.value = true;
|
// dialogFormVisible.value = true;
|
||||||
};
|
};
|
||||||
// 编辑操作
|
|
||||||
const handleEdit = (row) => {
|
const handleEdit = (row) => {
|
||||||
console.log('要编辑的行: ', row);
|
console.log('要编辑的行: ', row);
|
||||||
ElMessage.success('点击编辑!');
|
ElMessage.success('点击编辑!');
|
||||||
@ -273,7 +272,6 @@ const setDialogForm = (row) => {
|
|||||||
dialogForm.photoUrl = row.photoUrl;
|
dialogForm.photoUrl = row.photoUrl;
|
||||||
dialogForm.photoUrlDetail = row.photoUrlDetail;
|
dialogForm.photoUrlDetail = row.photoUrlDetail;
|
||||||
};
|
};
|
||||||
// 删除操作
|
|
||||||
const handleDelete = (row) => {
|
const handleDelete = (row) => {
|
||||||
console.log('删除操作: ', row);
|
console.log('删除操作: ', row);
|
||||||
app
|
app
|
||||||
|
Loading…
x
Reference in New Issue
Block a user