import{t as o,W as n}from"./index.Df8UJ10K.js";import{G as p}from"./api.DLjJ2FSX.js";import{aH as d,S as h,aj as f,ad as y}from"./vue.D1BjjNmv.js";const a="/api/platform-admin/contracts/";function w(t){return o({url:a,method:"get",params:t})}function g(t){return o({url:a,method:"post",data:t})}function b(t){return o({url:a+t.id+"/",method:"put",data:t})}function _(t){return o({url:a+t+"/",method:"delete",data:{id:t}})}function k(){return o({url:a,method:"get"})}function x(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!y(t)}const W=function({crudExpose:t}){const l=d(),i=async e=>await w(e),s=async({form:e,row:r})=>(e.id=r.id,await b(e)),u=async({row:e})=>await _(e.id),c=async({form:e})=>(e.document_link=e.document_link[0],await g(e)),m=e=>{console.log(e.document_link),l.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:i,addRequest:c,editRequest:s,delRequest:u},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=>{m(e.row)}}}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},search:{title:"关键字搜索",search:{show:!0,type:"input"},type:"input",form:{component:{placeholder:"请输入"},show:!1},column:{show:!1}},contract_no:{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 r=e.split("/").pop();return h(f("el-link"),{type:"primary",href:e,target:"_blank"},x(r)?r:{default:()=>[r]})}},minWidth:180}},title:{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:n({url:"/api/platform/tenants/",value:"tenant_id",label:"name",getData:e=>p({page:1,limit:20}).then(r=>r.data.results)}),form:{rules:[{required:!0,message:"企业名称必填"}],component:{placeholder:"请选择企业名称",filterable:!0,clearable:!0}},column:{minWidth:120}},total_amount:{title:"合约金额",type:"number",form:{rules:[{required:!0,message:"合约金额必填"}],component:{placeholder:"请输入合约金额",precision:2,step:1e3}},column:{minWidth:120}},effective_date:{title:"开始时间",type:"datetime",search:{show:!0},form:{rules:[{required:!0,message:"开始时间必填"}],component:{type:"datetime",valueFormat:"YYYY-MM-DD",placeholder:"请选择开始时间"}},column:{minWidth:150}},expire_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:n({data:[{value:1,label:"服务中"},{value:2,label:"试用中"},{value:0,label:"已停用"}]})},party_b_contact:{title:"联系人",type:"input",form:{rules:[{required:!0,message:"联系人必填"}],component:{placeholder:"请输入联系人姓名"}},column:{minWidth:120}},party_b_phone:{title:"联系电话",type:"input",form:{rules:[{required:!0,message:"联系电话必填"},{pattern:/^1[3-9]\d{9}$/,message:"请输入正确的手机号码"}],component:{placeholder:"请输入联系电话"}},column:{minWidth:130}},contract_type_display:{title:"服务描述",type:"textarea",form:{rules:[{required:!0,message:"服务描述必填"}],component:{placeholder:"请输入服务描述",showWordLimit:!0,maxlength:500,rows:3}},column:{minWidth:200}},remark:{title:"备注",type:"textarea",form:{component:{placeholder:"请输入备注",showWordLimit:!0,maxlength:200,rows:2}},column:{minWidth:200}}}}}},O=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:W},Symbol.toStringTag,{value:"Module"}));export{k as G,O as a,W as c};
