From 4a9d97bdf382b4f00a9723a30ff5d32a50be295c Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 16 十月 2023 17:02:36 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/contract/contract.js |   87 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 85 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/static/js/contract/contract.js b/src/main/webapp/static/js/contract/contract.js
index dec90b0..4d01e07 100644
--- a/src/main/webapp/static/js/contract/contract.js
+++ b/src/main/webapp/static/js/contract/contract.js
@@ -1,7 +1,7 @@
 var pageCurr;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
-}).use(['table', 'laydate', 'form', 'admin', 'tree', 'dropdown'], function () {
+}).use(['table', 'laydate', 'form', 'admin','xmSelect', 'tree', 'dropdown'], function () {
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
@@ -88,11 +88,12 @@
             , {field: 'status$', align: 'center', title: '鐘舵��'}
             , {field: 'userId$', align: 'center', title: '娣诲姞浜哄憳'}
             , {field: 'createTime$', align: 'center', title: '娣诲姞鏃堕棿'}
+            , {field: 'settle$', align: 'center',title: '杩涘害', style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
             , {field: 'updateBy$', align: 'center', title: '淇敼浜哄憳'}
             , {field: 'updateTime$', align: 'center', title: '淇敼鏃堕棿'}
             , {field: 'memo', align: 'center', title: '澶囨敞'}
 
-            , {fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 400}
+            , {fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 500}
         ]],
         request: {
             pageName: 'curr',
@@ -193,6 +194,29 @@
     table.on('tool(contract)', function (obj) {
         var data = obj.data;
         switch (obj.event) {
+            case 'approval':
+                layer.confirm('瀹℃壒閫氳繃锛�', {
+                    skin: 'layui-layer-admin',
+                    shade: .1,
+                    offset: '200px',
+                    title: data.name
+                }, function (i) {
+                    layer.close(i);
+                    approval(data.id);
+                });
+                break;
+            case 'more':
+                top.contractByMore = data.id;
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "contract_more.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
             case 'edit':
                 showEditModel(data);
                 break;
@@ -226,9 +250,12 @@
             title: (mData ? '淇敼' : '娣诲姞') + '鍚堝悓',
             content: $('#editDialog').html(),
             success: function (layero, dIndex) {
+                let loadNameXml = loadNameXmlSel()
+                console.log(loadNameXml)
                 layDateRender(mData);
                 form.val('detail', mData);
                 form.on('submit(editSubmit)', function (data) {
+                    data.field.customer = loadNameXml.getValue()[0] ? loadNameXml.getValue()[0].name : null;
                     var loadIndex = layer.load(2);
                     $.ajax({
                         url: baseUrl + "/contract/" + (mData ? 'update' : 'add') + "/auth",
@@ -472,6 +499,62 @@
 
     layDateRender();
 
+    function approval(contractId, plannerId, dIdx) {
+        let loadIndex = layer.load(2);
+        $.ajax({
+            url: baseUrl+"/contract/approval/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                contractId: contractId,
+                plannerId: plannerId
+            },
+            method: 'POST',
+            success: function (res) {
+                if (dIdx) {
+                    layer.close(dIdx);
+                }
+                layer.close(loadIndex);
+                if (res.code === 200){
+                    layer.msg(res.msg, {icon: 1});
+                    tableReload();
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg, {icon: 2});
+                }
+            }
+        })
+    }
+
+    window.loadNameXmlSel = function () {
+        return xmSelect.render({
+            el: '#nameXmlSel',
+            autoRow: true,
+            filterable: true,
+            remoteSearch: true,
+            clickClose: true,
+            radio: true,
+            remoteMethod: function (val, cb, show) {
+                $.ajax({
+                    url: baseUrl + "/cstmr/all/get/kv",
+                    headers: {'token': localStorage.getItem('token')},
+                    data: {
+                        condition: val
+                    },
+                    method: 'POST',
+                    success: function (res) {
+                        if (res.code === 200) {
+                            cb(res.data)
+                        } else {
+                            cb([]);
+                            layer.msg(res.msg, {icon: 2});
+                        }
+                    }
+                });
+            },
+        });
+    }
+
 });
 
 // 鍏抽棴鍔ㄤ綔

--
Gitblit v1.9.1