更新胶料信息处理逻辑,优化字段描述及数据验证,增强系统稳定性和用户体验。
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user