import{_ as T,b as A,u as L,a as j,ah as w,r as v,e as H,aH as K,n as o,o as G,c as J,p as t,q as s,P as u,x as i,aj as O,v as h,s as R,l as Q,k as W,j as X,m as Y,bH as Z,D as ee}from"./index.8d733f79.js";import{_ as ae}from"./dialogContent.8cf6deaf.js";import{E as te}from"./el-progress.ee3fa77d.js";import{e as oe,f as le,g as se,h as ne}from"./systemLink.0379a9eb.js";import de from"./addCode.65702494.js";const ie={class:"apiParams_wrap","element-loading-background":"rgba(0,0,0,0)"},re={class:"importDialog"},ce={class:"tit"},pe={style:{position:"relative"}},ue={class:"download"},me=["href"],fe={__name:"mapRelations",setup(_e){const{t:C}=A(),{proxy:d}=ee();L();const D=j(),_=w({total:0,tableData:[],columns:[{prop:"deviceCodeThird",label:"deviceCode3"},{prop:"deviceCode",label:"deviceCode1"},{prop:"modelCode",label:"modelCode"},{prop:"subDeviceCodeThird",label:"subDeviceCode3"},{prop:"subModelCode",label:"subModelCode"},{label:"action",type:"action",width:180,fixed:"right"}]}),r=w({factoryId:D.query.factoryId,code:"",pageNo:1,pageSize:10}),$=v([]),m=v(!1),f=v(),g=v([]),b=v(!1);H(()=>{c()});async function c(){const e=await oe(r);_.total=e.data.totalElements,_.tableData=e.data.content}const k=e=>{var a,l;(a=f.value)==null||a.clearFiles(),(l=f.value)==null||l.handleStart(e[0])},S=e=>{const a=e.file,l=new FormData;l.append("file",a),l.append("factoryId",D.query.factoryId),b.value=!0,le(l).then(p=>{var y;d.$modal.msgSuccess(p.msg),c(),(y=f.value)==null||y.clearFiles(),m.value=!1,b.value=!1}).catch(()=>{var p;(p=f.value)==null||p.clearFiles(),m.value=!1,b.value=!1})},I=()=>{var e;console.log("\u4E0A\u4F20\u7684\u6587\u4EF6",g.value),g.value.length||d.$modal.msgError(C("uploadFileP")),(e=f.value)==null||e.submit()},E=e=>{$.value=e.map(a=>a.id)},F=()=>{d.$refs.formRef.resetFields(),c()},M=()=>{d.$refs.addCodeRef.showModal({})},N=e=>{d.$refs.addCodeRef.showModal(e)},V=e=>{d.$modal.confirm(C("confirmDelete")).then(()=>{se(e.id).then(a=>{d.$modal.msgSuccess(a.msg),c()})}).catch(()=>{})},B=()=>{d.$modal.confirm(C("confirmBatchDelete")).then(()=>{ne({ids:$.value.join(",")}).then(e=>{d.$modal.msgSuccess(e.msg),c(),d.$refs.tableRef.clearSelection()})}).catch(()=>{})};return(e,a)=>{const l=Q,p=W,y=X,x=Y,P=te,U=ae,q=Z;return K((G(),J("div",ie,[t(x,{ref:"formRef",model:o(r),inline:!0,"label-width":"68px"},{default:s(()=>[t(p,null,{default:s(()=>[t(l,{type:"primary",onClick:M},{default:s(()=>[u(i(e.$t("add")),1)]),_:1}),t(l,{type:"primary",onClick:a[0]||(a[0]=n=>m.value=!0)},{default:s(()=>[u(i(e.$t("batchAdd")),1)]),_:1}),t(l,{type:"primary",onClick:B,disabled:!o($).length},{default:s(()=>[u(i(e.$t("batchDelete")),1)]),_:1},8,["disabled"])]),_:1}),t(p,{label:e.$t("code"),prop:"code"},{default:s(()=>[t(y,{modelValue:o(r).code,"onUpdate:modelValue":a[1]||(a[1]=n=>o(r).code=n),placeholder:e.$t("codeP"),style:{width:"236px"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(p,null,{default:s(()=>[t(l,{type:"primary",onClick:c},{default:s(()=>[u(i(e.$t("query")),1)]),_:1}),t(l,{onClick:F},{default:s(()=>[u(i(e.$t("reset")),1)]),_:1})]),_:1})]),_:1},8,["model"]),t(o(O),{class:"f-h",ref:"tableRef",selection:"",rowKey:"id",columns:o(_).columns,tableData:o(_).tableData,total:o(_).total,pageNum:o(r).pageNo,"onUpdate:pageNum":a[2]||(a[2]=n=>o(r).pageNo=n),pageSize:o(r).pageSize,"onUpdate:pageSize":a[3]||(a[3]=n=>o(r).pageSize=n),onPagination:c,onChangeSelection:E},{action:s(({scope:n})=>[t(l,{link:"",type:"primary",onClick:z=>N(n.row)},{default:s(()=>[u(i(e.$t("edit")),1)]),_:2},1032,["onClick"]),t(l,{link:"",type:"danger",onClick:z=>V(n.row)},{default:s(()=>[u(i(e.$t("delete")),1)]),_:2},1032,["onClick"])]),_:1},8,["columns","tableData","total","pageNum","pageSize"]),t(o(de),{ref:"addCodeRef",onRefesh:c},null,512),t(U,{modelValue:o(m),"onUpdate:modelValue":a[5]||(a[5]=n=>R(m)?m.value=n:null),title:e.$t("batchAdd"),onConfirm:I,onCancel:a[6]||(a[6]=n=>m.value=!1)},{main:s(()=>[h("div",re,[h("div",ce,i(e.$t("uploadFile")),1),h("div",pe,[t(P,{ref_key:"uploadRef",ref:f,"file-list":o(g),"onUpdate:file-list":a[4]||(a[4]=n=>R(g)?g.value=n:null),accept:".xlsx,.xls",action:"#","http-request":S,limit:1,"on-exceed":k,"auto-upload":!1},{default:s(()=>[t(l,{type:"primary"},{default:s(()=>[u(i(e.$t("selectImportFile")),1)]),_:1})]),_:1},8,["file-list"]),h("div",ue,[h("a",{href:"/template/mapRelationsTemplate.xlsx",download:"\u65B0\u589E\u6620\u5C04\u5173\u7CFB\u6A21\u677F.xlsx"},i(e.$t("downImportTemplate")),9,me)])])])]),_:1},8,["modelValue","title"])])),[[q,o(b)]])}}},Ce=T(fe,[["__scopeId","data-v-ffcda1e6"]]);export{Ce as default};
