Merge branch 'main' of http://27.223.88.102:33000/chenx/qhmes
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslMixerMaterialSubstitute/list',
|
||||
save = '/xslmes/mesXslMixerMaterialSubstitute/add',
|
||||
edit = '/xslmes/mesXslMixerMaterialSubstitute/edit',
|
||||
deleteOne = '/xslmes/mesXslMixerMaterialSubstitute/delete',
|
||||
deleteBatch = '/xslmes/mesXslMixerMaterialSubstitute/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslMixerMaterialSubstitute/importExcel',
|
||||
exportXls = '/xslmes/mesXslMixerMaterialSubstitute/exportXls',
|
||||
queryById = '/xslmes/mesXslMixerMaterialSubstitute/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,102 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '编号', align: 'center', dataIndex: 'serialNo', width: 80 },
|
||||
{ title: '密炼物料编码', align: 'center', dataIndex: 'mixerMaterialCode', width: 130 },
|
||||
{ title: '密炼物料名称', align: 'center', dataIndex: 'mixerMaterialName', width: 160 },
|
||||
{ title: '替代密炼物料编码', align: 'center', dataIndex: 'substituteMaterialCode', width: 140 },
|
||||
{ title: '替代密炼物料名称', align: 'center', dataIndex: 'substituteMaterialName', width: 160 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100, defaultHidden: true },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100, defaultHidden: true },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '密炼物料',
|
||||
field: 'mixerMaterialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'mes_mixer_material,material_name,id',
|
||||
placeholder: '请选择密炼物料',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '密炼物料编码', field: 'mixerMaterialCode', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '密炼物料名称', field: 'mixerMaterialName', component: 'JInput', colProps: { span: 6 } },
|
||||
{
|
||||
label: '替代密炼物料',
|
||||
field: 'substituteMaterialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'mes_mixer_material,material_name,id',
|
||||
placeholder: '请选择替代密炼物料',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '替代物料编码', field: 'substituteMaterialCode', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '替代物料名称', field: 'substituteMaterialName', component: 'JInput', colProps: { span: 6 } },
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '编号',
|
||||
field: 'serialNo',
|
||||
component: 'InputNumber',
|
||||
componentProps: { disabled: true, placeholder: '保存后自动生成', style: { width: '100%' } },
|
||||
ifShow: ({ values }) => !!values.serialNo,
|
||||
},
|
||||
{
|
||||
label: '密炼物料',
|
||||
field: 'mixerMaterialName',
|
||||
component: 'Input',
|
||||
slot: 'mixerMaterialPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择密炼物料' }],
|
||||
},
|
||||
{ label: '', field: 'mixerMaterialId', component: 'Input', show: false },
|
||||
{
|
||||
label: '密炼物料编码',
|
||||
field: 'mixerMaterialCode',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择密炼物料后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '替代密炼物料',
|
||||
field: 'substituteMaterialName',
|
||||
component: 'Input',
|
||||
slot: 'substituteMaterialPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择替代密炼物料' }],
|
||||
},
|
||||
{ label: '', field: 'substituteMaterialId', component: 'Input', show: false },
|
||||
{
|
||||
label: '替代密炼物料编码',
|
||||
field: 'substituteMaterialCode',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择替代密炼物料后自动带出' },
|
||||
},
|
||||
];
|
||||
|
||||
export const superQuerySchema = {
|
||||
serialNo: { title: '编号', order: 0, view: 'number' },
|
||||
mixerMaterialId: {
|
||||
title: '密炼物料',
|
||||
order: 1,
|
||||
view: 'sel_search',
|
||||
dictTable: 'mes_mixer_material',
|
||||
dictCode: 'id',
|
||||
dictText: 'material_name',
|
||||
},
|
||||
mixerMaterialCode: { title: '密炼物料编码', order: 2, view: 'text' },
|
||||
mixerMaterialName: { title: '密炼物料名称', order: 3, view: 'text' },
|
||||
substituteMaterialId: {
|
||||
title: '替代密炼物料',
|
||||
order: 4,
|
||||
view: 'sel_search',
|
||||
dictTable: 'mes_mixer_material',
|
||||
dictCode: 'id',
|
||||
dictText: 'material_name',
|
||||
},
|
||||
substituteMaterialCode: { title: '替代密炼物料编码', order: 5, view: 'text' },
|
||||
substituteMaterialName: { title: '替代密炼物料名称', order: 6, view: 'text' },
|
||||
};
|
||||
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_substitute:add'"
|
||||
@click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_substitute:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_material_substitute: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_substitute: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_substitute:edit',
|
||||
},
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslMixerMaterialSubstituteModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslMixerMaterialSubstitute" 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 MesXslMixerMaterialSubstituteModal from './components/MesXslMixerMaterialSubstituteModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema } from './MesXslMixerMaterialSubstitute.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslMixerMaterialSubstitute.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,
|
||||
},
|
||||
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_substitute:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,170 @@
|
||||
<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('mixer')">选择</a-button>
|
||||
<a-button v-if="model.mixerMaterialId && !isDetail" @click="clearMixer('mixer', model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #substituteMaterialPicker="{ model }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input
|
||||
v-model:value="model.substituteMaterialName"
|
||||
read-only
|
||||
placeholder="请点击选择替代密炼物料"
|
||||
style="flex: 1"
|
||||
:disabled="isDetail"
|
||||
/>
|
||||
<a-button type="primary" :disabled="isDetail" @click="openMixerSelect('substitute')">选择</a-button>
|
||||
<a-button v-if="model.substituteMaterialId && !isDetail" @click="clearMixer('substitute', model)">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesMixerMaterialSelectModal @register="registerMixerModal" @select="onMixerSelect" />
|
||||
</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 MesMixerMaterialSelectModal from '/@/views/mes/material/modules/MesMixerMaterialSelectModal.vue';
|
||||
import { formSchema } from '../MesXslMixerMaterialSubstitute.data';
|
||||
import { saveOrUpdate } from '../MesXslMixerMaterialSubstitute.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
const pickerTarget = ref<'mixer' | 'substitute'>('mixer');
|
||||
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, getFieldsValue, scrollToField }] = useForm({
|
||||
labelWidth: 140,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const [registerMixerModal, { openModal: openMixerModal }] = 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 });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : unref(isDetail) ? '详情' : '编辑'));
|
||||
|
||||
function openMixerSelect(target: 'mixer' | 'substitute') {
|
||||
pickerTarget.value = target;
|
||||
const values = getFieldsValue();
|
||||
const mid = target === 'mixer' ? values?.mixerMaterialId : values?.substituteMaterialId;
|
||||
openMixerModal(true, { mixerMaterialId: mid });
|
||||
}
|
||||
|
||||
function onMixerSelect(payload: Recordable | null) {
|
||||
if (!payload) {
|
||||
return;
|
||||
}
|
||||
if (pickerTarget.value === 'mixer') {
|
||||
setFieldsValue({
|
||||
mixerMaterialId: payload.mixerMaterialId,
|
||||
mixerMaterialName: payload.materialName || '',
|
||||
mixerMaterialCode: '',
|
||||
});
|
||||
fillMaterialCode(payload.mixerMaterialId, 'mixer');
|
||||
} else {
|
||||
setFieldsValue({
|
||||
substituteMaterialId: payload.mixerMaterialId,
|
||||
substituteMaterialName: payload.materialName || '',
|
||||
substituteMaterialCode: '',
|
||||
});
|
||||
fillMaterialCode(payload.mixerMaterialId, 'substitute');
|
||||
}
|
||||
}
|
||||
|
||||
async function fillMaterialCode(id: string, target: 'mixer' | 'substitute') {
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const { queryById } = await import('/@/views/mes/material/MesMixerMaterial.api');
|
||||
const raw = await queryById({ id });
|
||||
const row = (raw as Recordable)?.materialCode != null ? raw : (raw as Recordable)?.result;
|
||||
if (row?.materialCode) {
|
||||
if (target === 'mixer') {
|
||||
setFieldsValue({ mixerMaterialCode: row.materialCode, mixerMaterialName: row.materialName || '' });
|
||||
} else {
|
||||
setFieldsValue({ substituteMaterialCode: row.materialCode, substituteMaterialName: row.materialName || '' });
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
function clearMixer(target: 'mixer' | 'substitute', model: Recordable) {
|
||||
if (target === 'mixer') {
|
||||
model.mixerMaterialId = '';
|
||||
model.mixerMaterialName = '';
|
||||
model.mixerMaterialCode = '';
|
||||
} else {
|
||||
model.substituteMaterialId = '';
|
||||
model.substituteMaterialName = '';
|
||||
model.substituteMaterialCode = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values.mixerMaterialId) {
|
||||
createMessage.warning('请选择密炼物料');
|
||||
return;
|
||||
}
|
||||
if (!values.substituteMaterialId) {
|
||||
createMessage.warning('请选择替代密炼物料');
|
||||
return;
|
||||
}
|
||||
if (values.mixerMaterialId === values.substituteMaterialId) {
|
||||
createMessage.warning('密炼物料与替代密炼物料不能相同');
|
||||
return;
|
||||
}
|
||||
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>
|
||||
@@ -0,0 +1,39 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslMixerPsCompile/list',
|
||||
save = '/xslmes/mesXslMixerPsCompile/add',
|
||||
edit = '/xslmes/mesXslMixerPsCompile/edit',
|
||||
deleteOne = '/xslmes/mesXslMixerPsCompile/delete',
|
||||
deleteBatch = '/xslmes/mesXslMixerPsCompile/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslMixerPsCompile/importExcel',
|
||||
exportXls = '/xslmes/mesXslMixerPsCompile/exportXls',
|
||||
queryById = '/xslmes/mesXslMixerPsCompile/queryById',
|
||||
proofread = '/xslmes/mesXslMixerPsCompile/proofread',
|
||||
audit = '/xslmes/mesXslMixerPsCompile/audit',
|
||||
approve = '/xslmes/mesXslMixerPsCompile/approve',
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
export const proofread = (params: { ids: string }) => defHttp.post({ url: Api.proofread, params }, { joinParamsToUrl: true });
|
||||
|
||||
export const audit = (params: { ids: string }) => defHttp.post({ url: Api.audit, params }, { joinParamsToUrl: true });
|
||||
|
||||
export const approve = (params: { ids: string }) => defHttp.post({ url: Api.approve, params }, { joinParamsToUrl: true });
|
||||
@@ -0,0 +1,286 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
const colHalf = { span: 12 };
|
||||
|
||||
const deptSelectBase = {
|
||||
sync: false,
|
||||
checkStrictly: true,
|
||||
defaultExpandLevel: 2,
|
||||
};
|
||||
|
||||
const deptSelectSingleProps = {
|
||||
...deptSelectBase,
|
||||
multiple: false,
|
||||
};
|
||||
|
||||
const deptSelectProps = {
|
||||
...deptSelectBase,
|
||||
multiple: true,
|
||||
};
|
||||
|
||||
const hasWorkflowInfo = ({ values }) =>
|
||||
!!(values.proofreadBy || values.proofreadTime || values.auditBy || values.auditTime || values.approveBy || values.approveTime);
|
||||
|
||||
function sectionDivider(label: string, field: string, ifShow?: FormSchema['ifShow']): FormSchema {
|
||||
return {
|
||||
field,
|
||||
label,
|
||||
component: 'Divider',
|
||||
componentProps: { orientation: 'left', plain: false },
|
||||
colProps: { span: 24 },
|
||||
ifShow,
|
||||
};
|
||||
}
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: 'PS编码', align: 'center', dataIndex: 'psCode', width: 140 },
|
||||
{ title: '类型', align: 'center', dataIndex: 'psType_dictText', width: 110 },
|
||||
{ title: '发放日期', align: 'center', dataIndex: 'issueDate', width: 110 },
|
||||
{ title: '发送部门', align: 'center', dataIndex: 'sendDeptId_dictText', width: 120 },
|
||||
{ title: '收信部门', align: 'center', dataIndex: 'receiveDeptId_dictText', width: 160 },
|
||||
{ title: '参照部门', align: 'center', dataIndex: 'referenceDeptId_dictText', width: 160 },
|
||||
{ title: '标题', align: 'center', dataIndex: 'title', width: 180 },
|
||||
{ title: '目的', align: 'center', dataIndex: 'purpose', width: 160, defaultHidden: true },
|
||||
{ title: '依据', align: 'center', dataIndex: 'basis', width: 160, defaultHidden: true },
|
||||
{ title: '担当', align: 'center', dataIndex: 'responsiblePerson', width: 90 },
|
||||
{ title: '状态', align: 'center', dataIndex: 'status_dictText', width: 90 },
|
||||
{
|
||||
title: '编制人',
|
||||
align: 'center',
|
||||
dataIndex: 'compileBy',
|
||||
width: 100,
|
||||
customRender: ({ record }) => record?.createBy_dictText || record?.createBy || '',
|
||||
},
|
||||
{ title: '校对人', align: 'center', dataIndex: 'proofreadBy', width: 100, defaultHidden: true },
|
||||
{ title: '校对时间', align: 'center', dataIndex: 'proofreadTime', width: 165, defaultHidden: true },
|
||||
{ title: '审核人', align: 'center', dataIndex: 'auditBy', width: 100, defaultHidden: true },
|
||||
{ title: '审核时间', align: 'center', dataIndex: 'auditTime', width: 165, defaultHidden: true },
|
||||
{ title: '批准人', align: 'center', dataIndex: 'approveBy', width: 100, defaultHidden: true },
|
||||
{ title: '批准时间', align: 'center', dataIndex: 'approveTime', width: 165, defaultHidden: true },
|
||||
{ title: '所属工厂', align: 'center', dataIndex: 'factoryName', width: 120, defaultHidden: true },
|
||||
{ title: '施工代号', align: 'center', dataIndex: 'constructionCode_dictText', width: 110, defaultHidden: true },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100, defaultHidden: true },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100, defaultHidden: true },
|
||||
{ title: '修改时间', align: 'center', dataIndex: 'updateTime', width: 165, defaultHidden: true },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: 'PS编码', field: 'psCode', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '标题', field: 'title', component: 'JInput', colProps: { span: 6 } },
|
||||
{
|
||||
label: '状态',
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
defaultValue: 'compile',
|
||||
componentProps: { dictCode: 'xslmes_mixer_ps_status', placeholder: '请选择状态' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '开始日期',
|
||||
field: 'issueDate_begin',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期起' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '结束日期',
|
||||
field: 'issueDate_end',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期止' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
field: 'psType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_ps_belong' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
|
||||
sectionDivider('基本信息', 'dividerBasic'),
|
||||
{
|
||||
label: 'PS编码',
|
||||
field: 'psCode',
|
||||
component: 'Input',
|
||||
colProps: colHalf,
|
||||
componentProps: { placeholder: '请输入PS编码', allowClear: true },
|
||||
},
|
||||
{
|
||||
label: 'PS归属',
|
||||
field: 'psType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_ps_belong', placeholder: '请选择PS归属' },
|
||||
colProps: colHalf,
|
||||
},
|
||||
{
|
||||
label: '施工代号',
|
||||
field: 'constructionCode',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_construction_code', placeholder: '请选择施工代号' },
|
||||
colProps: colHalf,
|
||||
},
|
||||
{
|
||||
label: '发放日期',
|
||||
field: 'issueDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' }, placeholder: '请选择发放日期' },
|
||||
colProps: colHalf,
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'status',
|
||||
component: 'JDictSelectTag',
|
||||
defaultValue: 'compile',
|
||||
componentProps: { dictCode: 'xslmes_mixer_ps_status', disabled: true },
|
||||
colProps: colHalf,
|
||||
},
|
||||
{
|
||||
label: '编制人',
|
||||
field: 'compileBy',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, bordered: false, placeholder: '保存后按创建人显示' },
|
||||
colProps: colHalf,
|
||||
itemProps: { class: 'ps-workflow-item' },
|
||||
},
|
||||
{
|
||||
label: '担当',
|
||||
field: 'responsiblePerson',
|
||||
component: 'Input',
|
||||
colProps: colHalf,
|
||||
componentProps: { placeholder: '请输入担当', allowClear: true },
|
||||
},
|
||||
{
|
||||
label: '标题',
|
||||
field: 'title',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
componentProps: { placeholder: '请输入标题', allowClear: true },
|
||||
dynamicRules: () => [{ required: true, message: '请输入标题' }],
|
||||
},
|
||||
|
||||
sectionDivider('组织与部门', 'dividerDept'),
|
||||
{
|
||||
label: '所属工厂',
|
||||
field: 'factoryId',
|
||||
component: 'JSelectDept',
|
||||
componentProps: deptSelectSingleProps,
|
||||
colProps: colHalf,
|
||||
},
|
||||
{
|
||||
label: '发送部门',
|
||||
field: 'sendDeptId',
|
||||
component: 'JSelectDept',
|
||||
componentProps: deptSelectSingleProps,
|
||||
colProps: colHalf,
|
||||
},
|
||||
{
|
||||
label: '收信部门',
|
||||
field: 'receiveDeptId',
|
||||
component: 'JSelectDept',
|
||||
componentProps: deptSelectProps,
|
||||
colProps: colHalf,
|
||||
dynamicRules: () => [{ required: true, message: '请选择收信部门' }],
|
||||
},
|
||||
{
|
||||
label: '参照部门',
|
||||
field: 'referenceDeptId',
|
||||
component: 'JSelectDept',
|
||||
componentProps: deptSelectProps,
|
||||
colProps: colHalf,
|
||||
dynamicRules: () => [{ required: true, message: '请选择参照部门' }],
|
||||
},
|
||||
|
||||
sectionDivider('文档内容', 'dividerContent'),
|
||||
{
|
||||
label: '目的',
|
||||
field: 'purpose',
|
||||
component: 'InputTextArea',
|
||||
componentProps: { rows: 3, placeholder: '请输入目的', maxlength: 500, showCount: true },
|
||||
colProps: colHalf,
|
||||
},
|
||||
{
|
||||
label: '依据',
|
||||
field: 'basis',
|
||||
component: 'InputTextArea',
|
||||
componentProps: { rows: 3, placeholder: '请输入依据', maxlength: 500, showCount: true },
|
||||
colProps: colHalf,
|
||||
},
|
||||
{
|
||||
label: '内容',
|
||||
field: 'content',
|
||||
component: 'InputTextArea',
|
||||
componentProps: { rows: 5, placeholder: '请输入内容', maxlength: 2000, showCount: true },
|
||||
colProps: { span: 24 },
|
||||
},
|
||||
|
||||
sectionDivider('审批记录', 'dividerWorkflow', hasWorkflowInfo),
|
||||
{
|
||||
label: '校对人',
|
||||
field: 'proofreadBy',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, bordered: false },
|
||||
colProps: colHalf,
|
||||
itemProps: { class: 'ps-workflow-item' },
|
||||
ifShow: ({ values }) => !!values.proofreadBy,
|
||||
},
|
||||
{
|
||||
label: '校对时间',
|
||||
field: 'proofreadTime',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, bordered: false },
|
||||
colProps: colHalf,
|
||||
itemProps: { class: 'ps-workflow-item' },
|
||||
ifShow: ({ values }) => !!values.proofreadTime,
|
||||
},
|
||||
{
|
||||
label: '审核人',
|
||||
field: 'auditBy',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, bordered: false },
|
||||
colProps: colHalf,
|
||||
itemProps: { class: 'ps-workflow-item' },
|
||||
ifShow: ({ values }) => !!values.auditBy,
|
||||
},
|
||||
{
|
||||
label: '审核时间',
|
||||
field: 'auditTime',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, bordered: false },
|
||||
colProps: colHalf,
|
||||
itemProps: { class: 'ps-workflow-item' },
|
||||
ifShow: ({ values }) => !!values.auditTime,
|
||||
},
|
||||
{
|
||||
label: '批准人',
|
||||
field: 'approveBy',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, bordered: false },
|
||||
colProps: colHalf,
|
||||
itemProps: { class: 'ps-workflow-item' },
|
||||
ifShow: ({ values }) => !!values.approveBy,
|
||||
},
|
||||
{
|
||||
label: '批准时间',
|
||||
field: 'approveTime',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, bordered: false },
|
||||
colProps: colHalf,
|
||||
itemProps: { class: 'ps-workflow-item' },
|
||||
ifShow: ({ values }) => !!values.approveTime,
|
||||
},
|
||||
];
|
||||
|
||||
export const superQuerySchema = {
|
||||
psCode: { title: 'PS编码', order: 0, view: 'text' },
|
||||
psType: { title: '类型', order: 1, view: 'list', dictCode: 'xslmes_ps_belong' },
|
||||
constructionCode: { title: '施工代号', order: 2, view: 'list', dictCode: 'xslmes_construction_code' },
|
||||
issueDate: { title: '发放日期', order: 3, view: 'date' },
|
||||
title: { title: '标题', order: 4, view: 'text' },
|
||||
status: { title: '状态', order: 5, view: 'list', dictCode: 'xslmes_mixer_ps_status' },
|
||||
responsiblePerson: { title: '担当', order: 6, view: 'text' },
|
||||
};
|
||||
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_ps_compile:add'"
|
||||
@click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
v-auth="'xslmes:mes_xsl_mixer_ps_compile:proofread'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:check-circle-outlined"
|
||||
@click="handleProofread"
|
||||
>
|
||||
校对
|
||||
</a-button>
|
||||
<a-button
|
||||
v-auth="'xslmes:mes_xsl_mixer_ps_compile:audit'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:audit-outlined"
|
||||
@click="handleAudit"
|
||||
>
|
||||
审核
|
||||
</a-button>
|
||||
<a-button
|
||||
v-auth="'xslmes:mes_xsl_mixer_ps_compile:approve'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:safety-certificate-outlined"
|
||||
@click="handleApprove"
|
||||
>
|
||||
批准
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_ps_compile:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_ps_compile:importExcel'"
|
||||
preIcon="ant-design:import-outlined"
|
||||
@click="onImportXls"
|
||||
>
|
||||
导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0 && hasCompileSelection">
|
||||
<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_ps_compile: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_ps_compile:edit',
|
||||
ifShow: isCompileStatus(record),
|
||||
},
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslMixerPsCompileModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslMixerPsCompile" setup>
|
||||
import { computed, reactive } from 'vue';
|
||||
import { Modal } from 'ant-design-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 MesXslMixerPsCompileModal from './components/MesXslMixerPsCompileModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema } from './MesXslMixerPsCompile.data';
|
||||
import {
|
||||
list,
|
||||
deleteOne,
|
||||
batchDelete,
|
||||
getExportUrl,
|
||||
getImportUrl,
|
||||
proofread,
|
||||
audit,
|
||||
approve,
|
||||
} from './MesXslMixerPsCompile.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const queryParam = reactive<any>({});
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '密炼PS编制',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
tableSetting: { cacheKey: 'mesXslMixerPsCompile_v20260520' },
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 90,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
beforeFetch: (params) => Object.assign(params, queryParam),
|
||||
},
|
||||
exportConfig: {
|
||||
name: '密炼PS编制',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys, selectedRows }] = tableContext;
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
const isCompileStatus = (record?: Recordable) => !record?.status || record.status === 'compile';
|
||||
|
||||
const hasCompileSelection = computed(
|
||||
() => selectedRows.value.length > 0 && selectedRows.value.every((row) => isCompileStatus(row)),
|
||||
);
|
||||
|
||||
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) {
|
||||
if (record.status && record.status !== 'compile') {
|
||||
createMessage.warning('仅编制状态的单据允许编辑');
|
||||
return;
|
||||
}
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
|
||||
function handleStatusAction(action: 'proofread' | 'audit' | 'approve', label: string) {
|
||||
if (selectedRowKeys.value.length === 0) {
|
||||
createMessage.warning('请先选择要' + label + '的记录');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '确认' + label,
|
||||
content: `确定对选中的 ${selectedRowKeys.value.length} 条记录执行${label}吗?`,
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
const ids = selectedRowKeys.value.join(',');
|
||||
const fn = action === 'proofread' ? proofread : action === 'audit' ? audit : approve;
|
||||
await fn({ ids });
|
||||
createMessage.success(label + '成功');
|
||||
handleSuccess();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleProofread() {
|
||||
handleStatusAction('proofread', '校对');
|
||||
}
|
||||
|
||||
function handleAudit() {
|
||||
handleStatusAction('audit', '审核');
|
||||
}
|
||||
|
||||
function handleApprove() {
|
||||
handleStatusAction('approve', '批准');
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
if (!isCompileStatus(record)) {
|
||||
createMessage.warning('仅编制状态的单据允许删除');
|
||||
return;
|
||||
}
|
||||
deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
function batchHandleDelete() {
|
||||
if (!hasCompileSelection.value) {
|
||||
createMessage.warning('仅编制状态的单据允许删除,请取消已流转记录的勾选');
|
||||
return;
|
||||
}
|
||||
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_ps_compile:delete',
|
||||
ifShow: isCompileStatus(record),
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<BasicModal
|
||||
v-bind="$attrs"
|
||||
@register="registerModal"
|
||||
destroyOnClose
|
||||
:title="title"
|
||||
:width="1000"
|
||||
wrapClassName="ps-compile-modal-wrap"
|
||||
@ok="handleSubmit"
|
||||
>
|
||||
<div class="ps-compile-modal-body">
|
||||
<BasicForm @register="registerForm" />
|
||||
</div>
|
||||
</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 { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { formSchema } from '../MesXslMixerPsCompile.data';
|
||||
import { saveOrUpdate } from '../MesXslMixerPsCompile.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const userStore = useUserStore();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
const modalTitleOverride = ref('');
|
||||
const statusDictCode = ref('xslmes_mixer_ps_status');
|
||||
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField, updateSchema }] = useForm({
|
||||
labelWidth: 96,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
rowProps: { gutter: 16 },
|
||||
compact: true,
|
||||
});
|
||||
|
||||
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;
|
||||
modalTitleOverride.value = data?.modalTitle || '';
|
||||
statusDictCode.value = data?.statusDictCode || 'xslmes_mixer_ps_status';
|
||||
await updateSchema([
|
||||
{
|
||||
field: 'status',
|
||||
componentProps: { dictCode: statusDictCode.value, disabled: true },
|
||||
},
|
||||
]);
|
||||
if (unref(isUpdate)) {
|
||||
await setFieldsValue(normalizeRecord(data.record));
|
||||
} else {
|
||||
await setFieldsValue({ compileBy: resolveCompileBy() });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() => {
|
||||
if (modalTitleOverride.value) {
|
||||
return modalTitleOverride.value;
|
||||
}
|
||||
return !unref(isUpdate) ? '新增PS' : unref(isDetail) ? 'PS详情' : '编辑PS';
|
||||
});
|
||||
|
||||
function parseDeptIds(value: unknown): string[] {
|
||||
if (Array.isArray(value)) {
|
||||
return value.filter((v) => v != null && String(v).trim() !== '').map(String);
|
||||
}
|
||||
if (value == null || value === '') {
|
||||
return [];
|
||||
}
|
||||
return String(value)
|
||||
.split(',')
|
||||
.map((v) => v.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function joinDeptIds(value: unknown): string {
|
||||
const arr = parseDeptIds(value);
|
||||
return arr.length ? arr.join(',') : '';
|
||||
}
|
||||
|
||||
function resolveCompileBy(record?: Recordable) {
|
||||
if (record?.createBy_dictText || record?.createBy) {
|
||||
return record.createBy_dictText || record.createBy || '';
|
||||
}
|
||||
const user = userStore.getUserInfo;
|
||||
return user?.realname || user?.username || '';
|
||||
}
|
||||
|
||||
function normalizeRecord(record?: Recordable) {
|
||||
if (!record) {
|
||||
return record;
|
||||
}
|
||||
return {
|
||||
...record,
|
||||
compileBy: resolveCompileBy(record),
|
||||
receiveDeptId: parseDeptIds(record.receiveDeptId),
|
||||
referenceDeptId: parseDeptIds(record.referenceDeptId),
|
||||
};
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
delete values.compileBy;
|
||||
values.receiveDeptId = joinDeptIds(values.receiveDeptId);
|
||||
values.referenceDeptId = joinDeptIds(values.referenceDeptId);
|
||||
if (!values.receiveDeptId) {
|
||||
createMessage.warning('请选择收信部门');
|
||||
return;
|
||||
}
|
||||
if (!values.referenceDeptId) {
|
||||
createMessage.warning('请选择参照部门');
|
||||
return;
|
||||
}
|
||||
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>
|
||||
.ps-compile-modal-body {
|
||||
padding: 4px 8px 0;
|
||||
max-height: calc(100vh - 220px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
:deep(.ant-picker) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.ant-divider-horizontal.ant-divider-with-text-left) {
|
||||
margin: 8px 0 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
border-color: #e8e8e8;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.ant-form-item) {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
:deep(.ps-workflow-item) {
|
||||
margin-bottom: 8px;
|
||||
|
||||
.ant-form-item-label > label {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
.ant-input[disabled] {
|
||||
color: rgba(0, 0, 0, 0.75);
|
||||
cursor: default;
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.JSelectDept .j-select-row) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="less">
|
||||
.ps-compile-modal-wrap {
|
||||
.ant-modal-body {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,2 @@
|
||||
/** 复用密炼PS编制接口,仅查询已批准(approve)记录 */
|
||||
export { list, getExportUrl } from '../mesXslMixerPsCompile/MesXslMixerPsCompile.api';
|
||||
@@ -0,0 +1,89 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
/** PS审批历史专用状态字典(键值与原状态一致,批准显示为正式发布) */
|
||||
export const PS_HISTORY_STATUS_DICT = 'xslmes_mixer_ps_history_status';
|
||||
|
||||
const historyStatusTextMap: Record<string, string> = {
|
||||
compile: '编制',
|
||||
proofread: '校对',
|
||||
audit: '审核',
|
||||
approve: '正式发布',
|
||||
};
|
||||
|
||||
export function renderHistoryStatus(text?: string) {
|
||||
if (!text) {
|
||||
return '';
|
||||
}
|
||||
return historyStatusTextMap[text] || text;
|
||||
}
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: 'PS编码', align: 'center', dataIndex: 'psCode', width: 140 },
|
||||
{ title: '类型', align: 'center', dataIndex: 'psType_dictText', width: 110 },
|
||||
{ title: '发放日期', align: 'center', dataIndex: 'issueDate', width: 110 },
|
||||
{ title: '发送部门', align: 'center', dataIndex: 'sendDeptId_dictText', width: 120 },
|
||||
{ title: '收信部门', align: 'center', dataIndex: 'receiveDeptId_dictText', width: 160 },
|
||||
{ title: '参照部门', align: 'center', dataIndex: 'referenceDeptId_dictText', width: 160 },
|
||||
{ title: '标题', align: 'center', dataIndex: 'title', width: 180 },
|
||||
{ title: '担当', align: 'center', dataIndex: 'responsiblePerson', width: 90 },
|
||||
{
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
dataIndex: 'status',
|
||||
width: 100,
|
||||
customRender: ({ text }) => renderHistoryStatus(text),
|
||||
},
|
||||
{
|
||||
title: '编制人',
|
||||
align: 'center',
|
||||
dataIndex: 'compileBy',
|
||||
width: 100,
|
||||
customRender: ({ record }) => record?.createBy_dictText || record?.createBy || '',
|
||||
},
|
||||
{ title: '校对人', align: 'center', dataIndex: 'proofreadBy', width: 100 },
|
||||
{ title: '校对时间', align: 'center', dataIndex: 'proofreadTime', width: 165 },
|
||||
{ title: '审核人', align: 'center', dataIndex: 'auditBy', width: 100 },
|
||||
{ title: '审核时间', align: 'center', dataIndex: 'auditTime', width: 165 },
|
||||
{ title: '发布人', align: 'center', dataIndex: 'approveBy', width: 100 },
|
||||
{ title: '发布时间', align: 'center', dataIndex: 'approveTime', width: 165 },
|
||||
{ title: '所属工厂', align: 'center', dataIndex: 'factoryName', width: 120, defaultHidden: true },
|
||||
{ title: '施工代号', align: 'center', dataIndex: 'constructionCode_dictText', width: 110, defaultHidden: true },
|
||||
{ title: '目的', align: 'center', dataIndex: 'purpose', width: 160, defaultHidden: true },
|
||||
{ title: '依据', align: 'center', dataIndex: 'basis', width: 160, defaultHidden: true },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165, defaultHidden: true },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '开始日期',
|
||||
field: 'issueDate_begin',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期起' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '结束日期',
|
||||
field: 'issueDate_end',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', placeholder: '发放日期止' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: 'PS编码', field: 'psCode', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '标题', field: 'title', component: 'JInput', colProps: { span: 6 } },
|
||||
{
|
||||
label: '类型',
|
||||
field: 'psType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_ps_belong' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const superQuerySchema = {
|
||||
psCode: { title: 'PS编码', order: 0, view: 'text' },
|
||||
psType: { title: '类型', order: 1, view: 'list', dictCode: 'xslmes_ps_belong' },
|
||||
constructionCode: { title: '施工代号', order: 2, view: 'list', dictCode: 'xslmes_construction_code' },
|
||||
issueDate: { title: '发放日期', order: 3, view: 'date' },
|
||||
title: { title: '标题', order: 4, view: 'text' },
|
||||
responsiblePerson: { title: '担当', order: 5, view: 'text' },
|
||||
};
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_mixer_ps_history:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslMixerPsCompileModal @register="registerModal" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslMixerPsHistory" setup>
|
||||
import { reactive } from 'vue';
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import MesXslMixerPsCompileModal from '../mesXslMixerPsCompile/components/MesXslMixerPsCompileModal.vue';
|
||||
import { PS_HISTORY_STATUS_DICT, columns, searchFormSchema, superQuerySchema } from './MesXslMixerPsHistory.data';
|
||||
import { list, getExportUrl } from './MesXslMixerPsHistory.api';
|
||||
|
||||
const APPROVED_STATUS = 'approve';
|
||||
const queryParam = reactive<any>({ status: APPROVED_STATUS });
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: 'PS审批历史',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
tableSetting: { cacheKey: 'mesXslMixerPsHistory_v20260520' },
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 90,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
width: 100,
|
||||
fixed: 'right',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
params.status = APPROVED_STATUS;
|
||||
return Object.assign(params, queryParam);
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: 'PS审批历史',
|
||||
url: getExportUrl,
|
||||
params: queryParam,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }] = tableContext;
|
||||
const superQueryConfig = reactive(superQuerySchema);
|
||||
|
||||
function handleSuperQuery(params) {
|
||||
Object.keys(params).forEach((k) => {
|
||||
queryParam[k] = params[k];
|
||||
});
|
||||
queryParam.status = APPROVED_STATUS;
|
||||
reload();
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, {
|
||||
record,
|
||||
isUpdate: true,
|
||||
showFooter: false,
|
||||
modalTitle: 'PS审批历史详情',
|
||||
statusDictCode: PS_HISTORY_STATUS_DICT,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,34 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslOpenMillParam/list',
|
||||
save = '/xslmes/mesXslOpenMillParam/add',
|
||||
edit = '/xslmes/mesXslOpenMillParam/edit',
|
||||
deleteOne = '/xslmes/mesXslOpenMillParam/delete',
|
||||
deleteBatch = '/xslmes/mesXslOpenMillParam/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslOpenMillParam/importExcel',
|
||||
exportXls = '/xslmes/mesXslOpenMillParam/exportXls',
|
||||
queryById = '/xslmes/mesXslOpenMillParam/queryById',
|
||||
queryMaterialById = '/mes/material/material/queryById',
|
||||
}
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const queryMaterialById = (params: { id: string }) =>
|
||||
defHttp.get({ url: Api.queryMaterialById, params }, { successMessageMode: 'none' });
|
||||
|
||||
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,124 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '胶料名称', align: 'center', dataIndex: 'materialName', width: 160 },
|
||||
{ title: '胶料别名', align: 'center', dataIndex: 'materialCode', width: 130 },
|
||||
{ title: 'R0进胶时间(秒)', align: 'center', dataIndex: 'r0FeedTime', width: 120 },
|
||||
{ title: 'R0成环时间(秒)', align: 'center', dataIndex: 'r0RingTime', width: 120 },
|
||||
{ title: 'R0拉断时间(秒)', align: 'center', dataIndex: 'r0BreakTime', width: 120 },
|
||||
{ title: 'R0排胶时间(秒)', align: 'center', dataIndex: 'r0DischargeTime', width: 120 },
|
||||
{ title: 'R1进胶时间(秒)', align: 'center', dataIndex: 'r1FeedTime', width: 120 },
|
||||
{ title: 'R1成环时间(秒)', align: 'center', dataIndex: 'r1RingTime', width: 120 },
|
||||
{ title: 'R1拉断时间(秒)', align: 'center', dataIndex: 'r1BreakTime', width: 120 },
|
||||
{ title: 'R1排胶时间(秒)', align: 'center', dataIndex: 'r1DischargeTime', width: 120 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100, defaultHidden: true },
|
||||
{ title: '创建时间', align: 'center', dataIndex: 'createTime', width: 165 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100, defaultHidden: true },
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '胶料',
|
||||
field: 'materialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: {
|
||||
dictCode: 'mes_material,material_name,id',
|
||||
placeholder: '请选择胶料',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '胶料别名', field: 'materialCode', component: 'JInput', colProps: { span: 6 } },
|
||||
{ label: '胶料名称', field: 'materialName', component: 'JInput', colProps: { span: 6 } },
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '胶料',
|
||||
field: 'materialId',
|
||||
component: 'Input',
|
||||
slot: 'materialPicker',
|
||||
dynamicRules: () => [{ required: true, message: '请选择胶料' }],
|
||||
},
|
||||
{
|
||||
label: '胶料名称',
|
||||
field: 'materialName',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择胶料后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '胶料别名',
|
||||
field: 'materialCode',
|
||||
component: 'Input',
|
||||
componentProps: { disabled: true, placeholder: '选择胶料后自动带出别名' },
|
||||
},
|
||||
{
|
||||
label: 'R0进胶时间',
|
||||
field: 'r0FeedTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R0成环时间',
|
||||
field: 'r0RingTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R0拉断时间',
|
||||
field: 'r0BreakTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R0排胶时间',
|
||||
field: 'r0DischargeTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R1进胶时间',
|
||||
field: 'r1FeedTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R1成环时间',
|
||||
field: 'r1RingTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R1拉断时间',
|
||||
field: 'r1BreakTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: 'R1排胶时间',
|
||||
field: 'r1DischargeTime',
|
||||
component: 'InputNumber',
|
||||
componentProps: { min: 0, precision: 2, placeholder: '单位:秒', style: { width: '100%' } },
|
||||
},
|
||||
];
|
||||
|
||||
export const superQuerySchema = {
|
||||
materialId: {
|
||||
title: '胶料',
|
||||
order: 0,
|
||||
view: 'sel_search',
|
||||
dictTable: 'mes_material',
|
||||
dictCode: 'id',
|
||||
dictText: 'material_name',
|
||||
},
|
||||
materialCode: { title: '胶料别名', order: 1, view: 'text' },
|
||||
materialName: { title: '胶料名称', order: 2, view: 'text' },
|
||||
r0FeedTime: { title: 'R0进胶时间', order: 3, view: 'number' },
|
||||
r0RingTime: { title: 'R0成环时间', order: 4, view: 'number' },
|
||||
r0BreakTime: { title: 'R0拉断时间', order: 5, view: 'number' },
|
||||
r0DischargeTime: { title: 'R0排胶时间', order: 6, view: 'number' },
|
||||
r1FeedTime: { title: 'R1进胶时间', order: 7, view: 'number' },
|
||||
r1RingTime: { title: 'R1成环时间', order: 8, view: 'number' },
|
||||
r1BreakTime: { title: 'R1拉断时间', order: 9, view: 'number' },
|
||||
r1DischargeTime: { title: 'R1排胶时间', order: 10, view: 'number' },
|
||||
};
|
||||
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'xslmes:mes_xsl_open_mill_param:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_open_mill_param:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'xslmes:mes_xsl_open_mill_param: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_open_mill_param: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_open_mill_param:edit' },
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslOpenMillParamModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslOpenMillParam" 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 MesXslOpenMillParamModal from './components/MesXslOpenMillParamModal.vue';
|
||||
import { columns, searchFormSchema, superQuerySchema } from './MesXslOpenMillParam.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslOpenMillParam.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: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
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_open_mill_param:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="800" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #materialPicker="{ model, field }">
|
||||
<JDictSelectTag
|
||||
v-model:value="model[field]"
|
||||
dictCode="mes_material,material_name,id"
|
||||
placeholder="请选择胶料"
|
||||
:disabled="isDetail"
|
||||
@update:value="(v) => onMaterialChange(model, v)"
|
||||
/>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</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 JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { formSchema } from '../MesXslOpenMillParam.data';
|
||||
import { saveOrUpdate, queryMaterialById } from '../MesXslOpenMillParam.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
/** 避免弹窗初始化回显时误触发物料回填 */
|
||||
const skipMaterialChange = ref(false);
|
||||
|
||||
const [registerForm, { setProps, resetFields, setFieldsValue, validate, scrollToField }] = useForm({
|
||||
labelWidth: 130,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
skipMaterialChange.value = true;
|
||||
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 });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
skipMaterialChange.value = false;
|
||||
});
|
||||
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : unref(isDetail) ? '详情' : '编辑'));
|
||||
|
||||
async function onMaterialChange(model: Recordable, val: unknown) {
|
||||
if (skipMaterialChange.value) {
|
||||
return;
|
||||
}
|
||||
const id = val != null && val !== '' ? String(val) : '';
|
||||
if (!id) {
|
||||
model.materialName = '';
|
||||
model.materialCode = '';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const raw = await queryMaterialById({ id });
|
||||
const row = (raw as Recordable)?.materialName != null ? raw : (raw as Recordable)?.result;
|
||||
if (row) {
|
||||
model.materialName = row.materialName ?? '';
|
||||
model.materialCode = row.aliasName ?? '';
|
||||
}
|
||||
} catch {
|
||||
model.materialName = '';
|
||||
model.materialCode = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values.materialId) {
|
||||
createMessage.warning('请选择胶料');
|
||||
return;
|
||||
}
|
||||
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>
|
||||
Reference in New Issue
Block a user