he wei
2025-04-23 b9bd29a1a81f6f7de479e3cc3fdfe3d85fc660bf
src/views/system/user/index.vue
@@ -2,11 +2,14 @@
   import { ref, reactive, onMounted, computed } from "vue";
   import { storeToRefs } from "pinia";
   import { Search, Plus } from "@element-plus/icons-vue";
   import HdwCard from "@/components/HdwCard/index.vue";
   import ycCard from "@/components/ycCard/index.vue";
   import addEdit from "./addEdit.vue";
   import { ElMessage } from "element-plus";
   import useElement from "@/hooks/useElement.js";
   import store from "@/store";
  import { useUserStore } from '@/store/user';
  const userStore = useUserStore();
  const { uname } = storeToRefs(userStore);
   import {
      getAllUser,
      deleteUser,
@@ -16,11 +19,27 @@
   } from "@/api/user";
   const { $loading, $message, $confirm } = useElement();
   // const $message = ElMessage;
   const headers = [
      {
         prop: "uname",
         label: "用户名",
         width: "",
      },
    {
         prop: "realName",
         label: "姓名",
         width: "",
      },
    {
         prop: "phoneNumber",
         label: "电话",
         width: "",
      },
    {
         prop: "address",
         label: "地址",
         width: "",
      },
      {
@@ -48,7 +67,6 @@
      userInfo: {},
   });
   const uname = computed(() => store.user().name);
   // const tableData = reactive([]);
   // const userInfo = reactive({});
@@ -97,19 +115,13 @@
   function edit(record) {
      dialogTitle.value = "编辑用户";
      addEditVisible.value = true;
      console.log(record);
      let ids = record.ainfList.map(v => {
         let res = v.idPath.split("_").map((vv) => vv * 1);
         res.push(v.id);
         return res
      });
      console.log(record, '=======edit======');
      // if (record.ainfList.idPath) {
      //    ids = record.ainfList.idPath.split("_").map((v) => v * 1);
      // }
      // ids.push(record.areaId);
      console.log('ids', ids, '=============');
      datas.userInfo = { ...record, areaId: ids };
      datas.userInfo = { ...record };
   }
   function confirmRemove(record) {
      $confirm("删除该用户", () => {
@@ -192,34 +204,18 @@
      });
   }
   function itemClickHandler(item) {
      console.log(item, "====item", item.data);
      // areaId lockName lockState lockType pageNum pageSize
      currentAreaId.value = item.data.id;
      currentAreaIds.value = item.data.idPath
         ? item.data.idPath.split("_").map((v) => v * 1)
         : [];
      currentAreaIds.value.push(item.data.id);
      getList();
   }
   onMounted(() => {
      // getList();
      getList();
   });
</script>
<template>
  <div class="page-wrapper">
    <div class="page-header">
      <div class="hdw-card-container">
        <hdw-card title="区域列表" is-full>
          <hdw-tree @item-click="itemClickHandler"></hdw-tree>
        </hdw-card>
      </div>
    </div>
    <!-- <div class="page-header">
    </div> -->
    <div class="page-content">
      <hdw-card is-full>
      <yc-card is-full>
        <div class="page-content-wrapper">
          <div class="page-content-tools">
            <el-button type="primary" round size="small" @click="addUser" :icon="Plus">添加</el-button>
@@ -229,7 +225,7 @@
            <div class="pos-rel">
              <div class="pos-abs">
                <el-table class="yc-table" stripe height="100%" size="small" :data="datas.tableData" style="width: 100%">
                  <el-table-column type="index" label="序号" width="80"></el-table-column>
                  <el-table-column type="index" fixed="left" label="序号" width="80"></el-table-column>
                  <el-table-column v-for="header in headers" :key="header.prop" :prop="header.prop" :label="header.label"
                    :min-width="header.width" align="center"></el-table-column>
                  <el-table-column label="操作" width="360" align="center">
@@ -272,7 +268,7 @@
            <div class="page-tool"></div>
          </div>
        </div>
      </hdw-card>
      </yc-card>
    </div>
    <div class="page-footer"></div>
    <!-- 弹窗 -->