Browse Source

表单组件添加(add文件)

guicheng 8 months ago
parent
commit
9fc39131c9

+ 31 - 9
src/views/Template/template/components/add/index.vue

@@ -2,7 +2,7 @@
  * @Author: 
  * @Date: 2023-03-01 19:20:44
  * @LastEditors: Please set LastEditors
- * @LastEditTime: 2024-03-13 17:45:49
+ * @LastEditTime: 2024-03-15 16:42:54
  * @Description: kxs files
  * @filePath: 
 -->
@@ -18,18 +18,14 @@ import { useRenderIcon } from "@/components/ReIcon/src/hooks";
 import { postUserList } from "@/api/system";
 import { ElMessage, ElMessageBox } from "element-plus";
 import { http } from "@/utils/http";
-import { dataResult } from "@/api/apiResult";
 // 获取URLLIST
 import { getGroupUrl } from "@/utils/getUrl/getUrl"
 // 获取当前板块接口列表
-const UserUrl = await getGroupUrl(['User']);
 import Upload from "@iconify-icons/ri/upload-2-fill"
 import Close from "@iconify-icons/ri/close-fill"
+
 const props = defineProps<{
-  submit: {
-    type: Function;
-    default: () => {};
-  };
+  submit: Function;
   addVisible: {
     type: Boolean;
     default: false;
@@ -54,10 +50,19 @@ const optionList = [
 ]
 // 选项卡参数(默认值为列表某项的id)
 const activeId = ref('1')
+// 穿梭框数据
+const transferdata = ref([
+  { key: 1, label: '1', disabled: false },
+  { key: 2, label: '2', disabled: false },
+  { key: 3, label: '3', disabled: false },
+  { key: 4, label: '4', disabled: false },
+  { key: 5, label: '5', disabled: false },
+  { key: 6, label: '6', disabled: false },
+])
 // 提交函数
 const submit = async () => {
-  const { status, info }: any = await postUserList(UpdateForm.value);
-  // const { status, info }: any = await URL.postUserList.url(UpdateForm.value);
+  const UserUrl = await getGroupUrl(['User']);
+  const { status, info }: any = http.request(UserUrl.User.userSearch.method, UserUrl.User.userSearch.url, UpdateForm.value);
   if (status === "1") {
     ElMessage({
       message: "新增成功",
@@ -151,6 +156,23 @@ const closeVisible = () => {
           class="!w-[230px]"
         )
           el-option(:label="item.label", :value="item.Id" v-for="(item,index) in optionList")
+      el-form-item(label='取色器' prop="PassWord")
+        el-color-picker(v-model="UpdateForm.AdminName" show-alpha)
+      el-form-item(label='数字输入框' prop="PassWord")
+        el-input-number(v-model="UpdateForm.PassWord" :min="1" :max="10")
+      el-form-item(label='滑块' prop="PassWord")
+        el-slider(v-model="UpdateForm.PassWord")
+      el-form-item(label='开关' prop="PassWord")
+        el-switch(v-model="UpdateForm.PassWord")
+      el-form-item(label='单选框' prop="PassWord")
+        el-radio-group(v-model="UpdateForm.PassWord")
+          el-radio(:value="1") Option A
+          el-radio(:value="2") Option B
+          el-radio(:value="3") Option C
+      el-form-item(label='评分' prop="PassWord")
+        el-rate(v-model="UpdateForm.PassWord")
+      el-form-item(label='穿梭框' prop="AdminName")
+        el-transfer(v-model="UpdateForm.AdminName" :data="transferdata")
     el-button(
       :icon="useRenderIcon(Close)",
       :loading="loading",

+ 4 - 5
src/views/Template/template/components/edit/index.vue

@@ -2,7 +2,7 @@
  * @Author: 
  * @Date: 2023-03-01 19:20:44
  * @LastEditors: Please set LastEditors
- * @LastEditTime: 2024-03-13 18:00:16
+ * @LastEditTime: 2024-03-15 16:43:53
  * @Description: kxs files
  * @filePath: 
 -->
@@ -20,11 +20,8 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import Upload from "@iconify-icons/ri/upload-2-fill"
 import Close from "@iconify-icons/ri/close-fill"
 import { http } from "@/utils/http";
-import { dataResult } from "@/api/apiResult";
 // 获取URLLIST
 import { getGroupUrl } from "@/utils/getUrl/getUrl"
-// 获取当前板块接口列表
-const UserUrl = await getGroupUrl(['User']);
 const props = defineProps<{
   editVisible: {
     type: Boolean;
@@ -57,7 +54,9 @@ const optionList = [
 const activeId = ref('1')
 // 提交函数
 const submit = async () => {
-  const { status, info }: any = http.request<dataResult>(UserUrl.User.userSearch.method, UserUrl.User.userSearch.url, UpdateForm.value);
+  // 获取当前板块接口列表
+  const UserUrl = await getGroupUrl(['User']);
+  const { status, info }: any = http.request(UserUrl.User.userSearch.method, UserUrl.User.userSearch.url, UpdateForm.value);
   if (status === "1") {
     ElMessage({
       message: "修改成功",

+ 2 - 3
src/views/Template/template/hook.tsx

@@ -5,7 +5,6 @@ import { reactive, ref, computed, onMounted } from "vue";
 // 获取URLLIST
 import { getGroupUrl } from "@/utils/getUrl/getUrl"
 import { http } from "@/utils/http";
-import { dataResult } from "@/api/apiResult";
 // 获取当前板块接口列表
 const UserUrl = await getGroupUrl(['User']);
 export function useUser() {
@@ -89,7 +88,7 @@ export function useUser() {
       });
     };
     loading.value = true;
-    const { data, other }: any = http.request<dataResult>(UserUrl.User.userSearch.method, UserUrl.User.userSearch.url, { ...form, page_size: pagination.pageSize, page_num: pagination.currentPage });
+    const { data, other }: any = http.request(UserUrl.User.userSearch.method, UserUrl.User.userSearch.url, { ...form, page_size: pagination.pageSize, page_num: pagination.currentPage });
     dataList.value = data;
     pagination.total = other.Count;
     setTimeout(() => {
@@ -112,7 +111,7 @@ export function useUser() {
         type: "warning"
       }
     ).then(async () => {
-      const { status, info } = await http.request<dataResult>(UserUrl.User.userDelete.method, UserUrl.User.userDelete.url, { SysAdminId: row.Id });
+      const { status, info }: any = await http.request(UserUrl.User.userDelete.method, UserUrl.User.userDelete.url, { SysAdminId: row.Id });
       if (status === "1") {
         ElMessage({
           message: "删除成功",

+ 2 - 1
src/views/Template/template/index.vue

@@ -142,7 +142,8 @@ provide('closeAddVisible', closeAddVisible)
                       :icon="useRenderIcon(Delete)"
                       v-if="hasAuth(['delete'])"
                     ) 删除
-    Add(:addVisible="addVisible")
+    //- Add(:addVisible="addVisible")
+    Add(:addVisible="true")
     Edit(:editVisible="editVisible" :formData="editFormData")
                     
 </template>