Browse Source

1.0.0:新增反馈信息及图片类型后台管理界面

master
chengkun 4 years ago
parent
commit
1e4f04961e
  1. 2
      .env.development
  2. 2
      .env.production
  3. 2
      .env.staging
  4. 8
      package.json
  5. 54
      src/api/img/type.js
  6. 15
      src/router/index.js
  7. 8
      src/views/img/feedback/index.vue
  8. 315
      src/views/img/type/index.vue

2
.env.development

@ -1,5 +1,5 @@
# 页面标题
VUE_APP_TITLE = 若依管理系统
VUE_APP_TITLE = bnyer管理系统
# 开发环境配置
ENV = 'development'

2
.env.production

@ -1,5 +1,5 @@
# 页面标题
VUE_APP_TITLE = 若依管理系统
VUE_APP_TITLE = bnyer管理系统
# 生产环境配置
ENV = 'production'

2
.env.staging

@ -1,5 +1,5 @@
# 页面标题
VUE_APP_TITLE = 若依管理系统
VUE_APP_TITLE = bnyer管理系统
NODE_ENV = production

8
package.json

@ -1,8 +1,8 @@
{
"name": "ruoyi",
"version": "3.4.0",
"description": "若依管理系统",
"author": "若依",
"name": "bnyer",
"version": "1.0.0",
"description": "bnyer管理系统",
"author": "penny",
"license": "MIT",
"scripts": {
"dev": "vue-cli-service serve",

54
src/api/img/type.js

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 查询类型分页列表
export function listType(data) {
return request({
url: '/img/img/type/page',
method: 'post',
data: data
})
}
// 新增类型
export function addType(data) {
return request({
url: '/img/img/type/insert',
method: 'post' ,
data: data
})
}
// 修改类型
export function editType(data) {
return request({
url: '/img/img/type/update',
method: 'post' ,
data: data
})
}
// 删除类型
export function delType(ids) {
return request({
url: '/img/img/type/delete/' + ids,
method: 'delete'
})
}
// 获取类型详情
export function getTypeDetails(id) {
return request({
url: '/img/img/type/details/' + id,
method: 'get'
})
}
// 变更类型显示状态
export function changeStatus(data) {
return request({
url: '/img/img/type/changeStatus',
method: 'post' ,
data: data
})
}

15
src/router/index.js

@ -83,7 +83,20 @@ export const constantRoutes = [
path: 'index',
component: () => import('@/views/img/feedback'),
name: 'Feedback',
meta: { title: '反馈', icon: 'dashboard', affix: true }
meta: { title: '反馈信息', icon: 'dashboard', affix: true }
}
]
},
{
path: '/type',
component: Layout,
redirect: 'index',
children: [
{
path: 'index',
component: () => import('@/views/img/type'),
name: 'Feedback',
meta: { title: '图片类型', icon: 'dashboard', affix: true }
}
]
},

8
src/views/img/feedback/index.vue

@ -72,13 +72,13 @@
</el-table-column>
</el-table>
<!-- <pagination
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/> -->
/>
</el-row>
<!-- 详情对话框 -->
@ -101,7 +101,6 @@
<script>
import { listFeedback, getFeedbackDetails, delFeedback, changeStatus } from "@/api/img/feedback";
import { getToken } from "@/utils/auth";
export default {
name: "feedback",
@ -133,6 +132,8 @@ export default {
],
//
queryParams: {
pageNum: 1,
pageSize: 10,
source: undefined
},
//
@ -198,6 +199,7 @@ export default {
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */

315
src/views/img/type/index.vue

@ -0,0 +1,315 @@
<template>
<div class="app-container">
<el-row :gutter="20">
<!--类型搜索数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="类型名称" prop="typeName">
<el-input
v-model="queryParams.typeName"
placeholder="请输入类型名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否显示" prop="isShow">
<el-select v-model="queryParams.isShow" placeholder="是否显示" clearable>
<el-option
v-for="item in isShow"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['img:type:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['img:type:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="编号" align="center" key="id" prop="id" v-if="columns[0].visible" />
<el-table-column label="类型名称" align="center" key="typeName" prop="typeName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="是否显示" align="center" key="isShow" v-if="columns[2].visible">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
active-value="1"
inactive-value="0"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="排序" align="center" key="sort" prop="sort" v-if="columns[3].visible"/>
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[4].visible" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateTime" v-if="columns[5].visible" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
width="160"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['img:type:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['img:type:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<!-- 添加或修改图片类型对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="类型名称" prop="typeName">
<el-input v-model="form.typeName" placeholder="请输入类型名称" maxlength="30" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listType, addType, editType, delType, getTypeDetails, changeStatus } from "@/api/img/type";
export default {
name: "Type",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
typeList: null,
//
title: "",
//
open: false,
//
dateRange: [],
//
form: {},
defaultProps: {
children: "children",
label: "label"
},
isShow: [
{ value: 0, label: ``},
{ value: 1, label: ``}
],
//
queryParams: {
pageNum: 1,
pageSize: 10,
typeName: undefined,
isShow: undefined
},
//
columns: [
{ key: 0, label: `编号`, visible: true },
{ key: 1, label: `类型名称`, visible: true },
{ key: 2, label: `是否显示`, visible: true },
{ key: 3, label: `排序`, visible: true },
{ key: 4, label: `创建时间`, visible: true },
{ key: 5, label: `更新时间`, visible: true }
],
//
rules: {
typeName: [
{ required: true, message: "类型名称不能为空", trigger: "blur" },
{ min: 2, max: 20, message: '类型名称长度必须介于 2 和 20 之间', trigger: 'blur' }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询类型列表 */
getList() {
this.loading = true;
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.typeList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
this.queryParams.deptId = data.id;
this.handleQuery();
},
//
handleStatusChange(row) {
let text = row.isShow === "1" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '"id为:"' + row.id + '"类型吗?').then(function() {
let data = {
id: row.id,
status: row.isShow
}
return changeStatus(data);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.isShow = row.isShow === "0" ? "1" : "0";
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
typeName: undefined,
isShow: "1"
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加类型";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getTypeDetails(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改类型";
});
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
editType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除类型编号为"' + ids + '"的数据项?').then(function() {
return delType(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>
Loading…
Cancel
Save