|
|
|
@ -1,10 +1,22 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<div class="app-container">
|
|
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" size="medium"
|
|
|
|
<el-form
|
|
|
|
class="ry_form">
|
|
|
|
:model="queryParams"
|
|
|
|
|
|
|
|
ref="queryForm"
|
|
|
|
|
|
|
|
:inline="true"
|
|
|
|
|
|
|
|
v-show="showSearch"
|
|
|
|
|
|
|
|
label-width="100px"
|
|
|
|
|
|
|
|
size="medium"
|
|
|
|
|
|
|
|
class="ry_form"
|
|
|
|
|
|
|
|
>
|
|
|
|
<el-form-item label="状态" prop="showStatus">
|
|
|
|
<el-form-item label="状态" prop="showStatus">
|
|
|
|
<DictRadio v-model="queryParams.showStatus" @change="handleQuery" size="small"
|
|
|
|
<DictRadio
|
|
|
|
:radioData="dict.type.sys_show_status" :showAll="'all'"/>
|
|
|
|
v-model="queryParams.showStatus"
|
|
|
|
|
|
|
|
@change="handleQuery"
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
:radioData="dict.type.sys_show_status"
|
|
|
|
|
|
|
|
:showAll="'all'"
|
|
|
|
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="名称" prop="name">
|
|
|
|
<el-form-item label="名称" prop="name">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
@ -17,8 +29,16 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
|
|
<el-form-item class="flex_one tr">
|
|
|
|
<el-form-item class="flex_one tr">
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
<el-button
|
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
icon="el-icon-search"
|
|
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
|
|
@click="handleQuery"
|
|
|
|
|
|
|
|
>搜索</el-button
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
|
|
|
|
|
>重置</el-button
|
|
|
|
|
|
|
|
>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
@ -30,7 +50,7 @@
|
|
|
|
icon="el-icon-plus"
|
|
|
|
icon="el-icon-plus"
|
|
|
|
size="mini"
|
|
|
|
size="mini"
|
|
|
|
@click="handleAdd"
|
|
|
|
@click="handleAdd"
|
|
|
|
>新增
|
|
|
|
>新增
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
@ -40,34 +60,47 @@
|
|
|
|
:data="pmsProductCategoryList"
|
|
|
|
:data="pmsProductCategoryList"
|
|
|
|
:tree-props="{ hasChildren: 'hasChildren', children: 'children' }"
|
|
|
|
:tree-props="{ hasChildren: 'hasChildren', children: 'children' }"
|
|
|
|
@selection-change="handleSelectionChange"
|
|
|
|
@selection-change="handleSelectionChange"
|
|
|
|
row-key="id">
|
|
|
|
row-key="id"
|
|
|
|
<el-table-column label="名称" align="center" prop="name"/>
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-table-column label="名称" align="center" prop="name" />
|
|
|
|
<el-table-column label="图片" align="center" prop="icon">
|
|
|
|
<el-table-column label="图片" align="center" prop="icon">
|
|
|
|
<template slot-scope="{ row }">
|
|
|
|
<template slot-scope="{ row }">
|
|
|
|
<el-image v-if="row.icon" :src="row.icon" :preview-src-list="[row.icon]" class="small-img circle-img"/>
|
|
|
|
<el-image
|
|
|
|
|
|
|
|
v-if="row.icon"
|
|
|
|
|
|
|
|
:src="row.icon"
|
|
|
|
|
|
|
|
:preview-src-list="[row.icon]"
|
|
|
|
|
|
|
|
class="small-img circle-img"
|
|
|
|
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="排序" align="center" prop="sort"/>
|
|
|
|
<el-table-column label="排序" align="center" prop="sort" />
|
|
|
|
<el-table-column label="状态" align="center" prop="showStatus">
|
|
|
|
<el-table-column label="状态" align="center" prop="showStatus">
|
|
|
|
<template v-slot="{ row }">
|
|
|
|
<template v-slot="{ row }">
|
|
|
|
<dict-tag :value="row.showStatus" prop-name="sys_show_status"></dict-tag>
|
|
|
|
<dict-tag
|
|
|
|
|
|
|
|
:value="row.showStatus"
|
|
|
|
|
|
|
|
prop-name="sys_show_status"
|
|
|
|
|
|
|
|
></dict-tag>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
<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"
|
|
|
|
icon="el-icon-edit"
|
|
|
|
icon="el-icon-edit"
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
>修改
|
|
|
|
>修改
|
|
|
|
</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)"
|
|
|
|
>删除
|
|
|
|
>删除
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table-column>
|
|
|
|
@ -77,24 +110,27 @@
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px">
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px">
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="108px">
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="108px">
|
|
|
|
<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-form-item label="图片" prop="icon">
|
|
|
|
<el-form-item label="图片" prop="icon">
|
|
|
|
<oss-image-upload v-model="form.icon" :limit="1" />
|
|
|
|
<oss-image-upload v-model="form.icon" :limit="1" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="状态">
|
|
|
|
<el-form-item label="状态">
|
|
|
|
<DictRadio v-model="form.showStatus" size="small"
|
|
|
|
<DictRadio
|
|
|
|
:radioData="dict.type.sys_show_status"/>
|
|
|
|
v-model="form.showStatus"
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
:radioData="dict.type.sys_show_status"
|
|
|
|
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="排序" prop="sort">
|
|
|
|
<el-form-item label="排序" prop="sort">
|
|
|
|
<el-input v-model="form.sort" placeholder="排序"/>
|
|
|
|
<el-input v-model="form.sort" placeholder="排序" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="层级" prop="level">
|
|
|
|
<el-form-item label="层级" prop="level">
|
|
|
|
<el-input v-model="form.level" placeholder="层级"/>
|
|
|
|
<el-input v-model="form.level" placeholder="层级" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="上级分类" prop="parentId">
|
|
|
|
<!-- <el-form-item label="上级分类" prop="parentId">
|
|
|
|
<product-category-select class="w200" v-model="form.parentId" :props="{ checkStrictly: true }"/>
|
|
|
|
<product-category-select class="w200" v-model="form.parentId" :props="{ checkStrictly: true }"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item> -->
|
|
|
|
</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>
|
|
|
|
@ -111,14 +147,14 @@ import {
|
|
|
|
delPmsProductCategory,
|
|
|
|
delPmsProductCategory,
|
|
|
|
addPmsProductCategory,
|
|
|
|
addPmsProductCategory,
|
|
|
|
updatePmsProductCategory,
|
|
|
|
updatePmsProductCategory,
|
|
|
|
exportPmsProductCategory
|
|
|
|
exportPmsProductCategory,
|
|
|
|
} from "@/api/pms/productCategory";
|
|
|
|
} from "@/api/pms/productCategory";
|
|
|
|
import ProductCategorySelect from "@/views/components/ProductCategorySelect";
|
|
|
|
import ProductCategorySelect from "@/views/components/ProductCategorySelect";
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "PmsProductCategory",
|
|
|
|
name: "PmsProductCategory",
|
|
|
|
dicts: ['sys_show_status'],
|
|
|
|
dicts: ["sys_show_status"],
|
|
|
|
components: {ProductCategorySelect},
|
|
|
|
components: { ProductCategorySelect },
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
// 遮罩层
|
|
|
|
// 遮罩层
|
|
|
|
@ -160,8 +196,8 @@ export default {
|
|
|
|
/** 查询商品分类列表 */
|
|
|
|
/** 查询商品分类列表 */
|
|
|
|
getList() {
|
|
|
|
getList() {
|
|
|
|
this.loading = true;
|
|
|
|
this.loading = true;
|
|
|
|
const query = {...this.queryParams};
|
|
|
|
const query = { ...this.queryParams };
|
|
|
|
listPmsProductCategory(query).then(rows => {
|
|
|
|
listPmsProductCategory(query).then((rows) => {
|
|
|
|
this.pmsProductCategoryList = rows;
|
|
|
|
this.pmsProductCategoryList = rows;
|
|
|
|
this.loading = false;
|
|
|
|
this.loading = false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -184,7 +220,7 @@ export default {
|
|
|
|
createBy: null,
|
|
|
|
createBy: null,
|
|
|
|
createTime: null,
|
|
|
|
createTime: null,
|
|
|
|
updateBy: null,
|
|
|
|
updateBy: null,
|
|
|
|
updateTime: null
|
|
|
|
updateTime: null,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.resetForm("form");
|
|
|
|
this.resetForm("form");
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -199,9 +235,9 @@ 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;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
handleAdd() {
|
|
|
|
handleAdd() {
|
|
|
|
@ -212,8 +248,8 @@ export default {
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
handleUpdate(row) {
|
|
|
|
handleUpdate(row) {
|
|
|
|
this.reset();
|
|
|
|
this.reset();
|
|
|
|
const id = row.id || this.ids
|
|
|
|
const id = row.id || this.ids;
|
|
|
|
getPmsProductCategory(id).then(response => {
|
|
|
|
getPmsProductCategory(id).then((response) => {
|
|
|
|
this.form = response;
|
|
|
|
this.form = response;
|
|
|
|
this.open = true;
|
|
|
|
this.open = true;
|
|
|
|
this.title = "修改商品分类";
|
|
|
|
this.title = "修改商品分类";
|
|
|
|
@ -221,58 +257,64 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/** 提交按钮 */
|
|
|
|
/** 提交按钮 */
|
|
|
|
submitForm() {
|
|
|
|
submitForm() {
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
let p;
|
|
|
|
let p;
|
|
|
|
if(this.form.parentId){
|
|
|
|
if (this.form.parentId) {
|
|
|
|
this.form.parentId = this.form.parentId.pop()
|
|
|
|
this.form.parentId = this.form.parentId.pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.form.id != null) {
|
|
|
|
if (this.form.id != null) {
|
|
|
|
p = updatePmsProductCategory(this.form).then(response => {
|
|
|
|
p = updatePmsProductCategory(this.form).then((response) => {
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
this.open = false;
|
|
|
|
this.open = false;
|
|
|
|
this.getList();
|
|
|
|
this.getList();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
p = addPmsProductCategory(this.form).then(response => {
|
|
|
|
p = addPmsProductCategory(this.form).then((response) => {
|
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
|
this.open = false;
|
|
|
|
this.open = false;
|
|
|
|
this.getList();
|
|
|
|
this.getList();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p.then(() => {
|
|
|
|
p.then(() => {
|
|
|
|
this.$store.dispatch('mall/loadProductCategories', true)
|
|
|
|
this.$store.dispatch("mall/loadProductCategories", true);
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
handleDelete(row) {
|
|
|
|
handleDelete(row) {
|
|
|
|
if (row.children && row.children.length > 0) {
|
|
|
|
if (row.children && row.children.length > 0) {
|
|
|
|
this.$message.error('请先删除子目录');
|
|
|
|
this.$message.error("请先删除子目录");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const ids = row.id;
|
|
|
|
const ids = row.id;
|
|
|
|
this.$modal.confirm('是否确认删除商品分类编号为"' + ids + '"的数据项?').then(function () {
|
|
|
|
this.$modal
|
|
|
|
return delPmsProductCategory(ids);
|
|
|
|
.confirm('是否确认删除商品分类编号为"' + ids + '"的数据项?')
|
|
|
|
}).then(() => {
|
|
|
|
.then(function () {
|
|
|
|
this.getList();
|
|
|
|
return delPmsProductCategory(ids);
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
})
|
|
|
|
}).catch(() => {
|
|
|
|
.then(() => {
|
|
|
|
});
|
|
|
|
this.getList();
|
|
|
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(() => {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
handleExport() {
|
|
|
|
handleExport() {
|
|
|
|
const queryParams = this.queryParams;
|
|
|
|
const queryParams = this.queryParams;
|
|
|
|
this.$modal.confirm('是否确认导出所有商品分类数据项?').then(() => {
|
|
|
|
this.$modal
|
|
|
|
this.exportLoading = true;
|
|
|
|
.confirm("是否确认导出所有商品分类数据项?")
|
|
|
|
return exportPmsProductCategory(queryParams);
|
|
|
|
.then(() => {
|
|
|
|
}).then(response => {
|
|
|
|
this.exportLoading = true;
|
|
|
|
this.$download.download(response);
|
|
|
|
return exportPmsProductCategory(queryParams);
|
|
|
|
this.exportLoading = false;
|
|
|
|
})
|
|
|
|
}).catch(() => {
|
|
|
|
.then((response) => {
|
|
|
|
});
|
|
|
|
this.$download.download(response);
|
|
|
|
}
|
|
|
|
this.exportLoading = false;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(() => {});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|