点检计划-设备清单

This commit is contained in:
JinLu.Yin 2022-06-18 13:54:00 +08:00
parent c3c0511cb7
commit 515b24e4ad
4 changed files with 208 additions and 0 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询点检设备列表
export function listCheckmachinery(query) {
return request({
url: '/mes/dv/checkmachinery/list',
method: 'get',
params: query
})
}
// 查询点检设备详细
export function getCheckmachinery(recordId) {
return request({
url: '/mes/dv/checkmachinery/' + recordId,
method: 'get'
})
}
// 新增点检设备
export function addCheckmachinery(data) {
return request({
url: '/mes/dv/checkmachinery',
method: 'post',
data: data
})
}
// 修改点检设备
export function updateCheckmachinery(data) {
return request({
url: '/mes/dv/checkmachinery',
method: 'put',
data: data
})
}
// 删除点检设备
export function delCheckmachinery(recordId) {
return request({
url: '/mes/dv/checkmachinery/' + recordId,
method: 'delete'
})
}

View File

@ -230,6 +230,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.machineryId); this.ids = selection.map(item => item.machineryId);
this.selectedRows = selection;
this.single = selection.length != 1; this.single = selection.length != 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },

View File

@ -227,6 +227,12 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-tabs type="border-card" v-if="form.planId != null">
<el-tab-pane label="设备清单">
<Checkmachinery ref="machinerylist" :optType="optType" :planId="form.planId" ></Checkmachinery>
</el-tab-pane>
<el-tab-pane label="点检项目"></el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button> <el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button>
<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </el-button> <el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </el-button>
@ -239,10 +245,12 @@
<script> <script>
import { listCheckplan, getCheckplan, delCheckplan, addCheckplan, updateCheckplan } from "@/api/mes/dv/checkplan"; import { listCheckplan, getCheckplan, delCheckplan, addCheckplan, updateCheckplan } from "@/api/mes/dv/checkplan";
import Checkmachinery from "./machinery.vue"
import {genCode} from "@/api/system/autocode/rule" import {genCode} from "@/api/system/autocode/rule"
export default { export default {
name: "Checkplan", name: "Checkplan",
dicts: ['mes_cycle_type','mes_order_status'], dicts: ['mes_cycle_type','mes_order_status'],
components:{Checkmachinery},
data() { data() {
return { return {
autoGenFlag: false, autoGenFlag: false,

View File

@ -0,0 +1,155 @@
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
v-if="optType !='view'"
@click="handleAdd"
v-hasPermi="['mes:dv:checkmachinery:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
v-if="optType !='view'"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:dv:checkmachinery:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<MachinerySelect ref="machinerySelect" @onSelected="onMachineryAdd"></MachinerySelect>
<el-table v-loading="loading" :data="checkmachineryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="设备编码" align="center" prop="machineryCode" />
<el-table-column label="设备名称" align="center" prop="machineryName" />
<el-table-column label="品牌" align="center" prop="machineryBrand" />
<el-table-column label="规格型号" align="center" prop="machinerySpec" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
v-if="optType !='view'"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:dv:checkmachinery:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listCheckmachinery, delCheckmachinery, addCheckmachinery } from "@/api/mes/dv/checkmachinery";
import MachinerySelect from "@/components/machinerySelect/index.vue";
export default {
name: "Checkmachinery",
components:{MachinerySelect},
props:{
planId: null,
optType: null
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
checkmachineryList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
planId: this.planId,
machineryId: null,
machineryCode: null,
machineryName: null,
machineryBrand: null,
machinerySpec: null,
},
//
form: {},
};
},
created() {
this.getList();
},
methods: {
/** 查询点检设备列表 */
getList() {
this.loading = true;
listCheckmachinery(this.queryParams).then(response => {
this.checkmachineryList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.recordId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$refs.machinerySelect.showFlag = true;
},
//
onMachineryAdd(rows){
debugger;
if(rows !=null && rows.length >0){
rows.forEach(row => {
row.planId = this.planId;
addCheckmachinery(row).then(response =>{
this.getList();
});
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
const recordIds = row.recordId || this.ids;
this.$modal.confirm('是否确认删除点检设备编号为"' + recordIds + '"的数据项?').then(function() {
return delCheckmachinery(recordIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>