123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643 |
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>信息抽查</title>
- <link href="/css/bootstrap.min.css" rel="stylesheet">
- <link href="/css/page.css" rel="stylesheet">
- <script src="/js/jquery.js"></script>
- <script src="/js/bootstrap.min.js"></script>
- <script src="/js/util.js"></script>
- <script src="/js/vue.min.js"></script>
- <script src="/js/index.js"></script>
- <script src="/js/jquery-page.js"></script>
- <link rel="stylesheet" href="/css/index.css">
- <style>
- .form-horizontal {
- min-height: 40px;
- margin-top: 20px;
- }
- .row-box label {
- white-space: nowrap;
- }
- .row-box select {
- width: 100px;
- }
- .row-box input {
- margin-left: 15px;
- width: 5em;
- }
- .row-box + .row-box {
- margin-left: 15px;
- }
- .row-box + button {
- margin-left: 15px;
- }
- .row-box {
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .checkbox-inline{
- margin-left: -11px;
- }
- .import-primary{
- margin-left: 9px;
- }
- .r-c-box {
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- </style>
- </head>
- <body>
- <!-- 模态框(Modal) -->
- <div class="modal fade" id="editeuser" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-dialog">
- <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-form">
- <div class="edit-info">
- <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
- <span class="info">信息修改<span>
- </div>
- <form class="form-horizontal" role="form">
- <div class="form-group">
- <label for="username" class="col-sm-2 control-label">用户名:</label>
- <div class="col-sm-10">
- <input type="text" readonly="readonly" value='{{session "username"}}' class="form-control" id="username">
- </div>
- </div>
- <div class="form-group password">
- <label for="password" class="col-sm-2 control-label">密码:</label>
- <div class="col-sm-10">
- <input type="text" class="form-control" id="password" value='{{session "password"}}'>
- </div>
- <span class="passwordEdit hide check">密码不能为空</span>
- </div>
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10">
- <input type="button" onclick="saveuser()" class="btn btn-primary" value="保存">
- <input type="button" onclick="cancel()" class="btn btn-default" value="取消">
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal -->
- </div>
- <div>
- <div class="modal fade" id="loadingModal" backdrop="static" keyboard="false">
- <div style="width: 200px;height:100px; z-index: 20000; position: absolute; text-align: center; left: 50%; top: 50%;margin-left:-100px;margin-top:-10px">
- <div class="progress progress-striped active"
- style="margin-bottom: 0;height:50px; text-align:center;line-height: 50px;font-size:large;">
- 数据加载中,请稍候......
- </div>
- </div>
- </div>
- <div style="background-color: #3c8dbc;text-align: right;">
- <div style="text-align: right;text-align: right;" class="glyphicon glyphicon-user"></div>
- <h3 onclick="editeuser()" style=" cursor:pointer;color: #FFFFFF;margin-top: 10px;margin-right: 15px;display: -webkit-inline-box;">{{session "loginuser"}}</h3>
- </div>
- <div class="col-md-12" style="border-right: 1px double #EEEEEE;">
- <div style="padding:10px 0px 0px 0px">
- <form action="/center/list" class="form-horizontal" role="form">
- <div style="display: none">
- <input type="input" name="pagenum" id="pagenum" class="form-control" value="{{.T.pagenum}}"/>
- </div>
- <div style="display: none">
- <input type="input" name="labeler" id="labername" class="form-control" value=""/>
- </div>
- <div class="col-md-3">
- <input type="input" name="spidercode" class="form-control" value="{{.T.spidercode}}"
- placeholder="请输入爬虫代码"/>
- </div>
- <div class="col-md-1" style="padding-left: 0;">
- <input type="input" name="db" disabled class="form-control" value="{{.T.dbname}}"
- placeholder="请输入库名"/>
- </div>
- <div class="col-md-1" style="padding-left: 0">
- <input type="input" name="coll" id="fromtable" class="form-control" value='{{if ne .T.coll ""}}{{.T.coll}}{{else}}{{.T.fromtable}}{{end}}' placeholder="请输入表名"/>
- </div>
- <div class="col-md-7 row-box" style="padding-left: 0">
- <div class=" row-box" style="padding-left: 0">
- <label class="checkbox-inline">类型:</label>
- <select name="type" id="topsubtype" class="form-control">
- <option value="-1">请选择</option>
- <!--<option value="trailer" {{if eq .T.type "notice"}}selected{{end}}>预告</option>
- <option value="tender" {{if eq .T.type "tender"}}selected{{end}}>招标</option>
- <option value="bid" {{if eq .T.type "bid"}}selected{{end}}>结果</option>-->
- </select>
- </div>
- <div class="row-box">
- <label class="checkbox-inline">字段:</label>
- <select name="field" id="field" class="form-control">
- <option value="-1">请选择</option>
- <!--<option value="trailer" {{if eq .T.type "notice"}}selected{{end}}>预告</option>
- <option value="tender" {{if eq .T.type "tender"}}selected{{end}}>招标</option>
- <option value="bid" {{if eq .T.type "bid"}}selected{{end}}>结果</option> -->
- </select>
- <input type="input" name="minval" id="minval" style="display:none" class="form-control"
- value="{{.T.min}}" placeholder="最小值"/>
- <input type="input" name="maxval" id="maxval" style="display:none" class="form-control"
- value="{{.T.max}}" placeholder="最大值"/>
- <div id="boexists" style="margin-left: -29px;">
- <input id="hasno" type="checkbox" name="hasno" onclick="checkboxOnclick(this)" value={{if .T.hasno}} true {{else}} false {{end}}/>
- <label style="margin-left: -28px;">不存在</label>
- </div>
- <div id="datanotag" style="margin-left: -29px;">
- <input id="notag" type="checkbox" name="notag" onclick="checktagboxOnclick(this)" value={{if .T.notag}} true {{else}} false {{end}}/>
- <label style="margin-left: -28px;">未标注</label>
- </div>
- </div>
- <!--<div class="col-md-2">
- <label class="checkbox-inline">
- <input type="checkbox" name="ispackage" value="1">分包数据
- </label>
- </div>-->
- <button type="submit" style="display: none" class="btn btn-primary" id="submitForm"></button>
- <div class="btn btn-primary" style="margin-left: 15px" onclick="alertsync()">查看</div>
- <div id="markedinit" class="btn btn-primary" style="margin-left: 15px;display:none;" onclick="markedinit()">初始化marked</div>
- <!-- <div class="btn btn-primary" style="margin-left: 15px" onclick="syncmarked()">同步</div>-->
- </div>
- </form>
- </div>
- <div class="col-md-12">
- <div class="form-group col-md-5" style="padding-left: 0">
- <textarea class="form-control" name="descript" id="es"></textarea>
- </div>
- <div class="form-group col-md-6" style="margin-top: 10px;margin-left: -14px;">
- <div class="col-md-3" style="padding-left: 0">
- <input type="input" id="importcoll" class="form-control" value="" placeholder="库表名"/>
- </div>
- <button class="btn btn-primary import-primary" onclick='getescount()'>
- Es导入数据
- </button>
- <button class="btn btn-primary import-primary" onclick='importbyexcel()'>
- 导入Excel
- </button>
- </div>
- <iframe srcdoc="<form id='uploadform' method='post' enctype='multipart/form-data' action='/center/importbyexcel'><input type='file' name='xlsx' /><input type='input' id='excelcoll' name='excelcoll' /></form>"
- height=0 scrolling=no class="hide" id="fileframe">
- </iframe>
- </div>
- <hr style="border:1 double" width="100%">
- <div class="col-md-12">
- <div class="form-group col-md-3" style="margin-left: -15px;">
- <h4>
- 已验/总数:{{.T.checkednum}}/{{.T.allnum}}
- </h4>
- </div>
- <div class="r-c-box">
- <button class="btn btn-primary" style="margin-left: 17px;" onclick="updateinfo()">刷新</button>
- {{if ge .T.role 2}}
- <div class="r-c-box">
- <label class="checkbox-inline" style="word-break: keep-all; margin: 0 20px;">人员筛选:</label>
- <select name="type" id="labeler" onchange="changelabeler(this.value)" class="form-control">
- <option value="-1">请选择</option>
- </select>
- </div>
- {{end}}
- <button class="btn btn-primary" style="margin-left: 50px;" onclick="skipReview()">数据质检</button>
- </div>
-
- </div>
- <hr style="border:1 double" width="100%">
- <div id="spcontent" class="column">
- {{range $k,$v:=.T.list}}
- <div>
- <span style="font-size:18px"><script>document.write({{ $v }}["num"])</script>:</span>
- <div onclick="getdetail({{$v._id}})" style="display: inline-block;cursor:pointer;font-size:18px;color:{{if $v.checked}}green{{else}}#428bca{{end}}">{{$v.title}}</div>
- </div>
- {{end}}
- </div>
- </div>
- <div style="text-align: center;justify-content: flex-end;padding-right: 100px;" class="r-c-box">
- <div id="pager" class="pager clearfix"></div>
- <div class="pager clearfix r-c-box" style="margin-left: 16px;">
- 跳转到
- <input type="text" id="changePage" style="width:30px;">
- <a type="text" href="javascript:void(0);" onclick="gopage()" style="text-align:center;float: right;">GO</a>
- </div>
- </div>
- </div>
- </body>
- <script>
- var vueApp = new Vue()
- //history.replaceState('', {},location.href.replace(location.search, '') )
- $(function(){
- if({{.T.coll}} == "marked"){
- $("#markedinit").css("display","");
- }
- //不存在标记
- if( {{.T.hasno}} ){
- $("#hasno").attr("checked",true);
- }
- if( {{.T.notag}} ){
- $("#notag").attr("checked",true);
- }
- //数据类型
- for(i in {{.T.topsubtype}}){
- var selected = ""
- if({{.T.type}} == {{.T.topsubtype}}[i]){
- selected = "selected"
- }
- $("#topsubtype").append("<option "+selected+" value='"+{{.T.topsubtype}}[i]+"'>"+{{.T.topsubtype}}[i]+"</option>")
- }
- //标注人员筛选
- for(i in {{.T.labelers}}){
- var selected = ""
- console.log({{.T.labeler}},"----",{{.T.labelers}}[i])
- if({{.T.labeler}} == {{.T.labelers}}[i]){
- selected = "selected"
- }
- $("#labeler").append("<option "+selected+" value='"+{{.T.labelers}}[i]+"'>"+{{.T.labelers}}[i]+"</option>")
- }
- //字段选择
- var fk = "";
- for(i in {{.T.allfield}}){
- var selected = ""
- for(key in {{.T.allfield}}[i]){
- if({{.T.field}} == key){
- selected = "selected"
- fk = key
- }
- $("#field").append("<option " +selected+" value='"+key+"'>"+{{.T.allfield}}[i][key]+"</option>")
- }
- }
- if(fk=="budget"||fk=="bidamount"){
- $("#maxval").css("display","");
- $("#minval").css("display","");
- $("#boexists").css("display","none");
- }
-
- $("#field").change(function(){
- $("#hasno").attr("checked",false);
- $("#notag").attr("checked",false);
- if($(this).val()=="bidamount"||$(this).val()=="budget"){
- $("#minval").css("display","");
- $("#maxval").css("display","");
- $("#boexists").css("display","none");
- }else{
- $("#minval").css("display","none");
- $("#maxval").css("display","none");
- $("#boexists").css("display","");
- }
- });
- $("#fromtable").on('input propertychange', function(){
- var tmpcoll = $("#fromtable").val();
- if(tmpcoll == "marked"){
- $("#markedinit").css("display","");
- }else{
- $("#markedinit").css("display","none");
- }
- });
- })
- //是否选择不存在
- function checkboxOnclick(checkbox){
- if ( checkbox.checked == true){
- $("#hasno").attr("value",true);
- }else{
- $("#hasno").attr("value",false);
- }
- }
- //是否选择未标注
- function checktagboxOnclick(checkbox){
- if ( checkbox.checked == true){
- $("#notag").attr("value",true);
- }else{
- $("#notag").attr("value",false);
- }
- }
- function getdetail(id) {
- $.ajax({
- url: "/center/checkid",
- type: "post",
- data: {"id":id},
- async: false,
- success: function (r) {
- if(r && r.msg == ""){
- if(r.exists){//标注完成
- window.open("/center/finishcheck");
- }else if(!r.exists && r.id != id){
- /*
- vueApp.$message({
- message: '此条数据正在标注,请选择未标注数据',
- type: 'danger',
- duration: 2000,
- offset: 300
- });
- */
- vueApp.$confirm('此条数据正在标注,是否直接跳转到未标注数据?', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- window.open("/center/detail/"+r.id+".html");
- }).catch(() => {
- });
- }else if (!r.exists && r.id == id){
- window.open("/center/detail/"+r.id+".html");
- }else{
- alert("标注出错!")
- }
- }else{
- alert("标注出错!"+r.msg)
- }
- }
- })
- }
- function getescount(){
- var importcoll = $("#importcoll").val();
- if(importcoll == ""){
- alert("请输入导入表!")
- return
- }
- var estext = $("#es").val()
- if(estext==""){
- alert("请输入es查询语句!")
- return
- }
- $.ajax({
- url:"/center/getescount",
- method:"post",
- data: {"estext":estext},
- success:function(res){
- importbyes(res.count,res.msg,estext,importcoll)
- }
- });
- }
- function importbyes(count,msg,text,coll){
- vueApp.$confirm('es查询数据量:'+count, msg, {
- confirmButtonText: '确认导入',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- importes(text,coll)
- }).catch(() => {
- });
- }
- //es导入
- function importes(estext,coll){
- showLoading()
- $.ajax({
- url: "/center/importbyes",
- method: "post",
- data: {"estext": estext, "coll": coll},
- success: function (r) {
- hideLoading()
- if(r){
- alert(r.msg)
- }else{
- alert("导入失败")
- }
- // if (res && res.success) {
- // alert("数据导入成功")
- // //setTimeout(alert("数据导入成功"),200)
- // } else {
- // alert(res.msg)
- // //setTimeout(alert(res.msg),200)
- // }
- }
- });
- }
- //excel导入
- function importbyexcel(){
- var importcoll = $("#importcoll").val();
- if(importcoll == ""){
- alert("请输入导入表!")
- return
- }
- $("#excelcoll").val(importcoll);
- $("#fileframe").contents().find("#excelcoll").val(importcoll);
- var f=$("#fileframe").contents().find("input");
- f.get(0).click();
- f.change(function() {
- var val = $(this).val() ? $(this).val() : "";
- if (val.indexOf(".xlsx") < 0) {
- showMsg("文件格式非法",
- function() {});
- } else {
- $(this).parent().submit();
- showLoading()
- var ret = setInterval(function () {
- var f = $(window.frames[0].document).find("form");
- if (f.length == 0) {
- hideLoading()
- var b = $(window.frames[0].document).find("body").text();
- if (b) {
- var r = JSON.parse(b)
- if(r){
- console.log(r.msg)
- alert(r.msg)
- }else{
- alert("导入失败")
- }
- // if (r && r.success) {
- // alert("数据导入成功")
- // } else {
- // alert(r.msg)
- // }
- }
- $(window.frames[0].document).find("body").append("<form id='uploadform' method='post' enctype='multipart/form-data' action='/center/importbyexcel'><input type='file' name='xlsx' /><input type='input' id='excelcoll' name='excelcoll' /></form>");
- }
- },
- 500)
- }
- })
- }
- //展示loading框
- showLoading = function (){
- $('#loadingModal').modal({backdrop: 'static', keyboard: false});
- }
- //隐藏掉loading框
- hideLoading = function (){
- $('#loadingModal').modal('hide');
- }
- //分页
- $("#pager").zPager({
- totalData: {{.T.allnum}},//数据总条数
- current: {{.T.pagenum}},
- pageData: 50,//每页数据条数
- //htmlBox: $('#wraper'),
- btnShow: true,
- ajaxSetData: false
- });
- function currentPage(currentPage, type){
- /*
- 触发页码数位置: Page/js/jquery.z-pager.js 64行
- */
- console.log("当前页码数:" + currentPage);
- }
- function alertsync() {
- var coll = $("#fromtable").val();
- if(confirm("请先同步"+coll+"表中数据。如需同步,请点确定;否则,请取消,直接查看数据。"+"\n"+"(通过ES/Excel导入数据,无需同步)")){
- if(coll == "marked"){
- alert("marked表无需同步");
- return
- }
- showLoading();
- $.ajax({
- url:"/center/syncmarked",
- type:"post",
- async:false,
- data:{"coll":coll},
- success:function (r) {
- if(r){
- console.log(r.msg);
- alert(r.msg);
- hideLoading();
- if(r.flag){
- $("#submitForm").trigger('click');
- }
- }else{
- hideLoading()
- }
- }
- })
- }else{
- $("#submitForm").trigger('click');
- }
- }
- //页码跳转
- function gopage(){
- var pagenumber = $("#changePage").val();
- var totalcount = {{.T.allnum}};
- var pagecount = parseInt((totalcount + 50 - 1) / 50)
- if(1 <= pagenumber && pagenumber <= pagecount){
- submitform(pagenumber);
- }else{
- vueApp.$message({
- message: '页码输入有误,请重新输入!',
- type: 'danger',
- duration: 2000,
- offset: 300
- });
- }
-
- }
- function submitform(number){
- $("#pagenum").val(number);
- $("#submitForm").trigger('click');
- }
- function updateinfo(){
- $("#submitForm").trigger('click');
- }
- //同步marked表中的数据
- function syncmarked() {
- var coll = $("#fromtable").val();
- if(confirm("确定同步"+coll+"表中数据?")){
- if(coll == "marked"){
- alert("marked表无需同步");
- return
- }
- $.ajax({
- url:"/center/syncmarked",
- type:"post",
- data:{"coll":coll},
- success:function (r) {
- if(r){
- console.log(r.msg)
- alert(r.msg)
- }
- }
- })
- }
- }
- function markedinit(){
- vueApp.$confirm('确定初始化marked表中ck_data标记?', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- $.ajax({
- url: "/center/markedinit",
- type: "post",
- success: function (r) {
- if(r&&r.success){
- alert("初始化成功");
- }else{
- alert("初始化失败");
- }
- }
- })
- }).catch(() => {
- });
- }
- function saveuser() {
- var username = $("#username").val();
- var password = $("#password").val();
- if(username!=""&&password!=""){
- $.ajax({
- url: "/center/saveuser",
- type: "post",
- data: {"username":username,"password":password},
- success: function (r) {
- if(r&&r.flag){
- alert("更新成功");
- $("#editeuser").modal("hide");
- }else{
- alert("更新失败");
- }
- }
- })
- }else{
- alert("用户或密码不能为空!")
- }
- }
- function editeuser() {
- $("#editeuser").modal("show");
- }
- function cancel() {
- $("#editeuser").modal("hide");
- }
- function changelabeler(labeler){
- if(labeler == "-1"){
- return
- }
- $("#labername").val(labeler)
- $("#submitForm").trigger('click');
- //window.location.href = '/center/getlistbylabeler/?user='+labeler;
- //window.open("/center/getlistbylabeler/?user="+labeler);
- }
- function skipReview() {
- window.location.href="/center/review"
- }
- </script>
- </html>
|