| | |
| | | </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="aiDependencyToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain" shiro:hasPermission="aiDependencyList: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> |
| | | {{# } }} |
| | | <button class="layui-btn layui-btn-danger layui-btn-sm" type="button" shiro:hasPermission="aiDependencyList:add" lay-event="aiDependencyDeleteEvent">删除</button> |
| | | </script> |
| | | |
| | | |
| | |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } else if (layEvent === 'aiDependencyInfoAgreeEvent') { |
| | | } |
| | | if (layEvent === 'aiDependencyDeleteEvent') { |
| | | 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'); |
| | | aiDependencyDeleteEvent(data.id); |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | // 处理申请操作的通用方法 |
| | | 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 aiDependencyDeleteEvent(id) { |
| | | febs.get(ctx + 'admin/aiDependency/delete/' + id, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(aiDependencyTable)', function (obj) { |
| | | let data = obj.data, |
| | | layEvent = obj.event; |
| | | if(layEvent === 'aiDependencyAdd'){ |
| | | febs.modal.open('新增', 'modules/ai/aiDependency/add/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-aiDependency-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | function initaiDependencyTable() { |
| | | tableIns = febs.table.init({ |
| | |
| | | {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: 'productCategoryName', title: '分类', minWidth: 100,align:'center'}, |
| | | {field: 'prerequisiteProductName', title: '前置产品', minWidth: 100,align:'center'}, |
| | | {field: 'targetProductName', title: '目标产品', minWidth: 100,align:'center'}, |
| | | {field: 'requiredScore', title: '解锁分数', minWidth: 100,align:'center'}, |
| | | {field: 'createdTime', title: '时间', minWidth: 100,align:'center'}, |
| | | ]] |
| | | }); |