var x=Object.defineProperty,M=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var T=(n,o,e)=>o in n?x(n,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[o]=e,f=(n,o)=>{for(var e in o||(o={}))z.call(o,e)&&T(n,e,o[e]);if(_)for(var e of _(o))q.call(o,e)&&T(n,e,o[e]);return n},j=(n,o)=>M(n,P(o));var p=(n,o,e)=>new Promise((u,s)=>{var c=i=>{try{d(e.next(i))}catch(l){s(l)}},g=i=>{try{d(e.throw(i))}catch(l){s(l)}},d=i=>i.done?u(i.value):Promise.resolve(i.value).then(c,g);d((e=e.apply(n,o)).next())});import{P as B}from"./index.87b9fa4d.js";import{S as E}from"./index.d7d5ed38.js";import{h as K,i as G,d as H,c as O,j as R}from"./api.d9dd8052.js";import{U as C}from"./index.ce333022.js";import{d as U,a as D,r as k,u as N,B as I,i as t,q as V,l as r,_ as y,a9 as v,p as m,k as h,ai as $,ce as A,cf as J,H as w,cg as W,aa as Q,ae as X,ch as Y,bC as S}from"./index.0d3a6da1.js";import{f as Z}from"./dateUtil.de35d5fd.js";import"./searchs.b637f0d6.js";import"./oss-file-upload.c3b04b9e.js";import"./dayjs.min.74ed5bab.js";const ee="_instrumentSave_1gfcu_1",ae="_updateFile_1gfcu_5",L={instrumentSave:ee,updateFile:ae},te=U({name:"role-operation",props:{type:{type:String,default:"add"},data:{type:Object,default:()=>{}}},emits:["close","getList"],setup(n,{slots:o,attrs:e,emit:u}){const s=D({name:null,code:null,img:null,media:null,enableFlag:null}),c=k(!1),g=k(),d=N(),i=()=>p(this,null,function*(){g.value.validate(l=>p(this,null,function*(){if(l)return!1;try{c.value=!0,s.code&&(s.code=s.code.replace(/[,]/g,",")),n.type==="add"?(yield K(f({},s)),d.success("\u6DFB\u52A0\u6210\u529F")):n.type==="edit"&&(yield G(j(f({},s),{id:n.data.id})),d.success("\u4FEE\u6539\u6210\u529F")),u("close"),u("getList")}catch(a){}c.value=!1}))});return I(()=>p(this,null,function*(){if(n.type==="edit"){const l=n.data;s.name=l.name,s.code=l.code,s.img=l.img,s.media=l.media,s.enableFlag=l.enableFlag}})),()=>t("div",{class:L.instrumentSave},[t(V,{model:s,ref:g,"label-placement":"left","label-width":"100px"},{default:()=>[t(r,{label:"\u4E50\u5668\u540D\u79F0",path:"name",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E50\u5668\u540D\u79F0"}]},{default:()=>[t(y,{value:s.name,"onUpdate:value":l=>s.name=l,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u540D\u79F0",clearable:!0,maxlength:10,showCount:!0},null)]}),t(r,{label:"\u4E50\u5668\u7F16\u7801",path:"code",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801"}]},{default:()=>[t(y,{value:s.code,"onUpdate:value":l=>s.code=l,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801",clearable:!0},null)]}),t(r,{label:"\u4E50\u5668\u5C01\u9762",path:"img",rule:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u4E50\u5668\u5C01\u9762",trigger:["input","blur"]}]},{default:()=>[t(C,{fileList:s.img,"onUpdate:fileList":l=>s.img=l,accept:".jpg,.jpeg,.png",cropper:!0,size:5,class:L.updateFile,bucketName:"news-info",options:{enlarge:2,autoCropWidth:150,autoCropHeight:250},tips:"\u8BF7\u4E0A\u4F20\u6BD4\u4F8B\u4E3A3:5\uFF0CJPG\u3001PNG\u56FE\u7247"},null)]}),t(r,{label:"\u58F0\u90E8\u97F3\u9891",path:"media",rule:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u58F0\u90E8\u97F3\u9891"}]},{default:()=>[t(C,{size:10,fileList:s.media,"onUpdate:fileList":l=>s.media=l,listType:"image",bucketName:"gyt",tips:"\u8BF7\u4E0A\u4F20\u97F3\u9891\u6587\u4EF6",accept:".mp3"},null)]})]}),t(v,{justify:"end"},{default:()=>[t(m,{type:"default",onClick:()=>u("close")},{default:()=>[h("\u53D6\u6D88")]}),t(m,{type:"primary",onClick:()=>i(),loading:c.value},{default:()=>[h("\u4FDD\u5B58")]})]})])}}),me=U({name:"instrument-list",setup(){const n=$(),o=N(),e=D({loading:!1,pagination:{page:1,rows:10,pageTotal:0},searchForm:{keyword:"",timer:null,startTime:null,endTime:null,code:null,operatorKeyword:null,subjectId:null},dataList:[],subjectList:[],showSave:!1,saveMode:"add",rowData:{}}),u=k(),s=()=>{e.pagination.page=1,l()},c=()=>{var a;(a=u.value)==null||a.submit()},g=a=>{const b=a.enableFlag?"\u505C\u7528":"\u542F\u7528";n.warning({title:"\u63D0\u793A",content:`\u662F\u5426${b}\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>p(this,null,function*(){try{yield R({id:a.id}),l(),o.success(`${b}\u6210\u529F`)}catch(F){}})})},d=()=>{var a;(a=u.value)==null||a.reset()},i=()=>[{title:"\u7F16\u53F7",key:"id"},{title:"\u4E50\u5668\u540D\u79F0",key:"name"},{title:"\u4E50\u5668\u5C01\u9762",key:"img",render(a){return a.img&&t(X,{src:a.img,style:{width:"80px",height:"80px"}},null)}},{title:"\u4E50\u5668\u7F16\u7801",key:"code"},{title:"\u58F0\u90E8",key:"subjectName"},{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(Y,{type:a.enableFlag?"primary":"default"},{default:()=>[a.enableFlag?"\u542F\u7528":"\u505C\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",render(a){return t(v,null,{default:()=>[w(t(m,{type:"primary",size:"small",text:!0,onClick:()=>{e.rowData=a,e.showSave=!0,e.saveMode="edit"}},{default:()=>[h("\u4FEE\u6539")]}),[[S("auth"),"musicalInstrument/update1750840718913437697"]]),w(t(m,{type:"primary",size:"small",text:!0,onClick:()=>g(a)},{default:()=>[a.enableFlag?"\u505C\u7528":"\u542F\u7528"]}),[[S("auth"),"musicalInstrument/enable1750840534934487042"]])]})}}],l=()=>p(this,null,function*(){try{e.loading=!0;const{data:a}=yield O(f(f(f({},e.pagination),e.searchForm),Z(e.searchForm.timer,["startTime","endTime"])));e.loading=!1,e.pagination.pageTotal=Number(a.total),e.dataList=a.rows||[]}catch(a){e.loading=!1}});return I(()=>p(this,null,function*(){try{const{data:a}=yield H({page:1,rows:1e3});((a==null?void 0:a.rows)||[]).forEach(F=>{e.subjectList.push({value:F.id,label:F.name})})}catch(a){}l()})),()=>t("div",{class:"system-menu-container"},[t("div",{class:["section-container"]},[t(E,{ref:u,model:e.searchForm,onSubmit:s,onSetModel:a=>Object.assign(e.searchForm,a)},{default:()=>[t(r,{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(r,{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(r,{label:"\u58F0\u90E8",path:"subjectId"},{default:()=>[t(A,{placeholder:"\u8BF7\u9009\u62E9\u58F0\u90E8",value:e.searchForm.subjectId,"onUpdate:value":a=>e.searchForm.subjectId=a,options:e.subjectList,clearable:!0,filterable:!0},null)]}),t(r,{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(r,{path:"updateTime",label:"\u64CD\u4F5C\u65F6\u95F4"},{default:()=>[t(J,{value:e.searchForm.timer,"onUpdate:value":a=>e.searchForm.timer=a,type:"daterange",clearable:!0},null)]}),t(r,null,{default:()=>[t(v,null,{default:()=>[t(m,{type:"primary",onClick:c},{default:()=>[h("\u641C\u7D22")]}),t(m,{type:"default",onClick:d},{default:()=>[h("\u91CD\u7F6E")]})]})]})]}),t(v,{style:{paddingBottom:"12px"}},{default:()=>[w(t(m,{type:"primary",onClick:()=>{e.rowData={},e.showSave=!0,e.saveMode="add"}},{default:()=>[h("\u6DFB\u52A0")]}),[[S("auth"),"musicalInstrument/save1750840633332858882"]])]}),t(W,{loading:e.loading,columns:i(),data:e.dataList,rowKey:a=>a.id},null),t(B,{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:l,sync:!0},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(te,{type:e.saveMode,data:e.rowData,onClose:()=>e.showSave=!1,onGetList:l},null)]})])}});export{me as default};