This commit is contained in:
2026-05-29 15:49:02 +08:00
139 changed files with 21228 additions and 646 deletions

View File

@@ -0,0 +1,13 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslFormulaSpecEditLog/list',
queryById = '/xslmes/mesXslFormulaSpecEditLog/queryById',
exportXls = '/xslmes/mesXslFormulaSpecEditLog/exportXls',
}
export const getExportUrl = Api.exportXls;
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });

View File

@@ -0,0 +1,84 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const SPEC_TYPE_DICT = 'xslmes_formula_spec_edit_log_type';
export const ACTION_TYPE_DICT = 'xslmes_formula_spec_edit_log_action';
export const columns: BasicColumn[] = [
{
title: '示方分类',
align: 'center',
dataIndex: 'specType_dictText',
width: 110,
},
{ title: '示方标识', align: 'center', dataIndex: 'specTitle', width: 180, ellipsis: true },
{ title: '发行编号', align: 'center', dataIndex: 'issueNumber', width: 140 },
{
title: '操作类型',
align: 'center',
dataIndex: 'actionType_dictText',
width: 90,
},
{
title: '修改内容',
align: 'left',
dataIndex: 'changeSummary',
width: 320,
ellipsis: true,
},
{
title: '修改时间',
align: 'center',
dataIndex: 'modifyTime',
width: 165,
},
{ title: '修改人', align: 'center', dataIndex: 'modifyByName', width: 110 },
];
export const searchFormSchema: FormSchema[] = [
{
label: '示方分类',
field: 'specType',
component: 'JDictSelectTag',
componentProps: { dictCode: SPEC_TYPE_DICT, placeholder: '全部' },
colProps: { span: 6 },
},
{ label: '示方标识', field: 'specTitle', component: 'JInput', colProps: { span: 6 } },
{ label: '发行编号', field: 'issueNumber', component: 'JInput', colProps: { span: 6 } },
{
label: '操作类型',
field: 'actionType',
component: 'JDictSelectTag',
componentProps: { dictCode: ACTION_TYPE_DICT, placeholder: '全部' },
colProps: { span: 6 },
},
{ label: '修改人', field: 'modifyByName', component: 'Input', colProps: { span: 6 } },
{
label: '修改时间',
field: 'modifyTime',
component: 'RangePicker',
colProps: { span: 8 },
componentProps: {
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
];
export const changeItemColumns: BasicColumn[] = [
{ title: '区块', align: 'center', dataIndex: 'sectionLabel', width: 120 },
{ title: '字段/行', align: 'center', dataIndex: 'fieldLabel', width: 160 },
{
title: '变更前',
align: 'left',
dataIndex: 'beforeValue',
width: 280,
ellipsis: true,
},
{
title: '变更后',
align: 'left',
dataIndex: 'afterValue',
width: 280,
ellipsis: true,
},
];

View File

@@ -0,0 +1,88 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #tableTitle>
<a-button
type="primary"
v-auth="'xslmes:mes_xsl_formula_spec_edit_log:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: '查看对比',
onClick: handleCompare.bind(null, record),
},
]"
/>
</template>
</BasicTable>
<MesXslFormulaSpecEditLogCompareModal @register="registerCompareModal" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslFormulaSpecEditLog" setup>
import { reactive } from 'vue';
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslFormulaSpecEditLogCompareModal from './components/MesXslFormulaSpecEditLogCompareModal.vue';
import { columns, searchFormSchema } from './MesXslFormulaSpecEditLog.data';
import { list, getExportUrl } from './MesXslFormulaSpecEditLog.api';
const queryParam = reactive<any>({});
const [registerCompareModal, { openModal: openCompareModal }] = useModal();
const { tableContext, onExportXls } = useListPage({
tableProps: {
title: '配方日志查询',
api: list,
columns,
canResize: true,
showIndexColumn: true,
tableSetting: { cacheKey: 'mesXslFormulaSpecEditLog_v20260526' },
formConfig: {
schemas: searchFormSchema,
labelWidth: 90,
autoSubmitOnEnter: true,
showAdvancedButton: true,
fieldMapToTime: [['modifyTime', ['modifyTime_begin', 'modifyTime_end'], 'YYYY-MM-DD HH:mm:ss']],
},
actionColumn: {
title: '操作',
dataIndex: 'action',
width: 110,
fixed: 'right',
slots: { customRender: 'action' },
},
defSort: {
column: 'modifyTime',
order: 'desc',
},
beforeFetch: (params) => {
Object.assign(params, queryParam);
if (!params.column || params.column === 'createTime') {
params.column = 'modifyTime';
params.order = params.order || 'desc';
}
return params;
},
},
exportConfig: {
name: '配方日志查询',
url: getExportUrl,
params: queryParam,
},
});
const [registerTable] = tableContext;
function handleCompare(record: Recordable) {
openCompareModal(true, { record });
}
</script>

View File

@@ -0,0 +1,108 @@
<template>
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="配方修改对比"
:width="1100"
destroyOnClose
:showOkBtn="false"
cancelText="关闭"
>
<a-spin :spinning="loading">
<a-descriptions bordered :column="2" size="small" class="mb-4">
<a-descriptions-item label="示方分类">{{ detail?.specType_dictText || detail?.specType || '-' }}</a-descriptions-item>
<a-descriptions-item label="操作类型">{{ detail?.actionType_dictText || detail?.actionType || '-' }}</a-descriptions-item>
<a-descriptions-item label="示方标识">{{ detail?.specTitle || '-' }}</a-descriptions-item>
<a-descriptions-item label="发行编号">{{ detail?.issueNumber || '-' }}</a-descriptions-item>
<a-descriptions-item label="修改人">{{ detail?.modifyByName || '-' }}</a-descriptions-item>
<a-descriptions-item label="修改时间">{{ detail?.modifyTime || '-' }}</a-descriptions-item>
<a-descriptions-item label="修改内容" :span="2">{{ detail?.changeSummary || '-' }}</a-descriptions-item>
</a-descriptions>
<a-tabs v-model:activeKey="activeTab">
<a-tab-pane key="changes" tab="字段对比">
<BasicTable
:columns="changeItemColumns"
:dataSource="changeItems"
:pagination="false"
:canResize="false"
size="small"
bordered
rowKey="rowKey"
/>
<a-empty v-if="!loading && changeItems.length === 0" description="暂无字段级差异(新增/删除或无变更字段)" />
</a-tab-pane>
<a-tab-pane key="before" tab="变更前快照">
<pre class="snapshot-pre">{{ formatSnapshot(detail?.beforeData) }}</pre>
</a-tab-pane>
<a-tab-pane key="after" tab="变更后快照">
<pre class="snapshot-pre">{{ formatSnapshot(detail?.afterData) }}</pre>
</a-tab-pane>
</a-tabs>
</a-spin>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicTable } from '/@/components/Table';
import { changeItemColumns } from '../MesXslFormulaSpecEditLog.data';
import { queryById } from '../MesXslFormulaSpecEditLog.api';
defineEmits(['register']);
const loading = ref(false);
const activeTab = ref('changes');
const detail = ref<Recordable | null>(null);
const changeItems = ref<Recordable[]>([]);
const [registerModal, { setModalProps }] = useModalInner(async (data) => {
activeTab.value = 'changes';
detail.value = null;
changeItems.value = [];
setModalProps({ confirmLoading: false });
const id = data?.record?.id;
if (!id) {
return;
}
loading.value = true;
try {
const result = await queryById({ id });
detail.value = result || {};
changeItems.value = (result?.changeItems || []).map((item, index) => ({
...item,
rowKey: `${item.section || ''}_${item.fieldKey || ''}_${index}`,
}));
} finally {
loading.value = false;
}
});
function formatSnapshot(data: unknown) {
if (data == null) {
return '(无)';
}
try {
return JSON.stringify(data, null, 2);
} catch {
return String(data);
}
}
</script>
<style scoped>
.snapshot-pre {
max-height: 480px;
overflow: auto;
margin: 0;
padding: 12px;
background: #fafafa;
border: 1px solid #f0f0f0;
border-radius: 4px;
font-size: 12px;
line-height: 1.5;
white-space: pre-wrap;
word-break: break-all;
}
</style>

View File

