Merge pull request 'v1.3' (#6) from develop into master

master
p5rn97v8z 4 months ago
commit 9ea1876fcf

@ -0,0 +1,61 @@
<template>
<!-- 主容器 -->
<div class="content">
<!-- 错误页面背景图 -->
<img class="backgroud" src="@/assets/img/404.png" alt>
<!-- 主要提示文本 -->
<div class="text main-text">出错了...页面失踪了</div>
<!-- 返回按钮区域 -->
<div>
<!-- 点击返回上一页的按钮 -->
<el-button class="text" @click="back()" type="text" icon="el-icon-back">返回</el-button>
</div>
</div>
</template>
<script>
// Vue
export default {
//
methods: {
//
back() {
// 1
window.history.length > 1
? this.$router.go(-1) //
: this.$router.push("/"); //
}
}
};
</script>
<style lang="scss" scoped>
.content {
display: flex; /* 使用弹性布局 */
align-items: center; /* 垂直居中 */
flex-direction: column; /* 子元素垂直排列 */
width: 100%; /* 宽度占满父容器 */
height: 100%; /* 高度占满父容器 */
min-height: 900px; /* 最小高度为900px */
text-align: center; /* 文字水平居中 */
.backgroud {
display: inline-block; /* 行内块显示 */
width: 200px; /* 图片宽度 */
height: 200px; /* 图片高度 */
margin-top: 80px; /* 上边距 */
}
.main-text {
margin-top: 80px; /* 提示文字顶部留白 */
}
.text {
font-size: 24px; /* 字体大小 */
font-weight: bold; /* 加粗字体 */
color: #333; /* 字体颜色 */
}
}
</style>

@ -0,0 +1,261 @@
<template>
<div>
<!-- 表单容器使用 Element UI 的表单组件 -->
<el-form
class="detail-form-content" <!-- 表单样式类 -->
ref="ruleForm" <!-- 表单引用用于表单验证 -->
:model="ruleForm" <!-- 表单数据绑定 -->
label-width="80px" <!-- 表单标签宽度 -->
>
<el-row> <!-- 表单布局行 -->
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 用户名表单项仅当 flag 'yonghu' 时显示 -->
<el-form-item v-if="flag=='yonghu'" label="用户名" prop="yonghuming">
<!-- 用户名输入框只读 -->
<el-input v-model="ruleForm.yonghuming" readonly placeholder="用户名" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 姓名表单项仅当 flag 'yonghu' 时显示 -->
<el-form-item v-if="flag=='yonghu'" label="姓名" prop="xingming">
<!-- 姓名输入框 -->
<el-input v-model="ruleForm.xingming" placeholder="姓名" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="24"> <!-- 24列宽布局占满整行 -->
<!-- 头像表单项仅当 flag 'yonghu' 时显示 -->
<el-form-item v-if="flag=='yonghu'" label="头像" prop="touxiang">
<!-- 文件上传组件用于上传头像 -->
<file-upload
tip="点击上传头像" <!-- 提示信息 -->
action="file/upload" <!-- 上传接口地址 -->
:limit="3" <!-- 上传文件数量限制 -->
:multiple="true" <!-- 是否支持多文件上传 -->
:fileUrls="ruleForm.touxiang?ruleForm.touxiang:''" <!-- 已上传文件地址 -->
@change="yonghutouxiangUploadChange" <!-- 文件上传变化事件 -->
></file-upload>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 性别表单项仅当 flag 'yonghu' 时显示 -->
<el-form-item v-if="flag=='yonghu'" label="性别" prop="xingbie">
<!-- 性别选择下拉框 -->
<el-select v-model="ruleForm.xingbie" placeholder="请选择性别">
<!-- 性别选项循环 -->
<el-option
v-for="(item,index) in yonghuxingbieOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 职业表单项仅当 flag 'yonghu' 时显示 -->
<el-form-item v-if="flag=='yonghu'" label="职业" prop="zhiye">
<!-- 职业输入框 -->
<el-input v-model="ruleForm.zhiye" placeholder="职业" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 联系电话表单项仅当 flag 'yonghu' 时显示 -->
<el-form-item v-if="flag=='yonghu'" label="联系电话" prop="lianxidianhua">
<!-- 联系电话输入框 -->
<el-input v-model="ruleForm.lianxidianhua" placeholder="联系电话" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 身份证表单项仅当 flag 'yonghu' 时显示 -->
<el-form-item v-if="flag=='yonghu'" label="身份证" prop="shenfenzheng">
<!-- 身份证输入框 -->
<el-input v-model="ruleForm.shenfenzheng" placeholder="身份证" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 房主账号表单项仅当 flag 'fangzhu' 时显示 -->
<el-form-item v-if="flag=='fangzhu'" label="房主账号" prop="fangzhuzhanghao">
<!-- 房主账号输入框只读 -->
<el-input v-model="ruleForm.fangzhuzhanghao" readonly placeholder="房主账号" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 房主姓名表单项仅当 flag 'fangzhu' 时显示 -->
<el-form-item v-if="flag=='fangzhu'" label="房主姓名" prop="fangzhuxingming">
<!-- 房主姓名输入框 -->
<el-input v-model="ruleForm.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 性别表单项仅当 flag 'fangzhu' 时显示 -->
<el-form-item v-if="flag=='fangzhu'" label="性别" prop="xingbie">
<!-- 性别选择下拉框 -->
<el-select v-model="ruleForm.xingbie" placeholder="请选择性别">
<!-- 性别选项循环 -->
<el-option
v-for="(item,index) in fangzhuxingbieOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24"> <!-- 24列宽布局占满整行 -->
<!-- 头像表单项仅当 flag 'fangzhu' 时显示 -->
<el-form-item v-if="flag=='fangzhu'" label="头像" prop="touxiang">
<!-- 文件上传组件用于上传头像 -->
<file-upload
tip="点击上传头像" <!-- 提示信息 -->
action="file/upload" <!-- 上传接口地址 -->
:limit="3" <!-- 上传文件数量限制 -->
:multiple="true" <!-- 是否支持多文件上传 -->
:fileUrls="ruleForm.touxiang?ruleForm.touxiang:''" <!-- 已上传文件地址 -->
@change="fangzhutouxiangUploadChange" <!-- 文件上传变化事件 -->
></file-upload>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 手机表单项仅当 flag 'fangzhu' 时显示 -->
<el-form-item v-if="flag=='fangzhu'" label="手机" prop="shouji">
<!-- 手机输入框 -->
<el-input v-model="ruleForm.shouji" placeholder="手机" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="12"> <!-- 12列宽布局 -->
<!-- 身份证表单项仅当 flag 'fangzhu' 时显示 -->
<el-form-item v-if="flag=='fangzhu'" label="身份证" prop="shenfenzheng">
<!-- 身份证输入框 -->
<el-input v-model="ruleForm.shenfenzheng" placeholder="身份证" clearable></el-input>
</el-form-item>
</el-col>
<el-form-item v-if="flag=='users'" label="用户名" prop="username">
<!-- 用户名表单项仅当 flag 'users' 时显示 -->
<el-input v-model="ruleForm.username"
placeholder="用户名"></el-input>
</el-form-item>
<el-col :span="24"> <!-- 24列宽布局占满整行 -->
<el-form-item>
<!-- 修改按钮点击触发表单提交 -->
<el-button type="primary" @click="onUpdateHandler"> </el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
//
import { isNumber,isIntNumer,isEmail,isMobile,isPhone,isURL,checkIdCard } from "@/utils/validate";
export default {
data() {
return {
ruleForm: {}, //
flag: '', //
usersFlag: false, //
yonghuxingbieOptions: [], //
fangzhuxingbieOptions: [], //
};
},
mounted() {
//
var table = this.$storage.get("sessionTable"); //
this.flag = table; //
// HTTP
this.$http({
url: `${this.$storage.get("sessionTable")}/session`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) { //
this.ruleForm = data.data; //
} else {
this.$message.error(data.msg); //
}
});
//
this.yonghuxingbieOptions = "男,女".split(',')
//
this.fangzhuxingbieOptions = "男,女".split(',')
},
methods: {
//
yonghutouxiangUploadChange(fileUrls) {
this.ruleForm.touxiang = fileUrls; //
},
//
fangzhutouxiangUploadChange(fileUrls) {
this.ruleForm.touxiang = fileUrls; //
},
//
onUpdateHandler() {
// 'yonghu'
if((!this.ruleForm.yonghuming)&& 'yonghu'==this.flag){
this.$message.error('用户名不能为空'); //
return
}
// 'yonghu'
if((!this.ruleForm.mima)&& 'yonghu'==this.flag){
this.$message.error('密码不能为空'); //
return
}
// 'yonghu'
if( 'yonghu' ==this.flag && this.ruleForm.lianxidianhua&&(!isMobile(this.ruleForm.lianxidianhua))){
this.$message.error(`联系电话应输入手机格式`); //
return
}
// 'yonghu'
if( 'yonghu' ==this.flag && this.ruleForm.shenfenzheng&&(!checkIdCard(this.ruleForm.shenfenzheng))){
this.$message.error(`身份证应输入身份证格式`); //
return
}
// 'fangzhu'
if((!this.ruleForm.fangzhuzhanghao)&& 'fangzhu'==this.flag){
this.$message.error('房主账号不能为空'); //
return
}
// 'fangzhu'
if((!this.ruleForm.mima)&& 'fangzhu'==this.flag){
this.$message.error('密码不能为空'); //
return
}
// 'fangzhu'
if((!this.ruleForm.fangzhuxingming)&& 'fangzhu'==this.flag){
this.$message.error('房主姓名不能为空'); //
return
}
// 'fangzhu'
if( 'fangzhu' ==this.flag && this.ruleForm.shouji&&(!isMobile(this.ruleForm.shouji))){
this.$message.error(`手机应输入手机格式`); //
return
}
// 'fangzhu'
if( 'fangzhu' ==this.flag && this.ruleForm.shenfenzheng&&(!checkIdCard(this.ruleForm.shenfenzheng))){
this.$message.error(`身份证应输入身份证格式`); //
return
}
// HTTP
this.$http({
url: `${this.$storage.get("sessionTable")}/update`,
method: "post",
data: this.ruleForm
}).then(({ data }) => {
if (data && data.code === 0) { //
this.$message({
message: "修改信息成功", //
type: "success",
duration: 1500,
onClose: () => {
}
});
} else {
this.$message.error(data.msg); //
}
});
}
}
};
</script>
<style lang="scss" scoped>
// 使 SCSS
</style>

@ -0,0 +1,68 @@
<template>
<!-- 页面主容器 -->
<div class="content">
<!-- 欢迎语句显示项目名称 -->
<div class="text main-text">欢迎使用 {{this.$project.projectName}}</div>
</div>
</template>
<script>
//
import router from '@/router/router-static'
export default {
//
mounted(){
this.init();
},
methods:{
//
init(){
// Token
if(this.$storage.get('Token')){
//
this.$http({
// sessionTable
url: `${this.$storage.get('sessionTable')}/session`,
method: "get"
}).then(({ data }) => {
// code 0
if (data && data.code != 0) {
//
router.push({ name: 'login' })
}
});
} else {
// Token
router.push({ name: 'login' })
}
}
}
};
</script>
<style lang="scss" scoped>
.content {
display: flex; /* 使用弹性布局 */
align-items: center; /* 垂直居中 */
flex-direction: column; /* 子元素垂直排列 */
width: 100%; /* 宽度占满父容器 */
height: 100%; /* 高度占满父容器 */
min-height: 500px; /* 最小高度为500px */
text-align: center; /* 文字水平居中 */
.main-text {
font-size: 38px; /* 字体大小 */
font-weight: bold; /* 加粗字体 */
margin-top: 15%; /* 上边距为视口高度的15% */
}
.text {
font-size: 24px; /* 字体大小 */
font-weight: bold; /* 加粗字体 */
color: #333; /* 字体颜色 */
}
}
</style>

@ -0,0 +1,43 @@
<template>
<!-- 主容器使用 el-container 布局结构 -->
<el-container>
<!-- 引入顶部导航组件 -->
<index-header></index-header>
<!-- 内层容器 -->
<el-container>
<!-- 引入左侧菜单栏组件静态 -->
<index-aside></index-aside>
<!-- 引入主内容区域组件 -->
<index-main></index-main>
</el-container>
</el-container>
</template>
<script>
//
import IndexHeader from '@/components/index/IndexHeader'
//
import IndexAside from '@/components/index/IndexAsideStatic'
//
import IndexMain from '@/components/index/IndexMain'
export default {
// 使使
components: {
IndexHeader, //
IndexAside, //
IndexMain //
}
}
</script>
<style lang="scss" scoped>
//
.el-container {
position: absolute; /* 绝对定位 */
width: 100%; /* 宽度占满整个视口 */
top: 0; /* 距离顶部为0 */
left: 0; /* 距离左侧为0 */
bottom: 0; /* 距离底部为0实现高度自适应 */
}
</style>

