Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhouqian
vue-gjjs
Commits
467cf56d
Commit
467cf56d
authored
Jul 05, 2021
by
1377875331@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
面函xml格式显示
parent
9ffa5e63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
12 deletions
+91
-12
Event.js
src/model/Ditopn/Event.js
+2
-2
index.js
src/utils/index.js
+82
-0
Show.vue
src/views/Docpan/Show.vue
+7
-10
No files found.
src/model/Ditopn/Event.js
View file @
467cf56d
...
...
@@ -345,8 +345,8 @@ export default {
// let url = rtnmsg.data.trnmod_trndoc_smh_docpth;
this
.
title
=
"面函"
let
viewurl
=
"/#/docpan/show"
;
v
iewurl
+=
"?model="
+
rtnmsg
.
data
.
litbenl1blk
;
console
.
log
(
viewurl
)
v
ar
newXml
=
Utils
.
showXml
(
rtnmsg
.
data
.
litbenl1blk
)
window
.
sessionStorage
.
docXML
=
newXml
;
window
.
open
(
viewurl
,
'newwindow'
,
'height=1200,width=800,top=100,left=100,toolbar=no,resizable=no,menubar=no,location=no, status=no'
);
}
this
.
dialogOpen
=
true
...
...
src/utils/index.js
View file @
467cf56d
...
...
@@ -60,4 +60,85 @@ export default class Utils {
}
return
target
;
}
static
showXml
(
str
){
var
text
=
str
//去掉多余的空格
text
=
'
\
n'
+
text
.
replace
(
/
(
<
\w
+
)(\s
.*
?
>
)
/g
,
function
(
$0
,
name
,
props
)
{
return
name
+
' '
+
props
.
replace
(
/
\s
+
(\w
+=
)
/g
,
" $1"
);
}).
replace
(
/>
\s
*
?
</g
,
">
\
n<"
);
//把注释编码
text
=
text
.
replace
(
/
\n
/g
,
'
\
r'
).
replace
(
/<!--
(
.+
?)
-->/g
,
function
(
$0
,
text
)
{
var
ret
=
'<!--'
+
escape
(
text
)
+
'-->'
;
return
ret
;
}).
replace
(
/
\r
/g
,
'
\
n'
);
//调整格式
var
rgx
=
/
\n(
<
(([^\?])
.+
?)(?:\s
|
\s
*
?
>|
\s
*
?(\/)
>
)(?:
.*
?(?:(?:(\/)
>
)
|
(?:
<
(\/)\2
>
)))?)
/mg
;
var
nodeStack
=
[];
var
output
=
text
.
replace
(
rgx
,
function
(
$0
,
all
,
name
,
isBegin
,
isCloseFull1
,
isCloseFull2
,
isFull1
,
isFull2
){
var
isClosed
=
(
isCloseFull1
==
'/'
)
||
(
isCloseFull2
==
'/'
)
||
(
isFull1
==
'/'
)
||
(
isFull2
==
'/'
);
var
prefix
=
''
;
if
(
isBegin
==
'!'
)
{
prefix
=
Utils
.
getPrefix
(
nodeStack
.
length
);
}
else
{
if
(
isBegin
!=
'/'
)
{
prefix
=
Utils
.
getPrefix
(
nodeStack
.
length
);
if
(
!
isClosed
)
{
nodeStack
.
push
(
name
);
}
}
else
{
nodeStack
.
pop
();
prefix
=
Utils
.
getPrefix
(
nodeStack
.
length
);
}
}
var
ret
=
'
\
n'
+
prefix
+
all
;
return
ret
;
});
var
prefixSpace
=
-
1
;
var
outputText
=
output
.
substring
(
1
);
//把注释还原并解码,调格式
outputText
=
outputText
.
replace
(
/
\n
/g
,
'
\
r'
).
replace
(
/
(\s
*
)
<!--
(
.+
?)
-->/g
,
function
(
$0
,
prefix
,
text
)
{
if
(
prefix
.
charAt
(
0
)
==
'
\
r'
)
prefix
=
prefix
.
substring
(
1
);
text
=
unescape
(
text
).
replace
(
/
\r
/g
,
'
\
n'
);
var
ret
=
'
\
n'
+
prefix
+
'<!--'
+
text
.
replace
(
/^
\s
*/mg
,
prefix
)
+
'-->'
;
return
ret
;
});
//alert(outputText);
outputText
=
outputText
.
replace
(
/
\s
+$/g
,
''
).
replace
(
/
\r
/g
,
'
\
r
\
n'
);
return
outputText
}
static
getPrefix
(
prefixIndex
)
{
var
span
=
' '
;
var
output
=
[];
for
(
var
i
=
0
;
i
<
prefixIndex
;
++
i
)
{
output
.
push
(
span
);
}
return
output
.
join
(
''
);
}
}
\ No newline at end of file
src/views/Docpan/Show.vue
View file @
467cf56d
<
template
>
<div>
<div
class=
"title"
>
面函列表
</div>
<div>
<c-input
type=
"textarea"
:autosize=
"
{ minRows: 16}"
placeholder="请输入原因"
v-model="model">
</c-input>
<div
style=
"height:1000px;width:900px;overflow:auto"
>
<pre>
{{
model
.
docXML
}}
</pre>
</div>
</div>
</
template
>
...
...
@@ -19,12 +16,12 @@ import Utils from "~/utils"
export
default
{
data
(){
return
{
model
:
this
.
$route
.
query
.
model
,
model
:
{
docXML
:
""
},
}
},
mounted
()
{
console
.
log
(
this
.
$router
);
}
this
.
model
.
docXML
=
window
.
sessionStorage
.
docXML
}
}
</
script
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment