bri-components 1.2.8 → 1.2.10

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.8",
3
+ "version": "1.2.10",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <div class="BriControlInput">
3
+
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "BriControlInput",
10
+ mixins: [],
11
+ props: {
12
+
13
+ },
14
+ data () {
15
+ return {
16
+
17
+ };
18
+ },
19
+ computed: {},
20
+ created () {},
21
+ methods: {}
22
+ };
23
+ </script>
@@ -8,6 +8,7 @@
8
8
  @on-enter="clickConfirm"
9
9
  @on-click="clickConfirm"
10
10
  ></Input>
11
+
11
12
  <div
12
13
  v-show="status === 'show'"
13
14
  class="BriInputs-show"
@@ -126,7 +126,9 @@
126
126
  @on-visible-change="visibleChange"
127
127
  @on-change="changeVal"
128
128
  @click.stop="clickCascader"
129
- ></Cascader>
129
+ >
130
+ <slot></slot>
131
+ </Cascader>
130
132
  </template>
131
133
  </template>
132
134
  </template>
@@ -394,6 +396,9 @@
394
396
  if (this.isVisible || !val.length) {
395
397
  this.curValList = val;
396
398
  }
399
+
400
+ // 注:...params 参数不可去单独使用地区组件时调用
401
+ this.$emit("change", this.value[this.controlKey], ...params);
397
402
  }
398
403
  },
399
404
  watch: {
@@ -51,7 +51,7 @@
51
51
  <!-- 下拉方式 -->
52
52
  <template v-else>
53
53
  <Select
54
- v-model="curValList"
54
+ v-model="value[controlKey]"
55
55
  :multiple="true"
56
56
  :placeholder="selfPropsObj._placeholder"
57
57
  :disabled="!finalCanEdit"
@@ -59,6 +59,7 @@
59
59
  :transfer="selfPropsObj._transfer"
60
60
  :transfer-class-name="selfPropsObj._transferClassName"
61
61
  :max-tag-count="selfPropsObj._maxTagCount"
62
+ @on-select="changeSelect"
62
63
  >
63
64
  <Option
64
65
  v-for="(item, index) in listData"
@@ -174,6 +175,19 @@
174
175
  },
175
176
  created () {},
176
177
  methods: {
178
+ // 下拉框的选择
179
+ changeSelect (item) {
180
+ // 下拉方式时用v-model触发change有问题,组件进来如果值不为空的,就会v-model返值一次
181
+ if (this.curValList.includes(item.value)) {
182
+ let itemIndex = this.curValList.findIndex(valItem => valItem === item.value);
183
+ this.curValList.splice(itemIndex, 1);
184
+ } else {
185
+ this.curValList.push(item.value);
186
+ }
187
+
188
+ this.curValList = [...this.curValList];
189
+ },
190
+
177
191
  getItemColorClass (item) {
178
192
  return this.colorMap[item.color] ? item.color : "color-1";
179
193
  },
@@ -6,34 +6,48 @@
6
6
  maxWidth="200"
7
7
  :transfer="true"
8
8
  >
9
- <div
10
- :class="{
9
+ <!-- 编辑 -->
10
+ <template v-if="canEdit">
11
+ <div
12
+ :class="{
13
+ ...commonClass,
14
+ 'DshCoordinates-edit': canEdit,
15
+ }"
16
+ @mouseenter="isHover = true"
17
+ @mouseleave="isHover = false"
18
+ @click.stop="clickInput"
19
+ >
20
+ <div class="text">
21
+ {{ showVal }}
22
+ </div>
23
+
24
+ <!-- 图标 -->
25
+ <template>
26
+ <Icon
27
+ v-if="!$isEmptyData(curVal) && selfPropsObj._clearable && isHover"
28
+ class="icon-close"
29
+ type="ios-close-circle"
30
+ @click.stop="clickClear"
31
+ />
32
+ <Icon
33
+ v-else
34
+ class="icon-default"
35
+ :type="inputIcon"
36
+ />
37
+ </template>
38
+ </div>
39
+ </template>
40
+
41
+ <!-- 查看 -->
42
+ <template v-else>
43
+ <div :class="{
11
44
  ...commonClass,
