采购计量客户
This commit is contained in:
@ -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: '搜索',
|
||||
|
||||
@ -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,8 +245,11 @@
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
// btnEvent[code]();
|
||||
handleBatchApprove()
|
||||
if (code== 'refresh') {
|
||||
btnEvent[code]();
|
||||
} else {
|
||||
handleBatchApprove()
|
||||
}
|
||||
}
|
||||
function handleDatalog (record: Recordable) {
|
||||
modalVisible.value = true
|
||||
|
||||
@ -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) {
|
||||
handleBatchApprove()
|
||||
// btnEvent[code]();
|
||||
if (code== 'refresh') {
|
||||
btnEvent[code]();
|
||||
} else {
|
||||
handleBatchApprove()
|
||||
}
|
||||
}
|
||||
function handleDatalog (record: Recordable) {
|
||||
modalVisible.value = true
|
||||
|
||||
@ -7,8 +7,8 @@ export const formConfig = {
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'datePlan',
|
||||
label: '计划日期',
|
||||
field: 'dateMea',
|
||||
label: '计量日期',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
format: 'YYYY-MM-DD',
|
||||
@ -22,13 +22,13 @@ export const searchFormSchema: FormSchema[] = [
|
||||
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,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<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">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'qtySalesGj'">
|
||||
@ -14,7 +14,7 @@
|
||||
{{ 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) }}
|
||||
{{record.qtyMeaM3 ? Number.format(Number.parse(NP.divide(Number(record.qtyMeaM3 || 0), 10000)),numFormat) : null }}
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
@ -38,8 +38,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 +48,189 @@
|
||||
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: 'suCode',
|
||||
label: '供应商名称/简称/编码',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'pointUpName',
|
||||
label: '上载点',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'pointDelyName',
|
||||
label: '下载点',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
const columns: BasicColumn[] = [
|
||||
{
|
||||
dataIndex: 'datePlan',
|
||||
title: '计划日期',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
ellipsis: true,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'dateMea',
|
||||
title: '计量日期',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
dataIndex: 'pointDelyName',
|
||||
title: '下载点',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
dataIndex: 'suSname',
|
||||
title: '供应商',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'pointUpName',
|
||||
title: '上载点',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'qtySalesGj',
|
||||
title: '批复量(吉焦)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'qtySalesM3',
|
||||
title: '批复量(万方)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'qtyMeaGj',
|
||||
title: '完成量(吉焦)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'qtyMeaM3',
|
||||
title: '完成量(万方)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'rateM3Gj',
|
||||
title: '比值(方/吉焦)',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'cfmCuUserName',
|
||||
title: '确认人',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 110,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'cfmCuUserTime',
|
||||
title: '确认时间',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 180,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'cfmEmpName',
|
||||
title: '业务确认人',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 110,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'cfmEmpTime',
|
||||
title: '业务确认时间',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
dataIndex: 'ksName',
|
||||
title: '销售合同',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
dataIndex: 'kpName',
|
||||
title: '采购合同',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'comName',
|
||||
title: '交易主体',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
];
|
||||
const spinning = ref(false);
|
||||
const { t } = useI18n();
|
||||
const formState = ref({});
|
||||
@ -75,9 +255,9 @@
|
||||
canResize: false,
|
||||
formConfig: {
|
||||
labelCol:{span: 9},
|
||||
schemas: [],
|
||||
showResetButton: false,
|
||||
showSubmitButton: false
|
||||
schemas: codeFormSchema,
|
||||
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
|
||||
showResetButton: true,
|
||||
},
|
||||
immediate: false,
|
||||
beforeFetch: (params) => {
|
||||
@ -96,7 +276,6 @@
|
||||
await nextTick();
|
||||
await nextTick();
|
||||
nextTick(() => {
|
||||
|
||||
reload({searchInfo:{'limit':1,'size':10,'page':1}});
|
||||
});
|
||||
}
|
||||
@ -105,14 +284,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 +298,7 @@
|
||||
await addLngPngMeasureSalesPur(selectedValues.value);
|
||||
spinning.value = false;
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
message: '提示',
|
||||
description: '保存成功'
|
||||
});
|
||||
closeModal();
|
||||
@ -140,8 +311,33 @@
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-table-title) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
: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(4)) {
|
||||
width: 360px !important;
|
||||
max-width: 360px !important;;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
|
||||
width: 80px !important;
|
||||
}
|
||||
:deep( .ant-col-8:nth-child(2)) {
|
||||
width: 360px !important;
|
||||
max-width: 360px !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-9) {
|
||||
flex:auto !important
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -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>
|
||||
@ -51,13 +37,13 @@
|
||||
<TableAction :actions="getActions(record)" />
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</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,102 @@
|
||||
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 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 [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();
|
||||
|
||||
},
|
||||
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,
|
||||
},
|
||||
});
|
||||
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 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()
|
||||
}
|
||||
);
|
||||
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,15 +249,20 @@
|
||||
message: '提示',
|
||||
description: t('已驳回!'),
|
||||
});
|
||||
clearSelectedRowKeys()
|
||||
}
|
||||
|
||||
async function handleCancel() {
|
||||
if (!selectedRowsData.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要取消的数据'),
|
||||
});
|
||||
return;
|
||||
async function handleCancel(val) {
|
||||
if (val=='batch') {
|
||||
if (!selectedRowsData.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要取消的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
selectedRowsData.value= [{...val}]
|
||||
}
|
||||
await cancelLngPngMeasureSalesPur(selectedRowsData.value)
|
||||
handleSuccess();
|
||||
@ -271,44 +270,48 @@
|
||||
message: '提示',
|
||||
description: t('取消成功!'),
|
||||
});
|
||||
clearSelectedRowKeys()
|
||||
}
|
||||
async function handleSubmit() {
|
||||
if (!selectedRowsData.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要确认的数据'),
|
||||
});
|
||||
return;
|
||||
async function handleSubmit(val) {
|
||||
if (val=='batch') {
|
||||
if (!selectedRowsData.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要确认的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
selectedRowsData.value= [{...val}]
|
||||
}
|
||||
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: '提示',
|
||||
description: t('确认成功!'),
|
||||
});
|
||||
clearSelectedRowKeys()
|
||||
}
|
||||
async function handleSave() {
|
||||
if (!selectedRowsData.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要保存的数据'),
|
||||
});
|
||||
return;
|
||||
async function handleSave(val) {
|
||||
if (val=='batch') {
|
||||
if (!selectedRowsData.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要保存的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
selectedRowsData.value= [{...val}]
|
||||
}
|
||||
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: '提示',
|
||||
description: t('保存成功!'),
|
||||
});
|
||||
clearSelectedRowKeys()
|
||||
|
||||
}
|
||||
function dbClickRow(record) {
|
||||
@ -348,20 +351,25 @@
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
btnEvent[code]();
|
||||
btnEvent[code]('batch');
|
||||
}
|
||||
function handleDatalog (record: Recordable) {
|
||||
modalVisible.value = true
|
||||
logId.value = record.id
|
||||
}
|
||||
function handleBatchdelete() {
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要删除的数据'),
|
||||
});
|
||||
return;
|
||||
function handleDelete(val) {
|
||||
if (val=='batch') {
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: '提示',
|
||||
description: t('请选择需要删除的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
selectedKeys.value= [val?.id]
|
||||
}
|
||||
|
||||
//与工作流相关的数据不能进行批量删除
|
||||
const cantDelete = selectedRowsData.value.filter((x) => {
|
||||
return (
|
||||
@ -401,14 +409,14 @@
|
||||
selectedKeys.value = selectedRowKeys;
|
||||
selectedRowsData.value = selectedRows;
|
||||
}
|
||||
|
||||
function handleRefresh() {
|
||||
loadData();
|
||||
reload();
|
||||
}
|
||||
function handleSuccess() {
|
||||
selectedKeys.value = [];
|
||||
selectedRowsData.value = [];
|
||||
loadData();
|
||||
|
||||
selectedKeys.value = [];
|
||||
selectedRowsData.value = [];
|
||||
reload();
|
||||
}
|
||||
async function handleExport() {
|
||||
const res = await exportLngPngMeasureSalesPur({ isTemplate: false });
|
||||
@ -426,7 +434,7 @@
|
||||
});
|
||||
}
|
||||
function handleImportSuccess(){
|
||||
loadData()
|
||||
reload()
|
||||
}
|
||||
onMounted(() => {
|
||||
|
||||
@ -436,8 +444,9 @@
|
||||
} else {
|
||||
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
||||
}
|
||||
loadData()
|
||||
|
||||
|
||||
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
|
||||
mergeCustomListRenderConfig();
|
||||
});
|
||||
onUnmounted(() => {
|
||||
if (schemaIdComputedRef.value) {
|
||||
@ -448,31 +457,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 {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
});
|
||||
}
|
||||
if (['datalog'].includes(button.code)) {
|
||||
datalogBtn.push({
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
});
|
||||
}
|
||||
});
|
||||
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 +557,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-col-8:nth-child(2) .ant-form-item-label label) {
|
||||
width: 150px !important;
|
||||
max-width: 150px !important;
|
||||
}
|
||||
:deep(.ant-table-title) {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
@ -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>
|
||||
@ -53,9 +51,10 @@
|
||||
<TableAction :actions="getActions(record)" />
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
</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();
|
||||
|
||||
},
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
|
||||
striped: false,
|
||||
rowSelection: {
|
||||
type: 'checkbox',
|
||||
onChange: onSelectChange
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false,
|
||||
},
|
||||
customRow,
|
||||
});
|
||||
// const formName='管道气采购计量';
|
||||
const formName=currentRoute.value.meta?.title;
|
||||
|
||||
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();
|
||||
selectedKeys.value = [];
|
||||
selectedRowsData.value = [];
|
||||
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);
|
||||
}
|
||||
|
||||
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
|
||||
mergeCustomListRenderConfig();
|
||||
loadData()
|
||||
|
||||
});
|
||||
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){
|
||||
|
||||
Reference in New Issue
Block a user