点检计划

This commit is contained in:
JinLu.Yin 2022-06-19 16:43:29 +08:00
parent ccf2b575d1
commit 3a26a52a1d
2 changed files with 170 additions and 22 deletions

View File

@ -0,0 +1,158 @@
<template>
<el-dialog title="设备选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="80%"
center
>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目编码" prop="subjectCode">
<el-input
v-model="queryParams.subjectCode"
placeholder="请输入项目编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="项目名称" prop="subjectName">
<el-input
v-model="queryParams.subjectName"
placeholder="请输入项目名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="项目类型" prop="subjectType">
<el-select v-model="queryParams.subjectType" placeholder="请选择项目类型" clearable>
<el-option
v-for="dict in dict.type.mes_dvsubject_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dvsubjectList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="项目编码" align="center" prop="subjectCode" />
<el-table-column label="项目类型" align="center" prop="subjectType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_dvsubject_type" :value="scope.row.subjectType"/>
</template>
</el-table-column>
<el-table-column label="项目内容" align="center" prop="subjectContent" :show-overflow-tooltip="true"/>
<el-table-column label="标准" align="center" prop="subjectStandard" :show-overflow-tooltip="true"/>
<el-table-column label="是否启用" align="center" prop="enableFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelect"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listDvsubject} from "@/api/mes/dv/dvsubject";
export default {
name: "DvsubjectSelect",
dicts: ['sys_yes_no', 'mes_dvsubject_type'],
props:{
subjectType: null,
},
data() {
return {
showFlag:false,
//
loading: true,
// s
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
dvsubjectList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
subjectCode: null,
subjectName: null,
subjectType: this.subjectType,
subjectContent: null,
subjectStandard: null,
enableFlag: null,
},
//
form: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询设备点检保养项目列表 */
getList() {
this.loading = true;
listDvsubject(this.queryParams).then(response => {
this.dvsubjectList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.subjectId)
this.selectedRows = selection;
this.single = selection.length!==1
this.multiple = !selection.length
},
//
confirmSelect(){
if(this.ids ==[] || this.ids.length==0){
this.$notify({
title:'提示',
type:'warning',
message: '请至少选择一条数据!'
});
return;
}
this.$emit('onSelected',this.selectedRows);
this.showFlag = false;
}
}
};
</script>

View File

@ -26,6 +26,7 @@
</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>
<DvsubjectSelect ref="subjectSelect" subjectType="CHECK" @onSelected="onSubjectSelected"></DvsubjectSelect>
<el-table v-loading="loading" :data="checksubjectList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="checksubjectList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
@ -60,19 +61,21 @@
<script> <script>
import { listChecksubject, getChecksubject, delChecksubject, addChecksubject, updateChecksubject } from "@/api/mes/dv/checksubject"; import { listChecksubject, getChecksubject, delChecksubject, addChecksubject, updateChecksubject } from "@/api/mes/dv/checksubject";
import DvsubjectSelect from "@/components/dvsubjectSelect/multi.vue"
export default { export default {
name: "Checksubject", name: "Checksubject",
props:{ props:{
planId: null, planId: null,
optType: null optType: null
}, },
components:{DvsubjectSelect},
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
selectedRows: [],
// //
single: true, single: true,
// //
@ -124,30 +127,17 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.$refs.subjectSelect.showFlag = true;
this.open = true;
this.title = "添加点检项目";
}, },
onSubjectSelected(rows){
/** 提交按钮 */ if(rows != null && rows.length >0){
submitForm() { rows.forEach(row => {
this.$refs["form"].validate(valid => { row.planId= this.planId;
if (valid) { addChecksubject(row).then(response => {
if (this.form.recordId != null) { this.getList();
updateChecksubject(this.form).then(response => { });
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}); });
} else {
addChecksubject(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
} }
});
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {