add(hwmom-mes): 增加维护工艺路线步骤功能

- 在工艺路线列表页面添加维护工艺路线步骤按钮
- 实现维护工艺路线步骤对话框,包括工艺路线名称、工艺路线组成信息等
- 添加工艺路线步骤的添加、删除功能
master
zch 3 weeks ago
parent 638b7884cd
commit ac04250fc7

@ -1,3 +1,23 @@
// 定义工艺路线步骤的接口
export interface ProdBaseRouteProcess {
/** 工序ID */
processId: string | number;
/** 工序顺序 */
processOrder: string | number;
/** 备注 */
remark?: string;
/** 创建人 */
createBy?: number;
/** 创建时间 */
createTime?: string;
/** 更新人 */
updateBy?: number;
/** 更新时间 */
updateTime?: string;
/** 序号(前端使用) */
index?: number;
}
export interface BaseRouteVO { export interface BaseRouteVO {
/** /**
* 线ID * 线ID
@ -54,6 +74,13 @@ export interface BaseRouteVO {
*/ */
updateTime: string; updateTime: string;
/**
* 线
*/
routeProcessBoList?: ProdBaseRouteProcess[];
routeProcessVoList?: ProdBaseRouteProcess[];
} }
export interface BaseRouteForm extends BaseEntity { export interface BaseRouteForm extends BaseEntity {
@ -82,6 +109,12 @@ export interface BaseRouteForm extends BaseEntity {
*/ */
remark?: string; remark?: string;
/**
* 线
*/
routeProcessBoList?: ProdBaseRouteProcess[];
routeProcessVoList?: ProdBaseRouteProcess[];
} }
export interface BaseRouteQuery extends PageQuery { export interface BaseRouteQuery extends PageQuery {

@ -71,14 +71,25 @@
</el-table-column> </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'>
<template #default='scope'> <template #default='scope'>
<el-tooltip content='修改' placement='top'> <!-- <el-tooltip content='修改' placement='top'>
<el-button link type='primary' icon='Edit' @click='handleUpdate(scope.row)' <el-button link type='primary' icon='Edit' @click='handleUpdate(scope.row)'
v-hasPermi="['mes:baseRoute:edit']"></el-button> v-hasPermi="['mes:baseRoute:edit']"></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content='删除' placement='top'> <el-tooltip content='删除' placement='top'>
<el-button link type='primary' icon='Delete' @click='handleDelete(scope.row)' <el-button link type='primary' icon='Delete' @click='handleDelete(scope.row)'
v-hasPermi="['mes:baseRoute:remove']"></el-button> v-hasPermi="['mes:baseRoute:remove']"></el-button>
</el-tooltip> </el-tooltip>-->
<el-button
size="small"
type="text"
icon="el-icon-edit"
@click="routeProcessUpdate(scope.row)"
v-hasPermi="['mes:baseRoute:edit']"
>工艺步骤
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -116,12 +127,73 @@
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<!--维护工艺路线步骤对话框-->
<el-dialog :title='dialog.title' v-model='ifOpen' width='500px' 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='handleAddProdBaseRouteProcess'>添加</el-button>
</el-col>
<el-col :span='1.5'>
<el-button type='danger' icon='Delete' size='small' @click='handleDeleteProdBaseRouteProcess'>删除</el-button>
</el-col>
<!-- <el-col :span='1.5'>
<span v-show='tagShow'>提示:该工艺路线已关联生产工单无法修改</span>
</el-col> -->
</el-row>
<!-- <el-table :data='routeProcessBoList' :row-class-name='rowProdBaseRouteProcessIndex'
@selection-change='handleProdBaseRouteProcessSelectionChange' ref='mesBaseRouteProcess'>-->
<el-table
:data="routeProcessBoList"
:row-class-name="rowProdBaseRouteProcessIndex"
@selection-change="handleProdBaseRouteProcessSelectionChange"
ref="mesBaseRouteProcess"
>
<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='processOrder' width='100'>
<template #default='scope'>
<el-input v-model='scope.row.processOrder' />
</template>
</el-table-column>
<el-table-column label='工序' prop='processId'>
<template #default='scope'>
<el-select v-model='scope.row.processId' filterable placeholder='请选择工序' clearable>
<el-option
v-for='item in processList'
:key='item.processId'
:label='item.processName'
:value='item.processId'
:disabled='routeProcessBoList.some(i => i.processId === item.processId)'
/>
</el-select>
</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>
</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 } from '@/api/mes/baseRoute/types'; import { BaseRouteVO, BaseRouteQuery, BaseRouteForm, ProdBaseRouteProcess } from '@/api/mes/baseRoute/types';
import {getProcessInfoList} from "@/api/mes/baseProcessInfo";
/*import type { ProdBaseRouteProcess } from '@/api/mes/baseRoute/types';*/
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { active_flag } = toRefs<any>(proxy?.useDict('active_flag')); const { active_flag } = toRefs<any>(proxy?.useDict('active_flag'));
@ -138,6 +210,19 @@ const total = ref(0);
const queryFormRef = ref<ElFormInstance>(); const queryFormRef = ref<ElFormInstance>();
const baseRouteFormRef = ref<ElFormInstance>(); const baseRouteFormRef = ref<ElFormInstance>();
// data
const routeProcessOpen = ref(false);
const submitShow = ref(true);
const tagShow = ref(false);
const routeProcessBoList = ref<any[]>([]);
const checkedProdBaseRouteProcess = ref<any[]>([]);
const processList = ref<any[]>([]);
//线false
const ifOpen = ref(false); // 使 ref
const dialog = reactive<DialogOption>({ const dialog = reactive<DialogOption>({
visible: false, visible: false,
title: '' title: ''
@ -163,7 +248,8 @@ const initFormData: BaseRouteForm = {
routeName: undefined, routeName: undefined,
routeDesc: undefined, routeDesc: undefined,
activeFlag: '1', activeFlag: '1',
remark: undefined remark: undefined,
routeProcessBoList: []//
}; };
const data = reactive<PageData<BaseRouteForm, BaseRouteQuery>>({ const data = reactive<PageData<BaseRouteForm, BaseRouteQuery>>({
form: { ...initFormData }, form: { ...initFormData },
@ -201,12 +287,15 @@ const getList = async () => {
const cancel = () => { const cancel = () => {
reset(); reset();
dialog.visible = false; dialog.visible = false;
ifOpen.value = false;
}; };
/** 表单重置 */ /** 表单重置 */
const reset = () => { const reset = () => {
form.value = { ...initFormData }; form.value = { ...initFormData };
baseRouteFormRef.value?.resetFields(); baseRouteFormRef.value?.resetFields();
routeProcessBoList.value = [];
}; };
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -250,6 +339,10 @@ const submitForm = () => {
baseRouteFormRef.value?.validate(async (valid: boolean) => { baseRouteFormRef.value?.validate(async (valid: boolean) => {
if (valid) { if (valid) {
buttonLoading.value = true; buttonLoading.value = true;
// form routeProcessBoList
form.value.routeProcessBoList = routeProcessBoList.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 {
@ -257,6 +350,13 @@ const submitForm = () => {
} }
proxy?.$modal.msgSuccess('操作成功'); proxy?.$modal.msgSuccess('操作成功');
dialog.visible = false; dialog.visible = false;
// 线,
ifOpen.value = false;
routeProcessBoList.value = [];
form.value.routeProcessBoList = [];
form.value.routeProcessVoList = [];
await getList(); await getList();
} }
}); });
@ -278,7 +378,90 @@ const handleExport = () => {
}, `baseRoute_${new Date().getTime()}.xlsx`); }, `baseRoute_${new Date().getTime()}.xlsx`);
}; };
// methods
/** 维护工艺路线步骤 */
const routeProcessUpdate = async (row: BaseRouteVO) => {
reset();
const _routeId = row?.routeId || ids.value[0];
submitShow.value = true;
// 线
ifOpen.value = true;
/* tagShow.value = false;*/
/* // 检查是否关联生产工单
const res = await listProductOrder({ dispatchId: _routeId });
if (res.rows.length > 0) {
submitShow.value = false;
tagShow.value = true;
}*/
//
const routeRes = await getBaseRoute(_routeId);
form.value = routeRes.data;
routeProcessBoList.value = routeRes.data.routeProcessVoList || [];
routeProcessOpen.value = true;
dialog.title = '维护工艺路线步骤';
};
// rowProdBaseRouteProcessIndex
const rowProdBaseRouteProcessIndex = ({ row, rowIndex }: {
row: ProdBaseRouteProcess;
rowIndex: number
}): string => {
// processOrder
if (!row.processOrder) {
// index1
row.index = rowIndex + 1;
// processOrder(1)10
row.processOrder = (rowIndex + 1) * 10;
}
//
return '';
};
/** 工艺路线组成信息添加按钮操作 */
const handleAddProdBaseRouteProcess = () => {
routeProcessBoList.value.push({
processId: '',
processOrder: '',
remark: '',
createBy: '',
createTime: '',
updateBy: '',
updateTime: ''
});
};
/** 工艺路线组成信息删除按钮操作 */
const handleDeleteProdBaseRouteProcess = () => {
// 线
if (checkedProdBaseRouteProcess.value.length === 0) {
proxy?.$modal.msgError('请先选择要删除的工艺路线组成信息数据');
} else {
// 线
routeProcessBoList.value = routeProcessBoList.value.filter(
item => !checkedProdBaseRouteProcess.value.includes(item.index)
);
}
};
/** 复选框选中数据 */
const handleProdBaseRouteProcessSelectionChange = (selection: any[]) => {
// checkedProdBaseRouteProcess.value
checkedProdBaseRouteProcess.value = selection.map(item => item.index);
};
const getProcessList = async () => {
const processRes = await getProcessInfoList(null);
processList.value = processRes.data;
};
onMounted(() => { onMounted(() => {
getProcessList();
getList(); getList();
}); });
</script> </script>

Loading…
Cancel
Save