123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- {{include "com/inc.html"}}
- <!-- Main Header -->
- {{include "com/header.html"}}
- <!-- Left side column. 权限菜单 -->
- {{include "com/menu.html"}}
- <div class="content-wrapper">
- <section class="content-header">
- <h1>
- <small></small>
- </h1>
- <ol class="breadcrumb">
- <li><a href="/front/project"><i class="fa fa-dashboard"></i> 项目列表</a></li>
- <li><a href="#"><i class="fa fa-dashboard"></i> 项目清洗</a></li>
- </ol>
- </section>
- <!-- Main content -->
- <section class="content">
- <div class="row">
- <div class="col-xs-12">
- <div class="box">
- <div class="box-body">
- <div class="form-horizontal">
- <div class="box-body margin">
- <h4><i class="glyphicon glyphicon-exclamation-sign" style="margin-right: 6px"></i>数据情况</h4>
- <div class="form-group" style="margin-left: 15px">
- <span class="form-inline panel-body">分发总量/数据总量(条):
- <input type="text" class="form-control" readonly value="{{.T.allGiveDataNum}}/{{.T.allDataNum}}">
- </span>
- </div>
- <div class="form-group" style="margin-left: 10px">
- <div class="col-xs-3" style="width: auto">
- <label class="form-inline">数据总量:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.allDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">已分发:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.allGiveDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">待分发:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.allNoGiveDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">已标注:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.allIsTagDataNum}}"></label>
- </div>
- <div class="col-xs-5 form-group">
- <label class="form-inline"> 操作:
- <input type="button" class="btn btn-sm btn-primary" onclick="" value="标注">
- <input type="button" class="btn btn-sm btn-primary" onclick="dispatchTask('all')" value="分发">
- <input type="button" class="btn btn-sm btn-primary" value="质检">
- <input type="button" class="btn btn-sm btn-primary" value="质检结果">
- </label>
- </div>
- </div>
- <div class="form-group" style="margin-left: 10px">
- <div class="col-xs-6" style="width: auto">
- <label class="form-inline"> 达标:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.okAllDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">已分发:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.okIsGiveDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">待分发:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.okNotGiveDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">已标注:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.okIsTagDataNum}}"></label>
- </div>
- <div class="col-xs-5 form-group">
- <label class="form-inline">操作:
- <input type="button" class="btn btn-sm btn-primary" onclick="" value="标注">
- <input type="button" class="btn btn-sm btn-primary" onclick="dispatchTask('notag')" value="分发">
- <input type="button" class="btn btn-sm btn-primary" value="质检">
- <input type="button" class="btn btn-sm btn-primary" value="质检结果">
- </label>
- </div>
- </div>
- <div class="form-group" style="margin-left: 10px">
- <div class="col-xs-6" style="width: auto">
- <label class="form-inline"> 未达标:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.IsNoOkAllDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">已分发:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.IsNoOkIsGiveDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">待分发:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.IsNotOkNotGiveDataNum}}"></label>
- <label class="form-inline" style="margin-left: 5px">已标注:
- <input type="text" class="form-control" style="width: 80px" readonly value="{{.T.IsNotOkIsTagDataNum}}"></label>
- </div>
- <div class="col-xs-5 form-group">
- <label class="form-inline">操作:
- <input type="button" class="btn btn-sm btn-primary" onclick="" value="标注">
- <input type="button" class="btn btn-sm btn-primary" onclick="dispatchTask('tag')" value="分发">
- <input type="button" class="btn btn-sm btn-primary" value="质检">
- <input type="button" class="btn btn-sm btn-primary" value="质检结果">
- </label>
- </div>
- </div>
- </div>
- </div>
- <div id="status-div" class="col-xs-1" style="width: auto;float:right;">
- <select class="form-control selectpicker" id="pushModelSelect">
- <option value=-1>全部</option>
- <option value=0>开启</option>
- <option value=1>关闭</option>
- </select>
- </div>
- <hr>
- <div class="form-horizontal">
- <div class="box-body margin">
- <h3><i class="glyphicon glyphicon-tasks" style="margin-right: 6px"></i>数据清洗任务列表
- </h3>
- <table id="dataTable" class="table table-bordered table-hover">
- <thead>
- <tr>
- <th>序号</th>
- <th>项目名称</th>
- <th>用户组名称</th>
- <th>负责人</th>
- <th>分发数据量</th>
- <th>任务状态</th>
- <th>完成进度</th>
- <th>任务时间</th>
- <th>操作</th>
- </tr>
- </thead>
- </table>
- </div>
- </div>
- </div>
- <!-- /.box-body -->
- </div>
- <!-- /.box -->
- </div>
- </div>
- </section>
- </div>
- <div class="modal fade" id="modal-create-task" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog" style="width: 60%">
- <div class="modal-content">
- <div class="modal-header">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <div class="edit-info">
- <span class="glyphicon glyphicon-tasks" aria-hidden="true"></span>
- <span class="h3">新建任务</span>
- </div>
- <div class="edit-form">
- <form id="modal-form-task" class="form-horizontal">
- <div class="modal-body modal-task">
- <div class="form-group margin-bottom" style="margin-left: 15px">
- <label class="control-label form-inline h4">待分发数据总量(条):
- <span id="modal-num">0</span>
- </label>
- </div>
- <hr>
- <div></div>
- <div id="TaskDiv">
- <div id="itemDiv" class="form-group" style="margin-left: 10px;display: none">
- <select id="group-select-clone"></select>
- <label class="control-label form-inline" style="margin-left: 20px">数据量(条):
- <input type="number" class="form-control"></label>
- </div>
- <div class="form-group group-item" style="margin-left: 10px;">
- <select class="selectpicker" id="group-select"></select>
- <label class="control-label form-inline" style="margin-left: 20px">数据量(条):
- <input type="number" class="form-control"></label>
- <input type="button" class="btn btn-info btn-sm" onclick="addTaskSelect()" value="新增">
- </div>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <input type="button" onclick="saveTask()" class="btn btn-primary" value="保存">
- <input type="button" onclick="cancelModel()" class="btn btn-default" value="取消">
- </div>
- </div>
- </div><!-- /.modal -->
- </div>
- {{include "com/footer.html"}}
- <script>
- menuActive("project");
- let projectid = {{ .T.s_projectid }}
- let groupList = []
- let tableData = []
- let stype = "" // 分发类型:所有数据:all 达标数据:notag 未达标:tag
- $(function () {
- ttable = $('#dataTable').dataTable({
- "paging": true,
- "lengthChange": false,
- "searching": true,
- "ordering": false,
- "info": true,
- "autoWidth": false,
- "language": {
- "url": "/dist/js/dataTables.chinese.lang"
- },
- "fnDrawCallback": function () {
- $("ul.pagination").prepend(" 转到第 <input type='text' id='changePage' style='width:20px;'> 页 <a type='text' href='javascript:void(0);' id='dataTable-btn' style='text-align:center'>GO</a>");
- $('#dataTable-btn').click(function (e) {
- var redirectpage = 0
- if ($("#changePage").val() && $("#changePage").val() > 0) {
- var redirectpage = $("#changePage").val() - 1;
- }
- ttable.page(redirectpage).draw(false);
- });
- this.api().column(0).nodes().each(function (cell, i) {
- cell.innerHTML = i + 1;
- });
- },
- "columns": [
- {"data": null, width: "1%"},
- {"data": "s_projectname", width: "5%"},
- {"data": "s_groupname", width: "4%"},
- {"data": "s_personname", width: "4%"},
- {"data": "i_givenum", width: "4%"},
- {"data": "s_status", width: "4%"},
- {"data": "s_progress", width: "4%"},
- {
- "data": "_id", width: "4%", render: function (val, a, row) {
- let str = ""
- if (row['i_starttime'] === undefined) {
- str = "未开始"
- }else if (row['i_starttime'] && row['i_completetime'] === undefined) {
- let dt = new Date()
- dt.setTime(parseInt(row['i_starttime']) * 1000);
- str = dt.format("yyyy-MM-dd hh:mm:ss") + " - 未结束"
- }else {
- let dt = new Date()
- let ds = new Date()
- dt.setTime(parseInt(row['i_starttime']) * 1000);
- ds.setTime(parseInt(row["i_completetime"]) * 1000)
- str = dt.format("yyyy-MM-dd hh:mm:ss") + " - " + ds.format("yyyy-MM-dd hh:mm:ss")
- }
- return str
- }
- },
- {
- "data": "_id", width: "11%", render: function (val, a, row, pos) {
- tmp = '<div>' +
- '<a class="btn btn-sm btn-primary" href="/front/user/task/list?grouptaskid=' + val + '&s_sourceinfo='+row.s_sourceinfo+'">查看</a> ' +
- '<a class="btn btn-sm btn-warning" onclick="retrieveTask(\''+val+'\',\''+row.s_sourceinfo+'\',\''+row.s_status+'\')">收回</a> ' +
- '<a class="btn btn-sm btn-info">质检</a> ' +
- '<a class="btn btn-sm btn-info" onclick="repulseTask(\''+val+'\',\''+row.s_sourceinfo+'\',\''+row.s_status+'\')">打回</a> ' +
- '<a class="btn btn-sm btn-default" onclick="closeTask(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">关闭</a> ' +
- '</div>';
- return tmp
- }
- }
- ],
- "initComplete": function () {
- $("#dataTable_filter").append($('#status-div'))
- }
- });
- $.ajax({
- url: "/front/project/task/list",
- type: "POST",
- data: {"pid": projectid},
- success: function (r) {
- if (r.data.length > 0) {
- console.log(r.data)
- ttable.fnClearTable();
- ttable.fnAddData(r.data);
- }
- }
- })
- $.ajax({
- url: "/front/group/list",
- type: "POST",
- data: {},
- success: function (r) {
- if (r.rep) {
- groupList = r.data
- console.log(groupList)
- }
- }
- })
- });
- function dispatchTask(val) {
- console.log(val)
- stype = val
- if (stype === "all") {
- $('#modal-num').val({{.T.allGiveDataNum}})
- }else if (stype === "notag") {
- $('#modal-num').val({{.T.okNotGiveDataNum}})
- }else {
- $('#modal-num').val({{.T.IsNotOkNotGiveDataNum}})
- }
- $('#modal-create-task').modal('show')
- for (var i in groupList) {
- var opt = document.createElement('option');
- opt.innerText = groupList[i]["s_name"];
- opt.value = groupList[i]["_id"];
- $('#group-select')[0].appendChild(opt)
- }
- $("#group-select").selectpicker("refresh");
- }
- function cancelModel() {
- $('#TaskDiv .group-item.clone-template').remove()
- $("#modal-create-task").modal('hide')
- document.getElementById("modal-form-task").reset();
- }
- function addTaskSelect() {
- let tNode = $('#itemDiv').clone().addClass('group-item').addClass('clone-template').show()
- let st = $(tNode).find('select')
- $(st).addClass('selectpicker')
- for (var i in groupList) {
- var opt = document.createElement('option');
- opt.innerText = groupList[i]["s_name"];
- opt.value = groupList[i]["_id"];
- $(st)[0].appendChild(opt)
- }
- $(st).selectpicker("refresh");
- $('#TaskDiv').append($(tNode))
- }
- function saveTask() {
- let arr = []
- $('.group-item').each(function () {
- var selectId = $(this).find("select option:checked").val()
- var inputVal = $(this).find("input").val()
- let tmp = {}
- for (let v in groupList) {
- if (groupList[v]["_id"] === selectId) {
- tmp["s_groupid"] = selectId
- tmp["s_groupname"] = groupList[v]["s_name"]
- tmp["s_personname"] = groupList[v]["s_personname"]
- tmp["i_givenum"] = inputVal
- break
- }
- }
- arr.push(tmp)
- })
- console.log(arr)
- $.ajax({
- url: "/front/project/task/save",
- type: 'POST',
- data: {"s_projectid": projectid, "s_group": JSON.stringify(arr), "s_type": stype},
- success: function (r) {
- if (r.success) {
- location.reload()
- } else {
- showTip(r.msg);
- }
- }
- })
- }
- // 收回
- function retrieveTask(id, sourceinfo, status,givenum) {
- if (status === "未开始" || status === "进行中") {
- $.ajax({
- url: "/front/project/task/retrieve",
- type: 'POST',
- data: { "s_sourceinfo": sourceinfo, "taskid": id, "s_status": status,"i_givenum" :givenum},
- success: function (r) {
- if (r.success) {
- location.reload()
- } else {
- showTip(r.msg);
- }
- }
- })
- }else {
- showTip("操作不允许")
- }
- }
- // 打回
- function repulseTask(id, sourceinfo,status) {
- if (status === "已完成") {
- $.ajax({
- url: "/front/project/task/repulse",
- type: 'POST',
- data: {"s_sourceinfo": sourceinfo, "taskid": id, "s_tatus": status},
- success: function (r) {
- if (r.success) {
- location.reload()
- } else {
- showTip(r.msg);
- }
- }
- })
- }else {
- showTip("操作不允许")
- }
- }
- function closeTask(id, sourceinfo,status) {
- if (status === "未开始") {
- showConfirm("确认要关闭当前任务吗?", function () {
- $.ajax({
- url: "/front/project/task/close",
- type: 'POST',
- data: {"s_sourceinfo": sourceinfo, "s_status": status, "taskid": id},
- success: function (r) {
- if (r.success) {
- location.reload()
- } else {
- showTip(r.msg);
- }
- }
- })
- })
- }else {
- showTip("操作不允许")
- }
- }
- </script>
|