设备管理-检查项维护V1

yangwl
wws 1 year ago
parent 3ad5c53ca4
commit 3d4c4318d0

@ -178,17 +178,17 @@
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['device:item:export']"
>导出
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['device:item:export']"-->
<!-- >导出-->
<!-- </el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -196,30 +196,30 @@
<el-table-column type="selection" width="55" align="center"/>
<el-table-column v-if="false" label="主键" align="center" prop="itemId"/>
<el-table-column width="60" align="center" label="序号" type="index"></el-table-column>
<el-table-column label="检查项编码" align="center" prop="itemCode"/>
<el-table-column label="检查项" align="center" prop="itemName"/>
<el-table-column label="方法/工具" align="center" prop="itemMethod"/>
<el-table-column label="维护类型编码" align="center" prop="itemType"/>
<el-table-column label="维护类型名称" align="center" prop="itemTypeName"/>
<el-table-column label="备注" align="center" prop="itemRemark"/>
<el-table-column width="120" label="检查项编码" align="center" prop="itemCode"/>
<el-table-column width="120" label="检查项" align="center" prop="itemName"/>
<el-table-column width="120" label="方法/工具" align="center" prop="itemMethod"/>
<el-table-column width="120" label="维护类型编码" align="center" prop="itemType"/>
<el-table-column width="120" label="维护类型" align="center" prop="itemTypeName"/>
<el-table-column width="120" label="备注" align="center" prop="itemRemark"/>
<el-table-column v-if="false" label="工厂" align="center" prop="factoryCode"/>
<el-table-column v-if="false" label="备用字段1" align="center" prop="attr1"/>
<el-table-column v-if="false" label="备用字段2" align="center" prop="attr2"/>
<el-table-column v-if="false" label="备用字段3" align="center" prop="attr3"/>
<el-table-column v-if="false" label="删除标识" align="center" prop="delFlag"/>
<el-table-column label="创建时间" align="center" prop="createdTime" width="180">
<el-table-column width="180" label="创建时间" align="center" prop="createdTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createdBy"/>
<el-table-column label="更新时间" align="center" prop="updatedTime" width="180">
<el-table-column width="120" label="创建人" align="center" prop="createdBy"/>
<el-table-column width="180" label="更新时间" align="center" prop="updatedTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updatedBy"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
<el-table-column width="120" label="更新人" align="center" prop="updatedBy"/>
<el-table-column width="180" label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
@ -251,7 +251,7 @@
<!-- 添加或修改检查项维护对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<!-- 第一行 -->
<el-row>
<!-- 第一列 -->
@ -261,7 +261,7 @@
</el-form-item>
</el-col>
<!-- 第二列 -->
<el-col :span="6">
<el-col :span="6" :offset="0.9">
<el-form-item label="维护类型">
<el-select v-model="form.itemType" placeholder="请选择维护类型" clearable>
<el-option
@ -274,7 +274,7 @@
</el-form-item>
</el-col>
<!-- 第三列 -->
<el-col :span="7">
<el-col :span="7" offset="1">
<el-form-item label-width="100px" label="检查方法/工具">
<el-input v-model="form.itemMethod" placeholder="请输入检查方法/工具"></el-input>
</el-form-item>
@ -294,12 +294,12 @@
<!-- 单选-动态表单 -->
<el-row v-if="item.standardType === 'qualitative'">
<el-col :span="6">
<el-form-item label-width="100px" label="标准名称">
<el-form-item label="标准名称">
<el-input v-model="item.standardName" placeholder="请输入标准名称"></el-input>
</el-form-item>
</el-col>
<!-- 操作 -->
<el-col :span="4">
<el-col :span="4" class="my-dynamic-btn">
<el-button size="small" v-if="formStandard.length > 1" @click="removeStandard(index)" type="danger">
</el-button>
<el-button size="small" v-if="index === formStandard.length - 1" @click="addStandard" type="primary">
@ -308,27 +308,27 @@
</el-row>
<el-row v-else>
<el-col :span="6">
<el-form-item label-width="100px" label="标准名称">
<el-form-item label="标准名称">
<el-input v-model="item.standardName" placeholder="请输入标准名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="上限">
<el-form-item label-width="50px" label="上限">
<el-input v-model="item.detailUpLimit" placeholder="请输入上限"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="下限">
<el-form-item label-width="50px" label="下限">
<el-input v-model="item.detailDownLimit" placeholder="请输入下限"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="单位">
<el-form-item label-width="50px" label="单位">
<el-input v-model="item.detailUnit" placeholder="请输入单位"></el-input>
</el-form-item>
</el-col>
<!-- 操作 -->
<el-col :span="4">
<el-col :span="4" class="my-dynamic-btn">
<el-button size="small" v-if="formStandard.length > 1" @click="removeStandard(index)" type="danger">
</el-button>
<el-button size="small" v-if="index === formStandard.length - 1" @click="addStandard" type="primary">
@ -442,14 +442,7 @@ export default {
formStandard: [],
},
//
rules: {
itemName: [
{required: true, message: "检查项名称不能为空", trigger: "blur"}
],
itemMethod: [
{required: true, message: "检查项方法/工具不能为空", trigger: "blur"}
],
}
rules: {}
};
},
created() {
@ -458,7 +451,13 @@ export default {
methods: {
//
addStandard() {
this.formStandard.push({standardType: 'qualitative', standardName: null, detailUpLimit: null, detailDownLimit: null, detailUnit: null,})
this.formStandard.push({
standardType: 'qualitative',
standardName: null,
detailUpLimit: null,
detailDownLimit: null,
detailUnit: null,
})
},
//
removeStandard(index) {
@ -535,30 +534,94 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
console.log("这里这里")
this.reset();
const itemId = row.itemId || this.ids
getItem(itemId).then(response => {
this.form = response.data;
console.log(response.data)
this.formStandard = response.data.formStandard;
this.open = true;
this.title = "修改检查项";
});
},
/** 提交按钮 */
submitForm() {
//
if (this.form.itemName == null) {
this.$message({
message: "请输入检查项!",
type: "warning"
})
return
}
if (this.form.itemType == null) {
this.$message({
message: "请选择维护类型!",
type: "warning"
})
return
}
if (this.form.itemMethod == null) {
this.$message({
message: "请输入检查方法/工具!",
type: "warning"
})
return
}
for (let i = 0; i < this.formStandard.length; i++) {
//
if (this.formStandard[i].standardType == 'qualitative') {
if (this.formStandard[i].standardName == null) {
this.$message({
message: "请输入标准名称!",
type: "warning"
})
return
}
}
//
if (this.formStandard[i].standardType == 'quantify') {
if (this.formStandard[i].standardName == null) {
this.$message({
message: "请输入标准名称!",
type: "warning"
})
return
}
if (this.formStandard[i].detailUpLimit == null) {
this.$message({
message: "请输入上限!",
type: "warning"
})
return
}
if (this.formStandard[i].detailDownLimit == null) {
this.$message({
message: "请输入下限!",
type: "warning"
})
return
}
if (this.formStandard[i].detailUnit == null) {
this.$message({
message: "请输入单位!",
type: "warning"
})
return
}
}
}
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.itemId != null) {
this.form.formStandard = this.formStandard;
updateItem(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
console.log("这里是新增数据")
this.form.formStandard = this.formStandard;
console.log(this.form)
addItem(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
@ -592,4 +655,7 @@ export default {
.my-select-input {
width: 130px;
}
.my-dynamic-btn{
margin-left: 10px;
}
</style>

Loading…
Cancel
Save