|
@@ -1,18 +1,20 @@
|
|
|
<template>
|
|
|
- <div class="app-container calendar-list-container exchangeView">
|
|
|
+ <div class="app-container calendar-list-container exchangeView" v-loading="loading" element-loading-text="数据生成中">
|
|
|
<!-- 查询和其他操作 -->
|
|
|
<div class="filter-container">
|
|
|
- <el-input clearable class="filter-item" style="width: 200px;" placeholder="勋章名称"
|
|
|
+ <el-input clearable class="filter-item" style="width: 200px" placeholder="勋章名称"
|
|
|
v-model="listQuery.name"></el-input>
|
|
|
- <el-input clearable class="filter-item" style="width: 200px;" placeholder="勋章类型"
|
|
|
+ <el-input clearable class="filter-item" style="width: 200px" placeholder="勋章类型"
|
|
|
v-model="listQuery.type"></el-input>
|
|
|
- <el-select v-model="listQuery.status" clearable placeholder="状态" style="top: -4px;width: 200px;">
|
|
|
+ <el-select v-model="listQuery.status" clearable placeholder="状态" style="top: -4px; width: 200px">
|
|
|
<el-option :key="item.dictValue" v-for="item in statusList" :label="item.dictLabel" :value="item.dictValue">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
|
|
|
<el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
|
|
|
+ <el-button class="filter-item" type="primary" icon="el-icon-refresh" @click="handleRefresh">立即生成</el-button>
|
|
|
<el-button class="filter-item" type="warning" icon="el-icon-delete" @click="delAll">批量删除</el-button>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
<!-- 查询结果 -->
|
|
@@ -25,10 +27,12 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" min-width="80px" label="勋章类型" prop="type">
|
|
|
<template slot-scope="scope">
|
|
|
- <router-link :to="{name: 'medalDataList', params: { id: scope.row.type }}">
|
|
|
- <div style="color: #337ab7;cursor: pointer;">{{ scope.row.type }}</div>
|
|
|
- </router-link>
|
|
|
- </template>
|
|
|
+ <router-link :to="{ name: 'medalDataList', params: { id: scope.row.type } }">
|
|
|
+ <div style="color: #337ab7; cursor: pointer">
|
|
|
+ {{ scope.row.type }}
|
|
|
+ </div>
|
|
|
+ </router-link>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" min-width="80px" label="状态" prop="statusName">
|
|
|
</el-table-column>
|
|
@@ -52,13 +56,10 @@
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
<!-- 添加或修改对话框 -->
|
|
|
- <el-dialog
|
|
|
- :close-on-click-modal="false"
|
|
|
- :title="textMap[dialogStatus]"
|
|
|
- :visible.sync="dialogFormVisible"
|
|
|
- width="40%"
|
|
|
- >
|
|
|
- <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="80px" style='width: 700px; margin-left:50px;'>
|
|
|
+ <el-dialog :close-on-click-modal="false" :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"
|
|
|
+ width="40%">
|
|
|
+ <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="80px"
|
|
|
+ style="width: 700px; margin-left: 50px">
|
|
|
<el-form-item label="勋章名称" prop="name">
|
|
|
<el-input v-model="dataForm.name" style="width: 330px"></el-input>
|
|
|
</el-form-item>
|
|
@@ -74,13 +75,11 @@
|
|
|
<el-form-item label="排序" prop="sort">
|
|
|
<el-input-number :precision="0" :step="1" v-model="dataForm.sort"></el-input-number>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
-
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
<el-button v-if="dialogStatus == 'create'" type="primary" @click="createData">确定</el-button>
|
|
|
- <el-button v-else type="primary" @click="updateData">确定</el-button>
|
|
|
+ <el-button v-else type="primary" @click="updateData">确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -96,7 +95,7 @@
|
|
|
}
|
|
|
|
|
|
.avatar-uploader .el-upload:hover {
|
|
|
- border-color: #409EFF;
|
|
|
+ border-color: #409eff;
|
|
|
}
|
|
|
|
|
|
.avatar-uploader-icon {
|
|
@@ -130,33 +129,46 @@
|
|
|
</style>
|
|
|
|
|
|
<script>
|
|
|
-import { list, updateItem, createItem, deleteitem } from "@/api/medalList";
|
|
|
+import {
|
|
|
+ list,
|
|
|
+ updateItem,
|
|
|
+ createItem,
|
|
|
+ deleteitem,
|
|
|
+ refresh,
|
|
|
+} from "@/api/medalList";
|
|
|
import { dataTypeList } from "@/api/public";
|
|
|
import waves from "@/directive/waves"; // 水波纹指令
|
|
|
-import Tinymce from '@/components/Tinymce'
|
|
|
+import Tinymce from "@/components/Tinymce";
|
|
|
|
|
|
export default {
|
|
|
components: { Tinymce },
|
|
|
directives: { waves },
|
|
|
data() {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
rules: {
|
|
|
- name: [{ required: true, message: "勋章名称不能为空", trigger: "blur" }],
|
|
|
- type: [{ required: true, message: "勋章名称不能为空", trigger: "blur" }],
|
|
|
- status: [{ required: true, message: "请选择勋章状态", trigger: "blur" }],
|
|
|
+ name: [
|
|
|
+ { required: true, message: "勋章名称不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ type: [
|
|
|
+ { required: true, message: "勋章名称不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ status: [
|
|
|
+ { required: true, message: "请选择勋章状态", trigger: "blur" },
|
|
|
+ ],
|
|
|
sort: [{ required: true, message: "排序不能为空", trigger: "blur" }],
|
|
|
},
|
|
|
- dialogStatus: '',
|
|
|
+ dialogStatus: "",
|
|
|
textMap: {
|
|
|
update: "编辑",
|
|
|
create: "创建",
|
|
|
},
|
|
|
dialogFormVisible: false,
|
|
|
dataForm: {
|
|
|
- name: '',
|
|
|
- type: '',
|
|
|
- status: '',
|
|
|
- sort: '',
|
|
|
+ name: "",
|
|
|
+ type: "",
|
|
|
+ status: "",
|
|
|
+ sort: "",
|
|
|
},
|
|
|
statusList: [],
|
|
|
list: [],
|
|
@@ -165,24 +177,35 @@ export default {
|
|
|
listQuery: {
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
- name: '',
|
|
|
- type: '',
|
|
|
- status: '',
|
|
|
-
|
|
|
+ name: "",
|
|
|
+ type: "",
|
|
|
+ status: "",
|
|
|
},
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
created() {
|
|
|
this.getStatusList();
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleRefresh() {
|
|
|
+ this.loading = true;
|
|
|
+ refresh().then((response) => {
|
|
|
+ this.$notify({
|
|
|
+ title: "成功",
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
resetForm() {
|
|
|
this.dataForm = {
|
|
|
- name: '',
|
|
|
- type: '',
|
|
|
- status: '',
|
|
|
- sort: '',
|
|
|
+ name: "",
|
|
|
+ type: "",
|
|
|
+ status: "",
|
|
|
+ sort: "",
|
|
|
};
|
|
|
},
|
|
|
handleCreate() {
|
|
@@ -196,94 +219,94 @@ export default {
|
|
|
createData() {
|
|
|
this.$refs["dataForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- createItem(this.dataForm)
|
|
|
- .then(() => {
|
|
|
- this.getList();
|
|
|
- this.dialogFormVisible = false;
|
|
|
+ createItem(this.dataForm).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.dialogFormVisible = false;
|
|
|
|
|
|
- this.$notify({
|
|
|
- title: "成功",
|
|
|
- message: "创建成功",
|
|
|
- type: "success",
|
|
|
- duration: 2000,
|
|
|
- });
|
|
|
- this.getList()
|
|
|
- })
|
|
|
+ this.$notify({
|
|
|
+ title: "成功",
|
|
|
+ message: "创建成功",
|
|
|
+ type: "success",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
getStatusList() {
|
|
|
- dataTypeList({ dictType: 'medal_status_option_select' }).then(response => {
|
|
|
- this.statusList = response.data.data;
|
|
|
- }).catch(() => { });
|
|
|
+ dataTypeList({ dictType: "medal_status_option_select" })
|
|
|
+ .then((response) => {
|
|
|
+ this.statusList = response.data.data;
|
|
|
+ })
|
|
|
+ .catch(() => { });
|
|
|
},
|
|
|
getList() {
|
|
|
- this.listLoading = true
|
|
|
- list(this.listQuery).then(response => {
|
|
|
- this.list = response.data.data.items
|
|
|
- this.total = response.data.data.total
|
|
|
- this.listLoading = false
|
|
|
- }).catch(() => { })
|
|
|
+ this.listLoading = true;
|
|
|
+ list(this.listQuery)
|
|
|
+ .then((response) => {
|
|
|
+ this.list = response.data.data.items;
|
|
|
+ this.total = response.data.data.total;
|
|
|
+ this.listLoading = false;
|
|
|
+ })
|
|
|
+ .catch(() => { });
|
|
|
},
|
|
|
handleFilter() {
|
|
|
- this.listQuery.page = 1
|
|
|
- this.getList()
|
|
|
+ this.listQuery.page = 1;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
handleSizeChange(val) {
|
|
|
- this.listQuery.limit = val
|
|
|
- this.getList()
|
|
|
+ this.listQuery.limit = val;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
|
- this.listQuery.page = val
|
|
|
- this.getList()
|
|
|
+ this.listQuery.page = val;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
handleUpdate(row) {
|
|
|
this.dataForm = Object.assign({}, row);
|
|
|
- this.dialogStatus = 'update'
|
|
|
- this.dialogFormVisible = true
|
|
|
+ this.dialogStatus = "update";
|
|
|
+ this.dialogFormVisible = true;
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs['dataForm'].clearValidate()
|
|
|
- })
|
|
|
+ this.$refs["dataForm"].clearValidate();
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
updateData() {
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
+ this.$refs["dataForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
updateItem(this.dataForm).then(() => {
|
|
|
- this.dialogFormVisible = false
|
|
|
+ this.dialogFormVisible = false;
|
|
|
this.$notify({
|
|
|
- title: '成功',
|
|
|
- message: '更新成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- this.getList()
|
|
|
- })
|
|
|
-
|
|
|
+ title: "成功",
|
|
|
+ message: "更新成功",
|
|
|
+ type: "success",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
handleDelete(row) {
|
|
|
-
|
|
|
- this.$confirm('确认删除吗?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- deleteitem({ ids: row.id }).then(response => {
|
|
|
- this.$notify({
|
|
|
- title: '成功',
|
|
|
- message: '删除成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- this.getList()
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
-
|
|
|
+ this.$confirm("确认删除吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
})
|
|
|
-
|
|
|
+ .then(() => {
|
|
|
+ deleteitem({ ids: row.id }).then((response) => {
|
|
|
+ this.$notify({
|
|
|
+ title: "成功",
|
|
|
+ message: "删除成功",
|
|
|
+ type: "success",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => { });
|
|
|
},
|
|
|
delAll() {
|
|
|
this.$confirm("确认删除吗?", "提示", {
|
|
@@ -323,8 +346,8 @@ export default {
|
|
|
handleSelectionChange(val) {
|
|
|
this.multipleSelection = val;
|
|
|
},
|
|
|
- }
|
|
|
-}
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
<style>
|
|
|
.ad-avatar-uploader .el-upload {
|
|
@@ -336,7 +359,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
.ad-avatar-uploader .el-upload:hover {
|
|
|
- border-color: #409EFF;
|
|
|
+ border-color: #409eff;
|
|
|
}
|
|
|
|
|
|
.ad-avatar-uploader-icon {
|