|
|
@@ -1,13 +1,13 @@
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
|
<head>
|
|
|
- <th:block th:include="include :: header('新增工资')" />
|
|
|
+ <th:block th:include="include :: header('新增薪金')" />
|
|
|
<th:block th:include="include :: datetimepicker-css" />
|
|
|
</head>
|
|
|
<body class="white-bg">
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
|
<form class="form-horizontal m" id="form-salary-add">
|
|
|
- <h4 class="form-header h4">工资信息</h4>
|
|
|
+ <h4 class="form-header h4">薪金信息</h4>
|
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label">用户:</label>
|
|
|
@@ -23,7 +23,7 @@
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label">薪水分类:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <select name="subjectType" id="subjectType" class="form-control" th:with="type=${@dict.getType('subject_type')}">
|
|
|
+ <select name="salaryType" id="salaryType" class="form-control" th:with="type=${@dict.getType('subject_type')}">
|
|
|
<option value="">请选择</option>
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
|
|
</select>
|
|
|
@@ -32,7 +32,7 @@
|
|
|
</div>
|
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">工资日期:</label>
|
|
|
+ <label class="col-sm-3 control-label">薪金日期:</label>
|
|
|
<div class="col-sm-8">
|
|
|
<div class="input-group date">
|
|
|
<input name="salaryDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
|
@@ -43,17 +43,17 @@
|
|
|
</div>
|
|
|
<div class="col-xs-12">
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">工资总金额:</label>
|
|
|
+ <label class="col-sm-3 control-label">薪金总金额:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <input name="sumAmount" class="form-control" type="text">
|
|
|
+ <input name="sumAmount" id="sumAmount" class="form-control" type="text">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <h4 class="form-header h4">工资明细信息</h4>
|
|
|
+ <h4 class="form-header h4">薪金明细信息</h4>
|
|
|
<div class="row">
|
|
|
<div class="col-xs-12">
|
|
|
- <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
|
|
|
- <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
|
|
|
+<!-- <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>-->
|
|
|
+<!-- <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>-->
|
|
|
<div class="col-sm-12 select-table table-striped">
|
|
|
<table id="bootstrap-table"></table>
|
|
|
</div>
|
|
|
@@ -72,6 +72,7 @@
|
|
|
|
|
|
function submitHandler() {
|
|
|
if ($.validate.form()) {
|
|
|
+ console.log($('#form-salary-add').serialize());
|
|
|
$.operate.save(prefix + "/add", $('#form-salary-add').serialize());
|
|
|
}
|
|
|
}
|
|
|
@@ -98,8 +99,11 @@
|
|
|
align: 'center',
|
|
|
title: "序号",
|
|
|
formatter: function (value, row, index) {
|
|
|
- var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
|
|
- return columnIndex + $.table.serialNumber(index);
|
|
|
+ var actions = [];
|
|
|
+ actions.push($.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index)));
|
|
|
+ actions.push($.common.sprintf("<input class='form-control' type='hidden' name='salaryDetailList[%s].baseFlag' value='%s'>", index, row.baseFlag));
|
|
|
+ actions.push($.common.sprintf("<input class='form-control' type='hidden' name='salaryDetailList[%s].salarySubjectId' value='%s'>", index, row.salarySubjectId));
|
|
|
+ return actions.join('') + $.table.serialNumber(index);
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -116,7 +120,6 @@
|
|
|
title: '基准标记',
|
|
|
visible: false,
|
|
|
formatter: function(value, row, index) {
|
|
|
- console.log(index + "|" + value);
|
|
|
var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].baseFlag' value='%s'>", index, value)
|
|
|
return html;
|
|
|
}
|
|
|
@@ -165,18 +168,18 @@
|
|
|
$.table.init(options);
|
|
|
});
|
|
|
|
|
|
- function addRow() {
|
|
|
- var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
|
|
- var row = {
|
|
|
- index: $.table.serialNumber(count),
|
|
|
- subjectName: "",
|
|
|
- baseFlag: "",
|
|
|
- percent: 0,
|
|
|
- formula: "",
|
|
|
- amount: "",
|
|
|
- }
|
|
|
- sub.addRow(row);
|
|
|
- }
|
|
|
+ // function addRow() {
|
|
|
+ // var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
|
|
+ // var row = {
|
|
|
+ // index: $.table.serialNumber(count),
|
|
|
+ // subjectName: "",
|
|
|
+ // baseFlag: "",
|
|
|
+ // percent: 0,
|
|
|
+ // formula: "",
|
|
|
+ // amount: "",
|
|
|
+ // }
|
|
|
+ // sub.addRow(row);
|
|
|
+ // }
|
|
|
|
|
|
$(document).on("blur", "input[type='text'].detail-amount", function () {
|
|
|
let name = $(this).attr("name");
|
|
|
@@ -186,6 +189,7 @@
|
|
|
index: index, // 你想修改哪行,0表示第一行
|
|
|
row: {
|
|
|
index: $.table.serialNumber(index + 1),
|
|
|
+ salarySubjectId: $("#" + table.options.id).bootstrapTable('getData')[index].salarySubjectId,
|
|
|
subjectName: $("#" + table.options.id).bootstrapTable('getData')[index].subjectName,
|
|
|
baseFlag: $("#" + table.options.id).bootstrapTable('getData')[index].baseFlag,
|
|
|
percent: $("#" + table.options.id).bootstrapTable('getData')[index].percent,
|
|
|
@@ -196,12 +200,13 @@
|
|
|
|
|
|
let allData = $("#" + table.options.id).bootstrapTable('getData');
|
|
|
let changeRow = allData[index];
|
|
|
+ let sumAmt = 0;
|
|
|
|
|
|
if (changeRow.baseFlag === "Y") {
|
|
|
- let baseValue = changeRow.amount;
|
|
|
-
|
|
|
+ let baseValue = parseFloat(changeRow.amount);
|
|
|
+ sumAmt = sumAmt + baseValue;
|
|
|
for (let i = 0; i < allData.length; i++) {
|
|
|
- if (i !== index) {
|
|
|
+ if (i != index) {
|
|
|
let curRow = allData[i];
|
|
|
let curAmt = 0;
|
|
|
if ($.common.isEmpty(curRow.formula)) {
|
|
|
@@ -212,10 +217,12 @@
|
|
|
// 使用formula计算
|
|
|
curAmt = eval(curRow.formula).toFixed(2);
|
|
|
}
|
|
|
+ sumAmt = sumAmt + parseFloat(curAmt);
|
|
|
$("#" + table.options.id).bootstrapTable('updateRow', {
|
|
|
index: i, // 你想修改哪行,0表示第一行
|
|
|
row: {
|
|
|
index: $.table.serialNumber(i+1),
|
|
|
+ salarySubjectId: curRow.salarySubjectId,
|
|
|
subjectName: curRow.subjectName,
|
|
|
baseFlag: curRow.baseFlag,
|
|
|
percent: curRow.percent,
|
|
|
@@ -226,15 +233,15 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ $("#sumAmount").val(sumAmt);
|
|
|
});
|
|
|
|
|
|
- $("#subjectType").blur(function(){
|
|
|
+ $("#salaryType").blur(function(){
|
|
|
|
|
|
$("#" + table.options.id).bootstrapTable('removeAll');
|
|
|
- console.log($("#subjectType").val());
|
|
|
|
|
|
$.ajax({
|
|
|
- url: ctx + "business/subject/getlist/" + $("#subjectType").val(),
|
|
|
+ url: ctx + "business/subject/getlist/" + $("#salaryType").val(),
|
|
|
type: "get",
|
|
|
processData: false,
|
|
|
contentType: false,
|
|
|
@@ -251,6 +258,7 @@
|
|
|
|
|
|
var row = {
|
|
|
index: $.table.serialNumber(count),
|
|
|
+ salarySubjectId: result.rows[i].salarySubjectId,
|
|
|
subjectName: result.rows[i].subjectName,
|
|
|
baseFlag: result.rows[i].baseFlag,
|
|
|
percent: result.rows[i].percent,
|