<template>
	<view class="configure-page">
		<view class="greyTitle">为结果选项配置后续操作</view>
		<view v-for="(item,index) in resultConfigList" :key="index" class="configure-cont">
			<text class="contTitle">{{item.name}}</text>
			<text class="contCont" v-for="items in configList" v-if="item.resultType == items.key">{{items.name}}</text>
			<image src="../../static/查看更多_.png" class="moreImg" @click="showConfig(item,index)"></image>
		</view>
		<view class="sure-button">
			<button @click="sureList">保存</button>
		</view>
		<view class="recovery" @click="recoveryList">恢复初始配置</view>
	  <tm-tabbar :permission="1" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				resultConfigList:[],
				configList:[
					{
						key:'1',
						name:'无需操作',
					},{
						key:'2',
						name:'需改善回复',
					},{
						key:'3',
						name:'需使用改善工具',
					}
				],
				showPopup:false,
				radioVal:null,
				index:null,
			}
		},
		created() {
			this.getResultConfig()
		},
		methods: {
			//获取最新配置
			getResultConfig(){
				this.$store.dispatch({
					type:'configure/commActions',
					payload:{
						key:'getResultConfig'
					}
				}).then(res=>{
					this.resultConfigList = res?res:[];
				})
			},
			//恢复最初配置
			recoveryList(){
				this.$store.dispatch({
					type:'configure/commActions',
					payload:{
						key:'getDefault'
					}
				}).then((res)=>{
					// console.log(res)
					// this.resultConfigList = res?res:[];
				})
			},
			//保存配置
			sureList(){
				this.$store.dispatch({
					type:'configure/commActions',
					payload:{
						key:'postResultConfig',
						data:{
							list:this.resultConfigList
						}
					}
				}).then(res=>{
					// console.log(res,'kkkk')
					this.getResultConfig();
					// this.resultConfigList = res?res:[];
				})
			}
		},
		components: {
		}
	}
</script>

<style lang="less">
	.configure-page{
		height: 100%;
		background-color: #F5F6FA;
		.greyTitle{
			padding-left:25rpx;
			height: 105rpx;
			line-height: 105rpx;
			font-size: 30rpx;
			color: #292C33;
		}
		.configure-cont{
			padding-left:25rpx;
			font-size: 22.5rpx;
			line-height: 87.5rpx;
			border-bottom: 0.62rpx solid #DADEE6;
			background-color: #fff;
			.contTitle{
				display: inline-block;
				width: 175rpx;
				color: #525866;
			}
			.contCont{
				color: #292C33;
			}
			.moreImg{
				margin-top: 31.23rpx;
				margin-right: 18.68rpx;
				padding: 1.89rpx 6.31rpx;
				float: right;
				width: 12.37rpx;
				height: 21.21rpx;
			}
		}
		.configure-cont:nth-child(6){
			border-bottom: none;
		}
		.sure-button{
			margin: 35rpx auto;
			button{
				width: 625rpx;
				height: 62.5rpx;
				line-height: 62.5rpx;
				border-radius: 37.5rpx;
				background-color: #3377FF;
				color: #fff;
				font-size: 22.5rpx;
			}
		}
		.recovery{
			text-align: center;
			color: #7A8599;
			font-size: 22.5rpx;
		}
	}
</style>
