supplychain/wwwroot/api/contract_attach.ui
yumoqing fa5a1a3a8e feat: 供应合同和分销协议支持附件上传下载
contract_attach.ui: 附件管理页面(Tabular文件列表 + 上传按钮)
contract_attach_list.dspy: 查询合同附件列表
init.py: ensure_contract_folder() 自动创建附件目录
supply_contracts_list + distribution_agreements_list: 新增'合同附件'toolbar

实现: filemgr folder(contract_id=id, fiid=type)自动管理
2026-07-03 15:32:41 +08:00

84 lines
3.0 KiB
XML

{% set contract_id = params_kw.get('contract_id', '') %}
{% set contract_type = params_kw.get('contract_type', 'supply') %}
{% if contract_type == 'supply' %}
{% set fiid = 'supply_contract_attach' %}
{% else %}
{% set fiid = 'dist_agreement_attach' %}
{% endif %}
{% set folder = ensure_contract_folder(request, contract_id, fiid) %}
{
"widgettype": "VBox",
"options": {
"width": "100%",
"padding": "8px"
},
"subwidgets": [
{
"widgettype": "HBox",
"options": {
"alignItems": "center",
"marginBottom": "12px"
},
"subwidgets": [
{
"widgettype": "Title4",
"options": {
"fontWeight": "600",
"otext": "合同附件",
"i18n": true
}
},
{
"widgettype": "Filler"
},
{
"widgettype": "Button",
"options": {
"label": "上传附件",
"css": "primary",
"borderRadius": "6px",
"padding": "4px 12px"
},
"binds": [{
"wid": "self",
"event": "click",
"actiontype": "urlwidget",
"target": "PopupWindow",
"popup_options": {
"title": "上传附件",
"width": "450px",
"height": "200px",
"dismiss_events": ["cancel"]
},
"options": {
"url": "{{entire_url('/filemgr/upload_file.ui')}}?id={{folder}}&fiid={{fiid}}"
}
}]
}
]
},
{
"widgettype": "Tabular",
"options": {
"css": "card",
"width": "100%",
"height": "auto",
"data_url": "{{entire_url('contract_attach_list.dspy')}}?folderid={{folder}}&fiid={{fiid}}",
"data_method": "GET",
"page_rows": 50,
"row_options": {
"browserfields": {
"exclouded": [],
"cwidth": {}
},
"fields": [
{"name": "filename", "title": "文件名", "type": "str", "uitype": "str", "label": "文件名", "cwidth": 30},
{"name": "filesize", "title": "大小(bytes)", "type": "int", "uitype": "int", "label": "大小", "cwidth": 10},
{"name": "filetype", "title": "类型", "type": "str", "uitype": "str", "label": "类型", "cwidth": 8}
]
}
}
}
]
}