This commit is contained in:
2026-03-12 19:30:46 +08:00
15 changed files with 2848 additions and 417 deletions

View File

@ -0,0 +1,127 @@
import { LngPngMeasureSalesPurPageModel, LngPngMeasureSalesPurPageParams, LngPngMeasureSalesPurPageResult } from './model/PngMeasurePurModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
// Page = '/dayPlan/pngMeasurePur/page',
Page = '/magic-api/dayPlan/pngMeasurePurPageList',
List = '/dayPlan/pngMeasurePur/list',
Info = '/dayPlan/pngMeasurePur/info',
LngPngMeasureSalesPur = '/dayPlan/pngMeasurePur',
submit = '/dayPlan/pngMeasurePur/submit',
Cancel = '/dayPlan/pngMeasurePur/cancel',
Reject = '/dayPlan/pngMeasurePur/reject',
DataLog = '/dayPlan/pngMeasurePur/datalog',
}
export async function rejectLngPngMeasurePur(lngPngMeasureSalesPur: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.Reject,
params: lngPngMeasureSalesPur,
},
{
errorMessageMode: mode,
},
);
}
export async function submitLngPngMeasurePur(lngPngMeasureSalesPur: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.submit,
params: lngPngMeasureSalesPur,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 取消LngPngMeasureSalesPur
*/
export async function cancelLngPngMeasurePur(lngPngMeasureSalesPur: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.Cancel,
params: lngPngMeasureSalesPur,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 查询LngPngMeasureSalesPur分页列表
*/
export async function getLngPngMeasureSalesPurPage(params: LngPngMeasureSalesPurPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngMeasureSalesPurPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngPngMeasureSalesPur信息
*/
export async function getLngPngMeasureSalesPur(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngMeasureSalesPurPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngPngMeasureSalesPur
*/
export async function addLngPngMeasureSalesPur(lngPngMeasureSalesPur: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngPngMeasureSalesPur,
params: lngPngMeasureSalesPur,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngPngMeasureSalesPur
*/
export async function updateLngPngMeasureSalesPur(lngPngMeasureSalesPur: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngPngMeasureSalesPur,
params: lngPngMeasureSalesPur,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngPngMeasureSalesPur批量删除
*/
export async function deleteLngPngMeasureSalesPur(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngPngMeasureSalesPur,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,102 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngPngMeasureSalesPur分页参数 模型
*/
export interface LngPngMeasureSalesPurPageParams extends BasicPageParams {
id: string;
datePlan: string;
dateMea: string;
cuCode: string;
pointDelyCode: string;
suCode: string;
pointUpCode: string;
qtySalesGj: string;
qtySalesM3: string;
qtyMeaGj: string;
qtyMeaM3: string;
rateM3Gj: string;
modifyDate: string;
cfmCuUserId: string;
cfmCuUserTime: string;
cfmEmpId: string;
cfmEmpTime: string;
ksId: string;
kpId: string;
salesPurId: string;
comId: string;
}
/**
* @description: LngPngMeasureSalesPur分页返回值模型
*/
export interface LngPngMeasureSalesPurPageModel {
id: string;
datePlan: string;
dateMea: string;
cuCode: string;
pointDelyCode: string;
suCode: string;
pointUpCode: string;
qtySalesGj: string;
qtySalesM3: string;
qtyMeaGj: string;
qtyMeaM3: string;
rateM3Gj: string;
modifyDate: string;
cfmCuUserId: string;
cfmCuUserTime: string;
cfmEmpId: string;
cfmEmpTime: string;
ksId: string;
kpId: string;
salesPurId: string;
comId: string;
}
0;
/**
* @description: LngPngMeasureSalesPur分页返回值结构
*/
export type LngPngMeasureSalesPurPageResult = BasicFetchResult<LngPngMeasureSalesPurPageModel>;

View File

@ -11,9 +11,9 @@ export class InputNumberModel {
ref: any;
get numberFormat() {
if(this._fmt==undefined){
// if(this._fmt==undefined){
this._fmt = this.createNumberFmt(this.digits);
}
// }
return this._fmt;
}

View File

@ -142,7 +142,7 @@
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD HH:mm:ss ', true]],
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
submitButtonOptions: {
text: '搜索',

View File

@ -86,7 +86,7 @@
const tableButtonConfig = computed(() => {
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
return [{"isUse":true,"name":"审批通过","code":"approveGD","icon":"ant-design:check-outlined","isDefault":true}]
return [{"isUse":true,"name":"审批通过","code":"approveGD","icon":"ant-design:check-outlined","isDefault":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true}]
});
const actionButtonConfig = computed(() => {
@ -245,9 +245,12 @@
}
function buttonClick(code) {
// btnEvent[code]();
if (code== 'refresh') {
btnEvent[code]();
} else {
handleBatchApprove()
}
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id

View File

@ -86,7 +86,7 @@
})
const tableButtonConfig = computed(() => {
return [{"isUse":true,"name":"审批通过","code":"approveGD","icon":"ant-design:check-outlined","isDefault":true}]
return [{"isUse":true,"name":"审批通过","code":"approveGD","icon":"ant-design:check-outlined","isDefault":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true}]
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
@ -259,8 +259,11 @@
}
function buttonClick(code) {
if (code== 'refresh') {
btnEvent[code]();
} else {
handleBatchApprove()
// btnEvent[code]();
}
}
function handleDatalog (record: Recordable) {
modalVisible.value = true

View File

@ -0,0 +1,224 @@
<template>
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="{}"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
/>
</template>
<script lang="ts" setup>
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
import { formProps, formEventConfigs ,formConfig} from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addLngPngMeasureSalesPur, getLngPngMeasureSalesPur, updateLngPngMeasureSalesPur, deleteLngPngMeasureSalesPur } from '/@/api/dayPlan/PngMeasurePur';
import { cloneDeep } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { FromPageType } from '/@/enums/workflowEnum';
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
import { useRouter } from 'vue-router';
const { filterFormSchemaAuth } = usePermission();
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
const { currentRoute } = useRouter();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: {schemas:[]} as FormDataProps,
});
const state = reactive({
formModel: {},
});
let customFormEventConfigs=[];
onMounted(async () => {
try {
// 合并渲染覆盖配置中的字段配置、表单事件配置
await mergeCustomFormRenderConfig();
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
} else if (props.fromPage == FromPageType.PREVIEW) {
// 预览 无需权限,表单事件也无需执行
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
emits('form-mounted', formProps);
} catch (error) {
}
});
async function mergeCustomFormRenderConfig() {
let cloneProps=cloneDeep(formProps);
let fEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
if(props.fromPage !== FromPageType.FLOW){
let formPath=currentRoute.value.query.formPath;
//1.合并字段配置
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
//2.合并表单事件配置
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
}
}
data.formDataProps=cloneProps;
customFormEventConfigs=fEventConfigs;
}
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
}
// 校验form 通过返回表单数据
async function validate() {
let values = [];
try {
values = await systemFormRef.value?.validate();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 根据行唯一ID查询行数据并设置表单数据 【编辑】
async function setFormDataFromId(rowId, skipUpdate) {
try {
const record = await getLngPngMeasureSalesPur(rowId);
if (skipUpdate) {
return record;
}
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
return record;
} catch (error) {
}
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm(isDisabled) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateLngPngMeasureSalesPur(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addLngPngMeasureSalesPur(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
const cloneProps=cloneDeep(formProps);
customFormEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
const parts = obj.formConfigKey.split('_');
const formId=parts[1];
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
}
let flowData = changeWorkFlowForm(cloneProps, obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
if(formModels[RowKey]) {
setFormDataFromId(formModels[RowKey], false)
} else {
setFieldsValue(formModels)
}
} catch (error) {}
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
function getFormModel() {
return systemFormRef.value.formModel
}
async function handleDelete(id) {
return await deleteLngPngMeasureSalesPur([id]);
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFormModel,
handleDelete
});
</script>

View File

@ -0,0 +1,110 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { formProps } from './config';
import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum';
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
isCopy: false,
rowId: '',
});
const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
state.isCopy = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 900,
});
if (state.isUpdate || state.isView || state.isCopy) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
});
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
async function saveModal() {
let saveSuccess = false;
try {
const values = await formRef.value?.validate();
//添加隐藏组件
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (!state.isUpdate || state.isCopy) {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
}
return saveSuccess;
} catch (error) {}
}
} catch (error) {
return saveSuccess;
}
}
async function handleSubmit() {
try {
const saveSuccess = await saveModal();
setModalProps({ confirmLoading: true });
if (saveSuccess) {
if (!state.isUpdate || state.isCopy) {
//false 新增
notification.success({
message: 'Tip',
description: t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,317 @@
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: 'id',
fieldId: 'id',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'c910ef241351491ea24b9ec3dff5b962',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '计划日期',
fieldId: 'datePlan',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'faa288d9a1374c148c1c894004677b35',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '计量日期',
fieldId: 'dateMea',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'fa41d78b28654247b230764ad8bfc521',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '客户',
fieldId: 'cuCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8521e888da2d41ebb7751a3b001604c6',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '下载点',
fieldId: 'pointDelyCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '81623a1d60454d158e484e3858f7e56a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '供应商',
fieldId: 'suCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '52b7f27315704165a697b29f26e398f1',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '上载点',
fieldId: 'pointUpCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '95b7261c537e478f8d9d27a57c3da878',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '批复量 (吉焦)',
fieldId: 'qtySalesGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'f52ab7c25c3548a1a0e8b5acbfd10692',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '批复量 (方)',
fieldId: 'qtySalesM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'cc30102240434c61adeb45a9d04ba0cd',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '完成量 (吉焦)',
fieldId: 'qtyMeaGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '0bd6106c5273403296dbea6b6110cfe1',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '完成量 (方)',
fieldId: 'qtyMeaM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '975abc1b3ab142298c0a3177fb104b44',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '比值 (方/吉焦)',
fieldId: 'rateM3Gj',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'dadec2e649074a539771a661c3cbec90',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '附件',
fieldId: 'modifyDate',
isSubTable: false,
showChildren: true,
type: 'input',
key: '7adebb1d02b449248b8f1f76e0227eaf',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '客户确认人',
fieldId: 'cfmCuUserId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '04bfdc91e3aa45659defa2704fdbdf93',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '客户确认时间',
fieldId: 'cfmCuUserTime',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'c9db7957b454491a9c89ea8a83697d36',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '内部确认人',
fieldId: 'cfmEmpId',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'ec851f8e853d485d98e418413b2f19b7',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '内部确认时间',
fieldId: 'cfmEmpTime',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'a5b1119bc04b46aba72d11c4a8a83bf2',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '销售合同',
fieldId: 'ksId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '77e0ae785c7144f081edb386eee8d896',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '采购合同',
fieldId: 'kpId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '7c8dbc9a889945f88e62076f7bd9f2c3',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '状态',
fieldId: 'salesPurId',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e449b13549194b669491d020a7a48018',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '驳回意见',
fieldId: 'comId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '4009a493af0f4c8eab6290d648d9b178',
children: [],
},
];

View File

@ -0,0 +1,425 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="PngMeasurePurStyle">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'lngFileUploadList'">
<div v-for="(item, idx) in record.lngFileUploadList">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
</div>
</template>
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<PngMeasurePurModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<rejectReplyModal :visible="isOpen" @success="handleRejectReply" />
</PageWrapper>
</template>
<script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/dayPlan/pngMeasurePur/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, watch } from 'vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngPngMeasureSalesPurPage, deleteLngPngMeasureSalesPur,submitLngPngMeasurePur,
cancelLngPngMeasurePur, rejectLngPngMeasurePur} from '/@/api/dayPlan/PngMeasurePur';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { getLngPngMeasureSalesPur } from '/@/api/dayPlan/PngMeasurePur';
import { useModal } from '/@/components/Modal';
import PngMeasurePurModal from './components/PngMeasurePurModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
import rejectReplyModal from '/@/components/common/rejectReplyModal.vue';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage();
const { t } = useI18n();
const isOpen = ref(false)
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref();
const tableData = ref([])
const selectedKeys = ref<string[]>([]);
//所有按钮
const buttons = ref([{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true},{"name":"确认","code":"submit","icon":"ant-design:check-outlined","isDefault":false,"isUse":true},{"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":false,"isUse":true},{"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":false,"isUse":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','submit','cancel','reject']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
let arr =[{"name":"确认","code":"submit","icon":"ant-design:check-outlined","isDefault":true,"isUse":true},{"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true,"isUse":true},{"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},]
return arr
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {refresh : handleRefresh,datalog : handleDatalog,submit: handleSubmit, cancel: handleCancel, reject: handleReject}
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, setTableData,clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngMeasureSalesPurPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['dateMea', ['dateMeaStart', 'dateMeaEnd'], 'YYYY-MM-DD'],['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableData.value = res || []
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 120,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
watch(
() => tableData.value,
(val) => {
if (val) {
let arr = DataFormat.format(val, [
FormatOption.createQty('qtySalesGj'),
FormatOption.createQty('qtySalesM3'),
FormatOption.createQty('qtyMeaGj'),
FormatOption.createQty('qtyMeaM3'),
FormatOption.createQty('rateM3Gj', 6),
]);
if (arr.length) {
setTableData(arr)
}
}
},
{
immediate: true,
deep: true,
}
);
const handleDownload = (info) => {
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
downloadByUrl({ url, fileName: fileName});
};
function onSelectChange(selectedRowKeys: [], selectedRows) {
selectedKeys.value = selectedRowKeys;
}
function dbClickRow(record) {
}
function buttonClick(code) {
btnEvent[code]('batch');
}
async function handleSubmit (val) {
if (val=='batch') {
if (!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要确认的数据'),
});
return;
}
} else {
selectedKeys.value= [val?.id]
}
await submitLngPngMeasurePur(selectedKeys.value)
handleSuccess();
notification.success({
message: '提示',
description: t('确认成功!'),
});
clearSelectedRowKeys()
}
async function handleCancel (val) {
if (val=='batch') {
if (!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要取消的数据'),
});
return;
}
} else {
selectedKeys.value= [val?.id]
}
await cancelLngPngMeasurePur(selectedKeys.value)
handleSuccess();
notification.success({
message: '提示',
description: t('取消成功!'),
});
clearSelectedRowKeys()
}
function handleReject (val) {
if (val=='batch') {
if (!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要驳回的数据'),
});
return;
}
} else {
selectedKeys.value= [val?.id]
}
isOpen.value = true
}
const handleRejectReply = async (val) => {
let obj = {
"ids": selectedKeys.value,
"rejNote": val.reply,
}
await rejectLngPngMeasurePur(obj)
isOpen.value = false
handleSuccess();
notification.success({
message: '提示',
description: t('已驳回!'),
});
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
function handleRefresh() {
reload();
}
function handleSuccess() {
selectedKeys.value = [];
reload();
}
onMounted(() => {
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
let submitBtn: ActionItem[] = [];
let cancelBtn: ActionItem[] = [];
let rejectBtn: ActionItem[] = [];
let datalogBtn: ActionItem[] = [];
let actionsList: ActionItem[] = [];
actionButtonConfig.value?.map((button) => {
if (['submit'].includes(button.code)) {
submitBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['cancel'].includes(button.code)) {
cancelBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['reject'].includes(button.code)) {
rejectBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['datalog'].includes(button.code)) {
datalogBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
});
if (record.statusCode=='JLZ') {
actionsList = actionsList.concat(submitBtn);
}
if (record.statusCode=='JLWC') {
actionsList = actionsList.concat(cancelBtn);
}
if (record.statusCode=='JLZ'&&record.cfmCuUserId) {
actionsList = actionsList.concat(rejectBtn);
}
actionsList = actionsList.concat(datalogBtn);
return actionsList;
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less">
.PngMeasurePurStyle .cusSearchForm .advanceRow> div:nth-of-type(3){
display: none;
}
</style>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 80px !important;
}
:deep( .ant-col-8:nth-child(2)) {
width: 330px !important;
max-width: 330px !important;
}
:deep(.ant-col-8:nth-child(2) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(2) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
:deep( .ant-col-8:nth-child(6)) {
width: 330px !important;
max-width: 330px !important;
}
:deep(.ant-col-8:nth-child(6) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(6) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
:deep( .ant-col-8:nth-child(3)) {
width: 330px !important;
max-width: 330px !important;
}
:deep(.ant-col-8:nth-child(3) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(3) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
:deep( .ant-col-8:nth-child(5)) {
width: 330px !important;
max-width: 330px !important;
}
:deep(.ant-col-8:nth-child(5) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(5) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
</style>

View File

@ -7,8 +7,8 @@ export const formConfig = {
export const searchFormSchema: FormSchema[] = [
{
field: 'datePlan',
label: '计日期',
field: 'dateMea',
label: '计日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
@ -17,18 +17,18 @@ export const searchFormSchema: FormSchema[] = [
},
},
{
field: 'suCode',
field: 'suName',
label: '供应商名称/简称/编码',
component: 'Input',
},
{
field: 'pointUpName',
label: '载点',
field: 'pointDelyName',
label: '载点',
component: 'Input',
},
{
field: 'pointUpName',
label: '载点',
field: 'pointDelyName',
label: '载点',
component: 'Input',
},
];
@ -52,15 +52,15 @@ export const columns: BasicColumn[] = [
width: 120,
sorter: true,
},
{
dataIndex: 'cuSname',
title: '客户',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 200,
sorter: true,
},
// {
// dataIndex: 'cuSname',
// title: '客户',
// componentType: 'input',
// align: 'left',
// ellipsis: true,
// width: 200,
// sorter: true,
// },
{
dataIndex: 'pointDelyName',
title: '下载点',
@ -101,7 +101,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'qtySalesM3',
title: '批复量(方)',
title: '批复量(方)',
componentType: 'input',
align: 'left',
width: 120,
@ -110,7 +110,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'qtyMeaGj',
title: '完成量(吉焦)',
title: '提气量(吉焦)',
componentType: 'input',
align: 'left',
width: 120,
@ -119,13 +119,20 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'qtyMeaM3',
title: '完成量(方)',
title: '提气量(方)',
componentType: 'input',
align: 'left',
width: 120,
sorter: true,
},
{
dataIndex: 'lngFileUploadList',
title: '附件',
componentType: 'input',
align: 'left',
width: 200,
sorter: true,
},
{
dataIndex: 'rateM3Gj',
title: '比值(方/吉焦)',
@ -137,7 +144,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'cfmCuUserName',
title: '客户确认人',
title: '确认人',
componentType: 'input',
align: 'left',
width: 110,
@ -146,7 +153,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'cfmCuUserTime',
title: '客户确认时间',
title: '确认时间',
componentType: 'input',
align: 'left',
width: 180,
@ -155,7 +162,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'cfmEmpName',
title: '内部确认人',
title: '业务确认人',
componentType: 'input',
align: 'left',
width: 110,
@ -164,7 +171,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'cfmEmpTime',
title: '内部确认时间',
title: '业务确认时间',
componentType: 'input',
align: 'left',
width: 150,
@ -172,32 +179,13 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'ksName',
title: '销售合同',
title: '合同',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 200,
sorter: true,
},
{
dataIndex: 'kpName',
title: '采购合同',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 200,
sorter: true,
},
{
dataIndex: 'lngFileUploadList',
title: '附件',
componentType: 'input',
align: 'left',
width: 200,
sorter: true,
},
{
dataIndex: 'statusName',
title: '状态',
@ -208,8 +196,8 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'note',
title: '备注',
dataIndex: 'rejNote',
title: '驳回意见',
componentType: 'input',
align: 'left',
ellipsis: true,

View File

@ -1,20 +1,14 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" width="85%" :title="getTitle" @ok="handleSubmit" @visible-change="handleVisibleChange">
<a-spin :spinning="spinning" tip="加载中...">
<searchForm @search="onSearch" @reset="onReset" ></searchForm>
<BasicTable @register="registerTable" v-if="showTable">
<BasicTable @register="registerTable" v-if="showTable" class="PngMeasureSalesPurForm">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'qtySalesGj'">
{{ Number.format(Number.parse(record.qtySalesGj),numFormat) }}
</template>
<template v-if="column.dataIndex === 'qtyMeaGj'">
{{ Number.format(Number.parse(record.qtyMeaGj || 0),numFormat) }}
</template>
<template v-if="column.dataIndex === 'qtySalesM3'">
{{ Number.format(Number.parse(NP.divide(Number(record.qtySalesM3), 10000)),numFormat) }}
</template>
<template v-if="column.dataIndex === 'qtyMeaM3'">
{{ Number.format(Number.parse(NP.divide(Number(record.qtyMeaM3), 10000)),numFormat) }}
{{ Number.format(Number.parse(record.qtySalesM3),numFormat) }}
</template>
</template>
</BasicTable>
@ -38,8 +32,6 @@
import { useUserStore } from '/@/store/modules/user';
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
import { getLngPngMeasureSalesPurPageAdd, addLngPngMeasureSalesPur } from '/@/api/dayPlan/PngMeasureSalesPur';
import {formConfig, searchFormSchema, columns } from './config';
import searchForm from './searchForm.vue';
import NP from 'number-precision';
const userStore = useUserStore();
@ -50,7 +42,92 @@
const { currentRoute } = router;
const tabStore = useMultipleTabStore();
const codeFormSchema: FormSchema[] = [
{
field: 'datePlan',
label: '计划日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'pointDelyName',
label: '下载点',
component: 'Input',
},
{
field: 'suCode',
label: '供应商名称/简称/编码',
component: 'Input',
},
];
const columns: BasicColumn[] = [
{
dataIndex: 'datePlan',
title: '计划日期',
componentType: 'input',
align: 'left',
width: 120,
ellipsis: true,
},
{
dataIndex: 'pointDelyName',
title: '下载点',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 120,
},
{
dataIndex: 'suSname',
title: '供应商',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 150,
},
{
dataIndex: 'pointUpName',
title: '上载点',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 120,
},
{
dataIndex: 'qtySalesGj',
title: '批复量(吉焦)',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'qtySalesM3',
title: '批复量(方)',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'ksName',
title: '销售合同',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 150,
},
{
dataIndex: 'comName',
title: '交易主体',
componentType: 'input',
align: 'left',
width: 120,
},
];
const spinning = ref(false);
const { t } = useI18n();
const formState = ref({});
@ -75,9 +152,9 @@
canResize: false,
formConfig: {
labelCol:{span: 9},
schemas: [],
showResetButton: false,
showSubmitButton: false
schemas: codeFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
immediate: false,
beforeFetch: (params) => {
@ -96,7 +173,6 @@
await nextTick();
await nextTick();
nextTick(() => {
reload({searchInfo:{'limit':1,'size':10,'page':1}});
});
}
@ -105,14 +181,6 @@
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const onSearch = (val) => {
formState.value = val
reload()
}
const onReset = () => {
formState.value ={ page: 1,size: 10}
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
@ -127,7 +195,7 @@
await addLngPngMeasureSalesPur(selectedValues.value);
spinning.value = false;
notification.success({
message: 'Tip',
message: '提示',
description: '保存成功'
});
closeModal();
@ -138,10 +206,34 @@
}
</script>
<style lang="less" scoped>
:deep(.ant-table-title) {
display: none !important;
<style >
.PngMeasureSalesPurForm .basicCol{
position: inherit !important;
top: 0;
}
</style>
<style lang="less" scoped>
:deep( .ant-col-8:nth-child(1)) {
width: 360px !important;
max-width: 360px !important;;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
:deep( .ant-col-8:nth-child(3)) {
width: 360px !important;
max-width: 360px !important;;
}
:deep(.ant-col-8:nth-child(3) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(3) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
:deep( .ant-col-9) {
flex:auto !important
}
</style>

View File

@ -1,41 +1,27 @@
<template>
<div class="pd">
<div>
<template v-for="button in tableButtonConfig" :key="button.code" >
<a-button class="pr" v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button class="pr" v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</div>
<div :class="isExpend ? 'formStyle' : ''">
<searchForm @toggle="toggle" @search="onSearch" @reset="onReset"></searchForm>
</div>
</div>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="PngMeasureSalesPurStyle">
<BasicTable :loading="loading" :columns="columns" :data-source="tableData" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }"
rowKey="id" :pagination="pagination" @row-dbClick="dbClickRow" :scroll="{x: 2000}">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'qtySalesGj'">
{{ Number.format(Number.parse(record.qtySalesGj),numFormat) }}
</template>
<template v-if="column.dataIndex === 'qtySalesM3'">
{{ Number.format(Number.parse(record.qtySalesM3),numFormat) }}
</template>
<template v-if="column.dataIndex === 'qtyMeaGj'">
<input-number v-model:value="record.qtyMeaGj" :digits="3"
v-if="record.statusCode==='N'|| record.statusCode==='JLZ'" @change="numChange(record, index)" :min="0" style="width: 100%" />
<div v-else>{{ Number.format(Number.parse(record.qtyMeaGj),numFormat) }}</div>
<input-number v-model:value="record.qtyMeaGj" :disabled="!(record.statusCode==='JLZ'&&!record.cfmCuUserId&&!recorddataSource)"
@change="numChange(record)" :min="0" :digits="3" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'qtyMeaM3'">
<input-number v-model:value="record.qtyMeaM3" :digits="3"
v-if="record.statusCode==='N'|| record.statusCode==='JLZ'" @change="numChange(record, index)" :min="0" style="width: 100%" />
<div v-else>{{ Number.format(Number.parse(record.qtyMeaM3),numFormat) }}</div>
<input-number v-model:value="record.qtyMeaM3" :disabled="!(record.statusCode==='JLZ'&&!record.cfmCuUserId&&!recorddataSource)"
@change="numChange(record)" :min="0" :digits="3" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'lngFileUploadList'">
<div>
@ -43,7 +29,7 @@
:multiple="true" :dataDelete="true" :isShowTip="false" :isShowBtnIcon="false" @click="onUpload(index)" @change="uploadChange" :showDownloadIcon="false"/>
<div v-for="(item, idx) in record.lngFileUploadList">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
<span @click="deleteFile(record, idx, index)" class="delIcon"><DeleteOutlined /></span>
<span @click="deleteFile(record, idx)" class="delIcon"><DeleteOutlined /></span>
</div>
</div>
</template>
@ -54,10 +40,10 @@
</BasicTable>
<PngMeasureSalesPurModal @register="registerModal" @success="handleSuccess" />
<createFormModal @register="registerModalForm" @success="handleSuccessForm"/>
<ImportModal @register="registerImportModal" importUrl="/dayPlan/pngMeasureSalesPur/import" @success="handleImportSuccess"/>
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<createFormModal @register="registerModalForm" @success="handleSuccessForm"/>
</PageWrapper>
</template>
<script lang="ts" setup>
@ -65,7 +51,7 @@
const logId = ref('')
const logPath = ref('/dayPlan/pngMeasureSalesPur/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, createVNode, } from 'vue';
import { ref, computed, onMounted, onUnmounted, createVNode,watch } from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
@ -92,12 +78,11 @@
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
import { DeleteOutlined } from '@ant-design/icons-vue';
import searchForm from './components/searchForm.vue'
import NP from 'number-precision';
import createFormModal from './components/createForm.vue'
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const numFormat = "###,###,###,###,###,###.000"
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
@ -109,48 +94,39 @@
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref();
const tableData = ref([])
const total = ref(0);
const currentPage = ref(1);
const pageSize = ref(10);
const loading = ref(false)
// 分页配置
const pagination = computed(() => ({
total: total.value,
current: currentPage.value,
pageSize: pageSize.value,
showQuickJumper: true,
showSizeChanger: true,
showTotal: (total: number) => `${total}条数据`,
pageSizeOptions: ["10", "20", "50", "80", "100"],
onShowSizeChange: (current, pageSize) => {
pageSize.value = pageSize;
loadData()
},
onChange: (current, size) => {
pageSize.value = size;
loadData()
},
}));
//所有按钮
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"保存","code":"save","icon":"ant-design:save-outlined","isDefault":true},{"isUse":true,"name":"保存并确认","code":"submit","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true},{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true},{"isUse":true,"name":"导出","code":"export","icon":"ant-design:export-outlined","isDefault":true},{"isUse":true,"name":"导入","code":"import","icon":"ant-design:import-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"batchdelete","icon":"ant-design:delete-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true}]);
const buttons = ref([,
{"isUse":true,"name":"保存","code":"save","icon":"ant-design:save-outlined","isDefault":true},
{"isUse":true,"name":"保存并确认","code":"submit","icon":"ant-design:check-outlined","isDefault":true},
{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true},
{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},
{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','save','submit','cancel',]);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
let arr =[
{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},
{"isUse":true,"name":"保存","code":"save","icon":"ant-design:save-outlined","isDefault":true},
{"isUse":true,"name":"保存并确认","code":"submit","icon":"ant-design:check-outlined","isDefault":true},
{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true},
{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},
{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true}]
return arr
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd, refresh : handleRefresh,batchdelete : handleBatchdelete,import : handleImport,export : handleExport,
save: handleSave, submit: handleSubmit, cancel: handleCancel, reject: handleReject}
const btnEvent = {add : handleAdd, refresh : handleRefresh,delete : handleDelete,import : handleImport,export : handleExport,
save: handleSave, submit: handleSubmit, cancel: handleCancel, reject: handleReject,datalog : handleDatalog}
const tableData = ref([])
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
@ -162,84 +138,100 @@
const curIdx = ref()
const [registerModal, { openModal }] = useModal();
const [registerModalForm, { openModal: openModalForm }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const [registerModalForm, { openModal: openModalForm }] = useModal();
const tableId = '';
const tableName = 'PngMeasureSalesPur';
const columnName = 'PngMeasureSalesPur';
// const formName='管道气采购计量';
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, clearSelectedRowKeys, getDataSource, updateTableDataRecord,setTableData }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngMeasureSalesPurPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['dateMea', ['dateMeaStart', 'dateMeaEnd'], 'YYYY-MM-DD']],
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit};
},
afterFetch: (res) => {
tableData.value = res || []
tableRef.value.setToolBarWidth();
const loadData = async () => {
loading.value = true;
try {
const res = await getLngPngMeasureSalesPurPage({
limit: currentPage.value,
size: pageSize.value,
page: currentPage.value,
...formState.value,
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
tableData.value = res.list || [];
tableData.value.forEach(v=> {
v.qtySalesM3 = NP.divide(Number(v.qtySalesM3), 10000)
v.qtyMeaM3 = NP.divide(Number(v.qtyMeaM3), 10000)
})
total.value = res.total || res.length || 0;
} catch (error) {
console.error('获取列表失败:', error);
} finally {
loading.value = false;
watch(
() => tableData.value,
(val) => {
if (val) {
let arr = DataFormat.format(val, [
FormatOption.createQty('qtySalesGj'),
FormatOption.createQty('qtySalesM3'),
FormatOption.createQty('rateM3Gj', 6),
]);
if (arr.length) {
setTableData(arr)
}
};
const isExpend = ref(false)
const formState = ref({})
const toggle = (val)=> {
isExpend.value = val
}
const onSearch = (val)=> {
formState.value = val
handleSuccess()
}
const onReset = (val)=> {
formState.value ={ page: 1,size: 10}
handleSuccess()
},
{
immediate: true,
deep: true,
}
);
const onUpload = (index) => {
curIdx.value = index
}
const uploadChange = (val) => {
tableData.value[curIdx.value].lngFileUploadList = val
let data = getDataSource()
let record = data[curIdx.value]
record.lngFileUploadList = val
updateTableDataRecord(record.id, record)
}
const deleteFile = (record, idx, index) => {
const deleteFile = (record, idx) => {
record.lngFileUploadList.splice(idx, 1)
tableData.value[index] = record
updateTableDataRecord(record.id, record)
}
const handleDownload = (info) => {
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
downloadByUrl({ url, fileName: fileName});
};
const numChange = (record, index) => {
record.rateM3Gj = Number(record.qtyMeaGj) ? (Number(record.qtyMeaM3) || 0 ) / Number(record.qtyMeaGj) : 0
const numChange = (record) => {
record.rateM3Gj = Number(record.qtyMeaGj) ? (Number(record.qtyMeaM3) || 0 ) / Number(record.qtyMeaGj) : '0'
record.rateM3Gj = record.rateM3Gj ? Number(record.rateM3Gj).toFixed(6) : 0
tableData.value[index] = record
updateTableDataRecord(record.id, record)
}
const handleSuccessForm = (val) => {
handleSuccess()
}
function handleAdd() {
openModalForm(true,{isUpdate: false});
// router.push({
// path: '/dayPlan/PngMeasureSalesPur/createForm',
// query: {
// formPath: 'dayPlan/PngMeasureSalesPur',
// formName: "新建"+formName,
// formId:currentRoute.value.meta.formId,
// type:'add'
// }
// });
}
async function handleReject() {
if (!selectedRowsData.value.length) {
@ -255,9 +247,11 @@
message: '提示',
description: t('已驳回!'),
});
clearSelectedRowKeys()
}
async function handleCancel() {
async function handleCancel(val) {
if (val=='batch') {
if (!selectedRowsData.value.length) {
notification.warning({
message: '提示',
@ -265,14 +259,19 @@
});
return;
}
} else {
selectedRowsData.value= [{...val}]
}
await cancelLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: '提示',
description: t('取消成功!'),
});
clearSelectedRowKeys()
}
async function handleSubmit() {
async function handleSubmit(val) {
if (val=='batch') {
if (!selectedRowsData.value.length) {
notification.warning({
message: '提示',
@ -280,18 +279,20 @@
});
return;
}
selectedRowsData.value.forEach(v => {
v.qtyMeaM3 = NP.times(Number(v.qtyMeaM3), 10000)
v.qtySalesM3 = NP.times(Number(v.qtySalesM3), 10000)
})
} else {
selectedRowsData.value= [{...val}]
}
await updateLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: '提示',
description: t('确认成功!'),
});
clearSelectedRowKeys()
}
async function handleSave() {
async function handleSave(val) {
if (val=='batch') {
if (!selectedRowsData.value.length) {
notification.warning({
message: '提示',
@ -299,16 +300,16 @@
});
return;
}
selectedRowsData.value.forEach(v => {
v.qtyMeaM3 = NP.times(Number(v.qtyMeaM3), 10000)
v.qtySalesM3 = NP.times(Number(v.qtySalesM3), 10000)
})
} else {
selectedRowsData.value= [{...val}]
}
await addLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: '提示',
description: t('保存成功!'),
});
clearSelectedRowKeys()
}
function dbClickRow(record) {
@ -348,13 +349,14 @@
}
function buttonClick(code) {
btnEvent[code]();
btnEvent[code]('batch');
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
function handleBatchdelete() {
function handleDelete(val) {
if (val=='batch') {
if (!selectedKeys.value.length) {
notification.warning({
message: '提示',
@ -362,6 +364,10 @@
});
return;
}
} else {
selectedKeys.value= [val?.id]
}
//与工作流相关的数据不能进行批量删除
const cantDelete = selectedRowsData.value.filter((x) => {
return (
@ -401,14 +407,14 @@
selectedKeys.value = selectedRowKeys;
selectedRowsData.value = selectedRows;
}
function handleRefresh() {
loadData();
reload();
}
function handleSuccess() {
selectedKeys.value = [];
selectedRowsData.value = [];
loadData();
reload();
}
async function handleExport() {
const res = await exportLngPngMeasureSalesPur({ isTemplate: false });
@ -426,7 +432,7 @@
});
}
function handleImportSuccess(){
loadData()
reload()
}
onMounted(() => {
@ -436,8 +442,9 @@
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
loadData()
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
@ -448,31 +455,79 @@
}
});
function getActions(record: Recordable):ActionItem[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
let saveBtn: ActionItem[] = [];
let submitBtn: ActionItem[] = [];
let cancelBtn: ActionItem[] = [];
let deleteBtn: ActionItem[] = [];
let datalogBtn: ActionItem[] = [];
let actionsList: ActionItem[] = [];
actionButtonConfig.value?.map((button) => {
if (['save'].includes(button.code)) {
saveBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['submit'].includes(button.code)) {
submitBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['cancel'].includes(button.code)) {
cancelBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['delete'].includes(button.code)) {
deleteBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
});
}
if (['datalog'].includes(button.code)) {
datalogBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
});
}
});
if (record.statusCode=='JLZ'&&!record.cfmCuUserId&&!record.dataSource) {
actionsList = actionsList.concat(saveBtn);
}
if (record.statusCode=='JLZ'&&!record.cfmCuUserId) {
actionsList = actionsList.concat(submitBtn);
}
if (record.statusCode=='JLZ'&&record.cfmCuUserId) {
actionsList = actionsList.concat(cancelBtn);
}
if (record.statusCode=='JLZ'&&!record.dataSource) {
actionsList = actionsList.concat(deleteBtn);
}
actionsList = actionsList.concat(datalogBtn);
return actionsList;
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less">
.PngMeasureSalesPurStyle .cusSearchForm .advanceRow> div:nth-of-type(3){
@ -500,33 +555,23 @@
cursor: pointer;
margin-bottom: 5px;
}
.pd {
padding: 6px 4px 0px 8px;
position: relative;
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;
}
.pr {
margin-right: 4px;
margin-bottom: 8px;
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
.pr:nth-child(1) {
margin-left: 4px;
:deep( .ant-col-8:nth-child(2)) {
width: 330px !important;
max-width: 330px !important;
}
.formStyle {
position: absolute;
max-height: 400px;
z-index: 6;
background: #fff;
border: 1px solid rgba(204, 204, 204, 0.47);
box-shadow: 1px 2px 10px #ccc;
top: 0;
left: 0;
right: 0;
padding: 12px 0 8px 15px;
align-items: self-start !important;
justify-content: space-between;
margin: 2px 4px 12px 8px;
:deep(.ant-col-8:nth-child(2) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-table-title) {
display: none !important;
:deep(.ant-col-8:nth-child(2) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
</style>

View File

@ -17,27 +17,25 @@
</div>
</div>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="PngMeasureSalesPurStyle">
<BasicTable @register="registerTable" ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }" @row-dbClick="dbClickRow">
<BasicTable :loading="loading" :columns="columns" :data-source="tableData" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }"
rowKey="id" :pagination="pagination" @row-dbClick="dbClickRow" :scroll="{x: 2000}">
<!-- <template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template> -->
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'qtySalesGj'">
{{ Number.format(Number.parse(record.qtySalesGj),numFormat) }}
</template>
<template v-if="column.dataIndex === 'qtySalesM3'">
{{ Number.format(Number.parse(record.qtySalesM3),numFormat) }}
</template>
<template v-if="column.dataIndex === 'qtyMeaGj'">
<input-number v-model:value="record.qtyMeaGj" v-if="statusCode==='N'|| statusCode==='JLZ'" @change="numChange(record)" :min="0" style="width: 100%" />
<div v-else>{{ record.qtyMeaGj }}</div>
<input-number v-model:value="record.qtyMeaGj" :digits="3"
v-if="record.statusCode==='N'|| record.statusCode==='JLZ'" @change="numChange(record, index)" :min="0" style="width: 100%" />
<div v-else>{{ Number.format(Number.parse(record.qtyMeaGj),numFormat) }}</div>
</template>
<template v-if="column.dataIndex === 'qtyMeaM3'">
<input-number v-model:value="record.qtyMeaM3" v-if="statusCode==='N'|| statusCode==='JLZ'" @change="numChange(record)" :min="0" style="width: 100%" />
<input-number v-model:value="record.qtyMeaM3" :digits="3"
v-if="record.statusCode==='N'|| record.statusCode==='JLZ'" @change="numChange(record, index)" :min="0" style="width: 100%" />
<div v-else>{{ Number.format(Number.parse(record.qtyMeaM3),numFormat) }}</div>
</template>
<template v-if="column.dataIndex === 'lngFileUploadList'">
<div>
@ -45,7 +43,7 @@
:multiple="true" :dataDelete="true" :isShowTip="false" :isShowBtnIcon="false" @click="onUpload(index)" @change="uploadChange" :showDownloadIcon="false"/>
<div v-for="(item, idx) in record.lngFileUploadList">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
<span @click="deleteFile(record, idx)" class="delIcon"><DeleteOutlined /></span>
<span @click="deleteFile(record, idx, index)" class="delIcon"><DeleteOutlined /></span>
</div>
</div>
</template>
@ -56,6 +54,7 @@
</BasicTable>
<PngMeasureSalesPurModal @register="registerModal" @success="handleSuccess" />
<createFormModal @register="registerModalForm" @success="handleSuccessForm"/>
<ImportModal @register="registerImportModal" importUrl="/dayPlan/pngMeasureSalesPur/import" @success="handleImportSuccess"/>
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
@ -94,9 +93,11 @@
import { downloadByUrl } from '/@/utils/file/download';
import { DeleteOutlined } from '@ant-design/icons-vue';
import searchForm from './components/searchForm.vue'
import NP from 'number-precision';
import createFormModal from './components/createForm.vue'
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const numFormat = "###,###,###,###,###,###.000"
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
@ -108,6 +109,29 @@
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref();
const tableData = ref([])
const total = ref(0);
const currentPage = ref(1);
const pageSize = ref(10);
const loading = ref(false)
// 分页配置
const pagination = computed(() => ({
total: total.value,
current: currentPage.value,
pageSize: pageSize.value,
showQuickJumper: true,
showSizeChanger: true,
showTotal: (total: number) => `${total}条数据`,
pageSizeOptions: ["10", "20", "50", "80", "100"],
onShowSizeChange: (current, pageSize) => {
pageSize.value = pageSize;
loadData()
},
onChange: (current, size) => {
pageSize.value = size;
loadData()
},
}));
//所有按钮
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"保存","code":"save","icon":"ant-design:save-outlined","isDefault":true},{"isUse":true,"name":"保存并确认","code":"submit","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true},{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true},{"isUse":true,"name":"导出","code":"export","icon":"ant-design:export-outlined","isDefault":true},{"isUse":true,"name":"导入","code":"import","icon":"ant-design:import-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"batchdelete","icon":"ant-design:delete-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true}]);
//展示在列表内的按钮
@ -138,44 +162,36 @@
const curIdx = ref()
const [registerModal, { openModal }] = useModal();
const [registerModalForm, { openModal: openModalForm }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const tableId = '';
const tableName = 'PngMeasureSalesPur';
const columnName = 'PngMeasureSalesPur';
const formName='管道气采购计量';
const [registerTable, { reload, clearSelectedRowKeys, getDataSource, updateTableDataRecord }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngMeasureSalesPurPage,
rowKey: 'id',
immediate: false,
columns: customConfigColums,
formConfig: {
schemas: [],
showResetButton: false,
showSubmitButton: false
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit, ...formState.value};
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
// const formName='管道气采购计量';
const formName=currentRoute.value.meta?.title;
},
useSearchForm: true,
showTableSetting: true,
striped: false,
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
customRow,
const loadData = async () => {
loading.value = true;
try {
const res = await getLngPngMeasureSalesPurPage({
limit: currentPage.value,
size: pageSize.value,
page: currentPage.value,
...formState.value,
});
tableData.value = res.list || [];
tableData.value.forEach(v=> {
v.qtySalesM3 = NP.divide(Number(v.qtySalesM3), 10000)
v.qtyMeaM3 = NP.divide(Number(v.qtyMeaM3), 10000)
})
total.value = res.total || res.length || 0;
} catch (error) {
console.error('获取列表失败:', error);
} finally {
loading.value = false;
}
};
const isExpend = ref(false)
const formState = ref({})
const toggle = (val)=> {
@ -183,52 +199,52 @@
}
const onSearch = (val)=> {
formState.value = val
reload()
handleSuccess()
}
const onReset = (val)=> {
formState.value ={ page: 1,size: 10}
reload()
handleSuccess()
}
const onUpload = (index) => {
curIdx.value = index
}
const uploadChange = (val) => {
let data = getDataSource()
let record = data[curIdx.value]
record.lngFileUploadList = val
updateTableDataRecord(record.id, record)
tableData.value[curIdx.value].lngFileUploadList = val
}
const deleteFile = (record, idx) => {
const deleteFile = (record, idx, index) => {
record.lngFileUploadList.splice(idx, 1)
updateTableDataRecord(record.id, record)
tableData.value[index] = record
}
const handleDownload = (info) => {
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
downloadByUrl({ url, fileName: fileName});
};
const numChange = (record) => {
record.rateM3Gj = Number(record.qtyMeaGj) ? (Number(record.qtyMeaM3) || 0 ) / Number(record.qtyMeaGj) : '0'
record.rateM3Gj = record.rateM3Gj.toFixed(6)
updateTableDataRecord(record.id, record)
const numChange = (record, index) => {
record.rateM3Gj = Number(record.qtyMeaGj) ? (Number(record.qtyMeaM3) || 0 ) / Number(record.qtyMeaGj) : 0
record.rateM3Gj = record.rateM3Gj ? Number(record.rateM3Gj).toFixed(6) : 0
tableData.value[index] = record
}
const handleSuccessForm = (val) => {
handleSuccess()
}
function handleAdd() {
router.push({
path: '/dayPlan/PngMeasureSalesPur/createForm',
query: {
formPath: 'dayPlan/PngMeasureSalesPur',
formName: formName,
formId:currentRoute.value.meta.formId,
type:'add'
}
});
openModalForm(true,{isUpdate: false});
// router.push({
// path: '/dayPlan/PngMeasureSalesPur/createForm',
// query: {
// formPath: 'dayPlan/PngMeasureSalesPur',
// formName: "新建"+formName,
// formId:currentRoute.value.meta.formId,
// type:'add'
// }
// });
}
async function handleReject() {
if (!selectedRowsData.value.length) {
notification.warning({
message: 'Tip',
message: '提示',
description: t('请选择需要驳回的数据'),
});
return;
@ -236,16 +252,15 @@
await rejectLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: 'Tip',
message: '提示',
description: t('已驳回!'),
});
clearSelectedRowKeys()
}
async function handleCancel() {
if (!selectedRowsData.value.length) {
notification.warning({
message: 'Tip',
message: '提示',
description: t('请选择需要取消的数据'),
});
return;
@ -253,42 +268,47 @@
await cancelLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: 'Tip',
message: '提示',
description: t('取消成功!'),
});
clearSelectedRowKeys()
}
async function handleSubmit() {
if (!selectedRowsData.value.length) {
notification.warning({
message: 'Tip',
message: '提示',
description: t('请选择需要确认的数据'),
});
return;
}
selectedRowsData.value.forEach(v => {
v.qtyMeaM3 = NP.times(Number(v.qtyMeaM3), 10000)
v.qtySalesM3 = NP.times(Number(v.qtySalesM3), 10000)
})
await updateLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: 'Tip',
message: '提示',
description: t('确认成功!'),
});
clearSelectedRowKeys()
}
async function handleSave() {
if (!selectedRowsData.value.length) {
notification.warning({
message: 'Tip',
message: '提示',
description: t('请选择需要保存的数据'),
});
return;
}
selectedRowsData.value.forEach(v => {
v.qtyMeaM3 = NP.times(Number(v.qtyMeaM3), 10000)
v.qtySalesM3 = NP.times(Number(v.qtySalesM3), 10000)
})
await addLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: 'Tip',
message: '提示',
description: t('保存成功!'),
});
clearSelectedRowKeys()
}
function dbClickRow(record) {
@ -337,7 +357,7 @@
function handleBatchdelete() {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
message: '提示',
description: t('请选择需要删除的数据'),
});
return;
@ -351,7 +371,7 @@
});
if (cantDelete.length) {
notification.warning({
message: 'Tip',
message: '提示',
description: t('含有不能删除的数据'),
});
return;
@ -369,7 +389,7 @@
deleteLngPngMeasureSalesPur(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
message: '提示',
description: t('删除成功!'),
});
});
@ -382,28 +402,13 @@
selectedRowsData.value = selectedRows;
}
function customRow(record: Recordable) {
return {
onClick: () => {
let selectedRowKeys = [...selectedKeys.value];
if (selectedRowKeys.indexOf(record.id) >= 0) {
let index = selectedRowKeys.indexOf(record.id);
selectedRowKeys.splice(index, 1);
} else {
selectedRowKeys.push(record.id);
}
selectedKeys.value = selectedRowKeys;
},
};
}
function handleRefresh() {
reload();
loadData();
}
function handleSuccess() {
selectedKeys.value = [];
selectedRowsData.value = [];
reload();
loadData();
}
async function handleExport() {
const res = await exportLngPngMeasureSalesPur({ isTemplate: false });
@ -421,7 +426,7 @@
});
}
function handleImportSuccess(){
reload()
loadData()
}
onMounted(() => {
@ -431,9 +436,8 @@
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
loadData()
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
@ -467,20 +471,8 @@
});
return actionsList;
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less">
.PngMeasureSalesPurStyle .cusSearchForm .advanceRow> div:nth-of-type(3){