|
@@ -2,10 +2,11 @@
|
|
|
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
|
|
<a-table
|
|
|
:columns="columns"
|
|
|
- :dataSource="data"
|
|
|
+ :dataSource="model.data"
|
|
|
:pagination="false"
|
|
|
+ :rowKey="(record, index) => { return index }"
|
|
|
>
|
|
|
- <template
|
|
|
+ <!-- <template
|
|
|
v-for="(col, i) in ['sampleName', 'sampleModelSpecification', 'sampleQuantities','sampleManufacturer']"
|
|
|
:slot="col" slot-scope="text, record">
|
|
|
<a-input
|
|
@@ -16,7 +17,28 @@
|
|
|
:placeholder="columns[i].title"
|
|
|
@change="e => handleChange(e.target.value, record.key, col)"
|
|
|
/>
|
|
|
+ </template> -->
|
|
|
+ <template slot="sampleName" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.sampleName'" :rules="validatorRules.sampleName">
|
|
|
+ <a-input v-model="record.sampleName"></a-input>
|
|
|
+ </a-form-model-item>
|
|
|
</template>
|
|
|
+ <template slot="sampleModelSpecification" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.sampleModelSpecification'" :rules="validatorRules.sampleModelSpecification">
|
|
|
+ <a-input v-model="record.sampleModelSpecification"></a-input>
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+ <template slot="sampleQuantities" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.sampleQuantities'" :rules="validatorRules.sampleQuantities">
|
|
|
+ <a-input v-model="record.sampleQuantities"></a-input>
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+ <template slot="sampleManufacturer" slot-scope="text, record,index">
|
|
|
+ <a-form-model-item :prop="'data.'+index+'.sampleManufacturer'" :rules="validatorRules.sampleManufacturer">
|
|
|
+ <a-input v-model="record.sampleManufacturer"></a-input>
|
|
|
+ </a-form-model-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
|
|
|
<template slot="operation" slot-scope="text, record">
|
|
|
<span>
|
|
@@ -73,7 +95,9 @@ export default {
|
|
|
{ required: true, message: '请输入生产厂家!' }
|
|
|
]
|
|
|
},
|
|
|
- model: {},
|
|
|
+ model: {
|
|
|
+ data: [{}]
|
|
|
+ },
|
|
|
description: '高级表单常见于一次性输入和提交大批量数据的场景。',
|
|
|
loading: false,
|
|
|
|
|
@@ -114,7 +138,9 @@ export default {
|
|
|
scopedSlots: { customRender: 'operation' }
|
|
|
}
|
|
|
],
|
|
|
- data: []
|
|
|
+ data: [
|
|
|
+ {}
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -136,16 +162,14 @@ export default {
|
|
|
isNew: true
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
this.count = sessionStorage.getItem('count') != null ? Number(sessionStorage.getItem('count')) : 1
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
+ // 新增样品
|
|
|
newMember() {
|
|
|
- this.data.push({
|
|
|
+ this.model.data.push({
|
|
|
key: this.count + '',
|
|
|
sampleQuantities: 0,
|
|
|
sampleModelSpecification: '',
|
|
@@ -177,15 +201,16 @@ export default {
|
|
|
this.data = newData
|
|
|
}
|
|
|
},
|
|
|
+ // 下一步
|
|
|
nextStep() {
|
|
|
- sessionStorage.setItem('yangpin', JSON.stringify(this.data))
|
|
|
-
|
|
|
-
|
|
|
- // this.$refs.form.validate(valid => {
|
|
|
- // if (valid) {
|
|
|
- this.$emit('nextStep')
|
|
|
- // }
|
|
|
- // })
|
|
|
+
|
|
|
+
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.$emit('nextStep')
|
|
|
+ // sessionStorage.setItem('yangpin', JSON.stringify(this.data))
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
prevStep() {
|