bri-components 1.2.5 → 1.2.7

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.2.5",
3
+ "version": "1.2.7",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "axios": "^0.23.0",
34
+ "ali-oss": "^6.13.1",
34
35
  "bri-datas": "^1.0.8-0",
35
36
  "jshint": "^2.12.0",
36
37
  "minio": "^7.0.26",
@@ -1,7 +1,8 @@
1
1
  import axios from "axios";
2
-
2
+ import Oss from "ali-oss";
3
3
  const minio = require("minio");
4
4
  const stream = require("stream");
5
+
5
6
  export default {
6
7
  props: {
7
8
  groupKey: {
@@ -150,7 +151,7 @@ export default {
150
151
  callbackBodyType: "application/json",
151
152
  callbackBody: this.transferCallBody(callbackBody)
152
153
  };
153
- new this.$aliOss(res.ossConfig).multipartUpload(remoteName, file, {
154
+ new Oss(res.ossConfig).multipartUpload(remoteName, file, {
154
155
  progress: (percentage) => {
155
156
  this.inProgress(Number((percentage * 100).toFixed(0)));
156
157
  this.handleProgress && this.handleProgress(percentage, file);
@@ -291,7 +292,7 @@ export default {
291
292
  refreshSTSTokenInterval: 3600 * 1000
292
293
  };
293
294
 
294
- new this.$aliOss(newOss).multipartUpload(remoteName, file, {
295
+ new Oss(newOss).multipartUpload(remoteName, file, {
295
296
  progress: (percentage) => {
296
297
  this.inProgress(Number((percentage * 100).toFixed(0)));
297
298
  this.handleProgress && this.handleProgress(percentage, file);
@@ -20,7 +20,7 @@
20
20
  </div>
21
21
 
22
22
  <!-- 图标 -->
23
- <template>
23
+ <template v-if="canEdit">
24
24
  <Icon
25
25
  v-if="!$isEmptyData(curVal) && selfPropsObj._clearable && isHover"
26
26
  class="icon-close"
@@ -166,6 +166,12 @@
166
166
  numbers: [1],
167
167
  dateTypes: ["date", "datetime", "daterange", "datetimerange"]
168
168
  },
169
+ {
170
+ _key: "last_month_start",
171
+ name: "上月初",
172
+ numbers: [0],
173
+ dateTypes: ["month", "date", "datetime", "daterange", "datetimerange"]
174
+ },
169
175
  {
170
176
  _key: "dyn_month_start",
171
177
  name: "月初",
@@ -5,7 +5,7 @@
5
5
  <Input
6
6
  class="DshInput-edit"
7
7
  v-model="value[controlKey]"
8
- :type="subType"
8
+ :type="inputType"
9
9
  :placeholder="selfPropsObj._placeholder"
10
10
  :readonly="selfPropsObj._readonly"
11
11
  :disabled="!finalCanEdit || selfPropsObj._disabled"
@@ -38,7 +38,7 @@
38
38
  <!-- 查看 -->
39
39
  <template v-else>
40
40
  <!-- 查看页 的textarea单独处理 -->
41
- <template v-if="!isUnitShow && subType === 'textarea' && !$isEmptyData(curVal)">
41
+ <template v-if="inputType === 'textarea' && !$isEmptyData(curVal) && !isUnitShow">
42
42
  <p
43
43
  class="DshInput-show-textarea"
44
44
  v-text="showVal"
@@ -57,7 +57,19 @@
57
57
  'DshInput-unit': isUnitShow,
58
58
  'DshInput-show': !isUnitShow
59
59
  }">
60
- {{ showVal }}
60
+ <!-- 有值 -->
61
+ <a
62
+ v-if="inputType === 'url' && !$isEmptyData(curVal)"
63
+ class="text"
64
+ @click="goHttpWindow($event)"
65
+ >
66
+ {{ showVal }}
67
+ </a>
68
+
69
+ <!-- 无值 -->
70
+ <template v-else>
71
+ {{ showVal }}
72
+ </template>
61
73
  </div>
62
74
  </bri-tooltip>
63
75
  </template>
@@ -82,8 +94,9 @@
82
94
  computed: {
83
95
  selfPropsObj () {
84
96
  return {
85
- _readonly: ["serialNumber"].includes(this.propsObj._type),
86
- // _disabled: ["serialNumber"].includes(this.propsObj._type),
97
+ _textType: "default",
98
+ _readonly: ["serialNumber"].includes(this.controlType),
99
+ _disabled: ["serialNumber"].includes(this.controlType),
87
100
  _showWordLimit: this.propsObj._showWordLimit || (!!this.propsObj._maxlength || this.propsObj._maxlength === 0),
88
101
  _autosize: {
89
102
  minRows: 2
@@ -93,12 +106,18 @@
93
106
  ...this.commonDealPropsObj
94
107
  };
95
108
  },
109
+ inputType () {
110
+ return ["textarea", "password", "email", "url", "number", "tel"].includes(this.controlType)
111
+ ? this.controlType
112
+ : ["text"].includes(this.controlType) && ["url"].includes(this.subType)
113
+ ? "url"
114
+ : ["serialNumber"].includes(this.controlType)
115
+ ? "text"
116
+ : "text";
117
+ },
118
+ // 子类型,只在type="text"有效
96
119
  subType () {
97
- return ["serialNumber"].includes(this.selfPropsObj._type)
98
- ? "text"
99
- : ["text", "textarea", "password", "url", "email", "number", "tel"].includes(this.selfPropsObj._type)
100
- ? this.selfPropsObj._type
101
- : "text";
120
+ return this.selfPropsObj._textType;
102
121
  }
103
122
  },
104
123
  created () {},
@@ -127,6 +146,12 @@
127
146
  },
128
147
  onClear () {
129
148
  this.change();
149
+ },
150
+
151
+ // 超链接跳转
152
+ goHttpWindow (e) {
153
+ e.stopPropagation();
154
+ window.open(this.curVal);
130
155
  }
131
156
  }
132
157
  };
@@ -28,7 +28,6 @@
28
28
  {{ item.name || item._name }}
29
29
  </span>
30
30
  </Radio>
31
-
32
31
  </template>
33
32
 
34
33
  <div
@@ -121,6 +120,7 @@
121
120
  _filterable: true,
122
121
  _transfer: true,
123
122
  _data: [],
123
+ _customData: [],
124
124
 
125
125
  ...this.propsObj,
126
126
  ...this.commonDealPropsObj
@@ -153,46 +153,24 @@
153
153
  };
154
154
  },
155
155
  showVal () {
156
- return this.$isEmptyData(this.curValList)
156
+ return this.$isEmptyData(this.curVal)
157
157
  ? this.emptyShowVal
158
158
  : this.curValObj.name || this.curValObj._name;
159
159
  }
160
160
  },
161
161
  created () {
162
- this.initData();
162
+ this.init();
163
163
  },
164
164
  methods: {
165
- initData () {
166
- if (this.selfPropsObj._customData && this.selfPropsObj._customData.length) {
167
- this.selfPropsObj._customData.forEach(item => {
168
- this.getListData(item);
169
- });
170
- }
171
- },
172
- getListData (_customData) {
173
- this.$https({
174
- url: _customData.url,
175
- params: {
176
- ..._customData.params
177
- },
178
- callback: data => {
179
- this.initListData.push(
180
- ...data.list.map(item => (
181
- {
182
- _key: item[_customData._key || "_key"],
183
- name: item[_customData._name || "name"]
184
- }
185
- ))
186
- );
187
- }
188
- });
165
+ init () {
166
+
189
167
  },
168
+
190
169
  // 取消flat模式的选择项
191
170
  cancelSelect (item) {
192
171
  if (item._disabled !== true && this.selfPropsObj._clearable !== false) {
193
172
  if (item._key === this.curVal) {
194
173
  this.value[this.controlKey] = "";
195
-
196
174
  this.change();
197
175
  }
198
176
  }
@@ -221,6 +199,27 @@
221
199
  // 获取某项的置灰状态
222
200
  getItemDisabled (item) {
223
201
  return !!(!this.finalCanEdit || item._disabled);
202
+ },
203
+
204
+ // 接口 -获取自定义的接口数据
205
+ getListData () {
206
+ this.selfPropsObj._customData.forEach(item => {
207
+ this.$https({
208
+ url: item.url,
209
+ params: item.params,
210
+ callback: data => {
211
+ this.initListData = [
212
+ ...this.initListData,
213
+ ...data.list.map(item =>
214
+ ({
215
+ _key: item[item._key || "_key"],
216
+ name: item[item._name || "name"]
217
+ })
218
+ )
219
+ ];
220
+ }
221
+ });
222
+ });
224
223
  }
225
224
  }
226
225
  };
@@ -6,67 +6,70 @@
6
6
  maxWidth="200"
7
7
  :transfer="true"
8
8
  >
9
- <!-- 编辑模式 -->
10
- <div
11
- v-if="canEdit"
12
- :class="{
13
- ...commonClass,
14
- 'selectDepartments-edit': true
15
- }"
16
- @mouseenter="isHover = true"
17
- @mouseleave="isHover = false"
18
- @click="clickInput"
19
- >
20
- <!-- 有值 -->
21
- <template v-if="!$isEmptyData(curValList)">
22
- <dsh-tags
23
- class="text"
24
- :list="curValList"
25
- :propsObj="{
26
- disabled: !finalCanEdit,
27
- closable: true
9
+ <div @click.stop="clickInput">
10
+ <slot>
11
+ <!-- 编辑模式 -->
12
+ <div
13
+ v-if="canEdit"
14
+ :class="{
15
+ ...commonClass,
16
+ 'selectDepartments-edit': true
28
17
  }"
29
- @delete="clickDeleteItem"
30
- ></dsh-tags>
31
- </template>
32
- <!-- 无值 -->
33
- <template v-else>
34
- {{ emptyShowVal }}
35
- </template>
18
+ @mouseenter="isHover = true"
19
+ @mouseleave="isHover = false"
20
+ >
21
+ <!-- 有值 -->
22
+ <template v-if="!$isEmptyData(curValList)">
23
+ <dsh-tags
24
+ class="text"
25
+ :list="curValList"
26
+ :propsObj="{
27
+ disabled: !finalCanEdit,
28
+ closable: true
29
+ }"
30
+ @delete="clickDeleteItem"
31
+ ></dsh-tags>
32
+ </template>
33
+ <!-- 无值 -->
34
+ <template v-else>
35
+ {{ emptyShowVal }}
36
+ </template>
36
37
 
37
- <!-- 图标 -->
38
- <template>
39
- <Icon
40
- v-if="!$isEmptyData(curValList) && selfPropsObj._clearable && isHover"
41
- class="icon-close"
42
- type="ios-close-circle"
43
- @click.stop="clickClear"
44
- />
45
- <Icon
46
- v-else
47
- class="icon-default"
48
- :type="inputIcon"
49
- />
50
- </template>
51
- </div>
38
+ <!-- 图标 -->
39
+ <template>
40
+ <Icon
41
+ v-if="!$isEmptyData(curValList) && selfPropsObj._clearable && isHover"
42
+ class="icon-close"
43
+ type="ios-close-circle"
44
+ @click.stop="clickClear"
45
+ />
46
+ <Icon
47
+ v-else
48
+ class="icon-default"
49
+ :type="inputIcon"
50
+ />
51
+ </template>
52
+ </div>
52
53
 
53
- <!-- 查看模式 -->
54
- <div
55
- v-else
56
- :class="{
57
- ...commonClass,
58
- 'selectDepartments-show': true
59
- }"
60
- >
61
- <dsh-tags
62
- v-if="!$isEmptyData(curValList)"
63
- class="text"
64
- :list="curValList"
65
- ></dsh-tags>
54
+ <!-- 查看模式 -->
55
+ <div
56
+ v-else
57
+ :class="{
58
+ ...commonClass,
59
+ 'selectDepartments-show': true
60
+ }"
61
+ >
62
+ <dsh-tags
63
+ v-if="!$isEmptyData(curValList)"
64
+ class="text"
65
+ :list="curValList"
66
+ ></dsh-tags>
66
67
 
67
- <template v-else>
68
- {{ emptyShowVal }}
69
- </template>
68
+ <template v-else>
69
+ {{ emptyShowVal }}
70
+ </template>
71
+ </div>
72
+ </slot>
70
73
  </div>
71
74
  </bri-tooltip>
72
75
 
@@ -46,7 +46,9 @@
46
46
  :propsObj="pagePropsObj"
47
47
  @changePage="changePage"
48
48
  @changePageSize="changePageSize"
49
- ></dsh-page>
49
+ >
50
+ <slot name="page"></slot>
51
+ </dsh-page>
50
52
  </div>
51
53
  </div>
52
54
  </template>
@@ -17,7 +17,9 @@
17
17
  :disabled="obj.disabled"
18
18
  @on-change="changePage"
19
19
  @on-page-size-change="changePageSize"
20
- />
20
+ >
21
+ <slot></slot>
22
+ </Page>
21
23
  </template>
22
24
 
23
25
  <script>
@@ -32,7 +34,7 @@
32
34
  }
33
35
  },
34
36
  total: {
35
- type: Number,
37
+ type: [Number, String],
36
38
  default: 0
37
39
  },
38
40
  propsObj: {
@@ -1,15 +1,15 @@
1
1
  .DshPage {
2
2
  width: 100%;
3
- text-align: right;
4
- font-size: 14px;
5
- color: #666;
6
3
  height: 24px;
7
4
  line-height: 24px;
8
- .ivu-page-total{
5
+ text-align: right;
6
+ font-size: 14px;
7
+
8
+ .ivu-page-total {
9
9
  float: left;
10
10
  }
11
- .ivu-select-selection{
12
- border: 0px !important;
11
+ .ivu-select-selection {
12
+ border: 0px!important;
13
13
  }
14
14
  .ivu-page-item-active {
15
15
  a,
@@ -29,12 +29,11 @@
29
29
  .ivu-page-item {
30
30
  height: 24px!important;
31
31
  line-height: 24px!important;
32
- // background: @white;
33
32
  background: transparent;
34
33
  display: inline-block;
35
34
  vertical-align: middle;
36
35
  }
37
- .ivu-select-single .ivu-select-selection .ivu-select-selected-value{
36
+ .ivu-select-single .ivu-select-selection .ivu-select-selected-value {
38
37
  height: 24px!important;
39
38
  line-height: 24px!important;
40
39
  }
@@ -46,7 +45,6 @@
46
45
  a {
47
46
  color: #000;
48
47
  font-weight: bold;
49
- // font-size: 14px;
50
48
  }
51
49
  }
52
50
  .ivu-page-item {