更新
This commit is contained in:
@@ -12,6 +12,14 @@
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<span style="margin-left: 10px">类型:</span>
|
||||
<el-select v-model="groupName" filterable size="small" placeholder="类型">
|
||||
<el-option
|
||||
v-for="item in Group"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</div>
|
||||
<upload-excel-component @on-selected-file="selected"/>
|
||||
</div>
|
||||
@@ -26,7 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<specification-data1 ref="specificationData" :groups-names="groupsNames" :machine-names="machineNames" :project-name="projectName" @machineChange="machineChange"/>
|
||||
<specification-data1 ref="specificationData" :groups-names="groupsNames" :machine-names="machineNames" :project-name="projectName" :group-name="groupName" @machineChange="machineChange"/>
|
||||
<!--<el-upload-->
|
||||
<!--class="upload-demo"-->
|
||||
<!--drag-->
|
||||
@@ -52,6 +60,18 @@ export default {
|
||||
return {
|
||||
project: [],
|
||||
projectValue: '',
|
||||
groupName: '',
|
||||
Group: [{
|
||||
value: 'MX',
|
||||
name: 'MX'
|
||||
}, {
|
||||
value: 'WG',
|
||||
name: 'WG'
|
||||
}, {
|
||||
value: 'BZ',
|
||||
name: 'BZ'
|
||||
}],
|
||||
group: '',
|
||||
worksheet: [],
|
||||
itemFile: [],
|
||||
loading: false,
|
||||
@@ -160,6 +180,7 @@ export default {
|
||||
remarks,
|
||||
classificationCode
|
||||
console.log(this.worksheet[j].M2.v.substring(0, 1))
|
||||
this.group = this.worksheet[j].M2.v.substring(0, this.worksheet[j].M2.v.indexOf('-')) + '组'
|
||||
if (this.worksheet[j].M2.v.substring(0, 1) === '9') {
|
||||
const response = await isExit(this.projectValue, this.worksheet[j].F2.v)
|
||||
const res = response.data
|
||||
@@ -226,7 +247,7 @@ export default {
|
||||
async insertToSQL(establishment, proofread, review, date, machineName, machineNum, componentName, componentNum, groupNum, contractNum, pageNum, totalNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode) {
|
||||
try {
|
||||
if (groupNum.indexOf('MX') > -1) {
|
||||
const response = await importBasics(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
|
||||
const response = await importBasics(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, this.group, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
|
||||
const res = response.data
|
||||
console.log(res)
|
||||
if (res[0].result === '0') {
|
||||
@@ -236,7 +257,7 @@ export default {
|
||||
this.$notify.error(`${drawingNum}导入重复`)
|
||||
}
|
||||
} else {
|
||||
const response = await importPurcharse(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, groupNum, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
|
||||
const response = await importPurcharse(establishment, proofread, review, date, this.projectName, machineNum, machineName, componentName, componentNum, this.group, contractNum, totalNum, pageNum, drawingNum, name, type, material, spareNum, useNum, manufacturer, remarks, classificationCode)
|
||||
const res = response.data
|
||||
if (res[0].result === '0') {
|
||||
this.$notify.error(`${drawingNum}导入失败`)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<div style="width: 700px;margin: 0 auto">
|
||||
<div style="width: 900px;margin: 0 auto">
|
||||
<span>机床名称:</span>
|
||||
<el-select v-model="machineValue" filterable clearable size="small" placeholder="机床名称" @change="getGroups">
|
||||
<el-option
|
||||
@@ -19,6 +19,13 @@
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<el-button :loading="listLoading" :disabled="disabled" type="primary" icon="el-icon-d-caret" size="small" style="margin-left: 10px" @click="transferData">传递</el-button>
|
||||
<el-button type="danger" icon="el-icon-delete" size="small" @click="allDelete">一键删除</el-button>
|
||||
<el-row style="margin-top: 20px">
|
||||
<span>机床名称:</span>
|
||||
<el-input v-model="machineName" readonly size="small" placeholder="机床名称" style="width: 200px;"/>
|
||||
<span>机床数量:</span>
|
||||
<el-input v-model="machineNum" readonly size="small" placeholder="机床数量" style="width: 200px;"/>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card>
|
||||
@@ -97,20 +104,6 @@
|
||||
{{ scope.row.前图号或者型号 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
@click="handleEdit(scope.row)">编辑</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="block" style="margin-top: 10px;">
|
||||
<el-pagination
|
||||
@@ -296,7 +289,7 @@
|
||||
|
||||
<script>
|
||||
import { sleep } from '../../../utils/tool'
|
||||
import { unSpecificationQuery1, specificationQuery1, deleteBasicParts, deleteBWParts, getMaterial, getMaterialWB, searchMaterialWB, updateRow, updateRowWB, transferMX1, update, searchOldParts } from '../../../api/TechnologyCenter/ImportParts'
|
||||
import { unSpecificationQuery1, specificationQuery1, unSpecificationQueryWB1, specificationQueryWB1, deleteBasicParts, deleteBWParts, getMaterial, getMaterialWB, searchMaterialWB, updateRow, updateRowWB, transferMX1, update, searchOldParts, getMachineNames, transferWG1, allDelete, update1 } from '../../../api/TechnologyCenter/ImportParts'
|
||||
export default {
|
||||
name: 'SpecificationData',
|
||||
props: {
|
||||
@@ -311,6 +304,10 @@ export default {
|
||||
projectName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
groupName: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -318,6 +315,8 @@ export default {
|
||||
componentNum: '',
|
||||
groupValue: '',
|
||||
machineValue: '',
|
||||
machineName: '',
|
||||
machineNum: '',
|
||||
tableData: [],
|
||||
tableDataAll: [],
|
||||
listLoading: false,
|
||||
@@ -387,15 +386,23 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
machineNames(val) {
|
||||
this.machineName = ''
|
||||
this.machineNum = ''
|
||||
this.total = 0
|
||||
this.machineValue = val.length > 0 ? val[0].value : ''
|
||||
this.getGroups()
|
||||
},
|
||||
machineValue() {
|
||||
this.getMachineNames()
|
||||
},
|
||||
groupsNames(val) {
|
||||
this.groupValue = val.length > 0 ? val[0].value : ''
|
||||
},
|
||||
groupValue(val) {
|
||||
val ? this.fetchData() : this.tableData = []
|
||||
},
|
||||
groupName(val) {
|
||||
val ? this.fetchData() : this.tableData = []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -411,17 +418,30 @@ export default {
|
||||
const projectCheck = this.projectName ? 1 : 0
|
||||
const machineCheck = this.machineValue ? 1 : 0
|
||||
const groupCheck = this.groupValue ? 1 : 0
|
||||
// if (this.groupValue.indexOf('MX') > -1) { // 当分组为基本件时,查询基本件规范和不规范数据,否则查询外购件或标准件规范和不规范数据
|
||||
// 分别查出规范和不规范数据,将规范数据放前面在一个总数组中
|
||||
this.type = 1
|
||||
this.unSpecification = await unSpecificationQuery1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
|
||||
this.unSpecification.data.forEach(item => {
|
||||
this.tableDataAll.push(item)
|
||||
})
|
||||
const specification = await specificationQuery1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
|
||||
specification.data.forEach(item => {
|
||||
this.tableDataAll.push(item)
|
||||
})
|
||||
console.log(this.groupName)
|
||||
if (this.groupName.indexOf('MX') > -1) { // 当分组为基本件时,查询基本件规范和不规范数据,否则查询外购件或标准件规范和不规范数据
|
||||
// 分别查出规范和不规范数据,将规范数据放前面在一个总数组中
|
||||
this.type = 1
|
||||
this.unSpecification = await unSpecificationQuery1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
|
||||
this.unSpecification.data.forEach(item => {
|
||||
this.tableDataAll.push(item)
|
||||
})
|
||||
const specification = await specificationQuery1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
|
||||
specification.data.forEach(item => {
|
||||
this.tableDataAll.push(item)
|
||||
})
|
||||
} else {
|
||||
this.type = 2
|
||||
this.unSpecification = await unSpecificationQueryWB1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
|
||||
console.log(this.unSpecification)
|
||||
this.unSpecification.data.forEach(item => {
|
||||
this.tableDataAll.push(item)
|
||||
})
|
||||
const specification = await specificationQueryWB1(projectCheck, this.projectName, machineCheck, this.machineValue, groupCheck, this.groupValue)
|
||||
specification.data.forEach(item => {
|
||||
this.tableDataAll.push(item)
|
||||
})
|
||||
}
|
||||
this.total = this.tableDataAll.length
|
||||
this.pagination(this.pageCurrent, this.pageSize) // 前端分页,数据很多生成DOM节点也多,分页效果很明显。
|
||||
this.listLoading = false
|
||||
@@ -433,11 +453,19 @@ export default {
|
||||
this.Number = row.id
|
||||
this.Type = row.整改类型
|
||||
if (row.整改类型 === 1) {
|
||||
update(this.projectName, this.machineValue, row.id, row.整改类型).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.fetchData()
|
||||
}
|
||||
})
|
||||
if (this.groupName.indexOf('MX') > -1) {
|
||||
update(this.projectName, this.machineValue, row.id, row.整改类型).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.fetchData()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
update1(row.id, row.整改类型).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.fetchData()
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (row.整改类型 === 2) {
|
||||
this.title1 = '替换'
|
||||
@@ -455,6 +483,41 @@ export default {
|
||||
this.dialogParts = true
|
||||
}
|
||||
},
|
||||
allDelete() {
|
||||
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
if (this.projectName !== '' && this.machineValue !== '' && this.groupValue !== '') {
|
||||
allDelete(this.projectName, this.machineValue, this.groupValue).then(response => {
|
||||
if (response.data[0].result === '1') {
|
||||
this.tableData = []
|
||||
this.$message.success('删除成功')
|
||||
} else {
|
||||
this.$message.error('删除失败')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.warning('请选择好项目机床分组')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
getMachineNames() {
|
||||
console.log(this.machineValue, 2222)
|
||||
getMachineNames(this.machineValue).then(response => {
|
||||
console.log(response.data, 3333)
|
||||
if (response.data.length !== 0) {
|
||||
this.machineName = response.data[0].机床名称
|
||||
this.machineNum = response.data[0].机床数量
|
||||
}
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.dialogParts = false
|
||||
update(this.projectName, this.machineValue, this.Number, this.Type, this.PartsValueNum).then(response => {
|
||||
@@ -564,44 +627,34 @@ export default {
|
||||
this.err = 0
|
||||
if (this.groupValue) {
|
||||
this.listLoading = true
|
||||
for (let i = 0; i < this.tableDataAll.length; i++) {
|
||||
const data = this.tableDataAll[i]
|
||||
const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
|
||||
console.log(data.分类码)
|
||||
const resp = await transferMX1(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, data.规格, 1, data.是否传递, data.序号, data.分类码, data.整改类型, data.id, data.前id, data.前图号或者型号)
|
||||
await sleep(10)
|
||||
if (resp.data[0].result === '0') {
|
||||
this.err++
|
||||
if (this.groupName.indexOf('MX') > -1) {
|
||||
for (let i = 0; i < this.tableDataAll.length; i++) {
|
||||
const data = this.tableDataAll[i]
|
||||
const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
|
||||
const resp = await transferMX1(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, data.规格, 1, data.是否传递, data.序号, data.分类码, data.整改类型, data.id, data.前id, data.前图号或者型号)
|
||||
await sleep(10)
|
||||
if (resp.data[0].result === '0') {
|
||||
this.err++
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < this.tableDataAll.length; i++) {
|
||||
let dataType
|
||||
const data = this.tableDataAll[i]
|
||||
const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
|
||||
if (this.groupName.indexOf('WG') > -1) {
|
||||
dataType = 2
|
||||
} else {
|
||||
dataType = 1
|
||||
}
|
||||
const resp = await transferWG1(data.组件流水号, data.物料流水号, total, data.备注, data.标记, data.设计者编号, data.是否传递, dataType, data.序号, data.id)
|
||||
await sleep(10)
|
||||
if (resp.data[0].result === '0') {
|
||||
this.err++
|
||||
this.$notify.error(`传递零件失败`)
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (this.groupValue.indexOf('MX') > -1) {
|
||||
// for (let i = 0; i < this.tableDataAll.length; i++) {
|
||||
// const data = this.tableDataAll[i]
|
||||
// const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
|
||||
// const resp = await transferMX(data.图号或者型号, data.名称, total, data.备注, data.标记, data.设计者编号, data.组件流水号, data.材料流水号, 1, data.是否传递, data.序号, data.id)
|
||||
// await sleep(10)
|
||||
// if (resp.data[0].result === '0') {
|
||||
// this.err++
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for (let i = 0; i < this.tableDataAll.length; i++) {
|
||||
// let dataType
|
||||
// const data = this.tableDataAll[i]
|
||||
// const total = parseInt(data.备件数量) + parseInt(data.装机数量) * parseInt(data.部件数量)
|
||||
// if (this.groupValue.indexOf('WG') > -1) {
|
||||
// dataType = 2
|
||||
// } else {
|
||||
// dataType = 1
|
||||
// }
|
||||
// const resp = await transferWG(data.组件流水号, data.物料流水号, total, data.备注, data.标记, data.设计者编号, data.是否传递, dataType, data.序号, data.id)
|
||||
// await sleep(10)
|
||||
// if (resp.data[0].result === '0') {
|
||||
// this.err++
|
||||
// this.$notify.error(`传递零件失败`)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (this.err === 0) { // 传递成功后,清除该分组。当所有组都传递完成后,该项目下的机床和分组消失
|
||||
const index = this.groupsNames.indexOf(this.groupValue)
|
||||
this.groupsNames.splice(index, 1)
|
||||
|
||||
Reference in New Issue
Block a user