commit
b51beb1b91
7 changed files with 3084 additions and 2904 deletions
@ -1,111 +1,109 @@ |
||||
<template> |
||||
<div> |
||||
<el-form ref="editPram" :model="editPram" label-width="130px"> |
||||
<el-form-item label="分类名称" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: ['blur', 'change'] }]"> |
||||
<el-input v-model="editPram.categoryName" placeholder="分类名称" /> |
||||
</el-form-item> |
||||
<el-form-item v-if="editPram.parentCategoryName" label="父级" > |
||||
{{ editPram.parentCategoryName }} |
||||
</el-form-item> |
||||
<el-form-item label="分类图标(180*180)"> |
||||
<div class="upLoadPicBox" @click="modalPicTap('1')"> |
||||
<upload :photo="editPram.icon" @success="uploadSuccess" tip="图标尺寸为18*18比例,大小不能超过200KB,图片只能为jpg、png、gif格式"></upload> |
||||
</div> |
||||
</el-form-item> |
||||
<el-form-item label="排序"> |
||||
<el-input-number v-model="editPram.sort" :min="0" /> |
||||
</el-form-item> |
||||
<el-form-item label="状态"> |
||||
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" active-value="1" |
||||
inactive-value="2" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit">确定</el-button> |
||||
<el-button @click="close">取消</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</template> |
||||
<!--创建和编辑公用一个组件--> |
||||
<script> |
||||
import upload from '@/components/Upload/index' |
||||
import productApi from '@/api/product/productAttr.js'; |
||||
import { loadingFn } from "@/utils/validate" |
||||
|
||||
export default { |
||||
// name: "edit", |
||||
components: { upload }, |
||||
props: { |
||||
parentOptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
model:"classifySave", |
||||
loadingBtn: false, |
||||
constants: [], |
||||
editPram: { |
||||
level: 1, |
||||
icon:"", |
||||
showFlag: 1, |
||||
categoryName: "", |
||||
sort:1, |
||||
parentId:"", |
||||
parentCategoryName:"" |
||||
}, |
||||
categoryProps: { |
||||
value: 'id', |
||||
label: 'categoryName', |
||||
children: 'children' |
||||
} |
||||
} |
||||
}, |
||||
mounted() { |
||||
// this.initEditData() |
||||
}, |
||||
methods: { |
||||
updateModel(e){ |
||||
this.model = e |
||||
}, |
||||
uploadSuccess(e, res) { |
||||
if (res.code == 20000) { |
||||
({ publicUrl: this.editPram.icon } = res.data); |
||||
} |
||||
}, |
||||
// 点击图标 |
||||
addIcon() { }, |
||||
// 点击商品图 |
||||
modalPicTap(tit, num, i) { |
||||
}, |
||||
close() { |
||||
this.$parent.$parent.editDialogConfig.visible=false; |
||||
}, |
||||
initEditData() { |
||||
}, |
||||
addTreeListLabelForCasCard(arr, child) { |
||||
}, |
||||
handlerSubmit() { |
||||
productApi[this.model](this.editPram).then((result) => { |
||||
if(result.code==20000){ |
||||
this.$parent.$parent.editDialogConfig.visible=false; |
||||
this.$message.success("添加成功!"); |
||||
this.$parent.$parent.handleCurrentChange(); |
||||
|
||||
} |
||||
}).catch((err) => { |
||||
|
||||
}); |
||||
}, |
||||
handlerSaveOrUpdate(isSave) { |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
::v-deep .photo-container { |
||||
align-items: flex-start !important; |
||||
} |
||||
</style> |
||||
<template> |
||||
<div> |
||||
<el-form ref="editPram" :model="editPram" label-width="130px"> |
||||
<el-form-item label="分类名称" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: ['blur', 'change'] }]"> |
||||
<el-input v-model="editPram.categoryName" placeholder="分类名称" /> |
||||
</el-form-item> |
||||
<el-form-item v-if="editPram.parentCategoryName" label="父级"> |
||||
{{ editPram.parentCategoryName }} |
||||
</el-form-item> |
||||
<el-form-item label="分类图标(180*180)" prop="icon" :rules="[{ required: true, message: '请上传分类图标!', trigger: ['blur', 'change'] }]"> |
||||
<div class="upLoadPicBox" @click="modalPicTap('1')"> |
||||
<upload :photo="editPram.icon" @success="uploadSuccess" tip="图标尺寸为18*18比例,大小不能超过50KB,图片只能为jpg、png格式"></upload> |
||||
</div> |
||||
</el-form-item> |
||||
<el-form-item label="排序"> |
||||
<el-input-number v-model="editPram.sort" :min="0" /> |
||||
</el-form-item> |
||||
<el-form-item label="状态"> |
||||
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" active-value="1" inactive-value="2" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit">确定</el-button> |
||||
<el-button @click="close">取消</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</template> |
||||
<!--创建和编辑公用一个组件--> |
||||
<script> |
||||
import upload from '@/components/Upload/index' |
||||
import productApi from '@/api/product/productAttr.js' |
||||
import { loadingFn } from '@/utils/validate' |
||||
|
||||
export default { |
||||
// name: "edit", |
||||
components: { upload }, |
||||
props: { |
||||
parentOptions: { |
||||
type: Array, |
||||
default: () => [] |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
model: 'classifySave', |
||||
loadingBtn: false, |
||||
constants: [], |
||||
editPram: { |
||||
level: 1, |
||||
icon: '', |
||||
showFlag: 1, |
||||
categoryName: '', |
||||
sort: 1, |
||||
parentId: '', |
||||
parentCategoryName: '' |
||||
}, |
||||
categoryProps: { |
||||
value: 'id', |
||||
label: 'categoryName', |
||||
children: 'children' |
||||
} |
||||
} |
||||
}, |
||||
mounted() { |
||||
// this.initEditData() |
||||
}, |
||||
methods: { |
||||
updateModel(e) { |
||||
this.model = e |
||||
}, |
||||
uploadSuccess(e, res) { |
||||
if (res.code == 20000) { |
||||
;({ publicUrl: this.editPram.icon } = res.data) |
||||
} |
||||
}, |
||||
// 点击图标 |
||||
addIcon() {}, |
||||
// 点击商品图 |
||||
modalPicTap(tit, num, i) {}, |
||||
close() { |
||||
this.$parent.$parent.editDialogConfig.visible = false |
||||
}, |
||||
initEditData() {}, |
||||
addTreeListLabelForCasCard(arr, child) {}, |
||||
handlerSubmit() { |
||||
this.$refs.editPram.validate(valid => { |
||||
if (valid) { |
||||
productApi[this.model](this.editPram) |
||||
.then(result => { |
||||
if (result.code == 20000) { |
||||
this.$parent.$parent.editDialogConfig.visible = false |
||||
this.$message.success('添加成功!') |
||||
this.$parent.$parent.handleCurrentChange() |
||||
} |
||||
}) |
||||
.catch(err => {}) |
||||
} |
||||
}) |
||||
}, |
||||
handlerSaveOrUpdate(isSave) {} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
::v-deep .photo-container { |
||||
align-items: flex-start !important; |
||||
} |
||||
</style> |
||||
|
@ -1,72 +1,83 @@ |
||||
<template> |
||||
<div> |
||||
<el-form ref="form" :model="form"> |
||||
<el-form-item prop="brandName" label="品牌名称" label-width="100px" |
||||
:rules="[{ required: true, message: '请输入品牌名称', trigger: ['blur', 'change'] }]"> |
||||
<el-input v-model="form.brandName"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="品牌首字母" prop="firstLetter" label-width="100px" |
||||
:rules="[{ required: true, message: '请输入品牌首字母', trigger: ['blur', 'change'] }]"> |
||||
<el-input v-model="form.firstLetter"></el-input> |
||||
</el-form-item> |
||||
<el-form-item label=" 品牌LOGO" label-width="100px"> |
||||
<upload :photo="form.logoUrl" @success="uploadSuccess" tip="只能上传jpg/png格式文件,文件不能超过50kb"> |
||||
</upload> |
||||
</el-form-item> |
||||
<el-form-item label="排序" label-width="100px"> |
||||
<el-input-number v-model="form.sort" :min="0" /> |
||||
</el-form-item> |
||||
<el-form-item label="是否显示" label-width="100px"> |
||||
<el-switch v-model="form.showFlag" active-text="显示" inactive-text="隐藏" active-value="1" |
||||
inactive-value="2" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="footer"> |
||||
<el-button @click="$emit('close')" >取 消</el-button> |
||||
<el-button @click="save" type="primary">确 定</el-button> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import upload from '@/components/Upload/index' |
||||
export default { |
||||
components: { upload }, |
||||
|
||||
data() { |
||||
return { |
||||
apiMode:"brandSave", |
||||
form: { |
||||
"brandName": "", |
||||
"firstLetter": "", |
||||
"logoUrl": "", |
||||
"showFlag": "1", |
||||
"sort": "1" |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
save() { |
||||
this.$refs.form.validate((valid) => { |
||||
if (valid) { |
||||
this.$emit("brandSave",this.form,this.apiMode) |
||||
} |
||||
}); |
||||
}, |
||||
uploadSuccess(e, res) { |
||||
console.log(...arguments,"uploadSuccess") |
||||
if (res.code == 20000) { |
||||
({ publicUrl: this.form.logoUrl } = res.data); |
||||
} |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.footer { |
||||
width: 100%; |
||||
display: flex; |
||||
justify-content: center; |
||||
} |
||||
</style> |
||||
<template> |
||||
<div> |
||||
<el-form ref="form" :model="form"> |
||||
<el-form-item |
||||
prop="brandName" |
||||
label="品牌名称" |
||||
label-width="100px" |
||||
:rules="[{ required: true, message: '请输入品牌名称', trigger: ['blur', 'change'] }]" |
||||
> |
||||
<el-input v-model="form.brandName"></el-input> |
||||
</el-form-item> |
||||
<el-form-item |
||||
label="品牌首字母" |
||||
prop="firstLetter" |
||||
label-width="100px" |
||||
:rules="[{ required: true, message: '请输入品牌首字母', trigger: ['blur', 'change'] }]" |
||||
> |
||||
<el-input v-model="form.firstLetter"></el-input> |
||||
</el-form-item> |
||||
<el-form-item |
||||
label=" 品牌LOGO" |
||||
label-width="100px" |
||||
prop="logoUrl" |
||||
:rules="[{ required: true, message: '请上传品牌LOGO', trigger: ['blur', 'change'] }]" |
||||
> |
||||
<upload :photo="form.logoUrl" @success="uploadSuccess" tip="只能上传jpg/png格式文件,文件不能超过50kb"> </upload> |
||||
</el-form-item> |
||||
<el-form-item label="排序" label-width="100px"> |
||||
<el-input-number v-model="form.sort" :min="0" /> |
||||
</el-form-item> |
||||
<el-form-item label="是否显示" label-width="100px"> |
||||
<el-switch v-model="form.showFlag" active-text="显示" inactive-text="隐藏" active-value="1" inactive-value="2" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div slot="footer" class="footer"> |
||||
<el-button @click="$emit('close')">取 消</el-button> |
||||
<el-button @click="save" type="primary">确 定</el-button> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import upload from '@/components/Upload/index' |
||||
export default { |
||||
components: { upload }, |
||||
|
||||
data() { |
||||
return { |
||||
apiMode: 'brandSave', |
||||
form: { |
||||
brandName: '', |
||||
firstLetter: '', |
||||
logoUrl: '', |
||||
showFlag: '1', |
||||
sort: '1' |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
save() { |
||||
this.$refs.form.validate(valid => { |
||||
if (valid) { |
||||
this.$emit('brandSave', this.form, this.apiMode) |
||||
} |
||||
}) |
||||
}, |
||||
uploadSuccess(e, res) { |
||||
console.log(...arguments, 'uploadSuccess') |
||||
if (res.code == 20000) { |
||||
;({ publicUrl: this.form.logoUrl } = res.data) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
.footer { |
||||
width: 100%; |
||||
display: flex; |
||||
justify-content: center; |
||||
} |
||||
</style> |
||||
|
@ -1,175 +1,195 @@ |
||||
<template> |
||||
<div> |
||||
<el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }"> |
||||
<div class="padding-add"> |
||||
<el-form ref="artFrom" :model="page" label-width="80px" label-position="right" class="tabform" |
||||
@submit.native.prevent inline> |
||||
<el-form-item label="输入搜索"> |
||||
<el-input clearable v-model="page.brandName" placeholder="品牌名称/关键词" |
||||
class="form_content_width"></el-input> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" @click="userSearchs">查询</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16"> |
||||
<el-button type="primary" @click="addBrand">添加品牌</el-button> |
||||
<el-table @current-change="tableCurrentChange" ref="table" :data="tableData" v-loading="loading" |
||||
highlight-current-row :row-key="getRowKey" @selection-change="handleSelectRow" empty-text="暂无数据" |
||||
class="mt14"> |
||||
<el-table-column type="selection" width="60" :reserve-selection="true"> </el-table-column> |
||||
<el-table-column label="编号"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ scope.row.brandNum }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="品牌名称"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ scope.row.brandName }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="品牌首字母" prop="firstLetter"> </el-table-column> |
||||
<el-table-column label="排序" prop="sort"> </el-table-column> |
||||
<el-table-column label="是否显示"> |
||||
<template slot-scope="scope"> |
||||
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" |
||||
active-color="#13ce66" inactive-color="#ff4949"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" fixed="right"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="edit(scope.row)">编辑</el-button> |
||||
<el-divider direction="vertical"></el-divider> |
||||
<el-button type="text" @click="del(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="acea-row row-right page"> |
||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
||||
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize" |
||||
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" /> |
||||
</div> |
||||
</el-card> |
||||
<el-dialog title="品牌设置" :visible.sync="isAddOrEdit" v-loading="addLoading"> |
||||
<addOrEdit v-if="isAddOrEdit" @close="isAddOrEdit = false" @brandSave="brandSave" ref="addOrEdit"></addOrEdit> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import productApi from '@/api/product/productAttr.js'; |
||||
import { loadingFn } from "@/utils/validate" |
||||
import addOrEdit from "./components/AddOrEdit.vue" |
||||
export default { |
||||
components: { addOrEdit }, |
||||
data() { |
||||
return { |
||||
addLoading: false, |
||||
isAddOrEdit: false, |
||||
selection: [], |
||||
selectAttrList: null, |
||||
isShowAttrList: false, |
||||
loading: false, |
||||
page: { |
||||
"currentPage": 1, |
||||
"pageSize": 10, |
||||
"params": { |
||||
brandName:"" |
||||
}, |
||||
totalCount: 0 |
||||
}, |
||||
tableData: [], |
||||
total: 0, |
||||
selectedIds: new Set(), //选中合并项的id |
||||
ids: [], |
||||
multipleSelection: [], |
||||
}; |
||||
}, |
||||
computed: {}, |
||||
created() { |
||||
this.init() |
||||
}, |
||||
methods: { |
||||
addBrand() { |
||||
this.isAddOrEdit = true; |
||||
}, |
||||
brandSave(e,model="brandSave") { |
||||
loadingFn.call(this, "addLoading", productApi[model](e).then(res => { |
||||
if (res.code == 20000) { |
||||
this.$message.success("操作成功") |
||||
setTimeout(() => { |
||||
this.isAddOrEdit = false; |
||||
this.getList(); |
||||
|
||||
}, 1000); |
||||
} |
||||
}), 1000); |
||||
|
||||
}, |
||||
tableCurrentChange(e) { }, |
||||
handleCurrentChange(val) { |
||||
this.page.currentPage = val; |
||||
this.getList() |
||||
}, |
||||
handleSizeChange(val) { |
||||
this.page.pageSize = val |
||||
this.getList() |
||||
}, |
||||
clearSelection() { }, |
||||
onCancel() { }, |
||||
|
||||
showAttrList(e) { }, |
||||
getRowKey(row) { }, |
||||
//全选和取消全选时触发 |
||||
handleSelectAll(selection) { }, |
||||
// 选中某一行 |
||||
handleSelectRow(selection) { }, |
||||
setChecked() { }, |
||||
// 删除 |
||||
del(row) { |
||||
this.$alert('请确定删除该数据!', '提示', { |
||||
confirmButtonText: '确定', |
||||
callback: action => { |
||||
if (action == "confirm") { |
||||
loadingFn.call(this, "loading", productApi.brandDelete(row).then(res => { |
||||
if (res.code = 20000) { |
||||
this.$message.success("操作成功!") |
||||
this.handleCurrentChange() |
||||
} |
||||
})); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
addAttr(model) { |
||||
}, |
||||
// 编辑 |
||||
edit(row) { |
||||
this.isAddOrEdit = true; |
||||
this.$nextTick(() => { |
||||
this.$refs.addOrEdit.apiMode = "brandUpdate" |
||||
this.$refs.addOrEdit.form = Object.assign(this.$refs.addOrEdit.form, row); |
||||
}) |
||||
}, |
||||
// 列表 |
||||
getList() { |
||||
loadingFn.call(this, "loading", productApi.brandGetByPage(this.page).then(res => { |
||||
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data); |
||||
})); |
||||
}, |
||||
// 表格搜索 |
||||
userSearchs() { |
||||
this.handleCurrentChange() |
||||
}, |
||||
// 初始化 |
||||
init() { |
||||
this.getList() |
||||
} |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped></style> |
||||
|
||||
<template> |
||||
<div> |
||||
<el-card :bordered="false" shadow="never" class="ivu-mt" :body-style="{ padding: 0 }"> |
||||
<div class="padding-add"> |
||||
<el-form ref="artFrom" :model="page" label-width="80px" label-position="right" class="tabform" @submit.native.prevent inline> |
||||
<el-form-item label="输入搜索"> |
||||
<el-input clearable v-model="page.params.brandName" placeholder="品牌名称/关键词" class="form_content_width"></el-input> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" @click="userSearchs">查询</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> |
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16"> |
||||
<el-button type="primary" @click="addBrand">添加品牌</el-button> |
||||
<el-table |
||||
@current-change="tableCurrentChange" |
||||
ref="table" |
||||
:data="tableData" |
||||
v-loading="loading" |
||||
highlight-current-row |
||||
:row-key="getRowKey" |
||||
@selection-change="handleSelectRow" |
||||
empty-text="暂无数据" |
||||
class="mt14" |
||||
> |
||||
<el-table-column type="selection" width="60" :reserve-selection="true"> </el-table-column> |
||||
<el-table-column label="编号"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ scope.row.brandNum }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="品牌名称"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ scope.row.brandName }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="品牌首字母" prop="firstLetter"> </el-table-column> |
||||
<el-table-column label="排序" prop="sort"> </el-table-column> |
||||
<el-table-column label="是否显示"> |
||||
<template slot-scope="scope"> |
||||
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" inactive-color="#ff4949"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" fixed="right"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="edit(scope.row)">编辑</el-button> |
||||
<el-divider direction="vertical"></el-divider> |
||||
<el-button type="text" @click="del(scope.row)">删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="acea-row row-right page"> |
||||
<el-pagination |
||||
@size-change="handleSizeChange" |
||||
@current-change="handleCurrentChange" |
||||
:current-page="page.currentPage" |
||||
:page-sizes="[10, 15, 20, 30]" |
||||
:page-size="page.pageSize" |
||||
layout="total, sizes, prev, pager, next, jumper" |
||||
:total="page.totalCount" |
||||
/> |
||||
</div> |
||||
</el-card> |
||||
<el-dialog title="品牌设置" :visible.sync="isAddOrEdit" v-loading="addLoading"> |
||||
<addOrEdit v-if="isAddOrEdit" @close="isAddOrEdit = false" @brandSave="brandSave" ref="addOrEdit"></addOrEdit> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
import productApi from '@/api/product/productAttr.js' |
||||
import { loadingFn } from '@/utils/validate' |
||||
import addOrEdit from './components/AddOrEdit.vue' |
||||
export default { |
||||
components: { addOrEdit }, |
||||
data() { |
||||
return { |
||||
addLoading: false, |
||||
isAddOrEdit: false, |
||||
selection: [], |
||||
selectAttrList: null, |
||||
isShowAttrList: false, |
||||
loading: false, |
||||
page: { |
||||
currentPage: 1, |
||||
pageSize: 10, |
||||
params: { |
||||
brandName: '' |
||||
}, |
||||
totalCount: 0 |
||||
}, |
||||
tableData: [], |
||||
total: 0, |
||||
selectedIds: new Set(), //选中合并项的id |
||||
ids: [], |
||||
multipleSelection: [] |
||||
} |
||||
}, |
||||
computed: {}, |
||||
created() { |
||||
this.init() |
||||
}, |
||||
methods: { |
||||
addBrand() { |
||||
this.isAddOrEdit = true |
||||
}, |
||||
brandSave(e, model = 'brandSave') { |
||||
loadingFn.call( |
||||
this, |
||||
'addLoading', |
||||
productApi[model](e).then(res => { |
||||
if (res.code == 20000) { |
||||
this.$message.success('操作成功') |
||||
setTimeout(() => { |
||||
this.isAddOrEdit = false |
||||
this.getList() |
||||
}, 1000) |
||||
} |
||||
}), |
||||
1000 |
||||
) |
||||
}, |
||||
tableCurrentChange(e) {}, |
||||
handleCurrentChange(val) { |
||||
this.page.currentPage = val |
||||
this.getList() |
||||
}, |
||||
handleSizeChange(val) { |
||||
this.page.pageSize = val |
||||
this.getList() |
||||
}, |
||||
clearSelection() {}, |
||||
onCancel() {}, |
||||
|
||||
showAttrList(e) {}, |
||||
getRowKey(row) {}, |
||||
//全选和取消全选时触发 |
||||
handleSelectAll(selection) {}, |
||||
// 选中某一行 |
||||
handleSelectRow(selection) {}, |
||||
setChecked() {}, |
||||
// 删除 |
||||
del(row) { |
||||
this.$alert('请确定删除该数据!', '提示', { |
||||
confirmButtonText: '确定', |
||||
callback: action => { |
||||
if (action == 'confirm') { |
||||
loadingFn.call( |
||||
this, |
||||
'loading', |
||||
productApi.brandDelete(row).then(res => { |
||||
if ((res.code = 20000)) { |
||||
this.$message.success('操作成功!') |
||||
this.handleCurrentChange() |
||||
} |
||||
}) |
||||
) |
||||
} |
||||
} |
||||
}) |
||||
}, |
||||
addAttr(model) {}, |
||||
// 编辑 |
||||
edit(row) { |
||||
this.isAddOrEdit = true |
||||
this.$nextTick(() => { |
||||
this.$refs.addOrEdit.apiMode = 'brandUpdate' |
||||
this.$refs.addOrEdit.form = Object.assign(this.$refs.addOrEdit.form, row) |
||||
}) |
||||
}, |
||||
// 列表 |
||||
getList() { |
||||
loadingFn.call( |
||||
this, |
||||
'loading', |
||||
productApi.brandGetByPage(this.page).then(res => { |
||||
if ((res.code = 20000)) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data) |
||||
}) |
||||
) |
||||
}, |
||||
// 表格搜索 |
||||
userSearchs() { |
||||
this.handleCurrentChange() |
||||
}, |
||||
// 初始化 |
||||
init() { |
||||
this.getList() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped></style> |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,257 +1,257 @@ |
||||
<template> |
||||
<div class="article-manager"> |
||||
<!-- <el-card :bordered="false" shadow="never" class="ivu-mt-16" :body-style="{ padding: 0 }"> |
||||
<div class="padding-add"> |
||||
<el-form ref="artFrom" :model="artFrom" inline label-width="80px" label-position="right" @submit.native.prevent> |
||||
<el-form-item label="商品分类:" prop="pid" label-for="pid"> |
||||
<el-select v-model="artFrom.pid" placeholder="请选择商品分类" @change="userSearchs" clearable |
||||
class="form_content_width"> |
||||
<el-option v-for="item in treeSelect" :value="item.id" :label="item.cate_name" :key="item.id">{{ |
||||
item.cate_name |
||||
}}</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="分类状态:" label-for="is_show"> |
||||
<el-select v-model="artFrom.is_show" placeholder="请选择分类状态" clearable @change="userSearchs" |
||||
class="form_content_width"> |
||||
<el-option value="1" label="显示"></el-option> |
||||
<el-option value="0" label="隐藏"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="分类名称:" label-for="status2"> |
||||
<el-input clearable placeholder="请输入分类名称" v-model="artFrom.cate_name" class="form_content_width" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" @click="userSearchs">查询</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> --> |
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16"> |
||||
<el-button type="primary" class="bnt" @click="addClass(null)">添加分类</el-button> |
||||
<el-table row-key="id" class="mt14" v-loading="loading" :tree-props="{ children: 'children' }" :data="tableData"> |
||||
<el-table-column prop="categoryNum" label="编号"></el-table-column> |
||||
<el-table-column prop="categoryName" label="分类名称"></el-table-column> |
||||
<el-table-column prop="level" label="级别"></el-table-column> |
||||
<el-table-column prop="icon" label="分类图标" min-width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-image style="width: 50px; height: 50px" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"> |
||||
</el-image> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="showFlag" label="是否显示"> |
||||
<template slot-scope="scope"> |
||||
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" |
||||
inactive-color="#ff4949"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="sort" label="排序" min-width="100" tooltip="true"></el-table-column> |
||||
<el-table-column prop="date" label="操作" width="120" fixed="right"> |
||||
<template slot-scope="scope"> |
||||
<el-dropdown> |
||||
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button> |
||||
<el-dropdown-menu slot="dropdown"> |
||||
<el-dropdown-item> |
||||
<span @click="edit(scope.row)">编辑</span> |
||||
</el-dropdown-item> |
||||
<el-dropdown-item v-if="scope.row.level == 1"> |
||||
<span @click="addClass(scope.row)">新增下级</span> |
||||
</el-dropdown-item> |
||||
<el-dropdown-item v-if="scope.row.level == 1">查看下级 </el-dropdown-item> |
||||
</el-dropdown-menu> |
||||
</el-dropdown> |
||||
<el-button type=text> |
||||
</el-button> |
||||
<el-button @click="del(scope.row, scope)" type=text>删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-card> |
||||
<div class="acea-row row-right page"> |
||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
||||
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize" |
||||
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" /> |
||||
</div> |
||||
|
||||
<!-- 添加 编辑表单--> |
||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from> |
||||
<el-dialog title="分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false"> |
||||
<edit ref="edit" :parentOptions="tableData" /> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import edit from '@/components/Category/edit' |
||||
import editFrom from '../../../components/from/from'; |
||||
import productApi from '@/api/product/productAttr.js'; |
||||
import { loadingFn } from "@/utils/validate" |
||||
export default { |
||||
name: 'product_productClassify', |
||||
components: { |
||||
editFrom, |
||||
edit |
||||
}, |
||||
data() { |
||||
return { |
||||
editDialogConfig: { |
||||
visible: false |
||||
}, |
||||
treeSelect: [], |
||||
FromData: null, |
||||
grid: { |
||||
xl: 7, |
||||
lg: 7, |
||||
md: 12, |
||||
sm: 24, |
||||
xs: 24, |
||||
}, |
||||
loading: false, |
||||
page: { |
||||
"currentPage": 1, |
||||
"pageSize": 10, |
||||
"params": {}, |
||||
totalCount: 0 |
||||
}, |
||||
total: 0, |
||||
tableData: [], |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
handleCommand(e) { |
||||
|
||||
}, |
||||
handleSizeChange(val) { |
||||
this.page.pageSize = val |
||||
this.getList() |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.page.currentPage = val |
||||
this.getList() |
||||
}, |
||||
// 商品分类; |
||||
goodsCategory() { |
||||
}, |
||||
// 列表 |
||||
getList() { |
||||
loadingFn.call(this, "loading", productApi.classifyGetByPage(this.page).then(res => { |
||||
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data); |
||||
})); |
||||
}, |
||||
pageChange(index) { |
||||
this.artFrom.page = index; |
||||
this.getList(); |
||||
}, |
||||
// 添加 |
||||
addClass(parent = null) { |
||||
this.editDialogConfig.visible = true; |
||||
if (parent) { |
||||
let { categoryName, id } = parent; |
||||
this.$nextTick(() => { |
||||
this.$refs.edit.updateModel("classifySave"); |
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 }); |
||||
}) |
||||
} |
||||
}, |
||||
// 编辑 |
||||
edit(row) { |
||||
this.editDialogConfig.visible = true; |
||||
this.$nextTick(() => { |
||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row; |
||||
this.$refs.edit.updateModel("classifyUpdate"); |
||||
if (row.level == 1) { |
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id }) |
||||
} else { |
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, |
||||
{ |
||||
level, |
||||
icon, |
||||
showFlag, |
||||
parentCategoryName: this.tableData.find(item => item.id == parentId).categoryName, |
||||
categoryName, |
||||
sort, |
||||
parentId, id |
||||
}) |
||||
} |
||||
}) |
||||
}, |
||||
// 修改状态 |
||||
onchangeIsShow(row) { |
||||
let data = { |
||||
id: row.id, |
||||
is_show: row.is_show, |
||||
}; |
||||
setShowApi(data) |
||||
.then(async (res) => { |
||||
this.$message.success(res.msg); |
||||
}) |
||||
.catch((res) => { |
||||
this.$message.error(res.msg); |
||||
}); |
||||
}, |
||||
// 下拉树 |
||||
handleCheckChange(data) { |
||||
let value = ''; |
||||
let title = ''; |
||||
this.list = []; |
||||
this.artFrom.pid = 0; |
||||
data.forEach((item, index) => { |
||||
value += `${item.id},`; |
||||
title += `${item.title},`; |
||||
}); |
||||
value = value.substring(0, value.length - 1); |
||||
title = title.substring(0, title.length - 1); |
||||
this.list.push({ |
||||
value, |
||||
title, |
||||
}); |
||||
this.artFrom.pid = value; |
||||
this.getList(); |
||||
}, |
||||
// 删除 |
||||
del(row, scope) { |
||||
console.log(scope) |
||||
this.$alert('请确定删除!', '提示', { |
||||
confirmButtonText: '确定', |
||||
callback: action => { |
||||
if (action == "confirm") { |
||||
loadingFn.call(this, "loading", productApi.classifyDelete(row).then(res => { |
||||
if (res.code = 20000) { |
||||
this.$message.success("操作成功!") |
||||
this.handleCurrentChange() |
||||
} |
||||
})); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
// 表格搜索 |
||||
userSearchs() { |
||||
this.artFrom.page = 1; |
||||
this.getList(); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
<style scoped lang="stylus"> |
||||
.treeSel ::v-deep .ivu-select-dropdown-list { |
||||
padding: 0 10px !important; |
||||
box-sizing: border-box; |
||||
} |
||||
|
||||
.tabBox_img { |
||||
width: 36px; |
||||
height: 36px; |
||||
border-radius: 4px; |
||||
cursor: pointer; |
||||
|
||||
img { |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
} |
||||
</style> |
||||
<template> |
||||
<div class="article-manager"> |
||||
<!-- <el-card :bordered="false" shadow="never" class="ivu-mt-16" :body-style="{ padding: 0 }"> |
||||
<div class="padding-add"> |
||||
<el-form ref="artFrom" :model="artFrom" inline label-width="80px" label-position="right" @submit.native.prevent> |
||||
<el-form-item label="商品分类:" prop="pid" label-for="pid"> |
||||
<el-select v-model="artFrom.pid" placeholder="请选择商品分类" @change="userSearchs" clearable |
||||
class="form_content_width"> |
||||
<el-option v-for="item in treeSelect" :value="item.id" :label="item.cate_name" :key="item.id">{{ |
||||
item.cate_name |
||||
}}</el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="分类状态:" label-for="is_show"> |
||||
<el-select v-model="artFrom.is_show" placeholder="请选择分类状态" clearable @change="userSearchs" |
||||
class="form_content_width"> |
||||
<el-option value="1" label="显示"></el-option> |
||||
<el-option value="0" label="隐藏"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
<el-form-item label="分类名称:" label-for="status2"> |
||||
<el-input clearable placeholder="请输入分类名称" v-model="artFrom.cate_name" class="form_content_width" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" @click="userSearchs">查询</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</div> |
||||
</el-card> --> |
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16"> |
||||
<el-button type="primary" class="bnt" @click="addClass(null)">添加分类</el-button> |
||||
<el-table row-key="id" class="mt14" v-loading="loading" :tree-props="{ children: 'children' }" :data="tableData"> |
||||
<el-table-column prop="categoryNum" label="编号"></el-table-column> |
||||
<el-table-column prop="categoryName" label="分类名称"></el-table-column> |
||||
<el-table-column prop="level" label="级别"></el-table-column> |
||||
<el-table-column prop="icon" label="分类图标" min-width="100"> |
||||
<template slot-scope="scope"> |
||||
<el-image style="width: 50px; height: 50px" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"> |
||||
</el-image> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="showFlag" label="是否显示"> |
||||
<template slot-scope="scope"> |
||||
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" |
||||
inactive-color="#ff4949"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="sort" label="排序" min-width="100" tooltip="true"></el-table-column> |
||||
<el-table-column prop="date" label="操作" width="120" fixed="right"> |
||||
<template slot-scope="scope"> |
||||
<el-dropdown> |
||||
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button> |
||||
<el-dropdown-menu slot="dropdown"> |
||||
<el-dropdown-item> |
||||
<span @click="edit(scope.row)">编辑</span> |
||||
</el-dropdown-item> |
||||
<el-dropdown-item v-if="scope.row.level == 1"> |
||||
<span @click="addClass(scope.row)">新增下级</span> |
||||
</el-dropdown-item> |
||||
<!-- <el-dropdown-item v-if="scope.row.level == 1">查看下级 </el-dropdown-item> --> |
||||
</el-dropdown-menu> |
||||
</el-dropdown> |
||||
<el-button type=text> |
||||
</el-button> |
||||
<el-button @click="del(scope.row, scope)" type=text>删除</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-card> |
||||
<div class="acea-row row-right page"> |
||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
||||
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize" |
||||
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" /> |
||||
</div> |
||||
|
||||
<!-- 添加 编辑表单--> |
||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from> |
||||
<el-dialog title="分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false"> |
||||
<edit ref="edit" :parentOptions="tableData" /> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import edit from '@/components/Category/edit' |
||||
import editFrom from '../../../components/from/from'; |
||||
import productApi from '@/api/product/productAttr.js'; |
||||
import { loadingFn } from "@/utils/validate" |
||||
export default { |
||||
name: 'product_productClassify', |
||||
components: { |
||||
editFrom, |
||||
edit |
||||
}, |
||||
data() { |
||||
return { |
||||
editDialogConfig: { |
||||
visible: false |
||||
}, |
||||
treeSelect: [], |
||||
FromData: null, |
||||
grid: { |
||||
xl: 7, |
||||
lg: 7, |
||||
md: 12, |
||||
sm: 24, |
||||
xs: 24, |
||||
}, |
||||
loading: false, |
||||
page: { |
||||
"currentPage": 1, |
||||
"pageSize": 10, |
||||
"params": {}, |
||||
totalCount: 0 |
||||
}, |
||||
total: 0, |
||||
tableData: [], |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
handleCommand(e) { |
||||
|
||||
}, |
||||
handleSizeChange(val) { |
||||
this.page.pageSize = val |
||||
this.getList() |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.page.currentPage = val |
||||
this.getList() |
||||
}, |
||||
// 商品分类; |
||||
goodsCategory() { |
||||
}, |
||||
// 列表 |
||||
getList() { |
||||
loadingFn.call(this, "loading", productApi.classifyGetByPage(this.page).then(res => { |
||||
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data); |
||||
})); |
||||
}, |
||||
pageChange(index) { |
||||
this.artFrom.page = index; |
||||
this.getList(); |
||||
}, |
||||
// 添加 |
||||
addClass(parent = null) { |
||||
this.editDialogConfig.visible = true; |
||||
if (parent) { |
||||
let { categoryName, id } = parent; |
||||
this.$nextTick(() => { |
||||
this.$refs.edit.updateModel("classifySave"); |
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 }); |
||||
}) |
||||
} |
||||
}, |
||||
// 编辑 |
||||
edit(row) { |
||||
this.editDialogConfig.visible = true; |
||||
this.$nextTick(() => { |
||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row; |
||||
this.$refs.edit.updateModel("classifyUpdate"); |
||||
if (row.level == 1) { |
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id }) |
||||
} else { |
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, |
||||
{ |
||||
level, |
||||
icon, |
||||
showFlag, |
||||
parentCategoryName: this.tableData.find(item => item.id == parentId).categoryName, |
||||
categoryName, |
||||
sort, |
||||
parentId, id |
||||
}) |
||||
} |
||||
}) |
||||
}, |
||||
// 修改状态 |
||||
onchangeIsShow(row) { |
||||
let data = { |
||||
id: row.id, |
||||
is_show: row.is_show, |
||||
}; |
||||
setShowApi(data) |
||||
.then(async (res) => { |
||||
this.$message.success(res.msg); |
||||
}) |
||||
.catch((res) => { |
||||
this.$message.error(res.msg); |
||||
}); |
||||
}, |
||||
// 下拉树 |
||||
handleCheckChange(data) { |
||||
let value = ''; |
||||
let title = ''; |
||||
this.list = []; |
||||
this.artFrom.pid = 0; |
||||
data.forEach((item, index) => { |
||||
value += `${item.id},`; |
||||
title += `${item.title},`; |
||||
}); |
||||
value = value.substring(0, value.length - 1); |
||||
title = title.substring(0, title.length - 1); |
||||
this.list.push({ |
||||
value, |
||||
title, |
||||
}); |
||||
this.artFrom.pid = value; |
||||
this.getList(); |
||||
}, |
||||
// 删除 |
||||
del(row, scope) { |
||||
console.log(scope) |
||||
this.$alert('请确定删除!', '提示', { |
||||
confirmButtonText: '确定', |
||||
callback: action => { |
||||
if (action == "confirm") { |
||||
loadingFn.call(this, "loading", productApi.classifyDelete(row).then(res => { |
||||
if (res.code = 20000) { |
||||
this.$message.success("操作成功!") |
||||
this.handleCurrentChange() |
||||
} |
||||
})); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
// 表格搜索 |
||||
userSearchs() { |
||||
this.artFrom.page = 1; |
||||
this.getList(); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
<style scoped lang="stylus"> |
||||
.treeSel ::v-deep .ivu-select-dropdown-list { |
||||
padding: 0 10px !important; |
||||
box-sizing: border-box; |
||||
} |
||||
|
||||
.tabBox_img { |
||||
width: 36px; |
||||
height: 36px; |
||||
border-radius: 4px; |
||||
cursor: pointer; |
||||
|
||||
img { |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
} |
||||
</style> |
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue