<!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 = [
|
{id: "css_m1", type: "css", url: "root/css/tree.css"},
|
];
|
window.top.initJsCss(document, jscss_urls, callback);
|
};
|
|
function initVue() {
|
new TreeVue({
|
el: "#vbody",
|
data: {
|
dataname: "md_product_category",
|
title: "我的审批",
|
tree_title: "审批类型",
|
treeTxtFormatter: "{name}",
|
isTreeReadonly: true,
|
dataRequest: [],
|
|
initTreeData_d: [
|
{id: "C0", name: "商业审批",
|
children: [
|
{id: "C1", name: "商业创建审批", dataname: "md_org_data", filtertxt: "state_code='UnderApproval' and state_detail_code='UnderMasterApproval'", orderby: "update_time desc", pageurl: "module/md/page/customer/page/customer_edit.html"},
|
{id: "C2", name: "商业开户商务审批", dataname: "md_org_account", filtertxt: "state_code='WaitOpen' and state_detail_code in ('BusinessApproval')", orderby: "update_time desc", pageurl: "module/md/page/customer/page/customer_acct.html"},
|
{id: "C4", name: "商业开户财务审批", dataname: "md_org_account", filtertxt: "state_code='WaitOpen' and state_detail_code='FinancialApproval'", orderby: "update_time desc", pageurl: "module/md/page/customer/page/customer_acct.html"},
|
{id: "C5", name: "商业开户QA审批", dataname: "md_org_account", filtertxt: "state_code='WaitOpen' and state_detail_code='QualityAssuranceApproval'", orderby: "update_time desc", pageurl: "module/md/page/customer/page/customer_acct.html"},
|
{id: "C8", name: "商业开户审批", dataname: "md_org_account", filtertxt: "state_code='UnderApproval' and state_detail_code='UnderOpenApproval'", orderby: "update_time desc", pageurl: "module/md/page/customer/page/customer_acct.html"},
|
{id: "C3", name: "商业变更审批", dataname: "md_org_account", filtertxt: "state_code='UnderApproval' and state_detail_code='UnderChangeApproval'", orderby: "update_time desc"},
|
{id: "C7", name: "商业关户审批", dataname: "md_org_account", filtertxt: "state_code='UnderApproval' and state_detail_code='UnderCloseApproval'", orderby: "update_time desc", pageurl: "module/md/page/customer/page/customer_close.html"},
|
// {id: "C8", name: "商业指标审批", dataname: "md_target_dealer", filtertxt: "state_code='UnderApproval'", orderby: "update_time desc", pageurl: "module/target/page/customer_target_info.html"},
|
// {id: "C5", name: "商业授权审批"},
|
// {id: "C6", name: "商业协议审批"},
|
]
|
},
|
{id: "H0", name: "医院审批",
|
children: [
|
// {id: "H1", name: "医院库审批", dataname: "md_terminal", filtertxt: "state_code='UnderApproval'", orderby: "update_time desc", pageurl: "module/md/page/customer/page/customer_acct.html"},
|
{id: "H2", name: "医院库变更审批", dataname: "md_terminal", filtertxt: "state_code='UnderApproval'", orderby: "update_time desc", pageurl: "module/md/page/terminal/page/hospital_list_warehouse_info.html"},
|
// {id: "H3", name: "目标医院审批", dataname: "md_hospital", filtertxt: "state_code='UnderApproval'", orderby: "update_time desc", pageurl: "module/md/page/terminal/page/hospital_list_info.html"},
|
// {id: "H4", name: "医院指标审批", dataname: "md_target_hospital", filtertxt: "state_code='UnderApproval'", orderby: "update_time desc", pageurl: "module/md/page/terminal/page/terminal_target_info.html"},
|
]
|
},
|
{id: "O0", name: "订单审批",
|
children: [
|
{id: "O1", name: "普通订单审批", dataname: "general_sales_order", filtertxt: "state_code='UnderApproval' and type_code = '30-01'", orderby: "update_time desc", pageurl: "module/order/page/porder_general_info.html"},
|
{id: "O2", name: "直销订单审批", dataname: "direct_sales_order", filtertxt: "state_code='UnderApproval' and type_code in ('30-04', '30-Cxx-03')", orderby: "update_time desc", pageurl: "module/order/page/direct_order_list_info.html"},
|
{id: "O3", name: "折扣订单审批", dataname: "discount_order", filtertxt: "state_code='UnderApproval' and type_code in ('30-Cxx-01', '30-Cxx-02', '30-Cxx-04')", orderby: "update_time desc", pageurl: "module/order/page/discount_order_list_info.html"},
|
|
// {id: "O1", name: "采购订单审批"},
|
// {id: "O5", name: "寄售订单审批"},
|
]
|
},
|
// {id: "Z0", name: "植入审批",
|
// children: [
|
// // {id: "Z1", name: "植入上报审批"},
|
// // {id: "Z2", name: "销量上报审批"},
|
// // {id: "Z3", name: "植入撤销审批"},
|
// ]
|
// },
|
{id: "I0", name: "库存审批",
|
children: [
|
{id: "I1", name: "库存调整审批", dataname: "wm_alter", filtertxt: "state_code='UnderApproval'", orderby: "update_time desc", pageurl: "module/inventory/page/adjustment_edit.html"},
|
// {id: "I2", name: "库存调拨审批"},
|
]
|
},
|
],
|
|
dataname_p: "md_product",
|
pagesize_p: 10,
|
pagenum_p: 1,
|
total_p: 0,
|
tableData_p: [],
|
tableFields_p: [],
|
isRefresh_p: true,
|
tableHeight_p: 100,
|
|
// filterfieldClick: {},
|
tablefieldClick: {},
|
},
|
created() {
|
let clientHeight = document.documentElement.clientHeight;
|
this.treeHeight = clientHeight - 120;
|
var currentcapacity = window.top.vue.userinfo.currentactor;
|
var dataRequest_ = {
|
name: "md_approval",
|
|
filter: "rolecode like '%" + currentcapacity.code + "%'",
|
// url: "root/data/totalcnt",
|
isnotoption: true,
|
}
|
this.dataRequest.push(dataRequest_);
|
},
|
|
mounted() {
|
var me = this;
|
//预加载数据
|
if (this.dataRequest && this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
// // console.log("预加载数据:", data);
|
me.dataRequestObj = data;
|
let md_approval_ = ArrayToTree(clone(data.md_approval), "name", "parent_id");
|
me.initTreeData_d = md_approval_;
|
|
|
var medataRequest_ = []
|
me.initTreeData_d.map(nodes=>{
|
if (nodes.children) {
|
nodes.children.map(node=>{
|
if (node.dataname) {
|
var dataRequest_ = {
|
name: node.id,
|
dataname: node.dataname,
|
paramsobj: {dataname: node.dataname, filter: node.filtertxt},
|
url: "root/data/totalcnt",
|
isnotoption: true,
|
}
|
medataRequest_.push(dataRequest_);
|
}
|
})
|
}
|
})
|
|
me.loadRequestData(medataRequest_, result, function(data2) {
|
var initTreeData_d_ = clone(me.initTreeData_d);
|
initTreeData_d_.map(nodes=>{
|
if (nodes.children) {
|
var isBadge_ = false;
|
nodes.children.map(node=>{
|
if (data2[node.id] && data2[node.id].data && data2[node.id].data.totalcnt) {
|
isBadge_ = true;
|
node.badgeval = data2[node.id].data.totalcnt
|
}
|
})
|
nodes.isBadge = isBadge_;
|
}
|
})
|
me.initTreeData_d = clone(initTreeData_d_);
|
me.initData();
|
// 以服务的方式调用的 Loading 需要异步关闭
|
me.$nextTick(() => {
|
hideLoading();
|
});
|
})
|
});
|
}
|
else {
|
this.initData(); // 以服务的方式调用的 Loading 需要异步关闭
|
this.$nextTick(() => {
|
hideLoading();
|
});
|
}
|
},
|
|
methods:{
|
initData() {
|
var me = this;
|
me.treeData = me.initTreeData_d;
|
// this.onQuery(function(result, callback) {//查询后的回调,用于获取字段的
|
// me.treeData = me.initTreeData_d;
|
// if (callback) {
|
// callback();
|
// }
|
|
// });
|
},
|
|
onNodeClick(obj) {
|
var data = obj.data, node = obj.node, el = obj.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.selectednode = data;
|
this.pagenum_p = 1;
|
if (this.selectednode.dataname) {
|
this.getTableMeta();
|
this.getDataByNode();
|
}
|
|
},
|
|
getDataByNode() {
|
var me = this;
|
if (!this.selectednode.id) {
|
return
|
}
|
var filter_ = "1=1"
|
if (this.selectednode.filtertxt) {
|
filter_ = this.selectednode.filtertxt;
|
}
|
var param_ = {
|
dataname: this.selectednode.dataname,
|
filter: filter_,
|
orderby: this.selectednode.orderby,
|
page: {
|
pageno: this.pagenum_p,
|
pagesize: this.pagesize_p
|
},
|
}
|
me.tableData_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;
|
}
|
})
|
},
|
|
getTableMeta() {
|
var me = this;
|
var param_ = {
|
dataname: this.selectednode.dataname,
|
attachMeta: true,
|
}
|
this.isRefresh_p = false;
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
if (result.meta && result.meta[me.selectednode.dataname] && result.meta[me.selectednode.dataname].fields) {
|
var metas = clone(result.meta[me.selectednode.dataname].fields);
|
var filterFields_ = [];
|
var tableFields_ = [];
|
|
metas.map(f=>{
|
f.isshow = "T";
|
if (f.field == "is_refresh"){
|
f.formatterjson = {true: "是", false: "否"};
|
}
|
tableFields_.push(clone(f));
|
})
|
// if (!me.tableFields_p || (me.tableFields_p && me.tableFields_p.length == 0)) {
|
// me.tableFields_p = clone(tableFields_);
|
// }
|
me.tableFields_p = clone(tableFields_);
|
}
|
|
me.tableDataAfter_p();
|
me.tableFieldClick();
|
})
|
},
|
|
onTableDataAfter() {
|
|
},
|
|
tableDataAfter_p() {
|
var me = this;
|
if (this.tableFields_p.length > 0){
|
this.$nextTick(function(){
|
this.isRefresh_p = true;
|
this.$nextTick(function(){
|
var el_list = [];
|
me.tableHeight_p = me.treeHeight;
|
})
|
})
|
}
|
},
|
|
tableFieldClick() {
|
var me = this;
|
|
//表格字段事件设置
|
this.tablefieldClick = {
|
state_name: {//状态
|
val: {
|
notclick_val: "",//不可点击的值
|
notclick_bindfield: [],
|
onclick: function(obj) {//数据值点击事件
|
var machine_code_ = me.selectednode.machine_code
|
if (!machine_code_) {
|
return
|
}
|
var config = {
|
totab: false, //true: 以Tab导航的方式打开
|
width: "1100px",
|
height: "520px",
|
icon: "icon-product",
|
text: "流程步骤",
|
id: "customer_acct" + obj.row.id,//totab: true时需设置,用于判断是否已打开此页面
|
url: "module/tool/page/popup_workflow_step_user.html?v=2023020703",
|
data: obj.row,
|
delta: {machine_code: machine_code_},
|
sceneCode: "browse",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(obj, callback) {
|
if (callback) {
|
callback();
|
}
|
}
|
};
|
me.doPopupByPublic(config);
|
},
|
},
|
},
|
|
};
|
},
|
|
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.getDataByNode();
|
},
|
|
rowClick(obj){
|
this.selectedrow = obj.row;
|
},
|
|
toApproval() {
|
let me = this;
|
var row = me.selectedrow;
|
if(!row){
|
Root.message({
|
type: 'warning',
|
message: '请选择一条数据'
|
});
|
return;
|
}
|
|
var config = {
|
totab: true, //true: 以Tab导航的方式打开
|
width: "1100px",
|
height: "520px",
|
icon: "icon-product",
|
text: me.selectednode.name + (row.name ? row.name : (row.code ? row.code : "")),
|
id: me.selectednode.id + row.id,//totab: true时需设置,用于判断是否已打开此页面
|
url: me.selectednode.pageurl,
|
data: row,
|
delta: me.selectednode,
|
sceneCode: "approval",//"refuseedit",//"approval", //"add"//"browse",
|
callback: function(obj, callback) {
|
me.getDataByNode();
|
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;
|
}
|
</style>
|
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div class="topbar">
|
<span>{{title}}</span>
|
|
<div style="float: right; margin-right: 18px;">
|
<el-button-group style="margin-left: 3px;">
|
<el-button :disabled="!(selectedrow && selectedrow.id)" type="primary" @click="toApproval":icon="buttonsconfig.approval.icon">{{buttonsconfig.approval.name}}</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;">
|
<div style="height: 32px;line-height: 32px;border-bottom: 1px solid #ccc ;">
|
<span style="font-size: 14px;margin-left: 20px;">{{tree_title}}</span>
|
</div>
|
<div :style="{padding: '10px 0', height: treeHeight + 'px', overflow: 'auto'}">
|
<h-tree
|
:tree-data="treeData"
|
:tree-txt-formatter="treeTxtFormatter"
|
:is-readonly="isTreeReadonly"
|
:default-expand-all="false"
|
|
@node-click="onNodeClick"
|
>
|
</h-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 #aaa;">
|
<div class="table_title" style="float: left;">
|
<span>审批列表</span>
|
</div>
|
</div>
|
<h-table
|
v-if="isRefresh_p && tableFields_p.length"
|
ref="table_p"
|
:table-fields="tableFields_p"
|
:table-data="tableData_p"
|
:pagesize="pagesize_p"
|
:pagenum="pagenum_p"
|
:total="total_p"
|
:table-height="tableHeight_p - 52"
|
:is-highlight-row="true"
|
:table-field-click="tablefieldClick"
|
|
v-on:get-data="getData_p"
|
v-on:row-click="rowClick"
|
>
|
</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>
|