import{D as u,U as m,A as d,G as p}from"./api.BIv7WJgX.js";import{G as h}from"./api.D3DSHzTB.js";import{W as o}from"./index.BBRX_LCt.js";import{aH as f,S as y,aj as w,ad as g}from"./vue.D1BjjNmv.js";function b(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!g(r)}const v=function({crudExpose:r}){const a=f(),l=async e=>await p(e),n=async({form:e,row:t})=>(e.id=t.id,await m(e)),i=async({row:e})=>await u(e.id),s=async({form:e})=>(e.document_link=e.document_link[0],await d(e)),c=e=>{console.log(e.document_link),a.push({path:"/system/contract/preview",query:{file:e.document_link,contractName:e.contract_name}})};return{crudOptions:{toolbar:{buttons:{search:{show:!1},refresh:{show:!1},compact:{show:!1},export:{text:"导出",type:"primary",size:"small",icon:"upload",circle:!1,display:!0,show:!1},columns:{show:!1}}},search:{col:{span:3},show:!0,autoSearch:!1,buttons:{search:{size:"small"},reset:{size:"small"}}},request:{pageRequest:l,addRequest:s,editRequest:n,delRequest:i},actionbar:{buttons:{add:{show:!0}}},rowHandle:{fixed:"right",width:200,buttons:{view:{text:"详细信息",iconRight:"View",type:"text",show:!0},edit:{iconRight:"Edit",type:"text",show:!1},remove:{iconRight:"Delete",type:"text",show:!1},Viewcontract:{text:"查看合约",iconRight:"",type:"text",show:!0,click:e=>{c(e.row)}}}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},contract_number:{title:"合约编号",search:{show:!0},type:"input",form:{rules:[{required:!0,message:"合约编号必填"}],component:{placeholder:"请输入合约编号"}},column:{minWidth:150}},document_link:{title:"合约文档",type:"file-uploader",form:{component:{uploader:{type:"form",action:"/api/uploadfile/",accept:".pdf,.doc,.docx",maxSize:10*1024*1024,limit:1},placeholder:"请上传PDF或Word格式的合约文档",helpMessage:"支持PDF、Word格式,文件大小不超过10MB"}},column:{show:!1,component:{render:({value:e})=>{if(!e)return"未上传";const t=e.split("/").pop();return y(w("el-link"),{type:"primary",href:e,target:"_blank"},b(t)?t:{default:()=>[t]})}},minWidth:180}},contract_name:{title:"合约名称",search:{show:!0},type:"input",form:{rules:[{required:!0,message:"合约名称必填"}],component:{placeholder:"请输入合约名称"}},column:{minWidth:180}},tenant:{title:"企业名称",search:{show:!0},type:"dict-select",dict:o({url:"/api/platform/tenants/",value:"tenant_id",label:"name",getData:e=>h({page:1,limit:20}).then(t=>t.data.results)}),form:{rules:[{required:!0,message:"企业名称必填"}],component:{placeholder:"请选择企业名称",filterable:!0,clearable:!0}},column:{minWidth:120}},contract_amount:{title:"合约金额",type:"number",form:{rules:[{required:!0,message:"合约金额必填"}],component:{placeholder:"请输入合约金额",precision:2,step:1e3}},column:{minWidth:120}},start_date:{title:"开始时间",type:"datetime",search:{show:!0},form:{rules:[{required:!0,message:"开始时间必填"}],component:{type:"datetime",valueFormat:"YYYY-MM-DD",placeholder:"请选择开始时间"}},column:{minWidth:150}},end_date:{title:"结束时间",type:"datetime",search:{show:!0},form:{rules:[{required:!0,message:"结束时间必填"}],component:{type:"datetime",valueFormat:"YYYY-MM-DD",placeholder:"请选择结束时间"}},column:{minWidth:150}},status:{title:"合约状态",search:{show:!0},type:"dict-select",form:{rules:[{required:!0,message:"合约状态必填"}],component:{placeholder:"请选择合约状态"}},column:{minWidth:120},dict:o({data:[{value:1,label:"服务中"},{value:2,label:"试用中"},{value:0,label:"已停用"}]})},contact_person:{title:"联系人",type:"input",form:{rules:[{required:!0,message:"联系人必填"}],component:{placeholder:"请输入联系人姓名"}},column:{minWidth:120}},contact_phone:{title:"联系电话",type:"input",form:{rules:[{required:!0,message:"联系电话必填"},{pattern:/^1[3-9]\d{9}$/,message:"请输入正确的手机号码"}],component:{placeholder:"请输入联系电话"}},column:{minWidth:130}},contact_email:{title:"联系邮箱",type:"input",form:{rules:[{required:!0,message:"联系邮箱必填"},{type:"email",message:"请输入正确的邮箱格式"}],component:{placeholder:"请输入联系邮箱"}},column:{minWidth:180}},service_description:{title:"服务描述",type:"textarea",form:{rules:[{required:!0,message:"服务描述必填"}],component:{placeholder:"请输入服务描述",showWordLimit:!0,maxlength:500,rows:3}},column:{minWidth:200}},payment_method:{title:"支付方式",type:"dict-select",form:{rules:[{required:!0,message:"支付方式必填"}],component:{placeholder:"请选择支付方式"}},column:{minWidth:120},dict:o({data:[{value:1,label:"一次性付款"},{value:2,label:"分期付款"},{value:3,label:"其他"}]})},remarks:{title:"备注",type:"textarea",form:{component:{placeholder:"请输入备注",showWordLimit:!0,maxlength:200,rows:2}},column:{minWidth:200}}}}}};export{v as createCrudOptions};