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

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

View File

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

View File

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