pengjingzhao 1 week ago
parent
commit
e2599705e2
2 changed files with 49 additions and 37 deletions
  1. 6 0
      src/api/public-api.js
  2. 43 37
      src/components/system/staff-select/SystemStaffSelect.vue

+ 6 - 0
src/api/public-api.js

@@ -175,6 +175,12 @@ export function getPersonnelAll() {
     method: "get",
   });
 }
+export function getStaffHaveYbCode() {
+  return request({
+    url: "/publicApi/getStaffHaveYbCode",
+    method: "get",
+  });
+}
 
 export function getItemDrug(code) {
   return request({

+ 43 - 37
src/components/system/staff-select/SystemStaffSelect.vue

@@ -1,77 +1,83 @@
 <script lang="ts">
 import CyComboGridProps from "@/components/cy/combo-grid/src/CyComboGridProps";
-import {useVModel} from "@vueuse/core/index";
+import { useVModel } from "@vueuse/core/index";
 import CyComboGrid from "@/components/cy/combo-grid/src/CyComboGrid.vue";
 import XEUtils from "xe-utils";
-import {defineComponent} from "vue";
-import {getPersonnelAll} from "@/api/public-api";
+import { defineComponent } from "vue";
+import { getStaffHaveYbCode } from "@/api/public-api";
 
-const staffSelect = ref<any[]>([])
+const staffSelect = ref<any[]>([]);
 
-getPersonnelAll().then(res => {
+getStaffHaveYbCode().then(res => {
   // @ts-ignore
-  staffSelect.value = res
-})
+  staffSelect.value = res;
+});
 
 export default defineComponent({
-  name: 'SystemStaffSelect',
-  components: {CyComboGrid},
+  name: "SystemStaffSelect",
+  components: { CyComboGrid },
   props: {
     ...CyComboGridProps,
     tableHeader: {
       type: Array,
       default: () => [
-        {code: 'codeRs', name: '工号', width: '50px'},
-        {code: 'label', name: '名称', width: '80px'},
-        {code: 'deptCodeName', name: '科室', width: '90px'},
-        {code: 'title', name: '职称', width: '90px'},
-      ]
+        { code: "codeRs", name: "工号", width: "50px" },
+        { code: "label", name: "名称", width: "80px" },
+        { code: "deptCodeName", name: "科室", width: "90px" },
+        { code: "title", name: "职称", width: "90px" },
+      ],
     },
     filterSpecifiedEncoding: {
       type: Array,
-      default: () => []
-    }
+      default: () => [],
+    },
   },
-  emits: [
-    'update:modelValue'
-  ],
-  setup(props, {emit}) {
-    const mValue = useVModel(props, 'modelValue', emit)
+  emits: ["update:modelValue"],
+  setup(props, { emit }) {
+    const mValue = useVModel(props, "modelValue", emit);
 
     const tempData = computed(() => {
       if (props.filterSpecifiedEncoding?.length > 0) {
-        return staffSelect.value.filter(item => props.filterSpecifiedEncoding?.includes(item.value))
+        return staffSelect.value.filter(item =>
+          props.filterSpecifiedEncoding?.includes(item.value)
+        );
       }
-      return staffSelect.value
-    })
+      return staffSelect.value;
+    });
 
     const tempBind = computed(() => {
-      const temp: any = {}
+      const temp: any = {};
       for (const key in props) {
         if (XEUtils.has(CyComboGridProps, key)) {
           // @ts-ignore
-          temp[key] = props[key]
+          temp[key] = props[key];
         }
       }
-      return temp
-    })
+      return temp;
+    });
 
     return {
       tempBind,
       tempData,
-      mValue
-    }
+      mValue,
+    };
   },
-})
-
+});
 </script>
 
-
 <template>
   <CyComboGrid
-      v-bind="tempBind"
-      :local-search-key="['codeRs','pyCode', 'dcode', 'code', 'name', 'value', 'label']"
-      :data="tempData"
-      v-model="mValue"
+    v-bind="tempBind"
+    :local-search-key="[
+      'codeRs',
+      'pyCode',
+      'dcode',
+      'code',
+      'name',
+      'value',
+      'label',
+    ]"
+    :data="tempData"
+    v-model="mValue"
   />
 </template>