fl-web-component 0.1.1 → 1.0.1
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/fl-web-component.common.js +14751 -54489
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/dist/fl-web-component.umd.js +14751 -54489
- package/dist/fl-web-component.umd.js.map +1 -1
- package/dist/fl-web-component.umd.min.js +3 -3
- package/dist/fl-web-component.umd.min.js.map +1 -1
- package/package.json +28 -5
- package/packages/components/button/index.vue +18 -17
- package/packages/components/com-card/card-page.vue +51 -49
- package/packages/components/com-card/index.vue +20 -21
- package/packages/components/com-dialogWrapper/index.vue +18 -21
- package/packages/components/com-flcanvas/components/bspline.js +91 -0
- package/packages/components/com-flcanvas/components/entityFormatting.js +503 -0
- package/packages/components/com-flcanvas/components/round10.js +24 -0
- package/packages/components/com-flcanvas/index.vue +259 -0
- package/packages/components/com-formDialog/index.vue +76 -75
- package/packages/components/com-graphics/index.vue +1057 -226
- package/packages/components/com-graphics/per-control.vue +109 -0
- package/packages/components/com-graphics/pid.vue +168 -0
- package/packages/components/com-page/index.vue +33 -33
- package/packages/components/com-selectTree/index.vue +61 -63
- package/packages/components/com-table/column-default.vue +9 -14
- package/packages/components/com-table/column-dynamic.vue +4 -8
- package/packages/components/com-table/column-menu.vue +8 -8
- package/packages/components/com-table/column-slot.vue +4 -4
- package/packages/components/com-table/column.vue +7 -15
- package/packages/components/com-table/config.js +9 -9
- package/packages/components/com-table/index.vue +35 -35
- package/packages/components/com-table/table-page.vue +17 -17
- package/packages/components/com-tabs/index.vue +19 -19
- package/packages/components/com-treeDynamic/index.vue +45 -45
- package/packages/components/model/api/index.js +59 -67
- package/packages/components/model/api/mock/detecttree.js +38 -38
- package/packages/components/model/api/mock/getmodel-line.js +15830 -79332
- package/packages/components/model/api/mock/init.js +1 -1
- package/packages/components/model/api/mock/pbstree.js +486 -495
- package/packages/components/model/components/TextOverTooltip/index.vue +3 -3
- package/packages/components/model/components/annotation-toolbar.vue +4 -19
- package/packages/components/model/components/check-proofing-model.vue +26 -29
- package/packages/components/model/components/clipping-type.vue +22 -14
- package/packages/components/model/components/com-dialogWrapper/index.vue +22 -25
- package/packages/components/model/components/detect-panel.vue +38 -26
- package/packages/components/model/components/detect-tree.vue +9 -24
- package/packages/components/model/components/firstPer-panel.vue +23 -25
- package/packages/components/model/components/header-button.vue +31 -107
- package/packages/components/model/components/imageViewer/index.vue +34 -35
- package/packages/components/model/components/import-model.vue +127 -127
- package/packages/components/model/components/location-panel.vue +25 -29
- package/packages/components/model/components/measure-type.vue +15 -15
- package/packages/components/model/components/pbs-tree.vue +139 -144
- package/packages/components/model/components/proof-config.vue +2 -10
- package/packages/components/model/components/proof-for-pc.vue +35 -32
- package/packages/components/model/components/proof-history.vue +136 -154
- package/packages/components/model/components/proof-panel-detail.vue +166 -165
- package/packages/components/model/components/proof-panel.vue +281 -205
- package/packages/components/model/components/proof-project-user.vue +13 -50
- package/packages/components/model/components/proof-publish.vue +130 -130
- package/packages/components/model/components/proof-role.vue +93 -124
- package/packages/components/model/components/props-panel.vue +63 -54
- package/packages/components/model/index.vue +3225 -3213
- package/packages/components/model/utils/annotation-tool.js +75 -82
- package/packages/components/model/utils/cursor.js +15 -10
- package/packages/components/model/utils/detect-v1.js +23 -35
- package/packages/components/model/utils/index.js +25 -25
- package/packages/components/model/utils/threejs/measure-angle.js +180 -180
- package/packages/components/model/utils/threejs/measure-area.js +196 -184
- package/packages/components/model/utils/threejs/measure-distance.js +154 -152
- package/packages/components/model/utils/threejs/measure-volume.js +64 -61
- package/src/assets/test.png +0 -0
- package/src/assets/worker.glb +0 -0
- package/src/main.js +11 -8
- package/src/utils/flgltf-parser.js +141 -0
- package/src/utils/instance-parser.js +402 -0
- package/src/utils/mock.js +84746 -0
- package/src/utils/threejs/measure-angle.js +240 -0
- package/src/utils/threejs/measure-area.js +249 -0
- package/src/utils/threejs/measure-distance.js +195 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<div ref="svgDraw" id="konva-container" style="height:100%"></div>
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function downloadPDF(base64, fileName) {
|
|
11
|
+
const blob = base64ToBlob(base64);
|
|
12
|
+
const url = createObjectURL(blob);
|
|
13
|
+
const link = document.createElement('a');
|
|
14
|
+
link.href = url;
|
|
15
|
+
link.download = fileName || 'downloaded_pdf.pdf'; // 设置下载文件名,如果没有提供文件名,则默认为'downloaded_pdf.pdf'
|
|
16
|
+
document.body.appendChild(link); // 添加到DOM树中以便触发下载
|
|
17
|
+
link.click(); // 模拟点击下载
|
|
18
|
+
document.body.removeChild(link); // 下载完成后移除元素
|
|
19
|
+
URL.revokeObjectURL(url); // 释放URL对象
|
|
20
|
+
}
|
|
21
|
+
import Konva from 'konva'
|
|
22
|
+
import DxfParser from "dxf-parser";
|
|
23
|
+
import jsPDF from 'jspdf'
|
|
24
|
+
import { formatEntity, handleFn, centering } from './components/entityFormatting'
|
|
25
|
+
var konvaStage = null, konvaLayer = null;
|
|
26
|
+
var recordLayerConfig = {}
|
|
27
|
+
export default {
|
|
28
|
+
name: "Fl2dcanvas",
|
|
29
|
+
components: {},
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
created() {
|
|
36
|
+
//resize方法
|
|
37
|
+
window.addEventListener('resize', () => {
|
|
38
|
+
if (konvaStage) {
|
|
39
|
+
const obj = document.getElementById('konva-container')
|
|
40
|
+
konvaStage.setWidth(obj.clientWidth)
|
|
41
|
+
konvaStage.setHeight(obj.clientHeight)
|
|
42
|
+
konvaStage._resizeDOM()
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
this.$nextTick(() => {
|
|
48
|
+
console.log(document.getElementById('konva-container'));
|
|
49
|
+
console.log(this.$refs.svgDraw);
|
|
50
|
+
konvaStage = new Konva.Stage({
|
|
51
|
+
className: "stage",
|
|
52
|
+
container: "konva-container",
|
|
53
|
+
width: this.$refs.svgDraw.clientWidth,
|
|
54
|
+
height: this.$refs.svgDraw.clientHeight,
|
|
55
|
+
draggable: true,
|
|
56
|
+
});
|
|
57
|
+
//init layer
|
|
58
|
+
konvaLayer = new Konva.Layer({
|
|
59
|
+
name: "konva-layer",
|
|
60
|
+
x: 0,
|
|
61
|
+
y: 0,
|
|
62
|
+
});
|
|
63
|
+
//设置清晰度
|
|
64
|
+
konvaLayer.getCanvas().setPixelRatio(2);
|
|
65
|
+
konvaStage.add(konvaLayer);
|
|
66
|
+
konvaLayer.draw();
|
|
67
|
+
var scaleBy = 1.5;
|
|
68
|
+
//初始化缩放方法
|
|
69
|
+
konvaStage.on("wheel", (e) => {
|
|
70
|
+
console.log(e)
|
|
71
|
+
e.evt.preventDefault();
|
|
72
|
+
var oldScale = konvaStage.scaleX();
|
|
73
|
+
var pointer = konvaStage.getPointerPosition();
|
|
74
|
+
var mousePointTo = {
|
|
75
|
+
x: (pointer.x - konvaStage.x()) / oldScale,
|
|
76
|
+
y: (pointer.y - konvaStage.y()) / oldScale,
|
|
77
|
+
};
|
|
78
|
+
// how to scale? Zoom in? Or zoom out?
|
|
79
|
+
let direction = e.evt.deltaY > 0 ? -1 : 1;
|
|
80
|
+
if (e.evt.ctrlKey) {
|
|
81
|
+
direction = -direction;
|
|
82
|
+
}
|
|
83
|
+
var newScale = direction > 0 ? oldScale * scaleBy : oldScale / scaleBy;
|
|
84
|
+
this.scaleRatio = Math.ceil(newScale)
|
|
85
|
+
// 判断比例尺百分比
|
|
86
|
+
if (this.scaleRatio <= 1 || this.scaleRatio >= 100) return
|
|
87
|
+
// 设置放大缩小多少倍
|
|
88
|
+
konvaStage.scale({ x: newScale, y: newScale });
|
|
89
|
+
var newPos = {
|
|
90
|
+
x: pointer.x - mousePointTo.x * newScale,
|
|
91
|
+
y: pointer.y - mousePointTo.y * newScale,
|
|
92
|
+
};
|
|
93
|
+
konvaStage.position(newPos);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
//create方法结束
|
|
98
|
+
},
|
|
99
|
+
//销毁方法
|
|
100
|
+
|
|
101
|
+
methods: {
|
|
102
|
+
loadDxf(data){
|
|
103
|
+
const parser = new DxfParser();
|
|
104
|
+
let dxf = parser.parse(data);
|
|
105
|
+
let entities = formatEntity(dxf.entities);
|
|
106
|
+
let layers = dxf.tables.layer.layers;
|
|
107
|
+
//加载图纸
|
|
108
|
+
for (let key in layers) {
|
|
109
|
+
if (entities[key]) {
|
|
110
|
+
let group = [];
|
|
111
|
+
let l = entities[key].length
|
|
112
|
+
let layerConfig = recordLayerConfig[key]
|
|
113
|
+
let configParams = layerConfig && Object.keys(layerConfig).length > 0 ? layerConfig : null
|
|
114
|
+
for (let i = 0; i < l; i++) {
|
|
115
|
+
let type = entities[key][i].type;
|
|
116
|
+
handleFn(type, dxf, entities[key][i], group, key, configParams, konvaLayer, recordLayerConfig)
|
|
117
|
+
}
|
|
118
|
+
if (!konvaLayer) return
|
|
119
|
+
for(let i = 0; i < group.length;i++) {
|
|
120
|
+
let entity = group[i];
|
|
121
|
+
if (entity.type === 'text') {
|
|
122
|
+
if (konvaLayer) konvaLayer.add(entity.obj);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
let customShape = new Konva.Shape({
|
|
128
|
+
x: 0,
|
|
129
|
+
y: 0,
|
|
130
|
+
strokeWidth: 0.2,
|
|
131
|
+
name: key.replace(/\s*/g, ""),
|
|
132
|
+
entityId: key,
|
|
133
|
+
stroke: configParams ? configParams.color : "#000",
|
|
134
|
+
customColor: configParams ? configParams.color : "",
|
|
135
|
+
visible: configParams ? configParams.visible :true,
|
|
136
|
+
sceneFunc (context, shape) {
|
|
137
|
+
context.beginPath();
|
|
138
|
+
for(let i = 0; i < group.length;i++){
|
|
139
|
+
let entity = group[i];
|
|
140
|
+
if(entity.type === 'line'){
|
|
141
|
+
let x1=entity.x1;
|
|
142
|
+
let y1=entity.y1;
|
|
143
|
+
let x2=entity.x2;
|
|
144
|
+
let y2=entity.y2;
|
|
145
|
+
context.moveTo(x1, -parseFloat(y1));
|
|
146
|
+
context.lineTo(x2, -parseFloat(y2));
|
|
147
|
+
}
|
|
148
|
+
if(entity.type === "polyline"){
|
|
149
|
+
let points=entity.points;
|
|
150
|
+
let closed = entity.closed;
|
|
151
|
+
for(let j = 0; j < points.length; j++){
|
|
152
|
+
let index = j % 2;
|
|
153
|
+
if(index === 0){
|
|
154
|
+
let x = points[j];
|
|
155
|
+
let y = points[j+1];
|
|
156
|
+
if(j === 0){
|
|
157
|
+
context.moveTo(x, y);
|
|
158
|
+
}else{
|
|
159
|
+
context.lineTo(x,y);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if(closed) {
|
|
164
|
+
if (j === points.length - 1) {
|
|
165
|
+
context.lineTo(points[0], points[1]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// context.closePath();
|
|
172
|
+
context.fillStrokeShape(shape);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
if (konvaLayer) konvaLayer.add(customShape);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
//缩放视口
|
|
179
|
+
let scale = 1;
|
|
180
|
+
const boundingRect = konvaLayer.getClientRect();
|
|
181
|
+
let ratio = Number((this.$refs.svgDraw.clientWidth / boundingRect.width).toFixed(1));
|
|
182
|
+
if (ratio > 2) {
|
|
183
|
+
scale = Number((boundingRect.width / boundingRect.height).toFixed(1));
|
|
184
|
+
scale = scale < 2 ? 2 : scale
|
|
185
|
+
}
|
|
186
|
+
konvaStage.scale({
|
|
187
|
+
x: scale,
|
|
188
|
+
y: scale,
|
|
189
|
+
})
|
|
190
|
+
const boundingScale = konvaLayer.getClientRect();
|
|
191
|
+
//平移视口
|
|
192
|
+
const x =
|
|
193
|
+
this.$refs.svgDraw.clientWidth / 2 -
|
|
194
|
+
(Math.ceil(boundingScale.width) / 2 + boundingScale.x / 2);
|
|
195
|
+
const y =
|
|
196
|
+
this.$refs.svgDraw.clientHeight / 2 -
|
|
197
|
+
(Math.ceil(boundingScale.height) / 2 + boundingScale.y);
|
|
198
|
+
konvaStage.setX(x);
|
|
199
|
+
konvaStage.setY(y);
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
},
|
|
205
|
+
toPdf(){
|
|
206
|
+
// get data URL with default settings
|
|
207
|
+
|
|
208
|
+
// open in new window
|
|
209
|
+
konvaLayer.getCanvas().setPixelRatio(1);
|
|
210
|
+
const jpegURL = konvaStage.toDataURL({
|
|
211
|
+
mimeType: 'image/jpeg',
|
|
212
|
+
quality:1.0
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
let pageData=konvaLayer.canvas.toDataURL('image/jpeg', 1.0);
|
|
216
|
+
|
|
217
|
+
console.log(pageData);
|
|
218
|
+
|
|
219
|
+
let img = new Image();
|
|
220
|
+
img.src=jpegURL;
|
|
221
|
+
const pdf = new jsPDF('l', 'px', [konvaStage.width(), konvaStage.height()]);
|
|
222
|
+
|
|
223
|
+
pdf.addImage(
|
|
224
|
+
konvaStage.toDataURL({ pixelRatio: 2 }),
|
|
225
|
+
0,
|
|
226
|
+
0,
|
|
227
|
+
konvaStage.width(),
|
|
228
|
+
konvaStage.height()
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
pdf.save('canvas.pdf');
|
|
232
|
+
// var imgData = canvas.toDataURL('image/png');
|
|
233
|
+
//doc.text("Hello world!", 10, 10);
|
|
234
|
+
//doc.save("a4.pdf");
|
|
235
|
+
},
|
|
236
|
+
clearCache(){
|
|
237
|
+
konvaLayer && konvaLayer.destroyChildren()
|
|
238
|
+
konvaLayer && konvaLayer.destroy()
|
|
239
|
+
konvaLayer && konvaLayer.clear()
|
|
240
|
+
konvaStage && konvaStage.destroy()
|
|
241
|
+
konvaStage && konvaStage.clearCache()
|
|
242
|
+
konvaLayer = null
|
|
243
|
+
konvaStage = null
|
|
244
|
+
},
|
|
245
|
+
beforeDestroy() {
|
|
246
|
+
this.clearCache()
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
</script>
|
|
251
|
+
<style lang="scss" scoped>
|
|
252
|
+
#konva-container {
|
|
253
|
+
z-index: 3;
|
|
254
|
+
width: 100%;
|
|
255
|
+
height: 100%;
|
|
256
|
+
cursor: pointer;
|
|
257
|
+
overflow: hidden;
|
|
258
|
+
}
|
|
259
|
+
</style>
|
|
@@ -8,12 +8,7 @@
|
|
|
8
8
|
-->
|
|
9
9
|
<template>
|
|
10
10
|
<div v-loading="loadingForm" class="inline_false">
|
|
11
|
-
<el-form
|
|
12
|
-
ref="form"
|
|
13
|
-
:model="formInline"
|
|
14
|
-
:label-width="labelWidth"
|
|
15
|
-
class="form_inline_false"
|
|
16
|
-
>
|
|
11
|
+
<el-form ref="form" :model="formInline" :label-width="labelWidth" class="form_inline_false">
|
|
17
12
|
<!-- 表单循环 -->
|
|
18
13
|
<el-form-item
|
|
19
14
|
v-for="(item, index) in formItemConfigArr"
|
|
@@ -44,7 +39,7 @@
|
|
|
44
39
|
:key="optionItem.optionValue + optionIndex"
|
|
45
40
|
:label="optionItem.optionLabel"
|
|
46
41
|
:value="optionItem.optionValue"
|
|
47
|
-
:style="{
|
|
42
|
+
:style="{ width: minWidth + 2 + 'px' }"
|
|
48
43
|
/>
|
|
49
44
|
</el-select>
|
|
50
45
|
|
|
@@ -78,7 +73,7 @@
|
|
|
78
73
|
:tree-props="{
|
|
79
74
|
id: 'deptId',
|
|
80
75
|
label: 'deptName',
|
|
81
|
-
children: 'children'
|
|
76
|
+
children: 'children',
|
|
82
77
|
}"
|
|
83
78
|
:tree-node-key="`deptId`"
|
|
84
79
|
:placeholder-title="`请选择${item.label}`"
|
|
@@ -128,7 +123,7 @@
|
|
|
128
123
|
v-model="formInline[item.prop]"
|
|
129
124
|
type="textarea"
|
|
130
125
|
class="form_multiline"
|
|
131
|
-
:autosize="{ minRows: 2, maxRows: 4}"
|
|
126
|
+
:autosize="{ minRows: 2, maxRows: 4 }"
|
|
132
127
|
placeholder="请输入内容"
|
|
133
128
|
@input="handleInputValue($event, item.prop)"
|
|
134
129
|
/>
|
|
@@ -144,7 +139,8 @@
|
|
|
144
139
|
v-for="(optionItem, optionIndex) in item.optionArr"
|
|
145
140
|
:key="optionItem.optionValue + optionIndex"
|
|
146
141
|
:label="optionItem"
|
|
147
|
-
|
|
142
|
+
>{{ optionItem.optionLabel }}</el-radio
|
|
143
|
+
>
|
|
148
144
|
</el-radio-group>
|
|
149
145
|
|
|
150
146
|
<!-- 9. 多选框 MultipleCheckbox -->
|
|
@@ -158,7 +154,8 @@
|
|
|
158
154
|
v-for="(optionItem, optionIndex) in item.optionArr"
|
|
159
155
|
:key="optionItem.optionValue + optionIndex"
|
|
160
156
|
:label="optionItem"
|
|
161
|
-
|
|
157
|
+
>{{ optionItem.optionLabel }}</el-checkbox
|
|
158
|
+
>
|
|
162
159
|
</el-checkbox-group>
|
|
163
160
|
|
|
164
161
|
<!-- 10. 输入框 InputString InputInteger InputDecimals -->
|
|
@@ -201,7 +198,6 @@
|
|
|
201
198
|
|
|
202
199
|
<!-- 13. 富文本 RichText -->
|
|
203
200
|
|
|
204
|
-
|
|
205
201
|
<!-- 备用校验方法 -->
|
|
206
202
|
<!-- <div class="input_error" v-if="item.isRulesType"> <span class="input_error_label" :title="item.label">{{item.label}}</span>不能为空 </div> -->
|
|
207
203
|
</template>
|
|
@@ -214,19 +210,20 @@
|
|
|
214
210
|
export default {
|
|
215
211
|
name: 'FormDialog',
|
|
216
212
|
components: {
|
|
217
|
-
SelectTree: () =>
|
|
213
|
+
SelectTree: () =>
|
|
214
|
+
import('./components/SelectTree') /* 3. 选择器_树结构 SelectorTreeStructure */,
|
|
218
215
|
},
|
|
219
216
|
props: {
|
|
220
217
|
/* el-form-item表单循环项 */
|
|
221
218
|
formItemConfigArr: {
|
|
222
219
|
type: Array,
|
|
223
|
-
default: () => []
|
|
220
|
+
default: () => [],
|
|
224
221
|
},
|
|
225
222
|
/* 表单label宽度 */
|
|
226
223
|
labelWidth: {
|
|
227
224
|
type: String,
|
|
228
|
-
default: '120px'
|
|
229
|
-
}
|
|
225
|
+
default: '120px',
|
|
226
|
+
},
|
|
230
227
|
},
|
|
231
228
|
data() {
|
|
232
229
|
return {
|
|
@@ -239,55 +236,55 @@ export default {
|
|
|
239
236
|
/* 1. 选择器_单选 SelectorSingleSelection 绑定的值 */
|
|
240
237
|
valueSelectorSingle: '',
|
|
241
238
|
/* 表单校验 */
|
|
242
|
-
rulesForm: {}
|
|
243
|
-
}
|
|
239
|
+
rulesForm: {},
|
|
240
|
+
};
|
|
244
241
|
},
|
|
245
242
|
computed: {},
|
|
246
243
|
watch: {},
|
|
247
244
|
created() {
|
|
248
|
-
this.initialization()
|
|
245
|
+
this.initialization();
|
|
249
246
|
},
|
|
250
247
|
mounted() {},
|
|
251
248
|
methods: {
|
|
252
249
|
/* 初始化数据 */
|
|
253
250
|
initialization() {
|
|
254
251
|
for (let i = 1; i < this.formItemConfigArr.length; i++) {
|
|
255
|
-
const item = this.formItemConfigArr[i]
|
|
252
|
+
const item = this.formItemConfigArr[i];
|
|
256
253
|
this.rulesForm[item.prop] = {
|
|
257
254
|
required: true,
|
|
258
255
|
validator: this.validateRules(),
|
|
259
|
-
trigger: 'blur'
|
|
260
|
-
}
|
|
256
|
+
trigger: 'blur',
|
|
257
|
+
};
|
|
261
258
|
switch (item.itemType) {
|
|
262
259
|
/* 1. 选择器_单选 SelectorSingleSelection */
|
|
263
260
|
case 'SelectorSingleSelection':
|
|
264
|
-
this.formInline[item.prop] = {}
|
|
265
|
-
break
|
|
261
|
+
this.formInline[item.prop] = {};
|
|
262
|
+
break;
|
|
266
263
|
|
|
267
264
|
/* 2. 选择器_多选 SelectorMultipleSelection */
|
|
268
265
|
case 'SelectorMultipleSelection':
|
|
269
|
-
this.formInline[item.prop] = []
|
|
270
|
-
break
|
|
266
|
+
this.formInline[item.prop] = [];
|
|
267
|
+
break;
|
|
271
268
|
|
|
272
269
|
/* 3. 选择器_树结构 SelectorTreeStructure */
|
|
273
270
|
case 'SelectorTreeStructure':
|
|
274
|
-
this.formInline[item.prop] = {}
|
|
275
|
-
break
|
|
271
|
+
this.formInline[item.prop] = {};
|
|
272
|
+
break;
|
|
276
273
|
|
|
277
274
|
/* 8. 单选框 RadioBox */
|
|
278
275
|
case 'RadioBox':
|
|
279
|
-
this.formInline[item.prop] = {}
|
|
280
|
-
break
|
|
276
|
+
this.formInline[item.prop] = {};
|
|
277
|
+
break;
|
|
281
278
|
|
|
282
279
|
/* 9. 多选框 MultipleCheckbox */
|
|
283
280
|
case 'MultipleCheckbox':
|
|
284
|
-
this.formInline[item.prop] = []
|
|
285
|
-
break
|
|
281
|
+
this.formInline[item.prop] = [];
|
|
282
|
+
break;
|
|
286
283
|
|
|
287
284
|
/* 11. 计数器 CounterFrame */
|
|
288
285
|
case 'CounterFrame':
|
|
289
|
-
this.formInline[item.prop] = 0
|
|
290
|
-
break
|
|
286
|
+
this.formInline[item.prop] = 0;
|
|
287
|
+
break;
|
|
291
288
|
|
|
292
289
|
/**
|
|
293
290
|
* 4. 选择器_单时间 SelectorSingleTime
|
|
@@ -297,83 +294,87 @@ export default {
|
|
|
297
294
|
* 10. 输入框 InputString InputInteger InputDecimals
|
|
298
295
|
* 12. 文件上传 FileUpload
|
|
299
296
|
* 13. 富文本 RichText
|
|
300
|
-
|
|
297
|
+
**/
|
|
301
298
|
default:
|
|
302
|
-
this.formInline[item.prop] = ''
|
|
299
|
+
this.formInline[item.prop] = '';
|
|
303
300
|
}
|
|
304
301
|
}
|
|
305
302
|
},
|
|
306
303
|
/* 下拉框样式 无数据的情况下,给请选择提示设置最小宽度*/
|
|
307
304
|
setMinWidth(val) {
|
|
308
|
-
this.minWidth = val.srcElement.clientWidth
|
|
305
|
+
this.minWidth = val.srcElement.clientWidth;
|
|
309
306
|
},
|
|
310
307
|
validateRules(value, prop) {
|
|
311
|
-
console.log('validateRules', value, prop)
|
|
308
|
+
console.log('validateRules', value, prop);
|
|
312
309
|
if (!value) {
|
|
313
|
-
return `${prop}
|
|
310
|
+
return `${prop}不能为空`;
|
|
314
311
|
} else if (this.isNameType(value)) {
|
|
315
|
-
return `${prop}
|
|
312
|
+
return `${prop}只包含中文、英文、空格、数字、中划线、下划线`;
|
|
316
313
|
}
|
|
317
314
|
},
|
|
318
315
|
/**
|
|
319
316
|
* 只包含英文、数字、空格、中划线、下划线
|
|
320
317
|
* true 符合 false 不符合
|
|
321
|
-
|
|
318
|
+
**/
|
|
322
319
|
isCodeType(str, prop) {
|
|
323
320
|
if (str.length === 0) {
|
|
324
|
-
return `${prop}
|
|
321
|
+
return `${prop}不能为空`;
|
|
325
322
|
}
|
|
326
|
-
const reg =
|
|
327
|
-
|
|
328
|
-
const
|
|
323
|
+
const reg =
|
|
324
|
+
/[`~!@#$%^&*()+=<>?:"{}|,.;'·~!@#¥%……&*()——+={}|《》?:“”【】、;‘',。、]/im;
|
|
325
|
+
const regOne = /^[^\u4e00-\u9fa5]+$/;
|
|
326
|
+
const regTwo = /\\/;
|
|
329
327
|
if (!reg.test(str) && regOne.test(str) && !regTwo.test(str)) {
|
|
330
|
-
return `${prop}
|
|
328
|
+
return `${prop}只包含中文、英文、空格、数字、中划线、下划线`;
|
|
331
329
|
}
|
|
332
|
-
return true
|
|
330
|
+
return true;
|
|
333
331
|
},
|
|
334
332
|
/**
|
|
335
333
|
* 可输入英文、中文、空格、数字、中划线、下划线,特殊字符可以排除
|
|
336
334
|
* true 符合 false 不符合
|
|
337
|
-
|
|
335
|
+
**/
|
|
338
336
|
isNameType(str, prop) {
|
|
339
337
|
if (str.length === 0) {
|
|
340
|
-
return `${prop}
|
|
338
|
+
return `${prop}不能为空`;
|
|
341
339
|
}
|
|
342
|
-
const reg =
|
|
343
|
-
|
|
340
|
+
const reg =
|
|
341
|
+
/[`~!@#$%^&*()+=<>?:"{}|,.;'·~!@#¥%……&*()——+={}|《》?:“”【】、;‘',。、]/im;
|
|
342
|
+
const regTwo = /\\/;
|
|
344
343
|
if (!reg.test(str) && !regTwo.test(str)) {
|
|
345
|
-
return `${prop}
|
|
344
|
+
return `${prop}只包含英文、数字、空格、中划线、下划线`;
|
|
346
345
|
}
|
|
347
|
-
return true
|
|
346
|
+
return true;
|
|
348
347
|
},
|
|
349
348
|
|
|
350
349
|
/* 1. 选择器_单选 SelectorSingleSelection */
|
|
351
350
|
handleSelectorSingle(e, prop, index) {
|
|
352
|
-
this.formInline[prop] = {}
|
|
353
|
-
const arr = this.formItemConfigArr[index].optionArr
|
|
354
|
-
const objIndex = arr.find(item => {
|
|
355
|
-
if (item.optionValue === e) return item
|
|
356
|
-
})
|
|
357
|
-
this.handleInputValue(objIndex, prop)
|
|
351
|
+
this.formInline[prop] = {};
|
|
352
|
+
const arr = this.formItemConfigArr[index].optionArr;
|
|
353
|
+
const objIndex = arr.find((item) => {
|
|
354
|
+
if (item.optionValue === e) return item;
|
|
355
|
+
});
|
|
356
|
+
this.handleInputValue(objIndex, prop);
|
|
358
357
|
},
|
|
359
358
|
/* 2. 选择器_多选 SelectorMultipleSelection */
|
|
360
359
|
handleSelectorMultiple(e, prop) {
|
|
361
|
-
this.formInline[prop] = []
|
|
362
|
-
const nodesObj = this.$refs['formCascader'][0].getCheckedNodes()
|
|
363
|
-
const selectorMultipleSelectionArr = []
|
|
364
|
-
nodesObj.forEach(item => {
|
|
365
|
-
|
|
360
|
+
this.formInline[prop] = [];
|
|
361
|
+
const nodesObj = this.$refs['formCascader'][0].getCheckedNodes();
|
|
362
|
+
const selectorMultipleSelectionArr = [];
|
|
363
|
+
nodesObj.forEach((item) => {
|
|
364
|
+
selectorMultipleSelectionArr.push(item.data);
|
|
365
|
+
});
|
|
366
|
+
this.handleInputValue(selectorMultipleSelectionArr, prop);
|
|
366
367
|
},
|
|
367
368
|
|
|
368
369
|
/* 3. 选择器_树结构 SelectorTreeStructure */
|
|
369
370
|
nodeClickTree(data) {
|
|
370
|
-
this.handleInputValue(data, 'SelectorTreeStructure')
|
|
371
|
+
this.handleInputValue(data, 'SelectorTreeStructure');
|
|
371
372
|
},
|
|
372
373
|
|
|
373
374
|
/* 6. 选择器_日期范围 SelectorDateRange */
|
|
374
375
|
handleSelectorDateRange(e, prop) {
|
|
375
|
-
this.formInline[prop] = []
|
|
376
|
-
this.handleInputValue(e, prop)
|
|
376
|
+
this.formInline[prop] = [];
|
|
377
|
+
this.handleInputValue(e, prop);
|
|
377
378
|
},
|
|
378
379
|
|
|
379
380
|
/* 12. 文件上传 FileUpload */
|
|
@@ -387,15 +388,15 @@ export default {
|
|
|
387
388
|
* 9. 多选框 MultipleCheckbox
|
|
388
389
|
* 10. 输入框 InputString InputInteger InputDecimals
|
|
389
390
|
* 11. 计数器 CounterFrame
|
|
390
|
-
|
|
391
|
+
**/
|
|
391
392
|
handleInputValue(e, prop) {
|
|
392
|
-
this.formInline[prop] = e
|
|
393
|
-
this.$forceUpdate()
|
|
394
|
-
const data = { data: e, prop: prop }
|
|
395
|
-
this.$emit('handleInputValue', data)
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
393
|
+
this.formInline[prop] = e;
|
|
394
|
+
this.$forceUpdate();
|
|
395
|
+
const data = { data: e, prop: prop };
|
|
396
|
+
this.$emit('handleInputValue', data);
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
};
|
|
399
400
|
</script>
|
|
400
401
|
<style lang="scss" scoped>
|
|
401
402
|
// 1. 选择器_单选 form_select
|