土地资源库50%
This commit is contained in:
parent
63f2686c80
commit
82b4d2abd8
@ -68,3 +68,12 @@ export function getLandById(id) {
|
|||||||
params: { landId: id },
|
params: { landId: id },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 土地信息审批(PUT)
|
||||||
|
export function approveLand(data) {
|
||||||
|
return request({
|
||||||
|
url: '/land-resource/approval/approval',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { fetchLandList, deleteLand, createLand, updateLand } from '@/apis/landResourceManagement/landManagement';
|
import { createLand, deleteLand, editLand, fetchLandList, getLandById } from '@/apis/landResourceManagement/landManagement';
|
||||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ export function useLandCrud(type) {
|
|||||||
await createLand({ ...data, type });
|
await createLand({ ...data, type });
|
||||||
ElMessage.success('新增成功');
|
ElMessage.success('新增成功');
|
||||||
} else {
|
} else {
|
||||||
await updateLand(data);
|
await editLand(data);
|
||||||
ElMessage.success('更新成功');
|
ElMessage.success('更新成功');
|
||||||
}
|
}
|
||||||
formVisible.value = false;
|
formVisible.value = false;
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<template>
|
||||||
|
<LandCrud type="forest" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import LandCrud from './components/LandCrud.vue';
|
||||||
|
</script>
|
@ -142,18 +142,8 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="visible = false">取消</el-button>
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
<template v-if="!isReadonly">
|
||||||
<!-- 土地基本信息 tab -->
|
<el-button type="primary" @click="submitAll">修改</el-button>
|
||||||
<template v-if="activeFormTab === 'basic'">
|
|
||||||
<el-button type="primary" @click="submitBasicInfo">暂存</el-button>
|
|
||||||
<el-button @click="activeFormTab = 'property'">下一步</el-button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 土地产权信息 tab -->
|
|
||||||
<template v-else>
|
|
||||||
<el-button @click="activeFormTab = 'basic'">上一步</el-button>
|
|
||||||
<el-button v-if="formData.id" type="primary" @click="submitPropertyInfo">提交</el-button>
|
|
||||||
<el-button v-else type="primary" @click="submitAll">保存</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@ -272,6 +262,22 @@ const crudOptions = reactive({
|
|||||||
icon: 'delete',
|
icon: 'delete',
|
||||||
event: ({ row }) => handleDelete(row),
|
event: ({ row }) => handleDelete(row),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '审核',
|
||||||
|
icon: 'approve',
|
||||||
|
event: ({ row }) => onApprove(row),
|
||||||
|
},
|
||||||
|
// TODO: 驳回应该有填写驳回原因的弹窗
|
||||||
|
{
|
||||||
|
name: '驳回',
|
||||||
|
icon: 'reject',
|
||||||
|
event: ({ row }) => onReject(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '驳回原因',
|
||||||
|
icon: 'reject',
|
||||||
|
event: ({ row }) => onRejectReason(row),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
const handleTabChange = ({ name }) => {
|
const handleTabChange = ({ name }) => {
|
||||||
@ -347,7 +353,7 @@ const handleSubmit = async () => {
|
|||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// 业务代码
|
// 业务代码
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
import { createLand, deleteLand, editLand, fetchLandList, getLandById } from '@/apis/landResourceManagement/landManagement';
|
import { createLand, deleteLand, editLand, fetchLandList, getLandById, approveLand } from '@/apis/landResourceManagement/landManagement';
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getData();
|
getData();
|
||||||
@ -385,6 +391,53 @@ const fetchLandTypeData = async () => {
|
|||||||
console.error('获取土地类型数据失败', error);
|
console.error('获取土地类型数据失败', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const submitAll = async () => {
|
||||||
|
console.log('提交表单:', formData.value);
|
||||||
|
await editLand(formData.value);
|
||||||
|
ElMessage.success('保存成功');
|
||||||
|
resetForm();
|
||||||
|
visible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onApprove = async (row) => {
|
||||||
|
// UNSUBMIT(-1,"未提交"),
|
||||||
|
// REVIEW(0,"待审核"),
|
||||||
|
// PASS(1,"通过"),
|
||||||
|
// REFUSE(2,"驳回");
|
||||||
|
if (row.landStatus !== 0) {
|
||||||
|
ElMessage.error('该地块状态不是待审核状态');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const requiredBody = {
|
||||||
|
bizType: 'landResInfo',
|
||||||
|
bizId: row.id,
|
||||||
|
status: 1,
|
||||||
|
opinion: '',
|
||||||
|
};
|
||||||
|
await approveLand(requiredBody);
|
||||||
|
ElMessage.success('审核成功');
|
||||||
|
getData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onReject = async (row) => {
|
||||||
|
if (row.landStatus !== 0) {
|
||||||
|
ElMessage.error('该地块状态不是待审核状态');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const requiredBody = {
|
||||||
|
bizType: 'landResInfo',
|
||||||
|
bizId: row.id,
|
||||||
|
status: 2,
|
||||||
|
opinion: '',
|
||||||
|
};
|
||||||
|
await approveLand(requiredBody);
|
||||||
|
ElMessage.success('驳回成功');
|
||||||
|
getData();
|
||||||
|
};
|
||||||
|
// 显示驳回原因
|
||||||
|
const onRejectReason = async (row) => {
|
||||||
|
ElMessageBox.alert(row.rejectReason || '无驳回原因', '驳回原因');
|
||||||
|
};
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
console.log('handleAdd');
|
console.log('handleAdd');
|
||||||
resetForm();
|
resetForm();
|
||||||
|
@ -0,0 +1,113 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :v-model="visible" :title="dialogTitle" width="600px" destroy-on-close :close-on-click-modal="false">
|
||||||
|
<el-form ref="formRef" :model="formModel" :rules="rules" :disabled="isView" label-width="100px">
|
||||||
|
<el-form-item label="地块名称" prop="name">
|
||||||
|
<el-input v-model="formModel.name" placeholder="请输入地块名称" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="所属区域" prop="areaCode">
|
||||||
|
<AreaSelect v-model="formModel.areaCode" :emit-path="false" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="面积(亩)" prop="area">
|
||||||
|
<el-input-number v-model="formModel.area" :min="0" placeholder="请输入面积" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="图像文件" prop="image">
|
||||||
|
<FileUploader v-model="formModel.image" :limit="1" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="formModel.remark" type="textarea" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="close">取消</el-button>
|
||||||
|
<el-button v-if="!isView" type="primary" :loading="submitting" @click="submit">保存</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch, computed } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
initialData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
mode: {
|
||||||
|
type: String,
|
||||||
|
default: 'create', // 'create' | 'edit' | 'view'
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: '', // 地块类型:grass / forest / field
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:visible', 'submit']);
|
||||||
|
|
||||||
|
const formRef = ref(null);
|
||||||
|
const formModel = ref({});
|
||||||
|
const submitting = ref(false);
|
||||||
|
|
||||||
|
const isView = computed(() => props.mode === 'view');
|
||||||
|
const dialogTitle = computed(() => {
|
||||||
|
switch (props.mode) {
|
||||||
|
case 'create':
|
||||||
|
return '新增地块';
|
||||||
|
case 'edit':
|
||||||
|
return '编辑地块';
|
||||||
|
case 'view':
|
||||||
|
return '查看地块';
|
||||||
|
default:
|
||||||
|
return '地块信息';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
||||||
|
areaCode: [{ required: true, message: '请选择区域', trigger: 'change' }],
|
||||||
|
area: [{ required: true, message: '请输入面积', trigger: 'blur' }],
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(val) => {
|
||||||
|
if (val) {
|
||||||
|
formModel.value = { ...props.initialData };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
emit('update:visible', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submit() {
|
||||||
|
if (!formRef.value) return;
|
||||||
|
try {
|
||||||
|
await formRef.value.validate();
|
||||||
|
submitting.value = true;
|
||||||
|
emit('submit', { ...formModel.value });
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('表单校验失败', err);
|
||||||
|
} finally {
|
||||||
|
submitting.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.dialog-footer {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,59 @@
|
|||||||
|
<template>
|
||||||
|
<div class="land-search">
|
||||||
|
<el-form :model="search" inline label-width="100px">
|
||||||
|
<el-form-item label="地块名称">
|
||||||
|
<el-input v-model="search.name" placeholder="请输入地块名称" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="所属区域">
|
||||||
|
<AreaCascader v-model:region-code="search.regionCode" v-model:grid-id="search.id" :width="300" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="onSearch">搜索</el-button>
|
||||||
|
<el-button @click="onReset">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, watch, toRefs } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
search: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['update:search', 'search', 'reset']);
|
||||||
|
|
||||||
|
const search = reactive({ ...props.search });
|
||||||
|
|
||||||
|
watch(
|
||||||
|
search,
|
||||||
|
(val) => {
|
||||||
|
emit('update:search', { ...val });
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSearch = () => {
|
||||||
|
emit('search');
|
||||||
|
};
|
||||||
|
|
||||||
|
const onReset = () => {
|
||||||
|
Object.keys(search).forEach((key) => {
|
||||||
|
search[key] = '';
|
||||||
|
});
|
||||||
|
emit('update:search', { ...search });
|
||||||
|
emit('reset');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.land-search {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
x
Reference in New Issue
Block a user