<template>
  <div class="dialog" v-if="dialogForm">
    <div class="head_box" >
      <span class="title">{{ title }}重点人管理</span>
      <div>
        <el-button type="primary" size="small" :loading="loading" @click="submit" v-if="!disabled">保存</el-button >
        <el-button size="small" @click="close">关闭</el-button>
      </div>
    </div>
    <div class="form_cnt">
      <FormMessage :disabled="disabled" v-model="listQuery" :formList="formData" ref="elform" :rules="rules"></FormMessage>
    </div>
  </div>
</template>

<script setup>
import FormMessage from "@/components/aboutTable/FormMessage.vue";
import { ref, defineExpose,defineProps, defineEmits } from "vue";
const emit = defineEmits(["updateDate"]);
const props = defineProps({
  dic: Object
});
const dialogForm = ref(false); //弹窗
const formData = ref([
  { label: "数据来源", prop: "sjly", type: "select", options:props.dic.D_GS_RQFJ_LX,disabled:true },
  { label: "是否发掘", prop: "sffj", type: "select", options: props.dic.D_BZ_SF,disabled:true },
  { label: "数据时间", prop: "sj", type: "datetime"},
  { label: "指向地点", prop: "dd", type: "textarea", width: "100%" },
  { label: "数据内容", prop: "nr", type: "textarea", width: "100%" },
]);
const listQuery = ref({}); //表单
const loading = ref(false);
const elform = ref();
const title = ref("编辑");
const disabled = ref(false)
// 初始化数据
const init = (row) => {
  dialogForm.value = true;
  listQuery.value = JSON.parse(JSON.stringify(row))
};

// 提交
const submit = () => {
  elform.value.submit((data) => {
    emit('updateDate',data)
    close();
  });
};

// 关闭
const close = () => {
  listQuery.value = {};
  dialogForm.value = false;
  loading.value = false;
};

defineExpose({ init });
</script>

<style lang="scss" scoped>
@import "~@/assets/css/layout.scss";
@import "~@/assets/css/element-plus.scss";
::v-deep .el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
  color: #0072ff;
  background: rgba(0, 114, 255, 0.3);
}
.boxlist {
  width: 99%;
  height: 225px;
  margin-top: 10px;
  overflow: hidden;
}
</style>
