Commit 9f623d86 authored by jingnan's avatar jingnan 👀

领用出库申请开发

parent 5146bee6
...@@ -17,14 +17,13 @@ ...@@ -17,14 +17,13 @@
/> />
</el-select> </el-select>
</div> </div>
<DeeStaticCmp <dee-as-com
v-if="typeName" v-if="typeName"
style="border:none;" style="border:none;"
model-name="OutStorageUse" model-name="OutStorageUse"
:cmp-options="cmpOptions" :lay-config="cmpOptions"
:default-data="defaultData" :basic-data="{useRequestType:typeName}"
:on-form-event-hander="formEventHander" :on-form-event-hander="formEventHander"
@refreshForm="dataChangeHandler"
/> />
</div> </div>
</template> </template>
...@@ -52,15 +51,14 @@ export default { ...@@ -52,15 +51,14 @@ export default {
showCmp: true, showCmp: true,
cmpOptions: { cmpOptions: {
typeName: 'OutStorageUse', typeName: 'OutStorageUse',
value: 'outStorageUseApply_add_instruct' layKey: 'outStorageUseApply_add_instruct'
}, },
formEventHander: { formEventHander: {
'on-submit': () => { 'on-submit': () => {
console.log(this.formData, 'this.formData') if (!this.formData || !this.formData.typeName) {
if (!this.formData || !this.formData.subTypeName) { return this.$message.error('请选择一种领用类型')
return this.$message.error('请选择一种管理方式')
} }
this.$emit('on-submit') this.$emit('on-submit', this.formData)
}, },
'on-cancel': () => { 'on-cancel': () => {
this.$emit('on-cancel') this.$emit('on-cancel')
...@@ -73,8 +71,8 @@ export default { ...@@ -73,8 +71,8 @@ export default {
typeName: { typeName: {
immediate: true, immediate: true,
handler(val) { handler(val) {
this.changeModelCode() // this.changeModelCode()
// this.cmpOptions.typeName = val this.$set(this.cmpOptions, 'layKey', `outStorageUseApply_add_${val}`)
// this.formData.subTypeName = this.typeName // this.formData.subTypeName = this.typeName
} }
} }
...@@ -87,9 +85,6 @@ export default { ...@@ -87,9 +85,6 @@ export default {
methods: { methods: {
async getUseRequestTypes() { async getUseRequestTypes() {
this.options = await this.$utils.getDicListByCode('UseRequestType') this.options = await this.$utils.getDicListByCode('UseRequestType')
// this.$utils.getDicListByCode('UseRequestType').then(res => {
// this.options = res || []
// })
}, },
changeVal(val) { changeVal(val) {
console.log('🚀 file: index.vue:40 val:', val) console.log('🚀 file: index.vue:40 val:', val)
...@@ -99,26 +94,9 @@ export default { ...@@ -99,26 +94,9 @@ export default {
console.log('🚀 file: index.vue:99 val:', 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
this.formData.sorties = this.formData.sorties.split('+')[0]
// if (val.managedBy && val.managedBy.id) {
// getUserByUserId(val.managedBy.id).then(res => {
// if (Array.isArray(res.items) && res.items.length > 0) {
// const userObj = res.items[0].user
// val.managedOrg = userObj.organizations
// }
// })
// }
} }
}, },
changeModelCode() { changeModelCode() {
// const currentCategory = this.formData.projectCategory || this.defaultData.projectCategory
// if (currentCategory && this.typeName === 'CommonPlan') {
// this.$set(this.formData, 'modelCode', currentCategory.name)
// const id = currentCategory.parentId
// if (id) {
// this.getModelType(id)
// }
// }
} }
} }
} }
......
...@@ -33,6 +33,10 @@ export default { ...@@ -33,6 +33,10 @@ export default {
basicData: { basicData: {
type: Object, type: Object,
default: () => {} default: () => {}
},
parentTableData: {
type: Object,
default: () => {}
} }
}, },
data() { data() {
...@@ -72,15 +76,15 @@ export default { ...@@ -72,15 +76,15 @@ export default {
'subTypeName': 'OutStorageUseItem', 'subTypeName': 'OutStorageUseItem',
'extMaterial': this.selection.extMaterial, 'extMaterial': this.selection.extMaterial,
'extMaterialId': this.selection.extMaterialId, 'extMaterialId': this.selection.extMaterialId,
'extSupportingItemId': this.selection.id, // 'extSupportingItemId': this.selection.id,
'extSupportingItemIdType': this.selection.subTypeName, // 'extSupportingItemIdType': this.selection.subTypeName,
'takeAmount': this.selection.takeAmount, 'takeAmount': this.selection.takeAmount,
'unableAmount': this.selection.unableAmount, 'unableAmount': this.selection.unableAmount,
'reqAmount': this.applyForm.reqAmount 'reqAmount': this.applyForm.reqAmount
}] }]
this.$emit('submitEvent', { formData: data }) this.$emit('submitEvent', { formData: data })
} else { } else {
this.$utils.showMessageWarning('申领数量必填!') this.$utils.showMessageWarning('至少选择一条物料并且申领数量必填!')
return false return false
} }
}) })
......
<!--
* @Author: gjn
* @Date: 2023-08-25 11:07:44
* @Description:领用出库明细
-->
<template>
<div :style="layoutStyle" class="addOutStorageUseDetail">
<dee-as-com
ref="table"
:im-show-table-data="imShowTableData"
:basic-data="{...form,...basicData}"
:lay-config="{
typeName: 'OutStorageUseItem',
layKey: 'add_outStorageUseItem_instruct'
}"
table-height="auto"
:dis-business="true"
:result-data="tableData"
@tableToolHandler="tableToolHandler"
@selectionChange="selectionChange"
/>
<dee-dialog
title="添加出库物料"
width="1000px"
:dialog-visible="dialogShow"
@handleClose="dialogShow = false"
>
<AddOutStorageUseDetailDialog
v-if="dialogShow"
:basic-data="{...form,...basicData}"
:component-prop="componentProp"
@submitEvent="submitEvent"
@cancel="dialogShow = false"
/>
</dee-dialog>
</div>
</template>
<script>
import AddOutStorageUseDetailDialog from '../AddOutStorageUseDetailDialog'
import { post } from '@/utils/http'
export default {
componentName: '领用出库明细',
name: 'AddOutStorageUseDetail',
components: { AddOutStorageUseDetailDialog },
props: {
basicData: {
type: Object,
default: () => {}
},
itemId: {
type: String,
default: () => ''
},
form: {
type: Object,
default: () => {
return {}
}
},
imShowTableData: {
type: Array,
default: () => {
return []
}
},
typeName: {
type: String,
default: () => ''
},
typeKey: {
type: String,
default: () => ''
},
buttonFilter: {
type: String,
default: () => ''
},
layoutStyle: {
type: Object,
default: () => {
return {}
}
},
showBtn: {
type: Boolean,
default: true
}
},
data() {
return {
componentProp: {
showSubType: true
},
dialogShow: false,
selectionRows: [],
tableData: []
}
},
computed: {
},
watch: {
tableData: {
immediate: true,
deep: true,
handler(data) {
this.$emit('input', data)
}
}
},
methods: {
tableToolHandler(val) {
const btnValue = val.key.btnValue
switch (btnValue) {
case 'add':
this.dialogShow = true
break
case 'occupy':
this.occupy()
break
case 'remove':
this.remove()
break
default:
break
}
},
selectionChange(val) {
this.selectionRows = val
},
occupy() {
const form = Object.assign({}, this.form)
form.aircraftType = form.aircraftType.split('+')[1]
form.sorties = form.sorties.split('+')[1]
const param = {
...form,
typeName: this.basicData.useRequestType, // 领用类型
inStorageRequestItems: this.selectionRows,
subTypeName: 'OutStorageUse',
operator: 'ADD'
}
post('/OutStorageRequest/outStorageUse/saveAndTake', param).then(res => {
this.form.id = res.items.id
const data = res.items.inStorageRequestItems
const tableData = [...this.tableData]
data.forEach(item => {
tableData.forEach(v => {
if (v.extMaterialId === item.extMaterialId) {
v.id = item.id
v.operator = 'MODIFY'
v.outStorageOutId = res.items.id
v.allocatedAmount = this.sumArray(item.inventoryJobResponses, 'allocatedAmount')
}
})
})
this.tableData = tableData
}).catch((err) => {
console.log(err)
})
},
remove() {
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
post(`InStorageRequestItem/outStorageOutItem/delete?requestItemIds=${this.selectionRows.map(item => item.id).join(',')}`).then(res => {
this.$message({
type: 'success',
message: '删除成功!'
})
this.tableData = this.tableData.filter(item => !this.selectionRows.map(item => item.extMaterialId).includes(item.extMaterialId))
}).catch((err) => {
console.log(err)
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
sumArray(array, key) {
let sum = 0
for (let i = 0; i < array.length; i++) {
sum += Number(array[i][key])
}
return sum
},
submitEvent({ formData }) {
this.tableData.push(...formData)
this.dialogShow = false
}
}
}
</script>
<style>
</style>
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