线体管理

master
shaoyong 8 months ago
parent c01ce52351
commit c5aaa6379b

@ -0,0 +1,52 @@
import request from '@/utils/request'
// 查询线体管理列表
export function listMesLine(query) {
return request({
url: '/mes/mesLine/list',
method: 'get',
params: query
});
}
// 查询线体管理详细
export function getMesLine(id) {
return request({
url: '/mes/mesLine/' + id,
method: 'get'
});
}
// 新增线体管理
export function addMesLine(data) {
return request({
url: '/mes/mesLine',
method: 'post',
data: data
});
}
// 修改线体管理
export function updateMesLine(data) {
return request({
url: '/mes/mesLine',
method: 'put',
data: data
});
}
// 删除线体管理
export function delMesLine(id) {
return request({
url: '/mes/mesLine/' + id,
method: 'delete'
});
}
//线体获取
export function getLineBodyList(query) {
return request({
url: '/mes/mesLine/selectLineBody',
method: 'get',
params: query
});
}

@ -0,0 +1,423 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="90px"
>
<el-form-item label="线体编码" prop="lineCode">
<el-input
v-model="queryParams.lineCode"
placeholder="请输入线体编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="线体名称" prop="lineName">
<el-input
v-model="queryParams.lineName"
placeholder="请输入线体名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标准用人" prop="useMan">
<el-input
v-model="queryParams.useMan"
type="number"
placeholder="请输入标准用人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="标准效率(%)" prop="efficiency">
<el-input
v-model="queryParams.efficiency"
type="number"
placeholder="请输入标准效率"
clearable
@keyup.enter.native="handleQuery"
/>
</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-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAddLineBody"
v-hasPermi="['mes:mesLine:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:mesLine:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:mesLine:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['mes:mesLine:export']"
>导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="mesLineList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" align="center" />
<el-table-column label="线体编码" align="center" prop="lineCode" />
<el-table-column label="线体名称" align="center" prop="lineName" />
<el-table-column label="标准用人" align="center" prop="useMan" />
<el-table-column label="标准效率(%)" align="center" prop="efficiency" />
<el-table-column label="检验工具" align="center" prop="attr1" />
<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-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:mesLine:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:mesLine: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"
/>
<!-- 添加或修改线体管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="标准用人" prop="useMan">
<el-input v-model="form.useMan" type="number" placeholder="请输入标准用人" />
</el-form-item>
<el-form-item label="标准效率(%)" prop="efficiency">
<el-input v-model="form.efficiency" type="number" placeholder="请输入标准效率" />
</el-form-item>
<el-form-item label="检验工具" prop="attr1">
<el-input v-model="form.attr1" placeholder="请输入检验工具" />
</el-form-item>
<el-form-item
v-for="(item, index) in processItems"
:label="'第' + (index+1) +'道工艺'"
:key="item.key"
:prop="'processItems.'+index+'.value'"
:rules="{required: true, message: '请输入工艺', trigger: 'blur'}"
>
<el-input v-model="item.value" style="width: 70%;" placeholder="请输入工艺"></el-input>
<el-button @click.prevent="removeProcessItem(item)" style="margin-left:30px">删除</el-button>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="addProcessItem"></el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<SelectMesLine ref="selectMesLine" @onSelected="onSelectLineBody">
</SelectMesLine>
</div>
</template>
<script>
import {
listMesLine,
getMesLine,
delMesLine,
addMesLine,
updateMesLine,
} from "@/api/mes/mesLine";
import SelectMesLine from "./selectMesLine";
export default {
name: "MesLine",
components: {SelectMesLine,},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// 线
mesLineList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
lineCode: null,
lineName: null,
useMan: null,
efficiency: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
factoryCode: null,
},
//
form: {},
//
rules: {
useMan: [
{ required: true, message: "标准用人不能为空", trigger: "blur" },
],
efficiency: [
{ required: true, message: "标准效率不能为空", trigger: "blur" },
],
},
processItems:[{
value: '',
key: Date.now()
}],
};
},
created() {
this.getList();
},
methods: {
/** 查询线体管理列表 */
getList() {
this.loading = true;
listMesLine(this.queryParams).then((response) => {
this.mesLineList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
lineCode: null,
lineName: null,
useMan: null,
efficiency: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
factoryCode: null,
delFlag: null,
processList: [],
processItems: [{
value: '',
key: Date.now()
}],
};
this.processItems=[{
value: '',
key: Date.now()
}],
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加线体管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getMesLine(id).then((response) => {
this.form = response.data;
if (response.data.processList !== null) {
this.processItems = response.data.processList.map(item => {
return {
value: item,
key: Date.now(),
};
});
this.form.processItems = this.processItems;
}
this.open = true;
this.title = "修改线体管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
this.form.processList = this.form.processItems.map(item => item.value);
updateMesLine(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addMesLine(this.form).then((response) => {
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除线体编号为"' + ids + '"的数据项?')
.then(function () {
return delMesLine(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"mes/mesLine/export",
{
...this.queryParams,
},
`mesLine_${new Date().getTime()}.xlsx`
);
},
handleAddLineBody() {
this.$refs.selectMesLine.showFlag = true;
},
onSelectLineBody(obj) {
console.log(obj);
this.form.lineCode = obj.code;
this.form.lineName = obj.name;
addMesLine(this.form).then((response) => {
if(response.code == 200) {
this.$modal.msgSuccess("添加成功");
}else {
this.$modal.msgError(response.msg);
}
this.getList();
});
},
//
addProcessItem() {
this.processItems.push({
value: '',
key: Date.now()
});
this.form.processItems = this.processItems;
},
//
removeProcessItem(item) {
var index = this.processItems.indexOf(item)
if (index !== -1) {
this.processItems.splice(index, 1)
}
this.form.processItems = this.processItems;
},
},
};
</script>

@ -0,0 +1,145 @@
<template>
<el-dialog title="线体选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="1000px"
>
<el-row :gutter="20">
<!--BOM数据-->
<el-col :span="24" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="105px" align="center">
<el-form-item label="线体编码" prop="lineCode">
<el-input
v-model="queryParams.lineCode"
placeholder="请输入线体编码"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="线体名称" prop="lineName">
<el-input
v-model="queryParams.lineName"
placeholder="请输入线体名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</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="itemList" @selection-change="handleBomSelectionChange" ref="myTable" >
<el-table-column width="50" align="center" type="selection">
</el-table-column>
<!-- 序号 -->
<el-table-column type="index" width="90" align="center" label="序号"></el-table-column>
<el-table-column label="线体编码" align="center" key="lineCode" prop="lineCode" :show-overflow-tooltip="true" />
<el-table-column label="线体名称" align="center" key="lineName" prop="lineName" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitBomForm"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {getLineBodyList } from "@/api/mes/mesLine";
export default {
name: "selectMesLine",
data() {
return {
showFlag:false,
//
selectedRows: {},
//
single: true,
//
multiple: false,
//
showSearch: true,
//
total: 0,
// BOM
itemList: null,
defaultProps: {
id: "id",
label: "label"
},
//
queryParams: {
pageNum: 1,
pageSize: 10,
lineCode: '',
lineName : ''
},
};
},
created() {
this.getList();
},
methods: {
handleEquipmentSelectionChange (val) {
this.itemList = val
},
/** 查询BOM列表*/
getList() {
this.loading = true;
getLineBodyList(this.queryParams).then(response => {
this.itemList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleBomSelectionChange(selection) {
if(selection.length>1){
this.$modal.msgSuccess("只能选一个");
}
this.ids = selection[0].lineCode;
this.idsName = selection[0].lineName;
},
submitBomForm() {
this.selectedRows.code = this.ids;
this.selectedRows.name = this.idsName;
this.$emit('onSelected', this.selectedRows);
this.showFlag = false;
}
}
};
</script>
Loading…
Cancel
Save