| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <template>
- <div class="trajectory">
- <Search :onClickSearch="onClickSearch" :onClickReset="onClickReset" />
- <div class="trajectory-table">
- <a-table :scroll="{ x: '100%', y: 500 }" :childrenColumnName="null" rowKey="id" :loading="state.listLoading"
- :columns="columns" @change="refreshData" :rowClassName="rowClassName" :dataSource="state.list"
- :pagination="paginationConfig">
- <!-- 操作 -->
- <template #action="{ record }">
- <a-tooltip title="查看轨迹">
- <EnvironmentOutlined style="color: #2d8cf0;margin-right: 10px;" @click="onClickLookTrajectory(record.id)" />
- </a-tooltip>
- </template>
- </a-table>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { reactive, onMounted } from 'vue';
- import { EnvironmentOutlined } from '@ant-design/icons-vue';
- import Search from './components/Search.vue';
- import { apis } from '/@/api/custom/index';
- import router from '/@/router';
- import { useMyStore } from '/@/store';
- import { wgs84togcj02 } from '/@/vendors/coordtransform'
- const store = useMyStore()
- interface State {
- listLoading: boolean,
- list: any[],
- };
- const state: State = reactive({
- listLoading: false,
- list: [],
- });
- const paginationConfig = reactive({
- pageSizeOptions: ['20', '50', '100'],
- showQuickJumper: true,
- showSizeChanger: true,
- pageSize: 20,
- current: 1,
- total: 0
- })
- const fetchList = async (query?: any) => {
- state.listLoading = true;
- try {
- const res = await apis.fetchTrajectoryList({
- ...query,
- page: paginationConfig.current,
- page_size: paginationConfig.pageSize
- });
- if (res.code === 0) {
- paginationConfig.total = res.data.pagination.total
- paginationConfig.current = res.data.pagination.page
- paginationConfig.pageSize = res.data.pagination.page_size
- }
- state.list = res.data.list;
- } catch (e) {
- console.error(e);
- } finally {
- state.listLoading = false;
- }
- }
- onMounted(async () => {
- await fetchList();
- })
- const columns = [
- {
- title: '计划名称',
- dataIndex: 'task_name',
- width: 250,
- ellipsis: true,
- sorter: (a: any, b: any) => a.task_name.localeCompare(b.task_name),
- },
- {
- title: '拍摄负载',
- dataIndex: 'payload',
- width: 150,
- ellipsis: true,
- },
- {
- title: '创建时间',
- dataIndex: 'create_time',
- width: 200,
- sorter: (a: any, b: any) => a.create_time.localeCompare(b.create_time),
- },
- {
- title: '任务类型',
- dataIndex: 'template_type',
- width: 150,
- customRender: ({ text }: any) => {
- let content = '--';
- switch (text) {
- case '0':
- content = '航点航线';
- break;
- case '1':
- content = '二维正射';
- break;
- case '2':
- content = '倾斜摄影';
- break;
- case '3':
- content = '带状航线';
- break;
- case '4':
- content = '无';
- break;
- default:
- break;
- }
- return content;
- }
- },
- {
- title: '创建人',
- dataIndex: 'username',
- width: 150,
- },
- {
- title: '操作',
- dataIndex: 'actions',
- fixed: 'right',
- align: 'center',
- width: 50,
- slots: { customRender: 'action' },
- },
- ]
- const rowClassName = (record: any, index: number) => {
- const className = []
- if ((index & 1) === 0) {
- className.push('table-striped')
- }
- return className.toString().replaceAll(',', ' ')
- }
- const refreshData = async (page: any) => {
- paginationConfig.current = page?.current!
- paginationConfig.pageSize = page?.pageSize!
- await fetchList();
- }
- // 点击搜索
- const onClickSearch = async (query: any) => {
- await fetchList(query);
- }
- // 点击重置
- const onClickReset = async (query: any) => {
- await fetchList(query);
- }
- // 点击查看轨迹
- const onClickLookTrajectory = async (id: string) => {
- router.push({ path: '/workspace' });
- const res = await apis.fetchTrajectoryMap(id);
- const list = res.data.map((item: any) => {
- return wgs84togcj02(item.longitude, item.latitude);
- });
- store.commit('SET_TRAJECTORY_LIST', list)
- }
- </script>
- <style lang="scss">
- .trajectory {
- padding: 20px;
- }
- .ant-table {
- border-top: 1px solid rgb(0, 0, 0, 0.06);
- border-bottom: 1px solid rgb(0, 0, 0, 0.06);
- }
- .ant-table-tbody tr td {
- border: 0;
- }
- .table-striped {
- background-color: #f7f9fa;
- }
- </style>
|