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