<!-- eslint-disable vue/no-parsing-error -->
<!--
@ 作者: 鲁智强
@ 时间: 2023-08-15 11:34:38
@ 备注: 
-->
<!--
@ 作者: 鲁智强
@ 时间: 2023-08-15 11:34:38
@ 备注: 
-->
<template>
<el-dialog  destroy-on-close :model-value="true" :title="title" @close="handleClose">	
<el-form ref="ruleFormRef" :model="formData" label-width="50px" class="demo-ruleForm" style="width:100%">
	<el-form-item label="年度">
		<el-date-picker v-model="formData.time" type="year"/>
	</el-form-item>
	<el-form-item v-loading="isshow" :data="tablea" label="123">
		<el-row>
			<el-col v-for="item in tablea.child" :key="item.key" label="item.name">
				<el-card>
					<template #header>
						<div>
							<span>{{item.name}}</span>
						</div>
						<el-table border :data="item.child">
							<el-table-column label="指标名称" prop="name" />
							<el-table-column label="说明" prop="content">
								<el-input v-model="formData.zjr" />
							</el-table-column>
							<el-table-column label="指标权重" prop="content">
								<el-input v-model="formData.zjr" />
							</el-table-column>
							<el-table-column label="状态" prop="status">
								<el-select v-model="tablea.child.child.status">
									<el-option label="使用" :value="1"/>
									<el-option label="禁用" :value="2"/>		
									<el-option label="观察" :value="3"/>
								</el-select>
							</el-table-column>
						</el-table>
					</template>
				</el-card>
			</el-col>
		</el-row>
	</el-form-item>
	<el-form-item>
		<el-button type="primary" @click="submitForm()">确定</el-button>
	</el-form-item>
	</el-form>
</el-dialog>
</template>
	  <script lang="ts" setup>
	  import { reactive } from "vue"
	  import {ge_copy } from '@/api/opk/zxy/news/api'
	  import "quill/dist/quill.snow.css"; 
	const isshow = ref(false)
	const props= defineProps( {
	      title: {
	        type: String,
	        default: "",
	      },
	      edPostBox: {
	        type: Boolean,
	        default: false,
	      },
	      rowInfo: {
	        type: Object,
	        default() {
	          return {};
	        },
	      },
	      arrayNum: {
	        type: Number,
	        default: 0,
	      },
	    });
	const orgTreeProps ={
	   label: 'name',
	}
	const orgTreeProp = {
	    label:'title',
	    children:'children'
	}
	
	const emit = defineEmits(["update:edPostBox","editRow","addRow"])
	const formData = reactive({
		deaprtname:"",
		year:"",
		asd:[] as string[],
		zjr:"",
		lzq:"",
	})
	const tablea = ref<any>([])
	const table = ref<any>([])
	function ge_adds(){
	    const yui = props.rowInfo.key
	    ge_copy({id:yui})
	        .then((data) => {
	            tablea.value = data.data;
				table.value = data.data.child.child
	        }).finally(()=>{
	            isshow.value = false
	        })
	    }
	ge_adds()
	  // 关闭弹窗
	 const handleClose = ()=> {
	    emit("update:edPostBox", false);
	  }
	  onMounted(()=>{
	    Object.assign(formData,props.rowInfo);
	})
	 </script>
