设备管理-检查项维护(新增)

yangwl
wws 1 year ago
parent d275564d22
commit 3ad5c53ca4

@ -26,12 +26,14 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="维护类型" prop="itemType"> <el-form-item label="维护类型" prop="itemType">
<el-input <el-select v-model="queryParams.itemType" placeholder="请选择维护类型" clearable>
v-model="queryParams.itemType" <el-option
placeholder="请输入维护类型" v-for="dict in dict.type.device_item_type"
clearable :key="dict.value"
@keyup.enter.native="handleQuery" :label="dict.label"
:value="dict.value"
/> />
</el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="false" label="维护类型名称" prop="itemTypeName"> <el-form-item v-if="false" label="维护类型名称" prop="itemTypeName">
<el-input <el-input
@ -149,7 +151,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['device:item:add']" v-hasPermi="['device:item:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -160,7 +163,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['device:item:edit']" v-hasPermi="['device:item:edit']"
>修改</el-button> >修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -171,7 +175,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['device:item:remove']" v-hasPermi="['device:item:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -181,7 +186,8 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['device:item:export']" v-hasPermi="['device:item:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -195,7 +201,7 @@
<el-table-column label="方法/工具" align="center" prop="itemMethod"/> <el-table-column label="方法/工具" align="center" prop="itemMethod"/>
<el-table-column label="维护类型编码" align="center" prop="itemType"/> <el-table-column label="维护类型编码" align="center" prop="itemType"/>
<el-table-column label="维护类型名称" align="center" prop="itemTypeName"/> <el-table-column label="维护类型名称" align="center" prop="itemTypeName"/>
<el-table-column label="检查项备注" align="center" prop="itemRemark" /> <el-table-column label="备注" align="center" prop="itemRemark"/>
<el-table-column v-if="false" label="工厂" align="center" prop="factoryCode"/> <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="备用字段1" align="center" prop="attr1"/>
<el-table-column v-if="false" label="备用字段2" align="center" prop="attr2"/> <el-table-column v-if="false" label="备用字段2" align="center" prop="attr2"/>
@ -221,14 +227,16 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['device:item:edit']" v-hasPermi="['device:item:edit']"
>修改</el-button> >修改
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['device:item:remove']" v-hasPermi="['device:item:remove']"
>删除</el-button> >删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -243,25 +251,32 @@
<!-- 添加或修改检查项维护对话框 --> <!-- 添加或修改检查项维护对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
<el-form ref="form" :model="form" :rules="addrules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- 第一行 --> <!-- 第一行 -->
<el-row> <el-row>
<!-- 第一列 --> <!-- 第一列 -->
<el-col :span="6"> <el-col :span="6">
<el-form-item label="检查项" prop="prodCode"> <el-form-item label="检查项">
<el-input v-model="input" placeholder="请输入检查项"></el-input> <el-input v-model="form.itemName" placeholder="请输入检查项"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 第二列 --> <!-- 第二列 -->
<el-col :span="6"> <el-col :span="6">
<el-form-item label="维护类型" prop="prodCode"> <el-form-item label="维护类型">
<el-input v-model="input" placeholder="请输入输入维护类型"></el-input> <el-select v-model="form.itemType" placeholder="请选择维护类型" clearable>
<el-option
v-for="dict in dict.type.device_item_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 第三列 --> <!-- 第三列 -->
<el-col :span="7"> <el-col :span="7">
<el-form-item label-width="100px" label="检查方法/工具" prop="prodCode"> <el-form-item label-width="100px" label="检查方法/工具">
<el-input v-model="input" placeholder="请输入检查方法/工具"></el-input> <el-input v-model="form.itemMethod" placeholder="请输入检查方法/工具"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -270,17 +285,17 @@
<!-- 标准类型 --> <!-- 标准类型 -->
<el-row> <el-row>
<el-col :span="7"> <el-col :span="7">
<el-form-item label="标准类型" prop="prodCode"> <el-form-item label="标准类型">
<el-radio v-model="item.standardType" label="1"></el-radio> <el-radio v-model="item.standardType" label="qualitative"></el-radio>
<el-radio v-model="item.standardType" label="2"></el-radio> <el-radio v-model="item.standardType" label="quantify"></el-radio>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- 单选-动态表单 --> <!-- 单选-动态表单 -->
<el-row v-if="item.standardType === '1'"> <el-row v-if="item.standardType === 'qualitative'">
<el-col :span="6"> <el-col :span="6">
<el-form-item label-width="100px" label="标准名称" prop="prodCode"> <el-form-item label-width="100px" label="标准名称">
<el-input v-model="input" placeholder="请输入标准名称"></el-input> <el-input v-model="item.standardName" placeholder="请输入标准名称"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 操作 --> <!-- 操作 -->
@ -293,23 +308,23 @@
</el-row> </el-row>
<el-row v-else> <el-row v-else>
<el-col :span="6"> <el-col :span="6">
<el-form-item label-width="100px" label="标准名称" prop="prodCode"> <el-form-item label-width="100px" label="标准名称">
<el-input v-model="input" placeholder="请输入标准名称"></el-input> <el-input v-model="item.standardName" placeholder="请输入标准名称"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="上限" prop="prodCode"> <el-form-item label="上限">
<el-input v-model="input" placeholder="请输入上限"></el-input> <el-input v-model="item.detailUpLimit" placeholder="请输入上限"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="下限" prop="prodCode"> <el-form-item label="下限">
<el-input v-model="input" placeholder="请输入下限"></el-input> <el-input v-model="item.detailDownLimit" placeholder="请输入下限"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="单位" prop="prodCode"> <el-form-item label="单位">
<el-input v-model="input" placeholder="请输入单位"></el-input> <el-input v-model="item.detailUnit" placeholder="请输入单位"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 操作 --> <!-- 操作 -->
@ -322,8 +337,8 @@
</el-row> </el-row>
</div> </div>
<!-- 备注 --> <!-- 备注 -->
<el-form-item label="备注" prop="prodCode"> <el-form-item label="备注">
<el-input v-model="input" placeholder="请输入备注"></el-input> <el-input v-model="form.itemRemark" placeholder="请输入备注"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -339,12 +354,16 @@ import { listItem, getItem, delItem, addItem, updateItem } from "@/api/device/it
export default { export default {
name: "Item", name: "Item",
dicts: ['device_item_type'],
data() { data() {
return { return {
// //
formStandard: [{ formStandard: [{
standardType: '1', standardType: 'qualitative',
value1: null, standardName: null,
detailUpLimit: null,
detailDownLimit: null,
detailUnit: null,
}], }],
// //
pickerOptions: { pickerOptions: {
@ -415,7 +434,13 @@ export default {
updateTimeArray: [], updateTimeArray: [],
}, },
// //
form: {}, form: {
itemName: null,
itemType: null,
itemMethod: null,
itemRemark: null,
formStandard: [],
},
// //
rules: { rules: {
itemName: [ itemName: [
@ -433,7 +458,7 @@ export default {
methods: { methods: {
// //
addStandard() { addStandard() {
this.formStandard.push({standardType: '2', value1: ''}) this.formStandard.push({standardType: 'qualitative', standardName: null, detailUpLimit: null, detailDownLimit: null, detailUnit: null,})
}, },
// //
removeStandard(index) { removeStandard(index) {
@ -472,7 +497,15 @@ export default {
createdBy: null, createdBy: null,
updatedTime: null, updatedTime: null,
updatedBy: null, updatedBy: null,
formStandard: [],
}; };
this.formStandard = [{
standardType: 'qualitative',
standardName: null,
detailUpLimit: null,
detailDownLimit: null,
detailUnit: null,
}];
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -498,16 +531,18 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加检查项维护"; this.title = "新增检查项";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
console.log("这里这里")
this.reset(); this.reset();
const itemId = row.itemId || this.ids const itemId = row.itemId || this.ids
getItem(itemId).then(response => { getItem(itemId).then(response => {
this.form = response.data; this.form = response.data;
console.log(response.data)
this.open = true; this.open = true;
this.title = "修改检查项维护"; this.title = "修改检查项";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -521,6 +556,9 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
console.log("这里是新增数据")
this.form.formStandard = this.formStandard;
console.log(this.form)
addItem(this.form).then(response => { addItem(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -538,7 +576,8 @@ export default {
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {

Loading…
Cancel
Save