| 1 |
- var te=Object.defineProperty,ae=Object.defineProperties;var oe=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var ne=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var E=(s,a,t)=>a in s?te(s,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[a]=t,M=(s,a)=>{for(var t in a||(a={}))ne.call(a,t)&&E(s,t,a[t]);if(X)for(var t of X(a))se.call(a,t)&&E(s,t,a[t]);return s},L=(s,a)=>ae(s,oe(a));var r=(s,a,t)=>new Promise((B,x)=>{var b=o=>{try{_(t.next(o))}catch(m){x(m)}},p=o=>{try{_(t.throw(o))}catch(m){x(m)}},_=o=>o.done?B(o.value):Promise.resolve(o.value).then(b,p);_((t=t.apply(s,a)).next())});import{S as ie}from"./SimpleCard-de9f202a.js";/* empty css */import{X as le}from"./XTForm-6038013b.js";import{L as ce}from"./List-f201b75c.js";/* empty css */import{d as re,r as w,aa as de,d8 as U,k as me,aZ as pe,o as h,m as q,af as f,g as y,f as c,q as g,ao as P,y as v,v as T,dh as F,t as ue,bz as fe,j as ve}from"./index-610a1d46.js";import{u as _e,a as he}from"./index-981858ed.js";import{r as we,a as ye,b as ge,c as xe,d as be,e as Ce}from"./recordTemplateApi-3cadddc3.js";import{u as ke,B as Pe}from"./useForm-c19ef35c.js";import{X as Te}from"./XTUpload.vue_vue_type_style_index_0_scoped_61a00cd1_lang-bad913d6.js";import{u as Fe}from"./index-985aa6f5.js";import{c as Be}from"./concat-809d683e.js";/* empty css */import"./index-b6d11df2.js";import"./index-72381a11.js";import"./index-4ed0dc84.js";import"./uuid-98bbe2a6.js";import"./download-a90dd227.js";import"./uniqBy-2b2a500d.js";import"./useWindowSizeFn-1829b247.js";const De=[{label:"模板名称",field:"name",required:!0,component:"Input",componentProps:{placeholder:"请输入模板名称"}},{label:"上传模板",field:"files",component:"XTUpload",componentProps:({formModel:s,schema:a})=>({api:_e,maxSize:10,maxNumber:1,helpText:"仅支持 docx 格式文件, 文件大小不超过10M",accept:[".docx"],onChange:t=>{s[a.field]=t}}),colProps:{span:24}},{field:"addBtn",component:"PlainSlot",label:"",slot:"addBtn"}],Ie=[{name:"name",componentType:"Input",placeholder:"请输入模板名称",prefix:"icon-xt-search",width:300}],Me={class:"px-4 py-4"},Se={class:"bg-white wrap"},$e={class:"doc-nav"},Re={class:"flex"},Ve={class:"doc-nav_list"},Ae={key:1},Ne={class:"flex justify-center pl-4 grow"},ze={class:"card-body_cnt"},Xe=["onClick"],Ee=re({__name:"index",setup(s){const{createConfirm:a,createMessage:t}=fe(),[B,{openModal:x}]=Fe(),b=w(""),p=w([]),_=w(""),o=w(""),m="child-text-",S=w(!0),C=w([]);de(()=>r(this,null,function*(){yield k()}));const[j,{setFieldsValue:O,appendSchemaByField:$,removeSchemaByField:D,getFieldsValue:G,resetFields:R,validate:Q}]=ke({labelWidth:200,schemas:De,showActionButtonGroup:!1,actionColOptions:{span:23},baseColProps:{span:12}});function k(){return r(this,null,function*(){var n;const e=yield we({name:b.value});e.length?(p.value=e.map(l=>({id:l.id,title:l.name,name:l.updateTime})),S.value&&(o.value=(n=e[0])==null?void 0:n.id,yield I(e[0]),S.value=!1)):p.value=[]})}function W(){return r(this,null,function*(){o.value="",_.value="",yield D(C.value),yield R()})}function Z(){return r(this,null,function*(){var e,n,l,d;try{const i=yield Q(),u=[];for(const z in i)z.includes(m)&&u.push(i[z]);const N={name:i.name,testContent:u,fileIds:(n=(e=i==null?void 0:i.files)==null?void 0:e[0])!=null&&n.id?[(d=(l=i==null?void 0:i.files)==null?void 0:l[0])==null?void 0:d.id]:[]},ee=o.value?yield ge(L(M({},N),{id:o.value})):yield xe(N);t.success(o.value?"编辑成功!":"新增成功!"),yield k(),o.value||(o.value=ee)}catch(i){t.error("请检查问题后再提交!")}})}function V(){return r(this,null,function*(){const e=G();if(!(e!=null&&e.files.length)){t.warning("请上传模板后再预览");return}const n=[];for(const u in e)u.includes(m)&&n.push(e[u]);const l=e.files.map(u=>u.id),d=yield be({testContent:n,fileIds:l}),i=yield he(d);x(!0,{id:d,realName:e.name,previewUrl:i})})}function H(){A(U(5),"")}function J(e){D([`${m}${e}`,`${e}`])}function K(e){return r(this,null,function*(){b.value=e.name?e.name:"",yield k()})}function I(e){return r(this,null,function*(){yield D(C.value),yield R(),o.value=e.id;const n=yield ye(e.id);_.value=n.name,n.testContent.length&&n.testContent.forEach(l=>{A(U(5),l)}),yield O(M({},n))})}function A(e,n){return r(this,null,function*(){$({field:`${m}${e}`,component:"InputTextArea",label:"测试文本",required:!0,defaultValue:n,componentProps:{rows:1},colProps:{span:23}},""),$({field:`${e}`,component:"Input",label:" ",slot:"add",colProps:{span:1}},""),C.value=Be(C.value,`${m}${e}`,e)})}function Y(e){return r(this,null,function*(){a({content:"你确定要删除?",iconType:"warning",onOk:()=>r(this,null,function*(){yield Ce([e.id]),t.success("删除成功!"),yield k(),p.value.length?yield I(p.value[0]):yield V()})})})}return(e,n)=>{const l=me("a-empty"),d=pe("auth");return h(),q("div",Me,[f("div",Se,[f("div",$e,[f("div",Re,[y(c(le),{"form-data":c(Ie),onChange:K},null,8,["form-data"])]),f("div",Ve,[p.value.length?(h(),g(c(ce),{key:0,type:"other",data:p.value,selected:o.value,width:339,isEdit:!1,onItemClick:I,onDelete:Y},null,8,["data","selected"])):(h(),q("div",Ae,[y(l)]))]),f("div",null,[P((h(),g(c(F),{type:"primary",onClick:W,preIcon:"icon-plus|iconfont",class:"mr-2 btn-text doc-nav_add",ghost:""},{default:v(()=>[T("添加记录模版")]),_:1})),[[d,["biz:template:add"]]])])]),f("div",Ne,[y(c(ie),{title:_.value,class:"card"},{headRight:v(()=>[o.value?P((h(),g(c(F),{key:0,onClick:V,class:"mr-2 btn-text btn-text_card",ghost:""},{default:v(()=>[T("预览")]),_:1})),[[d,["biz:template:add"]]]):ue("",!0),P((h(),g(c(F),{type:"primary",onClick:Z,class:"mr-2 btn-text"},{default:v(()=>[T("保存")]),_:1})),[[d,["biz:template:add"]]])]),body:v(()=>[f("div",ze,[y(c(Pe),{onRegister:c(j),layout:"vertical"},{addBtn:v(()=>[P((h(),g(c(F),{type:"primary",onClick:H,preIcon:"icon-plus|iconfont",class:"mr-2 btn-text_form",ghost:""},{default:v(()=>[T("添加测试文本")]),_:1})),[[d,["lab:deviceManage:add"]]])]),add:v(({field:i})=>[f("i",{class:"iconfont icon-xt-details_delete_default from-icon--del",onClick:u=>J(i)},null,8,Xe)]),_:1},8,["onRegister"])])]),_:1},8,["title"])])]),y(c(Te),{onRegister:c(B)},null,8,["onRegister"])])}}});const ct=ve(Ee,[["__scopeId","data-v-3db7484a"]]);export{ct as default};
|