|
|
|
|
@ -17,7 +17,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<span style="margin-right:15px;display: inline-block;">类型 </span>
|
|
|
|
|
<el-radio-group @change="changeCategoryType" v-model="select.categoryType">
|
|
|
|
|
<el-radio-group @change="changeCategoryType" v-model="select.category_type_id">
|
|
|
|
|
<el-radio style="margin-right:5px" v-for="item in categoryTypeList" border
|
|
|
|
|
:label="item.id">{{item.title}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
@ -44,8 +44,8 @@
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<div style="margin-bottom:15px;">
|
|
|
|
|
<el-button @click="$refs['create'].setType('add'),
|
|
|
|
|
$refs['create'].setForm('type_id', select.categoryType),
|
|
|
|
|
<el-button v-if="select.category_type_id" @click="$refs['create'].setType('add'),
|
|
|
|
|
$refs['create'].setForm('type_id', select.category_type_id),
|
|
|
|
|
$refs['create'].setForm('year', select.year.toString()),
|
|
|
|
|
$refs['create'].show()" plain>新建{{select.year}}年{{select.categoryTypeName}}清单</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
@ -55,53 +55,67 @@
|
|
|
|
|
$refs['create'].setType('editor');
|
|
|
|
|
$refs['create'].show();
|
|
|
|
|
}" @destroyed="getList">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<Button v-if="row._type !== 'type'" size="small" type="primary" @click="$refs['create'].setId(row.id),
|
|
|
|
|
$refs['create'].setType('editor'),
|
|
|
|
|
$refs['create'].show();">编辑</Button>
|
|
|
|
|
</template>
|
|
|
|
|
<template #delete="{ row, column, $index }">
|
|
|
|
|
<el-popover width="180" v-if="row._type !== 'type'" :ref="`${column.id}-${$index}`" trigger="hover">
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<p style="padding-bottom: 10px;">确定要删除吗?</p>
|
|
|
|
|
<div style="text-align: right;margin: 0;">
|
|
|
|
|
<el-button size="mini" type="text" @click="$refs[`${column.id}-${$index}`].doClose()">取消</el-button>
|
|
|
|
|
<el-button type="primary" size="mini"
|
|
|
|
|
@click="$refs['xyTable'].deleteClick(row, 'delete')">确定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
|
|
|
|
<div style="margin-right: 6px;height: 100%;width: 100%;">
|
|
|
|
|
<Button type="error" size="small" @click="$refs[`${column.id}-${$index}`].doShow()">
|
|
|
|
|
删除
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
</template>
|
|
|
|
|
<template #pid="{ row }">
|
|
|
|
|
<Button size="small" type="primary" @click="createChild(row)">子栏目</Button>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column align='center' fixed="right" label="操作" width="220" header-align="center">
|
|
|
|
|
<template slot="header" slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini" @click="">整体克隆</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div style="display: flex;">
|
|
|
|
|
<Button v-if="scope.row._type !== 'type'" size="small" type="primary" @click="$refs['create'].setId(scope.row.id),
|
|
|
|
|
$refs['create'].setType('editor'),
|
|
|
|
|
$refs['create'].show();">编辑</Button>
|
|
|
|
|
<el-popover width="180" v-if="scope.row._type !== 'type'" :ref="`${scope.row.id}-${scope.$index}`" trigger="hover">
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<p style="padding-bottom: 10px;">确定要删除吗?</p>
|
|
|
|
|
<div style="text-align: right;margin: 0;">
|
|
|
|
|
<el-button size="mini" type="text" @click="$refs[`${scope.row.id}-${scope.$index}`].doClose()">取消</el-button>
|
|
|
|
|
<el-button type="primary" size="mini"
|
|
|
|
|
@click="$refs['xyTable'].deleteClick(scope.row, 'delete')">确定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template #reference>
|
|
|
|
|
<div style="margin-right: 6px;height: 100%;width: 100%;">
|
|
|
|
|
<Button type="error" size="small" @click="$refs[`${scope.row.id}-${scope.$index}`].doShow()">
|
|
|
|
|
删除
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
<Button size="small" type="primary" @click="createChild(scope.row)">子栏目</Button>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</xy-table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<create ref="create" :options="list" @refresh="getList"></create>
|
|
|
|
|
<categorySetting ref="categorySetting"></categorySetting>
|
|
|
|
|
<createRules ref="createRules"></createRules>
|
|
|
|
|
<createRules ref="createRules" @refresh="getList"></createRules>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
index,
|
|
|
|
|
destroy
|
|
|
|
|
} from "@/api/category"
|
|
|
|
|
import {
|
|
|
|
|
index as categoryType
|
|
|
|
|
} from "@/api/categoryType"
|
|
|
|
|
destroy,
|
|
|
|
|
categoryYears,
|
|
|
|
|
categoryTypes
|
|
|
|
|
} from "@/api/category"
|
|
|
|
|
import {
|
|
|
|
|
authMixin
|
|
|
|
|
} from "@/mixin/authMixin";
|
|
|
|
|
@ -126,8 +140,8 @@
|
|
|
|
|
yearList: [],
|
|
|
|
|
categoryTypeList:[],
|
|
|
|
|
select: {
|
|
|
|
|
year: parseInt(this.$moment().format('YYYY')),
|
|
|
|
|
categoryType:'',
|
|
|
|
|
year: '',
|
|
|
|
|
category_type_id:'',
|
|
|
|
|
categoryTypeName:''
|
|
|
|
|
},
|
|
|
|
|
isStartSelect: false,
|
|
|
|
|
@ -172,6 +186,11 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
>规则设置</el-button>
|
|
|
|
|
<div>{
|
|
|
|
|
row.rules.map(item=>{
|
|
|
|
|
return(<div>{item.start_at}~{item.end_at}不少于{item.quantity}条</div>)
|
|
|
|
|
})
|
|
|
|
|
}</div>
|
|
|
|
|
</div>)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -181,9 +200,10 @@
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
created() {
|
|
|
|
|
this.getPastYears()
|
|
|
|
|
this.getList()
|
|
|
|
|
this.yearList = this.getPastYears(5)
|
|
|
|
|
// this.yearList = this.getPastYears(5)
|
|
|
|
|
this.getCategoryType()
|
|
|
|
|
// this.select.year = this.$moment().format('YYYY')
|
|
|
|
|
},
|
|
|
|
|
@ -191,13 +211,10 @@
|
|
|
|
|
index,
|
|
|
|
|
destroy,
|
|
|
|
|
getCategoryType(){
|
|
|
|
|
categoryType({
|
|
|
|
|
page:1,
|
|
|
|
|
page_size:9999
|
|
|
|
|
}).then(res=>{
|
|
|
|
|
this.categoryTypeList = res.data
|
|
|
|
|
this.select.categoryType = res.data.length>0?res.data[0].id:''
|
|
|
|
|
this.select.categoryTypeName = res.data.length>0?res.data[0].title:''
|
|
|
|
|
categoryTypes().then(res=>{
|
|
|
|
|
this.categoryTypeList = res
|
|
|
|
|
// this.select.categoryType = res.data.length>0?res.data[0].id:''
|
|
|
|
|
// this.select.categoryTypeName = res.data.length>0?res.data[0].title:''
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
@ -213,6 +230,7 @@
|
|
|
|
|
this.select.categoryTypeName = item.title
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.getList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
@ -254,29 +272,34 @@
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getPastYears(years) {
|
|
|
|
|
const currentYear = new Date().getFullYear();
|
|
|
|
|
return Array.from({
|
|
|
|
|
length: years
|
|
|
|
|
}, (_, index) => currentYear - index);
|
|
|
|
|
getPastYears(years) {
|
|
|
|
|
categoryYears().then(res=>{
|
|
|
|
|
this.yearList = res.years
|
|
|
|
|
this.select.year = res.selected_year
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async getList() {
|
|
|
|
|
let res = await index({
|
|
|
|
|
year:this.select.year
|
|
|
|
|
year:this.select.year,
|
|
|
|
|
category_type_id:this.select.category_type_id
|
|
|
|
|
});
|
|
|
|
|
this.formatList(res);
|
|
|
|
|
this.list = res;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
createChild(row) {
|
|
|
|
|
createChild(row) {
|
|
|
|
|
let category_type_id = this.select.category_type_id
|
|
|
|
|
if(row.type_id){
|
|
|
|
|
category_type_id = row.type_id
|
|
|
|
|
}
|
|
|
|
|
if (row._type === 'type') {
|
|
|
|
|
this.$refs['create'].setForm('type_id', this.select.categoryType);
|
|
|
|
|
this.$refs['create'].setForm('type_id', category_type_id);
|
|
|
|
|
this.$refs['create'].setForm('pid', 0);
|
|
|
|
|
this.$refs['create'].setForm('year', this.select.year.toString());
|
|
|
|
|
this.$refs['create'].setType('add');
|
|
|
|
|
this.$refs['create'].show();
|
|
|
|
|
} else {
|
|
|
|
|
this.$refs['create'].setForm('type_id', this.select.categoryType);
|
|
|
|
|
this.$refs['create'].setForm('type_id', category_type_id);
|
|
|
|
|
this.$refs['create'].setForm('pid', row.id);
|
|
|
|
|
this.$refs['create'].setForm('year', this.select.year.toString());
|
|
|
|
|
this.$refs['create'].setType('add');
|
|
|
|
|
@ -285,7 +308,12 @@
|
|
|
|
|
},
|
|
|
|
|
createRules(row){
|
|
|
|
|
console.log(row)
|
|
|
|
|
this.$refs['createRules'].category_id = row.id
|
|
|
|
|
if(row._type==='type'){
|
|
|
|
|
this.$refs['createRules'].category_id = row._id
|
|
|
|
|
}else{
|
|
|
|
|
this.$refs['createRules'].category_id = row.id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$refs['createRules'].title = row.title;
|
|
|
|
|
this.$refs['createRules'].isShow = true;
|
|
|
|
|
}
|
|
|
|
|
|