新增架子车数设定
This commit is contained in:
@@ -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 });
|
||||
@@ -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 } },
|
||||
];
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user