备份

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//使用categoryCode绑定传入 //v-if每个子项模板
<template>
<view>
<!-- <template v-if="categoryCode === 'A'"> -->
<view class="block-list align-center" v-for="i in productType" :key="i.key">
<view class="list-left">{{ i.name }}</view>
<view class="input-box bg-white weight-box">
<u-input placeholder="" v-model="i.value" />
</view>
</view>
<!-- </template> -->
</view>
</template>

<script>
export default {
name: "subitem",
props: {
categoryCode: {
type: String,
default: "",
},
item: {
type: Object,
default() {
return {};
},
},
},
data() {
return {
productType: [],
category: [
{ name: "内径", key: "coilInnerDia", value: "" },
{ name: "厚度/直径", key: "orderThick", value: "" },
{ name: "宽度", key: "width", value: "" },
{ name: "长度", key: "orderLength", value: "" },
{ name: "壁厚", key: "thickTbthDim", value: "" },
{ name: "外径", key: "coilInsideDia", value: "" },
{ name: "订货量", key: "netWeight", value: "" },
],
A: ["orderThick","width","orderLength","netWeight" ],
B: ["coilInnerDia","orderThick","width","orderLength","netWeight" ],
C: ["orderThick","width","orderLength","netWeight" ],
D: ["coilInnerDia","orderThick","width","orderLength","netWeight" ],
E: ["coilInnerDia","orderThick","width","orderLength","netWeight" ],
G: ["coilInnerDia","orderThick","width","orderLength","netWeight" ],
N: ["coilInnerDia","orderThick","width","netWeight" ],
Q: ["coilInnerDia","orderThick","width","netWeight" ],
R: ["orderLength","netWeight" ],
S: ["orderThick","orderLength","netWeight" ],
T: ["coilInnerDia","orderThick","width","netWeight" ],
U: ["orderLength","netWeight" ],
W: ["coilInsideDia","thickTbthDim","coilInnerDia","orderLength","netWeight" ],
X: ["orderThick","netWeight" ],
};
},
mounted() {
this.setCategory();
this.setValue();
},
methods: {
setCategory() {
const item = this.categoryCode
let arr = [];
this.category.map((i, index) => {
Object.keys(item).includes(i.key) ? arr.push(this.category[index]) : "";
});
this.productType = arr;
},
setValue() {
let arr = this.productType
// const mapping = {
// A: "gp",
// B: "rz",
// C: "zhb",
// D: "rzsx",
// E: "lz",
// G: "rdx",
// N: "wqx",
// Q: "qx",
// R: "gg",
// S: "bc",
// T: "ct",
// U: "xg",
// W: "wfgg",
// X: "xc",
// };
// const arr = this[mapping[this.categoryCode]];
// let arr = this.categoryCode
if(arr.length){
arr.map((i) => {
i.value = this.item[i.key];
});

}
},
},
};
</script>

<style>
.input-box {
border: 1px solid #eee;
border-radius: 10rpx;
padding: 0 20rpx;
}
.weight-box {
width: 50vw;
}
</style>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//使用categoryCode绑定传入 //v-if每个子项模板
<template>
<view>
<!-- <template v-if="categoryCode === 'A'"> -->
<view class="block-list align-center" v-for="i in productType" :key="i.key">
<view class="list-left">{{ i.name }}</view>
<view class="input-box bg-white weight-box">
<u-input placeholder="" v-model="i.value" />
</view>
</view>
<!-- </template> -->
</view>
</template>

<script>
export default {
name: "subitem",
props: {
// categoryCode: {
// type: String,
// default: "",
// },
item: {
type: Object,
default() {
return {};
},
},
},
data() {
return {
productType: [],
category: [
{ name: "内径", key: "coilInnerDia", value: "" },
{ name: "厚度/直径", key: "orderThick", value: "" },
{ name: "宽度", key: "width", value: "" },
{ name: "长度", key: "orderLength", value: "" },
{ name: "壁厚", key: "thickTbthDim", value: "" },
{ name: "外径", key: "coilInsideDia", value: "" },
{ name: "订货量", key: "netWeight", value: "" },
],
gp: ["orderThick","width","orderLength","netWeight" ],
rz: ["coilInnerDia","orderThick","width","orderLength","netWeight" ],
zhb: ["orderThick","width","orderLength","netWeight" ],
rzsx: ["coilInnerDia","orderThick","width","orderLength","netWeight" ],
lz: ["coilInnerDia","orderThick","width","orderLength","netWeight" ],
rdx: ["coilInnerDia","orderThick","width","orderLength","netWeight" ],
wqx: ["coilInnerDia","orderThick","width","netWeight" ],
qx: ["coilInnerDia","orderThick","width","netWeight" ],
gg: ["orderLength","netWeight" ],
bc: ["orderThick","orderLength","netWeight" ],
ct: ["coilInnerDia","orderThick","width","netWeight" ],
xg: ["orderLength","netWeight" ],
wfgg: ["coilInsideDia","thickTbthDim","coilInnerDia","orderLength","netWeight" ],
xc: ["orderThick","netWeight" ],
};
},
mounted() {
this.setCategory();
this.setValue();
},
methods: {
setCategory() {
const item = this.item
let arr = [];
this.category.map((i, index) => {
Object.keys(item).includes(i.key) ? arr.push(this.category[index]) : "";
});
this.productType = arr;
},
setValue() {
let arr = this.productType
const mapping = {
A: "gp",
B: "rz",
C: "zhb",
D: "rzsx",
E: "lz",
G: "rdx",
N: "wqx",
Q: "qx",
R: "gg",
S: "bc",
T: "ct",
U: "xg",
W: "wfgg",
X: "xc",
};
// const arr = this[mapping[this.categoryCode]];
if(arr.length){
arr.map((i) => {
i.value = this.item[i.key];
});

}
},
},
};
</script>

<style>
.input-box {
border: 1px solid #eee;
border-radius: 10rpx;
padding: 0 20rpx;
}
.weight-box {
width: 50vw;
}
</style>