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

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