This commit is contained in:
李想 2025-02-27 17:30:06 +08:00
parent 547c825e17
commit 491bb5df40
3 changed files with 45 additions and 15 deletions

View File

@ -13,6 +13,13 @@ export function saveLand(params = {}) {
params, params,
}); });
} }
export function exportLands(params = {}) {
return request('/land-resource/landManage/export', {
method: 'GET',
params,
responseType: 'blob',
});
}
export function getAnnualList(params = {}) { export function getAnnualList(params = {}) {
return request('land-resource/annualManage/page', { return request('land-resource/annualManage/page', {

View File

@ -76,7 +76,7 @@ import { reactive, ref, watch } from 'vue';
import LandClassificationType from '@/components/LandClassificationType.vue'; import LandClassificationType from '@/components/LandClassificationType.vue';
import CustomSelect from '@/components/CustomSelect.vue'; import CustomSelect from '@/components/CustomSelect.vue';
import LandIsTranfer from '@/components/LandIsTranfer.vue'; import LandIsTranfer from '@/components/LandIsTranfer.vue';
import { lnadSave, exportLands } from '@/apis/land'; import { saveLand } from '@/apis/land';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { CommonUpload } from '@/apis'; import { CommonUpload } from '@/apis';
@ -85,6 +85,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
landType: {
type: String,
default: '0',
},
}); });
const emit = defineEmits(['close']); const emit = defineEmits(['close']);
/* --------------- data --------------- */ /* --------------- data --------------- */
@ -155,11 +159,12 @@ async function handleSubmit() {
...baseInfo, ...baseInfo,
...propertyInfo, ...propertyInfo,
isDraftsSave: 0, isDraftsSave: 0,
landType: props.landType,
}; };
let ids = ''; let ids = '';
propertyInfo.propertyCertificateUrl.map((item) => (ids += item.id)); propertyInfo.propertyCertificateUrl.map((item) => (ids += item.id));
data.propertyCertificateUrl = ids; data.propertyCertificateUrl = ids;
const res = await lnadSave(data); const res = await saveLand(data);
if (res.code == 200) { if (res.code == 200) {
ElMessage.success('保存成功'); ElMessage.success('保存成功');
resFrom(); resFrom();

View File

@ -1,6 +1,6 @@
<template> <template>
<CustCard> <CustCard>
<el-radio-group v-model="searchCondition.draftsSaveType" class="lands_types" style="margin-bottom: 30px" @change="getList()"> <el-radio-group v-model="searchCondition.landType" class="lands_types" style="margin-bottom: 30px" @change="getList()">
<el-radio-button v-for="item in landsType" :key="'landsType_' + item.value" :value="item.value"> <el-radio-button v-for="item in landsType" :key="'landsType_' + item.value" :value="item.value">
{{ item.label }} {{ item.label }}
</el-radio-button> </el-radio-button>
@ -29,7 +29,7 @@
</el-row> </el-row>
</el-form> </el-form>
<div class="options_btns"> <div class="options_btns">
<el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" :disabled="item.needKey && item.disabled" @click="item.method"> <el-button v-for="(item, i) in btns" :key="'btns_' + i" type="primary" @click="item.method">
{{ item.label }} {{ item.label }}
</el-button> </el-button>
</div> </div>
@ -53,19 +53,25 @@
<el-table-column label="是否上传附件" prop="isUpload" width="110"> <el-table-column label="是否上传附件" prop="isUpload" width="110">
<template #default="{ row }">{{ !row.isUpload ? '是' : '否' }}</template> <template #default="{ row }">{{ !row.isUpload ? '是' : '否' }}</template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" width="200" show-overflow-tooltip /> <el-table-column fixed="right" label="操作" width="200" show-overflow-tooltip>
<template #default="{ row }">
<el-button type="primary" link @click="handleEdit(row)">编辑</el-button>
<el-button type="info" link @click="handleInfo(row)">详情</el-button>
<el-button type="danger" link @click="handleDelete(row)">删除</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<br /> <br />
<Pagina :page-data="pageData" @page-change="(v) => handlePaginaChange(v, true)" @size-hange="(v) => handlePaginaChange(v)" /> <Pagina :page-data="pageData" @page-change="(v) => handlePaginaChange(v, true)" @size-hange="(v) => handlePaginaChange(v)" />
</CustCard> </CustCard>
<CreateLand :visible="addFlag" @close="addFlag = false" /> <CreateLand :visible="addFlag" :row-data="rowData" :land-type="searchCondition.landType" @close="addFlag = false" />
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted } from 'vue'; import { ref, reactive, onMounted } from 'vue';
import Pagina from '@/components/pagina.vue'; import Pagina from '@/components/pagina.vue';
import CustCard from '@/components/CustCard.vue'; import CustCard from '@/components/CustCard.vue';
import { getLandsList } from '@/apis/land.js'; import { getLandsList, exportLands } from '@/apis/land.js';
import CreateLand from './common/CreateLand.vue'; import CreateLand from './common/CreateLand.vue';
onMounted(() => { onMounted(() => {
@ -90,7 +96,7 @@ const landsType = ref([
}, },
]); ]);
const searchCondition = reactive({ const searchCondition = reactive({
draftsSaveType: '0', landType: '0',
landName: '', landName: '',
gridName: '', gridName: '',
owner: '', owner: '',
@ -121,19 +127,13 @@ const btns = reactive([
// }, // },
{ {
label: '导入', label: '导入',
needKey: true,
disabled: true,
method: function () { method: function () {
console.log('import'); console.log('import');
}, },
}, },
{ {
label: '导出', label: '导出',
needKey: true, method: handleExport,
disabled: true,
method: function () {
console.log('export');
},
}, },
]); ]);
@ -177,6 +177,24 @@ function handlePaginaChange(v, t = false) {
} }
getList(); getList();
} }
const attrNames = ref(['农用地', '住宅用地', '园林']);
async function handleExport() {
let res = await exportLands({
landType: searchCondition.landType,
});
if (res) {
let a = document.createElement('a');
a.download = attrNames.value[Number(searchCondition.landType)] + '.xlsx';
let blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
let link = window.URL.createObjectURL(blob);
a.href = link;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(link);
}
console.log('res', res);
}
// #endregion // #endregion
</script> </script>