<template>
  <div>
    <div class="search flex justify-between bg-white rounded-md">
      <el-form :inline="true" class="demo-form-inline" size="default">
        <el-form-item label="">
          <el-select
            v-model="form_query.sm_id"
            filterable
            clearable
            placeholder="全部学校"
            @change="initData"
          >
            <el-option
              v-for="(item, index) in tableSchoolData"
              :key="index"
              :label="item.sm_name"
              :value="item.id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="">
          <el-select
            placeholder="全部年级"
            v-model="form_query.user_grade_num"
            @change="initData"
            filterable
            clearable
          >
            <el-option
              v-for="(item, index) in tableGradeData"
              :key="index"
              :label="item.tjzn_njmc"
              :value="item.tjzn_id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="">
          <el-select
            v-model="form_query.user_class_num"
            placeholder="全部班级"
            @change="initData"
            filterable
            clearable
          >
            <el-option
              v-for="(item, index) in tableClassData"
              :key="index"
              :label="item.tjzb_bjmc"
              :value="item.tjzb_id"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <div>
        <el-button type="primary" @click="initData"> 查询 </el-button>
      </div>
    </div>
    <div class="bg-white rounded-md mt-4 px-23px py-16px">
      <div class="flex justify-between pb-4 btn">
        <div>
          <el-button type="primary" @click="handleAdd">新增</el-button>
          <el-button type="primary" @click="exportAll">导出</el-button>
          <import-button
            url="/user/main"
            :d="{ user_role_id: '76' }"
            @success="initData"
          >
            <template #text>批量导入</template>
          </import-button>
          <el-button type="primary" @click="toGraduation">一键毕业</el-button>
          <el-button type="primary" @click="upDialogVisible = true"
            >一键升级</el-button
          >

          <el-button
            type="danger"
            @click="handleMulDelete"
            :disabled="multipleSelection.length == 0"
            >删除</el-button
          >
        </div>
        <div class="flex content-center">
          <el-input
            v-model="form_query.keyword"
            class="w-40 mx-2"
            size="small"
            placeholder="请输搜索关键词"
            :suffix-icon="Search"
            clearable
          />
          <el-button type="primary" @click="initData">搜索</el-button>
        </div>
      </div>
      <el-table :data="tableData" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" />
        <el-table-column
          prop="user_id"
          label="ID"
          width="100"
        ></el-table-column>
        <el-table-column
          prop="user_name"
          label="账号"
          width="180"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column
          prop="user_realname"
          label="姓名"
          width="150"
        ></el-table-column>
        <el-table-column prop="sm_id" label="学校">
          <template #default="scope">
            <div v-for="item in tableSchoolData" :key="item.id">
              <span v-if="item.id == scope.row.sm_id">{{ item.sm_name }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="user_grade_num" label="年级">
          <template #default="scope">
            <div v-for="item in tableGradeData" :key="item.tjzn_id">
              <span v-if="item.tjzn_id == scope.row.user_grade_num">{{
                item.tjzn_njmc
              }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="user_class_num" label="班级">
          <template #default="scope">
            <div v-for="item in tableClassData" :key="item.tjzb_id">
              <span v-if="item.tjzb_id == scope.row.user_class_num">{{
                item.tjzb_bjmc
              }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="graduation" label="状态">
          <template #default="scope">
            <span v-if="scope.row.graduation == '0'">在读</span>
            <span v-if="scope.row.graduation == '1'">毕业</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="245">
          <template #default="scope">
            <el-button
              type="text"
              @click="
                handleDetail(scope.row.user_id), (detailDialogVisible = true)
              "
              >详情 |</el-button
            >
            <el-button type="text" @click="handleEdit(scope.row)"
              >编辑 |</el-button
            >
            <el-button type="text" @click="handleDelete(scope.row.user_id)"
              >删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="flex justify-end my-10">
        <el-pagination
          v-model:current-page="form_query.page"
          v-model:page-size="form_query.limit"
          layout="total,sizes, prev, pager, next, jumper"
          :total="total"
          :background="true"
          @current-change="initData"
          :hide-on-single-page="false"
        />
      </div>
      <el-dialog v-model="dialogVisible" :title="title" width="780px">
        <el-form
          ref="ruleFormRef"
          :model="ruleForm"
          :rules="rules"
          label-width="120px"
          class="demo-ruleForm"
          :size="formSize"
          status-icon
        >
          <h3 class="text-hex-00A3FF">账号信息</h3>
          <div class="flex">
            <el-form-item label="账号：" prop="user_name">
              <el-input class="rank" v-model="ruleForm.user_name" />
            </el-form-item>
            <el-form-item label="密码：" prop="user_password">
              <el-input
                class="rank"
                :disabled="isEdit"
                v-model="ruleForm.user_password"
              />
            </el-form-item>
          </div>
          <h3 class="text-hex-00A3FF">基本信息</h3>
          <el-form-item label="头像：">
            <file-upload-progress
              v-if="dialogVisible"
              v-model:part="ruleForm.user_avatar"
              :limit="1"
              accept=".jpg,.jpeg,.webp,.png"
              :size-limit="500 * 1024"
            >
              <el-button type="primary"> 点击上传 </el-button>

              <template #tip>
                <div class="mt-2 text-xs">
                  只能上传jpg/png文件，且不超过500kb，建议尺寸600x337
                </div>
              </template>
            </file-upload-progress>
          </el-form-item>
          <el-form-item label="头像地址：" prop="user_avatar" class="w-640px">
            <el-input v-model="ruleForm.user_avatar" />
          </el-form-item>
          <div class="flex">
            <el-form-item label="姓名：" prop="user_realname">
              <el-input class="rank" v-model="ruleForm.user_realname" />
            </el-form-item>
            <el-form-item label="学号：" prop="student_no">
              <el-input class="rank" v-model="ruleForm.student_no" />
            </el-form-item>
          </div>
          <div class="flex">
            <el-form-item label="身份证号：" prop="user_cardno">
              <el-input class="rank" v-model="ruleForm.user_cardno" />
            </el-form-item>
            <el-form-item label="曾用名：" prop="ue_cym">
              <el-input class="rank" v-model="ruleForm.ue_cym" />
            </el-form-item>
          </div>
          <div class="flex">
            <el-form-item label="籍贯：" prop="ue_jg_id">
              <el-select v-model="ruleForm.ue_jg_id" @change="handleJgChange">
                <el-option
                  v-for="g in jgData"
                  :key="g.v"
                  :label="g.n"
                  :value="g.v"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="出生日期：" prop="user_birthday">
              <el-date-picker
                v-model="ruleForm.user_birthday"
                type="date"
                placeholder="选择日期"
                value-format="YYYY-MM-DD"
              >
              </el-date-picker>
            </el-form-item>
          </div>
          <div class="flex">
            <el-form-item label="民族：" prop="ue_mz_id" filterable clearable>
              <el-select v-model="ruleForm.ue_mz_id" @change="handleMzChange">
                <el-option
                  v-for="g in mzData"
                  :key="g.v"
                  :label="g.n"
                  :value="g.v"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="性别：" prop="gender" filterable clearable>
              <el-radio-group v-model="ruleForm.gender">
                <el-radio
                  v-for="item in genderData"
                  :key="item.gender_id"
                  :label="item.gender_id"
                  :value="item.gender_id"
                  >{{ item.gender_name }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </div>
          <div class="flex">
            <el-form-item label="学校：" prop="sm_id">
              <el-select
                v-model="ruleForm.sm_id"
                filterable
                clearable
                placeholder="全部学校"
              >
                <el-option
                  v-for="(item, index) in tableSchoolData"
                  :key="index"
                  :label="item.sm_name"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="年级：" prop="user_grade_num">
              <el-select
                placeholder="全部年级"
                v-model="ruleForm.user_grade_num"
              >
                <el-option
                  v-for="(item, index) in tableGradeData"
                  :key="index"
                  :label="item.tjzn_njmc"
                  :value="item.tjzn_id"
                />
              </el-select>
            </el-form-item>
          </div>
          <div class="flex">
            <el-form-item label="班级：" prop="user_class_num">
              <el-select
                v-model="ruleForm.user_class_num"
                placeholder="全部班级"
              >
                <el-option
                  v-for="(item, index) in tableClassData"
                  :key="index"
                  :label="item.tjzb_bjmc"
                  :value="item.tjzb_id"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="联系方式：" prop="user_phone">
              <el-input v-model="ruleForm.user_phone" />
            </el-form-item>
          </div>

          <el-form-item label="详细地址：" prop="address" class="w-640px">
            <el-input type="textarea" v-model="ruleForm.address" />
          </el-form-item>
          <h3 class="text-hex-00A3FF">其他信息</h3>
          <el-form-item label="爱好特长：" prop="about" class="w-640px">
            <el-input type="textarea" v-model="ruleForm.about" />
          </el-form-item>

          <el-form-item
            label="结业信息："
            prop="ue_jbxx_stu_jyxx"
            class="w-316px"
          >
            <el-input class="rank" v-model="ruleForm.ue_jbxx_stu_jyxx" />
          </el-form-item>
          <el-form-item
            label="荣誉信息："
            prop="ue_jbxx_stu_ryxx"
            class="w-316px"
          >
            <el-input class="rank" v-model="ruleForm.ue_jbxx_stu_ryxx" />
          </el-form-item>
        </el-form>
        <div class="text-center">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="handleSubmit(ruleFormRef)">
            确定
          </el-button>
        </div>
      </el-dialog>

      <el-dialog
        v-model="detailDialogVisible"
        class="_"
        width="778"
        title="详情"
        @close="handleClose"
      >
        <img class="avatar" :src="ruleForm.user_avatar" />

        <el-form
          class="grid grid-cols-2"
          ref="ruleFormRef"
          label-position="right"
          label-width="90px"
          :model="detailForm"
        >
          <el-form-item label="账号:">
            {{ detailForm.user_name }}
          </el-form-item>
          <el-form-item label="用户角色:">
            {{ detailForm.role_name }}
          </el-form-item>
          <el-form-item label="姓名:">
            {{ detailForm.user_realname }}
          </el-form-item>
          <el-form-item label="学号:">
            {{ detailForm.student_no }}
          </el-form-item>
          <el-form-item label="身份证号:">
            {{ detailForm.user_cardno }}
          </el-form-item>
          <el-form-item label="曾用名:">
            {{ detailForm.ue_cym }}
          </el-form-item>
          <el-form-item label="出生日期:">
            {{ detailForm.user_birthday }}
          </el-form-item>
          <el-form-item label="籍贯:">
            {{ detailForm.ue_jg_name }}
          </el-form-item>
          <el-form-item label="性别:">
            {{ detailForm.gender1 }}
          </el-form-item>
          <el-form-item label="民族:">
            {{ detailForm.ue_mz_name }}
          </el-form-item>
          <el-form-item label="学校:">
            <div v-for="item in tableSchoolData" :key="item.id">
              <span v-if="item.id == detailForm.sm_id">{{ item.sm_name }}</span>
            </div>
          </el-form-item>
          <el-form-item label="年级:">
            <div v-for="item in tableGradeData" :key="item.tjzn_id">
              <span v-if="item.tjzn_id == detailForm.user_grade_num">{{
                item.tjzn_njmc
              }}</span>
            </div>
          </el-form-item>
          <el-form-item label="班级:">
            <div v-for="item in tableClassData" :key="item.tjzb_id">
              <span v-if="item.tjzb_id == detailForm.user_class_num">{{
                item.tjzb_bjmc
              }}</span>
            </div>
          </el-form-item>
          <el-form-item label="联系电话:">
            {{ detailForm.user_phone }}
          </el-form-item>
          <el-form-item label="结业信息:">
            {{ detailForm.ue_jbxx_stu_jyxx }}
          </el-form-item>
          <el-form-item label="爱好特长:" class="col-span-full">
            {{ detailForm.about }}
          </el-form-item>
          <el-form-item label="荣誉信息:">
            {{ detailForm.ue_jbxx_stu_ryxx }}
          </el-form-item>
        </el-form>
        <template #footer>
          <span class="flex_center space-x-12">
            <el-button size="large" type="primary" @click="handleFormCancel"
              >返回</el-button
            >
          </span>
        </template>
      </el-dialog>
      <el-dialog v-model="upDialogVisible" class="_" width="381" title="提醒">
        <el-form
          class="table"
          ref="ruleFormRef"
          :model="ruleForm"
          :rules="roleRules"
        >
          所属六年级、九年级的学生升级后会自动归入毕业生管理。
        </el-form>
        <template #footer>
          <span class="flex_center space-x-12">
            <el-button size="large" @click="upDialogVisible = false"
              >取消</el-button
            >
            <el-button size="large" type="primary" @click="handleFormSubmit">
              确定升级
            </el-button>
          </span>
        </template>
      </el-dialog>
    </div>
  </div>
</template>
<script setup>
import { useRouter } from "vue-router";
import { user } from "@/store/index";

import {
  yhxx_xs_list,
  yhxx_xs_del,
  yhxx_xs_add,
  yhxx_xs_edit,
  yhxx_xs_detail,
  all_graduation,
  grade_list,
  class_list,
  school_list,
  mzorjg_list,
} from "./api";
import { Search } from "@element-plus/icons-vue";
const router = useRouter();
const ruleFormRef = ref(null);
let grade = $ref("");
let genderData = ref([
  {
    gender_id: "1",
    gender_name: "男",
  },
  {
    gender_id: "2",
    gender_name: "女",
  },
]);

let ruleForm = $ref({
  user_name: "",
  user_password: "",
  user_avatar: "",
  user_realname: "",
  student_no: "",
  user_cardno: "",
  ue_cym: "",
  ue_jg_id: "",
  gender: "",
  ue_jg_name: "",
  user_birthday: "",
  ue_mz_id: "",
  ue_mz_name: "",
  sm_id: "",
  user_grade_num: "",
  user_class_num: "",
  user_phone: "",
  address: "",
  about: "",
  ue_jbxx_stu_ryxx: "",
  ue_jbxx_stu_jyxx: "",
  user_role_id: "76",
});
let detailForm = $ref({});
let keyword = $ref("");
let tableData = $ref([]);
let total = $ref(10);
let form_query = $ref({
  page: 1,
  limit: 6,
  keyword: "",
  user_grade_num: "",
  user_class_num: "",
  sm_id: "",
  user_role_id: "76",
  graduation: "0",
});
//列表
function initData() {
  const data = {
    ...form_query,
  };
  yhxx_xs_list(data).then((res) => {
    if (res.code == "1") {
      tableData = res.data.page_data;
      total = res.data.total_rows * 1;
    }
  });
}
initData();
//学校列表
let tableSchoolData = $ref([]);
function initSchoolData() {
  school_list({ limit: 100 }).then((res) => {
    if (res.code === "1") {
      tableSchoolData = res.data.page_data;
    }
  });
}
initSchoolData();
//年级列表
let tableGradeData = $ref([]);
function initGradeData() {
  grade_list({ limit: 100 }).then((res) => {
    if (res.code === "1") {
      tableGradeData = res.data.page_data;
    }
  });
}
initGradeData();
//班级列表
let tableClassData = $ref([]);
function initClassData() {
  class_list({ limit: 100 }).then((res) => {
    if (res.code === "1") {
      tableClassData = res.data.page_data;
    }
  });
}

initClassData();
//民族
let mzData = $ref([]);
function initMzData() {
  let data = {
    cs_code: "MZ",
  };
  mzorjg_list(data).then((res) => {
    if (res.code === "1") {
      mzData = res.data.option;
    }
  });
}
function handleMzChange() {
  mzData.map((item) => {
    if (item.v == ruleForm.ue_mz_id) {
      ruleForm.ue_mz_name = item.n;
    }
  });
}
//籍贯
let jgData = $ref([]);
function initJgData() {
  let data = {
    cs_code: "JG",
  };
  mzorjg_list(data).then((res) => {
    if (res.code === "1") {
      jgData = res.data.option;
    }
  });
}
function handleJgChange() {
  jgData.map((item) => {
    if (item.v == ruleForm.ue_jg_id) {
      ruleForm.ue_jg_name = item.n;
    }
  });
}
let multipleSelection = $ref([]);
let handleSelectionChange = (val) => {
  multipleSelection = [];
  val.forEach((i) => {
    multipleSelection.push(i.user_id);
  });
};
let rules = $ref({
  user_name: [{ required: true, message: "请输入账号", trigger: "submit" }],
  //user_password: [{ required: true, message: "请输入密码", trigger: "submit" }],
  user_realname: [{ required: true, message: "请输入姓名", trigger: "submit" }],
  student_no: [{ required: true, message: "请输入学号", trigger: "submit" }],
  user_cardno: [{ required: true, message: "请输入身份证号", trigger: "blur" }],
  ue_jg_id: [{ required: true, message: "请选择籍贯", trigger: "blur" }],
  user_birthday: [
    { required: true, message: "请选择出生日期", trigger: "blur" },
  ],
  gender: [{ required: true, message: "请选择性别", trigger: "blur" }],
  sm_id: [{ required: true, message: "请选择学校", trigger: "blur" }],
  user_grade_num: [{ required: true, message: "请选择年级", trigger: "blur" }],
  user_class_num: [{ required: true, message: "请选择班级", trigger: "blur" }],
  address: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
});

let detailDialogVisible = ref(false);
let detailData = ref({});
//详情

function handleDetail(id) {
  const data = {
    user_id: id,
  };
  yhxx_xs_detail(data).then((res) => {
    if (res.code === "1") {
      detailData = res.data;
      detailForm = {
        user_role_id: "76",
        user_name: detailData.user_name,
        user_realname: detailData.user_realname,
        role_name: detailData.role_name,
        student_no: detailData.student_no,
        user_cardno: detailData.user_cardno,
        user_avatar: detailData.user_avatar,
        ue_jg_id: detailData.ext.ue_jg_id,
        ue_jg_name: detailData.ext.ue_jg_name,
        ue_cym: detailData.ext.ue_cym,
        user_birthday: detailData.user_birthday,
        ue_mz_id: detailData.ext.ue_mz_id,
        ue_mz_name: detailData.ext.ue_mz_name,
        gender: detailData.gender,
        gender1:
          detailData.gender == 1
            ? "男"
            : detailData.gender == 2
            ? "女"
            : "保密",
        sm_id: detailData.sm_id,
        user_grade_num: detailData.user_grade_num,
        user_class_num: detailData.user_class_num,
        user_phone: detailData.user_phone,
        address: detailData.address,
        about: detailData.about,
        ue_jbxx_stu_jyxx: detailData.ext.ue_jbxx_stu_jyxx,
        ue_jbxx_stu_ryxx: detailData.ext.ue_jbxx_stu_ryxx,
      };
      Object.keys(ruleForm).find((item) => {
        ruleForm[item] = detailForm[item];
      });
    }
  });
}

//新增
let dialogVisible = $ref(false);
let title = $ref("");
let isEdit = $ref(false);
function handleAdd() {
  dialogVisible = true;
  title = "新增";
  isEdit = false;
  initMzData();
  initJgData();
  ruleForm = {
    user_name: "",
    user_password: "",
    user_avatar: "",
    user_realname: "",
    student_no: "",
    user_cardno: "",
    ue_cym: "",
    ue_jg_id: "",
    gender: "",
    ue_jg_name: "",
    user_birthday: "",
    ue_mz_id: "",
    ue_mz_name: "",
    sm_id: "",
    user_grade_num: "",
    user_class_num: "",
    user_phone: "",
    address: "",
    about: "",
    ue_jbxx_stu_ryxx: "",
    ue_jbxx_stu_jyxx: "",
    user_role_id: "76",
  };
  // Object.keys(ruleForm).find((item) => {
  //   ruleForm[item] = "";
  // });
}
//编辑
let currentId = $ref("");
let user_password = $ref("");
function handleEdit(row) {
  dialogVisible = true;
  title = "编辑";
  isEdit = true;
  initMzData();
  initJgData();

  currentId = row.user_id;
  handleDetail(row.user_id);
}
//一键毕业
function toGraduation() {
  let data = {
    levelup: "1",
    // user_id: multipleSelection,
  };
  all_graduation(data).then((res) => {
    if (res.code == "1") {
      res.data.levelup = "1";
      ElMessage({
        type: "success",
        message: res.msg,
      });
      router.push({ name: "bysgl" });
      initData();
    } else {
      ElMessage({
        message: res.msg,
        type: "error",
      });
    }
  });
}
//批量升级
let upDialogVisible = $ref(false);
async function handleFormSubmit() {
  let data = {
    levelup: "0",
  };
  all_graduation(data).then((res) => {
    if (res.code == "1") {
      res.data.levelup = "0";
      ElMessage({
        type: "success",
        message: res.msg,
      });
      upDialogVisible = false;
      initData();
    } else {
      ElMessage({
        message: res.msg,
        type: "error",
      });
    }
  });
}

const handleClose = () => {
  detailDialogVisible.value = false;
};

// 批量删除
function handleMulDelete() {
  ElMessageBox.confirm("确认删除这些数据?", "", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      let data = { user_id: multipleSelection };
      yhxx_xs_del(data).then((res) => {
        if (res.code == 1) {
          ElMessage({
            message: "删除成功",
            type: "success",
          });
          initData();
        } else {
          ElMessage({
            message: res.msg,
            type: "error",
          });
        }
      });
    })
    .catch(() => {});
}
//单个删除
function handleDelete(id) {
  ElMessageBox.confirm("确认删除?", "", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(() => {
      let data = { user_id: id };
      yhxx_xs_del(data).then((res) => {
        if (res.code == 1) {
          ElMessage({
            message: "删除成功",
            type: "success",
          });
          initData();
        } else {
          ElMessage({
            message: res.msg,
            type: "error",
          });
        }
      });
    })
    .catch(() => {});
}
function handleFormCancel() {
  detailDialogVisible.value = false;
}

let user_grade_num;
function handleGradeChange(val) {
  user_grade_num = val;
}

function exportAll() {
  let obj = {
    limit: "999999",
    user_id: multipleSelection.join(","),
    graduation: "0",
    user_role_id: "76",
    sm_id: form_query.sm_id,
    user_grade_num: form_query.user_grade_num,
    user_class_num: form_query.user_class_num,
  };
  console.log(obj, 44444);
  if (form_query.sm_id != "") {
    download("/user/main/index", obj);
  } else {
    return ElMessage({
      message: "请先选择学校。",
      type: "warning",
    });
  }
  // let ids = multipleSelection.join(",");
  // let link =
  //   window.GLOBAL_CONFIG.api +
  //   "/user/main/index?user_role_id=76&graduation=0&api=xls&page=1&limit=10000&token=" +
  //   user.value.token +
  //   "&user_id=" +
  //   ids;
  // console.log(link);
  // window.open(link, "_blank");
}
const handleSubmit = async (formEl) => {
  if (!formEl) return;
  formEl.validate(async (valid, fields) => {
    if (valid) {
      let obj = {};
      Object.keys(ruleForm).find((item) => {
        obj[item] = ruleForm[item];
      });
      const data = {
        user_main: obj,
      };
      if (!isEdit) {
        if (!data.user_main.user_password) {
          return ElMessage({
            type: "warning",
            message: "请输入密码",
          });
        }
        yhxx_xs_add(data).then((res) => {
          if (res.code == 1) {
            ElMessage({
              message: "添加成功",
              type: "success",
            });
            dialogVisible = false;
            initData();
          } else {
            ElMessage({
              message: res.msg,
              type: "error",
            });
          }
        });
      } else {
        data.user_id = currentId;
        data.user_main.user_password = user_password;
        yhxx_xs_edit(data).then((res) => {
          if (res.code == 1) {
            ElMessage({
              message: "编辑成功",
              type: "success",
            });
            dialogVisible = false;
            initData();
          } else {
            ElMessage({
              message: res.msg,
              type: "error",
            });
          }
        });
      }
    } else {
      console.log("error submit!", fields);
    }
  });
};
</script>
<style lang="scss" scoped>
.search {
  height: 72px;
  line-height: 85px;
  padding: 0 29px;
}
.avatar {
  width: 82px;
  height: 82px;
  background: #c4c4c4;
  border-radius: 8px;
  margin: 30px auto 50px;
}
:deep() .el-dialog__body {
  padding-left: 60px;
  border-top: 1px solid #f3f3f3;
}
.btn {
  border-bottom: 1px solid #e3e3e3;
}

:deep() .el-form-item__content {
  width: 196px;
  display: inline;
}
</style>