Browse Source

付款计划修改记录保存,审批结束后替换该合同当前付款计划,

梁世豪 7 months ago
parent
commit
ab3ec1d1bd

+ 207 - 0
src/main/java/com/liang/controller/PrjPayplanXgController.java

@@ -0,0 +1,207 @@
1
+package com.liang.controller;
2
+
3
+import com.github.pagehelper.PageInfo;
4
+import com.liang.common.JsonTool;
5
+import com.liang.common.base.BaseController;
6
+import com.liang.common.base.BaseResult;
7
+import com.liang.entity.PrjPayplan;
8
+import com.liang.entity.PrjPayplanXg;
9
+import com.liang.service.PrjPayplanXgService;
10
+import com.liang.service.PrjPayplannameService;
11
+import org.springframework.data.domain.Page;
12
+import org.springframework.data.domain.PageRequest;
13
+import org.springframework.http.ResponseEntity;
14
+import org.springframework.stereotype.Controller;
15
+import org.springframework.ui.Model;
16
+import org.springframework.web.bind.annotation.*;
17
+
18
+import javax.annotation.Resource;
19
+import java.math.BigDecimal;
20
+import java.util.ArrayList;
21
+import java.util.HashMap;
22
+import java.util.List;
23
+import java.util.Map;
24
+
25
+/**
26
+ * 付款计划(PrjPayplanXg)表控制层
27
+ *
28
+ */
29
+@Controller
30
+@RequestMapping("prjPayplanXg")
31
+public class PrjPayplanXgController extends BaseController {
32
+    /**
33
+     * 服务对象
34
+     */
35
+    @Resource
36
+    private PrjPayplanXgService prjPayplanXgService;
37
+    @Resource
38
+    private PrjPayplannameService prjPayplannameService;
39
+
40
+    /**
41
+     * 分页查询
42
+     *
43
+     * @param prjPayplan  筛选条件
44
+     * @param pageRequest 分页对象
45
+     * @return 查询结果
46
+     */
47
+    @GetMapping
48
+    public ResponseEntity<Page<PrjPayplanXg>> queryByPage(PrjPayplanXg prjPayplan, PageRequest pageRequest) {
49
+        return ResponseEntity.ok(this.prjPayplanXgService.queryByPage(prjPayplan, pageRequest));
50
+    }
51
+
52
+    /**
53
+     * 通过主键查询单条数据
54
+     *
55
+     * @param id 主键
56
+     * @return 单条数据
57
+     */
58
+    @GetMapping("{id}")
59
+    public ResponseEntity<PrjPayplanXg> queryById(@PathVariable("id") Integer id) {
60
+        return ResponseEntity.ok(this.prjPayplanXgService.queryById(id));
61
+    }
62
+
63
+    /**
64
+     * 删除数据
65
+     *
66
+     * @param id 主键
67
+     * @return 删除是否成功
68
+     */
69
+    @DeleteMapping
70
+    public ResponseEntity<Boolean> deleteById(Integer id) {
71
+        return ResponseEntity.ok(this.prjPayplanXgService.deleteById(id));
72
+    }
73
+
74
+    /**
75
+     * 页面初始化
76
+     *
77
+     * @return
78
+     */
79
+    @ResponseBody
80
+    @RequestMapping(value = "/list/{ht}", method = RequestMethod.POST)
81
+    public BaseResult list(@PathVariable Integer ht) {
82
+        List<PrjPayplanXg> list = prjPayplanXgService.getPayPlanList(ht);
83
+
84
+        PageInfo<PrjPayplanXg> pageinfo = new PageInfo<>(list);
85
+        //取出查询结果
86
+        List<PrjPayplanXg> rows = pageinfo.getList();
87
+        int total = (int) pageinfo.getTotal();
88
+        Map<String, Object> result = new HashMap<>();
89
+        result.put(RESULT_ROWS, rows);
90
+        result.put(RESULT_TOTAL, total);
91
+
92
+        return BaseResult.success(result);
93
+    }
94
+
95
+    /**
96
+     * 新建数据
97
+     *
98
+     * @return
99
+     */
100
+    @RequestMapping(value = "/forAdd", method = RequestMethod.GET)
101
+    public String forAdd(Model model) {
102
+        //付款计划名称
103
+        List<Map<String, String>> jhmcList = prjPayplannameService.getPlanName();
104
+        model.addAttribute("jhmcList", jhmcList);
105
+
106
+        return "prjpayplan/addXg";
107
+    }
108
+
109
+    /**
110
+     * 保存数据
111
+     *
112
+     * @return
113
+     */
114
+    @ResponseBody
115
+    @RequestMapping(value = "/doAdd", method = RequestMethod.POST)
116
+    public BaseResult doAdd(PrjPayplanXg prjPayplan,
117
+                            @RequestParam(required = false,value = "htje")Double htje) {
118
+        // 判断当前 合同下支付计划是否超额
119
+        List<PrjPayplanXg> list = prjPayplanXgService.getPayPlanList(prjPayplan.getHt());
120
+        // 使用 Stream 计算总和
121
+        Double je = 0.00 + prjPayplan.getZfje();
122
+        for (int i = 0; i<list.size();i++){
123
+            je = je + list.get(i).getZfje();
124
+        }
125
+        BigDecimal jes = BigDecimal.valueOf(je);
126
+        jes = jes.setScale(3, BigDecimal.ROUND_HALF_UP);
127
+        BigDecimal htjes = BigDecimal.valueOf(htje);
128
+        if (jes.compareTo(htjes) <= 0){
129
+            prjPayplan.setCjr(getSysUserId());
130
+            int num = prjPayplanXgService.insert(prjPayplan);
131
+            if (num > 0)
132
+                return BaseResult.success("保存成功!", prjPayplan);
133
+            else
134
+                return BaseResult.failure("保存失败!");
135
+        }else {
136
+            return BaseResult.failure("保存失败,计划金额超出合同总金额!");
137
+        }
138
+
139
+    }
140
+
141
+    /**
142
+     * 编辑数据
143
+     *
144
+     * @return
145
+     */
146
+    @RequestMapping(value = "/forUpdate/{id}", method = RequestMethod.GET)
147
+    public String forUpdate(Model model, @PathVariable Integer id) {
148
+        //当前项目
149
+        PrjPayplanXg payplan = prjPayplanXgService.queryById(id);
150
+        model.addAttribute("payplan", payplan);
151
+
152
+        return "prjpayplan/updateXg";
153
+    }
154
+
155
+    /**
156
+     * 更新数据
157
+     *
158
+     * @return
159
+     */
160
+    @ResponseBody
161
+    @RequestMapping(value = "/doUpdate", method = RequestMethod.POST)
162
+    public BaseResult doUpdate(PrjPayplanXg prjPayplan) {
163
+        int num = prjPayplanXgService.update(prjPayplan);
164
+        if (num > 0)
165
+            return BaseResult.success("保存成功!", prjPayplan);
166
+        else
167
+            return BaseResult.failure("保存失败!");
168
+    }
169
+
170
+    /**
171
+     * 浏览数据
172
+     *
173
+     * @return
174
+     */
175
+    @RequestMapping(value = "/forView/{id}", method = RequestMethod.GET)
176
+    public String forView(Model model, @PathVariable Integer id) {
177
+        //当前项目
178
+        PrjPayplanXg payplan = prjPayplanXgService.queryById(id);
179
+        model.addAttribute("payplan", payplan);
180
+
181
+        return "prjpayplan/view";
182
+    }
183
+
184
+    /**
185
+     * 批量删除
186
+     *
187
+     * @param data
188
+     * @return
189
+     */
190
+    @RequestMapping(value = "/batchDelete", method = RequestMethod.POST)
191
+    @ResponseBody
192
+    public BaseResult batchDelete(@RequestBody String data) {
193
+        List<PrjPayplan> contractList = JsonTool.parseArray(data, PrjPayplan.class);
194
+        List<Integer> idList = new ArrayList<>();
195
+        contractList.forEach(item -> {
196
+            idList.add(item.getId());
197
+        });
198
+
199
+        int num = prjPayplanXgService.batchDelete(idList);
200
+        if (num > 0) {
201
+            return BaseResult.success("批量删除成功!");
202
+        } else {
203
+            return BaseResult.failure("批量删除失败!");
204
+        }
205
+    }
206
+}
207
+

