优化组织信息完成

This commit is contained in:
java110 2022-07-27 15:49:24 +08:00
parent 3ff8d98e99
commit 0ecb758e85
10 changed files with 478 additions and 22 deletions

View File

@ -0,0 +1,77 @@
<div id="addRoleStaffModel" class="modal fade" role="dialog" aria-labelledby="addRoleStaffModelLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="addRoleStaffModelLabel">
<span><vc:i18n name="员工" namespace="addRoleStaff"></vc:i18n></span>
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="row">
<div class="col-sm-7 m-b-xs">
</div>
<div class="col-sm-5">
<div class="input-group">
<input :placeholder="vc.i18n('输入员工名称','addRoleStaff')" type="text" v-model="addRoleStaffInfo.staffName" class="form-control form-control-sm">
<span class="input-group-append">
<button type="button" class="btn btn-sm btn-primary"
v-on:click="queryStaffs()"><span><vc:i18n name="查询" namespace="addRoleStaff"></vc:i18n></span></button>
</span>
</div>
</div>
</div>
<div class="table-responsive" style="margin-top:15px">
<table class="table table-striped">
<thead>
<tr>
<th class="text-center">
<input type="checkbox" class="i-checks " @click="checkAll($event)" id="quan">
</th>
<th class="text-center">
<span><vc:i18n name="员工编号" namespace="addRoleStaff"></vc:i18n></span></th>
<th class="text-center">
<span><vc:i18n name="员工名称" namespace="addRoleStaff"></vc:i18n></span>
</th>
<th class="text-center">
<span><vc:i18n name="员工地址" namespace="addRoleStaff"></vc:i18n></span>
</th>
</tr>
</thead>
<tbody>
<tr v-for="staff in addRoleStaffInfo.staffs">
<td class="text-center">
<input type="checkbox" class="i-checks checkItem" v-bind:value="staff.userId" v-model="addRoleStaffInfo.selectStaffs">
</td>
<td class="text-center">{{staff.userId}}</td>
<td class="text-center">{{staff.name}}</td>
<td class="text-center">{{staff.address}}</td>
</tr>
</tbody>
</table>
<!-- 分页 -->
<vc:create namespace="addRoleStaff" path="frame/paginationPlus"></vc:create>
<div class="ibox-content" v-if="addRoleStaffInfo.staffs.length > 0">
<button class="btn btn-primary float-right" type="button" v-on:click="addRoleStaff()"><i
class="fa fa-check"></i>&nbsp;提交
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal"><span><vc:i18n name="取消" namespace="addRoleStaff"></vc:i18n></span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,138 @@
(function(vc) {
var DEFAULT_ROWS = 10
vc.extends({
propTypes: {
emitListener: vc.propTypes.string,
emitFunction: vc.propTypes.string
},
data: {
addRoleStaffInfo: {
staffs: [],
staffName: '',
roleId: '',
orgName: '',
selectStaffs: []
}
},
watch: { // 监视双向绑定的数据数组
checkData: {
handler() { // 数据数组有变化将触发此函数
if (vc.component.addRoleStaffInfo.selectStaffs.length == vc.component.addRoleStaffInfo.staffs.length) {
document.querySelector('#quan').checked = true;
} else {
document.querySelector('#quan').checked = false;
}
},
deep: true // 深度监视
}
},
_initMethod: function() {},
_initEvent: function() {
vc.on('addRoleStaff', 'openAddRoleStaffModal', function(_param) {
vc.component._refreshChooseOrgInfo();
$('#addRoleStaffModel').modal('show');
vc.copyObject(_param, vc.component.addRoleStaffInfo);
vc.component._loadAllStaffInfo(1, 10, '');
});
vc.on('addRoleStaff', 'paginationPlus', 'page_event', function(_currentPage) {
vc.component._loadAllStaffInfo(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_loadAllStaffInfo: function(_page, _row, _name) {
let param = {
params: {
page: _page,
row: _row,
userName: _name,
roleId: vc.component.addRoleStaffInfo.roleId
}
};
//发送get请求
vc.http.apiGet('/role.listStaffsNoRole',
param,
function(json) {
var _staffInfo = JSON.parse(json);
vc.component.addRoleStaffInfo.staffs = _staffInfo.data;
vc.emit('addRoleStaff', 'paginationPlus', 'init', {
total: _staffInfo.records,
currentPage: _page
});
},
function() {
console.log('请求失败处理');
}
);
},
addRoleStaff: function(_org) {
var _selectStaffs = vc.component.addRoleStaffInfo.selectStaffs;
var _tmpStaffs = vc.component.addRoleStaffInfo.staffs;
if (_selectStaffs.length < 1) {
vc.toast("请选择小区");
return;
}
let _staffs = [];
for (var _selectIndex = 0; _selectIndex < _selectStaffs.length; _selectIndex++) {
for (var _staffIndex = 0; _staffIndex < _tmpStaffs.length; _staffIndex++) {
if (_selectStaffs[_selectIndex] == _tmpStaffs[_staffIndex].userId) {
_staffs.push({
staffId: _tmpStaffs[_staffIndex].userId,
staffName: _tmpStaffs[_staffIndex].userName
});
}
}
}
let _objData = {
roleId: vc.component.addRoleStaffInfo.roleId,
orgName: vc.component.addRoleStaffInfo.orgName,
staffs: _staffs
}
vc.http.apiPost('/role.saveRoleStaff',
JSON.stringify(_objData), {
emulateJSON: true
},
function(json, res) {
$('#addRoleStaffModel').modal('hide');
let _json = JSON.parse(json)
if (_json.code == 0) {
vc.emit($props.emitListener, $props.emitFunction, {});
return;
}
vc.toast(_json.msg);
},
function() {
console.log('请求失败处理');
}
);
$('#addRoleStaffModel').modal('hide');
},
queryStaffs: function() {
vc.component._loadAllStaffInfo(1, 10, vc.component.addRoleStaffInfo.staffName);
},
_refreshChooseOrgInfo: function() {
vc.component.addRoleStaffInfo = {
staffs: [],
staffName: '',
roleId: '',
orgName: '',
selectStaffs: []
};
},
checkAll: function(e) {
var checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
if (e.target.checked) { // 判定全选checkbox的勾选状态
for (var i = 0; i < checkObj.length; i++) {
if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中
vc.component.addRoleStaffInfo.selectStaffs.push(checkObj[i].value);
}
}
} else { // 如果是去掉全选则清空checkbox选项绑定数组
vc.component.addRoleStaffInfo.selectStaffs = [];
}
}
}
});
})(window.vc);

View File

@ -0,0 +1,21 @@
<div class="modal fade" id="deleteRoleStaffModel" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><span><vc:i18n name="请确认您的操作" namespace="deleteRoleStaff"></vc:i18n></span>!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<tr align="center">
<th><span><vc:i18n name="确定取消授权" namespace="deleteRoleStaff"></vc:i18n></span></th>
</tr>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" v-on:click="closeDeleteRoleStaffModel()"><span><vc:i18n name="点错了" namespace="deleteRoleStaff"></vc:i18n></span></button>
<button type="button" class="btn btn-primary" v-on:click="deleteRoleStaff()"><span><vc:i18n name="确认删除" namespace="deleteRoleStaff"></vc:i18n></span></button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,49 @@
(function(vc, vm) {
vc.extends({
data: {
deleteRoleStaffInfo: {
}
},
_initMethod: function() {
},
_initEvent: function() {
vc.on('deleteRoleStaff', 'openDeleteRoleStaffModal', function(_params) {
vc.component.deleteRoleStaffInfo = _params;
$('#deleteRoleStaffModel').modal('show');
});
},
methods: {
deleteRoleStaff: function() {
vc.http.apiPost(
'/role.deleteRoleStaff',
JSON.stringify(vc.component.deleteRoleStaffInfo), {
emulateJSON: true
},
function(json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
//关闭model
$('#deleteRoleStaffModel').modal('hide');
vc.emit('roleStaffInfo', 'listRoleStaff', {});
return;
}
vc.toast(json);
},
function(errInfo, error) {
console.log('请求失败处理');
vc.toast(json);
});
},
closeDeleteRoleStaffModel: function() {
$('#deleteRoleStaffModel').modal('hide');
}
}
});
})(window.vc, window.vc.component);

View File

@ -0,0 +1,82 @@
<div class=" margin-top">
<div class="row">
<div class="col-sm-2">
<div class="form-group">
<input type="text" :placeholder="vc.i18n('请填写员工名称','org')" v-model="roleStaffInfo.staffName" class="form-control form-control-sm">
</div>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryRoleStaffMethod()">
<i class="fa fa-search"></i> <span>
<vc:i18n name="查询" namespace="room"></vc:i18n>
</span>
</button>
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddRoleStaffModal()">
<span>
<vc:i18n name="关联员工"></vc:i18n>
</span>
</button>
</div>
</div>
</div>
<table class="footable table table-stripped toggle-arrow-tiny margin-top" data-page-size="15">
<thead>
<tr>
<th class="text-center">
<span><vc:i18n name="名称" namespace="staff"></vc:i18n></span>
</th>
<th class="text-center">
<span><vc:i18n name="手机号" namespace="staff"></vc:i18n></span>
</th>
<th class="text-center">
<span><vc:i18n name="邮箱" namespace="staff"></vc:i18n></span>
</th>
<th class="text-center">
<span><vc:i18n name="地址" namespace="staff"></vc:i18n></span>
</th>
<th class="text-center">
<span><vc:i18n name="性别" namespace="staff"></vc:i18n></span>
</th>
<th class="text-center">
<span><vc:i18n name="操作" namespace="staff"></vc:i18n></span>
</th>
</tr>
</thead>
<tbody>
<tr v-for="staff in roleStaffInfo.staffs">
<td class="text-center">{{staff.name}}</td>
<td class="text-center">{{staff.tel}}</td>
<td class="text-center">{{staff.email}}</td>
<td class="text-center">{{staff.address}}</td>
<td class="text-center">{{staff.sex == 0 ? '男' : '女'}}</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openDeleteRoleStaffModel(staff)">
<span>
<vc:i18n name="删除"></vc:i18n>
</span>
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
<vc:create path="frame/addRoleStaff" emitListener="roleStaffInfo" emitFunction="listRoleStaff">
</vc:create>
<vc:create path="frame/deleteRoleStaff"></vc:create>
</div>

View File

@ -0,0 +1,84 @@
/**
入驻小区
**/
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
var ALL_ROWS = 100;
vc.extends({
data: {
roleStaffInfo: {
staffs: [],
total: 0,
records: 1,
moreCondition: false,
pgId: '',
staffName: '',
}
},
_initMethod: function() {
},
_initEvent: function() {
vc.on('roleStaffInfo', 'openRoleStaff', function(_param) {
vc.copyObject(_param, vc.component.roleStaffInfo);
vc.component._listRoleStaffs(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('roleStaffInfo', 'listRoleStaff', function(_param) {
//vc.copyObject(_param, vc.component.roleStaffInfo.conditions);
vc.component._listRoleStaffs(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function(_currentPage) {
vc.component._listRoleStaffs(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listRoleStaffs: function(_page, _rows) {
let param = {
params: {
page: _page,
row: _rows,
roleId: vc.component.roleStaffInfo.pgId,
userName: $that.roleStaffInfo.staffName
}
};
//发送get请求
vc.http.apiGet('/role.listRoleStaff',
param,
function(json, res) {
var _roleStaffInfo = JSON.parse(json);
vc.component.roleStaffInfo.total = _roleStaffInfo.total;
vc.component.roleStaffInfo.records = _roleStaffInfo.records;
vc.component.roleStaffInfo.staffs = _roleStaffInfo.data;
vc.emit('pagination', 'init', {
total: vc.component.roleStaffInfo.records,
dataCount: vc.component.roleStaffInfo.total,
currentPage: _page
});
},
function(errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddRoleStaffModal: function() {
vc.emit('addRoleStaff', 'openAddRoleStaffModal', {
roleId: vc.component.roleStaffInfo.pgId,
orgName: vc.component.roleStaffInfo.orgName
});
},
_openDeleteRoleStaffModel: function(_roleStaff) {
_roleStaff.roleId = $that.roleStaffInfo.pgId;
vc.emit('deleteRoleStaff', 'openDeleteRoleStaffModal', _roleStaff);
},
_queryRoleStaffMethod: function() {
vc.component._listRoleStaffs(DEFAULT_PAGE, DEFAULT_ROWS);
},
}
});
})(window.vc);

View File

@ -134,7 +134,7 @@
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json)
if (_json.code != 0) {
if (_json.code == 0) {
//关闭model
$('#editCarModal').modal('hide');
vc.emit('listOwnerCar', 'listOwnerCarData', {});

View File

@ -18,7 +18,10 @@
<vc:create path="frame/privilegeTree"></vc:create>
</div>
<div v-if="roleInfo.tabName == 'community'">
<vc:create path="frame/roleCOmmunity"></vc:create>
<vc:create path="frame/roleCommunity"></vc:create>
</div>
<div v-if="roleInfo.tabName == 'staff'">
<vc:create path="frame/roleStaff"></vc:create>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
(function (vc) {
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
@ -9,17 +9,17 @@
},
},
_initMethod: function () {
_initMethod: function() {
},
_initEvent: function () {
vc.on('role', 'switchRole', function (_param) {
_initEvent: function() {
vc.on('role', 'switchRole', function(_param) {
$that.roleInfo.curRole = _param;
$that._changeRoleTab('privilege')
})
},
methods: {
_changeRoleTab: function (_tabName) {
_changeRoleTab: function(_tabName) {
$that.roleInfo.tabName = _tabName;
if (_tabName == 'privilege') {
vc.emit('privilegeTree', 'loadPrivilege', $that.roleInfo.curRole.pgId);
@ -27,6 +27,10 @@
if (_tabName == 'community') {
vc.emit('roleCommunityInfo', 'openRoleCommunity', { pgId: $that.roleInfo.curRole.pgId });
}
if (_tabName == 'staff') {
vc.emit('roleStaffInfo', 'openRoleStaff', { pgId: $that.roleInfo.curRole.pgId });
}
}
},
});

View File

@ -5,8 +5,7 @@
<div class="ibox-title">
<h5><span><vc:i18n name="查询条件" namespace="listOwnerCar"></vc:i18n></span></h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-link btn-sm" style="margin-right:10px;"
v-on:click="_moreCondition()">{{listOwnerCarInfo.moreCondition == true ? '隐藏' : '更多'}}
<button type="button" class="btn btn-link btn-sm" style="margin-right:10px;" v-on:click="_moreCondition()">{{listOwnerCarInfo.moreCondition == true ? '隐藏' : '更多'}}
</button>
</div>
</div>
@ -25,7 +24,7 @@
<div class="col-sm-3">
<div class="form-group">
<select class="custom-select" v-model="listOwnerCarInfo.conditions.valid">
<option selected value="">{{vc.i18n('必填','listOwnerCar')}},请选择车位状态</option>
<option selected value="">{{vc.i18n('必填,请选择车位状态','listOwnerCar')}}</option>
<option value="1">{{vc.i18n('正常','listOwnerCar')}}</option>
<option value="3">{{vc.i18n('到期','listOwnerCar')}}</option>
<option value="2">{{vc.i18n('无车位','listOwnerCar')}}</option>
@ -69,8 +68,7 @@
<button type="button" class="btn btn-primary btn-sm" v-on:click="_addOwnerCar()">
<i class="fa fa-plus"></i> <span><vc:i18n name="添加" namespace="listOwnerCar"></vc:i18n></span>
</button>
<button type="button" class="btn btn-white btn-sm"
v-on:click="_openOwnerCarImport(null,true)">车辆导入
<button type="button" class="btn btn-white btn-sm" v-on:click="_openOwnerCarImport(null,true)">车辆导入
</button>
</div>
</div>
@ -141,7 +139,7 @@
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_toCarMember(car)" v-if="car.parkingType == '2'"><span><vc:i18n name="子母车辆" namespace="listOwnerCar"></vc:i18n></span>
</button>
</div>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_toPayFee(car)"><span><vc:i18n name="费用" namespace="listOwnerCar"></vc:i18n></span></button>
@ -153,16 +151,16 @@
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openDelOwnerCarModel(car)"><span><vc:i18n name="删除" namespace="listOwnerCar"></vc:i18n></span>
</button>
</div>
</td>
</tr>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="13">
<ul class="pagination float-right"></ul>
</td>
</tr>
<tr>
<td colspan="13">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
@ -174,4 +172,4 @@
<vc:create path="property/importOwnerCar"></vc:create>
<vc:create path="property/editCar" notifyLoadDataComponentName="listOwnerCar"></vc:create>
<vc:create path="property/deleteOwnerCar" notifyLoadDataComponentName="listOwnerCar"></vc:create>
</div>
</div>