12
- 'DshCoordinates-edit': canEdit,
13
- 'DshCoordinates-unit': !canEdit && isUnitShow,
14
- 'DshCoordinates-show': !canEdit && !isUnitShow
15
- }"
16
- @click.stop="clickInput"
17
- >
18
- <div class="text">
45
+ 'DshCoordinates-show': !isUnitShow,
46
+ 'DshCoordinates-unit': isUnitShow
47
+ }">
19
48
  {{ showVal }}
20
49
  </div>
21
-
22
- <!-- 图标 -->
23
- <template v-if="canEdit">
24
- <Icon
25
- v-if="!$isEmptyData(curVal) && selfPropsObj._clearable && isHover"
26
- class="icon-close"
27
- type="ios-close-circle"
28
- @click.stop="clickClear"
29
- />
30
- <Icon
31
- v-else
32
- class="icon-default"
33
- :type="inputIcon"
34
- />
35
- </template>
36
- </div>
50
+ </template>
37
51
  </bri-tooltip>
38
52
 
39
53
  <!-- 模态框 -->
@@ -41,103 +55,108 @@
41
55
  v-if="canEdit"
42
56
  class="DshCoordinates-modal"
43
57
  v-model="showModal"
44
- title="选择位置"
45
- :footer-hide="true"
46
58
  :styles="modalStyles"
47
- @on-cancel="clickCancel"
59
+ :footer-hide="true"
48
60
  >
61
+ <!-- 顶部 -->
49
62
  <div
50
63
  slot="header"
51
64
  class="DshCoordinates-modal-header"
52
65
  >
66
+ <!-- 可编辑 -->
53
67
  <Row
54
68
  v-if="finalCanEdit"
55
- class="edit"
69
+ class="header-edit"
56
70
  type="flex"
57
71
  justify="center"
58
72
  align="bottom"
59
73
  >
60
- <Col span="8">
61
- <div>
62
- <RadioGroup v-model="formData.kind">
74
+ <i-col span="8">
75
+ <radio-group v-model="formData.kind">
63
76
  <Radio label="keyword">按关键字搜索</Radio>
64
77
  <Radio label="coordinate">按坐标搜索</Radio>
65
- </RadioGroup>
66
- </div>
67
- <Row class="dsh-margin-top5">
68
- <Col span="16">
69
- <Input
70
- v-model="formData.searchText"
71
- placeholder="请输入..."
72
- :clearable="true"
73
- @on-enter="clickSearch"
74
- />
75
- <span class="edit-message">{{ searchMessage }}</span>
76
- </Col>
77
- <Col span="8">&nbsp;
78
- <Button
79
- type="primary"
80
- @click="clickSearch"
81
- >搜索</Button>
82
- </Col>
83
- </Row>
84
- </Col>
78
+ </radio-group>
85
79
 
86
- <Col span="8">
87
- <div class="edit-text">坐标获取结果</div>
88
- <Row class="dsh-margin-top5">
89
- <Col span="16">
90
- <Input
91
- :value="curVal.name"
92
- :readonly="true"
93
- :clearable="true"
94
- @on-clear="clickModalClear"
95
- @click.native="clickMapFitView"
96
- />
97
- </Col>
98
- <Col span="8">&nbsp;
99
- <Button
100
- type="primary"
101
- @click="clickConfirm"
102
- >确认</Button>
103
- </Col>
104
- </Row>
105
- </Col>
80
+ <Row class="header-edit-row">
81
+ <i-col span="16">
82
+ <Input
83
+ v-model="formData.searchText"
84
+ placeholder="请输入..."
85
+ :clearable="true"
86
+ @on-enter="clickSearch"
87
+ />
88
+ <span class="header-edit-message">{{ searchMessage }}</span>
89
+ </i-col>
90
+
91
+ <i-col span="8">
92
+ <Button
93
+ type="primary"
94
+ @click="clickSearch"
95
+ >搜索</Button>
96
+ </i-col>
97
+ </Row>
98
+ </i-col>
99
+
100
+ <i-col span="8">
101
+ <div class="header-edit-text">坐标获取结果</div>
102
+ <Row class="header-edit-row">
103
+ <i-col span="16">
104
+ <Input
105
+ :value="cloneVal.name"
106
+ :readonly="true"
107
+ :clearable="true"
108
+ @on-clear="clickModalClear"
109
+ @click.native="clickMapFitView"
110
+ />
111
+ </i-col>
112
+
113
+ <i-col span="8">
114
+ <Button
115
+ type="primary"
116
+ @click="clickConfirm"
117
+ >确认</Button>
118
+ </i-col>
119
+ </Row>
120
+ </i-col>
106
121
  </Row>
