<template>
  <div class="home">
    <nav-bar />
    <van-form @submit="postFrom">
      <p id="radio_sf"><label>*</label>1、身份类别</p>
      <van-field name="radio_sf" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group
            v-model="radio_sf"
            class="radio_dx"
            @change="radio_sf_change(radio_sf)"
          >
            <van-cell-group>
              <van-cell>
                <van-radio name="1">现役军人</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">军队文职人员</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">军人家属</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">离退休干部</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">退役军人（含消防救援人员）</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="6">公务员</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="7">事业单位</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="8">企业</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="9">自由职业</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="10">学生</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="11">其他</van-radio>
                <van-field
                  type="text"
                  border
                  placeholder="请输入"
                  name="sf_field"
                  v-model="sf_field"
                  v-if="sf_field_show"
                ></van-field>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_kbyy"><label>*</label>2、我来医院看病是因为</p>
      <van-field name="radio_kbyy" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group
            v-model="radio_kbyy"
            class="radio_dx"
            @change="radio_kbyy_change(radio_kbyy)"
          >
            <van-cell-group>
              <van-cell>
                <van-radio name="1">离家近</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">听熟人介绍</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">报纸广告介绍</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">服务好</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">知名度高</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="6">医保定点单位</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="7">交通方便</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="8">医疗费用较低</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="9">其他</van-radio>
                <van-field
                  type="text"
                  border
                  placeholder="请输入"
                  name="kbyy_field"
                  v-model="kbyy_field"
                  v-if="kbyy_field_show"
                ></van-field>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_yyfw">
        <label>*</label>3、根据当天来院就医体验，您对本医院的服务评价
      </p>
      <van-field name="radio_yyfw" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_yyfw" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_ryfw">
        <label>*</label>4、您对挂号、住院登记处工作人员的服务
      </p>
      <van-field name="radio_ryfw" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_ryfw" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_jssp"><label>*</label>5、您对所在科室医生的技术水平</p>
      <van-field name="radio_jssp" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_jssp" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_zlgc"><label>*</label>6、您对住院的整体治疗过程</p>
      <van-field name="radio_zlgc" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_zlgc" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_ysbh"><label>*</label>7、您对住院期间的隐私保护</p>
      <van-field name="radio_ysbh" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_ysbh" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_ctfw">
        <label>*</label>8、您对医学影像科（CT、磁共振、DR）人员的服务
      </p>
      <van-field name="radio_ctfw" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_ctfw" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="6">未经历</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_bcfw">
        <label>*</label>9、您对医学影像科(B超、心电图)人员的服务
      </p>
      <van-field name="radio_bcfw" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_bcfw" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="6">未经历</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_xlwt"><label>*</label>10、您对医生耐心解决您的问题方面</p>
      <van-field name="radio_xlwt" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_xlwt" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_zlcs">
        <label>*</label>11、您对医生说明各种诊疗措施作用方面
      </p>
      <van-field name="radio_zlcs" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_zlcs" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_kfzy">
        <label>*</label>12、您对医生解释您病情、预后和康复注意事项方面
      </p>
      <van-field name="radio_kfzy" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_kfzy" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_qkjg"><label>*</label>13、您对目前的治疗情况和结果</p>
      <van-field name="radio_qkjg" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_qkjg" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_sfjs">
        <label>*</label>14、当您需要医生时，医生到的是否及时？
      </p>
      <van-field name="radio_sfjs" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_sfjs" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">及时</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">不及时</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">没来</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_hsxsyd">
        <label>*</label>15、您对护士及时巡视病房和应答您的需要
      </p>
      <van-field name="radio_hsxsyd" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_hsxsyd" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_hskfzy">
        <label>*</label>16、您对护士向您交待诊疗和康复注意事项
      </p>
      <van-field name="radio_hskfzy" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_hskfzy" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_hshlcz"><label>*</label>17、您对护士的护理和操作技术</p>
      <van-field name="radio_hshlcz" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_hshlcz" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_hsjs">
        <label>*</label>18、当您需要护士时，护士到的是否及时？
      </p>
      <van-field name="radio_hsjs" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_hsjs" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">及时</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">不及时</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">没来</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_fyqdzx">
        <label>*</label>19、您对医疗费用“一日清单”执行情况
      </p>
      <van-field name="radio_fyqdzx" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_fyqdzx" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_hjsbaq"><label>*</label>20、您对病房的环境设施和安全情况</p>
      <van-field name="radio_hjsbaq" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_hjsbaq" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_fyml">
        <label>*</label>21、您对自己所支付的医药费用是否明了?
      </p>
      <van-field name="radio_fyml" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_fyml" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">明了</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">基本明了</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">不明了</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_ylsfhl"><label>*</label>22、您认为医疗收费</p>
      <van-field name="radio_ylsfhl" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_ylsfhl" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">合理</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">可以接受</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">较贵</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不合理</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">较低</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_ewbc">
        <label>*</label>23、您这次住院看病是否给过医务人员额外的报酬？
      </p>
      <van-field name="radio_ewbc" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group
            v-model="radio_ewbc"
            class="radio_dx"
            @change="radio_ewdc_change(radio_ewbc)"
          >
            <van-cell-group>
              <van-cell>
                <van-radio name="1">是</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">否</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p v-if="hzfs_show" id="radio_hzfs">
        <label>*</label>23.1、如果是，请选择是用何种方式
      </p>
      <van-field
        name="radio_hzfs"
        :rules="formRyles.rulesRadio23"
        v-if="hzfs_show"
      >
        <template #input>
          <van-radio-group
            v-model="radio_hzfs"
            class="radio_dx"
            v-if="hzfs_show"
            @change="radio_hzfs_change(radio_hzfs)"
          >
            <van-cell-group>
              <van-cell>
                <van-radio name="1">红包</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">礼物</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">宴请</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">其他</van-radio>
                <van-field
                  type="text"
                  border
                  placeholder="请输入"
                  name="hzfs_field"
                  v-model="hzfs_field"
                  v-if="hzfs_field_show"
                ></van-field>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_szksfw"><label>*</label>24、您对本次住院所在科室的服务</p>
      <van-field name="radio_szksfw" :rules="formRyles.rulesRadio">
        <!-- <div slot="label" class="van-field_label">
                <span class="">24、您对本次住院所在科室的服务</span>
            </div> -->
        <template #input>
          <van-radio-group v-model="radio_szksfw" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_tgcs"><label>*</label>25、您对本次住院所提供的餐食</p>
      <van-field name="radio_tgcs" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_tgcs" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="6">未经历</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="radio_wsbr">
        <label>*</label>26、您对本次住院的卫生环境、被服洗消
      </p>
      <van-field name="radio_wsbr" :rules="formRyles.rulesRadio">
        <template #input>
          <van-radio-group v-model="radio_wsbr" class="radio_dx">
            <van-cell-group>
              <van-cell>
                <van-radio name="1">很满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="2">满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="3">一般</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="4">不满意</van-radio>
              </van-cell>
              <van-cell>
                <van-radio name="5">很不满意</van-radio>
              </van-cell>
            </van-cell-group>
          </van-radio-group>
        </template>
      </van-field>

      <p id="jy_field"><label>*</label>27、请您填写对我们的建议、意见和要求</p>
      <van-field
        type="text"
        placeholder="请输入"
        v-model="jy_field"
        name="jy_field"
        :rules="formRyles.rulesField"
      ></van-field>
      <p id="xm_field"><label>*</label>28、您的姓名</p>
      <van-field
        type="text"
        placeholder="请输入"
        v-model="xm_field"
        name="xm_field"
        :rules="formRyles.rulesField"
      ></van-field>
      <p id="ph_field"><label>*</label>39、您的手机号码</p>
      <van-field
        type="number"
        placeholder="请输入"
        v-model="ph_field"
        name="ph_field"
        maxlength="11"
        :rules="formRyles.mobile"
      ></van-field>
      <div style="margin: 16px;">
        <van-button
          round
          block
          type="info"
          native-type="submit"
          @click="goVanFieldControl()"
          >提交</van-button
        >
      </div>
    </van-form>
  </div>
