Commit 90781eec authored by jingnan's avatar jingnan 👀

胶漆申领批量操作

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