|
@@ -4,18 +4,19 @@
|
|
|
<el-row :gutter="2">
|
|
|
<el-col :span="24">
|
|
|
<ProductTypeSelector
|
|
|
- v-model="productTypeResult"
|
|
|
:productTypeOptions="productTypeOptions"
|
|
|
+ :value="productTypeResult"
|
|
|
+ @input="onProductionInput"
|
|
|
@change="onProductionChange"
|
|
|
/>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row :gutter="2" v-if="productTypeResult.productCode">
|
|
|
+ <el-row :gutter="2" v-if="productTypeResult && productTypeResult.productCode">
|
|
|
<el-col :span="24">
|
|
|
<ProductSchemaForm
|
|
|
:productType="productTypeResult.productCode"
|
|
|
:productInfo="productTypeInfo"
|
|
|
- v-model="form"
|
|
|
+ :value="productForm"
|
|
|
:index="index"
|
|
|
@input="onSchemaFormChange"
|
|
|
/>
|
|
@@ -49,25 +50,61 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- productTypeResult: {
|
|
|
- productCode: '',
|
|
|
- activityCode: '',
|
|
|
- },
|
|
|
- productTypeInfo: {},
|
|
|
- form: {}
|
|
|
+ // productTypeResult: {
|
|
|
+ // productCode: '',
|
|
|
+ // activityCode: '',
|
|
|
+ // },
|
|
|
+ // productTypeInfo: {},
|
|
|
+ // form: {}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
productTypeOptions: state => state.order.productList,
|
|
|
+ productInfoList: state => state.order.orderInfo.productInfoList,
|
|
|
}),
|
|
|
+ productInfoListItem() {
|
|
|
+ return this.productInfoList[this.index]?.productCardInfo || {}
|
|
|
+ },
|
|
|
+ productTypeInfo(){
|
|
|
+ return this.productInfoListItem.info || {}
|
|
|
+ },
|
|
|
+ productForm() {
|
|
|
+ return this.productInfoListItem.form || {}
|
|
|
+ },
|
|
|
+ productTypeResult() {
|
|
|
+ return this.productInfoListItem.result || {
|
|
|
+ productCode: '',
|
|
|
+ activityCode: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
onProductionChange(e) {
|
|
|
- this.productTypeInfo = e.info
|
|
|
+ // this.productTypeInfo = e.info
|
|
|
+ const p = {
|
|
|
+ key: 'info',
|
|
|
+ data: e.info,
|
|
|
+ index: this.index,
|
|
|
+ }
|
|
|
+ this.$store.commit('order/refreshOrderProductItemCardForm', p)
|
|
|
this.onChange()
|
|
|
},
|
|
|
- onSchemaFormChange() {
|
|
|
+ onProductionInput(e) {
|
|
|
+ const p = {
|
|
|
+ key: 'result',
|
|
|
+ data: e,
|
|
|
+ index: this.index,
|
|
|
+ }
|
|
|
+ this.$store.commit('order/refreshOrderProductItemCardForm', p)
|
|
|
+ },
|
|
|
+ onSchemaFormChange(e) {
|
|
|
+ const p = {
|
|
|
+ key: 'form',
|
|
|
+ data: e,
|
|
|
+ index: this.index,
|
|
|
+ }
|
|
|
+ this.$store.commit('order/refreshOrderProductItemCardForm', p)
|
|
|
this.onChange()
|
|
|
},
|
|
|
getState() {
|
|
@@ -78,19 +115,6 @@ export default {
|
|
|
}
|
|
|
return JSON.parse(JSON.stringify(p))
|
|
|
},
|
|
|
- setState(t) {
|
|
|
- if (!t) return
|
|
|
- const { result: e, info, form } = t
|
|
|
- if (e) {
|
|
|
- this.productTypeResult = e
|
|
|
- }
|
|
|
- if (info) {
|
|
|
- this.productTypeInfo = info
|
|
|
- }
|
|
|
- if (form) {
|
|
|
- this.form = form
|
|
|
- }
|
|
|
- },
|
|
|
onChange() {
|
|
|
const payload = this.getState()
|
|
|
this.$emit('change', payload)
|