<template>
  <el-form :model="form" label-width="80px">
    <!-- <limit-level  v-for="(item,index) in rootData.children"  :key=index :rule="item" :moIndex="mo_index"></limit-level> -->
    <!-- 
       <limit-level  :rule="rootData.children[1]" :moIndex="mo_index"></limit-level> -->
    <!-- 
          <limit-level  :rule="data" :moIndex="mo_index"></limit-level> -->

    <!-- <limit-level  v-for="(item,index) in questionData"  :key="index" :rule="item" @submitAns="submitAns"  :moIndex="mo_index"></limit-level>

           <el-form-item>
            <div style="text-align:center; width: 500px;">
                <el-button size="small" type="primary" style="margin-right: 50px;" v-if="ans===rootData.children.length" @click="confirmAns">确定</el-button>
                <el-button size="small">取消</el-button>
            </div>
        </el-form-item> -->

    <el-form-item label="affairCode">
      <el-input v-model="form.affairCode"></el-input>
    </el-form-item>

    <el-form-item label="name">
      <el-input v-model="form.name"></el-input>
    </el-form-item>
    <el-form-item label="systemCode">
      <el-input v-model="form.systemCode"></el-input>
    </el-form-item>

    <el-form-item>
      <div style="text-align: center; width: 500px">
        <el-button
          size="small"
          type="primary"
          style="margin-right: 50px"
          @click="comfirm"
          >form提交</el-button
        >
        <el-button
          size="small"
          type="primary"
          style="margin-right: 50px"
          @click="comfirmJson"
          >json提交</el-button
        >
      </div>
    </el-form-item>
  </el-form>
</template>

<script>
import axios from "axios";
export default {
  components: {},
  created() {},
  methods: {
    submitAns(ids, id, name, data) {
      console.log("submitAns top");
      console.log("ids" + ids);
      console.log("name" + name);
    },

    comfirm() {
      this.$post("/test/getHcpSin/form", this.form).then((res) => {
        console.log(res);
        this.$message.info(res);
      });
    },

    comfirmJson() {
      let temp = this.form;

      // json格式请求头
      const headerJSON = {
        "Content-Type": "application/json",
      };

      axios
        .post("/m/test/getHcpSin/json", JSON.stringify(temp), {
          headers: headerJSON,
        })
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {});
    },
  },
  data() {
    return {
      form: {},
      data: [],
    };
  },
};
</script>