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({ return request({
url: '/product/attributeGroup/'+data.id, url: '/product/attributeGroup/'+data.id,
method: 'put', method: 'put',
data: data data: data
}) })
} }
// 修改属性 组 状态
export function updateAttributeGroupState(attributeGroupStateReq) {
return request({
url: '/product/attributeGroup/updateState',
method: 'put',
data: attributeGroupStateReq
})
}
// 删除属性组 // 删除属性组
export function delAttributeGroup(id) { export function delAttributeGroup(id) {

View File

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