gemercheung 1 سال پیش
والد
کامیت
30edda9856
4فایلهای تغییر یافته به همراه41 افزوده شده و 17 حذف شده
  1. BIN
      src/assets/avatar.png
  2. 3 3
      src/store/organization.ts
  3. 2 4
      src/view/layout/nav.vue
  4. 36 10
      src/view/organization-add.vue

BIN
src/assets/avatar.png


+ 3 - 3
src/store/organization.ts

@@ -7,9 +7,9 @@ export enum organizationTypeEnum {
 }
 }
 
 
 export const OrganizationTypeDesc: { [key in organizationTypeEnum]: string } = {
 export const OrganizationTypeDesc: { [key in organizationTypeEnum]: string } = {
-  [organizationTypeEnum.Province]: "省",
-  [organizationTypeEnum.City]: "市",
-  [organizationTypeEnum.Country]: "县",
+  [organizationTypeEnum.Province]: "省(自治区、直辖市)",
+  [organizationTypeEnum.City]: "市(地区、州、盟)",
+  [organizationTypeEnum.Country]: "县(区、市、旗)",
   [organizationTypeEnum.Supplier]: "服务商",
   [organizationTypeEnum.Supplier]: "服务商",
 
 
 };
 };

+ 2 - 4
src/view/layout/nav.vue

@@ -6,11 +6,10 @@
         <span v-if="!name">不可移动文物管理平台</span>
         <span v-if="!name">不可移动文物管理平台</span>
       </span>
       </span>
       <el-dropdown placement="bottom-end" class="avatar" v-if="user">
       <el-dropdown placement="bottom-end" class="avatar" v-if="user">
-
         <span class="avatar-left-label">
         <span class="avatar-left-label">
           <span class="org"> {{ user.orgName }}</span>
           <span class="org"> {{ user.orgName }}</span>
           <span class="name"> {{ user.nickName }}</span>
           <span class="name"> {{ user.nickName }}</span>
-          <el-avatar :src="user.head" />
+          <el-avatar :src="user.head || avatarDefault" />
         </span>
         </span>
         <template #dropdown>
         <template #dropdown>
           <el-dropdown-menu>
           <el-dropdown-menu>
@@ -41,6 +40,7 @@ import { user, logout } from "@/store/user";
 import { errorHook } from "@/request/state";
 import { errorHook } from "@/request/state";
 import lySlide from "./slide/index.vue";
 import lySlide from "./slide/index.vue";
 import { usersPasswordEdit } from "@/view/quisk";
 import { usersPasswordEdit } from "@/view/quisk";
