You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
5.6 KiB

3 years ago
<template>
<div class="main-content">
<div class="area-form">
<el-form :inline="true" size="default">
<el-form-item label="分组">
<el-select v-model="form.type" placeholder="请选择">
<el-option label="全部" :value="1"></el-option>
<el-option label="媒体评测" :value="2"></el-option>
<el-option label="产品宣传" :value="3"></el-option>
<el-option label="用户活动" :value="4"></el-option>
<el-option label="趣味互动" :value="5"></el-option>
</el-select>
</el-form-item>
<el-form-item label="车型">
<el-select v-model="form.series" placeholder="请选择">
<el-option label="全部" :value="1"></el-option>
<el-option label="车系1" :value="2"></el-option>
<el-option label="车系2" :value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="标签">
<el-input v-model="form.tag" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="confirm"> </el-button>
</el-form-item>
</el-form>
</div>
<div class="button-tab">
3 years ago
<el-button size="default" type="primary" @click="goRelease"></el-button>
<el-button size="default">批量删除</el-button>
3 years ago
</div>
<div class="area-table">
3 years ago
<el-table :data="tableData.data" size="default" border
@selection-change="handleSelect"
:header-cell-style="{background: '#EEE'}">
<el-table-column type="selection" width="55" />
<el-table-column prop="title" label="素材" width="360"></el-table-column>
3 years ago
<el-table-column prop="tag" label="标签" width="240">
<template #default="scope">
<el-tag style="margin-right: 8px" v-for="(item,index) in scope.row.tag" :key="index">
{{item == 1?'媒体评测':item == 2?'产品宣传':'其他'}}
</el-tag>
</template>
</el-table-column>
3 years ago
<el-table-column prop="set" label="分组" :formatter="statusFormatter"></el-table-column>
<el-table-column prop="series" label="车型" :formatter="statusFormatter"></el-table-column>
<el-table-column prop="info" label="描述"></el-table-column>
<el-table-column prop="time" label="上传时间"></el-table-column>
3 years ago
<el-table-column prop="action" label="操作" fixed="right" width="240">
<template #default="scope">
3 years ago
<el-link type="primary" @click="goEdit(scope.row.id)"></el-link>
<el-link type="danger" @click="singleDel(scope.row.id)" style="margin-left: 8px">删除</el-link>
3 years ago
</template>
</el-table-column>
</el-table>
<el-pagination
v-model:currentPage="pagination.current"
v-model:page-size="pagination.pageSize"
:page-sizes="[10, 20, 30, 40]"
background
layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total"
/>
</div>
</div>
</template>
<script>
3 years ago
import {defineComponent, reactive, watch, getCurrentInstance} from 'vue'
3 years ago
import {statusFormatter} from './config.js'
export default defineComponent({
name: 'v-questList',
setup() {
const form = reactive({
type: undefined,
series: undefined,
tag: ''
});
const tableData = reactive({
data: [],
});
3 years ago
const { proxy } = getCurrentInstance();
3 years ago
const pagination = reactive({
total: 0,
current: 1,
pageSize: 10
});
return {
3 years ago
form,proxy,
3 years ago
tableData,
pagination,
statusFormatter
}
},
mounted() {
this.getData();
watch(() => (this.pagination.pageSize), () => {
this.getData()
});
watch(() => (this.pagination.current), () => {
this.getData()
})
},
methods: {
getData() {
3 years ago
let obj = Object.assign({pageNum: this.pagination.current,pageSize: this.pagination.pageSize})
this.proxy.$post("/reference/list", obj).then(res => {
const data = res.data
this.tableData.data = data.records;
this.pagination.total = data.total
}).catch(() => {});
3 years ago
},
confirm() {
this.getData()
},
3 years ago
handleSelect(index) {
let arr = [];
index.forEach(ele => {
arr.push(ele.id)
})
console.log(arr)
},
3 years ago
goRelease() {
3 years ago
this.$router.push({ name: "MatUpload" })
3 years ago
},
goEdit(value) {
3 years ago
this.$router.push({ name: "MatUpload",params:{id:value}})
3 years ago
},
3 years ago
//删除
singleDel(id) {
this.$alert(
'是否删除'+id+'?', //文字
'删除', //标题
{type: 'warning'}
).then(() => {
this.$message.success('删除成功')
}).catch(() => {})
}
3 years ago
}
})
</script>
<style lang="less" scoped>
.area-table {
margin-top: 16px
}
</style>