<template>
|
<div style="height: 100%">
|
<div class="page-header">
|
<div class="header-left">
|
<a @click="$router.go(-1)"><i class="icon-btn-back"></i></a>
|
<h2 v-if="editable">编辑-工艺路线</h2>
|
<h2 v-if="!editable">查看-工艺路线</h2>
|
</div>
|
<div class="btn-group header-right" v-if="editable">
|
<el-button :disabled="isSubmit" v-thinclick="`allSave`">保存</el-button>
|
</div>
|
</div>
|
<div class="page-main">
|
<div class="routing-basic">
|
<el-form
|
:inline="true"
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
style="width: 100%"
|
class="l-mes"
|
:disabled="!editable"
|
>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item prop="routingNo" label="工艺编号">
|
<el-input
|
v-model="dataForm.routingNo"
|
placeholder="工艺编号"
|
disabled
|
></el-input>
|
</el-form-item>
|
<el-form-item prop="partNo" label="零件号">
|
<el-input
|
v-model="dataForm.partNo"
|
placeholder="零件号"
|
disabled
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openSelectPart"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
<el-form-item prop="partName" label="零件名称">
|
<el-input
|
v-model="dataForm.partName"
|
placeholder="零件名称"
|
readonly
|
style="width: 300px"
|
></el-input>
|
</el-form-item>
|
<el-form-item prop="description" label="描述">
|
<el-input
|
v-model="dataForm.description"
|
placeholder="描述"
|
style="width: 280px"
|
></el-input>
|
</el-form-item>
|
<!-- <el-form-item prop="wireCore" label="线芯">
|
<el-input
|
v-model="dataForm.wireCore"
|
placeholder="线芯"
|
style="width: 60px"
|
></el-input>
|
</el-form-item> -->
|
<el-form-item label="BOM" prop="bomId">
|
<el-select v-model="dataForm.bomId" placeholder="" filterable>
|
<el-option
|
v-for="item in bomList"
|
:key="item.id"
|
:label="item.number"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item prop="version" label="工艺版本">
|
<el-input
|
v-model="dataForm.version"
|
placeholder="工艺版本"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="工艺类型" prop="bomTypeDb">
|
<el-select
|
v-model="dataForm.bomTypeDb"
|
placeholder="请选择工艺类型"
|
style="width:100%"
|
@change="bomTypeDbChange"
|
>
|
<el-option
|
v-for="(item, index) in bomTypeDbOptions"
|
:label="item.label"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<!-- <el-form-item label="逐步采用日期" prop="phaseInDate">
|
<el-date-picker
|
v-model="dataForm.phaseInDate"
|
style="width: 100%"
|
type="datetime"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
>
|
</el-date-picker>
|
</el-form-item>
|
<el-form-item label="逐步淘汰日期" prop="phaseOutDate">
|
<el-date-picker
|
v-model="dataForm.phaseOutDate"
|
style="width: 100%"
|
type="datetime"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
>
|
</el-date-picker>
|
</el-form-item> -->
|
<!-- <el-form-item prop="alternativeNo" label="替代">
|
<el-input
|
v-model="dataForm.alternativeNo"
|
placeholder="替代"
|
></el-input>
|
</el-form-item>
|
<el-form-item prop="alternativeDesc" label="替代描述">
|
<el-input
|
v-model="dataForm.alternativeDesc"
|
placeholder="替代描述"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="已同步至IFS" prop="ifsSync">
|
<span
|
style="width: 146px;display: inline-block;font-size:12px;font-weight:bold;"
|
>{{ dataForm.ifsSync ? '是' : '否' }}</span
|
>
|
</el-form-item>
|
<el-form-item label="主工艺" prop="master">
|
<el-switch v-model="dataForm.master"> </el-switch>
|
</el-form-item> -->
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
|
<div class="routing-detail">
|
<div class="operation-list">
|
<div slot="header">
|
<span>
|
工序
|
<i
|
class="el-icon-sort"
|
@click="showTable = !showTable"
|
style="cursor: pointer;"
|
></i>
|
</span>
|
<el-button
|
style="float: right; padding: 3px 0"
|
type="text"
|
@click=";(showOperation = true), (last = true)"
|
v-if="editable"
|
>添加</el-button
|
>
|
</div>
|
<div
|
v-show="!showTable"
|
class="dragWrap"
|
:style="{
|
'--dragitemwidth': '250px'
|
}"
|
>
|
<div
|
:style="{
|
width: 265 * dataForm.operations.length - 15 + 'px'
|
}"
|
>
|
<div
|
class="dragHead"
|
v-for="x in dataForm.operations.length"
|
:key="x"
|
>
|
<div class="idx">{{ x }}</div>
|
</div>
|
<zttdraggable
|
:forceFallback="true"
|
:list="dataForm.operations"
|
:animation="200"
|
fallbackClass="fallbackStyle"
|
ghostClass="item_ghost"
|
@end="dragEnd"
|
>
|
<div
|
:class="{ dragItem: true, active: x.active }"
|
v-for="(x, i) in dataForm.operations"
|
:key="i"
|
@click="
|
rowClick(x)
|
rowSelected(x)
|
"
|
>
|
<div class="dragBody">
|
<div class="info">{{ x.operationNo }}</div>
|
<div class="info">{{ x.operationName }}</div>
|
<div class="info">{{ x.partName }}</div>
|
</div>
|
<div class="dragFoot">
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="openTechnologyOperation(x)"
|
>编辑
|
</el-button>
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="insertTechnologyOperation(x)"
|
>插入
|
</el-button>
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="handleDelete(x)"
|
>
|
删除
|
</el-button>
|
</div>
|
</div>
|
</zttdraggable>
|
</div>
|
</div>
|
|
<el-table
|
v-show="showTable"
|
id="routingOpTable"
|
ref="operationTable"
|
:default-sort="{ prop: 'index' }"
|
row-key="id"
|
highlight-current-row
|
:data="dataForm.operations"
|
@current-change="rowSelected"
|
@row-click="rowClick"
|
height="350"
|
style="width: 100%"
|
class="routing-operate-table"
|
:row-class-name="tableRowClassName"
|
>
|
<!-- <el-table-column width="15" align="center">
|
<template slot-scope="scope">
|
<i class="icon aufontAll h-icon-all-drag"></i>
|
</template>
|
</el-table-column> -->
|
<el-table-column
|
prop="index"
|
label="序号"
|
width="45"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="operationNo"
|
label="工序编号"
|
width="80"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="operationName"
|
label="工序名"
|
width="120"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-link
|
v-if="editable"
|
type="primary"
|
@click.stop="openTechnologyOperation(scope.row)"
|
>{{ scope.row.operationName }}</el-link
|
>
|
<span v-if="!editable">{{ scope.row.operationName }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="outsideOpItem"
|
label="外部工序项目"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column
|
prop="partName"
|
label="零件"
|
align="center"
|
width="120"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column prop="workCenter" label="工作中心" align="center">
|
<template slot-scope="scope">
|
<span>{{
|
workCenterOptions.find((item) => {
|
return scope.row.workCenter === item.value
|
})
|
? '[' +
|
workCenterOptions.find((item) => {
|
return scope.row.workCenter === item.value
|
}).value +
|
'] ' +
|
workCenterOptions.find((item) => {
|
return scope.row.workCenter === item.value
|
}).label
|
: ''
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="runTimeCodeDb"
|
label="因素单位"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<span>{{
|
runTimeCodeDbOptions.find((item) => {
|
return scope.row.runTimeCodeDb === item.value
|
})
|
? runTimeCodeDbOptions.find((item) => {
|
return scope.row.runTimeCodeDb === item.value
|
}).label
|
: ''
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="machRunFactor"
|
label="机器运转因素"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="machSetupTime"
|
label="机器设置时间"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="laborRunFactor"
|
label="劳力运转因素"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="laborSetupTime"
|
label="劳力设置时间"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="laborClassNo"
|
label="人工类别"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<span>{{
|
laborClassNoOptions.find((item) => {
|
return scope.row.laborClassNo === item.value
|
})
|
? '[' +
|
laborClassNoOptions.find((item) => {
|
return scope.row.laborClassNo === item.value
|
}).value +
|
'] ' +
|
laborClassNoOptions.find((item) => {
|
return scope.row.laborClassNo === item.value
|
}).label
|
: ''
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="crewSize"
|
label="班组人员"
|
align="center"
|
width="70"
|
>
|
</el-table-column>
|
<el-table-column
|
v-if="editable"
|
label="操作"
|
align="center"
|
width="135"
|
>
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="openTechnologyOperation(scope.row)"
|
>编辑
|
</el-button>
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="insertTechnologyOperation(scope.row)"
|
>插入
|
</el-button>
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="handleDelete(scope.row)"
|
>删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<div class="config-param">
|
<el-tabs type="card" style="width: 100%;height: 100%">
|
<el-tab-pane label="工序配置" style="height: 100%">
|
<el-divider content-position="left">零件</el-divider>
|
<div class="node-content-part">
|
<el-input
|
v-model="operationPart.partName"
|
placeholder="零件"
|
readonly
|
style="width:30%;"
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openSelectOperationPart"
|
></el-button>
|
</el-input>
|
</div>
|
|
<el-divider content-position="left">配置项</el-divider>
|
|
<div class="node-content-config">
|
<el-checkbox-group
|
v-model="checkboxGroup"
|
@change="checkboxGroupChange()"
|
:disabled="!editable"
|
>
|
<el-checkbox-button
|
label="productionCounting"
|
key="productionCounting"
|
>报工</el-checkbox-button
|
>
|
<el-checkbox-button label="daq" key="daq"
|
>采集</el-checkbox-button
|
>
|
<el-checkbox-button label="inspection" key="inspection"
|
>检验</el-checkbox-button
|
>
|
<el-checkbox-button
|
label="autoInspection"
|
key="autoInspection"
|
>自动报检</el-checkbox-button
|
>
|
<el-checkbox-button label="semiFinished" key="semiFinished"
|
>半成品</el-checkbox-button
|
>
|
<el-checkbox-button label="materialCost" key="materialCost"
|
>投料</el-checkbox-button
|
>
|
<el-checkbox-button label="reserved" key="reserved"
|
>工单预留</el-checkbox-button
|
>
|
</el-checkbox-group>
|
</div>
|
|
<el-divider content-position="left">能力</el-divider>
|
<div class="node-content">
|
<label
|
v-if="capacities == null || capacities.length == 0"
|
class="empty-text"
|
>
|
没有配置能力
|
</label>
|
|
<el-tag
|
size="medium"
|
v-for="item in capacities"
|
:key="item.id"
|
:type="item.type"
|
:title="item.label"
|
type="warning"
|
style="margin-left: 5px"
|
effect="dark"
|
>
|
{{ item.label }}
|
</el-tag>
|
</div>
|
<el-divider content-position="left">备注</el-divider>
|
<div class="node-content-remark">
|
<rich-text
|
:richContent="operationPart.remark"
|
@contentChange="setOperateRemark"
|
></rich-text>
|
</div>
|
</el-tab-pane>
|
<el-tab-pane v-if="dataForm.id!=null" label="工序参数" style="height: 100%;">
|
<el-row :gutter="10">
|
<el-col :span="9">
|
<el-card class="params-template">
|
<div slot="header">
|
<span>参数集</span>
|
<el-button
|
style="float: right; padding: 3px 0"
|
type="text"
|
size="medium"
|
v-if="editable && dataForm.operations.length > 0"
|
@click="openTempalteDialog"
|
>添加
|
</el-button>
|
</div>
|
<el-table
|
ref="templateTable"
|
:data="operationTemplateList"
|
class="l-mes"
|
height="600"
|
highlight-current-row
|
@row-click="templateRowClick"
|
>
|
<el-table-column
|
label="名称"
|
prop="operationTemplateName"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column
|
label="类型"
|
prop="operationTemplateType"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column label="操作" align="center">
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="mini"
|
v-if="editable && dataForm.operations.length > 0"
|
@click.stop="
|
handleTemplateDelete(scope.row, scope.$index)
|
"
|
>删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-card>
|
</el-col>
|
<el-col :span="15">
|
<el-card class="template-param">
|
<div slot="header">
|
<span>参数</span>
|
<div style="float: right;">
|
<el-button
|
style="padding: 3px 0"
|
type="text"
|
size="medium"
|
v-if="editable && routingTemplateId != null"
|
@click="saveAllParamChange"
|
>保存
|
</el-button>
|
<el-button
|
style="padding: 3px 0"
|
type="text"
|
size="medium"
|
v-if="editable && routingTemplateId != null"
|
@click="openTempalteParamDialog"
|
>添加
|
</el-button>
|
</div>
|
</div>
|
<div>
|
<component
|
:is="paramMergeTemplate"
|
:key="isShowTree"
|
:tableTreeData="paramData"
|
:routingTemplateId="routingTemplateId"
|
:handleParamDelete="handleParamDelete"
|
></component>
|
</div>
|
</el-card>
|
</el-col>
|
</el-row>
|
</el-tab-pane>
|
</el-tabs>
|
</div>
|
</div>
|
</div>
|
|
<operationDialog
|
:currshowlist.sync="showOperation"
|
@listenToOperationEvent="insertOperation"
|
/>
|
<partDialog :currshowlist.sync="showPart" @listenToPartEvent="selectPart" />
|
<operationPartDialog
|
:currshowlist.sync="showOperationPart"
|
:paramObj="paramObj"
|
@listenToPartEvent="selectOperationPart"
|
/>
|
<ParamTemplateDialog
|
:currshowlist.sync="showOperationTemplate"
|
@handleSelectionParamTemplateChange="selectOperationTemplate"
|
:paramTemplateObj="templateDefaultObj"
|
:paramTemplateSelArr="paramTemplateSelArr"
|
:paramTemplateSelCol="paramTemplateSelCol"
|
/>
|
<ParamDialog
|
:currshowlist.sync="showTemplateParam"
|
@handleSelectionChange="selectTemplateParam"
|
:paramSelArr="paramSelArr"
|
:paramSelCol="paramSelCol"
|
/>
|
<editRoutingOperation
|
:currshowlist.sync="showTechnologyOperation"
|
:currRoutingOperation="currTechnologyOperation"
|
/>
|
</div>
|
</template>
|
|
<script>
|
import {
|
getObj,
|
addObj,
|
putObj,
|
putParam,
|
getRoutingTemplate,
|
getRoutingTemplateParam,
|
addRoutingTemplate,
|
deleteRoutingTemplate,
|
addRoutingTemplateParamLed,
|
deleteRoutingTemplateParam,
|
putRoutingTemplateParam
|
} from '@/api/technology/routing'
|
import { fetchList as getBomList } from '@/api/technology/completeproductstructure'
|
import { getByOperation } from '@/api/aps/capability'
|
import { fetchListByFather} from '@/api/basic/param'
|
import { remote } from '@/api/admin/dict'
|
import diagram from './diagram'
|
import operationDialog from '@/views/common/operation.vue'
|
import partDialog from '@/views/common/part.vue'
|
import operationPartDialog from '@/views/technology/routing/routing-part.vue'
|
import ParamTemplateDialog from '@/views/common/operationParamTemplate.vue'
|
import ParamDialog from '@/views/common/param.vue'
|
import RichText from '@/views/common/rich-text.vue'
|
import editRoutingOperation from './edit-routing-operation'
|
import ElRow from 'element-ui/packages/row/src/row'
|
import ElCol from 'element-ui/packages/col/src/col'
|
import { getOperationParam } from '../../../api/basic/template'
|
import paramMergeTemplate from '../../common/param-mergeTemplate.vue'
|
import zttdraggable from 'vuedraggable'
|
|
const capabilityArray = [
|
'daq',
|
'productionCounting',
|
'inspection',
|
'autoInspection',
|
'semiFinished',
|
'materialCost',
|
'reserved'
|
]
|
|
export default {
|
data() {
|
return {
|
paramMergeTemplate: '',
|
itemKey: '',
|
isShowTree: false,
|
typeOptions: [],
|
paramTemplateSelArr: [],
|
paramTemplateSelCol: 'operationTemplateNo',
|
templateDefaultObj: { dataType: '生产要求' },
|
paramSelArr: [],
|
paramSelCol: 'code',
|
operationIndex: null,
|
routingOperationId: null,
|
routingTemplateId: null,
|
paramData: [],
|
paramList: [],
|
operationTemplateList: [],
|
checkboxGroup: [],
|
operationPart: {},
|
capacities: [],
|
visible: false,
|
showOperation: false,
|
showPart: false,
|
showOperationPart: false,
|
last: true,
|
showOperationTemplate: false,
|
showTemplateParam: false,
|
dataForm: {
|
id: null,
|
routingNo: null,
|
name: null,
|
partId: null,
|
partName: null,
|
description: null,
|
state: null,
|
master: false,
|
bomId: null,
|
operations: [],
|
refs: [],
|
bomTypeDb: 'M',
|
alternativeNo: '*',
|
alternativeDesc: null,
|
ifsSync: false,
|
phaseInDate: null,
|
phaseOutDate: null,
|
version: null,
|
wireCore: null
|
},
|
dataRule: {
|
partName: [
|
{ required: true, message: '零件不能为空', trigger: 'change' }
|
],
|
bomTypeDb: [
|
{ required: true, message: '工艺类型不能为空', trigger: 'change' }
|
],
|
bomId: [{ required: true, message: 'BOM不能为空', trigger: 'change' }],
|
phaseInDate: [
|
{ required: true, message: '逐步采用日期不能为空', trigger: 'blur' }
|
],
|
alternativeNo: [
|
{ required: true, message: '替代不能为空', trigger: 'blur' }
|
],
|
version: [
|
{ required: true, message: '工艺版本不能为空', trigger: 'blur' }
|
]
|
},
|
bomList: [],
|
paramObj: {},
|
isSubmit: false,
|
showTechnologyOperation: false,
|
currTechnologyOperation: null,
|
bomTypeDbOptions: [],
|
workCenterOptions: [],
|
runTimeCodeDbOptions: [],
|
laborClassNoOptions: [],
|
showTable: false
|
}
|
},
|
components: {
|
ElCol,
|
ElRow,
|
diagram,
|
operationDialog,
|
partDialog,
|
ParamTemplateDialog,
|
ParamDialog,
|
operationPartDialog,
|
RichText,
|
editRoutingOperation,
|
zttdraggable,
|
paramMergeTemplate
|
},
|
mounted() {
|
window.addEventListener(
|
'hashchange',
|
() => {
|
const currentPath = window.location.hash.slice(1)
|
if (this.$route.path !== currentPath) {
|
this.$router.push(currentPath)
|
}
|
},
|
false
|
)
|
|
// this.rowDrop()
|
},
|
|
computed: {
|
editable: function() {
|
if (!this.dataForm.id) {
|
return true
|
}
|
if (this.dataForm.id && this.dataForm.state == '01draft') {
|
return true
|
}
|
return false
|
}
|
},
|
watch: {
|
'dataForm.partId'(newValue, oldValue) {
|
if (oldValue) {
|
this.dataForm.bomId = null
|
}
|
if (newValue) {
|
getBomList(
|
Object.assign({
|
current: 1,
|
size: 999,
|
partId: this.dataForm.partId,
|
bomTypeDb: this.dataForm.bomTypeDb
|
})
|
).then((response) => {
|
this.bomList = response.data.data.records
|
})
|
} else {
|
this.bomList = []
|
}
|
},
|
'dataForm.bomTypeDb'(newValue, oldValue) {
|
if (newValue) {
|
if (this.dataForm.partId) {
|
getBomList(
|
Object.assign({
|
current: 1,
|
size: 999,
|
partId: this.dataForm.partId,
|
bomTypeDb: this.dataForm.bomTypeDb
|
})
|
).then((response) => {
|
this.bomList = response.data.data.records
|
})
|
} else {
|
this.bomList = []
|
}
|
} else {
|
this.bomList = []
|
}
|
}
|
},
|
|
created() {
|
this.dataForm.id = this.$route.query.id
|
this.getParamType()
|
this.init()
|
this.itemKey = Math.random()
|
this.getBomTypeDbOptions()
|
this.getWorkCenterOptions()
|
this.getRunTimeCodeDbOptions()
|
this.getLaborClassNo()
|
},
|
|
methods: {
|
// 查询结构类型字典
|
getBomTypeDbOptions() {
|
remote('bom_type_db').then((response) => {
|
if (response.data.code === 0) {
|
this.bomTypeDbOptions = response.data.data
|
} else {
|
this.bomTypeDbOptions = []
|
}
|
})
|
},
|
// 查询工作中心字典
|
getWorkCenterOptions() {
|
remote('work_center_type').then((response) => {
|
if (response.data.code === 0) {
|
this.workCenterOptions = response.data.data
|
} else {
|
this.workCenterOptions = []
|
}
|
})
|
},
|
// 查询因素单位字典
|
getRunTimeCodeDbOptions() {
|
remote('runtimecodedb_type').then((response) => {
|
if (response.data.code === 0) {
|
this.runTimeCodeDbOptions = response.data.data
|
} else {
|
this.runTimeCodeDbOptions = []
|
}
|
})
|
},
|
// 获取IFS人工类别的数据字典
|
getLaborClassNo() {
|
remote('labor_class_type').then((response) => {
|
if (response.data.code === 0) {
|
this.laborClassNoOptions = response.data.data
|
} else {
|
this.laborClassNoOptions = []
|
}
|
})
|
},
|
add() {
|
this.showOperation = true
|
this.last = true
|
},
|
allSave() {
|
if (this.dataForm.ifsSync) {
|
this.$confirm('该工艺路线已同步至IFS,是否确认修改保存?', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then((data) => {
|
this.save()
|
})
|
} else {
|
this.save()
|
}
|
},
|
save() {
|
return new Promise((resolve, reject) => {
|
this.isSubmit = true
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.dataForm.operations.length == 0) {
|
this.$message.error('请添加工序节点')
|
this.isSubmit = false
|
return
|
}
|
let operationsFlag = true
|
this.dataForm.operations.forEach((item) => {
|
if (item.partName == null || item.partName === '') {
|
operationsFlag = false
|
}
|
})
|
if (!operationsFlag) {
|
this.$message.error('每个工序都需添加对应零件')
|
this.isSubmit = false
|
return
|
}
|
if (this.dataForm.id) {
|
putObj(this.dataForm)
|
.then((response) => {
|
const data = response.data
|
if (data.code == 0) {
|
this.visible = false
|
this.setDataForm(data.data)
|
this.$message.success('修改成功')
|
this.$emit('refreshDataList')
|
resolve()
|
} else {
|
this.setDataForm(null)
|
this.$message.error('修改失败')
|
reject()
|
}
|
this.isSubmit = false
|
})
|
.catch((error) => {
|
this.isSubmit = false
|
console.log(error)
|
reject(error)
|
})
|
} else {
|
addObj(this.dataForm)
|
.then((response) => {
|
const data = response.data
|
if (data.code == 0) {
|
this.setDataForm(data.data)
|
this.$message.success('添加成功')
|
this.visible = false
|
this.$emit('refreshDataList')
|
resolve()
|
} else {
|
this.setDataForm(null)
|
this.$message.error('添加失败')
|
reject()
|
}
|
this.isSubmit = false
|
})
|
.catch((error) => {
|
this.isSubmit = false
|
console.log(error)
|
reject(error)
|
})
|
}
|
} else {
|
this.isSubmit = false
|
}
|
})
|
})
|
},
|
// 对dataForm进行赋值
|
setDataForm(data) {
|
if (data != null) {
|
this.dataForm.id = data.id
|
this.dataForm.routingNo = data.routingNo
|
this.dataForm.name = data.name
|
this.dataForm.partId = data.partId
|
this.dataForm.partName = data.partName
|
this.dataForm.description = data.description
|
this.dataForm.state = data.state
|
this.dataForm.master = data.master
|
this.dataForm.bomTypeDb = data.bomTypeDb
|
this.dataForm.alternativeNo = data.alternativeNo
|
this.dataForm.alternativeDesc = data.alternativeDesc
|
this.dataForm.ifsSync = data.ifsSync
|
this.dataForm.phaseInDate = data.phaseInDate
|
this.dataForm.phaseOutDate = data.phaseOutDate
|
this.dataForm.version = data.version
|
this.dataForm.wireCore = data.wireCore
|
this.dataForm.operations = data.operations
|
// this.dataForm.operations = data.operations
|
// this.$set(this.dataForm,'operations',data.operations)
|
|
this.dataForm.refs = data.refs
|
this.itemKey = Math.random()
|
} else {
|
this.dataForm.id = null
|
this.dataForm.routingNo = null
|
this.dataForm.name = null
|
this.dataForm.partId = null
|
this.dataForm.partName = null
|
this.dataForm.description = null
|
this.dataForm.state = null
|
this.dataForm.master = false
|
this.dataForm.bomTypeDb = 'M'
|
this.dataForm.alternativeNo = '*'
|
this.dataForm.alternativeDesc = null
|
this.dataForm.ifsSync = false
|
this.dataForm.phaseInDate = null
|
this.dataForm.phaseOutDate = null
|
this.dateForm.version = null
|
this.dataForm.wireCore = null
|
this.dataForm.operations = []
|
this.dataForm.refs = []
|
}
|
// this.$forceUpdate();
|
},
|
// 工序的点击事件
|
rowClick(row) {
|
// 获取参数集模板列表
|
this.dataForm.operations.forEach((e) => {
|
this.$set(e, 'active', false)
|
})
|
row.active = true
|
this.getRoutingTemplate(row.id)
|
},
|
// 根据工艺、工序id去获取参数集模板
|
getRoutingTemplate(opId) {
|
this.routingOperationId = opId
|
this.routingTemplateId = null
|
if (this.dataForm.id) {
|
getRoutingTemplate(
|
Object.assign({
|
routingOperationId: opId
|
})
|
).then((response) => {
|
if (response.data.data.length > 0) {
|
this.operationTemplateList = response.data.data
|
} else {
|
this.operationTemplateList = []
|
}
|
this.paramData = []
|
})
|
}
|
},
|
// 参数集模板点击事件
|
templateRowClick(row) {
|
|
if(this.isShowTree){
|
this.isShowTree=false
|
}else{
|
this.isShowTree=true
|
}
|
this.paramData=[]
|
this.getRoutingTemplateParam(row.id)
|
},
|
// 根据工艺、工序id、模板id去获取模板下的参数
|
getRoutingTemplateParam(tempId) {
|
this.routingTemplateId = tempId
|
getRoutingTemplateParam(
|
Object.assign({
|
routingOperationId: this.routingOperationId,
|
operationTemplateId: tempId
|
})
|
).then((response) => {
|
if (response.data.data.length > 0) {
|
this.paramData = []
|
this.paramData = response.data.data
|
this.paramMergeTemplate = 'paramMergeTemplate'
|
} else {
|
this.paramData = []
|
}
|
})
|
},
|
tableRowClassName({ row, rowIndex }) {
|
if (this.dataForm.state != null && this.dataForm.state === '02accepted') {
|
return 'filter'
|
} else {
|
return ''
|
}
|
},
|
dragEnd() {
|
console.log(this.dataForm.operations)
|
this.dataForm.operations.forEach((e, i) => {
|
e.index = i + 1
|
})
|
this.$forceUpdate()
|
this.$refs.operationTable.sort('index')
|
},
|
rowDrop() {
|
const that = this
|
const tbody = document.querySelector(
|
'#routingOpTable .el-table__body-wrapper tbody'
|
)
|
Sortable.create(tbody, {
|
filter: '.filter',
|
// 结束拖拽
|
onEnd({ newIndex, oldIndex }) {
|
if (newIndex > oldIndex) {
|
// 下移
|
that.dataForm.operations
|
.filter((e) => e.index == oldIndex + 1)
|
.forEach((e) => (e.index = 'x'))
|
that.dataForm.operations
|
.filter((e) => e.index > oldIndex + 1 && e.index <= newIndex + 1)
|
.forEach((e) => (e.index = e.index - 1))
|
that.dataForm.operations
|
.filter((e) => e.index == 'x')
|
.forEach((e) => (e.index = newIndex + 1))
|
} else if (oldIndex > newIndex) {
|
// 上移
|
that.dataForm.operations
|
.filter((e) => e.index == oldIndex + 1)
|
.forEach((e) => (e.index = 'x'))
|
that.dataForm.operations
|
.filter((e) => e.index < oldIndex + 1 && e.index >= newIndex + 1)
|
.forEach((e) => (e.index = e.index + 1))
|
that.dataForm.operations
|
.filter((e) => e.index == 'x')
|
.forEach((e) => (e.index = newIndex + 1))
|
}
|
}
|
})
|
},
|
|
init() {
|
if (this.dataForm.id) {
|
getObj(this.dataForm.id).then((response) => {
|
const resData = response.data.data
|
this.dataForm = resData
|
this.selectByIndex(1)
|
})
|
}
|
},
|
|
rowSelected(val) {
|
this.checkboxGroup = []
|
this.capacities = []
|
this.operationPart = {}
|
if (val != null) {
|
capabilityArray.forEach((e) => {
|
if (val[e]) {
|
this.checkboxGroup.push(e)
|
}
|
})
|
|
if (val.operationId) {
|
getByOperation(val.operationId).then((response) => {
|
this.capacities = response.data.data
|
})
|
}
|
this.operationPart = val
|
}
|
},
|
checkboxGroupChange() {
|
const row = this.$refs.operationTable.store.states.currentRow
|
capabilityArray.forEach((e) => {
|
row[e] = false
|
})
|
this.checkboxGroup.forEach((item) => {
|
row[item] = true
|
})
|
},
|
openSelectPart() {
|
this.showPart = true
|
},
|
openSelectOperationPart() {
|
this.showOperationPart = true
|
if (this.dataForm.bomId) {
|
this.paramObj = { bomId: this.dataForm.bomId }
|
} else {
|
this.paramObj = {}
|
}
|
},
|
selectPart(param) {
|
if (typeof param !== 'undefined') {
|
this.dataForm.partId = param.id
|
this.dataForm.partNo = param.partNo
|
this.dataForm.partName = param.partName
|
this.dataForm.version = param.engChgLevel
|
}
|
},
|
selectOperationPart(param) {
|
if (typeof param !== 'undefined') {
|
// this.operationPart.partId = param.id
|
// this.operationPart.partName = param.partName
|
// this.operationPart.isMaster = param.id == this.dataForm.partId
|
this.$set(this.operationPart, 'partId', param.id)
|
this.$set(this.operationPart, 'partName', param.partName)
|
this.$set(
|
this.operationPart,
|
'isMaster',
|
param.id == this.dataForm.partId
|
)
|
}
|
},
|
// 富文本备注改变,则进行赋值
|
setOperateRemark(val) {
|
this.operationPart.remark = val
|
},
|
insertTechnologyOperation(row) {
|
this.showOperation = true
|
this.last = false
|
this.operationIndex = row.index
|
},
|
async insertOperation(operation) {
|
if (this.dataForm.ifsSync) {
|
await this.$confirm('该工艺路线已同步至IFS,是否确认新增工序节点?', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
}
|
operation.operationName = operation.name
|
operation.operationId = operation.id
|
operation.id = null
|
if (this.last) {
|
// 行最后添加
|
operation.index = this.dataForm.operations.length + 1
|
this.dataForm.operations.push(operation)
|
} else {
|
// 插入前一行
|
operation.index = this.operationIndex
|
this.dataForm.operations = [
|
...this.dataForm.operations.slice(0, operation.index - 1),
|
operation,
|
...this.dataForm.operations.slice(operation.index - 1)
|
]
|
}
|
this.dataForm.operations.forEach((e, idx) => {
|
e.index = idx + 1
|
})
|
this.$forceUpdate()
|
this.$refs.operationTable.sort('index')
|
Promise.all([this.save()]).then((res) => {
|
this.selectByIndex(operation.index)
|
})
|
},
|
|
handleDelete(row) {
|
if (this.dataForm.operations.length == 1) {
|
this.$message.error('唯一一道工序,不可删除')
|
} else {
|
let remindInfo = ''
|
if (this.dataForm.ifsSync) {
|
remindInfo = '该工艺路线已同步至IFS,'
|
}
|
this.$confirm(
|
remindInfo + '是否确认删除工序编号为:' + row.operationNo,
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}
|
).then((data) => {
|
this.dataForm.operations.splice(
|
this.dataForm.operations.findIndex(
|
(item) => item.index === row.index
|
),
|
1
|
)
|
this.dataForm.operations
|
.filter((e) => e.index >= row.index)
|
.forEach((e) => (e.index = e.index - 1))
|
Promise.all([this.save()]).then((res) => {
|
this.selectByIndex(1)
|
})
|
})
|
}
|
},
|
|
selectByIndex(index) {
|
const row = this.dataForm.operations.filter((e) => e.index == index)
|
if (row && row.length > 0) {
|
this.$refs.operationTable.setCurrentRow(row[0])
|
this.getRoutingTemplate(row[0].id)
|
}
|
},
|
|
// 根据传参,选中某个模板,从0开始
|
selectTempalteByIndex(index) {
|
if (this.operationTemplateList && this.operationTemplateList.length > 0) {
|
this.$refs.templateTable.setCurrentRow(
|
this.operationTemplateList[index]
|
)
|
this.getRoutingTemplateParam(this.operationTemplateList[index].id)
|
}
|
},
|
|
// 打开参数集模板对话框
|
openTempalteDialog() {
|
// 筛选出当前页面已有的参数集模板
|
this.paramTemplateSelArr = []
|
/*
|
if(this.operationTemplateList.length>0){
|
this.operationTemplateList.forEach(ele => {
|
this.paramTemplateSelArr.push(ele.operationTemplateNo);
|
})
|
} */
|
this.showOperationTemplate = true
|
},
|
|
// 工序参数集模板的选中结果返回
|
selectOperationTemplate(param) {
|
if (param.length > 0) {
|
const templates = {
|
routingOperationId: this.routingOperationId,
|
routingOperationTemplateList: param
|
}
|
addRoutingTemplate(templates).then((response) => {
|
const data = response.data
|
if (data.code == 0) {
|
const newTempaltes = response.data.data
|
for (let i = 0; i < newTempaltes.length; i++) {
|
this.operationTemplateList.push(newTempaltes[i])
|
}
|
this.$message.success('添加成功')
|
// 选中最后一个模板
|
this.selectTempalteByIndex(this.operationTemplateList.length - 1)
|
this.getRoutingTemplate(this.routingOperationId)
|
} else {
|
this.$message.error('添加失败')
|
}
|
})
|
}
|
},
|
|
// 删除模板
|
handleTemplateDelete(row, index) {
|
this.$confirm(
|
'是否确认删除模板名称为' + row.operationTemplateName,
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}
|
)
|
.then(function() {
|
return deleteRoutingTemplate(row.id)
|
})
|
.then((response) => {
|
const data = response.data
|
if (data.code == 0) {
|
// 清空参数、删除当前行、清空选中、清空当前的routingTemplateId
|
this.operationTemplateList.splice(index, 1)
|
this.paramData = []
|
this.routingTemplateId = null
|
this.$refs.templateTable.setCurrentRow()
|
this.$message.success('删除成功')
|
} else {
|
this.$message.error('删除失败')
|
}
|
})
|
},
|
|
// 打开模板参数对话框
|
openTempalteParamDialog() {
|
if (this.routingTemplateId != null) {
|
// 筛选出当前页面已有的参数
|
this.paramSelArr = []
|
if (this.paramData.length > 0) {
|
this.paramData.forEach((ele) => {
|
this.paramSelArr.push(ele.code)
|
})
|
}
|
this.showTemplateParam = true
|
} else {
|
this.$message.error('请先选择参数集模板')
|
}
|
},
|
|
// 模板参数的选中结果返回
|
selectTemplateParam(param) {
|
// console.log(param);
|
// let idList=[]
|
// param.forEach(item=>{
|
// idList.push(item.id)
|
// })
|
// console.log(idList);
|
// let formData=new FormData()
|
// formData.append("idList",idList)
|
// fetchListByFather(formData).then((res) => {
|
// console.log(res);
|
// })
|
if (param.length > 0) {
|
const paramrrs = {
|
id: this.dataForm.id,
|
routingOperationId: this.routingOperationId,
|
operationTemplateId: this.routingTemplateId,
|
routingOperationParam: param
|
}
|
addRoutingTemplateParamLed(paramrrs).then((response) => {
|
const data = response.data
|
if (data.code == 0) {
|
const newParams = response.data.data
|
console.log(newParams);
|
this.$message.success('添加成功')
|
} else {
|
this.$message.error('添加失败')
|
}
|
this.templateRowClick({id: this.routingTemplateId})
|
})
|
}
|
},
|
|
// 删除参数
|
handleParamDelete(row, index) {
|
this.$confirm('是否确认删除参数项为【' + row.paramItem +'】的数据?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(function() {
|
let id = null
|
if(row.treeId && row.treeId!='null'){
|
id = row.treeId
|
}else{
|
if(row.twoId && row.twoId!='null'){
|
id = row.twoId
|
}else{
|
id = row.oneId
|
}
|
}
|
return deleteRoutingTemplateParam(id)
|
})
|
.then((response) => {
|
const data = response.data
|
if (data.code == 0) {
|
// 删除当前行
|
this.paramData.splice(index, 1)
|
this.$message.success('删除成功')
|
} else {
|
this.$message.error('删除失败')
|
}
|
})
|
},
|
|
// 保存单个参数的修改
|
saveParamChange(row) {
|
const paramJson = { routingOperationParam: [row] }
|
putRoutingTemplateParam(paramJson).then((response) => {
|
const data = response.data
|
if (data.code == 0) {
|
this.$message.success('保存成功')
|
} else {
|
this.$message.error('保存失败')
|
}
|
})
|
},
|
// 保存所有参数的修改
|
saveAllParamChange() {
|
let data = []
|
this.paramData.forEach(ele=>{
|
let o = {
|
id: null,
|
paramValue: ele.paramValue
|
}
|
if(ele.threeId && ele.threeId != 'null'){
|
o.id = ele.threeId
|
}else{
|
if(ele.twoId && ele.twoId != 'null'){
|
o.id = ele.twoId
|
}else{
|
o.id = ele.oneId
|
}
|
}
|
data.push(o)
|
})
|
const paramJson = { routingOperationParam: data }
|
putRoutingTemplateParam(paramJson).then((response) => {
|
const data = response.data
|
if (data.code == 0) {
|
this.$message.success('保存成功')
|
} else {
|
this.$message.error('保存失败')
|
}
|
})
|
},
|
// 获取工序参数类型
|
getParamType() {
|
remote('technology_param').then((response) => {
|
if (response.data.code === 0) {
|
this.typeOptions = response.data.data
|
} else {
|
this.typeOptions = []
|
}
|
})
|
},
|
// 表格字段格式化
|
getParam(row, column, cellValue) {
|
for (let i = 0, len = this.typeOptions.length; i < len; i++) {
|
if (cellValue == this.typeOptions[i].value) {
|
return this.typeOptions[i].label
|
}
|
}
|
},
|
openTechnologyOperation(row) {
|
if (row != null) {
|
this.currTechnologyOperation = row
|
this.showTechnologyOperation = true
|
}
|
},
|
bomTypeDbChange() {
|
this.dataForm.bomId = null
|
}
|
}
|
}
|
</script>
|
<style lang="scss" scoped>
|
.fallbackStyle {
|
opacity: 1 !important;
|
}
|
.item_ghost {
|
opacity: 0 !important;
|
}
|
.dragWrap {
|
overflow-x: auto;
|
padding: 10px;
|
margin: 0 -10px;
|
.dragHead {
|
display: inline-block;
|
width: var(--dragitemwidth);
|
+ .dragHead {
|
margin-left: 15px;
|
.idx::after {
|
content: '';
|
position: absolute;
|
top: 12px;
|
right: 25px;
|
height: 2px;
|
width: calc(var(--dragitemwidth) - 10px);
|
background: #288fe8;
|
}
|
}
|
.idx {
|
border-radius: 100%;
|
width: 25px;
|
height: 25px;
|
background: #288fe8;
|
color: white;
|
text-align: center;
|
margin: 0 auto 10px;
|
position: relative;
|
}
|
}
|
.dragItem {
|
display: inline-block;
|
width: var(--dragitemwidth);
|
background: white;
|
border-radius: 4px;
|
border: 1px solid #ebeef5;
|
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.1);
|
box-sizing: border-box;
|
+ .dragItem {
|
margin-left: 15px;
|
}
|
&.active {
|
box-shadow: 0 2px 10px 0 rgba(40, 143, 232, 0.3);
|
}
|
.dragBody {
|
cursor: grab;
|
&:active {
|
cursor: grabbing;
|
}
|
height: 100px;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
padding: 10px 5px;
|
justify-content: space-around;
|
.info {
|
font-size: 14px;
|
word-break: break-all;
|
}
|
}
|
.dragFoot {
|
height: 30px;
|
display: flex;
|
justify-content: space-around;
|
align-items: center;
|
border-top: 1px solid #eee;
|
}
|
}
|
}
|
</style>
|
<style>
|
.avue-main {
|
height: calc(100% - 60px);
|
}
|
.routing-detail {
|
width: 100%;
|
padding-top: 10px;
|
/*display: flex;
|
justify-content: flex-start;*/
|
box-sizing: border-box;
|
}
|
|
.operation-list {
|
background-color: #fff;
|
width: 100%;
|
min-height: 250px;
|
border: 1px solid #ddd;
|
padding: 10px 20px;
|
box-sizing: border-box;
|
}
|
|
.config-param {
|
background-color: #fff;
|
width: 100%;
|
height: 790px;
|
border: 1px solid #ddd;
|
padding: 2px 20px 10px;
|
margin-top: 10px;
|
box-sizing: border-box;
|
}
|
|
.params-template {
|
background-color: #fff;
|
height: 687px;
|
padding: 10px 0px;
|
border: 1px solid #ddd;
|
}
|
|
.template-param {
|
background-color: #fff;
|
height: 687px;
|
padding: 10px 0px;
|
border: 1px solid #ddd;
|
}
|
|
.template-param .el-input input {
|
text-align: center;
|
}
|
|
.node-content {
|
height: 100px;
|
padding: 5px 20px;
|
}
|
|
.node-content-part {
|
height: 50px;
|
padding: 5px 20px;
|
}
|
|
.node-content-config {
|
height: 50px;
|
padding: 5px 20px;
|
}
|
|
.node-content-remark {
|
height: 290px;
|
padding: 5px 20px;
|
}
|
|
.routing-basic {
|
background-color: #fff;
|
min-height: 130px;
|
display: flex;
|
padding: 20px 30px;
|
border: 1px solid #ddd;
|
box-sizing: border-box;
|
}
|
|
.routing-operate-table .el-table__body .el-table__row td:first-child .cell {
|
padding-left: 0px;
|
padding-right: 0px;
|
}
|
|
.routing-operate-table .el-table__body .el-table__row:hover {
|
/* cursor: move; */
|
}
|
|
.routing-operate-table .el-table__body .el-table__row:hover .icon {
|
display: block;
|
}
|
|
.routing-operate-table .el-table__body .el-table__row .icon {
|
color: rgba(0, 0, 0, 0.45);
|
font-size: 12px;
|
line-height: 18px;
|
float: right;
|
display: none;
|
}
|
|
.aufontAll {
|
font-family: aufontAll !important;
|
font-size: 16px;
|
font-style: normal;
|
-webkit-font-smoothing: antialiased;
|
-moz-osx-font-smoothing: grayscale;
|
}
|
|
.h-icon-all-drag {
|
background: url('/img/tz.png') center center no-repeat;
|
background-size: cover;
|
font-size: 14px;
|
}
|
.h-icon-all-drag:before {
|
content: '\E63E';
|
font-size: 14px;
|
visibility: hidden;
|
}
|
</style>
|