|
@@ -4,6 +4,8 @@
|
|
|
<!-- Left side column. 权限菜单 -->
|
|
|
{{template "memu"}}
|
|
|
<link href="/res/other/css/other.css" rel="stylesheet" type="text/css">
|
|
|
+<link href="/res/jsoneditor/css/jsoneditor.css" rel="stylesheet" type="text/css">
|
|
|
+<script src="/res/jsoneditor/js/jsoneditor.js"></script>
|
|
|
<style>
|
|
|
#dataTable_filter div {
|
|
|
padding: 0px 10px;
|
|
@@ -16,10 +18,10 @@
|
|
|
<div class="content-wrapper">
|
|
|
<section class="content-header" style="padding: 49px 15px 0 15px;">
|
|
|
<h1>
|
|
|
- <small><a class="btn btn-primary opraaa" opraaa="newqyk">新增buyer信息</a></small>
|
|
|
+ <small><a class="btn btn-primary opraaa" opraaa="newqyk" onclick='AddBuyerHTML()'>新增采购单位信息</a></small>
|
|
|
</h1>
|
|
|
<ol class="breadcrumb">
|
|
|
- <li><a href="#"><i class="fa fa-dashboard"></i> buyer增删改查</a></li>
|
|
|
+ <li><a href="#"><i class="fa fa-dashboard"></i> 采购单位增删改查</a></li>
|
|
|
</ol>
|
|
|
</section>
|
|
|
<!-- Main content -->
|
|
@@ -31,13 +33,11 @@
|
|
|
<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>
|
|
|
- <th>注册资本</th>
|
|
|
- <th>企业地址</th>
|
|
|
<th>操作</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
@@ -71,8 +71,12 @@
|
|
|
{{template "dialog"}}
|
|
|
{{template "footer"}}
|
|
|
<script>
|
|
|
- menuActive("qiyeku_info")
|
|
|
- var ttable = {}
|
|
|
+ menuActive("buyer_info")
|
|
|
+ var ttable = {};
|
|
|
+ var editor_add = null;
|
|
|
+ var editor_udapte = null;
|
|
|
+
|
|
|
+
|
|
|
$(function () {
|
|
|
ttable = $('#dataTable').DataTable({
|
|
|
"paging": true,
|
|
@@ -91,306 +95,169 @@
|
|
|
},
|
|
|
"columns": [
|
|
|
{
|
|
|
- "data": "company_name", "width": "18%", render: function (val, a, row) {
|
|
|
- if (val == null) {
|
|
|
- return ""
|
|
|
- }
|
|
|
- return val
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "data": "alias", "width": "11%", render: function (val, a, row) {
|
|
|
- if (val == null) {
|
|
|
- return ""
|
|
|
- }
|
|
|
- return val
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- "data": "province", "width": "4%", render: function (val, a, row) {
|
|
|
+ "data": "company_name", "width": "15%", render: function (val, a, row) {
|
|
|
if (val == null) {
|
|
|
return ""
|
|
|
}
|
|
|
- return val
|
|
|
+ return "<text title="+val+">"+val+"</text >"
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- "data": "city", "width": "4%", render: function (val, a, row) {
|
|
|
+ "data": "credit_no", "width": "10%", render: function (val, a, row) {
|
|
|
if (val == null) {
|
|
|
return ""
|
|
|
}
|
|
|
- return val
|
|
|
+ return "<text title="+val+">"+val+"</text >"
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- "data": "district", "width": "4%", render: function (val, a, row) {
|
|
|
+ "data": "type", "width": "10%", render: function (val, a, row) {
|
|
|
if (val == null) {
|
|
|
return ""
|
|
|
}
|
|
|
- return val
|
|
|
+ return "<text title="+val+">"+val+"</text >"
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- "data": "capital", "width": "6%", render: function (val, a, row) {
|
|
|
+ "data": "ranks", "width": "10%", render: function (val, a, row) {
|
|
|
if (val == null) {
|
|
|
return ""
|
|
|
}
|
|
|
- return val
|
|
|
+ return "<text title="+val+">"+val+"</text >"
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- "data": "company_address", "width": "17%", render: function (val, a, row) {
|
|
|
+ "data": "province", "width": "10%", render: function (val, a, row) {
|
|
|
if (val == null) {
|
|
|
return ""
|
|
|
}
|
|
|
- return val
|
|
|
+ return "<text title="+val+">"+val+"</text >"
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- "data": "_id", "width": "24%", render: function (val, a, row) {
|
|
|
+ "data": "_id", "width": "10%", render: function (val, a, row) {
|
|
|
var valueStr = JSON.stringify(row);
|
|
|
return "<div class='operate'>" +
|
|
|
"<a class='btn btn-primary' onclick='editdata(" + valueStr + ")'>编辑</a> " +
|
|
|
- "<a class='btn btn-default' onclick='showHylxs(\"" + val + "\")'>详细行业类型</a> " +
|
|
|
- "<a class='btn btn-sm btn-warning' onclick='showTels(\"" + val + "\")'>详细联系方式</a> " +
|
|
|
+ // "<a class='btn btn-default' onclick='showHylxs(\"" + val + "\")'>详细行业类型</a> " +
|
|
|
+ // "<a class='btn btn-sm btn-warning' onclick='showTels(\"" + val + "\")'>详细联系方式</a> " +
|
|
|
"<a class='btn btn-sm btn-danger' onclick='deleteQyk(\"" + val + "\")'>删除</a> " +
|
|
|
"</div>"
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
- /*新增企业库*/
|
|
|
- ttable.on('init.dt', function () {
|
|
|
- $(".opraaa").click(function () {
|
|
|
- var n = $(this).attr("opraaa");
|
|
|
- var _tit = "", htmlObj = {}, obj, tag = [];
|
|
|
- switch (n) {
|
|
|
- case "newqyk":
|
|
|
- tag = [
|
|
|
- {label: "企业名称:", s_label: "s_company_name", must: true},
|
|
|
- {label: "别名:", s_label: "s_alias"},
|
|
|
- {label: "省份:", s_label: "s_province"},
|
|
|
- {label: "城市:", s_label: "s_city"},
|
|
|
- {label: "区县:", s_label: "s_district"},
|
|
|
- {label: "注册资本:", s_label: "s_capital", placeholder: "示例:45678.98元;456.78万元;1234.25;"},
|
|
|
- {label: "企业地址:", s_label: "s_company_address"},
|
|
|
- ];
|
|
|
- //新增企业库按钮
|
|
|
- htmlObj = {
|
|
|
- title: "新增企业库信息",
|
|
|
- tag: tag,
|
|
|
- bts: [
|
|
|
- {
|
|
|
- label: "Save", class: "btn-danger",
|
|
|
- fun: function () {
|
|
|
- var company_name = $("#s_company_name").val();
|
|
|
- var alias = $("#s_alias").val();
|
|
|
- var province = $("#s_province").val();
|
|
|
- var city = $("#s_city").val();
|
|
|
- var district = $("#s_district").val();
|
|
|
- var capital = $("#s_capital").val();
|
|
|
- var company_address = $("#s_company_address").val();
|
|
|
- if (company_name === "") {
|
|
|
- alert("红色标签的表单不能为空!");
|
|
|
- return
|
|
|
- }
|
|
|
- //新增企业库api
|
|
|
- $.post("/admin/audit/qiyeku_info/save", {
|
|
|
- "company_name": company_name,
|
|
|
- "alias": alias,
|
|
|
- "province": province,
|
|
|
- "city": city,
|
|
|
- "district": district,
|
|
|
- "capital": capital,
|
|
|
- "company_address": company_address,
|
|
|
- }, function (data) {
|
|
|
- if (data && data.rep) {
|
|
|
- $("#myModal").modal("hide");
|
|
|
- alert("保存成功");
|
|
|
- setTimeout(function () {
|
|
|
- ttable.search(company_name).draw();
|
|
|
- // history.go(0) //刷新本页
|
|
|
- }, 1500) //停1.5秒
|
|
|
-
|
|
|
- } else {
|
|
|
- alert("内部错误");
|
|
|
- }
|
|
|
- }, 'json')
|
|
|
- }
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- OpenDialog(htmlObj, obj);
|
|
|
- break;
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
});
|
|
|
|
|
|
- //详细行业类型
|
|
|
- function showHylxs(_id) {
|
|
|
+ var vastrjson = [{
|
|
|
+ "infoid": "招标信息id",
|
|
|
+ "contact_person": "联系人",
|
|
|
+ "contact_type": "联系人类型",
|
|
|
+ "phone": "联系人电话",
|
|
|
+ "topscopeclass": "项目类型"
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ /*新增采购单位html*/
|
|
|
+ function AddBuyerHTML() {
|
|
|
$("#infos").html("");
|
|
|
- $("#info_title").html("详细行业类型");
|
|
|
- $.post("/admin/audit/query_qyk/ById", {
|
|
|
- "_id": _id,
|
|
|
- "q_field": "industry",
|
|
|
- }, function (data) {
|
|
|
- if (data && data.rep) {
|
|
|
- // console.log(data);
|
|
|
- var tmp = "<div class='row'>";
|
|
|
- for (var i in data.data.industry) {
|
|
|
- tmp = tmp +
|
|
|
- "<div class=\"col-lg-10\">\n" +
|
|
|
- "<div class=\"input-group\">\n" +
|
|
|
- " <input type='text' class='form-control' name='industry' placeholder=\"请填写行业类型\" value='" + data.data.industry[i] + "'>" +
|
|
|
- " <span class=\"input-group-btn\">" +
|
|
|
- ' <button class="btn btn-info " type="button" data-toggle="tooltip" title="删除" id="delCenterIpGrp"><span class="glyphicon glyphicon-minus"></span></button>' +
|
|
|
- " </span> " +
|
|
|
- " </div>" +
|
|
|
- "</div>";
|
|
|
- // console.log(i, data.data.industry[i]);
|
|
|
- }
|
|
|
- tmp = tmp +
|
|
|
- "<div class=\"col-lg-10\">\n" +
|
|
|
- "<button class='btn btn-info col-md-3' type='button' id='addCenterIpGrpBtn' onclick='addCenterIpGrp(this)' >新增行业类型</button> " +
|
|
|
- "<button type='button' class='btn btn-sm btn-default col-md-offset-5 col-md-2' data-dismiss='modal' aria-label='Close'>取消</button>" +
|
|
|
- "<button type='button' class='btn btn-sm btn-danger col-md-2' onclick='updateIndustrys(\"" + _id + "\")'>保存</button>" +
|
|
|
- "</div>" +
|
|
|
- "</div>";
|
|
|
- $("#infos").html(tmp);
|
|
|
+ $("#info_title").html("新增采购单位信息");
|
|
|
+ com ="<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\" style=\"color: red;\">采购单位名称:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_company_name\" must=\"true\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">历史名称:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_history_name\" placeholder=\"多个;隔开\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">行政区划代码:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_area_code\" ></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">单位类型:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_type\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">行政级别:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_ranks\" ></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">省份:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_province\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">城市:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_city\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">区县:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_district\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">采购单位类型:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_buyerclass\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">采购单位地址:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_address\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">微信公众号:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_wechat_accounts\" placeholder=\"多个;隔开\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">网址:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_website\"></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">联系方式:</label>" +
|
|
|
+ "<div class=\"col-sm-10\" id='s_contact' style=\"height:250px\"></div>" +
|
|
|
+ "<div class=\"row form-group\">" +
|
|
|
+ "<button type='button' class='btn btn-sm btn-default col-md-offset-5 col-md-2' data-dismiss='modal' aria-label='Close'>取消</button>" +
|
|
|
+ "<button type='button' class='btn btn-sm btn-danger col-md-2' onclick='Add()'>新增采购单位</button></div>";
|
|
|
|
|
|
|
|
|
- } else {
|
|
|
- alert("内部错误");
|
|
|
- }
|
|
|
- }, 'json');
|
|
|
- //展示详细行业类型
|
|
|
+ $("#infos").html(com);
|
|
|
+ $("#s_contact").html('');
|
|
|
+ var container = document.getElementById('s_contact');
|
|
|
+ showJson("add", vastrjson, container);
|
|
|
$("#info_data").modal("show");
|
|
|
}
|
|
|
-
|
|
|
- //添加行业详情
|
|
|
- function addCenterIpGrp(obj) {
|
|
|
- html = '<div class="input-group centerIp">' +
|
|
|
- '<input type="text" name="industry" class="form-control" id="ipInput" placeholder="请填写行业类型">' +
|
|
|
- '<span class="input-group-btn">' +
|
|
|
- '<button class="btn btn-info" type="button" data-toggle="tooltip" title="删除" id="delCenterIpGrp"><span class="glyphicon glyphicon-minus"></span></button>' +
|
|
|
- '</span>' +
|
|
|
- '</div>'
|
|
|
- obj.insertAdjacentHTML('beforebegin', html);
|
|
|
- }
|
|
|
-
|
|
|
- //更新行业详情
|
|
|
- function updateIndustrys(_id) {
|
|
|
- if (_id === "") {
|
|
|
- alert("参数id不存在");
|
|
|
+ /*保存企业库*/
|
|
|
+ function Add() {
|
|
|
+ var company_name = $("#s_company_name").val(); //采购单位名称
|
|
|
+ var history_name = $("#s_history_name").val(); //历史名称
|
|
|
+ var area_code = $("#s_area_code").val(); //行政区划代码
|
|
|
+ var type = $("#s_type").val(); //单位类型
|
|
|
+ var ranks = $("#s_ranks").val(); //行政级别
|
|
|
+ var province = $("#s_province").val(); //省份
|
|
|
+ var city = $("#s_city").val(); //城市
|
|
|
+ var district = $("#s_district").val(); //区县
|
|
|
+ var buyerclass = $("#s_buyerclass").val(); //采购单位类型
|
|
|
+ var address = $("#s_address").val(); //采购单位地址
|
|
|
+ var wechat_accounts = $("#s_wechat_accounts").val(); //微信公众号
|
|
|
+ var website = $("#s_website").val(); //网址
|
|
|
+ var contact = editor_add.getText(); //联系人
|
|
|
+ if (company_name === "") {
|
|
|
+ alert("红色标签的表单不能为空!");
|
|
|
+ return
|
|
|
+ } else if (contact === JSON.stringify(vastrjson, null, 2)) {
|
|
|
+ alert("联系人的表单未填写!");
|
|
|
return
|
|
|
}
|
|
|
- var params = $("#update-dataform").serialize();
|
|
|
- // console.log(_id, params);
|
|
|
- $.ajax({
|
|
|
- type: "POST",
|
|
|
- url: "/admin/audit/query_qyk/UpdateIndustrys",
|
|
|
- data: params + "&_id=" + _id,
|
|
|
- success: function (msg) {
|
|
|
- $("#info_data").modal("hide");
|
|
|
- if (msg.data) {
|
|
|
- alert("success");
|
|
|
- } else {
|
|
|
- alert("更新失败");
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
- $(document).on('click', '#delCenterIpGrp', function () {
|
|
|
- var el = this.parentNode.parentNode;
|
|
|
- if (confirm('您确定要删除选中的命令?')) {
|
|
|
- el.parentNode.removeChild(el);
|
|
|
- }
|
|
|
- });
|
|
|
|
|
|
- //详细联系方式
|
|
|
- function showTels(_id) {
|
|
|
- $("#infos").html("");
|
|
|
- $("#info_title").html("详细联系方式");
|
|
|
- $.post("/admin/audit/query_qyk/ById", {
|
|
|
- "_id": _id,
|
|
|
- "q_field": "contact",
|
|
|
+
|
|
|
+ //打印测试
|
|
|
+ console.log(company_name,contact);
|
|
|
+
|
|
|
+ return
|
|
|
+ //新增采购单位api
|
|
|
+ $.post("/admin/audit/buyer_info/save", {
|
|
|
+ "company_name": company_name,
|
|
|
+ "history_name": history_name,
|
|
|
+ "area_code": area_code,
|
|
|
+ "type": type,
|
|
|
+ "ranks": ranks,
|
|
|
+ "province": province,
|
|
|
+ "city": city,
|
|
|
+ "district": district,
|
|
|
+ "buyerclass": buyerclass,
|
|
|
+ "address": address,
|
|
|
+ "wechat_accounts": wechat_accounts,
|
|
|
+ "website": website,
|
|
|
+ "contact":contact
|
|
|
}, function (data) {
|
|
|
if (data && data.rep) {
|
|
|
- // console.log(data);
|
|
|
- // var tmp = "<div class='row'>";
|
|
|
- var tmp = "";
|
|
|
- for (var i in data.data.contact) {
|
|
|
- tmp += "<div class='row'>" +
|
|
|
- "<div class=\"col-lg-10\">" +
|
|
|
- '<h1><div class="input-group centerIp">' +
|
|
|
- '<input type="text" name="contact_persons" class="form-control" id="ipInput" placeholder="请填写联系人" value=' + data.data.contact[i].contact_person + '>' +
|
|
|
- '<select class="form-control" name="contact_types" value=' + data.data.contact[i].contact_type + '><option value ="法定代表人">法定代表人</option><option value ="项目联系人">项目联系人</option></select>' +
|
|
|
- '<input type="text" name="phones" class="form-control" id="ipInput" placeholder="请填写联系电话" value=' + data.data.contact[i].phone + '>' +
|
|
|
- '<select class="form-control" name="topscopeclasss" value=' + data.data.contact[i].topscopeclass + '><option value ="企业公示">企业公示</option><option value ="剑鱼标讯">剑鱼标讯</option></select>' +
|
|
|
- '<span class="input-group-btn">' +
|
|
|
- '<button class="btn btn-info" type="button" data-toggle="tooltip" title="删除" id="delCenterIpGrp"><span class="glyphicon glyphicon-minus"></span></button>' +
|
|
|
- '</span>' +
|
|
|
- '</div><h1>' +
|
|
|
- '</div></div>';
|
|
|
- // console.log(i, data.data.contact[i]);
|
|
|
- }
|
|
|
- tmp = tmp +
|
|
|
- "<div class='row'>" +
|
|
|
- "<div class=\"col-lg-10\">" +
|
|
|
- "<button class='btn btn-info col-md-3' type='button' id='addCenterIpGrpBtn' onclick='addCenterIpGrpTels(this)' >新增联系方式</button> " +
|
|
|
- "<button type='button' class='btn btn-sm btn-default col-md-offset-5 col-md-2' data-dismiss='modal' aria-label='Close'>取消</button>" +
|
|
|
- "<button type='button' class='btn btn-sm btn-danger col-md-2' onclick='updateTels(\"" + _id + "\")'>保存</button>" +
|
|
|
- "</div>" +
|
|
|
- "</div>";
|
|
|
- $("#infos").html(tmp);
|
|
|
+ $("#myModal").modal("hide");
|
|
|
+ alert("保存成功");
|
|
|
+ setTimeout(function () {
|
|
|
+ ttable.search(company_name).draw();
|
|
|
+ // history.go(0) //刷新本页
|
|
|
+ }, 1500) //停1.5秒
|
|
|
+
|
|
|
} else {
|
|
|
alert("内部错误");
|
|
|
}
|
|
|
- }, 'json');
|
|
|
- $("#info_data").modal("show");
|
|
|
+ }, 'json')
|
|
|
}
|
|
|
|
|
|
- //添加联系方式
|
|
|
- function addCenterIpGrpTels(obj) {
|
|
|
- html = '<h1><div class="input-group centerIp">' +
|
|
|
- '<input type="text" name="contact_persons" class="form-control" id="ipInput" placeholder="请填写联系人">' +
|
|
|
- '<select class="form-control" name="contact_types"><option value ="法定代表人">法定代表人</option><option value ="项目联系人">项目联系人</option></select>' +
|
|
|
- '<input type="text" name="phones" class="form-control" id="ipInput" placeholder="请填写联系电话">' +
|
|
|
- '<select class="form-control" name="topscopeclasss"><option value ="企业公示">企业公示</option><option value ="剑鱼标讯">剑鱼标讯</option></select>' +
|
|
|
- '<span class="input-group-btn">' +
|
|
|
- '<button class="btn btn-info" type="button" data-toggle="tooltip" title="删除" id="delCenterIpGrp"><span class="glyphicon glyphicon-minus"></span></button>' +
|
|
|
- '</span>' +
|
|
|
- '</div><h1>'
|
|
|
- obj.insertAdjacentHTML('beforebegin', html);
|
|
|
- }
|
|
|
-
|
|
|
- //更新联系方式
|
|
|
- function updateTels(_id) {
|
|
|
- if (_id === "") {
|
|
|
- alert("参数id不存在");
|
|
|
- return
|
|
|
- }
|
|
|
- var params = $("#update-dataform").serialize();
|
|
|
- console.log(params)
|
|
|
- $.ajax({
|
|
|
- type: "POST",
|
|
|
- url: "/admin/audit/query_qyk/UpdateTels",
|
|
|
- data: params + "&_id=" + _id,
|
|
|
- // contentType: "application/json; charset=utf-8",
|
|
|
- dataType: "json",
|
|
|
- traditional: true,
|
|
|
- success: function (msg) {
|
|
|
- $("#info_data").modal("hide");
|
|
|
- if (msg.data) {
|
|
|
- alert("success");
|
|
|
- } else {
|
|
|
- alert("更新失败");
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
//删除
|
|
|
function deleteQyk(_id) {
|
|
@@ -399,7 +266,7 @@
|
|
|
return
|
|
|
}
|
|
|
if (confirm("您确认要提交此操作?")) {
|
|
|
- $.post("/admin/audit/qiyeku_info/deleteQyk", {
|
|
|
+ $.post("/admin/audit/buyer_info/deleteQyk", {
|
|
|
"_id": _id,
|
|
|
}, function (data) {
|
|
|
if (data && data.rep) {
|
|
@@ -417,30 +284,45 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //编辑采购单位
|
|
|
function editdata(_obj) {
|
|
|
$("#infos").html("");
|
|
|
- $("#info_title").html("编辑企业库信息");
|
|
|
- com = "<div class=\"row form-group\">" +
|
|
|
- "<label for=\"lastname\" class=\"col-sm-2 control-label\" style=\"color: red;\">企业名称:</label>" +
|
|
|
- "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_company_name\" must=\"true\" value='" + _obj.company_name + "'></div>" +
|
|
|
- "</div><div class=\"row form-group\">" +
|
|
|
- "<label for=\"lastname\" class=\"col-sm-2 control-label\">别名:</label>" +
|
|
|
- "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_alias\" value='" + _obj.alias + "'></div>" +
|
|
|
- "</div><div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">省份:</label>" +
|
|
|
- "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_province\" value='" + _obj.province + "'></div>" +
|
|
|
- "</div><div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">城市:</label>" +
|
|
|
- "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_city\" value='" + _obj.city + "'></div>" +
|
|
|
- "</div><div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">区县:</label>" +
|
|
|
- "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_district\" value='" + _obj.district + "'></div>" +
|
|
|
- "</div><div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">注册资本:</label>" +
|
|
|
- "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_capital\" value='" + _obj.capital + "' placeholder=\"示例:45678.98元;456.78万元;1234.25;\"></div>" +
|
|
|
- "</div><div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">企业地址:</label>" +
|
|
|
- "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_company_address\" value='" + _obj.company_address + "'></div>" +
|
|
|
- "</div></div>" +
|
|
|
+ $("#info_title").html("编辑采购单位信息");
|
|
|
+ com ="<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\" style=\"color: red;\">采购单位名称:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_company_name\" must=\"true\" value='" + _obj.company_name + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">历史名称:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_history_name\" value='" + _obj.history_name + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">行政区划代码:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_area_code\" value='" + _obj.area_code + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">单位类型:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_type\" value='" + _obj.type + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">行政级别:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_ranks\" value='" + _obj.ranks + "' ></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">省份:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_province\" value='" + _obj.province + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">城市:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_city\" value='" + _obj.city + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">区县:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_district\" value='" + _obj.district + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">采购单位类型:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_buyerclass\" value='" + _obj.buyerclass + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">采购单位地址:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_address\" value='" + _obj.address + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">微信公众号:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_wechat_accounts\" value='" + _obj.wechat_accounts + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">网址:</label>" +
|
|
|
+ "<div class=\"col-sm-10\"><input type=\"text\" class=\"form-control\" id=\"s_website\" value='" + _obj.website + "'></div></div>" +
|
|
|
+ "<div class=\"row form-group\"><label for=\"lastname\" class=\"col-sm-2 control-label\">联系方式:</label>" +
|
|
|
+ "<div class=\"col-sm-10\" id='s_contact' style=\"height:250px\"></div>" +
|
|
|
"<div class=\"row form-group\">" +
|
|
|
- "<button type='button' class='btn btn-sm btn-default col-md-offset-5 col-md-2' data-dismiss='modal' aria-label='Close'>取消</button>" +
|
|
|
+
|
|
|
+ "<button type='button' class='btn btn-sm btn-default col-md-offset-2 col-md-2' data-dismiss='modal' aria-label='Close'>取消</button>" +
|
|
|
"<button type='button' class='btn btn-sm btn-danger col-md-2' onclick='updatedate(\"" + _obj._id + "\")'>更新</button></div>";
|
|
|
+
|
|
|
$("#infos").html(com);
|
|
|
+ $("#s_contact").html('');
|
|
|
+ var container = document.getElementById('s_contact');
|
|
|
+ showJson("add", vastrjson, container);
|
|
|
$("#info_data").modal("show");
|
|
|
}
|
|
|
|
|
@@ -449,27 +331,51 @@
|
|
|
alert("id不存在!");
|
|
|
return
|
|
|
}
|
|
|
- var company_name = $("#s_company_name").val();
|
|
|
- var alias = $("#s_alias").val();
|
|
|
- var province = $("#s_province").val();
|
|
|
- var city = $("#s_city").val();
|
|
|
- var district = $("#s_district").val();
|
|
|
- var capital = $("#s_capital").val();
|
|
|
- var company_address = $("#s_company_address").val();
|
|
|
+ var company_name = $("#s_company_name").val(); //采购单位名称
|
|
|
+ var history_name = $("#s_history_name").val(); //历史名称
|
|
|
+ var area_code = $("#s_area_code").val(); //行政区划代码
|
|
|
+ var type = $("#s_type").val(); //单位类型
|
|
|
+ var ranks = $("#s_ranks").val(); //行政级别
|
|
|
+ var province = $("#s_province").val(); //省份
|
|
|
+ var city = $("#s_city").val(); //城市
|
|
|
+ var district = $("#s_district").val(); //区县
|
|
|
+ var buyerclass = $("#s_buyerclass").val(); //采购单位类型
|
|
|
+ var address = $("#s_address").val(); //采购单位地址
|
|
|
+ var wechat_accounts = $("#s_wechat_accounts").val(); //微信公众号
|
|
|
+ var website = $("#s_website").val(); //网址
|
|
|
+ var contact = editor_add.getText(); //联系人
|
|
|
if (company_name === "") {
|
|
|
alert("红色标签的表单不能为空!");
|
|
|
return
|
|
|
+ } else if (contact === JSON.stringify(vastrjson, null, 2)) {
|
|
|
+ alert("联系人的表单未填写!");
|
|
|
+ return
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //打印测试
|
|
|
+ console.log(company_name,contact);
|
|
|
+
|
|
|
+ return
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//新增企业库api
|
|
|
- $.post("/admin/audit/qiyeku_info/save", {
|
|
|
+ $.post("/admin/audit/buyer_info/save", {
|
|
|
"_id": _id,
|
|
|
"company_name": company_name,
|
|
|
- "alias": alias,
|
|
|
+ "history_name": history_name,
|
|
|
+ "area_code": area_code,
|
|
|
+ "type": type,
|
|
|
+ "ranks": ranks,
|
|
|
"province": province,
|
|
|
"city": city,
|
|
|
"district": district,
|
|
|
- "capital": capital,
|
|
|
- "company_address": company_address,
|
|
|
+ "buyerclass": buyerclass,
|
|
|
+ "address": address,
|
|
|
+ "wechat_accounts": wechat_accounts,
|
|
|
+ "website": website,
|
|
|
+
|
|
|
}, function (data) {
|
|
|
if (data && data.rep) {
|
|
|
alert("更新成功");
|
|
@@ -483,4 +389,22 @@
|
|
|
}
|
|
|
}, 'json')
|
|
|
}
|
|
|
+ function showJson(ptype, content, container) {
|
|
|
+ var options = {
|
|
|
+ mode: 'code',
|
|
|
+ modes: ['code', 'tree'], // allowed modes
|
|
|
+ onError: function (err) {
|
|
|
+ alert(err.toString());
|
|
|
+ }
|
|
|
+ };
|
|
|
+ if (ptype == "add") {
|
|
|
+ editor_add = new JSONEditor(container, options, content);
|
|
|
+ } else if (ptype == "update") {
|
|
|
+ editor_update = new JSONEditor(container, options, content);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
</script>
|
|
|
+
|