权限调整+绘制吸附同步
This commit is contained in:
parent
6296877798
commit
acaf3d1f11
@ -24,7 +24,7 @@ export interface editRoleParams extends createRoleParams {
|
||||
export interface RoleInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
paths: PathItem[];
|
||||
resList: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ export function getWebsocketUrl() {
|
||||
export function getShowSetAlarmTextButton() {
|
||||
let show = false;
|
||||
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;
|
||||
}
|
||||
return show;
|
||||
|
@ -200,7 +200,9 @@ class DragMoveAbsorbablePoint extends AbsorbablePoint {
|
||||
pointC: [C],
|
||||
} = dragTarget.datas;
|
||||
this.moveTarget = {
|
||||
position: dragTarget.getGlobalPosition(),
|
||||
position: dragTarget
|
||||
.getGraphicApp()
|
||||
.toCanvasCoordinates(dragTarget.getGlobalPosition()),
|
||||
portPos: [
|
||||
dragTarget.localToCanvasPoint(A),
|
||||
dragTarget.localToCanvasPoint(B),
|
||||
@ -235,7 +237,9 @@ class DragMoveAbsorbablePoint extends AbsorbablePoint {
|
||||
} else {
|
||||
if (this.moveTarget == undefined) {
|
||||
this.moveTarget = {
|
||||
position: dragTarget.getGlobalPosition(),
|
||||
position: dragTarget
|
||||
.getGraphicApp()
|
||||
.toCanvasCoordinates(dragTarget.getGlobalPosition()),
|
||||
portPos: [
|
||||
dragTarget.localToCanvasPoint(dragTarget.getStartPoint()),
|
||||
dragTarget.localToCanvasPoint(dragTarget.getEndPoint()),
|
||||
@ -432,6 +436,9 @@ export class TurnoutPointsInteractionPlugin extends GraphicInteractionPlugin<Tur
|
||||
tep = new TurnoutEditPlugin(turnout, { onEditPointCreate });
|
||||
turnout.addAssistantAppend(tep);
|
||||
}
|
||||
tep.editPoints = [[], [], []];
|
||||
tep.removeChildren();
|
||||
tep.initEditPoints();
|
||||
// tep.reset();
|
||||
tep.showAll();
|
||||
tep.setRelatedDrag();
|
||||
@ -571,7 +578,7 @@ export class TurnoutEditPlugin extends GraphicEditPlugin<Turnout> {
|
||||
Array.from(cpMap.entries()).forEach(([cpDatas, dataPoints], i) => {
|
||||
cpDatas.forEach((cpData, j) => {
|
||||
const dp = new DraggablePoint(cpData);
|
||||
dp.on('transforming', (e: GraphicTransformEvent) => {
|
||||
dp.on('transforming', () => {
|
||||
const localPoint = this.graphic.canvasToLocalPoint(dp.position);
|
||||
dataPoints[j].x = localPoint.x;
|
||||
dataPoints[j].y = localPoint.y;
|
||||
|
@ -108,7 +108,6 @@ import { useQuasar, type QTableColumn, QForm } from 'quasar';
|
||||
import {
|
||||
createPath,
|
||||
deletePath,
|
||||
getPathInfo,
|
||||
pageQueryPath,
|
||||
PathItem,
|
||||
savePathData,
|
||||
@ -239,19 +238,17 @@ const options = computed(() => {
|
||||
|
||||
//编辑
|
||||
function edieAuthData(row: PathItem) {
|
||||
getPathInfo(row.id).then((res) => {
|
||||
pathInfo.id = res.id + '';
|
||||
pathInfo.name = res.name;
|
||||
pathInfo.path = res.path;
|
||||
pathInfo.id = row.id + '';
|
||||
pathInfo.name = row.name;
|
||||
pathInfo.path = row.path;
|
||||
let list: MethodType[] = [];
|
||||
if (res.method == '*') {
|
||||
if (row.method == '*') {
|
||||
list = options.value.map((item) => item.value as MethodType);
|
||||
} else {
|
||||
list = res.method.split(',') as MethodType[];
|
||||
list = row.method.split(',') as MethodType[];
|
||||
}
|
||||
pathInfo.methodList = list;
|
||||
editFormShow.value = true;
|
||||
});
|
||||
}
|
||||
|
||||
const myForm = ref<QForm | null>(null);
|
||||
|
@ -74,7 +74,7 @@
|
||||
</div>
|
||||
<AuthPathManage
|
||||
:sizeHeight="600"
|
||||
:selects="roleInfo.paths || []"
|
||||
:selects="roleInfo.editPaths || []"
|
||||
@selectsed="pathSelectsed"
|
||||
/>
|
||||
<q-card-actions align="right">
|
||||
@ -97,7 +97,6 @@ import {
|
||||
createRole,
|
||||
createRoleParams,
|
||||
deleteRole,
|
||||
getRoleInfo,
|
||||
pageQueryRole,
|
||||
saveRoleData,
|
||||
} from 'src/api/AuthApi';
|
||||
@ -182,25 +181,25 @@ const editFormShow = ref(false);
|
||||
|
||||
interface RoleItemInfo extends Omit<RoleInfo, 'id'> {
|
||||
id: string;
|
||||
editPaths: number[];
|
||||
editPaths: { id: number }[];
|
||||
}
|
||||
const roleInfo = reactive<RoleItemInfo>({
|
||||
id: '',
|
||||
editPaths: [],
|
||||
name: '',
|
||||
paths: [],
|
||||
resList: [],
|
||||
});
|
||||
|
||||
//编辑
|
||||
function edieRoleData(row: RoleInfo) {
|
||||
getRoleInfo(row.id).then((res) => {
|
||||
roleInfo.id = res.id + '';
|
||||
roleInfo.name = res.name;
|
||||
const list = res.paths || [];
|
||||
roleInfo.paths = list;
|
||||
roleInfo.editPaths = list.map((item) => item.id);
|
||||
editFormShow.value = true;
|
||||
roleInfo.id = row.id + '';
|
||||
roleInfo.name = row.name;
|
||||
const list = row.resList || [];
|
||||
roleInfo.resList = list;
|
||||
roleInfo.editPaths = list.map((item) => {
|
||||
return { id: item };
|
||||
});
|
||||
editFormShow.value = true;
|
||||
}
|
||||
|
||||
const myForm = ref<QForm | null>(null);
|
||||
@ -213,7 +212,7 @@ async function edieRolePath() {
|
||||
try {
|
||||
const params: createRoleParams = {
|
||||
name: roleInfo.name,
|
||||
resList: roleInfo.editPaths,
|
||||
resList: roleInfo.resList,
|
||||
};
|
||||
if (roleInfo.id) {
|
||||
const cloneParams = Object.assign(params, { id: +roleInfo.id });
|
||||
@ -266,11 +265,11 @@ function onReset() {
|
||||
roleInfo.id = '';
|
||||
roleInfo.name = '';
|
||||
roleInfo.editPaths = [];
|
||||
roleInfo.paths = [];
|
||||
roleInfo.resList = [];
|
||||
myForm.value?.resetValidation();
|
||||
}
|
||||
|
||||
function pathSelectsed(val: PathItem[]) {
|
||||
roleInfo.editPaths = val.map((item) => item.id);
|
||||
roleInfo.resList = val.map((item) => item.id);
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user