工程預付款冲销修改
This commit is contained in:
parent
ac2722c3cb
commit
e377fda7e5
|
|
@ -0,0 +1,22 @@
|
|||
package com.bonus.boot.manager.basic.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class AccountBean {
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
private String remark;
|
||||
private String month;
|
||||
private String reverseId;
|
||||
private String type;
|
||||
private BigDecimal amount;
|
||||
private String proId;
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -110,8 +110,6 @@ public class PrepaymentController {
|
|||
int i = service.addOperations(bean);
|
||||
if(i>0){
|
||||
ar.setFailMsg(GlobalConst.SAVE_SUCCEED);
|
||||
}else if(i==-1){
|
||||
ar.setFailMsg("当前月份已经存在");
|
||||
} else{
|
||||
ar.setFailMsg(GlobalConst.SAVE_FAIL);
|
||||
}
|
||||
|
|
@ -126,8 +124,6 @@ public class PrepaymentController {
|
|||
int i = service.updateOperations(bean);
|
||||
if(i>0){
|
||||
ar.setFailMsg(GlobalConst.SAVE_SUCCEED);
|
||||
}else if(i==-1){
|
||||
ar.setFailMsg("当前月份已经存在");
|
||||
} else{
|
||||
ar.setFailMsg(GlobalConst.SAVE_FAIL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.bonus.boot.manager.ca.bm.dao;
|
|||
|
||||
import com.bonus.boot.manager.ca.bm.entity.OperationsBean;
|
||||
import com.bonus.boot.manager.ca.bm.entity.PrepaymentBean;
|
||||
import com.bonus.boot.manager.tools.entity.ToolsBean;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
@ -49,6 +48,19 @@ public interface PrepaymentDao {
|
|||
*/
|
||||
OperationsBean getOperationsById(String id);
|
||||
|
||||
/**
|
||||
* 将子表的数据删除。
|
||||
* @param prepaymentId
|
||||
*/
|
||||
void delOperationsByPrepaymentId(Long prepaymentId);
|
||||
|
||||
/**
|
||||
* 获取 agingMonths
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getAgingMonths(String id);
|
||||
|
||||
List<PrepaymentBean> getDictList(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
|
||||
|
||||
PrepaymentBean getById(Long id);
|
||||
|
|
|
|||
|
|
@ -44,4 +44,6 @@ public class OperationsBean {
|
|||
private String userName; //用户名
|
||||
|
||||
private String projectName; //工程名称
|
||||
|
||||
private String reverseId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ public class PrepaymentBean {
|
|||
private String updatedTime;//更新时间
|
||||
private String keyword; //关键字
|
||||
|
||||
private String month;//备注
|
||||
|
||||
private String agingMonths; //账龄(月)
|
||||
private String state; //状态
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.YearMonth;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -46,6 +49,17 @@ public class PrepaymentServiceImpl implements PrepaymentService {
|
|||
public int addPrepayment(PrepaymentBean prepaymentBean) {
|
||||
prepaymentBean.setOperator(UserUtil.getLoginUser().getId().toString());
|
||||
int i = dao.addPrepayment(prepaymentBean);
|
||||
if(i>0){
|
||||
//将初始金额新增进去
|
||||
OperationsBean bean = new OperationsBean();
|
||||
bean.setPrepaymentId(prepaymentBean.getId());
|
||||
bean.setMonth(prepaymentBean.getFirstPaymentDate().substring(0,7));
|
||||
bean.setOperationType("2");
|
||||
bean.setAmount(prepaymentBean.getInitialAmount());
|
||||
bean.setExecutor(UserUtil.getLoginUser().getId().toString());
|
||||
bean.setRemarks("初始金额");
|
||||
int k = dao.addOperations(bean);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -53,22 +67,30 @@ public class PrepaymentServiceImpl implements PrepaymentService {
|
|||
public int addOperations(OperationsBean bean) {
|
||||
bean.setOperator(UserUtil.getLoginUser().getId().toString());
|
||||
int i = 0;
|
||||
int j = dao.getMath(bean);
|
||||
if(j>0){
|
||||
i = -1;
|
||||
}else{
|
||||
int k = dao.addOperations(bean);
|
||||
if(k>0){
|
||||
dao.updatePrepaymentId(bean);
|
||||
i = 1;
|
||||
}
|
||||
int k = dao.addOperations(bean);
|
||||
if(k>0){
|
||||
dao.updatePrepaymentId(bean);
|
||||
i = 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrepaymentBean getListById(String id) {
|
||||
return dao.getListById(id);
|
||||
PrepaymentBean bean = dao.getListById(id);
|
||||
//单独查账龄
|
||||
String month = dao.getAgingMonths(id);
|
||||
if(month != null){
|
||||
// 解析字符串为 YearMonth 对象
|
||||
YearMonth ym1 = YearMonth.parse(month);
|
||||
YearMonth ym2 = YearMonth.now();
|
||||
// 计算两个日期之间的月份数差
|
||||
long monthsBetween = ChronoUnit.MONTHS.between(ym1, ym2) + 1;
|
||||
bean.setAgingMonths(String.valueOf(monthsBetween));
|
||||
}else{
|
||||
bean.setAgingMonths("0");
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -86,22 +108,19 @@ public class PrepaymentServiceImpl implements PrepaymentService {
|
|||
public void delPrepayment(Long id) {
|
||||
String userId =UserUtil.getLoginUser().getId().toString();
|
||||
dao.delPrepayment(id,userId);
|
||||
//将子表的删除数据也删除
|
||||
dao.delOperationsByPrepaymentId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOperations(OperationsBean bean) {
|
||||
bean.setOperator(UserUtil.getLoginUser().getId().toString());
|
||||
int i = 0;
|
||||
int j = dao.getMath(bean);
|
||||
if(j>0){
|
||||
i = -1;
|
||||
}else{
|
||||
int k = dao.updateOperations(bean);
|
||||
if(k>0){
|
||||
dao.updatePrepaymentId(bean);
|
||||
i = 1;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.boot.manager.manager.controller;
|
||||
|
||||
import com.bonus.boot.manager.basic.entity.AccountBean;
|
||||
import com.bonus.boot.manager.basic.entity.MapBean;
|
||||
import com.bonus.boot.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.manager.manager.entity.R;
|
||||
|
|
@ -89,5 +90,14 @@ public class UtilController {
|
|||
List<MapBean> list = service.getSetMeal(o);
|
||||
return R.okTable(list, list.size());
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping(value = "/getNeedReverse")
|
||||
@ApiOperation(value = "人冲销列表select列表")
|
||||
public List<AccountBean> getNeedReverse(AccountBean o) {
|
||||
List<AccountBean> result = service.getNeedReverse(o);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
package com.bonus.boot.manager.manager.dao;
|
||||
|
||||
import com.bonus.boot.manager.basic.entity.AccountBean;
|
||||
import com.bonus.boot.manager.basic.entity.MapBean;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
|
@ -56,4 +57,6 @@ public interface UtilDao {
|
|||
int userteltpone(String phone);
|
||||
|
||||
List<MapBean> getHazard();
|
||||
|
||||
List<AccountBean> getNeedReverse(AccountBean o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.boot.manager.manager.service;
|
||||
|
||||
import com.bonus.boot.manager.basic.entity.AccountBean;
|
||||
import com.bonus.boot.manager.basic.entity.MapBean;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -40,4 +41,6 @@ public interface UtilService {
|
|||
List<MapBean> getSetMeal(MapBean bean);
|
||||
|
||||
List<MapBean> getHazard();
|
||||
|
||||
List<AccountBean> getNeedReverse(AccountBean o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,18 @@
|
|||
package com.bonus.boot.manager.manager.service.impl;
|
||||
|
||||
import com.bonus.boot.manager.basic.entity.AccountBean;
|
||||
import com.bonus.boot.manager.basic.entity.MapBean;
|
||||
import com.bonus.boot.manager.manager.dao.UtilDao;
|
||||
import com.bonus.boot.manager.manager.service.UtilService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("utilService")
|
||||
public class UtilServiceImpl implements UtilService {
|
||||
|
|
@ -55,4 +61,52 @@ public class UtilServiceImpl implements UtilService {
|
|||
public List<MapBean> getHazard() {
|
||||
return utilDao.getHazard();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AccountBean> getNeedReverse(AccountBean o) {
|
||||
String reverseId = o.getReverseId();
|
||||
o.setReverseId("");
|
||||
o.setType("2");
|
||||
List<AccountBean> result2 = utilDao.getNeedReverse(o);
|
||||
o.setType("1");
|
||||
o.setReverseId(reverseId);
|
||||
List<AccountBean> result1 = utilDao.getNeedReverse(o);
|
||||
|
||||
// 分组合并 result1
|
||||
List<AccountBean> collect1 = result1.stream()
|
||||
.collect(Collectors.groupingBy(AccountBean::getReverseId,
|
||||
Collectors.reducing(new AccountBean(), (a, b) -> {
|
||||
AccountBean merged = new AccountBean();
|
||||
merged.setKey(b.getReverseId());
|
||||
merged.setAmount((a.getAmount() == null ? BigDecimal.ZERO : a.getAmount())
|
||||
.add(b.getAmount() == null ? BigDecimal.ZERO : b.getAmount()));
|
||||
return merged;
|
||||
})))
|
||||
.values().stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 构建 collect1 的 key -> AccountBean 映射
|
||||
Map<String, AccountBean> collect1Map = collect1.stream()
|
||||
.collect(Collectors.toMap(AccountBean::getKey, a -> a));
|
||||
|
||||
// 处理 result2
|
||||
List<AccountBean> finalResult = new ArrayList<>();
|
||||
for (AccountBean bean : result2) {
|
||||
AccountBean compareBean = collect1Map.get(bean.getKey());
|
||||
if (compareBean == null) {
|
||||
bean.setValue(bean.getAmount()+" "+bean.getRemark());
|
||||
finalResult.add(bean);
|
||||
} else {
|
||||
BigDecimal diff = bean.getAmount()
|
||||
.subtract(compareBean.getAmount() == null ? BigDecimal.ZERO : compareBean.getAmount());
|
||||
if (diff.compareTo(BigDecimal.ZERO) > 0) {
|
||||
bean.setAmount(diff);
|
||||
bean.setValue(diff+" "+bean.getRemark()+"(已冲销部分)");
|
||||
finalResult.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
return finalResult;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
server.port=2002
|
||||
server.port=20020
|
||||
#????·??
|
||||
server.servlet.context-path=/yncw
|
||||
#mysql?????????
|
||||
spring.datasource.url=jdbc:mysql://192.168.0.14:4418/yncw1?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
|
||||
spring.datasource.url=jdbc:mysql://192.168.0.14:4418/yncw_real?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=Bonus@admin123!
|
||||
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/yncw_real?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
|
||||
|
|
|
|||
|
|
@ -61,6 +61,23 @@ select count(1) from pm_base_physical where telep_number=#{0} and is_active='1'
|
|||
<select id="getHazard" resultType="com.bonus.boot.manager.basic.entity.MapBean">
|
||||
select DISTINCT hazards as `key`,hazards as `value` from pm_occupation_phy_result where is_active ='1'
|
||||
</select>
|
||||
<select id="getNeedReverse" resultType="com.bonus.boot.manager.basic.entity.AccountBean">
|
||||
SELECT
|
||||
id AS `key`,
|
||||
amount,
|
||||
remarks as remark,
|
||||
reverse_id as reverseId,
|
||||
`month`
|
||||
FROM
|
||||
bm_monthly_operations
|
||||
WHERE
|
||||
p_id = #{proId}
|
||||
AND operation_type = #{type}
|
||||
and is_active = '1'
|
||||
<if test="id != null and id !=''">
|
||||
and id != #{id}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.boot.manager.ca.bm.dao.PrepaymentDao">
|
||||
|
||||
<insert id="addPrepayment">
|
||||
<insert id="addPrepayment" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
INSERT INTO `bm_project_prepayment` (`project_code`, `project_name`, `business_unit`, `contact_unit`, `type`,
|
||||
`initial_amount`, `first_payment_date`, `current_balance`, `remarks`,
|
||||
`operator`, `is_active`)
|
||||
|
|
@ -15,7 +15,11 @@
|
|||
<insert id="addOperations">
|
||||
INSERT INTO `bm_monthly_operations` (`p_id`, `month`, `operation_type`, `amount`, `executor`, `remarks`,
|
||||
`next_month`, `proposed_amount`, `handler`, `next_remarks`, `is_active`,
|
||||
`operator`,`current_balance`)
|
||||
`operator`,`current_balance`
|
||||
<if test="reverseId != null and reverseId != ''">
|
||||
, reverse_id
|
||||
</if>
|
||||
)
|
||||
VALUES (#{prepaymentId},
|
||||
#{month},
|
||||
#{operationType},
|
||||
|
|
@ -25,7 +29,11 @@
|
|||
#{nextMonth},
|
||||
#{proposedAmount},
|
||||
#{handler},
|
||||
#{nextRemarks}, '1', #{operator},#{currentBalance})
|
||||
#{nextRemarks}, '1', #{operator},#{currentBalance}
|
||||
<if test="reverseId != null and reverseId != ''">
|
||||
,#{reverseId}
|
||||
</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="add">
|
||||
|
|
@ -73,6 +81,10 @@
|
|||
<update id="updateOperations">
|
||||
UPDATE `bm_monthly_operations` SET `month` = #{month}, `operation_type` = #{operationType},
|
||||
`amount` = #{amount}, `executor` = #{executor},operator = #{operator}
|
||||
|
||||
<if test="reverseId != null and reverseId != ''">
|
||||
,reverse_id = #{reverseId}
|
||||
</if>
|
||||
<if test="remarks != null">
|
||||
,remarks = #{remarks}
|
||||
</if>
|
||||
|
|
@ -101,6 +113,11 @@
|
|||
operator = #{userId}
|
||||
WHERE `id` = #{id}
|
||||
</delete>
|
||||
<delete id="delOperationsByPrepaymentId">
|
||||
UPDATE `bm_monthly_operations`
|
||||
SET `is_active` = '0'
|
||||
WHERE `p_id` = #{prepaymentId}
|
||||
</delete>
|
||||
|
||||
<delete id="delOperations">
|
||||
UPDATE `bm_monthly_operations`
|
||||
|
|
@ -172,7 +189,7 @@
|
|||
operator,
|
||||
created_time as createdTime,
|
||||
updated_time as updatedTime,
|
||||
GREATEST(PERIOD_DIFF(DATE_FORMAT(CURDATE(), '%Y%m'), DATE_FORMAT(first_payment_date, '%Y%m')) + 1, 1) AS agingMonths,
|
||||
DATE_FORMAT(first_payment_date, '%Y-%m') as `month`,
|
||||
CASE
|
||||
WHEN current_balance = 0 THEN 0
|
||||
ELSE 1
|
||||
|
|
@ -190,7 +207,7 @@
|
|||
bm.amount, u2.username as executor, bm.remarks, bm.next_month as nextMonth,
|
||||
bm.proposed_amount as proposedAmount, bm.handler, bm.next_remarks as nextRemarks,
|
||||
u.username as operator, bm.created_time as createdTime, bm.updated_time as updatedTime
|
||||
,pro.project_name as projectName
|
||||
,pro.project_name as projectName,bm.reverse_id as reverseId
|
||||
FROM `bm_monthly_operations` bm
|
||||
LEFT JOIN bm_project_prepayment pro ON pro.id = bm.p_id
|
||||
LEFT JOIN sys_user u ON u.id = bm.operator
|
||||
|
|
@ -261,4 +278,22 @@
|
|||
SELECT id,`name` FROM bm_project_prepayment_dict
|
||||
WHERE IS_ACTIVE = 1 AND type = '2'
|
||||
</select>
|
||||
|
||||
<select id="getAgingMonths" resultType="java.lang.String">
|
||||
SELECT
|
||||
bmo1.`month`
|
||||
FROM
|
||||
`bm_monthly_operations` bmo1
|
||||
LEFT JOIN
|
||||
|
||||
(SELECT reverse_id,sum(amount) as amount
|
||||
FROM
|
||||
`bm_monthly_operations` WHERE p_id = #{id} and operation_type = 1
|
||||
GROUP BY reverse_id)
|
||||
bmo2 ON bmo1.id = bmo2.reverse_id
|
||||
WHERE
|
||||
bmo1.p_id = #{id} and bmo1.operation_type = 2 and (bmo1.amount-IFNULL(bmo2.amount,0)) > 0
|
||||
ORDER BY bmo1.`month` ASC
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
var id = localStorage.getItem("id");
|
||||
var reverseId = localStorage.getItem("reverseId");
|
||||
var prepaymentId = localStorage.getItem("prepaymentId");
|
||||
var currentBalance = localStorage.getItem("currentBalance");
|
||||
|
||||
|
|
@ -10,6 +11,12 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function(){
|
|||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
|
||||
//如果是新增类型的修改,则隐藏冲销按钮
|
||||
if(id !=="" && (reverseId === "" || reverseId === "null")){
|
||||
$("#reverse").css("display", "none");
|
||||
}
|
||||
getNeedReverse(form, prepaymentId,id,reverseId);
|
||||
|
||||
// 获取当前月份
|
||||
var currentDate = getCurrentMonth();
|
||||
console.log("currentDate:", currentDate)
|
||||
|
|
@ -39,7 +46,13 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function(){
|
|||
$('.radio-button').on('click', function() {
|
||||
$('.radio-button').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('#operationType').val($(this).data('value'));
|
||||
var operationType = $(this).data('value');
|
||||
$('#operationType').val(operationType);
|
||||
if(operationType == 1){
|
||||
$("#reverse").css("display", "flex");
|
||||
}else {
|
||||
$("#reverse").css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
initData();
|
||||
|
|
@ -58,9 +71,10 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function(){
|
|||
}
|
||||
|
||||
// 如果是冲销,检查是否超过当前余额
|
||||
var split = $('#reverseId option:checked').text().split(" ");
|
||||
if ($('#operationType').val() === '1') {
|
||||
if (parseFloat(value) > currentBalance) {
|
||||
return '请输入正确冲销或新增金额,冲销金额不能大于当前余额' + currentBalance;
|
||||
if (parseFloat(value) > parseFloat(split[0])) {
|
||||
return '请输入正确冲销或新增金额,冲销金额不能大于当前余额' + split[0];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -149,6 +163,16 @@ function calculateNewBalance() {
|
|||
}
|
||||
|
||||
function add(formData) {
|
||||
var operationType = $('#operationType').val();
|
||||
if (operationType == 1) {
|
||||
var reverseId = $('#reverseId').val();
|
||||
if (reverseId == null || reverseId == "") {
|
||||
layer.msg('具体冲销项', {icon: 5});
|
||||
return;
|
||||
}else{
|
||||
formData.field.reverseId = reverseId;
|
||||
}
|
||||
}
|
||||
//先保证未进行冲销或新增金额
|
||||
formData.field.currentBalance = currentBalance;
|
||||
// 计算更新后的余额
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ layui.use(['table', 'form', 'laydate'], function(){
|
|||
// {field: 'operation', title: '操作', width: 220, align: 'center', fixed: 'right', rowspan: 2}
|
||||
{ field: 'operation', title: '操作', width: 220, align: 'center', fixed: 'right', rowspan: 2, templet: function (d) {
|
||||
if (d.LAY_INDEX === 0) {
|
||||
return `<a class="layui-btn layui-btn-xs" onclick="edit('${d.id}')">修改</a> <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="del('${d.id}')">删除</a>`;
|
||||
return `<a class="layui-btn layui-btn-xs" onclick="edit('${d.id}','${d.reverseId}')">修改</a> <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="del('${d.id}')">删除</a>`;
|
||||
} else {
|
||||
return `禁止操作`;
|
||||
}
|
||||
|
|
@ -135,7 +135,7 @@ function addForm(){
|
|||
localStorage.setItem("currentBalance", currentBalance);
|
||||
localStorage.setItem("prepaymentUserId", userId);
|
||||
localStorage.setItem("prepaymentUserName", userName);
|
||||
openForm("","新增");
|
||||
openForm("","","新增");
|
||||
}
|
||||
|
||||
function updateForm() {
|
||||
|
|
@ -152,8 +152,9 @@ function updateForm() {
|
|||
/**
|
||||
* 新增-修改功能
|
||||
*/
|
||||
function openForm(id,title){
|
||||
function openForm(id,reverseId,title){
|
||||
localStorage.setItem("id",id);
|
||||
localStorage.setItem("reverseId",reverseId);
|
||||
var index = layer.open({
|
||||
title: [title, 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||||
type: 2,
|
||||
|
|
@ -163,8 +164,8 @@ function openForm(id,title){
|
|||
});
|
||||
}
|
||||
|
||||
function edit(id){
|
||||
openForm(id,"修改")
|
||||
function edit(id,reverseId){
|
||||
openForm(id,reverseId,"修改")
|
||||
}
|
||||
|
||||
function del(id) {
|
||||
|
|
|
|||
|
|
@ -24,4 +24,34 @@ function getRole(form,roleId) {
|
|||
console.log("获取人员角色下拉列表出错:", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getNeedReverse(form,proId,id,reverseId) {
|
||||
$("#reverseId").html("");
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: ctxPath + '/utilConnection/getNeedReverse',
|
||||
data: {
|
||||
proId:proId,
|
||||
id:id
|
||||
},
|
||||
async: false,
|
||||
success: function (data) {
|
||||
var html = '<option value="">--请选择冲销金额--</option>';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (reverseId == data[i].key) {
|
||||
html += '<option selected="selected" value=\'' + data[i].key + '\'>' + data[i].value + '</option>';
|
||||
} else {
|
||||
html += '<option value=\'' + data[i].key + '\'>' + data[i].value + '</option>';
|
||||
}
|
||||
}
|
||||
$("#reverseId").html(html);
|
||||
layui.form.render('select');
|
||||
//这里就是我们要渲染的地方了
|
||||
},
|
||||
error: function (err) {
|
||||
console.log("获取冲销列表下拉列表出错:", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -119,6 +119,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="reverse">
|
||||
<div class="form-label required">具体冲销项:</div>
|
||||
<div class="form-input">
|
||||
<select id="reverseId" class="layui-select" name="reverseId" >
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-label required">冲销或新增金额:</div>
|
||||
<div class="form-input">
|
||||
|
|
@ -187,6 +195,7 @@
|
|||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||
<script type="text/javascript" src="../../layui-v2.8.3/layui/layui.js"></script>
|
||||
<script src="../../css/ztree/3.5/jquery.ztree.all.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
<script type="text/javascript" src="../../js/prepayment/addOperations.js">
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Reference in New Issue