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

cloud-ui
刘河平 2024-11-15 16:32:25 +08:00
parent 642c12457c
commit b09cb3270e
4 changed files with 117 additions and 27 deletions

View File

@ -43,3 +43,13 @@ export function delAttributeGroup(id) {
}) })
} }
//修改状态
export function changeStatus(data) {
return request({
url: '/product/attributeGroup/'+data.id,
method: 'post',
data: data
})
}

View File

@ -42,3 +42,11 @@ export function delRule(id) {
method: 'delete' method: 'delete'
}) })
} }
export function changeStatus(data) {
return request({
url: '/product/rule/'+data.id,
method: 'post',
data: data
})
}

View File

@ -34,7 +34,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['product:attributeGroup:add']" v-hasPermi="['product:attributeGroup:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -45,7 +46,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['product:attributeGroup:edit']" v-hasPermi="['product:attributeGroup:edit']"
>修改</el-button> >修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -56,7 +58,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['product:attributeGroup:remove']" v-hasPermi="['product:attributeGroup:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -66,7 +69,8 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['product:attributeGroup:export']" v-hasPermi="['product:attributeGroup:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -81,10 +85,36 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="states"> <el-table-column label="状态" align="center" prop="states">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.states"/> <!-- <el-switch-->
<!-- v-model="scope.row.states"-->
<!-- style="&#45;&#45;el-switch-on-color: #13ce66; &#45;&#45;el-switch-off-color: #ff4949"-->
<!-- active-value="100"-->
<!-- inactive-value="0"-->
<!-- active-text="是"-->
<!-- inactive-text="否"-->
<!-- />-->
<el-switch @change="handleStateChange(scope.row)"
v-model="scope.row.states"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
active-value="Y"
inactive-value="N"
active-text="是"
inactive-text="否"
/>
</template> </template>
<!-- <el-switch-->
<!-- v-model="value"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#ff4949"-->
<!-- active-text="是"-->
<!-- inactive-text="否">-->
<!-- </el-switch>-->
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark"/> <el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -95,14 +125,16 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['product:attributeGroup:edit']" v-hasPermi="['product:attributeGroup:edit']"
>修改</el-button> >修改
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['product:attributeGroup:remove']" v-hasPermi="['product:attributeGroup:remove']"
>删除</el-button> >删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -131,7 +163,8 @@
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{dict.label}}</el-radio> >{{ dict.label }}
</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -152,13 +185,21 @@
</template> </template>
<script> <script>
import { listAttributeGroup, getAttributeGroup, delAttributeGroup, addAttributeGroup, updateAttributeGroup } from "@/api/product/attributeGroup"; import {
listAttributeGroup,
getAttributeGroup,
delAttributeGroup,
addAttributeGroup,
updateAttributeGroup,
changeStatus
} from "@/api/product/attributeGroup";
export default { export default {
name: "AttributeGroup", name: "AttributeGroup",
dicts: ['sys_yes_no'], dicts: ['sys_yes_no'],
data() { data() {
return { return {
value: true,
// //
loading: true, loading: true,
// //
@ -260,6 +301,14 @@ export default {
this.title = "修改属性组"; this.title = "修改属性组";
}); });
}, },
/**
* 修改状态
*/
handleStateChange(row) {
changeStatus(row).then(response => {
this.$modal.msgSuccess("修改成功");
})
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
@ -288,14 +337,17 @@ export default {
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('product/attributeGroup/export', { this.download('product/attributeGroup/export', {
...this.queryParams ...this.queryParams
}, `attributeGroup_${new Date().getTime()}.xlsx`) }, `attributeGroup_${new Date().getTime()}.xlsx`)
} },
} }
}; };
</script> </script>

View File

@ -71,13 +71,23 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="规格属性值" align="center" prop="name" > <el-table-column label="规格属性值" align="center" prop="name" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-row v-for="ruleAttr in scope.row.ruleAttrList"><span>{{ruleAttr.valueList.toString()}}</span></el-row> <el-row v-for="ruleAttr in scope.row.ruleAttrList"><span>{{ruleAttr.valueList.toString()}}</span></el-row>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="规格状态" align="center" prop="status" /> <el-table-column label="规格状态" align="center" prop="status" >
<template slot-scope="scope">
<el-switch @change="handleStateChange(scope.row)"
v-model="scope.row.states"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
active-value="Y"
inactive-value="N"
active-text="是"
inactive-text="否"
/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope" > <template slot-scope="scope" >
@ -166,11 +176,13 @@
<script> <script>
import { listRule, getRule, delRule, addRule, updateRule } from "@/api/product/rule"; import { listRule, getRule, delRule, addRule, updateRule } from "@/api/product/rule";
import {changeStatus} from "@/api/product/rule";
export default { export default {
name: "Rule", name: "Rule",
data() { data() {
return { return {
value: true,
// //
loading: true, loading: true,
// //
@ -342,6 +354,14 @@ export default {
this.title = "修改商品规格"; this.title = "修改商品规格";
}); });
}, },
/**
* 修改状态
*/
handleStateChange(row) {
changeStatus(row).then(response => {
this.$modal.msgSuccess("修改成功");
})
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {