11
WXL
2024-02-20 4fbeee3784d4be5483ed7ec9e00a875d66bc9ed0
src/views/project/components/orgselect/index.vue
@@ -1,5 +1,5 @@
<template>
  <div>
  <div class="selectclass">
    <el-select
      v-model="myValue"
      :loading="isLoading"
@@ -33,7 +33,7 @@
</template>
<script>
import { listOrganization,listReportname } from "@/api/project/organization";
import { listOrganization, listReportname } from "@/api/project/organization";
export default {
  name: "OrgSelecter",
@@ -41,66 +41,66 @@
  props: {
    //Select基础属性
    value: {
      type: [String, Array],
      type: [String, Array]
    },
    disabled: {
      type: Boolean,
      default: false,
      default: false
    },
    clearable: {
      type: Boolean,
      default: false,
      default: false
    },
    filterable: {
      type: Boolean,
      default: true,
      default: true
    },
    multiple: {
      type: Boolean,
      default: false,
      default: false
    },
    multipleLimit: {
      type: Number,
      default: 0,
      default: 0
    },
    defaultFirstOption: {
      type: Boolean,
      default: true,
      default: true
    },
    size: {
      type: String,
      default: "small",
      default: "small"
    },
    placeholder: {
      type: String,
      default: "",
      default: ""
    },
    //业务属性
    lazyLoad: {
      type: Boolean,
      default: false,
      default: false
    },
    isAll: {
      type: Boolean,
      default: false,
      default: false
    },
    //机构类型
    orgType: {
      type: String,
      default: "",
    },
      default: ""
    }
  },
  data() {
    return {
      pageData: { pageNum:1,pageSize:100 },
      pageData: { pageNum: 1, pageSize: 100 },
      isLoading: false,
      dataList: [],
      tempList: [],
      myValue: this.multiple ? [] : "",
      focusEvents: {
        func: () => {},
        loaded: false,
      },
        loaded: false
      }
    };
  },
  mounted() {
@@ -120,7 +120,6 @@
    }
  },
  methods: {
    renderSelecter() {
      this.pageData.PageSize = 100;
      this.dataList = [];
@@ -132,28 +131,28 @@
    //获取数据
    getdataList() {
      this.isLoading = true;
      let searchData={
          organizationtype:this.orgType,//传入的类型
          pageNum:1,
          pageSize:100000
      };//搜索条件
      let searchData = {
        organizationtype: this.orgType, //传入的类型
        pageNum: 1,
        pageSize: 100000
      }; //搜索条件
      let userType={"userType":"1"};
      let userType = { userType: "1" };
      listOrganization(searchData)
        .then((response) => {
        .then(response => {
          this.dataList.push(...response.rows);
          if (this.isAll) {
            let all = {
              organizationid: "",
              organizationname: "全部",
              organizationname: "全部"
            };
            this.dataList.unshift(all);
          }
          this.tempList = this.dataList.map(item=>item);
          this.tempList = this.dataList.map(item => item);
          this.focusEvents.loaded = true;
        })
        .catch((error) => {
        .catch(error => {
          // 暂无处理
        })
        .finally(() => {
@@ -163,10 +162,10 @@
    getOptionByValue(key) {
      let outValue = null;
      this.dataList.forEach((e) => {
          if (e.organizationid == key) {
            outValue = e;
          }
      this.dataList.forEach(e => {
        if (e.organizationid == key) {
          outValue = e;
        }
      });
      return outValue;
@@ -175,7 +174,7 @@
    filterMethod(val) {
      this.myValue = val;
      if (val) {
        this.dataList = this.tempList.filter((item) => {
        this.dataList = this.tempList.filter(item => {
          if (
            (item.PYM &&
              !!~item.PYM.toUpperCase().indexOf(val.toUpperCase())) ||
@@ -190,7 +189,7 @@
          }
        });
      } else {
        this.dataList = this.tempList.map(item=>item);
        this.dataList = this.tempList.map(item => item);
      }
    },
    focus() {
@@ -211,20 +210,20 @@
    defaultInit(defaultItem, defaultItemName) {
      if (defaultItem && defaultItemName) {
        let list = this.dataList.filter(
          (r) =>
          r =>
            r.organizationid == defaultItem &&
            r.organizationname == defaultItemName
        );
        if (list.length == 0) {
          let data = {
            organizationname: defaultItemName,
            organizationid: defaultItem,
            organizationid: defaultItem
          };
          this.dataList.push(data);
        }
      }
      this.tempList = this.dataList.map(item=>item);
    },
      this.tempList = this.dataList.map(item => item);
    }
  },
  computed: {},
  watch: {
@@ -235,9 +234,15 @@
    myValue(newVal) {
      this.$emit("input", newVal);
      this.$emit("change", newVal);
    },
  },
    }
  }
};
</script>
<style></style>
<style lang="scss" scoped>
::v-deep.selectclass .el-select {
  display: inline-block;
  position: relative;
  width: 90%;
}
</style>