meixioacomponent 2.0.37 → 2.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,185 @@
1
+ <template>
2
+ <div class="base-area-select-wrap">
3
+ <t-cascader
4
+ ref="cascader"
5
+ :keys="{
6
+ value:'code',
7
+ label:'name',
8
+ children: 'children',
9
+ }"
10
+ :load="load"
11
+ :options="options"
12
+ :disabled="disable||loading"
13
+ :size="componentSize" @change="onChange"
14
+ :placeholder="placeholder"
15
+ :input-props="inputProps"
16
+ v-model="localValue">
17
+ </t-cascader>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import baseButtonHandleVue from '../baseButtonHandle/baseButtonHandle.vue'
23
+ import {GetAreaTree} from "./api";
24
+ import areaConfig from "./areaConfig";
25
+ import {TransomComponentSize} from "../../../utils/utils";
26
+ //
27
+
28
+ export default {
29
+ name: 'baseArea',
30
+ data() {
31
+ return {
32
+ loading: false,
33
+ localValue: [],
34
+ localDetailValue: {},
35
+ placeholder: '请选择省市区镇',
36
+ options: [],
37
+ inputProps: {
38
+ value: '',
39
+ },
40
+ }
41
+ },
42
+ created() {
43
+ },
44
+
45
+ mounted() {
46
+ this.loadArea('').then(res => {
47
+ this.options = res;
48
+ })
49
+ },
50
+
51
+ props: {
52
+ value: {
53
+ default: null,
54
+ },
55
+ disable: {
56
+ type: Boolean,
57
+ default: false,
58
+ },
59
+ size: {type: String, default: 'small'}
60
+ },
61
+
62
+ components: {
63
+ baseButtonHandleVue,
64
+ },
65
+ computed: {
66
+ module: {
67
+ set(val) {
68
+ this.$emit('input', val)
69
+ },
70
+ get() {
71
+ return this.$props.value
72
+ },
73
+ },
74
+ componentSize() {
75
+ return TransomComponentSize(this.$props.size);
76
+ }
77
+
78
+ },
79
+ methods: {
80
+ init() {
81
+ if (this.module) {
82
+ const {province, city, district, town} = this.module;
83
+ this.inputProps.value = `${province}/${city}/${district}`
84
+ if (town) {
85
+ this.inputProps.value += `/${town}`
86
+ this.localValue = [province, city, district, town]
87
+ } else {
88
+ this.localValue = [province, city, district]
89
+ }
90
+ this.localDetailValue = {
91
+ province,
92
+ city,
93
+ district,
94
+ town
95
+ }
96
+ }
97
+ },
98
+ load(node) {
99
+ const {value} = node;
100
+ return new Promise((resolve) => {
101
+ this.loadArea(value).then(res => {
102
+ resolve(res);
103
+ })
104
+ })
105
+ },
106
+
107
+ loadArea(keyword) {
108
+ return new Promise((resolve) => {
109
+ this.loading = true;
110
+ GetAreaTree({
111
+ keyword: keyword
112
+ }).then(res => {
113
+ if (Array.isArray(res)) {
114
+ res.forEach(item => {
115
+ item[`children`] = item.level !== 4;
116
+ })
117
+ this.loading = false;
118
+ resolve(res);
119
+ } else {
120
+ resolve([]);
121
+ }
122
+ })
123
+ })
124
+ },
125
+ onChange() {
126
+ this.inputProps.value = '';
127
+ this.$nextTick(() => {
128
+ const list = this.$refs.cascader.panels;
129
+ list.forEach(itemList => {
130
+ this.onAreaChange(itemList)
131
+ })
132
+ const _value = {
133
+ ...this.localDetailValue,
134
+ }
135
+ this.$emit('confirmAreaValue', _value)
136
+ this.module = _value;
137
+ console.log(this.localValue);
138
+ })
139
+ },
140
+ onAreaChange(list) {
141
+ try {
142
+ let index = null;
143
+ for (let i = 0; i < list.length; i++) {
144
+ const item = list[i];
145
+ if (item.indeterminate || item.checked) {
146
+ index = i;
147
+ }
148
+ }
149
+ const value = list[index];
150
+ const {data} = value;
151
+ const {name, code, level} = data;
152
+ if (!level) return;
153
+ if (!this.localDetailValue[`idList`]) {
154
+ this.localDetailValue[`idList`] = [0, 0, 0, 0];
155
+ }
156
+ this.localDetailValue[`${areaConfig[level - 1].value}`] = name;
157
+ this.localDetailValue[`idList`][level - 1] = code;
158
+ console.log(this.localDetailValue);
159
+ } catch (error) {
160
+ console.log(error);
161
+ }
162
+ },
163
+ },
164
+ watch: {
165
+ module: {
166
+ deep: true,
167
+ handler() {
168
+ this.$nextTick(() => {
169
+ this.init();
170
+ })
171
+ }
172
+ }
173
+ }
174
+ }
175
+ </script>
176
+
177
+ <style lang="less" scoped>
178
+ .base-area-select-wrap {
179
+ width: 100%;
180
+ height: auto;
181
+ overflow: hidden;
182
+ border-radius: calc(var(--radius) * 2);
183
+ }
184
+
185
+ </style>
@@ -1,5 +1,4 @@
1
- import baseArea from "./baseArea.vue";
2
-
1
+ import baseArea from "./baseAreaV2.vue";
3
2
  baseArea.install = function (Vue) {
4
3
  Vue.component(baseArea.name, baseArea);
5
4
  };
@@ -127,7 +127,7 @@
127
127
 
128
128
  <script>
129
129
  import pro_form_itemVue from './proFormItem/pro_form_item.vue'
130
- import baseAreaVue from '../../base/baseArea/baseArea.vue'
130
+ import baseAreaVue from '../../base/baseArea/baseAreaV2.vue'
131
131
  import baseUploadVue from '../../base/baseUpload/baseUpload.vue'
132
132
  import pro_formItem_skeletonVue from './pro_form-item_skeleton.vue'
133
133
  import baseButtonHandleVue from '../../base/baseButtonHandle/baseButtonHandle.vue'
@@ -21,6 +21,7 @@
21
21
  <!-- </basePopoverButton>-->
22
22
 
23
23
  <base-pagination
24
+ :page-sizes="pageSizes"
24
25
  :config="pageConfig"
25
26
  :pageProps="pageProps"
26
27
  @currentChange="currentChange"
@@ -50,6 +51,10 @@ export default {
50
51
  pageConfig: {
51
52
  type: Object,
52
53
  },
54
+ pageSizes: {
55
+ type: Array,
56
+ default: () => [15, 30, 60, 100, 200, 300],
57
+ },
53
58
  },
54
59
  components: {
55
60
  basePopoverButton,
@@ -97,8 +97,6 @@
97
97
  >
98
98
 
99
99
 
100
-
101
-
102
100
  <template #expanded-row="{row}" v-if="expandId">
103
101
  <slot name="expandedRow" :scope="row"></slot>
104
102
  </template>
@@ -193,6 +191,7 @@
193
191
  class="oa-pro-table-footer"
194
192
  >
195
193
  <oa_pro_footerVue
194
+ :page-sizes="pageSizes"
196
195
  :pageConfig="pageConfig"
197
196
  :pageProps="pageProps"
198
197
  :totalList="totalList"
@@ -510,16 +509,20 @@ export default {
510
509
  default: false
511
510
  },
512
511
 
513
- expandId:{
514
- type:String,
515
- default:null
512
+ expandId: {
513
+ type: String,
514
+ default: null
516
515
  },
517
516
  rowspanAndColspan: {
518
517
  type: Function,
519
518
  default: () => {
520
519
  return null
521
520
  }
522
- }
521
+ },
522
+ pageSizes: {
523
+ type: Array,
524
+ default: () => [15, 30, 60, 100, 200, 300],
525
+ },
523
526
  },
524
527
  computed: {
525
528
  checkType() {
@@ -630,8 +633,8 @@ export default {
630
633
  },
631
634
  mixins: [tableSectionMixins],
632
635
  methods: {
633
- rehandleExpandChange(value,params){
634
- this.$emit('rehandleExpandChange',value)
636
+ rehandleExpandChange(value, params) {
637
+ this.$emit('rehandleExpandChange', value)
635
638
  },
636
639
  isToolTip(value) {
637
640
  if (!value) {
@@ -903,11 +906,17 @@ export default {
903
906
  }
904
907
 
905
908
  result[`keyword`] = this.module;
906
- if(this.sort[`sortBy`]){
907
- result[`sortField`] = this.sort?.sortBy;
908
- result[`sortOrder`] = this.sort?.descending ? 'desc' : 'asc';
909
+ try {
910
+ if (this.sort[`sortBy`]) {
911
+ result[`sortField`] = this.sort?.sortBy;
912
+ result[`sortOrder`] = this.sort?.descending ? 'desc' : 'asc';
913
+ }
914
+ } catch (error) {
915
+ result[`sortField`] = null;
916
+ result[`sortOrder`] = '';
909
917
  }
910
918
 
919
+
911
920
  // 高级筛选的结果
912
921
  const searchList = [];
913
922