Files
aida_front/src/component/Administrator/SE/getGenerateFrequency/index.vue

242 lines
6.7 KiB
Vue

<template>
<div class="test_cli admin_page">
<div class="admin_table_search">
<div class="admin_state">
<div class="admin_state_item">
<span>Start Date:</span>
<a-range-picker
style="width:250px"
class="range_picker"
v-model:value="rangePickerValue"
:placeholder="[
$t('HistoryPage.StartDate'),
$t('HistoryPage.EndDate'),
]"
valueFormat="YYYY-MM-DD"
>
<template #suffixIcon>
<span
class="icon iconfont range_picker_icon icon-rili"
></span>
</template>
</a-range-picker>
</div>
<div class="admin_state_item">
<span>Start Time:</span>
<a-time-range-picker style="width:250px" class="range_picker" valueFormat="HH:mm:ss" v-model:value="rangeTimeValue" />
</div>
<div class="admin_state_item">
<span>Generate Event:</span>
<a-select
v-model:value="changeEvent"
show-search
allowClear
style="width: 250px"
placeholder="Please select"
:options="allGenerateType"
@keydown.enter="gettrialList"
></a-select>
</div>
<div class="admin_state_item">
<span>Email:</span>
<input
v-model="email"
placeholder="Please enter email"
@keydown.enter="gettrialList"
type="text"
style="width: 250px"
/>
</div>
</div>
<div class="admin_search">
<div class="admin_search_item" @click="searchHistoryList">Search</div>
</div>
</div>
<div class="admin_table_content" ref="historyTable">
<a-table
@resizeColumn="handleResizeColumn"
:columns="columns"
:data-source="dataList"
:scroll="{ y: historyTableHeight }"
@change="changePage"
:pagination="{
showSizeChanger: true,
current: currentPage,
pageSize: pageSize,
total: total,
showQuickJumper: true,
bordered: false,
}"
>
</a-table>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, createVNode, computed } from "vue";
import { useStore } from "vuex";
import { Https } from "@/tool/https";
export default defineComponent({
components: {
},
setup() {
const store:any = useStore()
let rangePickerValue: any = ref([]);
let rangeTimeValue: any = ref([]);
let renameData: any = ref({}); //修改名字选中的数据
const allGenerateType = computed(()=>{
return store.state.adminPage.allGenerateType
})
const columns: any = computed(() => {
return [
{
title: 'Email',
align: "center",
dataIndex: "userEmail",
key: "userEmail",
width:200,
fixed: "left",
},
{
title: 'User Id',
align: "center",
ellipsis: true,
dataIndex: "id",
key: "id",
width:100,
},
{
title: 'Current Credits',
align: "center",
ellipsis: true,
dataIndex: "currentCredits",
key: "currentCredits",
width:150,
},
{
title: 'Generate Event',
align: "center",
ellipsis: true,
dataIndex: "generateFunction",
key: "generateFunction",
width:150,
customRender: (record: any) => {
return record.text?record.text:'ALL'
},
},
{
title: 'Usage Count',
align: "center",
ellipsis: true,
dataIndex: "usageCount",
key: "usageCount",
width:150,
customRender: (record: any) => {
return record.text?record.text:'-'
},
},
{
title: 'Cconsumed Credits',
align: "center",
ellipsis: true,
// width: 150,
// minWidth: 100,
// maxWidth: 200,
// resizable: true,
dataIndex: "consumedCredits",
key: "consumedCredits",
width:150,
customRender: (record: any) => {
return record.text?record.text:'-'
},
}
];
});
let email = ref('')
let dataList: any = ref([]);
let status: any = ref(0);
return {
rangePickerValue,
rangeTimeValue,
columns,
dataList,
email,
renameData,
status,
allGenerateType,
};
},
data() {
return {
currentPage: 1,
pageSize: 10,
total: 0,
changeEvent:'',
historyTableHeight: 0,
handleResizeColumn: (w:any, col:any) => {
col.width = w;
},
};
},
mounted() {
let historyTable: any = this.$refs.historyTable;
this.historyTableHeight = historyTable.clientHeight - 200;
this.gettrialList();
},
methods: {
//改变页码
changePage(e: any) {
this.currentPage = e.current;
this.pageSize = e.pageSize;
this.gettrialList();
},
//查询列表
searchHistoryList() {
this.currentPage = 1;
this.gettrialList();
},
//获取列表
gettrialList() {
let startTime: any = this.rangeTimeValue?.[0]
? this.rangeTimeValue[0]
: '00:00:00';
let endTime: any = this.rangeTimeValue?.[1]
? this.rangeTimeValue[1]
: '23:59:59';
let startDate: any = this.rangePickerValue?.[0]
? this.rangePickerValue[0]+' '+startTime
: "";
let endDate: any = this.rangePickerValue?.[1]
? this.rangePickerValue[1]+' '+endTime
: "";
let data = {
endTime:endDate,
startTime:startDate,
id:null,
changeEvent:this.changeEvent,
size:this.pageSize,
page:this.currentPage,
email:this.email?.trim(),
}
Https.axiosPost(Https.httpUrls.getGenerateFrequency,data).then((rv: any) => {
if (rv) {
console.log(rv)
this.dataList = rv.content
this.total = rv.total
// this.workspaceItem.position = this.singleTypeList[0].label
}
})
},
},
});
</script>
<style lang="less" scoped>
.admin_page .admin_table_search .admin_state {
display: flex;
flex-wrap: wrap;
}
</style>