      <template>
        <div class="app-container calendar-list-container">
          <div class="filter-container">
            <el-row :gutter="20">
            <el-col :span="6">
                <label class="el-form-item__label">{{$t('querylist.serviceid')}}:</label>
                <el-input style="width: 200px;" class="filter-item"
                      v-model="seachQuery.salt" :maxlength = 20>
                  </el-input>
            </el-col>
            <el-col :span="6">
                <label class="el-form-item__label">{{$t('querylist.truename')}}:</label>
                <el-input style="width: 200px;" class="filter-item"
                      v-model="seachQuery.truename" :maxlength = 20>
                  </el-input>
            </el-col>
            <el-col :span="6">
                <label class="el-form-item__label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{$t('querylist.idcard')}}:</label>
                <el-input style="width: 200px;" class="filter-item"
                      v-model="seachQuery.idcard" :maxlength = 20>
                  </el-input>
            </el-col>
            <el-col :span="6">
                <label class="el-form-item__label">{{$t('querylist.status')}}:</label> 
                <el-select class="filter-item" v-model="seachQuery.status"  style="width: 200px;">
                  <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
            </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="6">
                <label class="el-form-item__label">{{$t('querylist.np')}}:</label>
                <el-select class="filter-item" v-model="seachQuery.np"  style="width: 200px;">
                  <el-option v-for="item in provinceoptions" :key="item.code" :label="item.name" :value="item.code">
                  </el-option>
                </el-select>
            </el-col>
            <el-col :span="6">
                <label class="el-form-item__label">{{$t('querylist.cityname')}}:</label>
                  <el-select class="filter-item" v-model="seachQuery.cityname" default-first-optionplaceholder="请选择城市" style="width: 200px;">
                    <el-option v-for="item in branchesserviceOptions" :key="item.branche_code" :label="item.branche_name" :value="item.branche_code">
                    </el-option>
                  </el-select>
            </el-col>
            <el-col :span="6">
                <label class="el-form-item__label">&nbsp;&nbsp;&nbsp;&nbsp;{{$t('querylist.experience')}}:</label>
                <el-input-number v-model="seachQuery.experience" controls-position="right" :max="99"></el-input-number>
            </el-col>
            <el-col :span="6">
                <label class="el-form-item__label">{{$t('querylist.gender')}}:</label>
                  <el-select class="filter-item" v-model="seachQuery.gender"  style="width: 200px;">
                  <el-option v-for="item in genderOptions" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
            </el-col>
            </el-row>
            <el-row :gutter="20" >
              <div  align="center" > <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilterfirst">
              {{$t('table.search')}}
            </el-button>
            <el-button class="filter-item" type="primary" v-waves icon="el-icon-delete" @click="handleref">
              {{$t('table.cancel')}}
            </el-button></div>
            </el-row>
            <el-row :gutter="20">
              <div align="right">
                <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary"
                      icon="el-icon-edit">{{$t('table.add')}}
              </el-button>&nbsp;&nbsp;&nbsp;</div>    
            </el-row>
          </div>
          <el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="加载中......" border fit
                    highlight-current-row
                    style="width: 100%">
            <el-table-column type="index" align="center" :label="$t('table.seq')" width="50">
            </el-table-column>
            <el-table-column align="center" :label="$t('table.id')" width="100">
              <template slot-scope="scope">
                <span>{{scope.row.salt}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('table.truename')" width="100">
              <template slot-scope="scope">
                <span>{{scope.row.truename}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('table.age')" width="57">
              <template slot-scope="scope">
                <span>{{scope.row.age}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('table.idcard')" width="165">
              <template slot-scope="scope">
                <span>{{scope.row.idcard}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('table.cityname')" width="225">
              <template slot-scope="scope">
                <span>{{scope.row.cityname}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('table.np')" width="85">
              <template slot-scope="scope">
                <span>{{scope.row.np}}</span>
              </template>
            </el-table-column>
            <el-table-column align="center" :label="$t('table.status')" width="94">
              <template slot-scope="scope">
                <el-tag v-if="scope.row.status == '1' " type="success">{{$t('table.status1')}}</el-tag>
                <el-tag v-else-if="scope.row.status == '2' " >{{$t('table.status2')}}</el-tag>
                <el-tag v-else-if="scope.row.status == '3' " type="warning">{{$t('table.status3')}}</el-tag>
                <el-tag v-else-if="scope.row.status == '4' " type="danger">{{$t('table.status4')}}</el-tag>
                <el-tag v-else type="info">{{$t('table.status5')}}</el-tag>
              </template>
            </el-table-column> 
            <el-table-column align="center" :label="$t('table.actions')" width="422" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <a href="#" @click="hrefmmadminedit(scope.row.id)"><el-tag>{{$t('table.edit')}}</el-tag></a> 
                <a v-if="scope.row.status == '4'" href="#" @click="dangershow()" ><el-tag type="danger">{{$t('table.delete2')}}</el-tag></a> 
                <a v-else href="#" @click="updateStatusdel(scope.row.id)"><el-tag>{{$t('table.delete2')}}</el-tag></a> 
                <a v-if="scope.row.status == '4'" href="#" @click="dangershow()"><el-tag type="danger">{{$t('table.stock')}}</el-tag></a>
                <a v-else href="#" @click="hrefmmadminstock(scope.row.id)"><el-tag>{{$t('table.stock')}}</el-tag></a> 
                <a href="#" @click="hrefmmadminresume(scope.row.id)"><el-tag>{{$t('table.resume')}}</el-tag></a> 
                <a href="#" @click="hreftrain(scope.row.id)"><el-tag>{{$t('table.trains')}}</el-tag></a> 
                <a href="#" @click="hrefcertificate(scope.row.id)"><el-tag>{{$t('table.certificate')}}</el-tag></a> 
              </template>
            </el-table-column>
          </el-table>
          <div class="pagination-container">
            <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
                          :current-page="page" :page-sizes="[10,20,30,50]" :page-size="limit"
                          layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination>
          </div>
          <!--添加月嫂-->
          <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :before-close="handleClose">
            <el-form :rules="rules" ref="addForm" :model="addmminfo" label-position="left" label-width="80px"
                    style='width: 600px;margin-left:20px'>
                    <el-row :gutter="16" style="margin-bottom: 15px;">
                    <el-col :span="14">
                      <div class="grid-content bg-purple">
                        <el-form-item  :label="$t('querylist.serviceid')" prop="salt">
                          <el-input v-model="addmminfo.salt" style="width: 220px;" @blur="getsalt"></el-input>
                        </el-form-item>
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple" style="width: 300px;">
                        <el-form-item  :label="$t('querylist.truename')" prop="truename" style="width: 310px;">
                          <div class="block">
                        <el-input v-model="addmminfo.truename"> </el-input>
                          </div>
                        </el-form-item>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row :gutter="16" style="margin-bottom: 15px;">  
                    <el-col :span="14">
                      <div class="grid-content bg-purple" style="width: 300px;">
                        <el-form-item  :label="$t('querylist.mobilephone')" prop="mobile_phone">
                        <el-input v-model="addmminfo.mobile_phone"></el-input>
                        </el-form-item>
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple">
                        <el-form-item  :label="$t('querylist.idcard')" prop="idcard">
                          <el-input v-model="addmminfo.idcard" style="width: 230px;" @blur="getnp"></el-input>
                        </el-form-item>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row :gutter="16" style="margin-bottom: 15px;">
                    <el-col :span="14">
                      <div class="grid-content bg-purple" style="width: 300px;">
                        <el-form-item  :label="$t('querylist.babynumber')" prop="babynumber">
                        <el-input v-model="addmminfo.babynumber"></el-input>
                        </el-form-item>
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple">
                        <el-form-item  :label="$t('querylist.seniority')" prop="seniority">
                        <el-input v-model="addmminfo.seniority" style="width: 230px;"></el-input>
                        </el-form-item>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row :gutter="16" style="margin-bottom: 15px;">
                    <el-col :span="14">
                      <div class="grid-content bg-purple" style="width: 300px;"> 
                        <el-form-item  :label="$t('querylist.cityname')" prop="cityname">
                          <el-select class="filter-item" v-model="addmminfo.cityname" multiple default-first-optionplaceholder="请选择城市" style="width: 220px;">
                            <el-option v-for="item in branchesOptions" :key="item.branche_code" :label="item.branche_name" :value="item.branche_code">
                            </el-option>
                         </el-select>
                       </el-form-item>
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple">
                        <el-form-item  :label="$t('querylist.gender')" >
                          <el-rate v-model="addmminfo.gender" style="width: 220px;"></el-rate>
                        </el-form-item>
                      </div>
                    </el-col>
                  </el-row>
                  <!--4.14add-->
                  <el-row :gutter="16" style="margin-bottom: 15px;">
                    <el-col :span="14">
                      <div class="grid-content bg-purple" style="width: 300px;">
                        <el-form-item  :label="$t('querylist.ethnicgroup')" prop="ethnicgroup">
                         <el-select v-model="addmminfo.ethnicgroup" style="width: 220px;" >
                          <el-option v-for="item in ethnicgroupptions" :key="item.id" :disabled="true" :label="item.ethnicgroup" :value="item.id" >
                          </el-option>
                        </el-select>
                        </el-form-item>
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple">
                        <el-form-item  :label="$t('querylist.education')" prop="education">
                        <el-select v-model="addmminfo.education" style="width: 230px;" >
                          <el-option v-for="item in educationOptions" :key="item.value" :label="item.label" :value="item.value" >
                          </el-option>
                        </el-select>
                        </el-form-item>
                      </div>
                    </el-col>
                  </el-row>
                  
                  <el-row :gutter="16" style="margin-bottom: 15px;">
                    <el-col :span="14">
                      <div class="grid-content bg-purple">
                        <el-form-item  :label="$t('querylist.height')" prop="height">
                        <el-input v-model="addmminfo.height" style="width: 220px;" placeholder="请输入厘米"></el-input>
                        </el-form-item>
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple">
                        <el-form-item  :label="$t('querylist.weight')" prop="weight">
                        <el-input v-model="addmminfo.weight" style="width: 230px;" placeholder="请输入公斤"></el-input>
                        </el-form-item>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row :gutter="16" style="margin-bottom: 15px;">
                    <el-col :span="14">
                      <div class="grid-content bg-purple" style="width: 300px;">
                        <el-form-item  :label="$t('querylist.np')" prop="np">
                        <el-input v-model="addmminfo.npv" :disabled="true"></el-input>
                        <input type='hidden' v-model="addmminfo.np" />
                        <input type='hidden' v-model="addmminfo.id" />
                        </el-form-item>
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple" style="width: 300px;">
                        <el-form-item  :label="$t('querylist.marriage')" prop="marriage">
                          <el-select class="filter-item" v-model="addmminfo.marriage" style="width: 230px;">
                            <el-option v-for="item in marriageOptions" :key="item.value" :label="item.label" :value="item.value">
                            </el-option>
                         </el-select>
                       </el-form-item>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row :gutter="16" style="margin-bottom: 15px;">
                    <el-col :span="14">
                      <div class="grid-content bg-purple" style="width: 300px;">
                        <el-form-item  :label="$t('querylist.constellation')" prop="constellation">
                        <el-select v-model="addmminfo.constellation" style="width: 220px;" >
                        <el-option v-for="item in constellationoptions" :disabled="true" :key="item.id" :label="item.name" :value="item.id" >
                        </el-option>
                      </el-select>
                        </el-form-item>
                      </div>
                    </el-col>
                    <el-col :span="8">
                      <div class="grid-content bg-purple">
                        <el-form-item  :label="$t('querylist.zodiac')" prop="zodiac">
                        <el-select v-model="addmminfo.zodiac" style="width: 230px;" >
                      <el-option v-for="item in zodiacoptions" :disabled="true" :key="item.id" :label="item.name" :value="item.id" >
                      </el-option>
                    </el-select>
                        </el-form-item>
                      </div>
                    </el-col>
                  </el-row>  
                  <el-row :gutter="16" style="margin-bottom: 15px;">
                  <el-col :span="14">
                      <div class="grid-content bg-purple" style="width: 300px;">
                        <el-form-item  :label="$t('querylist.highlight')" prop="highlight">
                        <el-input v-model="addmminfo.highlight" style="width: 220px;"></el-input>
                        </el-form-item>
                      </div>
                    </el-col>
                  </el-row>
              </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button  type="primary" @click="addMMInfob">{{$t('table.confirm')}}</el-button>
              <el-button @click="resetForm('addForm')">{{$t('navbar.reset')}}</el-button>
            </div>
          </el-dialog>

          <el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
            <el-table :data="pvData" border fit highlight-current-row style="width: 100%">
              <el-table-column prop="key" label="Channel"></el-table-column>
              <el-table-column prop="pv" label="Pv"></el-table-column>
            </el-table>
            <span slot="footer" class="dialog-footer">
              <el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
            </span>
          </el-dialog>
        </div>
      </template>
      <script>
        import { fetchList, getProvince, fetchPv, updateArticle, SaltCheck, getZodiac, getConstellation, upDateStatus, getEthnicGroup, seachList, addmmInfo, createArticle, getNP, idcardCheck, getBranches } from '@/api/article'
        import waves from '@/directive/waves' // 水波纹指令
        import { parseTime } from '@/utils'
        import regex from '@/utils/regex'
        // arr to obj ,such as { CN : "China", US : "USA" }
        export default {
          name: 'couponreport',
          directives: {
            waves
          },
          data() {
            return {
              tableKey: 0,
              list: null,
              total: null,
              page: 1,
              limit: 10,
              queryType: 'list',
              listLoading: true,
              listQuery: {
                importance: undefined,
                title: undefined,
                type: undefined,
                sort: '+id'
              },
              seachQuery: {
                id: null,
                salt: null,
                truename: null,
                idcard: null,
                status: null,
                np: null,
                cityname: null,
                experience: null,
                gender: null
              },
              idcardquery: {
                idcard: null
              },
              checksalt: {
                salt: undefined
              },
              marriageOptions: [{ value: 'y', label: '已婚' }, { value: 'n', label: '未婚' }],
              educationOptions: [{ value: '1', label: '初中' }, { value: '2', label: '高中' }, { value: '3', label: '大专' }, { value: '4', label: '大本' }, { value: '5', label: '硕士' }],
              sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
              statusOptions: [{ label: '正常', value: '1' }, { label: '封存', value: '4' }],
              genderOptions: [{ label: 1, value: 1 }, { label: 2, value: 2 }, { label: 3, value: 3 }, { label: 5, value: 5 }],
              constellationoptions: [],
              branchesOptions: [],
              branchesserviceOptions: [],
              zodiacoptions: [],
              showReviewer: false,
              addmminfo: {
                truename: undefined,
                idcard: undefined,
                mobile_phone: undefined,
                seniority: undefined,
                babynumber: undefined,
                gender: 0,
                np: undefined,
                cityname: undefined,
                constellation: undefined,
                zodiac: undefined,
                ethnicgroup: undefined,
                education: undefined,
                height: undefined,
                marriage: undefined,
                highlight: undefined,
                weight: undefined,
                salt: undefined
              },
              ethnicgroupptions: '',
              provinceoptions: '',
              dialogFormVisible: false,
              checkidcard: {
                idcard: undefined
              },
              dialogStatus: '',
              textMap: {
                update: 'Edit',
                create: '添加月嫂'
              },
              dialogPvVisible: false,
              pvData: [],
              updateStatus: {
                id: undefined,
                status: undefined
              },
              rules: {
                truename: [{ required: true, min: 1, max: 20, message: '请正确录入姓名', trigger: 'blur' }],
                salt: [{ required: true, min: 1, max: 20, message: '请正确录入编号', trigger: 'blur' }],
                idcard: [{ required: true, message: '请正确身份证', trigger: 'blur' },
                  { pattern: regex.IDCARD, message: '身份证格式不正确', trigger: 'blur' }],
                mobile_phone: [{ message: '请输入手机号码', trigger: 'blur' },
                  { pattern: regex.REPHONE, message: '手机号格式错误', trigger: 'blur' }],
                seniority: [{ required: true, min: 1, max: 3, message: '请正确输入服务经验', trigger: 'blur' },
                  { pattern: regex.NUMBER, max: 2, message: '请正确输入服务经验', trigger: 'blur' }],
                babynumber: [{ required: true, min: 1, max: 5, message: '请正确录入带宝个数', trigger: 'blur' },
                  { pattern: regex.UNDER100, message: '请正确录入带宝个数', trigger: 'blur' }],
                gender: [{ required: true, min: 1, max: 5, message: '请正确录入星级', trigger: 'blur' }],
                np: [{ required: true, message: '请正确录入籍贯', trigger: 'blur' }],
                cityname: [{ required: true, message: '请正确录入服务城市', trigger: 'blur' }],
                weight: [{ required: false, min: 1, max: 3, message: '请正确录入体重', trigger: 'blur' },
                  { pattern: regex.NUMBER, max: 4, message: '体重输入错误', trigger: 'blur' }],
                height: [{ required: false, min: 1, max: 3, message: '请正确录入身高', trigger: 'blur' },
                  { pattern: regex.NUMBER, max: 4, message: '身高输入错误', trigger: 'blur' }],
                highlight: [{ max: 40, message: '请正确录入特长', trigger: 'blur' }]
              },
              downloadLoading: false
            }
          },
          created() {
            this.getList()
            getEthnicGroup().then(response3 => {
              this.ethnicgroupptions = response3.data
            })
            getProvince().then(response4 => {
              this.provinceoptions = response4.data
            })
            getConstellation().then(response3 => {
              this.constellationoptions = response3.data
            })
            getZodiac().then(response4 => {
              this.zodiacoptions = response4.data
            })
            getBranches().then(response5 => {
              this.branchesOptions = response5.data
              this.branchesserviceOptions = response5.data
            })
          },
          methods: {
            getList() {
              this.listQuery.page = this.page
              this.listQuery.limit = this.limit
              this.queryType = 'list'
              this.listLoading = true
              fetchList(this.listQuery).then(response => {
                this.list = response.data.items
                this.total = response.data.total
                this.listLoading = false
              })
            },
            handleFilter() {
              if (this.seachQuery.experience === 0) {
                this.seachQuery.experience = null
              }
              this.seachQuery.page = this.page
              this.seachQuery.limit = this.limit
              this.queryType = 'query'
              this.listLoading = true
              seachList(this.seachQuery).then(response => {
                this.list = response.data.items
                this.total = response.data.total
                this.listLoading = false
              })
            },
            handleFilterfirst() {
              if (this.seachQuery.experience === 0) {
                this.seachQuery.experience = null
              }
              this.seachQuery.page = 1
              this.seachQuery.limit = 10
              this.page = 1
              this.limit = 10
              this.queryType = 'query'
              this.listLoading = true
              seachList(this.seachQuery).then(response => {
                this.list = response.data.items
                this.total = response.data.total
                this.listLoading = false
              })
            },
            handleSizeChange(val) {
              this.limit = val
              if (this.queryType === 'list') {
                this.listQuery.limit = val
                this.listQuery.page = this.page
                this.getList()
              } else {
                this.seachQuery.limit = val
                this.seachQuery.page = this.page
                this.handleFilter()
              }
            },
            handleCurrentChange(val) {
              this.page = val
              if (this.queryType === 'list') {
                this.listQuery.limit = this.limit
                this.listQuery.page = val
                this.getList()
              } else {
                this.seachQuery.limit = this.limit
                this.seachQuery.page = val
                this.handleFilter()
              }
            },
            handleModifyStatus(row, status) {
              this.$message({
                message: '操作成功',
                type: 'success'
              })
              row.status = status
            },
            handleCreate() {
              this.addmminfo.dialogStatus = 'create'
              this.addmminfo.truename = ''
              this.addmminfo.idcard = ''
              this.addmminfo.mobile_phone = ''
              this.addmminfo.seniority = ''
              this.addmminfo.babynumber = ''
              this.addmminfo.gender = 0
              this.addmminfo.np = ''
              this.addmminfo.constellation = ''
              this.addmminfo.zodiac = ''
              this.addmminfo.ethnicgroup = ''
              this.addmminfo.education = ''
              this.addmminfo.height = ''
              this.addmminfo.marriage = ''
              this.addmminfo.highlight = ''
              this.addmminfo.weight = ''
              this.dialogFormVisible = true
              this.addmminfo.marriage = 'y'
              this.addmminfo.ethnicgroup = 1
              this.addmminfo.education = '1'
              // this.addmminfo.education = '2'
              this.addmminfo.cityname = []
              this.$nextTick(() => {
                this.$refs['addForm'].clearValidate()
              })
            },
            handleClose(done) {
              this.$confirm('确认关闭？').then(_ => {
                done()
              }).catch(_ => {})
            },
            addMMInfob() {
              this.$refs['addForm'].validate((valid) => {
                if (valid) {
                  var newcityname = ''
                  for (var value of this.addmminfo.cityname) {
                    newcityname = newcityname + value + ','
                  }
                  if (newcityname != null) {
                    this.addmminfo.cityname = newcityname.substring(0, newcityname.length - 1)
                  }
                  this.listLoading = true
                  addmmInfo(this.addmminfo).then(response => {
                    this.list = response.data.items
                    this.total = response.data.total
                    this.listLoading = false
                  })
                  this.$refs['addForm'].validate((valid) => {
                    if (valid) {
                      createArticle(this.temp).then(() => {
                        // this.list.unshift(this.temp)
                        this.dialogFormVisible = false
                        this.$notify({
                          title: '成功',
                          message: '创建成功',
                          type: 'success',
                          duration: 2000
                        })
                      })
                    }
                  })
                }
              })
            },
            getsalt() {
              if (this.addmminfo.salt != null) {
                this.checksalt.salt = this.addmminfo.salt
                SaltCheck(this.checksalt).then(response => {
                  if (response.data > 0) {
                    this.$message.error('编号重复，请确认！')
                    this.addmminfo.salt = null
                  }
                })
              }
            },
            getnp() {
              var reg = regex.IDCARD
              this.idcardquery.IDcard = this.addmminfo.idcard
              this.checkidcard.idcard = this.addmminfo.idcard
              if (reg.test(this.addmminfo.idcard)) {
                idcardCheck(this.checkidcard).then(response => {
                  if (response.data > 0) {
                    this.$message.error('身份证重复，请确认！')
                    this.addmminfo.idcard = '身份证重复，请确认！'
                  } else {
                    getNP(this.idcardquery).then(response => {
                      this.addmminfo.zodiac = Number(response.data.zodiac)
                      this.addmminfo.constellation = Number(response.data.constellation)
                      this.addmminfo.npv = response.data.province
                      this.addmminfo.np = response.data.np
                    })
                  }
                })
              } else {
                this.addmminfo.zodiac = null
                this.addmminfo.constellation = null
                this.addmminfo.np = null
              }
            },
            handleUpdate(row) {
              this.temp = Object.assign({}, row) // copy obj
              this.temp.timestamp = new Date(this.temp.timestamp)
              this.dialogStatus = 'update'
              this.dialogFormVisible = true
              this.$nextTick(() => {
                this.$refs['dataForm'].clearValidate()
              })
            },
            hreftrain(id) {
              this.$router.push({ name: 'train-form', params: { userId: id }})
            },
            hrefcertificate(id) {
              this.$router.push({ name: 'certificate-form', params: { userId: id }})
            },
            hrefmmadminstock(id) {
              this.$router.push({ name: 'mmadminstock-form', params: { userId: id }})
            },
            hrefmmadminedit(id) {
              this.$router.push({ name: 'mmadmininfo-edit', params: { userId: id }})
            },
            hrefmmadminresume(id) {
              this.$router.push({ name: 'resume-admin', params: { userId: id }})
            },
            updateData() {
              this.$refs['dataForm'].validate((valid) => {
                if (valid) {
                  const tempData = Object.assign({}, this.temp)
                  tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
                  updateArticle(tempData).then(() => {
                    for (const v of this.list) {
                      if (v.id === this.temp.id) {
                        const index = this.list.indexOf(v)
                        this.list.splice(index, 1, this.temp)
                        break
                      }
                    }
                    this.dialogFormVisible = false
                    this.$notify({
                      title: '成功',
                      message: '更新成功',
                      type: 'success',
                      duration: 2000
                    })
                  })
                }
              })
            },
            handleDelete(row) {
              this.$notify({
                title: '成功',
                message: '删除成功',
                type: 'success',
                duration: 2000
              })
              const index = this.list.indexOf(row)
              this.list.splice(index, 1)
            },
            handleFetchPv(pv) {
              fetchPv(pv).then(response => {
                this.pvData = response.data.pvData
                this.dialogPvVisible = true
              })
            },
            updateStatusdel(pv) {
              this.updateStatus.id = pv
              this.updateStatus.status = 4
              this.listLoading = true
              upDateStatus(this.updateStatus).then(response => {
                this.getList()
                this.listLoading = false
              })
              createArticle(this.temp).then(() => {
                // this.list.unshift(this.temp)
                // this.dialogFormVisible = false
                this.$notify({
                  title: '成功',
                  message: '更新成功',
                  type: 'success',
                  duration: 2000
                })
              })
            },
            dangershow() {
              this.$message({ message: '月嫂已经封存！请在编辑页面修改状态', type: 'warning' })
            },
            handleDownload() {
              this.downloadLoading = true
              import('@/vendor/Export2Excel').then(excel => {
                const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
                const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
                const data = this.formatJson(filterVal, this.list)
                excel.export_json_to_excel(tHeader, data, 'table-list')
                this.downloadLoading = false
              })
            },
            handleref() {
              this.seachQuery.id = null
              this.seachQuery.salt = null
              this.seachQuery.truename = null
              this.seachQuery.idcard = null
              this.seachQuery.status = null
              this.seachQuery.np = null
              this.seachQuery.cityname = null
              this.seachQuery.experience = null
              this.seachQuery.gender = null
              this.seachQuery.salt = null
            },
            resetForm(formName) {
              this.$refs[formName].resetFields()
            },
            formatJson(filterVal, jsonData) {
              return jsonData.map(v => filterVal.map(j => {
                if (j === 'timestamp') {
                  return parseTime(v[j])
                } else {
                  return v[j]
                }
              }))
            }
          }
        }
      </script>
      <style>
       .el-form--label-left .el-form-item__label{
        text-align:right
       }
       .el-rate{
         line-height: 0;
         margin-top:8px;
       }
      </style>
      