<template>
	<div>
		<!-- 任务列表 -->
		<u-grid :col="4" :border="true">
			<u-grid-item @click="openBumen" style="height: 35px;">
				<text class="grid-text">人员<u-icon name="arrow-down"></u-icon></text>
			</u-grid-item>
			<u-grid-item @click="openBumen" style="height: 35px;">
				<text class="grid-text">{{name}}</text>
			</u-grid-item>
		</u-grid>
		<u-subsection :list="['定性考核', '定量考核']" @change="thumbChange"></u-subsection>
		
			<el-table :data="dingXingData" border v-show="show==0" :cell-style="{padding:'0px'}">
						
						<el-table-column align="center" label="指标">
						  <template #default="scope">
							<el-button
							  style="font-size: 14px"
							  size="small"
							  type="text"
							  @click="toZhi(scope.row)"
							>{{scope.row.title}}</el-button>
						  </template>
						</el-table-column>
						<el-table-column align="center" label="操作属性" prop="extrapoints">
							<template #default="scope">
								<view v-if="scope.row.addreduce==1">减少</view>
								<view v-if="scope.row.addreduce==2">增加</view>
								<view v-if="scope.row.addreduce==3">无属性，现场确认加或减</view>
							  </template>
						</el-table-column>
			</el-table>
			<!-- <u-table style="margin-top: 10px;" v-if="show==0">
			<u-tr>
			
				<u-th>部门</u-th>
				<u-th>指标</u-th>
				<u-th>加分</u-th>
				<u-th>减分</u-th>
			</u-tr>
			<u-tr v-for="(iteam,index) in dataList" :key="index">
				<u-td>{{iteam.departmentname}}</u-td>
				<u-td style="color: #2979FF;">
					<view @click="toZhi(iteam)" class="">{{iteam.title}}</view>
				</u-td>
				<u-td>{{iteam.extrapoints}}</u-td>
				<u-td>{{iteam.scorereduction}}</u-td>
			</u-tr>
			
		</u-table> -->
		<el-dialog :close-on-click-modal="false" width="100%" :visible.sync="bumenShow">
		  <el-cascader-panel ref="cascader" placeholder="请选择人员" filterable clearable :options="renyuanList" :show-all-levels="false" :props="props1" @change='clickBu($event)'></el-cascader-panel>
		</el-dialog>
		<el-table :data="dingLiangData" border v-show="show==1" :cell-style="{padding:'0px'}">
			<el-table-column align="center" label="指标" prop="title"/>
			<el-table-column align="center" label="操作">
			  <template #default="scope">
				<el-button
				  style="font-size: 14px"
				  size="small"
				  type="text"
				  @click="toShi(scope.row)"
				>提报</el-button>
			  </template>
			</el-table-column>
		</el-table>
		<!-- <u-table style="margin-top: 10px;" v-if="show==1">
			<u-tr>
				<u-th>部门</u-th>
				<u-th>指标</u-th>
				<u-th>数据</u-th>
			</u-tr>
			<u-tr v-for="(iteam,index) in liangDataList" :key="index">
				<u-td>{{iteam.parentname}}</u-td>
				<u-td>
					<view class="">{{iteam.targetname}}</view>
				</u-td>
				<u-td style="color: #2979FF;">
					<view class="" @click="toShi(iteam)">
						提报
					</view>
				</u-td>
			</u-tr>
			
		</u-table> -->
	</div>
</template>

