停机记录新增,设备管理查询条件完善
This commit is contained in:
@@ -20,7 +20,14 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '部位代码', field: 'partCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '类别名称', field: 'equipmentCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '部位名称', field: 'partName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentCategoryPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备类别"
|
||||
:show-clear="!!model.equipmentCategoryId"
|
||||
@open="openCategorySelect"
|
||||
@clear="clearModelFields(model, ['equipmentCategoryId', 'equipmentCategoryName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_part:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +56,7 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentPartModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -54,11 +65,17 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipmentPartModal from './components/MesXslEquipmentPartModal.vue';
|
||||
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentPart.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentPart.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +83,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
@@ -87,7 +105,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openCategorySelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openCategoryModal(true, { equipmentCategoryId: v.equipmentCategoryId });
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentCategoryId: payload.equipmentCategoryId || '',
|
||||
equipmentCategoryName: payload.equipmentCategoryName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
Reference in New Issue
Block a user