Commit fa2846ba by 徐忆琳

Merge branch 'xuyl_v3.13.1_backup' into 'sass+v4.25.1'

分类管理代码合并

See merge request !7
2 parents cdea020b 99802bfc
...@@ -1901,6 +1901,51 @@ ...@@ -1901,6 +1901,51 @@
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true "dev": true
}, },
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"ssri": { "ssri": {
"version": "8.0.1", "version": "8.0.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
...@@ -1909,6 +1954,28 @@ ...@@ -1909,6 +1954,28 @@
"requires": { "requires": {
"minipass": "^3.1.1" "minipass": "^3.1.1"
} }
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
} }
} }
}, },
...@@ -13222,75 +13289,6 @@ ...@@ -13222,75 +13289,6 @@
} }
} }
}, },
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": { "vue-router": {
"version": "3.6.5", "version": "3.6.5",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz",
......
...@@ -47,9 +47,20 @@ const batchAddCategoryApi = params => { ...@@ -47,9 +47,20 @@ const batchAddCategoryApi = params => {
}) })
} }
const batchDetailApi = params => {
params.method = 'scrm.api.shopmall.discover.category.detail'
return http({
url,
method: 'post',
data: params,
sign: true
})
}
export default { export default {
addCategoryApi, addCategoryApi,
getCategoryListApi, getCategoryListApi,
delCategoryApi, delCategoryApi,
batchAddCategoryApi batchAddCategoryApi,
batchDetailApi
} }
<template> <template>
<div class="category-list-ctnr"> <div class="category-list-ctnr">
<GLTabs class="tabs" v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs> <GLTabs class="tabs" v-model="activeName" :tabPaneList="tabPaneList" @tab-click="handleClick"></GLTabs>
<pullDownNav @confirmDialog="handleEdit" @inputBlur="inputBlur" @delete="delCategory" v-model="curMainCategoryId" :tabList="mainCategoryList" :defaultProps="{id: 'id', name: 'categoryName'}"></pullDownNav> <template v-if="activeName ==1">
<pullDownNav @confirmDialog="handleEdit" @inputBlur="inputBlur" @delete="delCategory" v-model="curMainCategoryId"
:tabList="mainCategoryList" :defaultProps="{id: 'id', name: 'categoryName'}"></pullDownNav>
<div class="main-wrap"> <div class="main-wrap">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm> <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData"
@handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="operate-wrap"> <div class="operate-wrap">
<span class="table-title">二级分类列表</span> <span class="table-title">二级分类列表</span>
<el-button class="operate-btn" type="primary" size="small" @click="editCategory">新增二级分类</el-button> <el-button class="operate-btn" type="primary" size="small" @click="editCategory">新增二级分类</el-button>
</div> </div>
<GLTable ref="categoryRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"> <GLTable ref="categoryRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm"
:beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf"
@setTableFinishFun="setTableFinishFun">
<div slot="brandSlot"> <div slot="brandSlot">
<span>{{ brandList.slice(0, 3).join('、') }}</span> <span>{{ brandList.slice(0, 3).join('、') }}</span>
<el-popover <el-popover
...@@ -16,7 +21,7 @@ ...@@ -16,7 +21,7 @@
width="400" width="400"
trigger="hover"> trigger="hover">
<span> <span>
{{brandList.join('、')}} {{ brandList.join('、') }}
</span> </span>
<span class="more-brand" slot="reference">...[{{ brandList.length }}]</span> <span class="more-brand" slot="reference">...[{{ brandList.length }}]</span>
</el-popover> </el-popover>
...@@ -26,17 +31,25 @@ ...@@ -26,17 +31,25 @@
</div> </div>
</GLTable> </GLTable>
</div> </div>
</template>
<template v-if="activeName==2">
<ownerPreference></ownerPreference>
</template>
</div> </div>
</template> </template>
<script> <script>
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import pullDownNav from './components/pullDownNav' import pullDownNav from './components/pullDownNav'
export default { import ownerPreference from "views/category/ownerPreference";
export default {
name: 'App', name: 'App',
components:{ components: {
pullDownNav pullDownNav,
ownerPreference
}, },
data() { data() {
return { return {
...@@ -44,7 +57,7 @@ ...@@ -44,7 +57,7 @@
curMainCategoryId: '', curMainCategoryId: '',
tabPaneList: [], tabPaneList: [],
mainCategoryList: [], mainCategoryList: [],
brandList:['丰田','本田','一汽大众','奔驰','宝马','奥迪','比亚迪'], brandList: ['丰田', '本田', '一汽大众', '奔驰', '宝马', '奥迪', '比亚迪'],
buttonList: [ buttonList: [
{ {
type: 'el-button', type: 'el-button',
...@@ -120,27 +133,28 @@ ...@@ -120,27 +133,28 @@
}, },
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' } pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'}
} }
}, },
created() { created() {
this.getChannelList() this.getChannelList()
}, },
watch:{ watch: {
curMainCategoryId:{ curMainCategoryId: {
handler(){ handler() {
this.handleSearch() this.handleSearch()
}, },
deep: true deep: true
}, },
activeName:{ activeName: {
handler(){ handler() {
this.getMainCategory() this.getMainCategory()
}, },
deep: true deep: true
}, },
}, },
mounted() {}, mounted() {
},
methods: { methods: {
//获取频道名称 //获取频道名称
getChannelList() { getChannelList() {
...@@ -150,19 +164,27 @@ ...@@ -150,19 +164,27 @@
pageNum: 1 pageNum: 1
}) })
.then(res => { .then(res => {
if(res?.list?.length){ if (res?.list?.length) {
let tabPaneList = [] let tabPaneList = []
res.list.forEach(item => { res.list.forEach(item => {
if(item.channelType == 5 || item.channelType == 5){ if (item.channelType == 5 || item.channelType == 5) {
tabPaneList.push({label: item.channelName,name: item.channelType==5 ? 1 : 2 ,merchantChannelId: item.id}) tabPaneList.push({
label: item.channelName,
name: item.channelType == 5 ? 1 : 2,
merchantChannelId: item.id
})
} }
}) })
tabPaneList.push({
label: '车主优选',
name: 2
})
this.tabPaneList = tabPaneList this.tabPaneList = tabPaneList
this.activeName = tabPaneList[0].name this.activeName = tabPaneList[0].name
} }
}) })
}, },
getMainCategory(){ getMainCategory() {
const params = { const params = {
pageSize: 1000, pageSize: 1000,
pageNum: 1, pageNum: 1,
...@@ -170,21 +192,21 @@ ...@@ -170,21 +192,21 @@
categoryType: this.activeName categoryType: this.activeName
} }
this.$apis.category.getCategoryListApi(params).then(res => { this.$apis.category.getCategoryListApi(params).then(res => {
if(res?.list?.length){ if (res?.list?.length) {
this.mainCategoryList = res.list this.mainCategoryList = res.list
this.curMainCategoryId = res.list[0].id this.curMainCategoryId = res.list[0].id
}else{ } else {
this.curMainCategoryId = '' this.curMainCategoryId = ''
} }
}) })
}, },
inputBlur(e){ inputBlur(e) {
this.addCategory(e.value) this.addCategory(e.value)
}, },
handleEdit(e){ handleEdit(e) {
this.addCategory(e.categoryName, e.id) this.addCategory(e.categoryName, e.id)
}, },
delCategory(e, type){ delCategory(e, type) {
this.$confirm(`删除后数据将无法恢复,是否确认删除${e.categoryName}?`, '提示', { this.$confirm(`删除后数据将无法恢复,是否确认删除${e.categoryName}?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -192,10 +214,10 @@ ...@@ -192,10 +214,10 @@
callback: action => { callback: action => {
if (action == 'confirm') { if (action == 'confirm') {
this.$apis.category.delCategoryApi({id: e.id}).then(res => { this.$apis.category.delCategoryApi({id: e.id}).then(res => {
if(res){ if (res) {
this.$message.success('删除成功') this.$message.success('删除成功')
this.getMainCategory() this.getMainCategory()
if(type) { if (type) {
this.handleSearch() this.handleSearch()
} }
} }
...@@ -204,15 +226,15 @@ ...@@ -204,15 +226,15 @@
} }
}) })
}, },
addCategory(val, id){ addCategory(val, id) {
let params = { let params = {
categoryType: this.activeName, categoryType: this.activeName,
categoryLevel: 1, categoryLevel: 1,
categoryName: val categoryName: val
} }
if(id) params.id = id if (id) params.id = id
this.$apis.category.addCategoryApi(params).then(res => { this.$apis.category.addCategoryApi(params).then(res => {
if(res){ if (res) {
this.$message.success('新增成功') this.$message.success('新增成功')
this.getMainCategory() this.getMainCategory()
} }
...@@ -251,39 +273,40 @@ ...@@ -251,39 +273,40 @@
//接收到的数据为空 //接收到的数据为空
this.$refs.categoryRef.data.length ? (this.$refs.categoryRef.tableHeightValues = '') : this.$refs.categoryRef.setTableHeightFun() this.$refs.categoryRef.data.length ? (this.$refs.categoryRef.tableHeightValues = '') : this.$refs.categoryRef.setTableHeightFun()
}, },
editCategory(row={}) { editCategory(row = {}) {
if(!this.activeName) return this.$message.error('暂无频道') if (!this.activeName) return this.$message.error('暂无频道')
const target = this.mainCategoryList.find(item => item.id == this.curMainCategoryId) const target = this.mainCategoryList.find(item => item.id == this.curMainCategoryId)
if(!target) return this.$message.error('请选择一级分类') if (!target) return this.$message.error('请选择一级分类')
const params = { const params = {
categoryType: this.activeName, categoryType: this.activeName,
parentCategoryId: target.id, parentCategoryId: target.id,
parentCategoryName: target.categoryName parentCategoryName: target.categoryName
} }
if(row.id) { if (row.id) {
params.id = row.id params.id = row.id
params.name = row.categoryName params.name = row.categoryName
} }
const queryStr = encodeURIComponent(JSON.stringify(params)) const queryStr = encodeURIComponent(JSON.stringify(params))
this.$router.push({ path: `/category/add/`+queryStr,query: { $title: row.id ? '编辑二级分类' : '新增二级分类' }}) this.$router.push({path: `/category/add/` + queryStr, query: {$title: row.id ? '编辑二级分类' : '新增二级分类'}})
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.category-list-ctnr{ .category-list-ctnr {
.tabs{ .tabs {
margin-bottom: 16px; margin-bottom: 16px;
} }
.main-wrap{
.main-wrap {
background-color: #fff; background-color: #fff;
padding: 20px; padding: 20px;
} }
.more-brand{
.more-brand {
color: #5850FF; color: #5850FF;
cursor: pointer; cursor: pointer;
} }
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="case-ctnr">
<div class="main-wrap">
<div class="global-title">{{ formObj.id ? '编辑分类' : '新增分类' }}</div>
<glsx-combi-form :isInline="false" class="glsx-combi-form" ref="baseInfoRef" labelWidth="154px"
defaultWidth="432px" :formObj.sync="formObj" :formData="formData" :formRules="myRule">
<div slot="videoCoverSlot">
<glsx-preview :picOptions="posterOptions" :imageUrlArr="formObj.videoCoverArr"
@change="changeChannelImg"></glsx-preview>
<div class="text-tip" style="margin: 0;">建议尺寸:120*120</div>
</div>
<div slot="selectBrandSlot">
<el-radio-group v-model="formObj.categoryStyle">
<el-radio :label="0">标准商品-竖向排列
</el-radio>
<el-radio :label="1">标准商品-横向排列
</el-radio>
<el-radio :label="2">种草样式</el-radio>
</el-radio-group>
<div class="category-style">
<img src="@/assets/category/vertical.png">
<img src="@/assets/category/transverse.png">
<img src="@/assets/category/recommend.png">
</div>
</div>
</glsx-combi-form>
</div>
<GLFooter>
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleSave">确定</el-button>
</GLFooter>
</div>
</template>
<script>
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'add',
components: {
glsxCombiForm,
},
data() {
return {
dialogVisible: false,
formObj: {
id: '',
categoryName: '',
categoryStyle: 1,
videoCoverArr: []
},
brandList: [],
posterOptions: {
width: '120px',
height: '120px',
key: 'posterImg',
isClose: true
},
myRule: {
categoryName: [{required: true, message: '请输入分类名称', trigger: 'change'}],
categoryImage: [{
required: true, validator: (rule, value, callback) => {
if (this.formObj.videoCoverArr?.length != 1) {
callback(new Error(`请上传分类图标`))
} else {
callback()
}
}, trigger: 'change'
}],
categoryStyle: [{
required: true, validator: (rule, value, callback) => {
if (this.formObj.brandType == 'null') {
callback(new Error(`请选择布局样式`))
} else {
callback()
}
}, trigger: 'blur'
}],
},
formData: [
{
label: '分类名称',
name: 'categoryName',
maxlength: 20,
showLimit: true,
type: 'input',
isDisabled: false
},
{
label: '分类图标',
name: 'categoryImage',
addHtml: 'videoCoverSlot'
},
{
label: '布局样式',
name: 'categoryStyle',
addHtml: 'selectBrandSlot'
}
],
}
},
created() {
this.formObj.id = this.$route.query.id || ''
if (this.formObj.id) {
this.getCaseDetailApi()
}
},
methods: {
changeChannelImg(val) {
this.$refs.baseInfoRef.$refs.formRef.validateField('coverUrl')
},
handleSave() {
this.$refs.baseInfoRef.$refs.formRef.validate(valid => {
if (valid) {
let params = JSON.parse(JSON.stringify(this.formObj))
params.categoryType = 2 //类型 1 配置升级 2 车主优选
params.categoryLevel = 1 //分类等级(1:一级分类,2:二级分类)
params.categoryImage = this.formObj.videoCoverArr[0]
delete params.videoCoverArr
if (!params.id) delete params.id
this.$apis.category.addCategoryApi(params).then(res => {
console.log(res)
if (res) {
this.$message.success('操作成功')
this.handleCancel()
}
})
}
})
},
handleCancel() {
this.$router.back()
},
getCaseDetailApi() {
this.$apis.category.batchDetailApi({id: this.$route.query.id}).then(res => {
console.log(res)
if (res) {
const attrList = ['id', 'categoryName', 'categoryStyle']
attrList.forEach(key => {
this.formObj[key] = res[key]
})
this.formObj.videoCoverArr = [res.categoryImage]
}
})
}
}
}
</script>
<style scoped lang="scss">
.case-ctnr {
.glsx-combi-form {
padding: 20px;
background-color: #fff;
margin-bottom: 16px;
.brand-wrap {
margin-top: 8px;
width: 580px;
height: 80px;
background: #FFFFFF;
border: 1px solid #E8E8EA;
border-radius: 4px;
padding: 6px 8px;
overflow-y: auto;
.brand-item {
display: inline-block;
padding: 0 8px;
height: 24px;
color: #666666;
line-height: 24px;
background: #FAFBFE;
border: 1px solid #E5E5E5;
border-radius: 4px;
margin-right: 4px;
}
}
}
}
.category-style {
img {
width: 104px;
height: 102.6px;
margin-right: 65px;
}
}
</style>
<template>
<div class="owner-ctnr">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="tableSearchForm" :formData="searchFormData"
@handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
<div class="operate-wrap">
<span class="table-title"></span>
<el-button class="operate-btn" type="primary" size="small" @click="addClassify()">新建分类</el-button>
</div>
<GLTable ref="caseRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm"
:beforeSearchFn="beforeSearchFn" :tableParams="tableParams" :pageConf="pageConf"
@setTableFinishFun="setTableFinishFun">
<div slot="categoryImage" class="table-image" slot-scope="scope">
<el-popover placement="top" width="160" trigger="hover" popper-class="table-popover-block">
<img class="table-popover-img" :src="scope.scope.categoryImage"/>
<img class="img-36 pointer" slot="reference" :src="scope.scope.categoryImage"/>
</el-popover>
</div>
<div slot="categoryStyle" slot-scope="scope">
<div>{{
scope.scope.categoryStyle == 0 ? '竖向排列' : scope.scope.categoryStyle == 1 ? '横向排列' : scope.scope.categoryStyle == 2 ? '种草样式' : '--'
}}
</div>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
</div>
</template>
<script>
import url from 'assets/empty.png'
import bigView from 'components/big-view'
export default {
name: 'App',
components: {
// bigView
},
data() {
return {
tableSearchForm: {
// categoryType: 2,
// caseName: '',
// brandName: '',
// createDate: []
},
buttonList: [
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text',
fn: '编辑'
},
listeners: {
click: row => this.addClassify(row.scope, 0)
}
},
{
type: 'el-button',
name: '删除',
attrs: {
type: 'text',
fn: '删除'
},
listeners: {
click: row => this.delCate(row.scope)
}
}
],
searchForm: {},
url: url,
searchFormData: [
{
label: '分类名称',
name: 'categoryName',
type: 'input'
},
{
label: '创建日期',
name: 'createDate',
type: 'datePicker',
isClear: true,
// customPickerOptions: {
// disabledDate(date) {
// const yesterday = new Date(new Date().setDate(new Date().getDate()))
// if (date > yesterday) {
// return true
// }
// return false
// }
// }
},
],
getListApi: this.$apis.category.getCategoryListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '分类名称',
prop: 'categoryName'
},
{
label: '分类图标',
addHtml: 'categoryImage',
width: 150
},
{
label: '分类布局',
addHtml: 'categoryStyle'
},
{
label: '创建日期',
prop: 'createdDate'
},
{
label: '更新日期',
prop: 'updatedDate'
},
{
label: '操作人',
prop: 'updatedBy'
},
]
},
pageConf: {pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total'}
}
},
created() {
},
mounted() {
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.tableSearchForm))
params.categoryType = 2
params.categoryLevel = 1
if (this.tableSearchForm.createDate?.length) {
params.beginCreateTime = new Date(this.tableSearchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endCreateTime = new Date(this.tableSearchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = this.getParams()
delete this.searchForm.createDate
resolve()
})
},
handleSearch() {
this.$refs.caseRef.refreshTable()
},
handleReset() {
this.tableSearchForm = {
categoryName: '',
createDate: []
}
this.searchForm = {}
this.handleSearch()
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.caseRef.data.length ? (this.$refs.caseRef.tableHeightValues = '') : this.$refs.caseRef.setTableHeightFun()
},
addClassify(row = {}, type) {
this.$router.push({
path: `/category/ownerPreference/add?id=${row.id || ''}&$title=${type ? '编辑' : '新增'}分类`
})
},
delCate({id, caseName}) {
this.$confirm(`确定删除${caseName}吗`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis.category.delCategoryApi({id}).then(res => {
if (res) {
this.$message.success('删除成功')
this.handleSearch()
}
})
}
}
})
}
}
}
</script>
<style scoped lang="scss">
.owner-ctnr {
background-color: #fff;
padding: 20px;
.more-brand {
white-space: nowrap;
color: #5850FF;
cursor: pointer;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!