<!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">
|
function loadJsCss(callback) {
|
var jscss_urls = [
|
// {id: "css_m1", type: "css", url: "root/css/tree.css"},
|
];
|
window.top.initJsCss(document, jscss_urls, callback);
|
};
|
|
function initVue() {
|
new ListVue({
|
el: "#vbody",
|
data: {
|
dataname: "md_hierarchy_sales",
|
title: "销售指标",
|
treeData: [],
|
|
dataname_p: "md_product",
|
default_tableFields_p_obj: {
|
t1: [
|
{isshow: "T", field: "qty_in", name: "类型", align: "right", width: "80"},
|
{isshow: "T", field: "qty_in", name: "达成起步线", align: "right", width: "80"},
|
{isshow: "T", field: "qty_in", name: "状态", align: "right", width: "80"},
|
{isshow: "T", field: "year", name: "年份", align: "center",width: "50"},
|
{isshow: "T", field: "monthno", name: "月份", align: "center",width: "100"},
|
],
|
|
},
|
|
defaultProps: {
|
children: 'children',
|
label: 'name',
|
},
|
tableHeight2: 400,
|
filterText: "",
|
|
defaultExpandedKeys: [],
|
isRefresh_p: true,
|
filterFields: [
|
{isshow: "T", field: "code", name: "医院编码", filterfield: "", filteroperator: "like"},
|
{isshow: "T", field: "name", name: "医院名称", filterfield: "", filteroperator: "like"},
|
],
|
tableFields_p: [
|
{isshow: "T", field: "employee_name", name: "负责销售", align: "center",width: "150"},
|
{isshow: "T", field: "code", name: "医院编码", align: "center", width: "120"},
|
{isshow: "T", field: "name", name: "医院名称", align: "left", width: "120", isminwidth: true},
|
{isshow: "T", field: "field4", name: "2022", align: "right", width: "120"},
|
{isshow: "T", field: "field5", name: "分配", align: "right", width: "120"},
|
{isshow: "T", field: "field6", name: "认领", align: "right", width: "120"},
|
{isshow: "T", field: "field7", name: "增长", align: "right", width: "120", formatter: "formatter_percent"},
|
// {isshow: "T", field: "field7",name: "增长", type:"buttons", buttons: [{name:"推荐",code:"tj"},{name: "不推荐", code:"nbj"}]},
|
],
|
tableData_p: [],
|
pagesize_p: 10,
|
pagenum_p: 1,
|
total_p: 0,
|
tableHeight_p: 100,
|
formData: {},
|
|
filterfieldClick: {},
|
tablefieldClick: {},
|
},
|
created() {
|
let clientHeight = document.documentElement.clientHeight;
|
this.tableHeight2 = clientHeight - 180;
|
this.tableHeight_p = clientHeight - 150;
|
|
},
|
|
mounted() {
|
//获取数据
|
this.initData();
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
},
|
|
watch: {
|
filterText(val) {
|
this.$refs.tree.filter(val);
|
},
|
// versionObj(newVal, oldVal){
|
// this.getDataByVersion();
|
// },
|
},
|
|
methods:{
|
initData() {
|
var me = this;
|
this.getTreeData()
|
// this.onQuery(function(result, callback) {//查询后的回调,用于获取字段的
|
// if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
|
// var metas = clone(result.meta[me.dataname].fields);
|
// var filterFields_ = [];
|
// var tableFields_ = [];
|
|
// metas.map(f=>{
|
// f.isshow = "T";
|
|
// if (f.isfilter) {
|
// filterFields_.push(clone(f));
|
// }
|
// else {
|
// var filter_f = clone(f);
|
// filter_f.isshow = "F";
|
// filterFields_.push(filter_f);
|
// }
|
|
// tableFields_.push(clone(f));
|
// })
|
// if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
|
// me.filterFields = clone(filterFields_);
|
// me.tableFields = clone(tableFields_);
|
|
// //字段数组转字段obj
|
// me.fieldsToFieldsObj();
|
|
// //设置字段事件
|
// me.tableFieldClick();
|
// }
|
// }
|
|
// if (callback) {
|
// callback();
|
// }
|
|
// me.getProductMeta();
|
// });
|
},
|
filterNode(value, data) {
|
if (!value) return true;
|
return data.name.indexOf(value) !== -1;
|
},
|
getTreeData() {
|
var me = this;
|
let params = {
|
dataname: this.dataname,
|
}
|
|
Server.call("root/data/getEntitySet", params, function(result) {
|
console.log(result)
|
|
if (!result || !result.data || !result.data.entityset) {
|
return
|
}
|
|
let data = result.data.entityset
|
|
let defualtClickNodeId;
|
|
if (data.length > 0) {
|
var treeData_ = ArrayToTree(clone(data), "name", "parent_id");
|
treeData_ = treeData_.map(e => me.setTreeData(e))
|
me.treeData = clone(treeData_);
|
defualtClickNodeId = me.defualtClickNodeId(me.treeData)
|
}
|
|
me.$nextTick(() => {
|
me.$refs.tree.setCurrentKey(defualtClickNodeId)
|
})
|
|
me.clickNode({id: defualtClickNodeId}, {isLeaf: true})
|
})
|
},
|
setTreeData(e) {
|
let haveChildren = Array.isArray(e.children) && e.children.length > 0
|
|
let remark = e.remark? " (" + e.remark + ")" : ""
|
let type_name = e.type_name? " (" + e.type_name + ")" : ""
|
|
if (e.short_name) {
|
e.name = e.short_name + remark + type_name
|
}
|
else if (e.remark) {
|
e.name = e.remark
|
}
|
else {
|
e.name = "空岗"
|
}
|
e.children = haveChildren? e.children.map(i => this.setTreeData(i)) : []
|
|
return e
|
},
|
// get 默认选中节点id
|
defualtClickNodeId(treeData) {
|
let defualtClickNodeId = ""
|
|
let forFn = function (arr) {
|
if (arr && arr.length > 0) {
|
defualtClickNodeId = arr[0].id
|
|
if (arr[0].children) {
|
forFn(arr[0].children)
|
}
|
}
|
}
|
forFn(treeData)
|
|
return defualtClickNodeId
|
},
|
|
// 树节点点击
|
clickNode(data, node, tree) {
|
this.filterObj.name = ""
|
this.filterObj.code = ""
|
|
/* if (node.isLeaf) {
|
this.formAttr.disabled = false
|
}
|
else {
|
this.formAttr.disabled = true
|
} */
|
|
this.selectNode = {
|
data: data,
|
node: node,
|
tree, tree
|
};
|
this.paramObjBydefault = {position_id: data.id};
|
|
this.getEmployeeInfo(data, node, tree);
|
// this.onInitFilter();
|
},
|
// 获取岗位信息
|
getEmployeeInfo(data, node, tree) {
|
var me = this;
|
let parames = {
|
dataname: this.dataname,
|
id: data.id
|
}
|
me.formData = {}
|
Server.call("root/data/getEntity", parames, function(result) {
|
console.log(result);
|
if (result && result.data) {
|
me.formData = result.data[me.dataname];
|
}
|
me.onInitFilter();
|
});
|
},
|
|
// 获取查询经销商列表filter
|
getQueryCustomerFilter() {
|
var me = this;
|
let filterStr = ""
|
if (me.formData.province && me.formData.province.length > 0) {
|
me.formData.province.map(e => {
|
if (!filterStr) {
|
filterStr = "'" + e + "'"
|
}
|
else {
|
filterStr += ",'" + e + "'"
|
}
|
})
|
}
|
|
if (filterStr) {
|
return "1=1 and province in (" + filterStr + ")"
|
}
|
else if (me.formData.name && me.formData.name == "全国") {
|
return "1=1"
|
}
|
else {
|
return null
|
}
|
},
|
// 获取经销商列表
|
getCustomerList() {
|
var me = this;
|
var filter = " 1=1 ";
|
// let filter = me.getQueryCustomerFilter()
|
|
// if (!filter) {
|
// me.tableData = []
|
|
// return
|
// }
|
|
// if (me.filterObj.province) {
|
// filter += " and province = '" + me.filterObj.province + "'"
|
// }
|
// if (me.filterObj.code) {
|
// filter += " and code = '" + me.filterObj.code + "'"
|
// }
|
|
let parames = {
|
dataname: "md_hospital_level",
|
filter: filter,
|
position_id: me.formData.id,
|
orderby: "md_hospital.code",
|
page: {
|
pageno: this.pagenum_p,
|
pagesize: this.pagesize_p
|
},
|
}
|
Server.call("root/data/getEntitySet", parames, function(result) {
|
console.log(result);
|
if (!result || !result.data || !result.data.entityset) {
|
return
|
}
|
result.data.entityset.map(p=>{
|
p.field4 = 10000
|
p.field5 = 12000
|
p.field6 = 11000
|
p.field7 = (p.field6 - p.field4) / p.field4 * 100
|
|
})
|
me.tableData_p = result.data.entityset
|
});
|
},
|
|
onInitFilter: function() {
|
this.filterObj.name = "";
|
this.filterObj.code = "";
|
this.getCustomerList()
|
// this.onQuery()
|
},
|
|
|
|
getProductMeta() {
|
var me = this;
|
var param_ = {
|
dataname: this.dataname_p,
|
attachMeta: true,
|
}
|
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
if (result.meta && result.meta[me.dataname_p] && result.meta[me.dataname_p].fields) {
|
var metas = clone(result.meta[me.dataname_p].fields);
|
var filterFields_ = [];
|
var tableFields_ = [];
|
|
metas.map(f=>{
|
f.isshow = "T";
|
tableFields_.push(clone(f));
|
})
|
if (!me.tableFields_p || (me.tableFields_p && me.tableFields_p.length == 0)) {
|
me.tableFields_p = clone(tableFields_);
|
}
|
}
|
|
me.tableDataAfter_p();
|
})
|
},
|
|
tableDataAfter_p() {
|
var me = this;
|
if (this.tableFields_p.length > 0){
|
this.isRefresh_p = false;
|
this.$nextTick(function(){
|
this.isRefresh_p = true;
|
this.$nextTick(function(){
|
var el_list = [];
|
me.tableHeight_p = setpageHeight(me.$refs.table_p.$el, el_list, me.tableData.length, 5);
|
})
|
})
|
}
|
},
|
|
onTableDataAfter() {
|
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//筛选字段事件设置
|
this.filterfieldClick = {
|
product_code: {//字段事件设置
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
Root.message({
|
type: 'success',
|
message: '弹窗点击事件'
|
});
|
}
|
},
|
visible: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉展开事件'
|
});
|
}
|
},
|
select: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
input: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
},
|
};
|
//表格字段事件设置
|
this.tablefieldClick = {
|
product_code: {//字段事件设置
|
val: {//有值时的点击事件
|
notclick_val: "",//不可点击的值,1、是数组["11","22"];2、以“;”分隔的字符串"111;222"
|
notclick_bindfield: [],//当该字段值等于指定字段值时不可点击["filterfield": "111"]
|
onclick: function(obj) {//数据值点击事件
|
Root.message({
|
type: 'success',
|
message: obj.val + '点击事件'
|
});
|
},
|
},
|
defaultval: {
|
val: "查看",//空值时的显示值
|
onclick: function(obj) {//默认值点击事件,此事件需要设置val才有效
|
Root.message({
|
type: 'success',
|
message: '默认值点击事件'
|
});
|
}
|
},
|
suffixval: {
|
// val: "详情",//有值时的后缀,此后缀和单位后缀不同,如:详情,更多,查看等
|
// onclick: function(obj) {//有值时的后缀点击事件,此事件需要设置val才有效
|
// //打开
|
// me.opentest()
|
// }
|
},
|
popup: {
|
onclick: function(obj) {//弹窗点击事件
|
Root.message({
|
type: 'success',
|
message: '弹窗点击事件'
|
});
|
}
|
},
|
visible: {
|
onchange: function(obj) {//下拉展开事件
|
Root.message({
|
type: 'success',
|
message: '下拉展开事件'
|
});
|
}
|
},
|
select: {
|
onchange: function(obj) {//下拉更改事件
|
Root.message({
|
type: 'success',
|
message: '下拉更改事件'
|
});
|
}
|
},
|
input: {
|
onchange: function(obj) {//输入更改事件
|
Root.message({
|
type: 'success',
|
message: '输入更改事件'
|
});
|
}
|
},
|
|
|
},
|
};
|
},
|
|
opentest() {
|
var me = this;
|
Root.message({
|
type: 'success',
|
message: '后缀点击事件'
|
});
|
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "900px",
|
icon: "icon-product",
|
text: "表单样例页面",
|
id: "test_page",//totab: true时需设置,用于判断是否已打开此页面
|
//url: "module/system/page/coming.html",
|
url: "module/system/page/sample/sample_form.html",
|
data: {},
|
delta: {},
|
sceneCode: "edit", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
node_isShow(data, isShow) {
|
if (this.$refs[data.id]) {
|
this.$refs[data.id].style.display = isShow ? '' : 'none';
|
}
|
},
|
|
handleNodeClick(data, node, el) {
|
var val = data.name;
|
if (data.children && data.children.length) {
|
val = "";
|
data.children.map(r=>{
|
if (val == "") {
|
val = r.name;
|
}
|
else {
|
val += "','" + r.name;
|
}
|
})
|
}
|
|
// this.filterObjBydefault.category_name = val
|
this.selectedrow = data;
|
this.pagenum_p = 1;
|
this.getNodeData();
|
},
|
|
rowClick(obj) {
|
this.selectedrow = obj.row;
|
this.pagenum_p = 1;
|
this.getNodeData();
|
},
|
|
onQueryAfter() {
|
this.pagenum_p = 1;
|
this.tableData_p = [];
|
this.total_p = 0;
|
},
|
|
getData_p(page) {
|
this.pagesize_p = page.pagesize;
|
this.pagenum_p = page.pagenum;
|
|
this.getNodeData();
|
},
|
|
getNodeData() {
|
var me = this;
|
if (!this.selectedrow.id) {
|
return
|
}
|
var filter_ = "store_condition='" + this.selectedrow.name + "'"
|
var param_ = {
|
dataname: this.dataname_p,
|
filter: filter_,
|
orderby: "name",
|
page: {
|
pageno: this.pagenum_p,
|
pagesize: this.pagesize_p
|
},
|
}
|
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
if (result && result.data && result.data.entityset) {
|
var data_ = result.data.entityset;
|
me.tableData_p = data_;
|
me.total_p = result.data.page.recordcount;
|
}
|
else {
|
me.total_p = 0;
|
}
|
})
|
},
|
|
|
targetAllocation() {
|
var me = this;
|
var config = {
|
totab: true, //true: 以Tab导航的方式打开
|
width: "900px",
|
height: "900px",
|
icon: "icon-product",
|
text: "指标分配",
|
id: "targetAllocation",//totab: true时需设置,用于判断是否已打开此页面
|
//url: "module/system/page/coming.html",
|
url: "module/performance/page/target/targetAllocation.html",
|
data: {},
|
delta: {},
|
sceneCode: "edit", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.onQuery();
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
|
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
.el-tabs__nav-scroll {
|
overflow: hidden;
|
position: relative;
|
padding-left: 20px;
|
}
|
|
.el-badge__content.is-fixed {
|
position: absolute;
|
top: 8px;
|
right: 5px;
|
-webkit-transform: translateY(-50%) translateX(100%);
|
transform: translateY(-50%) translateX(100%);
|
}
|
|
.el-badge__content {
|
background-color: #F56C6C;
|
border-radius: 10px;
|
color: #FFF;
|
display: inline-block;
|
font-size: 10px;
|
height: 14px;
|
line-height: 14px;
|
padding: 0 4px;
|
text-align: center;
|
white-space: nowrap;
|
border: 1px solid #FFF;
|
}
|
|
.el-badge {
|
position: relative;
|
vertical-align: baseline;
|
display: inline-block;
|
}
|
</style>
|
|
<style>
|
/* .z_menu_tree .el-button--mini{
|
padding-left: 2px;
|
padding-right: 2px;
|
font-size: 14px !important;
|
}
|
|
.z_left_menu_tree .el-tree-node__content {
|
display: -webkit-box;
|
display: -ms-flexbox;
|
display: flex;
|
-webkit-box-align: center;
|
-ms-flex-align: center;
|
align-items: center;
|
height: 32px;
|
line-height: 32px;
|
font-size: 14px;
|
color: #303133;
|
padding: 0px;
|
list-style: none;
|
cursor: pointer;
|
position: relative;
|
transition: border-color .3s, background-color .3s, color .3s;
|
box-sizing: border-box;
|
white-space: nowrap;
|
overflow: hidden;
|
background-color: #fff;
|
} */
|
|
|
.el-dialog__body{
|
border-top: 1px solid #E4E7ED;
|
border-bottom: 1px solid #E4E7ED;
|
padding: 20px;
|
}
|
</style>
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div class="topbar">
|
<span>{{title}}</span>
|
|
<div style="margin-right: 18px;float: right;">
|
<el-button-group style="margin-left: 3px">
|
<el-button type="primary" @click="":icon="buttonsconfig.import.icon">{{buttonsconfig.import.name}}</el-button>
|
<el-button @click="targetAllocation" icon="el-icon-sort-down">指标分解</el-button>
|
</el-button-group>
|
</div>
|
</div>
|
|
<div class="h_dialog__body">
|
<div style="position: absolute;left: 10px; top:45px;width: 320px; bottom: 10px;border: 1px solid #ccc;overflow: auto;">
|
<div style="height: 32px;line-height: 32px;border-bottom: 1px solid #ccc ;">
|
<span style="font-size: 14px;margin-left: 20px;">员工列表</span>
|
</div>
|
<div style=" position: relative; height: 52px; box-sizing: border-box;">
|
<el-input
|
placeholder="输入搜索字"
|
v-model="filterText"
|
style="position: absolute; top:10px; left: 20px; right: 80px; width: auto;">
|
</el-input>
|
<div style="position: absolute; top:10px; right: 20px;">
|
<el-button @click="filterText = ''">清空</el-button>
|
</div>
|
</div>
|
<div class="z_left_menu_tree" :style="{padding: '10px 0', height: tableHeight2 + 'px', overflow: 'auto' }">
|
<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="clickNode"
|
>
|
</el-tree>
|
</div>
|
</div>
|
<div style="position: absolute;left: 340px; top:45px; right: 10px; bottom: 10px;border: 1px solid #ccc;">
|
<div>
|
<div style="height: 32px; border-bottom: 1px solid #ccc; line-height: 32px;">
|
<div class="table_title" style="float: left;">
|
<span>指标</span>
|
</div>
|
<!-- <div style="float: right;">
|
<el-button-group style="margin-left: 3px">
|
<el-button @click="":icon="buttonsconfig.add.icon">{{buttonsconfig.add.name}}</el-button>
|
<el-button
|
:disabled="!(selectedrow.id && (selectedrow.state_code == 'Input' || selectedrow.state_code == 'Rejected'))"
|
@click="" :icon="buttonsconfig.edit.icon">{{buttonsconfig.edit.name}}
|
</el-button>
|
<el-button
|
:disabled="!(selectedrow.id && (selectedrow.state_code == 'Input' || selectedrow.state_code == 'Rejected'))"
|
type = "danger"
|
@click="" :icon="buttonsconfig.delete.icon">{{buttonsconfig.delete.name}}
|
</el-button>
|
</el-button-group>
|
</div> -->
|
</div>
|
|
<div class="query-bar">
|
<h-form-filter ref="form1"
|
:form-attr="filterAttr"
|
:table-fields="filterFields"
|
:form-data="filterObj"
|
:table-field-click="filterfieldClick"
|
:isdraggableorder="false"
|
|
v-on:on-query="onQuery"
|
v-on:on-init-query="onInitFilter"
|
>
|
</h-form-filter>
|
</div>
|
|
<h-table
|
v-if="isRefresh_p"
|
ref="table_p"
|
:table-fields="tableFields_p"
|
:table-data="tableData_p"
|
:pagesize="pagesize_p"
|
:pagenum="pagenum_p"
|
:total="total_p"
|
:table-height="tableHeight_p - 60"
|
:is-highlight-row="true"
|
|
v-on:get-data="getData_p"
|
>
|
</h-table>
|
|
</div>
|
</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>
|
|
</body>
|
</html>
|