密炼生产计划优化
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslManualSmallMaterialDemandPlan/list',
|
||||
exportXls = '/xslmes/mesXslManualSmallMaterialDemandPlan/exportXls',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
@@ -0,0 +1,26 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
export const baseColumns: BasicColumn[] = [
|
||||
{ title: '原材料名称', align: 'center', dataIndex: 'rawMaterialName', width: 260, ellipsis: true },
|
||||
{ title: '需求重量(KG)', align: 'center', dataIndex: 'demandWeight', width: 180 },
|
||||
];
|
||||
|
||||
export const machineColumns: BasicColumn[] = [{ title: '机台', align: 'center', dataIndex: 'machineName', width: 180 }, ...baseColumns];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '日期',
|
||||
field: 'statDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '请选择日期' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '原材料名称', field: 'rawMaterialName', component: 'JInput', colProps: { span: 6 } },
|
||||
];
|
||||
|
||||
export const superQuerySchema = {
|
||||
machineName: { title: '机台', order: 0, view: 'text' },
|
||||
statDate: { title: '日期', order: 1, view: 'date' },
|
||||
rawMaterialName: { title: '原材料名称', order: 2, view: 'text' },
|
||||
demandWeight: { title: '需求重量(KG)', order: 3, view: 'number' },
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<a-checkbox v-model:checked="groupByMachine" @change="onGroupByMachineChange">按机台统计</a-checkbox>
|
||||
<a-button
|
||||
style="margin-left: 8px"
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_manual_small_material_demand_plan:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslManualSmallMaterialDemandPlan" setup>
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { BasicTable } from '/@/components/Table';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import {
|
||||
baseColumns,
|
||||
machineColumns,
|
||||
searchFormSchema,
|
||||
superQuerySchema,
|
||||
} from './MesXslManualSmallMaterialDemandPlan.data';
|
||||
import { list, getExportUrl } from './MesXslManualSmallMaterialDemandPlan.api';
|
||||
|
||||
const queryParam = reactive<any>({ groupByMachine: 0 });
|
||||
const groupByMachine = ref(false);
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '人工小料需求计划',
|
||||
api: list,
|
||||
columns: baseColumns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return Object.assign(params, queryParam, {
|
||||
groupByMachine: groupByMachine.value ? 1 : 0,
|
||||
});
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '人工小料需求计划',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload, setColumns }] = tableContext;
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
onMounted(() => {
|
||||
applyColumns();
|
||||
});
|
||||
|
||||
function applyColumns() {
|
||||
setColumns(groupByMachine.value ? machineColumns : baseColumns);
|
||||
}
|
||||
|
||||
function onGroupByMachineChange() {
|
||||
queryParam.groupByMachine = groupByMachine.value ? 1 : 0;
|
||||
applyColumns();
|
||||
reload();
|
||||
}
|
||||
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).forEach((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
reload();
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user