107
122
 
123
+ <!-- 不可编辑 -->
108
124
  <Row
109
125
  v-else
110
- class="show"
126
+ class="header-show"
111
127
  >
112
- <Col
128
+ <i-col
113
129
  span="6"
114
- class="show-name"
130
+ class="header-show-text"
115
131
  >
116
- 当前位置:
117
- </Col>
118
- <Col span="12">
119
- <Input
120
- :value="curVal.name"
121
- :readonly="true"
122
- @click.native="clickMapFitView"
123
- />
124
- </Col>
125
- <Col span="6">
126
- </Col>
132
+ 当前位置:
133
+ </i-col>
134
+
135
+ <i-col span="12">
136
+ <Input
137
+ :value="cloneVal.name"
138
+ :readonly="true"
139
+ @click.native="clickMapFitView"
140
+ />
141
+ </i-col>
142
+
143
+ <i-col span="6"></i-col>
127
144
  </Row>
128
145
  </div>
129
146
 
147
+ <!-- 地图 -->
130
148
  <transition>
131
149
  <div
132
150
  v-if="showModal"
133
- id="mapContain"
151
+ id="DshCoordinatesMap"
134
152
  class="DshCoordinates-modal-map"
135
153
  ></div>
136
154
  </transition>
137
155
 
156
+ <!-- 实时坐标 -->
138
157
  <div
139
- ref="divCoordinate"
140
- style="display: none; position:absolute;background:#fff;padding: 5px 10px"
158
+ ref="lnglatRef"
159
+ class="DshCoordinates-modal-lnglat"
141
160
  ></div>
142
161
  </Modal>
143
162
  </div>
@@ -165,7 +184,48 @@
165
184
  mixins: [
166
185
  controlMixin
167
186
  ],
187
+ data () {
188
+ return {
189
+ isHover: false,
190
+
191
+ showModal: false,
192
+ cloneVal: {
193
+ name: "",
194
+ lnglat: []
195
+ },
196
+ modalStyles: {
197
+ height: document.body.clientHeight * 0.96 + "px",
198
+ width: document.body.clientWidth * 0.96 + "px",
199
+ top: "2%"
200
+ },
201
+ formData: {
202
+ kind: "keyword",
203
+ searchText: ""
204
+ },
205
+
206
+ // 地图相应控件
207
+ map: null,
208
+ placeSearch: null,
209
+ mouseTool: null,
210
+ marker: null, // 标记点
211
+ plot: null, // 标记图形
212
+ searchMessage: "" // 提示信息
213
+ };
214
+ },
168
215
  computed: {
216
+ selfPropsObj () {
217
+ return {
218
+ ...this.propsObj,
219
+ ...this.commonDealPropsObj
220
+ };
221
+ },
222
+ kind () {
223
+ return this.selfPropsObj._showType;
224
+ },
225
+ inputIcon () {
226
+ return "ios-map-outline";
227
+ },
228
+
169
229
  curVal: {
170
230
  get () {
171
231
  return this.value[this.controlKey] || {
@@ -175,6 +235,7 @@
175
235
  },
176
236
  set (val) {
177
237
  this.value[this.controlKey] = val;
238
+ this.change();
178
239
  }
179
240
  },
180
241
  curLnglat: {
@@ -185,70 +246,26 @@
185
246
  this.curVal.lnglat = val;
186
247
  }
187
248
  },
188
-
189
- selfPropsObj () {
190
- return {
191
- ...this.propsObj,
192
- ...this.commonDealPropsObj
193
- };
194
- },
195
- kind () {
196
- return this.selfPropsObj._showType;
197
- },
198
- inputIcon () {
199
- return "ios-map-outline";
200
- },
201
-
202
249
  showVal () {
203
250
  return this.$isEmptyData(this.curVal)
204
251
  ? this.emptyShowVal
205
252
  : this.curVal.name;
206
253
  }
207
254
  },
