Merge branch 'master' of git.code.tencent.com:beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
0be7df6558
@ -78,12 +78,8 @@ export async function getPublishLineNet(): Promise<Item> {
|
|||||||
/**
|
/**
|
||||||
* 获取发布地图详细信息
|
* 获取发布地图详细信息
|
||||||
* @param id 发布地图线路ID
|
* @param id 发布地图线路ID
|
||||||
* @param type 发布地图线路类型
|
|
||||||
*/
|
*/
|
||||||
export async function getPublishMapInfoByLineId(
|
export async function getPublishMapInfoByLineId(lineId: number): Promise<Item> {
|
||||||
lineId: number,
|
const response = await api.get(`${PublishUriBase}/${lineId}`);
|
||||||
type: string
|
|
||||||
): Promise<Item> {
|
|
||||||
const response = await api.get(`${PublishUriBase}/${type}/${lineId}`);
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
@ -69,11 +69,11 @@ const list = reactive([
|
|||||||
label: '发布管理',
|
label: '发布管理',
|
||||||
icon: 'app_registration',
|
icon: 'app_registration',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: '/dataManage/lineInfo',
|
// path: '/dataManage/lineInfo',
|
||||||
label: '线路信息管理',
|
// label: '线路信息管理',
|
||||||
icon: 'app_registration',
|
// icon: 'app_registration',
|
||||||
},
|
// },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
@ -104,8 +104,7 @@ export async function loadLineDatas(app: GraphicApp) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { proto: base64, name: lineName } = await getPublishMapInfoByLineId(
|
const { proto: base64, name: lineName } = await getPublishMapInfoByLineId(
|
||||||
lineId,
|
lineId
|
||||||
'line'
|
|
||||||
);
|
);
|
||||||
lineStore.setLineName(lineName);
|
lineStore.setLineName(lineName);
|
||||||
if (base64) {
|
if (base64) {
|
||||||
|
@ -5,6 +5,9 @@ import {
|
|||||||
JlGraphic,
|
JlGraphic,
|
||||||
JlGraphicTemplate,
|
JlGraphicTemplate,
|
||||||
VectorText,
|
VectorText,
|
||||||
|
calculateLineMidpoint,
|
||||||
|
getNormalVector,
|
||||||
|
movePointAlongNormal,
|
||||||
} from 'src/jl-graphic';
|
} from 'src/jl-graphic';
|
||||||
|
|
||||||
export interface ILogicSectionData extends GraphicData {
|
export interface ILogicSectionData extends GraphicData {
|
||||||
@ -26,24 +29,29 @@ export interface ILogicSectionData extends GraphicData {
|
|||||||
export const LogicSectionConsts = {
|
export const LogicSectionConsts = {
|
||||||
lineColor: '0xff0000',
|
lineColor: '0xff0000',
|
||||||
lineWidth: 2,
|
lineWidth: 2,
|
||||||
|
labelColor: '0xFF00FF',
|
||||||
|
divisionColor: '0xFF00FF',
|
||||||
|
divisionWidth: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class LogicSection extends JlGraphic {
|
export class LogicSection extends JlGraphic {
|
||||||
static Type = 'LogicSection';
|
static Type = 'LogicSection';
|
||||||
lineGraphic: Graphics;
|
lineGraphic: Graphics;
|
||||||
labelGraphic: VectorText;
|
labelGraphic: VectorText;
|
||||||
|
divisionGraphic: Graphics = new Graphics();
|
||||||
constructor() {
|
constructor() {
|
||||||
super(LogicSection.Type);
|
super(LogicSection.Type);
|
||||||
this.lineGraphic = new Graphics();
|
this.lineGraphic = new Graphics();
|
||||||
this.labelGraphic = new VectorText();
|
this.labelGraphic = new VectorText();
|
||||||
this.labelGraphic.setVectorFontSize(14);
|
this.labelGraphic.setVectorFontSize(14);
|
||||||
this.labelGraphic.anchor.set(0.5);
|
this.labelGraphic.anchor.set(0.5);
|
||||||
this.labelGraphic.style.fill = '#0f0';
|
this.labelGraphic.style.fill = LogicSectionConsts.labelColor;
|
||||||
this.labelGraphic.transformSave = true;
|
this.labelGraphic.transformSave = true;
|
||||||
this.labelGraphic.name = 'label';
|
this.labelGraphic.name = 'label';
|
||||||
this.transformSave = true;
|
this.transformSave = true;
|
||||||
this.addChild(this.lineGraphic);
|
this.addChild(this.lineGraphic);
|
||||||
this.addChild(this.labelGraphic);
|
this.addChild(this.labelGraphic);
|
||||||
|
this.addChild(this.divisionGraphic);
|
||||||
}
|
}
|
||||||
|
|
||||||
get datas(): ILogicSectionData {
|
get datas(): ILogicSectionData {
|
||||||
@ -65,6 +73,46 @@ export class LogicSection extends JlGraphic {
|
|||||||
this.lineGraphic.moveTo(p.x, p.y);
|
this.lineGraphic.moveTo(p.x, p.y);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
let normalVector = getNormalVector(
|
||||||
|
this.datas.points[0],
|
||||||
|
this.datas.points[1]
|
||||||
|
);
|
||||||
|
if (this.datas.points[0].x > this.datas.points[1].x) {
|
||||||
|
normalVector = getNormalVector(
|
||||||
|
this.datas.points[1],
|
||||||
|
this.datas.points[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.divisionGraphic.clear();
|
||||||
|
this.divisionGraphic.lineStyle(
|
||||||
|
LogicSectionConsts.divisionWidth,
|
||||||
|
LogicSectionConsts.divisionColor
|
||||||
|
);
|
||||||
|
const nextP = movePointAlongNormal(this.datas.points[0], normalVector, 5);
|
||||||
|
const nextP1 = this.datas.points[0];
|
||||||
|
this.divisionGraphic.moveTo(nextP1.x, nextP1.y);
|
||||||
|
this.divisionGraphic.lineTo(nextP.x, nextP.y);
|
||||||
|
let normalVector2 = getNormalVector(
|
||||||
|
this.datas.points[this.datas.points.length - 2],
|
||||||
|
this.datas.points[this.datas.points.length - 1]
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
this.datas.points[this.datas.points.length - 2].x >
|
||||||
|
this.datas.points[this.datas.points.length - 1].x
|
||||||
|
) {
|
||||||
|
normalVector2 = getNormalVector(
|
||||||
|
this.datas.points[this.datas.points.length - 1],
|
||||||
|
this.datas.points[this.datas.points.length - 2]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const nextP2 = movePointAlongNormal(
|
||||||
|
this.datas.points[this.datas.points.length - 1],
|
||||||
|
normalVector2,
|
||||||
|
5
|
||||||
|
);
|
||||||
|
const nextP3 = this.datas.points[this.datas.points.length - 1];
|
||||||
|
this.divisionGraphic.moveTo(nextP3.x, nextP3.y);
|
||||||
|
this.divisionGraphic.lineTo(nextP2.x, nextP2.y);
|
||||||
this.labelGraphic.text = this.datas.code;
|
this.labelGraphic.text = this.datas.code;
|
||||||
const labelPosition = this.datas.childTransforms?.find(
|
const labelPosition = this.datas.childTransforms?.find(
|
||||||
(t) => t.name === this.labelGraphic.name
|
(t) => t.name === this.labelGraphic.name
|
||||||
@ -72,10 +120,11 @@ export class LogicSection extends JlGraphic {
|
|||||||
if (labelPosition) {
|
if (labelPosition) {
|
||||||
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
||||||
} else {
|
} else {
|
||||||
this.labelGraphic.position.set(
|
const centerPos = calculateLineMidpoint(
|
||||||
this.datas.points[0].x,
|
this.datas.points[0],
|
||||||
this.datas.points[0].y + 20
|
this.datas.points[this.datas.points.length - 1]
|
||||||
);
|
);
|
||||||
|
this.labelGraphic.position.set(centerPos.x, centerPos.y + 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get linePoints(): IPointData[] {
|
get linePoints(): IPointData[] {
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
:disable="operateDisabled"
|
:disable="operateDisabled"
|
||||||
label="编辑"
|
label="编辑"
|
||||||
:to="`/painting/${props.row.id}/${props.row.type}`"
|
:to="`/painting/${props.row.id}/Line`"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
color="primary"
|
color="primary"
|
||||||
@ -111,7 +111,7 @@
|
|||||||
lazy-rules
|
lazy-rules
|
||||||
:rules="[(val) => val.length > 0 || '请输入名称!']"
|
:rules="[(val) => val.length > 0 || '请输入名称!']"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<!-- <q-select
|
||||||
v-if="publishForm.type == 'Line'"
|
v-if="publishForm.type == 'Line'"
|
||||||
v-model="publishForm.lineId"
|
v-model="publishForm.lineId"
|
||||||
:options="lineOptions"
|
:options="lineOptions"
|
||||||
@ -120,7 +120,7 @@
|
|||||||
label="线路 * "
|
label="线路 * "
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:rules="[(val) => val || '请选择线路!']"
|
:rules="[(val) => val || '请选择线路!']"
|
||||||
/>
|
/> -->
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
||||||
<q-card-actions align="right">
|
<q-card-actions align="right">
|
||||||
@ -138,7 +138,7 @@ import { ref, reactive, onMounted, computed } from 'vue';
|
|||||||
import { useQuasar, type QTableColumn, QForm } from 'quasar';
|
import { useQuasar, type QTableColumn, QForm } from 'quasar';
|
||||||
import { pageQuery, createDraft, deleteDraft } from '../api/DraftApi';
|
import { pageQuery, createDraft, deleteDraft } from '../api/DraftApi';
|
||||||
import { publishDraft } from '../api/PublishApi';
|
import { publishDraft } from '../api/PublishApi';
|
||||||
import { getLineList } from '../api/LineInfoApi';
|
// import { getLineList } from '../api/LineInfoApi';
|
||||||
import { ApiError } from 'src/boot/axios';
|
import { ApiError } from 'src/boot/axios';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
@ -160,35 +160,35 @@ const typeOptions = [
|
|||||||
];
|
];
|
||||||
const createType = ref('Line');
|
const createType = ref('Line');
|
||||||
|
|
||||||
let lineOptions: Array<{ label: string; value: number }> = [];
|
// let lineOptions: Array<{ label: string; value: number }> = [];
|
||||||
function getAllLineList() {
|
// function getAllLineList() {
|
||||||
lineOptions = [];
|
// lineOptions = [];
|
||||||
getLineList()
|
// getLineList()
|
||||||
.then((res) => {
|
// .then((res) => {
|
||||||
res.forEach((item) => {
|
// res.forEach((item) => {
|
||||||
const obj = {
|
// const obj = {
|
||||||
label: item.name,
|
// label: item.name,
|
||||||
value: item.lineId,
|
// value: item.lineId,
|
||||||
};
|
// };
|
||||||
lineOptions.push(obj);
|
// lineOptions.push(obj);
|
||||||
});
|
// });
|
||||||
})
|
// })
|
||||||
.catch((err) => {
|
// .catch((err) => {
|
||||||
console.log(err, '---err--');
|
// console.log(err, '---err--');
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
const typeOptionsMap = computed(() => {
|
// const typeOptionsMap = computed(() => {
|
||||||
const obj: { [k: string]: string } = {};
|
// const obj: { [k: string]: string } = {};
|
||||||
typeOptions.forEach((item: { value: string; label: string }) => {
|
// typeOptions.forEach((item: { value: string; label: string }) => {
|
||||||
obj[item.value] = item.label;
|
// obj[item.value] = item.label;
|
||||||
});
|
// });
|
||||||
return obj;
|
// return obj;
|
||||||
});
|
// });
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
tableRef.value.requestServerInteraction();
|
tableRef.value.requestServerInteraction();
|
||||||
getAllLineList();
|
// getAllLineList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const columnDefs: QTableColumn[] = [
|
const columnDefs: QTableColumn[] = [
|
||||||
@ -200,14 +200,14 @@ const columnDefs: QTableColumn[] = [
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
// { name: 'creator', label: '创建人', field: 'creator', align: 'center' },
|
// { name: 'creator', label: '创建人', field: 'creator', align: 'center' },
|
||||||
{
|
// {
|
||||||
name: 'type',
|
// name: 'type',
|
||||||
label: '类型',
|
// label: '类型',
|
||||||
field: (row) => {
|
// field: (row) => {
|
||||||
return typeOptionsMap.value[row.type];
|
// return typeOptionsMap.value[row.type];
|
||||||
},
|
// },
|
||||||
align: 'center',
|
// align: 'center',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: 'createdAt',
|
name: 'createdAt',
|
||||||
label: '创建时间',
|
label: '创建时间',
|
||||||
@ -299,7 +299,7 @@ const publishForm = reactive({
|
|||||||
id: '',
|
id: '',
|
||||||
draftName: '',
|
draftName: '',
|
||||||
pubName: '',
|
pubName: '',
|
||||||
lineId: '',
|
// lineId: '',
|
||||||
type: 'Line',
|
type: 'Line',
|
||||||
});
|
});
|
||||||
function prePublish(row: any) {
|
function prePublish(row: any) {
|
||||||
@ -307,7 +307,7 @@ function prePublish(row: any) {
|
|||||||
publishForm.id = row.id;
|
publishForm.id = row.id;
|
||||||
publishForm.draftName = row.name;
|
publishForm.draftName = row.name;
|
||||||
publishForm.pubName = row.name;
|
publishForm.pubName = row.name;
|
||||||
publishForm.lineId = '';
|
// publishForm.lineId = '';
|
||||||
publishForm.type = row.type || 'Line';
|
publishForm.type = row.type || 'Line';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,9 +319,9 @@ async function publishGraphics() {
|
|||||||
draftingId: +publishForm.id,
|
draftingId: +publishForm.id,
|
||||||
name: publishForm.pubName,
|
name: publishForm.pubName,
|
||||||
};
|
};
|
||||||
if (publishForm.type == 'Line') {
|
// if (publishForm.type == 'Line') {
|
||||||
params.lineId = +publishForm.lineId;
|
// params.lineId = +publishForm.lineId;
|
||||||
}
|
// }
|
||||||
await publishDraft(params);
|
await publishDraft(params);
|
||||||
publishFormShow.value = false;
|
publishFormShow.value = false;
|
||||||
$q.notify({
|
$q.notify({
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
:disable="operateDisabled"
|
:disable="operateDisabled"
|
||||||
label="预览"
|
label="预览"
|
||||||
:to="`/linemap/${props.row.lineId}/${props.row.type}`"
|
:to="`/linemap/${props.row.id}`"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
color="red"
|
color="red"
|
||||||
|
@ -62,7 +62,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
component: () => import('layouts/DrawLayout.vue'),
|
component: () => import('layouts/DrawLayout.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/linemap/:id/:type',
|
path: '/linemap/:id/',
|
||||||
name: 'linemap',
|
name: 'linemap',
|
||||||
component: () => import('layouts/LineLayout.vue'),
|
component: () => import('layouts/LineLayout.vue'),
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user