tenghui-ui 2.2.7 → 2.2.8

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": "tenghui-ui",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
4
4
  "description": "vue 2x, tenghui-ui",
5
5
  "files": [
6
6
  "dist",
@@ -9,12 +9,37 @@
9
9
  :offset="-172">
10
10
  <div class="ui-record__list">
11
11
  <div class="ui-record__saves">
12
+ <el-popover
13
+ ref="EditLabelTitlePopover"
14
+ v-if="$refs.EditLabelTitle && $refs.EditLabelTitle[0]"
15
+ :reference="$refs.EditLabelTitle[0]"
16
+ placement="top"
17
+ width="160">
18
+ <el-input style="margin-bottom: 10px;" size="mini" v-model="changeLabelTitleVal" placeholder="请输入筛选标题"></el-input>
19
+ <div style="text-align: right; margin: 0">
20
+ <el-button size="mini" type="text" @click="$refs.EditLabelTitlePopover.doClose()">取消</el-button>
21
+ <el-button type="primary" size="mini" @click="handleConfirmChangeLabelTitle">确定</el-button>
22
+ </div>
23
+ </el-popover>
12
24
  <div class="ui-record__item"
13
25
  v-for="(item, index) in recordData.saves"
14
26
  :key="index"
15
- :title="item.map(v => `${v.label}:${v.valueLabel || v.value}`).join(';')"
27
+ :title="item.labels.map(v => `${v.label}:${v.valueLabel || v.value}`).join(';')"
16
28
  @click="handleShortcut(item)">
17
- <span v-for="(v, index) in item" :key="index">{{v.label}}:{{v.valueLabel || v.value}}</span>
29
+ <div v-if="!Array.isArray(item)">
30
+ <div v-if="item.title">
31
+ <span>{{ item.title }}</span>
32
+ </div>
33
+ <div v-else>
34
+ <span v-for="(v, index) in item.labels" :key="index">{{v.label}}:{{v.valueLabel || v.value}}</span>
35
+ </div>
36
+ </div>
37
+ <div v-else>
38
+ <span v-for="(v, index) in item.labels" :key="index">{{v.label}}:{{v.valueLabel || v.value}}</span>
39
+ </div>
40
+ <el-tooltip class="item" effect="dark" content="修改筛选标题" placement="top-start">
41
+ <i class="el-icon-edit ui-flag--icon" @click.stop="handleShowChangeLabelTitle(item)" ref="EditLabelTitle"></i>
42
+ </el-tooltip>
18
43
  <el-tooltip class="item" effect="dark" content="移除常用筛选" placement="top-start">
19
44
  <i class="el-icon-remove ui-flag--icon" @click.stop="handleOperation(index, 'saves')"></i>
20
45
  </el-tooltip>
@@ -58,21 +83,37 @@ export default {
58
83
  recordData: {
59
84
  saves: [],
60
85
  temps: []
61
- }
86
+ },
87
+
88
+ changeLabelTitleShow: false,
89
+ changeLabelTitleVal: '',
90
+ changeLabelTitleItem: {}
62
91
  }
63
92
  },
64
93
  created() {
65
94
  let locData = localStorage.getItem(`SaveRecord_${this.configKey}`);
66
- this.recordData = locData ? JSON.parse(locData) : {
95
+ const recordData = locData ? JSON.parse(locData) : {
67
96
  saves: [],
68
97
  temps: []
69
98
  }
99
+
100
+ if (recordData.saves[0] && Array.isArray(recordData.saves[0])) {
101
+ recordData.saves = recordData.saves.map(item => ({
102
+ labels: item,
103
+ title: ''
104
+ }));
105
+ }
106
+
107
+ this.recordData = recordData;
70
108
  },
71
109
  methods: {
72
110
  handleOperation(index, type) {
73
111
  if (type == 'temps') {
74
112
  const addItem = this.recordData.temps[index];
75
- this.recordData.saves.unshift(addItem);
113
+ this.recordData.saves.unshift({
114
+ labels: addItem,
115
+ title: ''
116
+ });
76
117
  } else {
77
118
  this.recordData.saves.splice(index, 1);
78
119
  }
@@ -81,7 +122,7 @@ export default {
81
122
  },
82
123
  async handleShortcut(item) {
83
124
  this.$parent.$children.forEach(ref => {
84
- const findItem = item.find(v => v.label == ref.label);
125
+ const findItem = (item.labels || item).find(v => v.label == ref.label);
85
126
  if (findItem) {
86
127
  ref.modelForm = findItem.value;
87
128
  } else if (ref.label) {
@@ -105,6 +146,18 @@ export default {
105
146
  this.recordData.temps.splice(10);
106
147
  }
107
148
  localStorage.setItem(`SaveRecord_${this.configKey}`, JSON.stringify(this.recordData));
149
+ },
150
+
151
+ // 修改标签名称
152
+ handleShowChangeLabelTitle(item) {
153
+ this.changeLabelTitleShow = true;
154
+ this.changeLabelTitleItem = item;
155
+ },
156
+ handleConfirmChangeLabelTitle() {
157
+ this.changeLabelTitleItem.title = this.changeLabelTitleVal;
158
+ this.changeLabelTitleVal = '';
159
+ this.$refs.EditLabelTitlePopover.doClose();
160
+ localStorage.setItem(`SaveRecord_${this.configKey}`, JSON.stringify(this.recordData));
108
161
  }
109
162
  },
110
163
  watch: {
@@ -195,6 +248,7 @@ export default {
195
248
 
196
249
  &:hover {
197
250
  border-color: #b2d8ff;
251
+ min-width: 100px;
198
252
 
199
253
  span {
200
254
  background-color: #b2d8ff;
@@ -222,6 +276,11 @@ export default {
222
276
  text-align: center;
223
277
  box-shadow: 0 0 4px 1px #409EFF;
224
278
  }
279
+
280
+ .el-icon-edit {
281
+ right: 28px;
282
+ font-size: 12px;
283
+ }
225
284
  }
226
285
  }
227
286