Commit 05ba6a47 authored by jingnan's avatar jingnan 👀

领用出库申请开发15%

parent abfa76e8
<!--
* @Author: gjn
* @Date: 2023-08-23 17:52:16
* @Description:领用出库申请新建
-->
<template>
<div class="addOutStorageUseCom">
<div class="sub-title">领用类型</div>
<div class="useType">
<span class="typeName">领用类型:</span>
<el-select v-model="typeName" placeholder="请选择" size="mini" @change="changeVal">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<DeeStaticCmp
v-if="typeName"
style="border:none;"
model-name="OutStorageUse"
:cmp-options="cmpOptions"
:default-data="defaultData"
:on-form-event-hander="formEventHander"
@refreshForm="dataChangeHandler"
/>
</div>
</template>
<script>
export default {
componentName: '领用出库申请新建',
name: 'AddOutStorageUseCom',
components: {},
props: {
defaultData: {
type: Object,
default: () => null
},
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
typeName: 'useAO',
options: [
],
showCmp: true,
cmpOptions: {
typeName: 'OutStorageUse',
value: 'outStorageUseApply_add_instruct'
},
formEventHander: {
'on-submit': () => {
console.log(this.formData, 'this.formData')
if (!this.formData || !this.formData.subTypeName) {
return this.$message.error('请选择一种管理方式')
}
this.$emit('on-submit')
},
'on-cancel': () => {
this.$emit('on-cancel')
}
}
}
},
computed: {},
watch: {
typeName: {
immediate: true,
handler(val) {
this.changeModelCode()
// this.cmpOptions.typeName = val
// this.formData.subTypeName = this.typeName
}
}
},
created() {},
mounted() {
this.getUseRequestTypes()
},
// 组件方法
methods: {
async getUseRequestTypes() {
this.options = await this.$utils.getDicListByCode('UseRequestType')
// this.$utils.getDicListByCode('UseRequestType').then(res => {
// this.options = res || []
// })
},
changeVal(val) {
console.log('🚀 file: index.vue:40 val:', val)
},
dataChangeHandler(val) {
if (val) {
console.log('🚀 file: index.vue:99 val:', val)
this.formData = Object.assign({}, val)
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() {
// 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)
// }
// }
}
}
}
</script>
<style lang='scss'>
.addOutStorageUseCom{
.sub-title{
margin-left: 6px;
}
.useType{
.typeName{
width:100px;
margin-left:33px;
text-align: right;
vertical-align: middle;
font-size: 14px;
color: #606266;
line-height: 40px;
}
}
}
</style>
/**
* @Description: 领用出库添加明细
* @author gjn
* @date 2023-08-24
*/
<template>
<div class="addOutStorageUseDetailDialog">
<dee-as-com
ref="OfferTable"
class="list-table"
:lay-config="{ typeName: 'OutStorageMatchItem', layKey: 'outStorageUseMaterial_Add'}"
:basic-data="basicData"
@row-click="handleRowClick"
/>
<el-form ref="applyForm" :rules="rules" :model="applyForm" class="applyForm">
<el-form-item label="申领数量" prop="reqAmount" label-width="100px">
<el-input-number v-model="applyForm.reqAmount" placeholder="申领数量" :min="0" size="small" />
</el-form-item>
<el-form-item class="foot-btn-box">
<el-button type="primary" @click="submitEvent">确认</el-button>
<el-button @click="cancelEvent">取消</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
componentName: '领用出库添加明细',
name: 'AddOutStorageUseDetailDialog',
components: {},
props: {
basicData: {
type: Object,
default: () => {}
}
},
data() {
return {
selection: null,
defaultData: {},
applyForm: {},
rules: {
reqAmount: [
{ required: true, message: '请填写申领数量', trigger: 'blur' }
]
}
}
},
computed: {},
watch: {
'value': {
immediate: true,
handler(val) {
console.log('val', val)
}
}
},
created() {
// 初始化数据
console.log('basicData', this.basicData)
},
methods: {
handleRowClick(val) {
this.selection = val.row
},
submitEvent() {
this.$refs['applyForm'].validate((valid) => {
if (valid && this.selection) {
if (this.applyForm.reqAmount > this.selection.unableAmount) return this.$utils.showMessageWarning('申领数量不能大于当前选中物料的可用数量!')
const data = [{
'subTypeName': 'OutStorageUseItem',
'extMaterial': this.selection.extMaterial,
'extMaterialId': this.selection.extMaterialId,
'extSupportingItemId': this.selection.id,
'extSupportingItemIdType': this.selection.subTypeName,
'takeAmount': this.selection.takeAmount,
'unableAmount': this.selection.unableAmount,
'reqAmount': this.applyForm.reqAmount
}]
this.$emit('submitEvent', { formData: data })
} else {
this.$utils.showMessageWarning('申领数量必填!')
return false
}
})
},
cancelEvent() {
this.$emit('cancel')
}
}
}
</script>
<style lang='scss'>
.addOutStorageUseDetailDialog{
.list-table{
height: 510px!important;
}
.applyForm{
margin-top: 30px;
}
.foot-btn-box{
display: flex;
margin-top: 10px;
justify-content: center;
align-content: center;
}
}
</style>
<template>
<div class="AoNoSelectCom">
<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: 'AoNoSelectCom',
componentName: '指令号',
props: {
value: {
type: [String, Number],
default: ''
},
form: {
type: Object,
default: () => ({ sorties: '' })
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
loading: false,
options: [],
remoteFlag: true
}
},
computed: {},
watch: {
'form.sorties': {
handler(val) {
this.$set(this.form, 'aoNo', '')
}
}
},
methods: {
remoteMethod(query) {
if (!this.form || !this.form.sorties) return this.$utils.showMessageWarning('请选择架次后查询!')
if (!query || query.length < 1) return
if (this.remoteFlag) {
this.remoteFlag = false
this.tableColumnSelect = true
const params = {
'pageFrom': 1,
'pageSize': 999,
'searchItems': {
'items': [
{
'fieldName': 'serialNumber',
'operator': 'LIKE',
'value': query
},
{
'fieldName': 'sorties',
'operator': 'LIKE',
'value': this.form.sorties.split('+')[1]
}
]
},
'openProps': []
}
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.serialNumber
}
})
} else {
this.locationList = []
}
})
.catch((err) => console.log(err))
.finally(() => {
this.loading = false
this.remoteFlag = true
this.tableColumnSelect = false
})
} else {
this.$utils.showMessageWarning('上一步请求正在查询中,请稍后')
}
},
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