停机记录新增,设备管理查询条件完善
This commit is contained in:
@@ -16,7 +16,14 @@ export const columns: BasicColumn[] = [
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentLedgerPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '类型',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentLedgerPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备台账"
|
||||
:show-clear="!!model.equipmentLedgerId"
|
||||
@open="openLedgerSelect"
|
||||
@clear="clearModelFields(model, ['equipmentLedgerId', 'equipmentName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
@@ -51,6 +61,7 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipInspectConfigModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerLedgerModal" @select="onLedgerSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -59,11 +70,17 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipInspectConfigModal from './components/MesXslEquipInspectConfigModal.vue';
|
||||
import MesXslEquipmentLedgerSelectModal from './components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipInspectConfig.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipInspectConfig.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'equipmentLedgerId', nameField: 'equipmentName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerLedgerModal, { openModal: openLedgerModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -71,6 +88,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -92,7 +110,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openLedgerSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openLedgerModal(true, { equipmentLedgerId: v.equipmentLedgerId });
|
||||
}
|
||||
|
||||
function onLedgerSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
equipmentName: payload.equipmentName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
Reference in New Issue
Block a user