208
- data () {
209
- return {
210
- showModal: false,
211
- cloneValue: {
212
- name: "",
213
- lnglat: []
214
- },
215
- modalStyles: {
216
- height: document.body.clientHeight * 0.96 + "px",
217
- width: document.body.clientWidth * 0.96 + "px",
218
- top: "2%"
219
- },
220
- formData: {
221
- kind: "keyword",
222
- searchText: ""
223
- },
224
-
225
- // 地图相应控件
226
- map: null,
227
- placeSearch: null,
228
- mouseTool: null,
229
- marker: null, // 标记点
230
- plot: null, // 标记图形
231
- searchMessage: "" // 提示信息
232
- };
233
- },
234
255
  created () {},
235
256
  methods: {
236
257
  // 打开窗体
237
258
  clickInput () {
238
- if (this.finalCanEdit) {
259
+ if (this.canEdit) {
239
260
  this.showModal = true;
240
- this.cloneValue = this.$deepCopy(this.curVal);
261
+ this.cloneVal = this.$deepCopy(this.curVal);
241
262
  this.getMap();
242
263
  }
243
264
  },
244
265
  // 点击确认
245
266
  clickConfirm () {
246
267
  this.showModal = false;
247
- this.change();
248
- },
249
- // 点击取消
250
- clickCancel () {
251
- this.curVal = this.cloneValue;
268
+ this.curVal = this.cloneVal;
252
269
  },
253
270
  // 点击删除
254
271
  clickClear () {
@@ -256,11 +273,10 @@
256
273
  name: "",
257
274
  lnglat: []
258
275
  };
259
- this.$emit("change", []);
260
276
  },
261
277
  // 清除已选内容
262
278
  clickModalClear () {
263
- this.curVal = {
279
+ this.cloneVal = {
264
280
  name: "",
265
281
  lnglat: []
266
282
  }; // 清除当前标记
@@ -294,8 +310,8 @@
294
310
  },
295
311
  getMap () {
296
312
  this.$nextTick(() => {
297
- let divCoordinate = this.$refs.divCoordinate;
298
- this.map = new AMap.Map("mapContain", {
313
+ let lnglatRef = this.$refs.lnglatRef;
314
+ this.map = new AMap.Map("DshCoordinatesMap", {
299
315
  rotateEnable: true,
300
316
  pitchEnable: true,
301
317
  zoom: this.propsObj._zoom || 12,
@@ -306,15 +322,15 @@
306
322
 
307
323
  // 滑动显示坐标点
308
324
  this.map.on("mouseover", function (e) {
309
- divCoordinate.style.display = "block";
325
+ lnglatRef.style.display = "block";
310
326
  });
311
327
  this.map.on("mousemove", function (e) {
312
- divCoordinate.innerHTML = e.lnglat.toString();
313
- divCoordinate.style.top = (e.pixel.y + 120) + "px";
314
- divCoordinate.style.left = (e.pixel.x + 6) + "px";
328
+ lnglatRef.innerHTML = e.lnglat.toString();
329
+ lnglatRef.style.top = (e.pixel.y + 120) + "px";
330
+ lnglatRef.style.left = (e.pixel.x + 6) + "px";
315
331
  });
316
332
  this.map.on("mouseout", function (e) {
317
- divCoordinate.style.display = "none";
333
+ lnglatRef.style.display = "none";
318
334
  });
319
335
 
320
336
  // 集成插件
@@ -337,7 +353,7 @@
337
353
  this.mouseTool = new AMap.MouseTool(this.map);
338
354
  this.mouseTool.on("draw", this.handleMouseToolCallback);
339
355
  // 设置默认坐标
340
- if (!this.$isEmptyData(this.curVal)) {
356
+ if (!this.$isEmptyData(this.cloneVal)) {
341
357
  this.handleAddMarker(this.curLnglat, true);
342
358
 
343
359
  if (this.kind === "multipleMarker") { // 多选打开绘图功能
@@ -491,7 +507,7 @@
491
507
  .then(response => {
492
508
  if (response.status === "1" && response.regeocode) {
493
509
  let address = response.regeocode.formatted_address;
494
- this.curVal.name = address;
510
+ this.cloneVal.name = address;
495
511
  }
496
512
  });
497
513
  }
@@ -49,6 +49,7 @@
49
49
  <template v-else>
50
50
  <bri-tooltip
51
51
  :content="showVal"
52
+ :defaultDisabled="false"
52
53
  maxWidth="200"
53
54
  :transfer="true"
54
55
  >
@@ -87,7 +87,17 @@
87
87
  ...commonClass,
88
88
  'DshSelect-show': true
89
89
  }">
90
- {{ showVal }}
90
+ <!-- 有值 -->
91
+ <dsh-tags
92
+ v-if="!$isEmptyData(curVal)"
93
+ class="text"
94
+ :list="[curValObj]"
95
+ ></dsh-tags>
96
+
97
+ <!-- 无值 -->
98
+ <template v-else>
99
+ {{ emptyShowVal }}
100
+ </template>
91
101
  </div>
92
102
  </bri-tooltip>
93
103
  </template>
@@ -147,10 +157,18 @@
147
157
  : listData;
148
158
  },
149
159
  curValObj () {
150
- return this.listData.find(item => item._key === this.curVal) || {
160
+ const obj = this.listData.find(item => item._key === this.curVal) || {
151
161
  _key: this.curVal,
152
162
  name: `温馨提示:选项${this.curVal}已找不到`
153
163
  };
164
+
165
+ return this.$isEmptyData(this.curVal)
166
+ ? undefined
167
+ : {
168
+ ...obj,
169
+ style: this.getItemStyle(obj),
170
+ color: undefined
171
+ };
154
172
  },
155
173
  showVal () {
156
174
  return this.$isEmptyData(this.curVal)
@@ -163,7 +181,7 @@
163
181
  },
164
182
  methods: {
165
183
  init () {
166
-
184
+ this.getListData();
167
185
  },
168
186
 
169
187
  // 取消flat模式的选择项
@@ -200,7 +218,6 @@
200
218
  getItemDisabled (item) {
201
219
  return !!(!this.finalCanEdit || item._disabled);
202
220
  },
203
-
204
221
  // 接口 -获取自定义的接口数据
205
222
  getListData () {
206
223
  this.selfPropsObj._customData.forEach(item => {
@@ -26,6 +26,7 @@ export default {
26
26
  }
27
27
  },
28
28
  /* 列表形式下用到的 */
29
+ rowIndex: Number,
29
30
  parentData: {
30
31
  type: Array,
31
32
  default () {
@@ -191,7 +191,9 @@
191
191
  ? h("Tooltip", {
192
192
  class: "td-inner-compare",
193
193
  props: {
194
- content: this.$isEmptyData(this.oldListData[rowIndex][column._key]) ? "" : this.oldListData[rowIndex][column._key],
194
+ content: this.$isEmptyData(this.oldListData[rowIndex][column._key])
195
+ ? ""
196
+ : this.oldListData[rowIndex][column._key],
195
197
  transfer: true,
196
198
  maxWidth: 200,
197
199
  placement: "top"
@@ -225,8 +227,12 @@
225
227
  change: () => this.$dispatchEvent(this.operationMap.changeVal, column, row, rowIndex, arguments)
226
228
  }
227
229
  }),
228
- !this.getRuleResult(column, row).bool &&
229
- h("span", { class: "table-row-td-tip" }, this.getRuleResult(column, row).message)
230
+
231
+ !this.getRuleResult(column, row).bool
232
+ ? h("span", {
233
+ class: "table-row-td-tip"
234
+ }, this.getRuleResult(column, row).message)
235
+ : undefined
230
236
  ];
231
237
  },
232
238
  renderHeaderCell: ({ column }, h) => {
@@ -365,7 +371,6 @@
365
371
  // 表单控件值改变
366
372
  changeVal (operationItem, col, row, rowIndex, params) {
367
373
  this.$set(this.ruleRecordMap, `${row._id}dsh${col._key}`, { showRuleMessage: true });
368
-
369
374
  this.change("changeVal", col, row, rowIndex, ...params);
370
375
  },
371
376
  // 表单控件失去焦点
@@ -1,7 +1,6 @@
1
1
  <template>
2
2
  <div class="DshTable">
3
3
  <bri-table
4
- :className="propsObj.className"
5
4
  :data="data"
6
5
  :columns="selfColumns"
7
6
  :propsObj="propsObj"