|
|
|
@ -6,7 +6,8 @@
|
|
|
|
|
<el-card shadow='hover'>
|
|
|
|
|
<el-form ref='queryFormRef' :model='queryParams' :inline='true'>
|
|
|
|
|
<el-form-item label='工位名称' prop='stationName'>
|
|
|
|
|
<el-input v-model='queryParams.stationName' placeholder='请输入工位名称' clearable @keyup.enter='handleQuery' />
|
|
|
|
|
<el-input v-model='queryParams.stationName' placeholder='请输入工位名称' clearable
|
|
|
|
|
@keyup.enter='handleQuery' />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='工位类型' prop='stationType'>
|
|
|
|
|
<el-select v-model='queryParams.stationType' placeholder='请选择工位类型' clearable>
|
|
|
|
@ -14,22 +15,24 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='所属工序' prop='processId'>
|
|
|
|
|
<el-select v-model="queryParams.processId" placeholder="请选择所属工序" clearable @keyup.enter='handleQuery' >
|
|
|
|
|
<el-select v-model='queryParams.processId' placeholder='请选择所属工序' clearable
|
|
|
|
|
@keyup.enter='handleQuery'>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in processInfoList"
|
|
|
|
|
:key="item.processId"
|
|
|
|
|
:label="item.processName"
|
|
|
|
|
:value="item.processId"
|
|
|
|
|
v-for='item in processInfoList'
|
|
|
|
|
:key='item.processId'
|
|
|
|
|
:label='item.processName'
|
|
|
|
|
:value='item.processId'
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='机台名称' prop='machineId'>
|
|
|
|
|
<el-select v-model="queryParams.machineId" placeholder="请选择机台名称" clearable @keyup.enter='handleQuery' >
|
|
|
|
|
<el-select v-model='queryParams.machineId' placeholder='请选择机台名称' clearable
|
|
|
|
|
@keyup.enter='handleQuery'>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in machineInfoList"
|
|
|
|
|
:key="item.machineId"
|
|
|
|
|
:label="item.machineName"
|
|
|
|
|
:value="item.machineId"
|
|
|
|
|
v-for='item in machineInfoList'
|
|
|
|
|
:key='item.machineId'
|
|
|
|
|
:label='item.machineName'
|
|
|
|
|
:value='item.machineId'
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -81,8 +84,8 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label='所属工序' align='center' prop='processName' v-if='columns[5].visible' />
|
|
|
|
|
<el-table-column label='单位生产时间' align='center' prop='productionTime' v-if='columns[6].visible' >
|
|
|
|
|
<template v-slot="scope">
|
|
|
|
|
<el-table-column label='单位生产时间' align='center' prop='productionTime' v-if='columns[6].visible'>
|
|
|
|
|
<template v-slot='scope'>
|
|
|
|
|
<span>{{ formatDayHourMinutes(scope.row.productionTime) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
@ -108,16 +111,19 @@
|
|
|
|
|
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label='操作' align='center' class-name='small-padding fixed-width'>
|
|
|
|
|
<el-table-column label='操作' align='center' class-name='small-padding fixed-width' width='100'>
|
|
|
|
|
<template #default='scope'>
|
|
|
|
|
<el-tooltip content='修改' placement='top'>
|
|
|
|
|
<el-button link type='primary' icon='Edit' @click='handleUpdate(scope.row)'
|
|
|
|
|
v-hasPermi="['mes:baseStationInfo:edit']"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
<el-tooltip content='删除' placement='top'>
|
|
|
|
|
<el-button link type='primary' icon='Delete' @click='handleDelete(scope.row)'
|
|
|
|
|
v-hasPermi="['mes:baseStationInfo:remove']"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
<!-- <el-tooltip content='修改' placement='top'>-->
|
|
|
|
|
<!-- <el-button link type='primary' icon='Edit' @click='handleUpdate(scope.row)'-->
|
|
|
|
|
<!-- v-hasPermi="['mes:baseStationInfo:edit']"></el-button>-->
|
|
|
|
|
<!-- </el-tooltip>-->
|
|
|
|
|
<!-- <el-tooltip content='删除' placement='top'>-->
|
|
|
|
|
<!-- <el-button link type='primary' icon='Delete' @click='handleDelete(scope.row)'-->
|
|
|
|
|
<!-- v-hasPermi="['mes:baseStationInfo:remove']"></el-button>-->
|
|
|
|
|
<!-- </el-tooltip>-->
|
|
|
|
|
<el-button link type='primary' @click='handleRelatedMaterial(scope.row)'
|
|
|
|
|
v-hasPermi="['mes:baseStationInfo:edit']">关联物料类型
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
@ -145,34 +151,34 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='所属工序' prop='processId'>
|
|
|
|
|
<el-select v-model="form.processId" placeholder="请选择所属工序">
|
|
|
|
|
<el-select v-model='form.processId' placeholder='请选择所属工序'>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in processInfoList"
|
|
|
|
|
:key="item.processId"
|
|
|
|
|
:label="item.processName"
|
|
|
|
|
:value="item.processId"
|
|
|
|
|
v-for='item in processInfoList'
|
|
|
|
|
:key='item.processId'
|
|
|
|
|
:label='item.processName'
|
|
|
|
|
:value='item.processId'
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='机台名称' prop='machineId'>
|
|
|
|
|
<el-select v-model="form.machineId" placeholder="请选择机台名称">
|
|
|
|
|
<el-select v-model='form.machineId' placeholder='请选择机台名称'>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in machineInfoList"
|
|
|
|
|
:key="item.machineId"
|
|
|
|
|
:label="item.machineName"
|
|
|
|
|
:value="item.machineId"
|
|
|
|
|
v-for='item in machineInfoList'
|
|
|
|
|
:key='item.machineId'
|
|
|
|
|
:label='item.machineName'
|
|
|
|
|
:value='item.machineId'
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='单位生产时间' prop='productionTime'>
|
|
|
|
|
<el-input-number v-model="form.productionTimeDays" placeholder="请输入天数" :min="0" :max="10000"
|
|
|
|
|
:controls="false" :style="{ width: '50px' }"/>
|
|
|
|
|
<el-input-number v-model='form.productionTimeDays' placeholder='请输入天数' :min='0' :max='10000'
|
|
|
|
|
:controls='false' :style="{ width: '50px' }" />
|
|
|
|
|
<span> 天 </span>
|
|
|
|
|
<el-input-number v-model="form.productionTimeHours" placeholder="请输入小时" :min="0" :max="23"
|
|
|
|
|
:controls="false" :style="{ width: '50px' }"/>
|
|
|
|
|
<el-input-number v-model='form.productionTimeHours' placeholder='请输入小时' :min='0' :max='23'
|
|
|
|
|
:controls='false' :style="{ width: '50px' }" />
|
|
|
|
|
<span> 小时 </span>
|
|
|
|
|
<el-input-number v-model="form.productionTimeMinutes" placeholder="请输入分钟" :min="0" :max="59"
|
|
|
|
|
:controls="false" :style="{ width: '50px' }"/>
|
|
|
|
|
<el-input-number v-model='form.productionTimeMinutes' placeholder='请输入分钟' :min='0' :max='59'
|
|
|
|
|
:controls='false' :style="{ width: '50px' }" />
|
|
|
|
|
<span> 分钟 </span>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='AGV编号' prop='agvCode'>
|
|
|
|
@ -202,6 +208,69 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 工位关联物料类型对话框 -->
|
|
|
|
|
<el-dialog :title='dialog.title' v-model='relationOpen' width='700px' append-to-body>
|
|
|
|
|
<el-form ref='baseStationInfoFormRef' :model='form' label-width='100px'>
|
|
|
|
|
<el-row :gutter='10' class='mb8'>
|
|
|
|
|
<el-col :span='12'>
|
|
|
|
|
<el-form-item label='工位编号' prop='stationCode'>
|
|
|
|
|
<el-input v-model='form.stationCode' placeholder='请输入工位编号' disabled />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span='12'>
|
|
|
|
|
<el-form-item label='工位名称' prop='stationName'>
|
|
|
|
|
<el-input v-model='form.stationName' placeholder='请输入工位名称' disabled />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-divider content-position='center'>工位关联物料类型信息</el-divider>
|
|
|
|
|
<el-row :gutter='10' class='mb8'>
|
|
|
|
|
<el-col :span='1.5'>
|
|
|
|
|
<el-button type='primary' plain icon='Plus' @click='handleAddRelation'>添加</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span='1.5'>
|
|
|
|
|
<el-button type='danger' icon='Delete' @click='handleDeleteStationMaterial'>删除</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-table :data='prodBaseStationMaterialtypeList' :row-class-name='rowBaseStationMaterialIndex'
|
|
|
|
|
@selection-change='handleStationMaterialSelectionChange'>
|
|
|
|
|
<el-table-column type='selection' width='50' align='center' />
|
|
|
|
|
<el-table-column label='序号' align='center' prop='index' />
|
|
|
|
|
<el-table-column align='center' label='物料类型' prop='materialTypeId'>
|
|
|
|
|
<template #default='scope'>
|
|
|
|
|
<el-select v-model='scope.row.materialTypeId' placeholder='请选择物料类型'>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for='item in materialTypeList'
|
|
|
|
|
:key='item.matrialTypeId'
|
|
|
|
|
:label='item.matrialTypeName'
|
|
|
|
|
:value='item.matrialTypeId'
|
|
|
|
|
:disabled='prodBaseStationMaterialtypeList.some(i =>i.materialTypeId === item.matrialTypeId)'
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label='激活标识' align='center' prop='activeFlag'>
|
|
|
|
|
<template #default='scope'>
|
|
|
|
|
<el-radio-group v-model='scope.row.activeFlag'>
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for='dict in active_flag'
|
|
|
|
|
:key='dict.value'
|
|
|
|
|
:value='dict.value'
|
|
|
|
|
>{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class='dialog-footer'>
|
|
|
|
|
<el-button type='primary' @click='submitForm'>确 定</el-button>
|
|
|
|
|
<el-button @click='cancelRelation'>取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@ -216,6 +285,7 @@ import {
|
|
|
|
|
import { BaseStationInfoVO, BaseStationInfoQuery, BaseStationInfoForm } from '@/api/mes/baseStationInfo/types';
|
|
|
|
|
import { getProcessInfoList } from '@/api/mes/baseProcessInfo';
|
|
|
|
|
import { getProdBaseMachineInfoList } from '@/api/mes/prodBaseMachineInfo';
|
|
|
|
|
import { getBaseMaterialTypeList } from '@/api/mes/baseMaterialType';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const { station_type, active_flag } = toRefs<any>(proxy?.useDict('station_type', 'active_flag'));
|
|
|
|
@ -239,6 +309,17 @@ const dialog = reactive<DialogOption>({
|
|
|
|
|
title: ''
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const relationOpen = ref(false);
|
|
|
|
|
const prodBaseStationMaterialtypeList = ref<any[]>([]);
|
|
|
|
|
const chekedStationMaterialList = ref<any[]>([]);
|
|
|
|
|
|
|
|
|
|
/** 查询物料类型下拉树结构 */
|
|
|
|
|
const materialTypeList = ref([]);
|
|
|
|
|
const getMaterialTypeListSelect = async () => {
|
|
|
|
|
let res = await getBaseMaterialTypeList(null);
|
|
|
|
|
materialTypeList.value = res.data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 查询工位下拉树结构 */
|
|
|
|
|
const getProcessInfoListSelect = async () => {
|
|
|
|
|
let res = await getProcessInfoList(null);
|
|
|
|
@ -287,6 +368,7 @@ const initFormData: BaseStationInfoForm = {
|
|
|
|
|
productionTimeDays: 0,
|
|
|
|
|
productionTimeHours: 0,
|
|
|
|
|
productionTimeMinutes: 0,
|
|
|
|
|
prodBaseStationMaterialtypeList: []
|
|
|
|
|
};
|
|
|
|
|
const data = reactive<PageData<BaseStationInfoForm, BaseStationInfoQuery>>({
|
|
|
|
|
form: { ...initFormData },
|
|
|
|
@ -319,7 +401,7 @@ const data = reactive<PageData<BaseStationInfoForm, BaseStationInfoQuery>>({
|
|
|
|
|
],
|
|
|
|
|
activeFlag: [
|
|
|
|
|
{ required: true, message: '激活标识不能为空', trigger: 'change' }
|
|
|
|
|
],
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -390,12 +472,15 @@ const submitForm = () => {
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
convertToSeconds();
|
|
|
|
|
if (form.value.stationId) {
|
|
|
|
|
form.value.prodBaseStationMaterialtypeList = prodBaseStationMaterialtypeList;
|
|
|
|
|
await updateBaseStationInfo(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
|
} else {
|
|
|
|
|
await addBaseStationInfo(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
|
}
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
dialog.visible = false;
|
|
|
|
|
relationOpen.value = false;
|
|
|
|
|
prodBaseStationMaterialtypeList.value = [];
|
|
|
|
|
await getList();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -407,7 +492,7 @@ const convertToSeconds = () => {
|
|
|
|
|
const hoursInSeconds = form.value.productionTimeHours * 60 * 60;
|
|
|
|
|
const minutesInSeconds = form.value.productionTimeMinutes * 60;
|
|
|
|
|
form.value.productionTime = daysInSeconds + hoursInSeconds + minutesInSeconds;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 秒转换为天小时分钟 */
|
|
|
|
|
const convertToTime = () => {
|
|
|
|
@ -419,7 +504,7 @@ const convertToTime = () => {
|
|
|
|
|
form.value.productionTimeDays = days;
|
|
|
|
|
form.value.productionTimeHours = hours;
|
|
|
|
|
form.value.productionTimeMinutes = minutes;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
const handleDelete = async (row?: BaseStationInfoVO) => {
|
|
|
|
@ -437,9 +522,67 @@ const handleExport = () => {
|
|
|
|
|
}, `baseStationInfo_${new Date().getTime()}.xlsx`);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 关联物料类型按钮操作 */
|
|
|
|
|
const handleRelatedMaterial = async (row?: BaseStationInfoVO) => {
|
|
|
|
|
reset();
|
|
|
|
|
const _stationId = row?.stationId || ids.value[0];
|
|
|
|
|
const res = await getBaseStationInfo(_stationId);
|
|
|
|
|
Object.assign(form.value, res.data);
|
|
|
|
|
prodBaseStationMaterialtypeList.value = [];
|
|
|
|
|
chekedStationMaterialList.value = [];
|
|
|
|
|
prodBaseStationMaterialtypeList.value = form.value.prodBaseStationMaterialtypeList?.map((item, index) => ({
|
|
|
|
|
...item,
|
|
|
|
|
index: index + 1
|
|
|
|
|
})) || [];
|
|
|
|
|
relationOpen.value = true;
|
|
|
|
|
dialog.title = '工位关联物料类型信息';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const rowBaseStationMaterialIndex = ({ row, rowIndex }: { row: any; rowIndex: number }): string => {
|
|
|
|
|
if (row.someCondition) {
|
|
|
|
|
return 'custom-class';
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 添加关联物料类型
|
|
|
|
|
const handleAddRelation = () => {
|
|
|
|
|
return prodBaseStationMaterialtypeList.value.push({
|
|
|
|
|
stationId: form.value.stationId,
|
|
|
|
|
activeFlag: '1',
|
|
|
|
|
index: prodBaseStationMaterialtypeList.value.length + 1
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 删除关联物料类型
|
|
|
|
|
const handleDeleteStationMaterial = () => {
|
|
|
|
|
if (chekedStationMaterialList.value.length === 0) {
|
|
|
|
|
proxy?.$modal.msgError('请先选择要删除的工位关联物料类型数据');
|
|
|
|
|
} else {
|
|
|
|
|
prodBaseStationMaterialtypeList.value = prodBaseStationMaterialtypeList.value
|
|
|
|
|
.filter(item => !chekedStationMaterialList.value.includes(item.index))
|
|
|
|
|
.map((item, index) => ({
|
|
|
|
|
...item,
|
|
|
|
|
index: index + 1
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 选中关联物料类型
|
|
|
|
|
const handleStationMaterialSelectionChange = (selection) => {
|
|
|
|
|
chekedStationMaterialList.value = selection.map(item => item.index);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const cancelRelation = () => {
|
|
|
|
|
reset();
|
|
|
|
|
relationOpen.value = false;
|
|
|
|
|
prodBaseStationMaterialtypeList.value = [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getProcessInfoListSelect();
|
|
|
|
|
getProdBaseMachineInfoListSelect();
|
|
|
|
|
getMaterialTypeListSelect();
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|