|
|
@ -128,6 +128,14 @@
|
|
|
|
>工艺步骤
|
|
|
|
>工艺步骤
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
|
|
|
@click="routeMaterialUpdate(scope.row)"
|
|
|
|
|
|
|
|
v-hasPermi="['mes:baseRoute:edit']"
|
|
|
|
|
|
|
|
>关联物料
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
@ -203,16 +211,16 @@
|
|
|
|
<el-form-item label='批次量' prop='batchSize'>
|
|
|
|
<el-form-item label='批次量' prop='batchSize'>
|
|
|
|
<el-input-number v-model='form.batchSize' placeholder='请输入批次量' />
|
|
|
|
<el-input-number v-model='form.batchSize' placeholder='请输入批次量' />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label='状态' prop='activeFlag'>
|
|
|
|
<!-- <el-form-item label='状态' prop='activeFlag'>-->
|
|
|
|
<el-radio-group v-model='form.activeFlag'>
|
|
|
|
<!-- <el-radio-group v-model='form.activeFlag'>-->
|
|
|
|
<el-radio
|
|
|
|
<!-- <el-radio-->
|
|
|
|
v-for='dict in mes_route_active_flag'
|
|
|
|
<!-- v-for='dict in mes_route_active_flag'-->
|
|
|
|
:key='dict.value'
|
|
|
|
<!-- :key='dict.value'-->
|
|
|
|
:value='dict.value'
|
|
|
|
<!-- :value='dict.value'-->
|
|
|
|
>{{ dict.label }}
|
|
|
|
<!-- >{{ dict.label }}-->
|
|
|
|
</el-radio>
|
|
|
|
<!-- </el-radio>-->
|
|
|
|
</el-radio-group>
|
|
|
|
<!-- </el-radio-group>-->
|
|
|
|
</el-form-item>
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
<el-form-item label='备注' prop='remark'>
|
|
|
|
<el-form-item label='备注' prop='remark'>
|
|
|
|
<el-input v-model='form.remark' placeholder='请输入备注' />
|
|
|
|
<el-input v-model='form.remark' placeholder='请输入备注' />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
@ -282,18 +290,83 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--维护工艺路线关联物料对话框-->
|
|
|
|
|
|
|
|
<el-dialog :title='dialog.title' v-model='materialOpen' width='700px' append-to-body>
|
|
|
|
|
|
|
|
<el-form ref='baseRouteFormRef' :model='form' :rules='rules' label-width='110px'>
|
|
|
|
|
|
|
|
<el-form-item label='工艺路线名称' prop='routeName'>
|
|
|
|
|
|
|
|
<el-input v-model='form.routeName' placeholder='请输入工艺路线名称' disabled />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-divider content-position='center'>工艺路线关联物料信息</el-divider>
|
|
|
|
|
|
|
|
<el-row :gutter='10' class='mb8'>
|
|
|
|
|
|
|
|
<el-col :span='1.5'>
|
|
|
|
|
|
|
|
<el-button type='primary' icon='Plus' size='small' @click='handleAddRouteMaterial'>添加物料</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span='1.5'>
|
|
|
|
|
|
|
|
<el-button type='danger' icon='Delete' size='small' @click='handleDeleteRouteMaterial'>删除</el-button>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
|
|
:data="prodBaseRouteMaterialList"
|
|
|
|
|
|
|
|
:row-class-name="rowRouteMaterialIndex"
|
|
|
|
|
|
|
|
@selection-change="handleRouteMaterialSelectionChange"
|
|
|
|
|
|
|
|
ref="mesBaseRouteMaterial"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-table-column type='selection' width='50' align='center' />
|
|
|
|
|
|
|
|
<el-table-column label='序号' align='center' prop='index' v-if='false' />
|
|
|
|
|
|
|
|
<el-table-column label='关联物料' prop='materialId' align='center'>
|
|
|
|
|
|
|
|
<template #default='scope'>
|
|
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
|
|
v-model='scope.row.materialName'
|
|
|
|
|
|
|
|
placeholder='请选择物料'
|
|
|
|
|
|
|
|
readonly
|
|
|
|
|
|
|
|
@click='openMaterialDialog(scope.$index)'
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label='激活标识' prop='activeFlag' align='center' width='150'>
|
|
|
|
|
|
|
|
<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' v-show='submitShow'>确 定</el-button>
|
|
|
|
|
|
|
|
<el-button @click='cancel'>取 消</el-button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 物料选择弹窗 -->
|
|
|
|
|
|
|
|
<el-dialog title='选择物料信息' v-model='materialDialogOpen' width='1200px' append-to-body>
|
|
|
|
|
|
|
|
<MaterialSelect ref='materialSelectRef' v-if='materialDialogOpen'></MaterialSelect>
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
|
|
<el-button type='primary' @click='handleMaterialSelection'>确 定</el-button>
|
|
|
|
|
|
|
|
<el-button @click='materialDialogOpen = false'>取 消</el-button>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup name='BaseRoute' lang='ts'>
|
|
|
|
<script setup name='BaseRoute' lang='ts'>
|
|
|
|
import { listBaseRoute, getBaseRoute, delBaseRoute, addBaseRoute, updateBaseRoute } from '@/api/mes/baseRoute';
|
|
|
|
import { listBaseRoute, getBaseRoute, delBaseRoute, addBaseRoute, updateBaseRoute } from '@/api/mes/baseRoute';
|
|
|
|
import { BaseRouteVO, BaseRouteQuery, BaseRouteForm, ProdBaseRouteProcess } from '@/api/mes/baseRoute/types';
|
|
|
|
import { BaseRouteVO, BaseRouteQuery, BaseRouteForm, ProdBaseRouteProcess, ProdBaseRouteMaterial } from '@/api/mes/baseRoute/types';
|
|
|
|
import {getProcessInfoList} from "@/api/mes/baseProcessInfo";
|
|
|
|
import {getProcessInfoList} from "@/api/mes/baseProcessInfo";
|
|
|
|
|
|
|
|
import { getMaterialList } from '@/api/wms/linkage';
|
|
|
|
|
|
|
|
import MaterialSelect from '@/views/mes/baseMaterialInfo/addMaterial.vue';
|
|
|
|
/*import type { ProdBaseRouteProcess } from '@/api/mes/baseRoute/types';*/
|
|
|
|
/*import type { ProdBaseRouteProcess } from '@/api/mes/baseRoute/types';*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
const { mes_route_active_flag, mes_process_production_type, mes_need_first_inspect, mes_route_type, mes_print_flow_card } = toRefs<any>(proxy?.useDict('mes_route_active_flag', 'mes_process_production_type', 'mes_need_first_inspect', 'mes_route_type', 'mes_print_flow_card'));
|
|
|
|
const { mes_route_active_flag, mes_process_production_type, mes_need_first_inspect, mes_route_type, mes_print_flow_card, active_flag } = toRefs<any>(proxy?.useDict('mes_route_active_flag', 'mes_process_production_type', 'mes_need_first_inspect', 'mes_route_type', 'mes_print_flow_card', 'active_flag'));
|
|
|
|
|
|
|
|
|
|
|
|
const baseRouteList = ref<BaseRouteVO[]>([]);
|
|
|
|
const baseRouteList = ref<BaseRouteVO[]>([]);
|
|
|
|
const buttonLoading = ref(false);
|
|
|
|
const buttonLoading = ref(false);
|
|
|
@ -317,6 +390,12 @@ const routeProcessBoList = ref<any[]>([]);
|
|
|
|
const checkedProdBaseRouteProcess = ref<any[]>([]);
|
|
|
|
const checkedProdBaseRouteProcess = ref<any[]>([]);
|
|
|
|
const processList = ref<any[]>([]);
|
|
|
|
const processList = ref<any[]>([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 关联物料相关
|
|
|
|
|
|
|
|
const materialOpen = ref(false);
|
|
|
|
|
|
|
|
const prodBaseRouteMaterialList = ref<ProdBaseRouteMaterial[]>([]);
|
|
|
|
|
|
|
|
const checkedRouteMaterial = ref<ProdBaseRouteMaterial[]>([]);
|
|
|
|
|
|
|
|
const materialList = ref<any[]>([]);
|
|
|
|
|
|
|
|
|
|
|
|
//控制维护工艺路线步骤对话框的显示与隐藏,默认为false隐藏
|
|
|
|
//控制维护工艺路线步骤对话框的显示与隐藏,默认为false隐藏
|
|
|
|
const ifOpen = ref(false); // 使用 ref 定义响应式变量
|
|
|
|
const ifOpen = ref(false); // 使用 ref 定义响应式变量
|
|
|
|
|
|
|
|
|
|
|
@ -364,7 +443,10 @@ const initFormData: BaseRouteForm = {
|
|
|
|
needFirstInspect: '0',
|
|
|
|
needFirstInspect: '0',
|
|
|
|
printFlowCard: '0',
|
|
|
|
printFlowCard: '0',
|
|
|
|
batchSize: 0,
|
|
|
|
batchSize: 0,
|
|
|
|
routeProcessBoList: []//工艺步骤
|
|
|
|
routeProcessBoList: [],//工艺步骤
|
|
|
|
|
|
|
|
// prodBaseRouteMaterialList 不在BaseRouteForm类型定义中,但后端需要,TS忽略类型检查
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
prodBaseRouteMaterialList: []
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const data = reactive<PageData<BaseRouteForm, BaseRouteQuery>>({
|
|
|
|
const data = reactive<PageData<BaseRouteForm, BaseRouteQuery>>({
|
|
|
|
form: { ...initFormData },
|
|
|
|
form: { ...initFormData },
|
|
|
@ -408,7 +490,7 @@ const getList = async () => {
|
|
|
|
const cancel = () => {
|
|
|
|
const cancel = () => {
|
|
|
|
reset();
|
|
|
|
reset();
|
|
|
|
dialog.visible = false;
|
|
|
|
dialog.visible = false;
|
|
|
|
|
|
|
|
materialOpen.value = false;
|
|
|
|
ifOpen.value = false;
|
|
|
|
ifOpen.value = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -459,11 +541,16 @@ const handleUpdate = async (row?: BaseRouteVO) => {
|
|
|
|
const submitForm = () => {
|
|
|
|
const submitForm = () => {
|
|
|
|
baseRouteFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
baseRouteFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
|
|
|
|
// 校验物料是否已选择
|
|
|
|
|
|
|
|
const hasEmptyMaterial = prodBaseRouteMaterialList.value.some(item => !item.materialId || item.materialId === '');
|
|
|
|
|
|
|
|
if (hasEmptyMaterial) {
|
|
|
|
|
|
|
|
proxy?.$modal.msgError('请选择所有关联物料');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
|
|
|
|
|
|
|
// 确保 form 包含最新的 routeProcessBoList 数据
|
|
|
|
|
|
|
|
form.value.routeProcessBoList = routeProcessBoList.value;
|
|
|
|
form.value.routeProcessBoList = routeProcessBoList.value;
|
|
|
|
|
|
|
|
form.value.prodBaseRouteMaterialList = prodBaseRouteMaterialList.value;
|
|
|
|
if (form.value.routeId) {
|
|
|
|
if (form.value.routeId) {
|
|
|
|
await updateBaseRoute(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
await updateBaseRoute(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -471,13 +558,13 @@ const submitForm = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
dialog.visible = false;
|
|
|
|
dialog.visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
// 关闭维护工艺路线步骤对话框,重置数据
|
|
|
|
|
|
|
|
ifOpen.value = false;
|
|
|
|
ifOpen.value = false;
|
|
|
|
|
|
|
|
materialOpen.value = false;
|
|
|
|
routeProcessBoList.value = [];
|
|
|
|
routeProcessBoList.value = [];
|
|
|
|
|
|
|
|
prodBaseRouteMaterialList.value = [];
|
|
|
|
form.value.routeProcessBoList = [];
|
|
|
|
form.value.routeProcessBoList = [];
|
|
|
|
|
|
|
|
form.value.prodBaseRouteMaterialList = [];
|
|
|
|
form.value.routeProcessVoList = [];
|
|
|
|
form.value.routeProcessVoList = [];
|
|
|
|
|
|
|
|
|
|
|
|
await getList();
|
|
|
|
await getList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -598,6 +685,72 @@ const getProcessList = async () => {
|
|
|
|
processList.value = processRes.data;
|
|
|
|
processList.value = processRes.data;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 维护工艺路线关联物料 */
|
|
|
|
|
|
|
|
const routeMaterialUpdate = async (row: BaseRouteVO) => {
|
|
|
|
|
|
|
|
reset();
|
|
|
|
|
|
|
|
const _routeId = row?.routeId || ids.value[0];
|
|
|
|
|
|
|
|
const routeRes = await getBaseRoute(_routeId);
|
|
|
|
|
|
|
|
form.value = routeRes.data;
|
|
|
|
|
|
|
|
prodBaseRouteMaterialList.value = routeRes.data.prodBaseRouteMaterialList || [];
|
|
|
|
|
|
|
|
submitShow.value = true;
|
|
|
|
|
|
|
|
materialOpen.value = true;
|
|
|
|
|
|
|
|
dialog.title = '维护工艺路线关联物料';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 修改rowRouteMaterialIndex方法,返回类名字符串 */
|
|
|
|
|
|
|
|
const rowRouteMaterialIndex = ({ row, rowIndex }: { row: any; rowIndex: number }): string => {
|
|
|
|
|
|
|
|
row.index = rowIndex + 1;
|
|
|
|
|
|
|
|
return '';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 工艺路线关联物料添加按钮操作 */
|
|
|
|
|
|
|
|
const handleAddRouteMaterial = () => {
|
|
|
|
|
|
|
|
prodBaseRouteMaterialList.value.push({
|
|
|
|
|
|
|
|
materialId: '',
|
|
|
|
|
|
|
|
activeFlag: '1',
|
|
|
|
|
|
|
|
remark: '',
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 工艺路线关联物料删除按钮操作 */
|
|
|
|
|
|
|
|
const handleDeleteRouteMaterial = () => {
|
|
|
|
|
|
|
|
if (checkedRouteMaterial.value.length === 0) {
|
|
|
|
|
|
|
|
proxy?.$modal.msgError('请先选择要删除的工艺路线关联物料数据');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
prodBaseRouteMaterialList.value = prodBaseRouteMaterialList.value.filter(
|
|
|
|
|
|
|
|
item => !checkedRouteMaterial.value.some(checked => checked.materialId === item.materialId)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
checkedRouteMaterial.value = [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 复选框选中数据 */
|
|
|
|
|
|
|
|
const handleRouteMaterialSelectionChange = (selection: ProdBaseRouteMaterial[]) => {
|
|
|
|
|
|
|
|
checkedRouteMaterial.value = selection;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getMaterialListOptions = async () => {
|
|
|
|
|
|
|
|
const res = await getMaterialList({});
|
|
|
|
|
|
|
|
materialList.value = res.data || [];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const materialSelectRef = ref();
|
|
|
|
|
|
|
|
const materialDialogOpen = ref(false);
|
|
|
|
|
|
|
|
const currentMaterialRowIndex = ref(-1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const openMaterialDialog = (rowIndex) => {
|
|
|
|
|
|
|
|
currentMaterialRowIndex.value = rowIndex;
|
|
|
|
|
|
|
|
materialDialogOpen.value = true;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleMaterialSelection = () => {
|
|
|
|
|
|
|
|
const selectedRow = materialSelectRef.value.tableRef.store.states.currentRow.value;
|
|
|
|
|
|
|
|
if (selectedRow && currentMaterialRowIndex.value !== -1) {
|
|
|
|
|
|
|
|
console.log(selectedRow);
|
|
|
|
|
|
|
|
prodBaseRouteMaterialList.value[currentMaterialRowIndex.value].materialId = selectedRow.materialId;
|
|
|
|
|
|
|
|
prodBaseRouteMaterialList.value[currentMaterialRowIndex.value].materialName = selectedRow.materialName;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
materialDialogOpen.value = false;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
getProcessList();
|
|
|
|
getProcessList();
|
|
|
|