提交 e51f6f1e 编写于 作者: huangwensu's avatar huangwensu

页面编辑

上级 19a466a1
......@@ -26,6 +26,9 @@ export default new Router({
},{
path: '/empty-phone',
component: resolve => require(['../views/black-list/empty-phone.vue'], resolve),
},{
path: '/strategy-list',
component: resolve => require(['../views/strategy-data/strategy-list.vue'], resolve),
},
]
},
......
<template>
<div class="strategy-container">
<el-row :gutter="30" class="row search" type="flex" style="margin-bottom:0;">
<el-form ref="form" :model="searchParam" label-suffix=":" style="width:100%;">
<el-col :span="18">
<el-form-item label="策略分类">
<el-select
v-model="searchParam.bizTypeId"
size="small"
placeholder="请选择策略分类"
clearable
style="margin-left: 20px"
>
<el-option
v-for="item in strategyData"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6" style="padding:0;text-align:right;padding-right:15px;">
<el-button type="primary" size="small" @click="search(1)">查询</el-button>
<el-button type="primary" size="small" @click="addStrategy">新增策略</el-button>
</el-col>
</el-form>
</el-row>
<el-table
class="search-table"
:data="tableData"
style="width: 100%">
<el-table-column prop="name" label="策略名称" min-width="140" align="center"></el-table-column>
<el-table-column prop="bizTypeName" label="策略分类" min-width="140" align="center"></el-table-column>
<el-table-column prop="paramsStyle" label="策略定义" min-width="150" align="center"></el-table-column>
<el-table-column prop="score" label="击中分值" min-width="150" align="center"></el-table-column>
<el-table-column prop="type" label="策略状态" min-width="150" align="center"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" min-width="200">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="actived(scope.row)">激活</el-button>
<el-button type="danger" size="small" @click="downLine(scope.row)">下线</el-button>
<el-button type="primary" size="small" @click="reviewData(scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="searchParam.pageNo"
:page-sizes="[15, 30, 50, 100, 200, 500, 700, 1000, 1500, 2000]"
:page-size="searchParam.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRows">
</el-pagination>
</div>
<!-- 下线确认框 -->
<el-dialog
title="策略下线确认"
:visible.sync="downDialogVisible"
width="30%"
center>
<span>一旦下线后,后续该业务分类订单将不执行本策略检查,请记得同步完成风险定级变更</span>
<span slot="footer" class="dialog-footer">
<el-button @click="downDialogVisible = false">取 消</el-button>
<el-button type="primary" @click="confirmDown">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { openLoading, closeLoading } from "../../common/utils";
export default {
data() {
return {
downDialogVisible: false,
searchParam: {
bizTypeId: '',
pageNo: 1,
pageSize: 15
},
totalRows: 0,
tableData: [],
strategyData: []
}
},
mounted() {
this.getCategyData();
this.search();
},
methods: {
// 封装一下请求通用的方法
getData(type, url, req, callback) {
openLoading(this);
this.$axios[type](localStorage.getItem("lectureUrl") + url, req)
.then(res => {
closeLoading(this);
let data = res.data;
if (data.code == "000000") {
if (callback) callback(data);
} else {
this.$message.error(data.message);
}
})
.catch(error => {
closeLoading(this);
this.$message.error("网络出现点问题");
});
},
search(param) {
if(param) this.searchParam.pageNo = 1;
this.getData(
"get", `/riskcontrol/strategy/list?bizTypeId=${this.searchParam.bizTypeId}&pageNo=${this.searchParam.pageNo}&pageSize=${this.searchParam.pageSize}`, {},
data => {
this.tableData = data.data.data;
this.totalRows = data.data.totalRows;
}
);
},
// 获取策略下拉数据
getCategyData() {
this.getData(
"get", `/riskcontrol/strategy/listBizType`, {},
data => {
this.strategyData = data.data;
}
);
},
// 新增策略
addStrategy() {
},
// 激活
actived() {
},
// 下线
downLine() {
this.downDialogVisible = true;
},
confirmDown() {
},
// 查看
reviewData() {
},
handleSizeChange(value) {
this.searchParam.pageSize = value;
this.search();
},
handleCurrentChange(value) {
this.searchParam.pageNo = value;
this.search();
}
}
}
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
<template>
<div class="layout-const-wrap">
<el-collapse v-model="activeNames" @change="handleChange">
<el-collapse-item name="1">
<template slot="title">
查询条件<span style="float:right;">{{collapseFlag}}</span>
</template>
<el-row :gutter="30" class="row" type="flex" style="margin-bottom:0;">
<el-form ref="form" :model="searchParam" label-suffix=":" label-width="130px" style="width:100%;">
<el-col :span="10">
<el-form-item label="楼层code">
<el-input v-model="searchParam.floorCode" placeholder="请输入楼层code" style="width:288px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="楼层名称">
<el-input v-model="searchParam.floorName" placeholder="请输入楼层名称" style="width:288px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="3" style="padding:0;text-align:right;padding-right:15px;">
<el-button type="primary" size="small" @click="search">查询</el-button>
<el-button type="default" size="small" @click="reset" style="margin-left:0;">重置</el-button>
</el-col>
</el-form>
</el-row>
</el-collapse-item>
</el-collapse>
<el-row :gutter="10" class="row create-button" style="margin-right:0;">
<el-button type="primary" size="small" @click="create">新建楼层常量</el-button>
</el-row>
<!-- 表格 -->
<el-table
:data="tableData"
style="width: 100%">
<el-table-column prop="seqNo" label="楼层常量排序" min-width="150" align="center"></el-table-column>
<el-table-column prop="floorCode" label="楼层code" min-width="140" align="center"></el-table-column>
<el-table-column label="楼层名称" prop="floorName" min-width="200" align="center"></el-table-column>
<el-table-column prop="floorDesc" label="楼层描述" min-width="200" align="center"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" min-width="200">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="editColumn(scope.row)">编辑</el-button>
<el-button type="danger" size="small" @click="deleteLayout(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="searchParam.pageNo"
:page-sizes="[15, 30, 50, 100, 200, 500, 700, 1000, 1500, 2000]"
:page-size="searchParam.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalRows">
</el-pagination>
</div>
<!-- 新建活动 -->
<el-dialog class="img-edit" :title="dialogTitle" :visible.sync="createActivityVisible" :close-on-click-modal="false">
<el-form ref="form" :model="contentTemplate" label-suffix=":" :rules="rules" label-width="130px" style="width:100%;">
<el-form-item label="楼层code" prop="floorCode">
<el-input v-model="contentTemplate.floorCode" placeholder="请输入楼层code" style="width:288px;"></el-input>
</el-form-item>
<el-form-item label="楼层名称" prop="floorName">
<el-input v-model="contentTemplate.floorName" placeholder="请输入楼层名称" style="width:288px;"></el-input>
</el-form-item>
<el-form-item label="楼层常量排序" prop="seqNo">
<el-input v-model="contentTemplate.seqNo" placeholder="请输入楼层常量排序" style="width:288px;"></el-input>
</el-form-item>
<el-form-item label="楼层描述" prop="floorDesc">
<el-input v-model="contentTemplate.floorDesc" placeholder="请输入楼层描述" style="width:288px;"></el-input>
</el-form-item>
<el-form-item label="楼层关系" prop="relationCode">
<el-input v-model="contentTemplate.relationCode" placeholder="请输入楼层关系" style="width:288px;"></el-input>
</el-form-item>
<el-form-item label="楼层图片" prop="imageUrl">
<el-upload
v-model="contentTemplate.imageUrl"
class="bg-uploader"
action="#"
:show-file-list="false"
:before-upload="layoutImgUrl">
<img v-show="contentTemplate.imageUrl" :src="contentTemplate.imageUrl" class="bg-img">
<img v-show="!contentTemplate.imageUrl" class="bg-img" src="../../../static/img/small.png">
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="createSave">保存</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { doUpload, getFilePath } from "../../common/qiniuUtil";
import {setOptionLabel,
initDepartment,
isEmptyUtils,
errorResponseCheck,
openLoading,
closeLoading,
messageBox,
getConstantList,getPositionList, isNotEmptyList} from '../../common/utils'
let vm = null
export default {
data() {
return {
collapseFlag: '收起',
dialogTitle: '新增楼层',
activeNames: ['1'],
createActivityVisible: false,
escPressFlg: false,//弹出层是否可以按ESC关闭
totalRows: 0,
searchParam: {
floorCode: '',
floorName: '',
pageNo: 1,
pageSize: 15
},
tableData: [],
contentTemplate: {
id: '',
floorCode: '',
floorName: '',
floorDesc: '',
seqNo: '',
relationCode: '',
imageUrl: ''
},
rules: {
"floorCode": [
{ required: true, message: '请输入楼层code', trigger: 'blur' }
],
"floorName": [
{ required: true, message: '请输入楼层名称', trigger: 'blur' }
],
"imageUrl": [
{ required: true, message: '请输入楼层图片', trigger: 'blur' }
]
}
}
},
created() {
vm = this
vm.search()
},
methods: {
//展开 收起
handleChange(arr) {
vm.collapseFlag = arr.length > 0 ? "收起" : "展开"
},
// 查询按钮
search() {
openLoading(vm);
let req = {
params: {
floorCode: vm.searchParam.floorCode,
floorName: vm.searchParam.floorName,
pageNo: vm.searchParam.pageNo,
pageSize: vm.searchParam.pageSize
},
};
vm.$axios.get(localStorage.getItem("msUrl") + 'homeFloorConstants/queryConstants'
, req).then(function (res) {
closeLoading(vm);
let data = JSON.parse(JSON.stringify(res.data.data));//通过这个实现深拷贝
vm.tableData = data.ConstantsList;
vm.totalRows = data.totalRows;
}).catch(function (error) {
errorResponseCheck(error, vm);
});
},
// 重置按钮
reset() {
vm.searchParam.floorCode = ''
vm.searchParam.floorName = ''
vm.searchParam.id = ''
vm.search()
},
// 新建楼层常量
create() {
vm.dialogTitle = '新增楼层常量'
vm.createActivityVisible = true
vm.contentTemplate.id = ''
vm.contentTemplate.floorCode = ''
vm.contentTemplate.floorName = ''
vm.contentTemplate.floorDesc = ''
vm.contentTemplate.seqNo = ''
vm.contentTemplate.relationCode = ''
vm.contentTemplate.imageUrl = ''
},
// 编辑楼层常量
editColumn(row) {
vm.$nextTick(() => {
vm.$refs.form.resetFields()
})
vm.dialogTitle = '编辑楼层常量'
vm.createActivityVisible = true
vm.contentTemplate = Object.assign({},row)
},
// 新增(修改)楼层常量信息
createSave() {
vm.$refs.form.validate((valid) => {
if (valid) {
vm.$axios.post(localStorage.getItem("msUrl") + 'homeFloorConstants/insertOrUpdate'
, vm.contentTemplate).then(function (res) {
if(res.data.code == "000000") {
vm.createActivityVisible = false
vm.$message({
type: 'success',
message: '保存成功!'
})
vm.search()
}
}).catch(function (error) {
vm.$message.error('保存失败')
})
} else {
return false;
}
});
},
// 删除楼层
deleteLayout(row) {
let req = {
params: {
id: row.id
}
}
vm.$axios.get(localStorage.getItem("msUrl") + 'homeFloorConstants/deleteById',req).then((res)=> {
if(res.data.code == "000000") {
vm.$message({
type: 'success',
message: '删除成功!'
})
vm.search()
}
}).catch((error) => {
vm.$message.error('删除失败')
})
},
// 上传楼层图片
layoutImgUrl(file) {
if (isEmptyUtils(file)) {
return;
}
vm.$message.info('开始上传');
doUpload(vm,file, getFilePath(file,null), 'preview4', 'progress1', 1).then(function (path) {
vm.contentTemplate.imageUrl = path.fullPath
vm.$message.success('上传成功')
});
// return false;
},
// 修改分页
handleSizeChange(value) {
vm.searchParam.pageSize = value
vm.search()
},
handleCurrentChange(value) {
vm.searchParam.pageNo = value
vm.search()
}
}
}
</script>
<style>
.layout-const-wrap .el-collapse {
border-top: 0;
}
.layout-const-wrap .el-collapse-item__wrap {
border-bottom: 0;
}
.layout-const-wrap .el-collapse-item__content {
padding-bottom: 0;
}
.acilayout-consttvity-wrap .el-collapse-item__header {
color: #409EFF;
}
.layout-const-wrap .el-collapse-item__wrap {
border-top: 1px solid #dcdfe6;
}
.layout-const-wrap .row {
margin-top: 20px;
margin-bottom:20px;
}
.layout-const-wrap .item-label {
white-space: nowrap;
}
.layout-const-wrap .label-row {
padding-top: 10px;
}
.layout-const-wrap .search-button {
text-align: right;
margin-top:20px;
}
.layout-const-wrap .create-button {
padding-top: 20px;
margin-top: 0 !important;
border-top: 1px solid #dcdfe6;
text-align: right;
}
.layout-const-wrap .el-table__header thead tr th {
background: #fafafa !important;
}
.layout-const-wrap .creat-form {
height: 550px;
overflow-y: auto;
overflow-x: hidden;
}
.layout-const-wrap .dialog-footer {
text-align: center;
}
.layout-const-wrap .dialog-footer button {
width: 150px;
height: 30px;
line-height: 8px;
}
.layout-const-wrap .el-table th>.cell{
color: #000;
}
.layout-const-wrap .el-form {
overflow: hidden;
}
.layout-const-wrap .bg-img {
width:80px;
height:80px;
}
</style>
<template>
<div class="layout-wrap">
<el-row :gutter="30" class="content-title" type="flex">
<el-col :span="4" class="name-label">
<h5>楼层管理</h5>
</el-col>
</el-row>
<el-row :gutter="30" class="row" type="flex" style="margin-bottom:0;display:none">
<el-form ref="form" :model="searchParam" label-suffix=":" label-width="130px" style="width:100%;">
<el-col :span="10">
<el-form-item label="" prop="shareFlag">
<el-radio-group v-model="webAndnativeLable" @change="webAndnative">
<el-radio label="native"></el-radio>
<el-radio label="h5"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-form>
</el-row>
<el-row :gutter="10" class="row create-button" style="margin-right:0;">
<el-button type="primary" size="small" @click="createLayout">新建楼层</el-button>
</el-row>
<!-- 表格 -->
<el-table :data="tableData" style="width: 100%">
<el-table-column label="楼层排序" width="200">
<template slot-scope="scope">
<input type="text" v-model="scope.row.seqNo" size="small">
</template>
</el-table-column>
<el-table-column prop="floorName" label="楼层名称" min-width="200" align="center"></el-table-column>
<el-table-column label="支持版本" min-width="200" align="center">
<template slot-scope="scope">
<span>{{ scope.row | getVersion }}</span>
</template>
</el-table-column>
<el-table-column prop="createdTime" label="最后修改时间" min-width="200" align="center"></el-table-column>
<el-table-column label="是否支持下拉刷新" min-width="120" align="center">
<template slot-scope="scope">
<span>{{ scope.row.freshFlag | refreshType}}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" min-width="200">
<template slot-scope="scope">
<el-button type="primary" size="small" @click="editColumn(scope.row)">编辑</el-button>
<el-button type="danger" size="small" @click="deleteControl(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="save-btn">
<el-button size="small" type="primary" @click="editTabSave">保 存</el-button>
</div>
<!-- 新建楼层 -->
<el-dialog class="img-edit" :title="dialogTitle" :visible.sync="createActivityVisible" :close-on-click-modal="false">
<el-form ref="form" :model="submitLayout" label-suffix=":" label-width="130px" style="width:100%;">
<el-form-item prop="shareFlag" v-if="addLayout">
<el-radio-group v-model="shareLable" @change="isSelect">
<div class="layout-content" v-for="(item,index) in allLayoutList" :key="index">
<el-radio :label="item.floorCode + '&' + item.floorName">
<div class="layout-text">{{item.floorDesc}}</div>
<img class="bg-img" :src="item.imageUrl">
</el-radio>
</div>
</el-radio-group>
</el-form-item>
<el-form-item label="是否支持下拉刷新" prop="shareFlag">
<el-radio-group v-model="isResearchLable" @change="refleshSelect">
<el-radio label="支持"></el-radio>
<el-radio label="不支持"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="支持版本">
<el-col :span="5">
<el-select v-model="submitLayout.appVersion" placeholder="请选择">
<el-option
v-for="item in versionList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="1"> &nbsp </el-col>
<el-col :span="12">
<el-radio-group v-model="submitLayout.range">
<el-radio :label=1>向上支持</el-radio>
<el-radio :label=2>向下支持</el-radio>
</el-radio-group>
</el-col>
</el-form-item>
<el-form-item label="是否显示图片" >
<el-radio-group v-model="submitLayout.isShow" @change="refleshSelect">
<el-radio :label='1'>显示</el-radio>
<el-radio :label='2'>不显示</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="submitLayout.isShow == 1" label="图片" >
<el-upload
v-model="submitLayout.imgUrl"
class="bg-uploader"
action="#"
accept="image/jpeg,image/jpg,image/png"
:show-file-list="false"
:before-upload="layoutImgUrl">
<img v-show="submitLayout.imgUrl" :src="submitLayout.imgUrl" class="bg-img">
<img v-show="!submitLayout.imgUrl" class="bg-img" src="../../../static/img/small.png">
</el-upload>
<div class="img-p">
<p>高度36px</p>
</div>
</el-form-item>
<el-form-item label="链接" prop="linkUrl" v-if="isWebLayout">
<el-input v-model="submitLayout.linkUrl" placeholder="" style="width:84%"></el-input>
</el-form-item>
<div v-if="submitLayout.isShow == 1">
<el-form-item label="“更多”文案">
<el-input v-model="submitLayout.content" placeholder="" style="width:84%"></el-input>
</el-form-item>
<el-form-item label="更多跳转">
</el-form-item>
<el-form-item label="链接类型">
<el-select v-model="submitLayout.linkType" placeholder="请选择" @change="linkChange" style="width:84%">
<el-option
v-for="item in linkSelect"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="选择模块" v-if="submitLayout.linkType == 4">
<el-select v-model="submitLayout.name" placeholder="请选择" @change="moduleChange" style="width:84%">
<el-option
v-for="item in modelList"
:key="item.id"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</el-form-item>
<div v-for="(i,j) in paramList2" :key="j" >
<el-form-item label="选择参数" v-if="submitLayout.linkType == 4 && paramFlagStatus == 1">
<el-select v-model="submitLayout.parameter[j]" filterable placeholder="请选择参数" style="width:84%">
<el-option
v-for="(item3,index3) in i"
:key="index3"
:label="item3.name"
:value="item3.id + '&'+ item3.name">
</el-option>
</el-select>
</el-form-item>
</div>
</div>
<el-form-item label="资源关联" >
<el-select v-model="submitLayout.templateCode" placeholder="请选择" style="width:84%">
<el-option
v-for="item in templateList"
:key="item.templateCode"
:label="item.name"
:value="item.templateCode">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="createSave">提交</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { doUpload, getFilePath } from "../../common/qiniuUtil";
import {setOptionLabel,
initDepartment,
isEmptyUtils,
errorResponseCheck,
openLoading,
closeLoading,
messageBox,
getConstantList,getPositionList, isNotEmptyList} from '../../common/utils'
let vm = null
export default {
data() {
return {
dialogTitle: '新增楼层',
editLayout: '编辑楼层',
createActivityVisible: false,
addLayout: false,
isWebLayout: false,
showType: '',
searchParam: {},
tableData: [],
allLayoutList: [],
webAndnativeLable: '',
isResearchLable: '',
shareLable: '',
isNativeorH5: '',
listId: '',
submitLayout: {
id: '',
floorCode: '',
floorName: '',
freshFlag: '',
seqNo: '',
linkUrl: '',
imgUrl: '',
isShow: 1,
appVersion: '',
range: 1,
content: '',
linkType: 8,
name: '',
parameter: [],
templateCode: '',
},
versionList: [],
linkSelect: [],
modelList: [],
paramList2: [],
chooseModel: {
code: null,
type: null,
paramFlag: 1,
},
selectParamData: {},
floorModel: {},
templateList: [],
paramFlagStatus: '',
optionStatus: '',
}
},
created() {
vm = this
vm.search()
vm.getAppVersion()
vm.getLinkType()
vm.getModuleData()
vm.queryResourceList()
},
methods: {
// 查询楼层信息
search() {
openLoading(vm);
vm.$axios.get(localStorage.getItem("msUrl") + 'homeFloor/queryList').then(function (res) {
closeLoading(vm);
let data = JSON.parse(JSON.stringify(res.data.data));//通过这个实现深拷贝
if(data.typeConfig) {
vm.isNativeorH5 = data.typeConfig.showType
vm.listId = data.typeConfig.id
if(vm.isNativeorH5 == 1) {
vm.webAndnativeLable = "native"
vm.showType = 1
}else{
vm.webAndnativeLable = "h5"
vm.showType = 2
}
}else{
vm.webAndnativeLable = ''
}
vm.tableData = data.floorList
}).catch(function (error) {
errorResponseCheck(error, vm);
});
},
// 上传楼层图片
layoutImgUrl(file) {
if (isEmptyUtils(file)) {
return;
}
var _img = new FileReader()
_img.readAsDataURL(file)
_img.onload = function(theFile) {
let image = new Image()
image.src = theFile.target.result
image.onload = function() {
let _this = this
if(_this.height != 36) {
vm.$message.info("上传图片尺寸大小不合适,请重新上传")
}else {
vm.$message.info('开始上传');
openLoading(vm)
doUpload(vm,file, getFilePath(file,null), 'preview4', 'progress1', 1).then(function (path) {
closeLoading(vm)
vm.submitLayout.imgUrl = path.fullPath
vm.$message.success('上传成功')
});
}
}
}
// return false;
},
// 选择native or h5
webAndnative(value) {
if(value == 'native') {
vm.showType = 1
}else if(value == 'h5') {
vm.showType = 2
}
},
//查询所有楼层常量信息
getAllLayout() {
vm.$axios.get(localStorage.getItem("msUrl") + 'homeFloorConstants/queryAllConstants').then(function (res) {
closeLoading(vm);
let data = JSON.parse(JSON.stringify(res.data.data));//通过这个实现深拷贝
vm.allLayoutList = data
}).catch(function (error) {
errorResponseCheck(error, vm);
});
},
// 新建楼层
createLayout() {
vm.dialogTitle = '新增楼层'
vm.optionStatus = 'create'
vm.createActivityVisible = true
vm.addLayout = true
vm.submitLayout.seqNo = vm.tableData.length
vm.submitLayout.floorCode = ''
vm.submitLayout.floorName = ''
vm.submitLayout.freshFlag = 1
vm.submitLayout.isShow = 1
vm.submitLayout.imgUrl = ''
// vm.submitLayout.appVersion = vm.versionList[0]
vm.submitLayout.appVersion = '3.0.4'
vm.submitLayout.range = 1
vm.submitLayout.content = ''
vm.submitLayout.linkType = 8
vm.submitLayout.name = ''
vm.submitLayout.parameter = [],
vm.submitLayout.templateCode = '',
vm.isResearchLable = '支持'
// vm.linkSelect = [];
vm.getAllLayout()
// vm.getLinkType()
// vm.getModuleData();
},
// 编辑模板内容
editColumn(row) {
vm.dialogTitle = '编辑楼层'
vm.optionStatus = 'edit'
vm.createActivityVisible = true
vm.addLayout = false
vm.submitLayout.id = row.id
vm.submitLayout.seqNo = row.seqNo
vm.submitLayout.floorCode = row.floorCode
vm.submitLayout.floorName = row.floorName
vm.submitLayout.freshFlag = row.freshFlag
vm.submitLayout.isShow = row.isShow
vm.submitLayout.imgUrl = row.imgUrl
if(row.freshFlag == 1) {
vm.isResearchLable = '支持'
}else{
vm.isResearchLable = '不支持'
}
if(row.floorCode == 'H000') {
vm.isWebLayout = true
vm.submitLayout.linkUrl = row.linkUrl
}else{
vm.isWebLayout = false
}
// vm.linkSelect = [];
this.selectFloorById(row.id);
// vm.getLinkType()
// vm.getModuleData();
},
// 选中楼层
isSelect(value) {
let floorInfo = value.split('&')
vm.submitLayout.floorCode = floorInfo[0]
vm.submitLayout.floorName = floorInfo[1]
if(floorInfo[0] == 'H000') {
vm.isWebLayout = true
}else{
vm.isWebLayout = false
}
},
// 是否支持下拉刷新
refleshSelect(value) {
if(value == '支持') {
vm.submitLayout.freshFlag = 1
}else if(value == '不支持') {
vm.submitLayout.freshFlag = 2
}
},
// 提交新增楼层
createSave() {
if(vm.addLayout){
if(!vm.submitLayout.floorCode) {
vm.$message.info("请选择楼层")
return
}
if(!vm.submitLayout.freshFlag) {
vm.$message.info("请选择是否支持下拉刷新")
return
}
if(vm.isWebLayout) {
if(!vm.submitLayout.linkUrl) {
vm.$message.info("请输入链接")
return
}
}
}else{
if(!vm.submitLayout.freshFlag) {
vm.$message.info("请选择是否支持下拉刷新")
return
}
if(vm.isWebLayout) {
if(!vm.submitLayout.linkUrl) {
vm.$message.info("请输入链接")
return
}
}
}
if(vm.submitLayout.isShow == 1) {
if(vm.submitLayout.imgUrl == '' || vm.submitLayout.imgUrl == null) {
vm.$message.info("请上传图片")
return
}
}
if(vm.submitLayout.isShow == 2) {
vm.submitLayout.imgUrl = '';
}
if(vm.submitLayout.content.length > 0) {
if(vm.submitLayout.content.length > 6) {
vm.$message.info("“更多”文案 限6字")
return
}
if(vm.submitLayout.linkType != 4) {
vm.$message.info("填写“更多”文案后,必须选择模块")
return
}
}
if(vm.submitLayout.linkType == 4) {
if(vm.submitLayout.content.length == 0) {
vm.$message.info("选择模块后,必须填写“更多”文案")
return
}
}
let submitData = this.setSubmitData();
// console.log('submitData:',submitData);
openLoading(vm);
vm.$axios.post(localStorage.getItem("msUrl") + 'homeFloor/insertOrUpdateFloorDetail'
, submitData).then(function (res) {
closeLoading(vm);
if(res.data.code == "000000") {
vm.createActivityVisible = false
vm.$message({
type: 'success',
message: '保存成功!'
})
vm.search()
}
}).catch(function (error) {
vm.$message.error('保存失败')
})
},
// 下线(删除)
deleteControl(row) {
this.$confirm('此操作将删除该楼层, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let req = {
params: {
id: row.id
}
}
vm.$axios.get(localStorage.getItem("msUrl") + 'homeFloor/deleteFloorById'
, req).then(function (res) {
if(res.data.code == '000000') {
vm.$message({
type: 'success',
message: '删除成功!'
})
vm.search()
}
}).catch(function (error) {
errorResponseCheck(error, vm);
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 保存
editTabSave() {
let data = {
typeConfig: {
showType: vm.showType,
id: vm.listId
},
detailConfig: vm.tableData
}
if(!data.typeConfig.showType) {
vm.$message.info("请选择native或者h5")
return
}
// 楼层不可重复判断
let seqNoArray = []
let nary = []
for(let i=0;i<data.detailConfig.length;i++) {
seqNoArray.push(parseInt(data.detailConfig[i].seqNo))
}
nary = seqNoArray.slice().sort();
for(let i=0;i<seqNoArray.length;i++){
if (nary[i]==nary[i+1]){
vm.$message.info("楼层排序重复内容:"+nary[i])
return
}
}
openLoading(vm);
vm.$axios.post(localStorage.getItem("msUrl") + 'homeFloor/deploy'
, data).then(function (res) {
closeLoading(vm);
if(res.data.code == "000000") {
vm.$message({
type: 'success',
message: '保存成功!'
})
vm.search()
}
}).catch(function (error) {
vm.$message.error('保存失败')
})
},
// 新增功能
setSubmitData() {
let submitData = {};
vm.submitParam();
// console.log('提交表单optionStatus:',vm.optionStatus)
if(vm.optionStatus == 'edit') {
submitData = {
model:{
tHomeFloorDetailConfig:{
id: vm.submitLayout.id,
floorCode: vm.submitLayout.floorCode,
floorName: vm.submitLayout.floorName,
freshFlag: vm.submitLayout.freshFlag,
seqNo: vm.submitLayout.seqNo,
linkUrl: vm.submitLayout.linkUrl,
status: 1,
imgUrl: vm.submitLayout.imgUrl,
isShow: vm.submitLayout.isShow,
appVersion: vm.submitLayout.appVersion,
range: vm.submitLayout.range,
content: vm.submitLayout.content,
templateCode: vm.submitLayout.templateCode,
},
contentAppModule:{
code: vm.chooseModel.code,//
type: vm.chooseModel.type,//
name: vm.submitLayout.name,
linkType: vm.submitLayout.linkType,
paramFlag: vm.chooseModel.paramFlag,
status: vm.floorModel.tHomeFloorDetailConfig.status,//
deleteFlag: vm.floorModel.tHomeFloorDetailConfig.deleteFlag,
createdId: vm.floorModel.tHomeFloorDetailConfig.createdId,
createdTime: vm.floorModel.tHomeFloorDetailConfig.createdTime,
modifiedId: vm.floorModel.tHomeFloorDetailConfig.modifiedId,
modifiedTime: vm.floorModel.tHomeFloorDetailConfig.modifiedTime
},
paramList:[]
}
}
let configData = vm.selectParamData.config;
for(let j=0;j<vm.submitLayout.parameter.length;j++) {
submitData.model.paramList[j] = {};
submitData.model.paramList[j].id = configData[j].id;
submitData.model.paramList[j].moduleId = configData[j].moduleId;
submitData.model.paramList[j].key = configData[j].paramKey;
submitData.model.paramList[j].value = vm.submitLayout.parameter[j];
submitData.model.paramList[j].type = configData[j].type;
submitData.model.paramList[j].seqNo = configData[j].seqNo;
submitData.model.paramList[j].status = configData[j].status;
submitData.model.paramList[j].deleteFlag = vm.floorModel.tHomeFloorDetailConfig.deleteFlag;
submitData.model.paramList[j].createdId = configData[j].createdId;
submitData.model.paramList[j].createdTime = configData[j].createdTime;
submitData.model.paramList[j].modifiedId = configData[j].modifiedId;
submitData.model.paramList[j].modifiedTime = configData[j].modifiedTime;
}
} else {
submitData = {
model:{
tHomeFloorDetailConfig:{
floorCode: vm.submitLayout.floorCode,
floorName: vm.submitLayout.floorName,
freshFlag: vm.submitLayout.freshFlag,
seqNo: vm.submitLayout.seqNo,
linkUrl: vm.submitLayout.linkUrl,
status: 1,
imgUrl: vm.submitLayout.imgUrl,
isShow: vm.submitLayout.isShow,
appVersion: vm.submitLayout.appVersion,
range: vm.submitLayout.range,
content: vm.submitLayout.content,
templateCode: vm.submitLayout.templateCode,
},
contentAppModule:{
code: vm.chooseModel.code,//
type: vm.chooseModel.type,//
name: vm.submitLayout.name,
linkType: vm.submitLayout.linkType,
paramFlag: vm.chooseModel.paramFlag,
status: '',
deleteFlag: 1,
createdId: '',
createdTime: '',
modifiedId: '',
modifiedTime: '',
},
paramList:[]
}
}
let configData = vm.selectParamData.config;
for(let j=0;j<vm.submitLayout.parameter.length;j++) {
submitData.model.paramList[j] = {};
submitData.model.paramList[j].id = configData[j].id;
submitData.model.paramList[j].moduleId = configData[j].moduleId;
submitData.model.paramList[j].key = configData[j].paramKey;
submitData.model.paramList[j].value = vm.submitLayout.parameter[j];
submitData.model.paramList[j].type = configData[j].type;
submitData.model.paramList[j].seqNo = configData[j].seqNo;
submitData.model.paramList[j].status = configData[j].status;
submitData.model.paramList[j].deleteFlag = 1;
submitData.model.paramList[j].createdId = configData[j].createdId;
submitData.model.paramList[j].createdTime = configData[j].createdTime;
submitData.model.paramList[j].modifiedId = configData[j].modifiedId;
submitData.model.paramList[j].modifiedTime = configData[j].modifiedTime;
}
}
return submitData;
},
setFloor(data) {
// console.log(data);
this.submitLayout.appVersion = data.tHomeFloorDetailConfig.appVersion;
this.submitLayout.range = data.tHomeFloorDetailConfig.range;
this.submitLayout.content = data.tHomeFloorDetailConfig.content;
this.submitLayout.linkType = data.contentAppModule.linkType;
this.submitLayout.name = data.contentAppModule.name;
this.submitLayout.templateCode = data.tHomeFloorDetailConfig.templateCode;
this.initParam();
vm.submitLayout.parameter = [];
for(let j=0;j<vm.floorModel.paramList.length;j++) {
vm.submitLayout.parameter[j] = vm.floorModel.paramList[j].value;
}
//编辑时候linkType为空赋值8(无跳转)
if(vm.submitLayout.linkType == null) {
vm.submitLayout.linkType = 8;
}
},
// new-根据ID查询楼层信息
selectFloorById(id) {
vm.$axios.get(localStorage.getItem("msUrl") + 'homeFloor/selectFloorById?id='+id).then(function (res) {
if(res.data.code == "000000") {
vm.floorModel = res.data.data.model;
vm.setFloor(res.data.data.model);
vm.initParamFlag();
}
}).catch(function (error) {
vm.$message.error(error);
});
},
// 获取APP版本号
getAppVersion() {
vm.$axios.get(localStorage.getItem("msUrl") + 'version/versionList').then(function (res) {
if(res.data.code == "000000") {
vm.versionList = res.data.data.versionName
}
}).catch(function (error) {
vm.$message.error(error);
});
},
// 获取链接类型下拉数据
getLinkType() {
let req = {
params: {
code: 'C005'
},
};
vm.$axios.get(localStorage.getItem("msUrl") + 'commonComstant/selectByTypeCode'
, req).then(function (res) {
if(res.data.code == "000000") {
let linkObject = JSON.parse(JSON.stringify(res.data.data));//通过这个实现深拷贝
let keys = Object.keys(linkObject);
for(var i=0;i<keys.length;i++) {
vm.linkSelect.push({
label: linkObject[keys[i]],
value: keys[i] - 0
})
}
}
}).catch(function (error) {
vm.$message.error(error);
});
},
// 获取模块下拉数据
getModuleData() {
vm.$axios.get(localStorage.getItem("msUrl") + 'moduleConfig/selectName').then(function (res) {
if(res.data.code == "000000") {
let moduleArray = JSON.parse(JSON.stringify(res.data.data))
vm.modelList = moduleArray.nameList;
}
}).catch(function (error) {
vm.$message.error(error);
});
},
// change链接类型
linkChange(value) {
this.submitLayout.name = '';
},
initParamFlag() {
for(let i = 0; i < vm.modelList.length; i++) {
if(vm.submitLayout.name == vm.modelList[i].name) {
// console.log('initParamFlag:',vm.modelList[i])
vm.paramFlagStatus = vm.modelList[i].paramFlag;
}
}
},
// change模块选择数据
moduleChange(value) {
for(let z=0;z<vm.submitLayout.parameter.length;z++) {
vm.submitLayout.parameter[z] = '';
}
for(let i = 0; i < vm.modelList.length; i++) {
if(value == vm.modelList[i].name) {
console.log('moduleChange',vm.modelList[i])
vm.paramFlagStatus = vm.modelList[i].paramFlag
vm.getParamData(vm.modelList[i].id,vm.modelList[i].paramFlag,2)
break
}
}
},
initParam() {
if(vm.modelList.length == 0) {
return;
}
for(let i=0;i<vm.modelList.length;i++) {
if(vm.modelList[i].name == vm.submitLayout.name) {
console.log('modelList:',vm.modelList[i]);
vm.chooseModel = vm.modelList[i];
vm.getParamData(vm.modelList[i].id,vm.modelList[i].paramFlag,1)
}
}
},
submitParam() {
for(let i=0;i<vm.modelList.length;i++) {
if(vm.modelList[i].name == vm.submitLayout.name) {
console.log('submitParam:',vm.modelList[i]);
vm.chooseModel = vm.modelList[i];
}
}
},
getParamData(id,flag,enter) {
console.log('flag值:',flag);
if(flag == 1) { // 是否有参数
let req = {
params: { id: id }
}
vm.$axios.get(localStorage.getItem("msUrl") + 'moduleConfig/selectParam'
, req).then(function (res) {
if(res.data.code == "000000") {
vm.paramList2 = res.data.data.paramList;
if(enter == 2) {
vm.submitLayout.parameter = [];
for(let j=0;j<vm.paramList2.length;j++) {
vm.submitLayout.parameter[j] = '';
}
}
vm.selectParamData = res.data.data;
}
}).catch(function (error) {
vm.$message.error(error);
})
}else{
return false
}
},
//查询资源名称和templateCode
queryResourceList() {
vm.$axios.get(localStorage.getItem("msUrl") + 'contentResourceField/queryResourceList').then(function (res) {
if(res.data.code == "000000") {
vm.templateList = res.data.data;
}
}).catch(function (error) {
vm.$message.error(error);
});
},
}
}
</script>
<style>
.layout-wrap .row {
margin-top: 20px;
margin-bottom:20px;
}
.layout-wrap .item-label {
white-space: nowrap;
}
.layout-wrap .label-row {
padding-top: 10px;
}
.layout-wrap .search-button {
text-align: right;
margin-top:20px;
}
.layout-wrap .create-button {
padding-top: 20px;
margin-top: 0 !important;
/* border-top: 1px solid #dcdfe6; */
text-align: right;
}
.layout-wrap .el-table__header thead tr th {
background: #fafafa !important;
}
.layout-wrap .creat-form {
height: 550px;
overflow-y: auto;
overflow-x: hidden;
}
.layout-wrap .course .el-upload{
border: 1px solid #71AEED;
border-radius: 2px;
}
.layout-wrap .bg-uploader {
float: left;
}
.layout-wrap .bg-img {
width:80px;
height:80px;
}
.layout-wrap .el-upload {
position: relative;
}
.layout-wrap .el-upload .info-img{
width: 73px;
position: absolute;
left: 2px;
top: -5px;
opacity: 0;
}
.layout-wrap .el-upload .info-img:hover{
opacity: 1;
}
.layout-wrap .img-size p{
font-size: 12px;
}
.layout-wrap .img-size p:nth-child(1){
margin-top: 45px;
}
.layout-wrap .dialog-footer {
text-align: center;
}
.layout-wrap .dialog-footer button {
width: 150px;
height: 30px;
line-height: 8px;
}
.layout-wrap .el-table th>.cell{
color: #000;
}
.layout-wrap .el-upload-list--text li {
min-width: 250px;
max-width: 60%;
}
.layout-wrap .el-form {
overflow: hidden;
}
.layout-wrap .save-btn {
text-align: center;
margin-top: 20px;
}
.layout-wrap .layout-content {
display: inline-block;
width: 33%;
margin-bottom: 20px;
}
.layout-wrap .el-table__row input {
border: none;
}
/* .layout-wrap .img-edit .el-radio__label {
display: block;
} */
.layout-wrap .layout-text {
width:150px;
padding: 10px 0;
}
.layout-wrap .img-p {
margin: 30px 0 0 20px;
float:left;
}
</style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册