<template>
  <div class="fm-style">
    <el-form
      ref="generateForm"
      class="generate"
      :disabled="isDisabled"
      :size="data.config.size"
      :model="models"
      :rules="rules"
      :label-position="data.config.labelPosition"
      :label-width="data.config.labelWidth + 'px'"
    >
      <template v-for="(item, index) in data.list">
        <template v-if="item.type == 'grid'">
          <el-row
            :key="index"
            type="flex"
            :gutter="item.options.gutter ? item.options.gutter : 0"
            :justify="item.options.justify"
            :align="item.options.align"
          >
            <el-col
              v-for="col in item.columns"
              :key="col.key"
              :span="col.span"
              class="inlineCol"
            >
              <!-- widget = citem 包含组件所有信息-->
              <template v-for="citem in col.list">
                <el-form-item
                  v-if="citem.type == 'blank'"
                  :label="citem.name"
                  :prop="citem.model"
                  :key="citem.key"
                  style="border-bottom: 1px solid black"
                >
                  <slot :name="citem.model" :model="models"></slot>
                </el-form-item>
                <template v-else-if="citem.type == 'proItem'">
                  <el-form-item class="problem-entry" label="项目信息" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <template v-else-if="linecitem.type == 'auditEdItem'">
                            
                            <el-form-item
                              label="被审计单位"
                              :key="linecitem.key"
                              class="problem-entry"
                            >
                              <el-row
                                :key="linecitem.key"
                                type="flex"
                                :gutter="
                                  linecitem.options.gutter
                                    ? linecitem.options.gutter
                                    : 0
                                "
                                :justify="linecitem.options.justify"
                                :align="linecitem.options.align"
                              >
                                <el-col
                                  v-for="(
                                    linecitemcol, linecitemcolIndex
                                  ) in linecitem.columns"
                                  :key="linecitemcolIndex"
                                  :span="linecitemcol.span"
                                >
                                  <template
                                    v-for="llcitem in linecitemcol.list"
                                  >
                                    <el-form-item
                                      v-if="llcitem.type == 'blank'"
                                      :label="llcitem.name"
                                      :prop="llcitem.model"
                                      :key="llcitem.key"
                                      style="border-bottom: 1px solid black"
                                    >
                                      <slot
                                        :name="llcitem.model"
                                        :model="models"
                                      ></slot>
                                    </el-form-item>
                                    <genetate-form-item
                                      v-else
                                      :key="llcitem.key"
                                      :models.sync="models"
                                      :remote="remote"
                                      :rules="rules"
                                      :formOptions="formOptions"
                                      :widget="llcitem"
                                      @input-change="onInputChange"
                                      @editTable="editTable"
                                      @orgSign="orgSign"
                                    >
                                    </genetate-form-item>
                                  </template>
                                </el-col>
                              </el-row>
                            </el-form-item>
                          </template>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @editTable="editTable"
                            @orgSign="orgSign"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'quesItem'">
                  <el-form-item class="problem-entry" label="问题信息" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <template v-else-if="linecitem.type == 'contrItem'">
                            
                            <el-form-item
                              label="合同信息"
                              :key="linecitem.key"
                              class="problem-entry"
                            >
                              <el-row
                                :key="linecitem.key"
                                type="flex"
                                :gutter="
                                  linecitem.options.gutter
                                    ? linecitem.options.gutter
                                    : 0
                                "
                                :justify="linecitem.options.justify"
                                :align="linecitem.options.align"
                              >
                                <el-col
                                  v-for="(
                                    linecitemcol, linecitemcolIndex
                                  ) in linecitem.columns"
                                  :key="linecitemcolIndex"
                                  :span="linecitemcol.span"
                                >
                                  <template
                                    v-for="llcitem in linecitemcol.list"
                                  >
                                    <el-form-item
                                      v-if="llcitem.type == 'blank'"
                                      :label="llcitem.name"
                                      :prop="llcitem.model"
                                      :key="llcitem.key"
                                      style="border-bottom: 1px solid black"
                                    >
                                      <slot
                                        :name="llcitem.model"
                                        :model="models"
                                      ></slot>
                                    </el-form-item>
                                    <genetate-form-item
                                      v-else
                                      :key="llcitem.key"
                                      :models.sync="models"
                                      :remote="remote"
                                      :rules="rules"
                                      :formOptions="formOptions"
                                      :widget="llcitem"
                                      @input-change="onInputChange"
                                      @editTable="editTable"
                                      @orgSign="orgSign"
                                    >
                                    </genetate-form-item>
                                  </template>
                                </el-col>
                              </el-row>
                            </el-form-item>
                          </template>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'rectifyItem'">
                  <el-form-item class="problem-entry" label="整改信息" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'riskmattersItem'">
                  <el-form-item class="problem-entry" label="风险事项信息" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'suggestItem'">
                  <el-form-item class="problem-entry" label="建议信息" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'accountabilityItem'">
                  <el-form-item class="problem-entry" label="责任追究信息" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'countItem'">
                  <el-form-item class="problem-entry" label="统计信息" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <template v-else-if="linecitem.type == 'amountProblemsItem'">
                            
                            <el-form-item
                              label="金额类问题整改方式（元）"
                              :key="linecitem.key"
                              class="problem-entry"
                            >
                              <el-row
                                :key="linecitem.key"
                                type="flex"
                                :gutter="
                                  linecitem.options.gutter
                                    ? linecitem.options.gutter
                                    : 0
                                "
                                :justify="linecitem.options.justify"
                                :align="linecitem.options.align"
                              >
                                <el-col
                                  v-for="(
                                    linecitemcol, linecitemcolIndex
                                  ) in linecitem.columns"
                                  :key="linecitemcolIndex"
                                  :span="linecitemcol.span"
                                >
                                  <template
                                    v-for="llcitem in linecitemcol.list"
                                  >
                                    <el-form-item
                                      v-if="llcitem.type == 'blank'"
                                      :label="llcitem.name"
                                      :prop="llcitem.model"
                                      :key="llcitem.key"
                                      style="border-bottom: 1px solid black"
                                    >
                                      <slot
                                        :name="llcitem.model"
                                        :model="models"
                                      ></slot>
                                    </el-form-item>
                                    <genetate-form-item
                                      v-else
                                      :key="llcitem.key"
                                      :models.sync="models"
                                      :remote="remote"
                                      :rules="rules"
                                      :formOptions="formOptions"
                                      :widget="llcitem"
                                      @input-change="onInputChange"
                                      @orgSign="orgSign"
                                      @editTable="editTable"
                                    >
                                    </genetate-form-item>
                                  </template>
                                </el-col>
                              </el-row>
                            </el-form-item>
                          </template>
                          <template v-else-if="linecitem.type == 'notAmountProblemsItem'">
                            
                            <el-form-item
                              label="非金额类问题整改方式"
                              :key="linecitem.key"
                              class="problem-entry"
                            >
                              <el-row
                                :key="linecitem.key"
                                type="flex"
                                :gutter="
                                  linecitem.options.gutter
                                    ? linecitem.options.gutter
                                    : 0
                                "
                                :justify="linecitem.options.justify"
                                :align="linecitem.options.align"
                              >
                                <el-col
                                  v-for="(
                                    linecitemcol, linecitemcolIndex
                                  ) in linecitem.columns"
                                  :key="linecitemcolIndex"
                                  :span="linecitemcol.span"
                                >
                                  <template
                                    v-for="llcitem in linecitemcol.list"
                                  >
                                    <el-form-item
                                      v-if="llcitem.type == 'blank'"
                                      :label="llcitem.name"
                                      :prop="llcitem.model"
                                      :key="llcitem.key"
                                      style="border-bottom: 1px solid black"
                                    >
                                      <slot
                                        :name="llcitem.model"
                                        :model="models"
                                      ></slot>
                                    </el-form-item>
                                    <genetate-form-item
                                      v-else
                                      :key="llcitem.key"
                                      :models.sync="models"
                                      :remote="remote"
                                      :rules="rules"
                                      :formOptions="formOptions"
                                      :widget="llcitem"
                                      @input-change="onInputChange"
                                      @orgSign="orgSign"
                                      @editTable="editTable"
                                    >
                                    </genetate-form-item>
                                  </template>
                                </el-col>
                              </el-row>
                            </el-form-item>
                          </template>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'hanldeDeptItem'">
                  <el-form-item class="problem-entry" label="办理部门" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'ChiefEngineerItem'">
                  <el-form-item class="problem-entry" label="局分管副总师" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'BureauLeaderItem'">
                  <el-form-item class="problem-entry" label="局领导" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'HandleCSItem'">
                  <el-form-item class="problem-entry" label="办理处室" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <template v-else-if="citem.type == 'leadershipItem'">
                  <el-form-item class="problem-entry" label="单位领导" :key="citem.key">
                    <el-row
                      :key="citem.key"
                      type="flex"
                      :gutter="citem.options.gutter ? citem.options.gutter : 0"
                      :justify="citem.options.justify"
                      :align="citem.options.align"
                    >
                      <el-col
                        v-for="(inlinecol, inlinecolIndex) in citem.columns"
                        :key="inlinecolIndex"
                        :span="inlinecol.span"
                      >
                        <template v-for="linecitem in inlinecol.list">
                          <el-form-item
                            v-if="linecitem.type == 'blank'"
                            :label="linecitem.name"
                            :prop="linecitem.model"
                            :key="linecitem.key"
                            style="border-bottom: 1px solid black"
                          >
                            <slot
                              :name="linecitem.model"
                              :model="models"
                            ></slot>
                          </el-form-item>
                          <genetate-form-item
                            v-else
                            :key="linecitem.key"
                            :models.sync="models"
                            :remote="remote"
                            :rules="rules"
                            :formOptions="formOptions"
                            :widget="linecitem"
                            @input-change="onInputChange"
                            @orgSign="orgSign"
                            @editTable="editTable"
                          >
                          </genetate-form-item>
                        </template>
                      </el-col>
                    </el-row>
                  </el-form-item>
                </template>
                <!-- 行内元素 -->
                <template v-else-if="citem.type == 'inline'">
                  <el-row
                    :key="citem.key"
                    type="flex"
                    :gutter="citem.options.gutter ? citem.options.gutter : 0"
                    :justify="citem.options.justify"
                    :align="citem.options.align"
                  >
                    <el-col
                      v-for="(inlinecol, inlinecolIndex) in citem.columns"
                      :key="inlinecolIndex"
                      :span="inlinecol.span"
                    >
                      <template v-for="linecitem in inlinecol.list">
                        <el-form-item
                          v-if="linecitem.type == 'blank'"
                          :label="linecitem.name"
                          :prop="linecitem.model"
                          :key="linecitem.key"
                          style="border-bottom: 1px solid black"
                        >
                          <slot :name="linecitem.model" :model="models"></slot>
                        </el-form-item>
                        <genetate-form-item
                          v-else
                          :key="linecitem.key"
                          :models.sync="models"
                          :remote="remote"
                          :rules="rules"
                          :formOptions="formOptions"
                          :widget="linecitem"
                          @input-change="onInputChange"
                          @orgSign="orgSign"
                          @editTable="editTable"
                        >
                        </genetate-form-item>
                      </template>
                    </el-col>
                  </el-row>
                </template>
                <genetate-form-item
                  v-else
                  :key="citem.key"
                  :models.sync="models"
                  :remote="remote"
                  :rules="rules"
                  :widget="citem"
                  :formOptions="formOptions"
                  @input-change="onInputChange"
                  @orgSign="orgSign"
                  @editTable="editTable"
                >
                </genetate-form-item>
              </template>
            </el-col>
          </el-row>
        </template>

        <template v-else-if="item.type == 'blank'">
          <el-form-item
            :label="item.name"
            :prop="item.model"
            :key="item.key"
            style="border-bottom: 1px solid black"
          >
            <slot :name="item.model" :model="models"></slot>
          </el-form-item>
        </template>

        <template v-else>
          <genetate-form-item
            :key="item.key"
            :models.sync="models"
            :rules="rules"
            :widget="item"
            :formOptions="formOptions"
            @input-change="onInputChange"
            @orgSign="orgSign"
            @editTable="editTable"
            :remote="remote"
          >
          </genetate-form-item>
        </template>
      </template>
    </el-form>
  </div>
