新增MES密炼物料替代对应关系及开炼机参数维护模块,包括相关实体、控制器、服务和映射器的实现,支持增删改查及数据验证功能。
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslMixerMaterialSubstitute/list',
|
||||
save = '/xslmes/mesXslMixerMaterialSubstitute/add',
|
||||
edit = '/xslmes/mesXslMixerMaterialSubstitute/edit',
|
||||
deleteOne = '/xslmes/mesXslMixerMaterialSubstitute/delete',
|
||||
deleteBatch = '/xslmes/mesXslMixerMaterialSubstitute/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslMixerMaterialSubstitute/importExcel',
|
||||
exportXls = '/xslmes/mesXslMixerMaterialSubstitute/exportXls',
|
||||
queryById = '/xslmes/mesXslMixerMaterialSubstitute/queryById',
|
||||
}
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const batchDelete = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url, params }, { successMessageMode: 'none' });
|
||||
};
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
@@ -0,0 +1,102 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '编号', align: 'center', dataIndex: 'serialNo', width: 80 },
|
||||
{ title: '密炼物料编码', align: 'center', dataIndex: 'mixerMaterialCode', width: 130 },
|
||||
{ title: '密炼物料名称', align: 'center', dataIndex: 'mixerMaterialName', width: 160 },
|
||||
{ title: '替代密炼物料编码', align: 'center', dataIndex: 'substituteMaterialCode', width: 140 },
|
||||
{ title: '替代密炼物料名称', align: 'center', dataIndex: 'substituteMaterialName', width: 160 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100, defaultHidden: true },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100, defaultHidden: true },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '密炼物料',
|
||||
field: 'mixerMaterialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'mes_mixer_material,material_name,id',
|
||||
placeholder: '请选择密炼物料',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '密炼物料编码', field: 'mixerMaterialCode', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '密炼物料名称', field: 'mixerMaterialName', component: 'JInput', colProps: { span: 6 } },
|
||||
{
|
||||
label: '替代密炼物料',
|
||||
field: 'substituteMaterialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'mes_mixer_material,material_name,id',
|
||||
placeholder: '请选择替代密炼物料',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '替代物料编码', field: 'substituteMaterialCode', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '替代物料名称', field: 'substituteMaterialName', component: 'JInput', colProps: { span: 6 } },
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '编号',
|
||||
field: 'serialNo',
|
||||
component: 'InputNumber',
|
||||
componentProps: { disabled: true, placeholder: '保存后自动生成', style: { width: '100%' } },
|
||||
ifShow: ({ values }) => !!values.serialNo,
|
||||
},
|
||||
{
|
||||
label: '密炼物料',
|
||||
field: 'mixerMaterialName',
|
||||
component: 'Input',
|
||||
slot: 'mixerMaterialPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择密炼物料' }],
|
||||
},
|
||||
{ label: '', field: 'mixerMaterialId', component: 'Input', show: false },
|
||||
{
|
||||
label: '密炼物料编码',
|
||||
field: 'mixerMaterialCode',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择密炼物料后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '替代密炼物料',
|
||||
field: 'substituteMaterialName',
|
||||
component: 'Input',
|
||||
slot: 'substituteMaterialPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择替代密炼物料' }],
|
||||
},
|
||||
{ label: '', field: 'substituteMaterialId', component: 'Input', show: false },
|
||||
{
|
||||
label: '替代密炼物料编码',
|
||||
field: 'substituteMaterialCode',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择替代密炼物料后自动带出' },
|
||||
},
|
||||
];
|
||||
|
||||
export const superQuerySchema = {
|
||||
serialNo: { title: '编号', order: 0, view: 'number' },
|
||||
mixerMaterialId: {
|
||||
title: '密炼物料',
|
||||
order: 1,
|
||||
view: 'sel_search',
|
||||
dictTable: 'mes_mixer_material',
|
||||
dictCode: 'id',
|
||||
dictText: 'material_name',
|
||||
},
|
||||
mixerMaterialCode: { title: '密炼物料编码', order: 2, view: 'text' },
|
||||
mixerMaterialName: { title: '密炼物料名称', order: 3, view: 'text' },
|
||||
substituteMaterialId: {
|
||||
title: '替代密炼物料',
|
||||
order: 4,
|
||||
view: 'sel_search',
|
||||
dictTable: 'mes_mixer_material',
|
||||
dictCode: 'id',
|
||||
dictText: 'material_name',
|
||||
},
|
||||
substituteMaterialCode: { title: '替代密炼物料编码', order: 5, view: 'text' },
|
||||
substituteMaterialName: { title: '替代密炼物料名称', order: 6, view: 'text' },
|
||||
};
|
||||
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_substitute:add'"
|
||||
@click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_substitute:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_substitute: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="'xslmes:mes_xsl_mixer_material_substitute:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '编辑',
|
||||
onClick: handleEdit.bind(null, record),
|
||||
auth: 'xslmes:mes_xsl_mixer_material_substitute:edit',
|
||||
},
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslMixerMaterialSubstituteModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslMixerMaterialSubstitute" setup>
|
||||
import { reactive } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslMixerMaterialSubstituteModal from './components/MesXslMixerMaterialSubstituteModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema } from './MesXslMixerMaterialSubstitute.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslMixerMaterialSubstitute.api';
|
||||
|
||||
const queryParam = reactive<any>({});
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '密炼物料替代对应关系',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 110,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
beforeFetch: (params) => Object.assign(params, queryParam),
|
||||
},
|
||||
exportConfig: {
|
||||
name: '密炼物料替代对应关系',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).forEach((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
reload();
|
||||
}
|
||||
|
||||
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 });
|
||||
}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
function batchHandleDelete() {
|
||||
batchDelete({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
|
||||
function getDropDownAction(record: Recordable) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'xslmes:mes_xsl_mixer_material_substitute:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="860" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #mixerMaterialPicker="{ model }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input
|
||||
v-model:value="model.mixerMaterialName"
|
||||
read-only
|
||||
placeholder="请点击选择密炼物料"
|
||||
style="flex: 1"
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
<a-button type="primary" :disabled="isDetail" @click="openMixerSelect('mixer')">选择</a-button>
|
||||
<a-button v-if="model.mixerMaterialId && !isDetail" @click="clearMixer('mixer', model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #substituteMaterialPicker="{ model }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input
|
||||
v-model:value="model.substituteMaterialName"
|
||||
read-only
|
||||
placeholder="请点击选择替代密炼物料"
|
||||
style="flex: 1"
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
<a-button type="primary" :disabled="isDetail" @click="openMixerSelect('substitute')">选择</a-button>
|
||||
<a-button v-if="model.substituteMaterialId && !isDetail" @click="clearMixer('substitute', model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesMixerMaterialSelectModal @register="registerMixerModal" @select="onMixerSelect" />
|
||||
</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 { useMessage } from '/@/hooks/web/useMessage';
|
||||
import MesMixerMaterialSelectModal from '/@/views/mes/material/modules/MesMixerMaterialSelectModal.vue';
|
||||
import { formSchema } from '../MesXslMixerMaterialSubstitute.data';
|
||||
import { saveOrUpdate } from '../MesXslMixerMaterialSubstitute.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
const pickerTarget = ref<'mixer' | 'substitute'>('mixer');
|
||||
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, getFieldsValue, scrollToField }] = useForm({
|
||||
labelWidth: 140,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const [registerMixerModal, { openModal: openMixerModal }] = useModal();
|
||||
|
||||
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 });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : unref(isDetail) ? '详情' : '编辑'));
|
||||
|
||||
function openMixerSelect(target: 'mixer' | 'substitute') {
|
||||
pickerTarget.value = target;
|
||||
const values = getFieldsValue();
|
||||
const mid = target === 'mixer' ? values?.mixerMaterialId : values?.substituteMaterialId;
|
||||
openMixerModal(true, { mixerMaterialId: mid });
|
||||
}
|
||||
|
||||
function onMixerSelect(payload: Recordable | null) {
|
||||
if (!payload) {
|
||||
return;
|
||||
}
|
||||
if (pickerTarget.value === 'mixer') {
|
||||
setFieldsValue({
|
||||
mixerMaterialId: payload.mixerMaterialId,
|
||||
mixerMaterialName: payload.materialName || '',
|
||||
mixerMaterialCode: '',
|
||||
});
|
||||
fillMaterialCode(payload.mixerMaterialId, 'mixer');
|
||||
} else {
|
||||
setFieldsValue({
|
||||
substituteMaterialId: payload.mixerMaterialId,
|
||||
substituteMaterialName: payload.materialName || '',
|
||||
substituteMaterialCode: '',
|
||||
});
|
||||
fillMaterialCode(payload.mixerMaterialId, 'substitute');
|
||||
}
|
||||
}
|
||||
|
||||
async function fillMaterialCode(id: string, target: 'mixer' | 'substitute') {
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const { queryById } = await import('/@/views/mes/material/MesMixerMaterial.api');
|
||||
const raw = await queryById({ id });
|
||||
const row = (raw as Recordable)?.materialCode != null ? raw : (raw as Recordable)?.result;
|
||||
if (row?.materialCode) {
|
||||
if (target === 'mixer') {
|
||||
setFieldsValue({ mixerMaterialCode: row.materialCode, mixerMaterialName: row.materialName || '' });
|
||||
} else {
|
||||
setFieldsValue({ substituteMaterialCode: row.materialCode, substituteMaterialName: row.materialName || '' });
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
function clearMixer(target: 'mixer' | 'substitute', model: Recordable) {
|
||||
if (target === 'mixer') {
|
||||
model.mixerMaterialId = '';
|
||||
model.mixerMaterialName = '';
|
||||
model.mixerMaterialCode = '';
|
||||
} else {
|
||||
model.substituteMaterialId = '';
|
||||
model.substituteMaterialName = '';
|
||||
model.substituteMaterialCode = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values.mixerMaterialId) {
|
||||
createMessage.warning('请选择密炼物料');
|
||||
return;
|
||||
}
|
||||
if (!values.substituteMaterialId) {
|
||||
createMessage.warning('请选择替代密炼物料');
|
||||
return;
|
||||
}
|
||||
if (values.mixerMaterialId === values.substituteMaterialId) {
|
||||
createMessage.warning('密炼物料与替代密炼物料不能相同');
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, unref(isUpdate));
|
||||
createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功');
|
||||
closeModal();
|
||||
emit('success');
|
||||
} catch (e: any) {
|
||||
if (e?.errorFields) {
|
||||
const firstField = e.errorFields[0];
|
||||
if (firstField) {
|
||||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
return Promise.reject(e);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,34 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslOpenMillParam/list',
|
||||
save = '/xslmes/mesXslOpenMillParam/add',
|
||||
edit = '/xslmes/mesXslOpenMillParam/edit',
|
||||
deleteOne = '/xslmes/mesXslOpenMillParam/delete',
|
||||
deleteBatch = '/xslmes/mesXslOpenMillParam/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslOpenMillParam/importExcel',
|
||||
exportXls = '/xslmes/mesXslOpenMillParam/exportXls',
|
||||
queryById = '/xslmes/mesXslOpenMillParam/queryById',
|
||||
queryMaterialById = '/mes/material/material/queryById',
|
||||
}
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const queryMaterialById = (params: { id: string }) =>
|
||||
defHttp.get({ url: Api.queryMaterialById, params }, { successMessageMode: 'none' });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const batchDelete = (params, handleSuccess) =>
|
||||
defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => handleSuccess());
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url, params }, { successMessageMode: 'none' });
|
||||
};
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
@@ -0,0 +1,124 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '胶料名称', align: 'center', dataIndex: 'materialName', width: 160 },
|
||||
{ title: '胶料编码', align: 'center', dataIndex: 'materialCode', width: 130 },
|
||||
{ title: 'R0进胶时间(秒)', align: 'center', dataIndex: 'r0FeedTime', width: 120 },
|
||||
{ title: 'R0成环时间(秒)', align: 'center', dataIndex: 'r0RingTime', width: 120 },
|
||||
{ title: 'R0拉断时间(秒)', align: 'center', dataIndex: 'r0BreakTime', width: 120 },
|
||||
{ title: 'R0排胶时间(秒)', align: 'center', dataIndex: 'r0DischargeTime', width: 120 },
|
||||
{ title: 'R1进胶时间(秒)', align: 'center', dataIndex: 'r1FeedTime', width: 120 },
|
||||
{ title: 'R1成环时间(秒)', align: 'center', dataIndex: 'r1RingTime', width: 120 },
|
||||
{ title: 'R1拉断时间(秒)', align: 'center', dataIndex: 'r1BreakTime', width: 120 },
|
||||
{ title: 'R1排胶时间(秒)', align: 'center', dataIndex: 'r1DischargeTime', width: 120 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100, defaultHidden: true },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100, defaultHidden: true },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '胶料',
|
||||
field: 'materialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'mes_material,material_name,id',
|
||||
placeholder: '请选择胶料',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '胶料编码', field: 'materialCode', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '胶料名称', field: 'materialName', component: 'JInput', colProps: { span: 6 } },
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '胶料',
|
||||
field: 'materialId',
|
||||
component: 'Input',
|
||||
slot: 'materialPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择胶料' }],
|
||||
},
|
||||
{
|
||||
label: '胶料名称',
|
||||
field: 'materialName',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择胶料后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '胶料编码',
|
||||
field: 'materialCode',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择胶料后自动带出' },
|
||||
},
|
||||
{
|
||||
label: 'R0进胶时间',
|
||||
field: 'r0FeedTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R0成环时间',
|
||||
field: 'r0RingTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R0拉断时间',
|
||||
field: 'r0BreakTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R0排胶时间',
|
||||
field: 'r0DischargeTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R1进胶时间',
|
||||
field: 'r1FeedTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R1成环时间',
|
||||
field: 'r1RingTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R1拉断时间',
|
||||
field: 'r1BreakTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R1排胶时间',
|
||||
field: 'r1DischargeTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
];
|
||||
|
||||
export const superQuerySchema = {
|
||||
materialId: {
|
||||
title: '胶料',
|
||||
order: 0,
|
||||
view: 'sel_search',
|
||||
dictTable: 'mes_material',
|
||||
dictCode: 'id',
|
||||
dictText: 'material_name',
|
||||
},
|
||||
materialCode: { title: '胶料编码', order: 1, view: 'text' },
|
||||
materialName: { title: '胶料名称', order: 2, view: 'text' },
|
||||
r0FeedTime: { title: 'R0进胶时间', order: 3, view: 'number' },
|
||||
r0RingTime: { title: 'R0成环时间', order: 4, view: 'number' },
|
||||
r0BreakTime: { title: 'R0拉断时间', order: 5, view: 'number' },
|
||||
r0DischargeTime: { title: 'R0排胶时间', order: 6, view: 'number' },
|
||||
r1FeedTime: { title: 'R1进胶时间', order: 7, view: 'number' },
|
||||
r1RingTime: { title: 'R1成环时间', order: 8, view: 'number' },
|
||||
r1BreakTime: { title: 'R1拉断时间', order: 9, view: 'number' },
|
||||
r1DischargeTime: { title: 'R1排胶时间', order: 10, view: 'number' },
|
||||
};
|
||||
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'xslmes:mes_xsl_open_mill_param:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_open_mill_param:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_open_mill_param: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="'xslmes:mes_xsl_open_mill_param:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'xslmes:mes_xsl_open_mill_param:edit' },
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslOpenMillParamModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslOpenMillParam" setup>
|
||||
import { reactive } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslOpenMillParamModal from './components/MesXslOpenMillParamModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema } from './MesXslOpenMillParam.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslOpenMillParam.api';
|
||||
|
||||
const queryParam = reactive<any>({});
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '开炼机参数维护',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
beforeFetch: (params) => Object.assign(params, queryParam),
|
||||
},
|
||||
exportConfig: {
|
||||
name: '开炼机参数维护',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).forEach((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
reload();
|
||||
}
|
||||
|
||||
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 });
|
||||
}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
function batchHandleDelete() {
|
||||
batchDelete({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
|
||||
function getDropDownAction(record: Recordable) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'xslmes:mes_xsl_open_mill_param:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #materialPicker="{ model, field }">
|
||||
<JDictSelectTag
|
||||
v-model:value="model[field]"
|
||||
dictCode="mes_material,material_name,id"
|
||||
placeholder="请选择胶料"
|
||||
:disabled="isDetail"
|
||||
@update:value="(v) => onMaterialChange(model, v)"
|
||||
/>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</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 JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { formSchema } from '../MesXslOpenMillParam.data';
|
||||
import { saveOrUpdate, queryMaterialById } from '../MesXslOpenMillParam.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
/** 避免弹窗初始化回显时误触发物料回填 */
|
||||
const skipMaterialChange = ref(false);
|
||||
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
||||
labelWidth: 130,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
skipMaterialChange.value = true;
|
||||
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 });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
skipMaterialChange.value = false;
|
||||
});
|
||||
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : unref(isDetail) ? '详情' : '编辑'));
|
||||
|
||||
async function onMaterialChange(model: Recordable, val: unknown) {
|
||||
if (skipMaterialChange.value) {
|
||||
return;
|
||||
}
|
||||
const id = val != null && val !== '' ? String(val) : '';
|
||||
if (!id) {
|
||||
model.materialName = '';
|
||||
model.materialCode = '';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const raw = await queryMaterialById({ id });
|
||||
const row = (raw as Recordable)?.materialName != null ? raw : (raw as Recordable)?.result;
|
||||
if (row) {
|
||||
model.materialName = row.materialName ?? '';
|
||||
model.materialCode = row.materialCode ?? '';
|
||||
}
|
||||
} catch {
|
||||
model.materialName = '';
|
||||
model.materialCode = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values.materialId) {
|
||||
createMessage.warning('请选择胶料');
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, unref(isUpdate));
|
||||
createMessage.success(unref(isUpdate) ? '编辑成功' : '新增成功');
|
||||
closeModal();
|
||||
emit('success');
|
||||
} catch (e: any) {
|
||||
if (e?.errorFields) {
|
||||
const firstField = e.errorFields[0];
|
||||
if (firstField) {
|
||||
scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
return Promise.reject(e);
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user