@@ -97,20 +104,6 @@
{{ scope.row.前图号或者型号 }}
-
-
- 编辑
- 删除
-
-
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)
diff --git a/src/views/TechnologyCenter/ImportParts/specificationData.vue b/src/views/TechnologyCenter/ImportParts/specificationData.vue
index 6f455fb5..45964b7c 100644
--- a/src/views/TechnologyCenter/ImportParts/specificationData.vue
+++ b/src/views/TechnologyCenter/ImportParts/specificationData.vue
@@ -20,6 +20,12 @@
传递
一键删除
+
+ 机床名称:
+
+ 机床数量:
+
+