<script>
	export default {
		data() {
		    return {
				name:'',
				dingXingData:[],
				dingLiangData:[],
				searchInfo:{
					id:''
				},
				props1: {
				        checkStrictly: true,
				        value: "keystr",
				        label: "name",
				        children:  "children",
				        emitPath:false,
				      },
				renyuanList:[],
				show:0,
				liangDataList:[],
				bumenShow:false,
				dataList:[
						// {
						// group: 3, //集团
						// groupname: "恒信高科", //集团名称
						// department: 2, //部门ID
						// departmentname: "化产分厂", //部门名称
						// dimension: 16468024536587500, //维度ID
						// dimensionname: "高效运营", //维度名称
						// target: 6, //指标ID
						// title: "安全环保", //指标名称
						// extrapoints: 0, //总加分
						// scorereduction: 4.6 //总减分
						// },
						// {
						// group: 3, //集团
						// groupname: "恒信高科", //集团名称
						// department: 2, //部门ID
						// departmentname: "化产分厂", //部门名称
						// dimension: 16468024536587500, //维度ID
						// dimensionname: "高效运营", //维度名称
						// target: 6, //指标ID
						// title: "指标1", //指标名称
						// extrapoints: 0, //总加分 
						// scorereduction: 9 //总减分
						// },
						// {
						// group: 3, //集团
						// groupname: "恒信高科", //集团名称
						// department: 2, //部门ID
						// departmentname: "化产分厂", //部门名称
						// dimension: 16468024536587500, //维度ID
						// dimensionname: "高效运营", //维度名称
						// target: 6, //指标ID
						// title: "指标2", //指标名称
						// extrapoints: 9, //总加分
						// scorereduction: 0 //总减分
						// },
						// {
						// group: 3, //集团
						// groupname: "恒信高科", //集团名称
						// department: 2, //部门ID
						// departmentname: "化产分厂", //部门名称
						// dimension: 16468024536587500, //维度ID
						// dimensionname: "高效运营", //维度名称
						// target: 6, //指标ID
						// title: "指标3", //指标名称
						// extrapoints: 4, //总加分
						// scorereduction: 5 //总减分
						// },
					]
		    }
		},
		onShow() {
			
			var myDeparment = {}
			this.$u.api.User.mycontent().then(res => {
				// alert("个人中心接口")
				// alert(JSON.stringify(res))
				if(res.code==0){
					myDeparment=res.data
					const from1 = {
						page: 1, 
						pagesize: 10000,
						adminorg:myDeparment.adminorg
						// company: parseInt(myDeparment.company), 
						// deparment: myDeparment.deparment.toString(), 
					}
					this.$u.api.User.stafflist(from1).
					then(res => {
						// alert("个人中心接口")
						// alert(JSON.stringify(res))
						if(res.code==0){
							this.renyuanList=res.data.list
						}
							
					})
				}
					
			})
		    // this.$u.api.Duty.newqualitative().then(res => {
		    // 	if(res.code==0){
		    // 		this.dataList=res.data
		    // 	}
		    // 	})
		    // this.$u.api.Duty.qualitativeevalration().then(res => {
		    // 	if(res.code==0){
		    // 		this.liangDataList=res.data
		    // 	}
		    // 	})
		},
		onLoad(){
			
			// if (this.$store.state.isLogin==false) {
			// 	window.location.href = 'https://www.hxgk.group/jumpapiurl/?url=http://new.hxgk.group/sj/index';
			// }
		},
		methods: {
			clickBu(val){
				console.log(val)
				this.name=this.$refs["cascader"].getCheckedNodes()[0].label
				this.searchInfo.id = val;
				this.getDingXingData()
				this.getDingLiangData()
				this.bumenShow=false
			},
			getDingXingData(){
				this.$u.api.Duty.getpostnature(this.searchInfo).then(res => {
					// alert(JSON.stringify(res))
					if(res.code==0){
						this.dingXingData=res.data
					}
				})
			},
			getDingLiangData(){
				this.$u.api.Duty.getpostration(this.searchInfo).then(res => {
					// alert(JSON.stringify(res))
					if(res.code==0){
						this.dingLiangData=res.data
					}
				})
			},
			openBumen(){
				this.bumenShow=true
			},
			thumbChange(index) {
				this.show=index
			},
			toShi(iteam){
				iteam.key=this.searchInfo.id
				this.$u.route('/pages/post/data', iteam);
			},
			toZhi(iteam){
				iteam.key=this.searchInfo.id
				this.$u.route('/pages/post/details', iteam);
			},
		}
	}
</script>

<style scoped lang="scss">
 ::v-deep.el-table .el-table__cell{
	padding: 0 0;
}
</style>
