@@ -1,56 +1,74 @@
< template >
< div class = "app-container" >
< el-card class = "topCard" >
< div class = "topDiv" >
< s pan style = "margin-left: 10px" > 工位号 : < / span >
< el-select v-model = "imgDialogOpName" placeholder="请选择工位号" size="small" style="width: 150px" @change="getImgCheckDirectFileList" >
< el -option
v-for = "item in stationNumber"
:key = "item.value"
:label = "item.la bel "
:value = "item.value"
size = "mini" / >
< / el-select >
<!-- < el-select v-model = "imgDialogBigType" placeholder="请选择机型" size="small" style="width: 150px" > - - >
<!-- < el-option-- >
<!-- label = "5S" -- >
<!-- value = "1" -- >
<!-- size = "mini" / > -- >
<!-- < el-option-- >
<!-- label = "6S" -- >
<!-- value = "4" -- >
<!-- size= "mini" / > -- >
<!-- < / el-select > -- >
< el-button type = "primary" plain size = "small" icon = "el-icon-order" @click ="getImgCheckDirectFileList" > 查询 < / el -button >
< el-button type = "distribution" icon = "el-icon-circle-plus-outline" size = "small" @click ="uploadShowPDF()" > 上传 < / el -button >
< /div >
< div c lass = "main" >
< el-table
:data = "imgCheckDirectFileList"
size = "small"
style = "width: 100%; height: 680px; font-size: 20px; color: #000; border: 1px solid #9e9b9b"
>
< el-table-column
label = "排序"
type = "index"
align = "center"
width = "100" / >
< el-table-column prop = "文件名称" label = "文件名称" align = "center" / >
< el-table-column prop = "操作时间" label = "导入时间" align = "center" / >
< el-table-column label = "查看文件" align = "center" width = "150" >
< template slot -scope = " scope2 " >
< el-button type = "warning" @click ="imgCheckDirectFile(scope2.row)" > 打开指导文件 < / el-button >
< / template >
< / el-table-column >
< el-table-column label = "操作" align = "center" width = "150" >
< template slot -scope = " scope2 " >
< el-button type = "warning" @click ="deleteImgCheckDirectFileSubmit(scope2.row)" > 删除 < / el-button >
< / template >
< / el-table-column >
< / el-table >
< / div >
< el-tabs v-model = "activeTab" @tab-click="handleTabClick" >
< el -tab - pane label = "工位PDF" name = "station" >
< div class = "topDiv" >
< span style = "margin-left: 10px" > 工位号 : < / span >
< el-select v-model = "imgDialogOpName" placeholder="请选择工位号" size="small" style="width: 150px" @change="getImgCheckDirectFileList" >
< el -option
v-for = "item in stationNum ber "
:key = "item.value"
:label = "item.label"
:value = "item.value"
size = "mini" / >
< / el-select >
< el-button type = "primary" plain size = "small" icon = "el-icon-order" @click ="getImgCheckDirectFileList" > 查询 < / el -button >
< el-button type = "distribution" icon = "el-icon-circle-plus-outline" size = "small" @click ="uploadShowPDF()" > 上传 < / el -button >
< / div >
< div class = "main" >
< el-table
:data = "imgCheckDirectFileList"
size = "small"
style = "width: 100%; height: 680px; font-size: 20px; color: #000; border: 1px solid #9e9b9b"
>
< el-table-column label = "排序" type = "index" align = "center" width = "100" / >
< el-table-column prop = "文件名称" label = "文件名称" align = "center" / >
< el-table-column prop = "操作时间" label = "导入时间" align = "center" / >
< el-table-column label = "查看文件" align = "center" width = "150" >
< template slot -scope = " scope2 " >
< el-button type = "warning" @click ="imgCheckDirectFile(scope2.row)" > 打开指导文件 < / el -button >
< / template >
< / el-table-column >
< el-table-column label = "操作" align = "center" width = "150" >
< template slot -scope = " scope2 " >
< el-button type = "warning" @click ="deleteImgCheckDirectFileSubmit(scope2.row)" > 删除 < / el -button >
< / template >
< / el-table-column >
< / el-table >
< /div >
</ el-tab-pane >
< el-tab-pane label = "整线PDF" name = "line" >
< div class = "topDiv" >
< el-button type = "primary" plain size = "small" icon = "el-icon-order" @click ="getLineDirectFileList" > 查询 < / el -button >
< el-button type = "distribution" icon = "el-icon-circle-plus-outline" size = "small" @click ="uploadShowPDF()" > 上传 < / el -button >
< / div >
< div class = "main" >
< el-table
:data = "lineDirectFileList"
size = "small"
style = "width: 100%; height: 680px; font-size: 20px; color: #000; border: 1px solid #9e9b9b"
>
< el-table-column label = "排序" type = "index" align = "center" width = "100" / >
< el-table-column prop = "文件名称" label = "文件名称" align = "center" / >
< el-table-column prop = "操作时间" label = "导入时间" align = "center" / >
< el-table-column label = "查看文件" align = "center" width = "150" >
< template slot -scope = " scope2 " >
< el-button type = "warning" @click ="lineCheckDirectFile(scope2.row)" > 打开指导文件 < / el -button >
< / template >
< / el-table-column >
< el-table-column label = "操作" align = "center" width = "150" >
< template slot -scope = " scope2 " >
< el-button type = "warning" @click ="deleteLineDirectFileSubmit(scope2.row)" > 删除 < / el -button >
< / template >
< / el-table-column >
< / el-table >
< / div >
< / el-tab-pane >
< / el-tabs >
< / el-card >
<!-- 上传文件 -- >
< el-dialog v-el-drag-dialog :visible.sync = "imgDialogFormVisible" title = "上传指导文件" center style = "height: 800px" width = "460px" >
< el-upload
id = "invoiceScan"
@@ -77,70 +95,40 @@
< el-button type = "primary" style = "width: 70px" @click ="submitPicturePDF()" > 确定 < / el -button >
< / div >
< / el-dialog >
<!-- 展示文件列表 -- >
< el-dialog v-el-drag-dialog :visible.sync = "imgCheckDialogFormVisible" title = "查看指导文件" center style = "height: 100%;overflow: auto" width = "80%" >
< span style = "margin-left: 10px" > 工位号 : < / span >
< el-button type = "text" size = "mini" icon = "el-icon-circle-check-outline" @click ="getImgCheckDirectFileList" > 查看 < / el -button >
< el-table
:data = "imgCheckDirectFileList"
size = "small"
max -height = " 365px "
style = "width: 100%; height: 280px; font-size: 20px; color: #000; border: 1px solid #9e9b9b"
>
< el-table-column
label = "排序"
type = "index"
align = "center"
width = "100" / >
< el-table-column prop = "文件名称" label = "文件名称" align = "center" / >
< el-table-column prop = "操作时间" label = "导入时间" align = "center" / >
< el-table-column label = "查看文件" align = "center" width = "150" >
< template slot -scope = " scope2 " >
< el-button type = "warning" @click ="imgCheckDirectFile(scope2.row)" > 打开指导文件 < / el-button >
< / template >
< / el-table-column >
< el-table-column label = "操作" align = "center" width = "150" >
< template slot -scope = " scope2 " >
< el-button type = "warning" @click ="deleteImgCheckDirectFileSubmit(scope2.row)" > 删除 < / el-button >
< / template >
< / el-table-column >
< / el-table >
< div slot = "footer" class = "dialog-footer" >
< el-button @click ="imgCheckDialogFormVisible=false" > 取消 < / el -button >
< / div >
< / el-dialog >
< / div >
< / template >
< script >
import { mapGetters } from 'vuex'
import { url } from '@/utils/request'
import $ from 'jquery'
import { getTableData1 , getTableData2 , getTableData3 , editType , confirmEdit1 , confirmEdit2 , selectCount , openDelete1 , openDelete2 , submit1 , submit2 , exportOut } from '@/api/ManufacturingCenter/maintainInformation'
import { MESUploadFileProject } from '@/utils/request'
export default {
data ( ) {
return {
activeTab : 'station' ,
imgDialogFormVisible : false ,
imgDialogObj : '' , // 点检类型对象
imgDialogOpName : '' , // 点检指导文件选择的工位号
// imgDialogBigType: '1', // 点检机型类型
imgCheckDialogFormVisible : false , // 查看点检文件
imgDialogObj : '' ,
imgDialogOpName : '' ,
imgCheckDialogFormVisible : false ,
stationNumber : [ ] ,
stationName : '' ,
limit : 1 ,
DataPDF : { } ,
uploadPDF : url ,
imgCheckDirectFileList : [ ] ,
lineDirectFileList : [ ] ,
dialogFormVisible : false
}
} ,
computed : {
} ,
created ( ) {
this . getStationNumber ( )
} ,
methods : {
handleTabClick ( ) {
if ( this . activeTab === 'line' ) {
this . getLineDirectFileList ( )
} else if ( this . imgDialogOpName ) {
this . getImgCheckDirectFileList ( )
}
} ,
getStationNumber ( ) {
this . stationNumber = [ ]
var param = [ ]
@@ -155,19 +143,9 @@ export default {
}
} )
} ,
// 表格颜色变化
tableRowClassName ( { row , rowIndex } ) {
// console.log(row, rowIndex)
if ( rowIndex % 2 === 0 ) {
return 'black'
} else {
return 'red'
}
} ,
// 给样式的
handelLimitStyle ( ) {
var obj = document . getElementsByClassName ( 'el-upload--picture-card' )
if ( obj [ 0 ] . style . display === 'none' ) {
if ( obj [ 0 ] && obj [ 0 ] . style . display === 'none' ) {
for ( var i = 0 ; i < obj . length ; i ++ ) {
obj [ i ] . style . display = 'block'
}
@@ -175,79 +153,81 @@ export default {
} ,
handelLimit ( ) {
var obj = document . getElementsByClassName ( 'el-upload--picture-card' )
if ( obj [ 0 ] . style . display === '' ) {
if ( obj [ 0 ] && obj [ 0 ] . style . display === '' ) {
for ( var i = 0 ; i < obj . length ; i ++ ) {
obj [ i ] . style . display = 'none'
}
}
} ,
// 上传成功回调
uploadSuccessPDF ( res ) {
uploadSuccessPDF ( ) {
this . dialogFormVisible = false
this . $refs . uploadPDF . clearFiles ( )
var obj = document . getElementsByClassName ( 'el-upload--picture-card' )
if ( obj [ 0 ] . style . display === 'none' ) {
if ( obj [ 0 ] && obj [ 0 ] . style . display === 'none' ) {
for ( var i = 0 ; i < obj . length ; i ++ ) {
obj [ i ] . style . display = 'block'
}
}
this . $message . success ( '指导文件上传成功!' )
if ( this . activeTab === 'line' ) {
this . getLineDirectFileList ( )
} else {
this . getImgCheckDirectFileList ( )
}
} ,
handlePictureCardPreview ( file ) {
this . dialogImageUrl = file . url
this . dialogVisiblePictureCard = true
} ,
// 上传前检测
beforeUploadPdf ( file ) {
let isJPG = /(\.|\/)(pdf)$/ . test ( file . type )
if ( ! isJPG ) {
let isPDF = /(\.|\/)(pdf)$/i . test ( file . type ) || /\.pdf$/i . test ( file . name )
if ( ! isPDF ) {
this . $message . error ( '只能上传PDF' )
return false
}
if ( ! this . imgDialogOpName ) {
if ( this . activeTab === 'station' && ! this . imgDialogOpName ) {
this . $message . error ( '请选择工位号' )
isJPG = false
return false
}
// if (!this.imgDialogBigType) {
// this.$message.error('请选择机型后提交')
// isJPG = false
// }
return isJPG
return true
} ,
warningExceedPdf ( ) {
this . $message . error ( '仅可上传一份PDF指导文件' )
} ,
// 预览指导文件按钮
imgCheckDirectFile ( row ) {
var param = [ ]
param [ 0 ] = [ 'ID' , row . ID ]
var Data = this . CreateData ( '11' , '基础数据_操作指南指导文件_查看文件' , param )
this . ExecDatabase ( Data ) . then ( response => {
console . log ( response )
if ( response . data . length > 0 ) {
this . pdfSrc = this . solvePdfUr1 ( response . data [ 0 ] . 指导文件 )
window . open ( this . pdfSrc , '_blank' )
// this.imgCheckDialogFormVisible = true // 查看点检文件
console . log ( this . pdfSrc )
} else {
this . $message . error ( '该工位此点检项目无指导文件,请设置后查看' )
}
} )
} ,
// 处理pdf 二进制流
solvePdfUr1 ( content , type , fileName ) {
lineCheckDirectFile ( row ) {
var param = [ ]
param [ 0 ] = [ 'ID' , row . ID ]
var Data = this . CreateData ( '11' , '基础数据_操作指南整线指导文件_查看文件' , param )
this . ExecDatabase ( Data ) . then ( response => {
if ( response . data . length > 0 ) {
this . pdfSrc = this . solvePdfUr1 ( response . data [ 0 ] . 指导文件 )
window . open ( this . pdfSrc , '_blank' )
} else {
this . $message . error ( '无整线指导文件,请设置后查看' )
}
} )
} ,
solvePdfUr1 ( content ) {
const bstr = atob ( content )
let n = bstr . length
const u8arr = new Uint8Array ( n )
while ( n -- ) { u8arr [ n ] = bstr . charCodeAt ( n ) }
// 确定解析格式, 可能可以变成img, 没有深入研究
const blob = new Blob ( [ u8arr ] , { type : 'application/pdf;chartset=UTF-8' } )
return window . URL . createObjectURL ( blob )
} ,
callOff ( ) {
this . dialogFormVisible = false
this . $refs [ 'form' ] . resetFields ( )
} ,
// 删除指导文件
deleteImgCheckDirectFileSubmit ( row ) {
this . $confirm ( '此操作将永久删除该指导文件, 是否继续?' , '提示' , {
confirmButtonText : '确定' ,
@@ -258,58 +238,96 @@ export default {
param [ 0 ] = [ 'ID' , row . ID ]
var Data = this . CreateData ( '12' , '基础数据_操作指南指导文件_删除' , param )
this . ExecDatabase ( Data ) . then ( response => {
if ( response . data [ 0 ] . result === '1' ) {
if ( response . data [ 0 ] && response . data [ 0 ] . result === '1' ) {
this . $message . success ( '删除指导文件成功!' )
this . getImgCheckDirectFileList ( )
} else if ( response . data ) {
this . $message . success ( '删除指导文件成功!' )
this . getImgCheckDirectFileList ( )
} else {
this . $message . error ( '删除指导文件失败!' )
}
} )
} ) . catch ( ( ) => {
} )
} ) . catch ( ( ) => { } )
} ,
// 添加指导文件
uploadShowPDF ( row ) {
deleteLineDirectFileSubmit ( row ) {
this . $confirm ( '此操作将永久删除该整线指导文件, 是否继续?' , '提示' , {
confirmButtonText : '确定' ,
cancelButtonText : '取消' ,
type : 'warning'
} ) . then ( ( ) => {
var param = [ ]
param [ 0 ] = [ 'ID' , row . ID ]
var Data = this . CreateData ( '12' , '基础数据_操作指南整线指导文件_删除' , param )
this . ExecDatabase ( Data ) . then ( response => {
if ( response . data [ 0 ] && response . data [ 0 ] . result === '1' ) {
this . $message . success ( '删除整线指导文件成功!' )
this . getLineDirectFileList ( )
} else if ( response . data ) {
this . $message . success ( '删除整线指导文件成功!' )
this . getLineDirectFileList ( )
} else {
this . $message . error ( '删除整线指导文件失败!' )
}
} )
} ) . catch ( ( ) => { } )
} ,
uploadShowPDF ( ) {
this . imgDialogFormVisible = true
} ,
// 保存文件
submitPicturePDF ( ) {
if ( ! this . imgDialogOpName ) {
this . $message . error ( '请先选择工位号后提交!' )
return
}
// if (!this.imgDialogBigType) {
// this.$message.error('请先选择机型后提交!')
// return
// }
var param = [ ]
param [ 0 ] = [ '工位号' , this . imgDialogOpName ]
// param[1] = ['机型', this.imgDialogBigType]
param [ 1 ] = [ '文件名称' , '' ]
param [ 2 ] = [ '文件后缀' , '' ]
param [ 3 ] = [ '文件内容' , null ]
var Data1 = this . CreateData ( '15' , '基础数据_操作指南指导文件_保存文件' , param )
var Data1
if ( this . activeTab === 'line' ) {
param [ 0 ] = [ '文件名称' , '' ]
param [ 1 ] = [ '文件后缀' , '' ]
param [ 2 ] = [ '文件内容' , null ]
Data1 = this . CreateData ( '15' , '基础数据_操作指南整线 指导文件_保存文件' , param )
} else {
if ( ! this . imgDialogOpName ) {
this . $message . error ( '请先选择工位号后提交!' )
return
}
param [ 0 ] = [ '工位号' , this . imgDialogOpName ]
param [ 1 ] = [ '文件名称' , '' ]
param [ 2 ] = [ '文件后缀' , '' ]
param [ 3 ] = [ '文件内容' , null ]
Data1 = this . CreateData ( '15' , '基础数据_操作指南指导文件_保存文件' , param )
}
this . DataPDF . param = Data1
this . $refs . uploadPDF . submit ( )
this . imgDialogFormVisible = false
this . $message . success ( '指导文件上传成功!' )
} ,
// 查询指导文件列表
getImgCheckDirectFileList ( ) {
console . log ( '触发了查询' )
var param = [ ]
this . imgCheckDirectFileList = [ ]
param [ 0 ] = [ '工位号' , this . imgDialogOpName ]
// param[1] = ['机型', this.imgDialogBigType]
var Data = this . CreateData ( '11' , '基础数据_操作指南指导文件_查询' , param )
this . ExecDatabase ( Data ) . then ( response => {
c onsol e. log ( response )
if ( response . data . length > 0 ) {
this . imgCheckDirectFileList = response . data
if ( resp onse. data && response . data . length > 0 ) {
this . imgCheckDirectFileList = response . data . filter ( function ( item ) {
return item . 工位号 != = '整线'
} )
if ( this . imgCheckDirectFileList . length === 0 ) {
this . $message . error ( '该工位无此点检指导文件,请添加后查看' )
}
} else {
this . $message . error ( '该工位无此点检指导文件,请添加后查看' )
}
} )
} ,
getLineDirectFileList ( ) {
this . lineDirectFileList = [ ]
var param = [ ]
var Data = this . CreateData ( '11' , '基础数据_操作指南整线指导文件_查询' , param )
this . ExecDatabase ( Data ) . then ( response => {
if ( response . data && response . data . length > 0 ) {
this . lineDirectFileList = response . data
} else {
this . $message . error ( '暂无整线指导文件,请添加后查看' )
}
} )
}
}
}
@@ -331,21 +349,7 @@ export default {
color : white ;
}
}
# dianjianbiao {
/*.el-table td, .el-table th.is-leaf,.el-table--border, .el-table--group{*/
/*border-color: black !important;*/
/*}*/
/*.el-table--border::after, .el-table--group::after, .el-table::before{*/
/*background-color: black !important;*/
/*}*/
/*th {*/
/*background: white !important;*/
/*color: black !important;*/
/*}*/
}
. el - upload - dragger {
width : 210 px ;
//right: 30px;
}
< / style >