|
@@ -25,9 +25,9 @@
|
|
|
<div class="form-group">
|
|
<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="col-sm-8">
|
|
|
- <select name="subjectType" class="form-control" th:with="type=${@dict.getType('subject_type')}" readonly="readonly">
|
|
|
|
|
|
|
+ <select name="salaryType" id="salaryType" class="form-control" th:with="type=${@dict.getType('subject_type')}">
|
|
|
<option value="">请选择</option>
|
|
<option value="">请选择</option>
|
|
|
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{subjectType}"></option>
|
|
|
|
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{salaryType}"></option>
|
|
|
</select>
|
|
</select>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -66,6 +66,7 @@
|
|
|
<th:block th:include="include :: footer" />
|
|
<th:block th:include="include :: footer" />
|
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
<th:block th:include="include :: datetimepicker-js" />
|
|
|
<script th:inline="javascript">
|
|
<script th:inline="javascript">
|
|
|
|
|
+ var baseFlagDatas = [[${@dict.getType('sys_yes_no')}]];
|
|
|
var prefix = ctx + "business/salary";
|
|
var prefix = ctx + "business/salary";
|
|
|
$("#form-salary-edit").validate({
|
|
$("#form-salary-edit").validate({
|
|
|
focusCleanup: true
|
|
focusCleanup: true
|
|
@@ -100,21 +101,14 @@
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
title: "序号",
|
|
title: "序号",
|
|
|
formatter: function (value, row, index) {
|
|
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);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- field: 'salarySubjectId',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- title: '工资科目',
|
|
|
|
|
- formatter: function(value, row, index) {
|
|
|
|
|
- var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].salarySubjectId' value='%s'>", index, value);
|
|
|
|
|
- return html;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
field: 'subjectName',
|
|
field: 'subjectName',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
title: '科目名',
|
|
title: '科目名',
|
|
@@ -123,94 +117,178 @@
|
|
|
return html;
|
|
return html;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
- field: 'amount',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- title: '金额',
|
|
|
|
|
|
|
+ field: 'baseFlag',
|
|
|
|
|
+ title: '基准标记',
|
|
|
|
|
+ visible: false,
|
|
|
formatter: function(value, row, index) {
|
|
formatter: function(value, row, index) {
|
|
|
- var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].amount' value='%s'>", index, value);
|
|
|
|
|
|
|
+ var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].baseFlag' value='%s'>", index, value)
|
|
|
return html;
|
|
return html;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
- field: 'delFlag',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- title: '删除标志',
|
|
|
|
|
|
|
+ field: 'baseFlagName',
|
|
|
|
|
+ title: '基准标记',
|
|
|
formatter: function(value, row, index) {
|
|
formatter: function(value, row, index) {
|
|
|
- var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].delFlag' value='%s'>", index, value);
|
|
|
|
|
- return html;
|
|
|
|
|
|
|
+ return $.table.selectDictLabel(baseFlagDatas, row.baseFlag);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
- field: 'createBy',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- title: '创建者',
|
|
|
|
|
|
|
+ field: 'percent',
|
|
|
|
|
+ title: '占比',
|
|
|
formatter: function(value, row, index) {
|
|
formatter: function(value, row, index) {
|
|
|
- var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].createBy' value='%s'>", index, value);
|
|
|
|
|
|
|
+ var html = $.common.sprintf("<input class='form-control' readonly='readonly' type='text' name='salaryDetailList[%s].percent' value='%s'>", index, value);
|
|
|
return html;
|
|
return html;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
- field: 'createTime',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- title: '创建时间',
|
|
|
|
|
|
|
+ field: 'formula',
|
|
|
|
|
+ title: '公式',
|
|
|
formatter: function(value, row, index) {
|
|
formatter: function(value, row, index) {
|
|
|
- var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].createTime' value='%s'>", index, value);
|
|
|
|
|
|
|
+ var html = $.common.sprintf("<input class='form-control' readonly='readonly' type='text' name='salaryDetailList[%s].formula' value='%s'>", index, value);
|
|
|
return html;
|
|
return html;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
{
|
|
{
|
|
|
- field: 'updateBy',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- title: '更新者',
|
|
|
|
|
- formatter: function(value, row, index) {
|
|
|
|
|
- var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].updateBy' value='%s'>", index, value);
|
|
|
|
|
- return html;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
- field: 'updateTime',
|
|
|
|
|
|
|
+ field: 'amount',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- title: '更新时间',
|
|
|
|
|
|
|
+ title: '金额',
|
|
|
formatter: function(value, row, index) {
|
|
formatter: function(value, row, index) {
|
|
|
- var html = $.common.sprintf("<input class='form-control' type='text' name='salaryDetailList[%s].updateTime' value='%s'>", index, value);
|
|
|
|
|
|
|
+ var html = $.common.sprintf("<input class='form-control detail-amount' type='text' name='salaryDetailList[%s].amount' value='%s'>", index, value);
|
|
|
return html;
|
|
return html;
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
- title: '操作',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- formatter: function(value, row, index) {
|
|
|
|
|
- var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
|
|
|
|
|
- return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
|
|
|
|
|
- }
|
|
|
|
|
- }]
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ // {
|
|
|
|
|
+ // title: '操作',
|
|
|
|
|
+ // align: 'center',
|
|
|
|
|
+ // formatter: function(value, row, index) {
|
|
|
|
|
+ // var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
|
|
|
|
|
+ // return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ ]
|
|
|
};
|
|
};
|
|
|
$.table.init(options);
|
|
$.table.init(options);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- function addRow() {
|
|
|
|
|
- var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
|
|
|
|
- var row = {
|
|
|
|
|
- index: $.table.serialNumber(count),
|
|
|
|
|
- salarySubjectId: "",
|
|
|
|
|
- subjectName: "",
|
|
|
|
|
- amount: "",
|
|
|
|
|
- delFlag: "",
|
|
|
|
|
- createBy: "",
|
|
|
|
|
- createTime: "",
|
|
|
|
|
- updateBy: "",
|
|
|
|
|
- updateTime: "",
|
|
|
|
|
|
|
+ // function addRow() {
|
|
|
|
|
+ // var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
|
|
|
|
+ // var row = {
|
|
|
|
|
+ // index: $.table.serialNumber(count),
|
|
|
|
|
+ // salarySubjectId: "",
|
|
|
|
|
+ // subjectName: "",
|
|
|
|
|
+ // amount: "",
|
|
|
|
|
+ // delFlag: "",
|
|
|
|
|
+ // createBy: "",
|
|
|
|
|
+ // createTime: "",
|
|
|
|
|
+ // updateBy: "",
|
|
|
|
|
+ // updateTime: "",
|
|
|
|
|
+ // }
|
|
|
|
|
+ // sub.addRow(row);
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ $(document).on("blur", "input[type='text'].detail-amount", function () {
|
|
|
|
|
+ let name = $(this).attr("name");
|
|
|
|
|
+ const index = name.split('[')[1].split(']')[0];
|
|
|
|
|
+
|
|
|
|
|
+ $("#" + table.options.id).bootstrapTable('updateRow', {
|
|
|
|
|
+ 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,
|
|
|
|
|
+ formula: $("#" + table.options.id).bootstrapTable('getData')[index].formula,
|
|
|
|
|
+ amount: $(this).val(),
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ let allData = $("#" + table.options.id).bootstrapTable('getData');
|
|
|
|
|
+ let changeRow = allData[index];
|
|
|
|
|
+ let sumAmt = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (changeRow.baseFlag === "Y") {
|
|
|
|
|
+ let baseValue = parseFloat(changeRow.amount);
|
|
|
|
|
+ sumAmt = sumAmt + baseValue;
|
|
|
|
|
+ for (let i = 0; i < allData.length; i++) {
|
|
|
|
|
+ if (i != index) {
|
|
|
|
|
+ let curRow = allData[i];
|
|
|
|
|
+ let curAmt = 0;
|
|
|
|
|
+ if ($.common.isEmpty(curRow.formula)) {
|
|
|
|
|
+ // 使用percent计算
|
|
|
|
|
+ let curPercent = parseFloat(curRow.percent) || 0;
|
|
|
|
|
+ curAmt = (baseValue * curPercent / 100).toFixed(2);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 使用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,
|
|
|
|
|
+ formula: curRow.formula,
|
|
|
|
|
+ amount: curAmt,
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- sub.addRow(row);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $("#sumAmount").val(sumAmt);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // $("#salaryType").blur(function(){
|
|
|
|
|
+ //
|
|
|
|
|
+ // $("#" + table.options.id).bootstrapTable('removeAll');
|
|
|
|
|
+ //
|
|
|
|
|
+ // $.ajax({
|
|
|
|
|
+ // url: ctx + "business/subject/getlist/" + $("#salaryType").val(),
|
|
|
|
|
+ // type: "get",
|
|
|
|
|
+ // processData: false,
|
|
|
|
|
+ // contentType: false,
|
|
|
|
|
+ // beforeSend: function () {
|
|
|
|
|
+ // $.modal.loading("正在处理中,请稍后...");
|
|
|
|
|
+ // $.modal.disable();
|
|
|
|
|
+ // },
|
|
|
|
|
+ // success: function (result) {
|
|
|
|
|
+ // if (result.code === web_status.SUCCESS) {
|
|
|
|
|
+ // console.log(result.rows);
|
|
|
|
|
+ // if (result.rows.length > 0) {
|
|
|
|
|
+ // for (var i = 0; i < result.rows.length; i++) {
|
|
|
|
|
+ // var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
|
|
|
|
+ //
|
|
|
|
|
+ // 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,
|
|
|
|
|
+ // formula: result.rows[i].formula,
|
|
|
|
|
+ // amount: "0",
|
|
|
|
|
+ // }
|
|
|
|
|
+ // console.log(row);
|
|
|
|
|
+ // sub.addRow(row);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ //
|
|
|
|
|
+ // // $.modal.alertSuccess(result.msg)
|
|
|
|
|
+ // } else if (result.code === web_status.WARNING) {
|
|
|
|
|
+ // $.modal.alertWarning(result.msg)
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // $.modal.alertError(result.msg);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // $.modal.closeLoading();
|
|
|
|
|
+ // $.modal.enable();
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ //
|
|
|
|
|
+ // });
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
</body>
|
|
</body>
|
|
|
</html>
|
|
</html>
|