{% extends 'obj_form.html' %} {% load i18n %} {% load tj_filters %} {% block js %} {{ block.super }} $('.btn-save').click(function(){ var a=[]; $("#sel2-company option").each(function(){ a.push( {'id':$(this).val(), 'name':$(this).text() } ); }); $('#id_companys_only').val(JSON.stringify(a)); $.SubmitForm('#obj_form form','{{request.path}}'); }); $('.select2_multiple').on('dblclick','option',function(){ $(this).remove(); }); $('#obj_form .btn-add-company').click(function(){ var c=$('#sel-company').val(); var label=$('#sel-company').find("option:selected").text(); if (c==''){ toastr.error(label+"请先选择公司!", "操作错误:", {timeOut: 800, positionClass: "toast-center-center"} ); return; }else{ var e=false; $("#sel2-company option").each(function(){ if($(this).val() == c){ e=true; return false; } }); if(e){ toastr.error(label+"已在列表中!", "操作错误:", {timeOut: 800, positionClass: "toast-center-center"} ); return; }else{ $('#sel2-company').append(""); } }; }); {% endblock %} {% block form_content %} {{ block.super }}
{{ form.title }}
{{form.instance.parent.title}}
{{ form.icon }}
{{ form.url }}
{{ form.priority }}
{{ form.remark }}
{% trans '保存' %}
{% endblock %}