第三次优化
parent
24ffae079e
commit
246109ddca
|
@ -49,3 +49,11 @@ export function delAttributeGroup(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改状态
|
||||||
|
export function updStatus(states,id) {
|
||||||
|
return request({
|
||||||
|
url: '/product/attributeGroup/updStatus?states=' + states+"&&"+'id='+id,
|
||||||
|
method: 'put'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -42,3 +42,18 @@ export function delRule(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改状态
|
||||||
|
export function updStatus(status,id) {
|
||||||
|
return request({
|
||||||
|
url: '/product/rule/updStatus?status=' + status+"&&"+'id='+id,
|
||||||
|
method: 'put'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function have(id) {
|
||||||
|
return request({
|
||||||
|
url: '/product/rule/have?id=' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -83,7 +83,19 @@
|
||||||
</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
|
||||||
|
style="display: block"
|
||||||
|
v-model="scope.row.states"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
active-text="是"
|
||||||
|
active-value="Y"
|
||||||
|
inactive-value="N"
|
||||||
|
inactive-text="否"
|
||||||
|
@change="updStatus(scope.row)"
|
||||||
|
>
|
||||||
|
</el-switch>
|
||||||
|
<!-- <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.states"/>-->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
@ -152,7 +164,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listAttributeGroup, getAttributeGroup, delAttributeGroup, addAttributeGroup, updateAttributeGroup,updAttributeGroup } from "@/api/product/attributeGroup";
|
import { listAttributeGroup, getAttributeGroup, delAttributeGroup, addAttributeGroup, updateAttributeGroup,updStatus } from "@/api/product/attributeGroup";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AttributeGroup",
|
name: "AttributeGroup",
|
||||||
|
@ -202,6 +214,20 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
*/
|
||||||
|
updStatus(row){
|
||||||
|
updStatus(row.states,row.id).then(
|
||||||
|
res=>{
|
||||||
|
if(res.code==200){
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
/** 查询属性组列表 */
|
/** 查询属性组列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
<image-preview :src="scope.row.image" :width="50" :height="50"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<el-table-column label="是否启用" align="center" prop="start">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
|
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
<CheckAttribute v-model="form.attributeIdList" :checked-list="attributeInfoList"/>
|
<CheckAttribute v-model="form.attributeIdList" :checked-list="attributeInfoList"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="商品属性组" name="attributeGroup">
|
<el-tab-pane label="商品属性组" name="attributeGroup">
|
||||||
<CheckAttributeGroup v-model="form.attributeGroupIdList" :checked-list="attributeGroupList"/>
|
<CheckAttributeGroup v-model="form.attributeGroupIdList" :checked-list="form.attributeGroupList"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="商品品牌" name="brand">
|
<el-tab-pane label="商品品牌" name="brand">
|
||||||
<CheckBrand v-model="form.brandIdList" :checked-list="brandInfoList"/>
|
<CheckBrand v-model="form.brandIdList" :checked-list="brandInfoList"/>
|
||||||
|
@ -269,7 +269,21 @@ export default {
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listCategory(this.queryParams).then(response => {
|
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;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -77,7 +77,24 @@
|
||||||
|
|
||||||
</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
|
||||||
|
style="display: block"
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
active-text="是"
|
||||||
|
active-value="Y"
|
||||||
|
inactive-value="N"
|
||||||
|
inactive-text="否"
|
||||||
|
@change="updStatus(scope.row)"
|
||||||
|
>
|
||||||
|
</el-switch>
|
||||||
|
<!-- <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.states"/>-->
|
||||||
|
</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">
|
||||||
|
@ -116,6 +133,20 @@
|
||||||
<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-form-item label="默认状态" prop="status">
|
||||||
|
<el-switch
|
||||||
|
style="display: block"
|
||||||
|
v-model="form.status"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
active-text="是"
|
||||||
|
active-value="Y"
|
||||||
|
inactive-value="N"
|
||||||
|
inactive-text="否"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
</el-switch>
|
||||||
|
</el-form-item>
|
||||||
<el-row v-for="(ruleAttr, index) in form.ruleAttrList">
|
<el-row v-for="(ruleAttr, index) in form.ruleAttrList">
|
||||||
<el-row style="margin: 20px 0">
|
<el-row style="margin: 20px 0">
|
||||||
<el-tag
|
<el-tag
|
||||||
|
@ -165,12 +196,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listRule, getRule, delRule, addRule, updateRule } from "@/api/product/rule";
|
import { listRule, getRule, delRule, addRule, updateRule,updStatus ,have} from "@/api/product/rule";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Rule",
|
name: "Rule",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
status:"",
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
|
@ -219,6 +252,20 @@ export default {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
*/
|
||||||
|
updStatus(row){
|
||||||
|
updStatus(row.status,row.id).then(
|
||||||
|
res=>{
|
||||||
|
if(res.code==200){
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
removeRule(index){
|
removeRule(index){
|
||||||
this.form.ruleAttrList.splice(index, 1);
|
this.form.ruleAttrList.splice(index, 1);
|
||||||
},
|
},
|
||||||
|
@ -285,7 +332,7 @@ export default {
|
||||||
this.ruleAddFormStatus = false;
|
this.ruleAddFormStatus = false;
|
||||||
},
|
},
|
||||||
/** 查询商品规格列表 */
|
/** 查询商品规格列表 */
|
||||||
getList() {
|
getList(row) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listRule(this.queryParams).then(response => {
|
listRule(this.queryParams).then(response => {
|
||||||
this.ruleList = response.data.rows;
|
this.ruleList = response.data.rows;
|
||||||
|
@ -331,8 +378,15 @@ export default {
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加商品规格";
|
this.title = "添加商品规格";
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
|
|
||||||
|
have(row.id).then(
|
||||||
|
res=>{
|
||||||
|
if(res.code==400){
|
||||||
|
this.$modal.msgSuccess(res.msg);
|
||||||
|
}else{
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getRule(id).then(response => {
|
getRule(id).then(response => {
|
||||||
|
@ -340,6 +394,11 @@ export default {
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改商品规格";
|
this.title = "修改商品规格";
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
@ -363,6 +422,12 @@ export default {
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
|
have(row.id).then(
|
||||||
|
res=> {
|
||||||
|
this.reset();
|
||||||
|
if (res.code == 400) {
|
||||||
|
this.$modal.msgSuccess(res.msg);
|
||||||
|
}else{
|
||||||
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 delRule(ids);
|
return delRule(ids);
|
||||||
|
@ -370,6 +435,12 @@ export default {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|
Loading…
Reference in New Issue