属性组和商品规格的状态的修改

cloud-ui
刘河平 2024-11-15 20:53:15 +08:00
parent b09cb3270e
commit edb3978432
1 changed files with 83 additions and 81 deletions

View File

@ -213,10 +213,10 @@ export default {
// //
rules: { rules: {
createBy: [ createBy: [
{ required: true, message: "创建人不能为空", trigger: "blur" } {required: true, message: "创建人不能为空", trigger: "blur"}
], ],
createTime: [ createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" } {required: true, message: "创建时间不能为空", trigger: "blur"}
], ],
}, },
ruleAddForm: { ruleAddForm: {
@ -231,20 +231,20 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
removeRule(index){ removeRule(index) {
this.form.ruleAttrList.splice(index, 1); this.form.ruleAttrList.splice(index, 1);
}, },
removeRuleProperty(valueList,index){ removeRuleProperty(valueList, index) {
valueList.splice(index, 1); valueList.splice(index, 1);
}, },
addRuleProperty(ruleAttr, continuousInput){ addRuleProperty(ruleAttr, continuousInput) {
if (this.addRulePropertyValue === null || this.addRulePropertyValue === 0){ if (this.addRulePropertyValue === null || this.addRulePropertyValue === 0) {
if (!continuousInput){ if (!continuousInput) {
ruleAttr.ruleAttrAddStatus = !ruleAttr.ruleAttrAddStatus ruleAttr.ruleAttrAddStatus = !ruleAttr.ruleAttrAddStatus
} }
return; return;
} }
if (ruleAttr.valueList.indexOf(this.addRulePropertyValue) > -1){ if (ruleAttr.valueList.indexOf(this.addRulePropertyValue) > -1) {
this.$message({ this.$message({
message: `规格[${ruleAttr.name}]属性值[${this.addRulePropertyValue}]已经存在`, message: `规格[${ruleAttr.name}]属性值[${this.addRulePropertyValue}]已经存在`,
type: 'warning' type: 'warning'
@ -253,20 +253,20 @@ export default {
} }
ruleAttr.valueList.push(this.addRulePropertyValue) ruleAttr.valueList.push(this.addRulePropertyValue)
this.addRulePropertyValue = null; this.addRulePropertyValue = null;
if (!continuousInput){ if (!continuousInput) {
ruleAttr.ruleAttrAddStatus = !ruleAttr.ruleAttrAddStatus ruleAttr.ruleAttrAddStatus = !ruleAttr.ruleAttrAddStatus
} }
}, },
ruleAddFormFun(){ ruleAddFormFun() {
if (this.ruleAddForm.name === null || this.ruleAddForm.name.length === 0){ if (this.ruleAddForm.name === null || this.ruleAddForm.name.length === 0) {
this.$message({ this.$message({
message: '规格名称不可为空', message: '规格名称不可为空',
type: 'warning' type: 'warning'
}); });
return; return;
} }
if (this.ruleAddForm.valueList === null || this.ruleAddForm.valueList.length === 0){ if (this.ruleAddForm.valueList === null || this.ruleAddForm.valueList.length === 0) {
this.$message({ this.$message({
message: '规格属性不可为空', message: '规格属性不可为空',
type: 'warning' type: 'warning'
@ -274,14 +274,14 @@ export default {
return; return;
} }
let ruleAttr = this.form.ruleAttrList.find(ruleAttr => ruleAttr.name === this.ruleAddForm.name); let ruleAttr = this.form.ruleAttrList.find(ruleAttr => ruleAttr.name === this.ruleAddForm.name);
if (ruleAttr === undefined){ if (ruleAttr === undefined) {
this.form.ruleAttrList.push({ this.form.ruleAttrList.push({
"name": this.ruleAddForm.name, "name": this.ruleAddForm.name,
"valueList": [this.ruleAddForm.valueList], "valueList": [this.ruleAddForm.valueList],
"ruleAttrAddStatus": false "ruleAttrAddStatus": false
}) })
}else { } else {
if (ruleAttr.valueList.indexOf(this.ruleAddForm.valueList) > -1){ if (ruleAttr.valueList.indexOf(this.ruleAddForm.valueList) > -1) {
this.$message({ this.$message({
message: `规格[${this.ruleAddForm.name}]属性值[${this.ruleAddForm.valueList}]已经存在`, message: `规格[${this.ruleAddForm.name}]属性值[${this.ruleAddForm.valueList}]已经存在`,
type: 'warning' type: 'warning'
@ -317,7 +317,7 @@ export default {
name: null, name: null,
status: null, status: null,
remark: null, remark: null,
ruleAttrList:[] ruleAttrList: []
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -331,10 +331,11 @@ export default {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@ -349,7 +350,7 @@ export default {
const id = row.id || this.ids const id = row.id || this.ids
getRule(id).then(response => { getRule(id).then(response => {
this.form = response.data; this.form = response.data;
this.form.ruleAttrList=response.data.ruleAttrList this.form.ruleAttrList = response.data.ruleAttrList
this.open = true; this.open = true;
this.title = "修改商品规格"; this.title = "修改商品规格";
}); });
@ -385,12 +386,13 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除商品规格编号为"' + ids + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除商品规格编号为"' + ids + '"的数据项?').then(function () {
return delRule(ids); return delRule(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
@ -398,6 +400,6 @@ export default {
...this.queryParams ...this.queryParams
}, `rule_${new Date().getTime()}.xlsx`) }, `rule_${new Date().getTime()}.xlsx`)
} }
} }
}; };
</script> </script>