diff --git a/src/api/DraftApi.ts b/src/api/DraftApi.ts index e3efca6..35bbae5 100644 --- a/src/api/DraftApi.ts +++ b/src/api/DraftApi.ts @@ -47,18 +47,6 @@ export function deleteDraft(id: number) { return api.delete(`${DraftUriBase}/${id}`); } -/** - * 草稿图发布 - * @param id 草稿id - */ -export function publishDraft(data: { - name: string; - lineId: number; - draftingId: number; -}) { - return api.post('/api/publishedGi/publish', data); -} - /** * 获取草稿数据 * @param params diff --git a/src/api/LineInfoApi.ts b/src/api/LineInfoApi.ts index 75f17f1..5b54923 100644 --- a/src/api/LineInfoApi.ts +++ b/src/api/LineInfoApi.ts @@ -38,7 +38,7 @@ export async function pageQuery( export function createLine(data: { name: string; lineId: number; - config: string; + config?: string; }) { return api.post(`${UriBase}`, data); } @@ -74,7 +74,7 @@ export async function getLineInfo(id: number): Promise { * @param params * @returns */ -export async function getLineList(): Promise { +export async function getLineList(): Promise> { const response = await api.get(`${UriBase}/list`); return response.data; } diff --git a/src/api/PublishApi.ts b/src/api/PublishApi.ts new file mode 100644 index 0000000..55160aa --- /dev/null +++ b/src/api/PublishApi.ts @@ -0,0 +1,61 @@ +import { api } from 'src/boot/axios'; +import { PageDto, PageQueryDto } from './ApiCommon'; + +const PublishUriBase = '/api/publishedGi'; + +interface Item { + id: number; + name: string; + proto: string; + createdAt: string; + updateAt: string; + creatorId?: number; +} + +export class PagingQueryParams extends PageQueryDto { + name?: string; +} + +/** + * 草稿图发布 + * @param id 草稿id + */ +export function publishDraft(data: { + name: string; + lineId: number; + draftingId: number; +}) { + return api.post(`${PublishUriBase}/publish`, data); +} + +/** + * 获取发布图形数据列表 + * @param params + * @returns + */ +export async function getDraft(id: number): Promise { + const response = await api.get(`${PublishUriBase}/list`); + return response.data; +} + +/** + * 分页查询 + * @param params + * @returns + */ +export async function pageQuery( + params: PagingQueryParams +): Promise> { + const response = await api.get(`${PublishUriBase}/paging`, { + params: params, + }); + return response.data; +} + +/** + * 删除发布图 + * @param id 草稿id + */ +export function deletePublish(id: number) { + return api.delete(`${PublishUriBase}/${id}`); +} diff --git a/src/graphics/station/Station.ts b/src/graphics/station/Station.ts index e1f3697..5df3279 100644 --- a/src/graphics/station/Station.ts +++ b/src/graphics/station/Station.ts @@ -4,7 +4,6 @@ import { JlGraphicTemplate, VectorText, } from 'src/jl-graphic'; -import { StationDraw } from './StationDrawAssistant'; export interface IStationData extends GraphicData { get code(): string; // 编号 @@ -30,16 +29,13 @@ export class Station extends JlGraphic { get datas(): IStationData { return this.getDatas(); } - static draw(station: Station | StationDraw, datas?: IStationData): void { - const codeGraph = station.codeGraph; - codeGraph.text = datas?.code || '车站Station'; + doRepaint(): void { + const codeGraph = this.codeGraph; + codeGraph.text = this.datas?.code || '车站Station'; codeGraph.style.fill = stationConsts.codeColor; codeGraph.setVectorFontSize(stationConsts.codeFontSize); codeGraph.anchor.set(0.5); } - doRepaint(): void { - Station.draw(this, this.datas); - } } export class StationTemplate extends JlGraphicTemplate { diff --git a/src/graphics/station/StationDrawAssistant.ts b/src/graphics/station/StationDrawAssistant.ts index 198944d..ef11490 100644 --- a/src/graphics/station/StationDrawAssistant.ts +++ b/src/graphics/station/StationDrawAssistant.ts @@ -1,10 +1,10 @@ import { FederatedPointerEvent, Point } from 'pixi.js'; import { + GraphicData, GraphicDrawAssistant, GraphicInteractionPlugin, JlDrawApp, JlGraphic, - VectorText, } from 'src/jl-graphic'; import { IStationData, Station, StationTemplate } from './Station'; @@ -17,8 +17,7 @@ export class StationDraw extends GraphicDrawAssistant< StationTemplate, IStationData > { - codeGraph: VectorText = new VectorText(''); - + codeGraph: Station; constructor(app: JlDrawApp, createData: () => IStationData) { super( app, @@ -27,13 +26,16 @@ export class StationDraw extends GraphicDrawAssistant< 'svguse:../drawIcon.svg#icon-station', '车站Station' ); + this.codeGraph = this.graphicTemplate.new(); this.container.addChild(this.codeGraph); stationInteraction.init(app); } bind(): void { super.bind(); - Station.draw(this); + const data = { graphicType: 'station' } as GraphicData; + this.codeGraph.loadData(data); + this.codeGraph.doRepaint(); } unbind(): void { super.unbind(); diff --git a/src/pages/DraftManage.vue b/src/pages/DraftManage.vue index 19d116a..6bc77a2 100644 --- a/src/pages/DraftManage.vue +++ b/src/pages/DraftManage.vue @@ -123,12 +123,7 @@ - + @@ -140,12 +135,9 @@