"vscode:/vscode.git/clone" did not exist on "c9bf4f7e66b8fafcfe4ad7ff795c691daab54f8b"
Commit 079fa476 authored by 季圣华's avatar 季圣华
Browse files

优化单据的代码结构

parent cfbe754b
......@@ -3,14 +3,14 @@ Navicat MySQL Data Transfer
Source Server : localhost
Source Server Version : 50704
Source Host : 127.0.0.1:3306
Source Host : localhost:3306
Source Database : jsh_erp
Target Server Type : MYSQL
Target Server Version : 50704
File Encoding : 65001
Date: 2020-09-13 18:47:08
Date: 2020-09-26 12:06:20
*/
SET FOREIGN_KEY_CHECKS=0;
......@@ -337,22 +337,22 @@ INSERT INTO `jsh_function` VALUES ('23', '010102', '商品信息', '0101', '/pag
INSERT INTO `jsh_function` VALUES ('24', '0102', '基本资料', '0', '', '\0', '0750', '', '电脑版', null, 'icon-grid', '0');
INSERT INTO `jsh_function` VALUES ('25', '01020101', '供应商信息', '0102', '/pages/manage/vendor.html', '\0', '0260', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('26', '010202', '仓库信息', '0102', '/pages/manage/depot.html', '\0', '0270', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('31', '010206', '经手人管理', '0102', '/pages/materials/person.html', '\0', '0284', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('31', '010206', '经手人管理', '0102', '/pages/manage/person.html', '\0', '0284', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('32', '0502', '采购管理', '0', '', '\0', '0330', '', '电脑版', '', 'icon-loop', '0');
INSERT INTO `jsh_function` VALUES ('33', '050201', '采购入库', '0502', '/pages/materials/purchase_in_list.html', '\0', '0340', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('33', '050201', '采购入库', '0502', '/pages/bill/purchase_in_list.html', '\0', '0340', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('38', '0603', '销售管理', '0', '', '\0', '0390', '', '电脑版', '', 'icon-briefcase', '0');
INSERT INTO `jsh_function` VALUES ('40', '080107', '调拨出库', '0801', '/pages/materials/allocation_out_list.html', '\0', '0807', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('41', '060303', '销售出库', '0603', '/pages/materials/sale_out_list.html', '\0', '0394', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('40', '080107', '调拨出库', '0801', '/pages/bill/allocation_out_list.html', '\0', '0807', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('41', '060303', '销售出库', '0603', '/pages/bill/sale_out_list.html', '\0', '0394', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('44', '0704', '财务管理', '0', '', '\0', '0450', '', '电脑版', '', 'icon-map', '0');
INSERT INTO `jsh_function` VALUES ('59', '030101', '库存状况', '0301', '/pages/reports/in_out_stock_report.html', '\0', '0600', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('194', '010204', '收支项目', '0102', '/pages/manage/inOutItem.html', '\0', '0282', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('195', '010205', '结算账户', '0102', '/pages/manage/account.html', '\0', '0283', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('197', '070402', '收入单', '0704', '/pages/financial/item_in.html', '\0', '0465', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('198', '0301', '报表查询', '0', '', '\0', '0570', '', '电脑版', null, 'icon-pie-chart', '0');
INSERT INTO `jsh_function` VALUES ('199', '050204', '采购退货', '0502', '/pages/materials/purchase_back_list.html', '\0', '0345', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('200', '060305', '销售退货', '0603', '/pages/materials/sale_back_list.html', '\0', '0396', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('201', '080103', '其它入库', '0801', '/pages/materials/other_in_list.html', '\0', '0803', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('202', '080105', '其它出库', '0801', '/pages/materials/other_out_list.html', '\0', '0805', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('199', '050204', '采购退货', '0502', '/pages/bill/purchase_back_list.html', '\0', '0345', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('200', '060305', '销售退货', '0603', '/pages/bill/sale_back_list.html', '\0', '0396', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('201', '080103', '其它入库', '0801', '/pages/bill/other_in_list.html', '\0', '0803', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('202', '080105', '其它出库', '0801', '/pages/bill/other_out_list.html', '\0', '0805', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('203', '070403', '支出单', '0704', '/pages/financial/item_out.html', '\0', '0470', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('204', '070404', '收款单', '0704', '/pages/financial/money_in.html', '\0', '0475', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('205', '070405', '付款单', '0704', '/pages/financial/money_out.html', '\0', '0480', '', '电脑版', '1', 'icon-notebook', '0');
......@@ -360,8 +360,8 @@ INSERT INTO `jsh_function` VALUES ('206', '070406', '转账单', '0704', '/pages
INSERT INTO `jsh_function` VALUES ('207', '030102', '账户统计', '0301', '/pages/reports/account_report.html', '\0', '0610', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('208', '030103', '进货统计', '0301', '/pages/reports/buy_in_report.html', '\0', '0620', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('209', '030104', '销售统计', '0301', '/pages/reports/sale_out_report.html', '\0', '0630', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('210', '040102', '零售出库', '0401', '/pages/materials/retail_out_list.html', '\0', '0405', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('211', '040104', '零售退货', '0401', '/pages/materials/retail_back_list.html', '\0', '0407', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('210', '040102', '零售出库', '0401', '/pages/bill/retail_out_list.html', '\0', '0405', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('211', '040104', '零售退货', '0401', '/pages/bill/retail_back_list.html', '\0', '0407', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('212', '070407', '收预付款', '0704', '/pages/financial/advance_in.html', '\0', '0495', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('217', '01020102', '客户信息', '0102', '/pages/manage/customer.html', '\0', '0262', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('218', '01020103', '会员信息', '0102', '/pages/manage/member.html', '\0', '0263', '', '电脑版', '1', 'icon-notebook', '0');
......@@ -371,16 +371,16 @@ INSERT INTO `jsh_function` VALUES ('226', '030106', '入库明细', '0301', '/pa
INSERT INTO `jsh_function` VALUES ('227', '030107', '出库明细', '0301', '/pages/reports/out_detail.html', '\0', '0645', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('228', '030108', '入库汇总', '0301', '/pages/reports/in_material_count.html', '\0', '0650', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('229', '030109', '出库汇总', '0301', '/pages/reports/out_material_count.html', '\0', '0655', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('232', '080109', '组装单', '0801', '/pages/materials/assemble_list.html', '\0', '0809', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('233', '080111', '拆卸单', '0801', '/pages/materials/disassemble_list.html', '\0', '0811', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('232', '080109', '组装单', '0801', '/pages/bill/assemble_list.html', '\0', '0809', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('233', '080111', '拆卸单', '0801', '/pages/bill/disassemble_list.html', '\0', '0811', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('234', '000105', '系统配置', '0001', '/pages/manage/systemConfig.html', '\0', '0165', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('235', '030110', '客户对账', '0301', '/pages/reports/customer_account.html', '\0', '0660', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('236', '000106', '商品属性', '0001', '/pages/materials/materialProperty.html', '\0', '0168', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('237', '030111', '供应商对账', '0301', '/pages/reports/vendor_account.html', '\0', '0665', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('239', '0801', '仓库管理', '0', '', '\0', '0420', '', '电脑版', '', 'icon-layers', '0');
INSERT INTO `jsh_function` VALUES ('240', '010104', '序列号', '0101', '/pages/manage/serialNumber.html', '\0', '0246', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('241', '050202', '采购订单', '0502', '/pages/materials/purchase_orders_list.html', '\0', '0335', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('242', '060301', '销售订单', '0603', '/pages/materials/sale_orders_list.html', '\0', '0392', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('241', '050202', '采购订单', '0502', '/pages/bill/purchase_orders_list.html', '\0', '0335', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('242', '060301', '销售订单', '0603', '/pages/bill/sale_orders_list.html', '\0', '0392', '', '电脑版', '1,2', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('243', '000108', '机构管理', '0001', '/pages/manage/organization.html', '', '0150', '', '电脑版', '1', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('244', '030112', '库存预警', '0301', '/pages/reports/stock_warning_report.html', '\0', '0670', '', '电脑版', '', 'icon-notebook', '0');
INSERT INTO `jsh_function` VALUES ('245', '000107', '插件管理', '0001', '/pages/manage/plugin.html', '\0', '0170', '', '电脑版', '1', 'icon-notebook', '0');
......@@ -421,7 +421,7 @@ CREATE TABLE `jsh_log` (
`tenant_id` bigint(20) DEFAULT NULL COMMENT '租户id',
PRIMARY KEY (`id`),
KEY `FKF2696AA13E226853` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6798 DEFAULT CHARSET=utf8 COMMENT='操作日志';
) ENGINE=InnoDB AUTO_INCREMENT=6800 DEFAULT CHARSET=utf8 COMMENT='操作日志';
-- ----------------------------
-- Records of jsh_log
......@@ -464,7 +464,7 @@ INSERT INTO `jsh_material` VALUES ('570', '17', '商品3', '', '300.000000', 'sp
INSERT INTO `jsh_material` VALUES ('577', null, '商品8', '', null, 'sp8', '', '', '', '', '15', '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('579', '21', '商品17', '', null, 'sp17', '', '', '', '', '15', '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('586', '17', '序列号商品测试', '', null, 'xlh123', '', '', '个', '', null, '', '', '', '', '1', '63', '0');
INSERT INTO `jsh_material` VALUES ('587', '17', '商品test1', '南通中远', null, '', 'test1', '', '个', '', null, '\0', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('587', '17', '商品test1', '南通中远', null, '', 'test1', '', '个', '', null, '', '', '', '', '0', '63', '0');
INSERT INTO `jsh_material` VALUES ('588', '21', '商品200', '', '112.000000', '', '300ml', '', '个', '', null, '', '', '', '', '0', '63', '0');
-- ----------------------------
......@@ -736,7 +736,7 @@ CREATE TABLE `jsh_sequence` (
-- ----------------------------
-- Records of jsh_sequence
-- ----------------------------
INSERT INTO `jsh_sequence` VALUES ('depot_number_seq', '1', '999999999999999999', '352', '1', '单据编号sequence');
INSERT INTO `jsh_sequence` VALUES ('depot_number_seq', '1', '999999999999999999', '353', '1', '单据编号sequence');
-- ----------------------------
-- Table structure for jsh_serial_number
......
......@@ -415,7 +415,7 @@
}
function turnBillDetailPage(number, type) {
js.addTabPage(null, "单据明细", "/pages/materials/bill_detail.html?n="+ number + "&type=" + type);
js.addTabPage(null, "单据明细", "/pages/bill/bill_detail.html?n="+ number + "&type=" + type);
}
/**
......
$.get("../../pages/template/base.html?7891", function(tem) {
if(tem) {
var template = Handlebars.compile(tem);
/**
* 加载供应商、客户模块
*/
$("#supplier").html(template({
supplierSelect: true
}));
$('#supplierDlg').dialog({
closed: true,
modal: true,
collapsible: false,
closable: true
});
$("#supplierDlg #supplier").textbox({
required: true,
validType: 'length[2,30]'
});
$("#supplierDlg #email").textbox({
validType: 'email'
});
$("#BeginNeedGet,#BeginNeedPay,#AllNeedGet,#AllNeedPay").numberbox({
min:0,
precision:2
});
$("#taxRate").textbox({
validType: 'length[1,2]'
});
$("#saveSupplier").linkbutton({
iconCls: 'icon-ok'
});
$("#cancelSupplier").linkbutton({
iconCls: 'icon-cancel'
});
$("#contacts,#telephone,#email,#phonenum,#fax,#taxNum,#bankName,#accountNumber,#address").textbox();
$("#description").textbox({
multiline:true
});
/**
* 加载仓库
*/
$("#depot").html(template({
depotSelect: true
}));
$('#depotDlg').dialog({
closed: true,
modal: true,
collapsible: false,
closable: true
});
$("#depotDlg #name").textbox({
required: true,
validType: 'length[2,30]'
});
$("#depotDlg #address").textbox({
validType: 'length[2,30]'
});
$("#depotDlg #warehousing,#depotDlg #truckage").numberbox({
min:0,
precision:2
});
$("#saveDepot").linkbutton({
iconCls: 'icon-ok'
});
$("#cancelDepot").linkbutton({
iconCls: 'icon-cancel'
});
$("#sort").textbox();
$("#depotDlg #remark").textbox({
multiline:true
});
/**
* 加载账户
*/
$("#account").html(template({
accountSelect: true
}));
$('#accountDlg').dialog({
closed: true,
modal: true,
collapsible: false,
closable: true
});
$("#accountDlg #name,#accountDlg #serialNo").textbox({
required: true,
validType: 'length[2,30]'
});
$("#accountDlg #initialAmount").numberbox({
min:0,
precision:2
});
$("#saveAccount").linkbutton({
iconCls: 'icon-ok'
});
$("#cancelAccount").linkbutton({
iconCls: 'icon-cancel'
});
}
});
//绑定供应商、客户事件
function bindSupplierEvent() {
if(listTitle === "采购入库列表" || listTitle === "其它入库列表" || listTitle === "采购订单列表"
|| listTitle === "零售出库列表"|| listTitle === "销售出库列表"|| listTitle === "销售订单列表"){
var supplierType = "供应商";
if(listTitle === "零售出库列表"){
supplierType = "会员";
}else if(listTitle === "销售出库列表" || listTitle === "销售订单列表"){
supplierType = "客户";
}
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
function checkSupplierName() {
var supplierName = $.trim($("#supplier").val());
var orgSupplier = "";
//表示是否存在 true == 存在 false = 不存在
var flag = false;
//开始ajax名称检验,不能重名
if(supplierName.length > 0 &&( orgSupplier.length ==0 || supplierName != orgSupplier))
{
$.ajax({
type:"get",
url: "/supplier/checkIsNameExist",
dataType: "json",
async : false,
data: ({
id : 0,
name : supplierName
}),
success: function (res) {
if(res && res.code === 200) {
if(res.data && res.data.status) {
flag = res.data.status;
if (flag) {
$.messager.alert('提示', '单位名称已经存在', 'info');
return;
}
}
}
},
//此处添加错误处理
error:function() {
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
return;
}
});
}
return flag;
}
//保存供应商信息
$("#saveSupplier").off("click").on("click",function() {
if(validateForm("supplierFM")) {
return;
}
if(checkSupplierName()){
return;
}
var reg = /^([0-9])+$/;
var phonenum = $.trim($("#phonenum").val());
if(phonenum.length>0 && !reg.test(phonenum))
{
$.messager.alert('提示','电话号码只能是数字','info');
$("#phonenum").val("").focus();
return;
}
var beginNeedGet = $.trim($("#BeginNeedGet").val());
var beginNeedPay = $.trim($("#BeginNeedPay").val());
if(beginNeedGet && beginNeedPay) {
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
return;
}
var url = '/supplier/add';
var supObj = $("#supplierFM").serializeObject();
supObj.type = supplierType;
supObj.enabled = 1;
$.ajax({
url: url,
type:"post",
dataType: "json",
data:{
info: JSON.stringify(supObj)
},
success: function(res) {
if (res) {
$('#supplierDlg').dialog('close');
initSupplier(); //刷新供应商
}
}
});
});
}
}
//绑定仓库事件
function bindDepotEvent() {
$("#depotFM #name").focus();
$("#selectType").val("principal");
//检查名称是否存在 ++ 重名无法提示问题需要跟进
function checkDepotName() {
var name = $.trim($("#depotDlg #name").val());
//表示是否存在 true == 存在 false = 不存在
var flag = false;
//开始ajax名称检验,不能重名
if (name.length > 0) {
$.ajax({
type: "get",
url: "/depot/checkIsNameExist",
dataType: "json",
async: false,
data: ({
id: 0,
name: name
}),
success: function (res) {
if(res && res.code === 200) {
if(res.data && res.data.status) {
flag = res.data.status;
if (flag) {
$.messager.alert('提示', '仓库名称已经存在', 'info');
return;
}
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '检查仓库名称是否存在异常,请稍后再试!', 'error');
return;
}
});
}
return flag;
}
$("#saveDepot").off("click").on("click", function () {
if(!$('#depotFM').form('validate')){
return;
}
var infoObj = $("#depotFM").serializeObject();
infoObj.type = 0;
if (checkDepotName()) {
return;
}
$.ajax({
url: "/depot/add",
type: "post",
dataType: "json",
data: ({
info: JSON.stringify(infoObj)
}),
success: function(res) {
if(res && res.code === 200) {
$('#depotDlg').dialog('close');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '保存仓库信息异常,请稍后再试!', 'error');
return;
}
});
});
}
//绑定账户事件
function bindAccountEvent() {
function checkAccountName() {
var accountName = $.trim($("#accountDlg #name").val());
//表示是否存在 true == 存在 false = 不存在
var flag = false;
//开始ajax名称检验,不能重名
if (accountName.length > 0) {
$.ajax({
type: "get",
url: "/account/checkIsNameExist",
dataType: "json",
async: false,
data: ({
id: 0,
name: accountName
}),
success: function (res) {
if(res && res.code === 200) {
if(res.data && res.data.status) {
flag = res.data.status;
if (flag) {
$.messager.alert('提示', '结算账户名称已经存在', 'info');
return;
}
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '检查结算账户名称是否存在异常,请稍后再试!', 'error');
return;
}
});
}
return flag;
}
//保存结算账户
$("#saveAccount").off("click").on("click", function () {
if (checkAccountName()) {
return;
}
if(!$('#accountFM').form('validate')){
return;
} else {
$.ajax({
url: '/account/add',
type: "post",
dataType: "json",
data: ({
info: JSON.stringify($("#accountFM").serializeObject())
}),
success: function(res) {
if(res && res.code === 200) {
$('#accountDlg').dialog('close');
initSystemData_account(); //刷新账户
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '保存结算账户异常,请稍后再试!', 'error');
return;
}
});
}
});
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html>
<head>
<title>经手人管理</title>
<meta charset="utf-8">
<!-- 指定以IE8的方式来渲染 -->
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
<script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
<link type="text/css" rel="stylesheet" href="/css/common.css"/>
<script type="text/javascript" src="/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/js/common/common.js"></script>
</head>
<body>
<!-- 数据显示table -->
<div id="tablePanel" class="easyui-panel" data-options="fit:true" style="padding:1px;top:300px;" title="经手人列表" iconCls="icon-list">
<div class="box-body form-inline">
<div class="form-group">
<label class="control-label">姓名:</label>
<div class="control-inline">
<input type="text" id="searchName" name="searchName" value="" maxlength="100" class="easyui-textbox width-90"/>
</div>
</div>
<div class="form-group">
<label class="control-label">类型:</label>
<div class="control-inline">
<select name="searchType" id="searchType" class="easyui-combobox width-90"
data-options="panelHeight:'auto'">
<option value="">全部</option>
<option value="业务员">业务员</option>
<option value="仓管员">仓管员</option>
<option value="财务员">财务员</option>
</select>
</div>
</div>
<div class="form-group">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>&nbsp;
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
</div>
</div>
<table id="tableData" style="top:300px;border-bottom-color:#FFFFFF"></table>
</div>
<div id="personDlg" class="easyui-dialog" style="width:380px;padding:10px 20px"
closed="true" buttons="#dlg-buttons" modal="true" cache="false" collapsible="false" closable="true">
<form id="personFM" method="post" novalidate>
<table>
<tr>
<td>姓名</td>
<td style="padding:5px">
<input name="Name" id="Name" class="easyui-textbox"
data-options="required:true,validType:'length[2,30]'" style="width: 230px;"/>
</td>
</tr>
<tr>
<td>类型</td>
<td style="padding:5px">
<select name="Type" id="Type" class="easyui-combobox"
data-options="panelHeight:'auto'" style="width:230px;">
<option value="业务员">业务员</option>
<option value="仓管员">仓管员</option>
<option value="财务员">财务员</option>
</select>
</td>
</tr>
</table>
</form>
</div>
<div id="dlg-buttons">
<a href="javascript:void(0)" id="savePerson" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
<a href="javascript:void(0)" id="cancelPerson" class="easyui-linkbutton" iconCls="icon-cancel"
onclick="javascript:$('#personDlg').dialog('close')">取消</a>
</div>
<script type="text/javascript">
//初始化界面
$(function () {
initTableData();
ininPager();
initForm();
});
//防止表单提交重复
function initForm() {
$('#personFM').form({
onSubmit: function () {
return false;
}
});
}
//初始化表格数据
function initTableData() {
$('#tableData').datagrid({
//title:'经手人列表',
//iconCls:'icon-save',
//width:700,
height: heightInfo,
nowrap: false,
rownumbers: false,
//动画效果
animate: false,
//选中单行
singleSelect: true,
collapsible: false,
selectOnCheck: false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
pagination: true,
//交替出现背景
striped: true,
//loadFilter: pagerFilter,
pageSize: initPageSize,
pageList: initPageNum,
columns: [[
{field: 'id', width: 35, align: "center", checkbox: true},
{title: '姓名', field: 'name', width: 180},
{title: '类型', field: 'type', width: 180},
{
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec, index) {
var str = '';
str += '<img src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editPerson(\'' + index + '\');"/>&nbsp;<a onclick="editPerson(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a>&nbsp;&nbsp;';
if(isShowOpFun()) {
str += '<img src="/js/easyui/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deletePerson(' + rec.id + ');"/>&nbsp;<a onclick="deletePerson(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>&nbsp;&nbsp;';
}
return str;
}
}
]],
toolbar: [
{
id: 'addPerson',
text: '增加',
iconCls: 'icon-add',
handler: function () {
addPerson();
}
},'-',
{
id: 'deletePerson',
text: '删除',
iconCls: 'icon-remove',
handler: function () {
batDeletePerson();
}
}
],
onLoadError: function () {
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
return;
}
});
dgResize();
toolbarStatus();
showPersonDetails(1, initPageSize);
}
//初始化键盘enter事件
$(document).keydown(function (event) {
//兼容 IE和firefox 事件
var e = window.event || event;
var k = e.keyCode || e.which || e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
if (k == "13" && (obj.id == "Type" || obj.id == "Name")) {
$("#savePerson").click();
}
//搜索按钮添加快捷键
if (k == "13" && (obj.id == "searchType")) {
$("#searchBtn").click();
}
});
//分页信息处理
function ininPager() {
try {
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
pager.pagination({
onSelectPage: function (pageNum, pageSize) {
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh', {
pageNumber: pageNum,
pageSize: pageSize
});
showPersonDetails(pageNum, pageSize);
}
});
}
catch (e) {
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
}
}
//删除经手人信息
function deletePerson(personID) {
$.messager.confirm('删除确认', '确定要删除此经手人信息吗?', function (r) {
if (r) {
$.ajax({
type: "post",
url: "/person/batchDeletePersonByIds",
dataType: "json",
data: ({
ids: personID
}),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
} else {
if(res && res.code == 601){
var jsondata={};
jsondata.ids=personID;
jsondata.deleteType='2';
var type='single';
batDeletePersonForceConfirm(res,"/person/batchDeletePersonByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除经手人信息失败,请稍后再试!', 'error');
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
return;
}
});
}
});
}
//批量删除经手人
function batDeletePerson() {
var row = $('#tableData').datagrid('getChecked');
if (row.length == 0) {
$.messager.alert('删除提示', '没有记录被选中!', 'info');
return;
}
if (row.length > 0) {
$.messager.confirm('删除确认', '确定要删除选中的' + row.length + '条经手人信息吗?', function (r) {
if (r) {
var ids = "";
for (var i = 0; i < row.length; i++) {
if (i == row.length - 1) {
ids += row[i].id;
break;
}
//alert(row[i].id);
ids += row[i].id + ",";
}
$.ajax({
type: "post",
url: "/person/batchDeletePersonByIds",
dataType: "json",
async: false,
data: ({
ids: ids
}),
success: function (res) {
if(res && res.code === 200) {
$("#searchBtn").click();
$(":checkbox").attr("checked", false);
} else {
if(res && res.code == 601){
var jsondata={};
jsondata.ids=ids;
jsondata.deleteType='2';
var type='batch';
batDeletePersonForceConfirm(res,"/person/batchDeletePersonByIds",jsondata,type);
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else{
$.messager.alert('删除提示', '删除经手人信息失败,请稍后再试!', 'error');
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
return;
}
});
}
});
}
}
/**
* 确认强制删除
* */
function batDeletePersonForceConfirm(res,url,jsondata,type) {
$.messager.confirm('删除确认', res.msg, function (r) {
if (r) {
$.ajax({
type: "post",
url: url,
dataType: "json",
data: (jsondata),
success: function (res) {
if(res && res.code == 200) {
$("#searchBtn").click();
if(type=='batch'){
$(":checkbox").attr("checked", false);
}
}else if(res && res.code == 600){
$.messager.alert('删除提示', res.msg, 'error');
}else {
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
}
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除经手人信息异常,请稍后再试!', 'error');
return;
}
});
}
});
}
//增加
var url;
var personID = 0;
//保存编辑前的名称
var oldPerson = "";
function addPerson() {
if(checkPower()){
return;
}
$('#personFM').form('clear');
$('#personDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/edit_add.png"/>&nbsp;增加经手人信息');
$(".window-mask").css({width: webW, height: webH});
$("#name").val("").focus();
oldPerson = "";
personID = 0;
url = '/person/add';
}
//保存信息
$("#savePerson").off("click").on("click", function () {
if(!$('#personFM').form('validate')){
return;
}
if (!$("#Type").val()) {
$.messager.alert('提示', '请选择类型!', 'warning');
return;
}
$.ajax({
url: url,
type: "post",
dataType: "json",
async: false,
data: ({
info: JSON.stringify($("#personFM").serializeObject())
}),
success: function(res) {
if(res && res.code === 200) {
$('#personDlg').dialog('close');
//加载完以后重新初始化
var opts = $("#tableData").datagrid('options');
showPersonDetails(opts.pageNumber, opts.pageSize);
}
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '保存经手人信息异常,请稍后再试!', 'error');
return;
}
});
});
//编辑信息
function editPerson(index) {
var rowsdata = $("#tableData").datagrid("getRows")[index];
$("#Name").textbox("setValue", rowsdata.name);
$("#Type").combobox("setValue", rowsdata.type);
$('#personDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/pencil.png"/>&nbsp;编辑经手人信息');
$(".window-mask").css({width: webW, height: webH});
if(!isShowOpFun()){
$("#savePerson").hide();
}
personID = rowsdata.id;
url = '/person/update?id=' + rowsdata.id;
}
//搜索处理
$("#searchBtn").unbind().bind({
click: function () {
showPersonDetails(1, initPageSize);
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
opts.pageNumber = 1;
opts.pageSize = initPageSize;
pager.pagination('refresh', {
pageNumber: 1,
pageSize: initPageSize
});
}
});
function showPersonDetails(pageNo, pageSize) {
var name = $.trim($("#searchName").val());
var type = $.trim($("#searchType").val());
$.ajax({
type: "get",
url: "/person/list",
dataType: "json",
data: ({
search: JSON.stringify({
name: name,
type: type
}),
currentPage: pageNo,
pageSize: pageSize
}),
success: function (res) {
if(res && res.code === 200){
if(res.data && res.data.page) {
$("#tableData").datagrid('loadData', res.data.page);
}
}
},
//此处添加错误处理
error: function () {
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
return;
}
});
}
//重置按钮
$("#searchResetBtn").unbind().bind({
click: function () {
$("#searchName").textbox("clear");
$("#searchType").combobox("clear");
//加载完以后重新初始化
$("#searchBtn").click();
}
});
</script>
</body>
</html>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment