胶料小料锁定原因新增

This commit is contained in:
2026-06-02 15:29:16 +08:00
parent 3f2c486f04
commit b8b06a881a
15 changed files with 959 additions and 2 deletions

View File

@@ -68,6 +68,20 @@ export const searchFormSchema: FormSchema[] = [
},
{
label: '转子类型',
field: 'rotorType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_rotor_type', placeholder: '大转子/小转子' },
colProps: { span: 6 },
},
];

View File

@@ -25,6 +25,57 @@ export const columns: BasicColumn[] = [
export const searchFormSchema: FormSchema[] = [
{ label: '单号', field: 'recordNo', component: 'Input', colProps: { span: 6 } },
{ label: '胶料名称', field: 'rubberMaterialName', component: 'Input', colProps: { span: 6 } },
{
label: '生产机台',
field: 'prodEquipmentLedgerId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id', placeholder: '请选择生产机台' },
colProps: { span: 6 },
},
{
label: '检验机台',
field: 'inspectEquipmentLedgerId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id', placeholder: '请选择检验机台' },
colProps: { span: 6 },
},
{
label: '班次',
field: 'workShift',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_work_shift', placeholder: '请选择班次' },
colProps: { span: 6 },
},
{
label: '班组',
field: 'workTeam',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_work_team', placeholder: '请选择班组' },
colProps: { span: 6 },
},
{
label: '检验类型',
field: 'quickTestTypeId',
component: 'JSearchSelect',
componentProps: {
dict: 'mes_xsl_rubber_quick_test_type,type_name,id',
async: true,
placeholder: '请选择检验类型',
},
colProps: { span: 6 },
},
{
label: '检验人',
field: 'inspectorUserId',
component: 'JSelectUser',
componentProps: {
rowKey: 'id',
labelKey: 'realname',
isRadioSelection: true,
maxSelectCount: 1,
},
colProps: { span: 6 },
},
{ label: '生产计划号', field: 'productionPlanNo', component: 'Input', colProps: { span: 6 } },
{ label: '胶料批次', field: 'rubberBatchNo', component: 'Input', colProps: { span: 6 } },
{

View File

@@ -26,8 +26,31 @@ export const columns: BasicColumn[] = [
export const searchFormSchema: FormSchema[] = [
{ label: '实验标准名称', field: 'stdName', component: 'Input', colProps: { span: 6 } },
{ label: '实验方法', field: 'testMethodName', component: 'Input', colProps: { span: 6 } },
{ label: '胶料名称', field: 'rubberMaterialName', component: 'Input', colProps: { span: 6 } },
{
label: '实验方法',
field: 'testMethodId',
component: 'JSearchSelect',
componentProps: {
dict: 'mes_xsl_rubber_quick_test_method,method_name,id',
async: true,
placeholder: '请选择实验方法',
},
colProps: { span: 6 },
},
{
label: '密炼机类型',
field: 'mixerType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_mixer_type', placeholder: '请选择密炼机类型' },
colProps: { span: 6 },
},
{
label: '胶料名称',
field: 'rubberMaterialId',
component: 'JDictSelectTag',
componentProps: { dictCode: 'mes_material,material_name,id', placeholder: '请选择胶料信息' },
colProps: { span: 6 },
},
{
label: '启用状态',
field: 'enableStatus',

View File

@@ -0,0 +1,51 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/xslmes/mesXslRubberSmallLockReason/list',
nextReasonCode = '/xslmes/mesXslRubberSmallLockReason/nextReasonCode',
save = '/xslmes/mesXslRubberSmallLockReason/add',
edit = '/xslmes/mesXslRubberSmallLockReason/edit',
deleteOne = '/xslmes/mesXslRubberSmallLockReason/delete',
deleteBatch = '/xslmes/mesXslRubberSmallLockReason/deleteBatch',
importExcel = '/xslmes/mesXslRubberSmallLockReason/importExcel',
exportXls = '/xslmes/mesXslRubberSmallLockReason/exportXls',
queryById = '/xslmes/mesXslRubberSmallLockReason/queryById',
}
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 fetchNextReasonCode = () => defHttp.get({ url: Api.nextReasonCode }, { successMessageMode: 'none' });
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,71 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
{ title: '编号', align: 'center', dataIndex: 'reasonCode', width: 100 },
{ title: '类型', align: 'center', dataIndex: 'lockType_dictText', width: 100 },
{ title: '条码类型', align: 'center', dataIndex: 'barcodeType_dictText', width: 100 },
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
{
title: '创建日期',
align: 'center',
dataIndex: 'createTime',
width: 165,
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
},
];
export const searchFormSchema: FormSchema[] = [
{ label: '编号', field: 'reasonCode', component: 'Input', colProps: { span: 6 } },
{
label: '类型',
field: 'lockType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_small_lock_type', placeholder: '请选择类型' },
colProps: { span: 6 },
},
{
label: '条码类型',
field: 'barcodeType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择条码类型' },
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '编号',
field: 'reasonCode',
component: 'Input',
componentProps: { readonly: true, placeholder: '保存时从001起自动生成' },
},
{
label: '类型',
field: 'lockType',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'xslmes_rubber_small_lock_type', placeholder: '请选择类型' },
},
{
label: '条码类型',
field: 'barcodeType',
component: 'JDictSelectTag',
required: true,
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择条码类型' },
},
{
label: '创建人',
field: 'createBy',
component: 'Input',
componentProps: { readonly: true },
ifShow: ({ values }) => !!values?.id,
},
{
label: '创建日期',
field: 'createTime',
component: 'Input',
componentProps: { readonly: true },
ifShow: ({ values }) => !!values?.id,
},
];

View File

@@ -0,0 +1,136 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_small_lock_reason:add'"
@click="handleAdd"
preIcon="ant-design:plus-outlined"
>
新增
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_small_lock_reason:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<j-upload-button
type="primary"
v-auth="'mes:mes_xsl_rubber_small_lock_reason: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_small_lock_reason:deleteBatch'">
批量操作
<Icon icon="mdi:chevron-down" />
</a-button>
</a-dropdown>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'mes:mes_xsl_rubber_small_lock_reason:edit',
},
]"
:dropDownActions="getDropDownAction(record)"
/>
</template>
</BasicTable>
<MesXslRubberSmallLockReasonModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslRubberSmallLockReason" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import Icon from '/@/components/Icon';
import MesXslRubberSmallLockReasonModal from './components/MesXslRubberSmallLockReasonModal.vue';
import { columns, searchFormSchema } from './MesXslRubberSmallLockReason.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberSmallLockReason.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: 200,
fixed: 'right',
},
},
exportConfig: {
name: '胶料小料锁定原因',
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true });
}
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 }, handleSuccess);
}
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
function handleSuccess() {
selectedRowKeys.value = [];
reload();
}
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{
label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'mes:mes_xsl_rubber_small_lock_reason:delete',
},
];
}
</script>

View File

@@ -0,0 +1,57 @@
<template>
<BasicModal @register="registerModal" :title="title" width="50%" v-bind="$attrs" destroyOnClose @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 '../MesXslRubberSmallLockReason.data';
import { fetchNextReasonCode, saveOrUpdate } from '../MesXslRubberSmallLockReason.api';
const emit = defineEmits(['register', 'success']);
const isUpdate = ref(true);
const isDetail = ref(false);
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
labelWidth: 120,
schemas: formSchema,
showActionButtonGroup: false,
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await resetFields();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
if (unref(isUpdate)) {
await setFieldsValue({ ...data.record });
} else {
try {
const nextCode = await fetchNextReasonCode();
await setFieldsValue({ reasonCode: nextCode });
} catch {
await setFieldsValue({ reasonCode: '' });
}
}
setProps({ disabled: !data?.showFooter });
});
const title = computed(() =>
!unref(isUpdate) ? '新增胶料小料锁定原因' : unref(isDetail) ? '锁定原因详情' : '编辑胶料小料锁定原因',
);
async function handleSubmit() {
try {
const values = await validate();
setModalProps({ confirmLoading: true });
await saveOrUpdate(values, isUpdate.value);
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>