|
|
|
|
|
import{C as e,D as t,E as n,G as r,P as i,S as a,T as o,X as s,Y as c,at as l,b as u,d,et as f,ht as p,m,ot as h,q as g,rt as _,tn as v,x as y}from"./vue.runtime.esm-bundler-DUiYyeqQ.js";import{a as b,c as x,l as S,s as C}from"./index-CgtDRRqt.js";import{t as w}from"./usePageLoad-DFTLo_Lv.js";import{c as T,l as E,r as D,s as O,t as k}from"./assets-26J9lCWW.js";import{f as A}from"./teachers-oTwpdyV9.js";var j={key:0,class:`linked-block`},M={class:`linked-tags`},N={class:`picker-toolbar`},P={key:1,class:`text-mute`},F={key:1,class:`picker-pager`},I=C(t({__name:`PaperLinkTeachersDialog`,props:i({paperId:{},paperTitle:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:i([`saved`],[`update:modelValue`]),setup(t,{emit:i}){let b=f(t,`modelValue`),x=t,C=i,w=p(!1),T=p(!1),E=p([]),D=p(``),I=p(!1),L=p([]),R=p(1),z=p({current_page:1,per_page:10,total:0}),B=p([]),V=p(null);function H(e){return E.value.some(t=>t.id===e)}function U(e){return!H(e.id)}async function W(){if(x.paperId){w.value=!0;try{E.value=(await O(x.paperId)).teachers||[],B.value=[],V.value?.clearSelection()}finally{w.value=!1}}}async function G(e=R.value){I.value=!0;try{let t=await A({page:e,page_size:z.value.per_page,keyword:D.value.trim()||void 0});L.value=t.items,z.value=t.meta,R.value=t.meta.current_page}finally{I.value=!1}}function K(){R.value=1,G(1)}function q(e){B.value=e.map(e=>e.id)}async function J(){if(x.paperId){if(!B.value.length){S.warning(`请选择要关联的老师`);return}T.value=!0;try{await k(x.paperId,B.value),S.success(`已关联老师`),b.value=!1,C(`saved`)}finally{T.value=!1}}}return _(()=>[b.value,x.paperId],([e])=>{e&&x.paperId&&(D.value=``,R.value=1,W(),G(1))}),(i,f)=>{let p=c(`el-tag`),_=c(`el-input`),x=c(`el-button`),S=c(`el-table-column`),C=c(`el-table`),O=c(`el-pagination`),k=c(`el-dialog`),A=s(`loading`);return r(),y(k,{modelValue:b.value,"onUpdate:modelValue":f[2]||=e=>b.value=e,title:`关联老师:${t.paperTitle||``}`,width:`760px`,"destroy-on-close":``,"append-to-body":``},{footer:l(()=>[n(x,{onClick:f[1]||=e=>b.value=!1},{default:l(()=>[...f[6]||=[o(`取消`,-1)]]),_:1}),n(x,{type:`primary`,loading:T.value,onClick:J},{default:l(()=>[...f[7]||=[o(`确认关联`,-1)]]),_:1},8,[`loading`])]),default:l(()=>[h((r(),e(`div`,null,[E.value.length?(r(),e(`div`,j,[f[3]||=u(`div`,{class:`linked-label`},`已关联老师`,-1),u(`div`,M,[(r(!0),e(m,null,g(E.value,e=>(r(),y(p,{key:e.id,size:`small`,type:`info`},{default:l(()=>[o(v(e.name)+v(e.university_name?`(${e.university_name})`:``),1)]),_:2},1024))),128))])])):a(``,!0),u(`div`,N,[n(_,{modelValue:D.value,"onUpdate:modelValue":f[0]||=e=>D.value=e,clearable:``,placeholder:`搜索姓名、高校、研究方向…`,style:{width:`260px`},onKeyup:d(K,[`enter`])},null,8,[`modelValue`]),n(x,{type:`primary`,onClick:K},{default:l(()=>[...f[4]||=[o(`搜索`,-1)]]),_:1})]),h((r(),y(C,{ref_key:`tableRef`,ref:V,data:L.value,"row-key":`id`,size:`small`,class:`picker-table`,onSelectionChange:q},{default:l(()=>[n(S,{type:`selection`,width:`44`,selectable:U}),n(S,{prop:`name`,label:`姓名`,width:`100`}),n(S,{prop:`university_name`,label:`高校`,"min-width":`140`,"show-overflow-tooltip":``}),n(S,{prop:`title`,label:`职称`,width:`100`,"show-overflow-tooltip":``}),n(S,{prop:`research_direction`,label:`研究方向`,"min-width":`120`,"show-overflow-tooltip":``}),n(S,{label:`状态`,width:`80`,align:`center`},{default:l(({row:t})=>[H(t.id)?(r(),y(p,{key:0,size:`small`,type:`info`},{default:l(()=>[...f[5]||=[o(`已关联`,-1)]]),_:1})):(r(),e(`span`,P,`—`))]),_:1})]),_:1},8,[`data`])),[[A,I.value]]),z.value.total>0?(r(),e(`div`,F,[n(O,{layout:`total, prev, pager, next`,total:z.value.total,"page-size":z.value.per_page,"current-page":R.value,onCurrentChange:G},null,8,[`total`,`page-size`,`current-page`])])):a(``,!0)])),[[A,w.value]])]),_:1},8,[`modelValue`,`title`])}}}),[[`__scopeId`,`data-v-a6c8acb0`]]),L={class:`list-page`},R={class:`list-filter-bar`},z={class:`paper-title-cell`},B={class:`paper-title-text`},V=[`href`],H={key:1},U={key:1,class:`text-mute`},W={class:`table-row-actions`},
|