Commit 42d37ea3 authored by jingnan's avatar jingnan 👀

领用申请换件联调

parent 76e14c44
...@@ -24,11 +24,13 @@ ...@@ -24,11 +24,13 @@
:lay-config="cmpOptions" :lay-config="cmpOptions"
:basic-data="{useRequestType:typeName}" :basic-data="{useRequestType:typeName}"
:on-form-event-hander="formEventHander" :on-form-event-hander="formEventHander"
@on-cancel="cancelHandler"
/> />
</div> </div>
</template> </template>
<script> <script>
import { post } from '@/utils/http'
export default { export default {
componentName: '领用出库申请新建', componentName: '领用出库申请新建',
name: 'AddOutStorageUseCom', name: 'AddOutStorageUseCom',
...@@ -45,13 +47,13 @@ export default { ...@@ -45,13 +47,13 @@ export default {
}, },
data() { data() {
return { return {
typeName: 'useAO', typeName: 'swapUse',
options: [ options: [
], ],
showCmp: true, showCmp: true,
cmpOptions: { cmpOptions: {
typeName: 'OutStorageUse', typeName: 'OutStorageUse',
layKey: 'outStorageUseApply_add_instruct' layKey: 'outStorageUseApply_add_useAO'
}, },
formEventHander: { formEventHander: {
'on-submit': () => { 'on-submit': () => {
...@@ -63,7 +65,8 @@ export default { ...@@ -63,7 +65,8 @@ export default {
'on-cancel': () => { 'on-cancel': () => {
this.$emit('on-cancel') this.$emit('on-cancel')
} }
} },
outStorageUseId: [] // 取消使解除占用操作需要
} }
}, },
computed: {}, computed: {},
...@@ -71,13 +74,15 @@ export default { ...@@ -71,13 +74,15 @@ export default {
typeName: { typeName: {
immediate: true, immediate: true,
handler(val) { handler(val) {
// this.changeModelCode()
this.$set(this.cmpOptions, 'layKey', `outStorageUseApply_add_${val}`) this.$set(this.cmpOptions, 'layKey', `outStorageUseApply_add_${val}`)
// this.formData.subTypeName = this.typeName
} }
} }
}, },
created() {}, created() {
this.$bus.$on('getApplyId', (data) => {
this.outStorageUseId = data
})
},
mounted() { mounted() {
this.getUseRequestTypes() this.getUseRequestTypes()
}, },
...@@ -87,16 +92,36 @@ export default { ...@@ -87,16 +92,36 @@ export default {
this.options = await this.$utils.getDicListByCode('UseRequestType') this.options = await this.$utils.getDicListByCode('UseRequestType')
}, },
changeVal(val) { changeVal(val) {
console.log('🚀 file: index.vue:40 val:', val)
}, },
dataChangeHandler(val) { dataChangeHandler(val) {
if (val) { if (val) {
console.log('🚀 file: index.vue:99 val:', val)
this.formData = Object.assign({}, val) this.formData = Object.assign({}, val)
this.formData.typeName = this.typeName this.formData.typeName = this.typeName
} }
}, },
changeModelCode() { changeModelCode() {
},
cancelHandler(val) {
this.$confirm('此操作将解除已占用的操作, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
post(`OutStorageRequest/outStorageOut/delete?applyIds=${this.outStorageUseId}`).then(res => {
this.$message({
type: 'success',
message: '删除成功!'
})
this.$emit('cancel')
}).catch((err) => {
console.log(err)
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
} }
} }
} }
......
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
@row-click="handleRowClick" @row-click="handleRowClick"
/> />
<el-form ref="applyForm" :rules="rules" :model="applyForm" class="applyForm"> <el-form ref="applyForm" :rules="rules" :model="applyForm" class="applyForm">
<el-form-item label="申领数量" prop="reqAmount" label-width="100px"> <el-form-item :label="amountItemLabel" prop="reqAmount" label-width="100px">
<el-input-number v-model="applyForm.reqAmount" placeholder="申领数量" :min="0" size="small" /> <el-input-number v-model="applyForm.reqAmount" :placeholder="amountItemLabel" :min="0" size="small" />
</el-form-item> </el-form-item>
<el-form-item class="foot-btn-box"> <el-form-item class="foot-btn-box">
<el-button type="primary" @click="submitEvent(true)">添加</el-button> <el-button v-if="basicData.useRequestType!=='swapUse'" type="primary" @click="submitEvent(true)">添加</el-button>
<el-button type="primary" @click="submitEvent(false)">确认</el-button> <el-button type="primary" @click="submitEvent(false)">确认</el-button>
<el-button @click="cancelEvent">取消</el-button> <el-button @click="cancelEvent">取消</el-button>
</el-form-item> </el-form-item>
...@@ -35,6 +35,10 @@ export default { ...@@ -35,6 +35,10 @@ export default {
type: Object, type: Object,
default: () => {} default: () => {}
}, },
selectDatas: {
type: Array,
default: () => []
},
parentTableData: { parentTableData: {
type: Object, type: Object,
default: () => {} default: () => {}
...@@ -45,9 +49,10 @@ export default { ...@@ -45,9 +49,10 @@ export default {
selection: null, selection: null,
defaultData: {}, defaultData: {},
applyForm: {}, applyForm: {},
amountItemLabel: '申领数量',
rules: { rules: {
reqAmount: [ reqAmount: [
{ required: true, message: '请填写申领数量', trigger: 'blur' } { required: true, message: '该项必填', trigger: 'blur' }
] ]
} }
} }
...@@ -59,11 +64,25 @@ export default { ...@@ -59,11 +64,25 @@ export default {
handler(val) { handler(val) {
console.log('val', val) console.log('val', val)
} }
},
'basicData.useRequestType': {
immediate: true,
handler(val) {
switch (val) {
case 'useAO':
this.amountItemLabel = '申领数量'
break
case 'swapUse':
this.amountItemLabel = '换件数量'
break
default:
break
}
}
} }
}, },
created() { created() {
// 初始化数据
console.log('basicData', this.basicData)
}, },
methods: { methods: {
handleRowClick(val) { handleRowClick(val) {
...@@ -83,9 +102,12 @@ export default { ...@@ -83,9 +102,12 @@ export default {
'unableAmount': this.selection.unableAmount, 'unableAmount': this.selection.unableAmount,
'reqAmount': this.applyForm.reqAmount 'reqAmount': this.applyForm.reqAmount
}] }]
this.$emit('submitEvent', { formData: data, addContinue },) if (this.basicData.useRequestType === 'swapUse') {
data[0].extSupportingItemVO = this.selectDatas[0].extSupportingItemVO
}
this.$emit('submitEvent', { formData: data, addContinue })
} else { } else {
this.$utils.showMessageWarning('至少选择一条物料并且申领数量必填!') this.$utils.showMessageWarning(`至少选择一条物料并且${this.amountItemLabel}必填!`)
return false return false
} }
}) })
......
...@@ -9,10 +9,7 @@ ...@@ -9,10 +9,7 @@
ref="table" ref="table"
:im-show-table-data="imShowTableData" :im-show-table-data="imShowTableData"
:basic-data="{...form,...basicData}" :basic-data="{...form,...basicData}"
:lay-config="{ :lay-config="cmpOptions"
typeName: 'OutStorageUseItem',
layKey: 'add_outStorageUseItem_instruct'
}"
table-height="auto" table-height="auto"
:dis-business="true" :dis-business="true"
:result-data="tableData" :result-data="tableData"
...@@ -40,7 +37,7 @@ ...@@ -40,7 +37,7 @@
</template> </template>
<script> <script>
import AddOutStorageUseDetailDialog from './components/AddOutStorageUseDetailDialog.vue' import AddOutStorageUseDetailDialog from './components/AddOutStorageUseDetailDialog'
import AdjustOccupyCom from '../adjustOccupyCom' import AdjustOccupyCom from '../adjustOccupyCom'
import { post } from '@/utils/http' import { post } from '@/utils/http'
export default { export default {
...@@ -100,7 +97,11 @@ export default { ...@@ -100,7 +97,11 @@ export default {
selectionRows: [], selectionRows: [],
tableData: [], tableData: [],
dialogTitle: '', dialogTitle: '',
componentName: '' componentName: '',
cmpOptions: {
typeName: 'OutStorageUseItem',
layKey: 'add_outStorageUseItem_useAO'
}
} }
}, },
computed: { computed: {
...@@ -113,14 +114,34 @@ export default { ...@@ -113,14 +114,34 @@ export default {
handler(data) { handler(data) {
this.$emit('input', data) this.$emit('input', data)
} }
},
'basicData.useRequestType': {
immediate: true,
deep: true,
handler(val) {
this.$set(this.cmpOptions, 'layKey', `add_outStorageUseItem_${val}`)
}
} }
}, },
created() {
this.$bus.$on('swapUseData', (data) => {
if (data && data.length) {
data.map(item => {
if (!this.tableData.find(row => row.extSupportingItemVO && row.extSupportingItemVO.id === item.id)) {
this.tableData.push({
extSupportingItemVO: item
})
}
})
}
})
},
methods: { methods: {
tableToolHandler(val) { tableToolHandler(val) {
const btnValue = val.key.btnValue const btnValue = val.key.btnValue
switch (btnValue) { switch (btnValue) {
case 'add': case 'add':
this.openDialog('添加出库物料', 'AddOutStorageUseDetailDialog') this.addHandle()
break break
case 'occupy': case 'occupy':
this.occupy() this.occupy()
...@@ -138,6 +159,18 @@ export default { ...@@ -138,6 +159,18 @@ export default {
selectionChange(val) { selectionChange(val) {
this.selectionRows = val this.selectionRows = val
}, },
addHandle() {
const useRequestType = this.basicData.useRequestType
if (useRequestType === 'useAO') {
this.openDialog('添加出库物料', 'AddOutStorageUseDetailDialog')
} else if (useRequestType === 'swapUse') {
if (this.selectionRows && this.selectionRows.length === 1) {
this.openDialog('添加出库物料', 'AddOutStorageUseDetailDialog')
} else {
this.$utils.showMessageWarning('请勾选一条数据进行操作!')
}
}
},
occupy() { occupy() {
const form = Object.assign({}, this.form) const form = Object.assign({}, this.form)
form.aircraftType = form.aircraftType.split('+')[1] form.aircraftType = form.aircraftType.split('+')[1]
...@@ -151,6 +184,7 @@ export default { ...@@ -151,6 +184,7 @@ export default {
operator: 'ADD' operator: 'ADD'
} }
post('/OutStorageRequest/outStorageUse/saveAndTake', param).then(res => { post('/OutStorageRequest/outStorageUse/saveAndTake', param).then(res => {
this.$bus.$emit('getApplyId', res.items.id)
this.form.id = res.items.id this.form.id = res.items.id
const data = res.items.inStorageRequestItems const data = res.items.inStorageRequestItems
const tableData = [...this.tableData] const tableData = [...this.tableData]
...@@ -199,7 +233,13 @@ export default { ...@@ -199,7 +233,13 @@ export default {
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}) })
this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.extMaterialId).includes(item.extMaterialId))
if (this.basicData.useRequestType === 'swapUse') {
this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.extSupportingItemVO.id).includes(item.extSupportingItemVO.id))
this.$bus.$emit('removeItems', this.selectionRows)
} else {
this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.extMaterialId).includes(item.extMaterialId))
}
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)
}) })
...@@ -211,7 +251,16 @@ export default { ...@@ -211,7 +251,16 @@ export default {
}) })
}, },
submitEvent({ formData, addContinue }) { submitEvent({ formData, addContinue }) {
this.tableData.push(...formData) if (this.basicData.useRequestType === 'swapUse') {
this.tableData.forEach((item, index) => {
if (item.extSupportingItemVO && item.extSupportingItemVO.id === formData[0].extSupportingItemVO.id) {
// this.tableData[index] = formData[0]
this.$set(this.tableData, index, formData[0])
}
})
} else {
this.tableData.push(...formData)
}
this.dialogShow = addContinue || false this.dialogShow = addContinue || false
}, },
refreshResponses({ inventoryJobResponses }) { refreshResponses({ inventoryJobResponses }) {
......
<!--
* @Author: gjn
* @Date: 2023-09-03 10:39:00
* @Description:领用出库——换件物料
-->
<template>
<div :style="layoutStyle" class="AddOutStorageUseSwapUse">
<dee-as-com
ref="table"
:im-show-table-data="imShowTableData"
:basic-data="{...form,...basicData}"
:lay-config="{
typeName: 'OutStorageMatchItem',
layKey: 'outStorageUseMaterial_swapUse'
}"
table-height="300px"
:dis-business="true"
:result-data="tableData"
@tableToolHandler="tableToolHandler"
@selectionChange="selectionChange"
/>
</div>
</template>
<script>
export default {
componentName: '领用出库换件物料',
name: 'AddOutStorageUseSwapUse',
components: {},
props: {
basicData: {
type: Object,
default: () => {}
},
itemId: {
type: String,
default: () => ''
},
form: {
type: Object,
default: () => {
return {}
}
},
imShowTableData: {
type: Array,
default: () => {
return []
}
},
layoutStyle: {
type: Object,
default: () => {
return {}
}
}
},
data() {
return {
tableData: [],
selectionRows: []
}
},
computed: {},
watch: {
'form.aoNo': {
immediate: true,
handler(val) {
if (this.form.aoNo && this.form.sorties && this.form.extResourceTypeId) {
this.getTableData()
}
}
},
'form.sorties': {
immediate: true,
handler(val) {
if (this.form.aoNo && this.form.sorties && this.form.extResourceTypeId) {
this.getTableData()
}
}
},
'form.extResourceTypeId': {
immediate: true,
handler(val) {
if (this.form.aoNo && this.form.sorties && this.form.extResourceTypeId) {
this.getTableData()
}
}
}
},
created() {
this.$bus.$on('removeItems', (data) => {
if (data && data.length) {
const targetData = data.map(item => item.extSupportingItemVO)
this.dealRowIsSwapUse(targetData, '否')
}
})
},
mounted() {
// this.getTableData()
},
// 组件方法
methods: {
tableToolHandler(val) {
const btnValue = val.key.btnValue
switch (btnValue) {
case 'confirm':
this.confirmSwap()
break
default:
break
}
},
getTableData() {
this.tableData = []
const params = {
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'items': [
{
'fieldName': 'extSupporting.extProcessPlanId',
'operator': 'EQ',
'value': this.form.aoNo
},
{
'fieldName': 'extMaterial.resType2Id',
'operator': 'EQ',
'value': this.form.extResourceTypeId
},
{
'fieldName': 'sorties',
'operator': 'EQ',
'value': this.form.sorties.split('+')[1]
}
// 勿删,测试所需数据
// {
// 'fieldName': 'extSupporting.extProcessPlanId',
// 'operator': 'EQ',
// 'value': '204662455135000'
// },
// {
// 'fieldName': 'extMaterial.resType2Id',
// 'operator': 'EQ',
// 'value': '195492405035000'
// },
// {
// 'fieldName': 'sorties',
// 'operator': 'EQ',
// 'value': '1003'
// }
],
'operator': 'AND'
},
'openProps': [
{
'name': 'extMaterial',
'openProps': [
{
'name': 'resType2'
}
]
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
this.$api.searchApi(`ExtSupportingItem`, params).then(res => {
if (!res.items || !res.items.content) return
this.tableData = res.items.content.map(item => {
item.isSwapUse = '否'
return item
})
// this.$bus.$emit('swapUseData', [])
}).catch((err) => {
console.log(err)
})
},
selectionChange(val) {
this.selectionRows = val
},
confirmSwap() {
const swapUseData = this.selectionRows.filter(row => row.isSwapUse !== '是')
this.$bus.$emit('swapUseData', swapUseData)
this.dealRowIsSwapUse(this.selectionRows, '是')
},
dealRowIsSwapUse(data, isSwapUse) {
data.map(item => {
const oriData = JSON.parse(JSON.stringify(this.tableData))
this.tableData = oriData.map(row => {
if (row && row.id === item.id) {
row.isSwapUse = isSwapUse
}
return row
})
})
}
}
}
</script>
<style lang='scss'>
</style>
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
this.options = res.items.content.map((item) => { this.options = res.items.content.map((item) => {
return { return {
label: item.serialNumber, label: item.serialNumber,
value: item.serialNumber value: item.id + ''
} }
}) })
} else { } else {
......
...@@ -90,6 +90,7 @@ export default { ...@@ -90,6 +90,7 @@ export default {
}, },
// 手动占用 // 手动占用
occupy() { occupy() {
if (!this.infoSelection || !this.infoSelection.length) return this.$utils.showMessageWarning('请勾选需要占用的数据!')
const param = this.infoSelection.map(item => { const param = this.infoSelection.map(item => {
if (item.allocatedAmount === 0 || !item.hasOwnProperty('allocatedAmount')) { if (item.allocatedAmount === 0 || !item.hasOwnProperty('allocatedAmount')) {
return this.$utils.showMessageWarning('请输入分配数量!') return this.$utils.showMessageWarning('请输入分配数量!')
......
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