diff --git a/src/views/PurchasingCenter/OfflineContract/index.vue b/src/views/PurchasingCenter/OfflineContract/index.vue index 5d2e07bd..917f32bf 100644 --- a/src/views/PurchasingCenter/OfflineContract/index.vue +++ b/src/views/PurchasingCenter/OfflineContract/index.vue @@ -99,7 +99,7 @@ @@ -858,13 +858,10 @@ export default { this.getPerson() this.projectChange() this.getSupplier1() - // this.searchTable2() - // this.searchTable11() this.initDirection() }, methods: { changefixed(val, index, date) { - console.log(index, 6666) let value = '' + val value = value .replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符 @@ -876,12 +873,9 @@ export default { if (value.indexOf('.') < 0 && value !== '') { value = parseFloat(value).toFixed(2) } - console.log(value, this.tableData3[index][date]) this.tableData3[index][date] = value - console.log(this.tableData3[index][date], 'this.tableData3[index][date]') }, handleSelection(val, row) { - console.log(row, 123) this.tableData00.forEach((item, i) => { if (item.组件零件流水号 === row.组件零件流水号 && row.组件零件流水号 !== '0') { if (this.numbers.indexOf(i) === -1) { @@ -1092,19 +1086,16 @@ export default { }) }, tabClick(tab) { - console.log(tab.name, 1111) if (tab.name === '外购件') { this.tabName = '外购件' this.searchTable11() } else if (tab.name === '标准件') { this.tabName = '标准件' - // this.searchTable11() } else if (tab.name === '基本件') { this.tabName = '基本件' this.searchTable12() } else { this.tabName = '仓库' - // this.searchTable22() } }, searchTable2() { // 查询离线合同列表 @@ -1112,9 +1103,7 @@ export default { this.supplierName0 ? this.check4 = 1 : this.check4 = 0 this.loading3 = true this.tableData3 = [] - console.log(this.id, 'id') searchOfflineContract(this.pageCurrent2, this.pageSize2, this.check3, this.offlineContract, this.check4, this.supplierName0, this.id).then(response => { - console.log(response.data.rows, 99) this.tableData2 = response.data.rows this.total2 = response.data.total this.loading3 = false @@ -1129,14 +1118,24 @@ export default { this.searchTable2() }, changeNumber(row) { - changeNum(row.物料流水号, row.使用库存数, row.机床流水号, row.组件零件流水号, row.零件数量).then(response => { - if (response.data[0].result === '1') { - this.$message.success('使用成功') - this.searchTable11() + var max = Number(row.零件数量) > (Number(row.货位存量) - Number(row.占用数量)) ? (Number(row.货位存量) - Number(row.占用数量) + Number(row.使用库存数)) : Number(row.零件数量) + if (row.使用库存数) { + if (row.使用库存数 > max) { + row.使用库存数 = row.使用库存数_原 + this.$message.error('数量超出范围,请重新输入') } else { - this.$message.success('使用失败') + changeNum(row.物料流水号, row.使用库存数, row.机床流水号, row.组件零件流水号, row.零件数量).then(response => { + if (response.data[0].result === '1') { + this.$message.success('使用成功') + this.searchTable11() + } else { + this.$message.error('使用失败') + } + }) } - }) + } else { + row.使用库存数 = 0 + } }, addOfflineContract() { // 创建离线合同 if (this.$refs['form2'] !== undefined) { @@ -1330,7 +1329,6 @@ export default { this.离线合同状态 = row.离线合同状态 this.loading4 = true searchMateriel(this.offlineContractNum).then(response => { - console.log(response, 'response') this.tableData3 = response.data this.tableData3.map(v => { this.$set(v, '未税总额', 0) @@ -1339,9 +1337,7 @@ export default { !v.单价 ? v.单价 = parseFloat(v.参考价格).toFixed(2) : parseFloat(v.单价).toFixed(2) this.$set(v, '未税单价', (v.单价 / (1 + this.taxRate)).toFixed(2)) }) - console.log(this.tableData3, 'tableData31') this.loading4 = false - console.log(response.data.length, 1231231233) }) this.arrival(row) || this.purchasing(row) ? this.disable = true : this.disable = false // 是否为编辑模式 }, @@ -1470,30 +1466,8 @@ export default { saveOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup, this.taxRate * 100).then(response => { if (response.data[0].result !== '1') { this.$message.error('离线合同保存失败') - // this.$message.success('离线合同保存成功') - // this.searchTable2() - // searchMateriel(this.offlineContractNum).then(response => { - // this.tableData3 = response.data - // this.tableData3.map(v => { - // this.$set(v, '未税总额', 0) - // this.$set(v, '含税总额', 0) - // !v.单价 ? v.单价 = v.参考价格 : v.单价 - // this.$set(v, '未税单价', v.单价 / (1 + this.taxRate)) - // }) - // }) } }) - // this.$confirm('确定保存合同?', '提示', { - // confirmButtonText: '确定', - // cancelButtonText: '取消', - // type: 'warning' - // }).then(() => { - // }).catch(() => { - // this.$message({ - // type: 'info', - // message: '已取消操作' - // }) - // }) }, doneOfflineContact() { // 生成离线合同 this.tongguo = true @@ -1537,16 +1511,6 @@ export default { this.$message.success('离线合同生成成功') this.searchTable2() this.tableData3 = [] - // searchMateriel(this.offlineContractNum).then(response => { - // this.tableData3 = response.data - // this.tableData3.map(v => { - // this.$set(v, '未税总额', 0) - // this.$set(v, '含税总额', 0) - // !v.单价 ? v.单价 = v.参考价格 : v.单价 - // this.$set(v, '未税单价', v.单价 / (1 + this.taxRate)) - // }) - // this.disable = true // 是否为编辑模式 - // }) } else { this.$message.error('离线合同生成失败') } }) }).catch(() => { @@ -1641,12 +1605,12 @@ export default { this.idNumGroup.push(val[i].id) this.NumGroup.push(val[i].待采购数量) } - console.log(this.materielNumGroup, 222) }, selectable(row, index) { // 控制某行是否可选 return Number(row.采购状态编号) < 3 && Number(row.是否确认) === 1 // 未采购&&确认物料修改 }, - searchTable11() { // 查询外购件列表 + // 查询外购件列表 + searchTable11() { let check1, check5, check7 this.loading1 = true this.materialName ? check1 = 1 : check1 = 0 @@ -1705,7 +1669,6 @@ export default { const supplier = [] this.remarkFilters = [] this.supplierFilters = [] - console.log(response.data.rows, 111) response.data.rows.map(v => { if (!remark.includes(v.备注)) { remark.push(v.备注) @@ -1733,7 +1696,6 @@ export default { this.materialName ? check1 = 1 : check1 = 0 this.loading2 = true searchMaterial22(check1, this.materialName, this.pageCurrent22, this.pageSize22).then(response => { - console.log(response.data, 3333) this.tableData22 = response.data.result this.total22 = parseInt(response.data.output[0].ItemCount) const supplier = []