|
- import{b as G,c as A,d as H,e as J,f as K}from"./indicatorTemplate-ca1642c9.js";import{a as Q,r,o as W,b as d,c as X,d as Y,e as v,f as l,h as a,i,F as Z,k as h,$ as ee,C as le,s as ae}from"./index-dd5fae99.js";const te={class:"flex justify-between items-center"},oe=["onClick"],ne=["onClick"],de=h({name:"appTemp"}),re=Object.assign(de,{setup(se){const{proxy:g}=ae(),p=Q({indexName:void 0}),_=r(),c=r(0),k=r([]),M=[{label:"序号",type:"index",width:"60"},{label:"指标名称",key:"indexName",prop:"indexName"},{label:"排序",key:"sort",prop:"sort",width:80},{label:"指标所属模块",key:"indexOwningModule",prop:"indexOwningModule"},{label:"指标类型",key:"indexType",prop:"indexType",width:80,render:n=>ee("span",n.indexType===1?"通用指标":n.indexType===2?"辅助指标":"-")},{label:"是否显示",key:"isDisplay",slot:"isDisplay",width:80},{label:"操作",slot:"action",width:"120",fixed:"right"}],m=async(n=_.value.pageParams)=>{var s;const e=await G({...n,...p});k.value=((s=e==null?void 0:e.data)==null?void 0:s.records)||[],c.value=e.data.total},O=()=>{m()},I=()=>{p.indexName=void 0,_.value.pageParams.pageNumber=1,_.value.pageParams.pageSize=10,m()},b=r(!1),D=r(),o=r({}),V=r(),S={indexName:[{required:!0,message:"请输入"}],indexOwningModule:[{required:!0,message:"请输入"}],sort:[{required:!0,message:"请输入"}],displayForm:[{required:!0,message:"请选择"}],indexType:[{required:!0,message:"请选择"}],indexScore:[{required:!0,message:"请输入"}],unit:[{required:!0,message:"请输入"}],indexDef:[{required:!0,message:"请输入"}]},y=r(!1),N=async(n,e)=>{if(n===2){const s=await A(e.id);o.value={...s.data}}D.value=n,b.value=!0,await le(),V.value.clearValidate()},z=async n=>{n&&await n.validate(async e=>{if(e){y.value=!0;const s={...o.value};try{await H(s),g.$message.success("提交成功!"),m(),y.value=!1,C(!0)}catch{y.value=!1}}})},C=()=>{o.value={},b.value=!1},B=n=>{g.$messageBox.confirm(`是否删除${n.indexName}?`,"提示!",{type:"warning"}).then(async()=>{await J(n.id),g.$message.success("删除成功!"),await m()})},P=async n=>{try{return await K(n.id,!n.isDisplay),g.$message.success(`${n.isDisplay?"禁用":"启用"}成功!`),m(),!0}catch{return!1}};return W(()=>{m()}),(n,e)=>{const s=d("el-input"),u=d("el-form-item"),T=d("el-col"),f=d("el-button"),R=d("el-row"),U=d("el-form"),$=d("el-card"),L=d("el-switch"),j=d("table-list"),q=d("el-input-number"),x=d("el-radio"),F=d("el-radio-group"),E=d("el-dialog");return X(),Y(Z,null,[v("div",null,[l($,{shadow:"never",class:"search mb-16"},{default:a(()=>[l(U,{"label-suffix":":",model:p,size:"small"},{default:a(()=>[l(R,{gutter:16},{default:a(()=>[l(T,{span:8},{default:a(()=>[l(u,{label:"指标名称"},{default:a(()=>[l(s,{modelValue:p.indexName,"onUpdate:modelValue":e[0]||(e[0]=t=>p.indexName=t),maxlength:"10",placeholder:"请输入"},null,8,["modelValue"])]),_:1})]),_:1}),l(T,{span:8},{default:a(()=>[l(u,{class:"btn"},{default:a(()=>[l(f,{type:"primary",onClick:O},{default:a(()=>e[11]||(e[11]=[i("查询")])),_:1}),l(f,{onClick:I},{default:a(()=>e[12]||(e[12]=[i("重置")])),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),l($,{shadow:"never"},{header:a(()=>[v("div",te,[e[14]||(e[14]=v("span",null,"指标列表",-1)),l(f,{type:"primary",size:"small",icon:"Plus",onClick:e[1]||(e[1]=t=>N(1))},{default:a(()=>e[13]||(e[13]=[i("新增指标")])),_:1})])]),default:a(()=>[l(j,{ref_key:"tableListRef",ref:_,column:M,data:k.value,total:c.value,onGetTableData:m},{isDisplay:a(({scope:t})=>[l(L,{modelValue:t.row.isDisplay,"onUpdate:modelValue":w=>t.row.isDisplay=w,"before-change":()=>P(t.row)},null,8,["modelValue","onUpdate:modelValue","before-change"])]),action:a(({scope:t})=>[v("a",{onClick:w=>N(2,t.row)},"编辑",8,oe),v("a",{class:"text-danger",onClick:w=>B(t.row)},"删除",8,ne)]),_:1},8,["data","total"])]),_:1})]),l(E,{title:D.value===1?"新增指标":"编辑指标","model-value":b.value},{footer:a(()=>[l(f,{type:"primary",size:"small",loading:y.value,onClick:e[10]||(e[10]=t=>z(V.value))},{default:a(()=>e[20]||(e[20]=[i(" 保存 ")])),_:1},8,["loading"]),l(f,{size:"small",onClick:C},{default:a(()=>e[21]||(e[21]=[i(" 关闭 ")])),_:1})]),default:a(()=>[l(U,{ref_key:"formRef",ref:V,model:o.value,rules:S,"label-suffix":":","label-width":"130"},{default:a(()=>[l(u,{label:"指标名称",prop:"indexName"},{default:a(()=>[l(s,{modelValue:o.value.indexName,"onUpdate:modelValue":e[2]||(e[2]=t=>o.value.indexName=t),maxlength:50,placeholder:"请输入"},null,8,["modelValue"])]),_:1}),l(u,{label:"指标所属模板",prop:"indexOwningModule"},{default:a(()=>[l(s,{modelValue:o.value.indexOwningModule,"onUpdate:modelValue":e[3]||(e[3]=t=>o.value.indexOwningModule=t),maxlength:50,placeholder:"请输入"},null,8,["modelValue"])]),_:1}),l(u,{label:"排序",prop:"sort"},{default:a(()=>[l(q,{modelValue:o.value.sort,"onUpdate:modelValue":e[4]||(e[4]=t=>o.value.sort=t),min:1,precision:0,placeholder:"请输入"},null,8,["modelValue"])]),_:1}),l(u,{label:"展示形式",prop:"displayForm"},{default:a(()=>[l(F,{modelValue:o.value.displayForm,"onUpdate:modelValue":e[5]||(e[5]=t=>o.value.displayForm=t)},{default:a(()=>[l(x,{label:1},{default:a(()=>e[15]||(e[15]=[i("图表")])),_:1}),l(x,{label:2},{default:a(()=>e[16]||(e[16]=[i("文字")])),_:1}),l(x,{label:3},{default:a(()=>e[17]||(e[17]=[i("评分")])),_:1})]),_:1},8,["modelValue"])]),_:1}),l(u,{label:"指标类型",prop:"indexType"},{default:a(()=>[l(F,{modelValue:o.value.indexType,"onUpdate:modelValue":e[6]||(e[6]=t=>o.value.indexType=t)},{default:a(()=>[l(x,{label:1},{default:a(()=>e[18]||(e[18]=[i("通用指标")])),_:1}),l(x,{label:2},{default:a(()=>e[19]||(e[19]=[i("辅助指标")])),_:1})]),_:1},8,["modelValue"])]),_:1}),l(u,{label:"单位",prop:"unit"},{default:a(()=>[l(s,{modelValue:o.value.unit,"onUpdate:modelValue":e[7]||(e[7]=t=>o.value.unit=t),maxlength:50,placeholder:"请输入"},null,8,["modelValue"])]),_:1}),l(u,{label:"指标定义",prop:"indexDef"},{default:a(()=>[l(s,{modelValue:o.value.indexDef,"onUpdate:modelValue":e[8]||(e[8]=t=>o.value.indexDef=t),maxlength:500,placeholder:"请输入",type:"textarea","show-word-limit":""},null,8,["modelValue"])]),_:1}),l(u,{label:"指标分值",prop:"indexScore"},{default:a(()=>[l(q,{modelValue:o.value.indexScore,"onUpdate:modelValue":e[9]||(e[9]=t=>o.value.indexScore=t),max:100,min:0,precision:2,placeholder:"请输入"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title","model-value"])],64)}}});export{re as default};
|