ocpview-pro 0.1.2 → 0.1.4
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/dist/index.js +144 -63
- package/dist/ocpviewplus.min.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/label/showtext.vue +152 -85
- package/src/components/masterplate/RewriteBillListDetails/BillListPanelTable.vue +17 -0
- package/src/components/masterplate/billquerygrid.vue +44 -8
package/package.json
CHANGED
|
@@ -1,95 +1,162 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</
|
|
9
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="showTooltip ? 'Tooltip' : 'div'"
|
|
4
|
+
v-bind="showTooltip ? { transfer: true, content: labeltext, maxWidth: maxWidth, disabled: tooltipDisabled } : {}"
|
|
5
|
+
class="ivu-table-cell-tooltip"
|
|
6
|
+
>
|
|
7
|
+
<template v-if="showTooltip" #content>
|
|
8
|
+
<span class="showtext-tooltip-content">{{ labeltext }}</span>
|
|
9
|
+
</template>
|
|
10
|
+
<span
|
|
11
|
+
ref="content"
|
|
12
|
+
class="ivu-table-cell-tooltip-content"
|
|
13
|
+
:class="{ 'showtext-link': textLink }"
|
|
14
|
+
v-html="displayText"
|
|
15
|
+
:style="{ textAlign: contentAlign }"
|
|
16
|
+
v-on="hasOverflow ? { mouseenter: handleTooltipIn, mouseleave: handleTooltipOut } : {}"
|
|
17
|
+
@click.prevent="textLink && linkTo()"
|
|
18
|
+
/>
|
|
19
|
+
</component>
|
|
10
20
|
</template>
|
|
11
21
|
<script>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
export default {
|
|
23
|
+
name: "showText",
|
|
24
|
+
data() {
|
|
25
|
+
return {
|
|
26
|
+
showTooltip: false,
|
|
27
|
+
tooltipDisabled: true,
|
|
28
|
+
tooltipTimer: null,
|
|
29
|
+
hasOverflow: false,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
label: {
|
|
34
|
+
type: [String, Number],
|
|
35
|
+
default: "",
|
|
22
36
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
maxWidth: {
|
|
38
|
+
type: [String, Number],
|
|
39
|
+
default: 300,
|
|
40
|
+
},
|
|
41
|
+
contentAlign: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "center",
|
|
44
|
+
},
|
|
45
|
+
resetText: {
|
|
46
|
+
type: Function,
|
|
47
|
+
default: null,
|
|
48
|
+
},
|
|
49
|
+
config: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => ({}),
|
|
52
|
+
},
|
|
53
|
+
rowIndex: {
|
|
54
|
+
type: [String, Number],
|
|
55
|
+
default: "",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
computed: {
|
|
59
|
+
labeltext() {
|
|
60
|
+
return this.label;
|
|
61
|
+
},
|
|
62
|
+
textLink() {
|
|
63
|
+
return !!(this.config && this.config.textLink);
|
|
64
|
+
},
|
|
65
|
+
displayText() {
|
|
66
|
+
if (this.resetText) {
|
|
67
|
+
return this.resetText(
|
|
68
|
+
this.doSpecialSymbols(this.label),
|
|
69
|
+
this.label
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return this.doSpecialSymbols(this.label);
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
mounted() {
|
|
76
|
+
this.$nextTick(() => {
|
|
77
|
+
this.checkOverflow();
|
|
78
|
+
this.setupResizeObserver();
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
beforeUnmount() {
|
|
82
|
+
if (this.tooltipTimer) {
|
|
83
|
+
clearTimeout(this.tooltipTimer);
|
|
84
|
+
this.tooltipTimer = null;
|
|
85
|
+
}
|
|
86
|
+
if (this.resizeObserver) {
|
|
87
|
+
this.resizeObserver.disconnect();
|
|
88
|
+
this.resizeObserver = null;
|
|
89
|
+
}
|
|
90
|
+
if (this.checkOverflowDebounced) {
|
|
91
|
+
this.checkOverflowDebounced.cancel();
|
|
92
|
+
this.checkOverflowDebounced = null;
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
methods: {
|
|
96
|
+
checkOverflow() {
|
|
97
|
+
const content = this.$refs.content;
|
|
98
|
+
this.hasOverflow = !!(
|
|
99
|
+
content && content.scrollWidth > content.offsetWidth
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
setupResizeObserver() {
|
|
103
|
+
const content = this.$refs.content;
|
|
104
|
+
if (!content || !window.ResizeObserver) return;
|
|
105
|
+
this.checkOverflowDebounced = this.$utils.debounce(
|
|
106
|
+
this.checkOverflow, 150
|
|
107
|
+
);
|
|
108
|
+
this.resizeObserver = new ResizeObserver(
|
|
109
|
+
this.checkOverflowDebounced
|
|
110
|
+
);
|
|
111
|
+
this.resizeObserver.observe(content.parentElement);
|
|
112
|
+
},
|
|
113
|
+
handleTooltipIn() {
|
|
114
|
+
if (this.tooltipTimer) {
|
|
115
|
+
clearTimeout(this.tooltipTimer);
|
|
116
|
+
this.tooltipTimer = null;
|
|
47
117
|
}
|
|
118
|
+
this.showTooltip = true;
|
|
119
|
+
this.tooltipTimer = setTimeout(() => {
|
|
120
|
+
this.tooltipDisabled = false;
|
|
121
|
+
this.tooltipTimer = null;
|
|
122
|
+
}, 300);
|
|
48
123
|
},
|
|
49
|
-
|
|
50
|
-
if (this.
|
|
51
|
-
this.
|
|
124
|
+
handleTooltipOut() {
|
|
125
|
+
if (this.tooltipTimer) {
|
|
126
|
+
clearTimeout(this.tooltipTimer);
|
|
127
|
+
this.tooltipTimer = null;
|
|
52
128
|
}
|
|
129
|
+
this.tooltipDisabled = true;
|
|
130
|
+
this.tooltipTimer = setTimeout(() => {
|
|
131
|
+
this.showTooltip = false;
|
|
132
|
+
this.tooltipTimer = null;
|
|
133
|
+
}, 300);
|
|
53
134
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.showTooltip = false;
|
|
61
|
-
},
|
|
62
|
-
doSpecialSymbols(str) {
|
|
63
|
-
if (str) {
|
|
64
|
-
str = str + '';
|
|
65
|
-
//替换所有的换行符
|
|
66
|
-
str = str.replace(/\r\n/g,'<br>');
|
|
67
|
-
str = str.replace(/\n/g,'<br>');
|
|
68
|
-
//替换所有的空格(中文空格、英文空格都会被替换)
|
|
69
|
-
str = str.replace(/\s/g,' ');
|
|
70
|
-
}
|
|
71
|
-
return str;
|
|
72
|
-
},
|
|
73
|
-
linkTo() {
|
|
74
|
-
if (this.config.onLinkTo) {
|
|
75
|
-
let obj = this.$Method.copy(this.config);
|
|
76
|
-
obj.rowIndex = this.rowIndex;
|
|
77
|
-
this.config.onLinkTo(obj);
|
|
78
|
-
}
|
|
135
|
+
doSpecialSymbols(str) {
|
|
136
|
+
if (str) {
|
|
137
|
+
str = str + "";
|
|
138
|
+
str = str.replace(/\r\n/g, "<br>");
|
|
139
|
+
str = str.replace(/\n/g, "<br>");
|
|
140
|
+
str = str.replace(/\s/g, " ");
|
|
79
141
|
}
|
|
142
|
+
return str;
|
|
80
143
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.showText = this.resetText(this.doSpecialSymbols(data),data);
|
|
87
|
-
} else {
|
|
88
|
-
this.showText = this.doSpecialSymbols(data);
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
immediate: true
|
|
144
|
+
linkTo() {
|
|
145
|
+
if (this.config && this.config.onLinkTo) {
|
|
146
|
+
let obj = this.$Method.copy(this.config);
|
|
147
|
+
obj.rowIndex = this.rowIndex;
|
|
148
|
+
this.config.onLinkTo(obj);
|
|
92
149
|
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
</script>
|
|
154
|
+
<style scoped>
|
|
155
|
+
.showtext-tooltip-content {
|
|
156
|
+
white-space: pre-wrap;
|
|
157
|
+
}
|
|
158
|
+
.showtext-link {
|
|
159
|
+
text-decoration: underline;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
}
|
|
162
|
+
</style>
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
:loading="loading"
|
|
27
27
|
:sort-config="{ remote: true, trigger: 'cell' }"
|
|
28
28
|
:seq-config="seqConfig"
|
|
29
|
+
:cell-style="cellStyleMethod"
|
|
29
30
|
@sort-change="RewriteTableOnSortChange"
|
|
30
31
|
@cell-dblclick="RewriteTableCellDBlclick"
|
|
31
32
|
>
|
|
@@ -347,6 +348,22 @@ export default {
|
|
|
347
348
|
const { row } = params;
|
|
348
349
|
this.dbclick(row);
|
|
349
350
|
},
|
|
351
|
+
/**
|
|
352
|
+
* 单据状态列颜色渲染
|
|
353
|
+
*/
|
|
354
|
+
cellStyleMethod({ row, column }) {
|
|
355
|
+
const item = this.tableColumns.find(
|
|
356
|
+
(c) => c.name === column.field
|
|
357
|
+
);
|
|
358
|
+
if (item && item._colorMap) {
|
|
359
|
+
const code = row[column.field];
|
|
360
|
+
const color = item._colorMap[code];
|
|
361
|
+
if (color) {
|
|
362
|
+
return { color };
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return {};
|
|
366
|
+
},
|
|
350
367
|
},
|
|
351
368
|
mounted() {
|
|
352
369
|
// console.log("我继承覆写了22222", this.myConfig);
|
|
@@ -78,6 +78,19 @@ import elementResizeDetectorMaker from "element-resize-detector";
|
|
|
78
78
|
import QueryBar from "./querybar.vue";
|
|
79
79
|
import GridColSet from "./gridcolset.vue";
|
|
80
80
|
import { resolveComponent } from "vue";
|
|
81
|
+
const columnColorConfig = {
|
|
82
|
+
billstatus: {
|
|
83
|
+
A: "#FA8C16",
|
|
84
|
+
N: "#1677FF",
|
|
85
|
+
S: "#1677FF",
|
|
86
|
+
Q: "#F5222D",
|
|
87
|
+
T: "#F5222D",
|
|
88
|
+
W: "#FA8C16",
|
|
89
|
+
X: "#00875A",
|
|
90
|
+
Y: "#52C41A",
|
|
91
|
+
C: "#666666",
|
|
92
|
+
},
|
|
93
|
+
};
|
|
81
94
|
export default {
|
|
82
95
|
name: "mbillquerygrid",
|
|
83
96
|
components: { QueryBar, GridColSet },
|
|
@@ -140,12 +153,14 @@ export default {
|
|
|
140
153
|
? this.OmdUrl.billQueryComboBoxCodeWithName
|
|
141
154
|
: true; // 默认值为 true 表示有编码
|
|
142
155
|
}
|
|
156
|
+
this.injectColumnRender(el);
|
|
143
157
|
});
|
|
144
158
|
if (this.myConfig.gridConfig.initRefresh !== undefined) {
|
|
145
159
|
this.initRefresh = this.myConfig.gridConfig.initRefresh;
|
|
146
160
|
}
|
|
147
161
|
if (!this.myConfig.gridConfig.method) {
|
|
148
|
-
this.myConfig.gridConfig.method =
|
|
162
|
+
this.myConfig.gridConfig.method =
|
|
163
|
+
this.myConfig.classPrefix + ".search";
|
|
149
164
|
}
|
|
150
165
|
if (!this.myConfig.gridConfig.resources) {
|
|
151
166
|
this.myConfig.gridConfig.resources = this.config.resources;
|
|
@@ -166,7 +181,7 @@ export default {
|
|
|
166
181
|
this.myConfig.queryConfig = {};
|
|
167
182
|
this.myConfig.queryConfig.curHelpUrl = this.config.curHelpUrl;
|
|
168
183
|
this.myConfig.queryConfig.items = this.$Method.copy(
|
|
169
|
-
this.myConfig.gridConfig.items
|
|
184
|
+
this.myConfig.gridConfig.items
|
|
170
185
|
);
|
|
171
186
|
this.myConfig.queryConfig.modulecode = this.config.modulecode;
|
|
172
187
|
this.myConfig.queryConfig.enablePermissions = this.enablePermissions;
|
|
@@ -179,12 +194,12 @@ export default {
|
|
|
179
194
|
if (this.myConfig.usercustominfo) {
|
|
180
195
|
if (this.myConfig.usercustominfo.filterscene) {
|
|
181
196
|
this.myConfig.queryConfig.sceneData = this.$Method.copy(
|
|
182
|
-
this.myConfig.usercustominfo.filterscene
|
|
197
|
+
this.myConfig.usercustominfo.filterscene
|
|
183
198
|
);
|
|
184
199
|
}
|
|
185
200
|
if (this.myConfig.usercustominfo.colset) {
|
|
186
201
|
this.gridCol = JSON.parse(
|
|
187
|
-
this.$Method.copy(this.myConfig.usercustominfo.colset)
|
|
202
|
+
this.$Method.copy(this.myConfig.usercustominfo.colset)
|
|
188
203
|
);
|
|
189
204
|
}
|
|
190
205
|
}
|
|
@@ -192,12 +207,33 @@ export default {
|
|
|
192
207
|
this.setChangeGridConfig();
|
|
193
208
|
},
|
|
194
209
|
methods: {
|
|
210
|
+
injectColumnRender(el) {
|
|
211
|
+
const colorMap = columnColorConfig[el.name];
|
|
212
|
+
if (
|
|
213
|
+
!colorMap ||
|
|
214
|
+
el.type !== "ComboBox" ||
|
|
215
|
+
el.render !== undefined
|
|
216
|
+
) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const fieldName = el.name;
|
|
220
|
+
el.render = (h, params) => {
|
|
221
|
+
const code = params.row[fieldName];
|
|
222
|
+
const color = colorMap[code];
|
|
223
|
+
const text = this.$Method.formatComboBox(code, params.column);
|
|
224
|
+
if (color) {
|
|
225
|
+
return h("span", { style: { color } }, text);
|
|
226
|
+
}
|
|
227
|
+
return h("span", text);
|
|
228
|
+
};
|
|
229
|
+
el._colorMap = colorMap;
|
|
230
|
+
},
|
|
195
231
|
initRowBtn() {
|
|
196
232
|
if (this.enablePermissions) {
|
|
197
233
|
let btns = [];
|
|
198
234
|
this.moduleMethod.forEach((el) => {
|
|
199
235
|
let btn = this.rowBtnData.find(
|
|
200
|
-
(el2) => el.name === el2.name
|
|
236
|
+
(el2) => el.name === el2.name
|
|
201
237
|
);
|
|
202
238
|
if (btn) {
|
|
203
239
|
btns.push(btn);
|
|
@@ -262,7 +298,7 @@ export default {
|
|
|
262
298
|
let culIndex = data.findIndex(
|
|
263
299
|
(el) =>
|
|
264
300
|
el[self.myConfig.gridConfig.bindSearchParam] ===
|
|
265
|
-
self.ph_key
|
|
301
|
+
self.ph_key
|
|
266
302
|
);
|
|
267
303
|
if (culIndex > -1) {
|
|
268
304
|
index = culIndex;
|
|
@@ -334,7 +370,7 @@ export default {
|
|
|
334
370
|
if (el.name && el.visible) {
|
|
335
371
|
let tmp = this.myConfig.gridConfig.items.find(
|
|
336
372
|
(el2) =>
|
|
337
|
-
el.name === el2.name || el.name === el2.sname
|
|
373
|
+
el.name === el2.name || el.name === el2.sname
|
|
338
374
|
);
|
|
339
375
|
if (tmp) {
|
|
340
376
|
let tmp2 = this.$Method.copy(tmp);
|
|
@@ -383,7 +419,7 @@ export default {
|
|
|
383
419
|
if (this.$refs.toolbar) {
|
|
384
420
|
this.observer.removeListener(
|
|
385
421
|
this.$refs.toolbar,
|
|
386
|
-
this.setOutsideHeight
|
|
422
|
+
this.setOutsideHeight
|
|
387
423
|
);
|
|
388
424
|
}
|
|
389
425
|
},
|