图斑修改添加上传SHP功能

dianlixunjian
zhufu 2025-02-21 10:04:04 +08:00
parent e32769cb26
commit 350718a2b8
3 changed files with 41 additions and 8 deletions

View File

@ -440,9 +440,9 @@ export function LoadCaseInfoById(params: { id: string }) {
params,
});
}
export function UpdateCaseInfo(data) {
export function UpdateCaseInfo(data,shppath='') {
return defHttp.post({
url: Api.UpdateCaseInfo,
url: `${Api.UpdateCaseInfo}?shppath=${shppath}`,
data,
});
}

View File

@ -127,21 +127,47 @@
</div>
</div>
</div>
<div class="row">
<div class="item" style="width: 100%;">
<div class="label">上传SHP</div>
<div style="flex:9;display:flex;">
<a-upload
v-model:file-list="shpList"
accept=".zip,.rar"
:maxCount="1"
:custom-request="shpCustomRequest"
>
<a-button>
<upload-outlined></upload-outlined>
上传SHP
</a-button>
<template #itemRender="{ file, actions }">
<a-space>
<span>{{ file.name }}</span>
</a-space>
</template>
</a-upload>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { defineProps, onMounted, ref, watch } from "vue"
import { defineProps, onMounted, ref, watch, defineEmits } from "vue"
import { getChildrenTree } from '@/api/demo/system'
import { getAppEnvConfig } from '@/utils/env';
import axios from "axios";
import { Upload } from 'ant-design-vue';
import { PlusOutlined, CloseOutlined, ExclamationCircleOutlined } from '@ant-design/icons-vue';
const props = defineProps(['infoData','infoResult'])
import { PlusOutlined, CloseOutlined, ExclamationCircleOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { uploadFile } from '@/api/formrender/index';
const props = defineProps(['infoData','infoResult','shppath'])
const emits = defineEmits(['update:shppath'])
const countyOptions = ref([])
const streetOptions = ref([])
const communityOptions = ref([])
const fileList = ref<any>([])
const shpList = ref([])
onMounted(() => {
const { id, case_no, case_description, countyid,
countyname, streetid, streetname,communityid, communityname, address, drone_no, lng, lat,
@ -277,6 +303,13 @@ const changeStreet = (val) => {
const changeCommunity = (val) => {
props.infoResult.communityname = communityOptions.value.find(item => item.value == val)?.label
}
const shpCustomRequest = (file) => {
const formData = new FormData()
formData.append('files', file.file)
uploadFile(formData).then(res => {
emits('update:shppath',res[0].filePath)
})
}
</script>
<style lang="scss" scoped>
.content{

View File

@ -31,7 +31,7 @@
:destroyOnClose="true"
@ok="submit"
@cancel="closeInfoModal">
<InfoModal :infoData="infoData" :infoResult="infoResult"/>
<InfoModal :infoData="infoData" :infoResult="infoResult" v-model:shppath="shppath"/>
</a-modal>
<a-modal
width="50%"
@ -59,6 +59,7 @@ const historyModal = ref(false)
const historyCaseId = ref()
const infoData = ref({})
const infoResult = ref({})
const shppath = ref()
const [registerTable, { setTableData, reload, clearSelectedRowKeys, setPagination, setLoading }] =
useTable({
title: '图斑汇总',
@ -98,8 +99,7 @@ const getHistoryList = (record) => {
}
const submit = () => {
console.log('submit',infoResult.value)
UpdateCaseInfo(infoResult.value).then(res => {
UpdateCaseInfo(infoResult.value,shppath.value).then(res => {
console.log(res)
message.success('修改成功')
closeInfoModal()