Commit 90781eec authored by jingnan's avatar jingnan 👀

胶漆申领批量操作

parent 472a197f
......@@ -35,7 +35,7 @@
</div>
<!-- 表格 -->
<div>
<div>
<div class="dee-table">
<el-table
ref="table"
v-loading="loading"
......
......@@ -6,22 +6,18 @@
<span>提示:双击可编辑时间/规格</span>
<el-button
size="mini"
:disabled="
rowData.applyStatus && rowData.applyStatus !== 'notApplied' ||$parent.$parent.$parent.$refs.footer&& $parent.$parent.$parent.$refs.footer.tableData.length > 0
"
style="width: 100px"
@click="applyStorageReqItem"
>胶漆使用申请</el-button>
<el-button
size="mini"
:disabled="rowData.applyStatus !== 'applied'"
@click="cancelApplyStorageReqItem"
>撤销申请</el-button>
</span>
</p>
<!-- 表格 -->
<div>
<div>
<div class="dee-table">
<el-table
ref="table"
v-loading="loading"
......@@ -32,8 +28,14 @@
highlight-current-row
:cell-class-name="deeTableCellStyle"
@row-click="rowClick"
@selection-change="handleSelectionChange"
@cell-dblclick="deeTableEdit"
>
<el-table-column
type="selection"
width="55"
:selectable="selectable"
/>
<el-table-column
type="index"
:width="80"
......@@ -200,7 +202,8 @@ export default {
needSpecRow: null,
rowData: {},
defultRow: null,
specOptions: []
specOptions: [],
selectedRow: []
}
},
created() {},
......@@ -232,6 +235,9 @@ export default {
{
'name': 'inStorageRequestItems'
},
{
'name': 'extScanCodeRecords'
},
{
'name': 'extMaterial',
'openProps': [
......@@ -263,7 +269,8 @@ export default {
needTimeLoading: false,
needTimeSelect: false,
needSpecLoading: false,
needSpecSelect: false
needSpecSelect: false,
cardNo: p.extScanCodeRecords && p.extScanCodeRecords.length && p.extScanCodeRecords[0].allocateNo || ''
}
})
this.tablePagination.total = res.items.totalElements
......@@ -329,32 +336,52 @@ export default {
this.$parent.$parent.$parent.$refs.footer.getTableData(this.rowData.id)
}, 300)
},
selectable(row, index) {
// 存在胶漆料调配号的数据不能使用申请也不能撤销
if (row.cardNo) {
return false
} else {
return true
}
},
handleSelectionChange(val) {
this.selectedRow = val
},
/**
* 胶漆使用申请
*/
applyStorageReqItem(row) {
const that = this
if (!that.rowData.spec) {
if (!this.selectedRow || !this.selectedRow.length) return this.$utils.showMessageWarning('请选择需要操作的数据!')
const validSpec = this.selectedRow.find(item => !item.spec)
if (validSpec) {
this.$utils.showMessageWarning('规格不能为空!')
return
}
const validStatus = this.selectedRow.find(item => item.applyStatus === 'applied')
if (validStatus) {
this.$utils.showMessageWarning('只能操作状态为未申请的数据!')
return
}
const params = this.selectedRow.map(item => {
return {
id: item.id,
spec: item.spec
}
}) || []
post(
`/ExtSupportingItem/deal/supportingItem?applyState=true`,
{
id: that.rowData.id,
spec: this.rowData.spec
}
params
)
.then((res) => {
if (res.message.includes('成功')) {
this.getTableData()
that.$message({
this.$message({
showClose: true,
message: '申请成功!',
type: 'success'
})
} else {
that.$message({
this.$message({
showClose: true,
message: '保存失败',
type: 'error'
......@@ -368,24 +395,32 @@ export default {
* 撤销胶漆使用申请
*/
cancelApplyStorageReqItem() {
var that = this
if (!this.selectedRow || !this.selectedRow.length) return this.$utils.showMessageWarning('请选择需要操作的数据!')
const validStatus = this.selectedRow.find(item => item.applyStatus !== 'applied')
if (validStatus) {
this.$utils.showMessageWarning('只能操作状态为已申请的数据!')
return
}
const params = this.selectedRow.map(item => {
return {
id: item.id,
spec: item.spec
}
}) || []
post(
`/ExtSupportingItem/deal/supportingItem?applyState=false`,
{
id: that.rowData.id,
spec: this.rowData.spec
}
params
)
.then((res) => {
if (res.message.includes('成功')) {
this.getTableData()
that.$message({
this.$message({
showClose: true,
message: '撤销申请成功!',
type: 'success'
})
} else {
that.$message({
this.$message({
showClose: true,
message: '保存失败',
type: 'error'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment