部分接口对接

main
刘妍 2025-04-17 15:28:41 +08:00
parent bd6d258338
commit 57ff1c4018
9 changed files with 138 additions and 14 deletions

View File

@ -16,7 +16,7 @@ VITE_GLOB_INFO_IMAGE_URL=http://120.222.154.48:6050
# Interface prefix # Interface prefix
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
VITE_GLOB_APP_TITLE = 林业防火平台 VITE_GLOB_APP_TITLE = 费县智慧林业防火平台
VITE_GLOB_APP_LOGO = /logo.png VITE_GLOB_APP_LOGO = /logo.png

View File

@ -24,7 +24,7 @@ VITE_GLOB_UPLOAD_URL=http://120.222.154.7:6050
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
VITE_GLOB_APP_TITLE = 林业防火平台 VITE_GLOB_APP_TITLE = 费县智慧林业防火平台
VITE_GLOB_APP_LOGO = /logo.png VITE_GLOB_APP_LOGO = /logo.png

View File

@ -1,6 +1,10 @@
import { defHttp } from '@/utils/http/axios'; import { defHttp } from '@/utils/http/axios';
import { TableDataByTableNameParams, TempeleteByTableNameParams } from './model/index'; import {
TableDataByTableNameParams,
TempeleteByTableNameParams,
UploadSldStyleParams,
} from './model/index';
enum Api { enum Api {
// 获取列表数据 // 获取列表数据
@ -9,6 +13,8 @@ enum Api {
TempeleteByTableName = '/api/Layer/TempeleteByTableName', TempeleteByTableName = '/api/Layer/TempeleteByTableName',
// 更新单条数据 // 更新单条数据
UpdateTableData = '/api/Layer/UpdateTableData', UpdateTableData = '/api/Layer/UpdateTableData',
// 上传样式
UploadSldStyle = '/api/Layer/UploadSldStyle',
} }
/** /**
* @description: * @description:
@ -27,11 +33,20 @@ export function updateTableData(params: any) {
}); });
} }
/** /**
* @description: * @description:
*/ */
export function tempeleteByTableName(params: TempeleteByTableNameParams) { export function tempeleteByTableName(params: TempeleteByTableNameParams) {
return defHttp.post({ return defHttp.get({
url: Api.TempeleteByTableName, url: Api.TempeleteByTableName,
params, params,
}); });
} }
/**
* @description:
*/
export function uploadSldStyle(params: UploadSldStyleParams) {
return defHttp.get({
url: Api.UploadSldStyle,
params,
});
}

View File

@ -30,4 +30,11 @@ export interface TableDataByTableNameParams {
} }
export interface TempeleteByTableNameParams { export interface TempeleteByTableNameParams {
tablename: string; tablename: string;
type: number;
}
export interface UploadSldStyleParams {
filepath: string;
tablename: string;
styleName: string;
} }

View File

@ -5,7 +5,7 @@ import { Titles01Config } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
export const option = { export const option = {
borderTitle: '费县林业防火平台', borderTitle: '费县智慧林业防火平台',
borderTitleWidth: 1920, borderTitleWidth: 1920,
borderTitleHeight: 98, borderTitleHeight: 98,
borderTitleSize: 18, borderTitleSize: 18,

View File

@ -26,6 +26,7 @@
import axios from 'axios'; import axios from 'axios';
import { getAppEnvConfig } from '@/utils/env'; import { getAppEnvConfig } from '@/utils/env';
import { fun_Delete } from '@/api/demo/files'; import { fun_Delete } from '@/api/demo/files';
import { uploadSldStyle } from '@/api/application/layer';
const { VITE_GLOB_API_URL } = getAppEnvConfig(); const { VITE_GLOB_API_URL } = getAppEnvConfig();
async function fetchXMLDataWithAxios(url) { async function fetchXMLDataWithAxios(url) {
@ -40,7 +41,12 @@
const { createMessage, createConfirm } = useMessage(); const { createMessage, createConfirm } = useMessage();
defineOptions({ name: 'MenuDrawer' }); defineOptions({ name: 'MenuDrawer' });
const editorJson = ref(); const editorJson = ref();
const params: any = ref({});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
console.log(data);
params.value.filepath = data.urlData.url;
params.value.styleName = data.styleName;
params.value.tablename = data.tableName;
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
fileData.value = data.urlData; fileData.value = data.urlData;
// 使 // 使
@ -150,7 +156,18 @@
const changeHandle = (value) => { const changeHandle = (value) => {
editorJson.value = value; editorJson.value = value;
}; };
const editorSubmit = () => {}; const editorSubmit = () => {
console.log(params.value);
uploadSldStyle(params.value).then((res) => {
console.log(res);
if (res) {
closeModal();
createMessage.success('提交成功!');
} else {
createMessage.error('提交失败!');
}
});
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.v-json-box { .v-json-box {

View File

@ -0,0 +1,50 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="下载模板" :showOkBtn="false">
<a-button type="primary" @click="downloadFile(0)">Excel</a-button>
<a-button type="primary" @click="downloadFile(1)">Shp</a-button>
</BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '@/components/Modal';
import { getAppEnvConfig } from '@/utils/env';
import axios from 'axios';
const { VITE_GLOB_API_URL } = getAppEnvConfig();
defineOptions({ name: 'MenuDrawer' });
const props = defineProps(['tableName']);
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
});
const downloadFile = (type) => {
const fileName = type == 0 ? 'Excel模板' : 'Shp模板';
const params = {
type,
tableName: props.tableName,
};
axios({
method: 'get',
url: VITE_GLOB_API_URL + '/api/Layer/TempeleteByTableName',
params: params,
headers: {
'X-Token': localStorage.getItem('X-Token'),
},
responseType: 'blob',
}).then((res) => {
const elink = document.createElement('a');
elink.download = fileName;
elink.style.display = 'none';
elink.href = URL.createObjectURL(res.data);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href);
document.body.removeChild(elink);
});
};
</script>
<style lang="less" scoped>
button {
margin: 10px;
}
</style>

View File

@ -24,7 +24,7 @@
style="width: 200px; margin-right: 10px" style="width: 200px; margin-right: 10px"
/> />
<a-button type="primary" @click="getList"> </a-button> <a-button type="primary" @click="getList"> </a-button>
<a-button type="primary" @click="handleCreate"> </a-button> <a-button type="primary" @click="exportTemplate"> </a-button>
<a-button type="primary" @click="handleItem"> </a-button> <a-button type="primary" @click="handleItem"> </a-button>
<a-button type="primary" @click="changeBatchProcessingModal(true)"> </a-button> <a-button type="primary" @click="changeBatchProcessingModal(true)"> </a-button>
<a-button type="primary" @click="styleHandle"> </a-button> <a-button type="primary" @click="styleHandle"> </a-button>
@ -101,6 +101,8 @@
<!-- 样式配置 --> <!-- 样式配置 -->
<div class="data-style" v-if="showTable == 'style'"> <div class="data-style" v-if="showTable == 'style'">
<div class="img-box"> <div class="img-box">
<a-input v-model:value="styleName" placeholder="样式名称" style="margin-bottom: 10px" />
<p style="color: #ed6f6f" v-if="styleName == ''"></p>
<a-upload-dragger <a-upload-dragger
v-model:fileList="fileList" v-model:fileList="fileList"
name="file" name="file"
@ -144,17 +146,18 @@
@changeBatchProcessingModal="changeBatchProcessingModal" @changeBatchProcessingModal="changeBatchProcessingModal"
/> />
</a-modal> </a-modal>
<TempeleteModel @register="registerTempeleteModel" :tableName="tableName" />
</PageWrapper> </PageWrapper>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { LayerTree, AddModel, Map, EditorModel } from './page'; import { LayerTree, AddModel, Map, EditorModel, TempeleteModel } from './page';
import { ref, UnwrapRef, reactive, onMounted } from 'vue'; import { ref, UnwrapRef, reactive, onMounted } from 'vue';
import { PageWrapper } from '@/components/Page'; import { PageWrapper } from '@/components/Page';
import { useModal } from '@/components/Modal'; import { useModal } from '@/components/Modal';
import { CloseOutlined, InboxOutlined } from '@ant-design/icons-vue'; import { CloseOutlined, InboxOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction } from '@/components/Table'; import { BasicTable, useTable, TableAction } from '@/components/Table';
import { columns } from './data'; import { columns } from './data';
import { tableDataByTableName, updateTableData } from '@/api/application/layer'; import { tableDataByTableName, updateTableData, uploadSldStyle } from '@/api/application/layer';
import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface'; import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
import { useMessage } from '@/hooks/web/useMessage'; import { useMessage } from '@/hooks/web/useMessage';
import { uploadFile, fun_Delete } from '@/api/demo/files'; import { uploadFile, fun_Delete } from '@/api/demo/files';
@ -171,6 +174,8 @@
const batchProcessingModalOpen = ref(false); const batchProcessingModalOpen = ref(false);
const [registerAddModal, { openModal: openAddModal }] = useModal(); const [registerAddModal, { openModal: openAddModal }] = useModal();
const [registerEditorModal, { openModal: openEditorModal }] = useModal(); const [registerEditorModal, { openModal: openEditorModal }] = useModal();
const [registerTempeleteModel, { openModal: openTempeleteModel }] = useModal();
const labelCol = { span: 6 }; const labelCol = { span: 6 };
const wrapperCol = { span: 18 }; const wrapperCol = { span: 18 };
const keyWord = ref(null); const keyWord = ref(null);
@ -212,6 +217,7 @@
const formState = ref({}); const formState = ref({});
const tableName = ref(); const tableName = ref();
const styleName = ref();
const rules = { const rules = {
name: [ name: [
{ required: true, message: 'Please input Activity name', trigger: 'blur' }, { required: true, message: 'Please input Activity name', trigger: 'blur' },
@ -312,15 +318,19 @@
}, },
}); });
}; };
const fileUrl = ref('');
const fileUrlView: any = ref({});
const posData = (record) => {}; const posData = (record) => {};
const styleHandle = () => { const styleHandle = () => {
fileUrl.value = '';
fileUrlView.value = {};
styleName.value = '';
showTable.value = 'style'; showTable.value = 'style';
}; };
const handleChange = (info) => { const handleChange = (info) => {
fileList.value = info.fileList; fileList.value = info.fileList;
}; };
const fileUrl = ref('');
const fileUrlView: any = ref({});
// //
const handleCustomRequest = (options) => { const handleCustomRequest = (options) => {
fileList.value = []; fileList.value = [];
@ -330,7 +340,7 @@
uploadFile(formData) uploadFile(formData)
.then((res: any) => { .then((res: any) => {
fileUrl.value = res[0].filePath; fileUrl.value = res[0].filePath;
fileUrlView.value.url = VITE_GLOB_API_URL + '/' + res[0].filePath; fileUrlView.value.url = res[0].filePath;
fileUrlView.value.id = res[0].id; fileUrlView.value.id = res[0].id;
createMessage.success('上传成功!'); createMessage.success('上传成功!');
}) })
@ -339,7 +349,23 @@
}); });
}; };
const styleSubmit = () => { const styleSubmit = () => {
console.log(fileUrl.value); if (!styleName.value) {
return createMessage.warning('样式名称不能为空!');
}
const params = {
filepath: fileUrl.value,
styleName: styleName.value,
tablename: tableName.value,
};
uploadSldStyle(params).then((res) => {
console.log(res);
if (res) {
showTable.value = '';
createMessage.success('提交成功!');
} else {
createMessage.error('提交失败!');
}
});
}; };
const styleCancel = () => { const styleCancel = () => {
if (fileUrlView.value.id) { if (fileUrlView.value.id) {
@ -360,8 +386,13 @@
} }
}; };
const editorHandle = () => { const editorHandle = () => {
if (!styleName.value) {
return createMessage.warning('样式名称不能为空!');
}
openEditorModal(true, { openEditorModal(true, {
urlData: fileUrlView.value, urlData: fileUrlView.value,
styleName: styleName.value,
tableName: tableName.value,
}); });
}; };
const changeBatchProcessingModal = (type: boolean) => { const changeBatchProcessingModal = (type: boolean) => {
@ -397,6 +428,9 @@
setColumns(arr); setColumns(arr);
}); });
}; };
const exportTemplate = () => {
openTempeleteModel(true);
};
onMounted(() => {}); onMounted(() => {});
</script> </script>

View File

@ -2,3 +2,4 @@ export { default as LayerTree } from './LayerTree.vue';
export { default as AddModel } from './AddModel.vue'; export { default as AddModel } from './AddModel.vue';
export { default as Map } from './Map.vue'; export { default as Map } from './Map.vue';
export { default as EditorModel } from './EditorModel.vue'; export { default as EditorModel } from './EditorModel.vue';
export { default as TempeleteModel } from './TempeleteModel.vue';