From 539d9ffc477d28a23a923b41fdeabc8c37c99ce6 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 23 九月 2024 14:43:31 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/locOwner/locOwner.js |   64 ++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/src/main/webapp/static/js/locOwner/locOwner.js b/src/main/webapp/static/js/locOwner/locOwner.js
index 66e7283..6dd579a 100644
--- a/src/main/webapp/static/js/locOwner/locOwner.js
+++ b/src/main/webapp/static/js/locOwner/locOwner.js
@@ -1,13 +1,16 @@
 var pageCurr;
+var admin;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
-}).use(['table','laydate', 'form', 'admin'], function(){
+}).extend({
+    dropdown: 'dropdown/dropdown',
+}).use(['table','laydate', 'form', 'admin', 'dropdown'], function(){
     var table = layui.table;
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
     var form = layui.form;
-    var admin = layui.admin;
+    admin = layui.admin;
 
     // 鏁版嵁娓叉煋
     tableIns = table.render({
@@ -23,7 +26,9 @@
         cols: [[
             // {type: 'checkbox'}
             {field: 'owner', align: 'center',title: '瀹㈡埛鍚嶇О'}
-            ,{field: 'id', align: 'center',title: '瀹㈡埛缂栫爜'}
+            ,{field: 'phone', align: 'center',title: '鐢佃瘽'}
+            ,{field: 'addr', align: 'center',title: '鍦板潃'}
+            ,{field: 'id', align: 'center',title: '瀹㈡埛缂栫爜',hide:true}
             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
         ]],
         request: {
@@ -238,3 +243,56 @@
         page: {curr: pageCurr}
      });
 }
+// excel瀵煎叆妯℃澘涓嬭浇
+function excelMouldDownload(){
+    layer.load(1, {shade: [0.1,'#fff']});
+    location.href = baseUrl + "/locOwner/excel/import/mould";
+    layer.closeAll('loading');
+}
+
+// excel瀵煎叆
+function importExcel() {
+    $("#importExcel").trigger("click");
+}
+function upload(obj){
+    if(!obj.files) {
+        return;
+    }
+    var file = obj.files[0];
+    admin.confirm('纭鍚屾 [' + file.name +'] 鏂囦欢鍚楋紵', function (index) {
+        layer.load(1, {shade: [0.1,'#fff']});
+        var url = baseUrl + "/locOwner/excel/import/auth";
+        var form = new FormData();
+        form.append("file", file);
+        xhr = new XMLHttpRequest();
+        xhr.open("post", url, true); //post鏂瑰紡锛寀rl涓烘湇鍔″櫒璇锋眰鍦板潃锛宼rue 璇ュ弬鏁拌瀹氳姹傛槸鍚﹀紓姝ュ鐞嗐��
+        xhr.setRequestHeader('token', localStorage.getItem('token'));
+        xhr.onload = uploadComplete; //璇锋眰瀹屾垚
+        xhr.onerror =  uploadFailed; //璇锋眰澶辫触
+        xhr.onloadend = function () { // // 涓婁紶瀹屾垚閲嶇疆鏂囦欢娴�
+            layer.closeAll('loading');
+            $("#importExcel").val("");
+        };
+        // xhr.upload.onprogress = progressFunction;//銆愪笂浼犺繘搴﹁皟鐢ㄦ柟娉曞疄鐜般��
+        xhr.upload.onloadstart = function(){//涓婁紶寮�濮嬫墽琛屾柟娉�
+            ot = new Date().getTime();   //璁剧疆涓婁紶寮�濮嬫椂闂�
+            oloaded = 0;//璁剧疆涓婁紶寮�濮嬫椂锛屼互涓婁紶鐨勬枃浠跺ぇ灏忎负0
+        };
+        xhr.send(form);
+    }, function(index){
+        $("#importExcel").val("");
+    });
+}
+function uploadComplete(evt) {
+    var res = JSON.parse(evt.target.responseText);
+    if(res.code === 200) {
+        layer.msg(res.msg, {icon: 1});
+        loadTree("");
+    } else {
+        layer.msg(res.msg, {icon: 2});
+    }
+}
+function uploadFailed(evt) {
+    var res = JSON.parse(evt.target.responseText);
+    layer.msg(res.msg, {icon: 2});
+}

--
Gitblit v1.9.1