|
@@ -2,60 +2,82 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<div class="my-title">采购</div>
|
|
|
+
|
|
|
<!-- 表单 -->
|
|
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item ref="supplierCheckbox" label="供应商" prop="supplierId">
|
|
|
- <supplier-component v-model="dataForm.supplierId" :supplier-id.sync="dataForm.supplierId"></supplier-component>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item ref="supplierInput" label="其他供应商" prop="supplierOther">
|
|
|
- <el-input v-model="dataForm.supplierOther" placeholder="请输入其他供应商"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="采购依据" prop="procurementBasis">
|
|
|
- <el-select
|
|
|
- v-model="dataForm.procurementBasis"
|
|
|
- placeholder="请选择">
|
|
|
- <el-option
|
|
|
- v-for="item in optionsPB"
|
|
|
- :key="item.code"
|
|
|
- :label="item.value"
|
|
|
- :value="item.code">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="不含税单价" prop="price">
|
|
|
- <el-input-number v-model="dataForm.price" :step="1" :min="0" :precision="1"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="含税单价" prop="taxPrice">
|
|
|
- <el-input-number v-model="dataForm.taxPrice" :step="1" :min="0" :precision="1"></el-input-number>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="含税总价" prop="procurementCode">
|
|
|
- <span>{{ (dataForm.cnt * dataForm.taxPrice).toFixed(1) }}</span>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="my-row">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="税率" prop="taxRate">
|
|
|
- <el-input-number v-model="dataForm.taxRate" :step="1" :precision="1"/> %
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <div class="form-item" v-for="(item, index) in dataForm.list" :key="item.purchaseDetailId">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="物品名称">
|
|
|
+ <span>{{item.materialName}}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="规格/型号">
|
|
|
+ <span>{{item.specification}}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="数量">
|
|
|
+ <span>{{item.cnt}}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="用途">
|
|
|
+ <span>{{item.batchNumber}}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item ref="supplierCheckbox" label="供应商" :prop="'list.' + index + '.supplierId'" :rules="dataRule.supplierId">
|
|
|
+ <supplier-component v-model="item.supplierId" :supplier-id.sync="item.supplierId"></supplier-component>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item ref="supplierInput" label="其他供应商" :prop="'list.' + index + '.supplierOther'" :rules="dataRule.supplierOther">
|
|
|
+ <el-input v-model="item.supplierOther" placeholder="请输入其他供应商"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="采购依据" :prop="'list.' + index + '.procurementBasis'" :rules="dataRule.procurementBasis">
|
|
|
+ <el-select
|
|
|
+ v-model="item.procurementBasis"
|
|
|
+ placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item2 in optionsPB"
|
|
|
+ :key="item2.code"
|
|
|
+ :label="item2.value"
|
|
|
+ :value="item2.code">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row class="my-row">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="不含税单价" :prop="'list.' + index + '.price'" :rules="dataRule.price">
|
|
|
+ <el-input-number v-model="item.price" :step="1" :min="0" :precision="1"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="含税单价" :prop="'list.' + index + '.taxPrice'" :rules="dataRule.taxPrice">
|
|
|
+ <el-input-number v-model="item.taxPrice" :step="1" :min="0" :precision="1"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="含税总价">
|
|
|
+ <span>{{ (item.cnt * item.taxPrice).toFixed(1) }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="税率" :prop="'list.' + index + '.taxRate'" :rules="dataRule.taxRate">
|
|
|
+ <el-input-number v-model="item.taxRate" :step="1" :precision="1"/> %
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="onChose">取消</el-button>
|
|
@@ -88,7 +110,8 @@
|
|
|
return {
|
|
|
id: 0,
|
|
|
dataForm: {
|
|
|
- cnt: 1
|
|
|
+ cnt: 1,
|
|
|
+ list:[]
|
|
|
},
|
|
|
dataRule: {
|
|
|
supplierId: [{required: true, validator: validateSupplier, trigger: 'change'}],
|
|
@@ -98,7 +121,8 @@
|
|
|
taxPrice: [{ required: true, message: '请输入含税单价', trigger: 'change' }],
|
|
|
taxRate: [{ required: true, message: '请输入税率', trigger: 'change' }]
|
|
|
},
|
|
|
- optionsPB: [] // 采购依据(字典)
|
|
|
+ optionsPB: [], // 采购依据(字典)
|
|
|
+ subTitle: '' //副标题
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -116,7 +140,16 @@
|
|
|
async init (row) {
|
|
|
if (!row) return
|
|
|
this.getPbList()
|
|
|
- this.dataForm = row
|
|
|
+ // this.dataForm = row
|
|
|
+
|
|
|
+ if(row instanceof Array){
|
|
|
+ this.subTitle = '批量采购'
|
|
|
+ this.dataForm.list = []
|
|
|
+ this.dataForm.list = [...row]
|
|
|
+ } else {
|
|
|
+ this.subTitle = '采购'
|
|
|
+ this.dataForm.list = [row]
|
|
|
+ }
|
|
|
},
|
|
|
validateField (type) {
|
|
|
this.$refs.dataForm.validateField(type)
|
|
@@ -125,30 +158,32 @@
|
|
|
dataFormSubmit () {
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ console.log(1111)
|
|
|
// // 检查供应商
|
|
|
// if (!this.dataForm.supplierId && !this.dataForm.supplierOther) {
|
|
|
// this.$message.error('请填写供应商')
|
|
|
// return
|
|
|
// }
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl(`/biz-service/purchaseDetail/updatePurchaseDetail`),
|
|
|
- method: 'post',
|
|
|
- data: this.$http.adornData({...this.dataForm})
|
|
|
- }).then(({data}) => {
|
|
|
- if (data && data.code === '200') {
|
|
|
- this.$message({
|
|
|
- message: '操作成功',
|
|
|
- type: 'success',
|
|
|
- duration: 1500,
|
|
|
- onClose: () => {
|
|
|
- this.onChose()
|
|
|
- this.$emit('refreshDataList')
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.$message.error(data.msg)
|
|
|
- }
|
|
|
- })
|
|
|
+
|
|
|
+ // this.$http({
|
|
|
+ // url: this.$http.adornUrl(`/biz-service/purchaseDetail/updatePurchaseDetail`),
|
|
|
+ // method: 'post',
|
|
|
+ // data: this.$http.adornData({...this.dataForm})
|
|
|
+ // }).then(({data}) => {
|
|
|
+ // if (data && data.code === '200') {
|
|
|
+ // this.$message({
|
|
|
+ // message: '操作成功',
|
|
|
+ // type: 'success',
|
|
|
+ // duration: 1500,
|
|
|
+ // onClose: () => {
|
|
|
+ // this.onChose()
|
|
|
+ // this.$emit('refreshDataList')
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.$message.error(data.msg)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -157,5 +192,11 @@
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
-
|
|
|
+.form-item {
|
|
|
+ /* border-bottom: 1px solid #000; */
|
|
|
+ margin: 5px 0;
|
|
|
+ padding:25px 0 5px;
|
|
|
+ background-color: #f1f9f9;
|
|
|
+ border-radius: 10px;
|
|
|
+}
|
|
|
</style>
|