Browse Source

点位导入导出

ops-management-platform-frontend-dev
wbc 1 day ago
parent
commit
a6e59cfedf
  1. 4
      src/views/property/meterial/index.vue
  2. 69
      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">
<template #toolbar>
<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 #bodyCell="{ column, record }">
<template v-if="column && record && column.key === 'action'">

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

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

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

@ -5,7 +5,7 @@ enum Api {
root = '/platform/pointInfo',
list = '/platform/pointInfo/list',
tree = '/platform/projectCategoryPoint/queryAll',
export = '/workflow/leave/export',
export = '/platform/excel/ExportPointInfo',
getSubcategoryType = '/platform/subcategoryType/list',
workOrderAdd = '/platform/workOrder/add',
getProjectInfo = '/platform/projectInfo/getNames',
@ -13,6 +13,7 @@ enum Api {
getContractNamesByProjectName = '/platform/contractInfo/getContractNamesByProjectName',
getIoCompanyByName = '/platform/contractInfo/getIoCompany',
getContractPartyBNameByProjectName = '/platform/projectInfo/getContractPartyBNameByProjectName',
upload = '/platform/excel/uploadPointInfo',
}
export function list(params: any) {
@ -28,7 +29,13 @@ export function exportExcel(data: any) {
export function getInfo(id: 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) {
return defHttp.post({ url: Api.root, data });
}

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

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

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

@ -19,9 +19,21 @@
<BasicTable @register="registerTable">
<template #toolbar>
<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 #bodyCell="{ column, record }">
<template v-if="column && record && column.key === 'action'">
@ -40,7 +52,7 @@
</template>
</BasicTable>
<detailDrawer ref="detailDrawerRef" />
<addModal ref="addModalRef" @success="reload()"/>
<addModal ref="addModalRef" @success="reload()" />
<pointModal ref="pointModalRef" />
</a-col>
</a-row>
@ -50,16 +62,16 @@
<script setup lang="ts">
import { PageWrapper } from '@/components/Page';
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 detailDrawer from './detailDrawer.vue';
import addModal from './addModal.vue';
import { ref, onMounted } from 'vue';
import pointModal from './pointModal.vue';
import { downloadExcel } from '@/utils/file/download';
defineOptions({ name: 'Point' });
const [registerTable, { reload}] = useTable({
const [registerTable, { getForm,reload }] = useTable({
title: '点位信息',
api: list,
showIndexColumn: true,
@ -93,10 +105,10 @@
//
const addModalRef = ref();
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) => {
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) => {
await removeByIds([id]);
@ -119,13 +131,26 @@
});
console.log(res);
};
const selectInfo = ref({})
const selectInfo = ref({});
const onSelect = (selectedKeys: any, info: any) => {
console.log('selected', selectedKeys, info);
selectInfo.value = info
selectInfo.value = info;
console.log(checkedTree.value);
reload();
};
//
const beforeUpload = async (file: any) => {
console.log(file);
const params = {
file: file,
};
await listUpload(params);
return false;
};
const importChange = () => {
reload();
};
onMounted(() => {
getTree();
});

Loading…
Cancel
Save