|
|
@ -0,0 +1,605 @@ |
|
|
|
<template> |
|
|
|
<div class="app-container"> |
|
|
|
<el-form ref="queryForm" :model="queryParams" :inline="true"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-BomId')" prop="bomid"> |
|
|
|
<el-input |
|
|
|
v-model="queryParams.bomid" |
|
|
|
placeholder="请输入" |
|
|
|
clearable |
|
|
|
size="small" |
|
|
|
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 type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-table v-loading="loading" :data="dataList" border> |
|
|
|
<el-table-column |
|
|
|
type="index" |
|
|
|
width="40" |
|
|
|
/> |
|
|
|
<el-table-column align="center" :label="getColumnName('ME_BomHead-BomId')" prop="ME_BomHead-BomId" sortable width="200px" show-overflow-tooltip /> |
|
|
|
<el-table-column align="center" :label="getColumnName('ME_BomHead-MatNr')" prop="ME_BomHead-MatNr" sortable width="200px" show-overflow-tooltip /> |
|
|
|
<el-table-column align="center" :label="getColumnName('ME_BomHead-Descr')" prop="ME_BomHead-Descr" sortable width="200px" show-overflow-tooltip /> |
|
|
|
<el-table-column v-for="(item, index) in headers" :key="index" align="center" :label="getColumnName(item)" show-overflow-tooltip> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span v-if="item === 'ME_BomHead-LastModify'"> {{ parseTime(scope.row[item]) }} </span> |
|
|
|
<span v-else-if="item === 'ME_BomHead-CreateTime'"> {{ parseTime(scope.row[item]) }} </span> |
|
|
|
<span v-else-if="item === 'me_bomhead-type'"> {{ getContent(scope.row[item]) }} </span> |
|
|
|
<span v-else>{{ scope.row[item] }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" align="center" width="120" fixed="right"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button |
|
|
|
size="mini" |
|
|
|
type="text" |
|
|
|
@click="handleUpdate(scope.row)" |
|
|
|
>修改</el-button> |
|
|
|
<el-button |
|
|
|
size="mini" |
|
|
|
type="text" |
|
|
|
@click="handleDelete(scope.row)" |
|
|
|
>删除</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<pagination |
|
|
|
v-show="total>0" |
|
|
|
:total="total" |
|
|
|
:page.sync="queryParams.pageNumber" |
|
|
|
:limit.sync="queryParams.pageSize" |
|
|
|
@pagination="getList" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 添加或修改配置对话框 --> |
|
|
|
<el-dialog :title="title" :visible.sync="open" fullscreen> |
|
|
|
<el-tabs type="border-card"> |
|
|
|
<el-tab-pane label="当前字段"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-BomId')" prop="ME_BomHead-BomId"> |
|
|
|
<el-input v-model="form['ME_BomHead-BomId']" placeholder="请输入" :disabled="!isAdd" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-MatNr')"> |
|
|
|
<el-input v-model="form['ME_BomHead-MatNr']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-Descr')"> |
|
|
|
<el-input v-model="form['ME_BomHead-Descr']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="6" style="text-align: right;"> |
|
|
|
<el-button type="primary" @click="submitForm" size="medium">确 定</el-button> |
|
|
|
<el-button @click="cancel" size="medium">取 消</el-button> |
|
|
|
</el-col> |
|
|
|
<el-col v-show="!isAdd" :span="24"> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-tree :data="form.valst" :props="defaultProps" @node-click="handleNodeClick" /> |
|
|
|
</el-col> |
|
|
|
<el-col :span="16"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addBomItem">新增</el-button> |
|
|
|
<el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteBomItem">删除</el-button> |
|
|
|
<el-button type="success" icon="el-icon-check" size="mini" @click="saveBomItem">保存</el-button> |
|
|
|
<div style="float:right; font-size:16px;"><strong>{{ editType }}</strong></div> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="`${getColumnName('ME_BomLst-FmatNr')}`" required> |
|
|
|
<el-input v-model="formBom['ME_BomLst-FmatNr']" placeholder="请输入" disabled /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-FmatName')"> |
|
|
|
<el-input v-model="formBom['ME_BomLst-FmatName']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-FmatQty')"> |
|
|
|
<el-input v-model="formBom['ME_BomLst-FmatQty']" placeholder="请输入" style="display:inline-block; width:200px" /> |
|
|
|
<el-select v-model="formBom['ME_BomLst-FmatUom']" style="width:130px" placeholder="请选择"> |
|
|
|
<el-option |
|
|
|
v-for="item in uomArray" |
|
|
|
:key="item['Uom-UomId']" |
|
|
|
:label="item['Uom-UomId'] + '-' + item['Uom-UomName']" |
|
|
|
:value="item['Uom-UomId']" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-FmatSpec')"> |
|
|
|
<el-input v-model="formBom['ME_BomLst-FmatSpec']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item> |
|
|
|
<el-divider /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="`${getColumnName('ME_BomLst-CmatNr')}`" required> |
|
|
|
<el-input v-model="formBom['ME_BomLst-CmatNr']" placeholder="请输入" :disabled="isBomlst" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-CmatName')"> |
|
|
|
<el-input v-model="formBom['ME_BomLst-CmatName']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-CmatQty')"> |
|
|
|
<el-input v-model="formBom['ME_BomLst-CmatQty']" placeholder="请输入" style="display:inline-block; width:200px" /> |
|
|
|
<el-select v-model="formBom['ME_BomLst-CmatUom']" style="width:130px" placeholder="请选择"> |
|
|
|
<el-option |
|
|
|
v-for="item in uomArray" |
|
|
|
:key="item['Uom-UomId']" |
|
|
|
:label="item['Uom-UomId'] + '-' + item['Uom-UomName']" |
|
|
|
:value="item['Uom-UomId']" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-CmatType')"> |
|
|
|
<el-select v-model="formBom['ME_BomLst-CmatType']" placeholder="请选择"> |
|
|
|
<el-option |
|
|
|
v-for="item in childType" |
|
|
|
:key="item" |
|
|
|
:label="item" |
|
|
|
:value="item" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-TimeUom')"> |
|
|
|
<el-input v-model="formBom['ME_BomLst-TimeUom']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-LossRate')"> |
|
|
|
<el-input v-model="formBom['ME_BomLst-LossRate']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-ValidFrom')"> |
|
|
|
<el-date-picker |
|
|
|
v-model="formBom['ME_BomLst-ValidFrom']" |
|
|
|
type="date" |
|
|
|
placeholder="请选择日期" |
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomLst-ValidTo')"> |
|
|
|
<el-date-picker |
|
|
|
v-model="formBom['ME_BomLst-ValidTo']" |
|
|
|
type="date" |
|
|
|
placeholder="请选择日期" |
|
|
|
value-format="yyyy-MM-dd" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item> |
|
|
|
<el-checkbox v-model="formBom['ME_BomLst-BackFlushItem']" :label="getColumnName('ME_BomLst-BackFlushItem')" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item> |
|
|
|
<el-checkbox v-model="formBom['ME_BomLst-CriticalItem']" :label="getColumnName('ME_BomLst-CriticalItem')" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<!-- <el-col :span="24"> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="success" icon="el-icon-check" @click="saveBomItem">保存</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-col> --> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-col> |
|
|
|
</el-form> |
|
|
|
</el-tab-pane> |
|
|
|
<el-tab-pane label="备用字段"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-BomheadCval1')"> |
|
|
|
<el-input v-model="form['ME_BomHead-BomheadCval1']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-BomheadCval2')"> |
|
|
|
<el-input v-model="form['ME_BomHead-BomheadCval2']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-BomheadIval1')"> |
|
|
|
<el-input v-model.number="form['ME_BomHead-BomheadIval1']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-BomheadIval2')"> |
|
|
|
<el-input v-model.number="form['ME_BomHead-BomheadIval2']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-BomheadDval1')"> |
|
|
|
<el-input v-model="form['ME_BomHead-BomheadDval1']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item :label="getColumnName('ME_BomHead-BomheadDval2')"> |
|
|
|
<el-input v-model="form['ME_BomHead-BomheadDval2']" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-form> |
|
|
|
</el-tab-pane> |
|
|
|
</el-tabs> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { getBomheadlist, getBomhead, delBomhead, addBomhead, updateBomhead, getUOMArr, getBomInfo, addBomlst, updateBomlst, delBomlist |
|
|
|
} from '@/api/plant/maintainbom' |
|
|
|
export default { |
|
|
|
name: 'Maintainbom', |
|
|
|
data() { |
|
|
|
return { |
|
|
|
// 遮罩层 |
|
|
|
loading: true, |
|
|
|
// 总条数 |
|
|
|
total: 0, |
|
|
|
// 零件表格数据 |
|
|
|
dataList: [], |
|
|
|
// 弹出层标题 |
|
|
|
title: '', |
|
|
|
// 是否显示弹出层 |
|
|
|
open: false, |
|
|
|
// 是否更新 |
|
|
|
isAdd: false, |
|
|
|
isBomlst: true, |
|
|
|
// 查询参数 |
|
|
|
queryParams: { |
|
|
|
pageNumber: 1, |
|
|
|
pageSize: 10, |
|
|
|
bomid: undefined |
|
|
|
}, |
|
|
|
defaultProps: { |
|
|
|
children: 'children', |
|
|
|
label: arg => `${arg['ME_BomLst-CmatNr']}/${arg['ME_BomLst-CmatName']}` |
|
|
|
}, |
|
|
|
editType: '', |
|
|
|
headers: [], |
|
|
|
uomArray: [], |
|
|
|
childType: ['BB-自制件'], |
|
|
|
// 表单参数 |
|
|
|
form: {}, |
|
|
|
formBom: { |
|
|
|
'ME_BomLst-FmatNr': undefined, |
|
|
|
'ME_BomLst-FmatName': undefined, |
|
|
|
'ME_BomLst-FmatQty': undefined, |
|
|
|
'ME_BomLst-FmatUom': undefined, |
|
|
|
'ME_BomLst-CmatNr': undefined, |
|
|
|
'ME_BomLst-LevelNr': undefined, |
|
|
|
'ME_BomLst-CmatName': undefined, |
|
|
|
'ME_BomLst-CmatQty': undefined, |
|
|
|
'ME_BomLst-CmatUom': undefined, |
|
|
|
'ME_BomLst-CmatType': undefined, |
|
|
|
'ME_BomLst-Position': undefined, |
|
|
|
'ME_BomLst-BackFlushItem': false, |
|
|
|
'ME_BomLst-CriticalItem': false, |
|
|
|
'ME_BomLst-ValidFrom': undefined, |
|
|
|
'ME_BomLst-ValidTo': undefined, |
|
|
|
'ME_BomLst-FmatSpec': undefined, |
|
|
|
'ME_BomLst-TimeUom': undefined, |
|
|
|
'ME_BomLst-LossRate': undefined, |
|
|
|
'ME_BomLst-BomlstCval2': undefined, |
|
|
|
'ME_BomLst-BomlstIval1': undefined, |
|
|
|
'ME_BomLst-BomlstIval2': undefined |
|
|
|
}, |
|
|
|
formBom1: {}, |
|
|
|
// 表单校验 |
|
|
|
rules: { |
|
|
|
'ME_BomHead-BomId': [ |
|
|
|
{ required: true, message: '此项不能为空', trigger: 'blur' } |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.getList() |
|
|
|
getUOMArr().then(res => { |
|
|
|
this.uomArray = res.data |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
/** 查询零件数据列表 */ |
|
|
|
getList() { |
|
|
|
this.loading = true |
|
|
|
getBomheadlist(this.queryParams).then( |
|
|
|
response => { |
|
|
|
this.dataList = response.data.records |
|
|
|
this.total = response.data.count |
|
|
|
this.headers = [ |
|
|
|
'ME_BomHead-LastModify', |
|
|
|
'ME_BomHead-LastUser', |
|
|
|
'ME_BomHead-CreateTime' |
|
|
|
] |
|
|
|
this.loading = false |
|
|
|
} |
|
|
|
) |
|
|
|
}, |
|
|
|
handleNodeClick(data) { |
|
|
|
this.formBom = {} |
|
|
|
this.formBom1 = {} |
|
|
|
if (data['ME_BomLst-FmatNr']) { |
|
|
|
getBomInfo(data['ME_BomLst-BomId'],data['ME_BomLst-FmatNr'],data['ME_BomLst-CmatNr']).then(res => { |
|
|
|
this.formBom = res.data |
|
|
|
this.formBom1 = res.data |
|
|
|
this.isBomlst = true |
|
|
|
this.editType = '编辑模式' |
|
|
|
this.formBom['ME_BomLst-BackFlushItem'] = this.formBom['ME_BomLst-BackFlushItem'] === 1 |
|
|
|
this.formBom['ME_BomLst-CriticalItem'] = this.formBom['ME_BomLst-CriticalItem'] === 1 |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 取消按钮 |
|
|
|
cancel() { |
|
|
|
this.open = false |
|
|
|
this.reset() |
|
|
|
}, |
|
|
|
addBomItem() { |
|
|
|
this.editType = '新增模式' |
|
|
|
if (!this.formBom1['ME_BomLst-CmatNr']) { |
|
|
|
this.formBom['ME_BomLst-FmatNr'] = this.form['ME_BomHead-BomId'] |
|
|
|
this.formBom['ME_BomLst-BomId'] = this.form['ME_BomHead-BomId'] |
|
|
|
} else { |
|
|
|
this.formBom['ME_BomLst-FmatNr'] = this.formBom1['ME_BomLst-CmatNr'] |
|
|
|
} |
|
|
|
this.formBom['ME_BomLst-FmatName'] = this.formBom1['ME_BomLst-CmatName'] |
|
|
|
this.formBom['ME_BomLst-FmatQty'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatNr'] = undefined |
|
|
|
this.formBom['ME_BomLst-LevelNr'] = this.formBom1['ME_BomLst-LevelNr'] ? this.formBom1['ME_BomLst-LevelNr'] + 1 : 1 |
|
|
|
this.formBom['ME_BomLst-CmatName'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatQty'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatType'] = undefined |
|
|
|
this.formBom['ME_BomLst-Position'] = undefined |
|
|
|
this.formBom['ME_BomLst-BackFlushItem'] = false |
|
|
|
this.formBom['ME_BomLst-CriticalItem'] = false |
|
|
|
this.formBom['ME_BomLst-ValidFrom'] = undefined |
|
|
|
this.formBom['ME_BomLst-ValidTo'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatSpec'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstCval2'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstIval1'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstIval2'] = undefined |
|
|
|
this.formBom['ME_BomLst-TimeUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-LossRate'] = undefined |
|
|
|
this.isBomlst = false |
|
|
|
// this.$forceUpdate() |
|
|
|
}, |
|
|
|
deleteBomItem() { |
|
|
|
const bomid = this.formBom['ME_BomLst-BomId'] |
|
|
|
this.editType = '' |
|
|
|
this.$confirm('是否确认删除?', '警告', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
return delBomlist(this.formBom['ME_BomLst-BomId'], this.formBom['ME_BomLst-FmatNr'], this.formBom['ME_BomLst-CmatNr']) |
|
|
|
}).then(() => { |
|
|
|
this.formBom['ME_BomLst-FmatNr'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatName'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatQty'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatNr'] = undefined |
|
|
|
this.formBom['ME_BomLst-LevelNr'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatName'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatQty'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatType'] = undefined |
|
|
|
this.formBom['ME_BomLst-Position'] = undefined |
|
|
|
this.formBom['ME_BomLst-BackFlushItem'] = false |
|
|
|
this.formBom['ME_BomLst-CriticalItem'] = false |
|
|
|
this.formBom['ME_BomLst-ValidFrom'] = undefined |
|
|
|
this.formBom['ME_BomLst-ValidTo'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatSpec'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstCval2'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstIval1'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstIval2'] = undefined |
|
|
|
this.formBom['ME_BomLst-TimeUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-LossRate'] = undefined |
|
|
|
this.formBom1 = {} |
|
|
|
getBomhead(bomid).then(response => { |
|
|
|
this.form = response.data |
|
|
|
}) |
|
|
|
this.msgSuccess('删除成功') |
|
|
|
}).catch(function() {}) |
|
|
|
}, |
|
|
|
saveBomItem() { |
|
|
|
if (!this.formBom['ME_BomLst-FmatNr'] && !this.formBom['ME_BomLst-CmatNr']) { |
|
|
|
this.msgError(`"${this.getColumnName('ME_BomLst-FmatNr')}"和"${this.getColumnName('ME_BomLst-CmatNr')}"不能为空`) |
|
|
|
} else { |
|
|
|
const bomid = this.formBom['ME_BomLst-BomId'] |
|
|
|
this.formBom['ME_BomLst-BackFlushItem'] = this.formBom['ME_BomLst-BackFlushItem'] ? 1 : 0 |
|
|
|
this.formBom['ME_BomLst-CriticalItem'] = this.formBom['ME_BomLst-CriticalItem'] ? 1 : 0 |
|
|
|
if (this.formBom['ME_BomLst-FmatQty']) { |
|
|
|
this.formBom['ME_BomLst-FmatQty'] = parseFloat(this.formBom['ME_BomLst-FmatQty']) |
|
|
|
} |
|
|
|
if (this.formBom['ME_BomLst-CmatQty']) { |
|
|
|
this.formBom['ME_BomLst-CmatQty'] = parseFloat(this.formBom['ME_BomLst-CmatQty']) |
|
|
|
} |
|
|
|
if (this.formBom['ME_BomLst-LossRate']) { |
|
|
|
this.formBom['ME_BomLst-LossRate'] = parseFloat(this.formBom['ME_BomLst-LossRate']) |
|
|
|
} |
|
|
|
if (this.editType === '编辑模式') { |
|
|
|
updateBomlst(this.formBom).then(res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.msgSuccess('修改成功') |
|
|
|
getBomhead(bomid).then(response => { |
|
|
|
this.form = response.data |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.msgError(res.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (this.editType === '新增模式') { |
|
|
|
addBomlst(this.formBom).then(res => { |
|
|
|
if (res.code === 200) { |
|
|
|
this.msgSuccess('新增成功') |
|
|
|
this.formBom = {} |
|
|
|
this.formBom['ME_BomLst-BackFlushItem'] = false |
|
|
|
this.formBom['ME_BomLst-CriticalItem'] = false |
|
|
|
this.formBom1 = {} |
|
|
|
getBomhead(bomid).then(response => { |
|
|
|
this.form = response.data |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.msgError(res.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
this.formBom1 = {} |
|
|
|
this.editType = '' |
|
|
|
} |
|
|
|
}, |
|
|
|
// 表单重置 |
|
|
|
reset() { |
|
|
|
this.isAdd = true |
|
|
|
this.form = { |
|
|
|
'ME_BomHead-MatNr': undefined, |
|
|
|
'ME_BomHead-BomId': undefined, |
|
|
|
'ME_BomHead-Descr': undefined, |
|
|
|
'ME_BomHead-BomheadCval1': undefined, |
|
|
|
'ME_BomHead-BomheadCval2': undefined, |
|
|
|
'ME_BomHead-BomheadIval1': undefined, |
|
|
|
'ME_BomHead-BomheadIval2': undefined, |
|
|
|
'ME_BomHead-BomheadDval1': undefined, |
|
|
|
'ME_BomHead-BomheadDval2': undefined, |
|
|
|
valst: [] |
|
|
|
} |
|
|
|
this.formBom['ME_BomLst-FmatNr'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatName'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatQty'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatNr'] = undefined |
|
|
|
this.formBom['ME_BomLst-LevelNr'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatName'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatQty'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-CmatType'] = undefined |
|
|
|
this.formBom['ME_BomLst-Position'] = undefined |
|
|
|
this.formBom['ME_BomLst-BackFlushItem'] = false |
|
|
|
this.formBom['ME_BomLst-CriticalItem'] = false |
|
|
|
this.formBom['ME_BomLst-ValidFrom'] = undefined |
|
|
|
this.formBom['ME_BomLst-ValidTo'] = undefined |
|
|
|
this.formBom['ME_BomLst-FmatSpec'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstCval2'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstIval1'] = undefined |
|
|
|
this.formBom['ME_BomLst-BomlstIval2'] = undefined |
|
|
|
this.formBom['ME_BomLst-TimeUom'] = undefined |
|
|
|
this.formBom['ME_BomLst-LossRate'] = undefined |
|
|
|
this.formBom1 = {} |
|
|
|
this.resetForm('form') |
|
|
|
}, |
|
|
|
/** 搜索按钮操作 */ |
|
|
|
handleQuery() { |
|
|
|
if (this.queryParams.bomid === '') this.queryParams.bomid = undefined |
|
|
|
this.queryParams.pageNumber = 1 |
|
|
|
this.getList() |
|
|
|
}, |
|
|
|
/** 新增按钮操作 */ |
|
|
|
handleAdd() { |
|
|
|
this.reset() |
|
|
|
this.open = true |
|
|
|
this.title = '添加' |
|
|
|
}, |
|
|
|
/** 修改按钮操作 */ |
|
|
|
handleUpdate(row) { |
|
|
|
this.reset() |
|
|
|
this.isAdd = false |
|
|
|
getBomhead(row['ME_BomHead-BomId']).then(response => { |
|
|
|
this.form = response.data |
|
|
|
this.open = true |
|
|
|
this.title = '修改' |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** 提交按钮 */ |
|
|
|
submitForm: function() { |
|
|
|
this.$refs['form'].validate(valid => { |
|
|
|
if (valid) { |
|
|
|
if (this.form['ME_BomHead-BomheadDval1']) { |
|
|
|
this.form['ME_BomHead-BomheadDval1'] = parseInt(this.form['ME_BomHead-BomheadDval1']) |
|
|
|
} |
|
|
|
if (this.form['ME_BomHead-BomheadDval2']) { |
|
|
|
this.form['ME_BomHead-BomheadDval2'] = parseInt(this.form['ME_BomHead-BomheadDval2']) |
|
|
|
} |
|
|
|
if (!this.isAdd) { |
|
|
|
updateBomhead(this.form).then(response => { |
|
|
|
if (response.code === 200) { |
|
|
|
this.msgSuccess('修改成功') |
|
|
|
this.open = false |
|
|
|
this.getList() |
|
|
|
} else { |
|
|
|
this.msgError(response.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
addBomhead(this.form).then(response => { |
|
|
|
if (response.code === 200) { |
|
|
|
this.msgSuccess('新增成功') |
|
|
|
this.open = false |
|
|
|
this.getList() |
|
|
|
} else { |
|
|
|
this.msgError(response.msg) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** 删除按钮操作 */ |
|
|
|
handleDelete(row) { |
|
|
|
this.$confirm('是否确认删除"' + row['ME_BomHead-BomId'] + '"的数据项?', '警告', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(function() { |
|
|
|
return delBomhead(row['ME_BomHead-BomId']) |
|
|
|
}).then(() => { |
|
|
|
this.msgSuccess('删除成功') |
|
|
|
const totalPage = Math.ceil((this.total -1) / this.queryParams.pageSize) |
|
|
|
this.queryParams.pageNumber = this.queryParams.pageNumber > totalPage ? totalPage : this.queryParams.pageNumber |
|
|
|
this.queryParams.pageNumber = this.queryParams.pageNumber < 1 ? 1 : this.queryParams.pageNumber |
|
|
|
this.getList() |
|
|
|
}).catch(function() {}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
i { |
|
|
|
font-size: 20px; |
|
|
|
margin-left: 10px; |
|
|
|
display: inline-block; |
|
|
|
} |
|
|
|
span :hover { |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
</style> |