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

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,27 +69,54 @@
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>
<el-table v-loading="loading" :data="attributeGroupList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="attributeGroupList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="组名称" align="center" prop="name" /> <el-table-column label="组名称" align="center" prop="name"/>
<el-table-column label="组内属性" align="center" prop="attributeInfoList" > <el-table-column label="组内属性" align="center" prop="attributeInfoList">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-for="attributeInfo in scope.row.attributeInfoList"> <el-tag v-for="attributeInfo in scope.row.attributeInfoList">
{{attributeInfo.name}} {{ attributeInfo.name }}
</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">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -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>
@ -121,7 +153,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="组名称" prop="name"> <el-form-item label="组名称" prop="name">
<el-input v-model="form.name" placeholder="请输入组名称" /> <el-input v-model="form.name" placeholder="请输入组名称"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -131,17 +163,18 @@
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>
</el-row> </el-row>
<el-row> <el-row>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item> </el-form-item>
</el-row> </el-row>
<CheckAttribute v-model="form.attributeIdList":checked-list="form.attributeList"/> <CheckAttribute v-model="form.attributeIdList" :checked-list="form.attributeList"/>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -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,
// //
@ -189,10 +230,10 @@ export default {
// //
rules: { rules: {
name: [ name: [
{ required: true, message: "组名称不能为空", trigger: "blur" } {required: true, message: "组名称不能为空", trigger: "blur"}
], ],
states: [ states: [
{ required: true, message: "状态不能为空", trigger: "change" } {required: true, message: "状态不能为空", trigger: "change"}
], ],
} }
}; };
@ -241,7 +282,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@ -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 => {
@ -283,19 +332,22 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除属性组编号为"' + ids + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除属性组编号为"' + ids + '"的数据项?').then(function () {
return delAttributeGroup(ids); return delAttributeGroup(ids);
}).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,16 +71,26 @@
</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" >
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -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 => {