<template>
	<fullscreen :fullscreen.sync="fullscreen" class="container">
		<div class="container-box">
			<toolList @iconCli='iconCli' :tooltit='tooltit'></toolList>
			<div class="tabbox zdy">
				<el-table height="100%" class="com-table" ref="multipleTable" :data="tableData"
					tooltip-effect="dark" size="small" border style="width: 100%" v-loading="loading">
					<el-table-column prop="missionId" label="任务编号">
					</el-table-column>
                    <el-table-column prop="missionName" label="名称">
					</el-table-column>
					<el-table-column prop="supplierCode" label="统计周期">
                        <template slot-scope="scope">
                        	{{scope.row.startTime}}-{{scope.row.endTime}}
                        </template>
					</el-table-column>
					<el-table-column prop="tempName" label="填报模板">
					</el-table-column>
					<el-table-column prop="endTime" label="处理时效">
					</el-table-column>
					<el-table-column prop="receiverName" label="发起人">
					</el-table-column>
                    <el-table-column prop="stsDesc" label="当前状态">
					</el-table-column>
                    <el-table-column label="操作" width="240px" align="center">
                        <template slot-scope="scope">
                            <el-button style="margin-right: 10px;" size="mini" type="primary" @click="jumpinfo(scope.row)">查看</el-button>
                            <span v-if="scope.row.groupLevel != 4">
                                <!-- <el-button size="mini" v-if="scope.row.sts == 111||scope.row.sts == 121||scope.row.sts == 131" type="danger" @click="shanchu(scope.row)">删除</el-button> -->
                                <el-button size="mini" type="primary" @click="zhaohui(scope.row)" v-if="stshs(1,scope.row.sts)">召回</el-button>
                                <el-button size="mini" type="primary" @click="jdgz(scope.row)" v-if="stshs(2,scope.row.sts)">进度跟踪</el-button>
                            </span>
                        </template>
                    </el-table-column>
				</el-table>
				<el-pagination class="pageBox" @current-change="currchange" layout="prev, pager, next" background
					:total="total">
				</el-pagination>
			</div>
		</div>
	</fullscreen>

</template>
<script>
	import mySearch from "../../../components/search.vue";
	import myMessage from "../../../components/myMessage.vue"
	import toolList from '../../../components/toolList'

	export default {
		components: {
			mySearch,
			myMessage,
			toolList
		},
		data() {
			return {
				tooltit: '进行中',
				fullscreen: false,
				total: 0,
				pageSize: 1,
				tableData: [{}],
				dialogStatus: false,
				disableStatus: false,
				titname: '',
				infolist: {},
				userInfo: {},
				params: {},
				centerDialogVisible: false,
				messTit: '',
				delid: '',
				loading: false,
				loadinged: false,
			}
		},
		methods: {
            stshs(n,v){
                if(n==1){
                    if(v==111||v==121||v==131||v=='012'||v=='022'||v=='032'){
                        return true
                    }else{
                        return false
                    }
                }else{
                    if(v==114||v==124||v==134||v=='125'||v=='135'||v==111||v==121||v==131||v=='012'||v=='022'||v=='032'){
                        return true
                    }else{
                        return false
                    }
                }
            },
            zhaohui(v){
                this.$http({
                    // url: "/market/cIllegalCallTask/callBack",
                    url: "/market/cIllegalCallTask/callBackByMission",
                    method: "post",
                    headers: {
                        "Content-Type": "application/json",
                    },
                    data: {
                        missionId: v.missionId,
                    },
                }).then((res) => {
                    this.shenpists = false;
                    this.$message({
                        message: '成功',
                        type: 'success'
                    });
                    this.getList({}, this.pageSize);
                });
            },
            shanchu(v){
                this.$http({
                    url: "/market/cIllegalCallTask/callBack",
                    method: "post",
                    headers: {
                        "Content-Type": "application/json",
                    },
                    data: {
                        missionId: v.missionId,
                    },
                }).then((res) => {
                    this.shenpists = false;
                    this.$message({
                        message: '成功',
                        type: 'success'
                    });
                    this.getList({}, this.pageSize);
                });
            },
			jumpinfo(v) {
                let id = v.tempId+','+v.taskId+','+v.missionId+','+v.groupLevel+','+v.missionName+','+v.parentMissionId+','+v.sts;
				this.$router.push({
					path: "/checkunderway?id="+id,
                    query:{
                        id:id,
                    }
				});
				this.setabList("进行中任务", "/checkunderway?id="+id);
			},
            jdgz(v) {
                let id = v.taskId+','+v.groupLevel+','+v.missionId;
				this.$router.push({
					path: "/schedule?id="+id,
                    query:{
                        id:id,
                    }
				});
				this.setabList("进度跟踪", "/schedule?id="+id);
			},
			setabList(n, p) {
				let params = {
					children: "",
					name: n,
					rountPath: p,
					target: "_self",
				};
				for (let i = 0; i < this.$store.state.tabList.length; i++) {
					if (this.$store.state.tabList[i].name === params.name) {
						this.$store.state.tabList[i] = params;
					}
				}
				let set = new Set([...this.$store.state.tabList, params]);
				set.add(params);
				this.$store.commit("setDefaultActive", params.rountPath);
				this.$store.commit("setTabList", Array.from(set));
			},
			//获取列表
			getList(v, n) {
				this.pageSize = n;
				let _this = this;
				this.loading = true;
				this.tableData = [];
                v.sts = 0;
				this.$http({
					url: "/market/cIllegalCallTask/queryToDoPage",
					method: "post",
					headers: {
						"Content-Type": "application/json",
						"page": '{"pageNo":"' + n + '","pageSize":"10"}'
					},
					data: v,
				}).then((res) => {
					this.tableData = res.data.data;
					this.total = res.data.totalRecord;
					this.loading = false;
				});
			},
			// 分页
			currchange(v) {
				this.pageSize = v;
				this.getList(this.params, this.pageSize);
			},
			//功能栏
			iconCli(v) {
				if (v === 1) {
					this.getList(this.params, this.pageSize);
				}
				if (v === 2) {
					this.fullscreen = !this.fullscreen
				}
			},
			getUser() {
				this.userInfo = JSON.parse(window.sessionStorage.userInfo);

			}
		},
		mounted() {
			this.getList({}, 1);
			this.getUser();
		},
		created() {

		}
	}
</script>
<style scoped lang="scss">
	.onetab {
		margin-bottom: 20px;
		padding: 0 20px;
	}

	.titbox {
		div {
			float: right;

			i {
				font-size: 22px;
				margin-left: 20px;
				cursor: pointer;
			}
		}
	}

	.tabbox {
		margin-top: 15px;
	}

	.pageBox {
		text-align: right;
		margin-top: 10px;
	}

	.info-line {
		width: 100%;
		display: block;
		padding-left: 20px;

		div {
			width: 50%;
			display: inline-block;
		}

		span {
			width: 80px;
			display: inline-block;
			text-align: left;

			i {
				color: red;
				display: inline-block;
				padding-right: 5px;
			}
		}

		.el-select,
		.el-input {
			width: calc(100% - 100px);
		}
	}

	.online {
		width: 100%;

		.el-select {
			width: calc(100% - 100px);
		}

		span {
			vertical-align: top;
		}

		.el-textarea {
			width: calc(100% - 100px);
		}
	}
</style>
