合并代码
All checks were successful
local-test分支构建发布 / Docker-Build (push) Successful in 2m20s

This commit is contained in:
joylink_fanyuhong 2024-09-06 15:06:06 +08:00
commit 181a3dae51
5 changed files with 36 additions and 33 deletions

View File

@ -24,7 +24,7 @@ export interface editRoleParams extends createRoleParams {
export interface RoleInfo { export interface RoleInfo {
id: number; id: number;
name: string; name: string;
paths: PathItem[]; resList: number[];
} }
/** /**

View File

@ -16,7 +16,7 @@ export function getWebsocketUrl() {
export function getShowSetAlarmTextButton() { export function getShowSetAlarmTextButton() {
let show = false; let show = false;
const host = window.location.hostname; const host = window.location.hostname;
if (process.env.NODE_ENV == 'development' || host == '192.168.3.233') { if (process.env.NODE_ENV == 'development' || host == '192.168.33.233') {
show = true; show = true;
} }
return show; return show;

View File

@ -200,7 +200,9 @@ class DragMoveAbsorbablePoint extends AbsorbablePoint {
pointC: [C], pointC: [C],
} = dragTarget.datas; } = dragTarget.datas;
this.moveTarget = { this.moveTarget = {
position: dragTarget.getGlobalPosition(), position: dragTarget
.getGraphicApp()
.toCanvasCoordinates(dragTarget.getGlobalPosition()),
portPos: [ portPos: [
dragTarget.localToCanvasPoint(A), dragTarget.localToCanvasPoint(A),
dragTarget.localToCanvasPoint(B), dragTarget.localToCanvasPoint(B),
@ -235,7 +237,9 @@ class DragMoveAbsorbablePoint extends AbsorbablePoint {
} else { } else {
if (this.moveTarget == undefined) { if (this.moveTarget == undefined) {
this.moveTarget = { this.moveTarget = {
position: dragTarget.getGlobalPosition(), position: dragTarget
.getGraphicApp()
.toCanvasCoordinates(dragTarget.getGlobalPosition()),
portPos: [ portPos: [
dragTarget.localToCanvasPoint(dragTarget.getStartPoint()), dragTarget.localToCanvasPoint(dragTarget.getStartPoint()),
dragTarget.localToCanvasPoint(dragTarget.getEndPoint()), dragTarget.localToCanvasPoint(dragTarget.getEndPoint()),
@ -432,6 +436,9 @@ export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Tur
tep = new TurnoutEditPlugin(turnout, { onEditPointCreate }); tep = new TurnoutEditPlugin(turnout, { onEditPointCreate });
turnout.addAssistantAppend(tep); turnout.addAssistantAppend(tep);
} }
tep.editPoints = [[], [], []];
tep.removeChildren();
tep.initEditPoints();
// tep.reset(); // tep.reset();
tep.showAll(); tep.showAll();
tep.setRelatedDrag(); tep.setRelatedDrag();
@ -571,7 +578,7 @@ export class TurnoutEditPlugin extends GraphicEditPlugin<Turnout> {
Array.from(cpMap.entries()).forEach(([cpDatas, dataPoints], i) => { Array.from(cpMap.entries()).forEach(([cpDatas, dataPoints], i) => {
cpDatas.forEach((cpData, j) => { cpDatas.forEach((cpData, j) => {
const dp = new DraggablePoint(cpData); const dp = new DraggablePoint(cpData);
dp.on('transforming', (e: GraphicTransformEvent) => { dp.on('transforming', () => {
const localPoint = this.graphic.canvasToLocalPoint(dp.position); const localPoint = this.graphic.canvasToLocalPoint(dp.position);
dataPoints[j].x = localPoint.x; dataPoints[j].x = localPoint.x;
dataPoints[j].y = localPoint.y; dataPoints[j].y = localPoint.y;

View File

@ -108,7 +108,6 @@ import { useQuasar, type QTableColumn, QForm } from 'quasar';
import { import {
createPath, createPath,
deletePath, deletePath,
getPathInfo,
pageQueryPath, pageQueryPath,
PathItem, PathItem,
savePathData, savePathData,
@ -239,19 +238,17 @@ const options = computed(() => {
// //
function edieAuthData(row: PathItem) { function edieAuthData(row: PathItem) {
getPathInfo(row.id).then((res) => { pathInfo.id = row.id + '';
pathInfo.id = res.id + ''; pathInfo.name = row.name;
pathInfo.name = res.name; pathInfo.path = row.path;
pathInfo.path = res.path; let list: MethodType[] = [];
let list: MethodType[] = []; if (row.method == '*') {
if (res.method == '*') { list = options.value.map((item) => item.value as MethodType);
list = options.value.map((item) => item.value as MethodType); } else {
} else { list = row.method.split(',') as MethodType[];
list = res.method.split(',') as MethodType[]; }
} pathInfo.methodList = list;
pathInfo.methodList = list; editFormShow.value = true;
editFormShow.value = true;
});
} }
const myForm = ref<QForm | null>(null); const myForm = ref<QForm | null>(null);

View File

@ -74,7 +74,7 @@
</div> </div>
<AuthPathManage <AuthPathManage
:sizeHeight="600" :sizeHeight="600"
:selects="roleInfo.paths || []" :selects="roleInfo.editPaths || []"
@selectsed="pathSelectsed" @selectsed="pathSelectsed"
/> />
<q-card-actions align="right"> <q-card-actions align="right">
@ -97,7 +97,6 @@ import {
createRole, createRole,
createRoleParams, createRoleParams,
deleteRole, deleteRole,
getRoleInfo,
pageQueryRole, pageQueryRole,
saveRoleData, saveRoleData,
} from 'src/api/AuthApi'; } from 'src/api/AuthApi';
@ -182,25 +181,25 @@ const editFormShow = ref(false);
interface RoleItemInfo extends Omit<RoleInfo, 'id'> { interface RoleItemInfo extends Omit<RoleInfo, 'id'> {
id: string; id: string;
editPaths: number[]; editPaths: { id: number }[];
} }
const roleInfo = reactive<RoleItemInfo>({ const roleInfo = reactive<RoleItemInfo>({
id: '', id: '',
editPaths: [], editPaths: [],
name: '', name: '',
paths: [], resList: [],
}); });
// //
function edieRoleData(row: RoleInfo) { function edieRoleData(row: RoleInfo) {
getRoleInfo(row.id).then((res) => { roleInfo.id = row.id + '';
roleInfo.id = res.id + ''; roleInfo.name = row.name;
roleInfo.name = res.name; const list = row.resList || [];
const list = res.paths || []; roleInfo.resList = list;
roleInfo.paths = list; roleInfo.editPaths = list.map((item) => {
roleInfo.editPaths = list.map((item) => item.id); return { id: item };
editFormShow.value = true;
}); });
editFormShow.value = true;
} }
const myForm = ref<QForm | null>(null); const myForm = ref<QForm | null>(null);
@ -213,7 +212,7 @@ async function edieRolePath() {
try { try {
const params: createRoleParams = { const params: createRoleParams = {
name: roleInfo.name, name: roleInfo.name,
resList: roleInfo.editPaths, resList: roleInfo.resList,
}; };
if (roleInfo.id) { if (roleInfo.id) {
const cloneParams = Object.assign(params, { id: +roleInfo.id }); const cloneParams = Object.assign(params, { id: +roleInfo.id });
@ -266,11 +265,11 @@ function onReset() {
roleInfo.id = ''; roleInfo.id = '';
roleInfo.name = ''; roleInfo.name = '';
roleInfo.editPaths = []; roleInfo.editPaths = [];
roleInfo.paths = []; roleInfo.resList = [];
myForm.value?.resetValidation(); myForm.value?.resetValidation();
} }
function pathSelectsed(val: PathItem[]) { function pathSelectsed(val: PathItem[]) {
roleInfo.editPaths = val.map((item) => item.id); roleInfo.resList = val.map((item) => item.id);
} }
</script> </script>