Files
yuezi-saas/frontend/dist/assets/handovers-DrzjoVE_.js
T

1 line
5.8 KiB
JavaScript

import{$ as e,H as t,L as n,P as r,V as i,Wt as a,_ as o,d as s,et as c,f as l,i as u,lt as d,p as f,st as p,u as m,v as h,z as g}from"./runtime-core.esm-bundler-DbRZbT7v.js";import{o as _,s as v}from"./index-ZRE77JpD.js";import"./request-C_vMs8Bs.js";import{i as y}from"./office-DHw6Jomg.js";var b={class:`p-6 space-y-4`},x={class:`bg-white rounded-2xl border border-gray-100 shadow-sm p-4 flex items-center flex-wrap gap-3`},S={class:`bg-white rounded-2xl border border-gray-100 shadow-sm`},C={class:`flex items-center justify-between px-5 py-4 border-b border-gray-50`},w={class:`px-2`},T={class:`px-5 py-3 border-t border-gray-50`},E={__name:`index`,setup(E){let D=d([]),O=d(0),k=d(!1),A=d(!1),j=d(!1),M=p({shift_date:``,shift_type:``}),N=p({page:1,per_page:20}),P=d(null),F=p({shift_date:``,shift_type:1,content:``,issues:``}),I={1:`早班`,2:`中班`,3:`晚班`,4:`夜班`},L={1:``,2:`warning`,3:`danger`,4:`info`},R={0:`待确认`,1:`已确认`},z={0:`warning`,1:`success`},B={shift_date:[{required:!0,message:`请选择交接日期`}],shift_type:[{required:!0,message:`请选择班次`}],content:[{required:!0,message:`请输入交接内容`}]};async function V(){k.value=!0;try{let e=await y.getList({...M,...N});D.value=e.data?.list||e.data?.data||[],O.value=e.data?.total||0}finally{k.value=!1}}function H(){N.page=1,V()}function U(){Object.assign(M,{shift_date:``,shift_type:``}),H()}function W(){Object.assign(F,{shift_date:``,shift_type:1,content:``,issues:``}),A.value=!0}async function G(){P.value&&await P.value.validate(async e=>{if(e){j.value=!0;try{await y.create(F),v.success(`创建成功`),A.value=!1,V()}finally{j.value=!1}}})}async function K(e){await _.confirm(`确定确认接班吗?`,`确认接班`,{type:`warning`}),await y.confirm(e.id),v.success(`确认成功`),V()}function q(e){N.page=e,V()}function J(e){N.per_page=e,N.page=1,V()}return r(()=>{V()}),(r,d)=>{let p=i(`el-date-picker`),_=i(`el-option`),v=i(`el-select`),y=i(`el-button`),E=i(`el-table-column`),V=i(`el-tag`),Y=i(`el-table`),X=i(`el-pagination`),Z=i(`el-form-item`),Q=i(`el-input`),$=i(`el-form`),ee=i(`el-dialog`),te=t(`loading`);return n(),f(`div`,b,[m(`div`,x,[h(p,{modelValue:M.shift_date,"onUpdate:modelValue":d[0]||=e=>M.shift_date=e,type:`date`,"value-format":`YYYY-MM-DD`,placeholder:`交接日期`,clearable:``,style:{width:`160px`}},null,8,[`modelValue`]),h(v,{modelValue:M.shift_type,"onUpdate:modelValue":d[1]||=e=>M.shift_type=e,placeholder:`班次`,clearable:``,style:{width:`120px`}},{default:e(()=>[(n(),f(u,null,g(I,(e,t)=>h(_,{key:t,label:e,value:Number(t)},null,8,[`label`,`value`])),64))]),_:1},8,[`modelValue`]),h(y,{type:`primary`,onClick:H},{default:e(()=>[...d[10]||=[o(`查询`,-1)]]),_:1}),h(y,{onClick:U},{default:e(()=>[...d[11]||=[o(`重置`,-1)]]),_:1})]),m(`div`,S,[m(`div`,C,[d[13]||=m(`div`,{class:`flex items-center gap-3`},[m(`span`,{class:`font-medium text-gray-700`},`交接记录列表`)],-1),h(y,{type:`primary`,onClick:W},{default:e(()=>[...d[12]||=[o(`新增交接`,-1)]]),_:1})]),m(`div`,w,[c((n(),s(Y,{data:D.value,style:{width:`100%`}},{default:e(()=>[h(E,{prop:`shift_date`,label:`交接日期`,width:`120`}),h(E,{label:`班次`,width:`90`,align:`center`},{default:e(({row:t})=>[h(V,{type:L[t.shift_type],size:`small`},{default:e(()=>[o(a(I[t.shift_type]),1)]),_:2},1032,[`type`])]),_:1}),h(E,{label:`交班人`,"min-width":`100`},{default:e(({row:e})=>[o(a(e.handover_user?.name||`-`),1)]),_:1}),h(E,{label:`接班人`,"min-width":`100`},{default:e(({row:e})=>[o(a(e.receiver_user?.name||`待确认`),1)]),_:1}),h(E,{prop:`content`,label:`交接内容`,"min-width":`200`,"show-overflow-tooltip":``}),h(E,{label:`状态`,width:`90`,align:`center`},{default:e(({row:t})=>[h(V,{type:z[t.status],size:`small`},{default:e(()=>[o(a(R[t.status]),1)]),_:2},1032,[`type`])]),_:1}),h(E,{label:`操作`,width:`120`,fixed:`right`,align:`center`},{default:e(({row:t})=>[t.status===0?(n(),s(y,{key:0,size:`small`,type:`success`,text:``,onClick:e=>K(t)},{default:e(()=>[...d[14]||=[o(`确认接班`,-1)]]),_:1},8,[`onClick`])):l(``,!0)]),_:1})]),_:1},8,[`data`])),[[te,k.value]])]),m(`div`,T,[h(X,{"current-page":N.page,"onUpdate:currentPage":d[2]||=e=>N.page=e,"page-size":N.per_page,"onUpdate:pageSize":d[3]||=e=>N.per_page=e,total:O.value,"page-sizes":[10,20,50],layout:`total,sizes,prev,pager,next,jumper`,background:``,onCurrentChange:q,onSizeChange:J},null,8,[`current-page`,`page-size`,`total`])])]),h(ee,{modelValue:A.value,"onUpdate:modelValue":d[9]||=e=>A.value=e,title:`新增交接记录`,width:`600px`,"destroy-on-close":``},{footer:e(()=>[h(y,{onClick:d[8]||=e=>A.value=!1},{default:e(()=>[...d[15]||=[o(`取消`,-1)]]),_:1}),h(y,{type:`primary`,loading:j.value,onClick:G},{default:e(()=>[...d[16]||=[o(`确定`,-1)]]),_:1},8,[`loading`])]),default:e(()=>[h($,{ref_key:`formRef`,ref:P,model:F,rules:B,"label-width":`90px`},{default:e(()=>[h(Z,{label:`交接日期`,prop:`shift_date`},{default:e(()=>[h(p,{modelValue:F.shift_date,"onUpdate:modelValue":d[4]||=e=>F.shift_date=e,type:`date`,"value-format":`YYYY-MM-DD`,placeholder:`请选择日期`,style:{width:`100%`}},null,8,[`modelValue`])]),_:1}),h(Z,{label:`班次`,prop:`shift_type`},{default:e(()=>[h(v,{modelValue:F.shift_type,"onUpdate:modelValue":d[5]||=e=>F.shift_type=e,style:{width:`100%`}},{default:e(()=>[(n(),f(u,null,g(I,(e,t)=>h(_,{key:t,label:e,value:Number(t)},null,8,[`label`,`value`])),64))]),_:1},8,[`modelValue`])]),_:1}),h(Z,{label:`交接内容`,prop:`content`},{default:e(()=>[h(Q,{modelValue:F.content,"onUpdate:modelValue":d[6]||=e=>F.content=e,type:`textarea`,rows:4,placeholder:`请输入交接内容`},null,8,[`modelValue`])]),_:1}),h(Z,{label:`遗留问题`},{default:e(()=>[h(Q,{modelValue:F.issues,"onUpdate:modelValue":d[7]||=e=>F.issues=e,type:`textarea`,rows:3,placeholder:`请输入遗留问题(选填)`},null,8,[`modelValue`])]),_:1})]),_:1},8,[`model`])]),_:1},8,[`modelValue`])])}}};export{E as default};