bug修复

This commit is contained in:
LHD_HY 2025-11-27 10:06:10 +08:00
parent c344954779
commit fc771fcf71
1 changed files with 45 additions and 68 deletions

View File

@ -33,15 +33,6 @@
start-placeholder="开始日期" end-placeholder="结束日期" v-if="item.f_type === 'dateRange'"
v-model="queryParams[item.f_model]" @change="onChangeTime($event, item.dateType)"
:picker-options="pickerOptions" />
<el-date-picker
type="year"
:style="{ width: item.f_width || '140px' }"
:value-format="item.valueFormat || 'yyyy'"
v-if="item.f_type === 'year'"
v-model="queryParams[item.f_model]"
:placeholder="`请选择${item.f_label}`"
:picker-options="item.group === 'yearRange' ? getYearRangeOptions(item) : {}"
/>
<el-input-number :min="0" style="width: 240px" v-if="item.f_type === 'num'"
v-model="queryParams[item.f_model]" />
</el-form-item>
@ -216,6 +207,11 @@ export default {
type: Boolean,
default: false,
},
// 600px
tableMaxHeight: {
type: [Number, String],
default: 600,
},
//
autoLoad: {
type: Boolean,
@ -248,19 +244,20 @@ export default {
},
/* 表格卡片动态高度 */
tableCardStyle() {
const baseHeight = this.showSearch ? 200 : 120 //
const toolbarHeight = this.showRightTools ? 40 : 0 //
const paginationHeight = 60 //
const availableHeight = `calc(100vh - ${baseHeight + toolbarHeight + paginationHeight + 25
}px)`
return {
height: availableHeight,
display: 'flex',
flexDirection: 'column',
//
}
},
/* 表格容器样式 */
tableContainerStyle() {
return {
flex: 1, //
overflow: 'auto', //
maxHeight: `calc(100vh - 200px)`, //
}
return {}
},
},
watch: {
@ -279,7 +276,6 @@ export default {
},
data() {
return {
tableMaxHeight: 'calc(100vh - 220px)', //
//
formRules: {},
loading: false,
@ -328,12 +324,9 @@ export default {
/* 生成查询参数 */
this.formLabel.map((e) => {
if (e.f_type === 'dateRange') {
// dateType
this.typeList.push(e.dateType);
//
this.$set(this.queryParams, e.dateType[0], '');
this.$set(this.queryParams, e.dateType[1], '');
this.$set(this.queryParams, e.f_model, []);
this.$set(this.queryParams, e.dateType[0], '')
this.$set(this.queryParams, e.dateType[1], '')
this.typeList = e.dateType
if (this.isOneMonth) {
this.pickerOptions = {
@ -373,32 +366,21 @@ export default {
this.dynamicWidth = this.getOperatorWidth()
},
methods: {
//
getYearRangeOptions(item) {
//
if (item.f_model === 'endTime') {
return {
disabledDate: (time) => {
const startYear = this.queryParams.startTime;
if (!startYear) return false; //
const currentYear = time.getFullYear();
return currentYear < Number(startYear); //
}
};
}
//
return {};
},
/** 获取列表数据 */
async getTableList() {
try {
if (
this.queryParams.time &&
this.queryParams.time.length !== 0
) {
this.queryParams[this.typeList[0]] =
this.queryParams.time[0]
this.queryParams[this.typeList[1]] =
this.queryParams.time[1]
}
const params = { ...this.queryParams }
const queryParams = JSON.parse(JSON.stringify(params))
console.log('查询参数',queryParams)
delete queryParams.time //
// openTime使 openStartTime, openEndTime
this.formLabel.forEach((item) => {
@ -447,32 +429,29 @@ export default {
/** 重置按钮 */
resetQuery() {
this.$refs.queryFormRef.resetFields()
// length
this.typeList.forEach((dateType) => {
const [startKey, endKey] = dateType;
const modelKey = this.formLabel.find(item => item.dateType && item.dateType[0] === startKey)?.f_model;
this.$set(this.queryParams, startKey, '');
this.$set(this.queryParams, endKey, '');
if (modelKey) {
this.$set(this.queryParams, modelKey, []);
if (this.typeList.length > 1) {
if (this.isCurrentDate) {
this.queryParams[this.typeList[0]] = new Date()
.toISOString()
.split('T')[0]
this.queryParams[this.typeList[1]] = new Date()
.toISOString()
.split('T')[0]
this.queryParams.time = [
new Date().toISOString().split('T')[0],
new Date().toISOString().split('T')[0],
]
} else {
this.queryParams[this.typeList[0]] = ''
this.queryParams[this.typeList[1]] = ''
this.queryParams.time = []
}
});
// isCurrentDate
if (this.isCurrentDate && this.typeList.length > 0) {
const today = new Date().toISOString().split('T')[0];
this.typeList.forEach((dateType) => {
const [startKey, endKey] = dateType;
const modelKey = this.formLabel.find(item => item.dateType && item.dateType[0] === startKey)?.f_model;
this.$set(this.queryParams, startKey, today);
this.$set(this.queryParams, endKey, today);
if (modelKey) {
this.$set(this.queryParams, modelKey, [today, today]);
}
});
} else {
this.queryParams[this.typeList[0]] = ''
}
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10;
this.getTableList();
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.getTableList()
},
/** 级联选择 */
handleCas(e, val) {
@ -697,8 +676,6 @@ export default {
//
.table-container {
width: 100%;
flex: 1;
overflow: auto;
::v-deep .el-table {
width: 100%;