{% extends 'obj_form.html' %} {% load i18n %} {% load tj_filters %} {% block js %} {{ block.super }} var editor = null; {% if cfg.product_photo %} var content = $("#id_product_content").val(); if (content!="None"){ $("#htmlEdit").html(content); } var E = window.wangEditor editor = new E('#htmlEdit') editor.config.uploadImgServer = '/mall/points_product/upload/' editor.config.uploadImgMaxLength = 20 editor.config.uploadImgMaxSize = 3 * 1024 * 1024 // 512kb editor.config.uploadFileName = 'file' editor.create() {% endif %} $('#data-content div.product_photo br').remove(); $('#photo-clear_id,#id_photo').removeClass('form-control'); var html='{% trans "属性名" %}'+ '{% trans "属性值" %}'+ '{% trans "单位" %}'+ '{% trans "备注" %}'; var s='',sel='', sSel=''; {% for p in props %} s=''; sel=''; html = html + ''+ '{{ p.label }}'+ ''+sel+''+ '{{ p.unit }}'+ ' '+ ''; {% endfor %} {% if props %} $('#tb_props tbody').html(html); {% endif %} $('#tb_props').append(''); $('.btn-save').click(function(){ if(editor){ var editorData = editor.txt.html(); $("#id_product_content").val(editorData); console.log(editorData); } $(this).hide(); //2022-06-12 if( !$.isEmpty($('#shelf_life_value').val()) ){ var period=$('#shelf_life_period').val(); var value=$('#shelf_life_value').val(); $('#id_shelf_life').val('{"period":"'+period+'","value":'+value+'}'); } $.SubmitForm('#obj_form form','{{request.path}}'); }); //2022-06-12 {% if form.instance.shelf_life %} $('#shelf_life_period').val('{{form.instance.shelf_life.period}}'); $('#shelf_life_value').val({{form.instance.shelf_life.value}}); {% endif %} //2020-11-24 $('#data-content .btn-delete').click(function(){ $.ajax({ url:'/obj/delete/product/{{form.instance.id}}/', success: function(data) { if(data.cnt>0){ toastr.success('当前产品已删除!', '操作成功:', {timeOut: 800, positionClass: "toast-center-center"} ); $.RefreshContent("/obj/list/product/"); }; }, }); }); $('#obj_form .product_photo a').click(function(event){ event.preventDefault(); var src=$(this).attr('href'); var i="
"; $.OpenCfmDlg($('#id_name').val(),i); }); {% endblock %} {% block subtitle-1 %} {% trans "产品管理" %} {% endblock %} {% block subtitle-2 %} {% trans "产品名称" %} {% endblock %} {% block form_content %} {{ block.super }} {% if has_series %}
{{ form.series }}
{% endif %} {% if form.instance.company.has_external_code %}
{{ form.external_code }}
{% endif %}
{{ form.name }}
{{ form.barcode }}
{{ form.pl }}
{{ form.standard }}
{{ form.processflow }}
{{ form.desc }}
{% ifequal user.company.id 26560 %}
{{ form.specs }}
{% endifequal %} {% if cfg.product_price %}
{{ form.price }}
{% endif %}
{{ form.remark|default_if_none:'' }}
{% if cfg.shelf_life %}
{% endif %} {% if cfg.product_photo %}
{{ form.photo }}
{% endif %}
{% if cfg.product_photo %}
产品介绍:
{% endif %}
{% if form.instance.id %} {% if is_show %} {% trans '删除' %} {% endif %} {% endif %} {% trans '保存' %}
{% endblock %}