|
@@ -24,7 +24,8 @@
|
|
|
</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-form-model-item :prop="'data.'+index+'.sampleModelSpecification'"
|
|
|
+ :rules="validatorRules.sampleModelSpecification">
|
|
|
<a-input :disabled="formDisabled" v-model="record.sampleModelSpecification"></a-input>
|
|
|
</a-form-model-item>
|
|
|
</template>
|
|
@@ -42,13 +43,14 @@
|
|
|
|
|
|
<template slot="operation" slot-scope="text, record">
|
|
|
<span>
|
|
|
- <a-popconfirm title="是否要删除此行?" :disabled="formDisabled" @confirm="remove(record.key)">
|
|
|
+ <a-popconfirm title="是否要删除此行?" :disabled="formDisabled" @confirm="remove(record.key)">
|
|
|
<a>删除</a>
|
|
|
</a-popconfirm>
|
|
|
</span>
|
|
|
</template>
|
|
|
</a-table>
|
|
|
- <a-button style="width: 100%; margin-top: 16px; margin-bottom: 8px" type="dashed" :disabled="formDisabled" icon="plus" @click="newMember">
|
|
|
+ <a-button style="width: 100%; margin-top: 16px; margin-bottom: 8px" type="dashed" :disabled="formDisabled"
|
|
|
+ icon="plus" @click="newMember">
|
|
|
新增样品
|
|
|
</a-button>
|
|
|
|
|
@@ -84,11 +86,20 @@ export default {
|
|
|
var arr = this.model.data.filter(item => item.sampleName === value)
|
|
|
console.log(arr)
|
|
|
if (arr.length > 1) {
|
|
|
- callback(new Error('该样品名称存在重复'));
|
|
|
+ callback(new Error('该样品名称存在重复'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
}
|
|
|
+ let numbermin = (rule, value, callback) => {
|
|
|
+
|
|
|
+ if (value < 1) {
|
|
|
+ callback(new Error('样品数量必须大于等于1'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
count: 1,
|
|
|
validatorRules: {
|
|
@@ -100,7 +111,9 @@ export default {
|
|
|
{ required: true, message: '请输入样品规格/型号!' }
|
|
|
],
|
|
|
sampleQuantities: [
|
|
|
- { required: true, message: '请输入样品数量!' }
|
|
|
+ { required: true, message: '请输入样品数量!' },
|
|
|
+ { type: 'number', message: '样品数量必须是数字',transform:(value)=>Number(value) },
|
|
|
+ { validator: numbermin }
|
|
|
],
|
|
|
sampleManufacturer: [
|
|
|
{ required: true, message: '请输入生产厂家!' }
|
|
@@ -118,49 +131,48 @@ export default {
|
|
|
title: '样品名称',
|
|
|
dataIndex: 'sampleName',
|
|
|
key: 'sampleName',
|
|
|
- align:"center",
|
|
|
+ align: 'center',
|
|
|
scopedSlots: { customRender: 'sampleName' }
|
|
|
},
|
|
|
{
|
|
|
title: '样品规格/型号',
|
|
|
dataIndex: 'sampleModelSpecification',
|
|
|
key: 'sampleModelSpecification',
|
|
|
- align:"center",
|
|
|
+ align: 'center',
|
|
|
scopedSlots: { customRender: 'sampleModelSpecification' }
|
|
|
},
|
|
|
{
|
|
|
title: '样品数量',
|
|
|
dataIndex: 'sampleQuantities',
|
|
|
key: 'sampleQuantities',
|
|
|
- align:"center",
|
|
|
+ align: 'center',
|
|
|
scopedSlots: { customRender: 'sampleQuantities' }
|
|
|
},
|
|
|
{
|
|
|
title: '生产厂家',
|
|
|
dataIndex: 'sampleManufacturer',
|
|
|
key: 'sampleManufacturer',
|
|
|
- align:"center",
|
|
|
+ align: 'center',
|
|
|
scopedSlots: { customRender: 'sampleManufacturer' }
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
key: 'action',
|
|
|
- align:"center",
|
|
|
+ align: 'center',
|
|
|
scopedSlots: { customRender: 'operation' }
|
|
|
}
|
|
|
- ],
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- formDisabled(){
|
|
|
+ formDisabled() {
|
|
|
return this.disabled
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
const data = JSON.parse(sessionStorage.getItem('yangpin'))
|
|
|
if (data != null) {
|
|
|
- this.model.data=data
|
|
|
-
|
|
|
+ this.model.data = data
|
|
|
|
|
|
} else {
|
|
|
this.model.data.push({})
|
|
@@ -227,24 +239,27 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
- .card {
|
|
|
- margin-bottom: 24px;
|
|
|
- }
|
|
|
- .next{
|
|
|
- width: 35%;
|
|
|
- margin-left: 20px;
|
|
|
- margin-right: 20px;
|
|
|
- margin-top: 20px;
|
|
|
- }
|
|
|
- .buttonAll{
|
|
|
- width: 100%;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- }
|
|
|
- .all{
|
|
|
- width: 100%;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- }
|
|
|
+.card {
|
|
|
+ margin-bottom: 24px;
|
|
|
+}
|
|
|
+
|
|
|
+.next {
|
|
|
+ width: 35%;
|
|
|
+ margin-left: 20px;
|
|
|
+ margin-right: 20px;
|
|
|
+ margin-top: 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.buttonAll {
|
|
|
+ width: 100%;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
+
|
|
|
+.all {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+}
|
|
|
</style>
|