<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="姓名" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="信用等级" prop="creditLevel">
        <el-select v-model="queryParams.creditLevel" placeholder="请选择信用等级" clearable>
          <el-option
            v-for="dict in dict.type.credit_level"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="性别" prop="gender">
        <el-select v-model="queryParams.gender" placeholder="请选择性别" clearable>
          <el-option
            v-for="dict in dict.type.sys_user_sex"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="年龄" prop="age">
        <el-input
          v-model="queryParams.age"
          placeholder="请输入年龄"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证号" prop="idCard">
        <el-input
          v-model="queryParams.idCard"
          placeholder="请输入身份证号码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="联系号码" prop="phoneNum">
        <el-input
          v-model="queryParams.phoneNum"
          placeholder="请输入联系号码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:creditUser:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:creditUser:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:creditUser:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          v-hasPermi="['system:user:import']"
        >导入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:creditUser:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="creditUserList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <!-- <el-table-column label="${comment}" align="center" prop="id" /> -->
      <el-table-column label="姓名" align="center" prop="userName" />
      <el-table-column label="信用分数" align="center" prop="creditScore" />
      <el-table-column label="信用等级" align="center" prop="creditLevel">
        <template slot-scope="scope">
          <!-- <dict-tag :options="dict.type.credit_level" :value="scope.row.creditLevel"/> -->
          <span>{{scope.row.creditLevel}}</span>
        </template>
      </el-table-column>
      <el-table-column label="性别" align="center" prop="gender">
        <template slot-scope="scope">
          <!-- <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.gender"/> -->
          <span>{{scope.row.gender}}</span>
        </template>
      </el-table-column>
      <el-table-column label="年龄" align="center" prop="age" />
      <el-table-column label="身份证号码" align="center" prop="idCard" width="165"/>
      <el-table-column label="联系号码" align="center" prop="phoneNum" width="120" />
      <el-table-column label="户籍地址" align="center" prop="nowIn" width="170"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:creditUser:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:creditUser:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改信用人员对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
        <el-row>
          <el-col :span="12">
           <el-form-item label="身份证号" prop="idCard">
             <el-input v-model="form.idCard" placeholder="请输入身份证号码" />
           </el-form-item>
          </el-col>
          <el-col :span="12">
           <el-form-item label="姓名" prop="userName">
             <el-input v-model="form.userName" placeholder="请输入姓名" />
           </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="性别" prop="gender">
                    <el-select style="width: 100%;" v-model="form.gender" placeholder="请选择性别">
                      <el-option
                        v-for="dict in dict.type.sys_user_sex"
                        :key="dict.value"
                        :label="dict.label"
          :value="dict.value"
                      ></el-option>
                    </el-select>
                  </el-form-item>
          </el-col>
          <el-col :span="12">
           <el-form-item label="年龄" prop="age">
             <el-input v-model="form.age" type="number" placeholder="请输入年龄" />
           </el-form-item>
          </el-col>
          <el-col :span="12">
             <el-form-item label="联系号码" prop="phoneNum">
               <el-input v-model="form.phoneNum" placeholder="请输入联系号码" />
             </el-form-item>
          </el-col>
          <el-col :span="12">
           <el-form-item label="信用分数" prop="creditScore">
             <el-input v-model="form.creditScore" type="number" placeholder="请输入信用分数" />
           </el-form-item>
          </el-col>
          <el-col :span="24">
             <el-row>
               <el-col :span="12" style="position: relative;">
                  <span style="position: absolute;top:5px; color: red;left:14px;">*</span>
                <el-form-item label="户籍地址" prop="provinceId" style="margin-bottom: 5px;">
                  <!-- <el-input v-model="form.provinceId" placeholder="请输入户籍地的省份" /> -->
                <el-cascader
                	:placeholder="nhdyesfgh"
                	:options="optionsListkl"
                	:filterable="true"
                	separator="/"
                	@change="chahetwo"
                	:props="optionPropsss"
                 style="width: 100%;"
                	ref="myCascader"
                  v-model="lser"
                   :class="[nhdyesfgh == '点击选择户籍地址' ? '' : 'placf']"
                  @active-item-change="handleItemChangefrkl"
                ></el-cascader>
                                <p style="line-height: 20px; font-size: 12px;color: red;">点击小圆圈一级一级选择</p>

                </el-form-item>

               </el-col>
               <el-col :span="12">
                  <el-form-item label="详细地址" prop="nowIn">
                    <el-input v-model="form.nowIn" placeholder="请输入详细地址" />
                  </el-form-item>
               </el-col>
             </el-row>
          </el-col>

          <el-col :span="12">
           <el-form-item label="信用等级" prop="creditLevel">
                     <el-select style="width: 100%;" v-model="form.creditLevel" placeholder="请选择信用等级">
                       <el-option
                         v-for="dict in dict.type.credit_level"
                         :key="dict.value"
                         :label="dict.label"
           :value="dict.value"
                       ></el-option>
                     </el-select>
                   </el-form-item>
          </el-col>


          <!-- <el-col :span="12">
               <el-form-item label="户籍地的省份" prop="province">
                 <el-input v-model="form.province" placeholder="请输入户籍地的省份" />
               </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
              <el-form-item label="户籍地的城市" prop="cityId">
                <el-input v-model="form.cityId" placeholder="请输入户籍地的城市" />
              </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
            <el-form-item label="户籍地的城市" prop="city">
              <el-input v-model="form.city" placeholder="请输入户籍地的城市" />
            </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
            <el-form-item label="户籍地的区" prop="regionId">
              <el-input v-model="form.regionId" placeholder="请输入户籍地的区" />
            </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
            <el-form-item label="户籍地的区" prop="region">
              <el-input v-model="form.region" placeholder="请输入户籍地的区" />
            </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
            <el-form-item label="户籍地的镇" prop="villageTownsId">
              <el-input v-model="form.villageTownsId" placeholder="请输入户籍地的镇" />
            </el-form-item>
          </el-col> -->
         <!-- <el-col :span="12">
           <el-form-item label="户籍地的镇" prop="villageTowns">
             <el-input v-model="form.villageTowns" placeholder="请输入户籍地的镇" />
           </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
           <el-form-item label="户籍地的村" prop="villageId">
             <el-input v-model="form.villageId" placeholder="请输入户籍地的村" />
           </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
            <el-form-item label="户籍地的村" prop="village">
              <el-input v-model="form.village" placeholder="请输入户籍地的村" />
            </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
           <el-form-item label="户籍地的组" prop="villagerGroupId">
             <el-input v-model="form.villagerGroupId" placeholder="请输入户籍地的组" />
           </el-form-item>
          </el-col> -->
          <!-- <el-col :span="12">
           <el-form-item label="户籍地的组" prop="villagerGroup">
             <el-input v-model="form.villagerGroup" placeholder="请输入户籍地的组" />
           </el-form-item>
          </el-col> -->



        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <!-- <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
          </div> -->
          <span>仅允许导入xls、xlsx格式文件。</span>
          <a href="http://118.31.23.65:5007/template/信用人员信息模板.xlsx" download  style="font-size:12px;vertical-align: baseline; color: red;" >下载模板</a>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listCreditUser, getCreditUser, delCreditUser, addCreditUser, updateCreditUser,listtrees } from "@/api/settlement/creditUser";