+ 2 - 0
src/main/java/com/liang/dao/PrjPayplanDao.java

@@ -103,5 +103,7 @@ public interface PrjPayplanDao {
103 103
      * @return
104 104
      */
105 105
     int batchDeleteByHt(List<Integer> htList);
106
+
107
+    void deleteByHtId(Integer htId);
106 108
 }
107 109
 

+ 105 - 0
src/main/java/com/liang/dao/PrjPayplanXgDao.java

@@ -0,0 +1,105 @@
1
+package com.liang.dao;
2
+
3
+import com.liang.entity.PrjPayplan;
4
+import com.liang.entity.PrjPayplanXg;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.springframework.data.domain.PageRequest;
7
+import org.springframework.data.domain.Pageable;
8
+
9
+import java.util.List;
10
+
11
+public interface PrjPayplanXgDao {
12
+
13
+    /**
14
+     * 通过ID查询单条数据
15
+     *
16
+     * @param id 主键
17
+     * @return 实例对象
18
+     */
19
+    PrjPayplanXg queryById(Integer id);
20
+
21
+    /**
22
+     * 查询指定行数据
23
+     *
24
+     * @param prjPayplan 查询条件
25
+     * @param pageable   分页对象
26
+     * @return 对象列表
27
+     */
28
+    List<PrjPayplanXg> queryAllByLimit(PrjPayplanXg prjPayplan, @Param("pageable") Pageable pageable);
29
+
30
+    /**
31
+     * 统计总行数
32
+     *
33
+     * @param prjPayplan 查询条件
34
+     * @return 总行数
35
+     */
36
+    long count(PrjPayplanXg prjPayplan);
37
+
38
+    /**
39
+     * 新增数据
40
+     *
41
+     * @param prjPayplan 实例对象
42
+     * @return 影响行数
43
+     */
44
+    int insert(PrjPayplanXg prjPayplan);
45
+
46
+    /**
47
+     * 批量新增数据(MyBatis原生foreach方法)
48
+     *
49
+     * @param entities List<PrjPayplan> 实例对象列表
50
+     * @return 影响行数
51
+     */
52
+    int insertBatch(@Param("entities") List<PrjPayplanXg> entities);
53
+
54
+    /**
55
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
56
+     *
57
+     * @param entities List<PrjPayplan> 实例对象列表
58
+     * @return 影响行数
59
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
60
+     */
61
+    int insertOrUpdateBatch(@Param("entities") List<PrjPayplan> entities);
62
+
63
+    /**
64
+     * 修改数据
65
+     *
66
+     * @param prjPayplan 实例对象
67
+     * @return 影响行数
68
+     */
69
+    int update(PrjPayplanXg prjPayplan);
70
+
71
+    /**
72
+     * 通过主键删除数据
73
+     *
74
+     * @param id 主键
75
+     * @return 影响行数
76
+     */
77
+    int deleteById(Integer id);
78
+
79
+    /**
80
+     * 批量删除付款计划
81
+     *
82
+     * @param idList
83
+     * @return
84
+     */
85
+    int batchDelete(List<Integer> idList);
86
+
87
+    /**
88
+     * 获取付款计划列表
89
+     *
90
+     * @return
91
+     */
92
+    List<PrjPayplanXg> getPayPlanList(Integer ht);
93
+
94
+    /**
95
+     * 批量删除项目人员
96
+     *
97
+     * @param htList
98
+     * @return
99
+     */
100
+    int batchDeleteByHt(List<Integer> htList);
101
+
102
+    List<PrjPayplan> queryByHtId(Integer htId);
103
+
104
+    void deleteBtHtId(Integer htId);
105
+}

+ 166 - 0
src/main/java/com/liang/entity/PrjPayplanXg.java

