采购计量

This commit is contained in:
‘huanghaiixia’
2026-01-14 17:44:36 +08:00
parent e87d2e18b4
commit 129d138061
8 changed files with 177 additions and 45 deletions

View File

@ -14,17 +14,22 @@
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'qtyMeaGj'">
<a-input-number v-model:value="record.qtyMeaGj" :min="0" style="width: 100%" />
<a-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>
</template>
<template v-if="column.dataIndex === 'qtyMeaM3'">
<a-input-number v-model:value="record.qtyMeaM3" :min="0" style="width: 100%" />
<a-input-number v-model:value="record.qtyMeaM3" v-if="statusCode==='N'|| statusCode==='JLZ'" @change="numChange(record)" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'fileList'">
<template v-if="column.dataIndex === 'lngFileUploadList'">
<div>
<Upload :file-list="record.fileList" :showUploadList="false" v-model:value="tableId" v-model:tableName="tableName" v-model:columnName="columnName"
:multiple="true" :dataDelete="true" :isShowTip="false" :isShowBtnIcon="false" @click="onUpload" :showDownloadIcon="false"/>
<Upload :file-list="record.lngFileUploadList" :showUploadList="false" v-model:value="tableId" v-model:tableName="tableName" v-model:columnName="columnName"
: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>
</div>
</div>
</template>
<template v-if="column.dataIndex === 'action'">
@ -67,6 +72,9 @@
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import Upload from '/@/components/Form/src/components/Upload.vue';
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
import { DeleteOutlined } from '@ant-design/icons-vue';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
@ -107,6 +115,7 @@
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const selectedKeys = ref<string[]>([]);
const selectedRowsData = ref<any[]>([]);
const curIdx = ref()
const [registerModal, { openModal }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
@ -115,7 +124,7 @@
const columnName = 'PngMeasureSalesPur';
const formName='管道气采购计量';
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
const [registerTable, { reload, clearSelectedRowKeys, getDataSource, updateTableDataRecord }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngMeasureSalesPurPage,
rowKey: 'id',
@ -125,14 +134,25 @@
gutter: 16,
},
schemas: customSearchFormSchema,
submitButtonOptions: {
text: '搜索',
onClick: () => {
clearSelectedRowKeys()
},
},
resetButtonOptions: {
text: '重置',
onClick: () => {
clearSelectedRowKeys()
},
},
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD HH:mm:ss ', true]],
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit};
},
afterFetch: (res) => {
clearSelectedRowKeys()
tableRef.value.setToolBarWidth();
},
@ -156,8 +176,28 @@
},
customRow,
});
const onUpload = () => {
console.log('单击')
const onUpload = (index) => {
curIdx.value = index
}
const uploadChange = (val) => {
let data = getDataSource()
let record = data[curIdx.value]
record.lngFileUploadList = val
updateTableDataRecord(record.id, record)
}
const deleteFile = (record, idx) => {
record.lngFileUploadList.splice(idx, 1)
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) => {
record.rateM3Gj = Number(record.qtyMeaGj) ? (Number(record.qtyMeaM3) || 0 ) / Number(record.qtyMeaGj) : '0'
record.rateM3Gj = record.rateM3Gj.toFixed(6)
updateTableDataRecord(record.id, record)
}
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
@ -390,4 +430,9 @@
.hide{
display: none !important;
}
.delIcon {
margin-left: 10px;
cursor: pointer;
margin-bottom: 5px;
}
</style>