Browse Source

分支合并

lianbingjie 5 years ago
parent
commit
8d6b76ba46
3 changed files with 358 additions and 0 deletions
  1. 1 0
      README.md
  2. 84 0
      core/src/qfw/manage/structured_data.go
  3. 273 0
      core/src/web/templates/manage/structed/index.html

+ 1 - 0
README.md

@@ -12,5 +12,6 @@ pkg目录,已经在版本控制中排除,不会被提交。
 
 业务代码放在bsw目录中,按前后台\模块划分
 系统配置文件统一放在config.json中。
+
 v2.9.5.1
 线上课程后台增加上传列表页图片功能

+ 84 - 0
core/src/qfw/manage/structured_data.go

@@ -0,0 +1,84 @@
+package manage
+
+import (
+	"fmt"
+	"github.com/go-xweb/log"
+	"github.com/go-xweb/xweb"
+	util "qfw/coreutil"
+	"time"
+)
+
+type Structed_data struct {
+	*xweb.Action
+	index          xweb.Mapper `xweb:"/manage/structed/index"`
+	getData        xweb.Mapper `xweb:"/manage/structed/getdata"`
+	handleData       xweb.Mapper `xweb:"/manage/structed/handledata"`
+}
+
+func init() {
+	xweb.AddAction(&Structed_data{})
+}
+
+
+func (t *Structed_data)Index(){
+	t.Render("/manage/structed/index.html")
+}
+
+
+
+func (t *Structed_data)GetData(){
+	userId:=t.GetSession("userId")
+	if userId!=""{
+		status := t.GetString("status")
+		log.Println("status",status)
+		phone := t.GetString("phone")
+		currentPage, _ := t.GetInteger("currentPage")
+		perPage, _ := t.GetInteger("perPage")
+
+		sql := " from structed_data "
+		val := []interface{}{}
+		var has_phone_check = false
+		if phone!=""{
+			has_phone_check = true
+			sql = sql + " where phone like ? "
+			val = append(val, "%"+phone+"%")
+		}
+		if status!=""{
+			if has_phone_check{
+				sql = sql + " and status = " + status
+			}else{
+				sql = sql + " where status = " + status
+			}
+		}
+
+		countQuery := "select count(*) " + sql
+		count := util.Mysql.QueryCount(countQuery, val...)
+
+		listQuery := "select * " + sql + fmt.Sprintf(" order by submit_time desc limit %d,%d", (currentPage-1)*perPage, perPage)
+		res := util.Mysql.Query(listQuery, val...)
+		for k, v := range *res {
+			v["index"] = k + 1
+		}
+		t.ServeJson(map[string]interface{}{
+			"currentPage": currentPage,
+			"data":        res,
+			"totalRows":   count,
+		})
+	}
+}
+
+func (t *Structed_data)HandleData(){
+	data_id := t.GetString("data_id")
+	userId := t.GetSession("userId")
+	if userId!=""{
+		res :=util.Mysql.Update("structed_data", map[string]interface{}{
+			"id":data_id,
+		}, map[string]interface{}{
+			"status":"1",
+			"handle_time":time.Now().Unix(),
+		})
+		t.ServeJson(map[string]interface{}{
+			"status":res,
+		})
+	}
+}

+ 273 - 0
core/src/web/templates/manage/structed/index.html

@@ -0,0 +1,273 @@
+<html>
+<head>
+    <title>结构化招标数据</title>
+    {{include "/common/inc.html"}}
+    <script src="{{Msg "seo" "cdn"}}/js/jquery.cookie.js"></script>
+    <script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/zDialog.js"></script>
+    <script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/My97DatePicker/WdatePicker.js"></script>
+    <script src="/js/qfwtable.js"></script>
+    <style type="text/css">
+
+        #content table{
+            table-layout: fixed;
+            border:0px;
+            font-size:14px;
+        }
+
+        .table>thead>tr>th:nth-child(1){
+            width:5%;
+        }
+        .table>thead>tr>th:nth-child(2){
+            width:10%;
+        }
+        .table>thead>tr>th:nth-child(3){
+            width:20%;
+        }
+        .table>thead>tr>th:nth-child(4){
+            width:20%;
+        }
+        .table>thead>tr>th:nth-child(5){
+            width:20%;
+        }
+        .table>thead>tr>th:nth-child(6){
+            width:20%;
+        }
+        .table>thead>tr>th:nth-child(7){
+            display: none;
+        }
+        .table > tbody > tr > td:nth-child(7) {
+            display: none;
+        }
+        .table>thead>tr>th{
+            border:0px;
+            font-size:14px;
+        }
+        .table>tbody>tr>td{
+            white-space: nowrap;
+            text-overflow: ellipsis;
+            overflow: hidden;
+            border:0px;
+            border-bottom:1px dashed #999999;
+        }
+        .table >tbody>tr{
+            cursor: pointer;
+        }
+        #_Container_0{
+            background-color:#FFFFFF;
+        }
+        .buttonStyle{width:64px;height:22px;line-height:22px;color:#369;text-align:center;background:url({{Msg "seo" "cdn"}}/images/buticon.gif) no-repeat left top;border:0;font-size:12px;}
+        .buttonStyle:hover{background:url({{Msg "seo" "cdn"}}/images/buticon.gif) no-repeat left -23px;}
+        .pagination>.active>a:hover,.pagination>.active>a:focus{
+            background-color:#18CC7D;
+        }
+        #sidebar { margin-left:0px;}
+        .greenStyle {
+            color: #4DB443;
+            border-color: #4DB443;
+        }
+        .editBtn {
+            display: flex;
+        }
+
+        .editBtn span {
+            padding: 3px 7px;
+            border: 1px solid;
+            border-radius: 4px;
+            margin: 0 3px;
+        }
+        .modal {
+            top: 33%;
+        }
+
+        .modal-dialog {
+            width: 400px;
+            text-align: center;
+        }
+
+        .modal-dialog .bootbox-close-button.close {
+            display: none;
+        }
+
+        .modal-dialog .modal-header .modal-title {
+            color: #4E5051;
+            font-size: 18px;
+        }
+
+        .modal-dialog .bootbox-body {
+            color: #4E5051;
+            font-size: 14px;
+        }
+
+        .modal-dialog .modal-header,
+        .modal-dialog .modal-footer {
+            border: none;
+
+        }
+
+        .modal-dialog .modal-footer{
+            display: flex;
+            justify-content: space-between;
+        }
+
+        .modal-dialog .modal-footer .bootbox-cancel{
+            width: 110px;
+            height: 38px;
+            left: 24px;
+            top: 112px;
+
+            background: #C2C2C2;
+            border-radius: 4px;
+            border-color: #C2C2C2;
+            color: #ffff;
+        }
+
+        .modal-dialog .modal-footer .bootbox-accept{
+            width: 110px;
+            height: 38px;
+            left: 226px;
+            top: 112px;
+
+            background: #4DB443;
+            border-radius: 4px;
+            border-color: #4DB443;
+            color: #ffff;
+        }
+    </style>
+</head>
+<body>
+{{include "/manage/audithead.html"}}
+<div class="row" style="width:96%; margin:0 auto;">
+    {{include "/manage/slider.html"}}
+    <div id="content">
+        <div id="audit"></div>
+    </div>
+</div>
+{{include "/common/bottom.html"}}
+</body>
+<script type="text/javascript" src="/js/bootbox.js"></script>
+<script>
+    var r = 0
+    $(function(){
+        $("#audit").datatable({
+            perPage: 10
+            ,showPagination:true
+            ,checkbox:"" //check radio
+            ,checkboxHeader:false
+            ,idField:"_id"
+            ,classname:"table-hover"
+            ,css:{"height":"550px"}
+            ,buttons: ['<div style="width:50%;margin:5px" class="input-group pull-right" id="search"><input type="text" id="searchtext" value=""  data-original-title="Search" class="form-control" placeholder="请输入手机号"><span class="input-group-btn"><button class="btn btn-success" onclick="SearchContent()" data-original-title="Search" id="searchtip" type="button" style="height:38px;">检索</button></span></div><div style="margin:5px;" class="controls pull-right"><select class="form-control" id="status"><option value="">  状态  </option><option value="1">  已处理 </option><option value="0">  未处理 </option></select></div>']
+            , url: '/manage/structed/getdata'
+            , columns: [
+                {
+                    title: "序号", field: "index"
+                },
+                {
+                    title: "状态",field: "status",callback:function(r){
+                        if (r.status == 1){
+                            return "已处理"
+                        }else{
+                            return "未处理"
+                        }
+                    }
+                },
+                {
+                    title: "姓名", field: "user_name",callback:function(r){
+                        return r.name
+                    }
+                },
+                {
+                    title: "手机号", field: "phone_num",callback:function(r){
+                        return r.phone
+                    }
+                },
+                {
+                    title: "提交时间", field: "submit_time",callback:function(r){
+                        return formattime(r.submit_time)
+                    }
+
+                },
+                {
+                    title: "操作", field: "handle",callback:function(r){
+                        if (r.status == 1){
+                            return formattime(r.handle_time)
+                        }else{
+                            return  "<div class='editBtn'><span class='greenStyle' onclick=handle(this)>去处理</span></div>"
+                        }
+                    }
+                },
+                {
+                    title: "id", field: "pay_time",callback:function(r){
+                        return r.id
+                    }
+                }
+            ]
+        });
+
+    });
+
+    function SearchContent(){
+        r = 0
+        var find=$("#audit").data("datatable");
+        if(!find.options.opost) find.options.opost=find.options.post||{};
+        find.options.post=$.extend(find.options.opost,{phone:$("#searchtext").val(),status:$("#status option:selected").val()});
+        find.options.currentPage=1;
+        find.render();
+
+    }
+
+    //去处理
+    function handle(e) {
+        var id =$(e).parents("td").next().text()
+        var tipMsg = "是否确定已处理?";
+
+
+        bootbox.confirm({
+            title: "提示",
+            message: tipMsg,
+            buttons: {
+                cancel: {
+                    label: '取消'
+                },
+                confirm: {
+                    label: '确定'
+                }
+            },
+            callback: function (result) {
+                if (!result) {
+                    return
+                }
+                if (id != ""){
+                    $.ajax({
+                        url:"/manage/structed/handledata",
+                        type:"POST",
+                        data:{"data_id":id},
+                        success:function (r) {
+                            if (r.status){
+                                window.location.reload(true)
+                            }else{
+                                bootbox.alert("处理失败请重试")
+                            }
+                        }
+                    })
+                }
+            }
+        });
+    }
+
+    function formattime(timestamp) {
+        if (typeof(timestamp) == "undefined"||timestamp == ""){
+            return ""
+        }else{
+            var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
+            var Y = date.getFullYear() + '-';
+            var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
+            var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
+            var h = (date.getHours()<10 ? '0'+date.getHours() : date.getHours())+':';
+            var m = (date.getMinutes()<10 ? '0'+date.getMinutes() : date.getMinutes())+':';
+            var s = (date.getSeconds()<10 ? '0'+date.getSeconds() : date.getSeconds())+' ';
+            return Y+M+D+h+m+s;
+        }
+    }
+</script>
+</html>