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.
 
 
 
 

2361 lines
79 KiB

<template>
<div class="mod-config">
<!-- 查询条件 -->
<el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
<el-form-item :label="'物料编码'">
<el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称'">
<el-input v-model="searchData.partDesc" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button :loading="queryLoading" @click="getDataList()">查询</el-button>
<el-button type="primary" @click="addModal()">新增</el-button>
<el-button type="primary" @click="delModal()">删除</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ "导出" }}
</download-excel>
</el-form-item>
</el-form>
<!-- routing列表 -->
<el-table
:height="height"
:data="dataList"
border
@selection-change="selectionRouting"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
:selectable="selectFlag"
width="50">
</el-table-column>
<el-table-column
v-for="(item,index) in columnList" :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="100"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="updateModal(scope.row)">编辑</a>
</template>
</el-table-column>
</el-table>
<!-- 复选统计 -->
<selectDiv ref="selectDiv"></selectDiv>
<!-- 分页插件 -->
<el-pagination style="margin-top: 0px"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- routing新增/编辑模态框 -->
<el-dialog :close-on-click-modal="false" v-drag :before-close="closeModalX" :visible.sync="modalFlag" width="1110px">
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 5px">
<el-form-item prop="partNo" :rules="rules.partNo">
<span v-if="!modalDisableFlag" slot="label" @click="queryPartList()"><a herf="#">物料编码</a></span>
<span v-if="modalDisableFlag" slot="label">物料编码</span>
<el-input v-model="modalData.partNo" :disabled="modalDisableFlag" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称'" prop="partDesc" :rules="rules.partDesc">
<el-input v-model="modalData.partDesc" disabled style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'工艺类型'" prop="routingType" :rules="rules.routingType">
<el-select v-model="modalData.routingType" :disabled="modalDisableFlag" style="width: 221px">
<el-option label="Manufacturing" value="Manufacturing"></el-option>
<el-option label="Repair" value="Repair"></el-option>
<el-option label="Prototype" value="Prototype"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="开始日期" prop="phaseInDate" :rules="rules.phaseInDate">
<el-date-picker
style="width: 221px"
v-model="modalData.phaseInDate"
type="date"
format="yyyy-MM-dd"
placeholder="请选择日期"
:editable=false>
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期">
<el-date-picker
style="width: 221px"
v-model="modalData.phaseOutDate"
type="date"
format="yyyy-MM-dd"
placeholder="请选择日期"
:editable=false>
</el-date-picker>
</el-form-item>
<el-form-item :label="'Routing版本号'" prop="routingRevision" :rules="rules.routingRevision">
<el-input v-model="modalData.routingRevision" type="number" :disabled="modalDisableFlag" style="width: 221px"></el-input>
</el-form-item>
<el-form-item v-if="!modalDisableFlag">
<el-button :loading="saveHeaderLoading" type="primary" @click="saveRoutingHeader()" style="margin-top: 23px;width: 142px">保存</el-button>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
<el-form-item label="备注">
<el-input type="textarea" v-model="modalData.noteText" :rows="3" resize='none' show-word-limit style="width: 1082px;height: 20px"></el-input>
</el-form-item>
</el-form>
<el-tabs v-model="detailTable" style="margin-top: 50px; width: 100%; min-height: 120px" type="border-card" @tab-click="tabDetailClick" class="detail-tab">
<!-- Routing明细信息页签 -->
<el-tab-pane label="Routings" name="routing_detail">
<el-form label-position="top" style="margin-top: -10px">
<el-form-item>
<el-button type="primary" @click="saveRoutingDetail()" style="margin-left: 7px">新增</el-button>
<el-button type="primary" @click="deleteRoutingDetail()">删除</el-button>
<el-button type="primary" @click="updateRoutingDetail()">编辑</el-button>
<el-button v-if="detailData.status === 'Tentative'" type="primary" @click="updateStatusToBuildable()">Buildable</el-button>
<el-button v-if="detailData.status === 'Buildable'" type="primary" @click="updateStatusToObsolete()">Obsolete</el-button>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="detailData" :rules="rules" style="margin-left: 7px">
<el-form-item :label="'替代编码'">
<el-select v-model="detailData.alternativeNo" @change="alternativeChange()" style="width: 221px">
<el-option
v-for = "(i, index) in detailDataList"
:key = "index"
:label = "i.alternativeNo"
:value = "i.alternativeNo">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="'替代名称'">
<el-input v-model="detailData.alternativeDescription" readonly style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'状态'">
<!-- <el-select v-model="detailData.status" disabled style="width: 221px">-->
<!-- <el-option label="暂定" value="Tentative"></el-option>-->
<!-- <el-option label="创建" value="Buildable"></el-option>-->
<!-- <el-option label="销毁" value="Obsolete"></el-option>-->
<!-- </el-select>-->
<el-input v-model="detailData.status" readonly style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px">
<el-form-item label="备注">
<el-input type="textarea" v-model="detailData.detailNoteText" :rows="3" resize='none' show-word-limit readonly style="width: 1073px;height: 20px"></el-input>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
<el-tabs v-model="subDetailTable" style="width: 100%; min-height: 330px" type="border-card" @tab-click="tabSubDetailClick" class="sub_detail-tab">
<!-- Routing子明细信息页签 -->
<el-tab-pane label="Operations" name="routing_sub_detail">
<el-form label-position="top" style="margin-top: 5px">
<el-form-item>
<el-button type="primary" @click="saveComponentModal()" style="margin-left: 7px">新增</el-button>
<el-button type="primary" @click="deleteComponentPart()">删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="subDetailList"
height="256px"
border
ref="componentTable"
@row-click="componentClickRow"
:row-class-name="rowClassName"
@selection-change="componentSelectionChange"
style="width:100%">
<el-table-column type="selection" align="center" width="50"></el-table-column>
<el-table-column
v-for="(item,index) in columnSubDetailList" :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="100"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="updateComponentModal(scope.row)">编辑</a>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<el-footer style="height:30px;margin-top:20px;text-align:center">
<el-button :loading="saveAllLoading" type="primary" @click="saveData()">保存</el-button>
<el-button type="primary" @click="closeModal">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 明细新增模态框 -->
<el-dialog title="替代" :close-on-click-modal="false" v-drag :visible.sync="saveDetailModalFlag" width="730px">
<el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
<el-form-item :label="'替代编码'" prop="alternativeNo" :disabled="saveDetailModalDisable" :rules="detailRules.alternativeNo">
<el-input v-model="saveDetailData.alternativeNo" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'替代名称'" prop="alternativeDescription" :rules="detailRules.alternativeDescription">
<el-input v-model="saveDetailData.alternativeDescription" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'状态'" prop="status" :rules="detailRules.status">
<!-- <el-select v-model="saveDetailData.status" style="width: 235px">-->
<!-- <el-option label="暂定" value="Tentative"></el-option>-->
<!-- <el-option label="创建" value="Buildable"></el-option>-->
<!-- <el-option label="销毁" value="Obsolete"></el-option>-->
<!-- </el-select>-->
<el-input v-model="saveDetailData.status" disabled style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="saveDetailData" style="margin-left: 5px">
<el-form-item label="备注">
<el-input type="textarea" v-model="saveDetailData.detailNoteText" :rows="3" resize='none' show-word-limit style="width: 690px;height: 20px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:35px;margin-top:65px;text-align:center">
<el-button :loading="saveDetailLoading" type="primary" @click="detailDataSave()">保存</el-button>
<el-button type="primary" @click="saveDetailModalFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 物料模态框 -->
<el-dialog title="物料清单" :close-on-click-modal="false" v-drag :visible.sync="partModelFlag" width="520px">
<div class="rq">
<el-form :inline="true" label-position="top" :model="partData">
<el-form-item :label="'物料编码'">
<el-input v-model="partData.partNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'物料名称'">
<el-input v-model="partData.partDesc" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="queryPartList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="300"
:data="partList"
@row-dblclick="getRowData"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in partColumnList" :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>
</div>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="partModelFlag=false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 子明细工序模态框 -->
<el-dialog title="工序清单" :close-on-click-modal="false" v-drag :visible.sync="componentPartModelFlag" width="520px">
<el-form :inline="true" label-position="top" :model="operationData">
<el-form-item :label="'工序号'">
<el-input v-model="operationData.operationId" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'工序名称'">
<el-input v-model="operationData.operationName" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="queryOperationList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:height="300"
:data="operationList"
@row-dblclick="getComponentRowData"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in componentOperationColumnList" :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>
</el-dialog>
<!-- 子明细新增模态框 -->
<el-dialog title="工序" :close-on-click-modal="false" v-drag :visible.sync="componentSaveModal" width="500px">
<el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
<!-- <el-form-item prop="operationId" :rules="componentRules.operationId">-->
<!-- <span v-if="!componentDisableFlag" slot="label" @click="queryOperationList()"><a herf="#">工序号</a></span>-->
<!-- <span v-if="componentDisableFlag" slot="label">工序号</span>-->
<!-- <el-input v-model="componentData.operationId" :disabled="componentDisableFlag" style="width: 221px"></el-input>-->
<!-- </el-form-item>-->
<el-form-item :label="'工序编码'" prop="operationNo" :rules="componentRules.operationNo">
<el-input v-model="componentData.operationNo" :disabled="componentDisableFlag" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'工序名称'" prop="operationName" :rules="componentRules.operationName">
<el-input v-model="componentData.operationName" :disabled="componentDisableFlag" style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
<el-form-item>
<span slot="label" @click="getBaseList(119)"><a herf="#">加工中心编码</a></span>
<el-input v-model="componentData.workCenterNo" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'加工中心名称'">
<el-input v-model="componentData.workCenterDesc" disabled style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
<el-form-item :label="'机器运行速度'">
<el-input class="numInput" v-model="componentData.machRunFactor" @input="handleInput(componentData.machRunFactor,1)" type="number" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'人工生产速度'">
<el-input class="numInput" v-model="componentData.laborSetupTime" @input="handleInput(componentData.laborSetupTime,5)" type="number" style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
<el-form-item :label="'调机时长'">
<el-input class="numInput" v-model="componentData.machSetupTime" @input="handleInput(componentData.machSetupTime,2)" type="number" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'时长单位'">
<el-select v-model="componentData.runTimeCode" clearable style="width: 221px">
<el-option label="单位/小时" value="A"></el-option>
<el-option label="小时/单位" value="B"></el-option>
<el-option label="小时" value="C"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
<el-form-item :label="'调机过程中人数'">
<el-input class="numInput" v-model="componentData.setupCrewSize" @input="handleInput(componentData.setupCrewSize,3)" type="number" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'生产过程中人数'">
<el-input class="numInput" v-model="componentData.crewSize" @input="handleInput(componentData.crewSize,4)" type="number" style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
<el-form-item :label="'机器效率%'">
<el-input class="numInput" v-model="componentData.efficiencyFactor" @input="handleInputB(componentData.efficiencyFactor,1)" type="number" style="width: 221px"></el-input>
</el-form-item>
<el-form-item :label="'人工效率%'">
<el-input class="numInput" v-model="componentData.laborRunFactor" @input="handleInputB(componentData.laborRunFactor,2)" type="number" style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
<el-form-item>
<span slot="label" @click="getBaseList(118, 1)"><a herf="#">人员等级</a></span>
<el-input v-model="componentData.laborClassDesc" style="width: 221px"></el-input>
</el-form-item>
<el-form-item>
<span slot="label" @click="getBaseList(118, 2)"><a herf="#">调机时的人员等级</a></span>
<el-input v-model="componentData.setupLaborClassDesc" style="width: 221px"></el-input>
</el-form-item>
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
<el-form-item :label="'外协采购料号'">
<el-input v-model="componentData.outsideOpItem" style="width: 456px"></el-input>
</el-form-item>
<!-- <el-form-item :label="'机台'">-->
<!-- <el-input v-model="componentData.machineNo" style="width: 221px"></el-input>-->
<!-- </el-form-item>-->
</el-form>
<el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
<el-form-item label="备注">
<el-input type="textarea" v-model="componentData.noteText" :rows="3" resize='none' show-word-limit style="width: 456px;height: 20px"></el-input>
</el-form-item>
</el-form>
<el-footer style="height:35px;margin-top:65px;text-align:center">
<el-button :loading="saveComponentLoading" type="primary" @click="componentDataSave()">保存</el-button>
<el-button type="primary" @click="componentSaveModal = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- chooseList模态框 -->
<ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
</div>
</template>
<script>
import {
routingManagementSearch, // routing列表查询
routingManagementSave, // routing新增
routingManagementEdit, // routing编辑
routingManagementDelete, // routing删除
queryRoutingHeader, // 查询routing主信息
saveRoutingHeader, // 新增routing主信息
queryRoutingDetail, // 查routing明细
routingDetailSave, // routing明细新增
routingDetailUpdate, // routing明细编辑
updateAlternativeStatus, // 修改明细状态
routingDetailDelete, // routing明细删除
queryPartList, // 查询物料清单
queryRoutingComponent, // 查询routing子明细
saveRoutingComponent, // 新增routing子明细
updateRoutingComponent, // 修改routing子明细
deleteRoutingComponent, // 删除routing子明细
queryOperationList, // 查询工序列表
} from '@/api/part/routingManagement.js'
import ChooseList from '@/views/modules/common/Chooselist'
export default {
// 组件
components: {
ChooseList
},
// 监听
watch: {
searchData: {
deep: true,
handler: function (newV, oldV) {
this.searchData.partNo = this.searchData.partNo.toUpperCase()
}
},
saveDetailData: {
deep: true,
handler: function (newV, oldV) {
this.saveDetailData.alternativeNo = this.saveDetailData.alternativeNo.toUpperCase()
}
}
},
// 对象
data () {
return {
// 导出
exportData: [],
exportName: 'routing物料列表' + this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: ['routing物料列表'],
exportFooter: [],
resultList: [],
// ======== 行高 ========
height: 200,
// ======== 分页 ========
pageIndex: 1,
pageSize: 50,
totalPage: 0,
selectedDataNum: 0,
// 条件查询
searchData: {
site: this.$store.state.user.site,
partNo: '',
partDesc: '',
page: 1,
limit: 10
},
// loading
queryLoading: false,
saveHeaderLoading: false,
saveDetailLoading: false,
saveComponentLoading: false,
saveAllLoading: false,
// 初始页签
detailTable: 'routing_detail',
subDetailTable: 'routing_sub_detail',
// ======== 数据对象 ========
modalData: {
flag: '',
title: '',
site: this.$store.state.user.site,
partNo: '',
partDesc: '',
routingRevision: '',
routingType: '',
noteText: '',
phaseInDate: '',
phaseOutDate: '',
createDate: '',
createBy: '',
updateDate: '',
updateBy: ''
},
detailData: {
site: this.$store.state.user.site,
partNo: '',
routingRevision: '',
routingType: '',
alternativeNo: '',
alternativeDescription: '',
routTemplateId: '',
planDate: '',
fixedLeadTimeDay: '',
fixedLeadTimeHour: '',
variableLeadTimeDay: '',
variableLeadTimeHour: '',
forStdLotByDay: '',
forLotByDay: '',
minLotQty: '',
detailNoteText: '',
status: '',
createDate: '',
createBy: '',
updateDate: '',
updateBy: ''
},
componentData: {
flag: '',
site: this.$store.state.user.site,
partNo: '',
routingRevision: '',
routingType: '',
alternativeNo: '',
operationId: '',
operationNo: '',
operationName: '',
efficiencyFactor: '',
machRunFactor: '',
machSetupTime: '',
runTimeCode: '',
laborRunFactor: '',
laborSetupTime: '',
crewSize: '',
setupCrewSize: '',
outsideOpItem: '',
machineNo: '',
workCenterNo: '',
workCenterDesc: '',
laborClassNo: '',
laborClassDesc: '',
setupLaborClassNo: '',
setupLaborClassDesc: '',
overlap: '',
noteText: '',
createDate: '',
createBy: '',
updateDate: '',
updateBy: ''
},
partData: {
site: this.$store.state.user.site,
partNo: '',
partDesc: '',
},
operationData: {
site: this.$store.state.user.site,
operationId: '',
operationName: '',
},
saveDetailData: {
flag: '',
site: this.$store.state.user.site,
partNo: '',
routingRevision: '',
routingType: '',
alternativeNo: '',
alternativeDescription: '',
routTemplateId: '',
planDate: '',
fixedLeadTimeDay: '',
fixedLeadTimeHour: '',
variableLeadTimeDay: '',
variableLeadTimeHour: '',
forStdLotByDay: '',
forLotByDay: '',
minLotQty: '',
detailNoteText: '',
status: '',
createDate: '',
createBy: '',
updateDate: '',
updateBy: ''
},
// ======== 数据列表 ========
dataList: [],
partList: [],
operationList: [],
componentPartSelections: [],
subDetailList: [],
detailDataList: [],
checkedDetail: [],
// ======== 列表表头 ========
columnList: [
{
userId: this.$store.state.user.name,
functionId: 104003,
serialNumber: '104003Table1PartNo',
tableId: '104003Table1',
tableName: 'Routing信息表',
columnProp: 'partNo',
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: 104003,
serialNumber: '104003Table1PartDesc',
tableId: '104003Table1',
tableName: 'Routing信息表',
columnProp: 'partDesc',
headerAlign: 'center',
align: 'left',
columnLabel: '物料名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 104003,
serialNumber: '104003Table1RoutingType',
tableId: '104003Table1',
tableName: 'Routing信息表',
columnProp: 'routingType',
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: 104003,
serialNumber: '104003Table1RoutingRevision',
tableId: '104003Table1',
tableName: 'Routing信息表',
columnProp: 'routingRevision',
headerAlign: 'center',
align: 'center',
columnLabel: 'Routing版本号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 104003,
serialNumber: '104003Table1CreateDate',
tableId: '104003Table1',
tableName: 'Routing信息表',
columnProp: 'createDate',
headerAlign: 'center',
align: 'center',
columnLabel: '创建时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 160
},
{
userId: this.$store.state.user.name,
functionId: 104003,
serialNumber: '104003Table1CreateBy',
tableId: '104003Table1',
tableName: 'Routing信息表',
columnProp: 'createBy',
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: 104003,
serialNumber: '104003Table1UpdateDate',
tableId: '104003Table1',
tableName: 'Routing信息表',
columnProp: 'updateDate',
headerAlign: 'center',
align: 'center',
columnLabel: '更新时间',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 160
},
{
userId: this.$store.state.user.name,
functionId: 104003,
serialNumber: '104003Table1UpdateBy',
tableId: '104003Table1',
tableName: 'Routing信息表',
columnProp: 'updateBy',
headerAlign: 'center',
align: 'center',
columnLabel: '更新人',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
}
],
partColumnList: [
{
columnProp: 'partNo',
headerAlign: "center",
align: "center",
columnLabel: '物料编码',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
},
{
columnProp: 'partDesc',
headerAlign: "center",
align: "center",
columnLabel: '物料名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
},
],
componentOperationColumnList: [
{
columnProp: 'operationId',
headerAlign: "center",
align: "center",
columnLabel: '工序号',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
},
{
columnProp: 'operationName',
headerAlign: "center",
align: "center",
columnLabel: '工序名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
}
],
columnSubDetailList: [
{
userId: this.$store.state.user.name,
functionId: 104003,
serialNumber: '104003Table2OperationNo',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'operationNo',
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: 104003,
serialNumber: '104003Table2OperationName',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'operationName',
headerAlign: 'center',
align: 'left',
columnLabel: '工序名称',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},
{
userId: this.$store.state.user.name,
functionId: 104003,
serialNumber: '104003Table2EfficiencyFactor',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'efficiencyFactor',
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: 104003,
serialNumber: '104003Table2MachRunFactor',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'machRunFactor',
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: 104003,
serialNumber: '104003Table2MachSetupTime',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'machSetupTime',
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: 104003,
serialNumber: '104003Table2RunTimeCode',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'runTimeCode',
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: 104003,
serialNumber: '104003Table2LaborRunFactor',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'laborRunFactor',
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: 104003,
serialNumber: '104003Table2LaborSetupTime',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'laborSetupTime',
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: 104003,
serialNumber: '104003Table2CrewSize',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'crewSize',
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: 104003,
serialNumber: '104003Table2SetupCrewSize',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'setupCrewSize',
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: 104003,
serialNumber: '104003Table2OutsideOpItem',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'outsideOpItem',
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: 104003,
serialNumber: '104003Table2MachineNo',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'machineNo',
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: 104003,
serialNumber: '104003Table2WorkCenterDesc',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'workCenterDesc',
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: 104003,
serialNumber: '104003Table2LaborClassNo',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'laborClassDesc',
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: 104003,
serialNumber: '104003Table2SetupLaborClassDesc',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'setupLaborClassDesc',
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: 104003,
serialNumber: '104003Table2NoteText',
tableId: '104003Table2',
tableName: 'Routing工序表',
columnProp: 'noteText',
headerAlign: 'center',
align: 'left',
columnLabel: '备注',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 150
},
],
// ======== 必填规则 ========
rules: {
partNo: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
partDesc: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
routingType: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
phaseInDate: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
routingRevision: [
{
required: true,
message: ' ',
trigger: 'change'
}
]
},
detailRules: {
alternativeNo: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
alternativeDescription: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
status: [
{
required: true,
message: ' ',
trigger: 'change'
}
]
},
componentRules: {
operationId: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
operationName: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
operationNo: [
{
required: true,
message: ' ',
trigger: 'change'
}
]
},
// ======== 复选数据集 ========
routingSelections: [],
// ======== 模态框开关控制 ========
modalFlag: false,
modalDisableFlag: false,
partModelFlag: false,
componentPartModelFlag: false,
saveDetailModalFlag: false,
saveDetailModalDisable: false,
componentSaveModal: false,
componentDisableFlag: false
}
},
mounted () {
this.$nextTick(() => {
this.height = window.innerHeight - 180
})
},
created () {
this.getDataList()
},
// js
methods: {
// ======== 分页相关方法 ========
/**
* 每页数
* @param val
*/
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
/**
* 当前页
* @param val
*/
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// ======== 页签切换相关方法 ========
/**
* 明细页签选择替换
* @param tab
* @param event
*/
tabDetailClick (tab, event) {
// 刷新列表数据
this.refreshDetailTable()
},
/**
* 子明细页签选择替换
* @param tab
* @param event
*/
tabSubDetailClick (tab, event) {
// 刷新列表数据
this.refreshSubDetailTable()
},
/**
* 刷新明细页签的table数据
*/
refreshDetailTable () {
if (this.detailTable === 'routing_detail') {
}
},
/**
* 刷新子明细页签的table数据
*/
refreshSubDetailTable () {
if (this.subDetailTable === 'routing_sub_detail') {
}
},
// ======== 列表数据操作方法 ========
/**
* 未知
* @returns {boolean}
*/
selectFlag () {
return true
},
/**
* 获取数据列表
*/
getDataList () {
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
this.queryLoading = true
routingManagementSearch(this.searchData).then(({data}) => {
if (data.code === 0) {
this.dataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
this.$refs.selectDiv.setLengthAll( this.dataList.length)
}
this.queryLoading = false
})
},
/**
* 复选列表信息
* @param val
*/
selectionRouting (val) {
this.routingSelections = val
this.$refs.selectDiv.setLengthselected(this.routingSelections.length)
},
// ======== 新增/编辑模态框 ========
/**
* routing新增模态框
*/
addModal () {
this.modalData = {
flag: '1',
title: 'Routing新增',
site: this.$store.state.user.site,
partNo: '',
partDesc: '',
routingRevision: '',
routingType: 'Manufacturing',
noteText: '',
phaseInDate: new Date(+ new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''),
phaseOutDate: '',
createBy: this.$store.state.user.name
}
this.detailData = {
site: this.$store.state.user.site,
partNo: '',
routingRevision: '',
routingType: '',
alternativeNo: '',
alternativeDescription: '',
routTemplateId: '',
planDate: '',
fixedLeadTimeDay: '',
fixedLeadTimeHour: '',
variableLeadTimeDay: '',
variableLeadTimeHour: '',
forStdLotByDay: '',
forLotByDay: '',
minLotQty: '',
detailNoteText: '',
status: '',
createBy: this.$store.state.user.name
}
this.subDetailList = []
this.modalDisableFlag = false
this.modalFlag = true
},
/**
* routing编辑模态框
*/
async updateModal (row) {
this.modalData = {
flag: '2',
site: row.site,
partNo: row.partNo,
partDesc: row.partDesc,
routingRevision: row.routingRevision,
routingType: row.routingType,
noteText: row.noteText,
phaseInDate: row.phaseInDate,
phaseOutDate: row.phaseOutDate,
engRevision: row.engRevision,
typeFlag: row.typeFlag,
netWeight: row.netWeight,
updateBy: this.$store.state.user.name
}
// 查routing明细
queryRoutingDetail(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailList
this.subDetailList = data.rows.componentList
this.detailData = data.rows.detailData
this.modalDisableFlag = true
this.modalFlag = true
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
/**
* 新增替代模态框
*/
saveRoutingDetail () {
if (this.modalData.partNo === '' || this.modalData.partNo == null) {
this.$message.warning('请先选择Routing物料!')
return
}
if (this.modalData.routingRevision === '' || this.modalData.routingRevision == null) {
this.$message.warning('请先填写Routing版本号!')
return
}
if (this.modalData.routingType === '' || this.modalData.routingType == null) {
this.$message.warning('请先选择工艺类型!')
return
}
this.saveDetailData = {
flag: '1',
site: this.$store.state.user.site,
partNo: this.modalData.partNo,
routingRevision: this.modalData.routingRevision,
routingType: this.modalData.routingType,
alternativeNo: '',
alternativeDescription: '',
routTemplateId: '',
planDate: '',
fixedLeadTimeDay: '',
fixedLeadTimeHour: '',
variableLeadTimeDay: '',
variableLeadTimeHour: '',
forStdLotByDay: '',
forLotByDay: '',
minLotQty: '',
detailNoteText: '',
status: 'Tentative',
createDate: '',
createBy: this.$store.state.user.name,
}
// 查询routing主信息
queryRoutingHeader(this.modalData).then(({data}) => {
if (data && data.code === 0) {
if (data.rows.length > 0) {
this.saveDetailModalFlag = true
this.saveDetailModalDisable = false
} else {
this.$message.warning('请先保存Routing主记录!')
}
} else {
this.$alert(data.msg, '提示', {
confirmButtonText: '确定'
})
}
})
},
/**
* 替代编辑模态框
*/
updateRoutingDetail () {
if (this.modalData.partNo === '' || this.modalData.partNo == null) {
this.$message.warning('请先选择Routing物料!')
return
}
if (this.modalData.routingRevision === '' || this.modalData.routingRevision == null) {
this.$message.warning('请先填写Routing版本号!')
return
}
if (this.modalData.routingType === '' || this.modalData.routingType == null) {
this.$message.warning('请先选择工艺类型!')
return
}
this.saveDetailData = {
flag: '2',
site: this.detailData.site,
partNo: this.detailData.partNo,
routingRevision: this.detailData.routingRevision,
routingType: this.detailData.routingType,
alternativeNo: this.detailData.alternativeNo,
alternativeDescription: this.detailData.alternativeDescription,
routTemplateId: this.detailData.routTemplateId,
planDate: this.detailData.planDate,
fixedLeadTimeDay: this.detailData.fixedLeadTimeDay,
fixedLeadTimeHour: this.detailData.fixedLeadTimeHour,
variableLeadTimeDay: this.detailData.variableLeadTimeDay,
variableLeadTimeHour: this.detailData.variableLeadTimeHour,
forStdLotByDay: this.detailData.forStdLotByDay,
forLotByDay: this.detailData.forLotByDay,
minLotQty: this.detailData.minLotQty,
detailNoteText: this.detailData.detailNoteText,
status: this.detailData.status,
updateBy: this.$store.state.user.name,
}
// 查询routing主信息
queryRoutingHeader(this.modalData).then(({data}) => {
if (data && data.code === 0) {
if (data.rows.length > 0) {
this.saveDetailModalFlag = true
this.saveDetailModalDisable = true
} else {
this.$message.warning('请先保存Routing主记录!')
}
} else {
this.$alert(data.msg, '提示', {
confirmButtonText: '确定'
})
}
})
},
/**
* 新增子明细模态框
*/
saveComponentModal () {
if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
this.$message.warning('请先选择替代!')
return
}
if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') {
this.$message.warning('不可编辑的替代状态!')
return
}
this.componentData = {
flag: '1',
site: this.$store.state.user.site,
partNo: this.modalData.partNo,
routingRevision: this.modalData.routingRevision,
routingType: this.modalData.routingType,
alternativeNo: this.detailData.alternativeNo,
operationId: '',
operationNo: '',
operationName: '',
efficiencyFactor: 100,
machRunFactor: '',
machSetupTime: '',
runTimeCode: '',
laborRunFactor: 100,
laborSetupTime: '',
crewSize: 1,
setupCrewSize: 1,
outsideOpItem: '',
machineNo: '',
workCenterNo: '',
workCenterDesc: '',
laborClassNo: '',
laborClassDesc: '',
setupLaborClassNo: '',
setupLaborClassDesc: '',
overlap: '',
noteText: '',
createBy: this.$store.state.user.name,
}
this.componentDisableFlag = false
this.componentSaveModal = true
},
/**
* 编辑模态框
*/
updateComponentModal (row) {
if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') {
this.$message.warning('不可编辑的替代状态!')
return
}
this.componentData = {
flag: '2',
site: row.site,
partNo: row.partNo,
routingRevision: row.routingRevision,
routingType: row.routingType,
alternativeNo: row.alternativeNo,
operationId: row.operationId,
operationNo: row.operationNo,
operationName: row.operationName,
efficiencyFactor: row.efficiencyFactor,
machRunFactor: row.machRunFactor,
machSetupTime: row.machSetupTime,
runTimeCode: row.runTimeCode,
laborRunFactor: row.laborRunFactor,
laborSetupTime: row.laborSetupTime,
crewSize: row.crewSize,
setupCrewSize: row.setupCrewSize,
outsideOpItem: row.outsideOpItem,
machineNo: row.machineNo,
workCenterNo: row.workCenterNo,
workCenterDesc: row.workCenterDesc,
laborClassNo: row.laborClassNo,
laborClassDesc: row.laborClassDesc,
setupLaborClassNo: row.setupLaborClassNo,
setupLaborClassDesc: row.setupLaborClassDesc,
overlap: row.overlap,
noteText: row.noteText,
updateBy: this.$store.state.user.name,
}
this.componentDisableFlag = true
this.componentSaveModal = true
},
// ======== 新增/编辑/删除方法 ========
/**
* routing新增/编辑
*/
saveData () {
if (this.modalData.partNo === '' || this.modalData.partNo == null) {
this.$message.warning('请选择物料编码!')
return
}
if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
this.$message.warning('请选择物料名称!')
return
}
if (this.modalData.routingType === '' || this.modalData.routingType == null) {
this.$message.warning('请选择制造类型!')
return
}
if (this.modalData.phaseInDate === '' || this.modalData.phaseInDate == null) {
this.$message.warning('请选择开始时间!')
return
}
// if (this.modalData.phaseOutDate === '' || this.modalData.phaseOutDate == null) {
// this.$message.warning('请选择结束时间!')
// return
// }
if (this.modalData.routingRevision === '' || this.modalData.routingRevision == null) {
this.$message.warning('请填写Routing版本号!')
return
}
if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
this.$message.warning('请选择替代!')
return
}
if (this.detailData.status === '' || this.detailData.status == null) {
this.$message.warning('请选择替代状态!')
return
}
let tempData = {
site: this.$store.state.user.site,
partNo: this.modalData.partNo,
partDesc: this.modalData.partDesc,
routingRevision: this.modalData.routingRevision,
routingType: this.modalData.routingType,
noteText: this.modalData.noteText,
phaseInDate: this.modalData.phaseInDate,
phaseOutDate: this.modalData.phaseOutDate,
alternativeNo: this.detailData.alternativeNo,
alternativeDescription: this.detailData.alternativeDescription,
detailNoteText: this.detailData.detailNoteText,
status: this.detailData.status,
createBy: this.$store.state.user.name,
updateBy: this.$store.state.user.name,
informationList: this.subDetailList
}
if (this.modalData.flag === '1') {
this.saveAllLoading = true
routingManagementSave(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveAllLoading = false
})
} else {
this.saveAllLoading = true
routingManagementEdit(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveAllLoading = false
})
}
},
/**
* 新增编辑模态框关闭
*/
closeModal () {
let tempArr = []
tempArr.push(this.modalData)
if (this.modalData.flag === '1') {
this.$confirm(`是否不保存且删除该条Routing记录?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let tempData = {
informationList: tempArr
}
routingManagementDelete(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.modalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
} else {
this.modalFlag = false
}
},
/**
* 新增编辑模态框关闭
*/
closeModalX (done) {
let tempArr = []
tempArr.push(this.modalData)
if (this.modalData.flag === '1') {
this.$confirm(`是否不保存且删除该条Routing记录?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let tempData = {
informationList: tempArr
}
routingManagementDelete(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
done()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
} else {
done()
}
},
/**
* routing删除
*/
delModal () {
if(this.routingSelections.length === 0){
this.$message.warning('请勾选要删除的Routing!')
return
}
this.$confirm(`是否删除这 `+ this.routingSelections.length +` 条Routing?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let tempData = {
informationList: this.routingSelections
}
routingManagementDelete(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
this.routingSelections = []
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
/**
* 查询物料
*/
queryPartList () {
queryPartList(this.partData).then(({data}) => {
if (data && data.code === 0) {
this.partList = data.rows
this.partModelFlag = true
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
/**
* 双击选中物料
* @param row
*/
getRowData (row) {
this.modalData.partNo = row.partNo
this.modalData.partDesc = row.partDesc
this.partModelFlag = false
},
getComponentRowData (row) {
this.componentData.operationId = row.operationId
this.componentData.operationName = row.operationName
this.componentPartModelFlag = false
},
/**
* 工序列表
*/
queryOperationList () {
// 查询所有工序
queryOperationList(this.operationData).then(({data}) => {
if (data && data.code === 0) {
this.operationList = data.rows
this.componentPartModelFlag = true
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
/**
* 表格的新增
* @param row
* @param rowIndex
*/
rowClassName({ row, rowIndex }) {
row.xh = rowIndex + 1;
},
/**
* 单选框选中数据
* @param selection
*/
componentSelectionChange(selection) {
this.checkedDetail = selection
},
/**
* 删除子物料
*/
deleteComponentPart () {
if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') {
this.$message.warning('不可编辑的替代状态!')
return
}
if (this.checkedDetail.length === 0) {
this.$message.warning('请选择要删除子物料!')
return
} else {
this.$confirm("请是否确认删除该子明细记录?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
let tempData = {
informationList: this.checkedDetail
}
deleteRoutingComponent(tempData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
}
},
/**
* 子物料
* @param row
*/
// componentPartClickRow (row) {
// this.$refs.componentPartTable.toggleRowSelection(row)
// },
componentClickRow (row) {
this.$refs.componentTable.toggleRowSelection(row)
},
// /**
// * 多选子物料
// * @param val
// */
// selectionComponentPart (val) {
// this.componentPartSelections = val
// },
// getRowKeys(row) {
// // 唯一值,一般都为id
// return row.partNo
// },
/**
* 新增子明细方法
*/
componentDataSave () {
if (this.componentData.partNo === '' || this.componentData.partNo == null) {
this.$message.warning('请选择主记录物料编码!')
return
}
if (this.componentData.routingType === '' || this.componentData.routingType == null) {
this.$message.warning('请选择主记录工艺类型!')
return
}
if (this.componentData.routingRevision === '' || this.componentData.routingRevision == null) {
this.$message.warning('请填写主记录Routing版本号!')
return
}
if (this.componentData.operationNo === '' || this.componentData.operationNo == null) {
this.$message.warning('请填写工序编码!')
return
}
if (this.componentData.operationName === '' || this.componentData.operationName == null) {
this.$message.warning('请选择工序名称!')
return
}
if (this.componentData.flag === '1') {
this.saveComponentLoading = true
saveRoutingComponent(this.componentData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows
this.componentSaveModal = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveComponentLoading = false
})
} else if (this.componentData.flag === '2') {
this.saveComponentLoading = true
updateRoutingComponent(this.componentData).then(({data}) => {
if (data && data.code === 0) {
this.subDetailList = data.rows
this.componentSaveModal = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveComponentLoading = false
})
}
},
/**
* 回车事件
*/
focusNextInput (index, type) {
let aaa = ''
if (this.subDetailList.length - 1 === index) {
aaa = `${type}0`
} else {
aaa = `${type}${index + 1}`
}
this.$nextTick(() => {
this.$refs[aaa].focus()
})
},
/**
* 保存主表信息
*/
saveRoutingHeader () {
if (this.modalData.partNo === '' || this.modalData.partNo == null) {
this.$message.warning('请先选择Routing物料!')
return
}
if (this.modalData.routingRevision === '' || this.modalData.routingRevision == null) {
this.$message.warning('请先填写Routing版本号!')
return
}
if (this.modalData.routingType === '' || this.modalData.routingType == null) {
this.$message.warning('请先选择制造类型!')
return
}
this.saveHeaderLoading = true
// 新增主表信息
saveRoutingHeader(this.modalData).then(({data}) => {
if (data && data.code === 0) {
this.modalData = {
flag: '1',
title: 'routing新增',
site: data.rows.modalData.site,
partNo: data.rows.modalData.partNo,
partDesc: data.rows.modalData.partDesc,
routingRevision: data.rows.modalData.routingRevision,
routingType: data.rows.modalData.routingType,
noteText: data.rows.modalData.noteText,
phaseInDate: data.rows.modalData.phaseInDate,
phaseOutDate: data.rows.modalData.phaseOutDate,
engRevision: data.rows.modalData.engRevision,
typeFlag: data.rows.modalData.typeFlag,
netWeight: data.rows.modalData.netWeight,
}
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = []
this.modalDisableFlag = true
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveHeaderLoading = false
})
},
/**
* 新增替代方法
*/
detailDataSave () {
if (this.saveDetailData.partNo === '' || this.saveDetailData.partNo == null) {
this.$message.warning('请先选择Routing物料!')
return
}
if (this.saveDetailData.routingRevision === '' || this.saveDetailData.routingRevision == null) {
this.$message.warning('请先填写Routing版本号!')
return
}
if (this.saveDetailData.routingType === '' || this.saveDetailData.routingType == null) {
this.$message.warning('请先选择工艺类型!')
return
}
if (this.saveDetailData.alternativeNo === '' || this.saveDetailData.alternativeNo == null) {
this.$message.warning('请填写替代编码!')
return
}
if (this.saveDetailData.alternativeDescription === '' || this.saveDetailData.alternativeDescription == null) {
this.$message.warning('请填写替代名称!')
return
}
if (this.saveDetailData.status === '' || this.saveDetailData.status == null) {
this.$message.warning('请选择替代状态!')
return
}
this.saveDetailLoading = true
if (this.saveDetailData.flag === '1') {
routingDetailSave(this.saveDetailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows
this.detailData = this.saveDetailData
this.subDetailList = []
this.saveDetailModalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveDetailLoading = false
})
} else {
routingDetailUpdate(this.saveDetailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = data.rows.subDetailList
this.saveDetailModalFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.saveDetailLoading = false
})
}
},
/**
* 删除替代
*/
deleteRoutingDetail () {
if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
this.$message.warning('请选择要删除的替代编码!')
return
}
if (this.detailData.alternativeNo === '*') {
this.$message.warning('当前为默认替代,不可以删除!')
return
}
this.$confirm(`是否删除这项替代?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
routingDetailDelete(this.detailData).then(({data}) => {
if (data && data.code === 0) {
this.detailData = data.rows.detailData
this.detailDataList = data.rows.detailDataList
this.subDetailList = data.rows.subDetailList
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
/**
* 修改替代状态为 Buildable
*/
updateStatusToBuildable () {
this.$confirm(`是否修改状态为Buildable?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateAlternativeStatus(this.detailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = data.rows.subDetailList
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
// 刷新替代和子明细
this.alternativeChange()
}
})
}).catch(() => {
})
},
/**
* 修改替代状态为 Obsolete
*/
updateStatusToObsolete () {
this.$confirm(`是否修改状态为Obsolete?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateAlternativeStatus(this.detailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = data.rows.subDetailList
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
// 刷新替代和子明细
this.alternativeChange()
}
})
}).catch(() => {
})
},
/**
* 替代改变事件
*/
alternativeChange () {
queryRoutingComponent(this.detailData).then(({data}) => {
if (data && data.code === 0) {
this.detailDataList = data.rows.detailDataList
this.detailData = data.rows.detailData
this.subDetailList = data.rows.subDetailList
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// ======= 正则校验 =======
handleInput (value, type) {
// 大于等于0,且只能输入4位小数
let val = value.replace(/^\D*([0-9]\d*\.?\d{0,4})?.*$/,'$1')
if (val == null || val == undefined || val == '') {
val = 0
}
if (type === 1) {
this.modalData.machRunFactor = val
} else if (type === 2) {
this.detailData.machSetupTime = val
} else if (type === 3) {
this.saveDetailData.setupCrewSize = val
} else if (type === 4) {
this.componentData.crewSize = val
} else if (type === 5) {
this.componentData.laborSetupTime = val
}
},
handleInputB (value, type) {
const reg = /^(([1-9]?\d{0,1}(\.\d{1,2})?)|100|100\.(0){1,2})$/
if (type === 1) {
if (reg.test(value) === true) {
this.componentData.efficiencyFactor = value
} else if (value > 100) {
this.componentData.efficiencyFactor = 100
} else {
this.componentData.efficiencyFactor = 0
}
} else if (type === 2) {
if (reg.test(value) === true) {
this.componentData.laborRunFactor = value
} else if (value > 100) {
this.componentData.laborRunFactor = 100
} else {
this.componentData.laborRunFactor = 0
}
}
},
// ======== chooseList相关方法 ========
/**
* 获取基础数据列表S
* @param val
* @param type
*/
getBaseList (val, type) {
this.tagNo = val
this.tagNo1 = type
this.$nextTick(() => {
let strVal = ''
if (val === 118) {
if(type === 1) {
strVal = this.componentData.laborClassNo
} else if (type === 2) {
strVal = this.componentData.setupLaborClassNo
}
}
if (val === 119) {
strVal = this.componentData.workCenterNo
}
this.$refs.baseList.init(val, strVal)
})
},
/**
* 列表方法的回调
* @param val
*/
getBaseData (val) {
if (this.tagNo === 118) {
if (this.tagNo1 === 1) {
this.componentData.laborClassNo = val.level_id
this.componentData.laborClassDesc = val.level_desc
} else if (this.tagNo1 === 2) {
this.componentData.setupLaborClassNo = val.level_id
this.componentData.setupLaborClassDesc = val.level_desc
}
}
if (this.tagNo === 119) {
this.componentData.workCenterNo = val.work_center_no
this.componentData.workCenterDesc = val.work_center_desc
}
},
// ======== 导出相关方法 ========
/**
* 导出excel
*/
async createExportData () {
this.searchData.limit = -1
this.searchData.page = 1
await routingManagementSearch(this.searchData).then(({data}) => {
this.resultList = data.page.list
})
return this.resultList
},
startDownload () {
},
finishDownload () {
},
fields () {
let json = '{'
this.columnList.forEach((item, index) => {
if (index == this.columnList.length - 1) {
json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
} else {
json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
}
})
json += '}'
let s = eval('(' + json + ')')
return s
}
}
}
</script>
<style scoped lang="scss">
/deep/ .detail-tab .el-tabs__content {
height: 165px;
padding: 15px 0px 0px 0px;
}
/deep/ .sub_detail-tab .el-tabs__content {
height: 280px;
padding: 0px;
}
.numInput /deep/ .el-input__inner{
text-align: right;
}
</style>