2204A-Ui (属性组 状态修改)

main
笨蛋 2024-11-16 01:52:54 +08:00
parent 08ca26c21c
commit cede467f24
2 changed files with 38 additions and 3 deletions

View File

@ -27,13 +27,21 @@ export function addAttributeGroup(data) {
}
// 修改属性组
export function updateAttributeGroup(data) {
export function updateAttributeGroupType(data) {
return request({
url: '/product/attributeGroup/'+data.id,
method: 'put',
data: data
})
}
// 修改属性 组 状态
export function updateAttributeGroupState(attributeGroupStateReq) {
return request({
url: '/product/attributeGroup/updateState',
method: 'put',
data: attributeGroupStateReq
})
}
// 删除属性组
export function delAttributeGroup(id) {

View File

@ -85,12 +85,14 @@
<template slot-scope="scope">
<el-switch
v-model="scope.row.states"
@change="stateButton(scope.row)"
active-value="Y"
inactive-value="N"
active-text="是"
inactive-text="否"
active-color="#13ce66"
inactive-color="#ff4949">
></el-switch>
</template>
</el-table-column>
@ -161,7 +163,13 @@
</template>
<script>
import { listAttributeGroup, getAttributeGroup, delAttributeGroup, addAttributeGroup, updateAttributeGroup } from "@/api/product/attributeGroup";
import {
listAttributeGroup,
getAttributeGroup,
delAttributeGroup,
addAttributeGroup,
updateAttributeGroupState, updateAttributeGroupType
} from '@/api/product/attributeGroup'
export default {
name: "AttributeGroup",
@ -186,6 +194,11 @@ export default {
title: "",
//
open: false,
//
attributeGroupStateReq :{
id:null,
states: null
},
//
queryParams: {
pageNum: 1,
@ -209,8 +222,22 @@ export default {
created() {
this.getList();
},
methods: {
/** 状态 按钮*/
stateButton(row){
this.attributeGroupStateReq.id = row.id
this.attributeGroupStateReq.states = row.states
updateAttributeGroupState(this.attributeGroupStateReq).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
},
/** 查询属性组列表 */
getList() {
this.loading = true;
@ -276,7 +303,7 @@ export default {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateAttributeGroup(this.form).then(response => {
updateAttributeGroupType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();