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

2 lines
11 KiB
JavaScript
Raw Normal View History

2026-02-11 16:00:36 +08:00
var _=(z,C,c)=>new Promise((n,l)=>{var g=i=>{try{p(c.next(i))}catch(k){l(k)}},M=i=>{try{p(c.throw(i))}catch(k){l(k)}},p=i=>i.done?n(i.value):Promise.resolve(i.value).then(g,M);p((c=c.apply(z,C)).next())});import{c as q,R as N,r as Q}from"./data-DemYqPxC.js";import{_ as W}from"./device-config-modal.vue_vue_type_script_setup_true_lang-O7hmNP8s.js";import{_ as X}from"./device-select-modal.vue_vue_type_script_setup_true_lang-BAoSHnQb.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-Cyl1zBqr.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 b,ac as h,ab as L,I as ae}from"../jse/index-index-C4azLyIf.js";import{u as se}from"./use-drawer-B6NqBbSq.js";import{u as O}from"./use-modal-DEZHga_N.js";import{v as ne}from"./AlertBuilder-BUEdbqfE.js";import"./code-editor.vue_vue_type_script_setup_true_lang-xZ17w_kH.js";import"./vxe-table-JfrGWPXK.js";import"./dict-tag.vue_vue_type_script_setup_true_lang-BnK0RDI7.js";import"./index-BbNoERZd.js";import"./index-DjVkTrdB.js";import"./use-vxe-grid-5bAHJi9n.js";import"./x-B0MWtAvA.js";import"./circle-check-big-rFR7hLa9.js";const le={class:"mb-6 grid grid-cols-1 gap-4 md:grid-cols-3"},ie={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"},ce={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"},me={class:"flex items-center justify-between"},ge={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"},be={class:"rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900"},fe={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 c=C,n=T(null),l=T([]),g=T(!1),[M,p]=se({onOpenChange(o){if(!o){n.value=null,l.value=[];return}const t=p.getData();n.value=t!=null?t:null,t!=null&&t.id&&f(t.id)}}),[i,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&&f(o.id),c("refresh")}function P(){const o=n.value;o!=null&&o.id&&f(o.id),c("refresh")}function H(o){return _(this,null,function*(){var d;const t=o.nickname||o.deviceKey||"该设备";try{yield ne(`确认解除设备【${t}】与该区域的绑定吗?`)}catch(r){return}const m=B.loading({content:"解除中...",duration:0});try{yield Q(o.id),B.success("已解除绑定");const r=n.value;r!=null&&r.id&&(yield f(r.id)),c("refresh")}catch(r){B.error((r==null?void 0:r.message)||((d=r==null?void 0:r.data)==null?void 0:d.msg)||"操作失败")}finally{m()}})}const G=j(()=>{const o=n.value;return o?`${o.areaName} - 设备绑定管理`:"设备绑定管理"}),I=j(()=>l.value.length),A=j(()=>l.value.filter(o=>o.enabled).length);function f(o){return _(this,null,function*(){g.value=!0;try{const t=yield q(o);l.value=Array.isArray(t)?t:[]}catch(t){l.value=[]}finally{g.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)||(o==null?void 0:o.productKey)||"-