import{_ as H,d as L,W as V,bn as $,w as x,aU as O,X as W,b0 as G,z as I,r,aC as J,H as X,l as o,o as C,c as K,j as a,C as l,M as Q,L as Y,G as B,J as g,a as F,aq as Z,aN as ee}from"./index.js";import{a as te,b as ae}from"./index.1b996d7e.js";import{s as oe,M as ne}from"./modal.2932b5.js";const se={class:"mt-[10px]"},re=L({__name:"category-tree",props:{otherParms:{type:Object,required:!0},breadcrumb:{type:Array,required:!0}},emits:["breadcrumbChange"],setup(y,{expose:w,emit:N}){const A=y,{currentCompany:d}=V(),{hasPermissionWithCode:h}=$("grossProfit"),p=x(""),v=x({}),_=O(!1),S=W(),{data:E,loading:k,run:D}=G({isList:!0});function P(t){p.value=t.cat_id,u(),N("breadcrumbChange",t)}function u(){if(!d.value.companyNo){ee.warning("\u8BF7\u5728\u53F3\u4E0A\u89D2\u9009\u62E9\u4E00\u5BB6\u4E1A\u52A1\u516C\u53F8!"),k.value=!1,E.value=[];return}const t={...A.otherParms,...p.value?{pid:p.value}:{pid:0},size:1e3,companyNo:d.value.companyNo};D(te(t))}const T=()=>u();function R(t={}){const{cat_id:n,cat_name:s,order_rate:f,sale_rate:i,rate:c,low_rate:b}=t;v.value={id:n,cat_name:s,order_rate:f||0,sale_rate:i||0,rate:c||0,low_rate:b||0},_.value=!0}const q=async t=>{const{cat_id:n,status:s,companyNo:f}=t,{code:i,message:c}=await ae({companyNo:d.value.companyNo,status:s+""=="1"?"0":"1",cat_id:n});S({code:i,message:c,handler:()=>u()})};return T(),I(()=>d.value,u),w({changePid:t=>p.value=t,onSearch:()=>u()}),(t,n)=>{const s=r("ElTableColumn"),f=r("ElTag"),i=r("ElButton"),c=r("el-tooltip"),b=r("el-button"),z=r("el-popconfirm"),M=r("ElTable"),U=J("loading");return X((C(),K("ul",se,[a(M,{data:o(E),border:"",size:"small","max-height":"calc(100vh - 160px)"},{default:l(()=>[a(s,{label:"\u5206\u7C7B\u540D\u79F0",prop:"cat_name","min-width":"160px","show-overflow-tooltip":""}),a(s,{label:"\u72B6\u6001",prop:"status","min-width":"70px"},{default:l(({row:e})=>[a(f,{type:String(e.status)==="0"?"warning":""},{default:l(()=>{var m;return[Q(Y(((m=o(oe).find(({value:j})=>j===String(e.status)))==null?void 0:m.label)||"--"),1)]}),_:2},1032,["type"])]),_:1}),a(s,{label:"\u5206\u7C7B\u7B49\u7EA7",prop:"level","min-width":"80px"}),a(s,{label:"\u64CD\u4F5C",width:"140px"},{default:l(({row:e})=>[o(h)("005")?(C(),B(c,{key:0,effect:"dark",content:"\u7F16\u8F91\u4E13\u5C5E\u5206\u7C7B",placement:"top"},{default:l(()=>[a(i,{link:"",class:"reset-margin",type:"primary",icon:o(g)("edits"),onClick:m=>R(e)},null,8,["icon","onClick"])]),_:2},1024)):F("v-if",!0),o(h)("004")?(C(),B(z,{key:1,title:String(e.status)==="1"?"\u6539\u4E3A\u7981\u7528\uFF1F":"\u6539\u4E3A\u542F\u7528\uFF1F",onConfirm:m=>q(e)},{reference:l(()=>[a(b,{class:"reset-margin",link:"",type:"primary",size:"small",icon:o(g)(String(e.status)==="1"?"close-circle-line":"checkbox-circle-line")},null,8,["icon"])]),_:2},1032,["title","onConfirm"])):F("v-if",!0),a(c,{effect:"dark",content:"\u4E0B\u4E00\u7EA7",placement:"top"},{default:l(()=>[a(i,{link:"",class:"reset-margin",type:"primary",icon:o(g)("arrow-right-s-line"),onClick:m=>P(e)},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"]),a(ne,{pid:p.value,data:v.value,"onUpdate:data":n[0]||(n[0]=e=>v.value=e),visible:o(_),"onUpdate:visible":n[1]||(n[1]=e=>Z(_)?_.value=e:null),breadcrumb:y.breadcrumb,onRefresh:u},null,8,["pid","data","visible","breadcrumb"])])),[[U,o(k)]])}}});var ce=H(re,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/serviceParam/grossProfit/cpns/category-tree.vue"]]);export{ce as default};
