...
|
...
|
@@ -3,23 +3,14 @@ |
|
|
class="size-modal"
|
|
|
width="auto"
|
|
|
v-model="showModal"
|
|
|
:loading="saveing"
|
|
|
:saveLoading="saveLoading"
|
|
|
@on-ok="modalOK"
|
|
|
@on-cancel="modalCancel"
|
|
|
:title="title"
|
|
|
ok-text="保存">
|
|
|
<div class="size-edit">
|
|
|
<Spin v-if="showLoading" fix size="large"></Spin>
|
|
|
<Checkbox v-model="sizeImgFlag">隐藏测量方式图</Checkbox>
|
|
|
<Table ref="tableSize" :show-header="false" :data="data" :columns="columns" v-if="!showLoading">
|
|
|
<div class="" slot="header">
|
|
|
<div class="table-header">
|
|
|
<div :style="{width:column.width+'px', flex:column.width?'inherit':'1'}" class="table-th" v-for="column in columns">
|
|
|
<span>{{column.title}}</span>
|
|
|
<Checkbox v-model="column.noMeasure" v-if="column.sizeAttributeId">无需测量</Checkbox>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<Table ref="tableSize" v-if="loadingOk" :row-class-name="rowClassName" :show-header="false" :data="data" :columns="columns">
|
|
|
</Table>
|
|
|
</div>
|
|
|
</Modal>
|
...
|
...
|
@@ -30,21 +21,21 @@ import productService from 'product-service'; |
|
|
import _ from 'lodash';
|
|
|
|
|
|
export default {
|
|
|
name: 'SizEdit',
|
|
|
name: 'ModalSizeEdit',
|
|
|
props: {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
showModal: false,
|
|
|
showLoading: true,
|
|
|
saveing: false,
|
|
|
saveLoading: true,
|
|
|
title: '编辑尺码信息',
|
|
|
sizeImgFlag: false,
|
|
|
skn: 0,
|
|
|
gender: '',
|
|
|
data: [],
|
|
|
columns: [{}],
|
|
|
noMeasureIds: {}
|
|
|
noMeasureIds: {},
|
|
|
loadingOk: false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
...
|
...
|
@@ -80,48 +71,71 @@ export default { |
|
|
let attrs = sizeInfo.sizeRelationsList[0].prdSizeAttributeBoList;
|
|
|
|
|
|
columns.push({
|
|
|
title: '尺码',
|
|
|
width: 70,
|
|
|
key: 'sizeName'
|
|
|
render(row, col, index) {
|
|
|
if (index === 0) {
|
|
|
return '尺码';
|
|
|
} else {
|
|
|
return row.sizeName;
|
|
|
}
|
|
|
},
|
|
|
fixed: 'left'
|
|
|
});
|
|
|
columns.push({
|
|
|
title: `参考尺码(${sizeInfo.genderName})`,
|
|
|
width: 220,
|
|
|
render() {
|
|
|
return `<i-input class="size-inpt" v-model="row.referenceNameA"></i-input>/
|
|
|
render(row, col, index) {
|
|
|
if (index === 0) {
|
|
|
return `参考尺码(${sizeInfo.genderName})`;
|
|
|
} else {
|
|
|
return `<i-input class="size-inpt" v-model="row.referenceNameA"></i-input>/
|
|
|
<i-input class="size-inpt" width="50" v-model="row.referenceNameB"></i-input>`;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
fixed: 'left'
|
|
|
});
|
|
|
_.each(attrs, (attr, index) => {
|
|
|
_.each(attrs, (attr, colIndex) => {
|
|
|
columns.push({
|
|
|
title: attr.sizeAttributeName,
|
|
|
noMeasure: _.some(noMeasureIds, id => +id === index + 2),
|
|
|
width: 120,
|
|
|
noMeasure: _.some(noMeasureIds, id => +id === attr.sizeAttributeId),
|
|
|
sizeAttributeId: attr.sizeAttributeId,
|
|
|
render() {
|
|
|
return `<i-input class="size-inpt"
|
|
|
v-model="row.prdSizeAttributeBoList[${index}].sizeValue"
|
|
|
:disabled="column.noMeasure"></i-input>`;
|
|
|
render(row, col, index) {
|
|
|
if (index === 0) {
|
|
|
return `<span>${attr.sizeAttributeName}</span>
|
|
|
<Checkbox v-model="column.noMeasure">无需测量</Checkbox>`;
|
|
|
} else {
|
|
|
return `<i-input class="size-inpt"
|
|
|
v-model="row.prdSizeAttributeBoList[${colIndex}].sizeValue"
|
|
|
:disabled="column.noMeasure"></i-input>`;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
this.data = sizeInfo.sizeRelationsList;
|
|
|
this.columns = columns;
|
|
|
this.data = _.concat({}, sizeInfo.sizeRelationsList);
|
|
|
this.sizeImgFlag = sizeInfo.sizeImgFlag !== 0;
|
|
|
this.gender = sizeInfo.gender;
|
|
|
this.loadingOk = true;
|
|
|
}
|
|
|
this.showLoading = false;
|
|
|
});
|
|
|
},
|
|
|
getColumns() {
|
|
|
|
|
|
},
|
|
|
rowClassName(row, index) {
|
|
|
if (index === 0) {
|
|
|
return 'table-header';
|
|
|
}
|
|
|
},
|
|
|
modalOK() {
|
|
|
this.showLoading = true;
|
|
|
let data = this.$refs.tableSize.rebuildData;
|
|
|
let data = _.drop(this.$refs.tableSize.rebuildData, 1);
|
|
|
let columns = this.$refs.tableSize.cloneColumns;
|
|
|
let noMeasureIds = [],
|
|
|
sizeInfoList = [],
|
|
|
productSizeReferList = [];
|
|
|
|
|
|
_.each(this.columns, (col, index) => {
|
|
|
_.each(columns, col => {
|
|
|
if (col.sizeAttributeId && col.noMeasure) {
|
|
|
noMeasureIds.push(index);
|
|
|
noMeasureIds.push(col.sizeAttributeId);
|
|
|
}
|
|
|
});
|
|
|
sizeInfoList = _.concat([], ..._.map(data, row => {
|
...
|
...
|
@@ -150,17 +164,16 @@ export default { |
|
|
sizeImgFlag: this.sizeImgFlag ? 1 : 0
|
|
|
};
|
|
|
|
|
|
this.saveing = true;
|
|
|
productService.saveProdSizeInfo(postData).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
this.loadingOk = false;
|
|
|
this.showModal = false;
|
|
|
this.showLoading = true;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
},
|
|
|
modalCancel() {
|
|
|
this.showLoading = true;
|
|
|
this.loadingOk = false;
|
|
|
this.showModal = false;
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
@@ -180,38 +193,16 @@ export default { |
|
|
width: 70px;
|
|
|
}
|
|
|
.table-header {
|
|
|
width: 100%;
|
|
|
height: 48px;
|
|
|
display: flex;
|
|
|
.table-th {
|
|
|
flex: 1;
|
|
|
line-height: initial;
|
|
|
padding-left: 10px;
|
|
|
padding-right: 10px;
|
|
|
font-size: 12px;
|
|
|
font-weight: bold;
|
|
|
border-bottom: 1px solid #e3e8ee;
|
|
|
border-bottom: 1px solid #e3e8ee;
|
|
|
background-color: #f5f7f9;
|
|
|
td {
|
|
|
background-color: #f5f7f9;
|
|
|
white-space: nowrap;
|
|
|
overflow: hidden;
|
|
|
background-color: #f5f7f9;
|
|
|
display: flex;
|
|
|
flex-flow: column;
|
|
|
justify-content: center;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.ivu-table-wrapper {
|
|
|
table {
|
|
|
width: 100%;
|
|
|
}
|
|
|
.ivu-table-title {
|
|
|
table {
|
|
|
th {
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
word-break: break-all;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
.size-modal {
|
|
|
.ivu-modal {
|
...
|
...
|
|