优化pad点单设置
This commit is contained in:
parent
d9f97b6ddb
commit
8cf46745cd
|
|
@ -54,7 +54,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类名称" prop="categoryName"></el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<el-table-column label="操作" v-if="radio">
|
||||
<template v-slot="scope">
|
||||
<el-button type="primary" @click="selectHandle(scope.row)">选择</el-button>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -192,7 +192,18 @@ export default {
|
|||
},
|
||||
// 确认选择商品
|
||||
selectConfirmGoods(res) {
|
||||
this.$set(this.form.list, this.activeItem, { ...res[0] })
|
||||
// this.form.list = res
|
||||
const flag = this.form.list.filter(item => item.id == res[0].id)
|
||||
|
||||
if (flag.length) {
|
||||
this.$notify({
|
||||
title: '注意',
|
||||
message: '请勿重复添加',
|
||||
type: 'error'
|
||||
})
|
||||
} else {
|
||||
this.$set(this.form.list, this.activeItem, { ...res[0] })
|
||||
}
|
||||
},
|
||||
// 切换tab
|
||||
tabChange() {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,12 @@
|
|||
</el-input>
|
||||
</div>
|
||||
<div class="tree_wrap">
|
||||
<el-tree :data="treeData" node-key="id" highlight-current :props="{ label: 'name' }" default-expand-all
|
||||
@node-click="treeItemClick"></el-tree>
|
||||
<!-- <el-tree :data="treeData" node-key="id" highlight-current :props="{ label: 'name' }" default-expand-all
|
||||
@node-click="treeItemClick"></el-tree> -->
|
||||
<div class="item" :class="{ active: selectCatoryIndex == index }" v-for="(item, index) in treeData"
|
||||
:key="item.id" @click="treeItemClick(item, index)">
|
||||
{{ item.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table_wrap">
|
||||
|
|
@ -62,6 +66,7 @@ export default {
|
|||
query: {
|
||||
name: ''
|
||||
},
|
||||
selectCatoryIndex: 0,
|
||||
selectCatory: '',
|
||||
treeDataOrgin: [],
|
||||
treeData: [],
|
||||
|
|
@ -88,6 +93,12 @@ export default {
|
|||
this.treeData = this.treeDataOrgin.filter(item => {
|
||||
return item.name.includes(this.query.name)
|
||||
})
|
||||
|
||||
if (this.treeData.length) {
|
||||
this.selectCatoryIndex = 0
|
||||
this.selectCatory = this.treeData[this.selectCatoryIndex]
|
||||
this.getTableData()
|
||||
}
|
||||
},
|
||||
//表格拖拽
|
||||
tableDrag() {
|
||||
|
|
@ -147,7 +158,8 @@ export default {
|
|||
}
|
||||
},
|
||||
// 分类被点击
|
||||
treeItemClick(data) {
|
||||
treeItemClick(data, index) {
|
||||
this.selectCatoryIndex = index
|
||||
this.selectCatory = data
|
||||
this.tableData.page = 1
|
||||
this.getTableData()
|
||||
|
|
@ -164,6 +176,7 @@ export default {
|
|||
})
|
||||
this.treeDataOrgin = res.content
|
||||
this.treeData = res.content
|
||||
this.selectCatory = res.content[this.selectCatoryIndex]
|
||||
this.getTableData()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
|
@ -235,6 +248,22 @@ export default {
|
|||
width: 100%;
|
||||
height: calc(100% - 70px);
|
||||
overflow-y: auto;
|
||||
|
||||
.item {
|
||||
padding: 10px 15px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: #1890ff;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue