This commit is contained in:
faiz 2024-07-02 09:58:38 +08:00
parent bc2e2c02fe
commit 4eae526816
1 changed files with 25 additions and 16 deletions

View File

@ -197,6 +197,23 @@
</template> </template>
</el-table> </el-table>
</el-form-item> </el-form-item>
<!-- <el-table
:data="attrList"
style="width: 100%">
<el-table-column
prop="title"
label="规格名称"
width="180">
</el-table-column>
<el-table-column
prop="detail"
label="规格值"
width="180">
<template slot-scope="scope">
<el-input @input="handleModet(scope.row)" v-for="item in scope.row.detail" v-model="item.value"></el-input>
</template>
</el-table-column>
</el-table> -->
<el-form-item> <el-form-item>
<el-button :loading="loading1" type="primary" class="submission" @click="handleSubmit('formValidate')">提交</el-button> <el-button :loading="loading1" type="primary" class="submission" @click="handleSubmit('formValidate')">提交</el-button>
</el-form-item> </el-form-item>
@ -431,8 +448,8 @@ export default {
], ],
tableIndex: 0, tableIndex: 0,
attrInfo: {}, attrInfo: {},
fatAttrValue:[],
detailStatus:true, detailStatus:true,
attrList:[],
oneFormBatch: [ oneFormBatch: [
{ {
image: '', image: '',
@ -474,15 +491,10 @@ export default {
}, },
methods: { methods: {
handleMany(row,i,val){ handleMany(row,i,val){
// row.detail[val] = row[i]
// console.log('row',row);
// console.log('i',i);
// console.log(val);
if(row[i]){ if(row[i]){
this.detailStatus = false this.detailStatus = false
this.fatAttrValue.map((res,key)=>{ this.ManyAttrValue.map((res,key)=>{
console.log(row.detail[val]) if(row.detail[val] == res.detail[val] && res.unique!==row.unique){
if(row.detail[val] == res.detail[val] && key!=0){
// //
res[i] = row[i] res[i] = row[i]
// detail // detail
@ -495,7 +507,6 @@ export default {
res['sku'] = skuValue res['sku'] = skuValue
} }
}) })
this.ManyAttrValue = this.fatAttrValue
row.detail[val] = row[i] row.detail[val] = row[i]
row.detail[val] = row[i] row.detail[val] = row[i]
let skuValue = '' let skuValue = ''
@ -650,22 +661,21 @@ export default {
watCh(val) { watCh(val) {
const tmp = {} const tmp = {}
const tmpTab = {} const tmpTab = {}
const temAttr = []
this.formValidate.attr.forEach((o, i) => { this.formValidate.attr.forEach((o, i) => {
tmp['value' + i] = { title: o.value } tmp['value' + i] = { title: o.value }
tmpTab['value' + i] = '' tmpTab['value' + i] = ''
temAttr.push({title:o.value,detail:o.detail.map((v, g) => {
return { value: v }
})})
}) })
this.attrList = temAttr
this.ManyAttrValue = this.attrFormat(val) this.ManyAttrValue = this.attrFormat(val)
this.fatAttrValue = this.attrFormat(val)
this.ManyAttrValue.forEach((val, index) => { this.ManyAttrValue.forEach((val, index) => {
const key = Object.values(val.detail).sort().join('/') const key = Object.values(val.detail).sort().join('/')
if (this.attrInfo[key]) this.ManyAttrValue[index] = this.attrInfo[key] if (this.attrInfo[key]) this.ManyAttrValue[index] = this.attrInfo[key]
val.image = this.formValidate.image val.image = this.formValidate.image
}) })
this.fatAttrValue.forEach((val, index) => {
const key = Object.values(val.detail).sort().join('/')
if (this.attrInfo[key]) this.fatAttrValue[index] = this.attrInfo[key]
val.image = this.formValidate.image
})
this.attrInfo = {} this.attrInfo = {}
this.ManyAttrValue.forEach((val) => { this.ManyAttrValue.forEach((val) => {
if (val.detail !== 'undefined' && val.detail !== null) { if (val.detail !== 'undefined' && val.detail !== null) {
@ -788,7 +798,6 @@ export default {
this.OneattrValue = info.attrValue this.OneattrValue = info.attrValue
} else { } else {
this.ManyAttrValue = info.attrValue this.ManyAttrValue = info.attrValue
this.fatAttrValue = info.attrValue
this.ManyAttrValue.forEach(val => { this.ManyAttrValue.forEach(val => {
if (val.detail !== 'undefined' && val.detail !== null) { if (val.detail !== 'undefined' && val.detail !== null) {
this.attrInfo[ this.attrInfo[