<template>
  <view>
    <view>
      <csr-tab :tabList="list" :value="active" @change="changeTab" />
    </view>
    <view>
      <uni-section padding>
        <uni-forms ref="baseForm" :modelValue="baseFormData" :rules="rules" label-width="95px" label-align="right">
          <view v-if="active==0">
            <uni-forms-item label="照片">
              <uni-file-picker limit="1" v-model="baseFormData.head" fileMediatype="image" @select="select" />
            </uni-forms-item>
            <uni-forms-item label="姓名" required name="xm">
              <uni-easyinput v-model="baseFormData.xm" placeholder="请输入姓名" />
            </uni-forms-item>
            <uni-forms-item label="性别" required name="xb">
              <uni-data-select v-model="baseFormData.xb" placeholder="请选择性别" :localdata="dicts.C0007" />
            </uni-forms-item>
            <uni-forms-item label="民族" required name="mz">
              <uni-data-select v-model="baseFormData.mz" placeholder="请选择民族" :localdata="dicts.C0009" />
            </uni-forms-item>
            <uni-forms-item label="手机号" required name="sjhm">
              <uni-easyinput v-model="baseFormData.sjhm" placeholder="请输入手机号" />
            </uni-forms-item>
            <uni-forms-item label="出生日期">
              <uni-datetime-picker type="date" v-model="baseFormData.csrq" placeholder="请选择出生日期" />
            </uni-forms-item>
            <uni-forms-item label="身高">
              <uni-easyinput type="number" v-model="baseFormData.sg" placeholder="身高单位:cm" />
            </uni-forms-item>
            <uni-forms-item label="体重">
              <uni-easyinput type="number" v-model="baseFormData.tz" placeholder="体重单位：kg" />
            </uni-forms-item>
            <uni-forms-item label="婚姻状况">
              <uni-data-select v-model="baseFormData.hyzk" placeholder="请选择婚姻状况" :localdata="dicts.C0010" />
            </uni-forms-item>
            <uni-forms-item label="能力状况">
              <uni-data-select v-model="baseFormData.nlpg" placeholder="请选择能力状况" :localdata="dicts.CZ036" />
            </uni-forms-item>
            <uni-forms-item label="居住地址">
              <uni-easyinput v-model="baseFormData.xjd" placeholder="请输入居住地址" />
            </uni-forms-item>
            <uni-forms-item label="定位">
              <view @click="openChooseLocation">
                <uni-easyinput v-model="baseFormData.zzjwd" placeholder="请选择定位" disabled />
              </view>
            </uni-forms-item>
            <uni-forms-item label="监护人">
              <uni-easyinput v-model="baseFormData.jhr" placeholder="请输入监护人姓名" />
            </uni-forms-item>
            <uni-forms-item label="监护人手机号">
              <uni-easyinput v-model="baseFormData.jhrsjhm" placeholder="请输入监护人手机号码" />
            </uni-forms-item>
            <uni-forms-item label="与老人关系">
              <uni-data-select v-model="baseFormData.jhrgx" placeholder="请选择与老人关系" :localdata="dicts.C0032" />
            </uni-forms-item>
            <uni-forms-item label="巡访责任人">
              <uni-easyinput v-model="baseFormData.xfzrr" placeholder="请输入巡访责任人姓名" />
            </uni-forms-item>
            <uni-forms-item label="巡访频次">
              <uni-data-select v-model="baseFormData.xfpc" placeholder="请选择巡访频次" :localdata="dicts.KH005" />
            </uni-forms-item>
            <uni-forms-item label="特困老人归类">
              <uni-data-checkbox multiple v-model="baseFormData.tkflData" :localdata="tkflData" />
            </uni-forms-item>
            <uni-forms-item label="兴趣爱好">
              <uni-data-checkbox multiple v-model="baseFormData.xqahData" :localdata="xqahData" />
            </uni-forms-item>
            <uni-forms-item label="兴趣爱好备注">
              <uni-easyinput v-model="baseFormData.xqahbz" placeholder="请输入兴趣爱好备注" />
            </uni-forms-item>
            <uni-forms-item label="技能特长">
              <uni-data-checkbox multiple v-model="baseFormData.jntcData" :localdata="jntcData" />
            </uni-forms-item>
            <uni-forms-item label="技能特长备注">
              <uni-easyinput v-model="baseFormData.jntcbz" placeholder="请输入技能特长备注" />
            </uni-forms-item>
            <uni-forms-item label="加入助老服务">
              <uni-data-checkbox v-model="baseFormData.jntcIszy" :localdata="dicts.CZ035" />
            </uni-forms-item>
            <view class="bottomButton">
              <button type="primary" size="mini" @click="next()">下一步</button>
            </view>
          </view>
          <view v-else-if="active==1">
            <uni-forms-item label="血糖" label-width="75px">
              <uni-data-select v-model="baseFormData.datzXt" placeholder="请选择血糖" :localdata="dicts.KH001" />
            </uni-forms-item>
            <uni-forms-item label="血压" label-width="75px">
              <uni-data-select v-model="baseFormData.datzXy" placeholder="请选择血压" :localdata="dicts.KH002" />
            </uni-forms-item>
            <uni-forms-item label="血脂" label-width="75px">
              <uni-data-select v-model="baseFormData.datzXz" placeholder="请选择血脂" :localdata="dicts.KH002" />
            </uni-forms-item>
            <uni-forms-item label="吸烟情况" label-width="75px">
              <uni-data-select v-model="baseFormData.datzXyqk" placeholder="请选择吸烟情况" :localdata="dicts.KH003" />
            </uni-forms-item>
            <uni-forms-item label="饮酒情况" label-width="75px">
              <uni-data-select v-model="baseFormData.datzYjqk" placeholder="请选择饮酒情况" :localdata="dicts.KH003" />
            </uni-forms-item>
            <view class="line-item">
              <uni-forms-item label-width="0px">
                <uni-data-checkbox mode="button" multiple v-model="baseFormData.bs" :localdata="bsData" />
              </uni-forms-item>
            </view>
            <uni-forms-item label="睡眠作息" label-width="75px">
              <uni-easyinput type="textarea" v-model="baseFormData.daShxgSmzx" placeholder="请输入睡眠作息" />
            </uni-forms-item>
            <uni-forms-item label="饮食喜好" label-width="75px">
              <uni-easyinput type="textarea" v-model="baseFormData.daShxgYsxh" placeholder="请输入饮食喜好" />
            </uni-forms-item>
            <uni-forms-item label="其他习惯" label-width="75px">
              <uni-easyinput type="textarea" v-model="baseFormData.daShxgQtxg" placeholder="请输入其他习惯" />
            </uni-forms-item>

            <view class="bottomButton">
              <button type="primary" size="mini" @click="active=0">上一步</button>
              <button type="primary" size="mini" @click="next(true)">保存</button>
            </view>
          </view>
          <view v-else-if="active==2">
            <button type="primary" size="mini" @click="editFamily"
              style="width: 100rpx;padding: 0 5px;line-height: 2;">新增</button>
            <uni-list>
              <uni-list-item :title="item.jtcyxm" :note="item.jtcylxdh"
                :rightText="transDictLabel(dicts.C0032,item.jtcygx)" v-for="(item,idx) in familyList" :key="idx"
                showArrow clickable @click="editFamily(item)" />
            </uni-list>

            <!-- 输入框示例 -->
            <uni-popup ref="inputDialog" type="dialog">
              <uni-popup-dialog ref="inputClose" mode="input" title="添加家庭成员信息" before-close="true"
                @confirm="submitFamilyForm" @close="cance">

                <uni-forms ref="familyForm" :modelValue="familyForm" :rules="familyRules" label-align="right" padding>
                  <uni-forms-item label="关系" required name="jtcygx">
                    <uni-data-select v-model="familyForm.jtcygx" placeholder="请选择与老人关系" :localdata="dicts.C0032" />
                  </uni-forms-item>
                  <uni-forms-item label="姓名" required name="jtcyxm">
                    <uni-easyinput v-model="familyForm.jtcyxm" placeholder="请输入姓名" />
                  </uni-forms-item>
                  <uni-forms-item label="性别" required name="jtcyxb">
                    <uni-data-select v-model="familyForm.jtcyxb" placeholder="请选择性别" :localdata="dicts.C0007" />
                  </uni-forms-item>
                  <uni-forms-item label="手机号" required name="jtcylxdh">
                    <uni-easyinput v-model="familyForm.jtcylxdh" placeholder="请输入手机号" />
                  </uni-forms-item>
                  <uni-forms-item label="地址" required name="jtcyjzd">
                    <uni-easyinput v-model="familyForm.jtcyjzd" placeholder="请输入居住地址" />
                  </uni-forms-item>
                </uni-forms>

              </uni-popup-dialog>
            </uni-popup>


          </view>
          <view v-else-if="active==3">
            <navigator url="/pages/lr/bhAdd">
              <button type="primary" size="mini" style="width: 100rpx;padding: 0 5px;line-height: 2;">新增</button>
            </navigator>
            <uni-table>
              <uni-tr>
                <uni-th width="80" align="center">病患类别</uni-th>
                <uni-th width="80" align="center">患病时间</uni-th>
                <uni-th width="48" align="center">设置</uni-th>
              </uni-tr>
              <uni-tr v-for="(item, index) in bhList" :key="index">
                <uni-td align="center">{{ item.bhlb }}</uni-td>
                <uni-td align="center">{{ item.bhsj }}</uni-td>
                <uni-td>
                  <view class="uni-group">
                    <button class="uni-button" size="mini" type="primary">修改</button>
                    <button class="uni-button" size="mini" type="warn">删除</button>
                  </view>
                </uni-td>
              </uni-tr>
            </uni-table>
          </view>
        </uni-forms>

      </uni-section>



    </view>

    <!-- <button type="primary" size="mini" style="margin: 30px 10px; width: 100px;" @click="change">改变状态</button> -->
  </view>
