报警管理-修改设备下拉框

This commit is contained in:
xusd 2024-09-13 17:41:25 +08:00
parent fed966910a
commit 9ca9049c96
3 changed files with 87 additions and 75 deletions

View File

@ -42,23 +42,13 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="机床设备" prop="equipId">
label="机床设备" <el-cascader
prop="equipId" v-model="cascaderValue"
> :options="equipCascader"
<el-select :props="{ value: 'id',label: 'name',children: 'children'}"
v-model="queryParams.equipId"
placeholder="请选择机床设备"
clearable clearable
size="small" @change="cascaderChange"></el-cascader>
>
<el-option
v-for="item in equipSelection"
:key="item.equipId"
:label="item.equipNo"
:value="item.equipId"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="等级" label="等级"
@ -293,23 +283,13 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item label="机床设备" prop="equipId">
label="机床设备" <el-cascader
prop="equipId" v-model="cascaderValue"
> :options="equipCascader"
<el-select :props="{ value: 'id',label: 'name',children: 'children'}"
v-model="queryParams.equipId"
placeholder="请选择机床设备"
clearable clearable
size="small" @change="cascaderChange"></el-cascader>
>
<el-option
v-for="item in equipSelection"
:key="item.equipId"
:label="item.equipNo"
:value="item.equipId"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="等级" label="等级"
@ -605,7 +585,7 @@
<script> <script>
import * as AlarmRulesApi from "@/api/system/alarm/alarmrules"; import * as AlarmRulesApi from "@/api/system/alarm/alarmrules";
import AlarmRulesForm from "./AlarmRulesForm.vue"; import AlarmRulesForm from "./AlarmRulesForm.vue";
import { getEquipSelection } from "@/api/system/equip/equipInfo"; import {getEquipCascader, getEquipSelection} from "@/api/system/equip/equipInfo";
export default { export default {
name: "AlarmRules", name: "AlarmRules",
components: { components: {
@ -613,6 +593,8 @@ export default {
}, },
data() { data() {
return { return {
cascaderValue:[],
equipCascader: [],
// //
loading: true, loading: true,
// //
@ -710,13 +692,27 @@ export default {
this.loading = true; this.loading = true;
this.queryParams.type = this.activeName === "threshold" ? 0 : 1; this.queryParams.type = this.activeName === "threshold" ? 0 : 1;
const res = await AlarmRulesApi.getAlarmRulesPage(this.queryParams); const res = await AlarmRulesApi.getAlarmRulesPage(this.queryParams);
this.equipSelection = await getEquipSelection(); await getEquipCascader().then(res=>{
res.forEach(item=>{
if (item.children == null){
item.disabled = true;
}
})
this.equipCascader = res;
})
this.list = res.data.list; this.list = res.data.list;
this.total = res.data.total; this.total = res.data.total;
} finally { } finally {
this.loading = false; this.loading = false;
} }
}, },
cascaderChange(value){
if (value.length > 0){
this.queryParams.equipId = value[1];
}else {
this.queryParams.equipId = null;
}
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
@ -724,7 +720,9 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.cascaderValue = [];
this.resetForm("queryForm"); this.resetForm("queryForm");
this.queryParams.equipId = null;
this.handleQuery(); this.handleQuery();
}, },
/** 添加/修改操作 */ /** 添加/修改操作 */
@ -759,4 +757,4 @@ export default {
}, },
}, },
}; };
</script> </script>

View File

@ -10,23 +10,13 @@
label-width="68px" label-width="68px"
style="text-align:right" style="text-align:right"
> >
<el-form-item <el-form-item label="机床设备" prop="equipId">
label="机床设备" <el-cascader
prop="equipId" v-model="cascaderValue"
> :options="equipCascader"
<el-select :props="{ value: 'id',label: 'name',children: 'children'}"
v-model="queryParams.equipId"
placeholder="请选择机床设备"
clearable clearable
size="small" @change="cascaderChange"></el-cascader>
>
<el-option
v-for="item in equipSelection"
:key="item.equipId"
:label="item.equipNo"
:value="item.equipId"
/>
</el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item <!-- <el-form-item
label="机床组件id" label="机床组件id"
@ -290,11 +280,11 @@
/> />
</div> </div>
</template> </template>
<script> <script>
import * as EquipAlarmDataApi from "@/api/system/alarm/equipalarmdata"; import * as EquipAlarmDataApi from "@/api/system/alarm/equipalarmdata";
import EquipAlarmDataForm from "./EquipAlarmDataForm.vue"; import EquipAlarmDataForm from "./EquipAlarmDataForm.vue";
import { getEquipSelection } from "@/api/system/equip/equipInfo"; import {getEquipCascader, getEquipSelection} from "@/api/system/equip/equipInfo";
export default { export default {
name: "EquipAlarmData", name: "EquipAlarmData",
components: { components: {
@ -302,6 +292,8 @@ export default {
}, },
data() { data() {
return { return {
cascaderValue:[],
equipCascader: [],
// //
loading: true, loading: true,
// //
@ -337,6 +329,13 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
cascaderChange(value){
if (value.length > 0){
this.queryParams.equipId = value[1];
}else {
this.queryParams.equipId = null;
}
},
/** 查询列表 */ /** 查询列表 */
async getList() { async getList() {
try { try {
@ -344,7 +343,14 @@ export default {
const res = await EquipAlarmDataApi.getEquipAlarmDataPage( const res = await EquipAlarmDataApi.getEquipAlarmDataPage(
this.queryParams this.queryParams
); );
this.equipSelection = await getEquipSelection(); await getEquipCascader().then(res=>{
res.forEach(item=>{
if (item.children == null){
item.disabled = true;
}
})
this.equipCascader = res;
})
this.list = res.data.list; this.list = res.data.list;
this.total = res.data.total; this.total = res.data.total;
} finally { } finally {
@ -358,7 +364,9 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.cascaderValue = [];
this.resetForm("queryForm"); this.resetForm("queryForm");
this.queryParams.equipId = null;
this.handleQuery(); this.handleQuery();
}, },
/** 添加/修改操作 */ /** 添加/修改操作 */
@ -394,4 +402,3 @@ export default {
}, },
}; };
</script> </script>

View File

@ -10,23 +10,13 @@
label-width="68px" label-width="68px"
style="text-align:right" style="text-align:right"
> >
<el-form-item <el-form-item label="机床设备" prop="equipId">
label="机床设备" <el-cascader
prop="equipId" v-model="cascaderValue"
> :options="equipCascader"
<el-select :props="{ value: 'id',label: 'name',children: 'children'}"
v-model="queryParams.equipId"
placeholder="请选择机床设备"
clearable clearable
size="small" @change="cascaderChange"></el-cascader>
>
<el-option
v-for="item in equipSelection"
:key="item.equipId"
:label="item.equipNo"
:value="item.equipId"
/>
</el-select>
</el-form-item> </el-form-item>
<!-- <el-form-item <!-- <el-form-item
label="机床组件id" label="机床组件id"
@ -281,11 +271,11 @@
/> />
</div> </div>
</template> </template>
<script> <script>
import * as EquipAlarmDataApi from "@/api/system/alarm/equipalarmdata"; import * as EquipAlarmDataApi from "@/api/system/alarm/equipalarmdata";
import EquipAlarmDataForm from "./EquipAlarmDataForm.vue"; import EquipAlarmDataForm from "./EquipAlarmDataForm.vue";
import { getEquipSelection } from "@/api/system/equip/equipInfo"; import {getEquipCascader, getEquipSelection} from "@/api/system/equip/equipInfo";
export default { export default {
name: "EquipAlarmData", name: "EquipAlarmData",
components: { components: {
@ -293,6 +283,8 @@ export default {
}, },
data() { data() {
return { return {
cascaderValue:[],
equipCascader: [],
// //
loading: true, loading: true,
// //
@ -329,6 +321,13 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
cascaderChange(value){
if (value.length > 0){
this.queryParams.equipId = value[1];
}else {
this.queryParams.equipId = null;
}
},
/** 查询列表 */ /** 查询列表 */
async getList() { async getList() {
try { try {
@ -336,7 +335,14 @@ export default {
const res = await EquipAlarmDataApi.getEquipAlarmDataPage( const res = await EquipAlarmDataApi.getEquipAlarmDataPage(
this.queryParams this.queryParams
); );
this.equipSelection = await getEquipSelection(); await getEquipCascader().then(res=>{
res.forEach(item=>{
if (item.children == null){
item.disabled = true;
}
})
this.equipCascader = res;
})
this.list = res.data.list; this.list = res.data.list;
this.total = res.data.total; this.total = res.data.total;
} finally { } finally {
@ -350,7 +356,9 @@ export default {
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.cascaderValue = [];
this.resetForm("queryForm"); this.resetForm("queryForm");
this.queryParams.equipId = null;
this.handleQuery(); this.handleQuery();
}, },
/** 添加/修改操作 */ /** 添加/修改操作 */
@ -386,4 +394,3 @@ export default {
}, },
}; };
</script> </script>