Merge branch 'main' of http://27.223.88.102:33000/chenx/qhmes
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only :placeholder="placeholder" style="flex: 1" />
|
||||
<a-button type="primary" @click="emit('open')">选择</a-button>
|
||||
<a-button v-if="showClear" @click="emit('clear')">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
defineProps<{
|
||||
model: Recordable;
|
||||
field: string;
|
||||
placeholder?: string;
|
||||
showClear?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{ (e: 'open'): void; (e: 'clear'): void }>();
|
||||
</script>
|
||||
@@ -44,7 +44,14 @@ export const columns: BasicColumn[] = [
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择工序"
|
||||
:show-clear="!!model.processOperationId"
|
||||
@open="openProcessSelect"
|
||||
@clear="clearModelFields(model, ['processOperationId', 'processOperationName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_main_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +56,7 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslDowntimeMainTypeModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
</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 MesXslDowntimeMainTypeModal from './components/MesXslDowntimeMainTypeModal.vue';
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslDowntimeMainType.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeMainType.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'processOperationId', nameField: 'processOperationName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = 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: 100,
|
||||
@@ -87,7 +105,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openProcessSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openProcessModal(true, { processOperationId: v.processOperationId });
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: payload.processOperationId || '',
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslDowntimeRecord/list',
|
||||
save = '/xslmes/mesXslDowntimeRecord/add',
|
||||
edit = '/xslmes/mesXslDowntimeRecord/edit',
|
||||
deleteOne = '/xslmes/mesXslDowntimeRecord/delete',
|
||||
deleteBatch = '/xslmes/mesXslDowntimeRecord/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslDowntimeRecord/importExcel',
|
||||
exportXls = '/xslmes/mesXslDowntimeRecord/exportXls',
|
||||
queryById = '/xslmes/mesXslDowntimeRecord/queryById',
|
||||
saveMaintenanceResult = '/xslmes/mesXslDowntimeRecord/saveMaintenanceResult',
|
||||
}
|
||||
|
||||
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 saveMaintenanceResult = (params) => defHttp.post({ url: Api.saveMaintenanceResult, params });
|
||||
|
||||
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 });
|
||||
};
|
||||
@@ -0,0 +1,177 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
/** 弹窗内日期时间选择:下拉挂到 body,避免被 Modal 滚动区裁剪 */
|
||||
const dateTimePickerProps = {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
style: { width: '100%' },
|
||||
getPopupContainer: () => document.body,
|
||||
};
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '机台', align: 'center', dataIndex: 'equipmentName', width: 150 },
|
||||
{ title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 130 },
|
||||
{ title: '停机原因', align: 'center', dataIndex: 'downtimeTypeName', width: 150 },
|
||||
{
|
||||
title: '开始时间',
|
||||
align: 'center',
|
||||
dataIndex: 'startTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
{
|
||||
title: '结束时间',
|
||||
align: 'center',
|
||||
dataIndex: 'endTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
{ title: '设备部位', align: 'center', dataIndex: 'equipmentPartName', width: 120 },
|
||||
{ title: '维修项目', align: 'center', dataIndex: 'inspectMaintainItemName', width: 140 },
|
||||
{ title: '维修结果', align: 'center', dataIndex: 'maintenanceResult', width: 160, ellipsis: true },
|
||||
{ title: '维修人', align: 'center', dataIndex: 'maintainerRealname', width: 100 },
|
||||
{ title: '是否已录入维修', align: 'center', dataIndex: 'maintenanceFilledFlag_dictText', width: 120 },
|
||||
{ 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: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{
|
||||
label: '机台',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'downtimeTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '停机原因',
|
||||
field: 'downtimeTypeName',
|
||||
component: 'Input',
|
||||
slot: 'downtimeTypePicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '是否已录入维修',
|
||||
field: 'maintenanceFilledFlag',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'yn' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '',
|
||||
field: 'equipmentLedgerId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
dynamicRules: () => [{ required: true, message: '请选择机台' }],
|
||||
},
|
||||
{
|
||||
label: '机台',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPicker',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'downtimeTypeId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
dynamicRules: () => [{ required: true, message: '请选择停机原因' }],
|
||||
},
|
||||
{
|
||||
label: '停机原因',
|
||||
field: 'downtimeTypeName',
|
||||
component: 'Input',
|
||||
slot: 'downtimeTypePicker',
|
||||
},
|
||||
{
|
||||
label: '开始时间',
|
||||
field: 'startTime',
|
||||
component: 'DatePicker',
|
||||
required: true,
|
||||
componentProps: { ...dateTimePickerProps, placeholder: '请选择开始时间' },
|
||||
},
|
||||
{
|
||||
label: '结束时间',
|
||||
field: 'endTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: { ...dateTimePickerProps, placeholder: '请选择结束时间' },
|
||||
},
|
||||
];
|
||||
|
||||
/** 录入维修结果弹窗 */
|
||||
export const maintenanceFormSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false },
|
||||
{ label: '', field: 'maintainerUsername', component: 'Input', show: false },
|
||||
{ label: '', field: 'maintainerRealname', component: 'Input', show: false },
|
||||
{
|
||||
label: '',
|
||||
field: 'equipmentPartId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
dynamicRules: () => [{ required: true, message: '请选择设备部位' }],
|
||||
},
|
||||
{
|
||||
label: '设备部位',
|
||||
field: 'equipmentPartName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPartPicker',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'inspectMaintainItemId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
dynamicRules: () => [{ required: true, message: '请选择维修项目' }],
|
||||
},
|
||||
{
|
||||
label: '维修项目',
|
||||
field: 'inspectMaintainItemName',
|
||||
component: 'Input',
|
||||
slot: 'inspectItemPicker',
|
||||
},
|
||||
{
|
||||
label: '维修结果',
|
||||
field: 'maintenanceResult',
|
||||
component: 'InputTextArea',
|
||||
required: true,
|
||||
componentProps: { rows: 3, placeholder: '手输维修结果' },
|
||||
},
|
||||
{
|
||||
label: '维修人',
|
||||
field: 'maintainerUserId',
|
||||
component: 'JSelectUser',
|
||||
required: true,
|
||||
componentProps: ({ formActionType }) => ({
|
||||
rowKey: 'id',
|
||||
labelKey: 'realname',
|
||||
isRadioSelection: true,
|
||||
maxSelectCount: 1,
|
||||
onOptionsChange: (options) => {
|
||||
const row = options?.[0];
|
||||
if (row && formActionType) {
|
||||
formActionType.setFieldsValue({
|
||||
maintainerUsername: row.username,
|
||||
maintainerRealname: row.realname,
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备"
|
||||
:show-clear="!!model.equipmentLedgerId"
|
||||
@open="openEquipmentSelect"
|
||||
@clear="clearModelFields(model, ['equipmentLedgerId', 'equipmentName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #form-downtimeTypePicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择停机类型"
|
||||
:show-clear="!!model.downtimeTypeId"
|
||||
@open="openDowntimeTypeSelect"
|
||||
@clear="clearModelFields(model, ['downtimeTypeId', 'downtimeTypeName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_record:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_downtime_record:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_downtime_record: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_downtime_record:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableActions(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslDowntimeRecordModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslDowntimeRecordMaintenanceModal @register="registerMaintenanceModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerEquipmentModal" @select="onEquipmentSelect" />
|
||||
<MesXslDowntimeTypeSelectModal @register="registerDowntimeTypeModal" @select="onDowntimeTypeSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslDowntimeRecord" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslDowntimeRecordModal from './components/MesXslDowntimeRecordModal.vue';
|
||||
import MesXslDowntimeRecordMaintenanceModal from './components/MesXslDowntimeRecordMaintenanceModal.vue';
|
||||
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
import MesXslDowntimeTypeSelectModal from './components/MesXslDowntimeTypeSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslDowntimeRecord.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeRecord.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'equipmentLedgerId', nameField: 'equipmentName' },
|
||||
{ idField: 'downtimeTypeId', nameField: 'downtimeTypeName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerMaintenanceModal, { openModal: openMaintenanceModal }] = useModal();
|
||||
const [registerEquipmentModal, { openModal: openEquipmentModal }] = useModal();
|
||||
const [registerDowntimeTypeModal, { openModal: openDowntimeTypeModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '停机记录',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 260,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '停机记录',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openEquipmentSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openEquipmentModal(true, { equipmentLedgerId: v.equipmentLedgerId });
|
||||
}
|
||||
|
||||
function onEquipmentSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
equipmentName: payload.equipmentName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openDowntimeTypeSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openDowntimeTypeModal(true, { downtimeTypeId: v.downtimeTypeId });
|
||||
}
|
||||
|
||||
function onDowntimeTypeSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
downtimeTypeId: payload.downtimeTypeId || '',
|
||||
downtimeTypeName: payload.downtimeTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
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 handleEnterMaintenance(record: Recordable) {
|
||||
openMaintenanceModal(true, { record });
|
||||
}
|
||||
|
||||
function getTableActions(record: Recordable) {
|
||||
return [
|
||||
{
|
||||
label: '录入维修结果',
|
||||
onClick: handleEnterMaintenance.bind(null, record),
|
||||
auth: 'mes:mes_xsl_downtime_record:edit',
|
||||
},
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_downtime_record:edit' },
|
||||
];
|
||||
}
|
||||
|
||||
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_downtime_record:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" destroyOnClose title="录入维修结果" width="640px" @register="registerModal" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #equipmentPartPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择设备部位(非小部位)" style="flex: 1" />
|
||||
<a-button type="primary" @click="openPartSelect">选择部位</a-button>
|
||||
<a-button v-if="model.equipmentPartId" @click="clearPart">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #inspectItemPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请先选部位,再选点检项目" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="!model.equipmentPartId" @click="openItemSelect">选择项目</a-button>
|
||||
<a-button v-if="model.inspectMaintainItemId" @click="clearItem">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesXslEquipmentPartSelectModal @register="registerPartModal" @select="onPartSelect" />
|
||||
<MesXslInspectMaintainItemSelectModal @register="registerItemModal" @select="onItemSelect" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { maintenanceFormSchema } from '../MesXslDowntimeRecord.data';
|
||||
import { saveMaintenanceResult } from '../MesXslDowntimeRecord.api';
|
||||
import { queryById as queryEquipmentById } from '/@/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.api';
|
||||
import MesXslEquipmentPartSelectModal from '/@/views/xslmes/mesXslEquipmentSubPart/components/MesXslEquipmentPartSelectModal.vue';
|
||||
import MesXslInspectMaintainItemSelectModal from './MesXslInspectMaintainItemSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const [registerPartModal, { openModal: openPartModal }] = useModal();
|
||||
const [registerItemModal, { openModal: openItemModal }] = useModal();
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, getFieldsValue }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: maintenanceFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false });
|
||||
const record = data?.record;
|
||||
if (!record?.id) {
|
||||
return;
|
||||
}
|
||||
let equipmentCategoryId = '';
|
||||
let equipmentTypeId = '';
|
||||
if (record.equipmentLedgerId) {
|
||||
try {
|
||||
const raw = await queryEquipmentById({ id: record.equipmentLedgerId });
|
||||
const ledger = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
equipmentCategoryId = ledger?.equipmentCategoryId || '';
|
||||
equipmentTypeId = ledger?.equipmentTypeId || '';
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
await setFieldsValue({
|
||||
id: record.id,
|
||||
equipmentLedgerId: record.equipmentLedgerId,
|
||||
equipmentCategoryId,
|
||||
equipmentTypeId,
|
||||
equipmentPartId: record.equipmentPartId,
|
||||
equipmentPartName: record.equipmentPartName,
|
||||
inspectMaintainItemId: record.inspectMaintainItemId,
|
||||
inspectMaintainItemName: record.inspectMaintainItemName,
|
||||
maintenanceResult: record.maintenanceResult,
|
||||
maintainerUserId: record.maintainerUserId,
|
||||
maintainerUsername: record.maintainerUsername,
|
||||
maintainerRealname: record.maintainerRealname,
|
||||
});
|
||||
});
|
||||
|
||||
function openPartSelect() {
|
||||
const vals = getFieldsValue();
|
||||
if (!vals.equipmentCategoryId) {
|
||||
createMessage.warning('无法获取设备类别,请确认停机记录已关联有效设备');
|
||||
return;
|
||||
}
|
||||
openPartModal(true, {
|
||||
equipmentCategoryId: vals.equipmentCategoryId,
|
||||
equipmentPartId: vals.equipmentPartId,
|
||||
});
|
||||
}
|
||||
|
||||
function clearPart() {
|
||||
setFieldsValue({
|
||||
equipmentPartId: '',
|
||||
equipmentPartName: '',
|
||||
inspectMaintainItemId: '',
|
||||
inspectMaintainItemName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function onPartSelect(payload: { equipmentPartId?: string; equipmentPartName?: string }) {
|
||||
const vals = getFieldsValue();
|
||||
const pid = payload.equipmentPartId || '';
|
||||
if (vals.inspectMaintainItemId && vals.equipmentPartId && vals.equipmentPartId !== pid) {
|
||||
setFieldsValue({
|
||||
equipmentPartId: pid,
|
||||
equipmentPartName: payload.equipmentPartName || '',
|
||||
inspectMaintainItemId: '',
|
||||
inspectMaintainItemName: '',
|
||||
});
|
||||
} else {
|
||||
setFieldsValue({
|
||||
equipmentPartId: pid,
|
||||
equipmentPartName: payload.equipmentPartName || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openItemSelect() {
|
||||
const vals = getFieldsValue();
|
||||
if (!vals.equipmentPartId) {
|
||||
createMessage.warning('请先选择设备部位');
|
||||
return;
|
||||
}
|
||||
openItemModal(true, {
|
||||
equipmentPartId: vals.equipmentPartId,
|
||||
equipmentTypeId: vals.equipmentTypeId,
|
||||
inspectMaintainItemId: vals.inspectMaintainItemId,
|
||||
});
|
||||
}
|
||||
|
||||
function clearItem() {
|
||||
setFieldsValue({ inspectMaintainItemId: '', inspectMaintainItemName: '' });
|
||||
}
|
||||
|
||||
function onItemSelect(payload: { inspectMaintainItemId?: string; inspectMaintainItemName?: string }) {
|
||||
setFieldsValue({
|
||||
inspectMaintainItemId: payload.inspectMaintainItemId || '',
|
||||
inspectMaintainItemName: payload.inspectMaintainItemName || '',
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values.maintainerUserId) {
|
||||
createMessage.warning('请选择维修人');
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveMaintenanceResult(values);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<BasicModal @register="registerModal" :title="title" width="720" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #equipmentPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择设备" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openEquipmentSelect">选择设备</a-button>
|
||||
<a-button v-if="model.equipmentLedgerId && !isDetail" @click="clearEquipment">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #downtimeTypePicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择停机类型" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openDowntimeTypeSelect">选择停机类型</a-button>
|
||||
<a-button v-if="model.downtimeTypeId && !isDetail" @click="clearDowntimeType">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerEquipmentModal" @select="onEquipmentSelect" />
|
||||
<MesXslDowntimeTypeSelectModal @register="registerDowntimeTypeModal" @select="onDowntimeTypeSelect" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslDowntimeRecord.data';
|
||||
import { saveOrUpdate } from '../MesXslDowntimeRecord.api';
|
||||
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
import MesXslDowntimeTypeSelectModal from './MesXslDowntimeTypeSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerEquipmentModal, { openModal: openEquipmentModal }] = useModal();
|
||||
const [registerDowntimeTypeModal, { openModal: openDowntimeTypeModal }] = useModal();
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 110,
|
||||
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 {
|
||||
await setFieldsValue({ startTime: dayjs().format('YYYY-MM-DD HH:mm:ss') });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增停机记录' : unref(isDetail) ? '停机记录详情' : '编辑停机记录',
|
||||
);
|
||||
|
||||
function openEquipmentSelect() {
|
||||
const vals = getFieldsValue();
|
||||
openEquipmentModal(true, { equipmentLedgerId: vals.equipmentLedgerId });
|
||||
}
|
||||
|
||||
function clearEquipment() {
|
||||
setFieldsValue({ equipmentLedgerId: '', equipmentName: '', equipmentCode: '' });
|
||||
}
|
||||
|
||||
function onEquipmentSelect(payload: { equipmentLedgerId?: string; equipmentName?: string; equipmentCode?: string }) {
|
||||
setFieldsValue({
|
||||
equipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
equipmentName: payload.equipmentName || '',
|
||||
equipmentCode: payload.equipmentCode || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openDowntimeTypeSelect() {
|
||||
const vals = getFieldsValue();
|
||||
openDowntimeTypeModal(true, { downtimeTypeId: vals.downtimeTypeId });
|
||||
}
|
||||
|
||||
function clearDowntimeType() {
|
||||
setFieldsValue({ downtimeTypeId: '', downtimeTypeName: '' });
|
||||
}
|
||||
|
||||
function onDowntimeTypeSelect(payload: { downtimeTypeId?: string; downtimeTypeName?: string }) {
|
||||
setFieldsValue({
|
||||
downtimeTypeId: payload.downtimeTypeId || '',
|
||||
downtimeTypeName: payload.downtimeTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" title="选择停机类型" :width="1000" @register="registerModal" @ok="handleOk">
|
||||
<BasicTable @register="registerTable" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
import { list, queryById } from '/@/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.api';
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
const selectedRow = ref<Recordable | null>(null);
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
selectedRow.value = rows?.[0] ?? null;
|
||||
}
|
||||
|
||||
function fetchTypePage(params: Recordable) {
|
||||
return list({ ...params, status: '0' });
|
||||
}
|
||||
|
||||
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
|
||||
api: fetchTypePage,
|
||||
columns: [
|
||||
{ title: '工序名称', dataIndex: 'processOperationName', width: 140 },
|
||||
{ title: '所属主类型', dataIndex: 'downtimeMainTypeName', width: 140 },
|
||||
{ title: '停机类型', dataIndex: 'downtimeType', width: 160 },
|
||||
{ title: '故障等级', dataIndex: 'faultLevel', width: 100 },
|
||||
],
|
||||
rowKey: 'id',
|
||||
useSearchForm: true,
|
||||
formConfig: {
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 8 } },
|
||||
],
|
||||
},
|
||||
pagination: { pageSize: 10 },
|
||||
canResize: false,
|
||||
showIndexColumn: false,
|
||||
immediate: true,
|
||||
rowSelection: {
|
||||
type: 'radio',
|
||||
columnWidth: 48,
|
||||
onChange: handleSelectionChange,
|
||||
},
|
||||
clickToRowSelect: true,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
selectedRow.value = null;
|
||||
clearSelectedRowKeys?.();
|
||||
setModalProps({ confirmLoading: false });
|
||||
const tid = data?.downtimeTypeId as string | undefined;
|
||||
if (tid) {
|
||||
setSelectedRowKeys?.([tid]);
|
||||
try {
|
||||
const raw = await queryById({ id: tid });
|
||||
const row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
if (row) {
|
||||
selectedRow.value = row;
|
||||
}
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
reload();
|
||||
});
|
||||
|
||||
async function handleOk() {
|
||||
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||
if (!row && keys.length) {
|
||||
try {
|
||||
const raw = await queryById({ id: keys[0] });
|
||||
row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
if (!row?.id) {
|
||||
emit('select', { downtimeTypeId: '', downtimeTypeName: '' });
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
emit('select', {
|
||||
downtimeTypeId: row.id,
|
||||
downtimeTypeName: row.downtimeType || '',
|
||||
});
|
||||
closeModal();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" title="选择维修项目" :width="1000" @register="registerModal" @ok="handleOk">
|
||||
<BasicTable @register="registerTable" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
import { list, queryById } from '/@/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItem.api';
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
const selectedRow = ref<Recordable | null>(null);
|
||||
const filterEquipmentPartId = ref('');
|
||||
const filterEquipmentTypeId = ref('');
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
selectedRow.value = rows?.[0] ?? null;
|
||||
}
|
||||
|
||||
function fetchItemPage(params: Recordable) {
|
||||
const p: Recordable = { ...params };
|
||||
if (filterEquipmentPartId.value) {
|
||||
p.equipmentPartId = filterEquipmentPartId.value;
|
||||
}
|
||||
if (filterEquipmentTypeId.value) {
|
||||
p.equipmentTypeId = filterEquipmentTypeId.value;
|
||||
}
|
||||
return list(p);
|
||||
}
|
||||
|
||||
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
|
||||
api: fetchItemPage,
|
||||
columns: [
|
||||
{ title: '项目编号', dataIndex: 'itemCode', width: 120 },
|
||||
{ title: '项目名称', dataIndex: 'itemName', width: 140 },
|
||||
{ title: '项目类别', dataIndex: 'itemCategory_dictText', width: 90 },
|
||||
{ title: '设备部位', dataIndex: 'equipmentPartName', width: 120 },
|
||||
{ title: '设备小部位', dataIndex: 'equipmentSubPartName', width: 120 },
|
||||
{ title: '点检方式', dataIndex: 'inspectMethod_dictText', width: 90 },
|
||||
{ title: '判断基准', dataIndex: 'judgmentCriteria', width: 160, ellipsis: true },
|
||||
],
|
||||
rowKey: 'id',
|
||||
useSearchForm: true,
|
||||
formConfig: {
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{ label: '项目编号', field: 'itemCode', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '项目名称', field: 'itemName', component: 'Input', colProps: { span: 8 } },
|
||||
{
|
||||
label: '项目类别',
|
||||
field: 'itemCategory',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_im_item_category', placeholder: '点检/保养' },
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
],
|
||||
},
|
||||
pagination: { pageSize: 10 },
|
||||
canResize: false,
|
||||
showIndexColumn: false,
|
||||
immediate: true,
|
||||
rowSelection: {
|
||||
type: 'radio',
|
||||
columnWidth: 48,
|
||||
onChange: handleSelectionChange,
|
||||
},
|
||||
clickToRowSelect: true,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
filterEquipmentPartId.value = data?.equipmentPartId ? String(data.equipmentPartId) : '';
|
||||
filterEquipmentTypeId.value = data?.equipmentTypeId ? String(data.equipmentTypeId) : '';
|
||||
selectedRow.value = null;
|
||||
clearSelectedRowKeys?.();
|
||||
setModalProps({ confirmLoading: false });
|
||||
const iid = data?.inspectMaintainItemId as string | undefined;
|
||||
if (iid) {
|
||||
setSelectedRowKeys?.([iid]);
|
||||
try {
|
||||
const raw = await queryById({ id: iid });
|
||||
const row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
if (row) {
|
||||
selectedRow.value = row;
|
||||
}
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
reload();
|
||||
});
|
||||
|
||||
async function handleOk() {
|
||||
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||
if (!row && keys.length) {
|
||||
try {
|
||||
const raw = await queryById({ id: keys[0] });
|
||||
row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
if (!row?.id) {
|
||||
emit('select', { inspectMaintainItemId: '', inspectMaintainItemName: '' });
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
emit('select', {
|
||||
inspectMaintainItemId: row.id,
|
||||
inspectMaintainItemName: row.itemName || '',
|
||||
});
|
||||
closeModal();
|
||||
}
|
||||
</script>
|
||||
@@ -47,8 +47,22 @@ export const columns: BasicColumn[] = [
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '主类型', field: 'downtimeMainTypeName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'downtimeMainTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属主类型',
|
||||
field: 'downtimeMainTypeName',
|
||||
component: 'Input',
|
||||
slot: 'downtimeMainTypePicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择工序"
|
||||
:show-clear="!!model.processOperationId"
|
||||
@open="openProcessSelect"
|
||||
@clear="clearProcess(model)"
|
||||
/>
|
||||
</template>
|
||||
<template #form-downtimeMainTypePicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请先选工序,再选主类型"
|
||||
:show-clear="!!model.downtimeMainTypeId"
|
||||
@open="openMainTypeSelect"
|
||||
@clear="clearModelFields(model, ['downtimeMainTypeId', 'downtimeMainTypeName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +66,8 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslDowntimeTypeModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
<MesXslDowntimeMainTypeSelectModal @register="registerMainTypeModal" @select="onMainTypeSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -53,12 +75,26 @@
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslDowntimeTypeModal from './components/MesXslDowntimeTypeModal.vue';
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
import MesXslDowntimeMainTypeSelectModal from './components/MesXslDowntimeMainTypeSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslDowntimeType.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeType.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'processOperationId', nameField: 'processOperationName' },
|
||||
{ idField: 'downtimeMainTypeId', nameField: 'downtimeMainTypeName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
const [registerMainTypeModal, { openModal: openMainTypeModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +102,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -87,7 +124,58 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openProcessSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openProcessModal(true, { processOperationId: v.processOperationId });
|
||||
}
|
||||
|
||||
function clearProcess(model: Recordable) {
|
||||
clearModelFields(model, [
|
||||
'processOperationId',
|
||||
'processOperationName',
|
||||
'downtimeMainTypeId',
|
||||
'downtimeMainTypeName',
|
||||
]);
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: Recordable) {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
const pid = payload.processOperationId || '';
|
||||
if (v.downtimeMainTypeId && v.processOperationId && v.processOperationId !== pid) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: pid,
|
||||
processOperationName: payload.processOperationName || '',
|
||||
downtimeMainTypeId: '',
|
||||
downtimeMainTypeName: '',
|
||||
});
|
||||
} else {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: pid,
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openMainTypeSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.processOperationId) {
|
||||
createMessage.warning('请先选择所属工序');
|
||||
return;
|
||||
}
|
||||
openMainTypeModal(true, {
|
||||
processOperationId: v.processOperationId,
|
||||
downtimeMainTypeId: v.downtimeMainTypeId,
|
||||
});
|
||||
}
|
||||
|
||||
function onMainTypeSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
downtimeMainTypeId: payload.downtimeMainTypeId || '',
|
||||
downtimeMainTypeName: payload.downtimeMainTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -25,7 +25,14 @@ export const columns: BasicColumn[] = [
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '记录编号', field: 'recordNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '计划单号', field: 'planNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ 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: 'recordType',
|
||||
|
||||
@@ -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"
|
||||
@@ -31,6 +41,7 @@
|
||||
</BasicTable>
|
||||
<MesXslEquipInspectRecordModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipInspectRecordHandleModal @register="registerHandleModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerLedgerModal" @select="onLedgerSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -40,15 +51,21 @@
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipInspectRecordModal from './components/MesXslEquipInspectRecordModal.vue';
|
||||
import MesXslEquipInspectRecordHandleModal from './components/MesXslEquipInspectRecordHandleModal.vue';
|
||||
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipInspectRecord.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl } from './MesXslEquipInspectRecord.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'equipmentLedgerId', nameField: 'equipmentName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerHandleModal, { openModal: openHandleModal }] = useModal();
|
||||
const [registerLedgerModal, { openModal: openLedgerModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -56,6 +73,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -73,7 +91,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 handleEnterResult(record: Recordable) {
|
||||
if (record.recordStatus !== 'pending') {
|
||||
|
||||
@@ -19,7 +19,14 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '类别名称', field: 'categoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '点检区分',
|
||||
field: 'inspectDistinct',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择工序"
|
||||
:show-clear="!!model.processOperationId"
|
||||
@open="openProcessSelect"
|
||||
@clear="clearModelFields(model, ['processOperationId', 'processOperationName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_category:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +56,7 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentCategoryModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
</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 MesXslEquipmentCategoryModal from './components/MesXslEquipmentCategoryModal.vue';
|
||||
import MesXslProcessOperationSelectModal from './components/MesXslProcessOperationSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentCategory.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentCategory.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'processOperationId', nameField: 'processOperationName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = 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 openProcessSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openProcessModal(true, { processOperationId: v.processOperationId });
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: payload.processOperationId || '',
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -20,7 +20,14 @@ export const columns: BasicColumn[] = [
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '设备状态',
|
||||
field: 'equipmentStatus',
|
||||
@@ -35,6 +42,38 @@ export const searchFormSchema: FormSchema[] = [
|
||||
componentProps: { dictCode: 'yn' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'manufacturerId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备厂家',
|
||||
field: 'manufacturerName',
|
||||
component: 'Input',
|
||||
slot: 'manufacturerPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备类型',
|
||||
field: 'equipmentTypeName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentTypePicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'factoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工厂',
|
||||
field: 'factoryName',
|
||||
component: 'Input',
|
||||
slot: 'factoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
|
||||
@@ -1,189 +1,331 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_ledger:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:audit-outlined"
|
||||
@click="handleBatchCreateRecord('inspect')"
|
||||
>
|
||||
点检
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:tool-outlined"
|
||||
@click="handleBatchCreateRecord('maintain')"
|
||||
>
|
||||
保养
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equipment_ledger:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equipment_ledger: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_equipment_ledger: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_equipment_ledger:edit' },
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentLedgerModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslEquipmentLedger" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslEquipmentLedgerModal from './components/MesXslEquipmentLedgerModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentLedger.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentLedger.api';
|
||||
import { batchCreateFromEquipment } from '../mesXslEquipInspectRecord/MesXslEquipInspectRecord.api';
|
||||
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
|
||||
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: {
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '设备台账',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload, getSelectRows }, { 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 });
|
||||
}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
function batchHandleDelete() {
|
||||
batchDelete({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
|
||||
function handleBatchCreateRecord(recordType: 'inspect' | 'maintain') {
|
||||
const rows = (getSelectRows?.() || []) as Recordable[];
|
||||
if (!rows.length) {
|
||||
createMessage.warning('请先勾选设备');
|
||||
return;
|
||||
}
|
||||
const ids = rows.map((r) => r.id).filter(Boolean);
|
||||
const typeLabel = recordType === 'inspect' ? '点检' : '保养';
|
||||
createConfirm({
|
||||
iconType: 'info',
|
||||
title: `生成${typeLabel}记录`,
|
||||
content: `确定为选中的 ${ids.length} 台设备各生成一条${typeLabel}记录?`,
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
try {
|
||||
const res = await batchCreateFromEquipment({ equipmentLedgerIds: ids, recordType });
|
||||
const data = (res as any)?.result ?? res;
|
||||
const failList: string[] = data?.failMessages || [];
|
||||
const successCount = data?.successCount ?? 0;
|
||||
if (successCount > 0 && !failList.length) {
|
||||
createMessage.success(`成功生成 ${successCount} 条${typeLabel}记录`);
|
||||
handleSuccess();
|
||||
} else if (successCount > 0 && failList.length) {
|
||||
createMessage.warning(`成功生成 ${successCount} 条;未生成:${failList.join(';')}`);
|
||||
handleSuccess();
|
||||
} else if (failList.length) {
|
||||
createMessage.warning(failList.join(';'));
|
||||
} else {
|
||||
createMessage.warning((res as any)?.message || `未生成任何${typeLabel}记录`);
|
||||
}
|
||||
} catch (e: any) {
|
||||
const errMsg =
|
||||
e?.response?.data?.message || e?.message || `生成${typeLabel}记录失败`;
|
||||
createMessage.warning(errMsg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function getDropDownAction(record: Recordable) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_equipment_ledger:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择工序"
|
||||
|
||||
:show-clear="!!model.processOperationId"
|
||||
|
||||
@open="openProcessSelect"
|
||||
|
||||
@clear="clearModelFields(model, ['processOperationId', 'processOperationName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #form-manufacturerPicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择设备厂家"
|
||||
|
||||
:show-clear="!!model.manufacturerId"
|
||||
|
||||
@open="openManufacturerSelect('manufacturer')"
|
||||
|
||||
@clear="clearModelFields(model, ['manufacturerId', 'manufacturerName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #form-equipmentCategoryPicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择设备类别"
|
||||
|
||||
:show-clear="!!model.equipmentCategoryId"
|
||||
|
||||
@open="openCategorySelect"
|
||||
|
||||
@clear="clearModelFields(model, ['equipmentCategoryId', 'equipmentCategoryName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #form-equipmentTypePicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择设备类型"
|
||||
|
||||
:show-clear="!!model.equipmentTypeId"
|
||||
|
||||
@open="openTypeSelect"
|
||||
|
||||
@clear="clearModelFields(model, ['equipmentTypeId', 'equipmentTypeName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #form-factoryPicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择所属工厂"
|
||||
|
||||
:show-clear="!!model.factoryId"
|
||||
|
||||
@open="openManufacturerSelect('factory')"
|
||||
|
||||
@clear="clearModelFields(model, ['factoryId', 'factoryName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #tableTitle>
|
||||
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_ledger:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
|
||||
新增
|
||||
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
|
||||
preIcon="ant-design:audit-outlined"
|
||||
|
||||
@click="handleBatchCreateRecord('inspect')"
|
||||
|
||||
>
|
||||
|
||||
点检
|
||||
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
|
||||
preIcon="ant-design:tool-outlined"
|
||||
|
||||
@click="handleBatchCreateRecord('maintain')"
|
||||
|
||||
>
|
||||
|
||||
保养
|
||||
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_equipment_ledger:exportXls'"
|
||||
|
||||
preIcon="ant-design:export-outlined"
|
||||
|
||||
@click="onExportXls"
|
||||
|
||||
>
|
||||
|
||||
导出
|
||||
|
||||
</a-button>
|
||||
|
||||
<j-upload-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_equipment_ledger: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_equipment_ledger: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_equipment_ledger:edit' },
|
||||
|
||||
]"
|
||||
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
</BasicTable>
|
||||
|
||||
<MesXslEquipmentLedgerModal @register="registerModal" @success="handleSuccess" />
|
||||
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSearchSelect" />
|
||||
|
||||
<MesXslManufacturerSelectModal
|
||||
|
||||
@register="registerManufacturerModal"
|
||||
|
||||
:modal-title="manufacturerModalTitle"
|
||||
|
||||
@select="onManufacturerSearchSelect"
|
||||
|
||||
/>
|
||||
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySearchSelect" />
|
||||
|
||||
<MesXslEquipmentTypeSelectModal @register="registerTypeModal" @select="onTypeSearchSelect" />
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslEquipmentLedger" setup>
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
|
||||
import { useModal } from '/@/components/Modal';
|
||||
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
import Icon from '/@/components/Icon';
|
||||
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
|
||||
import MesXslEquipmentLedgerModal from './components/MesXslEquipmentLedgerModal.vue';
|
||||
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
|
||||
import MesXslManufacturerSelectModal from './components/MesXslManufacturerSelectModal.vue';
|
||||
|
||||
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
|
||||
|
||||
import MesXslEquipmentTypeSelectModal from './components/MesXslEquipmentTypeSelectModal.vue';
|
||||
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentLedger.data';
|
||||
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentLedger.api';
|
||||
|
||||
import { batchCreateFromEquipment } from '../mesXslEquipInspectRecord/MesXslEquipInspectRecord.api';
|
||||
|
||||
|
||||
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
|
||||
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
|
||||
{ idField: 'processOperationId', nameField: 'processOperationName' },
|
||||
|
||||
{ idField: 'manufacturerId', nameField: 'manufacturerName' },
|
||||
|
||||
{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' },
|
||||
|
||||
{ idField: 'equipmentTypeId', nameField: 'equipmentTypeName' },
|
||||
|
||||
{ idField: 'factoryId', nameField: 'factoryName' },
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
const manufacturerPickTarget = ref<'manufacturer' | 'factory'>('manufacturer');
|
||||
|
||||
|
||||
|
||||
const manufacturerModalTitle = computed(() =>
|
||||
|
||||
manufacturerPickTarget.value === 'factory' ? '选择所属工厂' : '选择设备厂家',
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
|
||||
const [registerManufacturerModal, { openModal: openManufacturerModal }] = useModal();
|
||||
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
|
||||
const [registerTypeModal, { openModal: openTypeModal }] = useModal();
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -21,8 +21,22 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '小部位代码', field: 'subPartCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '类别名称', field: 'equipmentCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '大部位名称', field: 'equipmentPartName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentPartId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属大部位',
|
||||
field: 'equipmentPartName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPartPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '小部位名称', field: 'subPartName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<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="clearCategory(model)"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentPartPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备大部位"
|
||||
:show-clear="!!model.equipmentPartId"
|
||||
@open="openPartSelect"
|
||||
@clear="clearModelFields(model, ['equipmentPartId', 'equipmentPartName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_sub_part:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +66,8 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentSubPartModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
<MesXslEquipmentPartSelectModal @register="registerPartModal" @select="onPartSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -53,12 +75,26 @@
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipmentSubPartModal from './components/MesXslEquipmentSubPartModal.vue';
|
||||
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
|
||||
import MesXslEquipmentPartSelectModal from './components/MesXslEquipmentPartSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentSubPart.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentSubPart.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' },
|
||||
{ idField: 'equipmentPartId', nameField: 'equipmentPartName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
const [registerPartModal, { openModal: openPartModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +102,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
@@ -87,7 +124,44 @@
|
||||
},
|
||||
});
|
||||
|
||||
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 clearCategory(model: Recordable) {
|
||||
clearModelFields(model, ['equipmentCategoryId', 'equipmentCategoryName', 'equipmentPartId', 'equipmentPartName']);
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentCategoryId: payload.equipmentCategoryId || '',
|
||||
equipmentCategoryName: payload.equipmentCategoryName || '',
|
||||
equipmentPartId: '',
|
||||
equipmentPartName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function openPartSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.equipmentCategoryId) {
|
||||
createMessage.warning('请先选择所属设备类别');
|
||||
return;
|
||||
}
|
||||
openPartModal(true, {
|
||||
equipmentCategoryId: v.equipmentCategoryId,
|
||||
equipmentPartId: v.equipmentPartId,
|
||||
});
|
||||
}
|
||||
|
||||
function onPartSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentPartId: payload.equipmentPartId || '',
|
||||
equipmentPartName: payload.equipmentPartName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -18,8 +18,22 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '类型名称', field: 'typeName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '类别名称', field: 'equipmentCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择工序"
|
||||
:show-clear="!!model.processOperationId"
|
||||
@open="openProcessSelect"
|
||||
@clear="clearModelFields(model, ['processOperationId', 'processOperationName'])"
|
||||
/>
|
||||
</template>
|
||||
<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_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +66,8 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentTypeModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -54,11 +76,22 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipmentTypeModal from './components/MesXslEquipmentTypeModal.vue';
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
import MesXslEquipmentCategorySelectModal from './components/MesXslEquipmentCategorySelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentType.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentType.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'processOperationId', nameField: 'processOperationName' },
|
||||
{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +99,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
@@ -87,7 +121,31 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openProcessSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openProcessModal(true, { processOperationId: v.processOperationId });
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: payload.processOperationId || '',
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
|
||||
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 });
|
||||
|
||||
@@ -26,7 +26,38 @@ export const columns: BasicColumn[] = [
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '项目名称', field: 'itemName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '项目编号', field: 'itemCode', 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: 'equipmentTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备类型',
|
||||
field: 'equipmentTypeName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentTypePicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentPartId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备部位',
|
||||
field: 'equipmentPartName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPartPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentSubPartId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备小部位',
|
||||
field: 'equipmentSubPartName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentSubPartPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '项目类别',
|
||||
field: 'itemCategory',
|
||||
|
||||
@@ -1,6 +1,46 @@
|
||||
<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="clearCategory(model)"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentTypePicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请先选类别,再选类型"
|
||||
:show-clear="!!model.equipmentTypeId"
|
||||
@open="openTypeSelect"
|
||||
@clear="clearModelFields(model, ['equipmentTypeId', 'equipmentTypeName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentPartPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请先选类别,再选部位"
|
||||
:show-clear="!!model.equipmentPartId"
|
||||
@open="openPartSelect"
|
||||
@clear="clearPart(model)"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentSubPartPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请先选类别与部位,再选小部位"
|
||||
:show-clear="!!model.equipmentSubPartId"
|
||||
@open="openSubPartSelect"
|
||||
@clear="clearModelFields(model, ['equipmentSubPartId', 'equipmentSubPartName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
@@ -51,6 +91,10 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslInspectMaintainItemModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
<MesXslEquipmentTypeFilterSelectModal @register="registerTypeModal" @select="onTypeSelect" />
|
||||
<MesXslEquipmentPartSelectModal @register="registerPartModal" @select="onPartSelect" />
|
||||
<MesXslEquipmentSubPartFilterSelectModal @register="registerSubPartModal" @select="onSubPartSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -58,12 +102,32 @@
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslInspectMaintainItemModal from './components/MesXslInspectMaintainItemModal.vue';
|
||||
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
|
||||
import MesXslEquipmentPartSelectModal from '/@/views/xslmes/mesXslEquipmentSubPart/components/MesXslEquipmentPartSelectModal.vue';
|
||||
import MesXslEquipmentTypeFilterSelectModal from './components/MesXslEquipmentTypeFilterSelectModal.vue';
|
||||
import MesXslEquipmentSubPartFilterSelectModal from './components/MesXslEquipmentSubPartFilterSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslInspectMaintainItem.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslInspectMaintainItem.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' },
|
||||
{ idField: 'equipmentTypeId', nameField: 'equipmentTypeName' },
|
||||
{ idField: 'equipmentPartId', nameField: 'equipmentPartName' },
|
||||
{ idField: 'equipmentSubPartId', nameField: 'equipmentSubPartName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
const [registerTypeModal, { openModal: openTypeModal }] = useModal();
|
||||
const [registerPartModal, { openModal: openPartModal }] = useModal();
|
||||
const [registerSubPartModal, { openModal: openSubPartModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -71,6 +135,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -92,7 +157,106 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function clearCategory(model: Recordable) {
|
||||
clearModelFields(model, [
|
||||
'equipmentCategoryId',
|
||||
'equipmentCategoryName',
|
||||
'equipmentTypeId',
|
||||
'equipmentTypeName',
|
||||
'equipmentPartId',
|
||||
'equipmentPartName',
|
||||
'equipmentSubPartId',
|
||||
'equipmentSubPartName',
|
||||
]);
|
||||
}
|
||||
|
||||
function clearPart(model: Recordable) {
|
||||
clearModelFields(model, ['equipmentPartId', 'equipmentPartName', 'equipmentSubPartId', 'equipmentSubPartName']);
|
||||
}
|
||||
|
||||
function openCategorySelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openCategoryModal(true, { equipmentCategoryId: v.equipmentCategoryId });
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentCategoryId: payload.equipmentCategoryId || '',
|
||||
equipmentCategoryName: payload.equipmentCategoryName || '',
|
||||
equipmentTypeId: '',
|
||||
equipmentTypeName: '',
|
||||
equipmentPartId: '',
|
||||
equipmentPartName: '',
|
||||
equipmentSubPartId: '',
|
||||
equipmentSubPartName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function openTypeSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.equipmentCategoryId) {
|
||||
createMessage.warning('请先选择设备类别');
|
||||
return;
|
||||
}
|
||||
openTypeModal(true, {
|
||||
equipmentCategoryId: v.equipmentCategoryId,
|
||||
equipmentTypeId: v.equipmentTypeId,
|
||||
});
|
||||
}
|
||||
|
||||
function onTypeSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentTypeId: payload.equipmentTypeId || '',
|
||||
equipmentTypeName: payload.equipmentTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openPartSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.equipmentCategoryId) {
|
||||
createMessage.warning('请先选择设备类别');
|
||||
return;
|
||||
}
|
||||
openPartModal(true, {
|
||||
equipmentCategoryId: v.equipmentCategoryId,
|
||||
equipmentPartId: v.equipmentPartId,
|
||||
});
|
||||
}
|
||||
|
||||
function onPartSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentPartId: payload.equipmentPartId || '',
|
||||
equipmentPartName: payload.equipmentPartName || '',
|
||||
equipmentSubPartId: '',
|
||||
equipmentSubPartName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function openSubPartSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.equipmentCategoryId) {
|
||||
createMessage.warning('请先选择设备类别');
|
||||
return;
|
||||
}
|
||||
if (!v.equipmentPartId) {
|
||||
createMessage.warning('请先选择设备部位');
|
||||
return;
|
||||
}
|
||||
openSubPartModal(true, {
|
||||
equipmentCategoryId: v.equipmentCategoryId,
|
||||
equipmentPartId: v.equipmentPartId,
|
||||
equipmentSubPartId: v.equipmentSubPartId,
|
||||
});
|
||||
}
|
||||
|
||||
function onSubPartSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentSubPartId: payload.equipmentSubPartId || '',
|
||||
equipmentSubPartName: payload.equipmentSubPartName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslMixerMaterialTareStrategy/list',
|
||||
save = '/xslmes/mesXslMixerMaterialTareStrategy/add',
|
||||
edit = '/xslmes/mesXslMixerMaterialTareStrategy/edit',
|
||||
deleteOne = '/xslmes/mesXslMixerMaterialTareStrategy/delete',
|
||||
deleteBatch = '/xslmes/mesXslMixerMaterialTareStrategy/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslMixerMaterialTareStrategy/importExcel',
|
||||
exportXls = '/xslmes/mesXslMixerMaterialTareStrategy/exportXls',
|
||||
queryById = '/xslmes/mesXslMixerMaterialTareStrategy/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,153 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '密炼物料名称', align: 'center', dataIndex: 'mixerMaterialName', width: 140 },
|
||||
{ title: '供应商名称', align: 'center', dataIndex: 'supplierName', width: 140 },
|
||||
{ title: '物料规格', align: 'center', dataIndex: 'materialSpec', width: 120 },
|
||||
{ title: '包装物重量', align: 'center', dataIndex: 'tareWeight', width: 110 },
|
||||
{ title: '托盘重量', align: 'center', dataIndex: 'palletWeight', width: 100 },
|
||||
{ title: '单位', align: 'center', dataIndex: 'unitName', width: 80 },
|
||||
{ title: '生效开始日期', align: 'center', dataIndex: 'effectiveStartDate', width: 120, customRender: ({ text }) => (text ? String(text).substring(0, 10) : '') },
|
||||
{ title: '生效截止日期', align: 'center', dataIndex: 'effectiveEndDate', width: 120, customRender: ({ text }) => (text ? String(text).substring(0, 10) : '') },
|
||||
{ title: '维护人', align: 'center', dataIndex: 'maintainBy_dictText', width: 100 },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '密炼物料',
|
||||
field: 'mixerMaterialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'mes_mixer_material,material_name,id',
|
||||
placeholder: '请选择密炼物料',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '密炼物料名称', field: 'mixerMaterialName', component: 'JInput', colProps: { span: 6 } },
|
||||
{
|
||||
label: '供应商',
|
||||
field: 'supplierId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'mes_xsl_supplier,supplier_name,id',
|
||||
placeholder: '请选择供应商',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '供应商名称', field: 'supplierName', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '物料规格', field: 'materialSpec', component: 'JInput', colProps: { span: 6 } },
|
||||
{
|
||||
label: '生效日期',
|
||||
field: 'effectiveDateRange',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
placeholder: ['开始日期', '截止日期'],
|
||||
},
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '密炼物料',
|
||||
field: 'mixerMaterialName',
|
||||
component: 'Input',
|
||||
slot: 'mixerMaterialPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择密炼物料' }],
|
||||
},
|
||||
{ label: '', field: 'mixerMaterialId', component: 'Input', show: false },
|
||||
{
|
||||
label: '供应商',
|
||||
field: 'supplierName',
|
||||
component: 'Input',
|
||||
slot: 'supplierPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择供应商' }],
|
||||
},
|
||||
{ label: '', field: 'supplierId', component: 'Input', show: false },
|
||||
{
|
||||
label: '物料规格',
|
||||
field: 'materialSpec',
|
||||
component: 'Input',
|
||||
componentProps: { placeholder: '请输入物料规格', maxlength: 200 },
|
||||
helpMessage: '同一租户/供应商/密炼物料下,不同规格可分别维护;规格相同且生效日期重叠时不允许重复',
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
{
|
||||
label: '包装物重量',
|
||||
field: 'tareWeight',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 3, style: { width: '100%' }, placeholder: '请输入包装物重量' },
|
||||
dynamicRules: () => [{ required: true, message: '请填写包装物重量' }],
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
label: '托盘重量',
|
||||
field: 'palletWeight',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 3, style: { width: '100%' }, placeholder: '请输入托盘重量' },
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
label: '单位',
|
||||
field: 'unitName',
|
||||
component: 'Input',
|
||||
slot: 'unitPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择单位' }],
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{ label: '', field: 'unitId', component: 'Input', show: false },
|
||||
{
|
||||
label: '生效开始日期',
|
||||
field: 'effectiveStartDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' }, placeholder: '请选择开始日期' },
|
||||
dynamicRules: () => [{ required: true, message: '请选择生效开始日期' }],
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
label: '生效截止日期',
|
||||
field: 'effectiveEndDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' }, placeholder: '请选择截止日期' },
|
||||
dynamicRules: () => [{ required: true, message: '请选择生效截止日期' }],
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
label: '维护人',
|
||||
field: 'maintainBy',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '保存时自动带出当前登录用户' },
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
];
|
||||
|
||||
export const superQuerySchema = {
|
||||
mixerMaterialId: {
|
||||
title: '密炼物料',
|
||||
order: 0,
|
||||
view: 'sel_search',
|
||||
dictTable: 'mes_mixer_material',
|
||||
dictCode: 'id',
|
||||
dictText: 'material_name',
|
||||
},
|
||||
mixerMaterialName: { title: '密炼物料名称', order: 1, view: 'text' },
|
||||
supplierId: {
|
||||
title: '供应商',
|
||||
order: 2,
|
||||
view: 'sel_search',
|
||||
dictTable: 'mes_xsl_supplier',
|
||||
dictCode: 'id',
|
||||
dictText: 'supplier_name',
|
||||
},
|
||||
supplierName: { title: '供应商名称', order: 3, view: 'text' },
|
||||
materialSpec: { title: '物料规格', order: 4, view: 'text' },
|
||||
tareWeight: { title: '包装物重量', order: 5, view: 'number' },
|
||||
palletWeight: { title: '托盘重量', order: 6, view: 'number' },
|
||||
unitName: { title: '单位', order: 7, view: 'text' },
|
||||
effectiveStartDate: { title: '生效开始日期', order: 8, view: 'date' },
|
||||
effectiveEndDate: { title: '生效截止日期', order: 9, view: 'date' },
|
||||
maintainBy: { title: '维护人', order: 10, view: 'text' },
|
||||
};
|
||||
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_tare_strategy:add'"
|
||||
@click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_tare_strategy:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_tare_strategy: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_tare_strategy: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_tare_strategy:edit',
|
||||
},
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslMixerMaterialTareStrategyModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslMixerMaterialTareStrategy" 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 MesXslMixerMaterialTareStrategyModal from './components/MesXslMixerMaterialTareStrategyModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema } from './MesXslMixerMaterialTareStrategy.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslMixerMaterialTareStrategy.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,
|
||||
fieldMapToTime: [['effectiveDateRange', ['effectiveEndDate_begin', 'effectiveStartDate_end'], 'YYYY-MM-DD']],
|
||||
},
|
||||
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_tare_strategy:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,199 @@
|
||||
<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">选择</a-button>
|
||||
<a-button v-if="model.mixerMaterialId && !isDetail" @click="clearMixer(model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #supplierPicker="{ model }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input
|
||||
v-model:value="model.supplierName"
|
||||
read-only
|
||||
placeholder="请点击选择供应商"
|
||||
style="flex: 1"
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
<a-button type="primary" :disabled="isDetail" @click="openSupplierSelect">选择</a-button>
|
||||
<a-button v-if="model.supplierId && !isDetail" @click="clearSupplier(model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #unitPicker="{ model }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input
|
||||
v-model:value="model.unitName"
|
||||
read-only
|
||||
placeholder="请点击选择单位"
|
||||
style="flex: 1"
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
<a-button type="primary" :disabled="isDetail" @click="openUnitSelect">选择</a-button>
|
||||
<a-button v-if="model.unitId && !isDetail" @click="clearUnit(model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesMixerMaterialSelectModal @register="registerMixerModal" @select="onMixerSelect" />
|
||||
<MesXslSupplierSelectModal @register="registerSupplierModal" @select="onSupplierSelect" />
|
||||
<MesXslUnitSelectModal @register="registerUnitModal" @select="onUnitSelect" />
|
||||
</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 { useUserStore } from '/@/store/modules/user';
|
||||
import MesMixerMaterialSelectModal from '/@/views/mes/material/modules/MesMixerMaterialSelectModal.vue';
|
||||
import MesXslSupplierSelectModal from '/@/views/xslmes/mesXslVehicle/components/MesXslSupplierSelectModal.vue';
|
||||
import MesXslUnitSelectModal from '/@/views/xslmes/mesXslVehicle/components/MesXslUnitSelectModal.vue';
|
||||
import { formSchema } from '../MesXslMixerMaterialTareStrategy.data';
|
||||
import { saveOrUpdate } from '../MesXslMixerMaterialTareStrategy.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const userStore = useUserStore();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
||||
labelWidth: 130,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const [registerMixerModal, { openModal: openMixerModal }] = useModal();
|
||||
const [registerSupplierModal, { openModal: openSupplierModal }] = useModal();
|
||||
const [registerUnitModal, { openModal: openUnitModal }] = 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 });
|
||||
} else {
|
||||
await setFieldsValue({ maintainBy: userStore.getUserInfo?.username || '' });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : unref(isDetail) ? '详情' : '编辑'));
|
||||
|
||||
function openMixerSelect() {
|
||||
openMixerModal(true, {});
|
||||
}
|
||||
|
||||
function onMixerSelect(payload: Recordable | null) {
|
||||
if (!payload) {
|
||||
return;
|
||||
}
|
||||
setFieldsValue({
|
||||
mixerMaterialId: payload.mixerMaterialId,
|
||||
mixerMaterialName: payload.materialName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function clearMixer(model: Recordable) {
|
||||
model.mixerMaterialId = '';
|
||||
model.mixerMaterialName = '';
|
||||
}
|
||||
|
||||
function openSupplierSelect() {
|
||||
openSupplierModal(true, {});
|
||||
}
|
||||
|
||||
function onSupplierSelect(payload: Recordable | null) {
|
||||
if (!payload) {
|
||||
return;
|
||||
}
|
||||
setFieldsValue({
|
||||
supplierId: payload.supplierId || payload.id,
|
||||
supplierName: payload.supplierName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function clearSupplier(model: Recordable) {
|
||||
model.supplierId = '';
|
||||
model.supplierName = '';
|
||||
}
|
||||
|
||||
function openUnitSelect() {
|
||||
openUnitModal(true, {});
|
||||
}
|
||||
|
||||
function onUnitSelect(payload: { unitId: string; unitName: string }) {
|
||||
setFieldsValue({
|
||||
unitId: payload.unitId || undefined,
|
||||
unitName: payload.unitName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function clearUnit(model: Recordable) {
|
||||
model.unitId = '';
|
||||
model.unitName = '';
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values.mixerMaterialId) {
|
||||
createMessage.warning('请选择密炼物料');
|
||||
return;
|
||||
}
|
||||
if (!values.supplierId) {
|
||||
createMessage.warning('请选择供应商');
|
||||
return;
|
||||
}
|
||||
if (!values.unitId) {
|
||||
createMessage.warning('请选择单位');
|
||||
return;
|
||||
}
|
||||
if (values.effectiveStartDate && values.effectiveEndDate && values.effectiveStartDate > values.effectiveEndDate) {
|
||||
createMessage.warning('生效开始日期不能晚于截止日期');
|
||||
return;
|
||||
}
|
||||
if (values.palletWeight != null && values.palletWeight < 0) {
|
||||
createMessage.warning('托盘重量不能为负数');
|
||||
return;
|
||||
}
|
||||
if (values.materialSpec) {
|
||||
values.materialSpec = String(values.materialSpec).trim();
|
||||
} else {
|
||||
values.materialSpec = undefined;
|
||||
}
|
||||
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>
|
||||
@@ -54,6 +54,18 @@ export const columns: BasicColumn[] = [
|
||||
dataIndex: 'totalWeight',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '包装物皮重',
|
||||
align: 'center',
|
||||
dataIndex: 'packagingTare',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '托盘重量',
|
||||
align: 'center',
|
||||
dataIndex: 'palletWeight',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '剩余重量',
|
||||
align: 'center',
|
||||
@@ -238,6 +250,20 @@ export const formSchemaAdd: FormSchema[] = [
|
||||
componentProps: { placeholder: '请输入总重', precision: 3 },
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
label: '包装物皮重',
|
||||
field: 'packagingTare',
|
||||
component: 'InputNumber',
|
||||
componentProps: { disabled: true, precision: 3, style: { width: '100%' } },
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
label: '托盘重量',
|
||||
field: 'palletWeight',
|
||||
component: 'InputNumber',
|
||||
componentProps: { disabled: true, precision: 3, style: { width: '100%' } },
|
||||
colProps: { span: 12 },
|
||||
},
|
||||
{
|
||||
label: '剩余重量',
|
||||
field: 'remainingWeight',
|
||||
@@ -321,6 +347,20 @@ export const formSchemaEdit: FormSchema[] = [
|
||||
componentProps: { disabled: true },
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
{
|
||||
label: '包装物皮重',
|
||||
field: 'packagingTare',
|
||||
component: 'InputNumber',
|
||||
componentProps: { disabled: true, precision: 3, style: { width: '100%' } },
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
{
|
||||
label: '托盘重量',
|
||||
field: 'palletWeight',
|
||||
component: 'InputNumber',
|
||||
componentProps: { disabled: true, precision: 3, style: { width: '100%' } },
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
{
|
||||
label: '剩余数量',
|
||||
field: 'remainingQuantity',
|
||||
@@ -352,10 +392,12 @@ export const superQuerySchema = {
|
||||
materialName: { title: '物料名称', order: 3, view: 'text' },
|
||||
supplierName: { title: '供应商名称', order: 4, view: 'text' },
|
||||
totalWeight: { title: '总重', order: 5, view: 'number' },
|
||||
remainingWeight: { title: '剩余重量', order: 6, view: 'number' },
|
||||
remainingQuantity: { title: '剩余数量', order: 7, view: 'number' },
|
||||
status: { title: '状态', order: 8, view: 'list', dictCode: 'xslmes_card_status' },
|
||||
testResult: { title: '检测结果', order: 9, view: 'list', dictCode: 'xslmes_test_result' },
|
||||
warehouseArea: { title: '库区', order: 10, view: 'text' },
|
||||
createTime: { title: '创建时间', order: 11, view: 'datetime' },
|
||||
packagingTare: { title: '包装物皮重', order: 6, view: 'number' },
|
||||
palletWeight: { title: '托盘重量', order: 7, view: 'number' },
|
||||
remainingWeight: { title: '剩余重量', order: 8, view: 'number' },
|
||||
remainingQuantity: { title: '剩余数量', order: 9, view: 'number' },
|
||||
status: { title: '状态', order: 10, view: 'list', dictCode: 'xslmes_card_status' },
|
||||
testResult: { title: '检测结果', order: 11, view: 'list', dictCode: 'xslmes_test_result' },
|
||||
warehouseArea: { title: '库区', order: 12, view: 'text' },
|
||||
createTime: { title: '创建时间', order: 13, view: 'datetime' },
|
||||
};
|
||||
|
||||
@@ -17,8 +17,11 @@ export const columns: BasicColumn[] = [
|
||||
{ title: '厂家物料名称', align: 'center', dataIndex: 'manufacturerMaterialName', width: 140, ellipsis: true },
|
||||
{ title: '保质期', align: 'center', dataIndex: 'shelfLife', width: 100 },
|
||||
{ title: '总重(KG)', align: 'center', dataIndex: 'totalWeight', width: 100 },
|
||||
{ title: '托盘及皮重(合计)', align: 'center', dataIndex: 'palletTareTotal', width: 120 },
|
||||
{ title: '总份数', align: 'center', dataIndex: 'totalPortions', width: 80 },
|
||||
{ title: '每份总重(KG)', align: 'center', dataIndex: 'portionWeight', width: 110 },
|
||||
{ title: '包装物皮重', align: 'center', dataIndex: 'portionPackagingTare', width: 110, ellipsis: true },
|
||||
{ title: '托盘重量', align: 'center', dataIndex: 'portionPalletWeight', width: 100, ellipsis: true },
|
||||
{ title: '每份包数', align: 'center', dataIndex: 'portionPackages', width: 80 },
|
||||
{ title: '检测结果', align: 'center', dataIndex: 'testResult_dictText', width: 90 },
|
||||
{ title: '检测状态', align: 'center', dataIndex: 'testStatus_dictText', width: 90 },
|
||||
@@ -155,6 +158,12 @@ export const formSchema: FormSchema[] = [
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '请输入总重', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: '托盘及皮重(合计)',
|
||||
field: 'palletTareTotal',
|
||||
component: 'InputNumber',
|
||||
componentProps: { disabled: true, precision: 3, style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
// 字段升级为字符串类型,支持桌面端拆码明细多行拼接(如 20/1/)
|
||||
label: '总份数',
|
||||
@@ -168,6 +177,18 @@ export const formSchema: FormSchema[] = [
|
||||
component: 'Input',
|
||||
componentProps: { placeholder: '请输入每份总重(多行明细用 / 拼接)', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: '包装物皮重',
|
||||
field: 'portionPackagingTare',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '拆码明细拼接(/ 分隔)' },
|
||||
},
|
||||
{
|
||||
label: '托盘重量',
|
||||
field: 'portionPalletWeight',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '拆码明细拼接(/ 分隔)' },
|
||||
},
|
||||
{
|
||||
label: '每份包数',
|
||||
field: 'portionPackages',
|
||||
@@ -258,7 +279,8 @@ export const superQuerySchema = {
|
||||
materialName: { title: '物料名称', order: 4, view: 'text' },
|
||||
supplierName: { title: '供应商名称', order: 5, view: 'text' },
|
||||
totalWeight: { title: '总重(KG)', order: 6, view: 'number' },
|
||||
testStatus: { title: '检测状态', order: 7, view: 'list', dictCode: 'xslmes_test_status' },
|
||||
isSpecialAdoption: { title: '是否特采', order: 8, view: 'list', dictCode: 'yn' },
|
||||
status: { title: '状态', order: 9, view: 'list', dictCode: 'xslmes_entry_status' },
|
||||
palletTareTotal: { title: '托盘及皮重(合计)', order: 7, view: 'number' },
|
||||
testStatus: { title: '检测状态', order: 8, view: 'list', dictCode: 'xslmes_test_status' },
|
||||
isSpecialAdoption: { title: '是否特采', order: 9, view: 'list', dictCode: 'yn' },
|
||||
status: { title: '状态', order: 10, view: 'list', dictCode: 'xslmes_entry_status' },
|
||||
};
|
||||
|
||||
@@ -15,6 +15,8 @@ export const columns: BasicColumn[] = [
|
||||
{ title: '供应商', align: 'center', dataIndex: 'supplierName', width: 160, ellipsis: true },
|
||||
{ title: '保质期', align: 'center', dataIndex: 'shelfLife', width: 120 },
|
||||
{ title: '总重', align: 'center', dataIndex: 'totalWeight', width: 110 },
|
||||
{ title: '包装物皮重', align: 'center', dataIndex: 'packagingTare', width: 110 },
|
||||
{ title: '托盘重量', align: 'center', dataIndex: 'palletWeight', width: 100 },
|
||||
{ title: '剩余重量', align: 'center', dataIndex: 'remainingWeight', width: 110 },
|
||||
{ title: '剩余数量', align: 'center', dataIndex: 'remainingQuantity', width: 110 },
|
||||
{ title: '检测结果', align: 'center', dataIndex: 'testResult_dictText', width: 110 },
|
||||
@@ -64,9 +66,11 @@ export const superQuerySchema = {
|
||||
supplierName: { title: '供应商', order: 4, view: 'text' },
|
||||
shelfLife: { title: '保质期', order: 5, view: 'text' },
|
||||
totalWeight: { title: '总重', order: 6, view: 'number' },
|
||||
remainingWeight: { title: '剩余重量', order: 7, view: 'number' },
|
||||
remainingQuantity: { title: '剩余数量', order: 8, view: 'number' },
|
||||
testResult: { title: '检测结果', order: 9, view: 'list', dictCode: 'xslmes_test_result' },
|
||||
status: { title: '状态', order: 10, view: 'list', dictCode: 'xslmes_card_status' },
|
||||
priorityPickup: { title: '优先使用', order: 11, view: 'list', dictCode: 'yn' },
|
||||
packagingTare: { title: '包装物皮重', order: 7, view: 'number' },
|
||||
palletWeight: { title: '托盘重量', order: 8, view: 'number' },
|
||||
remainingWeight: { title: '剩余重量', order: 9, view: 'number' },
|
||||
remainingQuantity: { title: '剩余数量', order: 10, view: 'number' },
|
||||
testResult: { title: '检测结果', order: 11, view: 'list', dictCode: 'xslmes_test_result' },
|
||||
status: { title: '状态', order: 12, view: 'list', dictCode: 'xslmes_card_status' },
|
||||
priorityPickup: { title: '优先使用', order: 13, view: 'list', dictCode: 'yn' },
|
||||
};
|
||||
|
||||
@@ -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 },
|
||||
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -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 } },
|
||||
{
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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 });
|
||||
};
|
||||
@@ -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,
|
||||
},
|
||||
];
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -21,7 +21,22 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '备品件名称', field: 'sparePartName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '类别名称', field: 'sparePartsCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'sparePartsCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属类别',
|
||||
field: 'sparePartsCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'sparePartsCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'unitId', component: 'Input', show: false },
|
||||
{
|
||||
label: '单位',
|
||||
field: 'unitName',
|
||||
component: 'Input',
|
||||
slot: 'unitPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '规格型号', field: 'specModel', component: 'Input', colProps: { span: 6 } },
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-sparePartsCategoryPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择备品件类别"
|
||||
:show-clear="!!model.sparePartsCategoryId"
|
||||
@open="openCategorySelect"
|
||||
@clear="clearModelFields(model, ['sparePartsCategoryId', 'sparePartsCategoryName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #form-unitPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择单位"
|
||||
:show-clear="!!model.unitId"
|
||||
@open="openUnitSelect"
|
||||
@clear="clearModelFields(model, ['unitId', 'unitName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_spare_part:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +66,8 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslSparePartModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslSparePartsCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
<MesXslUnitSelectModal @register="registerUnitModal" @select="onUnitSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -54,11 +76,22 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslSparePartModal from './components/MesXslSparePartModal.vue';
|
||||
import MesXslSparePartsCategorySelectModal from '/@/views/xslmes/mesXslSparePartsCategory/components/MesXslSparePartsCategorySelectModal.vue';
|
||||
import MesXslUnitSelectModal from '/@/views/xslmes/mesXslVehicle/components/MesXslUnitSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslSparePart.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslSparePart.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'sparePartsCategoryId', nameField: 'sparePartsCategoryName' },
|
||||
{ idField: 'unitId', nameField: 'unitName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
const [registerUnitModal, { openModal: openUnitModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +99,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 110,
|
||||
@@ -87,7 +121,31 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openCategorySelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openCategoryModal(true, { sparePartsCategoryId: v.sparePartsCategoryId });
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
sparePartsCategoryId: payload.sparePartsCategoryId || '',
|
||||
sparePartsCategoryName: payload.sparePartsCategoryName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openUnitSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openUnitModal(true, { unitId: v.unitId });
|
||||
}
|
||||
|
||||
function onUnitSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
unitId: payload.unitId || '',
|
||||
unitName: payload.unitName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -31,6 +31,30 @@ export const columns: BasicColumn[] = [
|
||||
return Number.isInteger(n) ? String(n) : n.toFixed(2);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '货物皮重',
|
||||
align: 'center',
|
||||
dataIndex: 'cargoTareWeight',
|
||||
width: 100,
|
||||
customRender: ({ text }) => {
|
||||
if (text === null || text === undefined || text === '') return '0';
|
||||
const n = Number(text);
|
||||
if (Number.isNaN(n)) return String(text);
|
||||
return Number.isInteger(n) ? String(n) : n.toFixed(2);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '原料重量',
|
||||
align: 'center',
|
||||
dataIndex: 'rawMaterialWeight',
|
||||
width: 100,
|
||||
customRender: ({ text }) => {
|
||||
if (text === null || text === undefined || text === '') return '';
|
||||
const n = Number(text);
|
||||
if (Number.isNaN(n)) return String(text);
|
||||
return Number.isInteger(n) ? String(n) : n.toFixed(2);
|
||||
},
|
||||
},
|
||||
{ title: '司机', align: 'center', dataIndex: 'driverName', width: 90 },
|
||||
{ title: '手机号', align: 'center', dataIndex: 'driverPhone', width: 120 },
|
||||
];
|
||||
|
||||
21
jeecgboot-vue3/src/views/xslmes/utils/mesSearchPickerUtil.ts
Normal file
21
jeecgboot-vue3/src/views/xslmes/utils/mesSearchPickerUtil.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/** 列表查询:有 id 时去掉冗余 name 字段,避免模糊查询 */
|
||||
export type MesIdNamePair = { idField: string; nameField: string };
|
||||
|
||||
export function stripIdNameQueryParams(params: Recordable, pairs: MesIdNamePair[]) {
|
||||
for (const { idField, nameField } of pairs) {
|
||||
if (params[idField]) {
|
||||
delete params[nameField];
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
export function createStripIdNameBeforeFetch(pairs: MesIdNamePair[]) {
|
||||
return (params: Recordable) => stripIdNameQueryParams(params, pairs);
|
||||
}
|
||||
|
||||
export function clearModelFields(model: Recordable, fields: string[]) {
|
||||
for (const field of fields) {
|
||||
model[field] = '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user