采购计量列表样式调整

This commit is contained in:
‘huanghaiixia’
2026-01-20 17:55:58 +08:00
parent 3d97ce852e
commit b0e03cecc0
3 changed files with 622 additions and 109 deletions

View File

@ -17,27 +17,16 @@
</div>
</div>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="PngMeasureSalesPurStyle">
<BasicTable @register="registerTable" ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }" @row-dbClick="dbClickRow">
<a-table :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 === 'qtyMeaGj'">
<a-input-number v-model:value="record.qtyMeaGj" v-if="statusCode==='N'|| statusCode==='JLZ'" @change="numChange(record)" :min="0" style="width: 100%" />
<a-input-number v-model:value="record.qtyMeaGj" v-if="statusCode==='N'|| statusCode==='JLZ'" @change="numChange(record, index)" :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" v-if="statusCode==='N'|| statusCode==='JLZ'" @change="numChange(record)" :min="0" style="width: 100%" />
<a-input-number v-model:value="record.qtyMeaM3" v-if="statusCode==='N'|| statusCode==='JLZ'" @change="numChange(record, index)" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'lngFileUploadList'">
<div>
@ -45,7 +34,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,7 +42,7 @@
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
</a-table>
<PngMeasureSalesPurModal @register="registerModal" @success="handleSuccess" />
<ImportModal @register="registerImportModal" importUrl="/dayPlan/pngMeasureSalesPur/import" @success="handleImportSuccess"/>
@ -94,6 +83,7 @@
import { downloadByUrl } from '/@/utils/file/download';
import { DeleteOutlined } from '@ant-design/icons-vue';
import searchForm from './components/searchForm.vue'
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
@ -108,6 +98,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}]);
//展示在列表内的按钮
@ -144,37 +157,24 @@
const columnName = 'PngMeasureSalesPur';
const formName='管道气采购计量';
const [registerTable, { reload, clearSelectedRowKeys, getDataSource, updateTableDataRecord }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngMeasureSalesPurPage,
rowKey: 'id',
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 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;
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)=> {
@ -182,34 +182,31 @@
}
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) => {
const numChange = (record, index) => {
record.rateM3Gj = Number(record.qtyMeaGj) ? (Number(record.qtyMeaM3) || 0 ) / Number(record.qtyMeaGj) : '0'
record.rateM3Gj = record.rateM3Gj.toFixed(6)
updateTableDataRecord(record.id, record)
tableData.value[index] = record
}
function handleAdd() {
@ -238,7 +235,6 @@
message: 'Tip',
description: t('已驳回!'),
});
clearSelectedRowKeys()
}
async function handleCancel() {
@ -255,7 +251,6 @@
message: 'Tip',
description: t('取消成功!'),
});
clearSelectedRowKeys()
}
async function handleSubmit() {
if (!selectedRowsData.value.length) {
@ -271,7 +266,6 @@
message: 'Tip',
description: t('确认成功!'),
});
clearSelectedRowKeys()
}
async function handleSave() {
if (!selectedRowsData.value.length) {
@ -287,7 +281,6 @@
message: 'Tip',
description: t('保存成功!'),
});
clearSelectedRowKeys()
}
function dbClickRow(record) {
@ -381,28 +374,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 });
@ -420,7 +398,7 @@
});
}
function handleImportSuccess(){
reload()
loadData()
}
onMounted(() => {
@ -430,9 +408,8 @@
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
loadData()
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
@ -466,20 +443,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){