Commit 21006e58 authored by jingnan's avatar jingnan 👀

领用出库增加材料修改

parent a0fe9316
...@@ -18,7 +18,7 @@ import httpObj from './http' ...@@ -18,7 +18,7 @@ import httpObj from './http'
import _get from 'lodash.get' import _get from 'lodash.get'
import _set from 'lodash.set' import _set from 'lodash.set'
import router from '../router' import router from '../router'
import { downFileByFileId, downFileUseFileId } from '../api/file' import { downFileByFileId } from '../api/file'
// 限制promise并发数量 // 限制promise并发数量
export function promiseLimit(func, funcParams, limit = 5) { export function promiseLimit(func, funcParams, limit = 5) {
let i = 0 let i = 0
...@@ -1567,6 +1567,7 @@ export function findForm(elem = this) { ...@@ -1567,6 +1567,7 @@ export function findForm(elem = this) {
// 计算列表数据中某一项的和 // 计算列表数据中某一项的和
export function sumArray(array, key) { export function sumArray(array, key) {
if (!array || !Array.isArray(array)) return
const baseNum = 1000 // 解决js计算精度丢失问题 const baseNum = 1000 // 解决js计算精度丢失问题
let sum = 0 let sum = 0
for (let i = 0; i < array.length; i++) { for (let i = 0; i < array.length; i++) {
......
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
model-name="OutStorageUse" model-name="OutStorageUse"
:lay-config="cmpOptions" :lay-config="cmpOptions"
:basic-data="{...basicData,useRequestType:basicData.typeName||typeName}" :basic-data="{...basicData,useRequestType:basicData.typeName||typeName}"
@on-cancelCreate="cancelHandler"
/> />
<!-- @on-cancelCreate="cancelHandler" -->
</div> </div>
</template> </template>
<script> <script>
import { post } from '@/utils/http' // import { post } from '@/utils/http'
export default { export default {
componentName: '领用出库申请新建', componentName: '领用出库申请新建',
name: 'AddOutStorageUseCom', name: 'AddOutStorageUseCom',
...@@ -96,29 +96,29 @@ export default { ...@@ -96,29 +96,29 @@ export default {
this.formData = Object.assign({}, val) this.formData = Object.assign({}, val)
this.formData.typeName = this.typeName this.formData.typeName = this.typeName
} }
},
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: '已取消删除'
})
})
} }
// 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: '已取消删除'
// })
// })
// }
} }
} }
</script> </script>
......
...@@ -73,6 +73,7 @@ export default { ...@@ -73,6 +73,7 @@ export default {
switch (val) { switch (val) {
case 'useAO' : case 'useAO' :
case 'noAO': case 'noAO':
case 'materialUse':
this.amountItemLabel = '申领数量' this.amountItemLabel = '申领数量'
break break
case 'swapUse': case 'swapUse':
...@@ -97,8 +98,8 @@ export default { ...@@ -97,8 +98,8 @@ export default {
this.$refs['applyForm'].validate((valid) => { this.$refs['applyForm'].validate((valid) => {
if (valid && this.selection) { if (valid && this.selection) {
const typeName = this.basicData.useRequestType const typeName = this.basicData.useRequestType
const maxAmount = typeName === 'scrapUse' ? this.selection.reqAmountOri : this.selection.unableAmount const maxAmount = typeName === 'scrapUse' ? this.selection.reqAmountOri : typeName === 'materialUse' ? Math.min(this.selection.unableAmount, this.selection.applyAmount) : this.selection.unableAmount
const maxWarning = typeName === 'scrapUse' ? '出库数量' : '可用数量' const maxWarning = typeName === 'scrapUse' ? '出库数量' : typeName === 'materialUse' ? '可用数量及可申领数量' : '可用数量'
if (this.applyForm.reqAmount > maxAmount) return this.$utils.showMessageWarning(`申领数量不能大于当前选中物料的${maxWarning}!`) if (this.applyForm.reqAmount > maxAmount) return this.$utils.showMessageWarning(`申领数量不能大于当前选中物料的${maxWarning}!`)
const data = [{ const data = [{
'subTypeName': 'OutStorageUseItem', 'subTypeName': 'OutStorageUseItem',
......
...@@ -255,9 +255,12 @@ export default { ...@@ -255,9 +255,12 @@ export default {
const param = { const param = {
...form, ...form,
typeName: typeName, // 领用类型 typeName: typeName, // 领用类型
inStorageRequestItems: this.selectionRows, inStorageRequestItems: this.selectionRows.map(row => {
row.operator = row.id ? 'MODIFY' : 'ADD'
return row
}),
subTypeName: 'OutStorageUse', subTypeName: 'OutStorageUse',
operator: 'ADD' operator: this.form.id ? 'MODIFY' : 'ADD'
} }
post('/OutStorageRequest/outStorageUse/saveAndTake', param).then(res => { post('/OutStorageRequest/outStorageUse/saveAndTake', param).then(res => {
this.$bus.$emit('getApplyId', res.items.id) this.$bus.$emit('getApplyId', res.items.id)
......
<template>
<div class="CASSelect">
<el-select
:value="value"
:loading="loading"
filterable
remote
clearable
:remote-method="remoteMethod"
:disabled="disabled"
:placeholder="!options.length?'至少输入三位进行查询':'请选择'"
@change="change"
@clear="clear"
>
<el-option
v-for="item in options"
:key="item.key"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
<script>
export default {
name: 'CASSelect',
componentName: 'CAS号',
props: {
value: {
type: [String, Number],
default: ''
},
basicData: {
type: Object,
default: () => ({})
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
loading: false,
options: [],
remoteFlag: true
}
},
computed: {},
watch: {},
methods: {
remoteMethod(query, id) {
if (!this.basicData || !this.basicData.sorties) return this.$utils.showMessageWarning('请选择架次后查询!')
if ((!query || query.length < 3) && !id) return
if (this.remoteFlag) {
this.remoteFlag = false
const params = {
'pageFrom': 1,
'pageSize': 10,
'searchItems': {
'items': [
{
'fieldName': 'serialNumber',
'operator': 'LIKE',
'value': query || ''
},
{
'fieldName': 'sorties',
'operator': 'LIKE',
'value': this.basicData.sorties.split('+')[1] || ''
},
{
'fieldName': 'planeType',
'operator': 'LIKE',
'value': this.basicData.aircraftType.split('+')[1] || ''
},
{
'fieldName': 'positionNumber',
'operator': 'EQ',
'value': this.basicData.aoNo || '' // 站位编号
},
{
'fieldName': 'subTypeName',
'operator': 'EQ',
'value': 'ExtCas'
}
]
},
'openProps': []
}
if (id) {
params.searchItems.items.push({
'fieldName': 'id',
'operator': 'EQ',
'value': id
})
}
this.loading = true
this.options = []
this.$api.searchApi('ExtProcessPlan', params).then(res => {
if (res.items && res.items.content.length) {
this.options = res.items.content.map((item) => {
return {
label: item.serialNumber,
value: item.id
}
})
} else {
this.options = []
}
})
.catch((err) => console.log(err))
.finally(() => {
this.loading = false
this.remoteFlag = true
})
} else {
this.$utils.showMessageWarning('上一步请求正在查询中,请稍后')
}
},
change(val) {
this.$emit('input', val)
},
clear() {
this.$emit('input')
}
}
}
</script>
<style lang="scss">
</style>
<template>
<div class="ExtPositionSelect">
<el-select
:value="value"
:loading="loading"
filterable
clearable
:disabled="disabled"
:placeholder="options.length?'请选择':'暂无数据'"
@change="change"
@clear="clear"
>
<el-option
v-for="item in options"
:key="item.key"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
<script>
export default {
name: 'ExtPositionSelect',
componentName: '站位选择(按材料)',
props: {
value: {
type: [String, Number],
default: ''
},
basicData: {
type: Object,
default: () => ({})
},
form: {
type: Object,
default: () => ({ sorties: '' })
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
loading: false,
options: [],
remoteFlag: true
}
},
computed: {},
watch: {
'form.sorties': {
handler(val) {
if (!this.basicData.id) {
this.$set(this.form, 'aoNo', '')
val && this.form.aircraftType && this.getOptions()
}
}
},
value: {
handler(val) {
if (this.basicData.id && val && Number(val)) {
this.getOptions(Number(val))
}
}
}
},
methods: {
getOptions(id) {
if (!this.form || !this.form.sorties || !this.form.aircraftType) return this.$utils.showMessageWarning('请选择机型及架次后查询!')
this.tableColumnSelect = true
const params = {
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'items': [
{
'fieldName': 'aircraftSorties.aircraftType.defName',
'operator': 'LIKE',
'value': this.form.aircraftType.split('+')[1] || ''
},
{
'fieldName': 'aircraftSorties.defName',
'operator': 'LIKE',
'value': this.form.sorties.split('+')[1] || ''
}
]
},
'openProps': []
}
if (id) {
params.searchItems.items.push({
'fieldName': 'id',
'operator': 'EQ',
'value': id
})
}
this.loading = true
this.options = []
this.$api.searchApi('ExtPosition', params).then(res => {
if (res.items && res.items.content.length) {
this.options = res.items.content.map((item) => {
return {
label: item.serialNumber,
value: item.serialNumber
}
})
} else {
this.options = []
}
})
.catch((err) => console.log(err))
.finally(() => {
this.loading = false
this.remoteFlag = true
this.tableColumnSelect = false
})
},
change(val) {
this.$emit('input', val)
},
clear() {
this.$emit('input')
}
}
}
</script>
<style lang="scss">
</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