@@ -103,6 +103,14 @@ export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
sectionDivider('基本信息', 'dividerBasic'),
{
label: '标题',
field: 'title',
component: 'Input',
colProps: { span: 24 },
componentProps: { placeholder: '请输入标题', allowClear: true },
dynamicRules: () => [{ required: true, message: '请输入标题' }],
},
{
label: 'PS编码',
field: 'psCode',
@@ -136,6 +144,7 @@ export const formSchema: FormSchema[] = [
field: 'status',
component: 'JDictSelectTag',
defaultValue: 'compile',
show: false,
componentProps: { dictCode: 'xslmes_mixer_ps_status', disabled: true },
colProps: colHalf,
},
@@ -143,6 +152,7 @@ export const formSchema: FormSchema[] = [
label: '编制人',
field: 'compileBy',
component: 'Input',
show: false,
componentProps: { disabled: true, bordered: false, placeholder: '保存后按创建人显示' },
colProps: colHalf,
},
@@ -153,14 +163,6 @@ export const formSchema: FormSchema[] = [
colProps: colHalf,
componentProps: { placeholder: '请输入担当', allowClear: true },
},
{
label: '标题',
field: 'title',
component: 'Input',
colProps: { span: 24 },
componentProps: { placeholder: '请输入标题', allowClear: true },
dynamicRules: () => [{ required: true, message: '请输入标题' }],
},
sectionDivider('组织与部门', 'dividerDept'),
{

View File

@@ -32,7 +32,7 @@
const statusDictCode = ref('xslmes_mixer_ps_status');
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField, updateSchema }] = useForm({
labelWidth: 96,
labelWidth: 88,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 24 },
@@ -166,7 +166,25 @@
margin-bottom: 14px;
}
:deep(#MesXslMixerPsCompileForm_compileBy),
:deep(.ant-form-item-label) {
flex: 0 0 88px !important;
min-width: 88px !important;
max-width: 88px !important;
width: 88px !important;
padding-right: 8px !important;
box-sizing: border-box !important;
text-align: right;
overflow: hidden;
white-space: nowrap;
}
:deep(.ant-form-item-control) {
flex: 1 1 0% !important;
min-width: 0 !important;
max-width: 100% !important;
width: auto !important;
}
:deep(#MesXslMixerPsCompileForm_proofreadBy),
:deep(#MesXslMixerPsCompileForm_proofreadTime),
:deep(#MesXslMixerPsCompileForm_auditBy),

View File

@@ -1039,8 +1039,7 @@ async function applyMixingSpecPageData(row: Recordable, mode: 'edit' | 'referenc
} else {
refreshSignDisplay(pageData || {});
}
await loadMachineEffectiveVolume(sheetForm.machineId);
await loadMixerStepOptions(sheetForm.machineId);
await Promise.all([loadMachineEffectiveVolume(sheetForm.machineId), loadMixerStepOptions(sheetForm.machineId)]);
await syncSheetToForm();
materialData.value = ensureMixingDetailRows(pageData?.materialList || [], DEFAULT_MIXING_MATERIAL_ROW_COUNT);
convertFactorApplying.value = true;

View File

@@ -0,0 +1,13 @@
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/xslmes/mesXslRackTrainCountSetting/list',
edit = '/xslmes/mesXslRackTrainCountSetting/edit',
queryById = '/xslmes/mesXslRackTrainCountSetting/queryById',
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
export const saveSetting = (params) => defHttp.post({ url: Api.edit, params });

View File

@@ -0,0 +1,75 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const STATUS_DICT = 'xslmes_rack_train_count_setting_status';
export const columns: BasicColumn[] = [
{ title: '示方编号', align: 'center', dataIndex: 'specCode', width: 180, ellipsis: true },
{ title: '机台名称', align: 'center', dataIndex: 'machineName', width: 160, ellipsis: true },
{ title: '设定车数', align: 'center', dataIndex: 'setTrainCount', width: 100 },
{
title: '状态',
align: 'center',
dataIndex: 'status',
width: 100,
customRender: ({ text }) => {
if (text === '1' || text === 1) return '已设定';
if (text === '0' || text === 0) return '未设定';
return '-';
},
},
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 110 },
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 165 },
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 110 },
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
];
export const searchFormSchema: FormSchema[] = [
{ label: '示方编号', field: 'specCode', component: 'JInput', colProps: { span: 6 } },
{
label: '机台名称',
field: 'machineId',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'mes_xsl_equipment_ledger,equipment_name,id',
placeholder: '请选择机台',
},
colProps: { span: 6 },
},
{
label: '状态',
field: 'status',
component: 'JDictSelectTag',
componentProps: { dictCode: STATUS_DICT, placeholder: '全部' },
colProps: { span: 6 },
},
{ label: '关键字', field: 'keyword', component: 'Input', colProps: { span: 6 }, componentProps: { placeholder: '示方编号/机台名称' } },
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '', field: 'mixingSpecId', component: 'Input', show: false },
{ label: '示方编号', field: 'specCode', component: 'Input', componentProps: { disabled: true } },
{ label: '机台名称', field: 'machineName', component: 'Input', componentProps: { disabled: true } },
{
label: '设定车数',
field: 'setTrainCount',
component: 'InputNumber',
required: true,
componentProps: {
min: 0,
precision: 0,
style: { width: '100%' },
placeholder: '请输入设定车数',
},
},
{
label: '状态',
field: 'status',
component: 'JDictSelectTag',
componentProps: { dictCode: STATUS_DICT, disabled: true },
},
{ label: '修改人', field: 'updateBy', component: 'Input', componentProps: { disabled: true } },
{ label: '修改时间', field: 'updateTime', component: 'Input', componentProps: { disabled: true } },
{ label: '创建人', field: 'createBy', component: 'Input', componentProps: { disabled: true } },
{ label: '创建时间', field: 'createTime', component: 'Input', componentProps: { disabled: true } },
];

View File

@@ -0,0 +1,78 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<MesXslRackTrainCountSettingModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="MesXslRackTrainCountSettingList" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesXslRackTrainCountSettingModal from './components/MesXslRackTrainCountSettingModal.vue';
import { columns, searchFormSchema } from './MesXslRackTrainCountSetting.data';
import { list } from './MesXslRackTrainCountSetting.api';
const [registerModal, { openModal }] = useModal();
const { tableContext } = useListPage({
tableProps: {
title: '架子车数设定',
api: list,
columns,
canResize: true,
showIndexColumn: true,
tableSetting: { cacheKey: 'mesXslRackTrainCountSetting_v20260528' },
formConfig: {
labelWidth: 90,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
actionColumn: {
title: '操作',
dataIndex: 'action',
width: 140,
fixed: 'right',
slots: { customRender: 'action' },
},
defSort: {
column: 'updateTime',
order: 'desc',
},
},
});
const [registerTable, { reload }] = tableContext;
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: true });
}
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
function handleSuccess() {
reload();
}
function getTableAction(record: Recordable) {
return [
{
label: '设定',
onClick: handleEdit.bind(null, record),
auth: 'xslmes:mes_xsl_rack_train_count_setting:edit',
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
auth: 'xslmes:mes_xsl_rack_train_count_setting:list',
},
];
}
</script>

View File

@@ -0,0 +1,66 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="640px" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from '../MesXslRackTrainCountSetting.data';
import { queryById, saveSetting } from '../MesXslRackTrainCountSetting.api';
const emit = defineEmits(['register', 'success']);
const isDetail = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isDetail.value = !data?.showFooter;
const record = data?.record || {};
if (record.id) {
try {
const detail = await queryById({ id: record.id });
await setFieldsValue({
...detail,
mixingSpecId: detail.mixingSpecId || detail.id,
});
} catch {
await setFieldsValue({
...record,
mixingSpecId: record.mixingSpecId || record.id,
});
}
}
setProps({ disabled: !data?.showFooter });
});
const title = computed(() => (unref(isDetail) ? '架子车数设定详情' : '架子车数设定'));
async function handleSubmit() {
if (unref(isDetail)) {
closeModal();
return;
}
try {
const values = await validate();
setModalProps({ confirmLoading: true });
await saveSetting({
id: values.id,
mixingSpecId: values.mixingSpecId || values.id,
setTrainCount: values.setTrainCount,
});
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,54 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/xslmes/mesXslRubberQuickTestRecord/list',
save = '/xslmes/mesXslRubberQuickTestRecord/add',
edit = '/xslmes/mesXslRubberQuickTestRecord/edit',
deleteOne = '/xslmes/mesXslRubberQuickTestRecord/delete',
deleteBatch = '/xslmes/mesXslRubberQuickTestRecord/deleteBatch',
importExcel = '/xslmes/mesXslRubberQuickTestRecord/importExcel',
exportXls = '/xslmes/mesXslRubberQuickTestRecord/exportXls',
queryById = '/xslmes/mesXslRubberQuickTestRecord/queryById',
queryLineList = '/xslmes/mesXslRubberQuickTestRecord/queryLineListByRecordId',
batchFromMaterial = '/xslmes/mesXslRubberQuickTestRecord/batchFromMaterial',
}
export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel;
export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
export const queryLineListByRecordId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
export const batchFromMaterial = (params) => defHttp.post({ url: Api.batchFromMaterial, params });
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
};
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess();
});
},
});
};
export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url, params });
};

View File

@@ -0,0 +1,173 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
const numProps = { style: { width: '100%' }, precision: 6 };
export const columns: BasicColumn[] = [
{ title: '单号', align: 'center', dataIndex: 'recordNo', width: 150 },
{ title: '胶料名称', align: 'center', dataIndex: 'rubberMaterialName', width: 140 },
{ title: '生产机台', align: 'center', dataIndex: 'prodEquipmentName', width: 120 },
{ title: '生产日期', align: 'center', dataIndex: 'productionDate', width: 110 },
{ title: '车次编号', align: 'center', dataIndex: 'trainNo', width: 100 },
{ title: '班次', align: 'center', dataIndex: 'workShift_dictText', width: 80 },
{ title: '班组', align: 'center', dataIndex: 'workTeam_dictText', width: 80 },
{ title: '检验次数', align: 'center', dataIndex: 'inspectTimes', width: 90 },
{ title: '检验时间', align: 'center', dataIndex: 'inspectTime', width: 165 },
{ title: '检验人', align: 'center', dataIndex: 'inspectorRealname', width: 100 },
{ title: '检验类型', align: 'center', dataIndex: 'quickTestTypeName', width: 120 },
{ title: '检验结果', align: 'center', dataIndex: 'inspectResult_dictText', width: 90 },
{ title: '生产计划号', align: 'center', dataIndex: 'productionPlanNo', width: 120 },
{ title: '检验机台', align: 'center', dataIndex: 'inspectEquipmentName', width: 120 },
{ title: '胶料卡片号', align: 'center', dataIndex: 'rubberCardNo', width: 120 },
{ title: '胶料批次', align: 'center', dataIndex: 'rubberBatchNo', width: 120 },
];
export const searchFormSchema: FormSchema[] = [
{ label: '单号', field: 'recordNo', component: 'Input', colProps: { span: 6 } },
{ label: '胶料名称', field: 'rubberMaterialName', component: 'Input', colProps: { span: 6 } },
{ label: '生产计划号', field: 'productionPlanNo', component: 'Input', colProps: { span: 6 } },
{ label: '胶料批次', field: 'rubberBatchNo', component: 'Input', colProps: { span: 6 } },
{
label: '检验结果',
field: 'inspectResult',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_record_result' },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{ label: '', field: 'stdId', component: 'Input', show: false },
{ label: '', field: 'rubberMaterialId', component: 'Input', show: false },
{ label: '', field: 'prodEquipmentLedgerId', component: 'Input', show: false },
{ label: '', field: 'inspectEquipmentLedgerId', component: 'Input', show: false },
{ label: '', field: 'inspectorUserId', component: 'Input', show: false },
{ label: '', field: 'inspectorUsername', component: 'Input', show: false },
{ label: '', field: 'quickTestTypeId', component: 'Input', show: false },
{
label: '单号',
field: 'recordNo',
component: 'Input',
componentProps: { readonly: true, placeholder: '保存时自动生成' },
},
{
label: '胶料名称',
field: 'rubberMaterialName',
component: 'Input',
componentProps: { readonly: true },
},
{
label: '生产机台',
field: 'prodEquipmentName',
component: 'Input',
slot: 'prodEquipmentPicker',
},
{
label: '生产日期',
field: 'productionDate',
component: 'DatePicker',
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
},
{ label: '车次编号', field: 'trainNo', component: 'Input' },
{
label: '班次',
field: 'workShift',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_work_shift', placeholder: '请选择班次' },
},
{
label: '班组',
field: 'workTeam',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_work_team', placeholder: '请选择班组' },
},
{
label: '检验次数',
field: 'inspectTimes',
component: 'InputNumber',
componentProps: { style: { width: '100%' }, min: 0, precision: 0 },
},
{
label: '检验时间',
field: 'inspectTime',
component: 'DatePicker',
componentProps: {
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
},
},
{
label: '检验人',
field: 'inspectorUserId',
component: 'JSelectUser',
componentProps: ({ formActionType }) => ({
rowKey: 'id',
labelKey: 'realname',
isRadioSelection: true,
maxSelectCount: 1,
onOptionsChange: (options) => {
const row = options?.[0];
if (row) {
formActionType?.setFieldsValue?.({
inspectorUsername: row.username,
inspectorRealname: row.realname,
});
}
},
}),
},
{ label: '', field: 'inspectorRealname', component: 'Input', show: false },
{
label: '检验类型',
field: 'quickTestTypeId',
component: 'JSearchSelect',
componentProps: {
dict: 'mes_xsl_rubber_quick_test_type,type_name,id',
async: true,
placeholder: '请选择检验类型',
},
},
{
label: '检验结果',
field: 'inspectResult',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_record_result', placeholder: '合格/不合格' },
},
{ label: '生产计划号', field: 'productionPlanNo', component: 'Input' },
{
label: '检验机台',
field: 'inspectEquipmentName',
component: 'Input',
slot: 'inspectEquipmentPicker',
},
{ label: '胶料卡片号', field: 'rubberCardNo', component: 'Input' },
{ label: '胶料批次', field: 'rubberBatchNo', component: 'Input' },
];
export const lineJVxeColumns: JVxeColumn[] = [
{ title: '', key: 'dataPointId', type: JVxeTypes.hidden },
{ title: '检验项目', key: 'inspectItem', type: JVxeTypes.normal, width: 180, disabled: true },
{
title: '检验下限',
key: 'lowerLimit',
type: JVxeTypes.normal,
width: 110,
disabled: true,
},
{
title: '检验值',
key: 'inspectValue',
type: JVxeTypes.inputNumber,
width: 110,
componentProps: numProps,
},
{
title: '检验上限',
key: 'upperLimit',
type: JVxeTypes.normal,
width: 110,
disabled: true,
},
];

View File

@@ -0,0 +1,118 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_record:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<j-upload-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_record:importExcel'"
preIcon="ant-design:import-outlined"
@click="onImportXls"
>
导入
</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" />
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'mes:mes_xsl_rubber_quick_test_record:deleteBatch'">
批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesXslRubberQuickTestRecordModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslRubberQuickTestRecord" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import Icon from '/@/components/Icon';
import MesXslRubberQuickTestRecordModal from './components/MesXslRubberQuickTestRecordModal.vue';
import { columns, searchFormSchema } from './MesXslRubberQuickTestRecord.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestRecord.api';
const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '胶料快检记录',
api: list,
columns,
canResize: true,
formConfig: {
schemas: searchFormSchema,
labelWidth: 120,
autoSubmitOnEnter: true,
showAdvancedButton: true,
},
actionColumn: {
width: 160,
fixed: 'right',
},
},
exportConfig: {
name: '胶料快检记录',
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: true });
}
function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false });
}
async function handleDelete(record) {
await deleteOne({ id: record.id }, reload);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, reload);
}
function handleSuccess() {
reload();
}
function getTableAction(record) {
return [{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_rubber_quick_test_record:edit' }];
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'mes:mes_xsl_rubber_quick_test_record:delete',
},
];
}
</script>