import { getToken } from "@/utils/auth";
export default {
  name: "CreditUser",
  dicts: ['credit_level', 'sys_user_sex'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 信用人员表格数据
      creditUserList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/system/creditUser/importCredit"
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: null,
        creditLevel: null,
        gender: null,
        age: null,
        idCard: null,
        phoneNum: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
         idCard: [
                  { required: true, message: '请输入身份证号', trigger: 'blur' }
                ],
        phoneNum: [
                 { required: true, message: '请输入手机号码', trigger: 'blur' },
                 { pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, message: '格式不正确' }
               ],
        userName: [
                 { required: true, message: '请输入姓名', trigger: 'blur' }
               ],
        gender: [
                 { required: true, message: '请输入性别', trigger: 'blur' }
               ],
        age: [
                 { required: true, message: '请输入年龄', trigger: 'blur' }
               ],
        creditScore: [
                 { required: true, message: '请输入信用分数', trigger: 'blur' }
               ],
        creditLevel: [
                 { required: true, message: '请输入信用等级', trigger: 'blur' }
               ],

      },
      nhdyesfgh:'点击选择户籍地址',
      optionsListkl:[],
      optionPropsss: {
            	value: 'areaId',
            	label: 'name',
            	checkStrictly: true,
            },
      lser:[],
      nameutaiL:0,
    };
  },
  created() {
    this.getList();
    this.getTreew(0)
  },
  methods: {
    /** 查询信用人员列表 */
    getList() {
      this.loading = true;
      listCreditUser(this.queryParams).then(response => {
        this.creditUserList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    getTreew(index){
      this.loading = true;
      let pids = {}
      pids.pid = index
      console.log(345)
      listtrees(pids).then(response => {
        // this.cascaderKey = this.cascaderKey + 1
        console.log(34)
        if(response.data.length == 0){
          return
        }
        // if(val !== undefined){
        //   this.nameutaiL = val
        // }
        this.optionsListkl =  this.handleData(response.data);
        console.log(this.optionsListkl)
      	this.loading = false;
      });
    },
    handleData(data, val, level) {
       console.log(data,val,level,7536)
       for (let i = 0; i < data.length; i++) {
         if(!data[i].children) {
           this.$set(data[i], 'children', []);
         }
         if(data[i].areaId === val){
           let vfer = {}
           vfer.pid = val
           listtrees(vfer).then(res => {
             // this.cascaderKey = this.cascaderKey + 1
             if(res.data.length) {
               console.log(data[i].children,4567)
               // data[i].children = res.data;
               this.$set(data[i], 'children', res.data)
               console.log(data[i].children,45678)
                // this.nhdyesku = true
               data[i].children.forEach(ele => {
                 this.$set(ele, 'children', [])
               });
             }else {
               data[i].children = undefined;
             }
           }).catch(err => {
           });
         }else {
           if(data[i].children.length){
             this.handleData(data[i].children,val,level)
           }
         }
       }

        return data;
    },
    chahetwo(data) {
    	let nhdye = []
    	nhdye = this.$refs['myCascader'].getCheckedNodes()[0].pathLabels
    	console.log(nhdye)
    	 if(data.length == 1){
    	   this.form.provinceId = data[ data.length - 1];
    	   this.form.province = nhdye[ data.length - 1];
    	   this.$set(this.form, 'city', null)
    	   this.$set(this.form, 'cityId', null)
    	   this.$set(this.form, 'region', null)
    	   this.$set(this.form, 'regionId', null)
    	   this.$set(this.form, 'villageTowns', null)
    	   this.$set(this.form, 'villageTownsId', null)
    	   this.$set(this.form, 'villageId', null)
    	    this.$set(this.form, 'village', null)
    	 }else if(data.length == 2){
    	   this.form.cityId = data[ data.length - 1];
    	   this.form.city = nhdye[ data.length - 1];
    	   this.$set(this.form, 'region', null)
    	   this.$set(this.form, 'regionId', null)
    	   this.$set(this.form, 'villageTowns', null)
    	   this.$set(this.form, 'villageTownsId', null)
    	   this.$set(this.form, 'villageId', null)
    	    this.$set(this.form, 'village', null)
    	 }else if(data.length == 3){
    	   this.form.regionId = data[ data.length - 1];
    	   this.form.region = nhdye[ data.length - 1];
    	   this.$set(this.form, 'villageTowns', null)
    	   this.$set(this.form, 'villageTownsId', null)
    	   this.$set(this.form, 'villageId', null)
    	    this.$set(this.form, 'village', null)
    	 }else if(data.length == 4){
    	   this.form.villageTownsId = data[ data.length - 1];
    	   this.form.villageTowns = nhdye[ data.length - 1];
    	   this.$set(this.form, 'villageId', null)
    	    this.$set(this.form, 'village', null)
    	 }else if(data.length == 5){
    	   this.form.villageId = data[ data.length - 1];
    	   this.form.village = nhdye[ data.length - 1];
    	 }else{
    	   // this.nhdyesfgh = '点击选择户籍地址'
    	 }
    },
    handleItemChangefrkl(val) {
      console.log(val,235)
       let code = val ? val[val.length - 1] : '';  //需请求数据的上级地址的code值
       let level = val.length + 1;  //需请求第几级地址
       this.optionsListkl = this.handleData(this.optionsListkl, code, level);
    	},
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },

    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "用户导入";
      this.upload.open = true;
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('system/user/importTemplate', {
      }, `user_template_${new Date().getTime()}.xlsx`)
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        userName: null,
        creditScore: null,
        creditLevel: null,
        gender: null,
        age: null,
        idCard: null,
        phoneNum: null,
        provinceId: null,
        province: null,
        cityId: null,
        city: null,
        regionId: null,
        region: null,
        villageTownsId: null,
        villageTowns: null,
        villageId: null,
        village: null,
        villagerGroupId: null,
        villagerGroup: null,
        nowIn: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isDel: null,
        deleteReason: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.lser = []
      this.title = "添加信用人员";
      this.nhdyesfgh = '点击选择户籍地址'
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getCreditUser(id).then(response => {
        this.lser = []
        this.form = response.data;
        if(response.data.province !== null && response.data.province !== ""){
        				this.nhdyesfgh = response.data.province;
                if(response.data.city !== null && response.data.city !== ""){
                  this.nhdyesfgh = response.data.province + '/' + response.data.city;
                  if(response.data.region !== null && response.data.region !== ""){
                  	this.nhdyesfgh = response.data.province + '/' + response.data.city + '/' + response.data.region;
                    if(this.form.villageTowns !==null && this.form.villageTowns !=='' && this.form.villageTowns !== undefined){
                      this.nhdyesfgh = response.data.province + '/' + response.data.city + '/' + response.data.region + '/' + this.form.villageTowns;
                      if(this.form.village !==null && this.form.village !=='' && this.form.village !== undefined){
                        this.nhdyesfgh = response.data.province + '/' + response.data.city + '/' + response.data.region + '/' + this.form.villageTowns + '/' + this.form.village;
                      }
                    }
                  }else{
                  	// this.nhdyesfgh ='点击选择居住地址'
                  }
                }else{
                	// this.nhdyesfgh ='点击选择居住地址'
                }
        			}else{
        				this.nhdyesfgh ='点击选择户籍地址'
        			}
        this.nhyesfx = true
        this.open = true;
        this.title = "修改信用人员";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          let reg = /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
          let _IDre15 =  /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/;
          // 护照
           // let ncjsle = /^1[45][0-9]{7}$|(^[P|p|S|s]\d{7}$)|(^[S|s|G|g|E|e]\d{8}$)|(^[Gg|Tt|Ss|Ll|Qq|Dd|Aa|Ff]\d{8}$)|(^[H|h|M|m]\d{8,10}$)/;
           let ncjsle = /^[a-zA-Z0-9]{5,17}$/
           let nhyeli = /^[a-zA-Z]{5,17}$/
          // 港澳
          let gnse = /^([A-Z]\d{6,10}(\(\w{1}\))?)$/;
          // 台湾
          // let tw = /^\d{8}|^[a-zA-Z0-9]{10}|^\d{18}$/
          var tw =  /^[0-9]{8}$/;
           var twe = /^[0-9]{10}$/;
          // 校验身份证：
          console.log(reg.test(this.form.idCard),23741)
          if ( reg.test(this.form.idCard)|| _IDre15.test(this.form.idCard)) {
          	// this.idea();
          	// this.go(this.form.idCard.length);
          	// callback()
          } else {
            if(ncjsle.test(this.form.idCard) || nhyeli.test(this.form.idCard)){
               console.log(3)
            }else{
              if(gnse.test(this.form.idCard)  ){
                  console.log(4)
              }else{
                if(tw.test(this.form.idCard) || twe.test(this.form.idCard)){
                  console.log(5)
                }else{
                  this.$message.error('证件格式不正确');
                  return false
                }

                // return false
              }

            }
          	// callback(new Error('身份证号码不正确'))
          }



          if (this.form.id != null) {
            updateCreditUser(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addCreditUser(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除信用人员编号为"' + ids + '"的数据项？').then(function() {
        return delCreditUser(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/creditUser/export', {
        ...this.queryParams
      }, `信用人员表格数据.xlsx`)
    }
  }
};
</script>
<style  lang="scss">
  .placf {
    .el-input {
      .el-input__inner::placeholder{
        color: #333;
      }
      /* 谷歌 */
          .el-input__inner::-webkit-input-placeholder {
             color: #333;
          }
           /* 火狐 */
         .el-input__inner:-moz-placeholder {
              color: #333;
          }
           /*ie*/
         .el-input__inner:-ms-input-placeholder {
              color: #333;
          }
    }

  }
</style>
