Files
aiot-platform-ui/apps/web-antd/dist/js/device-bind-drawer-enhanced-4a3VpYgi.js

2 lines
12 KiB
JavaScript
Raw Normal View History

2026-03-09 13:05:46 +08:00
var _=(z,C,m)=>new Promise((n,i)=>{var c=l=>{try{p(m.next(l))}catch(k){i(k)}},M=l=>{try{p(m.throw(l))}catch(k){i(k)}},p=l=>l.done?n(l.value):Promise.resolve(l.value).then(c,M);p((m=m.apply(z,C)).next())});import{g as q,r as Q}from"./index-BvAci9nf.js";import{R as N}from"./data-Dg2RhqW8.js";import{_ as W}from"./device-config-modal.vue_vue_type_script_setup_true_lang-BSWzpuV1.js";import{_ as X}from"./device-select-modal.vue_vue_type_script_setup_true_lang-DITdw-Pq.js";import{ay as y,c7 as Z,bE as R,aL as ee,cF as te,a9 as B,ac as oe}from"./bootstrap-CRjSNGHY.js";import{m as re,b9 as T,aa as j,ad as E,b2 as v,j as u,bJ as a,ae as e,bp as w,u as s,ai as f,ac as h,ab as L,I as ae}from"../jse/index-index-CMeVxoEG.js";import{u as se}from"./use-drawer-7swngGBs.js";import{u as O}from"./use-modal-BABce5hC.js";import{v as ne}from"./AlertBuilder-BVlldnPG.js";import"./code-editor.vue_vue_type_script_setup_true_lang-Br1_X9dM.js";import"./vxe-table-uq8U2E1u.js";import"./dict-tag.vue_vue_type_script_setup_true_lang-BB6x-AyV.js";import"./index-CIc-2hgy.js";import"./index-Bljc00Y4.js";import"./use-vxe-grid-BMVG5Iiw.js";import"./x-CpZ5_sBZ.js";import"./circle-check-big-DP26Iidw.js";const ie={class:"mb-6 grid grid-cols-1 gap-4 md:grid-cols-3"},le={class:"rounded-lg border border-gray-200 bg-gradient-to-br from-blue-50 to-white p-4 dark:border-gray-700 dark:from-blue-950/30 dark:to-gray-900"},de={class:"flex items-center justify-between"},ue={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-white"},me={class:"rounded-lg border border-gray-200 bg-gradient-to-br from-green-50 to-white p-4 dark:border-gray-700 dark:from-green-950/30 dark:to-gray-900"},ge={class:"flex items-center justify-between"},ce={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-white"},pe={class:"rounded-lg border border-gray-200 bg-gradient-to-br from-orange-50 to-white p-4 dark:border-gray-700 dark:from-orange-950/30 dark:to-gray-900"},ke={class:"flex items-center justify-between"},ve={class:"mt-1 text-2xl font-bold text-gray-900 dark:text-white"},we={class:"mb-4 flex items-center justify-between rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800"},fe={class:"rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900"},be={key:0,class:"flex items-center gap-2"},xe={class:"font-medium"},ye={key:3,class:"flex gap-2"},he=re({__name:"device-bind-drawer-enhanced",emits:["refresh"],setup(z,{emit:C}){const m=C,n=T(null),i=T([]),c=T(!1),[M,p]=se({onOpenChange(o){if(!o){n.value=null,i.value=[];return}const t=p.getData();n.value=t!=null?t:null,t!=null&&t.id&&b(t.id)}}),[l,k]=O({connectedComponent:W,destroyOnClose:!0}),[V,$]=O({connectedComponent:X,destroyOnClose:!0});function D(){const o=n.value;o!=null&&o.id&&$.setData({areaId:o.id}).open()}function F(o){k.setData(o).open()}function K(){const o=n.value;o!=null&&o.id&&b(o.id),m("refresh")}function P(){const o=n.value;o!=null&&o.id&&b(o.id),m("refresh")}function H(o){return _(this,null,function*(){var d;const t=o.nickname||o.deviceKey||"该设备";try{yield ne(`确认解除设备【${t}】与该区域的绑定吗?`)}catch(r){return}const g=B.loading({content:"解除中...",duration:0});try{yield Q(o.id),B.success("已解除绑定");const r=n.value;r!=null&&r.id&&(yield b(r.id)),m("refresh")}catch(r){B.error((r==null?void 0:r.message)||((d=r==null?void 0:r.data)==null?void 0:d.msg)||"操作失败")}finally{g()}})}const G=j(()=>{const o=n.value;return o?`${o.areaName} - 设备绑定管理`:"设备绑定管理"}),I=j(()=>i.value.length),A=j(()=>i.value.filter(o=>o.enabled).length);function b(o){return _(this,null,function*(){c.value=!0;try{const t=yield q(o);i.value=Array.isArray(t)?t:[]}catch(t){i.value=[]}finally{c.value=!1}})}const U=[{title:"设备昵称",dataIndex:"nickname",key:"nickname",width:140,ellipsis:!0,customRender:({record:o})=>(o==null?void 0:o.nickname)||"-"},{title:"设备 Key",dataIndex:"deviceKey",key:"deviceKey",width:140,ellipsis:!0},{title:"产品",key:"product",width:120,customRender:({record:o})=>(o==null?void 0:o.productName)||