From c37dc71489ea9659bc895fefff5f56619ed6e065 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期四, 23 十一月 2023 14:11:47 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/crm/system/controller/AppVersionController.java    |  216 +++++++++++++++
 src/main/resources/mapper/AppVersionMapper.xml                          |   29 ++
 src/main/webapp/static/js/appVersion/appVersion.js                      |  294 +++++++++++++++++++++
 src/main/resources/appVersion/lock                                      |    0 
 src/main/java/com/zy/crm/system/entity/AppVersion.java                  |   86 ++++++
 src/main/java/com/zy/crm/system/mapper/AppVersionMapper.java            |   16 +
 src/main/java/com/zy/crm/system/service/AppVersionService.java          |   12 
 src/main/java/com/zy/crm/system/service/impl/AppVersionServiceImpl.java |   21 +
 src/main/webapp/views/appVersion/appVersion.html                        |  113 ++++++++
 9 files changed, 787 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/crm/system/controller/AppVersionController.java b/src/main/java/com/zy/crm/system/controller/AppVersionController.java
new file mode 100644
index 0000000..9cf7eb6
--- /dev/null
+++ b/src/main/java/com/zy/crm/system/controller/AppVersionController.java
@@ -0,0 +1,216 @@
+package com.zy.crm.system.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.core.annotations.ManagerAuth;
+import com.core.common.BaseRes;
+import com.core.common.Cools;
+import com.core.common.DateUtils;
+import com.core.common.R;
+import com.zy.crm.common.web.BaseController;
+import com.zy.crm.system.entity.AppVersion;
+import com.zy.crm.system.service.AppVersionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.util.ClassUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+public class AppVersionController extends BaseController {
+
+    @Autowired
+    private AppVersionService appVersionService;
+
+    @RequestMapping(value = "/appVersion/{id}/auth")
+    @ManagerAuth
+    public R get(@PathVariable("id") String id) {
+        return R.ok(appVersionService.selectById(String.valueOf(id)));
+    }
+
+    @RequestMapping(value = "/appVersion/list/auth")
+    @ManagerAuth
+    public R list(@RequestParam(defaultValue = "1") Integer curr,
+                  @RequestParam(defaultValue = "10") Integer limit,
+                  @RequestParam(required = false) String orderByField,
+                  @RequestParam(required = false) String orderByType,
+                  @RequestParam(required = false) String condition,
+                  @RequestParam Map<String, Object> param){
+        EntityWrapper<AppVersion> wrapper = new EntityWrapper<>();
+        excludeTrash(param);
+        convert(param, wrapper);
+        allLike(AppVersion.class, param.keySet(), wrapper, condition);
+        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+        return R.ok(appVersionService.selectPage(new Page<>(curr, limit), wrapper));
+    }
+
+    @RequestMapping(value = "/appVersion/checkUpdate/{version}/{type}")
+    public R checkUpdate(@PathVariable("version") String version,
+                         @PathVariable("type") Integer type) {
+        AppVersion latestApp = appVersionService.getLatestApp(type);
+        if (latestApp == null) {
+            return R.error();
+        }
+
+        if (latestApp.getVersion().equals(version)) {
+            return R.error("宸叉槸鏈�鏂扮増鏈�");
+        }
+
+        return R.ok("鏈夋柊鐗堟湰锛岄渶瑕佹洿鏂�").add(latestApp);
+    }
+
+    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
+        for (Map.Entry<String, Object> entry : map.entrySet()){
+            String val = String.valueOf(entry.getValue());
+            if (val.contains(RANGE_TIME_LINK)){
+                String[] dates = val.split(RANGE_TIME_LINK);
+                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
+                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
+            } else {
+                wrapper.like(entry.getKey(), val);
+            }
+        }
+    }
+
+    @RequestMapping(value = "/appVersion/add/auth")
+    @ManagerAuth
+    public R add(AppVersion appVersion) {
+        if (appVersion.getLatest() == 1) {
+            //淇敼鏈�鏂扮増鏈椂锛岄渶瑕佸皢鍏朵粬鐗堟湰璁剧疆涓洪潪鏈�鏂扮増
+            appVersionService.updateLatest(0, appVersion.getType());
+        }
+        appVersionService.insert(appVersion);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/appVersion/update/auth")
+    @ManagerAuth
+    public R update(AppVersion appVersion){
+        if (Cools.isEmpty(appVersion) || null==appVersion.getId()){
+            return R.error();
+        }
+        if (appVersion.getLatest() == 1) {
+            //淇敼鏈�鏂扮増鏈椂锛岄渶瑕佸皢鍏朵粬鐗堟湰璁剧疆涓洪潪鏈�鏂扮増
+            appVersionService.updateLatest(0, appVersion.getType());
+        }
+        appVersionService.updateById(appVersion);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/appVersion/delete/auth")
+    @ManagerAuth
+    public R delete(@RequestParam(value="ids[]") Long[] ids){
+        for (Long id : ids){
+            appVersionService.deleteById(id);
+        }
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/appVersion/export/auth")
+    @ManagerAuth
+    public R export(@RequestBody JSONObject param){
+        EntityWrapper<AppVersion> wrapper = new EntityWrapper<>();
+        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
+        Map<String, Object> map = excludeTrash(param.getJSONObject("appVersion"));
+        convert(map, wrapper);
+        List<AppVersion> list = appVersionService.selectList(wrapper);
+        return R.ok(exportSupport(list, fields));
+    }
+
+    @RequestMapping(value = "/appVersionQuery/auth")
+    @ManagerAuth
+    public R query(String condition) {
+        EntityWrapper<AppVersion> wrapper = new EntityWrapper<>();
+        wrapper.like("id", condition);
+        Page<AppVersion> page = appVersionService.selectPage(new Page<>(0, 10), wrapper);
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (AppVersion appVersion : page.getRecords()){
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", appVersion.getId());
+            map.put("value", appVersion.getId());
+            result.add(map);
+        }
+        return R.ok(result);
+    }
+
+    @RequestMapping(value = "/appVersion/check/column/auth")
+    @ManagerAuth
+    public R query(@RequestBody JSONObject param) {
+        Wrapper<AppVersion> wrapper = new EntityWrapper<AppVersion>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
+        if (null != appVersionService.selectOne(wrapper)){
+            return R.parse(BaseRes.REPEAT).add(getComment(AppVersion.class, String.valueOf(param.get("key"))));
+        }
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/appVersion/uploadApp/auth")
+    @ManagerAuth
+    public R uploadApp(@RequestParam("id") Integer id,
+                       @RequestParam("file") MultipartFile[] files){
+        AppVersion appVersion = appVersionService.selectById(id);
+
+        MultipartFile file = files[0];
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss");
+        String path =  ClassUtils.getDefaultClassLoader().getResource("appVersion").getPath();
+        //鏂囦欢鍚庣紑鍚�
+        String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
+        //涓婁紶鏂囦欢鍚�
+        String filename = format.format(new Date()) + suffix;
+        //鏈�缁堟枃浠惰矾寰�
+        String filepath = path + "/" + filename;
+
+
+        //鏈嶅姟鍣ㄧ淇濆瓨鐨勬枃浠跺璞�
+        File serverFile = new File(filepath);
+        if(!serverFile.exists()) {
+            try {
+                //鍒涘缓鏂囦欢
+                serverFile.createNewFile();
+                //灏嗕笂浼犵殑鏂囦欢鍐欏叆鍒版湇鍔″櫒绔枃浠跺唴
+                file.transferTo(serverFile);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        //淇濆瓨鏂囦欢鍚�
+        appVersion.setPath(filename);
+        appVersionService.updateById(appVersion);
+        return R.ok();
+    }
+
+    @RequestMapping("/appVersion/downloadApp/{filename}")
+    public void download(@PathVariable String filename, HttpServletResponse response) {
+        try {
+            ClassPathResource pathResource = new ClassPathResource("appVersion/" + filename);
+            File file = pathResource.getFile();
+            InputStream inputStream = pathResource.getInputStream();
+            //杈撳嚭鏂囦欢
+            InputStream fis = new BufferedInputStream(inputStream);
+            byte[] buffer = new byte[fis.available()];
+            fis.read(buffer);
+            fis.close();
+            response.reset();
+
+            //鑾峰彇鏂囦欢鐨勫悕瀛楀啀娴忚鍣ㄤ笅杞介〉闈�
+            String name = file.getName();
+            response.addHeader("Content-Disposition", "attachment;filename=" + new String(name.getBytes(), "iso-8859-1"));
+            response.addHeader("Content-Length", "" + file.length());
+            OutputStream out = new BufferedOutputStream(response.getOutputStream());
+            response.setContentType("application/octet-stream");
+            out.write(buffer);
+            out.flush();
+            out.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            response.setStatus(404);
+        }
+    }
+}
diff --git a/src/main/java/com/zy/crm/system/entity/AppVersion.java b/src/main/java/com/zy/crm/system/entity/AppVersion.java
new file mode 100644
index 0000000..d7c171e
--- /dev/null
+++ b/src/main/java/com/zy/crm/system/entity/AppVersion.java
@@ -0,0 +1,86 @@
+package com.zy.crm.system.entity;
+
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.enums.IdType;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@TableName("asr_app_version")
+public class AppVersion implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value= "")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 鐗堟湰鍙�
+     */
+    @ApiModelProperty(value= "鐗堟湰鍙�")
+    private String version;
+
+    /**
+     * app璺緞
+     */
+    @ApiModelProperty(value= "app璺緞")
+    private String path;
+
+    /**
+     * 鏄惁涓烘渶鏂扮増鏈� 0: 涓嶆槸  1: 鏄�  
+     */
+    @ApiModelProperty(value= "鏄惁涓烘渶鏂扮増鏈� 0: 鍚�  1: 鏄�  ")
+    private Integer latest;
+
+    /**
+     * app绫诲瀷 0: pad  1: 鐢佃  
+     */
+    @ApiModelProperty(value= "app绫诲瀷 0: pda  1: lcd  ")
+    private Integer type;
+
+    public AppVersion() {}
+
+    public AppVersion(String version, String path, Integer latest, Integer type) {
+        this.version = version;
+        this.path = path;
+        this.latest = latest;
+        this.type = type;
+    }
+
+//    AppVersion appVersion = new AppVersion(
+//            null,    // 鐗堟湰鍙�
+//            null,    // app璺緞
+//            null,    // 鏄惁涓烘渶鏂扮増鏈�
+//            null    // app绫诲瀷
+//    );
+
+    public String getLatest$(){
+        if (null == this.latest){ return null; }
+        switch (this.latest){
+            case 0:
+                return "鍚�";
+            case 1:
+                return "鏄�";
+            default:
+                return String.valueOf(this.latest);
+        }
+    }
+
+    public String getType$(){
+        if (null == this.type){ return null; }
+        switch (this.type){
+            case 0:
+                return "pda";
+            case 1:
+                return "lcd";
+            default:
+                return String.valueOf(this.type);
+        }
+    }
+
+
+}
diff --git a/src/main/java/com/zy/crm/system/mapper/AppVersionMapper.java b/src/main/java/com/zy/crm/system/mapper/AppVersionMapper.java
new file mode 100644
index 0000000..53132d7
--- /dev/null
+++ b/src/main/java/com/zy/crm/system/mapper/AppVersionMapper.java
@@ -0,0 +1,16 @@
+package com.zy.crm.system.mapper;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.zy.crm.system.entity.AppVersion;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface AppVersionMapper extends BaseMapper<AppVersion> {
+
+    int updateLatest(int latest, int type);
+
+    AppVersion getLatestApp(Integer type);
+
+}
diff --git a/src/main/java/com/zy/crm/system/service/AppVersionService.java b/src/main/java/com/zy/crm/system/service/AppVersionService.java
new file mode 100644
index 0000000..21ac7c2
--- /dev/null
+++ b/src/main/java/com/zy/crm/system/service/AppVersionService.java
@@ -0,0 +1,12 @@
+package com.zy.crm.system.service;
+
+import com.baomidou.mybatisplus.service.IService;
+import com.zy.crm.system.entity.AppVersion;
+
+public interface AppVersionService extends IService<AppVersion> {
+
+    int updateLatest(int latest, int type);
+
+    AppVersion getLatestApp(Integer type);
+
+}
diff --git a/src/main/java/com/zy/crm/system/service/impl/AppVersionServiceImpl.java b/src/main/java/com/zy/crm/system/service/impl/AppVersionServiceImpl.java
new file mode 100644
index 0000000..eb6e706
--- /dev/null
+++ b/src/main/java/com/zy/crm/system/service/impl/AppVersionServiceImpl.java
@@ -0,0 +1,21 @@
+package com.zy.crm.system.service.impl;
+
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.zy.crm.system.entity.AppVersion;
+import com.zy.crm.system.mapper.AppVersionMapper;
+import com.zy.crm.system.service.AppVersionService;
+import org.springframework.stereotype.Service;
+
+@Service("appVersionService")
+public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements AppVersionService {
+
+    @Override
+    public int updateLatest(int latest, int type) {
+        return this.baseMapper.updateLatest(latest, type);
+    }
+
+    @Override
+    public AppVersion getLatestApp(Integer type) {
+        return this.baseMapper.getLatestApp(type);
+    }
+}
diff --git a/src/main/resources/appVersion/lock b/src/main/resources/appVersion/lock
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/main/resources/appVersion/lock
diff --git a/src/main/resources/mapper/AppVersionMapper.xml b/src/main/resources/mapper/AppVersionMapper.xml
new file mode 100644
index 0000000..8c26acd
--- /dev/null
+++ b/src/main/resources/mapper/AppVersionMapper.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zy.crm.system.mapper.AppVersionMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="com.zy.crm.system.entity.AppVersion">
+        <id column="id" property="id" />
+        <result column="version" property="version" />
+        <result column="path" property="path" />
+        <result column="latest" property="latest" />
+        <result column="type" property="type" />
+
+    </resultMap>
+
+    <select id="getLatestApp" resultMap="BaseResultMap">
+        select top 1 * from asr_app_version
+        where type = #{type} and latest = 1
+    </select>
+
+    <update id="updateLatest">
+        update asr_app_version
+        set latest = #{latest}
+        where 1 = 1
+        <if test="type != null || type != ''">
+            and type = #{type}
+        </if>
+    </update>
+
+</mapper>
diff --git a/src/main/webapp/static/js/appVersion/appVersion.js b/src/main/webapp/static/js/appVersion/appVersion.js
new file mode 100644
index 0000000..d036a0e
--- /dev/null
+++ b/src/main/webapp/static/js/appVersion/appVersion.js
@@ -0,0 +1,294 @@
+var pageCurr;
+layui.config({
+    base: baseUrl + "/static/layui/lay/modules/"
+}).use(['table','laydate', 'form', 'admin','upload'], function(){
+    var table = layui.table;
+    var $ = layui.jquery;
+    var layer = layui.layer;
+    var layDate = layui.laydate;
+    var form = layui.form;
+    var admin = layui.admin;
+    var upload = layui.upload;
+
+    // 鏁版嵁娓叉煋
+    tableIns = table.render({
+        elem: '#appVersion',
+        headers: {token: localStorage.getItem('token')},
+        url: baseUrl+'/appVersion/list/auth',
+        page: true,
+        limit: 15,
+        limits: [15, 30, 50, 100, 200, 500],
+        toolbar: '#toolbar',
+        cellMinWidth: 50,
+        height: 'full-120',
+        cols: [[
+            {type: 'checkbox'}
+            ,{field: 'id', align: 'center',title: ''}
+            ,{field: 'version', align: 'center',title: '鐗堟湰鍙�'}
+            ,{field: 'path', align: 'center',title: 'app璺緞'}
+            ,{field: 'latest$', align: 'center',title: '鏄惁涓烘渶鏂扮増鏈�', templet:function (d){
+                if(d.latest == 0){
+                    return '<span class="layui-badge layui-bg-gray">鍚�</span>';
+                }else{
+                    return '<span class="layui-badge layui-bg-green">鏄�</span>'
+                }
+                }}
+            ,{field: 'type$', align: 'center',title: 'app绫诲瀷'}
+
+            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:400}
+        ]],
+        request: {
+            pageName: 'curr',
+            pageSize: 'limit'
+        },
+        parseData: function (res) {
+            return {
+                'code': res.code,
+                'msg': res.msg,
+                'count': res.data.total,
+                'data': res.data.records
+            }
+        },
+        response: {
+            statusCode: 200
+        },
+        done: function(res, curr, count) {
+            if (res.code === 403) {
+                top.location.href = baseUrl+"/";
+            }
+            pageCurr=curr;
+            limit();
+        }
+    });
+
+    // 鐩戝惉鎺掑簭浜嬩欢
+    table.on('sort(appVersion)', function (obj) {
+        var searchData = {};
+        $.each($('#search-box [name]').serializeArray(), function() {
+            searchData[this.name] = this.value;
+        });
+        searchData['orderByField'] = obj.field;
+        searchData['orderByType'] = obj.type;
+        tableIns.reload({
+            where: searchData,
+            page: {curr: 1}
+        });
+    });
+
+    // 鐩戝惉澶村伐鍏锋爮浜嬩欢
+    table.on('toolbar(appVersion)', function (obj) {
+        var checkStatus = table.checkStatus(obj.config.id).data;
+        switch(obj.event) {
+            case 'addData':
+                showEditModel();
+                break;
+            case 'deleteData':
+                if (checkStatus.length === 0) {
+                    layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+                    return;
+                }
+                del(checkStatus.map(function (d) {
+                    return d.id;
+                }));
+                break;
+            case 'exportData':
+                admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+                    var titles=[];
+                    var fields=[];
+                    obj.config.cols[0].map(function (col) {
+                        if (col.type === 'normal' && col.hide === false && col.toolbar == null) {
+                            titles.push(col.title);
+                            fields.push(col.field);
+                        }
+                    });
+                    var exportData = {};
+                    $.each($('#search-box [name]').serializeArray(), function() {
+                        exportData[this.name] = this.value;
+                    });
+                    var param = {
+                        'appVersion': exportData,
+                        'fields': fields
+                    };
+                    $.ajax({
+                        url: baseUrl+"/appVersion/export/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: JSON.stringify(param),
+                        dataType:'json',
+                        contentType:'application/json;charset=UTF-8',
+                        method: 'POST',
+                        success: function (res) {
+                            layer.closeAll();
+                            if (res.code === 200) {
+                                table.exportFile(titles,res.data,'xls');
+                            } else if (res.code === 403) {
+                                top.location.href = baseUrl+"/";
+                            } else {
+                                layer.msg(res.msg, {icon: 2})
+                            }
+                        }
+                    });
+                });
+                break;
+        }
+    });
+
+    // 鐩戝惉琛屽伐鍏蜂簨浠�
+    table.on('tool(appVersion)', function(obj){
+        var data = obj.data;
+        switch (obj.event) {
+            case 'edit':
+                showEditModel(data);
+                break;
+            case "del":
+                del([data.id]);
+                break;
+            case "upload":
+                $("#appFile").click()
+
+                $("#uploadFile").on("change",(evt) => {
+                    var files = evt.target.files;
+                    let formData = new FormData($("#uploadFile")[0]);
+                    formData.append("id", data.id);
+                    $.ajax({
+                        url: baseUrl+"/appVersion/uploadApp/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: formData,
+                        method: 'POST',
+                        cache: false,
+                        processData: false,
+                        contentType: false,
+                        success: function (res) {
+                            if (res.code == 200) {
+                                layer.msg('涓婁紶鎴愬姛',{time:1000},() => {
+                                    parent.location.reload()
+                                })
+                            }else{
+                                layer.msg(res.msg,{time:1000},() => {
+                                    parent.location.reload()
+                                })
+                            }
+                        }
+                    })
+                })
+                break;
+            case "download":
+                if (data.path == "" || data.path == null) {
+                    layer.msg('璇峰厛涓婁紶app鏂囦欢',{time:1000},() => {
+                        parent.location.reload()
+                    })
+                }else{
+                    window.open(baseUrl + "/appVersion/downloadApp/" + data.path);
+                }
+                break;
+        }
+    });
+
+    /* 寮圭獥 - 鏂板銆佷慨鏀� */
+    function showEditModel(mData) {
+        admin.open({
+            type: 1,
+            area: '600px',
+            title: (mData ? '淇敼' : '娣诲姞') + '璁㈠崟鐘舵��',
+            content: $('#editDialog').html(),
+            success: function (layero, dIndex) {
+                layDateRender(mData);
+                form.val('detail', mData);
+                form.on('submit(editSubmit)', function (data) {
+                    var loadIndex = layer.load(2);
+                    $.ajax({
+                        url: baseUrl+"/appVersion/"+(mData?'update':'add')+"/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: data.field,
+                        method: 'POST',
+                        success: function (res) {
+                            layer.close(loadIndex);
+                            if (res.code === 200){
+                                layer.close(dIndex);
+                                layer.msg(res.msg, {icon: 1});
+                                tableReload();
+                            } else if (res.code === 403){
+                                top.location.href = baseUrl+"/";
+                            }else {
+                                layer.msg(res.msg, {icon: 2});
+                            }
+                        }
+                    })
+                    return false;
+                });
+                $(layero).children('.layui-layer-content').css('overflow', 'visible');
+                layui.form.render('select');
+            }
+        });
+    }
+
+    /* 鍒犻櫎 */
+    function del(ids) {
+        layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', {
+            skin: 'layui-layer-admin',
+            shade: .1
+        }, function (i) {
+            layer.close(i);
+            var loadIndex = layer.load(2);
+            $.ajax({
+                url: baseUrl+"/appVersion/delete/auth",
+                headers: {'token': localStorage.getItem('token')},
+                data: {ids: ids},
+                method: 'POST',
+                success: function (res) {
+                    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});
+                    }
+                }
+            })
+        });
+    }
+
+    // 鎼滅储
+    form.on('submit(search)', function (data) {
+        pageCurr = 1;
+        tableReload(false);
+    });
+
+    // 閲嶇疆
+    form.on('submit(reset)', function (data) {
+        pageCurr = 1;
+        clearFormVal($('#search-box'));
+        tableReload(false);
+    });
+
+    // 鏃堕棿閫夋嫨鍣�
+    function layDateRender(data) {
+        setTimeout(function () {
+            layDate.render({
+                elem: '.layui-laydate-range'
+                ,type: 'datetime'
+                ,range: true
+            });
+
+        }, 300);
+    }
+    layDateRender();
+
+});
+
+// 鍏抽棴鍔ㄤ綔
+$(document).on('click','#data-detail-close', function () {
+    parent.layer.closeAll();
+});
+
+function tableReload(child) {
+    var searchData = {};
+    $.each($('#search-box [name]').serializeArray(), function() {
+        searchData[this.name] = this.value;
+    });
+    tableIns.reload({
+        where: searchData,
+        page: {curr: pageCurr}
+    });
+}
diff --git a/src/main/webapp/views/appVersion/appVersion.html b/src/main/webapp/views/appVersion/appVersion.html
new file mode 100644
index 0000000..e839f80
--- /dev/null
+++ b/src/main/webapp/views/appVersion/appVersion.html
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title></title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
+    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
+</head>
+<body>
+
+<div class="layui-fluid">
+    <div class="layui-card">
+        <div class="layui-card-body">
+            <div class="layui-form toolbar" id="search-box">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <div class="layui-input-inline">
+                            <input class="layui-input" type="text" name="id" placeholder="缂栧彿" autocomplete="off">
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <div class="layui-input-inline">
+                            <input class="layui-input" type="text" name="condition" placeholder="璇疯緭鍏�" autocomplete="off">
+                        </div>
+                    </div>
+                    <div class="layui-inline">&emsp;
+                        <button class="layui-btn icon-btn" lay-filter="search" lay-submit>
+                            <i class="layui-icon">&#xe615;</i>鎼滅储
+                        </button>
+                        <button class="layui-btn icon-btn" lay-filter="reset" lay-submit>
+                            <i class="layui-icon">&#xe666;</i>閲嶇疆
+                        </button>
+                    </div>
+                </div>
+            </div>
+            <table class="layui-hide" id="appVersion" lay-filter="appVersion"></table>
+        </div>
+    </div>
+</div>
+
+<form id="uploadFile" enctype="multipart/form-data" style="display: none;" >
+    <input type="file" name="file" id="appFile">
+    <input type="button" value="涓婁紶"/>
+</form>
+
+<script type="text/html" id="toolbar">
+    <div class="layui-btn-container">
+        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">鏂板</button>
+        <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">鍒犻櫎</button>
+    </div>
+</script>
+
+<script type="text/html" id="operate">
+    <a class="layui-btn layui-btn-xs btn-edit" lay-event="upload">涓婁紶APP</a>
+    <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="download">涓嬭浇APP</a>
+    <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">淇敼</a>
+    <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">鍒犻櫎</a>
+</script>
+
+<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
+<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/appVersion/appVersion.js" charset="utf-8"></script>
+</body>
+<!-- 琛ㄥ崟寮圭獥 -->
+<script type="text/html" id="editDialog">
+    <form id="detail" lay-filter="detail" class="layui-form admin-form model-form" >
+        <input name="id" type="hidden">
+        <div class="layui-row">
+            <div class="layui-col-md12">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">鐗堟湰鍙�: </label>
+                    <div class="layui-input-block">
+                        <input class="layui-input" name="version" placeholder="璇疯緭鍏ョ増鏈彿">
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">鏄惁涓烘渶鏂扮増鏈�: </label>
+                    <div class="layui-input-block">
+                        <select name="latest">
+                            <option value="">璇烽�夋嫨鏄惁涓烘渶鏂扮増鏈�</option>
+                            <option value="0">鍚�</option>
+                            <option value="1">鏄�</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">app绫诲瀷: </label>
+                    <div class="layui-input-block">
+                        <select name="type">
+                            <option value="">璇烽�夋嫨app绫诲瀷</option>
+                            <option value="0">pda</option>
+                            <option value="1">lcd</option>
+                        </select>
+                    </div>
+                </div>
+
+            </div>
+        </div>
+        <hr class="layui-bg-gray">
+        <div class="layui-form-item text-right">
+            <button class="layui-btn" lay-filter="editSubmit" lay-submit="">淇濆瓨</button>
+            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button>
+        </div>
+    </form>
+</script>
+</html>
+

--
Gitblit v1.9.1