|
@@ -1,21 +1,22 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-dialog
|
|
|
- title="新增模板"
|
|
|
+ :title="!id ? '新增': display ? '详情' : '修改'"
|
|
|
width="70%"
|
|
|
:close-on-click-modal="false"
|
|
|
:visible.sync="visible">
|
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
<el-row class="my-row">
|
|
|
- <el-form-item label="名称">
|
|
|
+ <el-form-item label="名称" prop="templateName">
|
|
|
<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.notes" :disabled="display" placeholder="备注"></el-input>
|
|
|
+ <el-form-item label="备注" prop="notes">
|
|
|
+ <el-input type="textarea" v-model="dataForm.notes" :disabled="display"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-row>
|
|
|
+ <div class="title"><span style="color: red">*</span> 材料清单</div>
|
|
|
<el-row>
|
|
|
<el-table
|
|
|
:data="dataList"
|
|
@@ -44,6 +45,9 @@
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
label="数量">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number v-model="scope.row.count" :disabled="display" :min="1" style="width: 140px;"/>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="unitName"
|
|
@@ -79,7 +83,7 @@
|
|
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
- <template-chose v-if="inboundVisible" ref="inbound" @addItem="addMaterial"/>
|
|
|
+ <template-chose v-if="inboundVisible" ref="inbound" @addItems="addItems"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -105,6 +109,7 @@
|
|
|
applicant: ''
|
|
|
},
|
|
|
dataRule: {
|
|
|
+ templateName: [{ required: true, message: '名称不能为空', trigger: 'blur' }]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -133,7 +138,6 @@
|
|
|
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({
|
|
@@ -174,6 +178,12 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ addItems (items) {
|
|
|
+ this.dataList = []
|
|
|
+ items.forEach((item) => {
|
|
|
+ this.addMaterial(item)
|
|
|
+ })
|
|
|
+ },
|
|
|
// 删除物品
|
|
|
removeItem (id) {
|
|
|
let index = this.dataList.findIndex((item) => { return item.materialId === id })
|