From d7fbde6bbd576a17b16aaad87c8ab23e1ea42d09 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 08 九月 2023 14:10:41 +0800
Subject: [PATCH] #
---
src/main/webapp/views/companyPost/companyPost_view.html | 70 +++++++++++
src/main/webapp/views/home/dashboard.html | 19 +++
src/main/webapp/static/js/companyPost/companyPost_view.js | 262 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 350 insertions(+), 1 deletions(-)
diff --git a/src/main/webapp/static/js/companyPost/companyPost_view.js b/src/main/webapp/static/js/companyPost/companyPost_view.js
new file mode 100644
index 0000000..aa6ff4d
--- /dev/null
+++ b/src/main/webapp/static/js/companyPost/companyPost_view.js
@@ -0,0 +1,262 @@
+var pageCurr;
+layui.config({
+ base: baseUrl + "/static/layui/lay/modules/"
+}).use(['table', 'laydate', 'form', 'admin', 'tree', '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;
+ var dropdown = layui.dropdown;
+ var tree = layui.tree;
+
+ // 鏁版嵁娓叉煋
+ tableIns = table.render({
+ elem: '#companyPost',
+ headers: {token: localStorage.getItem('token')},
+ url: baseUrl + '/companyPost/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: '#ID'}
+ , {field: 'title', align: 'center', title: '鏍囬'}
+ , {field: 'content', align: 'center', title: '鍐呭'}
+ , {field: 'createTime$', align: 'center', title: '鍒涘缓鏃堕棿'}
+ , {field: 'updateTime$', align: 'center', title: '鏇存柊鏃堕棿'}
+
+ // , {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(companyPost)', 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(companyPost)', 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 = {
+ 'companyPost': exportData,
+ 'fields': fields
+ };
+ $.ajax({
+ url: baseUrl + "/companyPost/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(companyPost)', function (obj) {
+ var data = obj.data;
+ switch (obj.event) {
+ case 'edit':
+ showEditModel(data);
+ break;
+ case "del":
+ del([data.id]);
+ break;
+ }
+ });
+
+ /* 寮圭獥 - 鏂板銆佷慨鏀� */
+ function showEditModel(mData) {
+ admin.open({
+ type: 1,
+ area: '800px',
+ 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 + "/companyPost/" + (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 + "/companyPost/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
+ });
+ layDate.render({
+ elem: '#createTime\\$',
+ type: 'datetime',
+ value: data !== undefined ? data['createTime\\$'] : null
+ });
+ layDate.render({
+ elem: '#updateTime\\$',
+ type: 'datetime',
+ value: data !== undefined ? data['updateTime\\$'] : null
+ });
+
+ }, 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/companyPost/companyPost_view.html b/src/main/webapp/views/companyPost/companyPost_view.html
new file mode 100644
index 0000000..ebb7ac7
--- /dev/null
+++ b/src/main/webapp/views/companyPost/companyPost_view.html
@@ -0,0 +1,70 @@
+<!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" style="width: 300px">
+ <div class="layui-input-inline">
+ <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="璧峰鏃堕棿 - 缁堟鏃堕棿" autocomplete="off" style="width: 300px">
+ </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"> 
+ <button class="layui-btn icon-btn" lay-filter="search" lay-submit>
+ <i class="layui-icon"></i>鎼滅储
+ </button>
+ <button class="layui-btn icon-btn" lay-filter="reset" lay-submit>
+ <i class="layui-icon"></i>閲嶇疆
+ </button>
+ </div>
+ </div>
+ </div>
+ <table class="layui-hide" id="companyPost" lay-filter="companyPost"></table>
+ </div>
+ </div>
+</div>
+
+<!--<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>-->
+<!-- <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right">瀵煎嚭</button>-->
+<!-- </div>-->
+<!--</script>-->
+
+<script type="text/html" id="operate">
+ <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/companyPost/companyPost_view.js" charset="utf-8"></script>
+</body>
+</html>
+
diff --git a/src/main/webapp/views/home/dashboard.html b/src/main/webapp/views/home/dashboard.html
index f5aeb2f..3cd2869 100644
--- a/src/main/webapp/views/home/dashboard.html
+++ b/src/main/webapp/views/home/dashboard.html
@@ -129,7 +129,10 @@
<div class="layui-col-xs12 layui-col-md4">
<div class="layui-card" style="height: 403px;overflow: hidden;">
- <div class="layui-card-header">鍏徃鍏憡</div>
+ <div class="layui-card-header" style="display: flex;justify-content: space-between;">
+ <div>鍏徃鍏憡</div>
+ <div><a href="#" id="openCompanyPost">鏌ョ湅鏇村</a></div>
+ </div>
<div class="layui-card-body" id="companyPostId">
</div>
</div>
@@ -448,6 +451,20 @@
});
});
+ $("#openCompanyPost").on("click", () => {
+ layer.open({
+ type: 2,
+ title: '鍏憡',
+ maxmin: true,
+ area: [top.detailWidth, top.detailHeight],
+ shadeClose: true,
+ content: '../companyPost/companyPost_view.html',
+ success: function(layero, index){
+
+ }
+ });
+ });
+
});
</script>
</body>
--
Gitblit v1.9.1