@@ -0,0 +1,166 @@
1
+package com.liang.entity;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+import java.sql.Date;
7
+
8
+/**
9
+ * 付款计划(PrjPayplanXg)实体类
10
+ *
11
+ */
12
+@Data
13
+public class PrjPayplanXg implements Serializable {
14
+    private static final long serialVersionUID = -50088345215138191L;
15
+
16
+    private Integer id;
17
+    /**
18
+     * 付款要求
19
+     */
20
+    private String fkyq;
21
+    /**
22
+     * 支付比例(%)
23
+     */
24
+    private Double zfbl;
25
+    /**
26
+     * 支付金额(万元)
27
+     */
28
+    private Double zfje;
29
+    /**
30
+     * 创建人
31
+     */
32
+    private Integer cjr;
33
+    private String cjrxm;
34
+    /**
35
+     * 创建时间
36
+     */
37
+    private Date cjsj;
38
+    /**
39
+     * 任务书
40
+     */
41
+    private Integer rws;
42
+    private String rwsmc;
43
+    /**
44
+     * 费用申请
45
+     */
46
+    private Integer fysq;
47
+    private String fysqmc;
48
+    /**
49
+     * 计划名称
50
+     */
51
+    private String jhmc;
52
+    /**
53
+     * 合同
54
+     */
55
+    private Integer ht;
56
+
57
+    /**
58
+     *付款信息
59
+     */
60
+    private String fkxx;
61
+
62
+    public Integer getId() {
63
+        return id;
64
+    }
65
+
66
+    public void setId(Integer id) {
67
+        this.id = id;
68
+    }
69
+
70
+    public String getFkyq() {
71
+        return fkyq;
72
+    }
73
+
74
+    public void setFkyq(String fkyq) {
75
+        this.fkyq = fkyq;
76
+    }
77
+
78
+    public Double getZfbl() {
79
+        return zfbl;
80
+    }
81
+
82
+    public void setZfbl(Double zfbl) {
83
+        this.zfbl = zfbl;
84
+    }
85
+
86
+    public Double getZfje() {
87
+        return zfje;
88
+    }
89
+
90
+    public void setZfje(Double zfje) {
91
+        this.zfje = zfje;
92
+    }
93
+
94
+    public Integer getCjr() {
95
+        return cjr;
96
+    }
97
+
98
+    public void setCjr(Integer cjr) {
99
+        this.cjr = cjr;
100
+    }
101
+
102
+    public Date getCjsj() {
103
+        return cjsj;
104
+    }
105
+
106
+    public void setCjsj(Date cjsj) {
107
+        this.cjsj = cjsj;
108
+    }
109
+
110
+    public Integer getRws() {
111
+        return rws;
112
+    }
113
+
114
+    public void setRws(Integer rws) {
115
+        this.rws = rws;
116
+    }
117
+
118
+    public Integer getFysq() {
119
+        return fysq;
120
+    }
121
+
122
+    public void setFysq(Integer fysq) {
123
+        this.fysq = fysq;
124
+    }
125
+
126
+    public String getJhmc() {
127
+        return jhmc;
128
+    }
129
+
130
+    public void setJhmc(String jhmc) {
131
+        this.jhmc = jhmc;
132
+    }
133
+
134
+    public Integer getHt() {
135
+        return ht;
136
+    }
137
+
138
+    public void setHt(Integer ht) {
139
+        this.ht = ht;
140
+    }
141
+
142
+    public String getCjrxm() {
143
+        return cjrxm;
144
+    }
145
+
146
+    public void setCjrxm(String cjrxm) {
147
+        this.cjrxm = cjrxm;
148
+    }
149
+
150
+    public String getRwsmc() {
151
+        return rwsmc;
152
+    }
153
+
154
+    public void setRwsmc(String rwsmc) {
155
+        this.rwsmc = rwsmc;
156
+    }
157
+
158
+    public String getFysqmc() {
159
+        return fysqmc;
160
+    }
161
+
162
+    public void setFysqmc(String fysqmc) {
163
+        this.fysqmc = fysqmc;
164
+    }
165
+}
166
+

+ 69 - 0
src/main/java/com/liang/service/PrjPayplanXgService.java

@@ -0,0 +1,69 @@
1
+package com.liang.service;
2
+
3
+import com.liang.entity.PrjPayplan;
4
+import com.liang.entity.PrjPayplanXg;
5
+import org.springframework.data.domain.Page;
6
+import org.springframework.data.domain.PageRequest;
7
+
8
+import java.util.List;
9
+
10
+public interface PrjPayplanXgService {
11
+
12
+
13
+        /**
14
+         * 通过ID查询单条数据
15
+         *
16
+         * @param id 主键
17
+         * @return 实例对象
18
+         */
19
+        PrjPayplanXg queryById(Integer id);
20
+
21
+        /**
22
+         * 分页查询
23
+         *
24
+         * @param prjPayplan  筛选条件
25
+         * @param pageRequest 分页对象
26
+         * @return 查询结果
27
+         */
28
+        Page<PrjPayplanXg> queryByPage(PrjPayplanXg prjPayplan, PageRequest pageRequest);
29
+
30
+        /**
31
+         * 新增数据
32
+         *
33
+         * @param prjPayplan 实例对象
34
+         * @return 实例对象
35
+         */
36
+        int insert(PrjPayplanXg prjPayplan);
37
+
38
+        /**
39
+         * 修改数据
40
+         *
41
+         * @param prjPayplan 实例对象
42
+         * @return 实例对象
43
+         */
44
+        int update(PrjPayplanXg prjPayplan);
45
+
46
+        /**
47
+         * 通过主键删除数据
48
+         *
49
+         * @param id 主键
50
+         * @return 是否成功
51
+         */
52
+        boolean deleteById(Integer id);
53
+
54
+        /**
55
+         * 批量删除付款计划
56
+         *
57
+         * @param idList
58
+         * @return
59
+         */
60
+        int batchDelete(List<Integer> idList);
61
+
62
+        /**
63
+         * 获取付款计划列表
64
+         *
65
+         * @return
66
+         */
67
+        List<PrjPayplanXg> getPayPlanList(Integer ht);
68
+
69
+}

+ 21 - 6
src/main/java/com/liang/service/impl/PrjContractXgServiceImpl.java

@@ -1,11 +1,12 @@
1 1
 package com.liang.service.impl;
2 2
 
3 3
 import com.liang.dao.PrjContractXgDao;
4
-import com.liang.entity.PrjAnnualBudgetRecord;
5
-import com.liang.entity.PrjContract;
6
-import com.liang.entity.PrjContractXg;
4
+import com.liang.dao.PrjPayplanDao;
5
+import com.liang.dao.PrjPayplanXgDao;
6
+import com.liang.entity.*;
7 7
 import com.liang.service.PrjContractXgService;
8 8
 import org.springframework.stereotype.Service;
9
+import org.springframework.transaction.annotation.Transactional;
9 10
 
10 11
 import javax.annotation.Resource;
11 12
 import java.util.List;
