优化商品的多属性选择器

This commit is contained in:
季圣华
2021-08-04 21:58:43 +08:00
parent 641d5c5cc2
commit 4d126849c3

View File

@@ -299,7 +299,7 @@
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ {
title: '多属性', key: 'sku', width: '12%', type: FormTypes.input, defaultValue: '', readonly:true title: '多属性', key: 'sku', width: '12%', type: FormTypes.input, defaultValue: '', readonly:true, placeholder: '点击生成条码赋值'
}, },
{ {
title: '采购价', key: 'purchaseDecimal', width: '12%', type: FormTypes.input, defaultValue: '', placeholder: '请输入${title}' title: '采购价', key: 'purchaseDecimal', width: '12%', type: FormTypes.input, defaultValue: '', placeholder: '请输入${title}'
@@ -364,6 +364,8 @@
]) ])
}, },
add () { add () {
//隐藏多属性
this.meTable.columns[2].type = FormTypes.hidden
// 默认新增一条数据 // 默认新增一条数据
this.getAllTable().then(editableTables => { this.getAllTable().then(editableTables => {
editableTables[0].add() editableTables[0].add()
@@ -412,6 +414,11 @@
requestMeTableData(url, params, tab) { requestMeTableData(url, params, tab) {
tab.loading = true tab.loading = true
getAction(url, params).then(res => { getAction(url, params).then(res => {
for (let i = 0; i < res.data.rows.length; i++) {
if(res.data.rows[i].sku) {
this.meTable.columns[2].type = FormTypes.input
}
}
tab.dataSource = res.data.rows || [] tab.dataSource = res.data.rows || []
}).finally(() => { }).finally(() => {
tab.loading = false tab.loading = false
@@ -624,6 +631,11 @@
}, },
onSkuChange(checked) { onSkuChange(checked) {
this.skuSwitch = checked this.skuSwitch = checked
if(checked) {
this.meTable.columns[2].type = FormTypes.input
} else {
this.meTable.columns[2].type = FormTypes.hidden
}
}, },
onBarCodeChange(checked) { onBarCodeChange(checked) {
let unit = this.form.getFieldValue('unit') let unit = this.form.getFieldValue('unit')