feat: 供应商资源定价模块 + CRUD配置 + load_path更新
新增模型: supplier_resource_price (供应商资源定价表) 新增UI: supplier_resource_price_list/index.ui (定价管理界面) 新增DDL: supplier_resource_price建表语句 更新load_path: 添加定价CRUD路径权限
This commit is contained in:
parent
4eb24b0707
commit
c06d54d86a
10
json/supplier_resource_price_list.json
Normal file
10
json/supplier_resource_price_list.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"supplier_resource_price": {
|
||||
"params": {
|
||||
"supplier_org_id": {"type": "str"},
|
||||
"resource_type": {"type": "str"},
|
||||
"resource_ref_id": {"type": "str"},
|
||||
"status": {"type": "str"}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -529,3 +529,37 @@ CREATE INDEX supply_contracts_idx_sc_reseller ON supply_contracts(resellerid);
|
||||
CREATE INDEX supply_contracts_idx_sc_supplier ON supply_contracts(supplier_id);
|
||||
CREATE UNIQUE INDEX supply_contracts_idx_sc_code ON supply_contracts(resellerid,contract_code);
|
||||
|
||||
-- ./supplier_resource_price.json
|
||||
|
||||
drop table if exists supplier_resource_price;
|
||||
CREATE TABLE supplier_resource_price
|
||||
(
|
||||
`id` VARCHAR(32) NOT NULL comment '主键ID',
|
||||
`supplier_org_id` VARCHAR(32) NOT NULL comment '供应商机构ID',
|
||||
`resource_type` VARCHAR(32) NOT NULL comment '资源类型',
|
||||
`resource_ref_id` VARCHAR(32) NOT NULL comment '资源引用ID',
|
||||
`resource_ref_name` VARCHAR(255) comment '资源名称',
|
||||
`unit_price` double(15,8) DEFAULT '0' comment '统一单价',
|
||||
`price_unit` VARCHAR(32) NOT NULL comment '价格单位',
|
||||
`input_price` double(15,8) comment '输入单价(LLM专用)',
|
||||
`output_price` double(15,8) comment '输出单价(LLM专用)',
|
||||
`currency` CHAR(8) DEFAULT 'CNY' comment '货币',
|
||||
`effective_date` date NOT NULL comment '生效日期',
|
||||
`expiry_date` date comment '失效日期',
|
||||
`status` CHAR(1) DEFAULT '1' comment '状态',
|
||||
`created_at` datetime NOT NULL comment '创建时间',
|
||||
`updated_at` datetime comment '更新时间'
|
||||
,primary key(id)
|
||||
)
|
||||
CHARACTER SET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci
|
||||
engine=innodb
|
||||
comment '供应商资源定价表'
|
||||
;
|
||||
|
||||
CREATE INDEX supplier_resource_price_idx_srp_supplier ON supplier_resource_price(supplier_org_id);
|
||||
CREATE INDEX supplier_resource_price_idx_srp_resource ON supplier_resource_price(resource_type,resource_ref_id);
|
||||
CREATE INDEX supplier_resource_price_idx_srp_dates ON supplier_resource_price(effective_date,expiry_date);
|
||||
CREATE INDEX supplier_resource_price_idx_srp_status ON supplier_resource_price(status);
|
||||
CREATE UNIQUE INDEX supplier_resource_price_idx_srp_unique ON supplier_resource_price(supplier_org_id,resource_type,resource_ref_id,effective_date);
|
||||
|
||||
|
||||
63
models/supplier_resource_price.json
Normal file
63
models/supplier_resource_price.json
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"summary": [
|
||||
{
|
||||
"name": "supplier_resource_price",
|
||||
"title": "供应商资源定价表",
|
||||
"primary": ["id"],
|
||||
"catelog": "entity"
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{"name": "id", "title": "主键ID", "type": "str", "length": 32, "nullable": "no"},
|
||||
{"name": "supplier_org_id", "title": "供应商机构ID", "type": "str", "length": 32, "nullable": "no"},
|
||||
{"name": "resource_type", "title": "资源类型", "type": "str", "length": 32, "nullable": "no"},
|
||||
{"name": "resource_ref_id", "title": "资源引用ID", "type": "str", "length": 32, "nullable": "no"},
|
||||
{"name": "resource_ref_name", "title": "资源名称", "type": "str", "length": 255},
|
||||
{"name": "unit_price", "title": "统一单价", "type": "double", "length": 15, "dec": 8, "default": "0"},
|
||||
{"name": "price_unit", "title": "价格单位", "type": "str", "length": 32, "nullable": "no"},
|
||||
{"name": "input_price", "title": "输入单价(LLM专用)", "type": "double", "length": 15, "dec": 8},
|
||||
{"name": "output_price", "title": "输出单价(LLM专用)", "type": "double", "length": 15, "dec": 8},
|
||||
{"name": "currency", "title": "货币", "type": "char", "length": 8, "default": "CNY"},
|
||||
{"name": "effective_date", "title": "生效日期", "type": "date", "nullable": "no"},
|
||||
{"name": "expiry_date", "title": "失效日期", "type": "date"},
|
||||
{"name": "status", "title": "状态", "type": "char", "length": 1, "default": "1"},
|
||||
{"name": "created_at", "title": "创建时间", "type": "datetime", "nullable": "no"},
|
||||
{"name": "updated_at", "title": "更新时间", "type": "datetime"}
|
||||
],
|
||||
"indexes": [
|
||||
{"name": "idx_srp_supplier", "idxtype": "index", "idxfields": ["supplier_org_id"]},
|
||||
{"name": "idx_srp_resource", "idxtype": "index", "idxfields": ["resource_type", "resource_ref_id"]},
|
||||
{"name": "idx_srp_dates", "idxtype": "index", "idxfields": ["effective_date", "expiry_date"]},
|
||||
{"name": "idx_srp_status", "idxtype": "index", "idxfields": ["status"]},
|
||||
{"name": "idx_srp_unique", "idxtype": "unique", "idxfields": ["supplier_org_id", "resource_type", "resource_ref_id", "effective_date"]}
|
||||
],
|
||||
"codes": [
|
||||
{
|
||||
"field": "supplier_org_id",
|
||||
"table": "suppliers",
|
||||
"valuefield": "org_id",
|
||||
"textfield": "supplier_name"
|
||||
},
|
||||
{
|
||||
"field": "resource_type",
|
||||
"table": "product_management.appcodes_kv",
|
||||
"valuefield": "k",
|
||||
"textfield": "v",
|
||||
"cond": "parentid='resource_type'"
|
||||
},
|
||||
{
|
||||
"field": "price_unit",
|
||||
"table": "product_management.appcodes_kv",
|
||||
"valuefield": "k",
|
||||
"textfield": "v",
|
||||
"cond": "parentid='price_unit'"
|
||||
},
|
||||
{
|
||||
"field": "status",
|
||||
"table": "product_management.appcodes_kv",
|
||||
"valuefield": "k",
|
||||
"textfield": "v",
|
||||
"cond": "parentid='product_status'"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -61,6 +61,7 @@ PATHS_ANY = [
|
||||
"/supplychain/platform_supply_relations_list",
|
||||
"/supplychain/platform_supply_products_list",
|
||||
"/supplychain/product_supplier_mapping_list",
|
||||
"/supplychain/supplier_resource_price_list",
|
||||
]
|
||||
|
||||
# logined — 需要认证的页面和 API
|
||||
@ -206,6 +207,13 @@ PATHS_OPERATOR = [
|
||||
"/supplychain/api/query_platform_suppliers.dspy",
|
||||
"/supplychain/api/query_platform_products.dspy",
|
||||
"/supplychain/api/import_supplier_product.dspy",
|
||||
# Supplier resource pricing (operator manages)
|
||||
"/supplychain/supplier_resource_price_list",
|
||||
"/supplychain/supplier_resource_price_list/index.ui",
|
||||
"/supplychain/supplier_resource_price_list/get_supplier_resource_price.dspy",
|
||||
"/supplychain/supplier_resource_price_list/add_supplier_resource_price.dspy",
|
||||
"/supplychain/supplier_resource_price_list/update_supplier_resource_price.dspy",
|
||||
"/supplychain/supplier_resource_price_list/delete_supplier_resource_price.dspy",
|
||||
]
|
||||
|
||||
PATHS_SALE = [
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"分销协议产品折扣明细表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"分销协议表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"平台供销产品明细表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"平台内供销关系表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"产品供应映射表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"销售记账表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"二级分销商表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"二级分销商表",
|
||||
|
||||
73
wwwroot/supplier_resource_price_list/index.ui
Normal file
73
wwwroot/supplier_resource_price_list/index.ui
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"widgettype": "VBox",
|
||||
"options": {"width": "100%", "padding": "8px", "gap": "8px"},
|
||||
"subwidgets": [
|
||||
{
|
||||
"widgettype": "InlineForm",
|
||||
"id": "price_filter",
|
||||
"options": {
|
||||
"css": "card", "padding": "8px", "submit_label": "查询",
|
||||
"fields": [
|
||||
{"name": "supplier_org_id", "label": "供应商", "uitype": "str", "cwidth": 12},
|
||||
{"name": "resource_type", "label": "资源类型", "uitype": "code", "cwidth": 10,
|
||||
"data": [{"value": "", "text": "全部"}, {"value": "llm_model", "text": "大模型按量"}, {"value": "llm_monthly", "text": "大模型包月"}, {"value": "compute", "text": "算力"}]},
|
||||
{"name": "status", "label": "状态", "uitype": "code", "cwidth": 8,
|
||||
"data": [{"value": "", "text": "全部"}, {"value": "1", "text": "有效"}, {"value": "0", "text": "无效"}]}
|
||||
]
|
||||
},
|
||||
"binds": [{
|
||||
"wid": "self", "event": "submit",
|
||||
"actiontype": "script", "target": "price_table",
|
||||
"script": "var tbl = bricks.getWidgetById('price_table', bricks.app.root); if(tbl) await tbl.render(params);"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"widgettype": "Tabular",
|
||||
"id": "price_table",
|
||||
"options": {
|
||||
"width": "100%", "css": "card",
|
||||
"data_url": "{{entire_url('/supplychain/supplier_resource_price_list/get_supplier_resource_price.dspy')}}",
|
||||
"data_method": "GET", "page_rows": 20,
|
||||
"toolbar": {
|
||||
"tools": [
|
||||
{"name": "add_price", "label": "新增定价"}
|
||||
]
|
||||
},
|
||||
"row_options": {
|
||||
"browserfields": {
|
||||
"exclouded": ["id", "created_at", "updated_at"],
|
||||
"alters": {
|
||||
"supplier_org_id": {
|
||||
"uitype": "code", "valueField": "supplier_org_id", "textField": "supplier_org_id_text",
|
||||
"params": {"dbname": "supplychain", "table": "suppliers", "tblvalue": "org_id", "tbltext": "supplier_name", "valueField": "supplier_org_id", "textField": "supplier_org_id_text"},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
},
|
||||
"resource_type": {"uitype": "code", "data": [{"value": "llm_model", "text": "大模型按量"}, {"value": "llm_monthly", "text": "大模型包月"}, {"value": "compute", "text": "算力"}]},
|
||||
"price_unit": {"uitype": "code", "data": [{"value": "per_1k_tokens", "text": "每千tokens"}, {"value": "per_request", "text": "每次"}, {"value": "per_gpu_hour", "text": "每GPU时"}]},
|
||||
"status": {"uitype": "code", "data": [{"value": "1", "text": "有效"}, {"value": "0", "text": "无效"}]}
|
||||
}
|
||||
},
|
||||
"fields": [
|
||||
{"name": "supplier_org_id", "title": "供应商", "type": "str", "length": 32, "cwidth": 14},
|
||||
{"name": "resource_type", "title": "资源类型", "type": "str", "length": 32, "cwidth": 10},
|
||||
{"name": "resource_ref_id", "title": "资源ID", "type": "str", "length": 32, "cwidth": 12},
|
||||
{"name": "resource_ref_name", "title": "资源名称", "type": "str", "length": 255, "cwidth": 12},
|
||||
{"name": "unit_price", "title": "统一单价", "type": "double", "length": 15, "dec": 8, "cwidth": 10},
|
||||
{"name": "input_price", "title": "输入价", "type": "double", "length": 15, "dec": 8, "cwidth": 10},
|
||||
{"name": "output_price", "title": "输出价", "type": "double", "length": 15, "dec": 8, "cwidth": 10},
|
||||
{"name": "price_unit", "title": "单位", "type": "str", "length": 32, "cwidth": 8},
|
||||
{"name": "effective_date", "title": "生效日", "type": "date", "cwidth": 10},
|
||||
{"name": "expiry_date", "title": "失效日", "type": "date", "cwidth": 10},
|
||||
{"name": "status", "title": "状态", "type": "char", "length": 1, "cwidth": 6}
|
||||
]
|
||||
}
|
||||
},
|
||||
"binds": [{
|
||||
"wid": "self", "event": "add_price",
|
||||
"actiontype": "urlwidget", "target": "PopupWindow",
|
||||
"popup_options": {"title": "新增定价", "cwidth": 45, "cheight": 28},
|
||||
"options": {"url": "{{entire_url('/supplychain/supplier_resource_price_list/add_supplier_resource_price.dspy')}}"}
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"供应商表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"供销合同产品折扣明细表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"供销合同表",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
"cheight":40,
|
||||
|
||||
|
||||
"title":"供销记账表",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user