|
|
|
@ -95,7 +95,7 @@
|
|
|
|
|
<span>{{ formatDayHourMinutes(scope.row.productionTime) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label='车间名称' align='center' prop='workshopId' v-if='columns[7].visible' />
|
|
|
|
|
<el-table-column label='车间名称' align='center' prop='workshopName' v-if='columns[7].visible' width='120'/>
|
|
|
|
|
<el-table-column label='委外标识' align='center' prop='outsourcingFlag' v-if='columns[8].visible'>
|
|
|
|
|
<template #default='scope'>
|
|
|
|
|
<dict-tag :options='mes_outsourcing_flag' :value='scope.row.outsourcingFlag' />
|
|
|
|
@ -208,7 +208,14 @@
|
|
|
|
|
<span> 分钟 </span>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='车间名称' prop='workshopId'>
|
|
|
|
|
<el-input v-model='form.workshopId' placeholder='请输入车间名称' />
|
|
|
|
|
<el-select v-model="form.workshopId" placeholder="请选择车间名称">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in workshopInfoList"
|
|
|
|
|
:key="item.workshopId"
|
|
|
|
|
:label="item.workshopName"
|
|
|
|
|
:value="item.workshopId"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label='委外标识' prop='outsourcingFlag'>
|
|
|
|
|
<el-radio-group v-model='form.outsourcingFlag'>
|
|
|
|
@ -291,6 +298,57 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<!-- 工序资源表格 -->
|
|
|
|
|
<div class="mt-4">
|
|
|
|
|
<div class="mb-2">
|
|
|
|
|
<el-button type="primary" icon="Plus" @click="handleAddResource">新增工序资源</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<el-table :data="processResourceList" v-loading="resourceLoading">
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
<el-table-column label="指派类型" align="center" prop="assignmentType">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :options="mes_assignment_type" :value="scope.row.assignmentType"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="载具工装类型" align="center" prop="toolingTypeCode">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :options="tooling_type_code" :value="scope.row.toolingTypeCode"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="必选标识" align="center" prop="requiredFlag">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :options="mes_required_flag" :value="scope.row.requiredFlag"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="选择模式" align="center" prop="selectionMode">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :options="mes_selection_mode" :value="scope.row.selectionMode"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="是否需要校验" align="center" prop="requiresValidation">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :options="mes_requires_validation" :value="scope.row.requiresValidation"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="是否需要准备任务" align="center" prop="requiresPreparation">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<dict-tag :options="mes_requires_preparation" :value="scope.row.requiresPreparation"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tooltip content="修改" placement="top">
|
|
|
|
|
<el-button link type="primary" icon="Edit" @click="handleUpdateResource(scope.row)"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
<el-tooltip content="删除" placement="top">
|
|
|
|
|
<el-button link type="primary" icon="Delete" @click="handleDeleteResource(scope.row)"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class='dialog-footer'>
|
|
|
|
|
<el-button :loading='buttonLoading' type='primary' @click='submitForm'>确 定</el-button>
|
|
|
|
@ -402,6 +460,76 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 工序资源对话框 -->
|
|
|
|
|
<el-dialog :title="resourceDialog.title" v-model="resourceDialog.visible" width="600px" append-to-body>
|
|
|
|
|
<el-form ref="resourceFormRef" :model="resourceForm" :rules="resourceRules" label-width="140px">
|
|
|
|
|
<el-form-item label="指派类型" prop="assignmentType">
|
|
|
|
|
<el-radio-group v-model="resourceForm.assignmentType">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in mes_assignment_type"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="载具工装类型" prop="toolingTypeCode">
|
|
|
|
|
<el-select v-model="resourceForm.toolingTypeCode" placeholder="请选择载具工装类型">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in tooling_type_code"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="必选标识" prop="requiredFlag">
|
|
|
|
|
<el-radio-group v-model="resourceForm.requiredFlag">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in mes_required_flag"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="选择模式" prop="selectionMode">
|
|
|
|
|
<el-radio-group v-model="resourceForm.selectionMode">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in mes_selection_mode"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="是否需要校验" prop="requiresValidation">
|
|
|
|
|
<el-radio-group v-model="resourceForm.requiresValidation">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in mes_requires_validation"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="是否需要准备任务" prop="requiresPreparation">
|
|
|
|
|
<el-radio-group v-model="resourceForm.requiresPreparation">
|
|
|
|
|
<el-radio
|
|
|
|
|
v-for="dict in mes_requires_preparation"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
|
<el-input v-model="resourceForm.remark" placeholder="请输入备注" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
<el-button :loading="resourceButtonLoading" type="primary" @click="submitResourceForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancelResource">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@ -416,11 +544,17 @@ import {
|
|
|
|
|
} from '@/api/mes/baseProcessInfo';
|
|
|
|
|
import { getProdLineList } from '@/api/mes/baseProdLineInfo';
|
|
|
|
|
import { getUserList } from '@/api/system/user';
|
|
|
|
|
import { getWorkshopList } from '@/api/mes/baseWorkshopInfo';
|
|
|
|
|
import {
|
|
|
|
|
BaseProcessInfoVO,
|
|
|
|
|
BaseProcessInfoQuery,
|
|
|
|
|
BaseProcessInfoForm
|
|
|
|
|
} from '@/api/mes/baseProcessInfo/types';
|
|
|
|
|
import {
|
|
|
|
|
BaseProcessResourceVO,
|
|
|
|
|
BaseProcessResourceQuery,
|
|
|
|
|
BaseProcessResourceForm
|
|
|
|
|
} from '@/api/mes/baseProcessResource/types';
|
|
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const {
|
|
|
|
@ -429,8 +563,27 @@ const {
|
|
|
|
|
mes_outsourcing_flag,
|
|
|
|
|
mes_process_production_type,
|
|
|
|
|
mes_material_method,
|
|
|
|
|
mes_inspection_method
|
|
|
|
|
} = toRefs<any>(proxy?.useDict('active_flag', 'process_type', 'mes_outsourcing_flag', 'mes_process_production_type', 'mes_material_method', 'mes_inspection_method'));
|
|
|
|
|
mes_inspection_method,
|
|
|
|
|
mes_assignment_type,
|
|
|
|
|
mes_requires_validation,
|
|
|
|
|
mes_selection_mode,
|
|
|
|
|
tooling_type_code,
|
|
|
|
|
mes_required_flag,
|
|
|
|
|
mes_requires_preparation
|
|
|
|
|
} = toRefs<any>(proxy?.useDict(
|
|
|
|
|
'active_flag',
|
|
|
|
|
'process_type',
|
|
|
|
|
'mes_outsourcing_flag',
|
|
|
|
|
'mes_process_production_type',
|
|
|
|
|
'mes_material_method',
|
|
|
|
|
'mes_inspection_method',
|
|
|
|
|
'mes_assignment_type',
|
|
|
|
|
'mes_requires_validation',
|
|
|
|
|
'mes_selection_mode',
|
|
|
|
|
'tooling_type_code',
|
|
|
|
|
'mes_required_flag',
|
|
|
|
|
'mes_requires_preparation'
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
const baseProcessInfoList = ref<BaseProcessInfoVO[]>([]);
|
|
|
|
|
const buttonLoading = ref(false);
|
|
|
|
@ -451,6 +604,14 @@ const chekedUserList = ref<any[]>([]);
|
|
|
|
|
const prodBaseProcessProdlineBoList = ref<any[]>([]);
|
|
|
|
|
const prodBaseProcessUserBoList = ref<any[]>([]);
|
|
|
|
|
|
|
|
|
|
let workshopInfoList = ref([]);
|
|
|
|
|
|
|
|
|
|
/** 查询车间下拉树结构 */
|
|
|
|
|
const getWorkshopListSelect = async () => {
|
|
|
|
|
let res = await getWorkshopList(null);
|
|
|
|
|
workshopInfoList.value = res.data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
|
|
const baseProcessInfoFormRef = ref<ElFormInstance>();
|
|
|
|
@ -646,7 +807,15 @@ const handleUpdate = async (row?: BaseProcessInfoVO) => {
|
|
|
|
|
reset();
|
|
|
|
|
const _processId = row?.processId || ids.value[0];
|
|
|
|
|
const res = await getBaseProcessInfo(_processId);
|
|
|
|
|
Object.assign(form.value, res.data);
|
|
|
|
|
// 处理返回数据
|
|
|
|
|
const { prodBaseProcessResourceList, ...sourceData } = res.data as any;
|
|
|
|
|
Object.assign(form.value, sourceData);
|
|
|
|
|
// 设置资源列表
|
|
|
|
|
if (prodBaseProcessResourceList && Array.isArray(prodBaseProcessResourceList)) {
|
|
|
|
|
processResourceList.value = prodBaseProcessResourceList;
|
|
|
|
|
} else {
|
|
|
|
|
processResourceList.value = [];
|
|
|
|
|
}
|
|
|
|
|
convertToTime();
|
|
|
|
|
dialog.visible = true;
|
|
|
|
|
dialog.title = '修改工序信息';
|
|
|
|
@ -658,10 +827,16 @@ const submitForm = () => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
convertToSeconds();
|
|
|
|
|
// 将资源列表添加到表单数据中
|
|
|
|
|
const submitData: BaseProcessInfoForm = {
|
|
|
|
|
...form.value,
|
|
|
|
|
prodBaseProcessResourceList: processResourceList.value
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (form.value.processId) {
|
|
|
|
|
await updateBaseProcessInfo(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
|
await updateBaseProcessInfo(submitData).finally(() => buttonLoading.value = false);
|
|
|
|
|
} else {
|
|
|
|
|
await addBaseProcessInfo(form.value).finally(() => buttonLoading.value = false);
|
|
|
|
|
await addBaseProcessInfo(submitData).finally(() => buttonLoading.value = false);
|
|
|
|
|
}
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
dialog.visible = false;
|
|
|
|
@ -869,9 +1044,130 @@ const rowProdBaseProcessUserIndex = ({ row, rowIndex }: { row: any; rowIndex: nu
|
|
|
|
|
return '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 工序资源相关
|
|
|
|
|
const processResourceList = ref<BaseProcessResourceVO[]>([]);
|
|
|
|
|
const resourceLoading = ref(false);
|
|
|
|
|
const resourceButtonLoading = ref(false);
|
|
|
|
|
const resourceFormRef = ref<ElFormInstance>();
|
|
|
|
|
|
|
|
|
|
const resourceDialog = reactive<DialogOption>({
|
|
|
|
|
visible: false,
|
|
|
|
|
title: ''
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const initResourceFormData: BaseProcessResourceForm = {
|
|
|
|
|
processResourceId: undefined,
|
|
|
|
|
assignmentType: undefined,
|
|
|
|
|
toolingTypeCode: undefined,
|
|
|
|
|
requiredFlag: undefined,
|
|
|
|
|
selectionMode: undefined,
|
|
|
|
|
requiresValidation: undefined,
|
|
|
|
|
requiresPreparation: undefined,
|
|
|
|
|
remark: undefined
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const resourceData = reactive<PageData<BaseProcessResourceForm, BaseProcessResourceQuery>>({
|
|
|
|
|
form: {...initResourceFormData},
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
processResourceId: undefined,
|
|
|
|
|
assignmentType: undefined,
|
|
|
|
|
toolingTypeCode: undefined,
|
|
|
|
|
requiredFlag: undefined,
|
|
|
|
|
selectionMode: undefined,
|
|
|
|
|
requiresValidation: undefined,
|
|
|
|
|
requiresPreparation: undefined,
|
|
|
|
|
params: {}
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
assignmentType: [
|
|
|
|
|
{ required: true, message: "指派类型不能为空", trigger: "change" }
|
|
|
|
|
],
|
|
|
|
|
requiredFlag: [
|
|
|
|
|
{ required: true, message: "必选标识不能为空", trigger: "change" }
|
|
|
|
|
],
|
|
|
|
|
selectionMode: [
|
|
|
|
|
{ required: true, message: "选择模式不能为空", trigger: "change" }
|
|
|
|
|
],
|
|
|
|
|
requiresValidation: [
|
|
|
|
|
{ required: true, message: "是否需要校验不能为空", trigger: "change" }
|
|
|
|
|
],
|
|
|
|
|
requiresPreparation: [
|
|
|
|
|
{ required: true, message: "是否需要准备任务不能为空", trigger: "change" }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const { queryParams: resourceQueryParams, form: resourceForm, rules: resourceRules } = toRefs(resourceData);
|
|
|
|
|
|
|
|
|
|
/** 新增资源按钮操作 */
|
|
|
|
|
const handleAddResource = () => {
|
|
|
|
|
resourceForm.value = {...initResourceFormData};
|
|
|
|
|
resourceDialog.visible = true;
|
|
|
|
|
resourceDialog.title = "添加工序资源";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 修改资源按钮操作 */
|
|
|
|
|
const handleUpdateResource = async (row: BaseProcessResourceVO) => {
|
|
|
|
|
resourceForm.value = {...initResourceFormData};
|
|
|
|
|
Object.assign(resourceForm.value, row);
|
|
|
|
|
resourceDialog.visible = true;
|
|
|
|
|
resourceDialog.title = "修改工序资源";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 删除资源按钮操作 */
|
|
|
|
|
const handleDeleteResource = async (row: BaseProcessResourceVO) => {
|
|
|
|
|
await proxy?.$modal.confirm('是否确认删除该工序资源?');
|
|
|
|
|
const index = processResourceList.value.findIndex(item => item.processResourceId === row.processResourceId);
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
processResourceList.value.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
proxy?.$modal.msgSuccess("删除成功");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 提交资源表单 */
|
|
|
|
|
const submitResourceForm = () => {
|
|
|
|
|
resourceFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
const resourceData: BaseProcessResourceVO = {
|
|
|
|
|
processResourceId: resourceForm.value.processResourceId,
|
|
|
|
|
processId: form.value.processId,
|
|
|
|
|
assignmentType: resourceForm.value.assignmentType,
|
|
|
|
|
toolingTypeCode: resourceForm.value.toolingTypeCode,
|
|
|
|
|
requiredFlag: resourceForm.value.requiredFlag,
|
|
|
|
|
selectionMode: resourceForm.value.selectionMode,
|
|
|
|
|
requiresValidation: resourceForm.value.requiresValidation,
|
|
|
|
|
requiresPreparation: resourceForm.value.requiresPreparation,
|
|
|
|
|
remark: resourceForm.value.remark
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (resourceForm.value.processResourceId) {
|
|
|
|
|
// 修改资源
|
|
|
|
|
const index = processResourceList.value.findIndex(item => item.processResourceId === resourceForm.value.processResourceId);
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
processResourceList.value[index] = resourceData;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 新增资源
|
|
|
|
|
processResourceList.value.push(resourceData);
|
|
|
|
|
}
|
|
|
|
|
proxy?.$modal.msgSuccess("操作成功");
|
|
|
|
|
resourceDialog.visible = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 取消资源表单 */
|
|
|
|
|
const cancelResource = () => {
|
|
|
|
|
resourceForm.value = {...initResourceFormData};
|
|
|
|
|
resourceDialog.visible = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getUsersList();
|
|
|
|
|
getLineList();
|
|
|
|
|
getWorkshopListSelect();// 初始化车间数据
|
|
|
|
|
getList();
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|