This commit is contained in:
fan 2023-08-16 14:02:32 +08:00
commit bbee8cc5e1

View File

@ -21,19 +21,15 @@
:options="optionsChoose"
label="车站控制模式转换"
/>
<q-select
outlined
@blur="onUpdate"
v-model="ipRtuStusDown"
:options="optionsChooseCommon"
<q-checkbox
v-model="stationModel.ipRtuStusDown"
label="是否通信中断"
@update:model-value="onUpdate"
/>
<q-select
outlined
@blur="onUpdate"
v-model="ipRtuStusInLocalCtrl"
:options="optionsChooseCommon"
<q-checkbox
v-model="stationModel.ipRtuStusInLocalCtrl"
label="是否站控"
@update:model-value="onUpdate"
/>
</q-form>
</template>
@ -50,17 +46,6 @@ const stationModel = reactive(new StationState());
const optionsChoose = ['中控', '站控且允许转到中控', '站控且不允许转到中控'];
const controlChange = ref('');
const ipRtuStusDown = ref('');
const ipRtuStusInLocalCtrl = ref('');
const optionsChooseCommon = ['是', '否'];
enum showSelect {
= 'true',
= 'false',
}
enum showSelectData {
true = '是',
false = '否',
}
lineStore.$subscribe;
watch(
@ -68,12 +53,6 @@ watch(
(val) => {
if (val && val.type == Station.Type) {
stationModel.copyFrom((val as Station).states as StationState);
ipRtuStusDown.value = (showSelectData as never)[
stationModel.ipRtuStusDown + ''
];
ipRtuStusInLocalCtrl.value = (showSelectData as never)[
stationModel.ipRtuStusInLocalCtrl + ''
];
}
}
);
@ -82,23 +61,11 @@ onMounted(() => {
const station = lineStore.selectedGraphic as Station;
if (station) {
stationModel.copyFrom((station as Station).states as StationState);
ipRtuStusDown.value = (showSelectData as never)[
stationModel.ipRtuStusDown + ''
];
ipRtuStusInLocalCtrl.value = (showSelectData as never)[
stationModel.ipRtuStusInLocalCtrl + ''
];
}
});
function onUpdate() {
const station = lineStore.selectedGraphic as Station;
stationModel.ipRtuStusDown = JSON.parse(
(showSelect as never)[ipRtuStusDown.value]
);
stationModel.ipRtuStusInLocalCtrl = JSON.parse(
(showSelect as never)[ipRtuStusInLocalCtrl.value]
);
const data = {
ipRtuStusDown: false,
ipRtuStusInLocalCtrl: false,
@ -107,10 +74,8 @@ function onUpdate() {
id: station.id,
};
const lineId = lineStore.lineId as number;
data.ipRtuStusDown = JSON.parse((showSelect as never)[ipRtuStusDown.value]);
data.ipRtuStusInLocalCtrl = JSON.parse(
(showSelect as never)[ipRtuStusInLocalCtrl.value]
);
data.ipRtuStusDown = stationModel.ipRtuStusDown;
data.ipRtuStusInLocalCtrl = stationModel.ipRtuStusInLocalCtrl;
if (station) {
switch (controlChange.value) {
case '中控':