测试修改

This commit is contained in:
joylink_zhaoerwei 2023-12-27 09:27:34 +08:00
parent b604fbd59c
commit e97a677c3b
2 changed files with 20 additions and 7 deletions

View File

@ -14,7 +14,7 @@ export function mockLocalDemoTestSet(
deviceType: string; deviceType: string;
status: string; status: string;
groupId?: string; groupId?: string;
}[][]; }[];
} }
) { ) {
return api.post(`${alertUriBase}/localDemoTest/${alertType}`, data); return api.post(`${alertUriBase}/localDemoTest/${alertType}`, data);

View File

@ -25,6 +25,7 @@
v-model="setAlartTextData.alertType" v-model="setAlartTextData.alertType"
:options="optionsAlertType" :options="optionsAlertType"
:rules="[(val) => val.length > 0 || '请选择故障类型!']" :rules="[(val) => val.length > 0 || '请选择故障类型!']"
@update:model-value="onChooseAlertType"
/> />
<q-list bordered separator class="rounded-borders"> <q-list bordered separator class="rounded-borders">
<q-expansion-item <q-expansion-item
@ -42,10 +43,9 @@
v-if="setAlartTextData.alertType == '列车信号故障'" v-if="setAlartTextData.alertType == '列车信号故障'"
outlined outlined
label="车组号" label="车组号"
v-model.number="configItem.groupId" v-model="configItem.groupId"
type="number"
lazy-rules lazy-rules
:rules="[(val) => val || '请输入车组号!']" :rules="[(val) => val.length > 0 || '请输入车组号!']"
/> />
<q-select <q-select
outlined outlined
@ -261,12 +261,13 @@ const $q = useQuasar();
async function onSubmit() { async function onSubmit() {
myForm.value?.validate().then(async (res) => { myForm.value?.validate().then(async (res) => {
if (res) { if (res) {
const deviceInfos = setAlartTextData.value.groupList
.map((item) => item.deviceInfos)
.flat();
try { try {
const params = { const params = {
lineId: +setAlartTextData.value.lineId, lineId: +setAlartTextData.value.lineId,
deviceInfos: setAlartTextData.value.groupList.map( deviceInfos,
(item) => item.deviceInfos
),
}; };
const alertType = (saveAlertTypeData as never)[ const alertType = (saveAlertTypeData as never)[
setAlartTextData.value.alertType + '' setAlartTextData.value.alertType + ''
@ -340,6 +341,18 @@ function deleteSelectConfig(index: number) {
lineStore.getLineApp().updateSelected(); lineStore.getLineApp().updateSelected();
} }
function onChooseAlertType() {
setAlartTextData.value.groupList = [
{
groupName: '测试组',
groupId: '',
status: '',
deviceInfos: [],
expanded: false,
},
];
}
function onReset() { function onReset() {
setAlartTextData.value = { setAlartTextData.value = {
lineId: lineStore.lineId as unknown as string, lineId: lineStore.lineId as unknown as string,