</template>

<script>
import GenetateFormItem from "./GenerateFormItem";
import { loadJs } from "../util/index.js";

export default {
  name: "fm-generate-form",
  components: {
    GenetateFormItem,
  },
  props: ["data", "remote", "value", "insite", "formOptions", "isDisabled"],
  data() {
    return {
      models: {},
      rules: {},
      generateModleInfo: {},
    };
  },
  created() {
    
    this.generateModle(this.data.list);
    console.log(this.data.list);
  },
  mounted() {},
  methods: {
    orgSign() {
      this.$emit('orgSign')
    },
    editTable(data) {
      this.$emit('editTable',{
        id: data.id,
        flag: data.flag
      })
    },
    generateModle(genList) {
      for (let i = 0; i < genList.length; i++) {
        if (genList[i].type === "grid") {
          genList[i].columns.forEach((item) => {
            this.generateModle(item.list);
          });
        } else {
          if (
            this.value &&
            Object.keys(this.value).indexOf(genList[i].model) >= 0
          ) {
            this.models[genList[i].model] = this.value[genList[i].model];
          } else {
            if (genList[i].type === "blank") {
              this.$set(
                this.models,
                genList[i].model,
                genList[i].options.defaultType === "String"
                  ? ""
                  : genList[i].options.defaultType === "Object"
                  ? {}
                  : []
              );
            } else if (genList[i].type === "inline") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "proItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "auditEdItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "contrItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "quesItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "rectifyItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "riskmattersItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "suggestItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "accountabilityItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            }  else if (genList[i].type === "amountProblemsItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "notAmountProblemsItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "countItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "hanldeDeptItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "ChiefEngineerItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "BureauLeaderItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "HandleCSItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            } else if (genList[i].type === "leadershipItem") {
              genList[i].columns.forEach((item) => {
                this.generateModle(item.list);
              });
            }
            else {
              this.models[genList[i].model] = genList[i].options.defaultValue;
            }
          }

          if (this.rules[genList[i].model]) {
            this.rules[genList[i].model] = [
              ...this.rules[genList[i].model],
              ...genList[i].rules.map((item) => {
                if (item.pattern) {
                  return { ...item, pattern: new RegExp(item.pattern) };
                } else {
                  return { ...item };
                }
              }),
            ];
          } else {
            this.rules[genList[i].model] = [
              ...genList[i].rules.map((item) => {
                if (item.pattern) {
                  return { ...item, pattern: new RegExp(item.pattern) };
                } else {
                  return { ...item };
                }
              }),
            ];
          }
        }
      }
    },

    getGenerateModleInfo(genList) {
      for (let i = 0; i < genList.length; i++) {
        if (genList[i].type === "grid") {
          genList[i].columns.forEach((item) => {
            this.getGenerateModleInfo(item.list);
          });
        } else {
          if (
            this.value &&
            Object.keys(this.value).indexOf(genList[i].model) >= 0
          ) {
            this.generateModleInfo[genList[i].model] =
              this.value[genList[i].model];
          } else {
            if (genList[i].type === "blank") {
              this.$set(
                this.generateModleInfo,
                genList[i].model,
                genList[i].options.defaultType === "String"
                  ? ""
                  : genList[i].options.defaultType === "Object"
                  ? {}
                  : []
              );
            } else if (genList[i].type === "inline") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "proItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "auditEdItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "contrItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "quesItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "rectifyItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "riskmattersItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "suggestItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "accountabilityItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            }  else if (genList[i].type === "amountProblemsItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "notAmountProblemsItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "countItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "hanldeDeptItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "ChiefEngineerItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "BureauLeaderItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "HandleCSItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else if (genList[i].type === "leadershipItem") {
              genList[i].columns.forEach((item) => {
                this.getGenerateModleInfo(item.list);
              });
            } else {
              this.generateModleInfo[genList[i].model] = {
                name: genList[i].name,
                value: genList[i].options.defaultValue,
              };
            }
          }
        }
      }
    },
    getData() {
      return new Promise((resolve, reject) => {
        this.$refs.generateForm.validate((valid) => {
          if (valid) {
            this.getGenerateModleInfo(this.data.list);
            resolve(this.generateModleInfo);
          } else {
            reject(new Error(this.$t("fm.message.validError")).message);
          }
        });
      });
    },
    reset() {
      this.$refs.generateForm.resetFields();
    },
    onInputChange(value, field) {
      this.$emit("on-change", field, value, this.models);
    },
    refresh() {},
  },
  watch: {
    data: {
      deep: true,
      handler(val) {
        this.generateModle(val.list);
      },
    },
    value: {
      deep: true,
      handler(val) {
        this.models = { ...this.models, ...val };
      },
    },
  },
};
</script>