@ -0,0 +1,397 @@
<template>
<div>
<div class="container loginIn" style="backgroundImage: url(http://codegen.caihongy.cn/20210128/ac0684f4d39c4b5ebf6694a20d747cd6.jpg)">
<div :class="2 == 1 ? 'left' : 2 == 2 ? 'left center' : 'left right'" style="backgroundColor: rgba(206, 221, 207, 0.4)">
<el-form class="login-form" label-position="left" :label-width="2 == 3 ? '56px' : '0px'">
<div class="title-container"><h3 class="title" style="color: rgba(31, 147, 255, 0.73)">房屋租赁系统登录</h3></div>
<el-form-item :label="2 == 3 ? '用户名' : ''" :class="'style'+2">
<span v-if="2 != 3" class="svg-container" style="color:rgba(16, 17, 17, 1);line-height:44px"><svg-icon icon-class="user" /></span>
<el-input placeholder="请输入用户名" name="username" type="text" v-model="rulesForm.username" />
</el-form-item>
<el-form-item :label="2 == 3 ? '密码' : ''" :class="'style'+2">
<span v-if="2 != 3" class="svg-container" style="color:rgba(16, 17, 17, 1);line-height:44px"><svg-icon icon-class="password" /></span>
<el-input placeholder="请输入密码" name="password" type="password" v-model="rulesForm.password" />
</el-form-item>
<el-form-item v-if="0 == '1'" class="code" :label="2 == 3 ? '验证码' : ''" :class="'style'+2">
<span v-if="2 != 3" class="svg-container" style="color:rgba(16, 17, 17, 1);line-height:44px"><svg-icon icon-class="code" /></span>
<el-input placeholder="请输入验证码" name="code" type="text" v-model="rulesForm.code" />
<div class="getCodeBt" @click="getRandCode(4)" style="height:44px;line-height:44px">
<span v-for="(item, index) in codes" :key="index" :style="{color:item.color,transform:item.rotate,fontSize:item.size}">{{ item.num }}</span>
</div>
</el-form-item>
<el-form-item label="角色" prop="loginInRole" class="role">
<el-radio
v-for="item in menus"
v-if="item.hasBackLogin=='是'"
v-bind:key="item.roleName"
v-model="rulesForm.role"
:label="item.roleName"
>{{item.roleName}}</el-radio>
</el-form-item>
<el-button type="primary" @click="login()" class="loginInBt" style="padding:0;font-size:16px;border-radius:22px;height:44px;line-height:44px;width:100%;backgroundColor:rgba(64, 158, 255, 1); borderColor:rgba(64, 158, 255, 1); color:rgba(255, 255, 255, 1)">{{'1' == '1' ? '登录' : 'login'}}</el-button>
<el-form-item class="setting">
<div style="color:rgba(153, 153, 153, 1)" class="register" @click="register('fangzhu')"></div>
<!-- <div style="color:rgba(153, 153, 153, 1)" class="reset">修改密码</div> -->
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script>
import menu from "@/utils/menu";
export default {
data() {
return {
rulesForm: {
username: "",
password: "",
role: "",
code: '',
},
menus: [],
tableName: "",
codes: [{
num: 1,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 2,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 3,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 4,
color: '#000',
rotate: '10deg',
size: '16px'
}],
};
},
mounted() {
let menus = menu.list();
this.menus = menus;
},
created() {
this.setInputColor()
this.getRandCode()
},
methods: {
setInputColor(){
this.$nextTick(()=>{
document.querySelectorAll('.loginIn .el-input__inner').forEach(el=>{
el.style.backgroundColor = "rgba(255, 255, 255, 1)"
el.style.color = "rgba(20, 21, 21, 0.91)"
el.style.height = "44px"
el.style.lineHeight = "44px"
el.style.borderRadius = "22px"
})
document.querySelectorAll('.loginIn .style3 .el-form-item__label').forEach(el=>{
el.style.height = "44px"
el.style.lineHeight = "44px"
})
document.querySelectorAll('.loginIn .el-form-item__label').forEach(el=>{
el.style.color = "rgba(16, 17, 17, 1)"
})
setTimeout(()=>{
document.querySelectorAll('.loginIn .role .el-radio__label').forEach(el=>{
el.style.color = "#fff"
})
},350)
})
},
register(tableName){
this.$storage.set("loginTable", tableName);
this.$router.push({path:'/register'})
},
//
login() {
let code = ''
for(let i in this.codes) {
code += this.codes[i].num
}
if ('0' == '1' && !this.rulesForm.code) {
this.$message.error("请输入验证码");
return;
}
if ('0' == '1' && this.rulesForm.code.toLowerCase() != code.toLowerCase()) {
this.$message.error("验证码输入有误");
this.getRandCode()
return;
}
if (!this.rulesForm.username) {
this.$message.error("请输入用户名");
return;
}
if (!this.rulesForm.password) {
this.$message.error("请输入密码");
return;
}
if (!this.rulesForm.role) {
this.$message.error("请选择角色");
return;
}
let menus = this.menus;
for (let i = 0; i < menus.length; i++) {
if (menus[i].roleName == this.rulesForm.role) {
this.tableName = menus[i].tableName;
}
}
this.$http({
url: `${this.tableName}/login?username=${this.rulesForm.username}&password=${this.rulesForm.password}`,
method: "post"
}).then(({ data }) => {
if (data && data.code === 0) {
this.$storage.set("Token", data.token);
this.$storage.set("role", this.rulesForm.role);
this.$storage.set("sessionTable", this.tableName);
this.$storage.set("adminName", this.rulesForm.username);
this.$router.replace({ path: "/index/" });
} else {
this.$message.error(data.msg);
}
});
},
getRandCode(len = 4){
this.randomString(len)
},
randomString(len = 4) {
let chars = [
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
"3", "4", "5", "6", "7", "8", "9"
]
let colors = ["0", "1", "2","3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
let sizes = ['14', '15', '16', '17', '18']
let output = [];
for (let i = 0; i < len; i++) {
//
let key = Math.floor(Math.random()*chars.length)
this.codes[i].num = chars[key]
//
let code = '#'
for (let j = 0; j < 6; j++) {
let key = Math.floor(Math.random()*colors.length)
code += colors[key]
}
this.codes[i].color = code
//
let rotate = Math.floor(Math.random()*60)
let plus = Math.floor(Math.random()*2)
if(plus == 1) rotate = '-'+rotate
this.codes[i].rotate = 'rotate('+rotate+'deg)'
//
let size = Math.floor(Math.random()*sizes.length)
this.codes[i].size = sizes[size]+'px'
}
},
}
};
</script>
<style lang="scss" scoped>
.loginIn {
min-height: 100vh;
position: relative;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
.left {
position: absolute;
left: 0;
top: 0;
width: 360px;
height: 100%;
.login-form {
background-color: transparent;
width: 100%;
right: inherit;
padding: 0 12px;
box-sizing: border-box;
display: flex;
justify-content: center;
flex-direction: column;
}
.title-container {
text-align: center;
font-size: 24px;
.title {
margin: 20px 0;
}
}
.el-form-item {
position: relative;
.svg-container {
padding: 6px 5px 6px 15px;
color: #889aa4;
vertical-align: middle;
display: inline-block;
position: absolute;
left: 0;
top: 0;
z-index: 1;
padding: 0;
line-height: 40px;
width: 30px;
text-align: center;
}
.el-input {
display: inline-block;
height: 40px;
width: 100%;
& /deep/ input {
background: transparent;
border: 0px;
-webkit-appearance: none;
padding: 0 15px 0 30px;
color: #fff;
height: 40px;
}
}
}
}
.center {
position: absolute;
left: 50%;
top: 50%;
width: 360px;
transform: translate3d(-50%,-50%,0);
height: 446px;
border-radius: 8px;
}
.right {
position: absolute;
left: inherit;
right: 0;
top: 0;
width: 360px;
height: 100%;
}
.code {
.el-form-item__content {
position: relative;
.getCodeBt {
position: absolute;
right: 0;
top: 0;
line-height: 40px;
width: 100px;
background-color: rgba(51,51,51,0.4);
color: #fff;
text-align: center;
border-radius: 0 4px 4px 0;
height: 40px;
overflow: hidden;
span {
padding: 0 5px;
display: inline-block;
font-size: 16px;
font-weight: 600;
}
}
.el-input {
& /deep/ input {
padding: 0 130px 0 30px;
}
}
}
}
.setting {
& /deep/ .el-form-item__content {
padding: 0 15px;
box-sizing: border-box;
line-height: 32px;
height: 32px;
font-size: 14px;
color: #999;
margin: 0 !important;
.register {
float: left;
width: 50%;
}
.reset {
float: right;
width: 50%;
text-align: right;
}
}
}
.style2 {
padding-left: 30px;
.svg-container {
left: -30px !important;
}
.el-input {
& /deep/ input {
padding: 0 15px !important;
}
}
}
.code.style2, .code.style3 {
.el-input {
& /deep/ input {
padding: 0 115px 0 15px;
}
}
}
.style3 {
& /deep/ .el-form-item__label {
padding-right: 6px;
}
.el-input {
& /deep/ input {
padding: 0 15px !important;
}
}
}
.role {
& /deep/ .el-form-item__label {
width: 56px !important;
}
& /deep/ .el-radio {
margin-right: 12px;
}
}
}
</style>

@ -0,0 +1,356 @@
<template>
<!-- 主容器块用于样式隔离与布局 -->
<div class="addEdit-block">
<!-- 表单组件绑定ruleForm数据模型使用ref方便在JS中引用 -->
<el-form
class="detail-form-content"
ref="ruleForm" <!-- 表单引用 -->
:model="ruleForm" <!-- 数据模型 -->
:rules="rules" <!-- 校验规则 -->
label-width="80px" <!-- 标签宽度 -->
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 动态背景色 -->
>
<!-- 布局行用于排列表单项 -->
<el-row>
<!-- 左半列跨度12占50% -->
<el-col :span="12">
<!-- 非查看模式时显示可编辑名称输入框 -->
<el-form-item class="input" v-if="type!='info'" label="名称" prop="name">
<!-- 输入框双向绑定ruleForm.name -->
<el-input v-model="ruleForm.name"
placeholder="名称" clearable :readonly="ro.name"></el-input> <!-- -->
</el-form-item>
<!-- 查看模式下显示只读名称输入框 -->
<div v-else>
<el-form-item class="input" label="名称" prop="name">
<!-- 强制只读状态 -->
<el-input v-model="ruleForm.name"
placeholder="名称" readonly></el-input> <!-- -->
</el-form-item>
</div>
</el-col>
<!-- 全宽列跨度24占100% -->
<el-col :span="24">
<!-- 非查看模式且value未锁定时显示上传组件 -->
<el-form-item class="upload" v-if="type!='info' && !ro.value" label="值" prop="value">
<!-- 文件上传组件 -->
<file-upload
tip="点击上传值" <!-- 提示文字 -->
action="file/upload" <!-- 上传接口地址 -->
:limit="3" <!-- 最多上传3个文件 -->
:multiple="true" <!-- 支持多选 -->
:fileUrls="ruleForm.value?ruleForm.value:''" <!-- 初始文件路径 -->
@change="valueUploadChange" <!-- 上传完成后的回调 -->
></file-upload>
</el-form-item>
<!-- 查看模式下展示图片预览 -->
<div v-else>
<el-form-item v-if="ruleForm.value" label="值" prop="value">
<!-- 循环展示多个图片 -->
<img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in ruleForm.value.split(',')" :src="item" width="100" height="100"> <!-- -->
</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)) { // URL
callback(new Error("请输入正确的URL地址")); //
} else {
callback(); //
}
};
//
var validateMobile = (rule, value, callback) => {
if(!value){ //
callback(); //
} else if (!isMobile(value)) { //
callback(new Error("请输入正确的手机号码")); //
} else {
callback(); //
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){ //
callback(); //
} else if (!isPhone(value)) { //
callback(new Error("请输入正确的电话号码")); //
} else {
callback(); //
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){ //
callback(); //
} else if (!isEmail(value)) { //
callback(new Error("请输入正确的邮箱地址")); //
} else {
callback(); //
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){ //
callback(); //
} else if (!isNumber(value)) { //
callback(new Error("请输入数字")); //
} else {
callback(); //
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){ //
callback(); //
} else if (!isIntNumer(value)) { //
callback(new Error("请输入整数")); //
} else {
callback(); //
}
};
return {
//
addEditForm: {"btnSaveFontColor":"#fff", ...}, //
id: '', // ID
type: '', // add/edit/view
ro:{ //
name : false, //
value : false, //
},
ruleForm: { //
name: '', //
value: '', //
},
rules: { //
name: [
{ required: true, message: '名称不能为空', trigger: 'blur' }, //
],
value: [] //
}
};
},
props: ["parent"], //
computed: {}, //
created() { //
this.addEditStyleChange(); //
this.addEditUploadStyleChange(); //
},
methods: {
//
download(file){
window.open(`${file}`) //
},
// idtype
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
//
if(this.type == 'info' || this.type == 'else'){
this.info(id); //
} else if (this.type == 'cross') { //
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){
if(o == 'name'){ //
this.ruleForm.name = obj[o];
this.ro.name = true;
continue;
}
if(o == 'value'){ //
this.ruleForm.value = obj[o];
this.ro.value = true;
continue;
}
}
}
},
// ID
info(id) {
this.$http({ // HTTP
url: `config/info/${id}`, // URL
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: `config/${!this.ruleForm.id ? "save" : "update"}`, // URL
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.configCrossAddOrUpdateFlag = false;
this.parent.search(); //
this.parent.contentStyleChange();
}
});
} else {
this.$message.error(data.msg); //
}
});
}
});
},
// UUID
getUUID () {
return new Date().getTime(); // UUID
},
//
back() {
//
this.parent.showFlag = true;
this.parent.addOrUpdateFlag = false;
this.parent.configCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
valueUploadChange(fileUrls) {
this.ruleForm.value = fileUrls; //
this.addEditUploadStyleChange() //
},
//
addEditStyleChange() {
this.$nextTick(() => {
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el => {
el.style.height = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputFontColor
el.style.fontSize = this.addEditForm.inputFontSize
el.style.borderWidth = this.addEditForm.inputBorderWidth
el.style.borderStyle = this.addEditForm.inputBorderStyle
el.style.borderColor = this.addEditForm.inputBorderColor
el.style.borderRadius = this.addEditForm.inputBorderRadius
el.style.backgroundColor = this.addEditForm.inputBgColor
})
// label
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el => {
el.style.lineHeight = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputLableColor
el.style.fontSize = this.addEditForm.inputLableFontSize
})
// select/date/upload/textarea...
})
},
//
addEditUploadStyleChange() {
this.$nextTick(() => {
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el => {
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
})
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px; //
& /deep/ .ql-container {
height: 310px; // Quill
}
}
.amap-wrapper {
width: 100%; //
height: 500px; //
}
.search-box {
position: absolute; //
}
.addEdit-block {
margin: -10px; //
}
.detail-form-content {
padding: 12px; //
}
.btn .el-button {
padding: 0; // 0
}
</style>

@ -0,0 +1,519 @@
<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.name" placeholder="名称" clearable></el-input>
<!-- 带后置图标的输入框 -->
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.name" placeholder="名称" clearable></el-input>
<!-- 无图标输入框 -->
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.name" 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('config','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 新增按钮带后置图标 -->
<el-button
v-if="isAuth('config','新增') && 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('config','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮带前置图标 -->
<el-button
v-if="isAuth('config','删除') && 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('config','删除') && 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('config','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('config','查看')"
: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="name"
header-align="center"
label="名称">
<template slot-scope="scope">
{{scope.row.name}} <!-- 显示名称字段 -->
</template>
</el-table-column>
<!-- 值列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="value"
header-align="center"
width="200"
label="值">
<template slot-scope="scope">
<div v-if="scope.row.value"> <!-- -->
<img :src="scope.row.value.split(',')[0]" width="100" height="100">
</div>
<div v-else></div> <!-- -->
</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('config','查看') && 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('config','查看') && 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('config','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮带前置图标 -->
<el-button v-if="isAuth('config','修改') && 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('config','修改') && 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('config','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮带前置图标 -->
<el-button v-if="isAuth('config','删除') && 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('config','删除') && 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('config','删除') && 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>
</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: {
htmlfilter: function (val) {
return val.replace(/<[^>]*>/g).replace(/undefined/g,''); // HTMLundefined
}
},
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; //
},
init() {
//
},
search() {
this.pageIndex = 1; //
this.getDataList(); //
},
//
getDataList() {
this.dataListLoading = true; //
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
};
if (this.searchForm.name != '' && this.searchForm.name != undefined) {
params['name'] = '%' + this.searchForm.name + '%'; //
}
this.$http({
url: "config/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); //
});
},
//
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: "config/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,445 @@
<template>
<!-- 主容器块 -->
<div class="addEdit-block">
<!-- 表单组件用于添加或修改 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm" <!-- 绑定表单数据模型 -->
:rules="rules" <!-- 表单验证规则 -->
label-width="80px" <!-- 标签宽度 -->
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 动态背景颜色 -->
>
<el-row>
<!-- 空行占位 -->
</el-row>
<!-- 评论内容区域 -->
<el-row>
<el-col :span="24">
<!-- 评论内容输入框编辑模式 -->
<el-form-item class="textarea" v-if="type!='info'" label="评论内容" prop="content">
<el-input
style="min-width: 200px; max-width: 600px;" <!-- 输入框宽度限制 -->
type="textarea" <!-- 文本域类型 -->
:rows="8" <!-- 行数 -->
placeholder="评论内容" <!-- 占位符 -->
v-model="ruleForm.content" readonly> <!-- 只读绑定 -->
</el-input>
</el-form-item>
<!-- 评论内容显示查看模式 -->
<div v-else>
<el-form-item v-if="ruleForm.content" label="评论内容" prop="content">
<span>{{ruleForm.content}}</span> <!-- 显示评论内容 -->
</el-form-item>
</div>
</el-col>
</el-row>
<!-- 回复内容区域 -->
<el-row>
<el-col :span="24">
<!-- 回复内容输入框编辑模式 -->
<el-form-item class="textarea" v-if="type!='info'" label="回复内容" prop="reply">
<el-input
style="min-width: 200px; max-width: 600px;" <!-- 输入框宽度限制 -->
type="textarea" <!-- 文本域类型 -->
:rows="8" <!-- 行数 -->
placeholder="回复内容" <!-- 占位符 -->
v-model="ruleForm.reply"> <!-- 绑定回复内容 -->
</el-input>
</el-form-item>
<!-- 回复内容显示查看模式 -->
<div v-else>
<el-form-item v-if="ruleForm.reply" label="回复内容" prop="reply">
<span>{{ruleForm.reply}}</span> <!-- 显示回复内容 -->
</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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
addEditForm: {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"rgba(152, 129, 129, 1)","inputBorderRadius":"22px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"22px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"22px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"#606266","addEditBoxColor":"rgba(210, 194, 194, 0.29)","dateIconFontSize":"14px","btnSaveBgColor":"#409EFF","uploadIconFontColor":"#8c939d","textareaBorderColor":"rgba(152, 129, 129, 1)","btnCancelBgColor":"rgba(143, 222, 143, 1)","selectLableColor":"#606266","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"22px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"#606266","dateBorderColor":"rgba(152, 129, 129, 1)","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"#606266","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"#606266","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"22px","inputBgColor":"rgba(252, 250, 250, 1)","inputLableFontSize":"14px","uploadLableColor":"#606266","uploadBorderRadius":"22px","btnSaveHeight":"44px","selectBgColor":"#fff","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"rgba(152, 129, 129, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","uploadBorderColor":"rgba(152, 129, 129, 1)","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"22px","selectFontColor":"#606266","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"1px"}, //
id: '', // ID
type: '', //
ro:{
refid : false, // ID
userid : false, // ID
content : false, //
reply : false, //
},
ruleForm: {
refid: '', // ID
userid: '', // ID
content: '', //
reply: '', //
},
rules: {
refid: [
{ required: true, message: '关联表id不能为空', trigger: 'blur' }, // ID
],
userid: [
{ required: true, message: '用户id不能为空', trigger: 'blur' }, // ID
],
content: [
{ required: true, message: '评论内容不能为空', trigger: 'blur' }, //
],
reply: [
], //
}
};
},
props: ["parent"], //
computed: {}, //
created() {
this.addEditStyleChange(); //
this.addEditUploadStyleChange(); //
},
methods: {
//
download(file){
window.open(`${file}`); //
},
//
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
if(this.type=='info'||this.type=='else'){
this.info(id); //
}else if(this.type=='cross'){
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){
if(o=='refid'){
this.ruleForm.refid = obj[o]; // ID
this.ro.refid = true; //
continue;
}
if(o=='userid'){
this.ruleForm.userid = obj[o]; // ID
this.ro.userid = true; //
continue;
}
if(o=='content'){
this.ruleForm.content = obj[o]; //
this.ro.content = true; //
continue;
}
if(o=='reply'){
this.ruleForm.reply = obj[o]; //
this.ro.reply = true; //
continue;
}
}
}
},
//
info(id) {
this.$http({
url: `discussfangwuxinxi/info/${id}`, //
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.ruleForm = data.data; //
} else {
this.$message.error(data.msg); //
}
});
},
//
onSubmit() {
// ${column.compare}
// ${column.compare}
// ${column.compare}
// ${column.compare}
this.$refs["ruleForm"].validate(valid => { //
if (valid) {
this.$http({
url: `discussfangwuxinxi/${!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.discussfangwuxinxiCrossAddOrUpdateFlag = 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.discussfangwuxinxiCrossAddOrUpdateFlag = false; //
this.parent.contentStyleChange(); //
},
//
addEditStyleChange() {
this.$nextTick(()=>{
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight; //
el.style.color = this.addEditForm.inputFontColor; //
el.style.fontSize = this.addEditForm.inputFontSize; //
el.style.borderWidth = this.addEditForm.inputBorderWidth; //
el.style.borderStyle = this.addEditForm.inputBorderStyle; //
el.style.borderColor = this.addEditForm.inputBorderColor; //
el.style.borderRadius = this.addEditForm.inputBorderRadius; //
el.style.backgroundColor = this.addEditForm.inputBgColor; //
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight; //
el.style.color = this.addEditForm.inputLableColor; //
el.style.fontSize = this.addEditForm.inputLableFontSize; //
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight; //
el.style.color = this.addEditForm.selectFontColor; //
el.style.fontSize = this.addEditForm.selectFontSize; //
el.style.borderWidth = this.addEditForm.selectBorderWidth; //
el.style.borderStyle = this.addEditForm.selectBorderStyle; //
el.style.borderColor = this.addEditForm.selectBorderColor; //
el.style.borderRadius = this.addEditForm.selectBorderRadius; //
el.style.backgroundColor = this.addEditForm.selectBgColor; //
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight; //
el.style.color = this.addEditForm.selectLableColor; //
el.style.fontSize = this.addEditForm.selectLableFontSize; //
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor; //
el.style.fontSize = this.addEditForm.selectIconFontSize; //
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight; //
el.style.color = this.addEditForm.dateFontColor; //
el.style.fontSize = this.addEditForm.dateFontSize; //
el.style.borderWidth = this.addEditForm.dateBorderWidth; //
el.style.borderStyle = this.addEditForm.dateBorderStyle; //
el.style.borderColor = this.addEditForm.dateBorderColor; //
el.style.borderRadius = this.addEditForm.dateBorderRadius; //
el.style.backgroundColor = this.addEditForm.dateBgColor; //
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight; //
el.style.color = this.addEditForm.dateLableColor; //
el.style.fontSize = this.addEditForm.dateLableFontSize; //
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor; //
el.style.fontSize = this.addEditForm.dateIconFontSize; //
el.style.lineHeight = this.addEditForm.dateHeight; //
});
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px'; //
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight; //
el.style.height = this.addEditForm.uploadHeight; //
el.style.borderWidth = this.addEditForm.uploadBorderWidth; //
el.style.borderStyle = this.addEditForm.uploadBorderStyle; //
el.style.borderColor = this.addEditForm.uploadBorderColor; //
el.style.borderRadius = this.addEditForm.uploadBorderRadius; //
el.style.backgroundColor = this.addEditForm.uploadBgColor; //
});
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight; //
el.style.color = this.addEditForm.uploadLableColor; //
el.style.fontSize = this.addEditForm.uploadLableFontSize; //
});
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor; //
el.style.fontSize = this.addEditForm.uploadIconFontSize; //
el.style.lineHeight = iconLineHeight; //
el.style.display = 'block'; //
});
//
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight; //
el.style.color = this.addEditForm.textareaFontColor; //
el.style.fontSize = this.addEditForm.textareaFontSize; //
el.style.borderWidth = this.addEditForm.textareaBorderWidth; //
el.style.borderStyle = this.addEditForm.textareaBorderStyle; //
el.style.borderColor = this.addEditForm.textareaBorderColor; //
el.style.borderRadius = this.addEditForm.textareaBorderRadius; //
el.style.backgroundColor = this.addEditForm.textareaBgColor; //
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight; //
el.style.color = this.addEditForm.textareaLableColor; //
el.style.fontSize = this.addEditForm.textareaLableFontSize; //
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth; //
el.style.height = this.addEditForm.btnSaveHeight; //
el.style.color = this.addEditForm.btnSaveFontColor; //
el.style.fontSize = this.addEditForm.btnSaveFontSize; //
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth; //
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle; //
el.style.borderColor = this.addEditForm.btnSaveBorderColor; //
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius; //
el.style.backgroundColor = this.addEditForm.btnSaveBgColor; //
});
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth; //
el.style.height = this.addEditForm.btnCancelHeight; //
el.style.color = this.addEditForm.btnCancelFontColor; //
el.style.fontSize = this.addEditForm.btnCancelFontSize; //
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth; //
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle; //
el.style.borderColor = this.addEditForm.btnCancelBorderColor; //
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius; //
el.style.backgroundColor = this.addEditForm.btnCancelBgColor; //
});
});
},
//
addEditUploadStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight; //
el.style.height = this.addEditForm.uploadHeight; //
el.style.borderWidth = this.addEditForm.uploadBorderWidth; //
el.style.borderStyle = this.addEditForm.uploadBorderStyle; //
el.style.borderColor = this.addEditForm.uploadBorderColor; //
el.style.borderRadius = this.addEditForm.uploadBorderRadius; //
el.style.backgroundColor = this.addEditForm.uploadBgColor; //
});
});
},
}
};
</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,525 @@
<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.content" placeholder="评论内容" clearable></el-input>
<!-- 带后缀图标的输入框 -->
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.content" placeholder="评论内容" clearable></el-input>
<!-- 不带图标的输入框 -->
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.content" 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('discussfangwuxinxi','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 新增按钮带后缀图标 -->
<el-button
v-if="isAuth('discussfangwuxinxi','新增') && 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('discussfangwuxinxi','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮带前缀图标 -->
<el-button
v-if="isAuth('discussfangwuxinxi','删除') && 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('discussfangwuxinxi','删除') && 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('discussfangwuxinxi','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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}"
: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="content"
header-align="center"
label="评论内容">
<template slot-scope="scope">
{{scope.row.content}} <!-- 显示评论内容 -->
</template>
</el-table-column>
<!-- 回复内容列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="reply"
header-align="center"
label="回复内容">
<template slot-scope="scope">
{{scope.row.reply}} <!-- 显示回复内容 -->
</template>
</el-table-column>
<!-- 操作列 -->
<el-table-column width="300" :align="contents.tableAlign"
header-align="center"
label="操作">
<template slot-scope="scope">
<!-- 详情按钮带前缀图标 -->
<el-button v-if=" 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=" 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=" contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮带前缀图标 -->
<el-button v-if="isAuth('discussfangwuxinxi','修改') && 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('discussfangwuxinxi','修改') && 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('discussfangwuxinxi','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 查看评论按钮带前缀图标 -->
<el-button v-if="isAuth('discussfangwuxinxi','查看评论') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="primary" icon="el-icon-edit" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 查看评论按钮带后缀图标 -->
<el-button v-if="isAuth('discussfangwuxinxi','查看评论') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="primary" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-edit el-icon--right" /></el-button>
<!-- 查看评论按钮不带图标 -->
<el-button v-if="isAuth('discussfangwuxinxi','查看评论') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 回复按钮带前缀图标 -->
<el-button v-if="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="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="contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮带前缀图标 -->
<el-button v-if=" 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=" 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=" 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>
</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:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"}, //
layouts: '', //
};
},
created() {
this.init(); //
this.getDataList(); //
this.contentStyleChange(); //
},
mounted() {
//
},
filters: {
htmlfilter: function (val) {
return val.replace(/<[^>]*>/g).replace(/undefined/g,''); // HTMLundefined
}
},
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; //
},
init () {
//
},
search() {
this.pageIndex = 1; //
this.getDataList(); //
},
//
getDataList() {
this.dataListLoading = true; //
let params = {
page: this.pageIndex, //
limit: this.pageSize, //
sort: 'id', //
refid : this.$route.query.refid, // ID
}
if(this.searchForm.content!='' && this.searchForm.content!=undefined){
params['content'] = '%' + this.searchForm.content + '%'; //
}
this.$http({
url: "discussfangwuxinxi/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); //
});
},
//
disscussListHandler(id,type) {
this.$router.push({path:'/discussdiscussfangwuxinxi',query:{refid:id}}); //
},
//
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: "discussfangwuxinxi/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,332 @@
<template>
<!-- 主容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm" <!-- 表单引用 -->
:model="ruleForm" <!-- 绑定表单数据模型 -->
:rules="rules" <!-- 绑定验证规则 -->
label-width="80px" <!-- 标签宽度 -->
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 动态背景色 -->
>
<!-- 空行 -->
<el-row></el-row>
<!-- 评论内容区域 -->
<el-row>
<el-col :span="24"> <!-- 占满整列 -->
<!-- 编辑模式下的评论内容输入框 -->
<el-form-item class="textarea" v-if="type!='info'" label="评论内容" prop="content">
<el-input
style="min-width: 200px; max-width: 600px;" <!-- 输入框宽度限制 -->
type="textarea" <!-- 文本域类型 -->
:rows="8" <!-- 显示行数 -->
placeholder="评论内容" <!-- 占位符 -->
v-model="ruleForm.content" readonly> <!-- 双向绑定并只读 -->
</el-input>
</el-form-item>
<!-- 查看模式下的评论内容显示 -->
<div v-else>
<el-form-item v-if="ruleForm.content" label="评论内容" prop="content">
<span>{{ruleForm.content}}</span> <!-- 显示评论内容 -->
</el-form-item>
</div>
</el-col>
</el-row>
<!-- 回复内容区域 -->
<el-row>
<el-col :span="24"> <!-- 占满整列 -->
<!-- 编辑模式下的回复内容输入框 -->
<el-form-item class="textarea" v-if="type!='info'" label="回复内容" prop="reply">
<el-input
style="min-width: 200px; max-width: 600px;" <!-- 输入框宽度限制 -->
type="textarea" <!-- 文本域类型 -->
:rows="8" <!-- 显示行数 -->
placeholder="回复内容" <!-- 占位符 -->
v-model="ruleForm.reply"> <!-- 双向绑定回复内容 -->
</el-input>
</el-form-item>
<!-- 查看模式下的回复内容显示 -->
<div v-else>
<el-form-item v-if="ruleForm.reply" label="回复内容" prop="reply">
<span>{{ruleForm.reply}}</span> <!-- 显示回复内容 -->
</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(); //
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback(); //
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码")); //
} else {
callback(); //
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback(); //
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址")); //
} else {
callback(); //
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback(); //
} else if (!isNumber(value)) {
callback(new Error("请输入数字")); //
} else {
callback(); //
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback(); //
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数")); //
} else {
callback(); //
}
};
return {
//
addEditForm: {"btnSaveFontColor":"#fff","selectFontSize":"14px",...}, //
id: '', // ID
type: '', // //
ro:{ //
refid : false,
userid : false,
content : false,
reply : false,
},
ruleForm: { //
refid: '',
userid: '',
content: '',
reply: '',
},
rules: { //
refid: [
{ required: true, message: '关联表id不能为空', trigger: 'blur' }, //
],
userid: [
{ required: true, message: '用户id不能为空', trigger: 'blur' }, //
],
content: [
{ required: true, message: '评论内容不能为空', trigger: 'blur' }, //
],
reply: [] //
}
};
},
props: ["parent"], //
computed: {}, //
created() { //
this.addEditStyleChange(); //
this.addEditUploadStyleChange(); //
},
methods: {
//
download(file){
window.open(`${file}`); //
},
//
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
if(this.type=='info'||this.type=='else'){
this.info(id); //
}else if(this.type=='cross'){
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){
if(o=='refid'){ // refid
this.ruleForm.refid = obj[o];
this.ro.refid = true; //
continue;
}
if(o=='userid'){ // userid
this.ruleForm.userid = obj[o];
this.ro.userid = true; //
continue;
}
if(o=='content'){ // content
this.ruleForm.content = obj[o];
this.ro.content = true; //
continue;
}
if(o=='reply'){ // reply
this.ruleForm.reply = obj[o];
this.ro.reply = true; //
continue;
}
}
}
},
//
info(id) {
this.$http({
url: `discusswoyaodangfangzhu/info/${id}`, //
method: "get" // 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: `discusswoyaodangfangzhu/${!this.ruleForm.id ? "save" : "update"}`, //
method: "post", // 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.discusswoyaodangfangzhuCrossAddOrUpdateFlag = 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.discusswoyaodangfangzhuCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange(); //
},
//
addEditStyleChange() {
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight; //
el.style.color = this.addEditForm.inputFontColor; //
// ...
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight; //
// ...
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth; //
// ...
});
})
},
//
addEditUploadStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight; //
el.style.height = this.addEditForm.uploadHeight; //
// ...
})
})
},
}
};
</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; /* 移除默认padding */
}
</style>

@ -0,0 +1,737 @@
<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.content"
placeholder="评论内容"
clearable
></el-input>
<!-- 带后缀图标的输入框 -->
<el-input
v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2"
suffix-icon="el-icon-search"
v-model="searchForm.content"
placeholder="评论内容"
clearable
></el-input>
<!-- 无图标的输入框 -->
<el-input
v-if="contents.inputIcon == 0"
v-model="searchForm.content"
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('discusswoyaodangfangzhu','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 新增按钮后置图标 -->
<el-button
v-if="isAuth('discusswoyaodangfangzhu','新增') && 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('discusswoyaodangfangzhu','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮前置图标 -->
<el-button
v-if="isAuth('discusswoyaodangfangzhu','删除') && 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('discusswoyaodangfangzhu','删除') && 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('discusswoyaodangfangzhu','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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
}"
: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="content"
header-align="center"
label="评论内容"
>
<template slot-scope="scope">
{{ scope.row.content }}
</template>
</el-table-column>
<!-- 回复内容列 -->
<el-table-column
:sortable="contents.tableSortable"
:align="contents.tableAlign"
prop="reply"
header-align="center"
label="回复内容"
>
<template slot-scope="scope">
{{ scope.row.reply }}
</template>
</el-table-column>
<!-- 操作列 -->
<el-table-column
width="300"
:align="contents.tableAlign"
header-align="center"
label="操作"
>
<template slot-scope="scope">
<!-- 查看详情按钮 -->
<el-button
v-if="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="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="contents.tableBtnIcon == 0"
type="success"
size="mini"
@click="addOrUpdateHandler(scope.row.id,'info')"
>{{ contents.tableBtnFont == 1?'详情':'' }}</el-button>
<!-- 修改按钮 -->
<el-button
v-if="isAuth('discusswoyaodangfangzhu','修改') && 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('discusswoyaodangfangzhu','修改') && 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('discusswoyaodangfangzhu','修改') && contents.tableBtnIcon == 0"
type="primary"
size="mini"
@click="addOrUpdateHandler(scope.row.id)"
>{{ contents.tableBtnFont == 1?'修改':'' }}</el-button>
<!-- 查看评论按钮 -->
<el-button
v-if="isAuth('discusswoyaodangfangzhu','查看评论') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1"
type="primary"
icon="el-icon-edit"
size="mini"
@click="disscussListHandler(scope.row.id)"
>{{ contents.tableBtnFont == 1?'查看评论':'' }}</el-button>
<el-button
v-if="isAuth('discusswoyaodangfangzhu','查看评论') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2"
type="primary"
size="mini"
@click="disscussListHandler(scope.row.id)"
>{{ contents.tableBtnFont == 1?'查看评论':'' }}<i class="el-icon-edit el-icon--right" /></el-button>
<el-button
v-if="isAuth('discusswoyaodangfangzhu','查看评论') && contents.tableBtnIcon == 0"
type="primary"
size="mini"
@click="disscussListHandler(scope.row.id)"
>{{ contents.tableBtnFont == 1?'查看评论':'' }}</el-button>
<!-- 回复按钮 -->
<el-button
v-if="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="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="contents.tableBtnIcon == 0"
type="primary"
size="mini"
@click="addOrUpdateHandler(scope.row.id)"
>{{ contents.tableBtnFont == 1?'回复':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="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="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="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>
</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: {
"searchBtnFontColor": "#333",
"pagePosition": "1",
"inputFontSize": "14px",
// ...
},
//
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
},
//
init () {
// ...
},
//
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
this.dataListLoading = true;
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
refid : this.$route.query.refid,
}
if(this.searchForm.content!='' && this.searchForm.content!=undefined){
params['content'] = '%' + this.searchForm.content + '%'
}
this.$http({
url: "discusswoyaodangfangzhu/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);
});
},
//
disscussListHandler(id,type) {
this.$router.push({path:'/discussdiscusswoyaodangfangzhu',query:{refid:id}});
},
//
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: "discusswoyaodangfangzhu/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,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,769 @@
<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.leixing" placeholder="类型" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.leixing" placeholder="类型" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.leixing" 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.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangzhuxingming" 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('fangwubaoxiu','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('fangwubaoxiu','新增') && 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('fangwubaoxiu','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('fangwubaoxiu','删除') && 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('fangwubaoxiu','删除') && 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('fangwubaoxiu','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('fangwubaoxiu','查看')"
: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="baoxiumingcheng"
header-align="center"
label="报修名称">
<template slot-scope="scope">
{{scope.row.baoxiumingcheng}}
</template>
</el-table-column>
<!-- 类型列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="leixing"
header-align="center"
label="类型">
<template slot-scope="scope">
{{scope.row.leixing}}
</template>
</el-table-column>
<!-- 报修内容列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="baoxiuneirong"
header-align="center"
label="报修内容">
<template slot-scope="scope">
{{scope.row.baoxiuneirong}}
</template>
</el-table-column>
<!-- 图片列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="tupian"
header-align="center"
width="200"
label="图片">
<template slot-scope="scope">
<div v-if="scope.row.tupian">
<img :src="scope.row.tupian.split(',')[0]" width="100" height="100">
</div>
<div v-else></div>
</template>
</el-table-column>
<!-- 报修日期列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="baoxiuriqi"
header-align="center"
label="报修日期">
<template slot-scope="scope">
{{scope.row.baoxiuriqi}}
</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="fangzhuxingming"
header-align="center"
label="房主姓名">
<template slot-scope="scope">
{{scope.row.fangzhuxingming}}
</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 v-if="isAuth('fangwubaoxiu','')"
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('fangwubaoxiu','查看') && 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('fangwubaoxiu','查看') && 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('fangwubaoxiu','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 处理按钮 -->
<el-button v-if="isAuth('fangwubaoxiu','处理') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="success" icon="el-icon-tickets" size="mini" @click="weixiuchuliCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('fangwubaoxiu','处理') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="success" size="mini" @click="weixiuchuliCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-tickets el-icon--right" /></el-button>
<el-button v-if="isAuth('fangwubaoxiu','处理') && contents.tableBtnIcon == 0" type="success" size="mini" @click="weixiuchuliCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('fangwubaoxiu','修改') && 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('fangwubaoxiu','修改') && 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('fangwubaoxiu','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('fangwubaoxiu','删除') && 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('fangwubaoxiu','删除') && 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('fangwubaoxiu','删除') && 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>
<!-- 处理页面 -->
<weixiuchuli-cross-add-or-update v-if="weixiuchuliCrossAddOrUpdateFlag" :parent="this" ref="weixiuchuliCrossaddOrUpdate"></weixiuchuli-cross-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>
</div>
</template>
<script>
// /
import AddOrUpdate from "./add-or-update";
//
import weixiuchuliCrossAddOrUpdate from "../weixiuchuli/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,
//
weixiuchuliCrossAddOrUpdateFlag: false,
//
contents:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
layouts: '',
};
},
//
created() {
this.init();
this.getDataList();
this.contentStyleChange()
},
//
mounted() {
},
//
filters: {
// HTML
htmlfilter: function (val) {
return val.replace(/<[^>]*>/g).replace(/undefined/g,'');
}
},
//
components: {
AddOrUpdate,
weixiuchuliCrossAddOrUpdate,
},
//
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
},
//
weixiuchuliCrossAddOrUpdateHandler(row,type){
this.showFlag = false;
this.addOrUpdateFlag = false;
this.weixiuchuliCrossAddOrUpdateFlag = true;
this.$storage.set('crossObj',row);
this.$storage.set('crossTable','fangwubaoxiu');
this.$nextTick(() => {
this.$refs.weixiuchuliCrossaddOrUpdate.init(row.id,type);
});
},
//
init () {
//
this.leixingOptions = "水工,电工,木工".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.leixing!='' && this.searchForm.leixing!=undefined){
params['leixing'] = '%' + this.searchForm.leixing + '%'
}
if(this.searchForm.fangzhuxingming!='' && this.searchForm.fangzhuxingming!=undefined){
params['fangzhuxingming'] = '%' + this.searchForm.fangzhuxingming + '%'
}
if(this.searchForm.yonghuming!='' && this.searchForm.yonghuming!=undefined){
params['yonghuming'] = '%' + this.searchForm.yonghuming + '%'
}
//
this.$http({
url: "fangwubaoxiu/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,
baoxiumingcheng: row.baoxiumingcheng,
leixing: row.leixing,
baoxiuneirong: row.baoxiuneirong,
tupian: row.tupian,
baoxiuriqi: row.baoxiuriqi,
fangzhuzhanghao: row.fangzhuzhanghao,
fangzhuxingming: row.fangzhuxingming,
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: "fangwubaoxiu/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: "fangwubaoxiu/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,499 @@
<template>
<!-- 外层容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"
>
<!-- 表单项布局行 -->
<el-row>
<!-- 占据12列半屏 -->
<el-col :span="12">
<!-- 房屋类型输入项非查看模式显示可编辑框 -->
<el-form-item class="input" v-if="type!='info'" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
placeholder="房屋类型" clearable :readonly="ro.fangwuleixing"></el-input>
</el-form-item>
<!-- 查看模式下显示只读输入框 -->
<div v-else>
<el-form-item class="input" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
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>
// URL
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();
}
};
//
var validatePhone = (rule, value, callback) => {
if (!value) {
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if (!value) {
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if (!value) {
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if (!value) {
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: {
"btnSaveFontColor": "#fff",
"selectFontSize": "14px",
"btnCancelBorderColor": "rgba(152, 129, 129, 1)",
"inputBorderRadius": "22px",
"inputFontSize": "14px",
"textareaBgColor": "#fff",
"btnSaveFontSize": "14px",
"textareaBorderRadius": "22px",
"uploadBgColor": "#fff",
"textareaBorderStyle": "solid",
"btnCancelWidth": "88px",
"textareaHeight": "120px",
"dateBgColor": "#fff",
"btnSaveBorderRadius": "22px",
"uploadLableFontSize": "14px",
"textareaBorderWidth": "1px",
"inputLableColor": "#606266",
"addEditBoxColor": "rgba(210, 194, 194, 0.29)",
"dateIconFontSize": "14px",
"btnSaveBgColor": "#409EFF",
"uploadIconFontColor": "#8c939d",
"textareaBorderColor": "rgba(152, 129, 129, 1)",
"btnCancelBgColor": "rgba(143, 222, 143, 1)",
"selectLableColor": "#606266",
"btnSaveBorderStyle": "solid",
"dateBorderWidth": "1px",
"dateLableFontSize": "14px",
"dateBorderRadius": "22px",
"btnCancelBorderStyle": "solid",
"selectLableFontSize": "14px",
"selectBorderStyle": "solid",
"selectIconFontColor": "#C0C4CC",
"btnCancelHeight": "44px",
"inputHeight": "40px",
"btnCancelFontColor": "#606266",
"dateBorderColor": "rgba(152, 129, 129, 1)",
"dateIconFontColor": "#C0C4CC",
"uploadBorderStyle": "solid",
"dateBorderStyle": "solid",
"dateLableColor": "#606266",
"dateFontSize": "14px",
"inputBorderWidth": "1px",
"uploadIconFontSize": "28px",
"selectHeight": "40px",
"inputFontColor": "#606266",
"uploadHeight": "148px",
"textareaLableColor": "#606266",
"textareaLableFontSize": "14px",
"btnCancelFontSize": "14px",
"inputBorderStyle": "solid",
"btnCancelBorderRadius": "22px",
"inputBgColor": "rgba(252, 250, 250, 1)",
"inputLableFontSize": "14px",
"uploadLableColor": "#606266",
"uploadBorderRadius": "22px",
"btnSaveHeight": "44px",
"selectBgColor": "#fff",
"btnSaveWidth": "88px",
"selectIconFontSize": "14px",
"dateHeight": "40px",
"selectBorderColor": "rgba(152, 129, 129, 1)",
"inputBorderColor": "rgba(152, 129, 129, 1)",
"uploadBorderColor": "rgba(152, 129, 129, 1)",
"textareaFontColor": "#606266",
"selectBorderWidth": "1px",
"dateFontColor": "#606266",
"btnCancelBorderWidth": "1px",
"uploadBorderWidth": "1px",
"textareaFontSize": "14px",
"selectBorderRadius": "22px",
"selectFontColor": "#606266",
"btnSaveBorderColor": "#409EFF",
"btnSaveBorderWidth": "1px"
},
id: '', // ID
type: '', //
ro: { //
fangwuleixing: false,
},
ruleForm: { //
fangwuleixing: '',
},
rules: { //
fangwuleixing: [
{ required: true, message: '房屋类型不能为空', trigger: 'blur' },
],
}
};
},
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') {
// storage
var obj = this.$storage.getObj('crossObj');
for (var o in obj) {
if (o == 'fangwuleixing') {
this.ruleForm.fangwuleixing = obj[o];
this.ro.fangwuleixing = true;
continue;
}
}
}
//
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);
}
});
},
//
info(id) {
this.$http({
url: `fangwuleixing/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: `fangwuleixing/${!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.fangwuleixingCrossAddOrUpdateFlag = false;
this.parent.search();
this.parent.contentStyleChange();
}
});
} else {
this.$message.error(data.msg);
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true;
this.parent.addOrUpdateFlag = false;
this.parent.fangwuleixingCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
addEditStyleChange() {
this.$nextTick(() => {
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputFontColor;
el.style.fontSize = this.addEditForm.inputFontSize;
el.style.borderWidth = this.addEditForm.inputBorderWidth;
el.style.borderStyle = this.addEditForm.inputBorderStyle;
el.style.borderColor = this.addEditForm.inputBorderColor;
el.style.borderRadius = this.addEditForm.inputBorderRadius;
el.style.backgroundColor = this.addEditForm.inputBgColor;
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputLableColor;
el.style.fontSize = this.addEditForm.inputLableFontSize;
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectFontColor;
el.style.fontSize = this.addEditForm.selectFontSize;
el.style.borderWidth = this.addEditForm.selectBorderWidth;
el.style.borderStyle = this.addEditForm.selectBorderStyle;
el.style.borderColor = this.addEditForm.selectBorderColor;
el.style.borderRadius = this.addEditForm.selectBorderRadius;
el.style.backgroundColor = this.addEditForm.selectBgColor;
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectLableColor;
el.style.fontSize = this.addEditForm.selectLableFontSize;
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor;
el.style.fontSize = this.addEditForm.selectIconFontSize;
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateFontColor;
el.style.fontSize = this.addEditForm.dateFontSize;
el.style.borderWidth = this.addEditForm.dateBorderWidth;
el.style.borderStyle = this.addEditForm.dateBorderStyle;
el.style.borderColor = this.addEditForm.dateBorderColor;
el.style.borderRadius = this.addEditForm.dateBorderRadius;
el.style.backgroundColor = this.addEditForm.dateBgColor;
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateLableColor;
el.style.fontSize = this.addEditForm.dateLableFontSize;
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor;
el.style.fontSize = this.addEditForm.dateIconFontSize;
el.style.lineHeight = this.addEditForm.dateHeight;
});
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px';
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight;
el.style.color = this.addEditForm.uploadLableColor;
el.style.fontSize = this.addEditForm.uploadLableFontSize;
});
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor;
el.style.fontSize = this.addEditForm.uploadIconFontSize;
el.style.lineHeight = iconLineHeight;
el.style.display = 'block';
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight;
el.style.color = this.addEditForm.textareaFontColor;
el.style.fontSize = this.addEditForm.textareaFontSize;
el.style.borderWidth = this.addEditForm.textareaBorderWidth;
el.style.borderStyle = this.addEditForm.textareaBorderStyle;
el.style.borderColor = this.addEditForm.textareaBorderColor;
el.style.borderRadius = this.addEditForm.textareaBorderRadius;
el.style.backgroundColor = this.addEditForm.textareaBgColor;
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
el.style.color = this.addEditForm.textareaLableColor;
el.style.fontSize = this.addEditForm.textareaLableFontSize;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth;
el.style.height = this.addEditForm.btnSaveHeight;
el.style.color = this.addEditForm.btnSaveFontColor;
el.style.fontSize = this.addEditForm.btnSaveFontSize;
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth;
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle;
el.style.borderColor = this.addEditForm.btnSaveBorderColor;
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius;
el.style.backgroundColor = this.addEditForm.btnSaveBgColor;
});
// /
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth;
el.style.height = this.addEditForm.btnCancelHeight;
el.style.color = this.addEditForm.btnCancelFontColor;
el.style.fontSize = this.addEditForm.btnCancelFontSize;
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth;
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle;
el.style.borderColor = this.addEditForm.btnCancelBorderColor;
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius;
el.style.backgroundColor = this.addEditForm.btnCancelBgColor;
});
});
},
//
addEditUploadStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
});
},
}
};
</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,524 @@
<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.fangwuleixing" placeholder="房屋类型" clearable></el-input>
<!-- 后缀图标搜索框 -->
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangwuleixing" placeholder="房屋类型" clearable></el-input>
<!-- 无图标搜索框 -->
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangwuleixing" 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('fangwuleixing','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 不同图标位置的新增按钮 -->
<el-button
v-if="isAuth('fangwuleixing','新增') && 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('fangwuleixing','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除操作按钮 -->
<el-button
v-if="isAuth('fangwuleixing','删除') && 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('fangwuleixing','删除') && 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('fangwuleixing','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('fangwuleixing','查看')"
: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="fangwuleixing"
header-align="center"
label="房屋类型">
<template slot-scope="scope">
{{scope.row.fangwuleixing}}
</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('fangwuleixing','查看') && 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('fangwuleixing','查看') && 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('fangwuleixing','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('fangwuleixing','修改') && 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('fangwuleixing','修改') && 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('fangwuleixing','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('fangwuleixing','删除') && 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('fangwuleixing','删除') && 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('fangwuleixing','删除') && 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>
</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
},
//
init () {
},
//
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
this.dataListLoading = true;
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
}
if(this.searchForm.fangwuleixing!='' && this.searchForm.fangwuleixing!=undefined){
params['fangwuleixing'] = '%' + this.searchForm.fangwuleixing + '%'
}
this.$http({
url: "fangwuleixing/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);
});
},
//
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: "fangwuleixing/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,585 @@
<template>
<!-- 添加/编辑表单容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 设置表单背景颜色 -->
>
<el-row> <!-- 表单布局行 -->
<el-col :span="12"> <!-- 左侧列宽度为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"> <!-- 右侧列宽度为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="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="房屋类型" prop="fangwuleixing"> <!-- -->
<el-input v-model="ruleForm.fangwuleixing"
placeholder="房屋类型" clearable :readonly="ro.fangwuleixing"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
placeholder="房屋类型" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="小区" prop="xiaoqu"> <!-- -->
<el-input v-model="ruleForm.xiaoqu"
placeholder="小区" clearable :readonly="ro.xiaoqu"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="小区" prop="xiaoqu">
<el-input v-model="ruleForm.xiaoqu"
placeholder="小区" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="select" v-if="type!='info'" label="评分" prop="pingfen"> <!-- -->
<el-select v-model="ruleForm.pingfen" placeholder="请选择评分">
<el-option
v-for="(item,index) in pingfenOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="评分" prop="pingfen">
<el-input v-model="ruleForm.pingfen"
placeholder="评分" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="date" v-if="type!='info'" label="评价日期" prop="pingjiariqi"> <!-- -->
<el-date-picker
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
v-model="ruleForm.pingjiariqi"
type="date"
placeholder="评价日期">
</el-date-picker>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" v-if="ruleForm.pingjiariqi" label="评价日期" prop="pingjiariqi">
<el-input v-model="ruleForm.pingjiariqi"
placeholder="评价日期" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="房主账号" prop="fangzhuzhanghao"> <!-- -->
<el-input v-model="ruleForm.fangzhuzhanghao"
placeholder="房主账号" clearable :readonly="ro.fangzhuzhanghao"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="房主账号" prop="fangzhuzhanghao">
<el-input v-model="ruleForm.fangzhuzhanghao"
placeholder="房主账号" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="用户名" prop="yonghuming"> <!-- -->
<el-input v-model="ruleForm.yonghuming"
placeholder="用户名" clearable :readonly="ro.yonghuming"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="用户名" prop="yonghuming">
<el-input v-model="ruleForm.yonghuming"
placeholder="用户名" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="联系电话" prop="lianxidianhua"> <!-- -->
<el-input v-model="ruleForm.lianxidianhua"
placeholder="联系电话" clearable :readonly="ro.lianxidianhua"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="联系电话" prop="lianxidianhua">
<el-input v-model="ruleForm.lianxidianhua"
placeholder="联系电话" readonly></el-input>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row> <!-- 新的表单布局行 -->
<el-col :span="24"> <!-- 占满整行 -->
<el-form-item class="textarea" v-if="type!='info'" label="评价内容" prop="pingjianeirong"> <!-- -->
<el-input
style="min-width: 200px; max-width: 600px;" <!-- 设置文本框宽度范围 -->
type="textarea"
:rows="8" <!-- 设置文本框行数 -->
placeholder="评价内容"
v-model="ruleForm.pingjianeirong" >
</el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item v-if="ruleForm.pingjianeirong" label="评价内容" prop="pingjianeirong">
<span>{{ruleForm.pingjianeirong}}</span>
</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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: { /* 样式配置参数 */ },
id: '',
type: '',
ro:{
//
hetongbianhao : false,
fangwumingcheng : false,
fangwuleixing : false,
xiaoqu : false,
pingfen : false,
pingjianeirong : false,
pingjiariqi : false,
fangzhuzhanghao : false,
yonghuming : false,
.lianxidianhua : false,
sfsh : false,
shhf : false,
},
//
ruleForm: {
hetongbianhao: '',
fangwumingcheng: '',
fangwuleixing: '',
xiaoqu: '',
pingfen: '',
pingjianeirong: '',
pingjiariqi: '',
fangzhuzhanghao: '',
yonghuming: '',
lianxidianhua: '',
shhf: '',
},
//
pingfenOptions: [],
//
rules: {
hetongbianhao: [
],
fangwumingcheng: [
],
fangwuleixing: [
],
xiaoqu: [
],
pingfen: [
],
pingjianeirong: [
],
pingjiariqi: [
],
fangzhuzhanghao: [
],
yonghuming: [
],
lianxidianhua: [
],
sfsh: [
],
shhf: [
],
}
};
},
props: ["parent"], //
computed: {
},
created() {
this.addEditStyleChange() //
this.addEditUploadStyleChange() //
},
methods: {
//
download(file){
window.open(`${file}`)
},
//
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
if(this.type=='info'||this.type=='else'){ //
this.info(id); //
}else if(this.type=='cross'){ //
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){ //
if(o=='hetongbianhao'){
this.ruleForm.hetongbianhao = obj[o]; //
this.ro.hetongbianhao = true; //
continue;
}
if(o=='fangwumingcheng'){
this.ruleForm.fangwumingcheng = obj[o]; //
this.ro.fangwumingcheng = true; //
continue;
}
if(o=='fangwuleixing'){
this.ruleForm.fangwuleixing = obj[o]; //
this.ro.fangwuleixing = true; //
continue;
}
if(o=='xiaoqu'){
this.ruleForm.xiaoqu = obj[o]; //
this.ro.xiaoqu = true; //
continue;
}
if(o=='pingfen'){
this.ruleForm.pingfen = obj[o]; //
this.ro.pingfen = true; //
continue;
}
if(o=='pingjianeirong'){
this.ruleForm.pingjianeirong = obj[o]; //
this.ro.pingjianeirong = true; //
continue;
}
if(o=='pingjiariqi'){
this.ruleForm.pingjiariqi = obj[o]; //
this.ro.pingjiariqi = true; //
continue;
}
if(o=='fangzhuzhanghao'){
this.ruleForm.fangzhuzhanghao = obj[o]; //
this.ro.fangzhuzhanghao = true; //
continue;
}
if(o=='yonghuming'){
this.ruleForm.yonghuming = obj[o]; //
this.ro.yonghuming = true; //
continue;
}
if(o=='lianxidianhua'){
this.ruleForm.lianxidianhua = obj[o]; //
this.ro.lianxidianhua = true; //
continue;
}
}
}
//
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.pingfenOptions = "1,2,3,4,5".split(','); //
},
//
info(id) {
this.$http({
url: `fangwupingjia/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: `fangwupingjia/${!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.fangwupingjiaCrossAddOrUpdateFlag = false; //
this.parent.search(); //
this.parent.contentStyleChange(); //
}
});
} else {
this.$message.error(data.msg); //
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true; //
this.parent.addOrUpdateFlag = false; //
this.parent.fangwupingjiaCrossAddOrUpdateFlag = false; //
this.parent.contentStyleChange(); //
},
addEditStyleChange() { //
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputFontColor;
el.style.fontSize = this.addEditForm.inputFontSize;
el.style.borderWidth = this.addEditForm.inputBorderWidth;
el.style.borderStyle = this.addEditForm.inputBorderStyle;
el.style.borderColor = this.addEditForm.inputBorderColor;
el.style.borderRadius = this.addEditForm.inputBorderRadius;
el.style.backgroundColor = this.addEditForm.inputBgColor;
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputLableColor;
el.style.fontSize = this.addEditForm.inputLableFontSize;
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectFontColor;
el.style.fontSize = this.addEditForm.selectFontSize;
el.style.borderWidth = this.addEditForm.selectBorderWidth;
el.style.borderStyle = this.addEditForm.selectBorderStyle;
el.style.borderColor = this.addEditForm.selectBorderColor;
el.style.borderRadius = this.addEditForm.selectBorderRadius;
el.style.backgroundColor = this.addEditForm.selectBgColor;
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectLableColor;
el.style.fontSize = this.addEditForm.selectLableFontSize;
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor;
el.style.fontSize = this.addEditForm.selectIconFontSize;
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateFontColor;
el.style.fontSize = this.addEditForm.dateFontSize;
el.style.borderWidth = this.addEditForm.dateBorderWidth;
el.style.borderStyle = this.addEditForm.dateBorderStyle;
el.style.borderColor = this.addEditForm.dateBorderColor;
el.style.borderRadius = this.addEditForm.dateBorderRadius;
el.style.backgroundColor = this.addEditForm.dateBgColor;
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateLableColor;
el.style.fontSize = this.addEditForm.dateLableFontSize;
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor;
el.style.fontSize = this.addEditForm.dateIconFontSize;
el.style.lineHeight = this.addEditForm.dateHeight;
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight;
el.style.color = this.addEditForm.textareaFontColor;
el.style.fontSize = this.addEditForm.textareaFontSize;
el.style.borderWidth = this.addEditForm.textareaBorderWidth;
el.style.borderStyle = this.addEditForm.textareaBorderStyle;
el.style.borderColor = this.addEditForm.textareaBorderColor;
el.style.borderRadius = this.addEditForm.textareaBorderRadius;
el.style.backgroundColor = this.addEditForm.textareaBgColor;
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
el.style.color = this.addEditForm.textareaLableColor;
el.style.fontSize = this.addEditForm.textareaLableFontSize;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth;
el.style.height = this.addEditForm.btnSaveHeight;
el.style.color = this.addEditForm.btnSaveFontColor;
el.style.fontSize = this.addEditForm.btnSaveFontSize;
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth;
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle;
el.style.borderColor = this.addEditForm.btnSaveBorderColor;
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius;
el.style.backgroundColor = this.addEditForm.btnSaveBgColor;
});
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth;
el.style.height = this.addEditForm.btnCancelHeight;
el.style.color = this.addEditForm.btnCancelFontColor;
el.style.fontSize = this.addEditForm.btnCancelFontSize;
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth;
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle;
el.style.borderColor = this.addEditForm.btnCancelBorderColor;
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius;
el.style.backgroundColor = this.addEditForm.btnCancelBgColor;
});
});
},
addEditUploadStyleChange() { //
this.$nextTick(()=>{ // DOM
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
});
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px; <!-- 编辑器高度 -->
& /deep/ .ql-container { <!-- 编辑器内容区域 -->
height: 310px; <!-- 设置内容区域高度 -->
}
}
.amap-wrapper { <!-- 地图容器 -->
width: 100%; <!-- 宽度为100% -->
height: 500px; <!-- 高度为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,808 @@
<template>
<!-- 添加/编辑页面容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 设置表单背景颜色 -->
>
<el-row> <!-- 表单布局行 -->
<el-col :span="12"> <!-- 左侧列宽度为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="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="select" v-if="type!='info'" label="房屋类型" prop="fangwuleixing"> <!-- -->
<el-select v-model="ruleForm.fangwuleixing" placeholder="请选择房屋类型">
<el-option
v-for="(item,index) in fangwuleixingOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
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"> <!-- 左侧列宽度为12 -->
<el-form-item class="select" v-if="type!='info'" label="租赁方式" prop="zulinfangshi"> <!-- -->
<el-select v-model="ruleForm.zulinfangshi" placeholder="请选择租赁方式">
<el-option
v-for="(item,index) in zulinfangshiOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="租赁方式" prop="zulinfangshi">
<el-input v-model="ruleForm.zulinfangshi"
placeholder="租赁方式" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="朝向楼层" prop="chaoxianglouceng"> <!-- -->
<el-input v-model="ruleForm.chaoxianglouceng"
placeholder="朝向楼层" clearable :readonly="ro.chaoxianglouceng"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="朝向楼层" prop="chaoxianglouceng">
<el-input v-model="ruleForm.chaoxianglouceng"
placeholder="朝向楼层" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="面积" prop="mianji"> <!-- -->
<el-input v-model="ruleForm.mianji"
placeholder="面积" clearable :readonly="ro.mianji"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="面积" prop="mianji">
<el-input v-model="ruleForm.mianji"
placeholder="面积" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="select" v-if="type!='info'" label="房屋状态" prop="fangwuzhuangtai"> <!-- -->
<el-select v-model="ruleForm.fangwuzhuangtai" placeholder="请选择房屋状态">
<el-option
v-for="(item,index) in fangwuzhuangtaiOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="房屋状态" prop="fangwuzhuangtai">
<el-input v-model="ruleForm.fangwuzhuangtai"
placeholder="房屋状态" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="小区" prop="xiaoqu"> <!-- -->
<el-input v-model="ruleForm.xiaoqu"
placeholder="小区" clearable :readonly="ro.xiaoqu"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="小区" prop="xiaoqu">
<el-input v-model="ruleForm.xiaoqu"
placeholder="小区" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="详细地址" prop="xiangxidizhi"> <!-- -->
<el-input v-model="ruleForm.xiangxidizhi"
placeholder="详细地址" clearable :readonly="ro.xiangxidizhi"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="详细地址" prop="xiangxidizhi">
<el-input v-model="ruleForm.xiangxidizhi"
placeholder="详细地址" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="月租价格" prop="yuezujiage"> <!-- -->
<el-input v-model="ruleForm.yuezujiage"
placeholder="月租价格" clearable :readonly="ro.yuezujiage"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="月租价格" prop="yuezujiage">
<el-input v-model="ruleForm.yuezujiage"
placeholder="月租价格" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="押金" prop="yajin"> <!-- -->
<el-input v-model="ruleForm.yajin"
placeholder="押金" clearable :readonly="ro.yajin"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="押金" prop="yajin">
<el-input v-model="ruleForm.yajin"
placeholder="押金" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="房屋设施" prop="fangwusheshi"> <!-- -->
<el-input v-model="ruleForm.fangwusheshi"
placeholder="房屋设施" clearable :readonly="ro.fangwusheshi"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="房屋设施" prop="fangwusheshi">
<el-input v-model="ruleForm.fangwusheshi"
placeholder="房屋设施" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="date" v-if="type!='info'" label="发布日期" prop="faburiqi"> <!-- -->
<el-date-picker
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
v-model="ruleForm.faburiqi"
type="date"
placeholder="发布日期">
</el-date-picker>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" v-if="ruleForm.faburiqi" label="发布日期" prop="faburiqi">
<el-input v-model="ruleForm.faburiqi"
placeholder="发布日期" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="select" v-if="type!='info'" label="房主账号" prop="fangzhuzhanghao"> <!-- -->
<el-select @change="fangzhuzhanghaoChange" v-model="ruleForm.fangzhuzhanghao" placeholder="请选择房主账号">
<el-option
v-for="(item,index) in fangzhuzhanghaoOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input"v-if="ruleForm.fangzhuzhanghao" label="房主账号" prop="fangzhuzhanghao">
<el-input v-model="ruleForm.fangzhuzhanghao"
placeholder="房主账号" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="房主姓名" prop="fangzhuxingming"> <!-- -->
<el-input v-model="ruleForm.fangzhuxingming"
placeholder="房主姓名" clearable :readonly="ro.fangzhuxingming"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="房主姓名" prop="fangzhuxingming">
<el-input v-model="ruleForm.fangzhuxingming"
placeholder="房主姓名" readonly></el-input>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row> <!-- 新的表单布局行 -->
<el-col :span="24"> <!-- 占满整行 -->
<el-form-item v-if="type!='info'" label="房屋详情" prop="fangwuxiangqing"> <!-- -->
<editor
style="min-width: 200px; max-width: 600px;"
v-model="ruleForm.fangwuxiangqing"
class="editor"
action="file/upload">
</editor>
</el-form-item>
<div v-else> <!-- -->
<el-form-item v-if="ruleForm.fangwuxiangqing" label="房屋详情" prop="fangwuxiangqing">
<span v-html="ruleForm.fangwuxiangqing"></span>
</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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: { /* 样式配置参数 */ },
id: '',
type: '',
ro:{
//
fangwumingcheng : false,
fangwuleixing : false,
tupian : false,
zulinfangshi : false,
chaoxianglouceng : false,
mianji : false,
fangwuzhuangtai : false,
xiaoqu : false,
xiangxidizhi : false,
yuezujiage : false,
yajin : false,
fangwusheshi : false,
fangwuxiangqing : false,
faburiqi : false,
fangzhuzhanghao : false,
fangzhuxingming : false,
},
//
ruleForm: {
fangwumingcheng: '',
fangwuleixing: '',
tupian: '',
zulinfangshi: '',
chaoxianglouceng: '',
mianji: '',
fangwuzhuangtai: '',
xiaoqu: '',
xiangxidizhi: '',
yuezujiage: '',
yajin: '',
fangwusheshi: '',
fangwuxiangqing: '',
faburiqi: '',
fangzhuzhanghao: '',
fangzhuxingming: '',
},
//
fangwuleixingOptions: [],
//
zulinfangshiOptions: [],
//
fangwuzhuangtaiOptions: [],
//
fangzhuzhanghaoOptions: [],
//
rules: {
fangwumingcheng: [
{ required: true, message: '房屋名称不能为空', trigger: 'blur' }, //
],
fangwuleixing: [
{ required: true, message: '房屋类型不能为空', trigger: 'blur' }, //
],
tupian: [
{ required: true, message: '图片不能为空', trigger: 'blur' }, //
],
zulinfangshi: [
],
chaoxianglouceng: [
],
mianji: [
],
fangwuzhuangtai: [
],
xiaoqu: [
],
xiangxidizhi: [
],
yuezujiage: [
{ validator: validateIntNumber, trigger: 'blur' }, //
],
yajin: [
{ validator: validateIntNumber, trigger: 'blur' }, //
],
fangwusheshi: [
],
fangwuxiangqing: [
],
faburiqi: [
],
fangzhuzhanghao: [
],
fangzhuxingming: [
],
}
};
},
props: ["parent"], //
computed: {
},
created() {
this.addEditStyleChange() //
this.addEditUploadStyleChange() //
},
methods: {
//
download(file){
window.open(`${file}`)
},
//
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
if(this.type=='info'||this.type=='else'){ //
this.info(id); //
}else if(this.type=='cross'){ //
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){ //
if(o=='fangwumingcheng'){
this.ruleForm.fangwumingcheng = obj[o]; //
this.ro.fangwumingcheng = true; //
continue;
}
if(o=='fangwuleixing'){
this.ruleForm.fangwuleixing = obj[o]; //
this.ro.fangwuleixing = true; //
continue;
}
if(o=='tupian'){
this.ruleForm.tupian = obj[o]; //
this.ro.tupian = true; //
continue;
}
if(o=='zulinfangshi'){
this.ruleForm.zulinfangshi = obj[o]; //
this.ro.zulinfangshi = true; //
continue;
}
if(o=='chaoxianglouceng'){
this.ruleForm.chaoxianglouceng = obj[o]; //
this.ro.chaoxianglouceng = true; //
continue;
}
if(o=='mianji'){
this.ruleForm.mianji = obj[o]; //
this.ro.mianji = true; //
continue;
}
if(o=='fangwuzhuangtai'){
this.ruleForm.fangwuzhuangtai = obj[o]; //
this.ro.fangwuzhuangtai = true; //
continue;
}
if(o=='xiaoqu'){
this.ruleForm.xiaoqu = obj[o]; //
this.ro.xiaoqu = true; //
continue;
}
if(o=='xiangxidizhi'){
this.ruleForm.xiangxidizhi = obj[o]; //
this.ro.xiangxidizhi = true; //
continue;
}
if(o=='yuezujiage'){
this.ruleForm.yuezujiage = obj[o]; //
this.ro.yuezujiage = true; //
continue;
}
if(o=='yajin'){
this.ruleForm.yajin = obj[o]; //
this.ro.yajin = true; //
continue;
}
if(o=='fangwusheshi'){
this.ruleForm.fangwusheshi = obj[o]; //
this.ro.fangwusheshi = true; //
continue;
}
if(o=='fangwuxiangqing'){
this.ruleForm.fangwuxiangqing = obj[o]; //
this.ro.fangwuxiangqing = true; //
continue;
}
if(o=='faburiqi'){
this.ruleForm.faburiqi = obj[o]; //
this.ro.faburiqi = true; //
continue;
}
if(o=='fangzhuzhanghao'){
this.ruleForm.fangzhuzhanghao = obj[o]; //
this.ro.fangzhuzhanghao = true; //
continue;
}
if(o=='fangzhuxingming'){
this.ruleForm.fangzhuxingming = obj[o]; //
this.ro.fangzhuxingming = true; //
continue;
}
}
}
//
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.$http({
url: `option/fangwuleixing/fangwuleixing`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.fangwuleixingOptions = data.data;
} else {
this.$message.error(data.msg);
}
});
//
this.zulinfangshiOptions = "整租,合租".split(',');
//
this.fangwuzhuangtaiOptions = "可租,已租".split(',');
//
this.$http({
url: `option/fangzhu/fangzhuzhanghao`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.fangzhuzhanghaoOptions = data.data;
} else {
this.$message.error(data.msg);
}
});
},
//
fangzhuzhanghaoChange () {
this.$http({
url: `follow/fangzhu/fangzhuzhanghao?columnValue=`+ this.ruleForm.fangzhuzhanghao,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
if(data.data.fangzhuxingming){
this.ruleForm.fangzhuxingming = data.data.fangzhuxingming //
}
} else {
this.$message.error(data.msg);
}
});
},
//
info(id) {
this.$http({
url: `fangwuxinxi/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: `fangwuxinxi/${!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.fangwuxinxiCrossAddOrUpdateFlag = false; //
this.parent.search(); //
this.parent.contentStyleChange(); //
}
});
} else {
this.$message.error(data.msg); //
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true; //
this.parent.addOrUpdateFlag = false; //
this.parent.fangwuxinxiCrossAddOrUpdateFlag = false; //
this.parent.contentStyleChange(); //
},
//
tupianUploadChange(fileUrls) {
this.ruleForm.tupian = fileUrls; //
this.addEditUploadStyleChange(); //
},
addEditStyleChange() { //
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputFontColor;
el.style.fontSize = this.addEditForm.inputFontSize;
el.style.borderWidth = this.addEditForm.inputBorderWidth;
el.style.borderStyle = this.addEditForm.inputBorderStyle;
el.style.borderColor = this.addEditForm.inputBorderColor;
el.style.borderRadius = this.addEditForm.inputBorderRadius;
el.style.backgroundColor = this.addEditForm.inputBgColor;
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputLableColor;
el.style.fontSize = this.addEditForm.inputLableFontSize;
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectFontColor;
el.style.fontSize = this.addEditForm.selectFontSize;
el.style.borderWidth = this.addEditForm.selectBorderWidth;
el.style.borderStyle = this.addEditForm.selectBorderStyle;
el.style.borderColor = this.addEditForm.selectBorderColor;
el.style.borderRadius = this.addEditForm.selectBorderRadius;
el.style.backgroundColor = this.addEditForm.selectBgColor;
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectLableColor;
el.style.fontSize = this.addEditForm.selectLableFontSize;
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor;
el.style.fontSize = this.addEditForm.selectIconFontSize;
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateFontColor;
el.style.fontSize = this.addEditForm.dateFontSize;
el.style.borderWidth = this.addEditForm.dateBorderWidth;
el.style.borderStyle = this.addEditForm.dateBorderStyle;
el.style.borderColor = this.addEditForm.dateBorderColor;
el.style.borderRadius = this.addEditForm.dateBorderRadius;
el.style.backgroundColor = this.addEditForm.dateBgColor;
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateLableColor;
el.style.fontSize = this.addEditForm.dateLableFontSize;
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor;
el.style.fontSize = this.addEditForm.dateIconFontSize;
el.style.lineHeight = this.addEditForm.dateHeight;
});
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px';
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight;
el.style.color = this.addEditForm.uploadLableColor;
el.style.fontSize = this.addEditForm.uploadLableFontSize;
});
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor;
el.style.fontSize = this.addEditForm.uploadIconFontSize;
el.style.lineHeight = iconLineHeight;
el.style.display = 'block';
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight;
el.style.color = this.addEditForm.textareaFontColor;
el.style.fontSize = this.addEditForm.textareaFontSize;
el.style.borderWidth = this.addEditForm.textareaBorderWidth;
el.style.borderStyle = this.addEditForm.textareaBorderStyle;
el.style.borderColor = this.addEditForm.textareaBorderColor;
el.style.borderRadius = this.addEditForm.textareaBorderRadius;
el.style.backgroundColor = this.addEditForm.textareaBgColor;
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor;
el.style.fontSize = this.addEditForm.textareaLableFontSize;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth;
el.style.height = this.addEditForm.btnSaveHeight;
el.style.color = this.addEditForm.btnSaveFontColor;
el.style.fontSize = this.addEditForm.btnSaveFontSize;
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth;
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle;
el.style.borderColor = this.addEditForm.btnSaveBorderColor;
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius;
el.style.backgroundColor = this.addEditForm.btnSaveBgColor;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth;
el.style.height = this.addEditForm.btnCancelHeight;
el.style.color = this.addEditForm.btnCancelFontColor;
el.style.fontSize = this.addEditForm.btnCancelFontSize;
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth;
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle;
el.style.borderColor = this.addEditForm.btnCancelBorderColor;
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius;
el.style.backgroundColor = this.addEditForm.btnCancelBgColor;
});
});
},
addEditUploadStyleChange() { //
this.$nextTick(()=>{ // DOM
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
});
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px; <!-- 编辑器高度 -->
& /deep/ .ql-container { <!-- 编辑器内容区域 -->
height: 310px; <!-- 设置内容区域高度 -->
}
}
.amap-wrapper { <!-- 地图容器 -->
width: 100%; <!-- 宽度为100% -->
height: 500px; <!-- 高度为500px -->
}
.search-box { <!-- 搜索和筛选组件 -->
position: absolute; <!-- 绝对定位 -->
}
.addEdit-block { <!-- 表单容器 -->
margin: -10px; <!-- 外边距 -->
}
.detail-form-content { <!-- 表单内容 -->
padding: 12px; <!-- 内边距 -->
}
.btn .el-button { <!-- 按钮样式 -->
padding: 0; <!-- 无内边距 -->
}
</style>

@ -0,0 +1,690 @@
<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.fangwuzhuangtai" placeholder="房屋状态" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangwuzhuangtai" placeholder="房屋状态" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangwuzhuangtai" 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.xiaoqu" placeholder="小区" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.xiaoqu" placeholder="小区" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.xiaoqu" 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('fangwuxinxi','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('fangwuxinxi','新增') && 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('fangwuxinxi','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('fangwuxinxi','删除') && 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('fangwuxinxi','删除') && 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('fangwuxinxi','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('fangwuxinxi','查看')"
: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="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="tupian"
header-align="center"
width="200"
label="图片">
<template slot-scope="scope">
<div v-if="scope.row.tupian">
<img :src="scope.row.tupian.split(',')[0]" width="100" height="100">
</div>
<div v-else></div>
</template>
</el-table-column>
<!-- 租赁方式列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="zulinfangshi"
header-align="center"
label="租赁方式">
<template slot-scope="scope">
{{scope.row.zulinfangshi}}
</template>
</el-table-column>
<!-- 朝向楼层列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="chaoxianglouceng"
header-align="center"
label="朝向楼层">
<template slot-scope="scope">
{{scope.row.chaoxianglouceng}}
</template>
</el-table-column>
<!-- 面积列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="mianji"
header-align="center"
label="面积">
<template slot-scope="scope">
{{scope.row.mianji}}
</template>
</el-table-column>
<!-- 房屋状态列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="fangwuzhuangtai"
header-align="center"
label="房屋状态">
<template slot-scope="scope">
{{scope.row.fangwuzhuangtai}}
</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="xiangxidizhi"
header-align="center"
label="详细地址">
<template slot-scope="scope">
{{scope.row.xiangxidizhi}}
</template>
</el-table-column>
<!-- 月租价格列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="yuezujiage"
header-align="center"
label="月租价格">
<template slot-scope="scope">
{{scope.row.yuezujiage}}
</template>
</el-table-column>
<!-- 押金列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="yajin"
header-align="center"
label="押金">
<template slot-scope="scope">
{{scope.row.yajin}}
</template>
</el-table-column>
<!-- 房屋设施列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="fangwusheshi"
header-align="center"
label="房屋设施">
<template slot-scope="scope">
{{scope.row.fangwusheshi}}
</template>
</el-table-column>
<!-- 发布日期列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="faburiqi"
header-align="center"
label="发布日期">
<template slot-scope="scope">
{{scope.row.faburiqi}}
</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="fangzhuxingming"
header-align="center"
label="房主姓名">
<template slot-scope="scope">
{{scope.row.fangzhuxingming}}
</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('fangwuxinxi','查看') && 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('fangwuxinxi','查看') && 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('fangwuxinxi','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 预约按钮 -->
<el-button v-if="isAuth('fangwuxinxi','预约') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="success" icon="el-icon-tickets" size="mini" @click="yuyuekanfangCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('fangwuxinxi','预约') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="success" size="mini" @click="yuyuekanfangCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-tickets el-icon--right" /></el-button>
<el-button v-if="isAuth('fangwuxinxi','预约') && contents.tableBtnIcon == 0" type="success" size="mini" @click="yuyuekanfangCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('fangwuxinxi','修改') && 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('fangwuxinxi','修改') && 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('fangwuxinxi','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 查看评论按钮 -->
<el-button v-if="isAuth('fangwuxinxi','查看评论') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="primary" icon="el-icon-edit" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('fangwuxinxi','查看评论') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="primary" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-edit el-icon--right" /></el-button>
<el-button v-if="isAuth('fangwuxinxi','查看评论') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('fangwuxinxi','删除') && 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('fangwuxinxi','删除') && 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('fangwuxinxi','删除') && 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>
<!-- 预约看房页面 -->
<yuyuekanfang-cross-add-or-update v-if="yuyuekanfangCrossAddOrUpdateFlag" :parent="this" ref="yuyuekanfangCrossaddOrUpdate"></yuyuekanfang-cross-add-or-update>
</div>
</template>
<script>
// /
import AddOrUpdate from "./add-or-update";
//
import yuyuekanfangCrossAddOrUpdate from "../yuyuekanfang/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,
//
yuyuekanfangCrossAddOrUpdateFlag: false,
//
contents:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
layouts: '',
};
},
//
created() {
this.init();
this.getDataList();
this.contentStyleChange()
},
//
mounted() {
},
//
filters: {
// HTML
htmlfilter: function (val) {
return val.replace(/<[^>]*>/g).replace(/undefined/g,'');
}
},
//
components: {
AddOrUpdate,
yuyuekanfangCrossAddOrUpdate,
},
//
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
},
//
yuyuekanfangCrossAddOrUpdateHandler(row,type){
this.showFlag = false;
this.addOrUpdateFlag = false;
this.yuyuekanfangCrossAddOrUpdateFlag = true;
this.$storage.set('crossObj',row);
this.$storage.set('crossTable','fangwuxinxi');
this.$nextTick(() => {
this.$refs.yuyuekanfangCrossaddOrUpdate.init(row.id,type);
});
},
//
init () {
//
this.fangwuzhuangtaiOptions = "可租,已租".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.fangwuzhuangtai!='' && this.searchForm.fangwuzhuangtai!=undefined){
params['fangwuzhuangtai'] = '%' + this.searchForm.fangwuzhuangtai + '%'
}
if(this.searchForm.xiaoqu!='' && this.searchForm.xiaoqu!=undefined){
params['xiaoqu'] = '%' + this.searchForm.xiaoqu + '%'
}
//
this.$http({
url: "fangwuxinxi/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);
});
},
//
disscussListHandler(id,type) {
this.$router.push({path:'/discussfangwuxinxi',query:{refid:id}});
},
//
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: "fangwuxinxi/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,544 @@
<template>
<!-- 添加/编辑页面容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 设置表单背景颜色 -->
>
<el-row> <!-- 表单布局行 -->
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="房主账号" prop="fangzhuzhanghao"> <!-- -->
<el-input v-model="ruleForm.fangzhuzhanghao"
placeholder="房主账号" clearable :readonly="ro.fangzhuzhanghao"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="房主账号" prop="fangzhuzhanghao">
<el-input v-model="ruleForm.fangzhuzhanghao"
placeholder="房主账号" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="密码" prop="mima"> <!-- -->
<el-input v-model="ruleForm.mima"
placeholder="密码" clearable :readonly="ro.mima"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="密码" prop="mima">
<el-input v-model="ruleForm.mima"
placeholder="密码" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="房主姓名" prop="fangzhuxingming"> <!-- -->
<el-input v-model="ruleForm.fangzhuxingming"
placeholder="房主姓名" clearable :readonly="ro.fangzhuxingming"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="房主姓名" prop="fangzhuxingming">
<el-input v-model="ruleForm.fangzhuxingming"
placeholder="房主姓名" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="select" v-if="type!='info'" label="性别" prop="xingbie"> <!-- -->
<el-select v-model="ruleForm.xingbie" placeholder="请选择性别">
<el-option
v-for="(item,index) in xingbieOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="性别" prop="xingbie">
<el-input v-model="ruleForm.xingbie"
placeholder="性别" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="24"> <!-- 占满整行 -->
<el-form-item class="upload" v-if="type!='info' && !ro.touxiang" label="头像" prop="touxiang"> <!-- -->
<file-upload
tip="点击上传头像"
action="file/upload"
:limit="3"
:multiple="true"
:fileUrls="ruleForm.touxiang?ruleForm.touxiang:''"
@change="touxiangUploadChange"
></file-upload>
</el-form-item>
<div v-else> <!-- -->
<el-form-item v-if="ruleForm.touxiang" label="头像" prop="touxiang">
<img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in ruleForm.touxiang.split(',')" :src="item" width="100" height="100">
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="手机" prop="shouji"> <!-- -->
<el-input v-model="ruleForm.shouji"
placeholder="手机" clearable :readonly="ro.shouji"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="手机" prop="shouji">
<el-input v-model="ruleForm.shouji"
placeholder="手机" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="身份证" prop="shenfenzheng"> <!-- -->
<el-input v-model="ruleForm.shenfenzheng"
placeholder="身份证" clearable :readonly="ro.shenfenzheng"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="身份证" prop="shenfenzheng">
<el-input v-model="ruleForm.shenfenzheng"
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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: { /* 样式配置参数 */ },
id: '',
type: '',
ro:{
//
fangzhuzhanghao : false,
mima : false,
fangzhuxingming : false,
xingbie : false,
touxiang : false,
shouji : false,
shenfenzheng : false,
},
//
ruleForm: {
fangzhuzhanghao: '',
mima: '',
fangzhuxingming: '',
xingbie: '',
touxiang: '',
shouji: '',
shenfenzheng: '',
},
//
xingbieOptions: [],
//
rules: {
fangzhuzhanghao: [
{ required: true, message: '房主账号不能为空', trigger: 'blur' }, //
],
mima: [
{ required: true, message: '密码不能为空', trigger: 'blur' }, //
],
fangzhuxingming: [
{ required: true, message: '房主姓名不能为空', trigger: 'blur' }, //
],
xingbie: [
],
touxiang: [
],
shouji: [
{ validator: validateMobile, trigger: 'blur' }, //
],
shenfenzheng: [
{ validator: validateIdCard, trigger: 'blur' }, //
],
}
};
},
props: ["parent"], //
computed: {
},
created() {
this.addEditStyleChange() //
this.addEditUploadStyleChange() //
},
methods: {
//
download(file){
window.open(`${file}`)
},
//
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
if(this.type=='info'||this.type=='else'){ //
this.info(id); //
}else if(this.type=='cross'){ //
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){ //
if(o=='fangzhuzhanghao'){
this.ruleForm.fangzhuzhanghao = obj[o]; //
this.ro.fangzhuzhanghao = true; //
continue;
}
if(o=='mima'){
this.ruleForm.mima = obj[o]; //
this.ro.mima = true; //
continue;
}
if(o=='fangzhuxingming'){
this.ruleForm.fangzhuxingming = obj[o]; //
this.ro.fangzhuxingming = true; //
continue;
}
if(o=='xingbie'){
this.ruleForm.xingbie = obj[o]; //
this.ro.xingbie = true; //
continue;
}
if(o=='touxiang'){
this.ruleForm.touxiang = obj[o]; //
this.ro.touxiang = true; //
continue;
}
if(o=='shouji'){
this.ruleForm.shouji = obj[o]; //
this.ro.shouji = true; //
continue;
}
if(o=='shenfenzheng'){
this.ruleForm.shenfenzheng = obj[o]; //
this.ro.shenfenzheng = true; //
continue;
}
}
}
//
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.xingbieOptions = "男,女".split(',') //
},
//
info(id) {
this.$http({
url: `fangzhu/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: `fangzhu/${!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.fangzhuCrossAddOrUpdateFlag = false; //
this.parent.search(); //
this.parent.contentStyleChange(); //
}
});
} else {
this.$message.error(data.msg); //
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true; //
this.parent.addOrUpdateFlag = false; //
this.parent.fangzhuCrossAddOrUpdateFlag = false; //
this.parent.contentStyleChange(); //
},
//
touxiangUploadChange(fileUrls) {
this.ruleForm.touxiang = fileUrls; //
this.addEditUploadStyleChange(); //
},
addEditStyleChange() { //
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputFontColor;
el.style.fontSize = this.addEditForm.inputFontSize;
el.style.borderWidth = this.addEditForm.inputBorderWidth;
el.style.borderStyle = this.addEditForm.inputBorderStyle;
el.style.borderColor = this.addEditForm.inputBorderColor;
el.style.borderRadius = this.addEditForm.inputBorderRadius;
el.style.backgroundColor = this.addEditForm.inputBgColor;
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputLableColor;
el.style.fontSize = this.addEditForm.inputLableFontSize;
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectFontColor;
el.style.fontSize = this.addEditForm.selectFontSize;
el.style.borderWidth = this.addEditForm.selectBorderWidth;
el.style.borderStyle = this.addEditForm.selectBorderStyle;
el.style.borderColor = this.addEditForm.selectBorderColor;
el.style.borderRadius = this.addEditForm.selectBorderRadius;
el.style.backgroundColor = this.addEditForm.selectBgColor;
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectLableColor;
el.style.fontSize = this.addEditForm.selectLableFontSize;
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor;
el.style.fontSize = this.addEditForm.selectIconFontSize;
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateFontColor;
el.style.fontSize = this.addEditForm.dateFontSize;
el.style.borderWidth = this.addEditForm.dateBorderWidth;
el.style.borderStyle = this.addEditForm.dateBorderStyle;
el.style.borderColor = this.addEditForm.dateBorderColor;
el.style.borderRadius = this.addEditForm.dateBorderRadius;
el.style.backgroundColor = this.addEditForm.dateBgColor;
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateLableColor;
el.style.fontSize = this.addEditForm.dateLableFontSize;
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor;
el.style.fontSize = this.addEditForm.dateIconFontSize;
el.style.lineHeight = this.addEditForm.dateHeight;
});
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px';
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight;
el.style.color = this.addEditForm.uploadLableColor;
el.style.fontSize = this.addEditForm.uploadLableFontSize;
});
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor;
el.style.fontSize = this.addEditForm.uploadIconFontSize;
el.style.lineHeight = iconLineHeight;
el.style.display = 'block';
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight;
el.style.color = this.addEditForm.textareaFontColor;
el.style.fontSize = this.addEditForm.textareaFontSize;
el.style.borderWidth = this.addEditForm.textareaBorderWidth;
el.style.borderStyle = this.addEditForm.textareaBorderStyle;
el.style.borderColor = this.addEditForm.textareaBorderColor;
el.style.borderRadius = this.addEditForm.textareaBorderRadius;
el.style.backgroundColor = this.addEditForm.textareaBgColor;
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor;
el.style.fontSize = this.addEditForm.textareaLableFontSize;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth;
el.style.height = this.addEditForm.btnSaveHeight;
el.style.color = this.addEditForm.btnSaveFontColor;
el.style.fontSize = this.addEditForm.btnSaveFontSize;
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth;
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle;
el.style.borderColor = this.addEditForm.btnSaveBorderColor;
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius;
el.style.backgroundColor = this.addEditForm.btnSaveBgColor;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth;
el.style.height = this.addEditForm.btnCancelHeight;
el.style.color = this.addEditForm.btnCancelFontColor;
el.style.fontSize = this.addEditForm.btnCancelFontSize;
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth;
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle;
el.style.borderColor = this.addEditForm.btnCancelBorderColor;
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius;
el.style.backgroundColor = this.addEditForm.btnCancelBgColor;
});
});
},
addEditUploadStyleChange() { //
this.$nextTick(()=>{ // DOM
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
});
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px; <!-- 编辑器高度 -->
& /deep/ .ql-container { <!-- 编辑器内容区域 -->
height: 310px; <!-- 设置内容区域高度 -->
}
}
.amap-wrapper { <!-- 地图容器 -->
width: 100%; <!-- 宽度为100% -->
height: 500px; <!-- 高度为500px -->
}
.search-box { <!-- 搜索按钮 -->
position: absolute; <!-- 绝对定位 -->
}
.addEdit-block { <!-- 表单容器 -->
margin: -10px; <!-- 外边距 -->
}
.detail-form-content { <!-- 表单内容 -->
padding: 12px; <!-- 内边距 -->
}
.btn .el-button { <!-- 按钮样式 -->
padding: 0; <!-- 无内边距 -->
}
</style>

@ -0,0 +1,574 @@
<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.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.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangzhuxingming" 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('fangzhu','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('fangzhu','新增') && 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('fangzhu','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('fangzhu','删除') && 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('fangzhu','删除') && 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('fangzhu','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('fangzhu','查看')"
: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="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="mima"
header-align="center"
label="密码">
<template slot-scope="scope">
{{scope.row.mima}}
</template>
</el-table-column>
<!-- 房主姓名列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="fangzhuxingming"
header-align="center"
label="房主姓名">
<template slot-scope="scope">
{{scope.row.fangzhuxingming}}
</template>
</el-table-column>
<!-- 性别列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="xingbie"
header-align="center"
label="性别">
<template slot-scope="scope">
{{scope.row.xingbie}}
</template>
</el-table-column>
<!-- 头像列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="touxiang"
header-align="center"
width="200"
label="头像">
<template slot-scope="scope">
<div v-if="scope.row.touxiang">
<img :src="scope.row.touxiang.split(',')[0]" width="100" height="100">
</div>
<div v-else></div>
</template>
</el-table-column>
<!-- 手机列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="shouji"
header-align="center"
label="手机">
<template slot-scope="scope">
{{scope.row.shouji}}
</template>
</el-table-column>
<!-- 身份证列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="shenfenzheng"
header-align="center"
label="身份证">
<template slot-scope="scope">
{{scope.row.shenfenzheng}}
</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('fangzhu','修改') && 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('fangzhu','修改') && 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('fangzhu','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('fangzhu','删除') && 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('fangzhu','删除') && 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('fangzhu','删除') && 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>
</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:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
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
},
//
init () {
//
},
//
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
this.dataListLoading = true;
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
}
//
if(this.searchForm.fangzhuzhanghao!='' && this.searchForm.fangzhuzhanghao!=undefined){
params['fangzhuzhanghao'] = '%' + this.searchForm.fangzhuzhanghao + '%'
}
if(this.searchForm.fangzhuxingming!='' && this.searchForm.fangzhuxingming!=undefined){
params['fangzhuxingming'] = '%' + this.searchForm.fangzhuxingming + '%'
}
//
this.$http({
url: "fangzhu/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);
});
},
//
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: "fangzhu/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,717 @@
<template>
<!-- 定义模板的根元素 -->
<div class="addEdit-block">
<!-- 定义表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"
>
<!-- 定义表单的行布局 -->
<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="合同编号" readonly></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" v-if="ruleForm.hetongbianhao" 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="12">
<!-- 定义表单项 -->
<el-form-item class="input" v-if="type!='info'" label="房屋类型" prop="fangwuleixing">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.fangwuleixing"
placeholder="房屋类型" clearable :readonly="ro.fangwuleixing"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
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="xiaoqu">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.xiaoqu"
placeholder="小区" clearable :readonly="ro.xiaoqu"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="小区" prop="xiaoqu">
<el-input v-model="ruleForm.xiaoqu"
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="yuezujiage">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yuezujiage"
placeholder="月租价格" clearable :readonly="ro.yuezujiage"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="月租价格" prop="yuezujiage">
<el-input v-model="ruleForm.yuezujiage"
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="zuyongyueshu">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.zuyongyueshu"
placeholder="租用月数" clearable :readonly="ro.zuyongyueshu"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="租用月数" prop="zuyongyueshu">
<el-input v-model="ruleForm.zuyongyueshu"
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="zuyongjine">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.zuyongjine"
placeholder="租用金额" clearable :readonly="ro.zuyongjine"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="租用金额" prop="zuyongjine">
<el-input v-model="ruleForm.zuyongjine"
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="yajin">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yajin"
placeholder="押金" clearable :readonly="ro.yajin"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="押金" prop="yajin">
<el-input v-model="ruleForm.yajin"
placeholder="押金" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!-- 定义表单的列布局 -->
<el-col :span="12">
<!-- 定义表单项 -->
<el-form-item class="select" v-if="type!='info'" label="房租状态" prop="fangzuzhuangtai">
<!-- 定义下拉选择框 -->
<el-select v-model="ruleForm.fangzuzhuangtai" placeholder="请选择房租状态">
<el-option
v-for="(item,index) in fangzuzhuangtaiOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房租状态" prop="fangzuzhuangtai">
<el-input v-model="ruleForm.fangzuzhuangtai"
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="hetongjine">
<!-- 定义输入框 -->
<el-input v-model="hetongjine"
placeholder="合同金额" readonly></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" v-if="ruleForm.hetongjine" label="合同金额" prop="hetongjine">
<el-input v-model="ruleForm.hetongjine"
placeholder="合同金额" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!-- 定义表单的列布局 -->
<el-col :span="24">
<!-- 定义表单项 -->
<el-form-item class="upload" v-if="type!='info'" label="合同内容" prop="hetongneirong">
<!-- 定义文件上传组件 -->
<file-upload
tip="点击上传合同内容"
action="file/upload"
:limit="1"
:multiple="true"
:fileUrls="ruleForm.hetongneirong?ruleForm.hetongneirong:''"
@change="hetongneirongUploadChange"
></file-upload>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item v-if="ruleForm.hetongneirong" label="合同内容" prop="hetongneirong">
<!-- 定义下载按钮 -->
<el-button type="text" size="small" @click="download(ruleForm.hetongneirong)"></el-button>
</el-form-item>
</div>
</el-col>
<!-- 定义表单的列布局 -->
<el-col :span="12">
<!-- 定义表单项 -->
<el-form-item class="date" v-if="type!='info'" label="生效日" prop="shengxiaori">
<!-- 定义日期选择器 -->
<el-date-picker
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
v-model="ruleForm.shengxiaori"
type="date"
placeholder="生效日">
</el-date-picker>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" v-if="ruleForm.shengxiaori" label="生效日" prop="shengxiaori">
<el-input v-model="ruleForm.shengxiaori"
placeholder="生效日" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!-- 定义表单的列布局 -->
<el-col :span="12">
<!-- 定义表单项 -->
<el-form-item class="date" v-if="type!='info'" label="有限期至" prop="youxianqizhi">
<!-- 定义日期选择器 -->
<el-date-picker
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
v-model="ruleForm.youxianqizhi"
type="date"
placeholder="有限期至">
</el-date-picker>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" v-if="ruleForm.youxianqizhi" label="有限期至" prop="youxianqizhi">
<el-input v-model="ruleForm.youxianqizhi"
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="yonghuming">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yonghuming"
placeholder="用户名" clearable :readonly="ro.yonghuming"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="用户名" prop="yonghuming">
<el-input v-model="ruleForm.yonghuming"
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="lianxidianhua">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.lianxidianhua"
placeholder="联系电话" clearable :readonly="ro.lianxidianhua"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="联系电话" prop="lianxidianhua">
<el-input v-model="ruleForm.lianxidianhua"
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="fangzhuzhanghao">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.fangzhuzhanghao"
placeholder="房主账号" clearable :readonly="ro.fangzhuzhanghao"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房主账号" prop="fangzhuzhanghao">
<el-input v-model="ruleForm.fangzhuzhanghao"
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="fangzhuxingming">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.fangzhuxingming"
placeholder="房主姓名" clearable :readonly="ro.fangzhuxingming"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房主姓名" prop="fangzhuxingming">
<el-input v-model="ruleForm.fangzhuxingming"
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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
//
return {
//
addEditForm: {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"rgba(152, 129, 129, 1)","inputBorderRadius":"22px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"22px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"22px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"#606266","addEditBoxColor":"rgba(210, 194, 194, 0.29)","dateIconFontSize":"14px","btnSaveBgColor":"#409EFF","uploadIconFontColor":"#8c939d","textareaBorderColor":"rgba(152, 129, 129, 1)","btnCancelBgColor":"rgba(143, 222, 143, 1)","selectLableColor":"#606266","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"22px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"#606266","dateBorderColor":"rgba(152, 129, 129, 1)","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"#606266","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"#606266","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"22px","inputBgColor":"rgba(252, 250, 250, 1)","inputLableFontSize":"14px","uploadLableColor":"#606266","uploadBorderRadius":"22px","btnSaveHeight":"44px","selectBgColor":"#fff","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"rgba(152, 129, 129, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","uploadBorderColor":"rgba(152, 129, 129, 1)","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"22px","selectFontColor":"#606266","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"1px"},
// ID
id: '',
//
type: '',
//
ro:{
hetongbianhao : false,
fangwumingcheng : false,
fangwuleixing : false,
xiaoqu : false,
yuezujiage : false,
zuyongyueshu : false,
zuyongjine : false,
yajin : false,
fangzuzhuangtai : false,
hetongjine : false,
hetongneirong : false,
shengxiaori : false,
youxianqizhi : false,
yonghuming : false,
lianxidianhua : false,
fangzhuzhanghao : false,
fangzhuxingming : false,
sfsh : false,
shhf : false,
ispay : false,
},
//
ruleForm: {
hetongbianhao: this.getUUID(),
fangwumingcheng: '',
fangwuleixing: '',
xiaoqu: '',
yuezujiage: '',
zuyongyueshu: '',
zuyongjine: '',
yajin: '',
fangzuzhuangtai: '',
hetongjine: '',
hetongneirong: '',
shengxiaori: '',
youxianqizhi: '',
yonghuming: '',
lianxidianhua: '',
fangzhuzhanghao: '',
fangzhuxingming: '',
shhf: '',
},
//
fangzuzhuangtaiOptions: [],
//
rules: {
hetongbianhao: [],
fangwumingcheng: [],
fangwuleixing: [],
xiaoqu: [],
yuezujiage: [],
zuyongyueshu: [],
zuyongjine: [
{ validator: validateIntNumber, trigger: 'blur' },
],
yajin: [
{ validator: validateIntNumber, trigger: 'blur' },
],
fangzuzhuangtai: [],
hetongjine: [],
hetongneirong: [],
shengxiaori: [],
youxianqizhi: [],
yonghuming: [],
lianxidianhua: [],
fangzhuzhanghao: [],
fangzhuxingming: [],
sfsh: [],
shhf: [],
ispay: [],
}
};
},
//
props: ["parent"],
//
computed: {
//
hetongjine: {
get: function () {
return 0+parseFloat(this.ruleForm.zuyongjine)+parseFloat(this.ruleForm.yajin) || ''
}
},
},
//
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'){
var obj = this.$storage.getObj('crossObj');
for (var o in obj){
if(o=='hetongbianhao'){
this.ruleForm.hetongbianhao = obj[o];
this.ro.hetongbianhao = true;
continue;
}
if(o=='fangwumingcheng'){
this.ruleForm.fangwumingcheng = obj[o];
this.ro.fangwumingcheng = true;
continue;
}
if(o=='fangwuleixing'){
this.ruleForm.fangwuleixing = obj[o];
this.ro.fangwuleixing = true;
continue;
}
if(o=='xiaoqu'){
this.ruleForm.xiaoqu = obj[o];
this.ro.xiaoqu = true;
continue;
}
if(o=='yuezujiage'){
this.ruleForm.yuezujiage = obj[o];
this.ro.yuezujiage = true;
continue;
}
if(o=='zuyongyueshu'){
this.ruleForm.zuyongyueshu = obj[o];
this.ro.zuyongyueshu = true;
continue;
}
if(o=='zuyongjine'){
this.ruleForm.zuyongjine = obj[o];
this.ro.zuyongjine = true;
continue;
}
if(o=='yajin'){
this.ruleForm.yajin = obj[o];
this.ro.yajin = true;
continue;
}
if(o=='fangzuzhuangtai'){
this.ruleForm.fangzuzhuangtai = obj[o];
this.ro.fangzuzhuangtai = true;
continue;
}
if(o=='hetongjine'){
this.ruleForm.hetongjine = obj[o];
this.ro.hetongjine = true;
continue;
}
if(o=='hetongneirong'){
this.ruleForm.hetongneirong = obj[o];
this.ro.hetongneirong = true;
continue;
}
if(o=='shengxiaori'){
this.ruleForm.shengxiaori = obj[o];
this.ro.shengxiaori = true;
continue;
}
if(o=='youxianqizhi'){
this.ruleForm.youxianqizhi = obj[o];
this.ro.youxianqizhi = true;
continue;
}
if(o=='yonghuming'){
this.ruleForm.yonghuming = obj[o];
this.ro.yonghuming = true;
continue;
}
if(o=='lianxidianhua'){
this.ruleForm.lianxidianhua = obj[o];
this.ro.lianxidianhua = true;
continue;
}
if(o=='fangzhuzhanghao'){
this.ruleForm.fangzhuzhanghao = obj[o];
this.ro.fangzhuzhanghao = true;
continue;
}
if(o=='fangzhuxingming'){
this.ruleForm.fangzhuxingming = obj[o];
this.ro.fangzhuxingming = true;
continue;
}
}
}
//
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.fangzuzhuangtaiOptions = "租赁中,已退租".split(',')
},
//
info(id) {
this.$http({
url: `hetongxinxi/info/${id}`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.ruleForm = data.data;
} else {
this.$message.error(data.msg);
}
});
},
//
onSubmit() {
this.ruleForm.hetongjine = this.hetongjine
this.$refs["ruleForm"].validate(valid => {
if (valid) {
this.$http({
url: `hetongxinxi/${!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.hetongxinxiCrossAddOrUpdateFlag = 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.hetongxinxiCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
hetongneirongUploadChange(fileUrls) {
this.ruleForm.hetongneirong = fileUrls;
this.addEditUploadStyleChange()
},
//
addEditStyleChange() {
this.$nextTick(()=>{})
},
//
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,835 @@
<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.fangwuleixing" placeholder="房屋类型" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangwuleixing" placeholder="房屋类型" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangwuleixing" 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('hetongxinxi','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('hetongxinxi','新增') && 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('hetongxinxi','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('hetongxinxi','删除') && 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('hetongxinxi','删除') && 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('hetongxinxi','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('hetongxinxi','查看')"
: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="yuezujiage"
header-align="center"
label="月租价格">
<template slot-scope="scope">
{{scope.row.yuezujiage}}
</template>
</el-table-column>
<!-- 租用月数列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="zuyongyueshu"
header-align="center"
label="租用月数">
<template slot-scope="scope">
{{scope.row.zuyongyueshu}}
</template>
</el-table-column>
<!-- 租用金额列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="zuyongjine"
header-align="center"
label="租用金额">
<template slot-scope="scope">
{{scope.row.zuyongjine}}
</template>
</el-table-column>
<!-- 押金列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="yajin"
header-align="center"
label="押金">
<template slot-scope="scope">
{{scope.row.yajin}}
</template>
</el-table-column>
<!-- 房租状态列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="fangzuzhuangtai"
header-align="center"
label="房租状态">
<template slot-scope="scope">
{{scope.row.fangzuzhuangtai}}
</template>
</el-table-column>
<!-- 合同金额列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="hetongjine"
header-align="center"
label="合同金额">
<template slot-scope="scope">
{{scope.row.hetongjine}}
</template>
</el-table-column>
<!-- 合同内容列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="hetongneirong"
header-align="center"
label="合同内容">
<template slot-scope="scope">
<el-button type="text" size="small" @click="download(scope.row.hetongneirong)"></el-button>
</template>
</el-table-column>
<!-- 生效日列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="shengxiaori"
header-align="center"
label="生效日">
<template slot-scope="scope">
{{scope.row.shengxiaori}}
</template>
</el-table-column>
<!-- 有限期至列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="youxianqizhi"
header-align="center"
label="有限期至">
<template slot-scope="scope">
{{scope.row.youxianqizhi}}
</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="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="fangzhuxingming"
header-align="center"
label="房主姓名">
<template slot-scope="scope">
{{scope.row.fangzhuxingming}}
</template>
</el-table-column>
<!-- 是否支付列 -->
<el-table-column
:sortable="contents.tableSortable" :align="contents.tableAlign"
prop="ispay"
header-align="center"
label="是否支付">
<template slot-scope="scope">
<span style="margin-right:10px">{{scope.row.ispay=='已支付'?'已支付':'未支付'}}</span>
<el-button v-if="scope.row.ispay!='已支付' && isAuth('hetongxinxi','支付') " type="text" icon="el-icon-edit" size="small" @click="payHandler(scope.row)"></el-button>
</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 v-if="isAuth('hetongxinxi','')"
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('hetongxinxi','查看') && 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('hetongxinxi','查看') && 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('hetongxinxi','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 报修按钮 -->
<el-button v-if="isAuth('hetongxinxi','报修') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="success" icon="el-icon-tickets" size="mini" @click="fangwubaoxiuCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('hetongxinxi','报修') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="success" size="mini" @click="fangwubaoxiuCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-tickets el-icon--right" /></el-button>
<el-button v-if="isAuth('hetongxinxi','报修') && contents.tableBtnIcon == 0" type="success" size="mini" @click="fangwubaoxiuCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 评价按钮 -->
<el-button v-if="isAuth('hetongxinxi','评价') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="success" icon="el-icon-tickets" size="mini" @click="fangwupingjiaCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('hetongxinxi','评价') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="success" size="mini" @click="fangwupingjiaCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-tickets el-icon--right" /></el-button>
<el-button v-if="isAuth('hetongxinxi','评价') && contents.tableBtnIcon == 0" type="success" size="mini" @click="fangwupingjiaCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('hetongxinxi','修改') && 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('hetongxinxi','修改') && 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('hetongxinxi','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('hetongxinxi','删除') && 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('hetongxinxi','删除') && 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('hetongxinxi','删除') && 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>
<!-- 房屋报修交叉添加/修改页面 -->
<fangwubaoxiu-cross-add-or-update v-if="fangwubaoxiuCrossAddOrUpdateFlag" :parent="this" ref="fangwubaoxiuCrossaddOrUpdate"></fangwubaoxiu-cross-add-or-update>
<!-- 房屋评价交叉添加/修改页面 -->
<fangwupingjia-cross-add-or-update v-if="fangwupingjiaCrossAddOrUpdateFlag" :parent="this" ref="fangwupingjiaCrossaddOrUpdate"></fangwupingjia-cross-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>
</div>
</template>
<script>
import AddOrUpdate from "./add-or-update";
import fangwubaoxiuCrossAddOrUpdate from "../fangwubaoxiu/add-or-update";
import fangwupingjiaCrossAddOrUpdate from "../fangwupingjia/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,
// /
fangwubaoxiuCrossAddOrUpdateFlag: false,
// /
fangwupingjiaCrossAddOrUpdateFlag: false,
//
contents:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllBorderColor":"#DCDFE6","btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
layouts: '',
};
},
created() {
//
this.init();
//
this.getDataList();
//
this.contentStyleChange()
},
mounted() {
},
filters: {
// HTML
htmlfilter: function (val) {
return val.replace(/<[^>]*>/g).replace(/undefined/g,'');
}
},
components: {
// /
AddOrUpdate,
// /
fangwubaoxiuCrossAddOrUpdate,
// /
fangwupingjiaCrossAddOrUpdate,
},
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(){
// this.$nextTick(()=>{...})
},
//
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
},
// /
fangwubaoxiuCrossAddOrUpdateHandler(row,type){
this.showFlag = false;
this.addOrUpdateFlag = false;
this.fangwubaoxiuCrossAddOrUpdateFlag = true;
this.$storage.set('crossObj',row);
this.$storage.set('crossTable','hetongxinxi');
this.$nextTick(() => {
this.$refs.fangwubaoxiuCrossaddOrUpdate.init(row.id,type);
});
},
// /
fangwupingjiaCrossAddOrUpdateHandler(row,type){
this.showFlag = false;
this.addOrUpdateFlag = false;
this.fangwupingjiaCrossAddOrUpdateFlag = true;
this.$storage.set('crossObj',row);
this.$storage.set('crossTable','hetongxinxi');
this.$nextTick(() => {
this.$refs.fangwupingjiaCrossaddOrUpdate.init(row.id,type);
});
},
//
payHandler(row){
this.$storage.set('paytable','hetongxinxi');
this.$storage.set('payObject',row);
this.$router.push('pay');
},
//
init () {},
//
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.fangwuleixing!='' && this.searchForm.fangwuleixing!=undefined){
params['fangwuleixing'] = '%' + this.searchForm.fangwuleixing + '%'
}
if(this.searchForm.yonghuming!='' && this.searchForm.yonghuming!=undefined){
params['yonghuming'] = '%' + this.searchForm.yonghuming + '%'
}
this.$http({
url: "hetongxinxi/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,
yuezujiage: row.yuezujiage,
zuyongyueshu: row.zuyongyueshu,
zuyongjine: row.zuyongjine,
yajin: row.yajin,
fangzuzhuangtai: row.fangzuzhuangtai,
hetongjine: row.hetongjine,
hetongneirong: row.hetongneirong,
shengxiaori: row.shengxiaori,
youxianqizhi: row.youxianqizhi,
yonghuming: row.yonghuming,
lianxidianhua: row.lianxidianhua,
fangzhuzhanghao: row.fangzhuzhanghao,
fangzhuxingming: row.fangzhuxingming,
sfsh: row.sfsh,
shhf: row.shhf,
ispay: row.ispay,
id: row.id
}
}
},
//
shHandler(){
this.$confirm(`确定操作?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$http({
url: "hetongxinxi/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: "hetongxinxi/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,447 @@
<template>
<!-- 添加/编辑页面容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 设置表单背景颜色 -->
>
<el-row> <!-- 表单布局行 -->
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="用户名" prop="username"> <!-- -->
<el-input v-model="ruleForm.username"
placeholder="用户名" clearable readonly></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="用户名" prop="username">
<el-input v-model="ruleForm.username"
placeholder="用户名" readonly></el-input>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row> <!-- 新的表单布局行 -->
<el-col :span="24"> <!-- 占满整行 -->
<el-form-item class="textarea" v-if="type!='info'" label="留言内容" prop="content"> <!-- -->
<el-input
style="min-width: 200px; max-width: 600px;" <!-- 设置文本框宽度范围 -->
type="textarea"
:rows="8" <!-- 设置文本框行数 -->
placeholder="留言内容"
v-model="ruleForm.content" readonly>
</el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item v-if="ruleForm.content" label="留言内容" prop="content">
<span>{{ruleForm.content}}</span>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row> <!-- 新的表单布局行 -->
<el-col :span="24"> <!-- 占满整行 -->
<el-form-item class="textarea" v-if="type!='info'" label="回复内容" prop="reply"> <!-- -->
<el-input
style="min-width: 200px; max-width: 600px;" <!-- 设置文本框宽度范围 -->
type="textarea"
:rows="8" <!-- 设置文本框行数 -->
placeholder="回复内容"
v-model="ruleForm.reply" >
</el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item v-if="ruleForm.reply" label="回复内容" prop="reply">
<span>{{ruleForm.reply}}</span>
</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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: { /* 样式配置参数 */ },
id: '',
type: '',
ro:{
//
userid : false,
username : false,
content : false,
reply : false,
},
//
ruleForm: {
userid: '',
username: '',
content: '',
reply: '',
},
//
rules: {
userid: [
{ required: true, message: '留言人id不能为空', trigger: 'blur' }, //
],
username: [
],
content: [
{ required: true, message: '留言内容不能为空', trigger: 'blur' }, //
],
reply: [
],
}
};
},
props: ["parent"], //
computed: {
},
created() {
this.addEditStyleChange() //
this.addEditUploadStyleChange() //
},
methods: {
//
download(file){
window.open(`${file}`)
},
//
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
if(this.type=='info'||this.type=='else'){ //
this.info(id); //
}else if(this.type=='cross'){ //
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){ //
if(o=='userid'){
this.ruleForm.userid = obj[o]; // id
this.ro.userid = true; //
continue;
}
if(o=='username'){
this.ruleForm.username = obj[o]; //
this.ro.username = true; //
continue;
}
if(o=='content'){
this.ruleForm.content = obj[o]; //
this.ro.content = true; //
continue;
}
if(o=='reply'){
this.ruleForm.reply = obj[o]; //
this.ro.reply = true; //
continue;
}
}
}
},
//
info(id) {
this.$http({
url: `messages/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: `messages/${!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.messagesCrossAddOrUpdateFlag = false; //
this.parent.search(); //
this.parent.contentStyleChange(); //
}
});
} else {
this.$message.error(data.msg); //
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true; //
this.parent.addOrUpdateFlag = false; //
this.parent.messagesCrossAddOrUpdateFlag = false; //
this.parent.contentStyleChange(); //
},
addEditStyleChange() { //
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputFontColor;
el.style.fontSize = this.addEditForm.inputFontSize;
el.style.borderWidth = this.addEditForm.inputBorderWidth;
el.style.borderStyle = this.addEditForm.inputBorderStyle;
el.style.borderColor = this.addEditForm.inputBorderColor;
el.style.borderRadius = this.addEditForm.inputBorderRadius;
el.style.backgroundColor = this.addEditForm.inputBgColor;
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputLableColor;
el.style.fontSize = this.addEditForm.inputLableFontSize;
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectFontColor;
el.style.fontSize = this.addEditForm.selectFontSize;
el.style.borderWidth = this.addEditForm.selectBorderWidth;
el.style.borderStyle = this.addEditForm.selectBorderStyle;
el.style.borderColor = this.addEditForm.selectBorderColor;
el.style.borderRadius = this.addEditForm.selectBorderRadius;
el.style.backgroundColor = this.addEditForm.selectBgColor;
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectLableColor;
el.style.fontSize = this.addEditForm.selectLableFontSize;
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor;
el.style.fontSize = this.addEditForm.selectIconFontSize;
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateFontColor;
el.style.fontSize = this.addEditForm.dateFontSize;
el.style.borderWidth = this.addEditForm.dateBorderWidth;
el.style.borderStyle = this.addEditForm.dateBorderStyle;
el.style.borderColor = this.addEditForm.dateBorderColor;
el.style.borderRadius = this.addEditForm.dateBorderRadius;
el.style.backgroundColor = this.addEditForm.dateBgColor;
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateLableColor;
el.style.fontSize = this.addEditForm.dateLableFontSize;
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor;
el.style.fontSize = this.addEditForm.dateIconFontSize;
el.style.lineHeight = this.addEditForm.dateHeight;
});
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px';
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight;
el.style.color = this.addEditForm.uploadLableColor;
el.style.fontSize = this.addEditForm.uploadLableFontSize;
});
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor;
el.style.fontSize = this.addEditForm.uploadIconFontSize;
el.style.lineHeight = iconLineHeight;
el.style.display = 'block';
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight;
el.style.color = this.addEditForm.textareaFontColor;
el.style.fontSize = this.addEditForm.textareaFontSize;
el.style.borderWidth = this.addEditForm.textareaBorderWidth;
el.style.borderStyle = this.addEditForm.textareaBorderStyle;
el.style.borderColor = this.addEditForm.textareaBorderColor;
el.style.borderRadius = this.addEditForm.textareaBorderRadius;
el.style.backgroundColor = this.addEditForm.textareaBgColor;
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor;
el.style.fontSize = this.addEditForm.textareaLableFontSize;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth;
el.style.height = this.addEditForm.btnSaveHeight;
el.style.color = this.addEditForm.btnSaveFontColor;
el.style.fontSize = this.addEditForm.btnSaveFontSize;
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth;
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle;
el.style.borderColor = this.addEditForm.btnSaveBorderColor;
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius;
el.style.backgroundColor = this.addEditForm.btnSaveBgColor;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth;
el.style.height = this.addEditForm.btnCancelHeight;
el.style.color = this.addEditForm.btnCancelFontColor;
el.style.fontSize = this.addEditForm.btnCancelFontSize;
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth;
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle;
el.style.borderColor = this.addEditForm.btnCancelBorderColor;
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius;
el.style.backgroundColor = this.addEditForm.btnCancelBgColor;
});
});
},
addEditUploadStyleChange() { //
this.$nextTick(()=>{ // DOM
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
});
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px; <!-- 编辑器高度 -->
& /deep/ .ql-container { <!-- 编辑器内容区域 -->
height: 310px; <!-- 设置内容区域高度 -->
}
}
.amap-wrapper { <!-- 地图容器 -->
width: 100%; <!-- 宽度为100% -->
height: 500px; <!-- 高度为500px -->
}
.search-box { <!-- 搜索按钮 -->
position: absolute; <!-- 绝对定位 -->
}
.addEdit-block { <!-- 表单容器 -->
margin: -10px; <!-- 外边距 -->
}
.detail-form-content { <!-- 表单内容 -->
padding: 12px; <!-- 内边距 -->
}
.btn .el-button { <!-- 按钮样式 -->
padding: 0; <!-- 无内边距 -->
}
</style>

@ -0,0 +1,534 @@
<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.username" placeholder="用户名" clearable></el-input>
<!-- 后置图标搜索框 -->
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.username" placeholder="用户名" clearable></el-input>
<!-- 无图标搜索框 -->
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.username" 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('messages','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('messages','新增') && 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('messages','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('messages','删除') && 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('messages','删除') && 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('messages','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('messages','查看')"
: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="username"
header-align="center"
label="用户名">
<template slot-scope="scope">
{{scope.row.username}}
</template>
</el-table-column>
<!-- 留言内容列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="content"
header-align="center"
label="留言内容">
<template slot-scope="scope">
{{scope.row.content}}
</template>
</el-table-column>
<!-- 回复内容列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="reply"
header-align="center"
label="回复内容">
<template slot-scope="scope">
{{scope.row.reply}}
</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('messages','查看') && 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('messages','查看') && 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('messages','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('messages','修改') && 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('messages','修改') && 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('messages','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 回复按钮 -->
<el-button v-if="isAuth('messages','回复') && 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('messages','回复') && 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('messages','回复') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('messages','删除') && 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('messages','删除') && 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('messages','删除') && 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>
</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:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
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
},
//
init () {
//
},
//
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
this.dataListLoading = true;
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
}
//
if(this.searchForm.username!='' && this.searchForm.username!=undefined){
params['username'] = '%' + this.searchForm.username + '%'
}
//
this.$http({
url: "messages/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);
});
},
//
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: "messages/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,595 @@
<template>
<!-- 主容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"
>
<!-- 表单项布局行 -->
<el-row>
<!-- 占据12列半屏 -->
<el-col :span="12">
<!-- 标题输入项非查看模式显示可编辑框 -->
<el-form-item class="input" v-if="type!='info'" label="标题" prop="title">
<el-input v-model="ruleForm.title"
placeholder="标题" clearable :readonly="ro.title"></el-input>
</el-form-item>
<!-- 查看模式下显示只读输入框 -->
<div v-else>
<el-form-item class="input" label="标题" prop="title">
<el-input v-model="ruleForm.title"
placeholder="标题" readonly></el-input>
</el-form-item>
</div>
</el-col>
</el-row>
<!-- 图片上传 -->
<el-row>
<el-col :span="24">
<!-- 非查看模式下显示文件上传控件 -->
<el-form-item class="upload" v-if="type!='info' && !ro.picture" label="图片" prop="picture">
<file-upload
tip="点击上传图片"
action="file/upload"
:limit="3"
:multiple="true"
:fileUrls="ruleForm.picture?ruleForm.picture:''"
@change="pictureUploadChange"
></file-upload>
</el-form-item>
<!-- 查看模式下显示已上传图片 -->
<div v-else>
<el-form-item v-if="ruleForm.picture" label="图片" prop="picture">
<!-- 显示多张图片 -->
<img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in ruleForm.picture.split(',')" :src="item" width="100" height="100">
</el-form-item>
</div>
</el-col>
</el-row>
<!-- 简介 -->
<el-row>
<el-col :span="24">
<el-form-item class="textarea" v-if="type != 'info'" label="简介" prop="introduction">
<el-input
style="min-width: 200px; max-width: 600px;"
type="textarea"
:rows="8"
placeholder="简介"
v-model="ruleForm.introduction">
</el-input>
</el-form-item>
<div v-else>
<el-form-item v-if="ruleForm.introduction" label="简介" prop="introduction">
<span>{{ ruleForm.introduction }}</span>
</el-form-item>
</div>
</el-col>
</el-row>
<!-- 内容 -->
<el-row>
<el-col :span="24">
<el-form-item v-if="type != 'info'" label="内容" prop="content">
<editor
style="min-width: 200px; max-width: 600px;"
v-model="ruleForm.content"
class="editor"
action="file/upload">
</editor>
</el-form-item>
<div v-else>
<el-form-item v-if="ruleForm.content" label="内容" prop="content">
<span v-html="ruleForm.content"></span>
</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>
// URL
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();
}
};
//
var validatePhone = (rule, value, callback) => {
if (!value) {
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if (!value) {
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if (!value) {
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if (!value) {
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: {
"btnSaveFontColor": "#fff",
"selectFontSize": "14px",
"btnCancelBorderColor": "rgba(152, 129, 129, 1)",
"inputBorderRadius": "22px",
"inputFontSize": "14px",
"textareaBgColor": "#fff",
"btnSaveFontSize": "14px",
"textareaBorderRadius": "22px",
"uploadBgColor": "#fff",
"textareaBorderStyle": "solid",
"btnCancelWidth": "88px",
"textareaHeight": "120px",
"dateBgColor": "#fff",
"btnSaveBorderRadius": "22px",
"uploadLableFontSize": "14px",
"textareaBorderWidth": "1px",
"inputLableColor": "#606266",
"addEditBoxColor": "rgba(210, 194, 194, 0.29)",
"dateIconFontSize": "14px",
"btnSaveBgColor": "#409EFF",
"uploadIconFontColor": "#8c939d",
"textareaBorderColor": "rgba(152, 129, 129, 1)",
"btnCancelBgColor": "rgba(143, 222, 143, 1)",
"selectLableColor": "#606266",
"btnSaveBorderStyle": "solid",
"dateBorderWidth": "1px",
"dateLableFontSize": "14px",
"dateBorderRadius": "22px",
"btnCancelBorderStyle": "solid",
"selectLableFontSize": "14px",
"selectBorderStyle": "solid",
"selectIconFontColor": "#C0C4CC",
"btnCancelHeight": "44px",
"inputHeight": "40px",
"btnCancelFontColor": "#606266",
"dateBorderColor": "rgba(152, 129, 129, 1)",
"dateIconFontColor": "#C0C4CC",
"uploadBorderStyle": "solid",
"dateBorderStyle": "solid",
"dateLableColor": "#606266",
"dateFontSize": "14px",
"inputBorderWidth": "1px",
"uploadIconFontSize": "28px",
"selectHeight": "40px",
"inputFontColor": "#606266",
"uploadHeight": "148px",
"textareaLableColor": "#606266",
"textareaLableFontSize": "14px",
"btnCancelFontSize": "14px",
"inputBorderStyle": "solid",
"btnCancelBorderRadius": "22px",
"inputBgColor": "rgba(252, 250, 250, 1)",
"inputLableFontSize": "14px",
"uploadLableColor": "#606266",
"uploadBorderRadius": "22px",
"btnSaveHeight": "44px",
"selectBgColor": "#fff",
"btnSaveWidth": "88px",
"selectIconFontSize": "14px",
"dateHeight": "40px",
"selectBorderColor": "rgba(152, 129, 129, 1)",
"inputBorderColor": "rgba(152, 129, 129, 1)",
"uploadBorderColor": "rgba(152, 129, 129, 1)",
"textareaFontColor": "#606266",
"selectBorderWidth": "1px",
"dateFontColor": "#606266",
"btnCancelBorderWidth": "1px",
"uploadBorderWidth": "1px",
"textareaFontSize": "14px",
"selectBorderRadius": "22px",
"selectFontColor": "#606266",
"btnSaveBorderColor": "#409EFF",
"btnSaveBorderWidth": "1px"
},
id: '', // ID
type: '', //
ro: { //
title: false,
introduction: false,
picture: false,
content: false,
},
ruleForm: { //
title: '',
introduction: '',
picture: '',
content: '',
},
rules: { //
title: [
{ required: true, message: '标题不能为空', trigger: 'blur' }
],
introduction: [],
picture: [
{ required: true, message: '图片不能为空', trigger: 'blur' }
],
content: [
{ required: true, message: '内容不能为空', trigger: 'blur' }
]
}
};
},
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'){
var obj = this.$storage.getObj('crossObj');
for (var o in obj){
if(o==='title'){
this.ruleForm.title = obj[o];
this.ro.title = true;
continue;
}
if(o==='introduction'){
this.ruleForm.introduction = obj[o];
this.ro.introduction = true;
continue;
}
if(o==='picture'){
this.ruleForm.picture = obj[o];
this.ro.picture = true;
continue;
}
if(o==='content'){
this.ruleForm.content = obj[o];
this.ro.content = true;
continue;
}
}
}
},
//
info(id) {
this.$http({
url: `news/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: `news/${!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.newsCrossAddOrUpdateFlag = 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.newsCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
pictureUploadChange(fileUrls) {
this.ruleForm.picture = fileUrls;
this.addEditUploadStyleChange();
},
//
addEditStyleChange() {
this.$nextTick(()=>{
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputFontColor;
el.style.fontSize = this.addEditForm.inputFontSize;
el.style.borderWidth = this.addEditForm.inputBorderWidth;
el.style.borderStyle = this.addEditForm.inputBorderStyle;
el.style.borderColor = this.addEditForm.inputBorderColor;
el.style.borderRadius = this.addEditForm.inputBorderRadius;
el.style.backgroundColor = this.addEditForm.inputBgColor;
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputLableColor;
el.style.fontSize = this.addEditForm.inputLableFontSize;
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectFontColor;
el.style.fontSize = this.addEditForm.selectFontSize;
el.style.borderWidth = this.addEditForm.selectBorderWidth;
el.style.borderStyle = this.addEditForm.selectBorderStyle;
el.style.borderColor = this.addEditForm.selectBorderColor;
el.style.borderRadius = this.addEditForm.selectBorderRadius;
el.style.backgroundColor = this.addEditForm.selectBgColor;
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectLableColor;
el.style.fontSize = this.addEditForm.selectLableFontSize;
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor;
el.style.fontSize = this.addEditForm.selectIconFontSize;
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateFontColor;
el.style.fontSize = this.addEditForm.dateFontSize;
el.style.borderWidth = this.addEditForm.dateBorderWidth;
el.style.borderStyle = this.addEditForm.dateBorderStyle;
el.style.borderColor = this.addEditForm.dateBorderColor;
el.style.borderRadius = this.addEditForm.dateBorderRadius;
el.style.backgroundColor = this.addEditForm.dateBgColor;
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateLableColor;
el.style.fontSize = this.addEditForm.dateLableFontSize;
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor;
el.style.fontSize = this.addEditForm.dateIconFontSize;
el.style.lineHeight = this.addEditForm.dateHeight;
});
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px';
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight;
el.style.color = this.addEditForm.uploadLableColor;
el.style.fontSize = this.addEditForm.uploadLableFontSize;
});
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor;
el.style.fontSize = this.addEditForm.uploadIconFontSize;
el.style.lineHeight = iconLineHeight;
el.style.display = 'block';
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight;
el.style.color = this.addEditForm.textareaFontColor;
el.style.fontSize = this.addEditForm.textareaFontSize;
el.style.borderWidth = this.addEditForm.textareaBorderWidth;
el.style.borderStyle = this.addEditForm.textareaBorderStyle;
el.style.borderColor = this.addEditForm.textareaBorderColor;
el.style.borderRadius = this.addEditForm.textareaBorderRadius;
el.style.backgroundColor = this.addEditForm.textareaBgColor;
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
el.style.color = this.addEditForm.textareaLableColor;
el.style.fontSize = this.addEditForm.textareaLableFontSize;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth;
el.style.height = this.addEditForm.btnSaveHeight;
el.style.color = this.addEditForm.btnSaveFontColor;
el.style.fontSize = this.addEditForm.btnSaveFontSize;
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth;
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle;
el.style.borderColor = this.addEditForm.btnSaveBorderColor;
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius;
el.style.backgroundColor = this.addEditForm.btnSaveBgColor;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth;
el.style.height = this.addEditForm.btnCancelHeight;
el.style.color = this.addEditForm.btnCancelFontColor;
el.style.fontSize = this.addEditForm.btnCancelFontSize;
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth;
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle;
el.style.borderColor = this.addEditForm.btnCancelBorderColor;
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius;
el.style.backgroundColor = this.addEditForm.btnCancelBgColor;
});
});
},
//
addEditUploadStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
});
}
}
};
</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,530 @@
<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.title" placeholder="标题" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.title" placeholder="标题" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.title" 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('news','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('news','新增') && 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('news','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('news','删除') && 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('news','删除') && 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('news','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('news','查看')"
: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="title"
header-align="center"
label="标题">
<template slot-scope="scope">
{{scope.row.title}}
</template>
</el-table-column>
<!-- 简介列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="introduction"
header-align="center"
label="简介">
<template slot-scope="scope">
{{scope.row.introduction}}
</template>
</el-table-column>
<!-- 图片列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="picture"
header-align="center"
width="200"
label="图片">
<template slot-scope="scope">
<div v-if="scope.row.picture">
<img :src="scope.row.picture.split(',')[0]" width="100" height="100">
</div>
<div v-else></div>
</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('news','查看') && 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('news','查看') && 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('news','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('news','修改') && 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('news','修改') && 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('news','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('news','删除') && 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('news','删除') && 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('news','删除') && 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>
</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:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllBorderColor":"#DCDFE6","btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
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(){
// this.$nextTick(()=>{...})
},
//
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
},
//
init () {
},
//
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
this.dataListLoading = true;
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
}
if(this.searchForm.title!='' && this.searchForm.title!=undefined){
params['title'] = '%' + this.searchForm.title + '%'
}
this.$http({
url: "news/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);
});
},
//
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: "news/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,467 @@
<template>
<!-- 添加/编辑页面容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 设置表单背景颜色 -->
>
<el-row> <!-- 表单布局行 -->
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="收藏id" prop="refid"> <!-- id -->
<el-input v-model="ruleForm.refid"
placeholder="收藏id" clearable :readonly="ro.refid"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="收藏id" prop="refid">
<el-input v-model="ruleForm.refid"
placeholder="收藏id" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="表名" prop="tablename"> <!-- -->
<el-input v-model="ruleForm.tablename"
placeholder="表名" clearable :readonly="ro.tablename"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="表名" prop="tablename">
<el-input v-model="ruleForm.tablename"
placeholder="表名" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="收藏名称" prop="name"> <!-- -->
<el-input v-model="ruleForm.name"
placeholder="收藏名称" clearable :readonly="ro.name"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="收藏名称" prop="name">
<el-input v-model="ruleForm.name"
placeholder="收藏名称" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="24"> <!-- 占满整行 -->
<el-form-item class="upload" v-if="type!='info' && !ro.picture" label="收藏图片" prop="picture"> <!-- -->
<file-upload
tip="点击上传收藏图片"
action="file/upload"
:limit="3"
:multiple="true"
:fileUrls="ruleForm.picture?ruleForm.picture:''"
@change="pictureUploadChange"
></file-upload>
</el-form-item>
<div v-else> <!-- -->
<el-form-item v-if="ruleForm.picture" label="收藏图片" prop="picture">
<img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in ruleForm.picture.split(',')" :src="item" width="100" height="100">
</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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: { /* 样式配置参数 */ },
id: '',
type: '',
ro:{
//
userid : false,
refid : false,
tablename : false,
name : false,
picture : false,
},
//
ruleForm: {
userid: '',
refid: '',
tablename: '',
name: '',
picture: '',
},
//
rules: {
userid: [
{ required: true, message: '用户id不能为空', trigger: 'blur' }, //
],
refid: [
],
tablename: [
],
name: [
{ required: true, message: '收藏名称不能为空', trigger: 'blur' }, //
],
picture: [
{ required: true, message: '收藏图片不能为空', trigger: 'blur' }, //
],
}
};
},
props: ["parent"], //
computed: {
},
created() {
this.addEditStyleChange() //
this.addEditUploadStyleChange() //
},
methods: {
//
download(file){
window.open(`${file}`)
},
//
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
if(this.type=='info'||this.type=='else'){ //
this.info(id); //
}else if(this.type=='cross'){ //
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){ //
if(o=='userid'){
this.ruleForm.userid = obj[o]; // id
this.ro.userid = true; //
continue;
}
if(o=='refid'){
this.ruleForm.refid = obj[o]; // id
this.ro.refid = true; //
continue;
}
if(o=='tablename'){
this.ruleForm.tablename = obj[o]; //
this.ro.tablename = true; //
continue;
}
if(o=='name'){
this.ruleForm.name = obj[o]; //
this.ro.name = true; //
continue;
}
if(o=='picture'){
this.ruleForm.picture = obj[o]; //
this.ro.picture = true; //
continue;
}
}
}
},
//
info(id) {
this.$http({
url: `storeup/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: `storeup/${!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.storeupCrossAddOrUpdateFlag = false; //
this.parent.search(); //
this.parent.contentStyleChange(); //
}
});
} else {
this.$message.error(data.msg); //
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true; //
this.parent.addOrUpdateFlag = false; //
this.parent.storeupCrossAddOrUpdateFlag = false; //
this.parent.contentStyleChange(); //
},
//
pictureUploadChange(fileUrls) {
this.ruleForm.picture = fileUrls; //
this.addEditUploadStyleChange(); //
},
addEditStyleChange() { //
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputFontColor;
el.style.fontSize = this.addEditForm.inputFontSize;
el.style.borderWidth = this.addEditForm.inputBorderWidth;
el.style.borderStyle = this.addEditForm.inputBorderStyle;
el.style.borderColor = this.addEditForm.inputBorderColor;
el.style.borderRadius = this.addEditForm.inputBorderRadius;
el.style.backgroundColor = this.addEditForm.inputBgColor;
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputLableColor;
el.style.fontSize = this.addEditForm.inputLableFontSize;
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectFontColor;
el.style.fontSize = this.addEditForm.selectFontSize;
el.style.borderWidth = this.addEditForm.selectBorderWidth;
el.style.borderStyle = this.addEditForm.selectBorderStyle;
el.style.borderColor = this.addEditForm.selectBorderColor;
el.style.borderRadius = this.addEditForm.selectBorderRadius;
el.style.backgroundColor = this.addEditForm.selectBgColor;
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectLableColor;
el.style.fontSize = this.addEditForm.selectLableFontSize;
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor;
el.style.fontSize = this.addEditForm.selectIconFontSize;
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateFontColor;
el.style.fontSize = this.addEditForm.dateFontSize;
el.style.borderWidth = this.addEditForm.dateBorderWidth;
el.style.borderStyle = this.addEditForm.dateBorderStyle;
el.style.borderColor = this.addEditForm.dateBorderColor;
el.style.borderRadius = this.addEditForm.dateBorderRadius;
el.style.backgroundColor = this.addEditForm.dateBgColor;
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateLableColor;
el.style.fontSize = this.addEditForm.dateLableFontSize;
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor;
el.style.fontSize = this.addEditForm.dateIconFontSize;
el.style.lineHeight = this.addEditForm.dateHeight;
});
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px';
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight;
el.style.color = this.addEditForm.uploadLableColor;
el.style.fontSize = this.addEditForm.uploadLableFontSize;
});
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor;
el.style.fontSize = this.addEditForm.uploadIconFontSize;
el.style.lineHeight = iconLineHeight;
el.style.display = 'block';
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight;
el.style.color = this.addEditForm.textareaFontColor;
el.style.fontSize = this.addEditForm.textareaFontSize;
el.style.borderWidth = this.addEditForm.textareaBorderWidth;
el.style.borderStyle = this.addEditForm.textareaBorderStyle;
el.style.borderColor = this.addEditForm.textareaBorderColor;
el.style.borderRadius = this.addEditForm.textareaBorderRadius;
el.style.backgroundColor = this.addEditForm.textareaBgColor;
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor;
el.style.fontSize = this.addEditForm.textareaLableFontSize;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth;
el.style.height = this.addEditForm.btnSaveHeight;
el.style.color = this.addEditForm.btnSaveFontColor;
el.style.fontSize = this.addEditForm.btnSaveFontSize;
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth;
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle;
el.style.borderColor = this.addEditForm.btnSaveBorderColor;
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius;
el.style.backgroundColor = this.addEditForm.btnSaveBgColor;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth;
el.style.height = this.addEditForm.btnCancelHeight;
el.style.color = this.addEditForm.btnCancelFontColor;
el.style.fontSize = this.addEditForm.btnCancelFontSize;
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth;
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle;
el.style.borderColor = this.addEditForm.btnCancelBorderColor;
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius;
el.style.backgroundColor = this.addEditForm.btnCancelBgColor;
});
});
},
addEditUploadStyleChange() { //
this.$nextTick(()=>{ // DOM
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
});
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px; <!-- 编辑器高度 -->
& /deep/ .ql-container { <!-- 编辑器内容区域 -->
height: 310px; <!-- 设置内容区域高度 -->
}
}
.amap-wrapper { <!-- 地图容器 -->
width: 100%; <!-- 宽度为100% -->
height: 500px; <!-- 高度为500px -->
}
.search-box { <!-- 搜索长度 -->
position: absolute; <!-- 绝对定位 -->
}
.addEdit-block { <!-- 表单容器 -->
margin: -10px; <!-- 外边距 -->
}
.detail-form-content { <!-- 表单内容 -->
padding: 12px; <!-- 内边距 -->
}
.btn .el-button { <!-- 按钮样式 -->
padding: 0; <!-- 无内边距 -->
}
</style>

@ -0,0 +1,524 @@
<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.name" placeholder="收藏名称" clearable></el-input>
<!-- 后置图标搜索框 -->
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.name" placeholder="收藏名称" clearable></el-input>
<!-- 无图标搜索框 -->
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.name" 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('storeup','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('storeup','新增') && 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('storeup','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('storeup','删除') && 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('storeup','删除') && 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('storeup','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('storeup','查看')"
: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="name"
header-align="center"
label="收藏名称">
<template slot-scope="scope">
{{scope.row.name}}
</template>
</el-table-column>
<!-- 收藏图片列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="picture"
header-align="center"
width="200"
label="收藏图片">
<template slot-scope="scope">
<div v-if="scope.row.picture">
<img :src="scope.row.picture.split(',')[0]" width="100" height="100">
</div>
<div v-else></div>
</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('storeup','查看') && 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('storeup','查看') && 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('storeup','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('storeup','修改') && 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('storeup','修改') && 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('storeup','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('storeup','删除') && 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('storeup','删除') && 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('storeup','删除') && 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>
</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:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
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
},
//
init () {
//
},
//
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
this.dataListLoading = true;
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
}
//
if(this.searchForm.name!='' && this.searchForm.name!=undefined){
params['name'] = '%' + this.searchForm.name + '%'
}
//
this.$http({
url: "storeup/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);
});
},
//
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: "storeup/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,413 @@
<template>
<!-- 添加/编辑页面容器 -->
<div class="addEdit-block">
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}" <!-- 设置表单背景颜色 -->
>
<el-row> <!-- 表单布局行 -->
<el-col :span="12"> <!-- 左侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="用户名" prop="username"> <!-- -->
<el-input v-model="ruleForm.username"
placeholder="用户名" clearable :readonly="ro.username"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="用户名" prop="username">
<el-input v-model="ruleForm.username"
placeholder="用户名" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="12"> <!-- 右侧列宽度为12 -->
<el-form-item class="input" v-if="type!='info'" label="密码" prop="password"> <!-- -->
<el-input v-model="ruleForm.password"
placeholder="密码" clearable :readonly="ro.password"></el-input>
</el-form-item>
<div v-else> <!-- -->
<el-form-item class="input" label="密码" prop="password">
<el-input v-model="ruleForm.password"
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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: { /* 样式配置参数 */ },
id: '',
type: '',
ro:{
//
username : false,
password : false,
role : false,
},
//
ruleForm: {
username: '',
password: '',
},
//
rules: {
username: [
{ required: true, message: '用户名不能为空', trigger: 'blur' }, //
],
password: [
{ required: true, message: '密码不能为空', trigger: 'blur' }, //
],
role: [
],
}
};
},
props: ["parent"], //
computed: {
},
created() {
this.addEditStyleChange() //
this.addEditUploadStyleChange() //
},
methods: {
//
download(file){
window.open(`${file}`)
},
//
init(id,type) {
if (id) {
this.id = id; // ID
this.type = type; //
}
if(this.type=='info'||this.type=='else'){ //
this.info(id); //
}else if(this.type=='cross'){ //
var obj = this.$storage.getObj('crossObj'); //
for (var o in obj){ //
if(o=='username'){
this.ruleForm.username = obj[o]; //
this.ro.username = true; //
continue;
}
if(o=='password'){
this.ruleForm.password = obj[o]; //
this.ro.password = true; //
continue;
}
if(o=='role'){
this.ruleForm.role = obj[o]; //
this.ro.role = true; //
continue;
}
}
}
},
//
info(id) {
this.$http({
url: `users/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: `users/${!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.usersCrossAddOrUpdateFlag = false; //
this.parent.search(); //
this.parent.contentStyleChange(); //
}
});
} else {
this.$message.error(data.msg); //
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true; //
this.parent.addOrUpdateFlag = false; //
this.parent.usersCrossAddOrUpdateFlag = false; //
this.parent.contentStyleChange(); //
},
addEditStyleChange() { //
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputFontColor;
el.style.fontSize = this.addEditForm.inputFontSize;
el.style.borderWidth = this.addEditForm.inputBorderWidth;
el.style.borderStyle = this.addEditForm.inputBorderStyle;
el.style.borderColor = this.addEditForm.inputBorderColor;
el.style.borderRadius = this.addEditForm.inputBorderRadius;
el.style.backgroundColor = this.addEditForm.inputBgColor;
});
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight;
el.style.color = this.addEditForm.inputLableColor;
el.style.fontSize = this.addEditForm.inputLableFontSize;
});
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectFontColor;
el.style.fontSize = this.addEditForm.selectFontSize;
el.style.borderWidth = this.addEditForm.selectBorderWidth;
el.style.borderStyle = this.addEditForm.selectBorderStyle;
el.style.borderColor = this.addEditForm.selectBorderColor;
el.style.borderRadius = this.addEditForm.selectBorderRadius;
el.style.backgroundColor = this.addEditForm.selectBgColor;
});
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight;
el.style.color = this.addEditForm.selectLableColor;
el.style.fontSize = this.addEditForm.selectLableFontSize;
});
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor;
el.style.fontSize = this.addEditForm.selectIconFontSize;
});
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateFontColor;
el.style.fontSize = this.addEditForm.dateFontSize;
el.style.borderWidth = this.addEditForm.dateBorderWidth;
el.style.borderStyle = this.addEditForm.dateBorderStyle;
el.style.borderColor = this.addEditForm.dateBorderColor;
el.style.borderRadius = this.addEditForm.dateBorderRadius;
el.style.backgroundColor = this.addEditForm.dateBgColor;
});
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight;
el.style.color = this.addEditForm.dateLableColor;
el.style.fontSize = this.addEditForm.dateLableFontSize;
});
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor;
el.style.fontSize = this.addEditForm.dateIconFontSize;
el.style.lineHeight = this.addEditForm.dateHeight;
});
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px';
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight;
el.style.color = this.addEditForm.uploadLableColor;
el.style.fontSize = this.addEditForm.uploadLableFontSize;
});
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor;
el.style.fontSize = this.addEditForm.uploadIconFontSize;
el.style.lineHeight = iconLineHeight;
el.style.display = 'block';
});
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight;
el.style.color = this.addEditForm.textareaFontColor;
el.style.fontSize = this.addEditForm.textareaFontSize;
el.style.borderWidth = this.addEditForm.textareaBorderWidth;
el.style.borderStyle = this.addEditForm.textareaBorderStyle;
el.style.borderColor = this.addEditForm.textareaBorderColor;
el.style.borderRadius = this.addEditForm.textareaBorderRadius;
el.style.backgroundColor = this.addEditForm.textareaBgColor;
});
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor;
el.style.fontSize = this.addEditForm.textareaLableFontSize;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth;
el.style.height = this.addEditForm.btnSaveHeight;
el.style.color = this.addEditForm.btnSaveFontColor;
el.style.fontSize = this.addEditForm.btnSaveFontSize;
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth;
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle;
el.style.borderColor = this.addEditForm.btnSaveBorderColor;
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius;
el.style.backgroundColor = this.addEditForm.btnSaveBgColor;
});
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth;
el.style.height = this.addEditForm.btnCancelHeight;
el.style.color = this.addEditForm.btnCancelFontColor;
el.style.fontSize = this.addEditForm.btnCancelFontSize;
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth;
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle;
el.style.borderColor = this.addEditForm.btnCancelBorderColor;
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius;
el.style.backgroundColor = this.addEditForm.btnCancelBgColor;
});
});
},
addEditUploadStyleChange() { //
this.$nextTick(()=>{ // DOM
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight;
el.style.height = this.addEditForm.uploadHeight;
el.style.borderWidth = this.addEditForm.uploadBorderWidth;
el.style.borderStyle = this.addEditForm.uploadBorderStyle;
el.style.borderColor = this.addEditForm.uploadBorderColor;
el.style.borderRadius = this.addEditForm.uploadBorderRadius;
el.style.backgroundColor = this.addEditForm.uploadBgColor;
});
});
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px; <!-- 编辑器高度 -->
& /deep/ .ql-container { <!-- 编辑器内容区域 -->
height: 310px; <!-- 设置内容区域高度 -->
}
}
.amap-wrapper { <!-- 地图容器 -->
width: 100%; <!-- 宽度为100% -->
height: 500px; <!-- 高度为500px -->
}
.search-box { <!-- 搜索原高度 -->
position: absolute; <!-- 绝对定位 -->
}
.addEdit-block { <!-- 表单容器 -->
margin: -10px; <!-- 外边距 -->
}
.detail-form-content { <!-- 表单内容 -->
padding: 12px; <!-- 内边距 -->
}
.btn .el-button { <!-- 按钮样式 -->
padding: 0; <!-- 无内边距 -->
}
</style>

@ -0,0 +1,530 @@
<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.username" placeholder="用户名" clearable></el-input>
<!-- 后置图标搜索框 -->
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.username" placeholder="用户名" clearable></el-input>
<!-- 无图标搜索框 -->
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.username" 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('users','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('users','新增') && 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('users','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('users','删除') && 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('users','删除') && 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('users','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('users','查看')"
: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="username"
header-align="center"
label="用户名">
<template slot-scope="scope">
{{scope.row.username}}
</template>
</el-table-column>
<!-- 密码列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="password"
header-align="center"
label="密码">
<template slot-scope="scope">
{{scope.row.password}}
</template>
</el-table-column>
<!-- 角色列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="role"
header-align="center"
label="角色">
<template slot-scope="scope">
{{scope.row.role}}
</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('users','查看') && 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('users','查看') && 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('users','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('users','修改') && 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('users','修改') && 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('users','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('users','删除') && 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('users','删除') && 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('users','删除') && 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>
</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:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
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
},
//
init () {
//
},
//
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
this.dataListLoading = true;
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
}
//
if(this.searchForm.username!='' && this.searchForm.username!=undefined){
params['username'] = '%' + this.searchForm.username + '%'
}
//
this.$http({
url: "users/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);
});
},
//
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: "users/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,660 @@
<template>
<div class="addEdit-block">
<!-- 表单容器 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"> <!-- 后台配置表单背景颜色 -->
<el-row>
<!-- 表单列自适应布局 -->
<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="12">
<el-form-item class="input" v-if="type!='info'" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
placeholder="房屋类型" clearable :readonly="ro.fangwuleixing"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
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="baoxiumingcheng">
<el-input v-model="ruleForm.baoxiumingcheng"
placeholder="报修名称" clearable :readonly="ro.baoxiumingcheng"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="报修名称" prop="baoxiumingcheng">
<el-input v-model="ruleForm.baoxiumingcheng"
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="leixing">
<el-input v-model="ruleForm.leixing"
placeholder="类型" clearable :readonly="ro.leixing"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="类型" prop="leixing">
<el-input v-model="ruleForm.leixing"
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="baoxiuriqi">
<el-input v-model="ruleForm.baoxiuriqi"
placeholder="报修日期" clearable :readonly="ro.baoxiuriqi"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="报修日期" prop="baoxiuriqi">
<el-input v-model="ruleForm.baoxiuriqi"
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="weixiufankui">
<el-input v-model="ruleForm.weixiufankui"
placeholder="维修反馈" clearable :readonly="ro.weixiufankui"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="维修反馈" prop="weixiufankui">
<el-input v-model="ruleForm.weixiufankui"
placeholder="维修反馈" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!-- 维修进度表单下拉选择 -->
<el-col :span="12">
<el-form-item class="select" v-if="type!='info'" label="维修进度" prop="weixiujindu">
<el-select v-model="ruleForm.weixiujindu" placeholder="请选择维修进度">
<el-option
v-for="(item,index) in weixiujinduOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<div v-else>
<el-form-item class="input" label="维修进度" prop="weixiujindu">
<el-input v-model="ruleForm.weixiujindu"
placeholder="维修进度" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!-- 更新日期表单日期选择器 -->
<el-col :span="12">
<el-form-item class="date" v-if="type!='info'" label="更新日期" prop="gengxinriqi">
<el-date-picker
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
v-model="ruleForm.gengxinriqi"
type="date"
placeholder="更新日期">
</el-date-picker>
</el-form-item>
<div v-else>
<el-form-item class="input" v-if="ruleForm.gengxinriqi" label="更新日期" prop="gengxinriqi">
<el-input v-model="ruleForm.gengxinriqi"
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="fangzhuzhanghao">
<el-input v-model="ruleForm.fangzhuzhanghao"
placeholder="房主账号" clearable :readonly="ro.fangzhuzhanghao"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="房主账号" prop="fangzhuzhanghao">
<el-input v-model="ruleForm.fangzhuzhanghao"
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="fangzhuxingming">
<el-input v-model="ruleForm.fangzhuxingming"
placeholder="房主姓名" clearable :readonly="ro.fangzhuxingming"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="房主姓名" prop="fangzhuxingming">
<el-input v-model="ruleForm.fangzhuxingming"
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="yonghuming">
<el-input v-model="ruleForm.yonghuming"
placeholder="用户名" clearable :readonly="ro.yonghuming"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="用户名" prop="yonghuming">
<el-input v-model="ruleForm.yonghuming"
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="lianxidianhua">
<el-input v-model="ruleForm.lianxidianhua"
placeholder="联系电话" clearable :readonly="ro.lianxidianhua"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="联系电话" prop="lianxidianhua">
<el-input v-model="ruleForm.lianxidianhua"
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();
}
};
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();
}
};
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"rgba(152, 129, 129, 1)","inputBorderRadius":"22px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"22px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"22px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"#606266","addEditBoxColor":"rgba(210, 194, 194, 0.29)","dateIconFontSize":"14px","btnSaveBgColor":"#409EFF","uploadIconFontColor":"#8c939d","textareaBorderColor":"rgba(152, 129, 129, 1)","btnCancelBgColor":"rgba(143, 222, 143, 1)","selectLableColor":"#606266","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"22px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"#606266","dateBorderColor":"rgba(152, 129, 129, 1)","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"#606266","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"#606266","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"22px","inputBgColor":"rgba(252, 250, 250, 1)","inputLableFontSize":"14px","uploadLableColor":"#606266","uploadBorderRadius":"22px","btnSaveHeight":"44px","selectBgColor":"#fff","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"rgba(152, 129, 129, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","uploadBorderColor":"rgba(152, 129, 129, 1)","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"22px","selectFontColor":"#606266","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"1px"},
// ID
id: '',
//
type: '',
//
ro:{
fangwumingcheng : false,
fangwuleixing : false,
baoxiumingcheng : false,
leixing : false,
baoxiuriqi : false,
weixiufankui : false,
weixiujindu : false,
gengxinriqi : false,
fangzhuzhanghao : false,
fangzhuxingming : false,
yonghuming : false,
lianxidianhua : false,
},
//
ruleForm: {
fangwumingcheng: '',
fangwuleixing: '',
baoxiumingcheng: '',
leixing: '',
baoxiuriqi: '',
weixiufankui: '',
weixiujindu: '',
gengxinriqi: '',
fangzhuzhanghao: '',
fangzhuxingming: '',
yonghuming: '',
lianxidianhua: '',
},
//
weixiujinduOptions: [],
//
rules: {
fangwumingcheng: [
],
fangwuleixing: [
],
baoxiumingcheng: [
],
leixing: [
],
baoxiuriqi: [
],
weixiufankui: [
],
weixiujindu: [
],
gengxinriqi: [
],
fangzhuzhanghao: [
],
fangzhuxingming: [
],
yonghuming: [
],
lianxidianhua: [
],
}
};
},
//
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'){
var obj = this.$storage.getObj('crossObj');
for (var o in obj){
if(o=='fangwumingcheng'){
this.ruleForm.fangwumingcheng = obj[o];
this.ro.fangwumingcheng = true;
continue;
}
if(o=='fangwuleixing'){
this.ruleForm.fangwuleixing = obj[o];
this.ro.fangwuleixing = true;
continue;
}
if(o=='baoxiumingcheng'){
this.ruleForm.baoxiumingcheng = obj[o];
this.ro.baoxiumingcheng = true;
continue;
}
if(o=='leixing'){
this.ruleForm.leixing = obj[o];
this.ro.leixing = true;
continue;
}
if(o=='baoxiuriqi'){
this.ruleForm.baoxiuriqi = obj[o];
this.ro.baoxiuriqi = true;
continue;
}
if(o=='weixiufankui'){
this.ruleForm.weixiufankui = obj[o];
this.ro.weixiufankui = true;
continue;
}
if(o=='weixiujindu'){
this.ruleForm.weixiujindu = obj[o];
this.ro.weixiujindu = true;
continue;
}
if(o=='gengxinriqi'){
this.ruleForm.gengxinriqi = obj[o];
this.ro.gengxinriqi = true;
continue;
}
if(o=='fangzhuzhanghao'){
this.ruleForm.fangzhuzhanghao = obj[o];
this.ro.fangzhuzhanghao = true;
continue;
}
if(o=='fangzhuxingming'){
this.ruleForm.fangzhuxingming = obj[o];
this.ro.fangzhuxingming = true;
continue;
}
if(o=='yonghuming'){
this.ruleForm.yonghuming = obj[o];
this.ro.yonghuming = true;
continue;
}
if(o=='lianxidianhua'){
this.ruleForm.lianxidianhua = obj[o];
this.ro.lianxidianhua = true;
continue;
}
}
}
//
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.weixiujinduOptions = "维修中,已完成".split(',')
},
//
info(id) {
this.$http({
url: `weixiuchuli/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: `weixiuchuli/${!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.weixiuchuliCrossAddOrUpdateFlag = false;
this.parent.search();
this.parent.contentStyleChange();
}
});
} else {
this.$message.error(data.msg);
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true;
this.parent.addOrUpdateFlag = false;
this.parent.weixiuchuliCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
addEditStyleChange() {
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputFontColor
el.style.fontSize = this.addEditForm.inputFontSize
el.style.borderWidth = this.addEditForm.inputBorderWidth
el.style.borderStyle = this.addEditForm.inputBorderStyle
el.style.borderColor = this.addEditForm.inputBorderColor
el.style.borderRadius = this.addEditForm.inputBorderRadius
el.style.backgroundColor = this.addEditForm.inputBgColor
})
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputLableColor
el.style.fontSize = this.addEditForm.inputLableFontSize
})
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectFontColor
el.style.fontSize = this.addEditForm.selectFontSize
el.style.borderWidth = this.addEditForm.selectBorderWidth
el.style.borderStyle = this.addEditForm.selectBorderStyle
el.style.borderColor = this.addEditForm.selectBorderColor
el.style.borderRadius = this.addEditForm.selectBorderRadius
el.style.backgroundColor = this.addEditForm.selectBgColor
})
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectLableColor
el.style.fontSize = this.addEditForm.selectLableFontSize
})
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor
el.style.fontSize = this.addEditForm.selectIconFontSize
})
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateFontColor
el.style.fontSize = this.addEditForm.dateFontSize
el.style.borderWidth = this.addEditForm.dateBorderWidth
el.style.borderStyle = this.addEditForm.dateBorderStyle
el.style.borderColor = this.addEditForm.dateBorderColor
el.style.borderRadius = this.addEditForm.dateBorderRadius
el.style.backgroundColor = this.addEditForm.dateBgColor
})
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateLableColor
el.style.fontSize = this.addEditForm.dateLableFontSize
})
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor
el.style.fontSize = this.addEditForm.dateIconFontSize
el.style.lineHeight = this.addEditForm.dateHeight
})
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px'
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight
el.style.color = this.addEditForm.uploadLableColor
el.style.fontSize = this.addEditForm.uploadLableFontSize
})
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor
el.style.fontSize = this.addEditForm.uploadIconFontSize
el.style.lineHeight = iconLineHeight
el.style.display = 'block'
})
// textarea
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaFontColor
el.style.fontSize = this.addEditForm.textareaFontSize
el.style.borderWidth = this.addEditForm.textareaBorderWidth
el.style.borderStyle = this.addEditForm.textareaBorderStyle
el.style.borderColor = this.addEditForm.textareaBorderColor
el.style.borderRadius = this.addEditForm.textareaBorderRadius
el.style.backgroundColor = this.addEditForm.textareaBgColor
})
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
el.style.color = this.addEditForm.textareaLableColor
el.style.fontSize = this.addEditForm.textareaLableFontSize
})
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth
el.style.height = this.addEditForm.btnSaveHeight
el.style.color = this.addEditForm.btnSaveFontColor
el.style.fontSize = this.addEditForm.btnSaveFontSize
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle
el.style.borderColor = this.addEditForm.btnSaveBorderColor
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius
el.style.backgroundColor = this.addEditForm.btnSaveBgColor
})
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth
el.style.height = this.addEditForm.btnCancelHeight
el.style.color = this.addEditForm.btnCancelFontColor
el.style.fontSize = this.addEditForm.btnCancelFontSize
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle
el.style.borderColor = this.addEditForm.btnCancelBorderColor
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius
el.style.backgroundColor = this.addEditForm.btnCancelBgColor
})
})
},
addEditUploadStyleChange() { //
this.$nextTick(()=>{ // DOM
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
})
},
}
};
</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,639 @@
<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.baoxiumingcheng" placeholder="报修名称" clearable></el-input>
<!-- 后置图标搜索框 -->
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.baoxiumingcheng" placeholder="报修名称" clearable></el-input>
<!-- 无图标搜索框 -->
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.baoxiumingcheng" 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.weixiujindu" placeholder="维修进度" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.weixiujindu" placeholder="维修进度" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.weixiujindu" 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.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangzhuxingming" 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('weixiuchuli','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('weixiuchuli','新增') && 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('weixiuchuli','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('weixiuchuli','删除') && 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('weixiuchuli','删除') && 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('weixiuchuli','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('weixiuchuli','查看')"
: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="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="baoxiumingcheng"
header-align="center"
label="报修名称">
<template slot-scope="scope">
{{scope.row.baoxiumingcheng}}
</template>
</el-table-column>
<!-- 类型列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="leixing"
header-align="center"
label="类型">
<template slot-scope="scope">
{{scope.row.leixing}}
</template>
</el-table-column>
<!-- 报修日期列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="baoxiuriqi"
header-align="center"
label="报修日期">
<template slot-scope="scope">
{{scope.row.baoxiuriqi}}
</template>
</el-table-column>
<!-- 维修反馈列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="weixiufankui"
header-align="center"
label="维修反馈">
<template slot-scope="scope">
{{scope.row.weixiufankui}}
</template>
</el-table-column>
<!-- 维修进度列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="weixiujindu"
header-align="center"
label="维修进度">
<template slot-scope="scope">
{{scope.row.weixiujindu}}
</template>
</el-table-column>
<!-- 更新日期列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="gengxinriqi"
header-align="center"
label="更新日期">
<template slot-scope="scope">
{{scope.row.gengxinriqi}}
</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="fangzhuxingming"
header-align="center"
label="房主姓名">
<template slot-scope="scope">
{{scope.row.fangzhuxingming}}
</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 width="300" :align="contents.tableAlign"
header-align="center"
label="操作">
<template slot-scope="scope">
<!-- 详情按钮 -->
<el-button v-if="isAuth('weixiuchuli','查看') && 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('weixiuchuli','查看') && 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('weixiuchuli','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('weixiuchuli','修改') && 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('weixiuchuli','修改') && 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('weixiuchuli','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('weixiuchuli','删除') && 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('weixiuchuli','删除') && 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('weixiuchuli','删除') && 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>
</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:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
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
},
//
init () {
//
this.weixiujinduOptions = "维修中,已完成".split(',')
},
//
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
this.dataListLoading = true;
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
}
//
if(this.searchForm.baoxiumingcheng!='' && this.searchForm.baoxiumingcheng!=undefined){
params['baoxiumingcheng'] = '%' + this.searchForm.baoxiumingcheng + '%'
}
if(this.searchForm.weixiujindu!='' && this.searchForm.weixiujindu!=undefined){
params['weixiujindu'] = '%' + this.searchForm.weixiujindu + '%'
}
if(this.searchForm.fangzhuxingming!='' && this.searchForm.fangzhuxingming!=undefined){
params['fangzhuxingming'] = '%' + this.searchForm.fangzhuxingming + '%'
}
if(this.searchForm.yonghuming!='' && this.searchForm.yonghuming!=undefined){
params['yonghuming'] = '%' + this.searchForm.yonghuming + '%'
}
//
this.$http({
url: "weixiuchuli/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);
});
},
//
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: "weixiuchuli/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,628 @@
<template>
<!-- 定义模板的根元素 -->
<div class="addEdit-block">
<!-- 定义表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"
>
<!-- 定义表单的行布局 -->
<el-row>
<!-- 定义表单的列布局 -->
<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="12">
<!-- 定义表单项 -->
<el-form-item class="select" v-if="type!='info'" label="房屋类型" prop="fangwuleixing">
<!-- 定义下拉选择框 -->
<el-select v-model="ruleForm.fangwuleixing" placeholder="请选择房屋类型">
<el-option
v-for="(item,index) in fangwuleixingOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
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="select" v-if="type!='info'" label="租赁方式" prop="zulinfangshi">
<!-- 定义下拉选择框 -->
<el-select v-model="ruleForm.zulinfangshi" placeholder="请选择租赁方式">
<el-option
v-for="(item,index) in zulinfangshiOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="租赁方式" prop="zulinfangshi">
<el-input v-model="ruleForm.zulinfangshi"
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="chaoxianglouceng">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.chaoxianglouceng"
placeholder="朝向楼层" clearable :readonly="ro.chaoxianglouceng"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="朝向楼层" prop="chaoxianglouceng">
<el-input v-model="ruleForm.chaoxianglouceng"
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="xiaoqu">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.xiaoqu"
placeholder="小区" clearable :readonly="ro.xiaoqu"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="小区" prop="xiaoqu">
<el-input v-model="ruleForm.xiaoqu"
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="mianji">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.mianji"
placeholder="面积" clearable :readonly="ro.mianji"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="面积" prop="mianji">
<el-input v-model="ruleForm.mianji"
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="yuezujiage">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yuezujiage"
placeholder="月租价格" clearable :readonly="ro.yuezujiage"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="月租价格" prop="yuezujiage">
<el-input v-model="ruleForm.yuezujiage"
placeholder="月租价格" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!-- 定义表单的列布局 -->
<el-col :span="12">
<!-- 定义表单项 -->
<el-form-item class="date" v-if="type!='info'" label="发布日期" prop="faburiqi">
<!-- 定义日期选择器 -->
<el-date-picker
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
v-model="ruleForm.faburiqi"
type="date"
placeholder="发布日期">
</el-date-picker>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" v-if="ruleForm.faburiqi" label="发布日期" prop="faburiqi">
<el-input v-model="ruleForm.faburiqi"
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="yonghuming">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yonghuming"
placeholder="用户名" clearable :readonly="ro.yonghuming"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="用户名" prop="yonghuming">
<el-input v-model="ruleForm.yonghuming"
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="lianxidianhua">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.lianxidianhua"
placeholder="联系电话" clearable :readonly="ro.lianxidianhua"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="联系电话" prop="lianxidianhua">
<el-input v-model="ruleForm.lianxidianhua"
placeholder="联系电话" readonly></el-input>
</el-form-item>
</div>
</el-col>
</el-row>
<!-- 定义表单的行布局 -->
<el-row>
<!-- 定义表单的列布局 -->
<el-col :span="24">
<!-- 定义表单项 -->
<el-form-item v-if="type!='info'" label="房屋详情" prop="fangwuxiangqing">
<!-- 定义富文本编辑器 -->
<editor
style="min-width: 200px; max-width: 600px;"
v-model="ruleForm.fangwuxiangqing"
class="editor"
action="file/upload">
</editor>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item v-if="ruleForm.fangwuxiangqing" label="房屋详情" prop="fangwuxiangqing">
<!-- 显示内容 -->
<span v-html="ruleForm.fangwuxiangqing"></span>
</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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
//
return {
//
addEditForm: {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"rgba(152, 129, 129, 1)","inputBorderRadius":"22px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"22px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"22px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"#606266","addEditBoxColor":"rgba(210, 194, 194, 0.29)","dateIconFontSize":"14px","btnSaveBgColor":"#409EFF","uploadIconFontColor":"#8c939d","textareaBorderColor":"rgba(152, 129, 129, 1)","btnCancelBgColor":"rgba(143, 222, 143, 1)","selectLableColor":"#606266","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"22px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"#606266","dateBorderColor":"rgba(152, 129, 129, 1)","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"#606266","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"#606266","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"22px","inputBgColor":"rgba(252, 250, 250, 1)","inputLableFontSize":"14px","uploadLableColor":"#606266","uploadBorderRadius":"22px","btnSaveHeight":"44px","selectBgColor":"#fff","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"rgba(152, 129, 129, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","uploadBorderColor":"rgba(152, 129, 129, 1)","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"22px","selectFontColor":"#606266","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"1px"},
// ID
id: '',
//
type: '',
//
ro:{
fangwumingcheng : false,
fangwuleixing : false,
tupian : false,
zulinfangshi : false,
chaoxianglouceng : false,
xiaoqu : false,
mianji : false,
yuezujiage : false,
fangwuxiangqing : false,
faburiqi : false,
yonghuming : false,
lianxidianhua : false,
sfsh : false,
shhf : false,
},
//
ruleForm: {
fangwumingcheng: '',
fangwuleixing: '',
tupian: '',
zulinfangshi: '',
chaoxianglouceng: '',
xiaoqu: '',
mianji: '',
yuezujiage: '',
fangwuxiangqing: '',
faburiqi: '',
yonghuming: '',
lianxidianhua: '',
shhf: '',
},
//
fangwuleixingOptions: [],
zulinfangshiOptions: [],
//
rules: {
fangwumingcheng: [
{ required: true, message: '房屋名称不能为空', trigger: 'blur' },
],
fangwuleixing: [
{ required: true, message: '房屋类型不能为空', trigger: 'blur' },
],
tupian: [
{ required: true, message: '图片不能为空', trigger: 'blur' },
],
zulinfangshi: [
{ required: true, message: '租赁方式不能为空', trigger: 'blur' },
],
chaoxianglouceng: [
],
xiaoqu: [
],
mianji: [
],
yuezujiage: [
{ validator: validateIntNumber, trigger: 'blur' },
],
fangwuxiangqing: [
],
faburiqi: [
],
yonghuming: [
],
lianxidianhua: [
],
sfsh: [
],
shhf: [
],
}
};
},
//
props: ["parent"],
//
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'){
var obj = this.$storage.getObj('crossObj');
for (var o in obj){
if(o=='fangwumingcheng'){
this.ruleForm.fangwumingcheng = obj[o];
this.ro.fangwumingcheng = true;
continue;
}
if(o=='fangwuleixing'){
this.ruleForm.fangwuleixing = obj[o];
this.ro.fangwuleixing = true;
continue;
}
if(o=='tupian'){
this.ruleForm.tupian = obj[o];
this.ro.tupian = true;
continue;
}
if(o=='zulinfangshi'){
this.ruleForm.zulinfangshi = obj[o];
this.ro.zulinfangshi = true;
continue;
}
if(o=='chaoxianglouceng'){
this.ruleForm.chaoxianglouceng = obj[o];
this.ro.chaoxianglouceng = true;
continue;
}
if(o=='xiaoqu'){
this.ruleForm.xiaoqu = obj[o];
this.ro.xiaoqu = true;
continue;
}
if(o=='mianji'){
this.ruleForm.mianji = obj[o];
this.ro.mianji = true;
continue;
}
if(o=='yuezujiage'){
this.ruleForm.yuezujiage = obj[o];
this.ro.yuezujiage = true;
continue;
}
if(o=='fangwuxiangqing'){
this.ruleForm.fangwuxiangqing = obj[o];
this.ro.fangwuxiangqing = true;
continue;
}
if(o=='faburiqi'){
this.ruleForm.faburiqi = obj[o];
this.ro.faburiqi = true;
continue;
}
if(o=='yonghuming'){
this.ruleForm.yonghuming = obj[o];
this.ro.yonghuming = true;
continue;
}
if(o=='lianxidianhua'){
this.ruleForm.lianxidianhua = obj[o];
this.ro.lianxidianhua = true;
continue;
}
}
}
//
this.$http({
url: `${this.$storage.get('sessionTable')}/session`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
var json = data.data;
if(json.yonghuming!=''&&json.yonghuming){
this.ruleForm.yonghuming = json.yonghuming
}
if(json.lianxidianhua!=''&&json.lianxidianhua){
this.ruleForm.lianxidianhua = json.lianxidianhua
}
} else {
this.$message.error(data.msg);
}
});
//
this.$http({
url: `option/fangwuleixing/fangwuleixing`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.fangwuleixingOptions = data.data;
} else {
this.$message.error(data.msg);
}
});
//
this.zulinfangshiOptions = "整租,合租".split(',')
},
//
info(id) {
this.$http({
url: `woyaodangfangzhu/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: `woyaodangfangzhu/${!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.woyaodangfangzhuCrossAddOrUpdateFlag = 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.woyaodangfangzhuCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
tupianUploadChange(fileUrls) {
this.ruleForm.tupian = fileUrls;
this.addEditUploadStyleChange()
},
//
addEditStyleChange() {
this.$nextTick(()=>{})
},
//
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,800 @@
<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.xiaoqu" placeholder="小区" clearable></el-input>
<!-- 定义带有后缀图标的输入框 -->
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.xiaoqu" placeholder="小区" clearable></el-input>
<!-- 定义普通输入框 -->
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.xiaoqu" 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('woyaodangfangzhu','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 定义带后缀图标的新增按钮 -->
<el-button
v-if="isAuth('woyaodangfangzhu','新增') && 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('woyaodangfangzhu','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 定义删除按钮 -->
<el-button
v-if="isAuth('woyaodangfangzhu','删除') && 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('woyaodangfangzhu','删除') && 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('woyaodangfangzhu','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ 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('woyaodangfangzhu','查看')"
: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="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="tupian"
header-align="center"
width="200"
label="图片">
<template slot-scope="scope">
<div v-if="scope.row.tupian">
<img :src="scope.row.tupian.split(',')[0]" width="100" height="100">
</div>
<div v-else></div>
</template>
</el-table-column>
<!-- 定义租赁方式列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="zulinfangshi"
header-align="center"
label="租赁方式">
<template slot-scope="scope">
{{scope.row.zulinfangshi}}
</template>
</el-table-column>
<!-- 定义朝向楼层列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="chaoxianglouceng"
header-align="center"
label="朝向楼层">
<template slot-scope="scope">
{{scope.row.chaoxianglouceng}}
</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="mianji"
header-align="center"
label="面积">
<template slot-scope="scope">
{{scope.row.mianji}}
</template>
</el-table-column>
<!-- 定义月租价格列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="yuezujiage"
header-align="center"
label="月租价格">
<template slot-scope="scope">
{{scope.row.yuezujiage}}
</template>
</el-table-column>
<!-- 定义发布日期列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="faburiqi"
header-align="center"
label="发布日期">
<template slot-scope="scope">
{{scope.row.faburiqi}}
</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('woyaodangfangzhu','审核')"
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('woyaodangfangzhu','查看') && 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('woyaodangfangzhu','查看') && 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('woyaodangfangzhu','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 定义修改按钮 -->
<el-button v-if="isAuth('woyaodangfangzhu','修改') && 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('woyaodangfangzhu','修改') && 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('woyaodangfangzhu','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 定义查看评论按钮 -->
<el-button v-if="isAuth('woyaodangfangzhu','查看评论') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="primary" icon="el-icon-edit" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('woyaodangfangzhu','查看评论') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="primary" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-edit el-icon--right" /></el-button>
<el-button v-if="isAuth('woyaodangfangzhu','查看评论') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="disscussListHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 定义删除按钮 -->
<el-button v-if="isAuth('woyaodangfangzhu','删除') && 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('woyaodangfangzhu','删除') && 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('woyaodangfangzhu','删除') && 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>
</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: {
"searchBtnFontColor": "#333",
"pagePosition": "1",
"inputFontSize": "14px",
"inputBorderRadius": "22px",
"tableBtnDelFontColor": "#333",
"tableBtnIconPosition": "1",
"searchBtnHeight": "40px",
"inputIconColor": "rgba(66, 130, 129, 1)",
"searchBtnBorderRadius": "22px",
"tableStripe": false,
"btnAdAllWarnFontColor": "#333",
"tableBtnDetailFontColor": "#333",
"tableBtnHeight": "40px",
"searchBtnBorderColor": "#DCDFE6",
"tableHeaderFontColor": "rgba(33, 34, 35, 1)",
"inputTitle": 1,
"tableBtnBorderRadius": "22px",
"btnAdAllFont": 1,
"btnAdAllDelFontColor": "rgba(21, 20, 20, 1)",
"tableBtnIcon": 1,
"btnAdAllHeight": "40px",
"btnAdAllWarnBgColor": "rgba(238, 236, 126, 1)",
"btnAdAllBorderWidth": "1px",
"tableStripeFontColor": "#606266",
"tableBtnBorderStyle": "solid",
"inputHeight": "40px",
"btnAdAllBorderRadius": "22px",
"btnAdAllDelBgColor": "rgba(234, 93, 93, 0.69)",
"pageJumper": true,
"btnAdAllAddBgColor": "rgba(153, 239, 237, 1)",
"searchBtnFont": 1,
"tableIndex": true,
"btnAdAllIcon": 1,
"tableSortable": true,
"pageSizes": true,
"tableFit": true,
"pageBtnBG": true,
"searchBtnFontSize": "14px",
"tableBtnEditBgColor": "rgba(240, 242, 124, 1)",
"inputBorderWidth": "1px",
"inputFontPosition": 1,
"inputFontColor": "#333",
"pageEachNum": 10,
"tableHeaderBgColor": "rgba(152, 129, 129, 1)",
"inputTitleColor": "#333",
"btnAdAllBoxPosition": "1",
"tableBtnDetailBgColor": "rgba(171, 239, 239, 1)",
"inputIcon": 0,
"searchBtnIconPosition": 1,
"btnAdAllFontSize": "14px",
"inputBorderStyle": "solid",
"inputBgColor": "rgba(197, 174, 174, 0.32)",
"pageStyle": false,
"pageTotal": true,
"btnAdAllAddFontColor": "#333",
"tableBtnFont": 1,
"tableContentFontColor": "rgba(22, 22, 23, 1)",
"inputBorderColor": "rgba(152, 129, 129, 1)",
"tableShowHeader": true,
"tableBtnFontSize": "14px",
"tableBtnBorderColor": "rgba(196, 210, 244, 1)",
"inputIconPosition": 1,
"tableBorder": true,
"btnAdAllBorderStyle": "solid",
"tableBtnBorderWidth": "1px",
"tableStripeBgColor": "rgba(213, 197, 197, 1)",
"tableBtnEditFontColor": "#333",
"tableAlign": "center"
},
//
layouts: '',
};
},
//
created() {
//
this.init();
//
this.getDataList();
//
this.contentStyleChange();
},
//
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;
},
//
init() {
},
//
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.xiaoqu != '' && this.searchForm.xiaoqu != undefined) {
params['xiaoqu'] = '%' + this.searchForm.xiaoqu + '%';
}
this.$http({
url: "woyaodangfangzhu/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);
});
},
//
disscussListHandler(id) {
this.$router.push({ path: '/discusswoyaodangfangzhu', query: { refid: id } });
},
//
shDialog(row) {
this.sfshVisiable = !this.sfshVisiable;
if (row) {
this.shForm = {
fangwumingcheng: row.fangwumingcheng,
fangwuleixing: row.fangwuleixing,
tupian: row.tupian,
zulinfangshi: row.zulinfangshi,
chaoxianglouceng: row.chaoxianglouceng,
xiaoqu: row.xiaoqu,
mianji: row.mianji,
yuezujiage: row.yuezujiage,
fangwuxiangqing: row.fangwuxiangqing,
faburiqi: row.faburiqi,
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: "woyaodangfangzhu/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: "woyaodangfangzhu/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,578 @@
<template>
<div class="addEdit-block">
<!-- 表单容器 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"> <!-- 后台配置表单背景颜色 -->
<el-row>
<!-- 用户名表单 -->
<el-col :span="12">
<el-form-item class="input" v-if="type!='info'" label="用户名" prop="yonghuming">
<!-- 输入框非只读模式 -->
<el-input v-model="ruleForm.yonghuming"
placeholder="用户名" clearable :readonly="ro.yonghuming"></el-input>
</el-form-item>
<div v-else>
<!-- 输入框只读模式 -->
<el-form-item class="input" label="用户名" prop="yonghuming">
<el-input v-model="ruleForm.yonghuming"
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="mima">
<el-input v-model="ruleForm.mima"
placeholder="密码" clearable :readonly="ro.mima"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="密码" prop="mima">
<el-input v-model="ruleForm.mima"
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="xingming">
<el-input v-model="ruleForm.xingming"
placeholder="姓名" clearable :readonly="ro.xingming"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="姓名" prop="xingming">
<el-input v-model="ruleForm.xingming"
placeholder="姓名" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!-- 头像上传 -->
<el-col :span="24">
<el-form-item class="upload" v-if="type!='info' && !ro.touxiang" label="头像" prop="touxiang">
<file-upload
tip="点击上传头像"
action="file/upload"
:limit="3"
:multiple="true"
:fileUrls="ruleForm.touxiang?ruleForm.touxiang:''"
@change="touxiangUploadChange"
></file-upload>
</el-form-item>
<div v-else>
<el-form-item v-if="ruleForm.touxiang" label="头像" prop="touxiang">
<img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in ruleForm.touxiang.split(',')" :src="item" width="100" height="100">
</el-form-item>
</div>
</el-col>
<!-- 性别下拉选择 -->
<el-col :span="12">
<el-form-item class="select" v-if="type!='info'" label="性别" prop="xingbie">
<el-select v-model="ruleForm.xingbie" placeholder="请选择性别">
<el-option
v-for="(item,index) in xingbieOptions"
v-bind:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<div v-else>
<el-form-item class="input" label="性别" prop="xingbie">
<el-input v-model="ruleForm.xingbie"
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="zhiye">
<el-input v-model="ruleForm.zhiye"
placeholder="职业" clearable :readonly="ro.zhiye"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="职业" prop="zhiye">
<el-input v-model="ruleForm.zhiye"
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="lianxidianhua">
<el-input v-model="ruleForm.lianxidianhua"
placeholder="联系电话" clearable :readonly="ro.lianxidianhua"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="联系电话" prop="lianxidianhua">
<el-input v-model="ruleForm.lianxidianhua"
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="shenfenzheng">
<el-input v-model="ruleForm.shenfenzheng"
placeholder="身份证" clearable :readonly="ro.shenfenzheng"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="身份证" prop="shenfenzheng">
<el-input v-model="ruleForm.shenfenzheng"
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();
}
};
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();
}
};
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
return {
//
addEditForm: {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"rgba(152, 129, 129, 1)","inputBorderRadius":"22px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"22px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"22px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"#606266","addEditBoxColor":"rgba(210, 194, 194, 0.29)","dateIconFontSize":"14px","btnSaveBgColor":"#409EFF","uploadIconFontColor":"#8c939d","textareaBorderColor":"rgba(152, 129, 129, 1)","btnCancelBgColor":"rgba(143, 222, 143, 1)","selectLableColor":"#606266","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"22px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"#606266","dateBorderColor":"rgba(152, 129, 129, 1)","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"#606266","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"#606266","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"22px","inputBgColor":"rgba(252, 250, 250, 1)","inputLableFontSize":"14px","uploadLableColor":"#606266","uploadBorderRadius":"22px","btnSaveHeight":"44px","selectBgColor":"#fff","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"rgba(152, 129, 129, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","uploadBorderColor":"rgba(152, 129, 129, 1)","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"22px","selectFontColor":"#606266","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"1px"},
// ID
id: '',
//
type: '',
//
ro:{
yonghuming : false,
mima : false,
xingming : false,
touxiang : false,
xingbie : false,
zhiye : false,
lianxidianhua : false,
shenfenzheng : false,
},
//
ruleForm: {
yonghuming: '',
mima: '',
xingming: '',
touxiang: '',
xingbie: '',
zhiye: '',
lianxidianhua: '',
shenfenzheng: '',
},
//
xingbieOptions: [],
//
rules: {
yonghuming: [
{ required: true, message: '用户名不能为空', trigger: 'blur' },
],
mima: [
{ required: true, message: '密码不能为空', trigger: 'blur' },
],
xingming: [
],
touxiang: [
],
xingbie: [
],
zhiye: [
],
lianxidianhua: [
{ validator: validateMobile, trigger: 'blur' },
],
shenfenzheng: [
{ validator: validateIdCard, trigger: 'blur' },
],
}
};
},
//
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'){
var obj = this.$storage.getObj('crossObj');
for (var o in obj){
if(o=='yonghuming'){
this.ruleForm.yonghuming = obj[o];
this.ro.yonghuming = true;
continue;
}
if(o=='mima'){
this.ruleForm.mima = obj[o];
this.ro.mima = true;
continue;
}
if(o=='xingming'){
this.ruleForm.xingming = obj[o];
this.ro.xingming = true;
continue;
}
if(o=='touxiang'){
this.ruleForm.touxiang = obj[o];
this.ro.touxiang = true;
continue;
}
if(o=='xingbie'){
this.ruleForm.xingbie = obj[o];
this.ro.xingbie = true;
continue;
}
if(o=='zhiye'){
this.ruleForm.zhiye = obj[o];
this.ro.zhiye = true;
continue;
}
if(o=='lianxidianhua'){
this.ruleForm.lianxidianhua = obj[o];
this.ro.lianxidianhua = true;
continue;
}
if(o=='shenfenzheng'){
this.ruleForm.shenfenzheng = obj[o];
this.ro.shenfenzheng = true;
continue;
}
}
}
//
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.xingbieOptions = "男,女".split(',')
},
//
info(id) {
this.$http({
url: `yonghu/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: `yonghu/${!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.yonghuCrossAddOrUpdateFlag = false;
this.parent.search();
this.parent.contentStyleChange();
}
});
} else {
this.$message.error(data.msg);
}
});
}
});
},
//
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true;
this.parent.addOrUpdateFlag = false;
this.parent.yonghuCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
touxiangUploadChange(fileUrls) {
this.ruleForm.touxiang = fileUrls;
this.addEditUploadStyleChange()
},
//
addEditStyleChange() {
this.$nextTick(()=>{ // DOM
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputFontColor
el.style.fontSize = this.addEditForm.inputFontSize
el.style.borderWidth = this.addEditForm.inputBorderWidth
el.style.borderStyle = this.addEditForm.inputBorderStyle
el.style.borderColor = this.addEditForm.inputBorderColor
el.style.borderRadius = this.addEditForm.inputBorderRadius
el.style.backgroundColor = this.addEditForm.inputBgColor
})
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputLableColor
el.style.fontSize = this.addEditForm.inputLableFontSize
})
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectFontColor
el.style.fontSize = this.addEditForm.selectFontSize
el.style.borderWidth = this.addEditForm.selectBorderWidth
el.style.borderStyle = this.addEditForm.selectBorderStyle
el.style.borderColor = this.addEditForm.selectBorderColor
el.style.borderRadius = this.addEditForm.selectBorderRadius
el.style.backgroundColor = this.addEditForm.selectBgColor
})
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectLableColor
el.style.fontSize = this.addEditForm.selectLableFontSize
})
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor
el.style.fontSize = this.addEditForm.selectIconFontSize
})
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateFontColor
el.style.fontSize = this.addEditForm.dateFontSize
el.style.borderWidth = this.addEditForm.dateBorderWidth
el.style.borderStyle = this.addEditForm.dateBorderStyle
el.style.borderColor = this.addEditForm.dateBorderColor
el.style.borderRadius = this.addEditForm.dateBorderRadius
el.style.backgroundColor = this.addEditForm.dateBgColor
})
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateLableColor
el.style.fontSize = this.addEditForm.dateLableFontSize
})
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor
el.style.fontSize = this.addEditForm.dateIconFontSize
el.style.lineHeight = this.addEditForm.dateHeight
})
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px'
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight
el.style.color = this.addEditForm.uploadLableColor
el.style.fontSize = this.addEditForm.uploadLableFontSize
})
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor
el.style.fontSize = this.addEditForm.uploadIconFontSize
el.style.lineHeight = iconLineHeight
el.style.display = 'block'
})
//
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaFontColor
el.style.fontSize = this.addEditForm.textareaFontSize
el.style.borderWidth = this.addEditForm.textareaBorderWidth
el.style.borderStyle = this.addEditForm.textareaBorderStyle
el.style.borderColor = this.addEditForm.textareaBorderColor
el.style.borderRadius = this.addEditForm.textareaBorderRadius
el.style.backgroundColor = this.addEditForm.textareaBgColor
})
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor
el.style.fontSize = this.addEditForm.textareaLableFontSize
})
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth
el.style.height = this.addEditForm.btnSaveHeight
el.style.color = this.addEditForm.btnSaveFontColor
el.style.fontSize = this.addEditForm.btnSaveFontSize
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle
el.style.borderColor = this.addEditForm.btnSaveBorderColor
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius
el.style.backgroundColor = this.addEditForm.btnSaveBgColor
})
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth
el.style.height = this.addEditForm.btnCancelHeight
el.style.color = this.addEditForm.btnCancelFontColor
el.style.fontSize = this.addEditForm.btnCancelFontSize
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle
el.style.borderColor = this.addEditForm.btnCancelBorderColor
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius
el.style.backgroundColor = this.addEditForm.btnCancelBgColor
})
})
},
addEditUploadStyleChange() { //
this.$nextTick(()=>{ // DOM
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
})
},
}
};
</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,583 @@
<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.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('yonghu','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('yonghu','删除') && 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-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('yonghu','查看')"
: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="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="mima"
header-align="center"
label="密码">
<template slot-scope="scope">
{{scope.row.mima}}
</template>
</el-table-column>
<!-- 姓名列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="xingming"
header-align="center"
label="姓名">
<template slot-scope="scope">
{{scope.row.xingming}}
</template>
</el-table-column>
<!-- 头像列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="touxiang"
header-align="center"
width="200"
label="头像">
<template slot-scope="scope">
<div v-if="scope.row.touxiang">
<img :src="scope.row.touxiang.split(',')[0]" width="100" height="100">
</div>
<div v-else></div>
</template>
</el-table-column>
<!-- 性别列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="xingbie"
header-align="center"
label="性别">
<template slot-scope="scope">
{{scope.row.xingbie}}
</template>
</el-table-column>
<!-- 职业列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="zhiye"
header-align="center"
label="职业">
<template slot-scope="scope">
{{scope.row.zhiye}}
</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="shenfenzheng"
header-align="center"
label="身份证">
<template slot-scope="scope">
{{scope.row.shenfenzheng}}
</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('yonghu','查看') && 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('yonghu','修改') && 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('yonghu','删除') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="danger" icon="el-icon-delete" 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>
</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: {"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageEachNum":10,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
layouts: '',
};
},
created() {
//
this.init();
//
this.getDataList();
//
this.contentStyleChange()
},
mounted() {
//
},
filters: {
// HTMLundefined
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(()=>{ // DOM
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(()=>{ // DOM
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(()=>{ // DOM
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(){
//
// this.$nextTick(()=>{ // DOM
// setTimeout(()=>{ //
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--success').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight //
// el.style.color = this.contents.tableBtnDetailFontColor //
// el.style.fontSize = this.contents.tableBtnFontSize //
// el.style.borderWidth = this.contents.tableBtnBorderWidth //
// el.style.borderStyle = this.contents.tableBtnBorderStyle //
// el.style.borderColor = this.contents.tableBtnBorderColor //
// el.style.borderRadius = this.contents.tableBtnBorderRadius //
// el.style.backgroundColor = this.contents.tableBtnDetailBgColor //
// })
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--primary').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight //
// el.style.color = this.contents.tableBtnEditFontColor //
// el.style.fontSize = this.contents.tableBtnFontSize //
// el.style.borderWidth = this.contents.tableBtnBorderWidth //
// el.style.borderStyle = this.contents.tableBtnBorderStyle //
// el.style.borderColor = this.contents.tableBtnBorderColor //
// el.style.borderRadius = this.contents.tableBtnBorderRadius //
// el.style.backgroundColor = this.contents.tableBtnEditBgColor //
// })
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--danger').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight //
// el.style.color = this.contents.tableBtnDelFontColor //
// el.style.fontSize = this.contents.tableBtnFontSize //
// el.style.borderWidth = this.contents.tableBtnBorderWidth //
// el.style.borderStyle = this.contents.tableBtnBorderStyle //
// el.style.borderColor = this.contents.tableBtnBorderColor //
// el.style.borderRadius = this.contents.tableBtnBorderRadius //
// el.style.backgroundColor = this.contents.tableBtnDelBgColor //
// })
// }, 50) // 50
// })
},
//
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 //
},
//
init () {
//
},
//
search() {
this.pageIndex = 1; //
this.getDataList(); //
},
//
getDataList() {
this.dataListLoading = true; //
let params = {
page: this.pageIndex, //
limit: this.pageSize, //
sort: 'id', //
}
//
if(this.searchForm.yonghuming!='' && this.searchForm.yonghuming!=undefined){
params['yonghuming'] = '%' + this.searchForm.yonghuming + '%'
}
this.$http({
url: "yonghu/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(() => { // DOM
this.$refs.addOrUpdate.init(id,type); //
});
},
//
download(file){
window.open(`${file}`) //
},
//
deleteHandler(id) {
var ids = id ? [Number(id)] : this.dataListSelections.map(item => { // ID
return Number(item.id);
});
this.$confirm(`确定进行[${id ? "删除" : "批量删除"}]操作?`, "提示", { //
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$http({
url: "yonghu/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,696 @@
<template>
<!-- 定义模板的根元素 -->
<div class="addEdit-block">
<!-- 定义表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"
>
<!-- 定义表单的行布局 -->
<el-row>
<!-- 定义表单的列布局 -->
<el-col :span="12">
<!-- 定义表单项 -->
<el-form-item class="input" v-if="type!='info'" label="预约编号" prop="yuyuebianhao">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yuyuebianhao"
placeholder="预约编号" readonly></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" v-if="ruleForm.yuyuebianhao" label="预约编号" prop="yuyuebianhao">
<el-input v-model="ruleForm.yuyuebianhao"
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="12">
<!-- 定义表单项 -->
<el-form-item class="input" v-if="type!='info'" label="房屋类型" prop="fangwuleixing">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.fangwuleixing"
placeholder="房屋类型" clearable :readonly="ro.fangwuleixing"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房屋类型" prop="fangwuleixing">
<el-input v-model="ruleForm.fangwuleixing"
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="fangwuzhuangtai">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.fangwuzhuangtai"
placeholder="房屋状态" clearable :readonly="ro.fangwuzhuangtai"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房屋状态" prop="fangwuzhuangtai">
<el-input v-model="ruleForm.fangwuzhuangtai"
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="xiaoqu">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.xiaoqu"
placeholder="小区" clearable :readonly="ro.xiaoqu"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="小区" prop="xiaoqu">
<el-input v-model="ruleForm.xiaoqu"
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="yuezujiage">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yuezujiage"
placeholder="月租价格" clearable :readonly="ro.yuezujiage"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="月租价格" prop="yuezujiage">
<el-input v-model="ruleForm.yuezujiage"
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="yajin">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yajin"
placeholder="押金" clearable :readonly="ro.yajin"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="押金" prop="yajin">
<el-input v-model="ruleForm.yajin"
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="zuyongyueshu">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.zuyongyueshu"
placeholder="租用月数" clearable :readonly="ro.zuyongyueshu"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="租用月数" prop="zuyongyueshu">
<el-input v-model="ruleForm.zuyongyueshu"
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="zuyongjine">
<!-- 定义输入框 -->
<el-input v-model="zuyongjine"
placeholder="租用金额" readonly></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" v-if="ruleForm.zuyongjine" label="租用金额" prop="zuyongjine">
<el-input v-model="ruleForm.zuyongjine"
placeholder="租用金额" readonly></el-input>
</el-form-item>
</div>
</el-col>
<!-- 定义表单的列布局 -->
<el-col :span="12">
<!-- 定义表单项 -->
<el-form-item class="date" v-if="type!='info'" label="预约时间" prop="yuyueshijian">
<!-- 定义日期时间选择器 -->
<el-date-picker
value-format="yyyy-MM-dd HH:mm:ss"
v-model="ruleForm.yuyueshijian"
type="datetime"
placeholder="预约时间">
</el-date-picker>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" v-if="ruleForm.yuyueshijian" label="预约时间" prop="yuyueshijian">
<el-input v-model="ruleForm.yuyueshijian"
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="yonghuming">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.yonghuming"
placeholder="用户名" clearable :readonly="ro.yonghuming"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="用户名" prop="yonghuming">
<el-input v-model="ruleForm.yonghuming"
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="xingming">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.xingming"
placeholder="姓名" clearable :readonly="ro.xingming"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="姓名" prop="xingming">
<el-input v-model="ruleForm.xingming"
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="shenfenzheng">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.shenfenzheng"
placeholder="身份证" clearable :readonly="ro.shenfenzheng"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="身份证" prop="shenfenzheng">
<el-input v-model="ruleForm.shenfenzheng"
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="lianxidianhua">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.lianxidianhua"
placeholder="联系电话" clearable :readonly="ro.lianxidianhua"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="联系电话" prop="lianxidianhua">
<el-input v-model="ruleForm.lianxidianhua"
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="fangzhuzhanghao">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.fangzhuzhanghao"
placeholder="房主账号" clearable :readonly="ro.fangzhuzhanghao"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房主账号" prop="fangzhuzhanghao">
<el-input v-model="ruleForm.fangzhuzhanghao"
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="fangzhuxingming">
<!-- 定义输入框 -->
<el-input v-model="ruleForm.fangzhuxingming"
placeholder="房主姓名" clearable :readonly="ro.fangzhuxingming"></el-input>
</el-form-item>
<!-- 定义只读显示 -->
<div v-else>
<el-form-item class="input" label="房主姓名" prop="fangzhuxingming">
<el-input v-model="ruleForm.fangzhuxingming"
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();
}
};
//
var validatePhone = (rule, value, callback) => {
if(!value){
callback();
} else if (!isPhone(value)) {
callback(new Error("请输入正确的电话号码"));
} else {
callback();
}
};
//
var validateEmail = (rule, value, callback) => {
if(!value){
callback();
} else if (!isEmail(value)) {
callback(new Error("请输入正确的邮箱地址"));
} else {
callback();
}
};
//
var validateNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isNumber(value)) {
callback(new Error("请输入数字"));
} else {
callback();
}
};
//
var validateIntNumber = (rule, value, callback) => {
if(!value){
callback();
} else if (!isIntNumer(value)) {
callback(new Error("请输入整数"));
} else {
callback();
}
};
//
return {
//
addEditForm: {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"rgba(152, 129, 129, 1)","inputBorderRadius":"22px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"22px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"22px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"#606266","addEditBoxColor":"rgba(210, 194, 194, 0.29)","dateIconFontSize":"14px","btnSaveBgColor":"#409EFF","uploadIconFontColor":"#8c939d","textareaBorderColor":"rgba(152, 129, 129, 1)","btnCancelBgColor":"rgba(143, 222, 143, 1)","selectLableColor":"#606266","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"22px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"#606266","dateBorderColor":"rgba(152, 129, 129, 1)","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"#606266","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"#606266","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"22px","inputBgColor":"rgba(252, 250, 250, 1)","inputLableFontSize":"14px","uploadLableColor":"#606266","uploadBorderRadius":"22px","btnSaveHeight":"44px","selectBgColor":"#fff","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"rgba(152, 129, 129, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","uploadBorderColor":"rgba(152, 129, 129, 1)","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"22px","selectFontColor":"#606266","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"1px"},
// ID
id: '',
//
type: '',
//
ro:{
yuyuebianhao : false,
fangwumingcheng : false,
fangwuleixing : false,
fangwuzhuangtai : false,
xiaoqu : false,
yuezujiage : false,
yajin : false,
zuyongyueshu : false,
zuyongjine : false,
yuyueshijian : false,
yonghuming : false,
xingming : false,
shenfenzheng : false,
lianxidianhua : false,
fangzhuzhanghao : false,
fangzhuxingming : false,
sfsh : false,
shhf : false,
},
//
ruleForm: {
yuyuebianhao: this.getUUID(),
fangwumingcheng: '',
fangwuleixing: '',
fangwuzhuangtai: '',
xiaoqu: '',
yuezujiage: '',
yajin: '',
zuyongyueshu: '',
zuyongjine: '',
yuyueshijian: '',
yonghuming: '',
xingming: '',
shenfenzheng: '',
lianxidianhua: '',
fangzhuzhanghao: '',
fangzhuxingming: '',
shhf: '',
},
//
rules: {
yuyuebianhao: [
{ required: true, message: '预约编号不能为空', trigger: 'blur' },
],
fangwumingcheng: [
],
fangwuleixing: [
],
fangwuzhuangtai: [
],
xiaoqu: [
],
yuezujiage: [
{ validator: validateIntNumber, trigger: 'blur' },
],
yajin: [
],
zuyongyueshu: [
{ validator: validateIntNumber, trigger: 'blur' },
],
zuyongjine: [
],
yuyueshijian: [
{ required: true, message: '预约时间不能为空', trigger: 'blur' },
],
yonghuming: [
],
xingming: [
],
shenfenzheng: [
],
lianxidianhua: [
],
fangzhuzhanghao: [
],
fangzhuxingming: [
],
sfsh: [
],
shhf: [
],
}
};
},
//
props: ["parent"],
//
computed: {
//
zuyongjine: {
get: function () {
return 1*this.ruleForm.yuezujiage*this.ruleForm.zuyongyueshu
}
},
},
//
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'){
var obj = this.$storage.getObj('crossObj');
for (var o in obj){
if(o=='yuyuebianhao'){
this.ruleForm.yuyuebianhao = obj[o];
this.ro.yuyuebianhao = true;
continue;
}
if(o=='fangwumingcheng'){
this.ruleForm.fangwumingcheng = obj[o];
this.ro.fangwumingcheng = true;
continue;
}
if(o=='fangwuleixing'){
this.ruleForm.fangwuleixing = obj[o];
this.ro.fangwuleixing = true;
continue;
}
if(o=='fangwuzhuangtai'){
this.ruleForm.fangwuzhuangtai = obj[o];
this.ro.fangwuzhuangtai = true;
continue;
}
if(o=='xiaoqu'){
this.ruleForm.xiaoqu = obj[o];
this.ro.xiaoqu = true;
continue;
}
if(o=='yuezujiage'){
this.ruleForm.yuezujiage = obj[o];
this.ro.yuezujiage = true;
continue;
}
if(o=='yajin'){
this.ruleForm.yajin = obj[o];
this.ro.yajin = true;
continue;
}
if(o=='zuyongyueshu'){
this.ruleForm.zuyongyueshu = obj[o];
this.ro.zuyongyueshu = true;
continue;
}
if(o=='zuyongjine'){
this.ruleForm.zuyongjine = obj[o];
this.ro.zuyongjine = true;
continue;
}
if(o=='yuyueshijian'){
this.ruleForm.yuyueshijian = obj[o];
this.ro.yuyueshijian = true;
continue;
}
if(o=='yonghuming'){
this.ruleForm.yonghuming = obj[o];
this.ro.yonghuming = true;
continue;
}
if(o=='xingming'){
this.ruleForm.xingming = obj[o];
this.ro.xingming = true;
continue;
}
if(o=='shenfenzheng'){
this.ruleForm.shenfenzheng = obj[o];
this.ro.shenfenzheng = true;
continue;
}
if(o=='lianxidianhua'){
this.ruleForm.lianxidianhua = obj[o];
this.ro.lianxidianhua = true;
continue;
}
if(o=='fangzhuzhanghao'){
this.ruleForm.fangzhuzhanghao = obj[o];
this.ro.fangzhuzhanghao = true;
continue;
}
if(o=='fangzhuxingming'){
this.ruleForm.fangzhuxingming = obj[o];
this.ro.fangzhuxingming = true;
continue;
}
}
}
//
this.$http({
url: `${this.$storage.get('sessionTable')}/session`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
var json = data.data;
if(json.yonghuming!=''&&json.yonghuming){
this.ruleForm.yonghuming = json.yonghuming
}
if(json.xingming!=''&&json.xingming){
this.ruleForm.xingming = json.xingming
}
if(json.shenfenzheng!=''&&json.shenfenzheng){
this.ruleForm.shenfenzheng = json.shenfenzheng
}
if(json.lianxidianhua!=''&&json.lianxidianhua){
this.ruleForm.lianxidianhua = json.lianxidianhua
}
} else {
this.$message.error(data.msg);
}
});
},
//
info(id) {
this.$http({
url: `yuyuekanfang/info/${id}`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.ruleForm = data.data;
} else {
this.$message.error(data.msg);
}
});
},
//
onSubmit() {
this.ruleForm.zuyongjine = this.zuyongjine
this.$refs["ruleForm"].validate(valid => {
if (valid) {
this.$http({
url: `yuyuekanfang/${!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.yuyuekanfangCrossAddOrUpdateFlag = 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.yuyuekanfangCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
addEditStyleChange() {
this.$nextTick(()=>{})
},
//
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,836 @@
<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.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 :label="contents.inputTitle == 1 ? '姓名' : ''">
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 1" prefix-icon="el-icon-search" v-model="searchForm.xingming" placeholder="姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.xingming" placeholder="姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.xingming" 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.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 1 && contents.inputIconPosition == 2" suffix-icon="el-icon-search" v-model="searchForm.fangzhuxingming" placeholder="房主姓名" clearable></el-input>
<el-input v-if="contents.inputIcon == 0" v-model="searchForm.fangzhuxingming" 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('yuyuekanfang','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()">{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('yuyuekanfang','新增') && 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('yuyuekanfang','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()">{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<!-- 删除按钮 -->
<el-button
v-if="isAuth('yuyuekanfang','删除') && 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('yuyuekanfang','删除') && 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('yuyuekanfang','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()">{{ 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('yuyuekanfang','查看')"
: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="yuyuebianhao"
header-align="center"
label="预约编号">
<template slot-scope="scope">
{{scope.row.yuyuebianhao}}
</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="fangwuzhuangtai"
header-align="center"
label="房屋状态">
<template slot-scope="scope">
{{scope.row.fangwuzhuangtai}}
</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="yuezujiage"
header-align="center"
label="月租价格">
<template slot-scope="scope">
{{scope.row.yuezujiage}}
</template>
</el-table-column>
<!-- 押金列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="yajin"
header-align="center"
label="押金">
<template slot-scope="scope">
{{scope.row.yajin}}
</template>
</el-table-column>
<!-- 租用月数列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="zuyongyueshu"
header-align="center"
label="租用月数">
<template slot-scope="scope">
{{scope.row.zuyongyueshu}}
</template>
</el-table-column>
<!-- 租用金额列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="zuyongjine"
header-align="center"
label="租用金额">
<template slot-scope="scope">
{{scope.row.zuyongjine}}
</template>
</el-table-column>
<!-- 预约时间列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="yuyueshijian"
header-align="center"
label="预约时间">
<template slot-scope="scope">
{{scope.row.yuyueshijian}}
</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="xingming"
header-align="center"
label="姓名">
<template slot-scope="scope">
{{scope.row.xingming}}
</template>
</el-table-column>
<!-- 身份证列 -->
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="shenfenzheng"
header-align="center"
label="身份证">
<template slot-scope="scope">
{{scope.row.shenfenzheng}}
</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="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="fangzhuxingming"
header-align="center"
label="房主姓名">
<template slot-scope="scope">
{{scope.row.fangzhuxingming}}
</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('yuyuekanfang','审核')"
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('yuyuekanfang','查看') && 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('yuyuekanfang','查看') && 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('yuyuekanfang','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 合同按钮 -->
<el-button v-if="isAuth('yuyuekanfang','合同') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="success" icon="el-icon-tickets" size="mini" @click="hetongxinxiCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('yuyuekanfang','合同') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="success" size="mini" @click="hetongxinxiCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-tickets el-icon--right" /></el-button>
<el-button v-if="isAuth('yuyuekanfang','合同') && contents.tableBtnIcon == 0" type="success" size="mini" @click="hetongxinxiCrossAddOrUpdateHandler(scope.row,'cross')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 修改按钮 -->
<el-button v-if="isAuth('yuyuekanfang','修改') && 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('yuyuekanfang','修改') && 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('yuyuekanfang','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<!-- 删除按钮 -->
<el-button v-if="isAuth('yuyuekanfang','删除') && 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('yuyuekanfang','删除') && 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('yuyuekanfang','删除') && 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>
<!-- 合同信息页面 -->
<hetongxinxi-cross-add-or-update v-if="hetongxinxiCrossAddOrUpdateFlag" :parent="this" ref="hetongxinxiCrossaddOrUpdate"></hetongxinxi-cross-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>
</div>
</template>
<script>
// /
import AddOrUpdate from "./add-or-update";
//
import hetongxinxiCrossAddOrUpdate from "../hetongxinxi/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,
//
hetongxinxiCrossAddOrUpdateFlag: false,
//
contents:{"searchBtnFontColor":"#333","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"22px","tableBtnDelFontColor":"#333","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(66, 130, 129, 1)","searchBtnBorderRadius":"22px","tableStripe":false,"btnAdAllWarnFontColor":"#333","tableBtnDelBgColor":"rgba(244, 150, 150, 1)","searchBtnIcon":"1","tableSize":"medium","searchBtnBorderStyle":"solid","tableSelection":true,"searchBtnBorderWidth":"1px","tableContentFontSize":"14px","searchBtnBgColor":"rgba(153, 239, 237, 1)","inputTitleSize":"14px","btnAdAllBorderColor":"#DCDFE6","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"1","tableBtnDetailFontColor":"#333","tableBtnHeight":"40px","pagePager":true,"searchBtnBorderColor":"#DCDFE6","tableHeaderFontColor":"rgba(33, 34, 35, 1)","inputTitle":"1","tableBtnBorderRadius":"22px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(21, 20, 20, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"rgba(238, 236, 126, 1)","btnAdAllBorderWidth":"1px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"solid","inputHeight":"40px","btnAdAllBorderRadius":"22px","btnAdAllDelBgColor":"rgba(234, 93, 93, 0.69)","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(153, 239, 237, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":true,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"rgba(240, 242, 124, 1)","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"#333","pageEachNum":10,"tableHeaderBgColor":"rgba(152, 129, 129, 1)","inputTitleColor":"#333","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"rgba(171, 239, 239, 1)","inputIcon":"0","searchBtnIconPosition":"1","btnAdAllFontSize":"14px","inputBorderStyle":"solid","inputBgColor":"rgba(197, 174, 174, 0.32)","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"#333","tableBtnFont":"1","tableContentFontColor":"rgba(22, 22, 23, 1)","inputBorderColor":"rgba(152, 129, 129, 1)","tableShowHeader":true,"tableBtnFontSize":"14px","tableBtnBorderColor":"rgba(196, 210, 244, 1)","inputIconPosition":"1","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(213, 197, 197, 1)","tableBtnEditFontColor":"#333","tableAlign":"center"},
//
layouts: '',
};
},
created() {
//
this.init();
//
this.getDataList();
//
this.contentStyleChange()
},
mounted() {
//
},
filters: {
// HTML
htmlfilter: function (val) {
return val.replace(/<[^>]*>/g).replace(/undefined/g,'');
}
},
components: {
// /
AddOrUpdate,
//
hetongxinxiCrossAddOrUpdate,
},
methods: {
//
contentStyleChange() {
this.contentSearchStyleChange()
this.contentBtnAdAllStyleChange()
this.contentSearchBtnStyleChange()
this.contentTableBtnStyleChange()
this.contentPageStyleChange()
},
//
contentSearchStyleChange() {
this.$nextTick(()=>{ // DOM
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
},
//
hetongxinxiCrossAddOrUpdateHandler(row,type){
this.showFlag = false;
this.addOrUpdateFlag = false;
this.hetongxinxiCrossAddOrUpdateFlag = true;
this.$storage.set('crossObj',row);
this.$storage.set('crossTable','yuyuekanfang');
this.$nextTick(() => {
this.$refs.hetongxinxiCrossaddOrUpdate.init(row.id,type);
});
},
//
init () {
},
//
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.yonghuming!='' && this.searchForm.yonghuming!=undefined){
params['yonghuming'] = '%' + this.searchForm.yonghuming + '%'
}
if(this.searchForm.xingming!='' && this.searchForm.xingming!=undefined){
params['xingming'] = '%' + this.searchForm.xingming + '%'
}
if(this.searchForm.fangzhuxingming!='' && this.searchForm.fangzhuxingming!=undefined){
params['fangzhuxingming'] = '%' + this.searchForm.fangzhuxingming + '%'
}
//
this.$http({
url: "yuyuekanfang/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 = {
yuyuebianhao: row.yuyuebianhao,
fangwumingcheng: row.fangwumingcheng,
fangwuleixing: row.fangwuleixing,
fangwuzhuangtai: row.fangwuzhuangtai,
xiaoqu: row.xiaoqu,
yuezujiage: row.yuezujiage,
yajin: row.yajin,
zuyongyueshu: row.zuyongyueshu,
zuyongjine: row.zuyongjine,
yuyueshijian: row.yuyueshijian,
yonghuming: row.yonghuming,
xingming: row.xingming,
shenfenzheng: row.shenfenzheng,
lianxidianhua: row.lianxidianhua,
fangzhuzhanghao: row.fangzhuzhanghao,
fangzhuxingming: row.fangzhuxingming,
sfsh: row.sfsh,
shhf: row.shhf,
id: row.id
}
}
},
//
shHandler(){
this.$confirm(`确定操作?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$http({
url: "yuyuekanfang/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: "yuyuekanfang/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,200 @@
<template>
<div class="container">
<!-- 显示支付提示信息 -->
<el-alert title="确认支付前请先核对订单信息" type="success" :closable="false"></el-alert>
<!-- 输入收款人信息暂时注释 -->
<!-- <div class="top-content">
<span>收款人</span>
<el-input style="width:300px" v-model="name" placeholder="收款人"></el-input>
<span style="margin-left:20px">收款账号</span>
<el-input style="width:300px" v-model="account" placeholder="收款账号"></el-input>
</div> -->
<!-- 显示支付金额暂时注释 -->
<!-- <div class="price-content">
<span>金额</span>
<span>99.0</span>
</div> -->
<!-- 支付方式选择区域 -->
<div class="pay-type-content">
<!-- 微信支付选项 -->
<div class="pay-type-item">
<el-radio v-model="type" label="微信支付"></el-radio>
<img src="@/assets/img/test/weixin.png" alt>
<!-- <span>微信支付</span> -->
</div>
<!-- 支付宝支付选项 -->
<div class="pay-type-item">
<el-radio v-model="type" label="支付宝支付"></el-radio>
<img src="@/assets/img/test/zhifubao.png" alt>
<!-- <span>支付宝支付</span> -->
</div>
<!-- 建设银行支付选项 -->
<div class="pay-type-item">
<el-radio v-model="type" label="建设银行"></el-radio>
<img src="@/assets/img/test/jianshe.png" alt>
<!-- <span>建设银行</span> -->
</div>
<!-- 农业银行支付选项 -->
<div class="pay-type-item">
<el-radio v-model="type" label="农业银行"></el-radio>
<img src="@/assets/img/test/nongye.png" alt>
<!-- <span>农业银行</span> -->
</div>
<!-- 中国银行支付选项 -->
<div class="pay-type-item">
<el-radio v-model="type" label="中国银行"></el-radio>
<img src="@/assets/img/test/zhongguo.png" alt>
<!-- <span>中国银行</span> -->
</div>
<!-- 交通银行支付选项 -->
<div class="pay-type-item">
<el-radio v-model="type" label="交通银行"></el-radio>
<img src="@/assets/img/test/jiaotong.png" alt>
<!-- <span>交通银行</span> -->
</div>
</div>
<!-- 按钮区域 -->
<div class="buton-content">
<!-- 确认支付按钮 -->
<el-button @click="submitTap" type="primary">确认支付</el-button>
<!-- 返回按钮 -->
<el-button @click="back()"></el-button>
</div>
</div>
</template>
<script>
// import { Message } from "element-ui";
export default {
data() {
return {
//
name: "",
//
account: "",
//
type: "",
//
table: "",
//
obj: ""
};
},
mounted() {
//
let table = this.$storage.get("paytable");
//
let obj = this.$storage.getObj("payObject");
//
this.table = table;
//
this.obj = obj;
},
methods: {
submitTap() {
// if (!this.name) {
// this.$message.error("");
// return;
// }
// if (!this.account) {
// this.$message.error("");
// return;
// }
//
if (!this.type) {
this.$message.error("请选择支付方式");
return;
}
//
this.$confirm(`确定支付?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
//
this.obj.ispay = "已支付";
//
this.$http({
url: `${this.table}/update`,
method: "post",
data: this.obj
}).then(({ data }) => {
//
if (data && data.code === 0) {
//
this.$message({
message: "支付成功",
type: "success",
duration: 1500,
onClose: () => {
//
this.$router.go(-1);
}
});
} else {
//
this.$message.error(data.msg);
}
});
});
},
back(){
//
this.$router.go(-1);
}
}
};
</script>
<style lang="scss" scoped>
/* 容器样式 */
.container {
margin: 10px;
font-size: 14px;
span {
width: 60px;
}
/* 顶部内容区域样式(暂时注释) */
.top-content {
display: flex;
align-items: center;
padding: 20px;
}
/* 价格内容区域样式(暂时注释) */
.price-content {
display: flex;
align-items: center;
margin-top: 20px;
padding-bottom: 20px;
padding: 20px;
border-bottom: 1px solid #eeeeee;
font-size: 20px;
font-weight: bold;
color: red;
}
/* 支付方式内容区域样式 */
.pay-type-content {
display: flex;
align-items: center;
margin-top: 20px;
flex-wrap: wrap;
span {
width: 100px;
}
/* 支付方式项样式 */
.pay-type-item {
display: flex;
align-items: center;
justify-content: space-between;
width: 300px;
margin: 20px;
border: 1px solid #eeeeee;
padding: 20px;
}
}
/* 按钮内容区域样式 */
.buton-content {
margin: 20px;
}
}
</style>

@ -0,0 +1,269 @@
<template>
<div>
<!-- 外层容器 -->
<div class="container">
<!-- 登录表单容器设置背景颜色和圆角 -->
<div class="login-form" style="backgroundColor:rgba(183, 174, 174, 0.5);borderRadius:22px">
<!-- 标题设置字体颜色和大小 -->
<h1 class="h1" style="color:#000;fontSize:28px;">房屋租赁系统注册</h1>
<!-- 表单引用表单对象设置样式类和标签宽度 -->
<el-form ref="rgsForm" class="rgs-form" :model="rgsForm" label-width="120px">
<!-- 用户名输入项仅当 tableName 'yonghu' 时显示 -->
<el-form-item label="用户名" class="input" v-if="tableName=='yonghu'">
<!-- 输入框双向绑定用户名数据 -->
<el-input v-model="ruleForm.yonghuming" autocomplete="off" placeholder="用户名" type="text" />
</el-form-item>
<!-- 密码输入项仅当 tableName 'yonghu' 时显示 -->
<el-form-item label="密码" class="input" v-if="tableName=='yonghu'">
<!-- 输入框双向绑定密码数据 -->
<el-input v-model="ruleForm.mima" autocomplete="off" placeholder="密码" type="text" />
</el-form-item>
<!-- 姓名输入项仅当 tableName 'yonghu' 时显示 -->
<el-form-item label="姓名" class="input" v-if="tableName=='yonghu'">
<!-- 输入框双向绑定姓名数据 -->
<el-input v-model="ruleForm.xingming" autocomplete="off" placeholder="姓名" type="text" />
</el-form-item>
<!-- 职业输入项仅当 tableName 'yonghu' 时显示 -->
<el-form-item label="职业" class="input" v-if="tableName=='yonghu'">
<!-- 输入框双向绑定职业数据 -->
<el-input v-model="ruleForm.zhiye" autocomplete="off" placeholder="职业" type="text" />
</el-form-item>
<!-- 联系电话输入项仅当 tableName 'yonghu' 时显示 -->
<el-form-item label="联系电话" class="input" v-if="tableName=='yonghu'">
<!-- 输入框双向绑定联系电话数据 -->
<el-input v-model="ruleForm.lianxidianhua" autocomplete="off" placeholder="联系电话" type="text" />
</el-form-item>
<!-- 身份证输入项仅当 tableName 'yonghu' 时显示 -->
<el-form-item label="身份证" class="input" v-if="tableName=='yonghu'">
<!-- 输入框双向绑定身份证数据 -->
<el-input v-model="ruleForm.shenfenzheng" autocomplete="off" placeholder="身份证" type="text" />
</el-form-item>
<!-- 房主账号输入项仅当 tableName 'fangzhu' 时显示 -->
<el-form-item label="房主账号" class="input" v-if="tableName=='fangzhu'">
<!-- 输入框双向绑定房主账号数据 -->
<el-input v-model="ruleForm.fangzhuzhanghao" autocomplete="off" placeholder="房主账号" type="text" />
</el-form-item>
<!-- 房主姓名输入项仅当 tableName 'fangzhu' 时显示 -->
<el-form-item label="房主姓名" class="input" v-if="tableName=='fangzhu'">
<!-- 输入框双向绑定房主姓名数据 -->
<el-input v-model="ruleForm.fangzhuxingming" autocomplete="off" placeholder="房主姓名" type="text" />
</el-form-item>
<!-- 手机输入项仅当 tableName 'fangzhu' 时显示 -->
<el-form-item label="手机" class="input" v-if="tableName=='fangzhu'">
<!-- 输入框双向绑定手机数据 -->
<el-input v-model="ruleForm.shouji" autocomplete="off" placeholder="手机" type="text" />
</el-form-item>
<!-- 身份证输入项仅当 tableName 'fangzhu' 时显示 -->
<el-form-item label="身份证" class="input" v-if="tableName=='fangzhu'">
<!-- 输入框双向绑定身份证数据 -->
<el-input v-model="ruleForm.shenfenzheng" autocomplete="off" placeholder="身份证" type="text" />
</el-form-item>
<!-- 注册按钮 -->
<el-button class="btn" type="primary" @click="login()"></el-button>
</el-form>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
//
ruleForm: {},
//
rules: {},
//
tableName: ""
};
},
mounted() {
//
//
let table = this.$storage.get("loginTable");
this.tableName = table;
},
methods: {
//
getUUID() {
return new Date().getTime();
},
//
login() {
// tableName 'yonghu'
if (!this.ruleForm.yonghuming && `yonghu` == this.tableName) {
this.$message.error(`用户名不能为空`);
return;
}
// tableName 'yonghu'
if (!this.ruleForm.mima && `yonghu` == this.tableName) {
this.$message.error(`密码不能为空`);
return;
}
// tableName 'yonghu'
if (`yonghu` == this.tableName && this.ruleForm.lianxidianhua && !this.$validate.isMobile(this.ruleForm.lianxidianhua)) {
this.$message.error(`联系电话应输入手机格式`);
return;
}
// tableName 'yonghu'
if (`yonghu` == this.tableName && this.ruleForm.shenfenzheng && !this.$validate.checkIdCard(this.ruleForm.shenfenzheng)) {
this.$message.error(`身份证应输入身份证格式`);
return;
}
// tableName 'fangzhu'
if (!this.ruleForm.fangzhuzhanghao && `fangzhu` == this.tableName) {
this.$message.error(`房主账号不能为空`);
return;
}
// tableName 'fangzhu'
if (!this.ruleForm.mima && `fangzhu` == this.tableName) {
this.$message.error(`密码不能为空`);
return;
}
// tableName 'fangzhu'
if (!this.ruleForm.fangzhuxingming && `fangzhu` == this.tableName) {
this.$message.error(`房主姓名不能为空`);
return;
}
// tableName 'fangzhu'
if (`fangzhu` == this.tableName && this.ruleForm.shouji && !this.$validate.isMobile(this.ruleForm.shouji)) {
this.$message.error(`手机应输入手机格式`);
return;
}
// tableName 'fangzhu'
if (`fangzhu` == this.tableName && this.ruleForm.shenfenzheng && !this.$validate.checkIdCard(this.ruleForm.shenfenzheng)) {
this.$message.error(`身份证应输入身份证格式`);
return;
}
// HTTP
this.$http({
url: `${this.tableName}/register`,
method: "post",
data: this.ruleForm
}).then(({ data }) => {
//
if (data && data.code === 0) {
//
this.$message({
message: "注册成功",
type: "success",
duration: 1500,
onClose: () => {
//
this.$router.replace({ path: "/login" });
}
});
} else {
//
this.$message.error(data.msg);
}
});
}
}
};
</script>
<style lang="scss" scoped>
//
.el-radio__input.is-checked .el-radio__inner {
border-color: #00c292;
background: #00c292;
}
.el-radio__input.is-checked+.el-radio__label {
color: #00c292;
}
//
.h1 {
margin-top: 10px;
}
//
.container {
background-image: url("<url id="d08b9asbcdrtv2l5qnu0" type="url" status="failed" title="" wc="0">http://codegen.caihongy.cn/20210128/ac0684f4d39c4b5ebf6694a20d747cd6.jpg</url> ");
height: 100vh;
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
//
.login-form {
right: 50%;
top: 50%;
height: auto;
transform: translate3d(50%, -50%, 0);
border-radius: 10px;
background-color: rgba(255,255,255,.5);
width: 420px;
padding: 30px 30px 40px 30px;
font-size: 14px;
font-weight: 500;
//
.h1 {
margin: 0;
text-align: center;
line-height: 54px;
font-size: 24px;
color: #000;
}
//
.rgs-form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
//
.input {
width: 100%;
& /deep/ .el-form-item__label {
line-height: 40px;
color: rgba(17, 16, 16, 1);
font-size: #606266;
}
& /deep/ .el-input__inner {
height: 40px;
color: rgba(23, 24, 26, 1);
font-size: 14px;
border-width: 1px;
border-style: solid;
border-color: #606266;
border-radius: 22px;
background-color: #fff;
}
}
//
.btn {
width: 88px;
height: 44px;
color: #fff;
font-size: 14px;
border-width: 1px;
border-style: solid;
border-color: #409EFF;
border-radius: 22px;
background-color: #409EFF;
}
}
}
}
</style>

@ -0,0 +1,157 @@
<template>
<!-- 页面根容器 -->
<div>
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:rules="rules"
:model="ruleForm"
label-width="80px"
>
<!-- 原密码输入项 -->
<el-form-item label="原密码" prop="password">
<el-input v-model="ruleForm.password"></el-input>
</el-form-item>
<!-- 新密码输入项 -->
<el-form-item label="新密码" prop="newpassword">
<el-input v-model="ruleForm.newpassword"></el-input>
</el-form-item>
<!-- 确认密码输入项 -->
<el-form-item label="确认密码" prop="repassword">
<el-input v-model="ruleForm.repassword"></el-input>
</el-form-item>
<!-- 提交按钮区域 -->
<el-form-item>
<el-button type="primary" @click="onUpdateHandler"> </el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
// 使
dialogVisible: false,
//
ruleForm: {},
//
user: {},
//
rules: {
password: [
{
required: true,
message: "密码不能为空",
trigger: "blur"
}
],
newpassword: [
{
required: true,
message: "新密码不能为空",
trigger: "blur"
}
],
repassword: [
{
required: true,
message: "确认密码不能为空",
trigger: "blur"
}
]
}
};
},
mounted() {
//
this.$http({
url: `${this.$storage.get("sessionTable")}/session`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
//
this.user = data.data;
} else {
//
this.$message.error(data.msg);
}
});
},
methods: {
//
onLogout() {
// Token
this.$storage.remove("Token");
//
this.$router.replace({ name: "login" });
},
//
onUpdateHandler() {
//
this.$refs["ruleForm"].validate(valid => {
if (valid) {
var password = "";
// mima password
if (this.user.mima) {
password = this.user.mima;
} else if (this.user.password) {
password = this.user.password;
}
//
if (this.ruleForm.password != password) {
this.$message.error("原密码错误");
return;
}
//
if (this.ruleForm.newpassword != this.ruleForm.repassword) {
this.$message.error("两次密码输入不一致");
return;
}
//
this.user.password = this.ruleForm.newpassword;
this.user.mima = this.ruleForm.newpassword;
//
this.$http({
url: `${this.$storage.get("sessionTable")}/update`,
method: "post",
data: this.user
}).then(({ data }) => {
if (data && data.code === 0) {
//
this.$message({
message: "修改密码成功,下次登录系统生效",
type: "success",
duration: 1500,
onClose: () => {
//
}
});
} else {
//
this.$message.error(data.msg);
}
});
}
});
}
}
};
</script>
<style lang="scss" scoped>
/* 本页面样式为空,可在此添加自定义样式 */
</style>

