<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
|
<title>政策方案</title>
|
<script type="text/javascript">
|
var pageVue = null;
|
function loadJsCss(callback) {
|
var jscss_urls = [];
|
window.top.initJsCss(document, jscss_urls, callback);
|
};
|
|
function initVue() {
|
new ListVue({
|
el: "#vbody",
|
data: {
|
dataname: "bonus_policy",
|
tableHeight2: 510,
|
isEditTreeData: false,
|
isEditTableData: false,
|
tableFields: [],
|
treeDataObj: {},
|
treeData: [],
|
defaultExpandedKeys: [],
|
defaultProps: {
|
children: 'children',
|
label: 'name'
|
},
|
tableData: [],
|
filterText: '',
|
|
tablefieldClick: {},
|
},
|
created() {
|
|
},
|
mounted() {
|
this.initData();
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
},
|
watch: {
|
filterText(val) {
|
this.$refs.tree.filter(val);
|
}
|
},
|
methods:{
|
initData() {
|
this.getTree();
|
this.getTableData()
|
},
|
|
getTree() {
|
let me = this;
|
|
let param_ = {
|
dataname: "fee_plan",
|
}
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
console.log(result);
|
|
if (!result || !result.data || !result.data.entityset || result.data.entityset.length == 0) return;
|
|
let data = result.data.entityset
|
data[0].name = "经销商折扣政策"
|
me.treeData = data
|
|
|
let defualtClickNodeId = me.treeData[0].id
|
|
me.$nextTick(() => {
|
me.$refs.tree.setCurrentKey(defualtClickNodeId)
|
})
|
|
me.readnode();
|
});
|
},
|
|
//点击事件
|
readnode(data, node){
|
let me = this;
|
let filter_ = "1=1";
|
|
let param_ = {
|
dataname: "fee_model_plan",
|
filter: filter_,
|
}
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
var data_ = result.data.entityset;
|
me.tableData = data_;
|
}
|
});
|
},
|
|
// 政策定义 table
|
getTableData() {
|
let me = this
|
|
let parames = {
|
dataname: "fee_model_plan",
|
filter: "1=1",
|
attachMeta: true
|
}
|
|
me.tableData = [];
|
me.tableloading = true;
|
Server.call("root/data/getEntitySet", parames, function(result) {
|
console.log(result)
|
me.tableloading = false;
|
if (result.meta && result.meta.fee_model_plan) {
|
var metas = clone(result.meta.fee_model_plan);
|
var tableFields_ = [];
|
|
metas.map(f=>{
|
f.isshow = "T";
|
|
tableFields_.push(clone(f));
|
})
|
me.tableFields = clone(tableFields_);
|
}
|
if (result && result.data && result.data.entityset) {
|
me.tableData = result.data.entityset
|
}
|
|
//字段数组转字段obj,目的为了筛选时获取字段属性
|
me.fieldsToFieldsObj();
|
|
//设置字段事件
|
me.tableFieldClick();
|
});
|
},
|
|
takeEffect(remark) {
|
let me = this
|
|
let message = ""
|
|
if (remark == "Open") {
|
message = "确定生效吗?"
|
}
|
else {
|
message = "确定失效吗?"
|
}
|
|
Root.confirm(message, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
let param = {
|
"id": this.selectedrow.id,
|
"state": remark
|
}
|
|
Server.call("root/fee/changePlanSate", param, function(result) {
|
console.log(result);
|
|
me.readnode()
|
});
|
}).catch(() => {
|
});
|
},
|
|
filterNode(value, data) {
|
if (!value) return true;
|
return data.name.indexOf(value) !== -1;
|
},
|
|
openDebugging(obj) {
|
var me = this;
|
|
var config = {
|
totab: true, //true: 以Tab导航的方式打开
|
width: "400px",
|
height: "600px",
|
icon: "icon-product",
|
text: "公式配置",
|
id: uuid_short(),//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/fee/page/policy/page/designer/designer.html?id=" + obj.row.id,
|
data: {},
|
delta: {},
|
sceneCode: "browse",
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
|
me.doPopupByPublic(config);
|
},
|
|
onAddData() {
|
var me = this;
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "300px",
|
icon: "icon-product",
|
text: "新增政策",
|
id: "policy_edit",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/fee/page/policy/page/policy_edit.html",
|
data: {},
|
delta: {},
|
sceneCode: "add",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.getTree();
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
onEditData(param1, scope) {
|
var me = this;
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "900px",
|
icon: "icon-product",
|
text: "政策编辑",
|
id: "policy_edit",//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/fee/page/policy/page/policy_edit.html",
|
data: scope.row,
|
delta: me.dataname,
|
sceneCode: "edit",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.getTree();
|
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
|
me.doPopupByPublic(config);
|
},
|
|
onDelData(scope) {
|
let me = this
|
|
let row = scope.row;
|
Root.confirm('确定删除该数据吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
let param = {
|
id: row.id,
|
dataname: "fee_model_plan",
|
}
|
Server.call("root/data/deleteEntity", param, function(result) {
|
console.log(result);
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
|
me.readnode();
|
});
|
}).catch(() => {
|
|
});
|
},
|
|
tableFieldClick() {
|
var me = this;
|
|
//表格字段事件设置
|
this.tablefieldClick = {
|
name: { //字段事件设置
|
val: { //有值时的点击事件
|
notclick_val: "", //不可点击的值,1、是数组["11","22"];2、以“;”分隔的字符串"111;222"
|
notclick_bindfield: [], //当该字段值等于指定字段值时不可点击["filterfield": "111"]
|
onclick: function(obj) { //数据值点击事件
|
me.openDebugging(obj);
|
},
|
}
|
},
|
};
|
},
|
}
|
});
|
}
|
|
loadJsCss(function() {
|
initVue();
|
});
|
</script>
|
|
<style>
|
.el-dialog__body{
|
border-top: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
padding: 20px;
|
}
|
.custom-tree-node {
|
flex: 1;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
font-size: 14px;
|
padding-right: 8px;
|
}
|
</style>
|
</head>
|
|
<body style="margin: 0px;">
|
<div id="vbody">
|
<div id="page_root">
|
<div style="width: 100%; height: 100%; padding: 10px; box-sizing: border-box;">
|
<div :style="{width: '20%', height: tableHeight2 + 60+'px', float: 'left', border: '1px solid #ccc'}">
|
<div style="height: 45px; border-bottom: 1px solid #aaa;">
|
<div class="topbar" style="float: left; line-height: 45px; margin-left: 1em; font-size: 14px">
|
<span>政策方案</span>
|
</div>
|
<div style="float: right; margin: 10px;">
|
<el-button-group style="margin-left: 3px; ">
|
</el-button-group>
|
</div>
|
</div>
|
<div style=" padding: 20px;">
|
<el-input
|
placeholder="输入搜索字"
|
v-model="filterText">
|
</el-input>
|
</div>
|
<div v-if="treeData.length > 0" :style="{height: tableHeight2 - 68 +'px', padding: '0px 20px 20px 20px', 'box-sizing': 'border-box'}">
|
<div :style="{height: tableHeight2 - 80 +'px', 'overflow-y': 'auto', 'font-size': '14px'}">
|
<el-tree
|
ref="tree"
|
node-key="id"
|
default-expand-all
|
highlight-current
|
:props="defaultProps"
|
:data="treeData"
|
:default-expanded-keys="defaultExpandedKeys"
|
:filter-node-method="filterNode"
|
@node-click="readnode"
|
>
|
</el-tree>
|
|
</div>
|
</div>
|
</div>
|
<div v-if="" :style="{width: '79%', height: tableHeight2 + 60+'px', float: 'right', border: '1px solid #ccc'}">
|
<div style="height: 45px; border-bottom: 1px solid #aaa;">
|
<div class="topbar" style="float: left; line-height: 45px; margin-left: 1em; font-size: 14px">
|
<span>政策定义</span>
|
</div>
|
<div style="float: right; margin: 10px;">
|
<el-button-group style="margin-left: 3px; ">
|
<el-button @click="addData">添 加</el-button>
|
<el-button @click="takeEffect('Open')" :disabled="!(selectedrow.state_code=='input')" type="success">生 效</el-button>
|
<el-button @click="takeEffect('Cancel')" :disabled="!(selectedrow.state_code=='Open')" type="danger">失 效</el-button>
|
<el-button @click="setEditTableData" >{{isEditTableData ? '取消编辑' : '在线编辑'}}</el-button>
|
</el-button-group>
|
</div>
|
</div>
|
|
<h-table v-if="isRefresh" ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="isEditTableData"
|
:is-pagination="false"
|
:table-height="tableHeight2"
|
:is-highlight-row="true"
|
:table-field-click="tablefieldClick"
|
:tableloading="tableloading"
|
|
v-on:get-data="getData"
|
v-on:edit-data="editData"
|
v-on:del-data="delData"
|
v-on:row-click="rowClick"
|
v-on:order-fields="orderFilterFields"
|
>
|
</h-table>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
</div>
|
</body>
|
</html>
|