关联主合同优化

This commit is contained in:
‘huanghaiixia’
2026-03-11 13:47:57 +08:00
parent 68e301ca25
commit 4f9a410c5c
12 changed files with 124 additions and 199 deletions

View File

@ -1,44 +1,38 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle pdcss">
<div class="top-toolbar">
<a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>取消
</a-button>
<a-button style="margin-right: 10px" type="primary" @click="checkBtn">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
</div>
<searchForm @search="onSearch" @reset="onReset" ></searchForm>
<BasicTable @register="registerTable">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'qtySalesGj'">
{{ Number.format(Number.parse(record.qtySalesGj),numFormat) }}
<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'">
{{ 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) }}
</template>
</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) }}
</template>
</template>
</BasicTable>
</div>
</a-spin>
</BasicTable>
</a-spin>
</BasicModal>
</template>
<script lang="ts" setup>
import { useRouter } from 'vue-router';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { SaveOutlined, } from '@ant-design/icons-vue';
import { ref, computed, unref, nextTick } from 'vue';
import { SaveOutlined, } from '@ant-design/icons-vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus';
import { useModal } from '/@/components/Modal';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import dayjs from 'dayjs';
import { message } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user';
@ -60,17 +54,19 @@
const spinning = ref(false);
const { t } = useI18n();
const formState = ref({});
const [register, { openModal:openModal}] = useModal();
onMounted(() => {
const isUpdate = ref(true);
const showTable = ref(false)
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
showTable.value = true
setModalProps({ confirmLoading: false });
setPagination({'limit': 1,'size': 10,'page': 1});
isUpdate.value = !!data?.isUpdate;
});
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const [registerTable, { reload }] = useTable({
const [registerTable, { reload,setPagination }] = useTable({
title: t('管道气计量新增列表'),
api: getLngPngMeasureSalesPurPageAdd,
columns: columns,
@ -83,15 +79,28 @@
showResetButton: false,
showSubmitButton: false
},
immediate: true,
immediate: false,
beforeFetch: (params) => {
return { ...params,...formState.value};
return { ...params,...formState.value,page:params.limit};
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
});
const getTitle = computed(() => (!unref(isUpdate) ? t('管道气计量新增列表') : t('')));
const handleVisibleChange = async (visible: boolean) => {
if (visible) {
showTable.value = false
await nextTick();
await nextTick();
await nextTick();
nextTick(() => {
reload({searchInfo:{'limit':1,'size':10,'page':1}});
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
@ -107,7 +116,7 @@
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function checkBtn() {
async function handleSubmit() {
if (!selectedValues.value.length) {
message.warn('请选择数据')
return
@ -121,10 +130,8 @@
message: 'Tip',
description: '保存成功'
});
setTimeout(() => {
bus.emit(FORM_LIST_MODIFIED, {});
close();
}, 500);
closeModal();
emit('success', selectedValues.value);
}catch (errorInfo) {
spinning.value = false;
}
@ -133,18 +140,6 @@
</script>
<style lang="less" scoped>
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
.pdcss {
padding:0px 12px 6px 12px !important;
}
:deep(.ant-table-title) {
display: none !important;
}

View File

@ -3,7 +3,7 @@
<a-row>
<a-col :span="6">
<a-form-item label="计量日期" name="dateMea" >
<a-range-picker v-model:value="formState.dateMea" />
<RangePicker v-model:value="formState.dateMea" />
</a-form-item>
</a-col>
<a-col :span="7">
@ -61,6 +61,7 @@
<script lang="ts" setup>
import { useRouter } from 'vue-router';
import { RangePicker } from '/@/components/RangePicker';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';

View File

@ -54,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"/>
@ -93,6 +94,7 @@
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"
@ -160,6 +162,7 @@
const curIdx = ref()
const [registerModal, { openModal }] = useModal();
const [registerModalForm, { openModal: openModalForm }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const tableId = '';
const tableName = 'PngMeasureSalesPur';
@ -218,21 +221,24 @@
downloadByUrl({ url, fileName: fileName});
};
const numChange = (record, index) => {
record.rateM3Gj = Number(record.qtyMeaGj) ? (Number(record.qtyMeaM3) || 0 ) / Number(record.qtyMeaGj) : '0'
record.rateM3Gj = record.rateM3Gj.toFixed(6)
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() {