提交 b6daf5c7 编写于 作者: Skyeye云's avatar Skyeye云

明细账列表项开发完成

上级 84154587
......@@ -10,10 +10,7 @@ layui.config({
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$,
laydate = layui.laydate;
var rowNum = 1; //表格的序号
var initemHtml = "";//收支项目
var usetableTemplate = $("#usetableTemplate").html();
var selOption = getFileContent('tpl/template/select-option.tpl');
var handsPersonList = new Array();//经手人员
......@@ -31,70 +28,18 @@ layui.config({
$("#accountId").html(getDataUseHandlebars(selOption, json));
});
// 初始化收入项目
systemCommonUtil.getSysInoutitemListByType(1, function(json){
// 加载收入项目数据
initemHtml = getDataUseHandlebars(selOption, json);
matchingLanguage();
form.render();
// 初始化一行数据
addRow();
});
// 数量变化
$("body").on("input", ".rkMoney", function() {
calculatedTotalPrice();
});
$("body").on("change", ".rkMoney", function() {
calculatedTotalPrice();
});
// 计算总价
function calculatedTotalPrice(){
var rowTr = $("#useTable tr");
var allPrice = 0;
$.each(rowTr, function(i, item) {
// 获取行坐标
var rowNum = $(item).attr("trcusid").replace("tr", "");
// 获取金额
var initemMoney = parseFloat(isNull($("#initemMoney" + rowNum).val()) ? "0" : $("#initemMoney" + rowNum).val());
// 输出金额
$("#initemMoney" + rowNum).html((initemMoney).toFixed(2));
allPrice += initemMoney;
});
$("#allPrice").html(allPrice.toFixed(2));
}
// 初始化列表项选择
voucherUtil.init('showVoucherUtilBox');
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function(data) {
if(winui.verifyForm(data.elem)) {
var rowTr = $("#useTable tr");
if(rowTr.length == 0) {
winui.window.msg('请选择收入项目.', {icon: 2, time: 2000});
var result = voucherUtil.getData();
console.log(result);
if(result.length < 2){
return false;
}
var tableData = new Array();
var noError = false; //循环遍历表格数据时,是否有其他错误信息
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
if(judgeInPoingArr(tableData, "initemId", $("#initemId" + rowNum).val())){
$("#initemId" + rowNum).addClass("layui-form-danger");
$("#initemId" + rowNum).focus();
winui.window.msg('一张单中不允许出现相同收支项目信息.', {icon: 2, time: 2000});
noError = true;
return false;
}
var row = {
initemId: $("#initemId" + rowNum).val(),
initemMoney: $("#initemMoney" +rowNum).val(),
remark: $("#remark" + rowNum).val()
};
tableData.push(row);
});
if(noError) {
return false;
}
var params = {
organId: sysCustomerUtil.customerMation.id,
handsPersonId: handsPersonList[0].id,
......@@ -102,16 +47,16 @@ layui.config({
accountId: $("#accountId").val(),
remark: $("#remark").val(),
changeAmount: $("#changeAmount").val(),
initemStr: JSON.stringify(tableData)
initemStr: JSON.stringify(result)
};
AjaxPostUtil.request({url: reqBasePath + "income002", params: params, type: 'json', method: "POST", callback: function(json) {
if(json.returnCode == 0) {
parent.layer.close(index);
parent.refreshCode = '0';
} else {
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
}
}});
// AjaxPostUtil.request({url: reqBasePath + "income002", params: params, type: 'json', method: "POST", callback: function(json) {
// if(json.returnCode == 0) {
// parent.layer.close(index);
// parent.refreshCode = '0';
// } else {
// winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
// }
// }});
}
return false;
});
......@@ -156,45 +101,9 @@ layui.config({
// 新增行
$("body").on("click", "#addRow", function() {
addRow();
});
// 删除行
$("body").on("click", "#deleteRow", function() {
deleteRow();
voucherUtil.addItem();
});
// 新增行
function addRow() {
var par = {
id: "row" + rowNum.toString(), //checkbox的id
trId: "tr" + rowNum.toString(), //行的id
initemId: "initemId" + rowNum.toString(), //收入项目id
initemMoney: "initemMoney" + rowNum.toString(), //金额id
voucherId: "voucherId" + rowNum.toString(), //凭证id
accountSubjectId: "accountSubjectId" + rowNum.toString(), //会计科目id
remark: "remark" + rowNum.toString() //备注id
};
$("#useTable").append(getDataUseHandlebars(usetableTemplate, par));
//赋值给收支项目
$("#" + "initemId" + rowNum.toString()).html(initemHtml);
form.render('select');
form.render('checkbox');
rowNum++;
}
// 删除行
function deleteRow() {
var checkRow = $("#useTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
// 客户选择
$("body").on("click", "#customMationSel", function(e){
sysCustomerUtil.openSysCustomerChoosePage(function (customerMation){
......@@ -210,24 +119,6 @@ layui.config({
});
});
// 选择会计科目
$("body").on("click", ".chooseIfsAccountSubjectBtn", function(e){
var _this = $(this);
sysIfsUtil.openSysAccountSubjectChoosePage(function (chooseAccountSubjectMation){
_this.parent().find("input").attr("accountSubject", JSON.stringify(chooseAccountSubjectMation));
_this.parent().find("input").val(chooseAccountSubjectMation.num + "_" + chooseAccountSubjectMation.name);
});
});
// 选择凭证
$("body").on("click", ".chooseVoucherBtn", function(e){
var _this = $(this);
sysIfsUtil.openIfsVoucherChoosePage(function (chooseVoucherMation){
_this.parent().find("input").attr("voucher", JSON.stringify(chooseVoucherMation));
_this.parent().find("input").val(chooseVoucherMation.fileName);
});
});
$("body").on("click", "#cancle", function() {
parent.layer.close(index);
});
......
......@@ -5,6 +5,7 @@
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/customer/voucherUtil.css" rel="stylesheet" />
</head>
<body>
<div style="margin: 0 auto; padding: 20px;">
......@@ -35,44 +36,20 @@
<div class="winui-toolbar">
<div class="winui-tool" style="text-align: left;">
<button id="addRow" class="winui-toolbtn" type="button"><i class="fa fa-plus" aria-hidden="true"></i>新增行</button>
<button id="deleteRow" class="winui-toolbtn" type="button"><i class="fa fa-trash-o" aria-hidden="true"></i>删除行</button>
</div>
</div>
<table class="layui-table">
<thead>
<tr>
<th style="width: 30px;"></th>
<th style="width: 120px;">收入项目</th>
<th style="width: 80px;">金额</th>
<th style="width: 160px;">凭证</th>
<th style="width: 160px;">会计科目</th>
<th style="min-width: 100px;">备注</th>
</tr>
</thead>
<tbody id="useTable" class="insurance-table">
</tbody>
</table>
<div id="showVoucherUtilBox" style="overflow-x: auto;">
</div>
</div>
</div>
<div class="layui-form-item layui-col-xs3">
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">收款账户<i class="red">*</i></label>
<div class="layui-input-block">
<select id="accountId" lay-search win-verify="required"></select>
</div>
</div>
<div class="layui-form-item layui-col-xs3">
<label class="layui-form-label">共计金额</label>
<div class="layui-input-block ver-center" id="allPrice">
0.00
</div>
</div>
<div class="layui-form-item layui-col-xs3">
<label class="layui-form-label">收款金额<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="changeAmount" name="changeAmount" win-verify="required|money" placeholder="请输入收款金额" class="layui-input" value="0.00"/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">经手人<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="handsPersonId" name="handsPersonId" win-verify="required" placeholder="请选择经手人员" class="layui-input" style="padding-right: 30px;"/>
......@@ -94,26 +71,10 @@
</form>
</div>
<!-- usetableTemplate -->
<script type="text/x-handlebars-template" id="usetableTemplate">
<tr trcusid="{{trId}}">
<td><input type="checkbox" rowId="{{id}}" lay-filter="checkboxProperty" name="tableCheckRow"/></td>
<td><select id="{{initemId}}" lay-search win-verify="required"></select></td>
<td><input type="text" class="layui-input rkMoney" id="{{initemMoney}}" win-verify="required|money"/></td>
<td>
<input type="text" id="{{voucherId}}" name="{{voucherId}}" placeholder="请选择凭证" class="layui-input" readonly="readonly"/>
<i class="fa fa-plus-circle input-icon chooseVoucherBtn" style="top: 12px;"></i>
</td>
<td>
<input type="text" id="{{accountSubjectId}}" name="{{accountSubjectId}}" placeholder="请选择会计科目" class="layui-input" readonly="readonly"/>
<i class="fa fa-plus-circle input-icon chooseIfsAccountSubjectBtn" style="top: 12px;"></i>
</td>
<td><input type="text" class="layui-input" id="{{remark}}"/></td>
</tr>
</script>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script src="../../assets/lib/layui/customer/voucher/spinbox.js"></script>
<script src="../../assets/lib/layui/customer/voucher/voucherUtil.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/income/'}).use('incomeAdd');
</script>
......
......@@ -20,6 +20,7 @@ var customerJS = {
"sysCustomerUtil": "../../assets/lib/layui/customer/sysCustomerUtil.js", // CRM相关的工具函数
"sysIfsUtil": "../../assets/lib/layui/customer/sysIfsUtil.js", // 财务相关的工具函数
"sysFileUtil": "../../assets/lib/layui/customer/sysFileUtil.js", // 系统文件相关处理工具
"publicKeyCode": "../../assets/lib/layui/customer/publicKeyCode.js", // 快捷键
};
// 编辑加载自定义的js文件
......
var Public = Public || {};
// 快捷键
Public.keyCode = {
ALT: 18,
BACKSPACE: 8,
CAPS_LOCK: 20,
COMMA: 188,
COMMAND: 91,
COMMAND_LEFT: 91, // COMMAND
COMMAND_RIGHT: 93,
CONTROL: 17,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
INSERT: 45,
LEFT: 37,
MENU: 93, // COMMAND_RIGHT
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106,
NUMPAD_SUBTRACT: 109,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SHIFT: 16,
SPACE: 32,
TAB: 9,
UP: 38,
F7: 118,
F12: 123,
S: 83,
WINDOWS: 91 // COMMAND
}
\ No newline at end of file
layui.define(["jquery"], function(exports) {
var jQuery = layui.jquery;
(function ($) {
$.fn.numberField = function (opts) {
return $(this).each(function () {
if (this.tagName.toLowerCase() != 'input') {
return;
}
if (typeof (opts) == 'string') {
var instance = $(this).data('_numberField');
if (!instance) {
return;
}
var args = Array.prototype.slice.call(arguments, 1);
if (typeof (instance[opts]) === 'function') {
instance[opts].apply(instance, args);
}
} else {
var instance = $(this).data('_numberField');
if (instance) {
return;
}
instance = new $.NumberField($(this), opts);
$(this).data('_numberField', instance);
}
});
}
$.NumberField = function (obj, opts) {
this.input = obj;
this.opts = $.extend(true, {}, $.NumberField.defaults, opts);
this._init();
}
$.fn.getNumberField = function () {
return $.NumberField.getNumberField(this);
}
$.NumberField.getNumberField = function (obj) {
obj = $(obj)
if (obj.length == 0) {
return;
} else if (obj.length == 1) {
return obj.data('_numberField');
} else if (obj.length > 1) {
var array = [];
obj.each(function (idx) {
array.push(this.data('_numberField'));
})
return array;
}
}
$.NumberField.prototype = {
constructor: $.NumberField,
_init: function () {
var opts = this.opts, min = parseFloat(opts.min), max = parseFloat(opts.max),
step = parseFloat(opts.step), precision = parseInt(opts.precision);
this.min = !isNaN(min) ? min : Number.NEGATIVE_INFINITY;
this.max = !isNaN(max) ? max : Number.MAX_VALUE;
this.step = !isNaN(step) ? step : 1;
this.precision = isNaN(precision) || !opts.decimal || precision < 0 ? 0 : precision;
this.allowedReg = this._getAllowedReg();
this.input.css('ime-mode', 'disabled');
this._initVal();
this._initDisabled();
this._bindEvent();
},
_getAllowedReg: function () {
var opts = this.opts, allowed = '0123456789', reg;
if (opts.decimal) {
allowed += '.';
}
if (this.min < 0) {
allowed += '-';
}
allowed = allowed.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
reg = new RegExp('[' + allowed + ']');
return reg;
},
_initVal: function () {
var val = this._getProcessedVal(this.opts.value);
if (val === false) {
val = this._getProcessedVal(this.input.val());
if (val === false) {
val = '';
}
}
this._val = this.originVal = val;
this.input.val(val);
},
_initDisabled: function () {
var opts = this.opts;
this._disabled = opts.disabled === true ? true : opts.disabled === false ? false : !!this.input.attr('disabled');
this.originDisabled = this._disabled;
this._handleDisabled(this._disabled);
},
_bindEvent: function () {
var self = this, opts = self.opts;
var KEYS = {
'up': 38,
'down': 40
}
var mouseWheel = $.support.mozilla ? 'DOMMouseScroll' : 'mousewheel';
this.input.on('keydown', function (e) {
var which = e.which;
if (which == KEYS.up || which == KEYS.down) {
if (!opts.keyEnable) {
return;
}
var operator = which == KEYS.up ? 'plus' : 'minus';
self._handleAdjusting(operator);
e.preventDefault();
}
})
.on('keypress', function (e) {
var charCode = typeof e.charCode != 'undefined' ? e.charCode : e.keyCode;
var keyChar = $.trim(String.fromCharCode(charCode));
if (charCode != 0 && !self.allowedReg.test(keyChar)) {
e.preventDefault();
}
})
.on('keyup', function (e) {
self._clearAutoRepeat();
})
.on('focus', function (e) {
self.focus = true;
//self.wrap.addClass(opts.activeCls);
})
.on('blur', function (e) {
self.focus = false;
//self.wrap.removeClass(opts.activeCls);
var val = $.trim(self.input.val());
//alert('blur')
//self._clearAutoRepeat();
if (val === self._val) {
return;
}
if (!self.setValue(val)) {
self.input.val(self._val);
}
})
.on(mouseWheel, function (e) {
e.preventDefault();
if (!self.focus || !opts.wheelEnable) {
return;
}
e = e.originalEvent;
var delta = e.wheelDelta ? (e.wheelDelta / 120) : (-e.detail / 3);
var operator = delta == 1 ? 'plus' : 'minus';
var val = self.input.val();
if (val !== self._val && !self.setValue(val)) {
self.input.val(this._val);
}
self._adjustVal(operator);
});
},
/**
*对原始值进行处理
*@return {false || string || number} 原始值为空返回'',为NaN返回false,为number返回处理好的数字
*/
_getProcessedVal: function (val) {
if (typeof val == 'string' && $.trim(val) === '') {
return '';
}
if (typeof val == 'string' && $.trim(val) === '自动') {
return val;
}
val = parseFloat(val);
if (isNaN(val)) {
return false;
}
val = val > this.max ? this.max : val < this.min ? this.min : val;
val = val.toFixed(this.precision);
if (!this.opts.forceDecimal) {
val = parseFloat(val);
}
return val;
},
enable: function () {
this._handleDisabled(false);
},
disable: function () {
this._handleDisabled(true);
},
_handleDisabled: function (disabled) {
var opts = this.opts;
disabled === true ? this.input.addClass(opts.inputDisabledCls) : this.input.removeClass(opts.inputDisabledCls);
this._disabled = disabled;
this.input.attr('disabled', disabled);
},
/**
*有微调发生时,对微调进行处理
*/
_handleAdjusting: function (operator) {
var val = this.input.val();
if (val !== this._val && !this.setValue(val)) {
this.input.val(this._val);
}
//已经到达最大值,最小值时
if ((this._val === this.max && operator == 'plus') || (this._val === this.min && operator == 'minus')) {
return;
}
if (this.opts.autoRepeat) {
this._clearAutoRepeat();
this._setAutoRepeat(operator);
}
this._adjustVal(operator);
},
/**
*微调值
*/
_adjustVal: function (operator) {
//已经到达最大值,最小值时
if ((this._val === this.max && operator == 'plus') || (this._val === this.min && operator == 'minus')) {
this._clearAutoRepeat();
return;
}
var baseVal = this._val !== '' ? this._val : this.min < 0 && this.min > Number.NEGATIVE_INFINITY ? this.min : 0;
var val = operator == 'plus' ? baseVal + this.step : baseVal - this.step;
this.setValue(val);
},
_setAutoRepeat: function (operator) {
var opts = this.opts, self = this;
self.autoTimer = window.setTimeout(function () {
self.autoRepeater = window.setInterval(function () {
self._adjustVal(operator);
}, opts.interval);
}, opts.delay);
},
_clearAutoRepeat: function () {
if (this.autoTimer) {
window.clearTimeout(this.autoTimer);
}
if (this.autoRepeater) {
window.clearTimeout(this.autoRepeater);
}
},
setValue: function (val) {
var opts = this.opts;
if (this._disabled) {
return;
}
val = this._getProcessedVal(val);
if (val === false) {
return;
}
this.input.val(val);
this._val = val;
return true;
}
}
$.NumberField.defaults = {
value: undefined,
max: undefined,
min: undefined,
step: 1,
decimal: false,
precision: 2,
disabled: undefined,
keyEnable: false,
wheelEnable: false,
autoRepeat: true,
delay: 400,
interval: 80,
inputCls: 'ui-input',
inputDisabledCls: 'ui-input-disabled'
}
})(jQuery);
exports('spinbox', null);
});
/**
*Spinbox插件 扩展自 NumberField
*带微调按钮的数字输入框
*/
// 明细账选择凭证的工具函数
var voucherUtil = {
tableHtmlDom: '<table class="voucher" cellpadding="0" cellspacing="0" id="voucher">' +
'<thead>' +
' <tr>' +
' <th class="col_operate"></th>' +
' <th class="col_summary">摘要</th>' +
' <th class="col_voucher">凭证</th>' +
' <th class="col_subject">会计科目</th>' +
' <th class="col_money"> <strong class="tit">借方金额</strong>' +
' <div class="money_unit"> <span>亿</span> <span>千</span> <span>百</span> <span>十</span> <span>万</span> <span>千</span> <span>百</span> <span>十</span> <span>元</span> <span>角</span> <span class="last">分</span> </div>' +
' </th>' +
' <th class="col_money"> <strong class="tit">贷方金额</strong>' +
' <div class="money_unit"> <span>亿</span> <span>千</span> <span>百</span> <span>十</span> <span>万</span> <span>千</span> <span>百</span> <span>十</span> <span>元</span> <span>角</span> <span class="last">分</span> </div>' +
' </th>' +
' </tr>' +
' </thead>' +
' <tbody id="useTable">' +
' </tbody>' +
' <tfoot>' +
' <tr>' +
' <td colspan="4" class="col_total">合计:<span id="capAmount"></span></td>' +
' <td class="col_debite"><div class="cell_val debit_total" id="debit_total"></div></td>' +
' <td class="col_credit"><div class="cell_val credit_total" id="credit_total"></div></td>' +
' </tr></tfoot>' +
'</table>',
tBodyItemHtmlDom: '<tr class="entry_item">' +
' <td class="col_operate"><div class="operate"><i class="fa fa-trash-o del" aria-hidden="true" title="删除"></i></div></td>' +
' <td class="col_summary" data-edit="summary">' +
' <textarea class="layui-textarea" maxlength="200"></textarea>' +
' </td>' +
' <td class="col_voucher" data-edit="voucher">' +
' <div class="cell_val voucher_val"></div>' +
' </td>' +
' <td class="col_subject" data-edit="subject">' +
' <div class="cell_val subject_val"></div>' +
' </td>' +
' <td class="col_debite" data-edit="money"><div class="cell_val debit_val"></div></td>' +
' <td class="col_credit" data-edit="money"><div class="cell_val credit_val"></div></td>' +
' </tr>',
/**
* 初始化
*
* @param boxId dom的id
*/
init: function (boxId){
$("#" + boxId).html(voucherUtil.tableHtmlDom);
for(var i = 0; i < 2; i++){
voucherUtil.addItem();
}
voucherUtil.initClickEvent();
},
initClickEvent: function (){
$("body").on("click", "td[data-edit]", function(){
var _this = $(this);
_this.find(".cell_val").hide();
switch ($(this).attr("data-edit")) {
case 'summary':
break;
case 'voucher': // 凭证
_this.find(".cell_val").show();
sysIfsUtil.openIfsVoucherChoosePage(function (chooseVoucherMation){
_this.find(".cell_val").attr("dataId", chooseVoucherMation.id);
_this.find(".cell_val").html(chooseVoucherMation.fileName);
});
break;
case 'subject': // 会计科目
_this.find(".cell_val").show();
sysIfsUtil.openSysAccountSubjectChoosePage(function (chooseAccountSubjectMation){
_this.find(".cell_val").attr("dataId", chooseAccountSubjectMation.id);
_this.find(".cell_val").html(chooseAccountSubjectMation.num + "_" + chooseAccountSubjectMation.name);
});
break;
case 'money':
if ($(this).find(".edit_money").length == 0) {
voucherUtil.creatinput($(this))
} else {
$(this).find(".edit_money").show().focus();
$(this).find(".cell_val").hide();
}
break;
}
});
$("body").on("click", ".col_operate .del", function(){
var tBody = $("#useTable").find("tr");
if(tBody.length <= 2){
winui.window.msg("最少填写两行数据.", {icon: 2, time: 2000});
return false;
}
$(this).parents("tr").remove();
});
},
creatinput: function (_this) {
var oInput = $('<input type="text" class="edit_money" autocomplete="off" />').numberField({
decimal: true,
max: 999999999.99,
keyEnable: false
}).bind('keydown', function (e) {
var keyValue = e.which, value = $(this).val(), parentTd = $(this).parent(),
parentTr = $(this).parents('tr.entry_item'), nextTr = parentTr.next();
if (parentTd.hasClass('col_debite')) {
parentTr.find('.credit_val').text('');
} else {
parentTr.find('.debit_val').text('');
}
}).bind('blur', function () {
var currAmount = $(this).val() === '' ? 0 : Number($(this).val()).toFixed(2).replace(".", "");
if (currAmount != 0) {
$(this).parent().find(".cell_val").html(currAmount).show();
} else {
$(this).parent().find(".cell_val").html("").show();
}
if (voucherUtil.adddebit_total($(".debit_val")) <= 999999999.99) {
$("#debit_total").text(voucherUtil.adddebit_total($(".debit_val")))
} else {
alert("借方金额合计太大")
}
if (voucherUtil.adddebit_total($(".credit_val")) <= 999999999.99) {
$("#credit_total").text(voucherUtil.adddebit_total($(".credit_val")))
} else {
$("#credit_total").text(voucherUtil.adddebit_total($(".credit_val")))
alert("贷方金额合计太大")
}
$(this).hide();
}).appendTo(_this).select();
},
adddebit_total: function (obj) {
var number = 0;
for (var i = 0; i < obj.length; i++) {
if (obj.eq(i).text() != '') {
number = number + parseFloat(obj.eq(i).text())
}
}
return number;
},
/**
* 新增一个新的item
*/
addItem: function (){
$("#useTable").append(voucherUtil.tBodyItemHtmlDom);
},
/**
* 获取数据
*/
getData: function (){
var tBody = $("#useTable").find("tr");
if(tBody.length < 2){
winui.window.msg("请最少填写两行数据.", {icon: 2, time: 2000});
return null;
}
var result = [];
$.each(tBody, function (i, item){
var _this = $(item);
var subjectId = _this.find(".col_subject").find(".cell_val").attr("dataId");
var debiteMoney = _this.find(".col_debite").find(".cell_val").html(); // 借方金额
var creditMoney = _this.find(".col_credit").find(".cell_val").html(); // 贷方金额
if(isNull(subjectId)){
winui.window.msg("请选择会计科目.", {icon: 2, time: 2000});
return false;
}
if(isNull(debiteMoney) && isNull(creditMoney)){
winui.window.msg("借方金额和贷方金额最少填写一项.", {icon: 2, time: 2000});
return false;
}
result.push({
remark: _this.find(".col_summary").find("textarea").val(),
voucherId: _this.find(".col_voucher").find(".cell_val").attr("dataId"),
subjectId: subjectId,
debiteMoney: debiteMoney,
creditMoney: creditMoney
});
});
return result;
}
}
\ No newline at end of file
.voucher {
border-collapse: collapse
}
.voucher th {
height: 48px;
color: #555555;
font-size: 14px;
text-align: center;
font-weight: bold;
overflow: hidden;
}
.voucher .col_money {
font-size: 12px;
}
.voucher .col_money .tit {
display: block;
height: 25px;
line-height: 25px;
}
.voucher .money_unit {
height: 22px;
line-height: 22px;
font-weight: normal;
border-top: 1px solid #dadada;
text-align: center;
}
.voucher .money_unit span {
float: left;
display: inline;
width: 19px;
height: 100%;
margin-right: 1px;
background-color: #fff;
}
.voucher .money_unit .last {
margin-right: 0;
width: 18px;
}
.voucher th, .voucher td {
border: 1px solid #ccc;
}
.voucher td.col_debite, .voucher td.col_credit, .voucher td.col_money, .money_unit {
background-image: url(../../../../images/voucher/money_rp.png);
background-repeat: repeat-y;
}
.voucher td {
height: 60px;
}
.voucher .col_debite, .voucher .col_credit, .voucher .col_money {
width: 218px;
}
.col_summary textarea {
width: 200px;
height: 50px;
min-height: 50px;
border: 0px;
}
.col_voucher .cell_val {
width: 240px;
word-break: break-all;
word-wrap: break-word;
}
.col_subject .cell_val {
width: 240px;
word-break: break-all;
word-wrap: break-word;
}
.col_debite .cell_val,
.col_credit .cell_val{
width: 220px;
}
.voucher .col_operate {
text-align: center;
width: 26px;
border-right: 1px solid #ccc;
}
.voucher .col_operate .operate{
height: 100%;
}
.voucher .col_operate .operate i{
line-height: 50px;
width: 26px;
font-size: 15px;
z-index: 100;
}
.voucher .col_operate .operate i:hover{
cursor: pointer;
}
.edit_summary, .edit_money, .edit_subject {
float: left;
outline: none;
resize: none;
border: 2px solid #4bb8f3;
box-shadow: rgba(0, 0, 0, .1) 0 1px 2px 1px inset;
height: 50px;
padding: 3px;
overflow: hidden;
line-height: 50px \9;
}
.edit_money {
font-family: Verdana, Geneva, sans-serif;
font-size: 20px;
width: 208px;
text-align: right;
overflow: hidden;
ime-mode: disabled;
}
.voucher .col_debite .cell_val, .voucher .col_credit .cell_val {
overflow: hidden;
font-family: 'tahoma';
font-weight: bold;
font-size: 14px;
letter-spacing: 11px;
overflow: hidden;
position: relative;
right: -5px;
*right: 4px;
text-align: right;
}
.cell_val {
}
.choose_btn{
top: 0px;
right: 0px;
position: relative;
float: right;
}
.entry_item:hover {
background-color: #f8f8f8;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册