|
@@ -5,34 +5,46 @@
|
|
|
:close-on-click-modal="false"
|
|
|
:visible.sync="visible">
|
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="auto">
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="编码" prop="code">
|
|
|
- <el-input v-model="dataForm.code" placeholder="缺字段"></el-input>
|
|
|
+ <el-row class="my-row my-row-1">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="编码" prop="recordCode">
|
|
|
+ <el-input v-model="dataForm.recordCode" :disabled="true" placeholder="编码系统自动生成"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="6" style="padding-left: 20px">
|
|
|
+ <el-col :span="8" style="padding-left: 20px">
|
|
|
<el-form-item label="领料人" prop="userId">
|
|
|
<user-component v-model="dataForm.userId" @userSelected="userChanged"></user-component>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="6" style="padding-left: 20px">
|
|
|
- <el-form-item label="领料人部门" prop="orgId">
|
|
|
- <el-input :disabled="true" v-model="dataForm.orgName" placeholder="请选择领料人"></el-input>
|
|
|
+ <el-col :span="8" style="padding-left: 20px">
|
|
|
+ <el-form-item label="领料人部门" prop="orgName">
|
|
|
+ <el-input :disabled="true" v-model="dataForm.orgName" placeholder="自动匹配"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <template v-for="(item, index) in dataForm">
|
|
|
+ <template v-for="(item, index) in dataList">
|
|
|
<div :key="index" class="my-line">
|
|
|
<el-row class="my-row">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="名称" prop="materialName">
|
|
|
- <el-input v-model="item.materialName" placeholder="请填写名称"></el-input>
|
|
|
+ <el-select v-model="item.materialId"
|
|
|
+ remote
|
|
|
+ filterable
|
|
|
+ :remote-method="remoteMaterial"
|
|
|
+ @change="onMaterialChanged(item)"
|
|
|
+ placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in optionsMaterial"
|
|
|
+ :key="item.code"
|
|
|
+ :label="item.value"
|
|
|
+ :value="item.code">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="批次号" prop="batchNumber">
|
|
|
- <el-input v-model="item.batchNumber" placeholder="请填写入库物品(零件)批次"></el-input>
|
|
|
+ <el-form-item label="类别" prop="cateId">
|
|
|
+ <el-input v-model="item.categoryName" :disabled="true" placeholder="类别"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="text-align: right;">
|
|
@@ -42,17 +54,17 @@
|
|
|
<el-row class="my-row">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="单位" prop="unitName">
|
|
|
- <el-input v-model="item.unitName" placeholder="缺字段"></el-input>
|
|
|
+ <el-input v-model="item.unitName" :disabled="true" placeholder="单位"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="类别" prop="cateId">
|
|
|
- <dict-select :dict-id="item.cateId" v-bind:dict-type="dictType"/>
|
|
|
+ <el-form-item label="规格" prop="specifications">
|
|
|
+ <el-input v-model="item.specifications" :disabled="true" placeholder="规格"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="规格" prop="specifications">
|
|
|
- <el-input v-model="item.specifications" placeholder="缺字段"></el-input>
|
|
|
+ <el-form-item label="批次号" prop="batchNumber">
|
|
|
+ <el-input v-model="item.batchNumber" placeholder="请填写出库物品(零件)批次"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -84,6 +96,8 @@
|
|
|
<script>
|
|
|
import UserComponent from '../common/user-component'
|
|
|
import DictSelect from '../sys/dict-select'
|
|
|
+ import { getUserInfo } from '@/api/user'
|
|
|
+ import { getMaterialList, outboundBatch } from '@/api/warehouse'
|
|
|
import {getUUID} from '../../../utils'
|
|
|
export default {
|
|
|
name: 'stock-order-inbound',
|
|
@@ -91,39 +105,22 @@
|
|
|
data () {
|
|
|
return {
|
|
|
visible: false,
|
|
|
- dictType: 'material_type',
|
|
|
- dataForm: [{
|
|
|
- id: '',
|
|
|
- amount: 0,
|
|
|
- applicant: '',
|
|
|
- approver: '',
|
|
|
- batchNumber: '',
|
|
|
- cnt: '',
|
|
|
- materialId: '',
|
|
|
- materialName: '',
|
|
|
- notes: '',
|
|
|
- orgId: '',
|
|
|
- price: '',
|
|
|
- recordType: '',
|
|
|
- source: '',
|
|
|
- state: 0,
|
|
|
- templateItemPlanId: '',
|
|
|
- usage: '',
|
|
|
- userId: '',
|
|
|
- orgName: ''
|
|
|
- }],
|
|
|
+ dataForm: {},
|
|
|
+ dataList: [],
|
|
|
dataRule: {
|
|
|
- }
|
|
|
+ },
|
|
|
+ optionsMaterial: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
init () {
|
|
|
this.visible = true
|
|
|
- this.dataForm = []
|
|
|
+ this.dataForm = {}
|
|
|
+ this.dataList = []
|
|
|
this.addOne()
|
|
|
},
|
|
|
addOne () {
|
|
|
- this.dataForm.push({
|
|
|
+ this.dataList.push({
|
|
|
id: '',
|
|
|
code: getUUID(),
|
|
|
amount: 0,
|
|
@@ -146,8 +143,8 @@
|
|
|
})
|
|
|
},
|
|
|
removeOne (index) {
|
|
|
- this.dataForm.splice(index, 1)
|
|
|
- if (this.dataForm.length === 0) {
|
|
|
+ this.dataList.splice(index, 1)
|
|
|
+ if (this.dataList.length === 0) {
|
|
|
this.addOne()
|
|
|
}
|
|
|
},
|
|
@@ -155,29 +152,29 @@
|
|
|
dataFormSubmit () {
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl(`/biz-service/in-out-bound-ctl/inbound`),
|
|
|
- method: 'post',
|
|
|
- data: this.$http.adornData({
|
|
|
- 'amount': this.dataForm.amount,
|
|
|
- 'applicant': this.dataForm.applicant,
|
|
|
- 'approver': this.dataForm.approver,
|
|
|
- 'batchNumber': this.dataForm.batchNumber,
|
|
|
- 'cnt': this.dataForm.cnt,
|
|
|
- 'materialId': this.dataForm.materialId,
|
|
|
- 'materialName': this.dataForm.materialName,
|
|
|
- 'notes': this.dataForm.notes,
|
|
|
- 'price': this.dataForm.price,
|
|
|
- 'orgId': this.dataForm.orgId,
|
|
|
- 'recordType': this.dataForm.recordType,
|
|
|
- 'source': this.dataForm.source,
|
|
|
- 'state': this.dataForm.state,
|
|
|
- 'templateItemPlanId': this.dataForm.templateItemPlanId,
|
|
|
- 'usage': this.dataForm.usage,
|
|
|
- 'userId': this.dataForm.userId,
|
|
|
- 'creatorId': this.$store.state.user.id
|
|
|
+ let postData = []
|
|
|
+ this.dataList.forEach((item) => {
|
|
|
+ postData.push({
|
|
|
+ amount: item.amount,
|
|
|
+ applicant: this.dataForm.userId,
|
|
|
+ approver: item.approver,
|
|
|
+ batchNumber: item.batchNumber,
|
|
|
+ cnt: item.cnt,
|
|
|
+ materialId: item.materialId,
|
|
|
+ materialName: item.materialName,
|
|
|
+ materialTypeId: item.materialTypeId,
|
|
|
+ notes: item.notes,
|
|
|
+ orgId: this.dataForm.orgId,
|
|
|
+ price: item.price,
|
|
|
+ recordCode: this.dataForm.recordCode,
|
|
|
+ recordType: this.dataForm.recordType,
|
|
|
+ source: item.source,
|
|
|
+ specifications: item.specifications,
|
|
|
+ unitName: item.unitName,
|
|
|
+ creatorId: this.$store.state.user.id
|
|
|
})
|
|
|
- }).then(({data}) => {
|
|
|
+ })
|
|
|
+ outboundBatch(postData).then(({data}) => {
|
|
|
if (data && data.code === '200') {
|
|
|
this.$message({
|
|
|
message: '操作成功',
|
|
@@ -199,10 +196,7 @@
|
|
|
this.$refs.dataForm.validateField(type)
|
|
|
},
|
|
|
userChanged (userId) {
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('/user-service/user/info/' + userId),
|
|
|
- method: 'get'
|
|
|
- }).then(({data}) => {
|
|
|
+ getUserInfo(userId).then(({data}) => {
|
|
|
if (data && data.code === '200') {
|
|
|
this.dataForm.orgId = data.data.orgId
|
|
|
this.dataForm.orgName = data.data.orgName
|
|
@@ -210,6 +204,37 @@
|
|
|
this.$message.error(data.msg)
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 远程方法:物料List
|
|
|
+ async remoteMaterial (query) {
|
|
|
+ if (!query) return
|
|
|
+ const params = {
|
|
|
+ materialName: query.trimStart()
|
|
|
+ }
|
|
|
+ await getMaterialList(params).then(({data}) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.optionsMaterial = []
|
|
|
+ data.data.records.forEach((item) => {
|
|
|
+ this.optionsMaterial.push({
|
|
|
+ code: item.materialId,
|
|
|
+ value: item.materialName,
|
|
|
+ cateId: item.cateId,
|
|
|
+ categoryName: item.categoryName,
|
|
|
+ specifications: item.specifications,
|
|
|
+ unitName: item.unitName
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onMaterialChanged (item) {
|
|
|
+ if (!item.materialId) return
|
|
|
+ let item2 = this.optionsMaterial.find((item1) => item1.code === item.materialId)
|
|
|
+ if (!item2) return
|
|
|
+ item.categoryName = item2.categoryName
|
|
|
+ item.cateId = item2.cateId
|
|
|
+ item.specifications = item2.specifications
|
|
|
+ item.unitName = item2.unitName
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -220,4 +245,7 @@
|
|
|
border-bottom: 1px solid #c0c4cc;
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
+.my-row-1{
|
|
|
+ margin-bottom: 20px;
|
|
|
+}
|
|
|
</style>
|