增加气站合同附件受控上传与预览
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
const platformApiBaseURL =
|
||||
const gasApiBaseURL =
|
||||
import.meta.env.VITE_API_BASE_URL ||
|
||||
'http://localhost:12426/heqi/platform/v1';
|
||||
'http://localhost:12426/heqi/gas/v1';
|
||||
|
||||
export type ContractAttachmentMetadata = {
|
||||
has_file: boolean;
|
||||
@@ -36,7 +36,7 @@ async function upload(file: File): Promise<ContractAttachmentUploadReply> {
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
const response = await fetch(
|
||||
`${platformApiBaseURL}/gasorder_contract/attachment/upload`,
|
||||
`${gasApiBaseURL}/gasorder_contract/attachment/upload`,
|
||||
{ method: 'POST', headers: authorizationHeaders(), body: form },
|
||||
);
|
||||
const payload = (await response.json()) as ApiEnvelope<ContractAttachmentUploadReply>;
|
||||
@@ -49,7 +49,7 @@ async function upload(file: File): Promise<ContractAttachmentUploadReply> {
|
||||
/** 使用受签名保护的清理凭证删除尚未绑定的临时文件。 */
|
||||
async function cleanup(cleanupToken: string): Promise<void> {
|
||||
const response = await fetch(
|
||||
`${platformApiBaseURL}/gasorder_contract/attachment/cleanup`,
|
||||
`${gasApiBaseURL}/gasorder_contract/attachment/cleanup`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...authorizationHeaders() },
|
||||
@@ -64,7 +64,7 @@ async function cleanup(cleanupToken: string): Promise<void> {
|
||||
/** 获取鉴权 PDF Blob;内部存储 URI 始终不会暴露给浏览器。 */
|
||||
async function load(identity: string): Promise<Blob> {
|
||||
const response = await fetch(
|
||||
`${platformApiBaseURL}/gasorder_contract/${encodeURIComponent(identity)}/attachment`,
|
||||
`${gasApiBaseURL}/gasorder_contract/${encodeURIComponent(identity)}/attachment`,
|
||||
{ headers: authorizationHeaders() },
|
||||
);
|
||||
if (!response.ok) throw new Error('合同附件不可用,请重新上传');
|
||||
|
||||
@@ -517,7 +517,7 @@ const gasOverrides: ResourceUiDefinition[] = [
|
||||
{ name: '重置密码', resource: '/user_account/:identity/password', method: 'PUT', fields: [f('password', { required: true })] },
|
||||
]),
|
||||
define('user_address', '用户地址', 'writable', [relation('user_account_identity', '/user_account', true), f('address', { required: true }), f('longitude'), f('latitude'), f('is_default')]),
|
||||
define('gasorder_contract', '配送合同', 'managed', [f('contract_no', { required: true, listCopyable: true }), relation('user_account_identity', '/user_account', true, { label: '用户账户', listLabel: '用户账户', listRelationNameOnly: true, showIdentityCopy: true, readonlyRelationText: true }), relation('delivery_basic_identity', '/delivery_basic', false, { label: '所属配送点', listLabel: '所属配送点', listRelationNameOnly: true, emptyText: '暂未指定', placeholder: '请选择默认配送点,可留空', showIdentityCopy: true }), f('title', { required: true }), f('terms'), f('file_uri'), f('default_delivery_fee'), f('signed_at', { required: true }), f('effective_at', { required: true }), f('expired_at')], 'list', [
|
||||
define('gasorder_contract', '配送合同', 'managed', [f('contract_no', { required: true, listCopyable: true }), relation('user_account_identity', '/user_account', true, { label: '用户账户', listLabel: '用户账户', listRelationNameOnly: true, showIdentityCopy: true, readonlyRelationText: true }), relation('delivery_basic_identity', '/delivery_basic', false, { label: '所属配送点', listLabel: '所属配送点', listRelationNameOnly: true, emptyText: '暂未指定', placeholder: '请选择默认配送点,可留空', showIdentityCopy: true }), f('title', { required: true }), f('terms'), f('file_uri', { label: '合同附件', type: 'contract-file' }), f('default_delivery_fee'), f('signed_at', { required: true }), f('effective_at', { required: true }), f('expired_at')], 'list', [
|
||||
{ name: '启用合同', resource: '/gasorder_contract/:identity/activate', fields: reason, visibleFor: { field: 'contract_status', values: [0] } },
|
||||
{ name: '续签合同', resource: '/gasorder_contract/:identity/renew', fields: [f('effective_at', { required: true }), f('expired_at'), ...reason], visibleFor: { field: 'contract_status', values: [11, 12, 13] } },
|
||||
{ name: '终止合同', resource: '/gasorder_contract/:identity/terminate', danger: true, fields: reason, visibleFor: { field: 'contract_status', values: [11] } },
|
||||
|
||||
Reference in New Issue
Block a user