Commit 7c2feb6d authored by xioln's avatar xioln

供外出库调整占用

parent 5146bee6
......@@ -1549,6 +1549,21 @@ export function fileByIdDownload(objName, objId, linkId) {
this.downLoadFile(res)
})
}
/**
* @Description: 查找DeeForm
* @author xioln
*/
export function findForm(elem = this) {
// 检查当前元素是否是 el-form
if (elem.$el && elem.$el.classList.contains('el-form')) {
return elem // 找到了 el-form,返回当前
}
// 检查是否存在父组件
if (elem.$parent) {
return findForm(elem.$parent) // 递归调用父组件
}
return null // 没有找到 el-form,返回 null
}
export default {
treeFindBackArray,
......@@ -1631,5 +1646,6 @@ export default {
groupBy,
filterParams,
deepClone,
fileByIdDownload
fileByIdDownload,
findForm
}
......@@ -7,14 +7,14 @@
<div class="AddOutStorageMaterialDetailDialog-diloag">
<dee-as-com
ref="materielSearch"
:lay-config="{ typeName: 'Inventory', layKey: 'search_sanqichukuwuliaomingxi'}"
:lay-config="{ typeName: 'Inventory', layKey: 'search_sanqichukuwuliaomingxi' }"
:basic-data="defaultData"
@searchEvent="searchEvent"
/>
<dee-as-com
ref="materielTable"
class="list-table"
:lay-config="{ typeName: 'Inventory', layKey: 'table_sanqichukuwuliaomingxi'}"
:lay-config="{ typeName: 'Inventory', layKey: 'table_sanqichukuwuliaomingxi' }"
@selectionChange="selectionChange"
/>
<div slot="footer" class="foot-btn-box">
......@@ -32,7 +32,7 @@ export default {
props: {
basicData: {
type: Object,
default: () => {}
default: () => { }
}
},
data() {
......@@ -126,16 +126,16 @@ export default {
}
</script>
<style lang='scss'>
.AddOutStorageMaterialDetailDialog-diloag{
.list-table{
height: 510px!important;
.AddOutStorageMaterialDetailDialog-diloag {
.list-table {
height: 510px !important;
}
.foot-btn-box{
.foot-btn-box {
display: flex;
margin-top: 10px;
justify-content: center;
align-content: center;
}
}
</style>
......@@ -51,8 +51,8 @@ export default {
'form.sorties': {
immediate: true,
deep: true,
handler(val) {
if (val) {
handler(val, oldVal) {
if (val !== oldVal) {
const params = {
searchItems: {
items: [
......
/**
* @Description: 供外出库调整占用申领数量
* @author xioln
* @date 2023-08-02
*/
<template>
<div class="outStorageAdjustOccupy-reqAmount">
<el-input-number v-model="reqAmount" :min="0" :max="maxNum" @change="handleChange" />
</div>
</template>
<script>
export default {
componentName: '供外出库调整占用申领数量',
name: 'OutStorageCallBackReqAmount',
components: {},
props: {
form: {
type: Object,
default: () => {}
},
value: {
type: Number,
default: 0
}
},
data() {
return {
reqAmount: 0,
maxNum: 0
}
},
computed: {},
created() {
// 初始化数据
if (this.value !== '0') {
this.reqAmount = Number(this.value)
}
if (this.form.reqAmount) {
this.maxNum = this.form.reqAmount
} else {
this.maxNum = 10
}
},
methods: {
handleChange() {
this.$emit('input', this.reqAmount)
}
}
}
</script>
<style lang='scss'>
</style>
/**
* @Description: 供外出库调整占用
* @author xioln
* @date 2023-08-23
* @FilePath: applications/dee-mes/src/privateComponents/components/OutStorageOfferAdjustOccupy/index.vue
*/
<template>
<div class="OutStorageOfferAdjustOccupy">
<DeeAsCom
ref="adjustOccupyInfo"
:basic-data="basicData"
:lay-config="{
typeName: 'OutStorageOutItem',
layKey: 'adjustOccupyTable'
}"
/>
<DeeAsCom
ref="adjustOccupyInventory"
:basic-data="basicData"
:lay-config="{
typeName: 'JobResponseOutStorageOut',
layKey: 'table'
}"
/>
</div>
</template>
<script>
export default {
componentName: '供外出库调整占用',
name: 'OutStorageOfferAdjustOccupy', // name写在组件的最前方,自定义组件为必填
components: {},
data() {
return {
}
},
computed: {},
created() {
// 初始化数据
},
methods: {
}
}
</script>
<style lang='scss'>
</style>
/**
* @Description: 供外出库调整占用
* @author xioln
* @date 2023-08-23
*/
<template>
<div class="outStorageOffer-adjustOccupy">
<DeeAsCom
ref="adjustOccupyInfo"
:basic-data="selectDatas[0]"
:form="form"
:lay-config="{
typeName: 'Inventory',
layKey: 'adjustOccupyTable'
}"
@selectionChange="infoSelectionChange"
/>
<div style="height: 80px; text-align: center;display: flex;justify-content: center;align-items: center;">
<el-button type="primary" size="medium" round icon="el-icon-caret-top" @click="relieve">解除</el-button>
<el-button type="primary" round icon="el-icon-caret-bottom" @click="occupy">占用</el-button>
</div>
<DeeAsCom
ref="adjustOccupyjobResponse"
:basic-data="selectDatas[0]"
:lay-config="{
typeName: 'JobResponseOutStorageOut',
layKey: 'table',
}"
@selectionChange="jobResponseSelectionChange"
/>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
componentName: '供外出库调整占用',
name: 'OutStorageOfferAdjustOccupy', // name写在组件的最前方,自定义组件为必填
components: {},
props: {
// basicData: {
// type: Object,
// default: () => { }
// },
selectDatas: {
type: Array,
default: () => {}
},
form: {
type: Object,
default: () => {}
}
},
data() {
return {
infoSelection: [],
jobResponseSelection: []
}
},
computed: {},
created() {
// 初始化数据
},
methods: {
infoSelectionChange(v) {
this.infoSelection = v
},
jobResponseSelectionChange(v) {
this.jobResponseSelection = v
},
// 解除占用
relieve() {
if (this.jobResponseSelection.length === 0) {
return this.$utils.showMessageWarning('请选择响应数据!')
}
const ids = this.jobResponseSelection.map(item => item.id).join(',')
post('InStorageRequestItem/adjust/cancelTake?jobResponseIds=' + ids).then(res => {
this.$utils.showMessageSuccess('解除占用成功!')
this.refeach()
}).catch((err) => {
console.log(err)
})
},
// 手动占用
occupy() {
const param = this.infoSelection.map(item => {
if (item.allocatedAmount === 0 || !item.hasOwnProperty('allocatedAmount')) {
return this.$utils.showMessageWarning('请输入分配数量!')
} else {
return {
inventoryId: item.id,
allocatedAmount: item.allocatedAmount
}
}
})
console.log('param', param)
if (!param.includes(undefined)) {
post('InStorageRequestItem/adjust/reTake?itemId=' + this.selectDatas[0].id, param).then(res => {
this.$utils.showMessageSuccess('占用成功!')
this.refeach()
}).catch((err) => {
console.log(err)
})
}
},
refeach() {
this.$refs.adjustOccupyInfo.$refs.asCom.getData()
this.$refs.adjustOccupyjobResponse.$refs.asCom.getData()
}
}
}
</script>
<style lang='scss'>
.outStorageOffer-adjustOccupy{
}
</style>
......@@ -15,23 +15,31 @@
>
<dee-tools slot="header" :tools="tools" mode="normal" :collapse="false" />
</dee-table>
<dee-dialog width="70%" title="添加供外出库申请明细" :visible="dialogVisible">
<addOutStorageOfferDetailDialog ref="addOffer" :basic-data="form" @submitEvent="addData" @cancel="cancel" />
<dee-dialog width="70%" title="添加供外出库申请明细" :visible.sync="dialogVisible" @on-cancel="cancel">
<addOutStorageOfferDetailDialog ref="addOffer" :basic-data="form" @submitEvent="addData" />
</dee-dialog>
<dee-dialog width="70%" title="调整占用" :visible.sync="aoDialogVisible" @on-cancel="aoCancel">
<OutStorageOfferAdjustOccupy ref="adjustOffer" :select-datas="selectTableData" :form="form" @submitEvent="addData" />
</dee-dialog>
</div>
</template>
<script>
import AddOutStorageOfferDetailDialog from './components/addOutStorageOfferDetailDialog'
import OutStorageOfferAdjustOccupy from './components/outStorageOfferAdjustOccupy'
import { post } from '@/utils/http'
export default {
componentName: '供外出库申请明细',
name: 'OutStorageOfferDetail',
components: { AddOutStorageOfferDetailDialog },
components: { AddOutStorageOfferDetailDialog, OutStorageOfferAdjustOccupy },
props: {
form: {
type: Object,
required: true
},
basicData: {
type: Object,
required: true
}
},
data() {
......@@ -44,7 +52,7 @@ export default {
{ title: '规格', key: 'extMaterial.spec', align: 'center' },
{ title: '单位名称', key: 'extMaterial.extUnit.unitName', align: 'center' },
{
title: '申领数量', key: 'reqAmount', align: 'center', minWidth: '120',
title: '申领数量', key: 'reqAmount', align: 'center', minWidth: '160', fixed: 'right',
component: {
show: true,
render: (h, data, column, index) => {
......@@ -71,11 +79,17 @@ export default {
icon: '/icons/c-add.png',
handler: {
click: () => {
this.$utils.findForm(this).validate((isok) => {
if (isok) {
if (!this.form.extWorkCenterId) {
this.$utils.showMessageWarning('请先选择库房!')
return
}
this.dialogVisible = true
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
}
}
},
......@@ -84,7 +98,33 @@ export default {
icon: '/icons/c-creatBook.png',
handler: {
click: () => {
this.$utils.findForm(this).validate((isok) => {
if (isok) {
// 校验通过
this.occupy()
} else {
this.$utils.showMessageWarning('请填写基本信息!')
}
})
}
}
},
{
name: '调整占用',
icon: '/icons/c-newchangeapp.png',
handler: {
click: () => {
if (this.selectTableData.length === 1) {
if (this.selectTableData[0].hasOwnProperty('id')) {
this.aoDialogVisible = true
} else {
this.$utils.showMessageWarning('请先保存占用!')
}
} else if (this.selectTableData.length > 1) {
this.$utils.showMessageWarning('只能勾选一条明细!')
} else {
this.$utils.showMessageWarning('请先选择要调整的明细!')
}
}
}
},
......@@ -97,7 +137,9 @@ export default {
}
}
}],
param: {}
param: {},
aoDialogVisible: false,
selectTableData: []
}
},
computed: {
......@@ -115,8 +157,8 @@ export default {
// 初始化数据
},
mounted() {
if (this.$route.query.id) {
this.getEditData(this.$route.query.id)
if (this.basicData.id) {
this.getEditData()
}
},
methods: {
......@@ -131,11 +173,13 @@ export default {
cancel() {
this.dialogVisible = false
},
aoCancel() {
this.aoDialogVisible = false
},
occupy() {
const form = { ...this.form }
form.aircraftType = form.aircraftType.split('+')[1]
form.sorties = form.sorties.split('+')[1]
const param = {
...form,
inStorageRequestItems: this.tableData,
......@@ -143,7 +187,7 @@ export default {
operator: 'ADD'
}
post('OutStorageRequest/outStorageOut/saveAndTake', param).then(res => {
console.log('res', res)
this.$utils.showMessageSuccess('占用成功!')
const data = res.items.inStorageRequestItems
const tableData = [...this.tableData]
data.forEach(item => {
......@@ -183,45 +227,46 @@ export default {
})
})
},
getEditData(id) {
const param = {
'searchItems': {
'items': [
{ 'fieldName': 'subTypeName', 'operator': 'EQ', 'value': 'OutStorageOut' },
{ 'fieldName': 'id', 'operator': 'EQ', 'value': id }
]
},
openProps: [{
'name': 'inStorageRequestItems',
'openProps': [{
'name': 'extMaterial',
'openProps': [{
'name': 'resType2'
}, {
'name': 'extUnit'
}]
}, {
'name': 'extDxSipplier'
}, {
'name': 'creator'
}, {
'name': 'storageZone'
},
{
'name': 'inventoryJobResponses'
}]
}]
}
post('OutStorageRequest/search', param).then(res => {
console.log('res', res)
const data = res.items.content[0].inStorageRequestItems
data.forEach(item => {
item.allocatedAmount = this.sumArray(item.inventoryJobResponses, 'allocatedAmount')
})
this.tableData = data
}).catch((err) => {
console.log(err)
})
getEditData() {
this.tableData.push(...this.basicData.inStorageRequestItems)
// const param = {
// 'searchItems': {
// 'items': [
// { 'fieldName': 'subTypeName', 'operator': 'EQ', 'value': 'OutStorageOut' },
// { 'fieldName': 'id', 'operator': 'EQ', 'value': id }
// ]
// },
// openProps: [{
// 'name': 'inStorageRequestItems',
// 'openProps': [{
// 'name': 'extMaterial',
// 'openProps': [{
// 'name': 'resType2'
// }, {
// 'name': 'extUnit'
// }]
// }, {
// 'name': 'extDxSipplier'
// }, {
// 'name': 'creator'
// }, {
// 'name': 'storageZone'
// },
// {
// 'name': 'inventoryJobResponses'
// }]
// }]
// }
// post('OutStorageRequest/search', param).then(res => {
// console.log('res', res)
// const data = res.items.content[0].inStorageRequestItems
// data.forEach(item => {
// item.allocatedAmount = this.sumArray(item.inventoryJobResponses, 'allocatedAmount')
// })
// this.tableData = data
// }).catch((err) => {
// console.log(err)
// })
},
sumArray(array, key) {
let sum = 0
......
......@@ -62,7 +62,7 @@ export default {
}
}
},
form: {
'form.extProductAreaId': {
immediate: true,
deep: true,
handler() {
......
......@@ -52,8 +52,8 @@ export default {
'form.aircraftType': {
immediate: true,
deep: true,
handler(val) {
if (val) {
handler(val, oldVal) {
if (val !== oldVal) {
const params = {
searchItems: {
items: [{ 'fieldName': 'aircraftTypeId', operator: 'EQ', value: val.split('+')[0] }],
......
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