点击排序时增加表格锁定

This commit is contained in:
lai
2024-01-05 11:35:09 +08:00
parent 327a377e79
commit 0b6303e544

View File

@@ -74,7 +74,7 @@ let queryParams: any = reactive({
/**表格分页、排序、筛选变化时触发操作, 排序方式,取值为 ascend descend */
function fnTableChange(pagination: any, filters: any, sorter: any, extra: any) {
console.log(sorter)
tableState.loading = true;
const { columnKey, order } = sorter;
if (order) {
queryParams.sortField = columnKey;
@@ -198,78 +198,84 @@ function fnDesign() {
let goldXDate: any = [];
let goldYData: any = [];
let hideAll: any = {};
goldData(queryParams).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.data.length > 0) {
console.log(res.data)
tableState.data = res.data;
goldXDate = res.data.map((item: any) => item.timeGroup);
goldYData = Object.keys(res.data[0])
.filter(key => !['timeGroup', 'neName', 'startIndex'].includes(key))
.map(key => {
const title: any = findTitleByKey(key);
hideAll[title] = false;
return {
name: title,
data: res.data.map((item: any) => parseInt(item[key])),
};
goldData(queryParams)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.data.length > 0) {
console.log(res.data);
tableState.data = res.data;
goldXDate = res.data.map((item: any) => item.timeGroup);
goldYData = Object.keys(res.data[0])
.filter(key => !['timeGroup', 'neName', 'startIndex'].includes(key))
.map(key => {
const title: any = findTitleByKey(key);
hideAll[title] = false;
return {
name: title,
data: res.data.map((item: any) => parseInt(item[key])),
};
});
} else {
tableState.data = [];
state.designTreeData.forEach((item: any) => {
goldYData.push({ name: item.title, data: [] });
});
message.warning({
content: t('views.perfManage.goldTarget.nullTip'),
duration: 2,
});
}
// 图标参数
const option = {
xDatas: goldXDate,
yDatas: goldYData,
tooltip: {
trigger: 'axis',
formatter: function (datas: any) {
let res = datas[0].name + '<br/>';
for (const item of datas) {
res += `${item.marker} ${item.seriesName}:${item.data}<br/>`;
}
return res;
},
},
legend: {
// orient: 'vertical',
// left: 'left',
type: 'scroll',
orient: 'vertical', // vertical
right: 20,
//itemWidth: 20,
itemGap: 25,
textStyle: {
color: '#646A73',
},
icon: 'circle',
selected: hideAll,
},
grid: {
left: '10%',
right: '30%',
bottom: '20%',
},
yAxis: [
{ type: 'value', splitNumber: 4, axisLabel: { fontSize: 10 } },
],
};
chartsOption.perfChart = option;
//处理表格数据
} else {
tableState.data = [];
state.designTreeData.forEach((item: any) => {
goldYData.push({ name: item.title, data: [] });
});
message.warning({
content: t('views.perfManage.goldTarget.nullTip'),
content: t('common.getInfoFail'),
duration: 2,
});
}
// 图标参数
const option = {
xDatas: goldXDate,
yDatas: goldYData,
tooltip: {
trigger: 'axis',
formatter: function (datas: any) {
let res = datas[0].name + '<br/>';
for (const item of datas) {
res += `${item.marker} ${item.seriesName}:${item.data}<br/>`;
}
return res;
},
},
legend: {
// orient: 'vertical',
// left: 'left',
type: 'scroll',
orient: 'vertical', // vertical
right: 20,
//itemWidth: 20,
itemGap: 25,
textStyle: {
color: '#646A73',
},
icon: 'circle',
selected: hideAll,
},
grid: {
left: '10%',
right: '30%',
bottom: '20%',
},
yAxis: [{ type: 'value', splitNumber: 4, axisLabel: { fontSize: 10 } }],
};
chartsOption.perfChart = option;
//处理表格数据
} else {
message.warning({
content: t('common.getInfoFail'),
duration: 2,
});
}
});
})
.finally(() => {
tableState.loading = false;
});
}
/**