离线合同:设置安全库存量

This commit is contained in:
chenjianan
2018-11-19 14:12:27 +08:00
parent be947a241c
commit fa32b53a6f
2 changed files with 63 additions and 3 deletions

View File

@@ -168,3 +168,15 @@ export function searchContractDemo(num1 = null) {
}
})
}
// 设置安全库存
export function setSafeValue(...params) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '采购管理_离线合同_物料安全库存_修改数据',
param: `物料流水号=${params[0]}&安全库存量=${params[1]}`
}
})
}

View File

@@ -29,6 +29,7 @@
<el-card>
<el-table
v-loading="loading1"
:data="tableData1"
border
style="width: 100%;max-height: 300px;"
@@ -69,7 +70,22 @@
</el-table-column>
<el-table-column label="安全库存量" min-width="200" align="center">
<template slot-scope="scope">
{{ scope.row.安全库存量 }}
<template v-if="scope.row.changeSafeValue">
<el-input v-model="scope.row.安全库存量" class="edit-input" size="mini"/>
<el-button class="cancel-btn" size="mini" icon="el-icon-refresh" type="warning" @click="cancelEdit(scope.row)">取消</el-button>
</template>
<span v-else>{{ scope.row.安全库存量 }}</span>
</template>
</el-table-column>
<el-table-column label="设置" min-width="100" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.changeSafeValue" type="mini" size="mini" icon="el-icon-circle-check-outline" @click="confirmEdit(scope.row)">确定</el-button>
<el-button
v-else
type="primary"
size="mini"
icon="el-icon-edit"
@click="scope.row.changeSafeValue=!scope.row.changeSafeValue">设置</el-button>
</template>
</el-table-column>
</el-table>
@@ -491,13 +507,14 @@
<script>
import { searchInventoryNum, searchOfflineContract, searchOfflineContract2, searchSupplier, initPayMethod, initPayTimeNode, addOfflineContract, editOfflineContract, deleteOfflineContract, searchMateriel,
addMateriel, deleteMateriel, doneOfflineContact, searchContractDemo } from '@/api/PurchasingCenter/OfflineContract'
addMateriel, deleteMateriel, doneOfflineContact, searchContractDemo, setSafeValue } from '@/api/PurchasingCenter/OfflineContract'
import { mapGetters } from 'vuex'
export default {
name: '', // 离线合同
data() {
return {
loading1: false,
title2: '',
purchaseStateValue: 2, // 采购状态 全部
purchaseState: [
@@ -640,12 +657,18 @@ export default {
})
},
searchTable1() { // 查询物料库物料
this.loading1 = true
this.materialName ? this.check1 = 1 : this.check1 = 0
this.inventoryStateValue ? this.check2 = 1 : this.check2 = 0
searchInventoryNum(this.pageCurrent1, this.pageSize1, this.check1, this.materialName, this.check2, this.inventoryStateValue, this.purchaseStateValue).then(response => {
console.log(response.data.rows)
this.tableData1 = response.data.rows
this.tableData1.map(v => {
this.$set(v, 'changeSafeValue', false)
v.原安全库存量 = v.安全库存量
return v
})
this.total1 = response.data.total
this.loading1 = false
})
},
handleSizeChange1(val) {
@@ -663,6 +686,23 @@ export default {
this.materielGroup.push(val[i].物料流水号)
}
},
cancelEdit(row) { // 取消设置
row.安全库存量 = row.原安全库存量
row.changeSafeValue = false
this.$message('取消修改')
},
confirmEdit(row) { // 确认设置
Number(row.安全库存量) ? row.安全库存量 = Number(row.安全库存量) : row.安全库存量 = 0
setSafeValue(row.物料流水号, parseInt(row.安全库存量)).then(response => {
if (response.data[0].result === '1') {
row.changeSafeValue = false
this.$message.success('设置成功')
this.searchTable1()
} else {
this.$message.error('设置失败')
}
})
},
searchTable2() { // 查询离线合同列表
this.offlineContract ? this.check3 = 1 : this.check3 = 0
this.supplierName0 ? this.check4 = 1 : this.check4 = 0
@@ -1025,4 +1065,12 @@ export default {
.searchForm .el-form-item{
margin-bottom: 5px;
}
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 5px;
}
</style>