Files
aida_front/src/component/Administrator/trialApproval.vue
X1627315083 84674c63fd fix
2024-03-22 12:01:11 +08:00

291 lines
7.7 KiB
Vue

<template>
<div class="admin_page">
<div class="admin_table_search">
<div class="admin_state">
<div class="admin_state_item admin_table_voluntarily">
<span>voluntarily:</span>
<a-switch v-model:checked="voluntarily" @change="setIsAutoApproval" />
</div>
<div class="admin_state_item">
<span>State:</span>
<a-select v-model:value="currentState.value" size="large" style="width:280px" optionFilterProp="label" :options="state" placeholder="Please select" allowClear show-search></a-select>
</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
:columns="columns"
:data-source="collectionList"
:scroll="{ y: historyTableHeight }"
@change="changePage"
:pagination="{
showSizeChanger: true,
current: currentPage,
pageSize: pageSize,
total: total,
showQuickJumper: true,
bordered: false,
}"
>
<template
#bodyCell="{ column, text, record, index }"
>
<div
class="operate_list"
v-if="column?.Operations"
>
<div
v-show="status == 0"
class="operate_item"
@click="setAagree(record, index)"
>
agree
</div>
<div
v-show="status == 0"
class="operate_item"
@click="setRefuse(record, index)"
>
refuse
</div>
<!-- <div
class="operate_item"
@click="deleteGroup(record, index)"
>
Delete
</div> -->
</div>
</template>
</a-table>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, createVNode, computed } from "vue";
import { setCookie, getCookie, WriteCookie } from "@/tool/cookie";
import { Https } from "@/tool/https";
import { Modal, message } from "ant-design-vue";
export default defineComponent({
components: {
},
setup() {
let renameData: any = ref({}); //修改名字选中的数据
const columns: any = computed(() => {
return [
{
title: 'Email',
align: "center",
ellipsis: true,
width: 70,
dataIndex: "email",
key: "email",
},
{
title: 'Create Time',
align: "center",
width: 70,
dataIndex: "updateTime",
key: "updateTime",
// customRender: (record: any) => {
// let time = formatTime(
// record.text / 1000,
// "YYYY-MM-DD hh:mm:ss"
// );
// return time;
// },
},
{
title: 'State',
align: "center",
ellipsis: true,
width: 70,
dataIndex: "status",
key: "status",
customRender: (record: any) => {
let str
if(record.value == 0){
str ='pending'
}else if(record.value == 1){
str ='agree'
}else if(record.value == 2){
str ='reject'
}
return str;
},
},
{
title: 'Address',
align: "center",
ellipsis: true,
width: 70,
dataIndex: "country",
key: "country",
},
{
title: 'Surname',
align: "center",
ellipsis: true,
width: 70,
dataIndex: "surname",
key: "surname",
},
{
title: 'Name',
align: "center",
ellipsis: true,
width: 70,
dataIndex: "userName",
key: "userName",
},
{
title: 'Operations',
key: "operation",
align: "center",
fixed: "right",
width: 70,
// slots:{customRender:'action'}
Operations: true,
},
];
});
let currentState = ref({
name:'all',
value:'',
state:false,
},)
let state:any = ref([
{
label:'all',
value:'',
},
{
label:'pending',
value:0,
},
{
label:'agree',
value:1,
},
{
label:'rejected',
value:2,
},
])
let collectionList: any = ref([]);
let userInfo: any = {};
let status: any = ref(0);
let voluntarily: any = ref(false);
return {
columns,
collectionList,
renameData,
userInfo,
status,
currentState,
state,
voluntarily,
};
},
data() {
return {
currentPage: 1,
pageSize: 10,
total: 0,
historyTableHeight: 0,
newCollectionName: "",
renameVisivle: false, //修改名字弹窗
collectionName: "", //选中的名字
searchCollectionName: "",
};
},
mounted() {
let historyTable: any = this.$refs.historyTable;
this.historyTableHeight = historyTable.clientHeight - 130;
this.gettrialList();
let userInfo:any = getCookie("userInfo")
this.userInfo = JSON.parse(userInfo);
this.getIsAutoApproval()
},
methods: {
//改变页码
changePage(e: any) {
this.currentPage = e.current;
this.pageSize = e.pageSize;
this.gettrialList();
},
//获取是否自动审批
getIsAutoApproval(){
Https.axiosPost(Https.httpUrls.getIsAutoApproval, {}).then(
(rv: any) => {
this.voluntarily = rv
}
);
},
//查询列表
searchHistoryList() {
this.currentPage = 1;
this.gettrialList();
},
setIsAutoApproval(){
Https.axiosPost(Https.httpUrls.switchIsAutoApproval, {}).then(
(rv: any) => {
this.getIsAutoApproval
}
);
},
//获取列表
gettrialList() {
let data = {
page: this.currentPage,
size: this.pageSize,
status: this.currentState.value,
// startDate:startDate,
// endDate:endDate
};
Https.axiosPost(Https.httpUrls.trialOrderList, data).then(
(rv: any) => {
this.collectionList = rv.content;
}
);
},
setAgree(record: any, index: number){
const formData = new FormData()
formData.append('ids',record.id)
let config:any = {headers:{'Content-Type':'multipart/form-data','Accept':'*/*' }}
Https.axiosPost(Https.httpUrls.trialOrderApproval, {ids:record.id}).then(
(rv: any) => {
message.success('同意成功~')
}
);
},
setRefuse(record: any, index: number){
const formData = new FormData()
formData.append('ids',record.id)
let config:any = {headers:{'Content-Type':'multipart/form-data','Accept':'*/*' }}
Https.axiosPost(Https.httpUrls.trialOrderRefuse, formData,config).then(
(rv: any) => {
this.gettrialList();
message.success('拒绝成功~')
}
);
},
setState(){
this.currentState.state = true
},
setStateItem(item:any){
this.currentState = item
this.currentState.state = false
},
},
});
</script>
<style lang="less">
</style>