zs 9 月之前
父节点
当前提交
024dfac3bc
共有 1 个文件被更改,包括 12 次插入11 次删除
  1. 12 11
      src/views/user/user/index.vue

+ 12 - 11
src/views/user/user/index.vue

@@ -87,6 +87,7 @@ let limit = inject('limit')
 const data = ref([])
 const total = ref(0)
 const type = ref('User')
+const user_id = ref('')
 const role = ref([])
 onMounted(async () => {
   loading.value = true
@@ -212,6 +213,7 @@ const getDict = (data) => {
 // 查看
 const toView = async (data) => {
   form.value = data
+  user_id.value = data.id
   role.value = get(data, 'role')
   dialog.value = { type: '1', show: true, title: t('pages.user.dialogTitle') }
 }
@@ -219,28 +221,27 @@ const toView = async (data) => {
 const toChang = async (name) => {
   let result
   if (name == 'User') {
-    const id = form.value.id || form.value.user
-    result = await store.fetch(id)
+    result = await store.fetch(user_id.value)
     if ($checkRes(result)) form.value = result.data
   } else {
     if (name == 'Expert') {
-      result = await expertStore.query({ user: form.value.user || form.value.id })
+      result = await expertStore.query({ user: user_id.value })
     } else if (name == 'Company') {
-      result = await companyStore.query({ user: form.value.user || form.value.id })
+      result = await companyStore.query({ user: user_id.value })
     } else if (name == 'Unit') {
-      result = await unitStore.query({ user: form.value.user || form.value.id })
+      result = await unitStore.query({ user: user_id.value })
     } else if (name == 'Association') {
-      result = await associationStore.query({ user: form.value.user || form.value.id })
+      result = await associationStore.query({ user: user_id.value })
     } else if (name == 'Competition') {
-      result = await competitionStore.query({ user: form.value.user || form.value.id })
+      result = await competitionStore.query({ user: user_id.value })
     } else if (name == 'Incubator') {
-      result = await incubatorStore.query({ user: form.value.user || form.value.id })
+      result = await incubatorStore.query({ user: user_id.value })
     } else if (name == 'Investment') {
-      result = await investmentStore.query({ user: form.value.user || form.value.id })
+      result = await investmentStore.query({ user: user_id.value })
     } else if (name == 'State') {
-      result = await stateStore.query({ user: form.value.user || form.value.id })
+      result = await stateStore.query({ user: user_id.value })
     }
-    if ($checkRes(result)) form.value = result.data[0] || { user: form.value.user || form.value.id }
+    if ($checkRes(result)) form.value = result.data[0] || {}
   }
 }
 const onSubmit = async () => {