@ -0,0 +1,158 @@
<template>
<!-- 页面根容器 -->
<div>
<!-- 表单组件 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:rules="rules"
:model="ruleForm"
label-width="80px"
>
<!-- 原密码输入项 -->
<el-form-item label="原密码" prop="password">
<el-input v-model="ruleForm.password"></el-input>
</el-form-item>
<!-- 新密码输入项 -->
<el-form-item label="新密码" prop="newpassword">
<el-input v-model="ruleForm.newpassword"></el-input>
</el-form-item>
<!-- 确认密码输入项 -->
<el-form-item label="确认密码" prop="repassword">
<el-input v-model="ruleForm.repassword"></el-input>
</el-form-item>
<!-- 提交按钮区域 -->
<el-form-item>
<el-button type="primary" @click="onUpdateHandler"> </el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
// 使
dialogVisible: false,
//
ruleForm: {},
//
user: {},
//
rules: {
password: [
{
required: true, //
message: "密码不能为空", //
trigger: "blur" //
}
],
newpassword: [
{
required: true,
message: "新密码不能为空",
trigger: "blur"
}
],
repassword: [
{
required: true,
message: "确认密码不能为空",
trigger: "blur"
}
]
}
};
},
mounted() {
//
this.$http({
url: `${this.$storage.get("sessionTable")}/session`, //
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
//
this.user = data.data;
} else {
//
this.$message.error(data.msg);
}
});
},
methods: {
//
onLogout() {
// Token
this.$storage.remove("Token");
//
this.$router.replace({ name: "login" });
},
//
onUpdateHandler() {
//
this.$refs["ruleForm"].validate(valid => {
if (valid) {
var password = "";
// mima password
if (this.user.mima) {
password = this.user.mima;
} else if (this.user.password) {
password = this.user.password;
}
//
if (this.ruleForm.password != password) {
this.$message.error("原密码错误");
return;
}
//
if (this.ruleForm.newpassword != this.ruleForm.repassword) {
this.$message.error("两次密码输入不一致");
return;
}
//
this.user.password = this.ruleForm.newpassword;
this.user.mima = this.ruleForm.newpassword;
//
this.$http({
url: `${this.$storage.get("sessionTable")}/update`, //
method: "post",
data: this.user //
}).then(({ data }) => {
if (data && data.code === 0) {
//
this.$message({
message: "修改密码成功,下次登录系统生效",
type: "success",
duration: 1500,
onClose: () => {
//
}
});
} else {
//
this.$message.error(data.msg);
}
});
}
});
}
}
};
</script>
<style lang="scss" scoped>
/* 当前样式为空,可根据需求添加自定义样式 */
</style>
Loading…
Cancel
Save