</template>

<script>
  import amapFile from "@/libs/amap-wx.130.js";
  import config from "../../config.js";
  import { UploadOne } from '@/api/upload.js';
  import { addKhjbxx, updateKhjbxx, listJtxx, addJtxx, updateJtxx, } from '@/api/lr.js'
  import { decryptRowData_ECB } from '@/common/sm4.js'
  import { decimalToBinary } from '@/common/num.js'

  export default {
    data() {
      return {
        dicts: {
          C0007: [],
          C0009: [],
          C0010: [],
          CZ036: [],
          C0032: [],
          CZ035: [],
          KH001: [],
          KH002: [],
          KH003: [],
          KH004: [],
          KH005: [],
        },

        active: 0,
        activeName: '基本信息',
        list: ['基本信息', '健康档案', '家庭信息', '病史记录'],
        rules: {
          xm: {
            rules: [{
              required: true,
              errorMessage: '姓名不能为空'
						}]
          },
          xb: {
            rules: [{
              required: true,
              errorMessage: '请选择性别'
						}]
          },
          mz: {
            rules: [{
              required: true,
              errorMessage: '请选择民族'
						}]
          },
          sjhm: {
            rules: [{
                required: true,
                errorMessage: '请输入手机号'
							},
              {
                format: 'number',
                errorMessage: '请输入正确的手机号',
							},
              {
                pattern: '^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\\d{8})$',
                errorMessage: '请输入正确的手机号',
							}
						]
          },
          jhrsjhm: {
            rules: [{
                format: 'number',
                errorMessage: '请输入正确的手机号',
							},
              {
                pattern: '^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\\d{8})$',
                errorMessage: '请输入正确的手机号',
							}
						]
          }
        },
        baseData: {},
        baseFormData: {
          xm: '',
          xb: '',
          mz: '',
          sjhm: '',
          lng: '',
          lat: '',
          dw: '',
          jntcIszy: '0',
          xqahData: [],
          xqah: [],
          jntcData: [],
          jntc: [],
          tkflData: [],
          tkfl: [],
          bs: [],
          "tx": null,
          "csrq": null,
          "sg": null,
          "tz": null,
          "hyzk": null,
          "nlpg": null,
          "xjd": null,
          "jhr": null,
          "jhrsjhm": null,
          "jhrgx": null,
          "xfzrr": null,
          "xfpc": null,
          "xqahbz": null,
          "jntcbz": null,
          "datzXt": "0",
          "datzXy": "0",
          "datzXz": "0",
          "datzXyqk": "0",
          "datzYjqk": "0",
          "daIsSjxtbs": "0",
          "daIsHxxtbs": "0",
          "daIsXhxtbs": "0",
          "daIsXhxtbsb": "0",
          "daIsMnxtbs": "0",
          "daIsYdxtbs": "0",
          "daIsSzxtbs": "0",
          "daIsNfmxtbs": "0",
          "daIsZlbs": "0",
          "daIsXnxgbs": "0",
          "daIsTnbs": "0",
          "daIsTfbs": "0",
          "daShxgSmzx": null,
          "daShxgYsxh": null,
          "daShxgQtxg": null,
          "zzjwd": "",
          "zjlx": "01",
          "zjhm": "420101197305263488",
          "gj": "156",
          "hjlb": "03",
          "xzqhId": "220000000000"
        },
        tkflData: [{
            value: "0",
            text: "独居老人"
					},
          {
            value: "1",
            text: "分散供养特困老人"
					},
          {
            value: "2",
            text: "高龄老人"
					},
          {
            value: "3",
            text: "计划生育特殊家庭老人"
					},
          {
            value: "4",
            text: "空巢老人"
					},
          {
            value: "5",
            text: "农村留守老人"
					},
          {
            value: "6",
            text: "失能老人"
					},
          {
            value: "7",
            text: "重残老人"
					}
				],
        xqahData: [{
            value: "0",
            text: "棋牌"
					},
          {
            value: "1",
            text: "户外活动"
					},
          {
            value: "2",
            text: "旅游出行"
					},
          {
            value: "3",
            text: "书法"
					},
          {
            value: "4",
            text: "唱歌"
					},
          {
            value: "5",
            text: "跳舞"
					},
          {
            value: "6",
            text: "花艺"
					},
          {
            value: "7",
            text: "女工"
					},
          {
            value: "8",
            text: "其他"
					}
				],
        jntcData: [{
            value: "0",
            text: "水电暖"
					},
          {
            value: "1",
            text: "家电维修"
					},
          {
            value: "2",
            text: "医护"
					},
          {
            value: "3",
            text: "教辅"
					},
          {
            value: "4",
            text: "文体"
					},
          {
            value: "5",
            text: "其他"
					}
				],
        lrxqData: [{
            value: "zc",
            text: "助餐"
					},
          {
            value: "zg",
            text: "助购"
					},
          {
            value: "zx",
            text: "助行"
					},
          {
            value: "zz",
            text: "助浴"
					},
          {
            value: "zj",
            text: "助洁"
					},
          {
            value: "zl",
            text: "助乐"
					},
          {
            value: "zy",
            text: "助医"
					},
          {
            value: "zi",
            text: "助急"
					},
          {
            value: "djfy",
            text: "代缴费用"
					},
          {
            value: "zyly",
            text: "住养老院"
					},
          {
            value: "kfxl",
            text: "康复训练"
					},
          {
            value: "qtxq",
            text: "其他"
					}
				],
        bsData: [{
            value: "0",
            text: "神经系统病史"
					},
          {
            value: "1",
            text: "呼吸系统病史"
					},
          {
            value: "2",
            text: "消化系统病史"
					},
          {
            value: "3",
            text: "循环系统病史"
					},
          {
            value: "4",
            text: "泌尿系统病史"
					},
          {
            value: "5",
            text: "运动系统病史"
					},
          {
            value: "6",
            text: "生殖系统病史"
					},
          {
            value: "7",
            text: "内分泌系统病史"
					},
          {
            value: "8",
            text: "肿瘤病史"
					},
          {
            value: "9",
            text: "心脑血管病史"
					},
          {
            value: "10",
            text: "糖尿病史"
					},
          {
            value: "11",
            text: "痛风病史"
					}
				],

        bhList: [],
        myAmapFunT: '',
        startPoint: {
          latitude: 43.834931,
          longitude: 125.289036
        },

        // 家庭信息列表请求参数
        familyParams: {
          pageNum: 1,
          pageSize: 10,
          khId: null,
        },
        familyList: [],
        familyForm: {
          jtcygx: null,
          jtcyxm: null,
          jtcyxb: null,
          jtcylxdh: null,
          jtcyjzd: null,
        },
        familyRules: {
          jtcygx: {
            rules: [{
              required: true,
              errorMessage: '请选择与老年人关系'
        		}]
          },
          jtcyxb: {
            rules: [{
              required: true,
              errorMessage: '请选择性别'
        		}]
          },
          jtcyxm: {
            rules: [{
              required: true,
              errorMessage: '请输入姓名'
        		}]
          },
          jtcyjzd: {
            rules: [{
              required: true,
              errorMessage: '请输入地址'
        		}]
          },
          jtcylxdh: {
            rules: [{
                required: true,
                errorMessage: '请输入手机号'
        			},
              {
                format: 'number',
                errorMessage: '请输入正确的手机号',
        			},
              {
                pattern: '^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\\d{8})$',
                errorMessage: '请输入正确的手机号',
        			}
        		]
          },
        },
      }

    },
    created() {
      this.getDictList(Object.keys(this.dicts), this.dicts)
    },
    onLoad(option) {
      if (Object.keys(option).length !== 0) {
        this.baseFormData = JSON.parse(option.item)
        if (this.baseFormData.xm) {
          this.familyParams.khId = this.baseFormData.id
          this.getFamilyList()
          uni.setNavigationBarTitle({
            title: '修改客户信息'
          });
          this.bsFormatTo()
        }
      }
      this.myAmapFunT = new amapFile.AMapWX({
        key: config.gaodeKey
      })
    },
    methods: {
      // 获取上传状态
      async select(e) {
        let ossfilePath = await UploadOne(e.tempFilePaths[0], {})
        this.baseFormData.tx = ossfilePath.data.url
      },
      addbhxx() {

      },
      getFamilyList() {
        listJtxx(this.familyParams).then(res => {
          if (res.code !== 200) return
          this.familyList = decryptRowData_ECB(res.rows, ['jtcyxm', 'jtcyzjhm', 'jtcylxdh', 'jtcyjzd'], [1, 2, 3,
            4])
        })
      },
      editFamily(data = {}) {
        if (data) {
          this.familyForm = data
        }
        this.$refs.inputDialog.open()
      },
      submitFamilyForm(val) {
        this.$refs['familyForm'].validate().then(() => {
          const submitForm = {
            ...this.familyForm,
            khId: this.familyParams.khId,
            // 接口补充数据，不添加无法提交
            jtcyzjhm: "420101196302161908",
            jtcyzjlx: "01"
          };
          if (this.familyForm.id) {
            updateJtxx(submitForm).then(res => {
              if (res.code !== 200) return
              // 关闭窗口后，恢复默认内容
              uni.showToast({
                title: `修改成功！`,
                duration: 2000,
                success: (res) => {
                  this.$refs.inputDialog.close()
                }
              })
            })
          } else {
            addJtxx(submitForm).then(res => {
              if (res.code !== 200) return
              // 关闭窗口后，恢复默认内容
              uni.showToast({
                title: `新增成功！`,
                duration: 2000,
                success: (res) => {
                  this.getFamilyList()
                  this.$refs.inputDialog.close()
                }
              })

            })
          }

        }).catch(err => {
          console.log('err', err);
        })
      },
      // 弹出取消
      cance() {
        this.$refs.familyForm.clearValidate()
        this.$refs.inputDialog.close()
      },
      // tab切换
      changeTab(e) {
        this.active = this.list.indexOf(e.tab)
        this.activeName = e.tab
      },
      next(isSave) {
        this.$refs['baseForm'].validate().then(res => {
          if (isSave) {
            this.bsFormatFrom()
            if (this.baseFormData.id) {
              // 修改
              updateKhjbxx(this.baseFormData).then(r => {
                if (r.code !== 200) return
                uni.showToast({
                  title: `修改成功！`,
                  duration: 2000,
                  success: function(res) {
                    setTimeout(function() {
                      uni.switchTab({
                        url: '/pages/index/index'
                      });
                    }, 2000)
                  }
                })
              })
            } else {
              // 新增
              addKhjbxx(this.baseFormData).then(r => {
                if (r.code !== 200) return
                uni.showToast({
                  title: `新增成功！`,
                  duration: 2000,
                  success: function(res) {
                    setTimeout(function() {
                      uni.switchTab({
                        url: '/pages/index/index'
                      });
                    }, 2000)
                  }
                })
              })
            }

          } else {
            this.active = 1
          }
        }).catch(err => {
          console.log("err", err)
          uni.showModal({
            title: '错误提示',
            content: err[0].errorMessage,
            showCancel: false,
            success: function(res) {
              if (res.confirm) {
                console.log('用户点击确定');
              } else if (res.cancel) {
                console.log('用户点击取消');
              }
            }
          });

        })
      },


      // 地图弹出
      async openChooseLocation(opt) {
        let that = this
        await uni.chooseLocation({
          latitude: opt?.latitude || that.startPoint.latitude,
          longitude: opt?.longitude || that.startPoint.longitude,
          success: function(res) {
            // console.log(res)
            that.baseFormData.dw = res.name
            that.baseFormData.lng = res.longitude
            that.baseFormData.lat = res.latitude
            that.baseFormData.zzjwd = res.longitude + ',' + res.latitude

            if (!res.name) {
              return uni.showToast({
                title: '请重新选择位置',
                icon: 'none'
              });
            }

          },
          fail: function(info) { //失败回调
            console.log('调取失败')
            console.log(info)
          },

        })
      },
      // 指定位置替换
      replaceStringByIndex(str, oldChar, newChar, index) {
        return str.substring(0, index) + newChar + str.substring(index + 1);
      },
      // 数组转10进制
      formatInt10(value, like) {
        let len = like.length
        if (value.length == 0) {
          this.baseFormData.xqah = like
        } else {
          value.forEach(e => {

            like = this.replaceStringByIndex(like, '0', '1', e)
            if (like.length != len) {
              for (let i = 0; i < len - like.length; i++) {
                like += '0'
              }
            }
          })
        }
        return parseInt(like.toString().split('').reverse().join(''), 2)
      },
      // 数组转2进制
      formatInt2(value) {
        let xqaix = decimalToBinary(value).split('')
        let result = []
        if (xqaix != 0) {
          xqaix.forEach((e, i) => {
            if (e == 1) {
              result.push(i.toString())
            }
          })
        }
        return result
      },

      bsFormatFrom() {
        this.baseFormData.tkfl = this.formatInt10(this.baseFormData.tkflData, '00000000')
        this.baseFormData.xqah = this.formatInt10(this.baseFormData.xqahData, '000000000')
        this.baseFormData.jntc = this.formatInt10(this.baseFormData.jntcData, '000000')
        if (this.baseFormData.csrq) {
          this.baseFormData.csrq = this.baseFormData.csrq.replaceAll('-', '')
        }

        if (this.baseFormData.bs.length > 0) {
          this.baseFormData.bs.forEach(e => {
            if (e == '0') {
              this.baseFormData.daIsSjxtbs = '1'
            } else if (e == '1') {
              this.baseFormData.daIsHxxtbs = '1'
            } else if (e == '2') {
              this.baseFormData.daIsXhxtbs = '1'
            } else if (e == '3') {
              this.baseFormData.daIsXhxtbsb = '1'
            } else if (e == '4') {
              this.baseFormData.daIsMnxtbs = '1'
            } else if (e == '5') {
              this.baseFormData.daIsYdxtbs = '1'
            } else if (e == '6') {
              this.baseFormData.daIsSzxtbs = '1'
            } else if (e == '7') {
              this.baseFormData.daIsNfmxtbs = '1'
            } else if (e == '8') {
              this.baseFormData.daIsZlbs = '1'
            } else if (e == '9') {
              this.baseFormData.daIsXnxgbs = '1'
            } else if (e == '10') {
              this.baseFormData.daIsTnbs = '1'
            } else if (e == '11') {
              this.baseFormData.daIsTfbs = '1'
            }
          })
        }
      },
      bsFormatTo() {
        if (this.baseFormData.xqah) {
          this.baseFormData.xqahData = this.formatInt2(this.baseFormData.xqah)
        }
        if (this.baseFormData.jntc) {
          this.baseFormData.jntcData = this.formatInt2(this.baseFormData.jntc)
        }
        if (this.baseFormData.tkfl) {
          this.baseFormData.tkflData = this.formatInt2(this.baseFormData.tkfl)
        }
        if (this.baseFormData.csrq) {
          let riqi = this.baseFormData.csrq
          let riqi1 = riqi.slice(0, 4) + '-' + riqi.slice(4)
          this.baseFormData.csrq = riqi1.slice(0, 7) + '-' + riqi1.slice(7)
        }
        if (this.baseFormData.tx) {
          this.baseFormData.head = [{
            url: this.baseFormData.tx
					}]
        }

        this.baseFormData.bs = []
        if (this.baseFormData.daIsSjxtbs == '1') {
          this.baseFormData.bs.push('0')
        }
        if (this.baseFormData.daIsHxxtbs == '1') {
          this.baseFormData.bs.push('1')
        }
        if (this.baseFormData.daIsXhxtbs == '1') {
          this.baseFormData.bs.push('2')
        }
        if (this.baseFormData.daIsXhxtbsb == '1') {
          this.baseFormData.bs.push('3')
        }
        if (this.baseFormData.daIsMnxtbs == '1') {
          this.baseFormData.bs.push('4')
        }
        if (this.baseFormData.daIsYdxtbs == '1') {
          this.baseFormData.bs.push('5')
        }
        if (this.baseFormData.daIsSzxtbs == '1') {
          this.baseFormData.bs.push('6')
        }
        if (this.baseFormData.daIsNfmxtbs == '1') {
          this.baseFormData.bs.push('7')
        }
        if (this.baseFormData.daIsZlbs == '1') {
          this.baseFormData.bs.push('8')
        }
        if (this.baseFormData.daIsXnxgbs == '1') {
          this.baseFormData.bs.push('9')
        }
        if (this.baseFormData.daIsTnbs == '1') {
          this.baseFormData.bs.push('10')
        }
        if (this.baseFormData.daIsTfbs == '1') {
          this.baseFormData.bs.push('11')
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
  .line {
    border-bottom: 10px solid #f0f0f0;
    height: 1px;
    margin-top: 10px;
  }

  .bottomButton {
    height: 140rpx;
    width: 60%;
    margin: 0 auto;
    text-align: center;

    button {
      width: 40%;
    }

    button+button {
      margin-left: 15px;
    }
  }


  .line-item {
    /deep/ .checklist-group {
      justify-content: space-around;

      .checklist-box.is--button {
        width: 36%;
        margin-right: 0;
      }
    }
  }

  /deep/ .uni-section .uni-section-header {
    padding: 0;
  }
</style>