2204A-Ui (属性组 商品规格 品类信息 状态按钮 状态修改)
parent
cede467f24
commit
508c213c4c
|
@ -34,6 +34,14 @@ export function updateRule(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
// 修改规格 状态
|
||||
export function updateRuleInfoState(wyzRuleInfoSaveReq) {
|
||||
return request({
|
||||
url: '/product/ruleAttr/ruleInfoStateReq',
|
||||
method: 'put',
|
||||
data: wyzRuleInfoSaveReq
|
||||
})
|
||||
}
|
||||
|
||||
// 删除商品规格
|
||||
export function delRule(id) {
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="状态" align="center" prop="states">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
|
@ -92,7 +93,6 @@
|
|||
inactive-text="否"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949">
|
||||
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="父级品类" align="center" prop="parentId" />
|
||||
<el-table-column label="父级品类" align="center" prop="parentIds" />
|
||||
<el-table-column label="是否启用" align="center" prop="start">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
|
||||
|
@ -84,8 +84,10 @@
|
|||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['product:category:edit']"
|
||||
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
|
@ -263,7 +265,21 @@ export default {
|
|||
getList() {
|
||||
this.loading = true;
|
||||
listCategory(this.queryParams).then(response => {
|
||||
this.categoryList = this.handleTree(response.data, "id", "parentId");
|
||||
const idToName = response.data.reduce((acc, node) => {
|
||||
acc[node.id] = node.name;
|
||||
return acc;
|
||||
}, {});
|
||||
console.log(idToName);
|
||||
const updatedTreeData = response.data.map(node => {
|
||||
// 如果 parentId 为 null,说明没有父节点,不需要替换
|
||||
const parentName = node.parentId !== null ? idToName[node.parentId] : null;
|
||||
console.log(parentName);
|
||||
return {
|
||||
...node,
|
||||
parentIds: parentName
|
||||
};
|
||||
});
|
||||
this.categoryList = this.handleTree(updatedTreeData, "id", "parentId");
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键" align="center" prop="id" />
|
||||
<el-table-column label="规格名称" align="center" prop="name" />
|
||||
|
||||
<el-table-column label="规格属性名" align="center" prop="name" >
|
||||
<template slot-scope="scope">
|
||||
<el-row v-for="ruleAttr in scope.row.ruleAttrList"><span>{{ruleAttr.name}}</span></el-row>
|
||||
|
@ -74,14 +75,30 @@
|
|||
|
||||
<template slot-scope="scope">
|
||||
<el-row v-for="ruleAttr in scope.row.ruleAttrList"><span>{{ruleAttr.valueList.toString()}}</span></el-row>
|
||||
|
||||
</template>
|
||||
</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
|
||||
v-model="scope.row.status"
|
||||
@change="stateRuleButton(scope.row,scope.row.status)"
|
||||
active-value="Y"
|
||||
inactive-value="N"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949">
|
||||
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
:disabled=loading
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
|
@ -165,12 +182,18 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listRule, getRule, delRule, addRule, updateRule } from "@/api/product/rule";
|
||||
import { listRule, getRule, delRule, addRule, updateRule ,updateRuleInfoState} from '@/api/product/rule'
|
||||
|
||||
|
||||
export default {
|
||||
name: "Rule",
|
||||
data() {
|
||||
return {
|
||||
|
||||
wyzRuleInfoSaveReq :{
|
||||
id: null,
|
||||
states: null,
|
||||
},
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
|
@ -212,13 +235,28 @@ export default {
|
|||
valueList: null,
|
||||
},
|
||||
ruleAddFormStatus: false,
|
||||
addRulePropertyValue: null
|
||||
addRulePropertyValue: null,
|
||||
//修改规格状态
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
|
||||
//修改规格状态
|
||||
stateRuleButton(row,status){
|
||||
this.wyzRuleInfoSaveReq.id=row.id
|
||||
this.wyzRuleInfoSaveReq.states=status
|
||||
alert(this.wyzRuleInfoSaveReq.id)
|
||||
alert(this.wyzRuleInfoSaveReq.states)
|
||||
updateRuleInfoState(this.wyzRuleInfoSaveReq).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
|
||||
removeRule(index){
|
||||
this.form.ruleAttrList.splice(index, 1);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue