ソースを参照

付款计划付款信息

梁世豪 8 ヶ月 前
コミット
258e5fe5f6

+ 7 - 0
src/main/java/com/liang/entity/PrjPayplan.java

@@ -1,5 +1,7 @@
1 1
 package com.liang.entity;
2 2
 
3
+import lombok.Data;
4
+
3 5
 import java.sql.Date;
4 6
 import java.io.Serializable;
5 7
 
@@ -9,6 +11,7 @@ import java.io.Serializable;
9 11
  * @author makejava
10 12
  * @since 2023-06-06 13:16:05
11 13
  */
14
+@Data
12 15
 public class PrjPayplan implements Serializable {
13 16
     private static final long serialVersionUID = -50088345215138191L;
14 17
 
@@ -53,6 +56,10 @@ public class PrjPayplan implements Serializable {
53 56
      */
54 57
     private Integer ht;
55 58
 
59
+    /**
60
+     *付款信息
61
+     */
62
+    private String fkxx;
56 63
 
57 64
     public Integer getId() {
58 65
         return id;

+ 7 - 2
src/main/resources/mapper/PrjPayplanDao.xml

@@ -13,6 +13,7 @@
13 13
         <result property="fysq" column="FYSQ" jdbcType="INTEGER"/>
14 14
         <result property="jhmc" column="JHMC" jdbcType="VARCHAR"/>
15 15
         <result property="ht" column="HT" jdbcType="INTEGER"/>
16
+        <result property="fkxx" column="FKXX" jdbcType="VARCHAR"/>
16 17
     </resultMap>
17 18
 
18 19
     <!--查询单个-->
@@ -103,8 +104,8 @@
103 104
 
104 105
     <!--新增所有列-->
105 106
     <insert id="insert" keyProperty="id" useGeneratedKeys="true">
106
-        insert into prj_PayPlan(FKYQ, ZFBL, ZFJE, CJR, CJSJ, RWS, JHMC, HT)
107
-        values (#{fkyq}, #{zfbl}, #{zfje}, #{cjr}, GETDATE(), #{rws}, #{jhmc}, #{ht})
107
+        insert into prj_PayPlan(FKYQ, ZFBL, ZFJE, CJR, CJSJ, RWS, JHMC, HT,FKXX)
108
+        values (#{fkyq}, #{zfbl}, #{zfje}, #{cjr}, GETDATE(), #{rws}, #{jhmc}, #{ht},#{fkxx})
108 109
     </insert>
109 110
 
110 111
     <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
@@ -151,6 +152,10 @@
151 152
             <if test="fysq != null">
152 153
                 FYSQ = #{fysq},
153 154
             </if>
155
+            <if test="fkxx != null">
156
+                FKXX = #{fkxx},
157
+            </if>
158
+
154 159
         </set>
155 160
         where ID = #{id}
156 161
     </update>

+ 70 - 3
src/main/resources/templates/prjpayplan/add.html

@@ -53,6 +53,17 @@
53 53
                        lay-reqtext="支付金额不能为空">
54 54
             </div>
55 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>
56 67
 
57 68
 
58 69
         <!-- 右侧悬浮按钮 -->
@@ -73,8 +84,9 @@
73 84
 <script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
74 85
 <script type="text/javascript" th:inline="javascript">
75 86
     AjaxUtil.ctx = /*[[@{/}]]*/'';
76
-    layui.use(['form', 'layer'], function () {
87
+    layui.use(['form', 'layer','table'], function () {
77 88
         var form = layui.form,
89
+            table = layui.table,
78 90
             layer = layui.layer;
79 91
 
80 92
         var htInfo = parent.getHtInfo();
@@ -96,8 +108,18 @@
96 108
             const zfbl = parseFloat(document.getElementById('zfbl').value);
97 109
             const htje = parseFloat(htInfo.htje);
98 110
             const zfjes = parseFloat(htje * zfbl * 0.01);
99
-            console.log(zfje);
100
-            console.log(htje);
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);
101 123
             if (zfje > htje){
102 124
                 layer.msg('支付金额不能大于合同总金额!');
103 125
                 return false;
@@ -123,7 +145,52 @@
123 145
 
124 146
             return false;
125 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,
126 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
+        });
127 194
         // 监听取消按钮
128 195
         $("button[lay-filter='cancleBtn']").click(function () {
129 196
             var iframeIndex = parent.layer.getFrameIndex(window.name);

+ 75 - 1
src/main/resources/templates/prjpayplan/update.html

@@ -49,6 +49,17 @@
49 49
                        class="layui-input" lay-verify="required" lay-reqtext="支付金额不能为空">
50 50
             </div>
51 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>
52 63
 
53 64
 
54 65
         <!-- 右侧悬浮按钮 -->
@@ -69,8 +80,9 @@
69 80
 <script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
70 81
 <script type="text/javascript" th:inline="javascript">
71 82
     AjaxUtil.ctx = /*[[@{/}]]*/'';
72
-    layui.use(['form', 'layer'], function () {
83
+    layui.use(['form', 'layer','table'], function () {
73 84
         var form = layui.form,
85
+            table= layui.table,
74 86
             layer = layui.layer;
75 87
 
76 88
         var htInfo = parent.getHtInfo();
@@ -83,9 +95,45 @@
83 95
                 $("#zfje").val(zfje.toFixed(2));
84 96
             }
85 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
+        });
86 122
 
87 123
         //监听提交
88 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);
89 137
             var index = layer.load(0, {shade: 0.1});
90 138
             AjaxUtil.post({
91 139
                 url: AjaxUtil.ctx + "prjPayplan/doUpdate",
@@ -106,7 +154,33 @@
106 154
 
107 155
             return false;
108 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;
109 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
+        });
110 184
         // 监听取消按钮
111 185
         $("button[lay-filter='cancleBtn']").click(function () {
112 186
             var iframeIndex = parent.layer.getFrameIndex(window.name);

+ 37 - 1
src/main/resources/templates/prjpayplan/view.html

@@ -41,6 +41,14 @@
41 41
                 <input type="text" id="zfje" name="zfje" class="layui-input" th:value="${payplan.zfje}" readonly>
42 42
             </div>
43 43
         </div>
44
+        <div class="layui-form-item layui-inline" style="width: 100%">
45
+            <label class="layui-form-label" style="width: 10%">付款信息</label>
46
+            <div class="layuimini-container" style="margin-left: 13%; padding-bottom: 10px;width: 90%">
47
+                <input type="hidden" id="fkxx" name="fkxx" class="layui-input"
48
+                th:value="${payplan.fkxx}">
49
+                <table class="layui-hide" id="currentTableId2" name="currentTableId2" lay-filter="currentTableFilter2" style="padding-top: 0px;margin-top: 0px"></table>
50
+            </div>
51
+        </div>
44 52
 
45 53
 
46 54
         <!-- 右侧悬浮按钮 -->
@@ -58,7 +66,35 @@
58 66
 <script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
59 67
 <script type="text/javascript" th:inline="javascript">
60 68
     AjaxUtil.ctx = /*[[@{/}]]*/'';
61
-    layui.use(['form', 'layer', 'tableSelect'], function () {
69
+    layui.use(['form', 'layer', 'tableSelect','table'], function () {
70
+        var table = layui.table;
71
+        console.log([[${payplan.fkxx}]])
72
+        // 用于存放表格数据
73
+        var prjPayplan = new Array();
74
+        if ([[${payplan.fkxx}]] != null && [[${payplan.fkxx}]] != "") {
75
+            prjPayplan = eval('(' + [[${payplan.fkxx}]] + ')');
76
+        }
77
+        var currTable2 = table.render({
78
+            elem: '#currentTableId2',
79
+            data: prjPayplan,
80
+            cols: [
81
+                [
82
+                    {type: "checkbox", align: 'center'},
83
+                    {type: 'numbers', align: 'center'},
84
+                    {field: 'name', title: '公司名称', width: '30%',align:'center',edit: 'text'},
85
+                    {field: 'fkje', title: '付款金额', width: '15%', align: 'center',edit:'text'},
86
+                    {field: 'fksm', title: '付款说明', align: 'center',edit: 'text'}
87
+                ]
88
+            ],
89
+            autoSort: false,
90
+
91
+            limit: Number.MAX_VALUE,
92
+            page: false,
93
+            skin: 'grid',
94
+            done: function (res, curr, count) { // done为数据渲染完的回调
95
+            }
96
+        });
97
+
62 98
 
63 99
         // 监听取消按钮
64 100
         $("button[lay-filter='cancleBtn']").click(function () {