From 4fbeee3784d4be5483ed7ec9e00a875d66bc9ed0 Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期二, 20 二月 2024 16:09:40 +0800 Subject: [PATCH] 11 --- src/views/project/components/orgselect/index.vue | 89 +++++++++++++++++++++++--------------------- 1 files changed, 47 insertions(+), 42 deletions(-) diff --git a/src/views/project/components/orgselect/index.vue b/src/views/project/components/orgselect/index.vue index cc71e07..a0d2660 100644 --- a/src/views/project/components/orgselect/index.vue +++ b/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> -- Gitblit v1.9.3