Kaynağa Gözat

模板获取URL方式调整

guicheng 6 ay önce
ebeveyn
işleme
708485608f

+ 7 - 8
src/views/Template/template/components/add/index.vue

@@ -1,8 +1,8 @@
 <!--
  * @Author: 
  * @Date: 2023-03-01 19:20:44
- * @LastEditors: Please set LastEditors
- * @LastEditTime: 2024-03-15 16:42:54
+ * @LastEditors: guicheng 1625811865@qq.com
+ * @LastEditTime: 2024-05-14 14:52:51
  * @Description: kxs files
  * @filePath: 
 -->
@@ -15,14 +15,14 @@ export default {
 <script setup lang="ts">
 import { inject, ref } from "vue";
 import { useRenderIcon } from "@/components/ReIcon/src/hooks";
-import { postUserList } from "@/api/system";
 import { ElMessage, ElMessageBox } from "element-plus";
-import { http } from "@/utils/http";
-// 获取URLLIST
-import { getGroupUrl } from "@/utils/getUrl/getUrl";
-// 获取当前板块接口列表
 import Upload from "@iconify-icons/ri/upload-2-fill";
 import Close from "@iconify-icons/ri/close-fill";
+import { http } from "@/utils/http";
+// 获取当前板块接口列表
+import { getGroupUrl } from "@/utils/getUrl/getUrl";
+// 获取URLLIST
+const UserUrl = await getGroupUrl(["User"]);
 
 const props = defineProps<{
   submit: Function;
@@ -61,7 +61,6 @@ const transferdata = ref([
 ]);
 // 提交函数
 const submit = async () => {
-  const UserUrl = await getGroupUrl(["User"]);
   const { status, info }: any = http.request(
     UserUrl.User.userSearch.method,
     UserUrl.User.userSearch.url,

+ 29 - 22
src/views/Template/template/components/edit/index.vue

@@ -1,8 +1,8 @@
 <!--
  * @Author: 
  * @Date: 2023-03-01 19:20:44
- * @LastEditors: Please set LastEditors
- * @LastEditTime: 2024-03-15 16:43:53
+ * @LastEditors: guicheng 1625811865@qq.com
+ * @LastEditTime: 2024-05-14 14:53:14
  * @Description: kxs files
  * @filePath: 
 -->
@@ -15,13 +15,14 @@ export default {
 <script setup lang="ts">
 import { inject, ref } from "vue";
 import { useRenderIcon } from "@/components/ReIcon/src/hooks";
-import { postUserList } from "@/api/system";
 import { ElMessage, ElMessageBox } from "element-plus";
-import Upload from "@iconify-icons/ri/upload-2-fill"
-import Close from "@iconify-icons/ri/close-fill"
+import Upload from "@iconify-icons/ri/upload-2-fill";
+import Close from "@iconify-icons/ri/close-fill";
 import { http } from "@/utils/http";
+// 获取当前板块接口列表
+import { getGroupUrl } from "@/utils/getUrl/getUrl";
 // 获取URLLIST
-import { getGroupUrl } from "@/utils/getUrl/getUrl"
+const UserUrl = await getGroupUrl(["User"]);
 const props = defineProps<{
   editVisible: {
     type: Boolean;
@@ -38,25 +39,27 @@ const props = defineProps<{
   };
 }>();
 // 表单数据
-let UpdateForm: any = ref({
+const UpdateForm: any = ref({
   RealName: "",
   AdminName: "",
   PassWord: "",
-  RoleId: "",
+  RoleId: ""
 });
 // 传参选项数据
 const optionList = [
-  { Id: '1', label: '推荐' },
-  { Id: '2', label: '实物' },
-  { Id: '3', label: '虚拟商品' },
-]
+  { Id: "1", label: "推荐" },
+  { Id: "2", label: "实物" },
+  { Id: "3", label: "虚拟商品" }
+];
 // 选项卡参数(默认值为列表某项的id)
-const activeId = ref('1')
+const activeId = ref("1");
 // 提交函数
 const submit = async () => {
-  // 获取当前板块接口列表
-  const UserUrl = await getGroupUrl(['User']);
-  const { status, info }: any = http.request(UserUrl.User.userSearch.method, UserUrl.User.userSearch.url, UpdateForm.value);
+  const { status, info }: any = http.request(
+    UserUrl.User.userSearch.method,
+    UserUrl.User.userSearch.url,
+    UpdateForm.value
+  );
   if (status === "1") {
     ElMessage({
       message: "修改成功",
@@ -66,23 +69,27 @@ const submit = async () => {
       AdminName: "",
       RealName: "",
       RoleId: "",
-      PassWord: "",
+      PassWord: ""
     };
   } else {
     ElMessageBox.alert(info, "提示", {
       confirmButtonText: "关闭",
       type: "warning"
     });
-  };
+  }
 };
 // 关闭弹窗回调函数
-const closeVisible = inject('closeEditVisible');
+const closeVisible = inject("closeEditVisible");
 const openVisible = async () => {
   //通过ID获取表格数据
-  const { data, info }: any = await postUserList(props.formData.id);
-  UpdateForm.value = data
+  const { data, info }: any = http.request(
+    UserUrl.User.userSearch.method,
+    UserUrl.User.userSearch.url,
+    props.formData.id
+  );
+  UpdateForm.value = data;
   // 通过表格项获取数据
-  UpdateForm.value = props.formData
+  UpdateForm.value = props.formData;
 };
 </script>