@@ -14,6 +15,10 @@ import java.util.List;
14 15
 public class PrjContractXgServiceImpl implements PrjContractXgService {
15 16
     @Resource
16 17
     private PrjContractXgDao prjContractXgDao;
18
+    @Resource
19
+    private PrjPayplanXgDao prjPayplanXgDao;
20
+    @Resource
21
+    private PrjPayplanDao prjPayplanDao;
17 22
 
18 23
     @Override
19 24
     public int insert(PrjContract prjContract) {
@@ -36,14 +41,24 @@ public class PrjContractXgServiceImpl implements PrjContractXgService {
36 41
     }
37 42
 
38 43
     @Override
44
+    @Transactional
39 45
     public void doUpdate(Integer htId) {
40
-        //  1.获取年度预算中间表情数据
46
+        //  1.获取合同中间表数据
41 47
         PrjContractXg prjContractXg = prjContractXgDao.queryRecordByHtId(htId);
42
-        //  2.修改年度预算明细表的内容
48
+        // 2.获取付款计划中间表数据
49
+        List<PrjPayplan> prjPayplanXgList = prjPayplanXgDao.queryByHtId(htId);
50
+        //  3.修改合同表中的内容
43 51
         int  i =prjContractXgDao.updateXg(prjContractXg);
52
+        //  4.修改付款计划表中的内容
53
+        //  (1)删除付款计划表中的内容
54
+        prjPayplanDao.deleteByHtId(htId);
55
+        //  (2)查入付款计划中间表中的数据
56
+        prjPayplanDao.insertBatch(prjPayplanXgList);
44 57
         if (i>0) {
45
-        // 3.保存成功后删除中间表中的数据
58
+        // 5.保存成功后删除中间表中的数据
46 59
             prjContractXgDao.deldteById(htId);
60
+        // 6.删除付款计划中间表中的数据
61
+        prjPayplanXgDao.deleteBtHtId(htId);
47 62
         }
48 63
     }
49 64
 }

+ 86 - 0
src/main/java/com/liang/service/impl/PrjPayplanXgServiceImpl.java

@@ -0,0 +1,86 @@
1
+package com.liang.service.impl;
2
+
3
+import com.liang.dao.PrjPayplanXgDao;
4
+import com.liang.entity.PrjPayplan;
5
+import com.liang.entity.PrjPayplanXg;
6
+import com.liang.service.PrjPayplanXgService;
7
+import org.springframework.data.domain.Page;
8
+import org.springframework.data.domain.PageImpl;
9
+import org.springframework.data.domain.PageRequest;
10
+import org.springframework.stereotype.Service;
11
+
12
+import javax.annotation.Resource;
13
+import java.util.List;
14
+
15
+@Service("prjPayplanXgService")
16
+public class PrjPayplanXgServiceImpl implements PrjPayplanXgService {
17
+    @Resource
18
+    private PrjPayplanXgDao prjPayplanXgDao;
19
+
20
+    /**
21
+     * 通过ID查询单条数据
22
+     *
23
+     * @param id 主键
24
+     * @return 实例对象
25
+     */
26
+    @Override
27
+    public PrjPayplanXg queryById(Integer id) {
28
+        return this.prjPayplanXgDao.queryById(id);
29
+    }
30
+
31
+    /**
32
+     * 分页查询
33
+     *
34
+     * @param prjPayplan  筛选条件
35
+     * @param pageRequest 分页对象
36
+     * @return 查询结果
37
+     */
38
+    @Override
39
+    public Page<PrjPayplanXg> queryByPage(PrjPayplanXg prjPayplan, PageRequest pageRequest) {
40
+        long total = this.prjPayplanXgDao.count(prjPayplan);
41
+        return new PageImpl<>(this.prjPayplanXgDao.queryAllByLimit(prjPayplan, pageRequest), pageRequest, total);
42
+    }
43
+
44
+    /**
45
+     * 新增数据
46
+     *
47
+     * @param prjPayplan 实例对象
48
+     * @return 实例对象
49
+     */
50
+    @Override
51
+    public int insert(PrjPayplanXg prjPayplan) {
52
+        return this.prjPayplanXgDao.insert(prjPayplan);
53
+    }
54
+
55
+    /**
56
+     * 修改数据
57
+     *
58
+     * @param prjPayplan 实例对象
59
+     * @return 实例对象
60
+     */
61
+    @Override
62
+    public int update(PrjPayplanXg prjPayplan) {
63
+        return this.prjPayplanXgDao.update(prjPayplan);
64
+    }
65
+
66
+    /**
67
+     * 通过主键删除数据
68
+     *
69
+     * @param id 主键
70
+     * @return 是否成功
71
+     */
72
+    @Override
73
+    public boolean deleteById(Integer id) {
74
+        return this.prjPayplanXgDao.deleteById(id) > 0;
75
+    }
76
+
77
+    @Override
78
+    public int batchDelete(List<Integer> idList) {
79
+        return this.prjPayplanXgDao.batchDelete(idList);
80
+    }
81
+
82
+    @Override
83
+    public List<PrjPayplanXg> getPayPlanList(Integer ht) {
84
+        return this.prjPayplanXgDao.getPayPlanList(ht);
85
+    }
86
+}

+ 4 - 0
src/main/resources/mapper/PrjPayplanDao.xml

@@ -200,5 +200,9 @@
200 200
             #{item}
201 201
         </foreach>
202 202
     </delete>
203
+    <delete id="deleteByHtId">
204
+        delete from prj_PayPlan
205
+        where HT = #{htId}
206
+    </delete>
203 207
 </mapper>
204 208
 

+ 211 - 0
src/main/resources/mapper/PrjPayplanXgDao.xml

@@ -0,0 +1,211 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.liang.dao.PrjPayplanXgDao">
4
+
5
+    <resultMap type="com.liang.entity.PrjPayplanXg" id="PrjPayplanXgMap">
6
+        <result property="id" column="ID" jdbcType="INTEGER"/>
7
+        <result property="fkyq" column="FKYQ" jdbcType="VARCHAR"/>
8
+        <result property="zfbl" column="ZFBL" jdbcType="NUMERIC"/>
9
+        <result property="zfje" column="ZFJE" jdbcType="NUMERIC"/>
10
+        <result property="cjr" column="CJR" jdbcType="INTEGER"/>
11
+        <result property="cjsj" column="CJSJ" jdbcType="TIMESTAMP"/>
12
+        <result property="rws" column="RWS" jdbcType="INTEGER"/>
13
+        <result property="fysq" column="FYSQ" jdbcType="INTEGER"/>
14
+        <result property="jhmc" column="JHMC" jdbcType="VARCHAR"/>
15
+        <result property="ht" column="HT" jdbcType="INTEGER"/>
16
+        <result property="fkxx" column="FKXX" jdbcType="VARCHAR"/>
17
+    </resultMap>
18
+
19
+    <!--查询单个-->
20
+    <select id="queryById" resultMap="PrjPayplanXgMap">
21
+        select p.*, x.ZWMC as RWSMC, u.name as CJRXM
22
+        from prj_PayPlan_xg p
23
+                 left join prj_Project x on x.ID = p.RWS
24
+                 left join sys_user_info u on u.user_id = p.CJR
25
+        where p.ID = #{id}
26
+    </select>
27
+
28
+    <!--查询指定行数据-->
29
+    <select id="queryAllByLimit" resultMap="PrjPayplanXgMap">
30
+        select *
31
+        from prj_PayPlan_xg
32
+        <where>
33
+            <if test="id != null">
34
+                and ID = #{id}
35
+            </if>
36
+            <if test="fkyq != null and fkyq != ''">
37
+                and FKYQ = #{fkyq}
38
+            </if>
39
+            <if test="zfbl != null">
40
+                and ZFBL = #{zfbl}
41
+            </if>
42
+            <if test="zfje != null">
43
+                and ZFJE = #{zfje}
44
+            </if>
45
+            <if test="cjr != null">
46
+                and CJR = #{cjr}
47
+            </if>
48
+            <if test="cjsj != null">
49
+                and CJSJ = #{cjsj}
50
+            </if>
51
+            <if test="rws != null">
52
+                and RWS = #{rws}
53
+            </if>
54
+            <if test="fysq != null">
55
+                and FYSQ = #{fysq}
56
+            </if>
57
+            <if test="jhmc != null and jhmc != ''">
58
+                and JHMC = #{jhmc}
59
+            </if>
60
+            <if test="ht != null">
61
+                and HT = #{ht}
62
+            </if>
63
+        </where>
64
+        limit #{pageable.offset}, #{pageable.pageSize}
65
+    </select>
66
+
67
+    <!--统计总行数-->
68
+    <select id="count" resultType="java.lang.Long">
69
+        select count(1)
70
+        from prj_PayPlan_xg
71
+        <where>
72
+            <if test="id != null">
73
+                and ID = #{id}
74
+            </if>
75
+            <if test="fkyq != null and fkyq != ''">
76
+                and FKYQ = #{fkyq}
77
+            </if>
78
+            <if test="zfbl != null">
79
+                and ZFBL = #{zfbl}
80
+            </if>
81
+            <if test="zfje != null">
82
+                and ZFJE = #{zfje}
83
+            </if>
84
+            <if test="cjr != null">
85
+                and CJR = #{cjr}
86
+            </if>
87
+            <if test="cjsj != null">
88
+                and CJSJ = #{cjsj}
89
+            </if>
90
+            <if test="rws != null">
91
+                and RWS = #{rws}
92
+            </if>
93
+            <if test="fysq != null">
94
+                and FYSQ = #{fysq}
95
+            </if>
96
+            <if test="jhmc != null and jhmc != ''">
97
+                and JHMC = #{jhmc}
98
+            </if>
99
+            <if test="ht != null">
100
+                and HT = #{ht}
101
+            </if>
102
+        </where>
103
+    </select>
104
+
105
+    <!--新增所有列-->
106
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
107
+        insert into prj_PayPlan_xg(FKYQ, ZFBL, ZFJE, CJR, CJSJ, RWS, JHMC, HT,FKXX)
108
+        values (#{fkyq}, #{zfbl}, #{zfje}, #{cjr}, GETDATE(), #{rws}, #{jhmc}, #{ht},#{fkxx})
109
+    </insert>
110
+
111
+    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
112
+        insert into prj_PayPlan_xg(FKYQ, ZFBL, ZFJE, CJR, CJSJ, RWS, FYSQ, JHMC, HT)
113
+        values
114
+        <foreach collection="entities" item="entity" separator=",">
115
+            (#{entity.fkyq}, #{entity.zfbl}, #{entity.zfje}, #{entity.cjr}, #{entity.cjsj}, #{entity.rws},
116
+            #{entity.fysq}, #{entity.jhmc}, #{entity.ht})
117
+        </foreach>
118
+    </insert>
119
+
120
+    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
121
+        insert into prj_PayPlan_xg(FKYQ, ZFBL, ZFJE, CJR, CJSJ, RWS, FYSQ, JHMC, HT)
122
+        values
123
+        <foreach collection="entities" item="entity" separator=",">
124
+            (#{entity.fkyq}, #{entity.zfbl}, #{entity.zfje}, #{entity.cjr}, #{entity.cjsj}, #{entity.rws},
125
+            #{entity.fysq}, #{entity.jhmc}, #{entity.ht})
126
+        </foreach>
127
+        on duplicate key update
128
+        FKYQ = values(FKYQ),
129
+        ZFBL = values(ZFBL),
130
+        ZFJE = values(ZFJE),
131
+        CJR = values(CJR),
132
+        CJSJ = values(CJSJ),
133
+        RWS = values(RWS),
134
+        FYSQ = values(FYSQ),
135
+        JHMC = values(JHMC),
136
+        HT = values(HT)
137
+    </insert>
138
+
139
+    <!--通过主键修改数据-->
140
+    <update id="update">
141
+        update prj_PayPlan_xg
142
+        <set>
143
+            <if test="fkyq != null and fkyq != ''">
144
+                FKYQ = #{fkyq},
145
+            </if>
146
+            <if test="zfbl != null">
147
+                ZFBL = #{zfbl},
148
+            </if>
149
+            <if test="zfje != null">
150
+                ZFJE = #{zfje},
151
+            </if>
152
+            <if test="fysq != null">
153
+                FYSQ = #{fysq},
154
+            </if>
155
+            <if test="fkxx != null">
156
+                FKXX = #{fkxx},
157
+            </if>
158
+
159
+        </set>
160
+        where ID = #{id}
161
+    </update>
162
+
163
+    <!--通过主键修改费用申请-->
164
+    <update id="updateFysq">
165
+        update prj_PayPlan_xg
166
+        set FYSQ = #{fysq}
167
+        where ID = #{id}
168
+    </update>
169
+
170
+    <!--通过主键删除-->
171
+    <delete id="deleteById">
172
+        delete
173
+        from prj_PayPlan_xg
174
+        where ID = #{id}
175
+    </delete>
176
+
177
+    <!--批量删除付款计划-->
178
+    <delete id="batchDelete" parameterType="java.util.ArrayList">
179
+        delete from prj_PayPlan_xg
180
+        where ID in
181
+        <foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
182
+            #{item}
183
+        </foreach>
184
+    </delete>
185
+
186
+    <!--付款计划列表-->
187
+    <select id="getPayPlanList" resultMap="PrjPayplanXgMap">
188
+        select p.*, x.ZWMC as RWSMC, u.name as CJRXM
189
+        from prj_PayPlan_xg p
190
+                 left join prj_Project x on x.ID = p.RWS
191
+                 left join sys_user_info u on u.user_id = p.CJR
192
+        where p.HT = #{ht}
193
+    </select>
194
+    <select id="queryByHtId" resultType="com.liang.entity.PrjPayplan">
195
+        select * from prj_PayPlan_xg where HT = #{ht}
196
+    </select>
197
+
198
+    <!--批量删除付款计划-->
199
+    <delete id="batchDeleteByHt" parameterType="java.util.ArrayList">
200
+        delete from prj_PayPlan_xg
201
+        where HT in
202
+        <foreach item="item" index="index" collection="htList" open="(" separator="," close=")">
203
+            #{item}
204
+        </foreach>
205
+    </delete>
206
+    <delete id="deleteBtHtId">
207
+        delete from prj_PayPlan_xg
208
+        where HT = #{htId}
209
+    </delete>
210
+</mapper>
211
+

+ 2 - 2
src/main/resources/templates/prjcontract/view_xg.html

@@ -186,7 +186,7 @@
186 186
         //付款计划
187 187
         table.render({
188 188
             elem: '#currentTableId3',
189
-            url: AjaxUtil.ctx + 'prjPayplan/list/' + htId,
189
+            url: AjaxUtil.ctx + 'prjPayplanXg/list/' + htId,
190 190
             method: 'post',
191 191
             cols: [
192 192
                 [
@@ -221,7 +221,7 @@
221 221
                 maxmin: true,
222 222
                 shade: 0.2,
223 223
                 area: [layerwidth + 'px', layerheight + 'px'],
224
-                content: AjaxUtil.ctx + 'prjPayplan/forView/' + data.id,
224
+                content: AjaxUtil.ctx + 'prjPayplanXg/forView/' + data.id,
225 225
                 end: function (index) {
226 226
                     layer.close(index);
227 227
                 }

+ 11 - 6
src/main/resources/templates/prjcontract/xg_update.html

@@ -74,6 +74,11 @@
74 74
                                        readonly>
75 75
                             </div>
76 76
                         </div>
77
+                        <div class="layui-form-item layui-inline" style="width: 100%">
78
+                            <div class="layui-input-block" style="margin-left: 8%; width: 85%;">
79
+                                <p style="color: red;">注:修改合同时,付款计划需要重新填写!!</p>
80
+                            </div>
81
+                        </div>
77 82
 
78 83
                         <div class="layui-form-item layui-inline" style="width: 100%">
79 84
                             <label class="layui-form-label" style="width: 60px">合同文件</label>
@@ -509,7 +514,7 @@
509 514
         //付款计划
510 515
         var currTable3 = table.render({
511 516
             elem: '#currentTableId3',
512
-            url: AjaxUtil.ctx + 'prjPayplan/list/' + htId,
517
+            url: AjaxUtil.ctx + 'prjPayplanXg/list/' + htId,
513 518
             method: 'post',
514 519
             cols: [
515 520
                 [
@@ -545,7 +550,7 @@
545 550
                 maxmin: true,
546 551
                 shade: 0.2,
547 552
                 area: [layerwidth + 'px', layerheight + 'px'],
548
-                content: AjaxUtil.ctx + 'prjPayplan/forAdd',
553
+                content: AjaxUtil.ctx + 'prjPayplanXg/forAdd',
549 554
                 end: function (index) {
550 555
                     // 重载表格
551 556
                     if (updateflag == 1)
@@ -576,7 +581,7 @@
576 581
                     maxmin: true,
577 582
                     shade: 0.2,
578 583
                     area: [layerwidth + 'px', layerheight + 'px'],
579
-                    content: AjaxUtil.ctx + 'prjPayplan/forUpdate/' + data[0].id,
584
+                    content: AjaxUtil.ctx + 'prjPayplanXg/forUpdate/' + data[0].id,
580 585
                     end: function (index) {
581 586
                         // 重载表格
582 587
                         if (updateflag == 1)
@@ -605,7 +610,7 @@
605 610
                     maxmin: true,
606 611
                     shade: 0.2,
607 612
                     area: [layerwidth + 'px', layerheight + 'px'],
608
-                    content: AjaxUtil.ctx + 'prjPayplan/forView/' + data[0].id,
613
+                    content: AjaxUtil.ctx + 'prjPayplanXg/forView/' + data[0].id,
609 614
                     end: function () {
610 615
                     }
611 616
                 });
@@ -625,7 +630,7 @@
625 630
                 layer.confirm('确定批量删除付款计划吗?', function (index) {
626 631
                     layer.close(index);
627 632
                     AjaxUtil.post({
628
-                        url: AjaxUtil.ctx + "prjPayplan/batchDelete",
633
+                        url: AjaxUtil.ctx + "prjPayplanXg/batchDelete",
629 634
                         contentType: "application/json",
630 635
                         data: JSON.stringify(data),
631 636
                         success: function (res) {
@@ -653,7 +658,7 @@
653 658
                 maxmin: true,
654 659
                 shade: 0.2,
655 660
                 area: [layerwidth + 'px', layerheight + 'px'],
656
-                content: AjaxUtil.ctx + 'prjPayplan/forView/' + data.id,
661
+                content: AjaxUtil.ctx + 'prjPayplanXg/forView/' + data.id,
657 662
                 end: function (index) {
658 663
                     layer.close(index);
659 664
                 }

+ 202 - 0
src/main/resources/templates/prjpayplan/addXg.html

@@ -0,0 +1,202 @@
1
+<!DOCTYPE html>
2
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
+    <title>新建</title>
7
+    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
8
+    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
9
+    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
10
+    <style>
11
+        body {
12
+            background-color: #ffffff;
13
+        }
14
+    </style>
15
+</head>
16
+<body>
17
+<form class="layui-form" action="" lay-filter="formDemo">
18
+    <div class="layui-form layuimini-form" style="margin-right: 20px">
19
+        <input type="hidden" id="rws" name="rws" class="layui-input">
20
+        <input type="hidden" id="ht" name="ht" class="layui-input">
21
+        <div class="layui-form-item">
22
+            <label class="layui-form-label required" style="width: 70px">计划名称</label>
23
+            <div class="layui-input-block">
24
+                <!--                <select name="jhmc" id="jhmc" lay-filter="status" lay-verify="required" lay-reqtext="请选择计划名称">-->
25
+                <!--                    <option value="">请选择</option>-->
26
+                <!--                    <option th:each="item:${jhmcList}" th:text="${item.name}"-->
27
+                <!--                            th:value="${item.name}"></option>-->
28
+                <!--                </select>-->
29
+                <input type="text" id="jhmc" name="jhmc" class="layui-input" placeholder="请输入计划名称" lay-verify="required"
30
+                       lay-reqtext="请输入计划名称">
31
+
32
+            </div>
33
+        </div>
34
+        <div class="layui-form-item">
35
+            <label class="layui-form-label" style="width: 70px">付款要求</label>
36
+            <div class="layui-input-block">
37
+                <textarea id="fkyq" name="fkyq" class="layui-textarea" style="width: 100%;height: 100px"></textarea>
38
+                <tip>按合同约定填写</tip>
39
+            </div>
40
+        </div>
41
+        <div class="layui-form-item">
42
+            <label class="layui-form-label" style="width: 90px; margin-left: -20px">支付比例(%)</label>
43
+            <!--            <label class="layui-form-label required" style="width: 90px; margin-left: -20px">支付比例(%)</label>-->
44
+            <div class="layui-input-block">
45
+                <!--                <input type="number" id="zfbl" name="zfbl" autocomplete="off" class="layui-input" lay-verify="required" lay-reqtext="支付比例不能为空">-->
46
+                <input type="number" id="zfbl" name="zfbl" autocomplete="off" class="layui-input">
47
+            </div>
48
+        </div>
49
+        <div class="layui-form-item">
50
+            <label class="layui-form-label required" style="width: 70px">支付金额(万元)</label>
51
+            <div class="layui-input-block">
52
+                <input type="number" id="zfje" name="zfje" autocomplete="off" class="layui-input" lay-verify="required"
53
+                       lay-reqtext="支付金额不能为空">
54
+            </div>
55
+        </div>
56
+        <div class="layui-form-item layui-inline" style="width: 100%">
57
+            <label class="layui-form-label" style="width: 10%">付款信息</label>
58
+            <div class="layuimini-container" style="margin-left: 13%; padding-bottom: 10px;width: 90%">
59
+                <input type="hidden" id="fkxx" name="fkxx" class="layui-input">
60
+                <div class="layui-btn-group" style="margin-bottom: -8px">
61
+                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-filter="add"><i class="layui-icon">&#xe63c;</i>添加行</button>
62
+                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-filter="delete"><i class="layui-icon">&#xe63c;</i>删除行</button>
63
+                </div>
64
+                <table class="layui-hide" id="currentTableId2" name="currentTableId2" lay-filter="currentTableFilter2" style="padding-top: 0px;margin-top: 0px"></table>
65
+            </div>
66
+        </div>
67
+
68
+
69
+        <!-- 右侧悬浮按钮 -->
70
+        <div class="right-bottom-btn">
71
+            <button class="layui-btn" lay-submit lay-filter="saveBtn">
72
+                <i class="layui-icon layui-icon-ok"></i>保存
73
+            </button>
74
+            <button class="layui-btn" lay-filter="cancleBtn">
75
+                <i class="layui-icon layui-icon-close"></i>取消
76
+            </button>
77
+        </div>
78
+    </div>
79
+</form>
80
+
81
+<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
82
+<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
83
+<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
84
+<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
85
+<script type="text/javascript" th:inline="javascript">
86
+    AjaxUtil.ctx = /*[[@{/}]]*/'';
87
+    layui.use(['form', 'layer','table'], function () {
88
+        var form = layui.form,
89
+            table = layui.table,
90
+            layer = layui.layer;
91
+
92
+        var htInfo = parent.getHtInfo();
93
+        $("#rws").val(htInfo.rws);
94
+        $("#ht").val(htInfo.ht);
95
+
96
+        //支付比例
97
+        $("#zfbl").on("input", function (e) {
98
+            //获取input输入的值
99
+            var zfbl = parseFloat(e.delegateTarget.value);
100
+            if (!isNaN(zfbl)) {
101
+                var zfje = htInfo.htje * zfbl * 0.01;
102
+                $("#zfje").val(zfje.toFixed(2));
103
+            }
104
+        });
105
+        //监听提交
106
+        form.on('submit(saveBtn)', function (data) {
107
+            const zfje = parseFloat(document.getElementById('zfje').value);
108
+            const zfbl = parseFloat(document.getElementById('zfbl').value);
109
+            const htje = parseFloat(htInfo.htje);
110
+            const zfjes = parseFloat(htje * zfbl * 0.01);
111
+            var data_prjPayplan = [];
112
+            for (const item of prjPayplan ) {
113
+                var dfWb = {
114
+                    "id": item.id,
115
+                    "name": item.name,
116
+                    "fkje": item.fkje,
117
+                    "fksm": item.fksm
118
+                };
119
+                data_prjPayplan.push(dfWb);
120
+            }
121
+            $("#fkxx").val(JSON.stringify(data_prjPayplan));
122
+            data.field.fkxx = JSON.stringify(data_prjPayplan);
123
+            if (zfje > htje){
124
+                layer.msg('支付金额不能大于合同总金额!');
125
+                return false;
126
+            }
127
+            var index = layer.load(0, {shade: 0.1});
128
+            AjaxUtil.post({
129
+                url: AjaxUtil.ctx + "prjPayplanXg/doAdd/?htje="+htje,
130
+                data: data.field,
131
+                success: function (res) {
132
+                    layer.close(index);
133
+                    if (res.code === 0) {
134
+                        parent.setUpdateFlag();
135
+                        parent.layer.close(parent.layer.getFrameIndex(window.name));
136
+                    } else {
137
+                        layer.msg(res.message);
138
+                    }
139
+
140
+                },
141
+                error: function (error) {
142
+                    Message.error(error.message, 1000);
143
+                }
144
+            });
145
+
146
+            return false;
147
+        });
148
+        var prjPayplan = new Array();
149
+        var currTable2 = table.render({
150
+            elem: '#currentTableId2',
151
+            data: prjPayplan,
152
+            cols: [
153
+                [
154
+                    {type: "checkbox", align: 'center'},
155
+                    {type: 'numbers', align: 'center'},
156
+                    {field: 'name', title: '公司名称', width: '30%',align:'center',edit: 'text'},
157
+                    {field: 'fkje', title: '付款金额', width: '15%', align: 'center',edit:'text'},
158
+                    {field: 'fksm', title: '付款说明', align: 'center',edit: 'text'}
159
+                ]
160
+            ],
161
+            autoSort: false,
162
+
163
+            limit: Number.MAX_VALUE,
164
+            page: false,
165
+            skin: 'grid',
166
+            done: function (res, curr, count) { // done为数据渲染完的回调
167
+            }
168
+        });
169
+        $("button[lay-filter='add']").click(function () {
170
+            var newRow={"name":"","fkje":"","fksm":""   };
171
+            prjPayplan.push(newRow)
172
+            currTable2.reload();
173
+        });
174
+        $("button[lay-filter='delete']").click(function () {
175
+            if (prjPayplan.length == 0)
176
+                return;
177
+
178
+            var checkStatus = table.checkStatus('currentTableId2')
179
+                , data = checkStatus.data;
180
+            if (data == null || data.length === 0) {
181
+                Message.warning("请选择要删除的文件!", 1000);
182
+                return;
183
+            }
184
+            for (var i = 0; i < prjPayplan.length; i++) {
185
+                var item = prjPayplan[i];
186
+                if (item.LAY_CHECKED) {//条件:选中
187
+                    prjPayplan.splice(i, 1);//移除后后造成数组下标索引发生变化,所以下面需要i--
188
+                    i--;
189
+                }
190
+            }
191
+            //刷新表格
192
+            currTable2.reload();
193
+        });
194
+        // 监听取消按钮
195
+        $("button[lay-filter='cancleBtn']").click(function () {
196
+            var iframeIndex = parent.layer.getFrameIndex(window.name);
197
+            parent.layer.close(iframeIndex);
198
+        });
199
+    });
200
+</script>
201
+</body>
202
+</html>

+ 192 - 0
src/main/resources/templates/prjpayplan/updateXg.html

@@ -0,0 +1,192 @@
1
+<!DOCTYPE html>
2
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
+    <title>新建</title>
7
+    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
8
+    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
9
+    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
10
+    <style>
11
+        body {
12
+            background-color: #ffffff;
13
+        }
14
+    </style>
15
+</head>
16
+<body>
17
+<form class="layui-form" action="" lay-filter="formDemo">
18
+    <div class="layui-form layuimini-form" style="margin-right: 20px">
19
+        <input type="hidden" id="rws" name="rws" class="layui-input" th:value="${rws}">
20
+        <input type="hidden" id="ht" name="ht" class="layui-input" th:value="${ht}">
21
+        <div class="layui-form-item">
22
+            <label class="layui-form-label required" style="width: 70px">计划名称</label>
23
+            <div class="layui-input-block">
24
+                <input type="hidden" id="id" name="id" class="layui-input" th:value="${payplan.id}">
25
+                <input type="text" id="jhmc" name="jhmc" class="layui-input" th:value="${payplan.jhmc}" readonly>
26
+            </div>
27
+        </div>
28
+        <div class="layui-form-item">
29
+            <label class="layui-form-label" style="width: 70px">付款要求</label>
30
+            <div class="layui-input-block">
31
+                <textarea id="fkyq" name="fkyq" class="layui-textarea" style="width: 100%;height: 100px"
32
+                          th:text="${payplan.fkyq}"></textarea>
33
+                <tip>按合同约定填写</tip>
34
+            </div>
35
+        </div>
36
+        <div class="layui-form-item">
37
+            <!--            <label class="layui-form-label required" style="width: 90px; margin-left: -20px">支付比例(%)</label>-->
38
+            <label class="layui-form-label" style="width: 90px; margin-left: -20px">支付比例(%)</label>-->
39
+            <div class="layui-input-block">
40
+                <!--                <input type="number" id="zfbl" name="zfbl" autocomplete="off" th:value="${payplan.zfbl}" class="layui-input" lay-verify="required" lay-reqtext="支付比例不能为空">-->
41
+                <input type="number" id="zfbl" name="zfbl" autocomplete="off" th:value="${payplan.zfbl}"
42
+                       class="layui-input">
43
+            </div>
44
+        </div>
45
+        <div class="layui-form-item">
46
+            <label class="layui-form-label required" style="width: 70px">支付金额(万元)</label>
47
+            <div class="layui-input-block">
48
+                <input type="number" id="zfje" name="zfje" autocomplete="off" th:value="${payplan.zfje}"
49
+                       class="layui-input" lay-verify="required" lay-reqtext="支付金额不能为空">
50
+            </div>
51
+        </div>
52
+        <div class="layui-form-item layui-inline" style="width: 100%">
53
+            <label class="layui-form-label" style="width: 10%">付款信息</label>
54
+            <div class="layuimini-container" style="margin-left: 13%; padding-bottom: 10px;width: 90%">
55
+                <input type="hidden" id="fkxx" name="fkxx" class="layui-input">
56
+                <div class="layui-btn-group" style="margin-bottom: -8px">
57
+                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-filter="add"><i class="layui-icon">&#xe63c;</i>添加行</button>
58
+                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-filter="delete"><i class="layui-icon">&#xe63c;</i>删除行</button>
59
+                </div>
60
+                <table class="layui-hide" id="currentTableId2" name="currentTableId2" lay-filter="currentTableFilter2" style="padding-top: 0px;margin-top: 0px"></table>
61
+            </div>
62
+        </div>
63
+
64
+
65
+        <!-- 右侧悬浮按钮 -->
66
+        <div class="right-bottom-btn">
67
+            <button class="layui-btn" lay-submit lay-filter="saveBtn">
68
+                <i class="layui-icon layui-icon-ok"></i>保存
69
+            </button>
70
+            <button class="layui-btn" lay-filter="cancleBtn">
71
+                <i class="layui-icon layui-icon-close"></i>取消
72
+            </button>
73
+        </div>
74
+    </div>
75
+</form>
76
+
77
+<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
78
+<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
79
+<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
80
+<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
81
+<script type="text/javascript" th:inline="javascript">
82
+    AjaxUtil.ctx = /*[[@{/}]]*/'';
83
+    layui.use(['form', 'layer','table'], function () {
84
+        var form = layui.form,
85
+            table= layui.table,
86
+            layer = layui.layer;
87
+
88
+        var htInfo = parent.getHtInfo();
89
+        //支付比例
90
+        $("#zfbl").on("input", function (e) {
91
+            //获取input输入的值
92
+            var zfbl = parseFloat(e.delegateTarget.value);
93
+            if (!isNaN(zfbl)) {
94
+                var zfje = htInfo.htje * zfbl * 0.01;
95
+                $("#zfje").val(zfje.toFixed(2));
96
+            }
97
+        });
98
+        var prjPayplan = new Array();
99
+        if ([[${payplan.fkxx}]] != null && [[${payplan.fkxx}]] != "") {
100
+            prjPayplan = eval('(' + [[${payplan.fkxx}]] + ')');
101
+        }
102
+        var currTable2 = table.render({
103
+            elem: '#currentTableId2',
104
+            data: prjPayplan,
105
+            cols: [
106
+                [
107
+                    {type: "checkbox", align: 'center'},
108
+                    {type: 'numbers', align: 'center'},
109
+                    {field: 'name', title: '公司名称', width: '30%',align:'center',edit: 'text'},
110
+                    {field: 'fkje', title: '付款金额', width: '15%', align: 'center',edit:'text'},
111
+                    {field: 'fksm', title: '付款说明', align: 'center',edit: 'text'}
112
+                ]
113
+            ],
114
+            autoSort: false,
115
+
116
+            limit: Number.MAX_VALUE,
117
+            page: false,
118
+            skin: 'grid',
119
+            done: function (res, curr, count) { // done为数据渲染完的回调
120
+            }
121
+        });
122
+
123
+        //监听提交
124
+        form.on('submit(saveBtn)', function (data) {
125
+            var data_prjPayplan = [];
126
+            for (const item of prjPayplan ) {
127
+                var dfWb = {
128
+                    "id": item.id,
129
+                    "name": item.name,
130
+                    "fkje": item.fkje,
131
+                    "fksm": item.fksm
132
+                };
133
+                data_prjPayplan.push(dfWb);
134
+            }
135
+            $("#fkxx").val(JSON.stringify(data_prjPayplan));
136
+            data.field.fkxx = JSON.stringify(data_prjPayplan);
137
+            var index = layer.load(0, {shade: 0.1});
138
+            AjaxUtil.post({
139
+                url: AjaxUtil.ctx + "prjPayplanXg/doUpdate",
140
+                data: data.field,
141
+                success: function (res) {
142
+                    layer.close(index);
143
+                    if (res.code === 0) {
144
+                        parent.setUpdateFlag();
145
+                    } else {
146
+                        // Message.error(res.message, 1000);
147
+                    }
148
+                    parent.layer.close(parent.layer.getFrameIndex(window.name));
149
+                },
150
+                error: function (error) {
151
+                    Message.error(error.message, 1000)
152
+                }
153
+            });
154
+
155
+            return false;
156
+        });
157
+        //监听添加行按钮
158
+        $("button[lay-filter='add']").click(function () {
159
+            var newRow={"name":"","fkje":"","fksm":""   };
160
+            prjPayplan.push(newRow)
161
+            currTable2.reload();
162
+        });
163
+        //监听删除行按钮
164
+        $("button[lay-filter='delete']").click(function () {
165
+            if (prjPayplan.length == 0)
166
+                return;
167
+
168
+            var checkStatus = table.checkStatus('currentTableId2')
169
+                , data = checkStatus.data;
170
+            if (data == null || data.length === 0) {
171
+                Message.warning("请选择要删除的文件!", 1000);
172
+                return;
173
+            }
174
+            for (var i = 0; i < prjPayplan.length; i++) {
175
+                var item = prjPayplan[i];
176
+                if (item.LAY_CHECKED) {//条件:选中
177
+                    prjPayplan.splice(i, 1);//移除后后造成数组下标索引发生变化,所以下面需要i--
178
+                    i--;
179
+                }
180
+            }
181
+            //刷新表格
182
+            currTable2.reload();
183
+        });
184
+        // 监听取消按钮
185
+        $("button[lay-filter='cancleBtn']").click(function () {
186
+            var iframeIndex = parent.layer.getFrameIndex(window.name);
187
+            parent.layer.close(iframeIndex);
188
+        });
189
+    });
190
+</script>
191
+</body>
192
+</html>