| New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-aiDependency" lay-title="产品升级策略管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="aiDependency-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="aiDependencyTable" lay-data="{id: 'aiDependencyTable'}"></table> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | | height: auto; |
| | | white-space: nowrap; /*文本不会换行,在同一行显示*/ |
| | | overflow: hidden; /*超出隐藏*/ |
| | | text-overflow: ellipsis; /*省略号显示*/ |
| | | } |
| | | .layui-table img{ |
| | | max-width:100px |
| | | } |
| | | ::-webkit-scrollbar { |
| | | height: 20px !important; |
| | | background-color: #f4f4f4; |
| | | } |
| | | </style> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!--<script type="text/html" id="aiDependencyToolbar">--> |
| | | <!-- <div class="layui-btn-container">--> |
| | | <!-- <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain" shiro:hasPermission="companyList:add" lay-event="aiDependencyAdd">新增</button>--> |
| | | <!-- </div>--> |
| | | <!--</script>--> |
| | | |
| | | <script type="text/html" id="aiDependencyOption"> |
| | | {{# if(d.state == 0){ }} |
| | | <button class="layui-btn layui-btn-sm layui-btn-success" type="button" shiro:hasPermission="aiDependencyList:view" lay-event="aiDependencyInfoAgreeEvent">同意</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-danger" type="button" shiro:hasPermission="aiDependencyList:view" lay-event="aiDependencyInfoDisagreeEvent">拒绝</button> |
| | | {{# } }} |
| | | {{# if(d.state == 1){ }} |
| | | <button class="layui-btn layui-btn-sm layui-btn-warm" type="button" shiro:hasPermission="aiDependencyList:view" lay-event="aiDependencyInfoUnbindEvent">解绑</button> |
| | | {{# } }} |
| | | </script> |
| | | |
| | | |
| | | <style> |
| | | .layui-form-onswitch { |
| | | background-color: #5FB878 !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-aiDependency'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'orderNum', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initaiDependencyTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(aiDependencyTable)', function (obj) { |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'aiDependencyInfoEvent') { |
| | | if (data.state == 1){ |
| | | febs.alert.warn('请先禁用这行数据'); |
| | | return; |
| | | } |
| | | febs.modal.open('编辑','modules/ai/aiDependency/info/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-aiDependency-Info').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } else if (layEvent === 'aiDependencyInfoAgreeEvent') { |
| | | febs.modal.confirm('删除', '确认删除?', function () { |
| | | memberRoleDeleteEvent(data.id); |
| | | }); |
| | | // 同意操作 |
| | | febs.modal.confirm('审核','确定要同意该申请吗?', function () { |
| | | handleApplyAction(data.id, 'agree'); |
| | | }); |
| | | } else if (layEvent === 'aiDependencyInfoDisagreeEvent') { |
| | | // 拒绝操作 |
| | | febs.modal.confirm('审核','确定要拒绝该申请吗?', function () { |
| | | handleApplyAction(data.id, 'disagree'); |
| | | }); |
| | | } else if (layEvent === 'aiDependencyInfoUnbindEvent') { |
| | | // 解绑操作 |
| | | febs.modal.confirm('审核','确定要解除绑定吗?此操作不可撤销!', function () { |
| | | handleApplyAction(data.id, 'unbind'); |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | // 处理申请操作的通用方法 |
| | | function handleApplyAction(id, action) { |
| | | var actionName = { 'agree': '同意', 'disagree': '拒绝', 'unbind': '解绑' }[action]; |
| | | var url = ctx + 'admin/aiDependency/' + action; |
| | | |
| | | $.ajax({ |
| | | url: url, |
| | | type: 'post', |
| | | data: JSON.stringify({id: id}), |
| | | dataType: 'json', |
| | | headers: {'Content-Type': 'application/json;charset=utf-8'}, |
| | | success: function(res) { |
| | | if (res.code === 200) { |
| | | febs.alert.success(actionName + '成功'); |
| | | // 刷新表格数据 |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}}); |
| | | } else { |
| | | febs.alert.error(res.msg || actionName + '失败'); |
| | | } |
| | | }, |
| | | error: function() { |
| | | febs.alert.error('服务器错误,请稍后重试'); |
| | | }, |
| | | complete: function() { |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function initaiDependencyTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'aiDependencyTable', |
| | | url: ctx + 'admin/aiDependency/list', |
| | | toolbar:"#aiDependencyToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#aiDependencyOption', minWidth: 200, align: 'center'}, |
| | | {field: 'id', title: 'ID', minWidth: 100,align:'center'}, |
| | | {field: 'name', title: '昵称', minWidth: 100,align:'center'}, |
| | | {field: 'realName', title: '姓名', minWidth: 100,align:'center'}, |
| | | {field: 'companyName', title: '公司', minWidth: 100,align:'center'}, |
| | | {field: 'createdTime', title: '时间', minWidth: 100,align:'center'}, |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | tableIns.reload({where: params, page: {curr: 1}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |