123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600 |
- {{include "com/inc.html"}}
- <!-- Main Header -->
- {{include "com/header.html"}}
- <!-- Left side column. 权限菜单 -->
- {{include "com/menu.html"}}
- <div class="content-wrapper" xmlns="http://www.w3.org/1999/html">
- <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>
- <hr>
- <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"> 操作:
- <a type="button" class="btn btn-sm btn-primary" href="/front/user/jymark/list?pid={{.T.s_projectid}}&stype=all">标注</a>
- <a type="button" class="btn btn-sm btn-primary" onclick="dispatchTask('all')">分发</a>
- <a type="button" class="btn btn-sm btn-primary" onclick="checkMethod('all')">质检</a>
- <a type="button" class="btn btn-sm btn-primary" onclick="checkAllSuc()">通过</a>
- </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">操作:
- <a type="button" class="btn btn-sm btn-primary" href="/front/user/jymark/list?pid={{.T.s_projectid}}&stype=notag">标注</a>
- <a type="button" class="btn btn-sm btn-primary" onclick="dispatchTask('notag')">分发</a>
- <a type="button" class="btn btn-sm btn-primary" onclick="checkMethod('notag')">质检</a>
- <a type="button" class="btn btn-sm btn-primary" onclick="checkSuc()">质检通过</a>
- </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">操作:
- <a type="button" class="btn btn-sm btn-primary" href="/front/user/jymark/list?pid={{.T.s_projectid}}&stype=tag">标注</a>
- <a type="button" class="btn btn-sm btn-primary" onclick="dispatchTask('tag')">分发</a>
- <a type="button" class="btn btn-sm btn-primary" onclick="checkMethod('tag')">质检</a>
- <!-- <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;">
- <label for="statusSelect">状态:
- <select class="form-control selectpicker" id="statusSelect">
- <option value="-1">全部</option>
- <option value="未开始">未开始</option>
- <option value="进行中">进行中</option>
- <option value="已完成">已完成</option>
- <option value="已关闭">已关闭</option>
- </select></label>
- </div>
- <div class="box-body margin">
- <h4><i class="glyphicon glyphicon-tasks" style="margin-right: 6px"></i>数据清洗任务列表</h4>
- <hr>
- <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>
- <!-- /.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 sourceinfo = {{ .T.s_sourceinfo }}
- let allNoGiveDataNum = {{.T.allNoGiveDataNum}}
- let okNotGiveDataNum = {{.T.okNotGiveDataNum}}
- let okIsTagDataNum = {{ .T.okIsTagDataNum }}
- let IsNoOkAllDataNum = {{ .T.IsNoOkAllDataNum }}
- let IsNotOkNotGiveDataNum = {{.T.IsNotOkNotGiveDataNum}}
- let IsNotOkIsTagDataNum = {{ .T.IsNotOkIsTagDataNum }}
- let okRealGiveNum = {{ .T.okRealGiveNum }}
- let groupList = []
- let tableData = []
- let stype = "" // 分发类型:所有数据:all 达标数据:notag 未达标:tag
- //展示loading框
- showLoading = function (text){
- if(text){
- $("#loadText").html(text)
- }
- $('#loadingModal').modal({backdrop: 'static', keyboard: false});
- }
- //隐藏掉loading框
- hideLoading = function (){
- $('#loadingModal').modal('hide');
- }
- $(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.api().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/group/user/task/list?pid='+projectid+'&grouptaskid='+val+'&s_groupid='+row.s_groupid+'&s_sourceinfo='+row.s_sourceinfo+'">查看</a> ' +
- '<a class="btn btn-sm btn-primary" onclick="retrieveTask(\''+val+'\',\''+row.s_sourceinfo+'\',\''+row.s_status+'\')">收回</a> ' +
- '<a class="btn btn-sm btn-primary" onclick="checkMethod1(\'' + row.s_projectid + '\',\'' + val + '\',\'' + row.s_sourceinfo + '\')">质检</a> ' +
- '<a class="btn btn-sm btn-primary" onclick="repulseTask(\''+val+'\',\''+row.s_sourceinfo+'\',\''+row.s_status+'\')">打回</a> ' +
- '<a class="btn btn-sm btn-primary" onclick="closeTask(\'' + val + '\',\''+row.s_sourceinfo+'\',\'' + row.s_status + '\')">关闭</a> ' +
- '</div>';
- return tmp
- }
- }
- ],
- "initComplete": function () {
- $("#dataTable_filter").append($('#status-div'))
- $("[type=search]").attr('placeholder', "用户组名称")
- },
- "fnServerParams": function (e) {
- e.s_status = $("#statusSelect option:selected").val()
- }
- });
- $.ajax({
- url: "/front/project/task/list",
- type: "POST",
- data: {"pid": projectid, "s_status": "-1"},
- success: function (r) {
- if (r.data.length > 0) {
- ttable.fnClearTable();
- ttable.fnAddData(r.data);
- }
- }
- })
- $.ajax({
- url: "/front/group/list",
- type: "POST",
- data: {},
- success: function (r) {
- if (r.rep) {
- groupList = r.data
- }
- }
- })
- $('#statusSelect').on('changed.bs.select', function () {
- $.ajax({
- url: "/front/project/task/list",
- type: "POST",
- data: {"pid": projectid, "s_status": $(this).val()},
- success: function (r) {
- if (r.data.length > 0) {
- ttable.fnClearTable();
- ttable.fnAddData(r.data);
- }else {
- ttable.fnClearTable();
- }
- }
- })
- })
- });
- function dispatchTask(val) {
- stype = val
- if (stype === "all") {
- if (okRealGiveNum === 0) {
- showTip("没有可分配的数据!")
- return
- }
- $('#modal-num').html(allNoGiveDataNum)
- }else if (stype === "notag") {
- if (okNotGiveDataNum === 0 || okNotGiveDataNum === okIsTagDataNum) {
- showTip("没有可分配的数据!")
- return
- }
- $('#modal-num').html(okNotGiveDataNum)
- }else {
- if (IsNotOkNotGiveDataNum === 0 || (IsNoOkAllDataNum === IsNotOkIsTagDataNum)) {
- showTip("没有可分配的数据!")
- return
- }
- $('#modal-num').html(IsNotOkNotGiveDataNum)
- }
- $('#modal-create-task').modal('show')
- if ($('#group-select option').length === 0) {
- 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 = []
- let valNum = 0
- let num = parseInt($('#modal-num').html())
- $('.group-item').each(function () {
- var selectId = $(this).find("select option:checked").val()
- var inputVal = $(this).find("input").val()
- valNum += parseInt(inputVal)
- if (inputVal === "" || valNum > num || inputVal === "0") {
- showTip("分发数量有问题")
- return
- }
- 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)
- })
- if (arr.length > 0) {
- 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, 3000);
- }
- }
- })
- }
- }
- // 收回
- function retrieveTask(id, sourceinfo, status, givenum) {
- if (status === "未开始" || status === "进行中") {
- showConfirm("确认要收回当前任务吗?", function () {
- $.ajax({
- url: "/front/project/task/retrieve",
- type: 'POST',
- data: { "s_sourceinfo": sourceinfo, "taskid": id, "i_givenum" :givenum},
- success: function (r) {
- if (r.success) {
- let msg = r.msg+"<br>"+"共收回"+r.count+"数据。"
- showTip(msg, 1500);
- location.reload()
- } else {
- showTip(r.msg);
- }
- }
- })
- })
- }else {
- showTip("操作不允许")
- }
- }
- // 打回
- function repulseTask(id, sourceinfo, status) {
- if (status === "已完成") {
- showConfirm("确认要打回当前任务吗?", function () {
- $.ajax({
- url: "/front/project/task/repulse",
- type: 'POST',
- data: {"s_sourceinfo": sourceinfo, "taskid": id},
- 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, "taskid": id},
- success: function (r) {
- if (r.success) {
- let msg = r.msg+"<br>"+"收回数据"+r.count+"条"
- showTip(msg, 1500);
- location.reload()
- } else {
- showTip(r.msg);
- }
- }
- })
- })
- }else {
- showTip("操作不允许")
- }
- }
- function checkMethod(stype) {
- // if (stype === "all") {
- // if (num2 <= 0) {
- // showTip("没有可质检的数据")
- // return;
- // }
- // }else if (stype === "notag") {
- // if (num2 <= 0) {
- // showTip("没有可质检的数据")
- // return;
- // }
- // }else if (stype === "tag") {
- // if (num3 <= 0) {
- // showTip("没有可质检的数据")
- // return;
- // }
- // }
- if (stype === "all") {
- let num0 = {{ .T.allIsTagDataNum }} // 已标注
- if (num0 > 0) {
- sessionStorage.setItem("check", "project")
- window.location.href = "/front/jy/check/data?pid="+projectid+"&s_sourceinfo={{.T.s_sourceinfo}}"+"&stype="+stype
- }else {
- showTip("没有质检数据")
- }
- }else if (stype === "notag") {
- let num0 = {{ .T.okAllDataNum }}
- let num1 = {{ .T.okIsGiveDataNum }} // 达标 已分发
- let num2 = {{ .T.okNotGiveDataNum }} // 达标 待分发
- let num3 = {{ .T.okIsTagDataNum }} // 达标 已标注
- if (num0 > 0) {
- if (num1 > 0) {
- if (num3 > 0) {
- sessionStorage.setItem("check", "project")
- window.location.href = "/front/jy/check/data?pid="+projectid+"&s_sourceinfo={{.T.s_sourceinfo}}"+"&stype="+stype+"&datatype=2"
- }else {
- showTip("没有质检数据")
- }
- }else {
- if (num2 > 0) {
- showLoading("数据处理中...")
- $.ajax({
- url: "/front/check/excp/notag/data",
- type: 'POST',
- data: {"s_sourceinfo": sourceinfo},
- success: function (r) {
- hideLoading()
- if (r.success) {
- sessionStorage.setItem("check", "project")
- window.location.href = "/front/jy/check/data?pid="+projectid+"&s_sourceinfo={{.T.s_sourceinfo}}"+"&stype="+stype+"&datatype=1"
- } else {
- showTip(r.msg);
- }
- }
- })
- }else {
- showTip("没有质检数据")
- }
- }
- }else {
- showTip("没有质检数据")
- }
- }else {
- let num0 = {{ .T.IsNotOkIsTagDataNum }}
- if (num0 > 0) {
- sessionStorage.setItem("check", "project")
- window.location.href = "/front/jy/check/data?pid="+projectid+"&s_sourceinfo={{.T.s_sourceinfo}}"+"&stype="+stype
- }else {
- showTip("没有质检数据")
- }
- }
- }
- function checkSuc() {
- let num1 = {{ .T.okIsGiveDataNum }} // 达标 已分发
- let num2 = {{ .T.okNotGiveDataNum }} // 达标 待分发
- let num3 = {{ .T.okIsTagDataNum }} // 达标 已标注
- if (num2 > 0 && num1 === 0 && num3 > 0) {
- showConfirm("确认达标数据通过质检?确认后,达标数据将无法进行标注、分发,默认完成标注。", function () {
- $.ajax({
- url: "/front/project/check/success",
- type: 'POST',
- data: {"s_sourceinfo": sourceinfo},
- success: function (r) {
- if (r.success) {
- location.reload()
- } else {
- showTip(r.msg);
- }
- }
- })
- })
- }else {
- showTip("操作不允许", 500)
- }
- }
- function checkAllSuc() {
- let num0 = {{ .T.allGiveDataNum }} // 已分发
- if (num0 === 0) {
- showConfirm("确认要通过数据吗?确认后,项目下未标注数据将无法进行标注、分发,默认完成标注。", function () {
- $.ajax({
- url: "/front/project/pass/success",
- type: 'POST',
- data: {"s_sourceinfo": sourceinfo},
- success: function (r) {
- if (r.success) {
- location.reload()
- } else {
- showTip(r.msg);
- }
- }
- })
- })
- }else {
- showTip("操作不允许", 500)
- }
- }
- function checkMethod1(pid, tid, sourceinfo) {
- sessionStorage.setItem("check", "project")
- window.location.href = "/front/jy/check/data?pid="+pid+"&tid="+tid+"&s_sourceinfo="+sourceinfo+"&stype=group"
- }
- </script>
|