plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

661 lines
21 KiB

<template>
<div class="mod-config">
<el-form :inline="true" label-position="top" style="margin-top: 1px; margin-left: 0px;" >
<el-row :gutter="20">
<el-col :span="18">
<el-form-item label="物料">
<el-input v-model="bomData.partNo" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="BOM类型">
<el-input v-model="bomData.bomType" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="BOM版本">
<el-input v-model="bomData.engChgLevel" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item label="替代编码">
<el-input v-model="bomData.alternativeNo" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="searchTable(true)" >刷新</el-button>
<el-button type="primary" v-if="((!ifDisableFlag && spForm.sp.includes(searchData.username) && baseForm.status === 'spz') || baseForm.status === 'cg' || superAdmin)" @click="changeBomRev()">变更</el-button>
<el-button type="primary" @click="jumpBom()">跳转至BOM</el-button>
<el-button v-if="baseForm.status === 'spz' && ((!ifDisableFlag && spForm.sp.includes(searchData.username)) || (superAdmin))" type="primary" @click="agreeSubmit">同意</el-button>
<el-button v-if="baseForm.status === 'spz' && ((baseForm.isReject === 'Y' && !ifDisableFlag && spForm.sp.includes(searchData.username)) || (superAdmin))" type="primary" @click="submitDataModal">驳回</el-button>
<!-- <el-button type="primary" @click="newData()" v-if="!ifDisableFlag">新增</el-button>-->
</el-form-item>
</el-col>
<el-col :span="3"><div class="grid-content bg-purple">
<el-form-item :label="'当前节点'" style="width: 100%">
<el-input v-model="spForm.nodeName" disabled ></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="3"><div class="grid-content bg-purple">
<el-form-item :label="'当前节点审批人'" style="width: 100%">
<el-input v-model="spForm.sp" disabled ></el-input>
</el-form-item>
</div>
</el-col>
</el-row>
<el-table
:data="bomList"
:height="height"
border
ref="componentTable"
style="width:100%">
<el-table-column
v-for="(item,index) in columnList1" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed == ''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="90"
label="操作">
<template slot-scope="scope">
<a type="text" v-if="scope.row.ifHasPeifang==='Y'" size="small" @click="jumpPeifang(scope.row)">跳转配方</a>
</template>
</el-table-column>
</el-table>
</el-form>
<el-dialog title="变更BOM" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="750px">
<el-table
:data="bomDetailList"
height="300"
border
highlight-current-row
onclick=""
@row-click="getRow"
ref="componentTable"
style="width:100%">
<el-table-column
prop="partNo"
header-align="left"
align="left"
min-width="80"
label="物料编码">
</el-table-column>
<el-table-column
prop="bomType"
header-align="left"
align="left"
min-width="80"
label="BOM类型">
</el-table-column>
<el-table-column
prop="engChgLevel"
header-align="left"
align="left"
min-width="80"
label="BOM版本">
</el-table-column>
<el-table-column
prop="alternativeNo"
header-align="left"
align="left"
min-width="80"
label="替代编码">
</el-table-column>
<el-table-column
prop="alternativeDescription"
header-align="left"
align="left"
min-width="80"
label="替代名称">
</el-table-column>
<el-table-column
prop="status"
header-align="left"
align="left"
min-width="60"
label="状态">
</el-table-column>
<el-table-column
prop="effPhaseInDate"
header-align="left"
align="left"
min-width="80"
label="生效日期">
</el-table-column>
<el-table-column
prop="effPhaseOutDate"
header-align="left"
align="left"
min-width="80"
label="失效日期">
</el-table-column>
</el-table>
<el-footer style="height:30px;margin-top:20px;text-align:center">
<el-button type="primary" @click="updateBMBomRev()">确定</el-button>
<el-button type="primary" @click="modalFlag=false">取消</el-button>
</el-footer>
</el-dialog>
<!-- 提交 -->
<el-dialog title="驳回" top="30vh" :close-on-click-modal="false" v-drag :visible.sync="submitModalFlag" width="500px">
<el-form :inline="true" label-position="top">
<el-form-item :label="'驳回意见'">
<el-input type="textarea" v-model="rejectOpinion" :rows="3" resize='none' show-word-limit style="width: 479px;height: 30px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:30px;margin-top: 50px;text-align:center">
<el-button type="primary" @click="rejectSubmit">确定</el-button>
<el-button type="primary" @click="submitModalFlag = false">取消</el-button>
</el-footer>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
<script>
import {
searchBMBom,
searchBMBomDetail,
updateBMBomRev,
tsdBasicInformationSearch,getBMStatusDesc,
submitChange, // 提交
getOADetailForBM,
} from "@/api/sampleManagement/technicalSpecificationList.js"
import {
getNodeAuthority, // 获取节点权限
} from '@/api/changeManagement/changeManagement.js'
import Chooselist from '@/views/modules/common/Chooselist'
export default {
components: {
Chooselist
},
data() {
return {
superAdmin:false,
modalFlag:false,
bomFlag:false,
height:200,
searchData: {
site: '',
username: this.$store.state.user.name,
codeNo: '',
buNo:'',
fieldId:'',
},
bomData:{
site: '',
partNo:'',
alternativeNo:'',
bomType:'',
engChgLevel:'',
},
currentRow:"",
bomList:[],
bomDetailList:[],
columnList1: [
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2LineSequence',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'lineSequence',
headerAlign: 'center',
align: 'center',
columnLabel: '序号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2ComponentPart',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'componentPart',
headerAlign: 'center',
align: 'center',
columnLabel: '物料编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2ComponentPartDesc',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'componentPartDesc',
headerAlign: 'center',
align: 'left',
columnLabel: '物料名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 160
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2QtyPerAssembly',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'qtyPerAssembly',
headerAlign: 'center',
align: 'right',
columnLabel: '单位用量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 140
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2ComponentScrap',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'componentScrap',
headerAlign: 'center',
align: 'right',
columnLabel: '调机量',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2ShrinkageFactor',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'shrinkageFactor',
headerAlign: 'center',
align: 'right',
columnLabel: '损耗率',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2PrintUnitName',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'printUnit',
headerAlign: 'center',
align: 'center',
columnLabel: '单位',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2IssueType',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'issueType',
headerAlign: 'center',
align: 'center',
columnLabel: '生产属性',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2OperationDesc',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'operationId',
headerAlign: 'center',
align: 'center',
columnLabel: '工序',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2IssueToLoc',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'issueToLocName',
headerAlign: 'center',
align: 'center',
columnLabel: '发料库位',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
{
userId: this.$store.state.user.name,
functionId: 104002,
serialNumber: '104002Table2NoteText',
tableId: '104002Table2',
tableName: 'BOM子物料表',
columnProp: 'noteText',
headerAlign: 'center',
align: 'left',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
],
baseForm:{
status:'',
isReject:'',
},
spForm:{
sp:'',
nodeName:'',
},
ifDisableFlag:false,
rejectOpinion: '',
submitModalFlag: false,
}
},
mounted () {
this.$nextTick(() => {
this.height = window.innerHeight - 100
})
},
methods: {
// 获取基础数据列表S
getBaseList (val, type) {
this.tagNo = val
this.tagNo1 = type
this.$nextTick(() => {
let strVal = ''
if (val === 1013) {
if(type==1) {
strVal = this.dataForm.partType
}
}
this.$refs.baseList.init(val, strVal)
})
},
/* 列表方法的回调 */
getBaseData (val) {
if (this.tagNo === 1013) {
if(this.tagNo1==1) {
this.dataForm.partType = val.Base_id
this.dataForm.partTypeDesc = val.Base_desc
}
}
},
choosePart(row){
this.dataForm.erpPartNo=row.erpPartNo
this.dataForm.familyId=row.familyId
this.dataForm.familyName=row.familyName
this.dataForm.partDesc=row.partDesc
this.dataForm.spec=row.spec
this.partModelFlag=false;
},
//初始化组件的参数
init(inData) {
if(this.searchData.codeNo!=null&&this.searchData.codeNo!=''){
return false;
}
//初始化参数
this.searchData = JSON.parse(JSON.stringify(inData));
if(this.searchData.ifDisableFlag){
this.ifDisableFlag=true
}
//刷新表格
this.searchTable();
},
searchTable(type){
getOADetailForBM(this.searchData).then(({data}) => {
this.spForm.nodeName = data.row.nodeName
this.spForm.sp = data.row.sp==null?'':data.row.sp
})
searchBMBom(this.searchData).then(({data}) => {
if(data&& data.code===0){
this.bomList = data.rows;
this.bomData = data.row;
if(type){
this.$message.success( '操作成功')
}
} else {
this.$message.error(data.msg)
}
});
tsdBasicInformationSearch(this.searchData).then(({data}) => {
this.baseForm=data.row;
this.bomData.site=data.row.site
this.bomData.partNo=data.row.finalPartNo
this.getNodeAuthority(data.row)
})
},
searchDetailTable(){
searchBMBomDetail(this.bomData).then(({data}) => {
this.bomDetailList=data.rows;
});
},
changeBomRev(){
this.searchDetailTable()
this.currentRow=null
this.modalFlag=true;
},
getRow(row){
this.currentRow=row
},
updateBMBomRev(){
if(this.currentRow==null){
this.$alert('请点击选择BOM版本!', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.currentRow.status!=='Buildable'){
this.$alert('只有Buildable状态的可以保存!', '错误', {
confirmButtonText: '确定'
})
return false;
}
let inData={
site:this.bomData.site,
codeNo:this.searchData.codeNo,
bomType:this.currentRow.bomType,
engChgLevel:this.currentRow.engChgLevel,
bomAlternativeNo:this.currentRow.alternativeNo
}
updateBMBomRev(inData).then(({data})=>{
if(data&& data.code===0){
this.searchTable();
this.modalFlag=false;
this.$message.success( '操作成功')
} else {
this.$message.error(data.msg)
}
})
},
jumpBom(){
if(this.bomData.engChgLevel!=null||this.bomData.engChgLevel!==''){
this.$message.error("bom明细不存在")
}
let inData={
site:this.searchData.site,
partNo:this.bomData.partNo,
bomType:this.bomData.bomType,
engChgLevel:this.bomData.engChgLevel,
}
localStorage.setItem('bomData', JSON.stringify(inData))
window.open('#/part-bomManagement');
},
jumpPeifang(row){
let inData={
site:row.site,
partNo:row.componentPart,
bomType:'Manufacturing',
}
localStorage.setItem('recipeData', JSON.stringify(inData))
window.open('#/part-recipeManagement');
},
// 获取流程的配置权限
getNodeAuthority (row) {
getBMStatusDesc(this.searchData).then(({data}) => {
this.superAdmin=data.superAdmin
if(data.superAdmin){
this.ifDisableFlag = false
return false
}
if (data.status === '已完成' || data.status === '已升版' || data.status === 'Dead') {
this.ifDisableFlag = true
return false
}
if(data.status === '审批中') {
let tempData = {
site: row.site,
stepId: row.stepId,
menuId: '103002'
}
getNodeAuthority(tempData).then(({data}) => {
if (data && data.code === 0) {
this.ifDisableFlag = true
let plmStepRoleBaseBm = data.rows.plm_stepRole_base_bm
let arr = plmStepRoleBaseBm.filter(a => a.fieldId === this.searchData.fieldId)
if (arr.length > 0) {
if (arr[0].updateFlag === 'N') {
this.ifDisableFlag = true
} else {
this.ifDisableFlag = false
}
} else {
this.ifDisableFlag = true
}
}
})
}
})
},
// 同意提交
agreeSubmit () {
this.$confirm(`是否确认提交?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let tempData = {
site: this.searchData.site,
userName: this.$store.state.user.name,
codeNo: this.searchData.codeNo,
menuId: '103002',
nodeConclusion: 'Y'
}
this.submitData(tempData)
})
},
// 驳回提交
rejectSubmit () {
this.$confirm(`是否确认驳回?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let tempData = {
site: this.searchData.site,
userName: this.$store.state.user.name,
codeNo: this.searchData.codeNo,
menuId: '103002',
nodeConclusion: 'N',
rejectOpinion : this.rejectOpinion
}
this.submitData(tempData)
})
},
submitData (tempData) {
submitChange(tempData).then(({data}) => {
if (data && data.code === 0) {
this.submitModalFlag = false
// this.searchTable();
window.location.reload();
this.$message({message: '操作成功', type: 'success'})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// 打开提交模态框
submitDataModal () {
this.rejectOpinion = ''
this.submitModalFlag = true
},
},
}
</script>
<style scoped>
</style>