View File

@@ -0,0 +1,166 @@
<template>
<BasicModal
v-bind="$attrs"
destroyOnClose
:title="title"
width="1100px"
@register="registerModal"
@ok="handleSubmit"
>
<BasicForm @register="registerForm">
<template #prodEquipmentPicker="{ model, field }">
<a-input-group compact style="display: flex; width: 100%">
<a-input v-model:value="model[field]" read-only placeholder="请选择生产机台" style="flex: 1" />
<a-button type="primary" :disabled="isDetail" @click="openProdEquipmentSelect">选择</a-button>
<a-button v-if="model.prodEquipmentLedgerId && !isDetail" @click="clearProdEquipment(model)">清除</a-button>
</a-input-group>
</template>
<template #inspectEquipmentPicker="{ model, field }">
<a-input-group compact style="display: flex; width: 100%">
<a-input v-model:value="model[field]" read-only placeholder="请选择检验机台" style="flex: 1" />
<a-button type="primary" :disabled="isDetail" @click="openInspectEquipmentSelect">选择</a-button>
<a-button v-if="model.inspectEquipmentLedgerId && !isDetail" @click="clearInspectEquipment(model)">清除</a-button>
</a-input-group>
</template>
</BasicForm>
<a-divider orientation="left">检验明细由实验标准带出不可增删</a-divider>
<JVxeTable
v-if="tableReady"
ref="lineTableRef"
row-number
keep-source
:toolbar="false"
:insert-row="false"
:remove-btn="false"
:max-height="380"
:loading="lineLoading"
:columns="lineJVxeColumns"
:dataSource="lineDataSource"
:disabled="isDetail"
/>
<MesXslEquipmentLedgerSelectModal @register="registerLedgerModal" @select="onLedgerSelect" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import type { JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
import { useMessage } from '/@/hooks/web/useMessage';
import { formSchema, lineJVxeColumns } from '../MesXslRubberQuickTestRecord.data';
import { saveOrUpdate, queryById, queryLineListByRecordId } from '../MesXslRubberQuickTestRecord.api';
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
const emit = defineEmits(['register', 'success']);
const { createMessage } = useMessage();
const isDetail = ref(false);
const tableReady = ref(false);
const lineLoading = ref(false);
const lineDataSource = ref<Recordable[]>([]);
const lineTableRef = ref<JVxeTableInstance>();
const ledgerPickTarget = ref<'prod' | 'inspect'>('prod');
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
labelWidth: 120,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 12 },
});
const [registerLedgerModal, { openModal: openLedgerModal }] = useModal();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
tableReady.value = false;
lineDataSource.value = [];
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isDetail.value = !data?.showFooter;
setProps({ disabled: !data?.showFooter });
if (data?.record?.id) {
lineLoading.value = true;
try {
const mainRaw = await queryById({ id: data.record.id });
const m = (mainRaw as any)?.id != null ? mainRaw : (mainRaw as any)?.result ?? mainRaw;
const linesRaw = await queryLineListByRecordId({ id: data.record.id });
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
await setFieldsValue({ ...m });
lineDataSource.value = list || [];
} finally {
lineLoading.value = false;
}
}
tableReady.value = true;
});
const title = computed(() => (unref(isDetail) ? '快检记录详情' : '编辑胶料快检记录'));
function openProdEquipmentSelect() {
ledgerPickTarget.value = 'prod';
const vals = getFieldsValue();
openLedgerModal(true, { equipmentLedgerId: vals?.prodEquipmentLedgerId || '' });
}
function openInspectEquipmentSelect() {
ledgerPickTarget.value = 'inspect';
const vals = getFieldsValue();
openLedgerModal(true, { equipmentLedgerId: vals?.inspectEquipmentLedgerId || '' });
}
async function onLedgerSelect(payload: Recordable) {
if (ledgerPickTarget.value === 'prod') {
await setFieldsValue({
prodEquipmentLedgerId: payload.equipmentLedgerId || '',
prodEquipmentName: payload.equipmentName || '',
});
} else {
await setFieldsValue({
inspectEquipmentLedgerId: payload.equipmentLedgerId || '',
inspectEquipmentName: payload.equipmentName || '',
});
}
}
function clearProdEquipment(model: Recordable) {
model.prodEquipmentLedgerId = '';
model.prodEquipmentName = '';
}
function clearInspectEquipment(model: Recordable) {
model.inspectEquipmentLedgerId = '';
model.inspectEquipmentName = '';
}
async function handleSubmit() {
if (unref(isDetail)) {
closeModal();
return;
}
try {
const values = await validate();
const lineRef = lineTableRef.value as any;
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
const lineList = tableData
.filter((r) => r && r.inspectItem)
.map((r) => ({
dataPointId: r.dataPointId,
inspectItem: r.inspectItem,
lowerLimit: r.lowerLimit,
inspectValue: r.inspectValue,
upperLimit: r.upperLimit,
}));
if (!lineList.length) {
createMessage.warning('检验明细不能为空');
return;
}
setModalProps({ confirmLoading: true });
await saveOrUpdate({ ...values, lineList }, true);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>