</template>

<script>
import Vue from "vue";
import { Tab, Tabs, Toast } from "vant";
import { Form } from "vant";
import { Field } from "vant";
import { getQuestions, sendZYData } from "@/request/api.js";
import QS from "qs";

export default {
  name: "myd_zy.vue",
  data() {
    return {
      questions: [],
      radio_sf: "",
      radio_kbyy: "",
      radio_yyfw: "",
      radio_ryfw: "",
      radio_jssp: "",
      radio_zlgc: "",
      radio_ysbh: "",
      radio_ctfw: "",
      radio_bcfw: "",
      radio_xlwt: "",
      radio_zlcs: "",
      radio_kfzy: "",
      radio_qkjg: "",
      radio_sfjs: "",
      radio_hsxsyd: "",
      radio_hskfzy: "",
      radio_hshlcz: "",
      radio_hsjs: "",
      radio_fyqdzx: "",
      radio_hjsbaq: "",
      radio_fyml: "",
      radio_ylsfhl: "",
      radio_ewbc: "",
      radio_hzfs: "",
      radio_szksfw: "",
      radio_tgcs: "",
      radio_wsbr: "",

      sf_field: "",
      kbyy_field: "",
      jy_field: "",
      xm_field: "",
      ph_field: "",
      hzfs_field: "",
      radio_ch: "",

      sf_field_show: false,
      kbyy_field_show: false,
      hzfs_show: false,
      hzfs_field_show: false,

      formRyles: {
        mobile: [
          { required: true, message: "请填正确的手机号" },
          {
            pattern: /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/,
            message: "手机格式错误",
          },
        ],
        rulesRadio: [{ required: true, message: "请选择选项" }],
        rulesRadio23: [
          //23.1的校验单独设置
          { required: true, message: "请选择选项" },
        ],
        rulesField: [{ required: true, message: "请输入内容" }],
      },
    };
  },
  created() {
    let params = {
      type_id: "101",
    };

    getQuestions(params).then((res) => {
      if (res.code === 200) {
        this.questions = res.data;
        // console.log(this.questions);
        // var newData = this.questions.find(
        //   (item) => item.question_id + "" === 101001 + ""
        // );
        // var str = newData.question_content;
        // console.log(str);
        // var jsonObj =JSON.parse(str.trim());
        // console.log(jsonObj);
        // console.log(jsonObj["1"]);
      } else {
        Toast(res.message);
      }
    });
  },
  methods: {
    radio_sf_change(val) {
      if (val !== "11") {
        this.sf_field_show = false;
        this.sf_field = "";
      } else {
        this.sf_field_show = true;
      }
    },
    radio_kbyy_change(val) {
      if (val !== "9") {
        this.kbyy_field_show = false;
        this.kbyy_field = "";
      } else {
        this.kbyy_field_show = true;
      }
    },
    radio_ewdc_change(val) {
      this.hzfs_show = val === "1";
    },
    radio_hzfs_change(val) {
      if (val !== "4") {
        this.hzfs_field_show = false;
        this.hzfs_field = "";
      } else {
        this.hzfs_field_show = true;
      }
    },
    //定位未填写的必填项第一项
    goVanFieldControl() {
      //延迟获取error标签数据组，放外面会导致获取过快导致null
      setTimeout(() => {
        let isError = document.getElementsByClassName("van-field--error"); // 获取错误内容标签
        if (isError.length !== 0) {
          isError[0].scrollIntoView({
            behavior: "smooth",
            block: "start",
            inline: "start",
          }); // 只定位到第一个必填项位置
        }
      }, 500);
    },
    postFrom(value) {
      let formData = [];
      let i = 101001;
      for (var val in value) {
        var newData = this.questions.find(
          (item) => item.question_id + "" === i + ""
        );
        if (newData.question_content !== undefined&&newData.question_content !=='') {
          console.log(newData.question_content)
          var str = newData.question_content;
          console.log(str);
          var jsonObj = JSON.parse(str.trim());
        }
        if (val === "radio_sf" && value[val] === "11") {
          let data = {
            question_id: i + "",
            question_title: jsonObj["11"],
            question_answer: "11",
            question_comment: value["sf_field"],
            type_id: "101",
            question_type: "01",
            tenant_id: "1",
            deleted: "0",
            updater: localStorage.getItem("userid"),
            username: value["xm_field"],
            usertel: value["ph_field"],
          };

          formData.push(data);
          i++;
        } else if (val === "sf_field") {
          continue;
        } else if (val === "radio_kbyy" && value[val] === "9") {
          let data = {
            question_id: i + "",
            question_title: jsonObj["9"],
            question_answer: "9",
            question_comment: value["kbyy_field"],
            type_id: "101",
            question_type: "01",
            tenant_id: "1",
            deleted: "0",
            updater: localStorage.getItem("userid"),
            username: value["xm_field"],
            usertel: value["ph_field"],
          };
          formData.push(data);
          i++;
        } else if (val === "kbyy_field") {
          continue;
        } else if (val === "radio_ewbc" && value[val] === "2") {
          let data = {
            question_id: i + "",
            question_title: jsonObj["2"],
            question_answer: "2",
            type_id: "101",
            question_type: "01",
            tenant_id: "1",
            deleted: "0",
            updater: localStorage.getItem("userid"),
            username: value["xm_field"],
            usertel: value["ph_field"],
          };
          formData.push(data);
          i++;
          i++;
        } else if (val === "radio_hzfs" && value[val] === "4") {
          let data = {
            question_id: i + "",
            question_title: jsonObj["4"],
            question_answer: "4",
            question_comment: value["hzfs_field"],
            type_id: "101",
            question_type: "01",
            tenant_id: "1",
            deleted: "0",
            updater: localStorage.getItem("userid"),
            username: value["xm_field"],
            usertel: value["ph_field"],
          };
          formData.push(data);
          i++;
        } else if (val === "hzfs_field") {
          continue;
        } else if (val === "jy_field") {
          let data = {
            question_id: i + "",
            question_title: value["jy_field"],
            question_answer: value["jy_field"],
            type_id: "101",
            question_type: "03",
            tenant_id: "1",
            deleted: "0",
            updater: localStorage.getItem("userid"),
            username: value["xm_field"],
            usertel: value["ph_field"],
          };
          formData.push(data);
          i++;
        } else if (val === "ph_field") {
          continue;
        } else if (val === "xm_field") {
          continue;
        } else {
          let data = {
            question_id: i + "",
            question_title: jsonObj[value[val]],
            question_answer: value[val],
            type_id: "101",
            question_type: "01",
            tenant_id: "1",
            deleted: "0",
            updater: localStorage.getItem("userid"),
            username: value["xm_field"],
            usertel: value["ph_field"],
          };
          formData.push(data);
          i++;
        }
      }

      // console.log(formData);//连接后端接口，发送数据

      sendZYData(formData).then((res) => {
        if (res.code === 200) {
          Toast(res.message);
          this.$router.push({ path: "/Succ" });
        }
      });
    },
  },
};
</script>

<style scoped>
.radio_dx {
  margin: 0.2rem 0.2rem 0.2rem 0.2rem;
  width: 100%;
}

p {
  background-color: #e5f4fb;
  padding: 0.3rem 0.3rem 0.3rem 0.3rem;
  font-size: large;
  color: #333333;
}

p label {
  color: red;
}

.van-field_label {
  background-color: #e5f4fb;
  padding: 0rem 0.43rem;
  border: 15px solid #e5f4fb;
  font-size: large;
}

.van-cell {
  display: block;
  padding: 0.26667rem 0rem;
}

.van-cell--required::before {
  padding-top: 0.25rem;
}
</style>
