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