<style lang="scss">
// @import '../styles/cover.scss';
</style>
<style>
.generate .inlineCol {
  margin-bottom: 0;
}

.generate {
  margin: 0 auto;
  border: 1px solid black;
  margin-top: 1%;
}
.generate .el-form-item__label {
  /* line-height: 140px !important;
  height: 120px !important; */
  border-right: 1px solid black;
  margin-right: 10px;
  padding: 10px;
}

.generate .el-form-item {
  margin: 0px !important;
  border-bottom: 1px solid black;
  /* padding: 10px; */
}

.generate .el-form-item__content {
  margin: 10px;
  /* display: inline-block; */
  /* padding: 10px; */
}

.generate .el-form-item__label {
  border: 0px;
  margin: 0px;
  text-align: center;
}

.generate .el-form-item__content {
  padding: 10px;
  margin: 0px;
  border-left: 1px solid black;
}

.generate .formtextarea .el-form-item__label {
  border: 0px;
  margin: 0px;
}

.generate .formtextarea .el-form-item__content {
  padding: 10px;
  margin: 0px;
  border-left: 1px solid black;
  /* width: 100%; */
}

.generate .inlineCol .problem-entry .el-form-item--small .el-form-item__content {
  padding: 0px;
  margin: 0px;
  /* border-left: 1px solid black; */
}

