@ -28,7 +28,7 @@
< / div >
< / div >
< el -card >
< el -card id = "docx-content" >
< div class = "title" > { { selectDate [ 0 ] ? $moment ( selectDate [ 0 ] ) . format ( 'YYYY-MM-DD' ) : "-" } } ~ { { selectDate [ 1 ] ? $moment ( selectDate [ 1 ] ) . format ( 'YYYY-MM-DD' ) : "-" } } 调度指令执行情况 < / div >
< p style = "text-indent: 30px;line-height: 1.2;padding: 20px 0;" > { { weather . weather } } < / p >
@ -44,6 +44,9 @@
< div v-for ="(item2, index2) in item1[1].sort((a,b) => new Date(a.act_start_time).valueOf() - new Date(b.act_start_time).valueOf())" :key="item2.id" style="display: flex;" >
< div style = "text-indent: 60px;" > { { index1 + 1 } } . { { index2 + 1 } } < / div >
< div >
< div >
【 { { diaolingleixing . get ( item2 . diaolingleixing ) } } 】 { { type ( item2 . leibie ) } }
< / div >
< div class = "time" >
< span > 时间 : < / span >
< span > { { item2 . act _start _time ? $moment ( item2 . act _start _time ) . format ( 'YYYY-MM-DD HH:mm' ) : "-" } } ~ { { item2 . act _end _time ? $moment ( item2 . act _end _time ) . format ( 'HH:mm' ) : "-" } } < / span >
@ -52,6 +55,9 @@
< span > 内容 : < / span >
< span > { { item2 . to _transfer _id ? "[调整]" : "" } } { { item2 . content } } < / span >
< / div >
< div class = "content" v-if ="item2.diaolingleixing === 4" >
< p v-for ="log in item2.id_logs_transfer_id_relation" > {{ $ moment ( log.created_at ) .format ( ' HH : mm ' ) }} {{ log.content }} < / p >
< / div >
< / div >
< / div >
< / div >
@ -92,6 +98,12 @@ export default {
transfers : [ ] ,
showData : [ ] ,
selectDate : [ new Date ( ) , new Date ( ) ] ,
diaolingleixing : new Map ( [
[ 1 , "水环境调令" ] ,
[ 2 , "防汛调令" ] ,
[ 3 , "船只过闸调令" ] ,
[ 4 , "逻辑调令" ]
] )
}
} ,
methods : {
@ -192,7 +204,7 @@ export default {
} ,
async getType ( ) {
const obj = ( await show ( { id : 1 } , false ) ) ? . select _item ;
const obj = ( await show ( { id : 3 1 } , false ) ) ? . select _item ;
if ( obj && typeof obj === "object" ) {
let keys = Object . keys ( obj ) ;
if ( keys . length > 0 ) {
@ -250,6 +262,11 @@ export default {
} ,
async exportDocx ( ) {
/ / c o n s t i n n e r H T M L = d o c u m e n t . q u e r y S e l e c t o r ( " # d o c x - c o n t e n t " ) . i n n e r H T M L ;
/ / c o n s t e x p o r t H T M L = ` < h t m l x m l n s : o = ' u r n : s c h e m a s - m i c r o s o f t - c o m : o f f i c e : o f f i c e ' x m l n s : w = ' u r n : s c h e m a s - m i c r o s o f t - c o m : o f f i c e : w o r d ' x m l n s = ' h t t p : / / w w w . w 3 . o r g / T R / R E C - h t m l 4 0 ' > < h e a d > < m e t a c h a r s e t = ' u t f - 8 ' > < t i t l e > 调 令 内 容 < / t i t l e > < / h e a d > < b o d y > $ { i n n e r H T M L } < / b o d y > < / h t m l > `
/ / l e t b l o b = n e w B l o b ( [ " \ u f e f f " , e x p o r t H T M L ] , {
/ / t y p e : " a p p l i c a t i o n / m s w o r d " ,
/ / } )
const document = new Document ( {
sections : [
{
@ -300,7 +317,7 @@ export default {
line : 300
} ,
indent : {
firstLine: convertInchesToTwip ( 0.5 )
left: 200
} ,
children : [
new TextRun ( {
@ -312,17 +329,37 @@ export default {
... i1 [ 1 ] . sort ( ( a , b ) => new Date ( a . act _start _time ) . valueOf ( ) - new Date ( b . act _start _time ) . valueOf ( ) ) . map ( ( i2 , index2 ) => {
return new Paragraph ( {
indent : {
firstLine: convertInchesToTwip ( 0.8 )
left: 400
} ,
alignment : AlignmentType . LEFT ,
children : [
new TextRun ( {
text : ` ${ index1 + 1 } . ${ index2 + 1 } `,
text : ` ${ index1 + 1 } . ${ index2 + 1 } 【${ this . diaolingleixing . get ( i2 . diaolingleixing ) } 】 ${ this . type ( i2 . leibie ) } `,
size : 20 ,
break : 1 ,
} ) ,
new TextRun ( {
text : ` 时间: ${ i2 . act _start _time ? this . $moment ( i2 . act _start _time ) . format ( 'YYYY-MM-DD HH:mm' ) : "-" } ~ ${ i2 . act _end _time ? this . $moment ( i2 . act _end _time ) . format ( 'HH:mm' ) : "-" } ` ,
size : 18 ,
break : 1 ,
} ) ,
new TextRun ( {
text : ` 时间: ${ i2 . act _start _time ? this . $moment ( i2 . act _start _time ) . format ( 'YYYY-MM-DD HH:mm' ) : "-" } ~ ${ i2 . act _end _time ? this . $moment ( i2 . act _end _time ) . format ( 'HH:mm' ) : "-" } \ n \ t ${ i2 . to _transfer _id ? "[调整]" : "" } 内容: ${ i2 . content || '' } ` ,
size : 18
} )
text : ` ${ i2 . to _transfer _id ? "[调整]" : "" } 内容: ${ i2 . content || '' } ` ,
size : 18 ,
break : 1 ,
} ) ,
... ( ( ) => {
if ( i2 . diaolingleixing === 4 ) {
return i2 . id _logs _transfer _id _relation . map ( log => new TextRun ( {
text : ` ${ this . $moment ( log . created _at ) . format ( 'HH:mm' ) } ${ log . content } ` ,
size : 18 ,
break : 1 ,
} ) )
} else {
return [ ]
}
} ) ( )
]
} )
} )
@ -336,17 +373,23 @@ export default {
} )
const blob = await Packer . toBlob ( document )
saveAs ( blob , ` ${ this . selectDate [ 0 ] ? this . $moment ( this . selectDate [ 0 ] ) . format ( 'YYYY年MM月DD日' ) : "-" } ~ ${ this . selectDate [ 1 ] ? this . $moment ( this . selectDate [ 1 ] ) . format ( 'YYYY年MM月DD日' ) : "-" } 调度指令执行情况 ` )
}
saveAs ( blob , ` ${ this . selectDate [ 0 ] ? this . $moment ( this . selectDate [ 0 ] ) . format ( 'YYYY年MM月DD日' ) : "-" } ~ ${ this . selectDate [ 1 ] ? this . $moment ( this . selectDate [ 1 ] ) . format ( 'YYYY年MM月DD日' ) : "-" } 调度指令执行情况 .docx ` )
} ,
} ,
computed : {
area ( ) {
return function ( area ) {
return this . areas . find ( i => i . value === area ) ? . key
}
} ,
type ( ) {
return function ( type ) {
return this . types . find ( i => i . value === type ) ? . key
}
}
} ,
created ( ) {
this . getType ( )
this . getArea ( )
this . getTransfer ( )
this . getWeather ( )