This commit is contained in:
joylink_zhaoerwei 2023-08-14 13:22:22 +08:00
parent cde1cc2334
commit 5082d847bf

View File

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