|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="app-list-content">
|
|
<div class="app-list-content">
|
|
|
<x-crud class="liu-crud-wrap" @load="onLoad">
|
|
<x-crud class="liu-crud-wrap" @load="onLoad">
|
|
|
|
|
+
|
|
|
<template #slot-tabs>
|
|
<template #slot-tabs>
|
|
|
<el-tabs class="liu-tabs" type="border-card" v-model="tabIndex">
|
|
<el-tabs class="liu-tabs" type="border-card" v-model="tabIndex">
|
|
|
<el-tab-pane v-for="(item, index) in tabsData" :key="index" :label="item.text" :name="item.key" >
|
|
<el-tab-pane v-for="(item, index) in tabsData" :key="index" :label="item.text" :name="item.key" >
|
|
@@ -24,7 +25,7 @@
|
|
|
<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
<el-input ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeSort(scope.row)" ></el-input>
|
|
<el-input ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeSort(scope.row)" ></el-input>
|
|
|
</template>
|
|
</template>
|
|
|
- <!-- 排序 -->
|
|
|
|
|
|
|
+
|
|
|
<template #table-header-inTurn>
|
|
<template #table-header-inTurn>
|
|
|
<div class="set-sort">
|
|
<div class="set-sort">
|
|
|
<span>排序</span>
|
|
<span>排序</span>
|
|
@@ -34,7 +35,6 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <!-- 操作 -->
|
|
|
|
|
<template #slot-column-option="{scope}">
|
|
<template #slot-column-option="{scope}">
|
|
|
<template>
|
|
<template>
|
|
|
<el-popover placement="top" width="160" :ref="'popover-' + scope.row.id">
|
|
<el-popover placement="top" width="160" :ref="'popover-' + scope.row.id">
|
|
@@ -43,11 +43,17 @@
|
|
|
<el-button size="mini" type="text" @click="cancelDel(scope.row.id)">取消</el-button>
|
|
<el-button size="mini" type="text" @click="cancelDel(scope.row.id)">取消</el-button>
|
|
|
<el-button type="primary" size="mini" @click="confirmDel(scope.row)">确定</el-button>
|
|
<el-button type="primary" size="mini" @click="confirmDel(scope.row)">确定</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
- <el-button type="text" size="small" slot="reference">删除</el-button>
|
|
|
|
|
|
|
+ <el-button type="text" size="small" slot="reference">删除建议</el-button>
|
|
|
</el-popover>
|
|
</el-popover>
|
|
|
</template>
|
|
</template>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <template #slot-cp-class="{scope}">
|
|
|
|
|
+ <el-select size="mini" v-model="currentClassName" placeholder="请选分类" style="width:150px;margin-right:10px;" @change="getClass" clearable>
|
|
|
|
|
+ <el-option v-for="item in classData" :key="item.value" :label="item.name" :value="item.id"> </el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
</x-crud>
|
|
</x-crud>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -72,35 +78,41 @@ export default {
|
|
|
sort: {
|
|
sort: {
|
|
|
status: false,
|
|
status: false,
|
|
|
},
|
|
},
|
|
|
- catId: '',
|
|
|
|
|
addDialog: false,
|
|
addDialog: false,
|
|
|
itemClassList: [],
|
|
itemClassList: [],
|
|
|
unitList: [],
|
|
unitList: [],
|
|
|
- currentItemId: 0
|
|
|
|
|
|
|
+ currentItemId: 0,
|
|
|
|
|
+ currentClassName:'',
|
|
|
|
|
+ classData:[],
|
|
|
|
|
+ currentClassId:''
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed: {},
|
|
computed: {},
|
|
|
methods: {
|
|
methods: {
|
|
|
- //取消删除
|
|
|
|
|
|
|
+ getClass(e){
|
|
|
|
|
+ this.currentClassId = e
|
|
|
|
|
+ this.app.refresh({ catId: this.currentClassId })
|
|
|
|
|
+ },
|
|
|
cancelDel(id) {
|
|
cancelDel(id) {
|
|
|
this.$refs[`popover-` + id].doClose();
|
|
this.$refs[`popover-` + id].doClose();
|
|
|
},
|
|
},
|
|
|
- // 确定删除
|
|
|
|
|
confirmDel(item) {
|
|
confirmDel(item) {
|
|
|
this.$service.itemCatRelate.delRelate({ itemId: item.id }).then(res => {
|
|
this.$service.itemCatRelate.delRelate({ itemId: item.id }).then(res => {
|
|
|
this.$message.success('删除成功');
|
|
this.$message.success('删除成功');
|
|
|
this.$refs[`popover-` + item.id].doClose();
|
|
this.$refs[`popover-` + item.id].doClose();
|
|
|
- this.app.refresh()
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.app.refresh({ catId: this.currentClassId })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ getAllCatetory(){
|
|
|
|
|
+ this.$service.itemCat.getAllCat().then(res=>{
|
|
|
|
|
+ this.classData = res.list ? res.list : []
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
onLoad({ ctx, app }) {
|
|
onLoad({ ctx, app }) {
|
|
|
this.app = app;
|
|
this.app = app;
|
|
|
if (this.$route.query.catId) {
|
|
if (this.$route.query.catId) {
|
|
|
- this.catId = this.$route.query.catId;
|
|
|
|
|
- if (this.$route.query.name != '') {
|
|
|
|
|
- this.tabsData[0].text = this.$route.query.tabName;
|
|
|
|
|
- this.$forceUpdate();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.currentClassId = this.$route.query.catId;
|
|
|
|
|
+ this.currentClassName = this.$route.query.catName ? this.$route.query.catName : ''
|
|
|
}
|
|
}
|
|
|
ctx.service(this.$service.itemCatRelate)
|
|
ctx.service(this.$service.itemCatRelate)
|
|
|
.set('table', {
|
|
.set('table', {
|
|
@@ -165,22 +177,19 @@ export default {
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
.set('pagination', {
|
|
.set('pagination', {
|
|
|
- size: 50
|
|
|
|
|
|
|
+ size:20
|
|
|
})
|
|
})
|
|
|
.set('layout', [
|
|
.set('layout', [
|
|
|
['slot-tabs'],
|
|
['slot-tabs'],
|
|
|
- ['flex1', 'refresh-btn'],
|
|
|
|
|
|
|
+ ['slot-cp-class','flex1', 'refresh-btn'],
|
|
|
['data-table'],
|
|
['data-table'],
|
|
|
['flex1', 'pagination'],
|
|
['flex1', 'pagination'],
|
|
|
])
|
|
])
|
|
|
.done();
|
|
.done();
|
|
|
- app.refresh({ catId: this.catId });
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ app.refresh({ catId: this.currentClassId });
|
|
|
|
|
|
|
|
- refresh(params) {
|
|
|
|
|
- this.app.refresh(params);
|
|
|
|
|
|
|
+ this.getAllCatetory()
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
showSort(e) {
|
|
showSort(e) {
|
|
|
this.sort.status = true;
|
|
this.sort.status = true;
|
|
|
},
|
|
},
|
|
@@ -189,14 +198,10 @@ export default {
|
|
|
this.sort.status = false;
|
|
this.sort.status = false;
|
|
|
},
|
|
},
|
|
|
changeSort(d) {
|
|
changeSort(d) {
|
|
|
- this.$service.goods .sort({ inTurn: d.inTurn, id: d.id, })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- this.$message.success('修改成功')
|
|
|
|
|
- this.refresh()
|
|
|
|
|
- })
|
|
|
|
|
- .catch((err) => {
|
|
|
|
|
- this.$message.error(err)
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.$service.goods .sort({ inTurn: d.inTurn, id: d.id, }).then(() => {
|
|
|
|
|
+ this.$message.success('修改成功')
|
|
|
|
|
+ this.app.refresh({catId: this.currentClassId})
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|