Browse Source

点位导入导出

ops-management-platform-frontend-dev
wbc 1 day ago
parent
commit
a6e59cfedf
  1. 4
      src/views/property/meterial/index.vue
  2. 71
      src/views/property/point/addModal.vue
  3. 11
      src/views/property/point/api.ts
  4. 4
      src/views/property/point/data.ts
  5. 45
      src/views/property/point/index.vue

4
src/views/property/meterial/index.vue

@ -19,8 +19,8 @@
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" @click="handleAdd" v-if="checkedTree[0]">新增</a-button> <a-button type="primary" @click="handleAdd" v-if="checkedTree[0]">新增</a-button>
<a-button type="primary">导入</a-button> <!-- <a-button type="primary">导入</a-button>
<a-button type="primary">导出</a-button> <a-button type="primary">导出</a-button> -->
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column && record && column.key === 'action'"> <template v-if="column && record && column.key === 'action'">

71
src/views/property/point/addModal.vue

@ -37,7 +37,7 @@
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="维护单位" name="maintenanceUnit"> <a-form-item label="维护单位" name="maintenanceUnit">
<a-input v-model:value="form.maintenanceUnit" placeholder="请输入" disabled/> <a-input v-model:value="form.maintenanceUnit" placeholder="请输入" disabled />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -49,15 +49,22 @@
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :span="24">
<a-form-item label="链路维护单位" name="linkUnit">
<a-input v-model:value="form.linkUnit" placeholder="请输入" />
</a-form-item>
</a-col>
</a-row>
<!-- <a-row :gutter="[16, 16]">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="地点" name="address"> <a-form-item label="地点" name="address">
<a-input v-model:value="form.address" placeholder="请输入" /> <a-input v-model:value="form.address" placeholder="请输入" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row> -->
<a-row :gutter="[16, 16]" v-show="false"> <a-row :gutter="[16, 16]" v-show="false">
<a-col :span="24"> <a-col :span="24">
<div id="container" style="width: 100%; height: 500px" v-show="form.address" ></div> <div id="container" style="width: 100%; height: 500px" v-show="form.address"></div>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
@ -72,12 +79,19 @@
</template> </template>
<script> <script>
import { reactive, ref ,toRefs} from 'vue'; import { reactive, ref, toRefs } from 'vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
import { getInfo, add, update, getProjectInfo, getOrganizationType,getContractPartyBNameByProjectName } from './api'; import {
getInfo,
add,
update,
getProjectInfo,
getOrganizationType,
getContractPartyBNameByProjectName,
} from './api';
export default { export default {
setup(props,{emit}) { setup(props, { emit }) {
const title = ref('新增'); const title = ref('新增');
const visible = ref(false); const visible = ref(false);
const form = reactive({ const form = reactive({
@ -85,7 +99,8 @@
organizationName: null, organizationName: null,
remark: '', remark: '',
maintenanceUnit: '', maintenanceUnit: '',
address: '', // address: '',
linkUnit:'',
longitude: '', longitude: '',
latitude: '', latitude: '',
pointName: '', pointName: '',
@ -102,17 +117,18 @@
const res = await getOrganizationType(); const res = await getOrganizationType();
organizationNameOptions.value = res.rows; organizationNameOptions.value = res.rows;
}; };
const showModal = async (type, id, projectId,selectInfo) => { const showModal = async (type, id, projectId, selectInfo) => {
console.log(selectInfo); console.log(selectInfo);
visible.value = true; visible.value = true;
if (type == 1) { if (type == 1) {
title.value = '新增'; title.value = '新增';
form.projectName = selectInfo.node.ownerName form.projectName = selectInfo.node.ownerName;
form.organizationName = selectInfo.node.projectName form.organizationName = selectInfo.node.projectName;
const res = await getContractPartyBNameByProjectName({projectName:selectInfo.node.ownerName}) const res = await getContractPartyBNameByProjectName({
form.maintenanceUnit = res projectName: selectInfo.node.ownerName,
});
form.maintenanceUnit = res;
initMap(); initMap();
} else if (type == 2) { } else if (type == 2) {
title.value = '编辑'; title.value = '编辑';
@ -138,8 +154,8 @@
delete params.id; delete params.id;
add(params).then((_) => { add(params).then((_) => {
message.success('新增成功'); message.success('新增成功');
emit('success') emit('success');
closeModal() closeModal();
}); });
} else { } else {
let params = {}; let params = {};
@ -148,8 +164,8 @@
} }
update(params).then((_) => { update(params).then((_) => {
message.success('编辑成功'); message.success('编辑成功');
emit('success') emit('success');
closeModal() closeModal();
}); });
} }
} }
@ -165,7 +181,8 @@
organizationName: [{ required: true, message: '请选择' }], organizationName: [{ required: true, message: '请选择' }],
remark: [{ required: true, message: '请输入' }], remark: [{ required: true, message: '请输入' }],
maintenanceUnit: [{ required: true, message: '请输入' }], maintenanceUnit: [{ required: true, message: '请输入' }],
address: [{ required: true, message: '请输入' }], // address: [{ required: true, message: '' }],
linkUnit : [{ required: true, message: '请输入' }],
pointName: [{ required: true, message: '请输入' }], pointName: [{ required: true, message: '请输入' }],
}; };
// //
@ -183,7 +200,9 @@
// //
map.value = new AMap.Map('container', { map.value = new AMap.Map('container', {
zoom: 17, zoom: 17,
center: form.longitude?[form.longitude, form.latitude]:['121.5645431', '29.8596452'], center: form.longitude
? [form.longitude, form.latitude]
: ['121.5645431', '29.8596452'],
}); });
// //
@ -198,19 +217,19 @@
if (currentMarker.value) { if (currentMarker.value) {
map.value.remove(currentMarker.value); map.value.remove(currentMarker.value);
currentMarker.value = null; currentMarker.value = null;
form.longitude = '' form.longitude = '';
form.latitude = '' form.latitude = '';
} else { } else {
currentMarker.value = new AMap.Marker({ currentMarker.value = new AMap.Marker({
position: [e.lnglat.getLng(), e.lnglat.getLat()], // position: [e.lnglat.getLng(), e.lnglat.getLat()], //
title: form.address , title: form.address,
}); });
form.longitude = e.lnglat.getLng() form.longitude = e.lnglat.getLng();
form.latitude = e.lnglat.getLat() form.latitude = e.lnglat.getLat();
// //
map.value.add(currentMarker.value); map.value.add(currentMarker.value);
} }
console.log(form) console.log(form);
}); });
} catch (error) { } catch (error) {
console.error('加载高德地图失败:', error); console.error('加载高德地图失败:', error);

11
src/views/property/point/api.ts

@ -5,7 +5,7 @@ enum Api {
root = '/platform/pointInfo', root = '/platform/pointInfo',
list = '/platform/pointInfo/list', list = '/platform/pointInfo/list',
tree = '/platform/projectCategoryPoint/queryAll', tree = '/platform/projectCategoryPoint/queryAll',
export = '/workflow/leave/export', export = '/platform/excel/ExportPointInfo',
getSubcategoryType = '/platform/subcategoryType/list', getSubcategoryType = '/platform/subcategoryType/list',
workOrderAdd = '/platform/workOrder/add', workOrderAdd = '/platform/workOrder/add',
getProjectInfo = '/platform/projectInfo/getNames', getProjectInfo = '/platform/projectInfo/getNames',
@ -13,6 +13,7 @@ enum Api {
getContractNamesByProjectName = '/platform/contractInfo/getContractNamesByProjectName', getContractNamesByProjectName = '/platform/contractInfo/getContractNamesByProjectName',
getIoCompanyByName = '/platform/contractInfo/getIoCompany', getIoCompanyByName = '/platform/contractInfo/getIoCompany',
getContractPartyBNameByProjectName = '/platform/projectInfo/getContractPartyBNameByProjectName', getContractPartyBNameByProjectName = '/platform/projectInfo/getContractPartyBNameByProjectName',
upload = '/platform/excel/uploadPointInfo',
} }
export function list(params: any) { export function list(params: any) {
@ -28,7 +29,13 @@ export function exportExcel(data: any) {
export function getInfo(id: ID) { export function getInfo(id: ID) {
return defHttp.get({ url: `${Api.root}/${id}` }); return defHttp.get({ url: `${Api.root}/${id}` });
} }
export function listUpload(params: any) {
return defHttp.post({
url: Api.upload,
headers: { 'Content-Type': 'multipart/form-data' },
params,
});
}
export function add(data: any) { export function add(data: any) {
return defHttp.post({ url: Api.root, data }); return defHttp.post({ url: Api.root, data });
} }

4
src/views/property/point/data.ts

@ -21,6 +21,10 @@ export const columns: BasicColumn[] = [
title: '地址', title: '地址',
dataIndex: 'address', dataIndex: 'address',
}, },
{
title: '链路维护单位',
dataIndex: 'linkUnit',
},
{ {
title: '所属机构', title: '所属机构',
dataIndex: 'organizationName', dataIndex: 'organizationName',

45
src/views/property/point/index.vue

@ -19,9 +19,21 @@
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-button type="primary" @click="handleAdd" v-if="checkedTree[0]">新增</a-button> <a-button type="primary" @click="handleAdd" v-if="checkedTree[0]">新增</a-button>
<a-button type="primary">导入</a-button> <a-upload
name="file"
:before-upload="beforeUpload"
@change="importChange"
:showUploadList="false"
v-if="checkedTree.length > 0"
>
<a-button type="primary"> 导入 </a-button>
</a-upload>
<a-button type="primary">点位导出</a-button> <a-button
v-auth="'system:role:export'"
@click="downloadExcel(exportExcel, '点位信息', getForm().getFieldsValue())"
>导出</a-button
>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column && record && column.key === 'action'"> <template v-if="column && record && column.key === 'action'">
@ -40,7 +52,7 @@
</template> </template>
</BasicTable> </BasicTable>
<detailDrawer ref="detailDrawerRef" /> <detailDrawer ref="detailDrawerRef" />
<addModal ref="addModalRef" @success="reload()"/> <addModal ref="addModalRef" @success="reload()" />
<pointModal ref="pointModalRef" /> <pointModal ref="pointModalRef" />
</a-col> </a-col>
</a-row> </a-row>
@ -50,16 +62,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { PageWrapper } from '@/components/Page'; import { PageWrapper } from '@/components/Page';
import { BasicTable, useTable } from '@/components/Table'; import { BasicTable, useTable } from '@/components/Table';
import { list, tree,removeByIds} from './api'; import { list, tree, removeByIds, listUpload ,exportExcel} from './api';
import { formSchemas, columns } from './data'; import { formSchemas, columns } from './data';
import detailDrawer from './detailDrawer.vue'; import detailDrawer from './detailDrawer.vue';
import addModal from './addModal.vue'; import addModal from './addModal.vue';
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import pointModal from './pointModal.vue'; import pointModal from './pointModal.vue';
import { downloadExcel } from '@/utils/file/download';
defineOptions({ name: 'Point' }); defineOptions({ name: 'Point' });
const [registerTable, { reload}] = useTable({ const [registerTable, { getForm,reload }] = useTable({
title: '点位信息', title: '点位信息',
api: list, api: list,
showIndexColumn: true, showIndexColumn: true,
@ -93,10 +105,10 @@
// //
const addModalRef = ref(); const addModalRef = ref();
const handleAdd = () => { const handleAdd = () => {
addModalRef.value.showModal(1,null,checkedTree.value[0],selectInfo.value); addModalRef.value.showModal(1, null, checkedTree.value[0], selectInfo.value);
}; };
const handleEdit = (id: any) => { const handleEdit = (id: any) => {
addModalRef.value.showModal(2, id,checkedTree.value[0],selectInfo.value); addModalRef.value.showModal(2, id, checkedTree.value[0], selectInfo.value);
}; };
const handleDelete = async (id: any) => { const handleDelete = async (id: any) => {
await removeByIds([id]); await removeByIds([id]);
@ -119,13 +131,26 @@
}); });
console.log(res); console.log(res);
}; };
const selectInfo = ref({}) const selectInfo = ref({});
const onSelect = (selectedKeys: any, info: any) => { const onSelect = (selectedKeys: any, info: any) => {
console.log('selected', selectedKeys, info); console.log('selected', selectedKeys, info);
selectInfo.value = info selectInfo.value = info;
console.log(checkedTree.value); console.log(checkedTree.value);
reload(); reload();
}; };
//
const beforeUpload = async (file: any) => {
console.log(file);
const params = {
file: file,
};
await listUpload(params);
return false;
};
const importChange = () => {
reload();
};
onMounted(() => { onMounted(() => {
getTree(); getTree();
}); });

Loading…
Cancel
Save