土地管理和基础信息维护归类到土地资源管理里面
This commit is contained in:
parent
425cfc4cd3
commit
aab1e69bf9
@ -45,8 +45,8 @@ export const constantRoutes = [
|
||||
},
|
||||
...resourceRouter,
|
||||
...traceRouter,
|
||||
...landsRoutes,
|
||||
...dictRoutes,
|
||||
// ...landsRoutes,
|
||||
// ...dictRoutes,
|
||||
...productOperateMainRoutes,
|
||||
...inputSuppliesRoutes,
|
||||
];
|
||||
|
@ -1,10 +1,11 @@
|
||||
import Layout from '@/layouts/index.vue';
|
||||
import Views from '@/layouts/Views.vue';
|
||||
|
||||
const dictRoutes = [
|
||||
{
|
||||
path: '/sub-government-affairs-service/dict',
|
||||
name: 'dict',
|
||||
component: Layout,
|
||||
component: Views,
|
||||
redirect: '/sub-government-affairs-service/region',
|
||||
meta: { title: '基础信息维护', icon: 'Document' },
|
||||
children: [
|
||||
|
@ -1,10 +1,11 @@
|
||||
import Layout from '@/layouts/index.vue';
|
||||
import Views from '@/layouts/Views.vue';
|
||||
|
||||
const landsRoutes = [
|
||||
{
|
||||
path: '/sub-government-affairs-service/landManage',
|
||||
name: 'landManage',
|
||||
component: Layout,
|
||||
component: Views,
|
||||
redirect: '/sub-government-affairs-service/landsManage',
|
||||
meta: { title: '土地管理', icon: 'Document' },
|
||||
children: [
|
||||
|
@ -20,6 +20,12 @@ export default [
|
||||
name: 'collective',
|
||||
meta: { title: '村集体', icon: 'Document' },
|
||||
},
|
||||
{
|
||||
path: '/sub-government-affairs-service/coop',
|
||||
component: () => import('@/views/productOperateMain/coOp/index.vue'),
|
||||
name: 'coop',
|
||||
meta: { title: '合作社', icon: 'Document' },
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -1,6 +1,8 @@
|
||||
import Layout from '@/layouts/index.vue';
|
||||
import annualplanRouters from './annualplan';
|
||||
import statisticsRoutes from './statisticAnalysis';
|
||||
import landsRoutes from './lands';
|
||||
import dictRoutes from './dict';
|
||||
|
||||
export default [
|
||||
{
|
||||
@ -18,6 +20,8 @@ export default [
|
||||
},
|
||||
...annualplanRouters,
|
||||
...statisticsRoutes,
|
||||
...landsRoutes,
|
||||
...dictRoutes,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -0,0 +1,466 @@
|
||||
<template>
|
||||
<div class="custom-page">
|
||||
<avue-crud
|
||||
ref="crudRef"
|
||||
v-model="state.form"
|
||||
v-model:search="state.query"
|
||||
v-model:page="state.pageData"
|
||||
:table-loading="state.loading"
|
||||
:data="state.data"
|
||||
:option="state.options"
|
||||
@refresh-change="refreshChange"
|
||||
@search-reset="searchChange"
|
||||
@search-change="searchChange"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@row-save="rowSave"
|
||||
@row-update="rowUpdate"
|
||||
@row-del="rowDel"
|
||||
>
|
||||
<template #menu-left>
|
||||
<!-- <el-button type="primary" icon="Upload" @click="onImport">导入</el-button> -->
|
||||
<el-button type="danger" icon="Delete" @click="onBatchDel">批量删除</el-button>
|
||||
</template>
|
||||
|
||||
<!-- <template #operationDate-search>
|
||||
<el-date-picker v-model="timeVal" type="daterange" style="width: 230px" start-placeholder="开始" end-placeholder="结束" />
|
||||
</template> -->
|
||||
|
||||
<template #menu="scope">
|
||||
<custom-table-operate :actions="state.options.actions" :data="scope" />
|
||||
</template>
|
||||
</avue-crud>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useApp } from '@/hooks';
|
||||
import { CRUD_OPTIONS } from '@/config';
|
||||
import { isEmpty, downloadFile } from '@/utils';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import {
|
||||
getOperationRecord,
|
||||
saveOperationRecord,
|
||||
editOperationRecord,
|
||||
delOperationRecord,
|
||||
exportOperationRecord,
|
||||
getAddrCropByLand,
|
||||
importOperationRecord,
|
||||
} from '@/apis/land';
|
||||
|
||||
const { VITE_APP_BASE_API } = import.meta.env;
|
||||
const app = useApp();
|
||||
const UserStore = useUserStore();
|
||||
const crudRef = ref(null);
|
||||
const handleLandChange = async (value, form, done) => {
|
||||
if (!value || !value.item || !value.item.id) return; // 如果没有选择任何地块,则直接返回
|
||||
let val = {};
|
||||
getAddrCropByLand(value.item?.id || '')
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
val = res.data || {};
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
val = {};
|
||||
})
|
||||
.finally(() => {});
|
||||
state.form.crop = val?.crop || value.item?.crop;
|
||||
state.form.address = val?.county + val?.town + val?.village || value.item?.address;
|
||||
};
|
||||
|
||||
const jobTypeOptions = reactive([
|
||||
{ label: '蔬菜', value: '0' },
|
||||
{ label: '水果', value: '1' },
|
||||
]);
|
||||
|
||||
let timeVal = ref([]);
|
||||
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
query: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
},
|
||||
form: {},
|
||||
selection: [],
|
||||
options: {
|
||||
...CRUD_OPTIONS,
|
||||
addBtnText: '添加',
|
||||
searchLabelWidth: '120px',
|
||||
searchSpan: 8,
|
||||
searchGutter: 100,
|
||||
searchMenuPosition: 'center',
|
||||
column: [
|
||||
{
|
||||
label: '主体代码',
|
||||
prop: 'executor',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
search: true,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '主体名称',
|
||||
prop: 'executor',
|
||||
search: true,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '经营产品种类',
|
||||
prop: 'landId',
|
||||
type: 'select',
|
||||
remote: false,
|
||||
search: true,
|
||||
props: {
|
||||
label: 'landName',
|
||||
value: 'id',
|
||||
},
|
||||
dicHeaders: {
|
||||
authorization: UserStore.token,
|
||||
},
|
||||
dicUrl: `${VITE_APP_BASE_API}/land-resource/landManage/page?current=1&size=9999&draftsSaveType=0&landName=&gridName=&owner=`,
|
||||
dicFormatter: (res) => res.data.records ?? [],
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择地块',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
change: handleLandChange,
|
||||
},
|
||||
{
|
||||
label: '主要经营产品',
|
||||
showOverflowTooltip: true,
|
||||
search: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '合作社规模',
|
||||
prop: 'crop',
|
||||
search: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '合作社地址',
|
||||
prop: 'villageCode',
|
||||
type: 'cascader',
|
||||
checkStrictly: false,
|
||||
search: false,
|
||||
props: {
|
||||
label: 'areaName',
|
||||
value: 'areaCode',
|
||||
children: 'areaChildVOS',
|
||||
},
|
||||
dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`,
|
||||
dicHeaders: {
|
||||
authorization: UserStore.token,
|
||||
},
|
||||
dicFormatter: (res) => res.data ?? [],
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '负责人',
|
||||
prop: 'crop',
|
||||
search: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '负责人电话',
|
||||
prop: 'crop',
|
||||
search: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '企业信用代码',
|
||||
prop: 'crop',
|
||||
search: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '经营许可证',
|
||||
prop: 'crop',
|
||||
search: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '经营有效期',
|
||||
prop: 'crop',
|
||||
search: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '审核状态',
|
||||
prop: 'crop',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
search: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '审核意见',
|
||||
prop: 'crop',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
rules: {
|
||||
required: true,
|
||||
message: '请输入',
|
||||
trigger: 'blur',
|
||||
},
|
||||
},
|
||||
{ label: '创建时间', prop: 'crop', addDisplay: false, editDisplay: false, search: false },
|
||||
],
|
||||
searchColumn: [
|
||||
{ label: '主体代码', prop: 'landName', search: true },
|
||||
{ label: '主体名称', prop: 'crop', search: true },
|
||||
{
|
||||
label: '经营产品种类',
|
||||
prop: 'operationType',
|
||||
type: 'select',
|
||||
search: true,
|
||||
dicData: jobTypeOptions,
|
||||
},
|
||||
{
|
||||
label: '创建日期',
|
||||
prop: 'operationDate',
|
||||
type: 'daterange',
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
width: 200,
|
||||
search: true,
|
||||
},
|
||||
],
|
||||
actions: [
|
||||
{
|
||||
name: '详情',
|
||||
icon: 'View',
|
||||
event: ({ row }) => doDetail(row),
|
||||
},
|
||||
{
|
||||
name: '编辑',
|
||||
icon: 'edit',
|
||||
event: ({ row }) => rowEdit(row),
|
||||
},
|
||||
{
|
||||
type: 'danger',
|
||||
name: '删除',
|
||||
icon: 'delete',
|
||||
event: ({ row }) => rowDel(row),
|
||||
},
|
||||
],
|
||||
},
|
||||
pageData: {
|
||||
total: 0,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
data: [],
|
||||
currentRow: {},
|
||||
});
|
||||
|
||||
// 加载
|
||||
const loadData = () => {
|
||||
// state.loading = true;
|
||||
// getOperationRecord(state.query)
|
||||
// .then((res) => {
|
||||
// if (res.code === 200) {
|
||||
// const { current, size, total, records } = res.data;
|
||||
// state.data = records;
|
||||
// state.pageData = {
|
||||
// currentPage: current || 1,
|
||||
// pageSize: size || 10,
|
||||
// total: total,
|
||||
// };
|
||||
// }
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// app.$message.error(err.msg);
|
||||
// state.data = [];
|
||||
// })
|
||||
// .finally(() => {
|
||||
// state.loading = false;
|
||||
// });
|
||||
};
|
||||
|
||||
loadData();
|
||||
|
||||
// 页数
|
||||
const currentChange = (current) => {
|
||||
state.query.current = current;
|
||||
loadData();
|
||||
};
|
||||
|
||||
// 条数
|
||||
const sizeChange = (size) => {
|
||||
state.query.size = size;
|
||||
loadData();
|
||||
};
|
||||
|
||||
// 搜索
|
||||
const searchChange = (params, done) => {
|
||||
if (done) done();
|
||||
state.query = params;
|
||||
state.query.current = 1;
|
||||
loadData();
|
||||
};
|
||||
|
||||
// 刷新
|
||||
const refreshChange = () => {
|
||||
loadData();
|
||||
app.$message.success('刷新成功');
|
||||
};
|
||||
|
||||
// 选择
|
||||
const selectionChange = (rows) => {
|
||||
state.selection = rows;
|
||||
};
|
||||
|
||||
const handleIds = () => {
|
||||
let datalist = state.selection.map((m) => {
|
||||
return { landId: m.landId, landName: m.landName };
|
||||
});
|
||||
|
||||
let selectIdlist = uniqueObjects(datalist, 'landId');
|
||||
let selectIdsVal = selectIdlist.map((n) => {
|
||||
return n.landId;
|
||||
});
|
||||
|
||||
return selectIdsVal.toString() || '';
|
||||
};
|
||||
|
||||
function uniqueObjects(arr, key) {
|
||||
return arr.reduce((acc, current) => {
|
||||
const duplicate = acc.find((element) => element[key] === current[key]);
|
||||
if (!duplicate) {
|
||||
acc.push(current);
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
// 新增
|
||||
const rowSave = (row, done, loading) => {
|
||||
// console.info('新增', row);
|
||||
saveOperationRecord(row)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
app.$message.success('添加成功!');
|
||||
done();
|
||||
loadData();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
app.$message.error(err.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
loading();
|
||||
});
|
||||
};
|
||||
|
||||
// 编辑
|
||||
const rowEdit = (row) => {
|
||||
console.info('编辑', row);
|
||||
crudRef.value.rowEdit(row);
|
||||
};
|
||||
|
||||
const doDetail = (row) => {
|
||||
crudRef.value.rowView(row);
|
||||
};
|
||||
const rowUpdate = (row, index, done, loading) => {
|
||||
console.info('更新');
|
||||
editOperationRecord(row)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
app.$message.success('更新成功!');
|
||||
done();
|
||||
loadData();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
app.$message.error(err.msg);
|
||||
})
|
||||
.finally(() => {
|
||||
loading();
|
||||
});
|
||||
};
|
||||
|
||||
// 删除
|
||||
const rowDel = (row, index, done) => {
|
||||
if (isEmpty(row)) return;
|
||||
app
|
||||
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => {
|
||||
console.info('删除', row.recordId);
|
||||
delOperationRecord(row.recordId || '')
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
app.$message.success('删除成功!');
|
||||
loadData();
|
||||
done();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
app.$message.error(err.msg);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
const onBatchDel = () => {
|
||||
let ids = handleIds();
|
||||
if (!ids.length || ids.length <= 0) {
|
||||
return app.$message.error('请先选择要删除的数据');
|
||||
}
|
||||
};
|
||||
</script>
|
@ -237,15 +237,6 @@ const state = reactive({
|
||||
},
|
||||
},
|
||||
{ label: '创建时间', prop: 'crop', addDisplay: false, editDisplay: false, search: false },
|
||||
{
|
||||
label: '创建日期',
|
||||
prop: 'operationDate',
|
||||
type: 'daterange',
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
width: 200,
|
||||
search: true,
|
||||
},
|
||||
],
|
||||
searchColumn: [
|
||||
{ label: '主体代码', prop: 'landName', search: true },
|
||||
|
Loading…
x
Reference in New Issue
Block a user