tenghui-ui 2.2.7 → 2.2.9

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