| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- var _activiti_projectUser;
- function selectProjectUser(title, callback, width, height) {//根据projectUser选择用户
- $.post('userActivitiController.do?isProjectUser', {}, function (isProjectUser) {
- var url = 'activitiLeaveController.do?userWorkflow';
- if (isProjectUser == 'true') {
- url = 'correctionController.do?userWorkflow&type=leave&_checkbox=false';//包括兼容机构,不包括2级部门
- }
- ;
- selectUser(title, url, callback, width, height);
- })
- }
- function selectAllUser(title, callback, checkbox, width, height) {//所有用户,不包括离职用户
- if (!checkbox) {
- checkbox = 'false';
- }
- if (!width) {
- width = '700px';
- }
- if (!height) {
- height = '550px';
- }
- var url = 'publicpageController.do?userSelect&checkbox=' + checkbox;
- selectUser(title, url, callback, width, height);
- }
- function selectUserByDepart(departId, title, callback, width, height) {//根据部门选择用户
- if (!departId) {
- departId = $('#departId').val();
- if (!departId) {
- tip('请先选择组织机构');
- return;
- }
- }
- var url = 'publicpageController.do?userSelectSameAndSubDepart&departid=' + departId;
- selectUser(title, url, callback, width, height);
- }
- function selectAllUserByDepart(departId, title, callback, width, height) {//根据部门选择用户,包括离职人员
- if (!departId) {
- departId = $('#departId').val();
- if (!departId) {
- tip('请先选择组织机构');
- return;
- }
- }
- var url = 'publicpageController.do?userSelectSameAndSubDepart&departid=' + departId + "&includeLeave=true";
- selectUser(title, url, callback, width, height);
- }
- function selectUserByLoginUser(title, callback, width, height) {//根据登录用户选择所在部门用户
- var url = 'publicpageController.do?userSelectSameAndSubDepart&includeLeave=false';
- selectUser(title, url, callback, width, height);
- }
- function selectUser(title, url, callback, width, height) {
- if (!width) {
- width = '600px';
- }
- if (!height) {
- height = '350px';
- }
- if (!title) {
- title = "员工列表";
- }
- var _selectDialog = $.dialog({
- content: 'url:' + url
- , zIndex: getzIndex()
- , title: title, lock: true, width: width, height: height, opacity: 0.4, button: [
- {
- name: '确定', callback: function () {
- var iframe = _selectDialog.iframe.contentWindow;
- var selectedRows = iframe.getSelectedRow();
- if (selectedRows.length == 0) {
- iframe.tip('请选择员工');
- return false;
- }
- var one = selectedRows[0];
- var userid = one.id;
- var realName = one.realName;
- // 获取员工时,同时获取科室信息
- var orgCode = one.orgIds;
- //科室信息写入到页面
- $('#sysOrgCode').val(orgCode);
- $('#userid').val(userid);
- $('#realName').val(realName);
- if (callback) {
- callback(selectedRows);
- }
- }, focus: true
- },
- {
- name: '取消', callback: function () {
- }
- }
- ]
- }).zindex();
- }
- function clearUser(id, name) {
- if (!id) {
- id = "userid";
- }
- if (!name) {
- name = "realName";
- }
- $('#' + id).val('');
- $('#' + name).val('');
- }
- function selectUserDep(title, callback, width, height) {//选择用户组织结构 ,包括兼容机构
- var url = 'userActivitiDataController.do?depSelect';
- selectDep(title, url, callback, width, height);
- }
- function selectAllDepCheckbox(title, callback, width, height) {//选择所有组织结构
- var url = 'dialogDealController.do?projectDepartTableAllCheckbox&ids=';
- selectDep(title, url, function (rows) {
- var depIds = new Array();
- var depNames = new Array();
- for (var i = 0; i < rows.length; i++) {
- var one = rows[i];
- var depId = one.id;
- var depName = one.departName;
- depIds.push(depId);
- depNames.push(depName);
- }
- $('#departId').val(depIds.join(','));
- $('#depName').val(depNames.join(','));
- if (callback) {
- callback(rows);
- }
- }, width, height);
- }
- function selectAllDep(title, callback, width, height) {//选择所有组织结构
- //userWageController.do?projectDepartTableAll 财务的
- //var url='dialogDealController.do?projectDepartTablePartChild'; 根据登录用户选择部门,包括3级部门
- //publicpageController.do?projectSelect 项目 不包含部门
- var url = 'dialogDealController.do?projectDepartTableAll&ids=';
- selectDep(title, url, callback, width, height);
- }
- function clearDep(depId, depName) {
- if (!depId) {
- depId = "departId";
- }
- if (!depName) {
- depName = "depName";
- }
- $('#departId').val('');
- $('#depName').val('');
- }
- function selectDep(title, url, callback, width, height) {
- if (!width) {
- width = '600px';
- }
- if (!height) {
- height = '350px';
- }
- if (!title) {
- title = '组织机构列表';
- }
- // 'url:userActivitiDataController.do?depSelect'
- var _selectDialog = $.dialog({
- content: 'url:' + url
- , zIndex: getzIndex()
- , title: title, lock: true, width: width, height: height, opacity: 0.4, button: [
- {
- name: '确定', callback: function () {
- var iframe = _selectDialog.iframe.contentWindow;
- var selectedRows = iframe.getSelectRows();
- if (selectedRows.length == 0) {
- iframe.tip('请选择组织机构');
- return false;
- }
- var one = selectedRows[0];
- var depId = one.id;
- var depName = one.departName;
- $('#departId').val(depId);
- $('#depName').val(depName);
- if (callback) {
- callback(selectedRows);
- }
- }, focus: true
- },
- {
- name: '取消', callback: function () {
- }
- }
- ]
- }).zindex();
- return _selectDialog;
- }
- function selectPost(callback) {//选择岗位
- var orgIds = $("#postId").val();
- var url = 'projectPostDetailController.do?postZTree&orgIds=' + orgIds;
- _openDialog(url, '岗位类型选择', function (iframe) {
- var treeObj = iframe.$.fn.zTree.getZTreeObj("departSelect");
- var nodes = treeObj.getCheckedNodes(true);
- var ids = new Array();
- var names = new Array();
- if (nodes.length > 0) {
- for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- ids.push(node.id);
- names.push(node.name);
- }
- }
- $("#postId").val(ids.join(','));
- $("#postName").val(names.join(','));
- if (callback) {
- callback(ids, names);
- }
- });
- }
- function selectDepPost(departId, callback) {//选择部门对应岗位,这里的postId跟原来不一样
- if (!departId) {
- departId = $('#departId').val();
- if (!departId) {
- tip('请选择组织机构');
- return;
- }
- }
- var orgIds = $("#postId").val();
- var url = 'userActivitiDataController.do?depPostSelect&orgIds=' + orgIds + "&departId=" + departId;
- _openDialog(url, '项目岗位选择', function (iframe) {
- var selectedRows = iframe.getSelectedRow();
- if (selectedRows.length == 0) {
- iframe.tip('请选择项目岗位');
- return false;
- }
- var one = selectedRows[0];
- var id = one.id;
- var name = one.ptjPostName;
- $("#postId").val(id);
- $("#postName").val(name);
- if (callback) {
- callback(selectedRows);
- }
- });
- }
- function selectLeafDuty(callback, width, height) {//选择职务,过滤非叶子节点
- var orgIds = $("#dutyId").val();
- var url = 'userActivitiDataController.do?leafDutySelect&orgIds=' + orgIds;
- _openDialog(url, '职务列表', function (iframe) {
- var selectedRows = iframe.getSelectedRow();
- if (selectedRows.length == 0) {
- iframe.tip('请选择职务');
- return false;
- }
- var one = selectedRows[0];
- var dutyId = one.id;
- var dutyName = one.dutiesName;
- $('#dutyId').val(dutyId);
- $('#dutyName').val(dutyName);
- if (callback) {
- callback(selectedRows);
- }
- });
- }
- function selectRelatedUnit(callback, width, height) {//选择供应商
- if (!height) height = '600px';
- var orgIds = $("#supplierId").val();
- var url = 'ordersController.do?selectReferUnits&classname=cn.com.lzt.relatedunits.entity.RelatedUnitsEntity&codefield=unitCode&namefield=unitName&orgIds=' + orgIds;
- _openDialog(url, '供应商列表', function (iframe) {
- var selectedRows = iframe.getSelectedRow();
- if (selectedRows.length == 0) {
- iframe.tip('请选供应商');
- return false;
- }
- var one = selectedRows[0];
- var supplierId = one.id;
- var supplierName = one.unitName;
- $('#supplierId').val(supplierId);
- $('#supplierName').val(supplierName);
- if (callback) {
- callback(selectedRows);
- }
- }, width, height);
- }
- function selectGoodsBySameName(params, callback, width, height) {//选择同名商品供应商
- if (!width) width = '800px';
- if (!height) height = '600px';
- params = params || {};
- var orgIds = params.orgIds;
- var initCategoryCode = params.initCategoryCode;
- var goodsName = params.goodsName
- var url = "ordersController.do?selectReferGoodsBySameName&classname=cn.com.lzt.goodsinfo.entity.TBGoodsInfoEntity&codefield=goodsCode&categoryfield=belongCategoryCode&categoryNamefield=belongCategoryName&namefield=goodsName&purchaseUnit=salesUnit&specification=specification&goodsDesc=goodsDesc&strEmpty=strEmpty" +
- "&initCategoryCode=" + initCategoryCode + "&goodsName=" + encodeURIComponent(goodsName);
- _openDialog(url, '商品列表', function (iframe) {
- var selectedRows = iframe.getSelectRows();
- if (selectedRows.length == 0) {
- iframe.tip('请选供应商');
- return false;
- }
- if (callback) {
- callback(selectedRows);
- }
- }, width, height);
- }
- function getUserInfo(userId) {
- var info;
- $.ajax({
- url: 'userActivitiDataController.do?userInfo'
- , data: {userId: userId}
- , dataType: 'json'
- , method: 'POST'
- , async: false
- , success: function (d) {
- info = d.obj;
- }
- });
- return info;
- }
- function clearPost() {
- $("#postId").val('');
- $("#postName").val('');
- }
- //选择服务合同
- function selectContract(callback, data, width, height) {
- var params = "";
- for (var i in data) {
- params += "&" + i + "=" + data[i];
- }
- var url = 'contractController.do?selectlist' + params;
- _openDialog(url, '选择合同', function (iframe) {
- var selectedRows = iframe.getSelectedRow();
- if (selectedRows.length == 0) {
- iframe.tip('请选择合同');
- return false;
- }
- var one = selectedRows[0];
- if (callback) {
- callback(one);
- }
- }, width, height);
- }
- function _openDialog(url, title, okCallback, width, height) {
- if (!width) {
- width = '500px';
- }
- if (!height) {
- height = '350px';
- }
- if (width == "100%") {
- width = window.top.document.body.offsetWidth;
- }
- if (height == "100%") {
- height = window.top.document.body.offsetHeight - 100;
- }
- var _selectDialog = $.dialog({
- content: 'url:' + url
- , zIndex: getzIndex()
- , title: title, lock: true, width: width, height: height, opacity: 0.4, button: [
- {
- name: '确定', callback: function () {
- var iframe = _selectDialog.iframe.contentWindow;
- if (okCallback) {
- var b = okCallback(iframe);
- return b;
- }
- }
- , focus: true
- },
- {
- name: '取消', callback: function () {
- }
- }
- ]
- }).zindex();
- return _selectDialog;
- }
- function _select(url, title, okCallback, width, height) {
- var dialog = _openDialog(url, title, function (iframe) {
- var selectedRows = iframe.getSelectedRow();
- if (selectedRows.length == 0) {
- iframe.tip('请至少选择一项');
- return false;
- }
- if (okCallback) {
- var b = okCallback(selectedRows);
- return b;
- }
- }, width, height);
- return dialog;
- }
- $(function () {
- if ($.Datatype) {
- $.Datatype.fix2 = function (val, obj, frm) {
- $(obj).val(parseFloat(val).toFixed(2));
- return true;
- }
- }
- });
|