|
@@ -0,0 +1,106 @@
|
|
|
|
+{{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>新增数据</h1>
|
|
|
|
+ <ol class="breadcrumb">
|
|
|
|
+ <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
|
|
|
|
+ <li><a href="/service/jy/repair/redis"> redis维护</a></li>
|
|
|
|
+ </ol>
|
|
|
|
+ </section>
|
|
|
|
+ <!-- Main content -->
|
|
|
|
+ <section class="content">
|
|
|
|
+ <div class="box-body">
|
|
|
|
+ <form class="form-horizontal">
|
|
|
|
+
|
|
|
|
+ </form>
|
|
|
|
+ </div>
|
|
|
|
+ </section>
|
|
|
|
+</div>
|
|
|
|
+
|
|
|
|
+{{include "com/footer.html"}}
|
|
|
|
+<script>
|
|
|
|
+ menuActive("/service/jy/repair/redis");
|
|
|
|
+ var create_data = {{.T.data}}
|
|
|
|
+ function parse(str) {
|
|
|
|
+ return JSON.stringify(str, null, "\t")
|
|
|
|
+ }
|
|
|
|
+ $('#jsonTextarea').val(parse(create_data))
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //添加更新
|
|
|
|
+ function saveRepair() {
|
|
|
|
+ var reason=$("#reasons").val()
|
|
|
|
+ if (reason=="") {
|
|
|
|
+ let msg = "请填写新增数据原因"
|
|
|
|
+ showMsg(msg)
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var curData = document.getElementById('jsonTextarea').value;
|
|
|
|
+ var data = JSON.parse(curData)
|
|
|
|
+ var updata = {}
|
|
|
|
+ for (var k in data) {
|
|
|
|
+ updata[k] = data[k]
|
|
|
|
+ }
|
|
|
|
+ //处理特殊字段
|
|
|
|
+ if (checkAddDict(updata)) {
|
|
|
|
+ let msg = "title,site,channel,area\n非空必填信息,请补充完善信息"
|
|
|
|
+ showMsg(msg)
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var detail = document.getElementById('jsonDetail').value
|
|
|
|
+ var tmp_detail = ''+detail
|
|
|
|
+ if (tmp_detail=="") {
|
|
|
|
+ let msg = "请填写detail"
|
|
|
|
+ showMsg(msg)
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var content = document.getElementById('jsonContentHtml').value
|
|
|
|
+ var tmp_content = ''+content
|
|
|
|
+ if (tmp_content=="") {
|
|
|
|
+ let msg = "请填写contenthtml"
|
|
|
|
+ showMsg(msg)
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var tmp_summary = $('#summary').val();
|
|
|
|
+ showConfirm("确定添加新信息?", function() {
|
|
|
|
+ $.ajax({
|
|
|
|
+ url: "/service/jy/newSave",
|
|
|
|
+ type: 'POST',
|
|
|
|
+ data: {"data":JSON.stringify(updata),
|
|
|
|
+ "contenthtml": tmp_content,
|
|
|
|
+ "detail": tmp_detail,
|
|
|
|
+ "summary": tmp_summary,
|
|
|
|
+ "reasons":reason,
|
|
|
|
+ },
|
|
|
|
+ success: function (task) {
|
|
|
|
+ if (task.rep) {
|
|
|
|
+ window.location.href="/service/jy/repair"
|
|
|
|
+ } else {
|
|
|
|
+ showTip("添加失败,请检查数据后在试");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function checkAddDict(data) {
|
|
|
|
+ if (data.length === 9){
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ if (data["area"]=="" || data["channel"]=="" || data["site"]=="" ||
|
|
|
|
+ data["publishtime"]=="" || data["title"]=="" || data["infoformat"]=="" ) {
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+</script>
|