|
@@ -1,2 +1,268 @@
|
|
|
+{{template "inc"}}
|
|
|
+<!-- Main Header -->
|
|
|
+{{template "header"}}
|
|
|
+<!-- Left side column. 权限菜单 -->
|
|
|
+{{template "memu"}}
|
|
|
|
|
|
-buyer_list
|
|
|
+<div class="content-wrapper">
|
|
|
+ <section class="content-header">
|
|
|
+ <h1>
|
|
|
+ <small><button class="btn btn-primary" onclick="addbuyer()">新增采购单位</button></small>
|
|
|
+ </h1>
|
|
|
+ <ol class="breadcrumb">
|
|
|
+ <li><a href="/admin/buyermanager/list"><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">
|
|
|
+ <table id="datawinnerTable" class="table table-bordered table-hover">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>中标单位</th>
|
|
|
+ <th>来源</th>
|
|
|
+ <th>时间</th>
|
|
|
+ <th>审核</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <!-- /.box-body -->
|
|
|
+ </div>
|
|
|
+ <!-- /.box -->
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
+</div>
|
|
|
+
|
|
|
+<!--新增标签-->
|
|
|
+<div class="modal fade" id="modal-info-addbuyer">
|
|
|
+ <div class="modal-dialog">
|
|
|
+ <form id="addbuyer-dataform" class="form-horizontal" role="form">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
+ <span aria-hidden="true">×</span></button>
|
|
|
+ <h4 class="modal-title">新增采购单位</h4>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="code" id="labelname" class="col-sm-2 control-label">名称:</label>
|
|
|
+ <div class="col-sm-10">
|
|
|
+ <input class="form-control" id="buyername"></input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="code" id="labelname" class="col-sm-2 control-label">类别:</label>
|
|
|
+ <div class="col-sm-10" style="display:flex;">
|
|
|
+ <select class="form-control parentclass" id="parentclass" style="margin-right:15px;"></select>
|
|
|
+ <select class="form-control childclass" id="childclass"></select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-default" data-dismiss="modal" onclick="reset()">取消</button>
|
|
|
+ <button type="button" class="btn btn-primary" onclick="saveaddbuyer()">保存</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- /.modal-content -->
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <!-- /.modal-dialog -->
|
|
|
+</div>
|
|
|
+<!-- /.modal -->
|
|
|
+
|
|
|
+<!--类别标签-->
|
|
|
+<div class="modal fade" id="modal-info-class">
|
|
|
+ <div class="modal-dialog">
|
|
|
+ <form id="category-dataform" class="form-horizontal" role="form">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
+ <span aria-hidden="true">×</span></button>
|
|
|
+ <h4 class="modal-title" id="titleinfo">添加类别</h4>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="code" id="labelname" class="col-sm-2 control-label">类别:</label>
|
|
|
+ <div class="col-sm-10" style="display:flex;">
|
|
|
+ <select class="form-control parentclass" style="margin-right:15px;"></select>
|
|
|
+ <select class="form-control childclass"></select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+ <button type="button" class="btn btn-default" data-dismiss="modal" onclick="reset()">取消</button>
|
|
|
+ <button type="button" class="btn btn-primary" onclick="savecategory()">确认</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- /.modal-content -->
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ <!-- /.modal-dialog -->
|
|
|
+</div>
|
|
|
+<!-- /.modal -->
|
|
|
+
|
|
|
+{{template "dialog"}}
|
|
|
+{{template "footer"}}
|
|
|
+<script>
|
|
|
+var s_name = "";
|
|
|
+var id = "";
|
|
|
+var classifymap = {};
|
|
|
+var tabid = "";
|
|
|
+$(function () {
|
|
|
+ ttable=$('#datawinnerTable').DataTable({
|
|
|
+ "paging" : true,
|
|
|
+ "lengthChange": false,
|
|
|
+ "searching" : true,
|
|
|
+ "ordering" : false,
|
|
|
+ "info" : true,
|
|
|
+ "autoWidth" : false,
|
|
|
+ "ajax": {
|
|
|
+ "url": "/admin/buyer/data",
|
|
|
+ "type": "post"
|
|
|
+ },
|
|
|
+ "language": {
|
|
|
+ "url": "/res/dist/js/dataTables.chinese.lang"
|
|
|
+ },
|
|
|
+ "columns": [
|
|
|
+ { "data": "s_name"},
|
|
|
+ { "data": "s_source"},
|
|
|
+ { "data": "l_intime"},
|
|
|
+ { "data": "isaudit",render:function(val,a,row){
|
|
|
+ if(val == true){
|
|
|
+ return "是"
|
|
|
+ }else{
|
|
|
+ return "否"
|
|
|
+ }
|
|
|
+ }},
|
|
|
+ { "data": "_id",render:function(val,a,row){
|
|
|
+ if(row["isaudit"] == false){
|
|
|
+ return '<a class="btn btn-sm btn-danger" onclick="delbuyer(\''+val+'\')" >删除</a>'+
|
|
|
+ ' <a class="btn btn-sm btn-success" href="#" onclick="auditbuyer(\''+row.s_name+'\',\''+val+'\')">审核</a>'
|
|
|
+ }else{
|
|
|
+ return '<a class="btn btn-sm btn-danger" onclick="delbuyer(\''+val+'\')" >删除</a>'
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ ]
|
|
|
+ });
|
|
|
+})
|
|
|
+
|
|
|
+function addbuyer(){
|
|
|
+ //查询分类数据
|
|
|
+ getbuyerclass("modal-info-addbuyer");
|
|
|
+ $("#modal-info-addbuyer").modal("show");
|
|
|
+}
|
|
|
+
|
|
|
+function getbuyerclass(id){
|
|
|
+ tabid = id;
|
|
|
+ $("#"+id+" .parentclass").empty();
|
|
|
+ $("#"+id+" .childclass").empty();
|
|
|
+ $("#"+id+" .parentclass").append("<option value=''>--请选择--</option>");
|
|
|
+ $("#"+id+" .childclass").append("<option value=''>--请选择--</option>");
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/buyer/buyerclass",
|
|
|
+ type:"post",
|
|
|
+ success:function(data){
|
|
|
+ var classify = data.data;
|
|
|
+ for(var i in classify){
|
|
|
+ var name = classify[i]["s_name"];
|
|
|
+ classifymap[name] = classify[i]["child"];
|
|
|
+ $("#"+id+" .parentclass").append("<option value='"+name+"'>"+name+"</option>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+//新增
|
|
|
+function saveaddbuyer(){
|
|
|
+ var buyername = $("#buyername").val();
|
|
|
+ var parentclass = $("#modal-info-addbuyer .parentclass").val();
|
|
|
+ var childclass = $("#modal-info-addbuyer .childclass").val();
|
|
|
+ if(parentclass == "" || childclass == "" || buyername == ""){
|
|
|
+ alert("表单填写不完整!");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/buyer/addbuyer",
|
|
|
+ type:"post",
|
|
|
+ data:{"buyername":buyername,"parentclass":parentclass,"childclass":childclass},
|
|
|
+ success:function(r){
|
|
|
+ if(r.rep){
|
|
|
+ $("#modal-info-addbuyer").modal("hide");
|
|
|
+ showTip("保存成功", 1000, function() {});
|
|
|
+ }else{
|
|
|
+ showTip("保存失败", 1000, function() {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+//删除
|
|
|
+function delbuyer(_id){
|
|
|
+ showConfirm("确定删除?", function() {
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/buyer/delbuyer",
|
|
|
+ type:"post",
|
|
|
+ data:{"_id":_id},
|
|
|
+ success:function(r){
|
|
|
+ if(r.rep){
|
|
|
+ ttable.ajax.reload();
|
|
|
+ }else{
|
|
|
+ showTip("删除失败", 1000, function() {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//审核
|
|
|
+function auditbuyer(name,_id){
|
|
|
+ getbuyerclass("modal-info-class");
|
|
|
+ s_name = name;
|
|
|
+ id = _id;
|
|
|
+ $("#modal-info-class").modal("show");
|
|
|
+}
|
|
|
+
|
|
|
+function savecategory(){
|
|
|
+ var parentclass = $("#modal-info-class .parentclass").val();
|
|
|
+ var childclass = $("#modal-info-class .childclass").val();
|
|
|
+ if(parentclass == "" || childclass == ""){
|
|
|
+ alert("表单填写不完整!");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ $("#modal-info-class").modal("hide");
|
|
|
+ showConfirm("确定通过?", function() {
|
|
|
+ $.ajax({
|
|
|
+ url:"/admin/buyer/auditbuyer",
|
|
|
+ type:"post",
|
|
|
+ data:{"name":s_name,"parentclass":parentclass,"childclass":childclass,"id":id},
|
|
|
+ success:function(r){
|
|
|
+ if(r.rep){
|
|
|
+ ttable.ajax.reload();
|
|
|
+ }else{
|
|
|
+ showTip("审核失败", 1000, function() {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+$(document).ready(function(){
|
|
|
+ $(".parentclass").change(function(){
|
|
|
+ var parentname = $(this).val();
|
|
|
+ var child = classifymap[parentname];
|
|
|
+ $(".childclass").empty();
|
|
|
+ if(child == undefined || child.length == 0 ){
|
|
|
+ $(".childclass").append("<option value=''>--请选择--</option>");
|
|
|
+ }else{
|
|
|
+ for(var i in child){
|
|
|
+ $(".childclass").append("<option value='"+child[i]+"'>"+child[i]+"</option>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+});
|
|
|
+</script>
|