instrument-list.60d16c92.js 8.0 KB

1
  1. var I=Object.defineProperty,j=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable;var C=(o,n,e)=>n in o?I(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,g=(o,n)=>{for(var e in n||(n={}))V.call(n,e)&&C(o,e,n[e]);if(_)for(var e of _(n))B.call(n,e)&&C(o,e,n[e]);return o},S=(o,n)=>j(o,K(n));var p=(o,n,e)=>new Promise((i,l)=>{var c=s=>{try{d(e.next(s))}catch(r){l(r)}},f=s=>{try{d(e.throw(s))}catch(r){l(r)}},d=s=>s.done?i(s.value):Promise.resolve(s.value).then(c,f);d((e=e.apply(o,n)).next())});import{P as E}from"./index.801838ae.js";import{S as q}from"./index.f939e49e.js";import{h as P,i as z,c as A,j as O}from"./api.10b6a21d.js";import{g as R}from"./filters.de6e9e5f.js";import{C as w}from"./constant.ded25e36.js";import{g as U}from"./objectUtil.ec24ceed.js";import{d as N,a as x,r as k,u as M,B as L,i as t,q as $,l as u,_ as y,ce as T,a9 as h,p as m,k as v,ai as G,cf as H,H as b,cg as J,aa as Q,ch as W,bC as F}from"./index.16e8fdaf.js";import{f as X}from"./dateUtil.efbc23b8.js";import"./searchs.b637f0d6.js";import"./dayjs.min.5d831ce7.js";const Y=N({name:"role-operation",props:{type:{type:String,default:"add"},data:{type:Object,default:()=>{}}},emits:["close","getList"],setup(o,{slots:n,attrs:e,emit:i}){const l=x({name:null,defaultScore:null,code:null,transferFlag:!0}),c=k(!1),f=k(),d=M(),s=()=>p(this,null,function*(){f.value.validate(r=>p(this,null,function*(){if(r)return!1;try{c.value=!0,l.code&&(l.code=l.code.replace(/[,]/g,",")),o.type==="add"?(yield P(S(g({},l),{defaultScore:l.transferFlag?l.defaultScore:"STAVE"})),d.success("\u6DFB\u52A0\u6210\u529F")):o.type==="edit"&&(yield z(S(g({},l),{defaultScore:l.transferFlag?l.defaultScore:"STAVE",id:o.data.id})),d.success("\u4FEE\u6539\u6210\u529F")),i("close"),i("getList")}catch(a){}c.value=!1}))});return L(()=>p(this,null,function*(){if(o.type==="edit"){const r=o.data;l.name=r.name,l.defaultScore=r.defaultScore,l.code=r.code,l.transferFlag=r.transferFlag}})),()=>t("div",{style:"background: #fff; padding-top: 12px"},[t($,{model:l,ref:f,"label-placement":"left","label-width":"100px"},{default:()=>[t(u,{label:"\u4E50\u5668\u540D\u79F0",path:"name",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E50\u5668\u540D\u79F0"}]},{default:()=>[t(y,{value:l.name,"onUpdate:value":r=>l.name=r,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u540D\u79F0",clearable:!0,maxlength:10,showCount:!0},null)]}),t(u,{label:"\u652F\u6301\u8F6C\u7B80\u8C31",path:"transferFlag",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u652F\u6301\u8F6C\u7B80\u8C31",trigger:["input","blur"],type:"boolean"}]},{default:()=>[t(T,{value:l.transferFlag,"onUpdate:value":r=>l.transferFlag=r,options:[{label:"\u662F",value:!0},{label:"\u5426",value:!1}],placeholder:"\u8BF7\u9009\u62E9\u662F\u5426\u652F\u6301\u8F6C\u7B80\u8C31",onUpdateValue:r=>p(this,null,function*(){r||(l.defaultScore="STAVE")}),clearable:!0},null)]}),l.transferFlag&&t(u,{label:"\u9ED8\u8BA4\u8C31\u9762",path:"defaultScore",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762"}]},{default:()=>[t(T,{clearable:!0,value:l.defaultScore,"onUpdate:value":r=>l.defaultScore=r,placeholder:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762",options:U(w)},null)]}),t(u,{label:"\u4E50\u5668\u7F16\u7801",path:"code",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801"}]},{default:()=>[t(y,{value:l.code,"onUpdate:value":r=>l.code=r,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801",clearable:!0},null)]})]}),t(h,{justify:"end"},{default:()=>[t(m,{type:"default",onClick:()=>i("close")},{default:()=>[v("\u53D6\u6D88")]}),t(m,{type:"primary",onClick:()=>s(),loading:c.value},{default:()=>[v("\u4FDD\u5B58")]})]})])}}),ce=N({name:"instrument-list",setup(){const o=G(),n=M(),e=x({loading:!1,pagination:{page:1,rows:10,pageTotal:0},searchForm:{keyword:"",timer:null,startTime:null,endTime:null,defaultScore:null,code:null,operatorKeyword:null},dataList:[],showSave:!1,saveMode:"add",rowData:{}}),i=k(),l=()=>{e.pagination.page=1,r()},c=()=>{var a;(a=i.value)==null||a.submit()},f=a=>{const D=a.enableFlag?"\u505C\u7528":"\u542F\u7528";o.warning({title:"\u63D0\u793A",content:`\u662F\u5426${D}\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>p(this,null,function*(){try{yield O({id:a.id}),r(),n.success(`${D}\u6210\u529F`)}catch(Z){}})})},d=()=>{var a;(a=i.value)==null||a.reset()},s=()=>[{title:"\u7F16\u53F7",key:"id"},{title:"\u4E50\u5668\u540D\u79F0",key:"name"},{title:"\u4E50\u5668\u7F16\u7801",key:"code"},{title:"\u58F0\u90E8",key:"subjectName"},{title:"\u9ED8\u8BA4\u8C31\u9762",key:"defaultScore",render(a){return R(a.defaultScore,new Map(Object.entries(w)))}},{title:"\u64CD\u4F5C\u4EBA",key:"operator",render(a){return t("div",null,[t("div",null,[a.operatorName]),t("div",null,[a.updateTime])])}},{title:"\u72B6\u6001",key:"enableFlag",render(a){return t(W,{type:a.enableFlag?"primary":"default"},{default:()=>[a.enableFlag?"\u542F\u7528":"\u505C\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",render(a){return t(h,null,{default:()=>[b(t(m,{type:"primary",size:"small",text:!0,onClick:()=>{e.rowData=a,e.showSave=!0,e.saveMode="edit"}},{default:()=>[v("\u4FEE\u6539")]}),[[F("auth"),"musicalInstrument/update1750840718913437697"]]),b(t(m,{type:"primary",size:"small",text:!0,onClick:()=>f(a)},{default:()=>[a.enableFlag?"\u505C\u7528":"\u542F\u7528"]}),[[F("auth"),"musicalInstrument/enable1750840534934487042"]])]})}}],r=()=>p(this,null,function*(){try{e.loading=!0;const{data:a}=yield A(g(g(g({},e.pagination),e.searchForm),X(e.searchForm.timer,["startTime","endTime"])));e.loading=!1,e.pagination.pageTotal=Number(a.total),e.dataList=a.rows||[]}catch(a){e.loading=!1}});return L(()=>{r()}),()=>t("div",{class:"system-menu-container"},[t("div",{class:["section-container"]},[t(q,{ref:i,model:e.searchForm,onSubmit:l,onSetModel:a=>Object.assign(e.searchForm,a),saveKey:"instrument-list"},{default:()=>[t(u,{path:"keyword",label:"\u5173\u952E\u5B57"},{default:()=>[t(y,{placeholder:"\u8BF7\u8F93\u5165\u7F16\u53F7/\u540D\u79F0",value:e.searchForm.keyword,"onUpdate:value":a=>e.searchForm.keyword=a,clearable:!0},null)]}),t(u,{path:"defaultScore",label:"\u9ED8\u8BA4\u8C31\u9762"},{default:()=>[t(T,{options:U(w),value:e.searchForm.defaultScore,"onUpdate:value":a=>e.searchForm.defaultScore=a,placeholder:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762",clearable:!0},null)]}),t(u,{path:"code",label:"\u4E50\u5668\u7F16\u7801"},{default:()=>[t(y,{value:e.searchForm.code,"onUpdate:value":a=>e.searchForm.code=a,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801",clearable:!0},null)]}),t(u,{path:"operatorName",label:"\u64CD\u4F5C\u4EBA"},{default:()=>[t(y,{value:e.searchForm.operatorKeyword,"onUpdate:value":a=>e.searchForm.operatorKeyword=a,placeholder:"\u8BF7\u8F93\u5165\u64CD\u4F5C\u4EBA",clearable:!0},null)]}),t(u,{path:"updateTime",label:"\u64CD\u4F5C\u65F6\u95F4"},{default:()=>[t(H,{value:e.searchForm.timer,"onUpdate:value":a=>e.searchForm.timer=a,type:"daterange",clearable:!0},null)]}),t(u,null,{default:()=>[t(h,null,{default:()=>[t(m,{type:"primary",onClick:c},{default:()=>[v("\u641C\u7D22")]}),t(m,{type:"default",onClick:d},{default:()=>[v("\u91CD\u7F6E")]})]})]})]}),t(h,{style:{paddingBottom:"12px"}},{default:()=>[b(t(m,{type:"primary",onClick:()=>{e.rowData={},e.showSave=!0,e.saveMode="add"}},{default:()=>[v("\u6DFB\u52A0")]}),[[F("auth"),"musicalInstrument/save1750840633332858882"]])]}),t(J,{loading:e.loading,columns:s(),data:e.dataList,rowKey:a=>a.id},null),t(E,{page:e.pagination.page,"onUpdate:page":a=>e.pagination.page=a,pageSize:e.pagination.rows,"onUpdate:pageSize":a=>e.pagination.rows=a,pageTotal:e.pagination.pageTotal,"onUpdate:pageTotal":a=>e.pagination.pageTotal=a,onList:r,sync:!0,saveKey:"login-device"},null)]),t(Q,{show:e.showSave,"onUpdate:show":a=>e.showSave=a,preset:"dialog",showIcon:!1,title:e.saveMode==="add"?"\u65B0\u589E\u4E50\u5668":"\u4FEE\u6539\u4E50\u5668",style:{width:"500px"}},{default:()=>[t(Y,{type:e.saveMode,data:e.rowData,onClose:()=>e.showSave=!1,onGetList:r},null)]})])}});export{ce as default};