From 811e1085c075d956f4c82041ab61905fd480339d Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 31 五月 2023 12:47:05 +0800
Subject: [PATCH] #货物状态自选

---
 src/main/java/com/zy/asrs/controller/OrderController.java |    8 +--
 src/main/webapp/static/js/basDevp/basDevp.js              |    2 +
 src/main/webapp/static/js/order/order.js                  |   28 +++++++++++++
 src/main/webapp/views/order/order.html                    |   27 +++++++++++++
 4 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/OrderController.java b/src/main/java/com/zy/asrs/controller/OrderController.java
index 244d8de..f605dde 100644
--- a/src/main/java/com/zy/asrs/controller/OrderController.java
+++ b/src/main/java/com/zy/asrs/controller/OrderController.java
@@ -94,14 +94,10 @@
     @ManagerAuth(memo = "鎵嬪姩娣诲姞璁㈠崟")
     @Transactional
     public R formAdd(@RequestBody OrderDomainParam param){
-        int payment = 0;
         String prefix = "";
         DocType docType = docTypeService.selectById(param.getDocType());
         if(!Cools.isEmpty(docType)){
             prefix = docType.getPakin() == 1 ? "RK" : "CK";
-        }
-        if (prefix.equals("CK")){
-            payment = 1;
         }
         if(Cools.isEmpty(param.getOrderNo())){
             param.setOrderNo(prefix + snowflakeIdWorker.nextId());
@@ -184,7 +180,9 @@
                 orderDetl.setUpdateTime(now);
                 orderDetl.setStatus(1);
                 orderDetl.setQty(0.0D);
-                orderDetl.setPayment(payment);
+                if(orderDetl.getPayment() == null){
+                    orderDetl.setPayment(0);
+                }
                 orderDetl.setUuid(String.valueOf(System.currentTimeMillis()));
                 if (!orderDetlService.insert(orderDetl)) {
                     throw new CoolException("淇濆瓨璁㈠崟鏄庣粏妗eけ璐�");
diff --git a/src/main/webapp/static/js/basDevp/basDevp.js b/src/main/webapp/static/js/basDevp/basDevp.js
index 535e6e7..9459a19 100644
--- a/src/main/webapp/static/js/basDevp/basDevp.js
+++ b/src/main/webapp/static/js/basDevp/basDevp.js
@@ -113,6 +113,7 @@
             statusCode: 200
         },
         done: function(res, curr, count) {
+
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
             }
@@ -120,6 +121,7 @@
             limit();
             form.on('checkbox(tableCheckbox)', function (data) {
                 var _index = $(data.elem).attr('table-index')||0;
+                console.log(_index);
                 if(data.elem.checked){
                     res.data[_index][data.value] = 'Y';
                 }else{
diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js
index 133061c..65ada4d 100644
--- a/src/main/webapp/static/js/order/order.js
+++ b/src/main/webapp/static/js/order/order.js
@@ -256,6 +256,7 @@
                         return false;
                     }
                     let nList = admin.util.deepClone(xxDataList);
+                    console.log(nList);
                     for (let xi = 0; xi < nList.length; xi++) {
                         if (nList[xi].anfme <= 0){
                             layer.msg('鏄庣粏淇敼鏁伴噺涓嶅悎娉�', {icon: 2});
@@ -316,13 +317,36 @@
                         {field: 'specs', title: '瑙勬牸'},
                         {field: 'anfme', title: '鏁伴噺(淇敼)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
                         {field: 'owner', title: '璐т富缂栧彿', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
+                        {field: 'payment', title: '璐т富缂栧彿', style: 'color: blue;font-weight: bold', templet: '#payment'},
+                        // {field: 'payment', title: '璐х墿鐘舵��',align: 'center', templet: '#payment'},
                         {field: 'qty', title: '浣滀笟鏁伴噺',  minWidth: 100, width: 100},
                         // {field: 'unit', title: '鍗曚綅', width: 80},
                         {field: 'memo', title: '澶囨敞' , edit: true},
                         {align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
                     ]],
-                    done: function (res) {
+                    done: function (res, curr, count) {
                         $(layero).find('.layui-table-view').css('margin', '0');
+                        var options = this;
+
+                        // 鑾峰彇褰撳墠琛屾暟鎹�
+                        table.getRowData = function(elem){
+                            var index = $(elem).closest('tr').data('index');
+                            return table.cache[options.id][index] || {};
+                        };
+
+                        $('.select-primary').on('change', function(){
+                            var value = this.value; // 鑾峰彇閫変腑椤� value
+                            var data = table.getRowData(this);
+                            console.log(value);
+                            xxDataList.forEach(res => {
+                                if (data.id === res.id){
+                                    console.log(res)
+                                    res.payment = value;
+                                }
+                            })
+
+
+                        });
                     },
                     size: ''
                 };
@@ -557,4 +581,6 @@
         ,type: 'datetime'
         ,range: true
     });
+
+
 });
diff --git a/src/main/webapp/views/order/order.html b/src/main/webapp/views/order/order.html
index 070c09c..99155f2 100644
--- a/src/main/webapp/views/order/order.html
+++ b/src/main/webapp/views/order/order.html
@@ -248,6 +248,33 @@
     </div>
     {{/each}}
 </script>
+
+
+<script type="text/html" id="payment">
+    <select id="select-primary" style="width: 100%" class="layui-border select-primary" lay-ignore >
+        <option value="0"
+                {{# if( d.payment === 0){ }}
+                selected = "selected"
+                {{# } }}
+        >浠i噰</option>
+        <option value="1"
+                {{# if( d.payment === 1){ }}
+                selected = "selected"
+                {{# } }}
+        >浠撳偍</option>
+    </select>
+</script>
+
+
+<!--<script type="text/html" id="payment">-->
+<!--    {{#  var cityList = d.cityList || ["鍖椾含","涓婃捣","骞垮窞","鍩庡競-1"]; }}-->
+<!--    <select name="payment" class="layui-border select-demo-primary" lay-ignore>-->
+<!--        <option value="">鍘熺敓 select 妗�</option>-->
+<!--        {{#  layui.each(cityList, function(i, v){ }}-->
+<!--        <option value="{{= v }}" {{= v === d.city ? 'selected' : '' }}>{{= v }}</option>-->
+<!--        {{#  }); }}-->
+<!--    </select>-->
+<!--</script>-->
 </body>
 
 </html>

--
Gitblit v1.9.1