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

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

@ -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,6 +346,11 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
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 => {
@ -354,6 +359,10 @@ export default {
this.open = true;
this.title = "修改商品规格";
});
}
}
)
},
/**
* 修改状态
@ -385,6 +394,11 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
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);
@ -393,6 +407,10 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
}
}
)
},
/** 导出按钮操作 */
handleExport() {