2 lines
7.6 KiB
JavaScript
Raw Permalink Normal View History

2025-06-02 21:34:56 +08:00
var e=Object.defineProperty,l=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,t=(l,a,o)=>a in l?e(l,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[a]=o;import{C as r,a as n,d as m,r as i,O as u,S as d,j as f,H as s,c as p,o as c,F as g,e as b,R as h,k as y,w as v,l as _,m as k,h as V,P as C,B as w,f as S,aw as N,Q as I}from"./index-C-c3zR6K.js";import{a as x}from"./data-Ds2MkwTF.js";import{l as D,g as j,d as O,u as P,a as U}from"./template-BNMhll00.js";const q={class:"app-container"},R={class:"dialog-footer"},$=r({name:"Template"}),F=Object.assign($,{setup(e){const r=n(),{proxy:$}=m(),F=i([]),T=i(!1),z=i(!0),E=i(!0),B=i([]),J=i(!0),Q=i(!0),H=i(0),K=i(""),A=u({formContentDialogVisible:!1,formSchema:"",formId:null}),G=u({form:{},queryParams:{pageNum:1,pageSize:10,formName:null},rules:{formName:[{required:!0,message:"表单名称不能为空",trigger:"blur"}],formVersion:[{required:!0,message:"表单版本不能为空",trigger:"blur"}],formStatus:[{required:!0,message:"发布状态不能为空",trigger:"change"}]}}),{queryParams:L,form:M,rules:W}=d(G);function X(){z.value=!0,D(L.value).then((e=>{F.value=e.rows,H.value=e.total,z.value=!1}))}function Y(){T.value=!1,Z()}function Z(){M.value={formId:null,formName:null,formSchema:null,formVersion:null,formStatus:null,remark:null,createBy:null,createTime:null,updateBy:null,updateTime:null,delFlag:null},$.resetForm("templateRef")}function ee(){L.value.pageNum=1,X()}function le(){$.resetForm("queryRef"),ee()}function ae(e){B.value=e.map((e=>e.formId)),J.value=1!=e.length,Q.value=!e.length}function oe(){r.push("/tool/build")}function te(e){Z();const l=e.formId||B.value;j(l).then((e=>{M.value=e.data,T.value=!0,K.value="修改单模板"}))}function re(){$.$refs.templateRef.validate((e=>{e&&(null!=M.value.formId?P(M.value).then((e=>{$.$modal.msgSuccess("修改成功"),T.value=!1,X()})):U(M.value).then((e=>{$.$modal.msgSuccess("新增成功"),T.value=!1,X()})))}))}function ne(e){const l=e.formId||B.value;$.$modal.confirm('是否确认删除单模板编号为"'+l+'"的数据项?').then((function(){return O(l)})).then((()=>{X(),$.$modal.msgSuccess("删除成功")})).catch((()=>{}))}function me(){$.download("form/template/export",((e,r)=>{for(var n in r||(r={}))a.call(r,n)&&t(e,n,r[n]);if(l)for(var n of l(r))o.call(r,n)&&t(e,n,r[n]);return e})({},L.value),`template_${(new Date).getTime()}.xlsx`)}const ie=i();function ue(){I((()=>{ie.value.getFormData().then((e=>{const l=JSON.stringify(e);x({formId:A.formId,dataContent:l}).then((()=>{A.formContentDialogVisible=!1,$.$modal.msgSuccess("提交成功")}))}))}))}return X(),(e,l)=>{const a=f("el-input"),o=f("el-form-item"),t=f("el-button"),r=f("el-form"),n=f("el-col"),m=f("right-toolbar"),i=f("el-row"),u=f("el-table-column"),d=f("el-link"),I=f("el-table"),x=f("pagination"),D=f("el-dialog"),O=f("v-form-render"),P=s("hasPermi"),U=s("loading");return c(),p("div",q,[g(b(r,{model:y(L),ref:"queryRef",inline:!0,"label-width":"68px"},{default:v((()=>[b(o,{label:"表单名称",prop:"formName"},{default:v((()=>[b(a,{modelValue:y(L).formName,"onUpdate:modelValue":l[0]||(l[0]=e=>y(L).formName=e),placeholder:"请输入表单名称",clearable:"",onKeyup:_(ee,["enter"])},null,8,["modelValue"])])),_:1}),b(o,null,{default:v((()=>[b(t,{type:"primary",icon:"Search",onClick:ee},{default:v((()=>l[10]||(l[10]=[k("搜索")]))),_:1}),b(t,{icon:"Refresh",onClick:le},{default:v((()=>l[11]||(l[11]=[k("重置")]))),_:1})])),_:1})])),_:1},8,["model"]),[[h,y(E)]]),b(i,{gutter:10,class:"mb8"},{default:v((()=>[b(n,{span:1.5},{default:v((()=>[g((c(),V(t,{type:"primary",plain:"",icon:"Plus",onClick:oe},{default:v((()=>l[12]||(l[12]=[k("新增")]))),_:1})),[[P,["form:template:add"]]])])),_:1}),b(n,{span:1.5},{default:v((()=>[g((c(),V(t,{type:"success",plain:"",icon:"Edit",disabled:y(J),onClick:te},{default:v((()=>l[13]||(l[13]=[k("修改")]))),_:1},8,["disabled"])),[[P,["form:template:edit"]]])])),_:1}),b(n,{span:1.5},{default:v((()=>[g((c(),V(t,{type:"danger",plain:"",icon:"Delete",disabled:y(Q),onClick:ne},{defa