|
@@ -47,7 +47,7 @@
|
|
|
<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>
|
|
|
+ <h4 class="modal-title" id="buyertitleinfo"></h4>
|
|
|
</div>
|
|
|
<div class="modal-body">
|
|
|
<div class="form-group">
|
|
@@ -59,8 +59,8 @@
|
|
|
<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>
|
|
|
+ <select class="form-control" id="parentclass" style="margin-right:15px;"></select>
|
|
|
+ <select class="form-control" id="childclass"></select>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -75,44 +75,13 @@
|
|
|
<!-- /.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 bid = 1;
|
|
|
+menuActive("buyermanager")
|
|
|
$(function () {
|
|
|
ttable=$('#datawinnerTable').DataTable({
|
|
|
"paging" : true,
|
|
@@ -153,15 +122,18 @@ $(function () {
|
|
|
|
|
|
function addbuyer(){
|
|
|
//查询分类数据
|
|
|
+ bid = 1;
|
|
|
+ $("#buyertitleinfo").html("新增采购单位");
|
|
|
getbuyerclass("modal-info-addbuyer");
|
|
|
$("#modal-info-addbuyer").modal("show");
|
|
|
+ $("#buyername").val("");
|
|
|
}
|
|
|
-
|
|
|
-function getbuyerclass(id){
|
|
|
- $("#"+id+" .parentclass").empty();
|
|
|
- $("#"+id+" .childclass").empty();
|
|
|
- $("#"+id+" .parentclass").append("<option value=''>--请选择--</option>");
|
|
|
- $("#"+id+" .childclass").append("<option value=''>--请选择--</option>");
|
|
|
+//获取buyer分类
|
|
|
+function getbuyerclass(){
|
|
|
+ $("#parentclass").empty();
|
|
|
+ $("#childclass").empty();
|
|
|
+ $("#parentclass").append("<option value=''>--请选择--</option>");
|
|
|
+ $("#childclass").append("<option value=''>--请选择--</option>");
|
|
|
$.ajax({
|
|
|
url:"/admin/buyer/buyerclass",
|
|
|
type:"post",
|
|
@@ -170,20 +142,29 @@ function getbuyerclass(id){
|
|
|
for(var i in classify){
|
|
|
var name = classify[i]["s_name"];
|
|
|
classifymap[name] = classify[i]["child"];
|
|
|
- $("#"+id+" .parentclass").append("<option value='"+name+"'>"+name+"</option>");
|
|
|
+ $("#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();
|
|
|
+ var parentclass = $("#parentclass").val();
|
|
|
+ var childclass = $("#childclass").val();
|
|
|
if(parentclass == "" || childclass == "" || buyername == ""){
|
|
|
alert("表单填写不完整!");
|
|
|
return ;
|
|
|
}
|
|
|
+ if(bid == 1){//新增保存
|
|
|
+ add(buyername,parentclass,childclass);
|
|
|
+ }else{//审核保存确认
|
|
|
+ audit(parentclass,childclass);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//新增保存
|
|
|
+function add(buyername,parentclass,childclass){
|
|
|
$.ajax({
|
|
|
url:"/admin/buyer/addbuyer",
|
|
|
type:"post",
|
|
@@ -198,7 +179,6 @@ function saveaddbuyer(){
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
//删除
|
|
|
function delbuyer(_id){
|
|
|
showConfirm("确定删除?", function() {
|
|
@@ -219,25 +199,22 @@ function delbuyer(_id){
|
|
|
|
|
|
//审核
|
|
|
function auditbuyer(name,_id){
|
|
|
- getbuyerclass("modal-info-class");
|
|
|
- s_name = name;
|
|
|
+ bid = 2;
|
|
|
+ getbuyerclass();
|
|
|
id = _id;
|
|
|
- $("#modal-info-class").modal("show");
|
|
|
+ $("#buyername").val(name);
|
|
|
+ $("#buyertitleinfo").html("审核采购单位");
|
|
|
+ $("#modal-info-addbuyer").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");
|
|
|
+//审核确认
|
|
|
+function audit(parentclass,childclass){
|
|
|
+ var name = $("#buyername").val();
|
|
|
+ $("#modal-info-addbuyer").modal("hide");
|
|
|
showConfirm("确定通过?", function() {
|
|
|
$.ajax({
|
|
|
url:"/admin/buyer/auditbuyer",
|
|
|
type:"post",
|
|
|
- data:{"name":s_name,"parentclass":parentclass,"childclass":childclass,"id":id},
|
|
|
+ data:{"name":name,"parentclass":parentclass,"childclass":childclass,"id":id},
|
|
|
success:function(r){
|
|
|
if(r.rep){
|
|
|
ttable.ajax.reload();
|
|
@@ -250,15 +227,15 @@ function savecategory(){
|
|
|
}
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
- $(".parentclass").change(function(){
|
|
|
+ $("#parentclass").change(function(){
|
|
|
var parentname = $(this).val();
|
|
|
var child = classifymap[parentname];
|
|
|
- $(".childclass").empty();
|
|
|
+ $("#childclass").empty();
|
|
|
if(child == undefined || child.length == 0 ){
|
|
|
- $(".childclass").append("<option value=''>--请选择--</option>");
|
|
|
+ $("#childclass").append("<option value=''>--请选择--</option>");
|
|
|
}else{
|
|
|
for(var i in child){
|
|
|
- $(".childclass").append("<option value='"+child[i]+"'>"+child[i]+"</option>");
|
|
|
+ $("#childclass").append("<option value='"+child[i]+"'>"+child[i]+"</option>");
|
|
|
}
|
|
|
}
|
|
|
});
|