bri-components 1.2.17 → 1.2.19

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.17",
3
+ "version": "1.2.19",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -2,13 +2,13 @@
2
2
  <div class="InfoCascader">
3
3
  <dsh-modal
4
4
  v-model="modalVal"
5
- :propsObj="modalPropsObj"
6
5
  mode="middle"
6
+ :propsObj="modalPropsObj"
7
7
  >
8
8
  <dsh-input
9
9
  class="InfoCascader-search"
10
10
  :value="searchData"
11
- :propsObj="inputPropsObj"
11
+ :propsObj="searchPropsObj"
12
12
  ></dsh-input>
13
13
 
14
14
  <div class="InfoCascader-content">
@@ -19,6 +19,7 @@
19
19
  :data="treeData"
20
20
  ></Tree>
21
21
  </div>
22
+
22
23
  <div class="InfoCascader-content-right">
23
24
  <div class="InfoCascader-content-right-title">
24
25
  {{curName}}说明
@@ -34,7 +35,7 @@
34
35
  <div class="InfoCascader-footer">
35
36
  <dsh-buttons
36
37
  class="InfoCascader-footer-btns"
37
- :list="$getOperationList(['cancel', 'confirm'])"
38
+ :list="$getOperationList(['canCancel', 'canConfirm'])"
38
39
  @click="$dispatchEvent($event)"
39
40
  ></dsh-buttons>
40
41
  </div>