.generate .inlineCol .problem-entry .el-form-item--small .el-form-item__content .el-input{
  padding: 10px;
  margin: 0px;
  /* border-left: 1px solid black; */
}
.generate .inlineCol .problem-entry .el-form-item--small .el-form-item__content span{
  padding: 10px;
  margin: 0px;
}

.generate .inlineCol .problem-entry .el-form-item--small .el-form-item__content .el-textarea{
  padding: 10px;
  margin: 0px;
}

.generate .inlineCol .problem-entry .el-form-item--small .el-form-item__content .el-form-item--small .el-form-item__content span 
{
  padding: 10px;
}

.generate .inlineCol .problem-entry .el-form-item--small .el-form-item__content .el-form-item--small .el-form-item__content .el-input
{
  padding: 10px;
}

.generate .inlineCol .problem-entry .el-form-item--small .el-form-item__content .el-form-item--small .el-form-item__content .el-textarea
{
  padding: 10px;
}


.generate .inlineCol .problem-entry .el-form-item__content {
  padding: 0px;
  margin: 0px;
  /* border-left: 1px solid black; */
}

/* .generate .inlineCol .el-form-item--small .el-form-item__content {
  padding: 10px;
  margin: 0px;
} */

.generate .inlineCol .el-form-item {
  border-left: 1px solid black;
}

.generate .inlineCol .el-row {
  width: 100%;
}
</style>
