1029 lines
36 KiB
Vue
1029 lines
36 KiB
Vue
<!--
|
|
* @Descripttion: (/process_operation_workstation_mapping)
|
|
* @Author: (admin)
|
|
* @Date: (2025-11-22)
|
|
-->
|
|
<template>
|
|
<div>
|
|
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent>
|
|
|
|
<el-form-item label="工艺路线编码" prop="fkRoutingCode">
|
|
<el-input v-model="queryParams.fkRoutingCode" placeholder="请输入工艺路线编码" clearable />
|
|
</el-form-item>
|
|
<el-form-item label="工序编码" prop="fkOperationCode">
|
|
<el-input v-model="queryParams.fkOperationCode" placeholder="请输入工序编码" clearable />
|
|
</el-form-item>
|
|
<el-form-item label="产线" prop="fkProductlinebodyCode">
|
|
<el-input v-model="queryParams.fkProductlinebodyCode" placeholder="请输入产线" clearable />
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
|
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<!-- 工具区域 -->
|
|
<el-row :gutter="15" class="mb10">
|
|
<el-col :span="1.5">
|
|
<el-button type="primary" v-hasPermi="['business:processoperationworkstationmapping:add']" plain icon="plus"
|
|
@click="handleAdd">
|
|
{{ $t('btn.add') }}
|
|
</el-button>
|
|
</el-col>
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
</el-row>
|
|
<el-table :data="dataList" v-loading="loading" ref="table" border header-cell-class-name="el-table-header-cell"
|
|
highlight-current-row @sort-change="sortChange">
|
|
<el-table-column type="index" width="70" label="序号" align="center" />
|
|
<el-table-column prop="fkRoutingCode" label="工艺路线编码" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="fkOperationCode" label="工序编码" align="center" :show-overflow-tooltip="true"
|
|
v-if="columns.showColumn('fkOperationCode')" />
|
|
<el-table-column prop="fkProductlinebodyCode" label="产线" align="center" :show-overflow-tooltip="true"
|
|
v-if="columns.showColumn('fkProductlinebodyCode')" />
|
|
<el-table-column prop="fkWorkstationCode" label="工位" align="center" :show-overflow-tooltip="true"
|
|
v-if="columns.showColumn('fkWorkstationCode')" />
|
|
<el-table-column prop="isActive" label="是否有效" align="center" v-if="columns.showColumn('isActive')">
|
|
<template #default="scope">
|
|
<el-tag type="success" v-if="scope.row.isActive == 'True'">有效</el-tag>
|
|
<el-tag v-else type="info">无效</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="priority" label="优先级" align="center" v-if="columns.showColumn('priority')" />
|
|
<el-table-column prop="standardTime" label="标准加工时间" align="center" v-if="columns.showColumn('standardTime')" />
|
|
<el-table-column prop="setupTime" label="准备时间" align="center" v-if="columns.showColumn('setupTime')" />
|
|
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column label="操作" width="160">
|
|
<template #default="scope">
|
|
<el-button type="primary" size="small" icon="view" title="查看" @click="handleView(scope.row)"></el-button>
|
|
<el-button type="success" size="small" icon="edit" title="编辑"
|
|
v-hasPermi="['business:processoperationworkstationmapping:edit']"
|
|
@click="handleUpdate(scope.row)"></el-button>
|
|
<el-button type="danger" size="small" icon="delete" title="删除"
|
|
v-hasPermi="['business:processoperationworkstationmapping:delete']"
|
|
@click="handleDelete(scope.row)"></el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
|
@pagination="getList" />
|
|
|
|
|
|
<!-- 添加或修改对话框 -->
|
|
<el-dialog draggable :title="title" :lock-scroll="false" v-model="open" width="1000">
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
<el-row :gutter="20">
|
|
<el-col :lg="12">
|
|
<el-form-item label="工艺路线" prop="fkRoutingCode">
|
|
<el-select @change="handleRoutingCodeChange" v-model="form.fkRoutingCode" placeholder="请选择"
|
|
style="width: 100%">
|
|
<el-option v-for="item in processRouteSelect" :key="item.value" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :lg="12">
|
|
<el-form-item label="工序" prop="fkOperationCode">
|
|
<el-select v-model="form.fkOperationCode" placeholder="请选择" style="width: 100%">
|
|
<el-option v-for="item in processSelect" :key="item.value" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :lg="12">
|
|
<el-form-item label="工厂" prop="fkFactoryCode">
|
|
<el-select @change="factoryChange" v-model="form.fkFactoryCode" placeholder="请选择" style="width: 100%">
|
|
<el-option v-for="item in workstationSelect" :key="item.value" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :lg="12">
|
|
<el-form-item label="车间" prop="fkWorkshopcode">
|
|
<el-select @change="handleWorkshop" v-model="form.fkWorkshopcode" placeholder="请选择" style="width: 100%">
|
|
<el-option v-for="item in workshopSelect" :key="item.value" :label="item.label" :value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :lg="12">
|
|
<el-form-item label="产线" prop="fkProductlinebodyCode">
|
|
<el-select @change="handleProductlineChange" v-model="form.fkProductlinebodyCode" placeholder="请选择"
|
|
style="width: 100%">
|
|
<el-option v-for="item in productionLineSelect" :key="item.value" :label="item.label"
|
|
:value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :lg="12">
|
|
<el-form-item label="工位" prop="fkWorkstationCode">
|
|
<el-select v-model="form.fkWorkstationCode" placeholder="请选择" style="width: 100%">
|
|
<el-option v-for="item in workstationNameSelect" :key="item.value" :label="item.label"
|
|
:value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<!-- <el-col :lg="12">
|
|
<el-form-item label="工序编码" prop="fkOperationCode">
|
|
<el-input v-model="form.fkOperationCode" placeholder="请输入工序编码" />
|
|
</el-form-item>
|
|
</el-col> -->
|
|
<!-- <el-col :lg="12">
|
|
<el-form-item label="产线" prop="fkProductlinebodyCode">
|
|
<el-input v-model="form.fkProductlinebodyCode" placeholder="请输入产线" />
|
|
</el-form-item>
|
|
</el-col> -->
|
|
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="是否有效" prop="isActive">
|
|
<el-select v-model="form.isActive" placeholder="请选择">
|
|
<el-option v-for="item in options.isActiveOptions" :key="item.dictValue" :label="item.dictLabel"
|
|
:value="item.dictValue">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="优先级" prop="priority">
|
|
<el-input v-model.number="form.priority" placeholder="请输入优先级" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="标准加工时间" prop="standardTime">
|
|
<el-input-number v-model.number="form.standardTime" @change="handleStandardTimeChange" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="准备时间" prop="setupTime">
|
|
<el-input-number v-model="form.setupTime" :min="0" @change="handleChange" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="24">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
|
|
</el-row>
|
|
</el-form>
|
|
<template #footer v-if="opertype != 3">
|
|
<el-button text @click="cancel">{{ $t('btn.cancel') }}</el-button>
|
|
<el-button type="primary" @click="submitForm">{{ $t('btn.submit') }}</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
|
|
<el-drawer @close="cancelClick" :close-on-click-modal="false" size="1200" v-model="drawer" title="详情">
|
|
|
|
<el-form ref="form1Ref" inline :model="form1" label-width="110px">
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="工艺路线编号" prop="fkRoutingCode">
|
|
<el-input v-model="form1.fkRoutingCode" placeholder="请输入工艺路线编号" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="工序编码" prop="fkOperationCode">
|
|
<el-input v-model="form1.fkOperationCode" placeholder="请输入工序编码" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="产线" prop="fkProductlinebodyCode">
|
|
<el-input v-model="form1.fkProductlinebodyCode" placeholder="请输入产线" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="工位号" prop="fkWorkstationCode">
|
|
<el-input v-model="form1.fkWorkstationCode" placeholder="请输入工位号" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="PLC地址" prop="plcAddress">
|
|
<el-input v-model="form1.plcAddress" placeholder="请输入PLC地址" disabled />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
|
|
<div class="table-container" style="margin-top: 20px;">
|
|
<div class="table-header" style="display: flex; justify-content: space-between; align-items: center; ">
|
|
<h4>关联流程列表</h4>
|
|
<!-- <el-button type="primary" size="small" @click="addTableRow">新增</el-button> -->
|
|
</div>
|
|
<el-table :data="tableData" style="width: 100%" border>
|
|
<el-table-column label="序号" align="center" type="index" width="70">
|
|
</el-table-column>
|
|
<el-table-column prop="flowName" label="流程类型名称">
|
|
<template #default="scope">
|
|
<el-select @change="handleFlowName($event, scope.row)" v-model="scope.row.flowTypeName"
|
|
placeholder="请选择流程名称" disabled>
|
|
<el-option v-for="item in options.flowNameOptions" :key="item.value" :label="item.label"
|
|
:value="item.value"></el-option>
|
|
</el-select>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column prop="flowTypeCode" label="流程类型编码">
|
|
<!-- <template #default="scope">
|
|
<el-input v-model="scope.row.flowTypeCode" placeholder="请输入流程编码" disabled />
|
|
</template> -->
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="flowCode" label="流程码">
|
|
<!-- <template #default="scope">
|
|
<el-input @keyup.enter="handleInput(scope.row)" v-model="scope.row.flowCode" placeholder="请输入流程码"
|
|
disabled />
|
|
</template> -->
|
|
</el-table-column>
|
|
|
|
<!-- <el-table-column label="操作" width="120">
|
|
<template #default="scope">
|
|
<el-button type="danger" size="small" @click="deleteTableRow(scope.row)">删除</el-button>
|
|
</template>
|
|
</el-table-column> -->
|
|
</el-table>
|
|
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
|
<el-tab-pane label="数据采集" name="first">
|
|
<!-- <newDataCollection :routing-codes="fkRoutingCodes"
|
|
:collect-parameters="processOperationWorkstationCollectParameters" :active-name="activeName"
|
|
@add-parameter="handleAddParameter" @delete-parameter="handleDeleteParameter" /> -->
|
|
<!-- 在父组件模板中修改子组件引用 -->
|
|
<newDataCollection :routing-codes="fkRoutingCodes"
|
|
:collect-parameters="processOperationWorkstationCollectParameters" :active-name="activeName"
|
|
@add-parameter="handleAddParameter" @delete-parameter="handleDeleteParameter"
|
|
@sync-success="handleSyncSuccess" @plc-change-success="handlePlcChangeSuccess" />
|
|
</el-tab-pane>
|
|
<el-tab-pane label="物料参数" name="second">
|
|
<!-- <el-button type="primary" @click="addTableRow1">添加</el-button> -->
|
|
<el-table :data="tableDataList" style="width: 100%">
|
|
<el-table-column label="序号" align="center" type="index" width="70"> </el-table-column>
|
|
<el-table-column prop="fkFlowCode" label="所属流程" />
|
|
<el-table-column prop="materialCode" label="物料编码" />
|
|
<el-table-column prop="materialName" label="物料名称" />
|
|
<el-table-column prop="useErrorProofRuleCode" label="防错规则" />
|
|
<!-- <el-table-column label="操作" width="120">
|
|
<template #default="scope">
|
|
<el-button type="danger" size="small" @click="deleteTableRow1(scope.row)">删除</el-button>
|
|
</template>
|
|
</el-table-column> -->
|
|
</el-table>
|
|
</el-tab-pane>
|
|
<el-tab-pane label="配方参数" name="third">
|
|
<el-table :data="recipeData" style="width: 100%">
|
|
<el-table-column label="序号" align="center" type="index" width="70"> </el-table-column>
|
|
<el-table-column align="center" prop="recipeCode" label="配方码" />
|
|
<el-table-column align="center" prop="version" label="版本号" />
|
|
<el-table-column align="center" prop="paramName" label="参数名称" />
|
|
<el-table-column align="center" prop="ifcheck" label="是否检测" />
|
|
<el-table-column align="center" prop="upperLimit" label="上限值" />
|
|
<el-table-column align="center" prop="lowerLimit" label="下限值" />
|
|
<el-table-column align="center" prop="standardValue" label="标准值" />
|
|
<el-table-column align="center" prop="remark" label="备注" :show-overflow-tooltip="true" />
|
|
</el-table>
|
|
<pagination :total="total1" v-model:page="queryParams2.pageNum" v-model:limit="queryParams2.pageSize"
|
|
@pagination="getList2" />
|
|
</el-tab-pane>
|
|
</el-tabs>
|
|
</div>
|
|
<!-- <template #footer>
|
|
<div style="flex: auto">
|
|
<el-button @click="cancelClick">关闭</el-button>
|
|
<el-button type="primary" @click="confirmClick">确定</el-button>
|
|
</div>
|
|
</template> -->
|
|
|
|
</el-drawer>
|
|
|
|
<!-- 添加物料参数 -->
|
|
<el-dialog title="添加物料参数" v-model="dialogVisible" width="50%">
|
|
<el-form ref="formRef1" :model="form2" label-width="110px">
|
|
<el-form-item label="所属流程">
|
|
<el-select v-model="form2.fkFlowCode" placeholder="请选择流程名称">
|
|
<el-option v-for="item in options.flowNameOptions" :key="item.value" :label="item.label"
|
|
:value="item.value"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="物料搜索">
|
|
<el-select @change="handleMaterialCode" v-model="form2.materialCode" multiple filterable remote
|
|
prefix-icon="el-icon-search" reserve-keyword placeholder="请输入" :remote-method="remoteMethod"
|
|
:loading="loading" style="width: 240px">
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="物料编码">
|
|
<el-input v-model="form2.materialCode" placeholder="请输入物料编码" />
|
|
</el-form-item>
|
|
<el-form-item label="物料名称">
|
|
<el-input v-model="form2.materialName" placeholder="请输入物料名称" />
|
|
</el-form-item>
|
|
|
|
<el-form-item label="防错规则">
|
|
<el-select v-model="form2.useErrorProofRuleCode" placeholder="请选择防错规则">
|
|
<el-option v-for="item in errorPreventionDictionary" :key="item.value" :label="item.label"
|
|
:value="item.value"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<template #footer>
|
|
<div style="flex: auto">
|
|
<el-button @click="errorProofingClose">取消</el-button>
|
|
<el-button type="primary" @click="errorProofingSubmit">确定</el-button>
|
|
</div>
|
|
</template>
|
|
</el-dialog>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script setup name="processoperationworkstationmapping">
|
|
import {
|
|
listProcessOperationWorkstationMapping,
|
|
addProcessOperationWorkstationMapping, delProcessOperationWorkstationMapping,
|
|
updateProcessOperationWorkstationMapping, getProcessOperationWorkstationMapping,
|
|
getPlantSelect,
|
|
getPlantWorkshopSelect,
|
|
getPlantProductlineSelect,
|
|
getPlantWorkstationSelect,
|
|
|
|
}
|
|
from '@/api/masterDataManagement/process/processoperationworkstationmapping.js'
|
|
import {
|
|
listProcessOperation,
|
|
addProcessOperation, delProcessOperation,
|
|
updateProcessOperation, getProcessOperation,
|
|
getDictsSelect, getDictsType,
|
|
getProcessRoutingOperation,
|
|
addProcessRoutingOperation,
|
|
delProcessRoutingOperation,
|
|
delProcessRoutingOperationParameter,
|
|
addProcessRoutingOperationParameter,
|
|
getProcessRoutingOperationErrorRuleDict,
|
|
getProcessRoutingOperationMaterialName,
|
|
getProcessRoutingOperationMaterialErrorRuleDict,
|
|
addProcessRoutingOperationMaterial,
|
|
delProcessRoutingOperationMaterial,
|
|
getProcessRoutingOperationFormulaParameter,
|
|
gProcessRouteSelect,
|
|
gProcessSelect
|
|
} from '@/api/masterDataManagement/process/processoperation.js'
|
|
import newDataCollection from '@/views/masterDataManagement/Process/components/newDataCollection2.vue'
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
const ids = ref([])
|
|
const loading = ref(false)
|
|
const form1Ref = ref(null)
|
|
|
|
const processRouteSelect = ref([])//工艺流线
|
|
const workstationSelect = ref([])//工厂
|
|
const processSelect = ref([])//工序
|
|
const workshopSelect = ref([])//车间
|
|
const productionLineSelect = ref([])//产线
|
|
const workstationNameSelect = ref([])//工站
|
|
|
|
const activeName = ref('first')
|
|
const total1 = ref(0)
|
|
const showSearch = ref(true)
|
|
const recipeData = ref([])
|
|
const queryParams = reactive({
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
sort: '',
|
|
sortType: 'asc',
|
|
})
|
|
const queryParams2 = reactive({
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
})
|
|
const columns = ref([
|
|
{ visible: true, prop: 'id', label: 'Id' },
|
|
{ visible: true, prop: 'fkOperationCode', label: '工序code' },
|
|
{ visible: true, prop: 'fkWorkstationCode', label: '工位号' },
|
|
{ visible: true, prop: 'isActive', label: '是否有效' },
|
|
{ visible: true, prop: 'priority', label: '优先级' },
|
|
{ visible: true, prop: 'standardTime', label: '标准加工时间' },
|
|
{ visible: true, prop: 'setupTime', label: '准备时间' },
|
|
{ visible: false, prop: 'createdTime', label: 'CreatedTime' },
|
|
{ visible: false, prop: 'createdBy', label: '创建人' },
|
|
{ visible: false, prop: 'remark', label: '备注信息' },
|
|
{ visible: false, prop: 'updatedTime', label: 'UpdatedTime' },
|
|
{ visible: false, prop: 'updatedBy', label: '更新人' },
|
|
])
|
|
const total = ref(0)
|
|
const dataList = ref([])
|
|
const queryRef = ref()
|
|
const defaultTime = ref([new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)])
|
|
const tableData = ref([])
|
|
|
|
var dictParams = [
|
|
]
|
|
|
|
|
|
function getList() {
|
|
loading.value = true
|
|
listProcessOperationWorkstationMapping(queryParams).then(res => {
|
|
const { code, data } = res
|
|
if (code == 200) {
|
|
dataList.value = data.result
|
|
total.value = data.totalNum
|
|
loading.value = false
|
|
}
|
|
})
|
|
}
|
|
function handleClick(tab, event) {
|
|
console.log(tab.props.label, '选择的标签');
|
|
if (tab.props.label == '配方参数') {
|
|
getProcessRoutingOperationFormulaParameter({
|
|
FkRoutingCode: form1.value.fkRoutingCode,
|
|
OperationCode: form1.value.fkOperationCode,
|
|
pageNum: queryParams2.pageNum,
|
|
pageSize: queryParams2.pageSize
|
|
}).then(res => {
|
|
if (res.code == 200) {
|
|
|
|
total1.value = res.data.totalNum
|
|
recipeData.value = res.data.result
|
|
}
|
|
})
|
|
}
|
|
}
|
|
function getList2() {
|
|
getProcessRoutingOperationFormulaParameter({
|
|
fkRoutingCode: form1.value.fkRoutingCode,
|
|
OperationCode: form1.value.fkOperationCode,
|
|
pageNum: queryParams2.pageNum,
|
|
pageSize: queryParams2.pageSize
|
|
}).then(res => {
|
|
if (res.code == 200) {
|
|
total1.value = res.data.totalNum
|
|
recipeData.value = res.data.result
|
|
}
|
|
})
|
|
}
|
|
function handleInput(row) {
|
|
let data = {
|
|
fkRoutingCode: row.fkRoutingCode,
|
|
fkOperationCode: row.fkOperationCode,
|
|
flowCode: row.flowCode,
|
|
flowTypeCode: row.flowTypeCode,
|
|
flowTypeName: row.flowTypeName
|
|
}
|
|
addProcessRoutingOperation(data).then(res => {
|
|
if (res.code == 200) {
|
|
proxy.$modal.msgSuccess("修改成功")
|
|
getProcessOperationWorkstationMapping(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
tableDataList.value = res.data.processOperationFlowMaterialParamters
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
function handleFlowName(val, row) {
|
|
console.log(row, '99999');
|
|
if (!options.value.flowNameOptions || options.value.flowNameOptions.length === 0) {
|
|
return;
|
|
}
|
|
const flowItem = options.value.flowNameOptions.find(item => item.value === val)
|
|
if (flowItem) {
|
|
row.flowTypeCode = flowItem.value,
|
|
row.flowCode = flowItem.value
|
|
} else {
|
|
row.flowTypeCode = ''
|
|
}
|
|
let data = {
|
|
fkRoutingCode: fkRoutingCodeData.value,
|
|
fkOperationCode: operationCodeData.value,
|
|
flowCode: row.flowCode,
|
|
flowTypeCode: flowItem.value,
|
|
flowTypeName: flowItem.label
|
|
}
|
|
console.log(data, '熙增data');
|
|
addProcessRoutingOperation(data).then(res => {
|
|
if (res.code == 200) {
|
|
proxy.$modal.msgSuccess("新增成功")
|
|
getProcessOperationWorkstationMapping(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
tableDataList.value = res.data.processOperationFlowMaterialParamters
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
function deleteTableRow(row) {
|
|
console.log(row.id, '090909');
|
|
|
|
if (row.id) {
|
|
const Ids = row.id
|
|
proxy
|
|
.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
|
|
.then(function () {
|
|
return delProcessRoutingOperation(Ids)
|
|
})
|
|
.then(() => {
|
|
proxy.$modal.msgSuccess("删除成功")
|
|
getProcessOperationWorkstationMapping(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
tableData.value = res.data.operationFlows
|
|
}
|
|
})
|
|
})
|
|
} else {
|
|
const index = tableData.value.indexOf(row);
|
|
console.log(index, '要删除的下标');
|
|
if (index > -1) {
|
|
tableData.value.splice(index, 1);
|
|
proxy.$modal.msgSuccess("删除成功");
|
|
}
|
|
}
|
|
}
|
|
function deleteTableRow1(row) {
|
|
const Ids = row.id
|
|
proxy
|
|
.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?')
|
|
.then(function () {
|
|
return delProcessRoutingOperationMaterial(Ids)
|
|
})
|
|
.then(() => {
|
|
proxy.$modal.msgSuccess("删除成功")
|
|
getProcessOperationWorkstationMapping(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
tableDataList.value = res.data.processOperationFlowMaterialParamters
|
|
}
|
|
})
|
|
})
|
|
}
|
|
function handleAddParameter(val) {
|
|
// addProcessRoutingOperationParameter(val).then(res => {
|
|
// if (res.code == 200) {
|
|
proxy.$modal.msgSuccess("同步成功")
|
|
getProcessOperationWorkstationMapping(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
tableData.value = res.data.operationFlows,
|
|
processOperationWorkstationCollectParameters.value = res.data.processOperationWorkstationCollectParameters || []
|
|
}
|
|
})
|
|
// }
|
|
// })
|
|
}
|
|
function handleSyncSuccess(id) {
|
|
getProcessOperationWorkstationMapping(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
tableData.value = res.data.operationFlows
|
|
processOperationWorkstationCollectParameters.value = res.data.processOperationWorkstationCollectParameters || []
|
|
// proxy.$modal.msgSuccess("同步完成并刷新数据")
|
|
}
|
|
})
|
|
}
|
|
|
|
function handlePlcChangeSuccess(row) {
|
|
getProcessOperationWorkstationMapping(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
processOperationWorkstationCollectParameters.value = res.data.processOperationWorkstationCollectParameters || []
|
|
// proxy.$modal.msgSuccess("PLC修改完成并刷新数据")
|
|
}
|
|
})
|
|
}
|
|
function handleDeleteParameter(val) {
|
|
proxy
|
|
.$confirm('是否确认删除参数编号为"' + val + '"的数据项?')
|
|
.then(function () {
|
|
return delProcessRoutingOperationParameter(val)
|
|
})
|
|
.then(() => {
|
|
proxy.$modal.msgSuccess("删除成功")
|
|
getProcessOperationWorkstationMapping(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
tableData.value = res.data.operationFlows,
|
|
processOperationWorkstationCollectParameters.value = res.data.processOperationWorkstationCollectParameters || []
|
|
}
|
|
})
|
|
})
|
|
}
|
|
function errorProofingClose() {
|
|
dialogVisible.value = false,
|
|
form2.value = {}
|
|
|
|
}
|
|
const processOperationWorkstationCollectParameters = ref([])
|
|
const tableDataList = ref([])
|
|
function cancelClick() {
|
|
console.log('取消');
|
|
drawer.value = false
|
|
|
|
resetForm1()
|
|
}
|
|
function errorProofingSubmit() {
|
|
console.log(form2.value, '新增的参数1234');
|
|
addProcessRoutingOperationMaterial(form2.value).then(res => {
|
|
if (res.code == 200) {
|
|
proxy.$message.success('添加成功')
|
|
dialogVisible.value = false
|
|
form2.value = {}
|
|
getProcessOperation(operationIdData.value).then(res => {
|
|
if (res.code == 200) {
|
|
tableData.value = res.data.operationFlows
|
|
processOperationWorkstationCollectParameters.value = res.data.processOperationWorkstationCollectParameters || []
|
|
tableDataList.value = res.data.processOperationFlowMaterialParamters
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
function addTableRow() {
|
|
if (!tableData.value || !Array.isArray(tableData.value)) {
|
|
tableData.value = []
|
|
}
|
|
const newRow = {
|
|
flowCode: ``,
|
|
flowName: ``,
|
|
}
|
|
tableData.value.push(newRow)
|
|
}
|
|
const addTableRow1 = () => {
|
|
dialogVisible.value = true
|
|
form2.value.fkRoutingCode = form1.value.fkRoutingCode
|
|
form2.value.fkOperationCode = form1.value.operationCode,
|
|
getProcessRoutingOperationMaterialErrorRuleDict().then(res => {
|
|
if (res.code === 200) {
|
|
console.log('防错字典查询');
|
|
errorPreventionDictionary.value = res.data.map(item => {
|
|
return {
|
|
label: item.errorProofRuleName,
|
|
value: item.errorProofRuleCode,
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
// 查询
|
|
function handleQuery() {
|
|
queryParams.pageNum = 1
|
|
getList()
|
|
}
|
|
function handleChange(val) {
|
|
form.value.setupTime = val
|
|
}
|
|
function handleStandardTimeChange(val) {
|
|
form.value.standardTime = val
|
|
}
|
|
// 重置查询操作
|
|
function resetQuery() {
|
|
proxy.resetForm("queryRef")
|
|
queryParams.isActive = ''
|
|
handleQuery()
|
|
}
|
|
// 自定义排序
|
|
function sortChange(column) {
|
|
var sort = undefined
|
|
var sortType = undefined
|
|
|
|
if (column.prop != null && column.order != null) {
|
|
sort = column.prop
|
|
sortType = column.order
|
|
|
|
}
|
|
queryParams.sort = sort
|
|
queryParams.sortType = sortType
|
|
handleQuery()
|
|
}
|
|
|
|
/*************** form操作 ***************/
|
|
const formRef = ref()
|
|
const title = ref('')
|
|
// 操作类型 1、add 2、edit 3、view
|
|
const opertype = ref(0)
|
|
const open = ref(false)
|
|
const state = reactive({
|
|
single: true,
|
|
multiple: true,
|
|
form: {
|
|
setupTime: 0,
|
|
standardTime: 0,
|
|
priority: 1,
|
|
},
|
|
form1: {
|
|
operationId: null,
|
|
fkRoutingCode: null,
|
|
operationCode: null,
|
|
operationName: null,
|
|
operationSeq: null,
|
|
operationType: null,
|
|
description: null,
|
|
standardTime: null,
|
|
controlStrategy: null,
|
|
isSkippable: null,
|
|
isReworkable: null,
|
|
isParallel: null,
|
|
parallelGroupCode: null,
|
|
defaultNextOperationCode: null,
|
|
status: null
|
|
},
|
|
form2: {},
|
|
rules: {
|
|
fkOperationCode: [{ required: true, message: "工序code不能为空", trigger: "blur" }],
|
|
fkWorkstationCode: [{ required: true, message: "工位号不能为空", trigger: "blur" }],
|
|
},
|
|
options: {
|
|
// 是否有效 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
|
isActiveOptions: [
|
|
{
|
|
dictLabel: '有效', dictValue: '1'
|
|
},
|
|
{
|
|
dictLabel: '无效', dictValue: '0'
|
|
},
|
|
|
|
],
|
|
standardTimeOptions: [
|
|
{
|
|
dictLabel: '分钟', dictValue: '分钟'
|
|
},
|
|
{
|
|
dictLabel: '小时', dictValue: '小时'
|
|
}
|
|
]
|
|
}
|
|
})
|
|
|
|
const { form, form1, form2, rules, options, single, multiple } = toRefs(state)
|
|
|
|
// 关闭dialog
|
|
function cancel() {
|
|
open.value = false
|
|
reset()
|
|
}
|
|
|
|
// 重置表单
|
|
function reset() {
|
|
form.value = {
|
|
id: null,
|
|
fkOperationCode: null,
|
|
fkWorkstationCode: null,
|
|
isActive: null,
|
|
priority: 1,
|
|
standardTime: 0,
|
|
setupTime: 0,
|
|
createdTime: null,
|
|
createdBy: null,
|
|
remark: null,
|
|
updatedTime: null,
|
|
updatedBy: null,
|
|
};
|
|
proxy.resetForm("formRef")
|
|
}
|
|
const drawer = ref(false)
|
|
function gProcessRouteSelectData() {
|
|
gProcessRouteSelect().then((res) => {
|
|
processRouteSelect.value = res.data.map(item => {
|
|
return {
|
|
label: item.routingCode + '-' + item.routingName,
|
|
value: item.routingCode,
|
|
};
|
|
})
|
|
});
|
|
}
|
|
|
|
|
|
function handleRoutingCodeChange(val) {
|
|
gProcessSelect(val).then((res) => {
|
|
processSelect.value = res.data.map(item => {
|
|
return {
|
|
label: item.operationCode + '-' + item.operationName,
|
|
value: item.operationCode,
|
|
};
|
|
})
|
|
});
|
|
}
|
|
//工厂下拉
|
|
const workshopCode = ref('');
|
|
function factoryChange(val) {
|
|
workshopCode.value = val;
|
|
getPlantWorkshopSelect(val).then((res) => {
|
|
workshopSelect.value = res.data.map(item => {
|
|
return {
|
|
label: item.workshopCode + '-' + item.workshopName,
|
|
value: item.workshopCode,
|
|
};
|
|
})
|
|
});
|
|
}
|
|
//车间下拉
|
|
const workshop = ref('')
|
|
function handleWorkshop(val) {
|
|
workshop.value = val
|
|
console.log(val, '车间选择');
|
|
let data = {
|
|
site_code: workshopCode.value,
|
|
workshop_code: workshop.value
|
|
}
|
|
console.log(data, '数据');
|
|
getPlantProductlineSelect(data).then((res) => {
|
|
if (res.code == 200) {
|
|
console.log('产线下拉', res);
|
|
productionLineSelect.value = res.data.map(item => {
|
|
return {
|
|
label: item.lineCode + '-' + item.lineName,
|
|
value: item.lineCode,
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
function handleProductlineChange(val) {
|
|
let data = {
|
|
site_code: workshopCode.value,
|
|
workshop_code: workshop.value
|
|
}
|
|
getPlantWorkstationSelect(data).then(res => {
|
|
if (res.code == 200) {
|
|
console.log(res, '工位下拉');
|
|
workstationNameSelect.value = res.data.map(item => {
|
|
return {
|
|
label: item.workstationCode + '-' + item.workstationName,
|
|
value: item.workstationCode,
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
function getPlantSelectData() {
|
|
getPlantSelect().then((res) => {
|
|
console.log(res, '工厂数据');
|
|
if (res.code == 200) {
|
|
workstationSelect.value = res.data.map(item => {
|
|
return {
|
|
label: item.siteCode + '-' + item.siteName,
|
|
value: item.siteCode,
|
|
};
|
|
})
|
|
}
|
|
|
|
});
|
|
}
|
|
// 添加按钮操作
|
|
function handleAdd() {
|
|
reset();
|
|
open.value = true
|
|
title.value = '添加'
|
|
opertype.value = 1
|
|
gProcessRouteSelectData()
|
|
getPlantSelectData()
|
|
}
|
|
function resetForm1() {
|
|
form1.value = {
|
|
operationId: null,
|
|
fkRoutingCode: null,
|
|
operationCode: null,
|
|
operationName: null,
|
|
operationSeq: null,
|
|
operationType: null,
|
|
description: null,
|
|
standardTime: null,
|
|
controlStrategy: null,
|
|
isSkippable: null,
|
|
isReworkable: null,
|
|
isParallel: null,
|
|
parallelGroupCode: null,
|
|
defaultNextOperationCode: null,
|
|
status: null
|
|
}
|
|
tableData.value = []
|
|
if (form1Ref.value) proxy.resetForm('form1Ref')
|
|
}
|
|
const fkRoutingCodeData = ref('')
|
|
const operationCodeData = ref('')
|
|
const operationIdData = ref('')
|
|
const fkRoutingCodes = ref({})
|
|
function handleView(val) {
|
|
console.log(val, 'val456');
|
|
fkRoutingCodeData.value = val.fkRoutingCode
|
|
operationCodeData.value = val.operationCode
|
|
// plcAddress = val.plcAddress
|
|
operationIdData.value = val.id
|
|
resetForm1()
|
|
drawer.value = true
|
|
form1.value = { ...val }
|
|
|
|
// 更新 fkRoutingCodes
|
|
fkRoutingCodes.value = {
|
|
routingCode: form1.value.fkRoutingCode,
|
|
fkOperationCode: form1.value.fkOperationCode,
|
|
id: operationIdData.value
|
|
}
|
|
getProcessOperationWorkstationMapping(val.id).then(res => {
|
|
if (res.code == 200) {
|
|
tableData.value = res.data.operationFlows
|
|
processOperationWorkstationCollectParameters.value = res.data.processOperationWorkstationCollectParameters || []
|
|
form1.value.plcAddress = res.data.plcAddress
|
|
console.log(res.data, '获取的地址');
|
|
// plcAddress.value = res.data.plcAddress
|
|
tableDataList.value = res.data.processOperationFlowMaterialParamters
|
|
// recipeData.value = res.data.operationRecipeParameters
|
|
}
|
|
})
|
|
|
|
getProcessRoutingOperation().then(res => {
|
|
if (res.code == 200) {
|
|
options.value.flowNameOptions = res.data.map(item => {
|
|
return {
|
|
label: item.flowTypeName,
|
|
value: item.flowTypeCode,
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
// 修改按钮操作
|
|
function handleUpdate(row) {
|
|
reset()
|
|
const id = row.id || ids.value
|
|
getProcessOperationWorkstationMapping(id).then((res) => {
|
|
const { code, data } = res
|
|
if (code == 200) {
|
|
open.value = true
|
|
title.value = '修改'
|
|
opertype.value = 2
|
|
gProcessRouteSelectData()
|
|
getPlantSelectData()
|
|
form.value = {
|
|
...data,
|
|
isActive: data.isActive == 'True' ? '1' : '0'
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 添加&修改 表单提交
|
|
function submitForm() {
|
|
proxy.$refs["formRef"].validate((valid) => {
|
|
if (valid) {
|
|
|
|
if (form.value.id != undefined && opertype.value === 2) {
|
|
updateProcessOperationWorkstationMapping(form.value).then((res) => {
|
|
proxy.$modal.msgSuccess("修改成功")
|
|
open.value = false
|
|
getList()
|
|
})
|
|
} else {
|
|
addProcessOperationWorkstationMapping(form.value).then((res) => {
|
|
proxy.$modal.msgSuccess("新增成功")
|
|
open.value = false
|
|
getList()
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 删除按钮操作
|
|
function handleDelete(row) {
|
|
const Ids = row.id || ids.value
|
|
console.log(row);
|
|
proxy
|
|
.$confirm('是否确认删除工序编码为"' + row.fkRoutingCode + '"的数据项?')
|
|
.then(function () {
|
|
return delProcessOperationWorkstationMapping(Ids)
|
|
})
|
|
.then(() => {
|
|
getList()
|
|
proxy.$modal.msgSuccess("删除成功")
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleQuery()
|
|
</script>
|
|
|
|
<style scoped>
|
|
::v-deep .el-select__wrapper {
|
|
align-items: center;
|
|
background-color: var(--el-fill-color-blank);
|
|
border-radius: var(--el-border-radius-base);
|
|
box-shadow: 0 0 0 1px var(--el-border-color) inset;
|
|
box-sizing: border-box;
|
|
cursor: pointer;
|
|
display: flex;
|
|
font-size: 14px;
|
|
gap: 6px;
|
|
line-height: 24px;
|
|
min-height: 32px;
|
|
padding: 4px 12px;
|
|
position: relative;
|
|
text-align: left;
|
|
transform: translateZ(0);
|
|
transition: var(--el-transition-duration);
|
|
/* width: 373px; */
|
|
}
|
|
</style> |