+import avatarDefault from "@/assets/avatar.png";
 import {
 import {
   UserType,
   UserType,
   changePassword,
   changePassword,
@@ -137,8 +137,6 @@ const showBack = computed(() => {
       display: none;
       display: none;
     }
     }
 
 
-
-
     * {
     * {
       pointer-events: all;
       pointer-events: all;
     }
     }

+ 36 - 10
src/view/organization-add.vue

@@ -18,11 +18,19 @@
         <el-option :value="Number(key)" :label="type" v-for="(type, key) in OrganizationTypeDesc" />
         <el-option :value="Number(key)" :label="type" v-for="(type, key) in OrganizationTypeDesc" />
       </el-select>
       </el-select>
     </el-form-item>
     </el-form-item>
+
+    <el-form-item label="上级单位" prop="parentId">
+      <el-tree-select :props="{
+        value: 'orgId',
+        label: (data: any) => data.orgName,
+      }" style="width: 300px" v-model="data.parentId" :data="allOrgs" node-key="orgId" clearable>
+      </el-tree-select>
+    </el-form-item>
     <el-form-item label="联系人" prop="contact" required>
     <el-form-item label="联系人" prop="contact" required>
       <el-input v-model="data.contact" style="width: 300px" :maxlength="500" placeholder="请输入" />
       <el-input v-model="data.contact" style="width: 300px" :maxlength="500" placeholder="请输入" />
     </el-form-item>
     </el-form-item>
     <el-form-item label="账号" prop="userName" required>
     <el-form-item label="账号" prop="userName" required>
-      <el-input v-model="data.userName" style="width: 300px" :maxlength="11"  placeholder="请输入手机号" />
+      <el-input v-model="data.userName" style="width: 300px" :maxlength="11" placeholder="请输入手机号" />
     </el-form-item>
     </el-form-item>
     <el-form-item label="密码" prop="password" required>
     <el-form-item label="密码" prop="password" required>
       <el-input autocomplete="off" readonly onfocus="this.removeAttribute('readonly');" v-model="data.password"
       <el-input autocomplete="off" readonly onfocus="this.removeAttribute('readonly');" v-model="data.password"
@@ -51,13 +59,24 @@ import type { FormInstance, FormRules } from "element-plus";
 import type { OrganizationType } from '@/request/organization'
 import type { OrganizationType } from '@/request/organization'
 import { OrganizationTypeDesc } from '@/store/organization'
 import { OrganizationTypeDesc } from '@/store/organization'
 
 
-import { ref, reactive, unref, watch } from "vue";
+import { ref, reactive, unref, watch, onMounted } from "vue";
 import { View, Hide } from '@element-plus/icons-vue';
 import { View, Hide } from '@element-plus/icons-vue';
 import { user } from '@/store/user'
 import { user } from '@/store/user'
+import {
+  getOrgListFetchList,
+
+} from "@/request";
 
 
 const addPassFlag = ref(true)//图标显示标识
 const addPassFlag = ref(true)//图标显示标识
 
 
+type SelectType = {
+  orgName: string,
+  orgId: number
+  children: SelectType[]
+}
+
 const baseFormRef = ref<FormInstance>();
 const baseFormRef = ref<FormInstance>();
+const allOrgs = ref<SelectType[]>([]);
 
 
 const rules = reactive<FormRules>({
 const rules = reactive<FormRules>({
   orgName: [
   orgName: [
@@ -87,18 +106,24 @@ const data = ref<OrganizationType & {}>({
   orderNum: 0,
   orderNum: 0,
   orgId: 0,
   orgId: 0,
   orgName: "",
   orgName: "",
-  parentId: 0,
+  parentId: null,
   password: "",
   password: "",
   type: null,
   type: null,
   userName: ""
   userName: ""
 });
 });
 
 
-const setParentId = () => {
-  if (user.value) {
-    const isSuper = user.value.roles.filter(item => item.roleKey === "super_admin").length > 0;
-    data.value.parentId = isSuper ? 0 : Number(user.value.orgId)
-  }
-}
+// const setParentId = () => {
+//   if (user.value) {
+//     const isSuper = user.value.roles.filter(item => item.roleKey === "super_admin").length > 0;
+//     data.value.parentId = isSuper ? 0 : Number(data.value.parentId)
+//   }
+// }
+
+onMounted(async () => {
+  const data = await getOrgListFetchList()
+  // console.log('allOrgs', data);
+  allOrgs.value = data as any as SelectType[]
+})
 watch(data, (newValue) => {
 watch(data, (newValue) => {
   data.value.userName = newValue.userName.replace(/[^0-9]/g, '');
   data.value.userName = newValue.userName.replace(/[^0-9]/g, '');
 }, {
 }, {
@@ -110,9 +135,10 @@ defineExpose<QuiskExpose>({
   async submit() {
   async submit() {
 
 
     if (unref(baseFormRef)) {
     if (unref(baseFormRef)) {
-      setParentId();
+      // setParentId();
       const res = await unref(baseFormRef)?.validate();
       const res = await unref(baseFormRef)?.validate();
       if (res) {
       if (res) {
+        console.log('data', data.value)
         await props.submit(data.value as any as OrganizationType);
         await props.submit(data.value as any as OrganizationType);
       }
       }
     } else {
     } else {