2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
import{o as J,ap as Se,bo as ke,be as Ce,q as d,r as S,v as l,D as o,b9 as xe,aw as Ee,u as a,b6 as Ue,b7 as De,b8 as W,bm as Ne,F as D,G as N,O as b,bn as qe,K as Te,L as c,bg as Be,s as v,ac as L,T as f,P as F,bj as Fe,bk as He,br as Pe,bi as Re,C as M,bp as Ae,c5 as Ie,bc as Le,bb as Me,bt as $e,ba as $,M as k,p as H}from"./.pnpm-BGZW0UGg.js";import{_ as Ke}from"./index.vue_vue_type_script_setup_true_lang-ByFSC-yR.js";import{_ as Oe}from"./index.vue_vue_type_script_setup_true_lang-CIGxhbMA.js";import{i as g,m as Ge}from"./index-CeIwrh_6.js";import{a as Ye,b as je,c as Qe}from"./doctor-CF92xvl4.js";import{e as ze}from"./tcm-o2aZele6.js";import{u as We}from"./usePaging-C4oc3vBq.js";const Je={class:"guahao-list"},Xe={class:"flex flex-wrap items-center gap-3 mb-4"},Ze={key:0,class:"text-sm text-gray-500"},et={class:"text-sm"},tt={class:"font-medium"},lt={class:"text-gray-500"},at={class:"text-xs text-gray-400"},nt={class:"text-gray-500"},ot={class:"text-sm"},st={key:0,class:"text-xs text-gray-400 truncate"},it={class:"flex justify-end mt-4"},rt={class:"text-sm text-gray-600 mb-4"},ut=J({name:"consumerPrescriptionGuahao"}),ht=J({...ut,setup(dt){const m=$({start_date:"",end_date:"",patient_name:"",doctor_name:"",assistant_id:void 0,status:"",channel_source:""}),X={start_date:"",end_date:"",patient_name:"",doctor_name:"",assistant_id:void 0,status:"",channel_source:""},{pager:E,getLists:U,resetPage:q}=We({fetchFun:Ye,params:m}),T=k([]),K=k(null),h=k([]);function Z(s){h.value=s}const ee=new Set(["自媒体4H","自媒体3Q","自媒体3H","自媒体2H","自媒体2Q"]);function B(s){return ee.has(String(s??"").trim())}const y=k([]),te=H(()=>{const s=n.channel_source;if(s===""||s==null)return"";const e=y.value.find(i=>String(i.value)===String(s));return e?String(e.name??"").trim():""}),O=H(()=>B(te.value)),le=H(()=>{const s=p.channel_source;if(s===""||s==null)return"";const e=y.value.find(i=>String(i.value)===String(s));return e?String(e.name??"").trim():""}),G=H(()=>B(le.value));function ae(s){const e=y.value.find(u=>String(u.value)===String(s)),i=e?String(e.name??"").trim():"";B(i)||(p.channel_source_detail="")}const C=k(!1),P=k(!1),p=$({channel_source:"",channel_source_detail:""});function ne(){if(h.value.length===0){g.msgWarning("请先勾选挂号记录");return}p.channel_source="",p.channel_source_detail="",C.value=!0}function oe(){p.channel_source="",p.channel_source_detail=""}async function se(){var s,e;if(h.value.length===0){g.msgWarning("请先勾选挂号记录");return}if(!p.channel_source){g.msgError("请选择渠道来源");return}if(G.value&&!p.channel_source_detail.trim()){g.msgError("请填写自媒体补充说明");return}P.value=!0;try{const i=h.value.map(u=>Number(u.id));await je({ids:i,channel_source:p.channel_source,channel_source_detail:p.channel_source_detail.trim()}),g.msgSuccess("批量修改成功"),C.value=!1,(e=(s=K.value)==null?void 0:s.clearSelection)==null||e.call(s),h.value=[],U()}finally{P.value=!1}}function ie(s){const e=y.value.find(u=>String(u.value)===String(s)),i=e?String(e.name??"").trim():"";B(i)||(n.channel_source_detail="")}const x=k(!1),R=k(!1),n=$({id:0,appointment_date:"",appointment_time:"",period:"morning",appointment_type:"video",status:1,remark:"",assistant_id:void 0,channel_source:"",channel_source_detail:""});function re(s){const e=String(s||"");return e.length>=11?e.slice(0,3)+"****"+e.slice(-4):e||"—"}function Y(s){const e=String(s||"");return e.length>=5?e.slice(0,5):e||"—"}function ue(){Object.assign(m,X),q()}function de(s){const e=String(s.period??s.type??"morning");return e==="afternoon"||e==="all"?e:"morning"}async function me(){try{const s=await ze();T.value=(s==null?void 0:s.lists)??s??[]}catch{T.value=[]}}async function pe(){try{const s=await Ge({type:"channels"}),e=((s==null?void 0:s.channels)||[]).filter(i=>i.status!==0);e.sort((i,u)=>{const r=Number((u==null?void 0:u.sort)??0)-Number((i==null?void 0:i.sort)??0);return r!==0?r:Number((u==null?void 0:u.id)??0)-Number((i==null?void 0:i.id)??0)}),y.value=e}catch{y.value=[]}}function ce(s){n.id=Number(s.id),n.appointment_date=String(s.appointment_date||""),n.appointment_time=Y(String(s.appointment_time||"")),n.period=de(s),n.appointment_type=String(s.appointment_type||"video"),n.status=Number(s.status),n.remark=String(s.remark||"");const e=s.appointment_assistant_id;n.assistant_id=e!=null&&e!==""?Number(e):void 0,n.channel_source=String(s.channel_source??s.channels??""),n.channel_source_detail=String(s.channel_source_detail??""),x.value=!0}function _e(){n.id=0,n.appointment_date="",n.appointment_time="",n.period="morning",n.appointment_type="video",n.status=1,n.remark="",n.assistant_id=void 0,n.channel_source="",n.channel_source_detail=""}async function fe(){if(!n.appointment_date){g.msgError("请选择预约日期");return}if(!n.appointment_time){g.msgError("请选择预约时间");return}if(!n.channel_source){g.msgError("请选择渠道来源");return}if(O.value&&!n.channel_source_detail.trim()){g.msgError("请填写自媒体补充说明");return}R.value=!0;try{const s={id:n.id,appointment_date:n.appointment_date,appointment_time:n.appointment_time,period:n.period,appointment_type:n.appointment_type,status:n.status,remark:n.remark,assistant_id:n.assistant_id??"",channel_source:n.channel_source,channel_source_detail:n.channel_source_detail.trim()};await Qe(s),g.msgSuccess("保存成功"),x.value=!1,U()}finally{R.value=!1}}return Se(()=>{me(),pe()}),ke(()=>{U()}),U(),(s,e)=>{const i=Ue,u=De,r=qe,V=Ne,w=Te,A=xe,j=Be,_=He,be=Pe,ve=Fe,ge=Ke,he=Ae,ye=Ie,I=Me,Ve=Le,Q=$e,z=Ce("perms"),we=Re;return d(),S("div",Je,[l(j,{class:"!border-none",shadow:"never"},{default:o(()=>[l(A,{class:"mb-[-16px]",model:a(m),inline:!0,onSubmit:e[7]||(e[7]=Ee(()=>{},["prevent"]))},{default:o(()=>[l(i,{label:"预约日期"},{default:o(()=>[l(Oe,{startTime:a(m).start_date,"onUpdate:startTime":e[0]||(e[0]=t=>a(m).start_date=t),endTime:a(m).end_date,"onUpdate:endTime":e[1]||(e[1]=t=>a(m).end_date=t)},null,8,["startTime","endTime"])]),_:1}),l(i,{label:"患者姓名"},{default:o(()=>[l(u,{modelValue:a(m).patient_name,"onUpdate:modelValue":e[2]||(e[2]=t=>a(m).patient_name=t),placeholder:"模糊搜索",clearable:"",class:"!w-[160px]",onKeyup:W(a(q),["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),l(i,{label:"医生"},{default:o(()=>[l(u,{modelValue:a(m).doctor_name,"onUpdate:modelValue":e[3]||(e[3]=t=>a(m).doctor_name=t),placeholder:"模糊搜索",clearable:"",class:"!w-[140px]",onKeyup:W(a(q),["enter"])},null,8,["modelValue","onKeyup"])]),_:1}),l(i,{label:"医助"},{default:o(()=>[l(V,{modelValue:a(m).assistant_id,"onUpdate:modelValue":e[4]||(e[4]=t=>a(m).assistant_id=t),placeholder:"全部",clearable:"",filterable:"",class:"!w-[180px]"},{default:o(()=>[(d(!0),S(D,null,N(a(T),t=>(d(),b(r,{key:t.id,label:t.name+(t.account?` (${t.account})`:""),value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"状态"},{default:o(()=>[l(V,{modelValue:a(m).status,"onUpdate:modelValue":e[5]||(e[5]=t=>a(m).status=t),placeholder:"全部",clearable:"",class:"!w-[130px]"},{default:o(()=>[l(r,{label:"已预约",value:1}),l(r,{label:"已取消",value:2}),l(r,{label:"已完成",value:3}),l(r,{label:"已过号",value:4})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"渠道"},{default:o(()=>[l(V,{modelValue:a(m).channel_source,"onUpdate:modelValue":e[6]||(e[6]=t=>a(m).channel_source=t),placeholder:"全部",clearable:"",filterable:"",class:"!w-[200px]"},{default:o(()=>[(d(!0),S(D,null,N(a(y),t=>(d(),b(r,{key:String(t.value),label:t.name,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(i,null,{default:o(()=>[l(w,{type:"primary",onClick:a(q)},{default:o(()=>[...e[24]||(e[24]=[c("查询",-1)])]),_:1},8,["onClick"]),l(w,{onClick:ue},{default:o(()=>[...e[25]||(e[25]=[c("重置",-1)])]),_:1})]),_:1})]),_:1},8,["model"])]),_:1}),l(j,{class:"!border-none mt-4",shadow:"never"},{default:o(()=>[v("div",Xe,[L((d(),b(w,{type:"primary",disabled:a(h).length===0,onClick:ne},{default:o(()=>[...e[26]||(e[26]=[c(" 批量修改渠道 ",-1)])]),_:1},8,["disabled"])),[[z,["doctor.appointment/edit"]]]),a(h).length>0?(d(),S("span",Ze," 已选 "+f(a(h).length)+" 条 ",1)):F("",!0)]),L((d(),b(ve,{ref_key:"tableRef",ref:K,"row-key":"id",data:a(E).lists,size:"large",stripe:"",onSelectionChange:Z},{default:o(()=>[l(_,{type:"selection",width:"48",align:"center","reserve-selection":""}),l(_,{label:"ID",prop:"id",width:"72",align:"center"}),l(_,{label:"诊单/患者","min-width":"140"},{default:o(({row:t})=>[v("div",et,[v("div",tt,f(t.patient_name||"—"),1),v("div",lt,f(re(t.patient_phone)),1),v("div",at,"诊单 #"+f(t.diagnosis_id??t.patient_id),1)])]),_:1}),l(_,{label:"医生",prop:"doctor_name",width:"100","show-overflow-tooltip":""}),l(_,{label:"医助",prop:"assistant_name",width:"100","show-overflow-tooltip":""}),l(_,{label:"预约时间","min-width":"128"},{default:o(({row:t})=>[v("div",null,f(t.appointment_date),1),v("div",nt,f(Y(t.appointment_time))+" · "+f(t.period_desc),1)]),_:1}),l(_,{label:"类型",prop:"appointment_type_desc",width:"100"}),l(_,{label:"渠道","min-width":"130","show-overflow-tooltip":""},{default:o(({row:t})=>[v("div",ot,f(t.channel_source_desc||"—"),1),t.channel_source_detail?(d(),S("div",st,f(t.channel_source_detail),1)):F("",!0)]),_:1}),l(_,{label:"状态",width:"96",align:"center"},{default:o(({row:t})=>[l(be,{type:t.status===1?"success":t.status===2?"info":t.status===3?"primary":"danger",size:"small",effect:"light"},{default:o(()=>[c(f(t.status_desc),1)]),_:2},1032,["type"])]),_:1}),l(_,{label:"备注",prop:"remark","min-width":"120","show-overflow-tooltip":""}),l(_,{label:"操作",width:"100",fixed:"right",align:"center"},{default:o(({row:t})=>[L((d(),b(w,{type:"primary",link:"",onClick:mt=>ce(t)},{default:o(()=>[...e[27]||(e[27]=[c(" 编辑 ",-1)])]),_:1},8,["onClick"])),[[z,["doctor.appointment/edit"]]])]),_:1})]),_:1},8,["data"])),[[we,a(E).loading]]),v("div",it,[l(ge,{modelValue:a(E),"onUpdate:modelValue":e[8]||(e[8]=t=>M(E)?E.value=t:null),onChange:a(U)},null,8,["modelValue","onChange"])])]),_:1}),l(Q,{modelValue:a(x),"onUpdate:modelValue":e[19]||(e[19]=t=>M(x)?x.value=t:null),title:"编辑挂号",width:"560px","destroy-on-close":"",onClosed:_e},{footer:o(()=>[l(w,{onClick:e[18]||(e[18]=t=>x.value=!1)},{default:o(()=>[...e[31]||(e[31]=[c("取消",-1)])]),_:1}),l(w,{type:"primary",loading:a(R),onClick:fe},{default:o(()=>[...e[32]||(e[32]=[c("保存",-1)])]),_:1},8,["loading"])]),default:o(()=>[l(A,{model:a(n),"label-width":"96px"},{default:o(()=>[l(i,{label:"预约日期",required:""},{default:o(()=>[l(he,{modelValue:a(n).appointment_date,"onUpdate:modelValue":e[9]||(e[9]=t=>a(n).appointment_date=t),type:"date","value-format":"YYYY-MM-DD",placeholder:"选择日期",class:"!w-full"},null,8,["modelValue"])]),_:1}),l(i,{label:"预约时间",required:""},{default:o(()=>[l(ye,{modelValue:a(n).appointment_time,"onUpdate:modelValue":e[10]||(e[10]=t=>a(n).appointment_time=t),format:"HH:mm","value-format":"HH:mm",placeholder:"时间",class:"!w-full"},null,8,["modelValue"])]),_:1}),l(i,{label:"时段",required:""},{default:o(()=>[l(Ve,{modelValue:a(n).period,"onUpdate:modelValue":e[11]||(e[11]=t=>a(n).period=t)},{default:o(()=>[l(I,{label:"morning"},{default:o(()=>[...e[28]||(e[28]=[c("上午",-1)])]),_:1}),l(I,{label:"afternoon"},{default:o(()=>[...e[29]||(e[29]=[c("下午",-1)])]),_:1}),l(I,{label:"all"},{default:o(()=>[...e[30]||(e[30]=[c("全天",-1)])]),_:1})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"问诊类型",required:""},{default:o(()=>[l(V,{modelValue:a(n).appointment_type,"onUpdate:modelValue":e[12]||(e[12]=t=>a(n).appointment_type=t),class:"!w-full"},{default:o(()=>[l(r,{label:"视频问诊",value:"video"}),l(r,{label:"图文问诊",value:"text"}),l(r,{label:"电话问诊",value:"phone"})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"渠道来源",required:""},{default:o(()=>[l(V,{modelValue:a(n).channel_source,"onUpdate:modelValue":e[13]||(e[13]=t=>a(n).channel_source=t),placeholder:"请选择渠道来源",filterable:"",class:"!w-full",onChange:ie},{default:o(()=>[(d(!0),S(D,null,N(a(y),t=>(d(),b(r,{key:String(t.value),label:t.name,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(O)?(d(),b(i,{key:0,label:"自媒体补充",required:""},{default:o(()=>[l(u,{modelValue:a(n).channel_source_detail,"onUpdate:modelValue":e[14]||(e[14]=t=>a(n).channel_source_detail=t),maxlength:"128","show-word-limit":"",placeholder:"请输入自媒体相关补充内容",clearable:"",class:"!w-full"},null,8,["modelValue"])]),_:1})):F("",!0),l(i,{label:"状态",required:""},{default:o(()=>[l(V,{modelValue:a(n).status,"onUpdate:modelValue":e[15]||(e[15]=t=>a(n).status=t),class:"!w-full"},{default:o(()=>[l(r,{label:"已预约",value:1}),l(r,{label:"已取消",value:2}),l(r,{label:"已完成",value:3}),l(r,{label:"已过号",value:4})]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"挂号医助"},{default:o(()=>[l(V,{modelValue:a(n).assistant_id,"onUpdate:modelValue":e[16]||(e[16]=t=>a(n).assistant_id=t),placeholder:"不修改可留空",clearable:"",filterable:"",class:"!w-full"},{default:o(()=>[(d(!0),S(D,null,N(a(T),t=>(d(),b(r,{key:t.id,label:t.name+(t.account?` (${t.account})`:""),value:t.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(i,{label:"备注"},{default:o(()=>[l(u,{modelValue:a(n).remark,"onUpdate:modelValue":e[17]||(e[17]=t=>a(n).remark=t),type:"textarea",rows:3,maxlength:"500","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"]),l(Q,{modelValue:a(C),"onUpdate:modelValue":e[23]||(e[23]=t=>M(C)?C.value=t:null),title:"批量修改渠道",width:"520px","destroy-on-close":"",onClosed:oe},{footer:o(()=>[l(w,{onClick:e[22]||(e[22]=t=>C.value=!1)},{default:o(()=>[...e[33]||(e[33]=[c("取消",-1)])]),_:1}),l(w,{type:"primary",loading:a(P),onClick:se},{default:o(()=>[...e[34]||(e[34]=[c("确定",-1)])]),_:1},8,["loading"])]),default:o(()=>[v("p",rt,"将对已选 "+f(a(h).length)+" 条挂号写入同一渠道来源(仅改渠道,不改其它字段)。",1),l(A,{model:a(p),"label-width":"96px"},{default:o(()=>[l(i,{label:"渠道来源",required:""},{default:o(()=>[l(V,{modelValue:a(p).channel_source,"onUpdate:modelValue":e[20]||(e[20]=t=>a(p).channel_source=t),placeholder:"请选择渠道来源",filterable:"",class:"!w-full",onChange:ae},{default:o(()=>[(d(!0),S(D,null,N(a(y),t=>(d(),b(r,{key:String(t.value),label:t.name,value:t.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(G)?(d(),b(i,{key:0,label:"自媒体补充",required:""},{default:o(()=>[l(u,{modelValue:a(p).channel_source_detail,"onUpdate:modelValue":e[21]||(e[21]=t=>a(p).channel_source_detail=t),maxlength:"128","show-word-limit":"",placeholder:"请输入自媒体相关补充内容",clearable:"",class:"!w-full"},null,8,["modelValue"])]),_:1})):F("",!0)]),_:1},8,["model"])]),_:1},8,["modelValue"])])}}});export{ht as default};
|