Browse Source

use the true type

Michael Wang 3 years ago
parent
commit
e48d5d2606

+ 1 - 1
src/api/rootOrgPage.ts

@@ -4,7 +4,7 @@ import { httpApp } from "@/plugins/axiosApp";
 export function getRootOrgList(params: {
   code?: string;
   name?: string;
-  enable?: string;
+  enable?: boolean;
   pageNo?: number;
   pageSize?: number;
 }) {

+ 2 - 2
src/api/subOrgPage.ts

@@ -4,7 +4,7 @@ import { httpApp } from "@/plugins/axiosApp";
 export function getSubOrgList(params: {
   code?: string;
   name?: string;
-  enable?: string;
+  enable?: boolean;
   rootOrgId: string;
   pageNo?: number;
   pageSize?: number;
@@ -55,7 +55,7 @@ export function exportOrg(params: {
   rootOrgId: string;
   code: string;
   name: string;
-  enable: string;
+  enable?: boolean;
 }) {
   return httpApp.post(`/api/ess/org/export`, params);
 }

+ 12 - 4
src/components/StateSelect.vue

@@ -3,7 +3,7 @@
     placeholder="状态"
     allowClear
     :disabled="props.disabled"
-    :value="props.value"
+    :value="valueStr"
     @change="handleChange"
     style="width: 80px"
   >
@@ -13,9 +13,11 @@
 </template>
 
 <script setup lang="ts">
+import { computed } from "vue-demi";
+
 const props = withDefaults(
   defineProps<{
-    value?: string;
+    value?: boolean;
     disabled?: boolean;
   }>(),
   {
@@ -25,8 +27,14 @@ const props = withDefaults(
 );
 const emit = defineEmits(["update:value"]);
 
-function handleChange(v: string) {
+const valueStr = computed(() => {
+  let res: undefined | boolean | string = props.value ?? undefined;
+  if (typeof res === "boolean") res = props.value + "";
+  return res as undefined | string;
+});
+
+function handleChange(v: undefined | string) {
   // console.log(v);
-  emit("update:value", v);
+  emit("update:value", typeof v === "undefined" ? v : JSON.parse(v));
 }
 </script>

+ 1 - 1
src/features/rootOrg/RootOrg.vue

@@ -91,7 +91,7 @@ store.currentLocation = "基础管理 / 顶级机构管理";
 
 let code = $ref("");
 let name = $ref("");
-let enable = $ref(undefined as undefined | string);
+let enable = $ref(undefined as undefined | boolean);
 
 let data = $ref([]);
 let pageSize = $ref(10);

+ 1 - 1
src/features/subOrg/SubOrg.vue

@@ -138,7 +138,7 @@ store.currentLocation = "基础管理 / 机构管理";
 let rootOrgId = $ref("");
 let code = $ref("");
 let name = $ref("");
-let enable = $ref(undefined as undefined | string);
+let enable = $ref(undefined as undefined | boolean);
 
 let data = $ref([]);
 let pageSize = $ref(10);