Merge pull request 'v1.2' (#4) from develop into master
@ -0,0 +1,9 @@
|
||||
/* 改变主题色变量 */
|
||||
$--color-primary: #00c292 !default;
|
||||
$--color-success: #67c23a !default;
|
||||
$--color-warning: #e6a23c !default;
|
||||
$--color-danger: #f56c6c !default;
|
||||
$--color-info: #909399 !default;
|
||||
/* 改变 icon 字体路径变量,必需 */
|
||||
$--font-path: '~element-ui/lib/theme-chalk/fonts';
|
||||
@import "~element-ui/packages/theme-chalk/src/index";
|
@ -0,0 +1,47 @@
|
||||
.form-content {
|
||||
background: #ffffff;
|
||||
padding: 10px 10px 0 10px;
|
||||
}
|
||||
.table-content {
|
||||
background: #ffffff;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.pagination-content {
|
||||
margin-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
text-align: right;
|
||||
}
|
||||
.detail-form-content{
|
||||
background: #ffffff;
|
||||
padding: 10px;
|
||||
.el-input{
|
||||
min-width: 200px;
|
||||
max-width: 600px;
|
||||
}
|
||||
}
|
||||
.bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
}
|
||||
.login-form {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 350px;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
padding: 0 60px;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.h1 {
|
||||
margin-top: 80px;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.btn-login {
|
||||
margin-top: 50px;
|
||||
width: 100%;
|
||||
}
|
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 4.1 MiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 843 B |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<el-card class="box-card"> <!-- 定义卡片组件的样式类 -->
|
||||
<div slot="header" class="header"> <!-- 卡片头部内容 -->
|
||||
<span>{{title}}</span> <!-- 显示标题内容 -->
|
||||
<span>
|
||||
<el-tag size="small" :type="titleTag">{{titleUnit}}</el-tag> <!-- 显示标题标签 -->
|
||||
</span>
|
||||
</div>
|
||||
<div class="content"> <!-- 卡片主体内容 -->
|
||||
{{content}} <!-- 显示主要内容 -->
|
||||
<span class="unit">{{contentUnit}}</span> <!-- 显示内容单位 -->
|
||||
</div>
|
||||
<div class="bottom"> <!-- 卡片底部内容 -->
|
||||
<span>{{bottomTitle}}</span> <!-- 显示底部标题 -->
|
||||
<span>
|
||||
{{bottomContent}} <!-- 显示底部内容 -->
|
||||
<i :class="bottomIcon"></i> <!-- 显示底部图标 -->
|
||||
</span>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: [
|
||||
"title", // 标题文本
|
||||
"titleTag", // 标题标签的类型
|
||||
"titleUnit", // 标题标签的单位
|
||||
"content", // 主体内容文本
|
||||
"contentUnit", // 主体内容的单位
|
||||
"bottomTitle", // 底部标题文本
|
||||
"bottomContent", // 底部内容文本
|
||||
"bottomIcon" // 底部图标的类名
|
||||
]
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.box-card {
|
||||
margin-right: 10px; /* 设置卡片右侧外边距 */
|
||||
.header {
|
||||
display: flex; /* 使用弹性布局 */
|
||||
justify-content: space-between; /* 子元素两端对齐 */
|
||||
align-items: center; /* 子元素垂直居中对齐 */
|
||||
}
|
||||
.content {
|
||||
font-size: 30px; /* 设置字体大小 */
|
||||
font-weight: bold; /* 设置字体加粗 */
|
||||
color: #666; /* 设置字体颜色 */
|
||||
text-align: center; /* 文本居中对齐 */
|
||||
.unit {
|
||||
font-size: 16px; /* 设置单位字体大小 */
|
||||
}
|
||||
}
|
||||
.bottom {
|
||||
display: flex; /* 使用弹性布局 */
|
||||
justify-content: space-between; /* 子元素两端对齐 */
|
||||
align-items: center; /* 子元素垂直居中对齐 */
|
||||
margin-top: 10px; /* 设置顶部外边距 */
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<!-- 顶部导航栏 -->
|
||||
<el-header>
|
||||
<!-- 水平导航菜单 -->
|
||||
<el-menu
|
||||
background-color="#00c292" <!-- 设置背景颜色为绿色 -->
|
||||
text-color="#FFFFFF" <!-- 设置文字颜色为白色 -->
|
||||
active-text-color="#FFFFFF" <!-- 设置激活项的文字颜色为白色 -->
|
||||
mode="horizontal" <!-- 设置菜单模式为水平 -->
|
||||
>
|
||||
<!-- 左侧项目名称 -->
|
||||
<div class="fl title">{{this.$project.projectName}}</div> <!-- 显示项目名称 -->
|
||||
|
||||
<!-- 右侧退出登录区域 -->
|
||||
<div class="fr logout" style="display:flex;">
|
||||
<!-- 用户信息显示 -->
|
||||
<el-menu-item index="3">
|
||||
<div>{{this.$storage.get('role')}} {{this.$storage.get('adminName')}}</div> <!-- 显示用户角色和用户名 -->
|
||||
</el-menu-item>
|
||||
<!-- 退出登录按钮 -->
|
||||
<el-menu-item @click="onLogout" index="2">
|
||||
<div>退出登录</div> <!-- 点击时触发退出登录方法 -->
|
||||
</el-menu-item>
|
||||
</div>
|
||||
</el-menu>
|
||||
</el-header>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false, // 对话框是否可见
|
||||
ruleForm: {}, // 表单数据
|
||||
user: {} // 当前用户信息
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 页面加载完成后获取当前用户的会话信息
|
||||
this.$http({
|
||||
url: `${this.$storage.get("sessionTable")}/session`, // 获取会话表名并拼接URL
|
||||
method: "get" // 使用GET方法请求数据
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) { // 如果返回数据成功
|
||||
this.user = data.data; // 将用户数据赋值给user变量
|
||||
} else {
|
||||
this.$message.error(data.msg); // 否则显示错误信息
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
onLogout() {
|
||||
// 退出登录方法
|
||||
this.$storage.remove("Token"); // 移除存储中的Token
|
||||
this.$router.replace({ name: "login" }); // 路由跳转到登录页面
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 样式部分 */
|
||||
.el-header .fr {
|
||||
float: right; /* 设置右浮动 */
|
||||
}
|
||||
|
||||
.el-header .fl {
|
||||
float: left; /* 设置左浮动 */
|
||||
}
|
||||
|
||||
.el-header {
|
||||
width: 100%; /* 宽度占满父容器 */
|
||||
color: #333; /* 文字颜色 */
|
||||
text-align: center; /* 文本居中对齐 */
|
||||
line-height: 60px; /* 行高 */
|
||||
padding: 0; /* 去掉内边距 */
|
||||
z-index: 99; /* 设置层级 */
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 60px; /* 设置宽度 */
|
||||
height: 60px; /* 设置高度 */
|
||||
margin-left: 70px; /* 左侧外边距 */
|
||||
}
|
||||
|
||||
.avator {
|
||||
width: 40px; /* 设置宽度 */
|
||||
height: 40px; /* 设置高度 */
|
||||
background: #ffffff; /* 背景颜色为白色 */
|
||||
border-radius: 50%; /* 圆角设置为圆形 */
|
||||
}
|
||||
|
||||
.title {
|
||||
color: #ffffff; /* 文字颜色为白色 */
|
||||
font-size: 20px; /* 字体大小 */
|
||||
font-weight: bold; /* 字体加粗 */
|
||||
margin-left: 20px; /* 左侧外边距 */
|
||||
}
|
||||
</style>
|
@ -0,0 +1,309 @@
|
||||
<template>
|
||||
<!-- 主容器div -->
|
||||
<div class="addEdit-block">
|
||||
<!-- ElementUI表单组件 -->
|
||||
<el-form
|
||||
<!-- 表单类名 -->
|
||||
class="detail-form-content"
|
||||
<!-- 表单引用标识 -->
|
||||
ref="ruleForm"
|
||||
<!-- 数据模型绑定 -->
|
||||
:model="ruleForm"
|
||||
<!-- 验证规则 -->
|
||||
:rules="rules"
|
||||
<!-- 标签宽度 -->
|
||||
label-width="80px"
|
||||
<!-- 动态背景色 -->
|
||||
:style="{backgroundColor:addEditForm.addEditBoxColor}"
|
||||
>
|
||||
<!-- ElementUI布局行 -->
|
||||
<el-row>
|
||||
<!-- 布局列(合同编号) -->
|
||||
<el-col :span="12">
|
||||
<!-- 编辑模式输入项 -->
|
||||
<el-form-item class="input" v-if="type!='info'" label="合同编号" prop="hetongbianhao">
|
||||
<!-- 可编辑输入框 -->
|
||||
<el-input v-model="ruleForm.hetongbianhao"
|
||||
placeholder="合同编号" clearable :readonly="ro.hetongbianhao"></el-input>
|
||||
</el-form-item>
|
||||
<!-- 查看模式展示 -->
|
||||
<div v-else>
|
||||
<el-form-item class="input" label="合同编号" prop="hetongbianhao">
|
||||
<!-- 只读展示 -->
|
||||
<el-input v-model="ruleForm.hetongbianhao"
|
||||
placeholder="合同编号" readonly></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<!-- 房屋名称字段(结构同上) -->
|
||||
<el-col :span="12">
|
||||
<el-form-item class="input" v-if="type!='info'" label="房屋名称" prop="fangwumingcheng">
|
||||
<el-input v-model="ruleForm.fangwumingcheng"
|
||||
placeholder="房屋名称" clearable :readonly="ro.fangwumingcheng"></el-input>
|
||||
</el-form-item>
|
||||
<div v-else>
|
||||
<el-form-item class="input" label="房屋名称" prop="fangwumingcheng">
|
||||
<el-input v-model="ruleForm.fangwumingcheng"
|
||||
placeholder="房屋名称" readonly></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<!-- 其他字段按相同结构省略... -->
|
||||
|
||||
<!-- 图片上传区域 -->
|
||||
<el-col :span="24">
|
||||
<!-- 上传控件 -->
|
||||
<el-form-item class="upload" v-if="type!='info' && !ro.tupian" label="图片" prop="tupian">
|
||||
<!-- 自定义上传组件 -->
|
||||
<file-upload
|
||||
tip="点击上传图片"
|
||||
action="file/upload"
|
||||
:limit="3"
|
||||
:multiple="true"
|
||||
:fileUrls="ruleForm.tupian?ruleForm.tupian:''"
|
||||
@change="tupianUploadChange"
|
||||
></file-upload>
|
||||
</el-form-item>
|
||||
<!-- 图片预览 -->
|
||||
<div v-else>
|
||||
<el-form-item v-if="ruleForm.tupian" label="图片" prop="tupian">
|
||||
<!-- 循环显示图片 -->
|
||||
<img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in ruleForm.tupian.split(',')"
|
||||
:src="item" width="100" height="100">
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<!-- 报修日期字段 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item class="date" v-if="type!='info'" label="报修日期" prop="baoxiuriqi">
|
||||
<!-- 日期选择器 -->
|
||||
<el-date-picker
|
||||
format="yyyy 年 MM 月 dd 日"
|
||||
value-format="yyyy-MM-dd"
|
||||
v-model="ruleForm.baoxiuriqi"
|
||||
type="date"
|
||||
placeholder="报修日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<!-- 只读展示 -->
|
||||
<div v-else>
|
||||
<el-form-item class="input" v-if="ruleForm.baoxiuriqi" label="报修日期" prop="baoxiuriqi">
|
||||
<el-input v-model="ruleForm.baoxiuriqi"
|
||||
placeholder="报修日期" readonly></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<!-- 其他字段按相同结构省略... -->
|
||||
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮组 -->
|
||||
<el-form-item class="btn">
|
||||
<!-- 提交按钮 -->
|
||||
<el-button v-if="type!='info'" type="primary" class="btn-success" @click="onSubmit">提交</el-button>
|
||||
<!-- 取消按钮 -->
|
||||
<el-button v-if="type!='info'" class="btn-close" @click="back()">取消</el-button>
|
||||
<!-- 返回按钮 -->
|
||||
<el-button v-if="type=='info'" class="btn-close" @click="back()">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 导入验证工具函数
|
||||
import { isNumber,isIntNumer,isEmail,isPhone, isMobile,isURL,checkIdCard } from "@/utils/validate";
|
||||
export default {
|
||||
data() {
|
||||
let self = this;
|
||||
// 身份证验证函数
|
||||
var validateIdCard = (rule, value, callback) => {
|
||||
if(!value){
|
||||
callback();
|
||||
} else if (!checkIdCard(value)) {
|
||||
callback(new Error("请输入正确的身份证号码"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
// URL验证函数
|
||||
var validateUrl = (rule, value, callback) => {
|
||||
if(!value){
|
||||
callback();
|
||||
} else if (!isURL(value)) {
|
||||
callback(new Error("请输入正确的URL地址"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
// 手机号验证函数
|
||||
var validateMobile = (rule, value, callback) => {
|
||||
if(!value){
|
||||
callback();
|
||||
} else if (!isMobile(value)) {
|
||||
callback(new Error("请输入正确的手机号码"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
// ...其他验证函数省略
|
||||
|
||||
return {
|
||||
// 表单样式配置对象
|
||||
addEditForm: {"btnSaveFontColor":"#fff",...}, // 实际为完整样式对象
|
||||
id: '', // 记录ID
|
||||
type: '', // 操作类型
|
||||
ro:{ // 只读控制对象
|
||||
hetongbianhao : false,
|
||||
// ...其他字段只读状态
|
||||
},
|
||||
ruleForm: { // 表单数据对象
|
||||
hetongbianhao: '',
|
||||
// ...其他字段初始化
|
||||
},
|
||||
leixingOptions: [], // 下拉选项
|
||||
rules: { // 验证规则对象
|
||||
hetongbianhao: [],
|
||||
// ...其他字段规则
|
||||
}
|
||||
};
|
||||
},
|
||||
props: ["parent"], // 接收父组件参数
|
||||
computed: {}, // 计算属性
|
||||
created() { // 生命周期钩子
|
||||
this.addEditStyleChange()
|
||||
this.addEditUploadStyleChange()
|
||||
},
|
||||
methods: {
|
||||
// 文件下载方法
|
||||
download(file){
|
||||
window.open(`${file}`)
|
||||
},
|
||||
// 初始化方法
|
||||
init(id,type) {
|
||||
if (id) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
}
|
||||
// 根据类型加载数据
|
||||
if(this.type=='info'||this.type=='else'){
|
||||
this.info(id);
|
||||
}else if(this.type=='cross'){
|
||||
// 处理跨表关联数据
|
||||
}
|
||||
// 获取用户信息
|
||||
this.$http({
|
||||
url: `${this.$storage.get('sessionTable')}/session`,
|
||||
method: "get"
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
var json = data.data;
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
// 设置下拉选项
|
||||
this.leixingOptions = "水工,电工,木工".split(',')
|
||||
},
|
||||
// 获取详情数据
|
||||
info(id) {
|
||||
this.$http({
|
||||
url: `fangwubaoxiu/info/${id}`,
|
||||
method: "get"
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.ruleForm = data.data;
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
// 表单提交方法
|
||||
onSubmit() {
|
||||
this.$refs["ruleForm"].validate(valid => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: `fangwubaoxiu/${!this.ruleForm.id ? "save" : "update"}`,
|
||||
method: "post",
|
||||
data: this.ruleForm
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.parent.showFlag = true;
|
||||
this.parent.addOrUpdateFlag = false;
|
||||
this.parent.fangwubaoxiuCrossAddOrUpdateFlag = false;
|
||||
this.parent.search();
|
||||
this.parent.contentStyleChange();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取UUID
|
||||
getUUID () {
|
||||
return new Date().getTime();
|
||||
},
|
||||
// 返回列表页
|
||||
back() {
|
||||
this.parent.showFlag = true;
|
||||
this.parent.addOrUpdateFlag = false;
|
||||
this.parent.fangwubaoxiuCrossAddOrUpdateFlag = false;
|
||||
this.parent.contentStyleChange();
|
||||
},
|
||||
// 图片上传回调
|
||||
tupianUploadChange(fileUrls) {
|
||||
this.ruleForm.tupian = fileUrls;
|
||||
this.addEditUploadStyleChange()
|
||||
},
|
||||
// 动态样式更新
|
||||
addEditStyleChange() {
|
||||
this.$nextTick(() => {
|
||||
// 通过DOM操作设置各表单控件样式
|
||||
})
|
||||
},
|
||||
// 上传控件样式更新
|
||||
addEditUploadStyleChange() {
|
||||
this.$nextTick(() => {
|
||||
// 设置上传组件样式
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.editor{
|
||||
height: 500px; // 富文本高度
|
||||
& /deep/ .ql-container {
|
||||
height: 310px; // 内容区高度
|
||||
}
|
||||
}
|
||||
.amap-wrapper {
|
||||
width: 100%; // 地图容器
|
||||
height: 500px;
|
||||
}
|
||||
.search-box {
|
||||
position: absolute; // 定位搜索框
|
||||
}
|
||||
.addEdit-block {
|
||||
margin: -10px; // 容器外边距
|
||||
}
|
||||
.detail-form-content {
|
||||
padding: 12px; // 表单内边距
|
||||
}
|
||||
.btn .el-button {
|
||||
padding: 0; // 按钮内边距
|
||||
}
|
||||
</style>
|
@ -0,0 +1,813 @@
|
||||
<template>
|
||||
<!-- 主内容区域 -->
|
||||
<div class="main-content">
|
||||
<!-- 列表页显示区域 -->
|
||||
<div v-if="showFlag">
|
||||
<!-- 搜索框表单 -->
|
||||
<el-form :inline="true" :model="searchForm" class="form-content">
|
||||
<!-- 搜索框布局行 -->
|
||||
<el-row :gutter="20" class="slt" :style="{justifyContent:contents.searchBoxPosition=='1'?'flex-start':contents.searchBoxPosition=='2'?'center':'flex-end'}">
|
||||
<!-- 房屋名称搜索框 -->
|
||||
<el-form-item :label="contents.inputTitle == 1 ? '房屋名称' : ''">
|
||||
<!-- 前缀图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 1" prefix-icon="el-icon-search" v-model="searchForm.fangwumingcheng" placeholder="房屋名称" clearable></el-input>
|
||||
<!-- 后缀图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangwumingcheng" placeholder="房屋名称" clearable></el-input>
|
||||
<!-- 无图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangwumingcheng" placeholder="房屋名称" clearable></el-input>
|
||||
</el-form-item>
|
||||
<!-- 评分搜索框 -->
|
||||
<el-form-item :label="contents.inputTitle == 1 ? '评分' : ''">
|
||||
<!-- 前缀图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 1" prefix-icon="el-icon-search" v-model="searchForm.pingfen" placeholder="评分" clearable></el-input>
|
||||
<!-- 后缀图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.pingfen" placeholder="评分" clearable></el-input>
|
||||
<!-- 无图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.pingfen" placeholder="评分" clearable></el-input>
|
||||
</el-form-item>
|
||||
<!-- 房主账号搜索框 -->
|
||||
<el-form-item :label="contents.inputTitle == 1 ? '房主账号' : ''">
|
||||
<!-- 前缀图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 1" prefix-icon="el-icon-search" v-model="searchForm.fangzhuzhanghao" placeholder="房主账号" clearable></el-input>
|
||||
<!-- 后缀图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangzhuzhanghao" placeholder="房主账号" clearable></el-input>
|
||||
<!-- 无图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangzhuzhanghao" placeholder="房主账号" clearable></el-input>
|
||||
</el-form-item>
|
||||
<!-- 用户名搜索框 -->
|
||||
<el-form-item :label="contents.inputTitle == 1 ? '用户名' : ''">
|
||||
<!-- 前缀图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 1" prefix-icon="el-icon-search" v-model="searchForm.yonghuming" placeholder="用户名" clearable></el-input>
|
||||
<!-- 后缀图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.yonghuming" placeholder="用户名" clearable></el-input>
|
||||
<!-- 无图标搜索框 -->
|
||||
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.yonghuming" placeholder="用户名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<!-- 查询按钮 -->
|
||||
<el-form-item>
|
||||
<!-- 前缀图标查询按钮 -->
|
||||
<el-button v-if="contents.searchBtnIcon == 1 && contents.searchBtnIconPosition == 1" icon="el-icon-search" type="success" @click="search()">{{ contents.searchBtnFont == 1?'查询':'' }}</el-button>
|
||||
<!-- 后缀图标查询按钮 -->
|
||||
<el-button v-if="contents.searchBtnIcon == 1 && contents.searchBtnIconPosition == 2" type="success" @click="search()">{{ contents.searchBtnFont == 1?'查询':'' }}<i class="el-icon-search el-icon--right"/></el-button>
|
||||
<!-- 无图标查询按钮 -->
|
||||
<el-button v-if="contents.searchBtnIcon == 0" type="success" @click="search()">{{ contents.searchBtnFont == 1?'查询':'' }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<!-- 操作按钮区域 -->
|
||||
<el-row class="ad" :style="{justifyContent:contents.btnAdAllBoxPosition=='1'?'flex-start':contents.btnAdAllBoxPosition=='2'?'center':'flex-end'}">
|
||||
<el-form-item>
|
||||
<!-- 新增按钮 -->
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
|
||||
type="success"
|
||||
icon="el-icon-plus"
|
||||
@click="addOrUpdateHandler()"
|
||||
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
|
||||
<!-- 不同图标位置的新增按钮 -->
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 2"
|
||||
type="success"
|
||||
@click="addOrUpdateHandler()"
|
||||
>{{ contents.btnAdAllFont == 1?'新增':'' }}<i class="el-icon-plus el-icon--right" /></el-button>
|
||||
<!-- 无图标的新增按钮 -->
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','新增') && contents.btnAdAllIcon == 0"
|
||||
type="success"
|
||||
@click="addOrUpdateHandler()"
|
||||
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
|
||||
<!-- 删除按钮 -->
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','删除') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1 && contents.tableSelection"
|
||||
:disabled="dataListSelections.length <= 0"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="deleteHandler()"
|
||||
>{{ contents.btnAdAllFont == 1?'删除':'' }}</el-button>
|
||||
<!-- 不同图标位置的删除按钮 -->
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','删除') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 2 && contents.tableSelection"
|
||||
:disabled="dataListSelections.length <= 0"
|
||||
type="danger"
|
||||
@click="deleteHandler()"
|
||||
>{{ contents.btnAdAllFont == 1?'删除':'' }}<i class="el-icon-delete el-icon--right" /></el-button>
|
||||
<!-- 无图标的删除按钮 -->
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
|
||||
:disabled="dataListSelections.length <= 0"
|
||||
type="danger"
|
||||
@click="deleteHandler()"
|
||||
>{{ contents.btnAdAllFont == 1?'删除':'' }}</el-button>
|
||||
<!-- 统计报表按钮 -->
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','报表') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
|
||||
type="warning"
|
||||
icon="el-icon-s-data"
|
||||
@click="chartDialog()"
|
||||
>{{ contents.btnAdAllFont == 1?'统计报表':'' }}</el-button>
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','报表') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 2"
|
||||
type="warning"
|
||||
@click="chartDialog()"
|
||||
>{{ contents.btnAdAllFont == 1?'统计报表':'' }}<i class="el-icon-s-data el-icon--right" /></el-button>
|
||||
<el-button
|
||||
v-if="isAuth('fangwupingjia','报表') && contents.btnAdAllIcon == 0"
|
||||
type="warning"
|
||||
@click="chartDialog()"
|
||||
>{{ contents.btnAdAllFont == 1?'统计报表':'' }}</el-button>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- 数据表格内容区域 -->
|
||||
<div class="table-content">
|
||||
<!-- 数据表格 -->
|
||||
<el-table class="tables" :size="contents.tableSize" :show-header="contents.tableShowHeader"
|
||||
:header-row-style="headerRowStyle" :header-cell-style="headerCellStyle"
|
||||
:border="contents.tableBorder"
|
||||
:fit="contents.tableFit"
|
||||
:stripe="contents.tableStripe"
|
||||
:row-style="rowStyle"
|
||||
:cell-style="cellStyle"
|
||||
:style="{width: '100%',fontSize:contents.tableContentFontSize,color:contents.tableContentFontColor}"
|
||||
v-if="isAuth('fangwupingjia','查看')"
|
||||
:data="dataList"
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandler">
|
||||
<!-- 多选列 -->
|
||||
<el-table-column v-if="contents.tableSelection"
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<!-- 索引列 -->
|
||||
<el-table-column label="索引" v-if="contents.tableIndex" type="index" width="50" />
|
||||
<!-- 合同编号列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="hetongbianhao"
|
||||
header-align="center"
|
||||
label="合同编号">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.hetongbianhao}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 房屋名称列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="fangwumingcheng"
|
||||
header-align="center"
|
||||
label="房屋名称">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.fangwumingcheng}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 房屋类型列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="fangwuleixing"
|
||||
header-align="center"
|
||||
label="房屋类型">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.fangwuleixing}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 小区列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="xiaoqu"
|
||||
header-align="center"
|
||||
label="小区">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.xiaoqu}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 评分列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="pingfen"
|
||||
header-align="center"
|
||||
label="评分">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.pingfen}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 评价内容列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="pingjianeirong"
|
||||
header-align="center"
|
||||
label="评价内容">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.pingjianeirong}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 评价日期列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="pingjiariqi"
|
||||
header-align="center"
|
||||
label="评价日期">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.pingjiariqi}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 房主账号列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="fangzhuzhanghao"
|
||||
header-align="center"
|
||||
label="房主账号">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.fangzhuzhanghao}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 用户名列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="yonghuming"
|
||||
header-align="center"
|
||||
label="用户名">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.yonghuming}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 联系电话列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="lianxidianhua"
|
||||
header-align="center"
|
||||
label="联系电话">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.lianxidianhua}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 审核回复列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="shhf"
|
||||
header-align="center"
|
||||
label="审核回复">
|
||||
</el-table-column>
|
||||
<!-- 审核状态列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
prop="sfsh"
|
||||
header-align="center"
|
||||
label="审核状态">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-right:10px">{{scope.row.sfsh=='是'?'通过':'未通过'}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 审核操作列 -->
|
||||
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
|
||||
v-if="isAuth('fangwupingjia','审核')"
|
||||
prop="sfsh"
|
||||
header-align="center"
|
||||
label="审核">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-edit" size="small" @click="shDialog(scope.row)">审核</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 操作列 -->
|
||||
<el-table-column width="300" :align="contents.tableAlign"
|
||||
header-align="center"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<!-- 详情按钮 -->
|
||||
<el-button v-if="isAuth('fangwupingjia','查看') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="success" icon="el-icon-tickets" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'详情':'' }}</el-button>
|
||||
<el-button v-if="isAuth('fangwupingjia','查看') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'详情':'' }}<i class="el-icon-tickets el-icon--right" /></el-button>
|
||||
<el-button v-if="isAuth('fangwupingjia','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'详情':'' }}</el-button>
|
||||
<!-- 修改按钮 -->
|
||||
<el-button v-if="isAuth('fangwupingjia','修改') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="primary" icon="el-icon-edit" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'修改':'' }}</el-button>
|
||||
<el-button v-if="isAuth('fangwupingjia','修改') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'修改':'' }}<i class="el-icon-edit el-icon--right" /></el-button>
|
||||
<el-button v-if="isAuth('fangwupingjia','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'修改':'' }}</el-button>
|
||||
<!-- 删除按钮 -->
|
||||
<el-button v-if="isAuth('fangwupingjia','删除') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="danger" icon="el-icon-delete" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'删除':'' }}</el-button>
|
||||
<el-button v-if="isAuth('fangwupingjia','删除') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="danger" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'删除':'' }}<i class="el-icon-delete el-icon--right" /></el-button>
|
||||
<el-button v-if="isAuth('fangwupingjia','删除') && contents.tableBtnIcon == 0" type="danger" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'删除':'' }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<el-pagination
|
||||
clsss="pages"
|
||||
:layout="layouts"
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="Number(contents.pageEachNum)"
|
||||
:total="totalPage"
|
||||
:small="contents.pageStyle"
|
||||
class="pagination-content"
|
||||
:background="contents.pageBtnBG"
|
||||
:style="{textAlign:contents.pagePosition==1?'left':contents.pagePosition==2?'center':'right'}"
|
||||
></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 添加/修改页面 -->
|
||||
<add-or-update v-if="addOrUpdateFlag" :parent="this" ref="addOrUpdate"></add-or-update>
|
||||
|
||||
<!-- 审核对话框 -->
|
||||
<el-dialog
|
||||
title="审核"
|
||||
:visible.sync="sfshVisiable"
|
||||
width="50%">
|
||||
<el-form ref="form" :model="form" label-width="80px">
|
||||
<el-form-item label="审核状态">
|
||||
<el-select v-model="shForm.sfsh" placeholder="审核状态">
|
||||
<el-option label="通过" value="是"></el-option>
|
||||
<el-option label="不通过" value="否"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="内容">
|
||||
<el-input type="textarea" :rows="8" v-model="shForm.shhf"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="shDialog">取 消</el-button>
|
||||
<el-button type="primary" @click="shHandler">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 统计报表对话框 -->
|
||||
<el-dialog
|
||||
title="统计报表"
|
||||
:visible.sync="chartVisiable"
|
||||
width="800">
|
||||
<div id="pingfenChart" style="width:100%;height:600px;"></div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="chartDialog">返回</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from "./add-or-update";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 搜索文件数据
|
||||
searchForm: {
|
||||
key: ""
|
||||
},
|
||||
// 数据列表
|
||||
dataList: [],
|
||||
// 当前页码
|
||||
pageIndex: 1,
|
||||
// 每页条数
|
||||
pageSize: 10,
|
||||
// 总条数
|
||||
totalPage: 0,
|
||||
// 数据加载状态
|
||||
dataListLoading: false,
|
||||
// 多选数据
|
||||
dataListSelections: [],
|
||||
// 列表显示状态
|
||||
showFlag: true,
|
||||
// 审核对话框显示状态
|
||||
sfshVisiable: false,
|
||||
// 审核表单数据
|
||||
shForm: {},
|
||||
// 统计报表对话框显示状态
|
||||
chartVisiable: false,
|
||||
// 添加/修改页面显示状态
|
||||
addOrUpdateFlag: false,
|
||||
// 配置样式
|
||||
contents: { /* 配置参数 */ },
|
||||
// 分页布局
|
||||
layouts: '',
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
this.getDataList();
|
||||
this.contentStyleChange();
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
filters: {
|
||||
// HTML过滤器
|
||||
htmlfilter: function (val) {
|
||||
return val.replace(/<[^>]*>/g).replace(/undefined/g,'');
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
},
|
||||
methods: {
|
||||
// 样式更新方法
|
||||
contentStyleChange() {
|
||||
this.contentSearchStyleChange();
|
||||
this.contentBtnAdAllStyleChange();
|
||||
this.contentSearchBtnStyleChange();
|
||||
this.contentTableBtnStyleChange();
|
||||
this.contentPageStyleChange();
|
||||
},
|
||||
// 搜索功能区域样式更新
|
||||
contentSearchStyleChange() {
|
||||
this.$nextTick(()=>{
|
||||
document.querySelectorAll('.form-content .slt .el-input__inner').forEach(el=>{
|
||||
let textAlign = 'left';
|
||||
if(this.contents.inputFontPosition == 2) textAlign = 'center';
|
||||
if(this.contents.inputFontPosition == 3) textAlign = 'right';
|
||||
el.style.textAlign = textAlign;
|
||||
el.style.height = this.contents.inputHeight;
|
||||
el.style.lineHeight = this.contents.inputHeight;
|
||||
el.style.color = this.contents.inputFontColor;
|
||||
el.style.fontSize = this.contents.inputFontSize;
|
||||
el.style.borderWidth = this.contents.inputBorderWidth;
|
||||
el.style.borderStyle = this.contents.inputBorderStyle;
|
||||
el.style.borderColor = this.contents.inputBorderColor;
|
||||
el.style.borderRadius = this.contents.inputBorderRadius;
|
||||
el.style.backgroundColor = this.contents.inputBgColor;
|
||||
});
|
||||
if(this.contents.inputTitle) {
|
||||
document.querySelectorAll('.form-content .slt .el-form-item__label').forEach(el=>{
|
||||
el.style.color = this.contents.inputTitleColor;
|
||||
el.style.fontSize = this.contents.inputTitleSize;
|
||||
el.style.lineHeight = this.contents.inputHeight;
|
||||
});
|
||||
}
|
||||
setTimeout(()=>{
|
||||
document.querySelectorAll('.form-content .slt .el-input__prefix').forEach(el=>{
|
||||
el.style.color = this.contents.inputIconColor;
|
||||
el.style.lineHeight = this.contents.inputHeight;
|
||||
});
|
||||
document.querySelectorAll('.form-content .slt .el-input__suffix').forEach(el=>{
|
||||
el.style.color = this.contents.inputIconColor;
|
||||
el.style.lineHeight = this.contents.inputHeight;
|
||||
});
|
||||
document.querySelectorAll('.form-content .slt .el-input__icon').forEach(el=>{
|
||||
el.style.lineHeight = this.contents.inputHeight;
|
||||
});
|
||||
},10);
|
||||
});
|
||||
},
|
||||
// 搜索功能区域按钮样式更新
|
||||
contentSearchBtnStyleChange() {
|
||||
this.$nextTick(()=>{
|
||||
document.querySelectorAll('.form-content .slt .el-button--success').forEach(el=>{
|
||||
el.style.height = this.contents.searchBtnHeight;
|
||||
el.style.color = this.contents.searchBtnFontColor;
|
||||
el.style.fontSize = this.contents.searchBtnFontSize;
|
||||
el.style.borderWidth = this.contents.searchBtnBorderWidth;
|
||||
el.style.borderStyle = this.contents.searchBtnBorderStyle;
|
||||
el.style.borderColor = this.contents.searchBtnBorderColor;
|
||||
el.style.borderRadius = this.contents.searchBtnBorderRadius;
|
||||
el.style.backgroundColor = this.contents.searchBtnBgColor;
|
||||
});
|
||||
});
|
||||
},
|
||||
// 操作按钮区域样式更新
|
||||
contentBtnAdAllStyleChange() {
|
||||
this.$nextTick(()=>{
|
||||
document.querySelectorAll('.form-content .ad .el-button--success').forEach(el=>{
|
||||
el.style.height = this.contents.btnAdAllHeight;
|
||||
el.style.color = this.contents.btnAdAllAddFontColor;
|
||||
el.style.fontSize = this.contents.btnAdAllFontSize;
|
||||
el.style.borderWidth = this.contents.btnAdAllBorderWidth;
|
||||
el.style.borderStyle = this.contents.btnAdAllBorderStyle;
|
||||
el.style.borderColor = this.contents.btnAdAllBorderColor;
|
||||
el.style.borderRadius = this.contents.btnAdAllBorderRadius;
|
||||
el.style.backgroundColor = this.contents.btnAdAllAddBgColor;
|
||||
});
|
||||
document.querySelectorAll('.form-content .ad .el-button--danger').forEach(el=>{
|
||||
el.style.height = this.contents.btnAdAllHeight;
|
||||
el.style.color = this.contents.btnAdAllDelFontColor;
|
||||
el.style.fontSize = this.contents.btnAdAllFontSize;
|
||||
el.style.borderWidth = this.contents.btnAdAllBorderWidth;
|
||||
el.style.borderStyle = this.contents.btnAdAllBorderStyle;
|
||||
el.style.borderColor = this.contents.btnAdAllBorderColor;
|
||||
el.style.borderRadius = this.contents.btnAdAllBorderRadius;
|
||||
el.style.backgroundColor = this.contents.btnAdAllDelBgColor;
|
||||
});
|
||||
document.querySelectorAll('.form-content .ad .el-button--warning').forEach(el=>{
|
||||
el.style.height = this.contents.btnAdAllHeight;
|
||||
el.style.color = this.contents.btnAdAllWarnFontColor;
|
||||
el.style.fontSize = this.contents.btnAdAllFontSize;
|
||||
el.style.borderWidth = this.contents.btnAdAllBorderWidth;
|
||||
el.style.borderStyle = this.contents.btnAdAllBorderStyle;
|
||||
el.style.borderColor = this.contents.btnAdAllBorderColor;
|
||||
el.style.borderRadius = this.contents.btnAdAllBorderRadius;
|
||||
el.style.backgroundColor = this.contents.btnAdAllWarnBgColor;
|
||||
});
|
||||
});
|
||||
},
|
||||
// 表格样式更新
|
||||
rowStyle({ row, rowIndex}) {
|
||||
if (rowIndex % 2 == 1) {
|
||||
if(this.contents.tableStripe) {
|
||||
return {color:this.contents.tableStripeFontColor};
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
cellStyle({ row, rowIndex}) {
|
||||
if (rowIndex % 2 == 1) {
|
||||
if(this.contents.tableStripe) {
|
||||
return {backgroundColor:this.contents.tableStripeBgColor};
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
headerRowStyle({ row, rowIndex}) {
|
||||
return {color: this.contents.tableHeaderFontColor};
|
||||
},
|
||||
headerCellStyle({ row, rowIndex}) {
|
||||
return {backgroundColor: this.contents.tableHeaderBgColor};
|
||||
},
|
||||
// 表格按钮样式更新
|
||||
contentTableBtnStyleChange() {
|
||||
// 此处省略了样式更新代码
|
||||
},
|
||||
// 分页样式更新
|
||||
contentPageStyleChange() {
|
||||
let arr = [];
|
||||
if(this.contents.pageTotal) arr.push('total');
|
||||
if(this.contents.pageSizes) arr.push('sizes');
|
||||
if(this.contents.pagePrevNext){
|
||||
arr.push('prev');
|
||||
if(this.contents.pagePager) arr.push('pager');
|
||||
arr.push('next');
|
||||
}
|
||||
if(this.contents.pageJumper) arr.push('jumper');
|
||||
this.layouts = arr.join();
|
||||
this.contents.pageEachNum = 10;
|
||||
},
|
||||
// 统计报表对话框
|
||||
chartDialog() {
|
||||
this.chartVisiable = !this.chartVisiable;
|
||||
this.$nextTick(()=>{
|
||||
var pingfenChart = this.$echarts.init(document.getElementById("pingfenChart"),'macarons');
|
||||
this.$http({
|
||||
url: "group/fangwupingjia/pingfen",
|
||||
method: "get",
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
let res = data.data;
|
||||
let xAxis = [];
|
||||
let yAxis = [];
|
||||
let pArray = [];
|
||||
for(let i=0;i<res.length;i++){
|
||||
xAxis.push(res[i].pingfen);
|
||||
yAxis.push(res[i].total);
|
||||
pArray.push({
|
||||
value: res[i].total,
|
||||
name: res[i].pingfen
|
||||
});
|
||||
var option = {};
|
||||
option = {
|
||||
title: {
|
||||
text: '房屋评价',
|
||||
left: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{b} : {c} ({d}%)'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['50%', '60%'],
|
||||
data: pArray,
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
pingfenChart.setOption(option);
|
||||
window.onresize = function() {
|
||||
pingfenChart.resize();
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
// 初始化方法
|
||||
init () {
|
||||
this.pingfenOptions = "1,2,3,4,5".split(',');
|
||||
},
|
||||
// 查询方法
|
||||
search() {
|
||||
this.pageIndex = 1;
|
||||
this.getDataList();
|
||||
},
|
||||
// 获取数据列表方法
|
||||
getDataList() {
|
||||
this.dataListLoading = true;
|
||||
let params = {
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
sort: 'id',
|
||||
};
|
||||
if(this.searchForm.fangwumingcheng!='' && this.searchForm.fangwumingcheng!=undefined){
|
||||
params['fangwumingcheng'] = '%' + this.searchForm.fangwumingcheng + '%';
|
||||
}
|
||||
if(this.searchForm.pingfen!='' && this.searchForm.pingfen!=undefined){
|
||||
params['pingfen'] = '%' + this.searchForm.pingfen + '%';
|
||||
}
|
||||
if(this.searchForm.fangzhuzhanghao!='' && this.searchForm.fangzhuzhanghao!=undefined){
|
||||
params['fangzhuzhanghao'] = '%' + this.searchForm.fangzhuzhanghao + '%';
|
||||
}
|
||||
if(this.searchForm.yonghuming!='' && this.searchForm.yonghuming!=undefined){
|
||||
params['yonghuming'] = '%' + this.searchForm.yonghuming + '%';
|
||||
}
|
||||
this.$http({
|
||||
url: "fangwupingjia/page",
|
||||
method: "get",
|
||||
params: params
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list;
|
||||
this.totalPage = data.data.total;
|
||||
} else {
|
||||
this.dataList = [];
|
||||
this.totalPage = 0;
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
// 每页数变更处理方法
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val;
|
||||
this.pageIndex = 1;
|
||||
this.getDataList();
|
||||
},
|
||||
// 当前页变更处理方法
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val;
|
||||
this.getDataList();
|
||||
},
|
||||
// 多选变更处理方法
|
||||
selectionChangeHandler(val) {
|
||||
this.dataListSelections = val;
|
||||
},
|
||||
// 添加/修改处理方法
|
||||
addOrUpdateHandler(id,type) {
|
||||
this.showFlag = false;
|
||||
this.addOrUpdateFlag = true;
|
||||
this.crossAddOrUpdateFlag = false;
|
||||
if(type!='info'){
|
||||
type = 'else';
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id,type);
|
||||
});
|
||||
},
|
||||
// 审核对话框方法
|
||||
shDialog(row){
|
||||
this.sfshVisiable = !this.sfshVisiable;
|
||||
if(row){
|
||||
this.shForm = {
|
||||
hetongbianhao: row.hetongbianhao,
|
||||
fangwumingcheng: row.fangwumingcheng,
|
||||
fangwuleixing: row.fangwuleixing,
|
||||
xiaoqu: row.xiaoqu,
|
||||
pingfen: row.pingfen,
|
||||
pingjianeirong: row.pingjianeirong,
|
||||
pingjiariqi: row.pingjiariqi,
|
||||
fangzhuzhanghao: row.fangzhuzhanghao,
|
||||
yonghuming: row.yonghuming,
|
||||
lianxidianhua: row.lianxidianhua,
|
||||
sfsh: row.sfsh,
|
||||
shhf: row.shhf,
|
||||
id: row.id
|
||||
}
|
||||
}
|
||||
},
|
||||
// 审核处理方法
|
||||
shHandler(){
|
||||
this.$confirm(`确定操作?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: "fangwupingjia/update",
|
||||
method: "post",
|
||||
data: this.shForm
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList();
|
||||
this.shDialog();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
// 下载文件方法
|
||||
download(file){
|
||||
window.open(`${file}`);
|
||||
},
|
||||
// 删除处理方法
|
||||
deleteHandler(id) {
|
||||
var ids = id
|
||||
? [Number(id)]
|
||||
: this.dataListSelections.map(item => {
|
||||
return Number(item.id);
|
||||
});
|
||||
this.$confirm(`确定进行[${id ? "删除" : "批量删除"}]操作?`, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: "fangwupingjia/delete",
|
||||
method: "post",
|
||||
data: ids
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.search();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 搜索按钮区域样式 */
|
||||
.slt {
|
||||
margin: 0 !important;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* 操作按钮区域样式 */
|
||||
.ad {
|
||||
margin: 0 !important;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* 分页组件样式 */
|
||||
.pages {
|
||||
& /deep/ .el-pagination__sizes {
|
||||
& /deep/ .el-input__inner {
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 按钮间距调整 */
|
||||
.el-button+.el-button {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* 表格按钮样式 */
|
||||
.tables {
|
||||
& /deep/ .el-button--success {
|
||||
height: 40px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgba(196, 210, 244, 1);
|
||||
border-radius: 22px;
|
||||
background-color: rgba(171, 239, 239, 1);
|
||||
}
|
||||
|
||||
& /deep/ .el-button--primary {
|
||||
height: 40px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgba(196, 210, 244, 1);
|
||||
border-radius: 22px;
|
||||
background-color: rgba(240, 242, 124, 1);
|
||||
}
|
||||
|
||||
& /deep/ .el-button--danger {
|
||||
height: 40px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: rgba(196, 210, 244, 1);
|
||||
border-radius: 22px;
|
||||
background-color: rgba(244, 150, 150, 1);
|
||||
}
|
||||
|
||||
& /deep/ .el-button {
|
||||
margin: 4px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,175 @@
|
||||
import Vue from 'vue'; // 引入 Vue 核心库
|
||||
// 配置路由
|
||||
import VueRouter from 'vue-router'; // 引入 Vue Router 库
|
||||
Vue.use(VueRouter); // 使用 Vue Router 插件
|
||||
|
||||
// 1. 创建组件
|
||||
import Index from '@/views/index'; // 导入首页组件
|
||||
import Home from '@/views/home'; // 导入主页组件
|
||||
import Login from '@/views/login'; // 导入登录页组件
|
||||
import NotFound from '@/views/404'; // 导入 404 页面组件
|
||||
import UpdatePassword from '@/views/update-password'; // 导入修改密码页面组件
|
||||
import pay from '@/views/pay'; // 导入支付页面组件
|
||||
import register from '@/views/register'; // 导入注册页面组件
|
||||
import center from '@/views/center'; // 导入个人信息页面组件
|
||||
import fangwuleixing from '@/views/modules/fangwuleixing/list'; // 导入房屋类型列表页面组件
|
||||
import discussfangwuxinxi from '@/views/modules/discussfangwuxinxi/list'; // 导入房屋信息评论列表页面组件
|
||||
import news from '@/views/modules/news/list'; // 导入公告信息列表页面组件
|
||||
import weixiuchuli from '@/views/modules/weixiuchuli/list'; // 导入维修处理列表页面组件
|
||||
import storeup from '@/views/modules/storeup/list'; // 导入我的收藏管理列表页面组件
|
||||
import fangwupingjia from '@/views/modules/fangwupingjia/list'; // 导入房屋评价列表页面组件
|
||||
import fangwuxinxi from '@/views/modules/fangwuxinxi/list'; // 导入房屋信息列表页面组件
|
||||
import yuyuekanfang from '@/views/modules/yuyuekanfang/list'; // 导入预约看房列表页面组件
|
||||
import woyaodangfangzhu from '@/views/modules/woyaodangfangzhu/list'; // 导入我要当房主列表页面组件
|
||||
import fangzhu from '@/views/modules/fangzhu/list'; // 导入房主列表页面组件
|
||||
import yonghu from '@/views/modules/yonghu/list'; // 导入用户列表页面组件
|
||||
import discusswoyaodangfangzhu from '@/views/modules/discusswoyaodangfangzhu/list'; // 导入我要当房主评论列表页面组件
|
||||
import fangwubaoxiu from '@/views/modules/fangwubaoxiu/list'; // 导入房屋报修列表页面组件
|
||||
import hetongxinxi from '@/views/modules/hetongxinxi/list'; // 导入合同信息列表页面组件
|
||||
import messages from '@/views/modules/messages/list'; // 导入留言板管理列表页面组件
|
||||
import config from '@/views/modules/config/list'; // 导入轮播图管理列表页面组件
|
||||
|
||||
// 2. 配置路由 注意:名字
|
||||
const routes = [ // 定义路由规则数组
|
||||
{
|
||||
path: '/index', // 路由路径
|
||||
name: '首页', // 路由名称
|
||||
component: Index, // 对应的组件
|
||||
children: [ // 子路由
|
||||
{
|
||||
path: '/', // 默认子路径
|
||||
name: '首页', // 子路由名称
|
||||
component: Home, // 对应的子组件
|
||||
meta: { icon: '', title: 'center' } // 元信息,包含图标和标题
|
||||
},
|
||||
{
|
||||
path: '/updatePassword', // 修改密码页面路径
|
||||
name: '修改密码', // 路由名称
|
||||
component: UpdatePassword, // 对应的组件
|
||||
meta: { icon: '', title: 'updatePassword' } // 元信息
|
||||
},
|
||||
{
|
||||
path: '/pay', // 支付页面路径
|
||||
name: '支付', // 路由名称
|
||||
component: pay, // 对应的组件
|
||||
meta: { icon: '', title: 'pay' } // 元信息
|
||||
},
|
||||
{
|
||||
path: '/center', // 个人信息页面路径
|
||||
name: '个人信息', // 路由名称
|
||||
component: center, // 对应的组件
|
||||
meta: { icon: '', title: 'center' } // 元信息
|
||||
},
|
||||
{
|
||||
path: '/fangwuleixing', // 房屋类型页面路径
|
||||
name: '房屋类型', // 路由名称
|
||||
component: fangwuleixing // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/discussfangwuxinxi', // 房屋信息评论页面路径
|
||||
name: '房屋信息评论', // 路由名称
|
||||
component: discussfangwuxinxi // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/news', // 公告信息页面路径
|
||||
name: '公告信息', // 路由名称
|
||||
component: news // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/weixiuchuli', // 维修处理页面路径
|
||||
name: '维修处理', // 路由名称
|
||||
component: weixiuchuli // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/storeup', // 我的收藏管理页面路径
|
||||
name: '我的收藏管理', // 路由名称
|
||||
component: storeup // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/fangwupingjia', // 房屋评价页面路径
|
||||
name: '房屋评价', // 路由名称
|
||||
component: fangwupingjia // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/fangwuxinxi', // 房屋信息页面路径
|
||||
name: '房屋信息', // 路由名称
|
||||
component: fangwuxinxi // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/yuyuekanfang', // 预约看房页面路径
|
||||
name: '预约看房', // 路由名称
|
||||
component: yuyuekanfang // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/woyaodangfangzhu', // 我要当房主页面路径
|
||||
name: '我要当房主', // 路由名称
|
||||
component: woyaodangfangzhu // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/fangzhu', // 房主页面路径
|
||||
name: '房主', // 路由名称
|
||||
component: fangzhu // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/yonghu', // 用户页面路径
|
||||
name: '用户', // 路由名称
|
||||
component: yonghu // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/discusswoyaodangfangzhu', // 我要当房主评论页面路径
|
||||
name: '我要当房主评论', // 路由名称
|
||||
component: discusswoyaodangfangzhu // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/fangwubaoxiu', // 房屋报修页面路径
|
||||
name: '房屋报修', // 路由名称
|
||||
component: fangwubaoxiu // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/hetongxinxi', // 合同信息页面路径
|
||||
name: '合同信息', // 路由名称
|
||||
component: hetongxinxi // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/messages', // 留言板管理页面路径
|
||||
name: '留言板管理', // 路由名称
|
||||
component: messages // 对应的组件
|
||||
},
|
||||
{
|
||||
path: '/config', // 轮播图管理页面路径
|
||||
name: '轮播图管理', // 路由名称
|
||||
component: config // 对应的组件
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/login', // 登录页面路径
|
||||
name: 'login', // 路由名称
|
||||
component: Login, // 对应的组件
|
||||
meta: { icon: '', title: 'login' } // 元信息
|
||||
},
|
||||
{
|
||||
path: '/register', // 注册页面路径
|
||||
name: 'register', // 路由名称
|
||||
component: register, // 对应的组件
|
||||
meta: { icon: '', title: 'register' } // 元信息
|
||||
},
|
||||
{
|
||||
path: '/', // 默认跳转路径
|
||||
name: '首页', // 路由名称
|
||||
redirect: '/index' // 重定向到 /index
|
||||
}, /* 默认跳转路由 */
|
||||
{
|
||||
path: '*', // 匹配所有未定义的路径
|
||||
component: NotFound // 对应的组件为 404 页面
|
||||
}
|
||||
];
|
||||
|
||||
// 3. 实例化 VueRouter 注意:名字
|
||||
const router = new VueRouter({ // 创建 VueRouter 实例
|
||||
mode: 'hash', // 使用 hash 模式
|
||||
/* hash模式改为history */
|
||||
routes // 将路由规则传递给 VueRouter
|
||||
});
|
||||
|
||||
export default router; // 导出路由实例
|
@ -0,0 +1,324 @@
|
||||
const menu = { // 定义一个 menu 对象,用于存储菜单数据和方法
|
||||
list() { // 定义 list 方法,返回菜单数据
|
||||
return [ // 返回一个包含角色及其对应菜单的数组
|
||||
{ // 第一个角色:管理员
|
||||
backMenu: [ // 后台菜单列表
|
||||
{ // 用户管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["新增", "查看", "修改", "删除"], // 按钮权限
|
||||
menu: "用户", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "yonghu" // 数据表名
|
||||
}],
|
||||
menu: "用户管理" // 父菜单名称
|
||||
},
|
||||
{ // 房主管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["新增", "查看", "修改", "删除"], // 按钮权限
|
||||
menu: "房主", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangzhu" // 数据表名
|
||||
}],
|
||||
menu: "房主管理" // 父菜单名称
|
||||
},
|
||||
{ // 房屋类型管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["新增", "查看", "修改", "删除"], // 按钮权限
|
||||
menu: "房屋类型", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwuleixing" // 数据表名
|
||||
}],
|
||||
menu: "房屋类型管理" // 父菜单名称
|
||||
},
|
||||
{ // 房屋信息管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["新增", "查看", "修改", "删除", "查看评论"], // 按钮权限
|
||||
menu: "房屋信息", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwuxinxi" // 数据表名
|
||||
}],
|
||||
menu: "房屋信息管理" // 父菜单名称
|
||||
},
|
||||
{ // 预约看房管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "删除", "审核", "合同"], // 按钮权限
|
||||
menu: "预约看房", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "yuyuekanfang" // 数据表名
|
||||
}],
|
||||
menu: "预约看房管理" // 父菜单名称
|
||||
},
|
||||
{ // 合同信息管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "删除"], // 按钮权限
|
||||
menu: "合同信息", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "hetongxinxi" // 数据表名
|
||||
}],
|
||||
menu: "合同信息管理" // 父菜单名称
|
||||
},
|
||||
{ // 房屋报修管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "删除", "审核", "处理"], // 按钮权限
|
||||
menu: "房屋报修", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwubaoxiu" // 数据表名
|
||||
}],
|
||||
menu: "房屋报修管理" // 父菜单名称
|
||||
},
|
||||
{ // 维修处理管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "删除"], // 按钮权限
|
||||
menu: "维修处理", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "weixiuchuli" // 数据表名
|
||||
}],
|
||||
menu: "维修处理管理" // 父菜单名称
|
||||
},
|
||||
{ // 房屋评价管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "删除", "审核", "报表"], // 按钮权限
|
||||
menu: "房屋评价", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwupingjia" // 数据表名
|
||||
}],
|
||||
menu: "房屋评价管理" // 父菜单名称
|
||||
},
|
||||
{ // 我要当房主管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "审核", "删除", "修改"], // 按钮权限
|
||||
menu: "我要当房主", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "woyaodangfangzhu" // 数据表名
|
||||
}],
|
||||
menu: "我要当房主管理" // 父菜单名称
|
||||
},
|
||||
{ // 留言板管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "回复", "删除"], // 按钮权限
|
||||
menu: "留言板管理", // 菜单名称
|
||||
tableName: "messages" // 数据表名
|
||||
}],
|
||||
menu: "留言板管理" // 父菜单名称
|
||||
},
|
||||
{ // 系统管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["新增", "查看", "修改", "删除"], // 按钮权限
|
||||
menu: "公告信息", // 菜单名称
|
||||
tableName: "news" // 数据表名
|
||||
}, {
|
||||
buttons: ["新增", "查看", "修改", "删除"], // 按钮权限
|
||||
menu: "轮播图管理", // 菜单名称
|
||||
tableName: "config" // 数据表名
|
||||
}],
|
||||
menu: "系统管理" // 父菜单名称
|
||||
}
|
||||
],
|
||||
frontMenu: [ // 前台菜单列表
|
||||
{ // 房屋信息模块
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "预约"], // 按钮权限
|
||||
menu: "房屋信息列表", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwuxinxi" // 数据表名
|
||||
}],
|
||||
menu: "房屋信息模块" // 父菜单名称
|
||||
},
|
||||
{ // 我要当房主模块
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "我要当房主列表", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "woyaodangfangzhu" // 数据表名
|
||||
}],
|
||||
menu: "我要当房主模块" // 父菜单名称
|
||||
}
|
||||
],
|
||||
hasBackLogin: "是", // 是否有后台登录功能
|
||||
hasBackRegister: "否", // 是否有后台注册功能
|
||||
hasFrontLogin: "否", // 是否有前台登录功能
|
||||
hasFrontRegister: "否", // 是否有前台注册功能
|
||||
roleName: "管理员", // 角色名称
|
||||
tableName: "users" // 数据表名
|
||||
},
|
||||
{ // 第二个角色:用户
|
||||
backMenu: [ // 后台菜单列表
|
||||
{ // 预约看房管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "删除"], // 按钮权限
|
||||
menu: "预约看房", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "yuyuekanfang" // 数据表名
|
||||
}],
|
||||
menu: "预约看房管理" // 父菜单名称
|
||||
},
|
||||
{ // 合同信息管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "审核", "支付", "报修", "评价"], // 按钮权限
|
||||
menu: "合同信息", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "hetongxinxi" // 数据表名
|
||||
}],
|
||||
menu: "合同信息管理" // 父菜单名称
|
||||
},
|
||||
{ // 房屋报修管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "删除", "审核", "处理"], // 按钮权限
|
||||
menu: "房屋报修", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwubaoxiu" // 数据表名
|
||||
}],
|
||||
menu: "房屋报修管理" // 父菜单名称
|
||||
},
|
||||
{ // 维修处理管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "维修处理", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "weixiuchuli" // 数据表名
|
||||
}],
|
||||
menu: "维修处理管理" // 父菜单名称
|
||||
},
|
||||
{ // 房屋评价管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "修改", "删除"], // 按钮权限
|
||||
menu: "房屋评价", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwupingjia" // 数据表名
|
||||
}],
|
||||
menu: "房屋评价管理" // 父菜单名称
|
||||
},
|
||||
{ // 我要当房主管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["新增", "查看", "修改", "删除", "审核", "查看评论"], // 按钮权限
|
||||
menu: "我要当房主", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "woyaodangfangzhu" // 数据表名
|
||||
}],
|
||||
menu: "我要当房主管理" // 父菜单名称
|
||||
},
|
||||
{ // 我的收藏管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "删除"], // 按钮权限
|
||||
menu: "我的收藏管理", // 菜单名称
|
||||
tableName: "storeup" // 数据表名
|
||||
}],
|
||||
menu: "我的收藏管理" // 父菜单名称
|
||||
}
|
||||
],
|
||||
frontMenu: [ // 前台菜单列表
|
||||
{ // 房屋信息模块
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "预约"], // 按钮权限
|
||||
menu: "房屋信息列表", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwuxinxi" // 数据表名
|
||||
}],
|
||||
menu: "房屋信息模块" // 父菜单名称
|
||||
},
|
||||
{ // 我要当房主模块
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "我要当房主列表", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "woyaodangfangzhu" // 数据表名
|
||||
}],
|
||||
menu: "我要当房主模块" // 父菜单名称
|
||||
}
|
||||
],
|
||||
hasBackLogin: "是", // 是否有后台登录功能
|
||||
hasBackRegister: "否", // 是否有后台注册功能
|
||||
hasFrontLogin: "是", // 是否有前台登录功能
|
||||
hasFrontRegister: "是", // 是否有前台注册功能
|
||||
roleName: "用户", // 角色名称
|
||||
tableName: "yonghu" // 数据表名
|
||||
},
|
||||
{ // 第三个角色:房主
|
||||
backMenu: [ // 后台菜单列表
|
||||
{ // 房屋信息管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "房屋信息", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwuxinxi" // 数据表名
|
||||
}],
|
||||
menu: "房屋信息管理" // 父菜单名称
|
||||
},
|
||||
{ // 预约看房管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "预约看房", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "yuyuekanfang" // 数据表名
|
||||
}],
|
||||
menu: "预约看房管理" // 父菜单名称
|
||||
},
|
||||
{ // 合同信息管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "合同信息", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "hetongxinxi" // 数据表名
|
||||
}],
|
||||
menu: "合同信息管理" // 父菜单名称
|
||||
},
|
||||
{ // 房屋报修管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "房屋报修", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwubaoxiu" // 数据表名
|
||||
}],
|
||||
menu: "房屋报修管理" // 父菜单名称
|
||||
},
|
||||
{ // 维修处理管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "维修处理", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "weixiuchuli" // 数据表名
|
||||
}],
|
||||
menu: "维修处理管理" // 父菜单名称
|
||||
},
|
||||
{ // 房屋评价管理
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "房屋评价", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwupingjia" // 数据表名
|
||||
}],
|
||||
menu: "房屋评价管理" // 父菜单名称
|
||||
}
|
||||
],
|
||||
frontMenu: [ // 前台菜单列表
|
||||
{ // 房屋信息模块
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看", "预约"], // 按钮权限
|
||||
menu: "房屋信息列表", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "fangwuxinxi" // 数据表名
|
||||
}],
|
||||
menu: "房屋信息模块" // 父菜单名称
|
||||
},
|
||||
{ // 我要当房主模块
|
||||
child: [{ // 子菜单
|
||||
buttons: ["查看"], // 按钮权限
|
||||
menu: "我要当房主列表", // 菜单名称
|
||||
menuJump: "列表", // 跳转类型
|
||||
tableName: "woyaodangfangzhu" // 数据表名
|
||||
}],
|
||||
menu: "我要当房主模块" // 父菜单名称
|
||||
}
|
||||
],
|
||||
hasBackLogin: "是", // 是否有后台登录功能
|
||||
hasBackRegister: "是", // 是否有后台注册功能
|
||||
hasFrontLogin: "否", // 是否有前台登录功能
|
||||
hasFrontRegister: "否", // 是否有前台注册功能
|
||||
roleName: "房主", // 角色名称
|
||||
tableName: "fangzhu" // 数据表名
|
||||
}
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
export default menu; // 导出 menu 对象,供其他模块使用
|
@ -0,0 +1,16 @@
|
||||
const storage = { // 定义一个名为 storage 的对象,用于操作浏览器的 localStorage
|
||||
set(key, value) { // 定义 set 方法,用于存储键值对
|
||||
localStorage.setItem(key, JSON.stringify(value)); // 将 value 转换为 JSON 字符串后存储到 localStorage 中
|
||||
},
|
||||
get(key) { // 定义 get 方法,用于获取指定 key 的值
|
||||
return localStorage.getItem(key) ? localStorage.getItem(key).replace('"', '').replace('"', '') : ""; // 获取值并移除可能存在的引号,如果不存在则返回空字符串
|
||||
},
|
||||
getObj(key) { // 定义 getObj 方法,用于获取指定 key 的值并解析为对象
|
||||
return localStorage.getItem(key) ? JSON.parse(localStorage.getItem(key)) : null; // 如果存在对应的值,则解析为 JSON 对象,否则返回 null
|
||||
},
|
||||
remove(key) { // 定义 remove 方法,用于删除指定 key 的值
|
||||
localStorage.removeItem(key); // 从 localStorage 中移除指定的 key
|
||||
}
|
||||
};
|
||||
|
||||
export default storage; // 导出 storage 对象,供其他模块使用
|
@ -0,0 +1,398 @@
|
||||
<template>
|
||||
<div class="main-content">
|
||||
<!-- 列表页 -->
|
||||
<div v-if="!showFlag">
|
||||
<!-- 查询表单 -->
|
||||
<el-form :inline="true" :model="searchForm" class="form-content">
|
||||
|
||||
<!-- 遍历字段列表生成查询项 -->
|
||||
#foreach($column in $columns)
|
||||
#if($column.queryFlag == "是")
|
||||
|
||||
<el-form-item label="${column.comments}">
|
||||
<!-- 如果字段类型为“日”(日期) -->
|
||||
#if($column.type == "日")
|
||||
<el-date-picker
|
||||
v-model="searchForm.${column.columnName}"
|
||||
type="date"
|
||||
placeholder="${column.comments}">
|
||||
</el-date-picker>
|
||||
|
||||
<!-- 如果字段类型为“下”(下拉选择) -->
|
||||
#elseif( $column.type == "下" )
|
||||
<el-select v-model="searchForm.${column.columnName}" placeholder="请选择${column.comments}">
|
||||
<!-- 拆分自定义内容作为选项 -->
|
||||
#set($array = ${column.customize.split(",")})
|
||||
#foreach($item in $array)
|
||||
<el-option
|
||||
:key="${item}"
|
||||
:label="${item}"
|
||||
:value="${item}">
|
||||
</el-option>
|
||||
#end
|
||||
</el-select>
|
||||
|
||||
<!-- 默认情况:普通输入框 -->
|
||||
#else
|
||||
<el-input v-model="searchForm.${column.columnName}"
|
||||
placeholder="${column.comments}" clearable></el-input>
|
||||
#end
|
||||
</el-form-item>
|
||||
|
||||
#end
|
||||
#end
|
||||
|
||||
<!-- 查询、新增、删除按钮组 -->
|
||||
<el-form-item>
|
||||
<el-button round @click="search()">查询</el-button>
|
||||
<el-button
|
||||
v-if="isAuth('${tableName}','新增')"
|
||||
type="primary"
|
||||
@click="addOrUpdateHandler()"
|
||||
round
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
v-if="isAuth('${tableName}','删除')"
|
||||
:disabled="dataListSelections.length <= 0"
|
||||
type="danger"
|
||||
@click="deleteHandler()"
|
||||
round
|
||||
>删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 表格区域 -->
|
||||
<div class="table-content">
|
||||
<!-- 数据表格 -->
|
||||
<el-table
|
||||
v-if="isAuth('${tableName}','查看')"
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandler"
|
||||
style="width: 100%;">
|
||||
|
||||
<!-- 多选列 -->
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
|
||||
<!-- 遍历字段列表生成表格列 -->
|
||||
#foreach($column in $columns)
|
||||
|
||||
<!-- 图片字段显示为图片 -->
|
||||
#if($column.type=='图')
|
||||
<el-table-column prop="${column.columnName}"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="200"
|
||||
label="${column.comments}">
|
||||
<template slot-scope="scope">
|
||||
<img :src="scope.row.${column.columnName}.split(',')[0]" min-width="100" height="100">
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 视频字段显示为下载按钮 -->
|
||||
#elseif($column.type=='视')
|
||||
<el-table-column prop="${column.columnName}"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="${column.comments}">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="download(scope.row.${column.columnName})">下载</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 富文本字段不显示在列表中 -->
|
||||
#elseif($column.type=='多')
|
||||
|
||||
<!-- 排除特定字段 -->
|
||||
#elseif($column.columnName=='clicktime')
|
||||
#elseif($column.columnName=='reversetime')
|
||||
#elseif($column.columnName=='clicknum')
|
||||
|
||||
<!-- 默认字段作为普通列展示 -->
|
||||
#else
|
||||
<el-table-column
|
||||
prop="${column.columnName}"
|
||||
header-align="center"
|
||||
align="center"
|
||||
sortable
|
||||
width="200"
|
||||
label="${column.comments}">
|
||||
</el-table-column>
|
||||
#end
|
||||
#end
|
||||
|
||||
<!-- 审核状态列 -->
|
||||
#if($sfsh=="是")
|
||||
<el-table-column
|
||||
prop="sfsh"
|
||||
header-align="center"
|
||||
align="center"
|
||||
sortable
|
||||
label="审核">
|
||||
</el-table-column>
|
||||
#end
|
||||
|
||||
<!-- 操作列 -->
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<!-- 审核按钮(仅当 sfsh 为“是”时显示) -->
|
||||
#if($sfsh=="是")
|
||||
<el-button type="text" icon="el-icon-edit" size="small" @click="shHandler(scope.row.id,scope.row.sfsh)">审核</el-button>
|
||||
#end
|
||||
|
||||
<!-- 修改按钮 -->
|
||||
<el-button v-if="isAuth('${tableName}','修改')" type="text" icon="el-icon-edit" size="small" @click="addOrUpdateHandler(scope.row.id)">修改</el-button>
|
||||
|
||||
<!-- 删除按钮 -->
|
||||
<el-button v-if="isAuth('${tableName}','删除')" type="text" icon="el-icon-delete" size="small" @click="deleteHandler(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页组件 -->
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
class="pagination-content"
|
||||
></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 添加/修改页面 -->
|
||||
<!-- 将父组件的 search 方法传递给子组件 -->
|
||||
<add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 引入 AddOrUpdate 组件(用于新增或编辑数据)
|
||||
import AddOrUpdate from "./add-or-update";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 查询表单数据对象
|
||||
searchForm: {
|
||||
key: ""
|
||||
},
|
||||
// 表格数据列表
|
||||
dataList: [],
|
||||
// 当前页码
|
||||
pageIndex: 1,
|
||||
// 每页条数
|
||||
pageSize: 10,
|
||||
// 总记录数
|
||||
totalPage: 0,
|
||||
// 加载状态
|
||||
dataListLoading: false,
|
||||
// 多选数据
|
||||
dataListSelections: [],
|
||||
// 是否显示添加/修改界面
|
||||
showFlag: false
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// 页面挂载后执行初始化和加载数据
|
||||
this.init();
|
||||
this.getDataList();
|
||||
},
|
||||
components: {
|
||||
// 注册 AddOrUpdate 子组件
|
||||
AddOrUpdate
|
||||
},
|
||||
methods: {
|
||||
// 初始化方法,处理提醒逻辑
|
||||
init () {
|
||||
#foreach($column in $columns)
|
||||
#if($column.remind=="数")
|
||||
let url = 'remind/${tableName}/${column.columnName}/1?1=1';
|
||||
#if($column.remindEnd)
|
||||
url+=`&remindend=${column.remindEnd}`,
|
||||
#end
|
||||
#if($column.remindStart)
|
||||
url+=`&remindstart=${column.remindStart}`,
|
||||
#end
|
||||
#[[this.$http({]]#
|
||||
url: url,
|
||||
method: "get",
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code == 0 && data.count>0 ) {
|
||||
#[[this.$alert(`有${data.count}条数据到达预警数量`)]]#
|
||||
}
|
||||
});
|
||||
#elseif($column.remind=="日")
|
||||
let url = 'remind/${tableName}/${column.columnName}/2?1=1';
|
||||
#if($column.remindEnd)
|
||||
url+=`&remindend=${column.remindEnd}`,
|
||||
#end
|
||||
#if($column.remindStart)
|
||||
url+=`&remindstart=${column.remindStart}`,
|
||||
#end
|
||||
#[[this.$http({]]#
|
||||
url: url,
|
||||
method: "get",
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code == 0 && data.count>0 ) {
|
||||
#[[this.$alert(`有${data.count}条数据到期`)]]#
|
||||
}
|
||||
});
|
||||
#end
|
||||
#end
|
||||
},
|
||||
|
||||
// 查询方法
|
||||
search() {
|
||||
this.pageIndex = 1;
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.dataListLoading = true;
|
||||
#[[this.$http({]]#
|
||||
url: "${tableName}/page",
|
||||
method: "get",
|
||||
params: {
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
sort: 'id',
|
||||
#foreach($column in $columns)
|
||||
#if($column.queryFlag == "是")
|
||||
${column.columnName} : this.searchForm.${column.columnName},
|
||||
#end
|
||||
#end
|
||||
}
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list;
|
||||
this.totalPage = data.data.total;
|
||||
} else {
|
||||
this.dataList = [];
|
||||
this.totalPage = 0;
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
// 每页条数变化时触发
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val;
|
||||
this.pageIndex = 1;
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
// 当前页码变化时触发
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val;
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
// 多选变化时触发
|
||||
selectionChangeHandler(val) {
|
||||
this.dataListSelections = val;
|
||||
},
|
||||
|
||||
// 打开新增/修改弹窗
|
||||
addOrUpdateHandler(id) {
|
||||
this.showFlag = true;
|
||||
#[[this.$nextTick(() => {]]#
|
||||
#[[this.$refs.addOrUpdate.init(id);]]#
|
||||
});
|
||||
},
|
||||
|
||||
// 审核操作
|
||||
shHandler(id,sfsh){
|
||||
if(sfsh=="是"){
|
||||
sfsh = '否'
|
||||
}else{
|
||||
sfsh = '是'
|
||||
}
|
||||
#[[this.$confirm(`确定操作?`, "提示", {]]#
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
#[[this.$http({]]#
|
||||
url: "sh/${tableName}",
|
||||
method: "post",
|
||||
data: {
|
||||
id:id,
|
||||
sfsh:sfsh
|
||||
}
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
#[[this.$message({]]#
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
#[[this.$message.error(data.msg);]]#
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 下载文件方法
|
||||
download(file){
|
||||
window.open(`#[[${file}]]#`)
|
||||
},
|
||||
|
||||
// 删除操作
|
||||
deleteHandler(id) {
|
||||
var ids = id
|
||||
? [Number(id)]
|
||||
: this.dataListSelections.map(item => {
|
||||
return Number(item.id);
|
||||
});
|
||||
#[[this.$confirm(`确定进行[${id ? "删除" : "批量删除"}]操作?`, "提示", {]]#
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
#[[this.$http({]]#
|
||||
url: "${tableName}/delete",
|
||||
method: "post",
|
||||
data: ids
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
#[[this.$message({]]#
|
||||
message: "操作成功",
|
||||
type: "success",
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.search();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
#[[this.$message.error(data.msg);]]#
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 当前样式为空,可根据需求添加自定义样式 */
|
||||
</style>
|
@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<!-- 页面根容器 -->
|
||||
<div>
|
||||
<!-- 登录背景图片 -->
|
||||
<img class="bg" src="@/assets/img/bg.jpg">
|
||||
|
||||
<!-- 登录表单 -->
|
||||
<el-form :model="rulesForm" :rules="rules" ref="rulesForm" class="login-form">
|
||||
<!-- 登录标题 -->
|
||||
<h1 class="h1">管理员登陆</h1>
|
||||
|
||||
<!-- 用户名输入项 -->
|
||||
<el-form-item label="账号" prop="username">
|
||||
<el-input type="text" v-model="rulesForm.username"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 密码输入项 -->
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input type="password" v-model="rulesForm.password"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 角色选择项 -->
|
||||
<el-form-item label="" prop="role">
|
||||
<!-- 循环渲染角色选项 -->
|
||||
<el-radio v-for="item in menus"
|
||||
v-bind:key="item.roleName"
|
||||
v-model="rulesForm.role"
|
||||
:label="item.roleName">
|
||||
{{item.roleName}}
|
||||
</el-radio>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 登录按钮 -->
|
||||
<el-button @click="login()" class="btn-login" type="primary">登陆</el-button>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 引入菜单工具模块,用于获取角色列表
|
||||
import menu from '@/utils/menu'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 表单数据对象
|
||||
rulesForm: {
|
||||
username: "", // 用户名
|
||||
password: "", // 密码
|
||||
role: "" // 角色
|
||||
},
|
||||
menus:[], // 菜单(角色)列表
|
||||
tableName:"users", // 默认登录表名为 users
|
||||
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
username: [{ required: true, message: "请输入账号", trigger: "blur" }],
|
||||
password: [{ required: true, message: "请输入密码", trigger: "blur" }]
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
mounted(){
|
||||
// 页面挂载后获取角色列表
|
||||
let menus = menu.list();
|
||||
this.menus = menus;
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 登录方法
|
||||
login() {
|
||||
#[[this.$refs["rulesForm"].validate(valid => {]]#
|
||||
|
||||
// 根据选中的角色查找对应的数据库表名
|
||||
let menus = this.menus;
|
||||
for(let i=0;i<menus.length;i++){
|
||||
if(menus[i].roleName==this.rulesForm.role){
|
||||
this.tableName = menus[i].tableName
|
||||
}
|
||||
}
|
||||
|
||||
// 如果表单验证通过
|
||||
if (valid) {
|
||||
#[[this.$http({]]#
|
||||
url: `#[[${this.tableName}]]#/login?username=#[[${this.rulesForm.username}&password=${this.rulesForm.password}]]#`,
|
||||
method: "post"
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
// 登录成功,保存 Token 和角色信息
|
||||
#[[this.$storage.set("Token", data.token);]]#
|
||||
#[[this.$storage.set("role", this.rulesForm.role);]]#
|
||||
|
||||
// 跳转到首页
|
||||
#[[this.$router.replace({ path: "/index/" });]]#
|
||||
} else {
|
||||
// 登录失败提示错误信息
|
||||
#[[this.$message.error(data.msg);]]#
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* 当前样式为空,可在此添加自定义样式 */
|
||||
</style>
|
@ -0,0 +1,11 @@
|
||||
// 定义一个名为 menu 的对象,用于管理菜单数据
|
||||
const menu = {
|
||||
// list 方法用于返回菜单列表数据
|
||||
list() {
|
||||
// 返回 ${roleMenus},该变量由模板引擎动态替换为不同角色的菜单配置
|
||||
return ${roleMenus}
|
||||
}
|
||||
}
|
||||
|
||||
// 导出 menu 对象,供其他模块引用
|
||||
export default menu
|
@ -0,0 +1,54 @@
|
||||
// 引入 Vue 核心库
|
||||
import Vue from 'vue';
|
||||
|
||||
// 配置路由:引入 VueRouter 插件
|
||||
import VueRouter from 'vue-router';
|
||||
Vue.use(VueRouter); // 安装 VueRouter 插件
|
||||
|
||||
// 1. 创建组件:导入需要用到的页面组件
|
||||
import Index from '@/views/index'; // 主页框架(包含头部、侧边栏等)
|
||||
import Home from '@/views/home'; // 首页内容组件
|
||||
import Login from '@/views/login'; // 登录页组件
|
||||
import NotFound from '@/views/404'; // 404 页面组件
|
||||
|
||||
// 动态导入后台菜单相关的模块列表组件(使用 Velocity 模板循环生成)
|
||||
#foreach($tableName in $backMenuTables)
|
||||
import ${tableName} from '@/views/modules/${tableName}/list'
|
||||
#end
|
||||
|
||||
// 2. 配置路由规则
|
||||
const routes = [
|
||||
{
|
||||
path: '/index', name:'index', component: Index, children: [
|
||||
// 默认子路由:访问 /index 自动跳转到首页
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home
|
||||
},
|
||||
// 动态生成后台菜单对应的路由(每个表一个路由)
|
||||
#foreach($tableName in $backMenuTables)
|
||||
,{
|
||||
path: '/${tableName}',
|
||||
name: '${tableName}',
|
||||
component: ${tableName}
|
||||
}
|
||||
#end
|
||||
]
|
||||
},
|
||||
// 登录页路由
|
||||
{ path: '/login', name:'login', component: Login },
|
||||
// 默认跳转至首页
|
||||
{ path: '/', redirect: '/index/' },
|
||||
// 所有未匹配路径都跳转到 404 页面
|
||||
{ path: '*', component: NotFound }
|
||||
];
|
||||
|
||||
// 3. 实例化 VueRouter 路由对象
|
||||
const router = new VueRouter({
|
||||
mode: 'hash', /* 使用 hash 模式,也可改为 history 模式 */
|
||||
routes /* 简写形式,相当于 routes: routes */
|
||||
})
|
||||
|
||||
// 导出路由实例,供 main.js 使用
|
||||
export default router;
|