123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- {extend name='main'}
- {block name="button"}
- {if auth("contrast")}
- <button class="layui-btn layui-btn-sm " style="background-color: #DC2219 " onclick="getIds()" >去对比</button>
- {/if}
- {/block}
- {block name="content"}
- <div class="think-box-shadow">
- {include file='child_project/index_search'}
- <table class="layui-table margin-top-10">
- {notempty name='list'}
- <thead>
- <tr>
- <th class='list-table-check-td think-checkbox'>
- <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
- </th>
- <th class='text-left nowrap'>项目名称</th>
- <th class='text-left nowrap'>主项目</th>
- <th class='text-left nowrap'>建筑分类</th>
- <th class='text-left nowrap'>创建时间</th>
- <th class='text-center nowrap'></th>
- </tr>
- </thead>
- {/notempty}
- <tbody>
- {foreach $list as $key=>$vo}
- <tr>
- <td class='list-table-check-td think-checkbox'>
- {if $vo.url neq ''} <label><input class="list-check-box" name="ids" value='{$vo.id}' type='checkbox'></label>{/if}
- </td>
- <td class='text-left nowrap'>{$vo.project_name|default=''}</td>
- <td class='text-left nowrap'>{$vo.main_project_name|default='-'}</td>
- <td class='text-left nowrap'>{$vo.category_name|default=''}</td>
- <td class='text-left nowrap'>{$vo.create_at|format_datetime}</td>
- <td class='text-left nowrap'>
- {if auth("admin/child_project/import")}
- <a class='layui-btn layui-btn-normal layui-btn-sm dr' id="dr" style="background-color:#DC2219;margin-right: 10px;width: 65px " onclick="changename('{$vo.id}')">
- {if $vo.url eq ''}待导入{else}重新导入{/if}
- </a>
- {/if}
- {if auth("admin/child_project/edit")}
- <a data-dbclick class="layui-btn layui-btn-sm" style="background-color: #FFB822" data-title="编辑" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
- {/if}
- {if $vo.url neq '' && auth("admin/child_project/look")}
- <a data-dbclick class="layui-btn layui-btn-sm" style="background-color: #5AD729" data-title="查看" data-open='{:url("admin/child_project/look")}?id={$vo.id}'>查 看</a>
- {/if}
- {if $vo.url neq '' && auth("admin/child_project/down")}
- <a href="{$vo.url}" class="layui-btn layui-btn-sm" style="background-color:#29B2D7 " download data-title="下载" >下 载</a>
- {/if}
- {if auth("admin/child_project/remove")}
- <a class="layui-btn layui-btn-sm layui-btn-danger" style="background-color: #2944D7" data-confirm="确定要删除吗?" data-action="{:url('admin/child_project/remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
- {/if}
- </td>
- </tr>
- {/foreach}
- </tbody>
- </table>
- {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
- </div>
- <script>
- function getIds()
- {
- var id = document.getElementsByName('ids');
- var value = new Array();
- for (var i=0;i<id.length;i++){
- if (id[i].checked){
- value.push(id[i].value);
- }
- }
- if (value.length<1){
- layer.msg('请选择需要对比的数据');
- }else if (value.length<2){
- layer.msg('请选择至少两条数据');
- }else{
- $.form.href('{:url("admin/child_project/contrast")}?ids=' +value.toString());
- //window.location = '{:url("admin/main_project/contrast")}?ids=' +value.toString();
- }
- }
- var project_id = ''
- function changename(val){
- project_id = val
- }
- layui.use('upload', function(){
- var upload = layui.upload;
- //执行实例
- var uploadInst = upload.render({
- elem: '.dr' //绑定元素
- ,url: 'admin/api.plugs/upload'
- ,accept: 'file', //普通文件,
- before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
- console.log(obj)
- // layer.load(); //上传loading
- }
- ,done: function(res){
- if (res.uploaded == true){
- var value = {path:res.key,project_id:project_id,url:res.url}
- $.ajax({
- url:"/admin/child_project/import",
- type:'get',
- data:value
- ,success:function(result){
- console.log(result.code);
- if (result.code==1){
- layer.msg('上传成功',{time:2000,end:function () {
- location.reload();
- // $.form.href('{:url("admin/child_project/index")}');
- }});
- }else {
- layer.msg('上传失败',{icon: 5});
- }
- }
- });
- }else {
- layer.msg('上传失败',{icon: 5});
- }
- // layer.closeAll('loading'); //关闭loading
- }
- ,error: function(){
- layer.msg('上传失败');
- }
- });
- });
- </script>
- {/block}
|