bri-components 1.5.16 → 1.5.18

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bri-components",
3
- "version": "1.5.16",
3
+ "version": "1.5.18",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "ali-oss": "^6.13.1",
34
34
  "axios": "^0.23.0",
35
- "bri-datas": "^1.4.3",
35
+ "bri-datas": "^1.4.4",
36
36
  "jshint": "^2.12.0",
37
37
  "jsonlint": "^1.6.3",
38
38
  "minio": "7.1.0",
@@ -0,0 +1,269 @@
1
+ <template>
2
+ <div class="DshSelectAll">
3
+ <Dropdown
4
+ style="width: 100%;"
5
+ v-clickoutside="clickCancel"
6
+ trigger="custom"
7
+ :visible="showModal"
8
+ :placement="'bottom-start'"
9
+ :transfer="true"
10
+ :transfer-class-name="`DshSelectAll-down ${selfPropsObj._transferClassName}`"
11
+ :stop-propagation="true"
12
+ :events-enabled="true"
13
+ >
14
+ <div class="DshSelectAll-input" @click="clickInput">
15
+ <div v-if="inputData.length" class="DshSelectAll-input-selected dsh-ellipsis">
16
+ <Tag
17
+ v-for="(item, index) in inputData"
18
+ :key="item._key"
19
+ closable
20
+ @on-close="clickDelete(item, index)"
21
+ >
22
+ {{ item.name }}
23
+ </Tag>
24
+ </div>
25
+ <Input
26
+ v-if="!selfPropsObj._disabled"
27
+ v-model="searchName"
28
+ :placeholder="selfPropsObj._placeholder"
29
+ :clearable="selfPropsObj._clearable"
30
+ :size="selfPropsObj._size"
31
+ ></Input>
32
+ </div>
33
+ <DropdownMenu slot="list">
34
+ <!-- 用了transfer="true",防止点击面板冒泡关闭 -->
35
+ <div class="DshSelectAll-down-box" @click.stop="0">
36
+ <div class="DshSelectAll-down-all">
37
+ <Checkbox
38
+ :indeterminate="indeterminate"
39
+ :value="checkAll"
40
+ @click.prevent.native="handleCheckAll"
41
+ >全选</Checkbox>
42
+ </div>
43
+ <CheckboxGroup v-model="checkAllGroup" @on-change="checkAllGroupChange">
44
+ <div
45
+ v-for="dataItem in dropDownData"
46
+ :key="dataItem._key">
47
+ <Checkbox :label="dataItem._key">
48
+ <span>{{ dataItem._name || dataItem.name }}</span>
49
+ </Checkbox>
50
+ </div>
51
+ </CheckboxGroup>
52
+
53
+ <dsh-buttons
54
+ class="DshSelectAll-down-footer"
55
+ :list="$getOperationList(['canCancel', 'canConfirm'])"
56
+ @click="$dispatchEvent($event)"
57
+ ></dsh-buttons>
58
+ </div>
59
+ </DropdownMenu>
60
+ </Dropdown>
61
+ </div>
62
+ </template>
63
+
64
+ <script>
65
+ export default {
66
+ name: "DshSelectAll",
67
+ data () {
68
+ return {
69
+ showModal: false,
70
+ searchName: "",
71
+
72
+ indeterminate: true,
73
+ checkAll: false,
74
+ checkAllGroup: [],
75
+
76
+ operationMap: {
77
+ canCancel: {
78
+ name: "取消",
79
+ type: "canCancel",
80
+ btnType: "text",
81
+ size: "small",
82
+ event: "clickCancel"
83
+ },
84
+ canConfirm: {
85
+ name: "确认",
86
+ type: "canConfirm",
87
+ btnType: "primary",
88
+ size: "small",
89
+ event: "clickConfirm"
90
+ }
91
+ }
92
+ };
93
+ },
94
+ props: {
95
+ value: {
96
+ type: Object,
97
+ default () {
98
+ return {};
99
+ }
100
+ },
101
+ propsObj: {
102
+ type: Object,
103
+ default () {
104
+ return {};
105
+ }
106
+ }
107
+ },
108
+ computed: {
109
+ compKey () {
110
+ return this.propsObj.compKey;
111
+ },
112
+ appKey () {
113
+ return this.propsObj.appKey;
114
+ },
115
+ selfPropsObj () {
116
+ return {
117
+ ...this.propsObj,
118
+ _data: this.propsObj._data || [],
119
+ _showData: this.propsObj._showData || [],
120
+ _placeholder: `请选择${this.propsObj._name}`
121
+ };
122
+ },
123
+ dropDownData () {
124
+ const _data = this.selfPropsObj._data.filter(item => item._key);
125
+ const _showData = this.selfPropsObj._showData.filter(item => item._key);
126
+ let dropShowData = _data.filter(item => item.name.indexOf(this.searchName) > -1);
127
+ if (dropShowData.length > 20) {
128
+ dropShowData.slice(0, 20);
129
+ }
130
+ return this.searchName ? dropShowData : _showData;
131
+ },
132
+ inputData () {
133
+ return this.selfPropsObj._data.filter(item => this.value[this.propsObj._key].includes(item._key));
134
+ },
135
+ inputStr () {
136
+ return this.inputData.map(item => item._name || item.name).join("、");
137
+ }
138
+ },
139
+ created () {
140
+ this.init();
141
+ },
142
+ methods: {
143
+ init () {
144
+ this.clickCancel(); // 加载先赋值
145
+ },
146
+ openModal () {
147
+ this.showModal = true;
148
+ },
149
+ closeModal () {
150
+ this.searchName = "";
151
+ this.showModal = false;
152
+ },
153
+ clickInput (e) {
154
+ if (!this.selfPropsObj._disabled) {
155
+ this.openModal();
156
+ } else {
157
+ e.stopPropagation();
158
+ }
159
+ },
160
+ clickDelete (item, index) {
161
+ this.value[this.propsObj._key].splice(index, 1);
162
+ this.checkAllGroup = this.value[this.propsObj._key];
163
+ this.$emit("change", this.value[this.propsObj._key]);
164
+ },
165
+
166
+ clickCancel () {
167
+ if (this.value[this.propsObj._key] && this.value[this.propsObj._key].length) {
168
+ this.checkAllGroup = this.value[this.propsObj._key];
169
+ }
170
+ this.closeModal();
171
+ },
172
+ clickConfirm () {
173
+ this.value[this.propsObj._key] = this.checkAllGroup;
174
+ this.closeModal();
175
+ this.$emit("change", this.value[this.propsObj._key]);
176
+ },
177
+
178
+ handleCheckAll () {
179
+ if (this.indeterminate) {
180
+ this.checkAll = false;
181
+ } else {
182
+ this.checkAll = !this.checkAll;
183
+ }
184
+ this.indeterminate = false;
185
+
186
+ if (this.checkAll) {
187
+ this.checkAllGroup = this.dropDownData.map(item => item._key);
188
+ } else {
189
+ this.checkAllGroup = [];
190
+ }
191
+ },
192
+ checkAllGroupChange (data) {
193
+ if (data.length === this.dropDownData.length) {
194
+ this.indeterminate = false;
195
+ this.checkAll = true;
196
+ } else if (data.length > 0) {
197
+ this.indeterminate = true;
198
+ this.checkAll = false;
199
+ } else {
200
+ this.indeterminate = false;
201
+ this.checkAll = false;
202
+ }
203
+ }
204
+ }
205
+ };
206
+ </script>
207
+
208
+ <style lang="less">
209
+ .DshSelectAll {
210
+ &-input {
211
+ background-color: #FFF;
212
+ padding: 0 6px;
213
+ display: flex;
214
+ align-items: center;
215
+ border: 1px solid #dcdee2;
216
+ input::placeholder{
217
+ color: #666;
218
+ }
219
+ &-selected {
220
+
221
+ }
222
+
223
+ .ivu-input-wrapper {
224
+ flex: 1;
225
+ min-width: 20%;
226
+
227
+ .ivu-input {
228
+ height: 30px;
229
+ border: none;
230
+
231
+ &:focus {
232
+ box-shadow: none;
233
+ }
234
+ }
235
+ }
236
+ .ivu-tag-text{
237
+ color: #000;
238
+ }
239
+ .ivu-tag .ivu-icon-ios-close{
240
+ color: #000;
241
+ opacity: 1;
242
+ }
243
+ }
244
+ &-down {
245
+ &-box {
246
+ width: 100%;
247
+ max-height: 300px;
248
+ padding: 10px 16px;
249
+ display: flex;
250
+ flex-direction: column;
251
+
252
+ .ivu-checkbox {
253
+ margin-right: 10px;
254
+ }
255
+ .ivu-checkbox-group {
256
+ flex: 1;
257
+ overflow: auto;
258
+ }
259
+ }
260
+
261
+ &-footer {
262
+ border-top: 1px solid #ccc;
263
+ margin-top: 10px;
264
+ padding-top: 10px;
265
+ text-align: right;
266
+ }
267
+ }
268
+ }
269
+ </style>
@@ -25,6 +25,7 @@ const componentNameMap = {
25
25
 
26
26
  switch: "DshSwitch",
27
27
  select: "DshSelect",
28
+ selectAll: "DshSelectAll",
28
29
  checkbox: "DshCheckbox",
29
30
  region: "DshCascader",
30
31
  regions: "DshCascader",
@@ -46,6 +47,7 @@ const componentNameMap = {
46
47
  themeColor: "DshThemeColor",
47
48
  themeIcon: "DshThemeIcon",
48
49
  color: "DshColor",
50
+ correlation: "DshCorrelation",
49
51
 
50
52
  back: "DshBack",
51
53
  undefined: "DshUndeveloped",
@@ -75,7 +77,8 @@ const pathMap = {
75
77
  DshLabels: "./senior/DshLabels.vue",
76
78
  DshPackage: "./senior/DshPackage.vue",
77
79
  flatTable: "./senior/flatTable.vue",
78
- cascaderTable: "./senior/cascaderTable"
80
+ cascaderTable: "./senior/cascaderTable",
81
+ DshCorrelation: "./senior/correlation"
79
82
  },
80
83
  extra: {
81
84
  DshThemeColor: "./extra/DshThemeColor.vue",
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <div class="correlation">
3
+ <dsh-form
4
+ :formData="formData[propsObj._key]"
5
+ :formList="formList"
6
+ :rowStyle="{height: undefined}"
7
+ @change="change"
8
+ ></dsh-form>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ name: "correlation",
15
+ props: {
16
+ canEdit: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ value: {
21
+ type: Object,
22
+ default () {
23
+ return {};
24
+ }
25
+ },
26
+ propsObj: {
27
+ type: Object,
28
+ default () {
29
+ return {};
30
+ }
31
+ }
32
+ },
33
+ data () {
34
+ return {
35
+ fieldMap: this.$modFieldMap,
36
+ dataMap: {}
37
+ };
38
+ },
39
+ computed: {
40
+ formList () {
41
+ let _span = 12;
42
+ if (this.propsObj._fieldCount) {
43
+ switch (this.propsObj._fieldCount) {
44
+ case 1: _span = 24; break;
45
+ case 2: _span = 12; break;
46
+ case 3: _span = 8; break;
47
+ case 4: _span = 6; break;
48
+ case 6: _span = 4; break;
49
+ default: _span = 12;
50
+ }
51
+ } else if (this.propsObj._subForm) {
52
+ switch (this.propsObj._subForm.length) {
53
+ case 1: _span = 24; break;
54
+ case 2: _span = 12; break;
55
+ case 3: _span = 8; break;
56
+ case 4: _span = 6; break;
57
+ default: _span = 12;
58
+ }
59
+ }
60
+
61
+ let list = this.propsObj._subForm ? this.propsObj._subForm.map(item => {
62
+ const data = this.dataMap[item._key] ? [...this.dataMap[item._key]] : [];
63
+ const dataKeys = data.map(item => item._key);
64
+ let showData = [ ...data ];
65
+ if (data.length > 2000) {
66
+ showData = showData.slice(0, 2000);
67
+ }
68
+ if (item._type === "text" && Object.keys(this.dataMap).length) {
69
+ // eslint-disable-next-line
70
+ this.formData[this.propsObj._key][item._key] = this.formData[this.propsObj._key][item._key].filter(item => dataKeys.includes(item));
71
+ }
72
+
73
+ return {
74
+ ...item,
75
+ _type: item._type === "number" ? "number" : item._type === "date"
76
+ ? "daterange" : "selectAll",
77
+ inSearch: item._type === "number" ? true : undefined,
78
+ _span: _span,
79
+ _noLabel: this.propsObj._noLabel,
80
+ _data: data,
81
+ _showData: showData
82
+ };
83
+ }) : [];
84
+ return list;
85
+ },
86
+ formData () {
87
+ let obj = { ...this.value[this.propsObj._key] };
88
+ this.propsObj._fields && this.propsObj._fields.forEach(item => {
89
+ if (!obj[item] || !obj[item].length) {
90
+ obj[item] = [];
91
+ }
92
+ });
93
+ this.$set(this.value, this.propsObj._key, obj);
94
+ // 设置控件默认值为[]
95
+ if (!this.value[this.propsObj._key]) {
96
+ this.$set(this.value, this.propsObj._key, {});
97
+ }
98
+ return this.value;
99
+ }
100
+ },
101
+ created () {
102
+ if (this.propsObj._dataTableKey) {
103
+ this.getDataMap();
104
+ }
105
+ },
106
+ methods: {
107
+ getDataMap () {
108
+ this.$https({
109
+ url: {
110
+ module: "sheet",
111
+ name: "getReferenceFilterDetail"
112
+ },
113
+ params: {
114
+ filterFormData: this.formData[this.propsObj._key],
115
+ filterFormEntity: {
116
+ selectEntity: this.propsObj._dataTableKey,
117
+ selectEntityField: this.propsObj._fields
118
+ },
119
+ dashboardKey: this.$route.params._key
120
+ },
121
+ callback: data => {
122
+ this.dataMap = data;
123
+ }
124
+ });
125
+ },
126
+ change (formItem, value) {
127
+ this.getDataMap();
128
+ }
129
+ }
130
+ };
131
+ </script>
132
+
133
+ <style lang="less" scoped></style>
package/src/index.js CHANGED
@@ -27,6 +27,7 @@ import DshControlInput from "./components/controls/DshControlInput.vue";
27
27
  import DshInput from "./components/controls/base/DshInput/DshInput.vue";
28
28
  import DshNumber from "./components/controls/base/DshNumber/DshNumber.vue";
29
29
  import DshSelect from "./components/controls/base/DshSelect/DshSelect.vue";
30
+ import DshSelectAll from "./components/controls/base/DshSelect/DshSelectAll.vue";
30
31
  import DshCheckbox from "./components/controls/base/DshSelect/DshCheckbox.vue";
31
32
  import DshCascader from "./components/controls/base/DshCascader/DshCascader.vue";
32
33
 
@@ -128,6 +129,7 @@ const map = {
128
129
  DshInput,
129
130
  DshNumber,
130
131
  DshSelect,
132
+ DshSelectAll,
131
133
  DshCheckbox,
132
134
  DshCascader,
133
135
 
@@ -212,6 +214,7 @@ export {
212
214
  DshInput,
213
215
  DshNumber,
214
216
  DshSelect,
217
+ DshSelectAll,
215
218
  DshCheckbox,
216
219
  DshCascader,
217
220