@@ -46,7 +47,10 @@
46
47
  export default {
47
48
  name: "InfoCascader",
48
49
  props: {
49
- showModal: Boolean,
50
+ showModal: {
51
+ type: Boolean,
52
+ default: false
53
+ },
50
54
 
51
55
  value: {
52
56
  type: Array,
@@ -69,32 +73,34 @@
69
73
  },
70
74
  data () {
71
75
  return {
76
+ searchData: {
77
+ search: ""
78
+ },
79
+ searchPropsObj: {
80
+ _key: "search",
81
+ _name: "关键字搜索"
82
+ },
83
+ curSelect: {},
84
+
85
+ show: true,
86
+ curName: "",
72
87
  description: "",
88
+
73
89
  operationMap: {
74
- cancel: {
90
+ canCancel: {
75
91
  name: "取消",
76
92
  type: "clickCancel",
77
93
  event: "clickCancel",
78
94
  class: "z-default"
79
95
  },
80
- confirm: {
96
+ canConfirm: {
81
97
  name: "确定",
82
98
  btnType: "primary",
83
99
  type: "clickConfirm",
84
100
  event: "clickConfirm",
85
101
  class: "z-primary"
86
102
  }
87
- },
88
- curSelect: {},
89
- curName: "",
90
- searchData: {
91
- search: ""
92
- },
93
- inputPropsObj: {
94
- _key: "search",
95
- _name: "关键字搜索"
96
- },
97
- show: true
103
+ }
98
104
  };
99
105
  },
100
106
  computed: {
@@ -55,6 +55,7 @@
55
55
  >
56
56
  <div :class="{
57
57
  ...commonClass,
58
+ 'dsh-ellipsis': unitWrap,
58
59
  'DshInput-unit': isUnitShow,
59
60
  'DshInput-show': !isUnitShow
60
61
  }">
@@ -102,6 +103,7 @@
102
103
  _autosize: {
103
104
  minRows: 2
104
105
  },
106
+ _wrap: true, // 单元格文字换行
105
107
 
106
108
  ...this.propsObj,
107
109
  ...this.commonDealPropsObj
@@ -119,12 +121,16 @@
119
121
  // 子类型,只在type="text"有效
120
122
  subType () {
121
123
  return this.selfPropsObj._textType;
124
+ },
125
+ unitWrap () {
126
+ return !(this.isUnitShow && !!this.selfPropsObj._wrap);
122
127
  }
123
128
  },
124
129
  created () {},
125
130
  methods: {
126
131
  onSearch (...params) {
127
- this.$emit("search", ...params);
132
+ this.$emit("search");
133
+ this.$emit("inputChange");
128
134
  },
129
135
  // 无参数
130
136
  onFocus () {
@@ -138,12 +144,17 @@
138
144
  }
139
145
  },
140
146
  onEnter (event) {
147
+ this.$emit("enter");
141
148
  this.$emit("inputChange");
142
149
  },
143
150
  // 参数event
144
151
  onChange (event) {
145
- this.$emit("inputChange");
146
152
  this.changeStatus = true;
153
+
154
+ clearTimeout(this.timer);
155
+ this.timer = setTimeout(() => {
156
+ this.$emit("inputChange");
157
+ }, 1000);
147
158
  },
148
159
  onClear () {
149
160
  this.change();
@@ -51,7 +51,6 @@
51
51
  :propsObj="modalPropsObj"
52
52
  >
53
53
  <dsh-cascader-table
54
- v-if="curVal && isEnlarge"
55
54
  useCol
56
55
  :canEdit="finalCanEdit"
57
56
  :treeColumns="treeColumns"
@@ -56,7 +56,6 @@
56
56
  :propsObj="modalPropsObj"
57
57
  >
58
58
  <bri-flat-table
59
- v-if="isEnlarge"
60
59
  :canEdit="finalCanEdit"
61
60
  :columns="columns"
62
61
  :data="curVal.list"
@@ -6,7 +6,7 @@
6
6
  :transfer="true"
7
7
  maxWidth="200"
8
8
  >
9
- <div @click.stop="clickInput">
9
+ <div @click="clickInput">
10
10
  <slot>
11
11
  <!-- 编辑 -->
12
12
  <bri-control-input
@@ -19,11 +19,36 @@
19
19
  :value="curValList"
20
20
  :inputIcon="inputIcon"
21
21
  :propsObj="selfPropsObj"
22
- @clickDeleteItem="clickDeleteItem"
23
- @clickClear="clickClear"
22
+ @deleteItem="clickDeleteItem"
23
+ @clear="clickClear"
24
24
  ></bri-control-input>
25
25
 
26
- <!-- 查看 -->
26
+ <!-- 表格查看 -->
27
+ <div
28
+ v-else-if="isUnitShow"
29
+ class="selectUsers-unit"
30
+ >
31
+ <template v-if="!$isEmptyData(curValList)">
32
+ <img
33
+ v-for="item in curValList"
34
+ :src="$imageResize(item.avatarurl, imageResizeConfig) || $imageSrcMap.system.boy"
35
+ :key="item._key"
36
+ class="selectUsers-unit-img"
37
+ />
38
+ <span
39
+ v-if="curValList[0]"
40
+ class="selectUsers-unit-text"
41
+ >
42
+ {{ curValList[0].name || curValList[0].realname || curValList[0].mobile }}
43
+ </span>
44
+ </template>
45
+
46
+ <template v-else>
47
+ {{ emptyShowVal }}
48
+ </template>
49
+ </div>
50
+
51
+ <!-- 弹窗查看 -->
27
52
  <div
28
53
  v-else
29
54
  :class="{
@@ -50,8 +75,8 @@
50
75
  v-if="finalCanEdit"
51
76
  class="selectUsers-modal"
52
77
  v-model="showModal"
53
- :propsObj="modalPropsObj"
54
78
  mode="custom"
79
+ :propsObj="modalPropsObj"
55
80
  @cancel="clickCancel"
56
81
  >
57
82
  <div class="selectUsers-modal-wrap">
@@ -65,7 +90,7 @@
65
90
  <dsh-input
66
91
  :value="searchData"
67
92
  :propsObj="inputPropsObj"
68
- @change="search"
93
+ @inputChange="search"
69
94
  ></dsh-input>
70
95
  </div>
71
96
 
@@ -200,6 +225,7 @@
200
225
  closable: true,
201
226
  class: "bri-modal-center"
202
227
  },
228
+
203
229
  // 筛选
204
230
  searchData: {
205
231
  name: ""
@@ -217,10 +243,10 @@
217
243
  realname: "当前用户"
218
244
  }
219
245
  ],
220
-
221
246
  loading: false,
222
247
  userList: [],
223
248
  departmentList: [],
249
+
224
250
  // 分页
225
251
  total: 0,
226
252
  pagePropsObj: {
@@ -245,6 +271,11 @@
245
271
  btnType: "primary",
246
272
  event: "clickConfirm"
247
273
  }
274
+ },
275
+ imageResizeConfig: {
276
+ m: "fixed",
277
+ w: 18,
278
+ h: 18
248
279
  }
249
280
  };
250
281
  },
@@ -294,7 +325,7 @@
294
325
  if (this.finalCanEdit) {
295
326
  this.openModal();
296
327
  this.newValList = this.$deepCopy(this.curValList);
297
- this.initModal();
328
+ this.modalInit();
298
329
  }
299
330
  },
