|
@@ -3,28 +3,34 @@
|
|
|
<div class="app-container">
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="dialogVisible = true">新增</el-button>
|
|
|
+ <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
|
|
</el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="findpage"></right-toolbar>
|
|
|
</el-row>
|
|
|
<!-- 模板内容 -->
|
|
|
<el-table :data="tableData" style="width: 100%" v-loading="loading">
|
|
|
- <el-table-column align="center" prop="companyName" label="公司名称" width="180">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" prop="companyDesc" label="公司描述" width="180">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" prop="advertisingProbability" label="广告权重" width="180">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" prop="createTime" label="创建时间">
|
|
|
+ <el-table-column align="center" prop="typeName" label="奖品类型名称"></el-table-column>
|
|
|
+ <el-table-column align="center" prop="typeAttr" label="奖品字段属性">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.typeAttr }}</span>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column fixed="right" align="center" label="操作" width="200">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" size="small" @click="Marketupdate(scope.row)">编辑</el-button>
|
|
|
- <el-button @click="Marketdel(scope.row)" type="text" size="small" style="color: red;">删除</el-button>
|
|
|
+ <el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
|
|
+ <el-button @click="handleDelete(scope.row)" type="text" size="small" style="color: red;">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <pagination :total="pagetotal" :page.sync="pageRequest.pageNum" :limit.sync="pageRequest.pageSize"
|
|
|
- @pagination="MarketList" />
|
|
|
+ <!-- <pagination :total="pagetotal" :page.sync="pageRequest.pageNum" :limit.sync="pageRequest.pageSize"
|
|
|
+ @pagination="MarketList" /> -->
|
|
|
+ <pagination
|
|
|
+ v-show="pagetotal>0"
|
|
|
+ :total="pagetotal"
|
|
|
+ :page.sync="pageRequest.pageNum"
|
|
|
+ :limit.sync="pageRequest.pageSize"
|
|
|
+ @pagination="findpage"
|
|
|
+ />
|
|
|
<el-dialog :title="dilogtitle" :visible.sync="dialogVisible" width="1000px">
|
|
|
<el-form class="demo-ruleForm wrap-scrollbar scroll-style" :model="attributionform" ref="attributionform"
|
|
|
label-width="130px" size="small">
|
|
@@ -45,7 +51,7 @@
|
|
|
<el-input v-model="configureitem.attrKey" class="widths1" placeholder="请输入字段名"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="标签:">
|
|
|
- <el-input v-model="configureitem.atrName" class="widths1" placeholder="标签名"></el-input>
|
|
|
+ <el-input v-model="configureitem.attrName" class="widths1" placeholder="标签名"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="10">
|
|
@@ -64,7 +70,7 @@
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="configuration">新增配置</el-button>
|
|
|
- <el-button size="small" @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button size="small" @click="handleClose">取 消</el-button>
|
|
|
<el-button size="small" type="primary" @click="submitForm">提 交</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
@@ -76,7 +82,8 @@
|
|
|
import {
|
|
|
addAwardType,
|
|
|
updateAward,
|
|
|
- getAwardTypeList
|
|
|
+ getAwardTypeList,
|
|
|
+ delAwardType
|
|
|
} from "@/api/award/awardList"
|
|
|
|
|
|
export default {
|
|
@@ -90,6 +97,7 @@ export default {
|
|
|
pageNum: 1,
|
|
|
pageSize: 20,
|
|
|
},
|
|
|
+ showSearch: true,
|
|
|
loading: false,
|
|
|
tableData: [],
|
|
|
attributionform: {
|
|
@@ -107,22 +115,85 @@ export default {
|
|
|
},
|
|
|
// 生命周期函数
|
|
|
created() {
|
|
|
+ this.findpage()
|
|
|
},
|
|
|
// 方法函数
|
|
|
methods: {
|
|
|
+ // 删除
|
|
|
+ handleDelete(row) {
|
|
|
+ const awardName = row.typeName
|
|
|
+ this.$confirm('是否确认名称为"' + awardName + '"的奖品类型?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ delAwardType({id: row.id}).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ this.findpage()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.info('已取消删除')
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 编辑
|
|
|
+ handleEdit(row) {
|
|
|
+ this.attributionform = row
|
|
|
+ this.attributionform.typeAttr = row.typeAttr
|
|
|
+ this.dilogtitle = '编辑'
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ handleAdd() {
|
|
|
+ this.dilogtitle = '新增'
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
submitForm() {
|
|
|
- addAwardType(this.attributionform).then((res) => {
|
|
|
- if (res.code == "200") {
|
|
|
- this.$message({ message: "新增成功", type: "success" });
|
|
|
- this.findpage();
|
|
|
- this.dialogVisible = false;
|
|
|
- } else {
|
|
|
- this.$message({ message: res.msg, type: "success" });
|
|
|
- }
|
|
|
- });
|
|
|
+ if (this.attributionform.id) {
|
|
|
+ updateAward(this.attributionform).then((res) => {
|
|
|
+ if (res.code == "200") {
|
|
|
+ this.$message({ message: "修改成功", type: "success" });
|
|
|
+ this.findpage();
|
|
|
+ this.handleClose()
|
|
|
+ } else {
|
|
|
+ this.$message({ message: res.msg, type: "success" });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addAwardType(this.attributionform).then((res) => {
|
|
|
+ if (res.code == "200") {
|
|
|
+ this.$message({ message: "新增成功", type: "success" });
|
|
|
+ this.findpage();
|
|
|
+ this.handleClose()
|
|
|
+ } else {
|
|
|
+ this.$message({ message: res.msg, type: "success" });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
findpage(){
|
|
|
-
|
|
|
+ getAwardTypeList(this.pageRequest).then((res) => {
|
|
|
+ this.tableData = res.data.records
|
|
|
+ this.pagetotal = res.data.total
|
|
|
+ this.pageRequest.pageNum = res.data.current
|
|
|
+ this.pageRequest.pageSize = res.data.size
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.attributionform = {
|
|
|
+ typeAttr: [
|
|
|
+ {
|
|
|
+ attrKey: "",
|
|
|
+ atrName: "",
|
|
|
+ type: "",
|
|
|
+ value: "",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ typeName: "",
|
|
|
+ }
|
|
|
+ this.dialogVisible = false
|
|
|
},
|
|
|
removeDomain(item) {
|
|
|
var index = this.attributionform.typeAttr.indexOf(item);
|