基础信息优化 设备状态+设备是否启用

master
A0010407 1 year ago
parent b6642517c3
commit 90327110ec

@ -83,3 +83,16 @@ export function bindSpareParts(data) {
data: data
});
}
// 设备状态修改
export function changeEquipmentStatus(equipmentId, status) {
const data = {
equipmentId,
status
}
return request({
url: '/wms/equipment/changeStatus',
method: 'put',
data: data
})
}

@ -6,12 +6,13 @@
size="small"
:inline="true"
v-show="showSearch"
label-width="98px"
label-width="88px"
>
<el-form-item label="设备编码" prop="equipmentCode">
<el-input
v-model="queryParams.equipmentCode"
placeholder="请输入设备编码"
style="width: 180px"
clearable
@keyup.enter.native="handleQuery"
/>
@ -21,6 +22,7 @@
v-model="queryParams.equipmentName"
placeholder="请输入设备名称"
clearable
style="width: 180px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
@ -31,7 +33,7 @@
@change="$forceUpdate()"
clearable
filterable
style="width: 205px"
style="width: 180px"
@keyup.enter.native="handleQuery"
>
<el-option
@ -42,6 +44,21 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备状态" prop="equipmentStatus">
<el-select
v-model="queryParams.equipmentStatus"
placeholder="设备状态"
style="width: 180px"
clearable
>
<el-option
v-for="dict in dict.type.equipment_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@ -152,6 +169,29 @@
prop="equipmentName"
width="200"
/>
<el-table-column
label="是否启用"
align="center"
prop="status"
width="150"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
active-value="1"
inactive-value="0"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column prop="equipmentStatus" label="设备状态" width="80">
<template slot-scope="scope">
<dict-tag
:options="dict.type.equipment_status"
:value="scope.row.equipmentStatus"
/>
</template>
</el-table-column>
<el-table-column
label="设备类型编码"
align="center"
@ -177,11 +217,6 @@
prop="workshopName"
width="150"
/>
<el-table-column label="设备状态" align="center" prop="status">
<template slot-scope="scope">
{{ scope.row.status == 1 ? "正常" : "停用" }}
</template>
</el-table-column>
<el-table-column label="设备IP" align="center" prop="plcIp" width="150" />
<el-table-column
label="设备端口号"
@ -586,7 +621,7 @@
<template>
<el-transfer
filterable
filter-placeholder="请输入班组人员名称"
filter-placeholder="请输入备品备件名称"
v-model="rightList"
:titles="['未绑定备件列表', '已绑定备件列表']"
:button-texts="['取消', '绑定']"
@ -846,6 +881,7 @@ import {
getEquipmentTypeList,
getSparePartsList,
getRightSparePartsList,
changeEquipmentStatus,
} from "@/api/wms/equipment";
import { getWorkCenterList, listFactory } from "@/api/wms/factory";
import { listTeamMembers } from "@/api/wms/team";
@ -855,7 +891,7 @@ import { getToken } from "@/utils/auth";
export default {
name: "Equipment",
dicts: ["sys_normal_disable", "equ_type"],
dicts: ["sys_normal_disable", "equ_type", "equipment_status"],
components: { EquipmentSpareParts },
data() {
return {
@ -1082,7 +1118,7 @@ export default {
console.log(this.treeData1);
});
},
/** 查询设备分类 */
/** 查询设备备件 */
sparePartsList() {
getSparePartsList(this.queryParams).then((response) => {
for (let i in response.rows) {
@ -1428,6 +1464,22 @@ export default {
`equipment_template_${new Date().getTime()}.xlsx`
);
},
//
handleStatusChange(row) {
let text = row.status === "1" ? "启用" : "停用";
this.$modal
.confirm('确认要"' + text + '""' + row.equipmentCode + '"设备吗?')
.then(function () {
return changeEquipmentStatus(row.equipmentId, row.status);
})
.then(() => {
this.$modal.msgSuccess(text + "成功");
})
.catch(function () {
row.status = row.status === "0" ? "1" : "0";
});
},
},
};
</script>

Loading…
Cancel
Save