300
331
  clickDeleteItem (deleteItem) {
@@ -305,7 +336,7 @@
305
336
  },
306
337
 
307
338
  /* ---------- 弹框里 --------- */
308
- initModal () {
339
+ modalInit () {
309
340
  this.searchData = {
310
341
  name: ""
311
342
  };
@@ -369,34 +400,31 @@
369
400
 
370
401
  /* ----------- 接口方法 ------------- */
371
402
  getUserListData () {
372
- this.loading = true;
373
403
  this.userList = [];
374
- let searchName = this.searchData.name;
375
- let search = {};
376
- if (searchName && searchName !== "") {
377
- search["realname"] = {
378
- "$regex": `.*${this.$speciaWord(searchName)}.*`, $options: "i"
379
- };
380
- } else {
381
- delete search["realname"];
382
- }
404
+
383
405
  this.$https({
384
406
  url: {
385
407
  module: "company",
386
408
  name: "userIndex"
387
409
  },
388
410
  params: {
389
- search: search,
411
+ search: {
412
+ realname: this.searchData.name
413
+ ? {
414
+ "$regex": `.*${this.$speciaWord(this.searchData.name)}.*`, $options: "i"
415
+ }
416
+ : undefined
417
+ },
390
418
  department: this.curDepartment._key,
391
419
  pagination: {
392
420
  page: this.pagePropsObj.page,
393
421
  pagesize: this.pagePropsObj.pagesize
394
422
  }
395
423
  },
424
+ loadingName: "loading",
396
425
  callback: data => {
397
- this.total = data.total;
398
426
  this.userList = data.list;
399
- this.loading = false;
427
+ this.total = data.total;
400
428
  }
401
429
  });
402
430
  },
@@ -76,6 +76,7 @@
76
76
  scrollWidth: "0",
77
77
  borderY: true,
78
78
  fixedHeader: true,
79
+ canClick: false,
79
80
  cellSelectionOption: {
80
81
  enable: false
81
82
  },
@@ -91,11 +92,14 @@
91
92
  return this.propsObj.state || this.state;
92
93
  },
93
94
  selfClassName () {
95
+ let className = "";
96
+ if (this.selfPropsObj.canClick) {
97
+ className += "bri-table-click ";
98
+ }
94
99
  if (this.loading || !this.data.length) {
95
- return "bri-table-onlyhead";
96
- } else {
97
- return "";
100
+ className += "bri-table-onlyhead ";
98
101
  }
102
+ return className;
99
103
  },
100
104
 
101
105
  rowStyleOption () {
@@ -19,12 +19,11 @@
19
19
  <dsh-modal
20
20
  class="BriTree-modal"
21
21
  v-model="treeFormShow"
22
- :propsObj="treeFormPropsObj"
23
22
  mode="custom"
23
+ :propsObj="treeFormPropsObj"
24
24
  >
25
25
  <div class="BriTree-modal-content">
26
26
  <dsh-form
27
- v-if="treeFormShow"
28
27
  ref="treeForm"
29
28
  :formList="treeFormList"
30
29
  :formData="treeFormData"
@@ -1,21 +1,19 @@
1
1
  <template>
2
2
  <div class="DshBtnModal">
3
3
  <dsh-buttons
4
- :list="$getOperationList(['set'])"
4
+ :list="$getOperationList(['canSet'])"
5
5
  @click="$dispatchEvent($event)"
6
6
  ></dsh-buttons>
7
7
 
8
- <div v-if="showModal">
9
- <dsh-modal
10
- v-model="showModal"
11
- :mode="selfModalPropsObj.mode"
12
- :propsObj="selfModalPropsObj"
13
- >
14
- <div style="margin: 10px 30px;">
15
- <slot></slot>
16
- </div>
17
- </dsh-modal>
18
- </div>
8
+ <dsh-modal
9
+ v-model="showModal"
10
+ :mode="selfModalPropsObj.mode"
11
+ :propsObj="selfModalPropsObj"
12
+ >
13
+ <div style="margin: 10px 30px;">
14
+ <slot></slot>
15
+ </div>
16
+ </dsh-modal>
19
17
  </div>
20
18
  </template>
21
19
 
@@ -34,9 +32,9 @@
34
32
  return {
35
33
  showModal: false,
36
34
  operationMap: {
37
- set: {
35
+ canSet: {
38
36
  name: "设置默认内容",
39
- type: "set",
37
+ type: "canSet",
40
38
  btnType: "dashed",
41
39
  size: "default",
42
40
  long: true,
@@ -139,7 +139,7 @@
139
139
  },
140
140
  computed: {
141
141
  showList () {
142
- return this.useSearch
142
+ return this.useSearch && this.searchName
143
143
  ? this.list.filter(item => (item.name || item._name).includes(this.searchName))
144
144
  : this.list;
145
145
  }
@@ -63,8 +63,8 @@
63
63
  mode: {
64
64
  type: String,
65
65
  default: "default",
66
- validator: function (value) {
67
- return ["small", "default", "middle", "large", "custom", "auto"].indexOf(value) !== -1;
66
+ validator (val) {
67
+ return ["small", "default", "middle", "large", "custom", "auto"].includes(val);
68
68
  }
69
69
  },
70
70
  propsObj: {
@@ -5,6 +5,23 @@
5
5
 
6
6
  &-show {}
7
7
 
8
+ &-unit {
9
+ .dsh-ellipsis();
10
+ padding-left: 5px;
11
+
12
+ &-img {
13
+ width: 18px;
14
+ height: 18px;
15
+ vertical-align: middle;
16
+ margin-left: -5px;
17
+ border-radius: 50%;
18
+ }
19
+
20
+ &-text {
21
+ vertical-align: middle;
22
+ }
23
+ }
24
+
8
25
  // 弹框部分
9
26
  &-modal {
10
27
  &-wrap {
@@ -9,5 +9,6 @@
9
9
  .ivu-form-item-error-tip {
10
10
  top: 90%;
11
11
  left: 15px;
12
+ font-size: 12px;
12
13
  }
13
14
  }
@@ -52,6 +52,12 @@
52
52
  max-width: calc(100% - 20px);
53
53
  }
54
54
 
55
+ &-click {
56
+ td {
57
+ cursor: pointer;
58
+ }
59
+ }
60
+
55
61
  td {
56
62
  white-space: normal !important;
57
63
  }
@@ -3,6 +3,7 @@
3
3
  width: 100%;
4
4
  height: 100%;
5
5
  }
6
+
6
7
  &-close {
7
8
  padding: 2px;
8
9
  position: absolute;
@@ -81,8 +82,8 @@
81
82
  .DshModal-close {
82
83
  top: 20px;
83
84
  right: 24px;
84
- color: rgba(0,0,0,0.6);
85
- font-size: 16px!important;
85
+ color: rgba(0, 0, 0, 0.6);
86
+ font-size: 16px !important;
86
87
  }
87
88
 
88
89
  .ivu-modal {
@@ -93,7 +94,7 @@
93
94
  border-bottom: none;
94
95
 
95
96
  &-inner {
96
- color: rgba(0,0,0,0.9);
97
+ color: rgba(0, 0, 0, 0.9);
97
98
  font-size: 16px;
98
99
  font-weight: 500;
99
100
  line-height: 24px;
@@ -121,8 +122,18 @@
121
122
  height: 80% !important;
122
123
  min-width: 500px;
123
124
  min-height: 400px;
125
+
124
126
  // max-width: 900px;
125
127
  // max-height: 800px;
128
+ .ivu-modal-content {
129
+ .ivu-modal-header {
130
+
131
+ &-inner {
132
+ line-height: 24px;
133
+ height: 24px;
134
+ }
135
+ }
136
+ }
126
137
  }
127
138
  }
128
139
  }
@@ -166,26 +177,26 @@
166
177
  height: 100%;
167
178
  display: flex;
168
179
  flex-direction: column;
169
-
180
+
170
181
  .DshModal-close,
171
182
  .ivu-modal-close {
172
183
  top: 20px;
173
184
  right: 24px;
174
185
  color: @contentColor;
175
186
  font-size: @smallTitleSize;
176
-
187
+
177
188
  .ivu-icon-ios-close {
178
189
  font-size: 22px;
179
190
  color: @contentColor;
180
191
  }
181
192
  }
182
-
193
+
183
194
  .ivu-modal-header {
184
195
  width: 100%;
185
196
  height: 44px;
186
197
  padding: 20px 24px 0px 24px;
187
198
  border-bottom: none;
188
-
199
+
189
200
  &-inner {
190
201
  color: rgba(0, 0, 0, 0.9);
191
202
  font-size: 16px;
@@ -194,7 +205,7 @@
194
205
  height: 24px;
195
206
  }
196
207
  }
197
-
208
+
198
209
  .ivu-modal-body {
199
210
  flex: 1;
200
211
  overflow: auto;