|
@@ -27,15 +27,16 @@
|
|
|
<div :key="index" class="my-line">
|
|
|
<el-row class="my-row">
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="名称" prop="materialName" :rules="{required: true, message: '名称不能为空', trigger: 'blur'}">
|
|
|
- <el-input v-if="display" v-model="item.materialName" :disabled="true"/>
|
|
|
+ <el-form-item label="名称" prop="materialId" :rules="{required: false, message: '名称不能为空', trigger: 'blur'}">
|
|
|
+ <el-input v-if="display || item.buttonType === '1'" placeholder="请输入" v-model="item.materialName"
|
|
|
+ :disabled="display" style="width: 200px; margin-right: 10px"/>
|
|
|
<el-select v-else v-model="item.materialId"
|
|
|
remote
|
|
|
filterable
|
|
|
- allow-create
|
|
|
:remote-method="remoteMaterial"
|
|
|
@change="onMaterialChanged(item)"
|
|
|
- placeholder="请选择或输入">
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 200px">
|
|
|
<el-option
|
|
|
v-for="item in optionsMaterial"
|
|
|
:key="item.code"
|
|
@@ -43,11 +44,26 @@
|
|
|
:value="item.code">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
+ <el-button v-show="item.buttonType && item.buttonType === '1'" @click="changeButtonType(item, 0)" type="danger">转为选择</el-button>
|
|
|
+ <el-button v-show="!item.buttonType || item.buttonType === '0'" @click="changeButtonType(item, 1)" type="danger">转为输入</el-button>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="padding-left: 20px">
|
|
|
- <el-form-item label="类别" prop="categoryName" :rules="{required: false, message: '类别不能为空', trigger: 'blur'}">
|
|
|
- <el-input v-model="item.categoryName" :disabled="display" placeholder="类别"></el-input>
|
|
|
+ <el-form-item label="类别" prop="materialTypeId" :rules="{required: false, message: '类别不能为空', trigger: 'blur'}">
|
|
|
+ <el-input v-if="!item.buttonType || item.buttonType === '0'" v-model="item.categoryName" :disabled="true" style="width: 200px"></el-input>
|
|
|
+ <el-select v-else v-model="item.materialTypeId"
|
|
|
+ remote
|
|
|
+ filterable
|
|
|
+ :remote-method="remoteMaterialTypes"
|
|
|
+ style="width: 200px"
|
|
|
+ placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in optionsMaterialTypes"
|
|
|
+ :key="item.code"
|
|
|
+ :label="item.value"
|
|
|
+ :value="item.code">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="text-align: right;">
|
|
@@ -57,12 +73,12 @@
|
|
|
<el-row class="my-row">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="单位" prop="unitName" :rules="{required: false, message: '单位不能为空', trigger: 'blur'}">
|
|
|
- <el-input v-model="item.unitName" :disabled="display" placeholder="单位"></el-input>
|
|
|
+ <el-input v-model="item.unitName" :disabled="display || !item.buttonType || item.buttonType === '0'" placeholder="单位"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="padding-left: 20px">
|
|
|
<el-form-item label="规格" prop="specifications" :rules="{required: false, message: '规格不能为空', trigger: 'blur'}">
|
|
|
- <el-input v-model="item.specifications" :disabled="display" placeholder="规格"></el-input>
|
|
|
+ <el-input v-model="item.specifications" :disabled="display || !item.buttonType || item.buttonType === '0'" placeholder="规格"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" style="padding-left: 20px">
|
|
@@ -135,7 +151,7 @@
|
|
|
import UserComponent from '../common/user-component'
|
|
|
import DictSelect from '../sys/dict-select'
|
|
|
import { getUserInfo } from '@/api/user'
|
|
|
- import { getMaterialList, getConversionList, inboundBatch, getBoundDetails } from '@/api/warehouse'
|
|
|
+ import { getMaterialList, getConversionList, inboundBatch, getBoundDetails, getMaterialTypes } from '@/api/warehouse'
|
|
|
export default {
|
|
|
name: 'stock-order-inbound',
|
|
|
components: {DictSelect, UserComponent},
|
|
@@ -155,7 +171,8 @@
|
|
|
userId: [{ required: true, message: '请选择入库申请人', trigger: 'blur' }]
|
|
|
},
|
|
|
optionsMaterial: [],
|
|
|
- optionsConversion: []
|
|
|
+ optionsConversion: [],
|
|
|
+ optionsMaterialTypes: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -231,7 +248,7 @@
|
|
|
batchNumber: item.batchNumber,
|
|
|
cnt: item.cnt,
|
|
|
materialId: item.materialId,
|
|
|
- materialName: item.materialName,
|
|
|
+ materialName: item.materialName ? item.materialName : item.materialId,
|
|
|
materialTypeId: item.materialTypeId,
|
|
|
notes: item.notes,
|
|
|
orgId: this.orgId,
|
|
@@ -275,6 +292,24 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 远程方法:货物种类
|
|
|
+ async remoteMaterialTypes (query) {
|
|
|
+ if (!query) return
|
|
|
+ const params = {
|
|
|
+ materialName: query.trimStart()
|
|
|
+ }
|
|
|
+ await getMaterialTypes(params).then(({data}) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.optionsMaterialTypes = []
|
|
|
+ data.data.records.forEach((item) => {
|
|
|
+ this.optionsMaterialTypes.push({
|
|
|
+ code: item.id,
|
|
|
+ value: item.name
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 远程方法:物料List
|
|
|
async remoteMaterial (query) {
|
|
|
if (!query) return
|
|
@@ -298,7 +333,7 @@
|
|
|
})
|
|
|
},
|
|
|
onMaterialChanged (item) {
|
|
|
- if (!item.materialId) return
|
|
|
+ if (!item.id) return
|
|
|
let item2 = this.optionsMaterial.find((item1) => item1.code === item.materialId)
|
|
|
if (!item2) return
|
|
|
item.categoryName = item2.categoryName
|
|
@@ -324,6 +359,14 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 切换按钮状态
|
|
|
+ changeButtonType (item, type) {
|
|
|
+ if (!item) return
|
|
|
+ item.buttonType = type === 0 ? '0' : '1'
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$forceUpdate()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|