列表页面在展示的时候,需要查询一个商品的信息,然后如果有关联,则删除和修改置灰/禁用

cloud-ui
刘河平 2024-11-16 09:12:57 +08:00
parent f5fa296f79
commit 4aa9d95877
2 changed files with 43 additions and 18 deletions

View File

@ -50,3 +50,10 @@ export function changeStatus(data) {
data: data
})
}
export function have(id){
return request({
url:"/product/rule/have?id="+id,
method:"get"
})
}

View File

@ -90,7 +90,7 @@
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope" >
<template slot-scope="scope" >
<el-button
size="mini"
type="text"
@ -175,7 +175,7 @@
</template>
<script>
import { listRule, getRule, delRule, addRule, updateRule } from "@/api/product/rule";
import {listRule, getRule, delRule, addRule, updateRule, have} from "@/api/product/rule";
import {changeStatus} from "@/api/product/rule";
export default {
@ -346,14 +346,23 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getRule(id).then(response => {
this.form = response.data;
this.form.ruleAttrList = response.data.ruleAttrList
this.open = true;
this.title = "修改商品规格";
});
have(row.id).then(
res=>{
if (res.data.code==400){
this.$modal.msgError(res.data.msg)
}else {
this.reset();
const id = row.id || this.ids
getRule(id).then(response => {
this.form = response.data;
this.form.ruleAttrList = response.data.ruleAttrList
this.open = true;
this.title = "修改商品规格";
});
}
}
)
},
/**
* 修改状态
@ -385,14 +394,23 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除商品规格编号为"' + ids + '"的数据项?').then(function () {
return delRule(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
have(row.id).then(
res=>{
if (res.data.code==400){
this.$modal.msgError(res.data.msg)
}else {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除商品规格编号为"' + ids + '"的数据项?').then(function () {
return delRule(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
}
}
)
},
/** 导出按钮操作 */
handleExport() {