<!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: "sys_capacity_target",
|
title: "角色列表",
|
|
default_filterFields: [
|
{isshow: "T", field: "name", name: "角色", filterfield:"", filteroperator: "like", type: ""},
|
],
|
tableFields: [
|
{field: "company_name", name: "公司", isshow: "T", align: "center"},
|
{field: "bu_name", name: "BU", isshow: "T", align: "center"},
|
{field: "name", name: "角色", isshow: "T", align: "center"},
|
{field: "position", name: "岗位", isshow: "T", align: "left"},
|
],
|
filterfieldClick: {},
|
tablefieldClick: {},
|
formfieldClick: {},
|
cid: "",
|
tid: "",
|
delid: "",
|
tableData: [],
|
saveDisabled: false,
|
tablebuttonClick: [],
|
tableHeight: 470,
|
},
|
created() {
|
|
this.popupParames = clone(Root.popupParames);
|
Root.setPopupTitle(this.title);
|
this.cid = this.popupParames.data.id;
|
this.tid = this.popupParames.data.code;
|
this.initData()
|
},
|
|
mounted() {
|
//获取数据
|
// this.initData();
|
|
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
},
|
|
methods:{
|
initData() {
|
var me = this;
|
me.tableButtonClick();
|
if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
|
me.filterFields = clone(me.default_filterFields)
|
}
|
let param = {
|
token: me.cid,
|
}
|
Server.call("root/client/getUser", param, function(result) {
|
var tableData_ = clone(me.tableData);
|
if(result.data.user.actors){
|
tableData_ = result.data.user.actors;
|
}
|
me.tableData = tableData_;
|
|
});
|
},
|
|
tableButtonClick() {
|
var me = this;
|
var tablebuttonClick = [];
|
tablebuttonClick = [
|
// {
|
// // name: "添加", // type: "primary", // icon: "el-icon-edit",
|
// isbuttonshow: true,
|
// code: "add", isselected: false, classname: "",
|
// onclick: function(obj) {
|
// // obj.selectedList
|
// me.onAddData();
|
// }
|
// },
|
// {
|
// // name: "删除", // type: "primary", // icon: "el-icon-edit",
|
// isbuttonshow: true, type: "danger",
|
// code: "delete", isselected: true, classname: "",
|
// onclick: function(obj) {
|
// // obj.selectedList
|
// // me.closeData('browse', obj.selectedList[0]);
|
// // me.closeData();
|
// }
|
// },
|
]
|
|
this.tablebuttonClick = clone(tablebuttonClick);
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//筛选字段事件设置
|
this.filterfieldClick = {
|
};
|
//表格字段事件设置
|
this.tablefieldClick = {
|
};
|
|
//表单字段事件设置
|
this.formfieldClick = {
|
};
|
},
|
|
closeDialog() {
|
var me = this;
|
if (me.popupParames.totab){
|
Root.tab.removeItem(Root.tab.selected);
|
Root.tab.open(me.popupParames.parentOption, false);
|
}
|
else {
|
Root.hidePopup();
|
}
|
},
|
|
onAddData(){
|
var me = this;
|
var delta_ = {};
|
if (me.tableData && me.tableData.length) {
|
delta_ = {
|
code:me.tableData[0].code,
|
};
|
}
|
|
var config = ({
|
totab: false, //true: 以Tab导航的方式打开
|
url: "module/config/page/capacity_list.html",
|
width: 950,
|
height: 650,
|
text: "新增角色",
|
sceneCode: "add",
|
delta: delta_,
|
callback: function(obj, callback) {
|
console.log(obj.row);
|
// formData_.target_id = obj.row.id;
|
// me.formData = formData_;
|
me.save(obj.row.id);
|
if (callback) {
|
callback();
|
}
|
}
|
});
|
|
me.doPopupByPublic(config);
|
},
|
|
save(id){
|
var me = this;
|
|
// var entity_ = clone(this.formData);
|
// var entity = {};
|
// for (var r in entity_) {
|
// if (entity_[r] != null) {
|
// entity[r] = entity_[r];
|
// }
|
// }
|
let param = {
|
dataname: this.dataname,
|
data: {},
|
}
|
|
var entity = {
|
capacity_id: id,
|
type_code: "User",
|
target_id: me.cid,
|
org_id: "OG00001",
|
}
|
|
param.data[this.dataname] = entity;
|
|
Server.call("root/data/saveEntity", param, function(result) {
|
if (result.success) {
|
Root.message({
|
type: 'success',
|
message: '保存成功'
|
});
|
me.saveDisabled = true;
|
me.initData();
|
}
|
});
|
},
|
|
rowClick(obj){
|
var me = this;
|
me.selectedrow = obj.row;
|
},
|
|
onDelData(){
|
let me = this;
|
var row = me.selectedrow;
|
let name_ = "该数据";
|
if (!this.dataname) {
|
Root.message({
|
type: 'warning',
|
message: '该事件需指定数据对象'
|
});
|
return
|
}
|
if (!row.id) {
|
Root.message({
|
type: 'warning',
|
message: '该事件需存在数据ID'
|
});
|
return
|
}
|
if (row.name) {
|
name_ = "_" + row.name + "_";
|
}
|
|
//检查该仓库是否被使用(是否存在库存,是否是移入仓库)
|
|
Root.confirm('确定删除' + name_ + '吗?', '删除提示', {
|
confirmButtonText: '删除',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
let param = {
|
id: me.delid,
|
dataname: this.dataname,
|
}
|
Server.call("root/data/deleteEntity", param, function(result) {
|
Root.message({
|
type: 'success',
|
message: '删除成功!'
|
});
|
me.initData();
|
});
|
}).catch(() => {
|
Root.message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
</style>
|
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" :style="{height: tableHeight + 'px', overflow: 'auto', padding: '0px 20px'}">
|
<h-table
|
v-if="isRefresh"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:is-edit-table-data="isEditTableData"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight - 20"
|
:table-field-click="tablefieldClick"
|
:tableloading="tableloading"
|
:table-buttons-click="tablebuttonClick"
|
:is-highlight-row="true"
|
|
:isdraggableorder="false"
|
:is-pagination="false"
|
:isfilterfield="false"
|
:isbasicfilterfields="false"
|
:istablebuttons="false"
|
|
v-on:get-data="getData"
|
v-on:edit-data="editData"
|
v-on:del-data="delData"
|
v-on:row-click="rowClick"
|
v-on:order-fields="orderTableFields"
|
>
|
</h-table>
|
</div>
|
|
<div class="el-dialog__footer">
|
<el-button size="small" type="default" @click="closeDialog">关 闭</el-button>
|
</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>
|