Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
7a4e9519
authored
2024-02-06 13:26:12 +0800
by
renchao@pashanhoo.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:证书预览
1 parent
bccdee33
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
26 deletions
src/views/workflow/components/dialog/zsdy.vue
src/views/workflow/components/dialog/zsyl.vue
src/views/workflow/components/dialog/zsdy.vue
View file @
7a4e951
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2024-0
1-24 17:31:21
* @LastEditTime: 2024-0
2-06 13:23:36
-->
<
template
>
<div>
...
...
@@ -526,7 +526,7 @@
// context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228);
// 权利人
let
qlrlines
=
this
.
bdcqz
.
qlr
if
(
getByteLen
(
this
.
bdcqz
.
qlr
)
>
3
6
)
{
if
(
getByteLen
(
this
.
bdcqz
.
qlr
)
>
3
2
)
{
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
qlrlines
)
{
...
...
@@ -551,7 +551,7 @@
// context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275);
let
ywrlines
=
this
.
bdcqz
.
ywr
if
(
getByteLen
(
this
.
bdcqz
.
ywr
)
>
3
6
)
{
if
(
getByteLen
(
this
.
bdcqz
.
ywr
)
>
3
2
)
{
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
ywrlines
)
{
...
...
@@ -575,7 +575,7 @@
let
lines2
=
this
.
bdcqz
.
zl
?
this
.
bdcqz
.
zl
.
split
(
' '
)
:
[];
if
(
getByteLen
(
this
.
bdcqz
.
zl
)
>
3
7
)
{
if
(
getByteLen
(
this
.
bdcqz
.
zl
)
>
3
2
)
{
lines2
.
forEach
((
line
,
index
)
=>
{
const
y
=
315
+
(
index
*
20
);
// 每行文本的垂直位置
let
currentLine
=
''
;
...
...
@@ -628,12 +628,60 @@
// 恢复原始字体设置
context
.
font
=
originalFont
;
// qlqtzk
function
getByteLenBdcdy
(
val
)
{
var
encoder
=
new
TextEncoder
(
'utf-8'
);
return
encoder
.
encode
(
val
).
length
;
}
const
maxWidth
=
290
;
// 最大宽度限制
let
lines
=
this
.
bdcqz
.
qlqtzk
?
this
.
bdcqz
.
qlqtzk
.
split
(
'\n'
).
filter
(
i
=>
i
&&
i
.
trim
())
:
[];
for
(
let
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
console
.
log
(
getByteLen
(
lines
[
i
]));
let
num
=
Math
.
ceil
(
getByteLen
(
lines
[
i
])
/
37
)
if
(
getByteLen
(
lines
[
i
])
>
37
)
{
let
bdcdyNum
=
Math
.
ceil
(
getByteLenBdcdy
(
lines
[
0
])
/
43
)
// 单独处理不动产单元号
let
linesBdcdy
=
lines
[
0
]
?
lines
[
0
].
split
(
' '
)
:
[];
if
(
getByteLenBdcdy
(
lines
[
0
])
>
43
)
{
linesBdcdy
.
forEach
((
line
,
index
)
=>
{
const
y
=
412
+
(
index
*
17
);
// 每行文本的垂直位置
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
line
)
{
const
testLine
=
currentLine
+
word
;
const
lineWidth
=
context
.
measureText
(
testLine
).
width
;
if
(
lineWidth
<=
maxWidth
)
{
currentLine
=
testLine
;
}
else
{
arr
.
push
(
currentLine
);
currentLine
=
word
;
}
}
arr
.
push
(
currentLine
);
arr
.
forEach
((
line
,
index
)
=>
{
context
.
fillText
(
line
,
770
,
y
+
(
index
*
17
));
// 调整行高
})
})
}
else
{
linesBdcdy
.
forEach
((
line
,
index
)
=>
{
const
y
=
418
+
(
index
*
17
);
// 每行文本的垂直位置
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
line
)
{
const
testLine
=
currentLine
+
word
;
const
lineWidth
=
context
.
measureText
(
testLine
).
width
;
if
(
lineWidth
<=
maxWidth
)
{
currentLine
=
testLine
;
}
else
{
arr
.
push
(
currentLine
);
currentLine
=
word
;
}
}
arr
.
push
(
currentLine
);
arr
.
forEach
((
line
,
index
)
=>
{
context
.
fillText
(
line
,
770
,
y
+
(
index
*
17
));
// 调整行高
})
})
}
for
(
let
i
=
1
;
i
<
lines
.
length
;
i
++
)
{
let
num
=
Math
.
ceil
(
getByteLen
(
lines
[
i
])
/
32
)
if
(
getByteLen
(
lines
[
i
])
>
32
)
{
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
lines
[
i
])
{
...
...
@@ -649,18 +697,18 @@
arr
.
push
(
currentLine
);
if
(
i
>
0
)
{
arr
.
forEach
((
line
,
index
)
=>
{
context
.
fillText
(
line
,
770
,
4
38
+
(
24
*
(
i
-
1
))
+
5
*
num
+
(
index
*
17
));
// 调整行高
context
.
fillText
(
line
,
770
,
4
08
+
(
bdcdyNum
*
15
)
+
(
24
*
(
i
-
1
))
+
5
*
num
+
(
index
*
17
));
// 调整行高
})
}
else
{
arr
.
forEach
((
line
,
index
)
=>
{
context
.
fillText
(
line
,
770
,
4
38
+
(
24
*
(
i
-
1
))
+
(
index
*
17
));
// 调整行高
context
.
fillText
(
line
,
770
,
4
08
+
(
bdcdyNum
*
15
)
+
(
24
*
(
i
-
1
))
+
(
index
*
17
));
// 调整行高
})
}
}
else
{
if
(
i
>
0
)
{
context
.
fillText
(
lines
[
i
]
?
lines
[
i
]
:
''
,
770
,
4
47
+
6
*
num
+
(
25
*
(
i
-
1
)));
context
.
fillText
(
lines
[
i
]
?
lines
[
i
]
:
''
,
770
,
4
17
+
(
bdcdyNum
*
15
)
+
6
*
num
+
(
25
*
(
i
-
1
)));
}
else
{
context
.
fillText
(
lines
[
i
]
?
lines
[
i
]
:
''
,
770
,
4
47
+
(
25
*
(
i
-
1
)));
context
.
fillText
(
lines
[
i
]
?
lines
[
i
]
:
''
,
770
,
4
17
+
(
bdcdyNum
*
15
)
+
(
25
*
(
i
-
1
)));
}
}
}
...
...
src/views/workflow/components/dialog/zsyl.vue
View file @
7a4e951
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2024-0
1-30 16:29:37
* @LastEditTime: 2024-0
2-06 13:23:44
-->
<
template
>
<div
class=
"from-clues loadingtext"
v-Loading=
"loading"
element-loading-text=
"拼命加载中..."
style=
"text-align: center;"
>
...
...
@@ -415,7 +415,6 @@
}
return
len
;
}
const
canvas
=
this
.
$refs
.
zm
;
const
context
=
canvas
.
getContext
(
'2d'
);
const
image
=
new
Image
();
...
...
@@ -434,7 +433,6 @@
}
context
.
fillText
(
this
.
bdcqz
.
sjjc
?
this
.
bdcqz
.
sjjc
:
''
,
620
,
125
);
context
.
fillText
(
this
.
bdcqz
.
djnd
?
this
.
bdcqz
.
djnd
:
''
,
665
,
125
);
console
.
log
(
getByteLen
(
this
.
bdcqz
.
sxqc
));
if
(
getByteLen
(
this
.
bdcqz
.
sxqc
)
>
14
)
{
const
originalFont
=
context
.
font
;
// 设置新的字体大小
...
...
@@ -452,7 +450,7 @@
// context.fillText(this.bdcqz.qlr ? this.bdcqz.qlr : '', 775, 228);
// 权利人
let
qlrlines
=
this
.
bdcqz
.
qlr
if
(
getByteLen
(
this
.
bdcqz
.
qlr
)
>
3
6
)
{
if
(
getByteLen
(
this
.
bdcqz
.
qlr
)
>
3
2
)
{
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
qlrlines
)
{
...
...
@@ -477,7 +475,7 @@
// 义务人
// context.fillText(this.bdcqz.ywr ? this.bdcqz.ywr : '', 775, 275);
let
ywrlines
=
this
.
bdcqz
.
ywr
if
(
getByteLen
(
this
.
bdcqz
.
ywr
)
>
3
6
)
{
if
(
getByteLen
(
this
.
bdcqz
.
ywr
)
>
3
2
)
{
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
ywrlines
)
{
...
...
@@ -500,9 +498,8 @@
}
// context.fillText(this.bdcqz.zl ? this.bdcqz.zl : '', 775, 325);
let
lines2
=
this
.
bdcqz
.
zl
?
this
.
bdcqz
.
zl
.
split
(
' '
)
:
[];
if
(
getByteLen
(
this
.
bdcqz
.
zl
)
>
3
7
)
{
if
(
getByteLen
(
this
.
bdcqz
.
zl
)
>
3
2
)
{
lines2
.
forEach
((
line
,
index
)
=>
{
const
y
=
315
+
(
index
*
20
);
// 每行文本的垂直位置
let
currentLine
=
''
;
...
...
@@ -557,11 +554,60 @@
// 恢复原始字体设置
context
.
font
=
originalFont
;
// qlqtzk
function
getByteLenBdcdy
(
val
)
{
var
encoder
=
new
TextEncoder
(
'utf-8'
);
return
encoder
.
encode
(
val
).
length
;
}
const
maxWidth
=
295
;
// 最大宽度限制
let
lines
=
this
.
bdcqz
.
qlqtzk
?
this
.
bdcqz
.
qlqtzk
.
split
(
'\n'
).
filter
(
i
=>
i
&&
i
.
trim
())
:
[];
for
(
let
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
let
num
=
Math
.
ceil
(
getByteLen
(
lines
[
i
])
/
37
)
if
(
getByteLen
(
lines
[
i
])
>
37
)
{
let
bdcdyNum
=
Math
.
ceil
(
getByteLenBdcdy
(
lines
[
0
])
/
43
)
// 单独处理不动产单元号
let
linesBdcdy
=
lines
[
0
]
?
lines
[
0
].
split
(
' '
)
:
[];
if
(
getByteLenBdcdy
(
lines
[
0
])
>
43
)
{
linesBdcdy
.
forEach
((
line
,
index
)
=>
{
const
y
=
412
+
(
index
*
17
);
// 每行文本的垂直位置
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
line
)
{
const
testLine
=
currentLine
+
word
;
const
lineWidth
=
context
.
measureText
(
testLine
).
width
;
if
(
lineWidth
<=
maxWidth
)
{
currentLine
=
testLine
;
}
else
{
arr
.
push
(
currentLine
);
currentLine
=
word
;
}
}
arr
.
push
(
currentLine
);
arr
.
forEach
((
line
,
index
)
=>
{
context
.
fillText
(
line
,
770
,
y
+
(
index
*
17
));
// 调整行高
})
})
}
else
{
linesBdcdy
.
forEach
((
line
,
index
)
=>
{
const
y
=
418
+
(
index
*
17
);
// 每行文本的垂直位置
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
line
)
{
const
testLine
=
currentLine
+
word
;
const
lineWidth
=
context
.
measureText
(
testLine
).
width
;
if
(
lineWidth
<=
maxWidth
)
{
currentLine
=
testLine
;
}
else
{
arr
.
push
(
currentLine
);
currentLine
=
word
;
}
}
arr
.
push
(
currentLine
);
arr
.
forEach
((
line
,
index
)
=>
{
context
.
fillText
(
line
,
770
,
y
+
(
index
*
17
));
// 调整行高
})
})
}
for
(
let
i
=
1
;
i
<
lines
.
length
;
i
++
)
{
let
num
=
Math
.
ceil
(
getByteLen
(
lines
[
i
])
/
32
)
if
(
getByteLen
(
lines
[
i
])
>
32
)
{
let
currentLine
=
''
;
let
arr
=
[];
for
(
let
word
of
lines
[
i
])
{
...
...
@@ -577,18 +623,18 @@
arr
.
push
(
currentLine
);
if
(
i
>
0
)
{
arr
.
forEach
((
line
,
index
)
=>
{
context
.
fillText
(
line
,
770
,
4
38
+
(
24
*
(
i
-
1
))
+
5
*
num
+
(
index
*
17
));
// 调整行高
context
.
fillText
(
line
,
770
,
4
08
+
(
bdcdyNum
*
15
)
+
(
24
*
(
i
-
1
))
+
5
*
num
+
(
index
*
17
));
// 调整行高
})
}
else
{
arr
.
forEach
((
line
,
index
)
=>
{
context
.
fillText
(
line
,
770
,
4
38
+
(
24
*
(
i
-
1
))
+
(
index
*
17
));
// 调整行高
context
.
fillText
(
line
,
770
,
4
08
+
(
bdcdyNum
*
15
)
+
(
24
*
(
i
-
1
))
+
(
index
*
17
));
// 调整行高
})
}
}
else
{
if
(
i
>
0
)
{
context
.
fillText
(
lines
[
i
]
?
lines
[
i
]
:
''
,
770
,
4
47
+
6
*
num
+
(
25
*
(
i
-
1
)));
context
.
fillText
(
lines
[
i
]
?
lines
[
i
]
:
''
,
770
,
4
17
+
(
bdcdyNum
*
15
)
+
6
*
num
+
(
25
*
(
i
-
1
)));
}
else
{
context
.
fillText
(
lines
[
i
]
?
lines
[
i
]
:
''
,
770
,
4
47
+
(
25
*
(
i
-
1
)));
context
.
fillText
(
lines
[
i
]
?
lines
[
i
]
:
''
,
770
,
4
17
+
(
bdcdyNum
*
15
)
+
(
25
*
(
i
-
1
)));
}
}
}
...
...
Please
register
or
sign in
to post a comment