|
@@ -8,12 +8,12 @@
|
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
<el-row class="my-row">
|
|
|
<el-form-item label="名称">
|
|
|
- <el-input v-model="dataForm.code" placeholder="名称"></el-input>
|
|
|
+ <el-input v-model="dataForm.templateName" :disabled="display" placeholder="请填写模板名称"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-row>
|
|
|
<el-row class="my-row">
|
|
|
<el-form-item label="备注">
|
|
|
- <el-input v-model="dataForm.code" placeholder="备注"></el-input>
|
|
|
+ <el-input v-model="dataForm.notes" :disabled="display" placeholder="备注"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
@@ -28,48 +28,49 @@
|
|
|
align="center">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="-"
|
|
|
+ prop="materialName"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="物品名称">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="recordType"
|
|
|
+ prop="specifications"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="规格">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="state"
|
|
|
+ prop="count"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="数量">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="approver"
|
|
|
+ prop="unitName"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="单位">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="-"
|
|
|
+ prop="notes"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="备注">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
+ v-if="!display"
|
|
|
fixed="right"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
width="100"
|
|
|
label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" size="small" @click="exportItem(scope.row.id)">删除</el-button>
|
|
|
+ <el-button style="color: red" type="text" size="small" @click="removeItem(scope.row.materialId)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<el-row style="text-align: center; margin-top: 10px;">
|
|
|
- <el-button type="primary" icon="el-icon-plus" @click="inBound"></el-button>
|
|
|
+ <el-button v-if="!display" type="primary" icon="el-icon-plus" @click="inBound"></el-button>
|
|
|
</el-row>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
@@ -78,24 +79,26 @@
|
|
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
- <template-chose v-if="inboundVisible" ref="inbound" />
|
|
|
+ <template-chose v-if="inboundVisible" ref="inbound" @addItem="addMaterial"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import UserComponent from '../common/user-component'
|
|
|
import DictSelect from '../sys/dict-select'
|
|
|
- import {getUUID} from '../../../utils'
|
|
|
import templateChose from './template-chose'
|
|
|
+ import { addTemplate, getTemplateInfo } from '@/api/warehouse'
|
|
|
export default {
|
|
|
name: 'stock-order-inbound',
|
|
|
components: {DictSelect, UserComponent, templateChose},
|
|
|
data () {
|
|
|
return {
|
|
|
visible: false,
|
|
|
+ display: false,
|
|
|
inboundVisible: false,
|
|
|
dictType: 'material_type',
|
|
|
dataList: [],
|
|
|
+ id: 0,
|
|
|
dataForm: {
|
|
|
id: '',
|
|
|
amount: 0,
|
|
@@ -106,37 +109,34 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- init () {
|
|
|
+ async init (id, display) {
|
|
|
+ console.log('id = ', id)
|
|
|
+ console.log('display = ', display)
|
|
|
this.visible = true
|
|
|
- this.dataForm.code = getUUID()
|
|
|
+ this.id = id || 0
|
|
|
+ this.display = display
|
|
|
+ this.dataForm = {}
|
|
|
+ this.dataList = []
|
|
|
+ if (!id) return
|
|
|
+ await getTemplateInfo(id).then(({data}) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.dataForm = data.data
|
|
|
+ this.dataList = data.data.whrTemplateMaterialList
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 表单提交
|
|
|
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
|
|
|
- })
|
|
|
- }).then(({data}) => {
|
|
|
+ let postData = {
|
|
|
+ templateName: this.dataForm.templateName,
|
|
|
+ notes: this.dataForm.notes,
|
|
|
+ whrTemplateMaterialList: this.dataList,
|
|
|
+ orgId: this.$store.state.user.orgId
|
|
|
+ }
|
|
|
+ // console.log('postData = ' + JSON.stringify(postData))
|
|
|
+ addTemplate(postData).then(({data}) => {
|
|
|
if (data && data.code === '200') {
|
|
|
this.$message({
|
|
|
message: '操作成功',
|
|
@@ -157,24 +157,29 @@
|
|
|
validateField (type) {
|
|
|
this.$refs.dataForm.validateField(type)
|
|
|
},
|
|
|
- userChanged (userId) {
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('/user-service/user/info/' + userId),
|
|
|
- method: 'get'
|
|
|
- }).then(({data}) => {
|
|
|
- if (data && data.code === '200') {
|
|
|
- this.dataForm.orgId = data.data.orgId
|
|
|
- this.dataForm.orgName = data.data.orgName
|
|
|
- } else {
|
|
|
- this.$message.error(data.msg)
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
inBound () {
|
|
|
this.inboundVisible = true
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.inbound.init()
|
|
|
})
|
|
|
+ },
|
|
|
+ // 添加物品
|
|
|
+ addMaterial (item) {
|
|
|
+ if (item) {
|
|
|
+ this.dataList.push({
|
|
|
+ count: item.cnt,
|
|
|
+ materialId: item.materialId,
|
|
|
+ materialName: item.materialName,
|
|
|
+ notes: item.notes,
|
|
|
+ orgId: this.$store.state.user.orgId,
|
|
|
+ unitName: item.unitName
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除物品
|
|
|
+ removeItem (id) {
|
|
|
+ let index = this.dataList.findIndex((item) => { return item.materialId === id })
|
|
|
+ this.dataList.splice(index, 1)
|
|
|
}
|
|
|
}
|
|
|
}
|