自制件出库

This commit is contained in:
bryan sun
2019-12-12 09:56:30 +08:00
6 changed files with 142 additions and 238 deletions

View File

@@ -48,84 +48,56 @@
</el-upload>
</el-card>
<el-card>
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
border
size="mini"
style="width: 100%;max-height: 520px"
height="520">
<el-table-column
label="序号"
align="center"
type="index"
width="50"/>
<el-table-column
label="机床图号"
align="center"
min-width="100px">
<template slot-scope="scope">{{ scope.row.机床图号 }}</template>
<el-table v-loading="loading" :data="tableData" border size="mini" style="width: 100%;max-height: 520px" height="520">
<el-table-column label="序号" align="center" type="index" width="50"/>
<el-table-column label="机床图号" align="center" min-width="100px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column
label="零件图号"
align="center"
min-width="100px">
<template slot-scope="scope">{{ scope.row.零件图号 }}</template>
<el-table-column label="零件图号" align="center" min-width="100px">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column
label="零件名称"
align="center"
min-width="100px">
<template slot-scope="scope">{{ scope.row.零件名称 }}</template>
<el-table-column label="零件名称" align="center" min-width="100px">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column
label="组号"
align="center"
min-width="100px">
<template slot-scope="scope">{{ scope.row.组号 }}</template>
<el-table-column label="组号" align="center" min-width="100px">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column
label="材料"
align="center">
<template slot-scope="scope">{{ scope.row.材料 }}</template>
<el-table-column label="材料" align="center">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column
label="备注"
align="center">
<template slot-scope="scope">{{ scope.row.零件备注 }}</template>
<el-table-column label="备注" align="center">
<template slot-scope="scope">
{{ scope.row.零件备注 }}
</template>
</el-table-column>
<el-table-column
label="零件类型"
align="center">
<template slot-scope="scope">{{ scope.row.零件类型名称 }}</template>
<el-table-column label="零件类型" align="center">
<template slot-scope="scope">
{{ scope.row.零件类型名称 }}
</template>
</el-table-column>
<el-table-column
label="是否导入"
align="center">
<el-table-column label="是否导入" align="center">
<template slot-scope="scope">
<el-tag v-if="Number(scope.row.是否导入)===1" type="success">已导入</el-tag>
<el-tag v-else type="danger">未导入</el-tag>
</template>
</el-table-column>
<el-table-column
min-width="50px"
label="零件图纸"
align="center">
<el-table-column min-width="50px" label="零件图纸" align="center">
<template slot-scope="scope">
<el-button circle icon="el-icon-search" size="small" @click="getNum(scope.row)"/>
<!--<el-button slot="reference" type="success" icon="el-icon-search" circle size="mini"></el-button>-->
<!--<el-button type="success" icon="el-icon-search" circle size="mini"></el-button>-->
</template>
</el-table-column>
<el-table-column
min-width="80px"
label="操作"
align="center">
<el-table-column min-width="80px" label="操作" align="center">
<template slot-scope="scope">
<!--<FileUpload ref="FileUpload" :num="scope.row.基本件流水号" table-name="机加工MES_零件图PDF表" @listenMsg ="listenMsgFromChid"/>-->
<el-upload
:disabled="disabled"
:action="action"
@@ -150,7 +122,6 @@
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</el-card>
<el-dialog
:show-close="close"
@@ -198,7 +169,7 @@ export default {
loading: false,
tableData: [],
fileList: [],
showFileList: true,
showFileList: false,
action: '',
disabled: false,
tableName: '机加工MES_零件图PDF表',
@@ -275,11 +246,11 @@ export default {
},
methods: {
getAction(row) {
this.num = row.基本件流水
this.action = `${MESUploadFile}?&num=${this.num}&tableName=${this.tableName}`
this.num = row.零件图
this.action = `${MESUploadFile}?&num=${this.num}&tableName=${this.tableName}&type=2`
},
batchImportOfDrawings() {
this.action = `${MESUploadFile}?&num=${this.num1}&tableName=${this.tableName}`
this.action = `${MESUploadFile}?&num=${this.num1}&tableName=${this.tableName}&type=1`
},
getNum(row) {
this.row1 = row
@@ -288,27 +259,38 @@ export default {
this.getFileList(row.零件图号)
},
uploadSuccess(res, file, fileList) {
console.log(res[0].result, 12345)
this.getTableData()
if (res[0].result === '1') {
const index = fileList.indexOf(file)
fileList.splice(index, 1)
} else {
this.str = res[0].result
this.arr = this.str.split('|')
console.log(this.arr[0], 0)
console.log(this.arr[1], 1)
if (this.arr[1] === '无该零件') {
this.$notify.error(`${this.arr[0]}该零件不存在,请检查上传文件名称是否正确!`)
this.$notify.error({
title: '提示',
message: `${this.arr[0]}该零件不存在,请检查上传文件名称是否正确!`,
duration: 0
})
}
if (this.arr[1] === '重复') {
this.$notify.error(`${this.arr[0]}请勿重复上传!`)
this.$notify.error({
title: '提示',
message: `${this.arr[0]}请勿重复上传!`,
duration: 0
})
}
if (this.arr[1] === '零件图号不正确') {
this.$notify.error({
title: '提示',
message: `${this.arr[0]}和所选图号不符!`,
duration: 0
})
}
// this.$message.error(`${file.name}该零件不存在,请检查上传文件名称是否正确!`)
}
if (fileList.length === 0) {
this.$message.success('文件上传成功')
// this.$refs.FileDown.getFileList(this.num)
this.getTableData()
// this.getTableData()
}
},
uploadFailure(a, file, fileList) {
@@ -347,12 +329,9 @@ export default {
this.getTableData()
},
async getFileList(value) {
// console.log(this.row1.零件图号, 11111)
// console.log(value, 121212)
this.hadFile = []
this.deleteShow === '1' ? this.isDeleteShow = true : this.isDeleteShow = false
if (value) {
// if (value === 1) {
await request({
url: '',
method: 'post',
@@ -362,7 +341,6 @@ export default {
}
}).then(data => {
this.suffix = data.data
console.log(this.suffix, 11111)
if (data.data.length > 0) {
if (this.operationType === '1') {
data.data.map(item => {
@@ -386,40 +364,6 @@ export default {
}
}
})
// } else {
// await request({
// url: '',
// method: 'post',
// data: {
// type: '3',
// name: `select * from ${this.tableName} where 是否启用 = 1 and num = ${value}`
// }
// }).then(data => {
// this.suffix = data.data
// if (data.data.length > 0) {
// if (this.operationType === '1') {
// data.data.map(item => {
// this.hadFile.push({
// url: `${MESDownloadFile}?id=${item.uid}.${item.suffix}&name=${item.name}.${item.suffix}`,
// name: `${item.name}.${item.suffix}`,
// suffix: item.suffix,
// id: item.uid
// })
// })
// } else if (this.operationType === '0') {
// const server = `${MESDownloadFile}`.split('/')
// data.data.map(item => {
// this.hadFile.push({
// url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
// name: `${item.name}.${item.suffix}`,
// suffix: item.suffix,
// id: item.uid
// })
// })
// }
// }
// })
// }
}
},
async deleteFileData(id) {
@@ -439,9 +383,11 @@ export default {
this.getTableData()
if (response.data.length === 0) {
this.$message.success('删除成功')
this.dialogVisible = false
this.getFileList(this.num)
} else {
this.$message.error('删除失败')
this.dialogVisible = false
this.getFileList(this.num)
}
})