/**
* 新增修改库存管理页面
*
* @author gucw
* @date 2025-06-09
*/
<template>
<div>
<dialog-edit
:visible.sync="open"
:title="title"
@close="handleCancel"
dialogType="dialog_edit"
width="800px"
height="600px"
>
<div slot="content" class="dialog_content">
<formlist
:form="form"
:form2="form2"
ref="formList"
@submit="formListSubmit"
:readonly="false"
:width="`120px`"
></formlist>
<div slot="footer" class="dialog_footer">
<e-submit
:option="{
name: '确定',
submit: formListSubmit,
}"
></e-submit>
<el-button @click="handleCancel">取 消</el-button>
</div>
</div>
</dialog-edit>
</div>
</template>
<script>
import {
addCmmsInventoryManagement,
updateCmmsInventoryManagement,
} from "@/api/cmmsInventoryManagement/cmmsInventoryManagement.js";
export default {
data() {
return {
form: [
{
arr: [
{
code: "equipmentCategory",
title: "设备大类",
type: 1,
readlyOnly: false,
verification: true,
rule: "0",
customTips: " ",
regular: " ",
dictionary: "",
multiple: false,
fileNum: 0,
single: true,
dateType: "date",
dateFormat: "yyyy-MM-dd",
},
{
code: "equipmentSubcategory",
title: "设备小类",
type: 1,
readlyOnly: false,
verification: true,
rule: "0",
customTips: " ",
regular: " ",
dictionary: "",
multiple: false,
fileNum: 0,
single: true,
dateType: "date",
dateFormat: "yyyy-MM-dd",
},
{
code: "specificationModel",
title: "规格型号",
type: 1,
readlyOnly: false,
verification: true,
rule: "0",
customTips: " ",
regular: " ",
dictionary: "",
multiple: false,
fileNum: 0,
single: true,
dateType: "date",
dateFormat: "yyyy-MM-dd",
},
{
code: "quantity",
title: "设备数量",
type: 0,
readlyOnly: false,
verification: true,
rule: "0",
customTips: " ",
regular: " ",
dictionary: "",
multiple: false,
fileNum: 0,
single: true,
dateType: "date",
dateFormat: "yyyy-MM-dd",
},
{
code: "alarmThreshold",
title: "告警阈值",
type: 0,
readlyOnly: false,
verification: true,
rule: "0",
customTips: " ",
regular: " ",
dictionary: "",
multiple: false,
fileNum: 0,
single: true,
dateType: "date",
dateFormat: "yyyy-MM-dd",
},
{
code: "hasAlarm",
title: "是否存在告警信息(0-否,1-是)",
type: 0,
readlyOnly: false,
verification: true,
rule: "0",
customTips: " ",
regular: " ",
dictionary: "",
multiple: false,
fileNum: 0,
single: true,
dateType: "date",
dateFormat: "yyyy-MM-dd",
},
{
code: "remarks",
title: "备注",
type: 0,
readlyOnly: false,
verification: true,
rule: "0",
customTips: " ",
regular: " ",
dictionary: "",
multiple: false,
fileNum: 0,
single: true,
dateType: "date",
dateFormat: "yyyy-MM-dd",
},
],
},
],
form2: {},
open: false,
};
},
methods: {
init(row) {
this.open = true;
this.form2 = {};
this.title = "新增库存管理";
if (row && row.id) {
this.title = "修改库存管理";
this.form2 = row;
}
},
// 表单提交的时候
async formListSubmit() {
await this.$refs.formList.submit();
await this.submission();
},
submission() {
let params = JSON.parse(JSON.stringify(this.form2));
if (this.form2.id) {
updateCmmsInventoryManagement(params).then((res) => {
if (res.data.code == 0) {
this.$emit("refreshDataList");
this.open = false;
this.$message.success("修改成功");
} else {
this.$message.error(res.data.msg);
}
});
} else {
addCmmsInventoryManagement(params).then((res) => {
if (res.data.code == 0) {
this.$emit("refreshDataList");
this.open = false;
this.$message.success("新增成功");
} else {
this.$message.error(res.data.msg);
}
});
}
},
// 关闭弹框
handleCancel() {
this.$emit("refreshDataList");
this.open = false;
},
},
};
</script>
这个也新增的时候字典没回显
最新发布