<!--
@ 作者: 鲁智强
@ 时间: 2023-08-15 11:34:38
@ 备注: 
-->
<template>
	<el-dialog :model-value="true" :title="title" @close="handleClose" style="width:30%">
		<el-form ref="ruleFormRef" :model="formData" label-width="120px" class="demo-ruleForm">
      	<el-form-item label="考核维度名称:" prop="title">
		<el-input v-model="formData.title" placeholder="请输入标题"></el-input> 
	</el-form-item>
	<el-form-item label="考核维度ID:" prop="outId">
		<el-input v-model="formData.outId" disabled placeholder="请输入ID"></el-input> 
	</el-form-item>
	<el-form-item label="排序:" prop="sort">
		<el-input v-model="formData.sort" disabled placeholder="请输入ID"></el-input> 
	</el-form-item>
	  <el-form-item  #default="{ row }">
        <el-button type="primary" @click="submitForm(row)">确定</el-button>
   	</el-form-item>
	</el-form>	
	</el-dialog>
  </template>
  <script lang="ts" setup>
  import { reactive } from "vue";
  import {adddutyclass,editPostCont,getdutyclassinfo,eitedutyclassinfo} from '@/api/opk/pulic/api'
<<<<<<< HEAD
  
=======
>>>>>>> luzhiqiang_v1
  interface FormInfo {
	id: number;
	sort: number;
	title: string;
	type: number;
	outId:string;
  }
const props= defineProps( {
	  title: {
		type: String,
		default: "",
	  },
	  editPostCont: {
		type: Boolean,
		default: false,
	  },
	  rowInfo: {
		type: Object as () => FormInfo,
		default() {
		  return {};
		},
	  },
	  arrayNum: {
		type: Number,
		default: 0,
	  },
	});
const emit = defineEmits(["update:editPostCont","editRow","addRow"])
const addPost = false;
const tableData = ref<any>([])
function jjjs(){
	editPostCont()
	    .then(data => {
        	tableData.value = data.data.list;
          	// 打印获取的数据
          	console.log('获取的数据:',tableData.value);
        })
        .catch(error => {
          console.error('Error fetching data:', error);
        });
}
const formData = reactive({
	title:"",
	outId:"",
	sort: 1,
})
  // 关闭弹窗
 const handleClose = ()=> {
    emit("update:editPostCont", false);
  }
 const submitForm=(val:any)=> {
      	eitedutyclassinfo(formData).then(()=>
			ElMessage.success("编辑成功"))
			handleClose()
			jjjs()
}
onMounted(()=>{
	Object.assign(formData, props.rowInfo);
})
  </script>
  
  <style scoped>
  
  
  .avatar-uploader .avatar {
	display: block;
	width: 178px;
	height: 178px;
  }
  </style>
  
  <style lang="scss">
  .avatar-uploader .el-upload {
	position: relative;
	overflow: hidden;
	cursor: pointer;
	border: 1px dashed var(--el-border-color);
	border-radius: 6px;
	transition: var(--el-transition-duration-fast);
  }
  
  .avatar-uploader .el-upload:hover {
	border-color: var(--el-color-primary);
  }
  
  .el-icon.avatar-uploader-icon {
	width: 178px;
	height: 178px;
	font-size: 28px;
	color: #8c939d;
	text-align: center;
  }
  .el-dialog{
	  width:1200px;
  }
  </style>
  