enterprise-saa-s-dashboard-.../dist/assets/DeviceRegistration-CmbG4qLB.js

17 lines
18 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{c as C,d as I,a as i,b as e,j as y,m as M,p as X,x as O,f as r,u as l,F as g,r as F,t as d,v as L,n as u,h as v,s as b,k as B,o as n,g as R}from"./index-C5t0nGiQ.js";import{C as U,T as z}from"./triangle-alert-DaaA5cmC.js";import{U as S}from"./upload-Cl9qkJl5.js";import{X as D}from"./x-Cy9cTPf9.js";import{D as H}from"./download-hBwFRgUo.js";/**
* @license lucide-vue-next v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const k=C("camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
* @license lucide-vue-next v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W=C("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-vue-next v0.487.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const j=C("file-spreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]),Z={class:"p-6"},J={class:"bg-white p-6 rounded-lg mb-6",style:{boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)"}},K={class:"grid grid-cols-3 gap-6"},Q={class:"mb-4 p-4 rounded-lg flex items-start gap-3",style:{backgroundColor:"#F6FFED",border:"1px solid #B7EB8F"}},Y={class:"mb-6 p-4 rounded-lg flex items-start gap-3",style:{backgroundColor:"#FFFBE6",border:"1px solid #FFE58F",display:"none"}},ee={class:"bg-white rounded-lg mb-6",style:{boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)"}},te={class:"p-6 border-b",style:{borderColor:"#F0F0F0"}},oe={class:"flex items-center justify-between"},se={class:"overflow-x-auto"},le={class:"w-full"},re={class:"px-6 py-4",style:{color:"rgba(0, 0, 0, 0.65)"}},de={class:"px-6 py-4"},ne={class:"px-6 py-4"},ae={class:"px-6 py-4",style:{color:"rgba(0, 0, 0, 0.65)"}},ie={class:"px-6 py-4"},ce={class:"px-6 py-4"},pe={class:"bg-white rounded-lg mb-6",style:{boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)"}},ue={class:"p-6 border-b",style:{borderColor:"#F0F0F0"}},be={class:"flex items-center justify-between"},xe={class:"flex items-center gap-2"},ye={class:"text-sm font-semibold",style:{color:"#4a7c59"}},ve={class:"p-6"},fe={class:"space-y-3"},me=["onClick"],ge={class:"flex-1"},he={class:"flex items-center gap-2"},Fe={key:0,class:"px-2 py-1 rounded text-xs flex items-center gap-1",style:{backgroundColor:"#FFF1F0",color:"#FF4D4F",border:"1px solid #FFCCC7"}},De={class:"flex items-center gap-2"},ke=["onClick"],Ce=["onClick"],we={key:0,class:"fixed inset-0 z-50 flex items-center justify-center",style:{"background-color":"rgba(0,0,0,0.45)"}},_e={class:"bg-white rounded-lg w-[560px] max-h-[80vh] flex flex-col",style:{"box-shadow":"0 4px 12px rgba(0,0,0,0.15)"}},Ae={class:"flex items-center justify-between p-5 border-b",style:{"border-color":"#F0F0F0"}},Me={class:"p-6 overflow-y-auto flex-1"},Be={class:"mb-4"},ze={class:"text-sm font-medium mb-2"},Se={class:"flex flex-wrap gap-3"},je=["src","alt"],Ee=["onClick"],$e={class:"flex items-center justify-end gap-3 p-5 border-t",style:{"border-color":"#F0F0F0"}},Ge=["disabled"],Ne={key:1,class:"fixed inset-0 z-50 flex items-center justify-center",style:{"background-color":"rgba(0,0,0,0.45)"}},Pe={class:"bg-white rounded-lg w-[520px]",style:{"box-shadow":"0 4px 12px rgba(0,0,0,0.15)"}},Te={class:"flex items-center justify-between p-5 border-b",style:{"border-color":"#F0F0F0"}},Ve={class:"p-6"},qe={class:"mb-6"},Ie={class:"p-4 rounded-lg flex items-center justify-between",style:{"background-color":"#FAFAFA",border:"1px solid #F0F0F0"}},Xe={class:"flex items-center gap-3"},Oe={class:"px-3 py-1.5 rounded text-sm flex items-center gap-1",style:{border:"1px solid #4a7c59",color:"#4a7c59"}},Le={class:"mb-6"},Re={class:"text-sm",style:{color:"#52C41A"}},Ue={class:"flex items-center justify-end gap-3 p-5 border-t",style:{"border-color":"#F0F0F0"}},He=["disabled"],tt=I({__name:"DeviceRegistration",setup(We){const f=b(!1),c=b(null),m=b(!1),w=b(0),p=b([]),h=b(""),_=s=>{w.value=s,p.value=[],h.value="",m.value=!0},E=s=>{const t=s.target;if(t.files)for(const o of Array.from(t.files))p.value.push({name:o.name,url:URL.createObjectURL(o)});t.value=""},$=s=>{p.value.splice(s,1)},G=()=>{const s=x.value.find(t=>t.id===w.value);s&&(s.photos=p.value.length,s.completed=!0),m.value=!1},N=s=>{const t=s.target;t.files&&t.files.length>0&&(c.value=t.files[0])},A=b("GD30"),x=b([{id:1,text:"主板安装及固定",completed:!0,photos:3,needPhoto:!0,versionCheck:!0,versionMatch:!0},{id:2,text:"采集板连接",completed:!0,photos:2,needPhoto:!0,versionCheck:!0,versionMatch:!0},{id:3,text:"测控板安装",completed:!0,photos:2,needPhoto:!0,versionCheck:!0,versionMatch:!1},{id:4,text:"电源线连接检查",completed:!1,photos:0,needPhoto:!0,versionCheck:!1,versionMatch:!0},{id:5,text:"外壳密封性检测",completed:!1,photos:0,needPhoto:!0,versionCheck:!1,versionMatch:!0}]),P=[{code:"MB-2024-001",name:"主控板",sn:"MB20240308001",spec:"GD30-MB-V2.3",calibration:"无需校准",quantity:1},{code:"RX-2024-002",name:"采集板",sn:"RX20240308002",spec:"GD30-RX-V1.8",calibration:"已校准",quantity:2},{code:"MC-2024-003",name:"测控板",sn:"MC20240308003",spec:"GD30-MC-V1.5",calibration:"无需校准",quantity:1},{code:"TX-2024-003",name:"发射板",sn:"TX20240308003",spec:"GD30-TX-V1.5",calibration:"无需校准",quantity:1},{code:"BO-2024-004",name:"升压板",sn:"BO20240308004",spec:"BP600",calibration:"无需校准",quantity:1},{code:"CS-2024-005",name:"外壳机箱",sn:"-",spec:"AL6061-T6",calibration:"无需校准",quantity:1}],T=B(()=>x.value.filter(s=>s.completed).length),V=B(()=>x.value.length),q=s=>{x.value=x.value.map(t=>t.id===s?{...t,completed:!t.completed}:t)};return(s,t)=>(n(),i("div",Z,[t[36]||(t[36]=e("div",{class:"mb-6"},[e("h2",{class:"text-2xl font-semibold mb-1"},"设备登记"),e("p",{class:"text-sm",style:{color:"rgba(0, 0, 0, 0.45)"}},"登记新设备信息及装配记录")],-1)),e("div",J,[t[13]||(t[13]=e("h3",{class:"text-lg font-semibold mb-6"},"装机信息",-1)),e("div",K,[e("div",null,[t[11]||(t[11]=e("label",{class:"block text-sm mb-2",style:{color:"rgba(0, 0, 0, 0.85)"}},[y(" 设备型号 "),e("span",{style:{color:"#FF4D4F"}},"*")],-1)),M(e("select",{"onUpdate:modelValue":t[0]||(t[0]=o=>A.value=o),class:"w-full px-3 py-2 border rounded",style:{borderColor:"#D9D9D9",backgroundColor:"#fff"}},[...t[10]||(t[10]=[e("option",{value:"GD30"},"GD30 高密度电法仪",-1),e("option",{value:"GT20"},"GT20 瞬变电磁仪",-1),e("option",{value:"GTXD"},"GM10 大地电磁仪",-1)])],512),[[X,A.value]])]),t[12]||(t[12]=O('<div><label class="block text-sm mb-2" style="color:rgba(0, 0, 0, 0.85);"> 主机SN号 <span style="color:#FF4D4F;">*</span></label><input type="text" class="w-full px-3 py-2 border rounded" style="border-color:#D9D9D9;" placeholder="请输入主机SN号" value="GD30-20240308-001"></div><div><label class="block text-sm mb-2" style="color:rgba(0, 0, 0, 0.85);"> 主板SN号 <span style="color:#FF4D4F;">*</span></label><div class="flex items-center gap-2"><input type="text" class="flex-1 px-3 py-2 border rounded" style="border-color:#D9D9D9;" placeholder="请输入主板SN号" value="MB20240308001"><span class="px-2 py-1 rounded text-xs whitespace-nowrap" style="background-color:#F6FFED;color:#52C41A;border:1px solid #B7EB8F;"> 已绑定 </span></div></div><div><label class="block text-sm mb-2" style="color:rgba(0, 0, 0, 0.85);"> 装机测试状态 </label><div class="flex items-center gap-2 px-3 py-2 border rounded" style="border-color:#D9D9D9;background-color:#FAFAFA;"><select><option><span style="color:#52C41A;">测试通过</span></option><option><span style="color:#c41a1aff;">测试不通过</span></option></select></div></div><div><label class="block text-sm mb-2" style="color:rgba(0, 0, 0, 0.85);"> 生产日期 </label><input type="date" class="w-full px-3 py-2 border rounded" style="border-color:#D9D9D9;" value="2024-03-08"></div><div><label class="block text-sm mb-2" style="color:rgba(0, 0, 0, 0.85);"> 登记人 </label><input type="text" class="w-full px-3 py-2 border rounded" style="border-color:#D9D9D9;background-color:#FAFAFA;" value="张工"></div>',5))])]),e("div",Q,[r(l(U),{size:20,style:{color:"#52C41A",flexShrink:0,marginTop:"2px"}}),t[14]||(t[14]=e("div",null,[e("div",{style:{color:"#389E0D",fontWeight:500}},"型号已匹配GD30"),e("div",{class:"text-sm mt-1",style:{color:"#52C41A"}}," 授权文件auth_gd30_v2.3.lic | 配置文件config_gd30_v1.5.json | 固件版本v2.3.5 ")],-1))]),e("div",Y,[r(l(z),{size:20,style:{color:"#FAAD14",flexShrink:0,marginTop:"2px"}}),t[15]||(t[15]=e("div",null,[e("div",{style:{color:"#D46B08",fontWeight:500}},"未匹配到型号关联信息"),e("div",{class:"text-sm mt-1",style:{color:"#FAAD14"}}," 请先在型号管理中配置该型号的授权文件、配置文件和固件版本 ")],-1))]),e("div",ee,[e("div",te,[e("div",oe,[t[17]||(t[17]=e("h3",{class:"text-lg font-semibold"},"设备BOM清单",-1)),e("button",{class:"px-4 py-2 rounded flex items-center gap-2",style:{border:"1px solid #D9D9D9",color:"rgba(0, 0, 0, 0.85)"},onClick:t[1]||(t[1]=o=>f.value=!0)},[r(l(S),{size:16}),t[16]||(t[16]=y(" 导入 ",-1))])])]),e("div",se,[e("table",le,[t[19]||(t[19]=e("thead",{style:{backgroundColor:"#FAFAFA"}},[e("tr",null,[e("th",{class:"px-6 py-3 text-left text-sm font-medium",style:{color:"rgba(0, 0, 0, 0.85)"}},"物料编码"),e("th",{class:"px-6 py-3 text-left text-sm font-medium",style:{color:"rgba(0, 0, 0, 0.85)"}},"物料名称"),e("th",{class:"px-6 py-3 text-left text-sm font-medium",style:{color:"rgba(0, 0, 0, 0.85)"}},"SN号"),e("th",{class:"px-6 py-3 text-left text-sm font-medium",style:{color:"rgba(0, 0, 0, 0.85)"}},"规格型号"),e("th",{class:"px-6 py-3 text-left text-sm font-medium",style:{color:"rgba(0, 0, 0, 0.85)"}},"校准状态"),e("th",{class:"px-6 py-3 text-left text-sm font-medium",style:{color:"rgba(0, 0, 0, 0.85)"}},"数量"),e("th",{class:"px-6 py-3 text-left text-sm font-medium",style:{color:"rgba(0, 0, 0, 0.85)"}},"操作")])],-1)),e("tbody",null,[(n(),i(g,null,F(P,(o,a)=>e("tr",{key:a,class:"border-b",style:{borderColor:"#F0F0F0"}},[e("td",re,d(o.code),1),e("td",de,d(o.name),1),e("td",ne,d(o.sn),1),e("td",ae,d(o.spec),1),e("td",ie,[e("span",{class:"px-2 py-1 rounded text-xs",style:u({backgroundColor:o.calibration==="已校准"?"#F6FFED":"#F0F2F5",color:o.calibration==="已校准"?"#52C41A":"rgba(0, 0, 0, 0.65)",border:`1px solid ${o.calibration==="已校准"?"#B7EB8F":"#D9D9D9"}`})},d(o.calibration),5)]),e("td",ce,d(o.quantity),1),t[18]||(t[18]=e("td",{class:"px-6 py-4"},[e("div",{class:"flex items-center gap-3"},[e("button",{class:"text-sm",style:{color:"#4a7c59"}},"编辑"),e("button",{class:"text-sm",style:{color:"#FF4D4F"}},"删除")])],-1))])),64))])])])]),e("div",pe,[e("div",ue,[e("div",be,[t[21]||(t[21]=e("h3",{class:"text-lg font-semibold"},"装配Checklist",-1)),e("div",xe,[t[20]||(t[20]=e("span",{class:"text-sm",style:{color:"rgba(0, 0, 0, 0.65)"}},"完成进度",-1)),e("span",ye,d(T.value)+"/"+d(V.value),1)])])]),e("div",ve,[e("div",fe,[(n(!0),i(g,null,F(x.value,o=>(n(),i("div",{key:o.id,class:"flex items-center gap-4 p-4 rounded border",style:u({backgroundColor:o.completed?"#F6FFED":"#FAFAFA",borderColor:o.completed?"#B7EB8F":"#F0F0F0"})},[e("button",{onClick:a=>q(o.id),class:"w-6 h-6 rounded border flex items-center justify-center flex-shrink-0 transition-colors",style:u({borderColor:o.completed?"#52C41A":"#D9D9D9",backgroundColor:o.completed?"#52C41A":"#fff"})},[o.completed?(n(),R(l(W),{key:0,size:16,color:"#fff"})):v("",!0)],12,me),e("div",{class:"w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",style:u({backgroundColor:o.completed?"#52C41A":"#D9D9D9",color:"white"})},d(o.id),5),e("div",ge,[e("div",he,[e("span",{style:u({color:o.completed?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.65)"})},d(o.text),5),o.versionCheck&&!o.versionMatch?(n(),i("span",Fe,[r(l(z),{size:12}),t[22]||(t[22]=y(" 版本不一致! ",-1))])):v("",!0)])]),e("div",De,[o.needPhoto&&o.completed&&o.photos>0?(n(),i("button",{key:0,class:"px-3 py-1 rounded text-xs flex items-center gap-1 cursor-pointer",style:{backgroundColor:"#eef5f0",color:"#4a7c59"},onClick:a=>_(o.id)},[r(l(k),{size:12}),y(" 已上传 "+d(o.photos)+"张 ",1)],8,ke)):v("",!0),o.needPhoto&&!o.completed?(n(),i("button",{key:1,class:"px-3 py-1 rounded text-xs flex items-center gap-1",style:{backgroundColor:"#4a7c59",color:"#fff"},onClick:a=>_(o.id)},[r(l(k),{size:12}),t[23]||(t[23]=y(" 拍照上传 ",-1))],8,Ce)):v("",!0)])],4))),128))])])]),t[37]||(t[37]=e("div",{class:"flex items-center justify-end gap-3 p-4 bg-white rounded-lg sticky bottom-0",style:{boxShadow:"0 -2px 8px rgba(0, 0, 0, 0.05)"}},[e("button",{class:"px-6 py-2 rounded",style:{border:"1px solid #D9D9D9",color:"rgba(0, 0, 0, 0.85)"}}," 取消 "),e("button",{class:"px-6 py-2 rounded",style:{border:"1px solid #D9D9D9",color:"rgba(0, 0, 0, 0.85)"}}," 更新 "),e("button",{class:"px-6 py-2 rounded text-white",style:{backgroundColor:"#4a7c59"}}," 提交 ")],-1)),m.value?(n(),i("div",we,[e("div",_e,[e("div",Ae,[t[24]||(t[24]=e("h3",{class:"text-lg font-semibold"},"上传照片",-1)),e("button",{onClick:t[2]||(t[2]=o=>m.value=!1),class:"p-1 rounded hover:bg-gray-100",style:{color:"rgba(0,0,0,0.45)"}},[r(l(D),{size:18})])]),e("div",Me,[e("div",Be,[e("div",ze,"照片("+d(p.value.length)+"张)",1),e("div",Se,[(n(!0),i(g,null,F(p.value,(o,a)=>(n(),i("div",{key:a,class:"relative w-24 h-24 rounded-lg overflow-hidden",style:{border:"1px solid #F0F0F0"}},[e("img",{src:o.url,alt:o.name,class:"w-full h-full object-cover"},null,8,je),e("button",{class:"absolute top-1 right-1 w-5 h-5 rounded-full flex items-center justify-center",style:{"background-color":"rgba(0,0,0,0.5)",color:"#fff"},onClick:Ze=>$(a)},[r(l(D),{size:12})],8,Ee)]))),128)),e("div",{class:"w-24 h-24 rounded-lg flex flex-col items-center justify-center cursor-pointer transition-colors hover:border-blue-400",style:{border:"2px dashed #D9D9D9",color:"rgba(0,0,0,0.45)"},onClick:t[3]||(t[3]=o=>{var a;return(a=s.$refs.photoInput)==null?void 0:a.click()})},[r(l(k),{size:24}),t[25]||(t[25]=e("span",{class:"text-xs mt-1"},"添加照片",-1))]),e("input",{ref:"photoInput",type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:E},null,544)])]),e("div",null,[t[26]||(t[26]=e("div",{class:"text-sm font-medium mb-2"},"备注",-1)),M(e("textarea",{"onUpdate:modelValue":t[4]||(t[4]=o=>h.value=o),class:"w-full px-3 py-2 border rounded text-sm",style:{"border-color":"#D9D9D9","min-height":"80px",resize:"vertical"},placeholder:"输入备注信息(可选)"},null,512),[[L,h.value]])])]),e("div",$e,[e("button",{class:"px-4 py-2 rounded text-sm",style:{border:"1px solid #D9D9D9",color:"rgba(0,0,0,0.85)"},onClick:t[5]||(t[5]=o=>m.value=!1)},"取消"),e("button",{class:"px-4 py-2 rounded text-white text-sm",style:u({backgroundColor:p.value.length>0?"#4a7c59":"#D9D9D9"}),disabled:p.value.length===0,onClick:G},"确认上传("+d(p.value.length)+"张)",13,Ge)])])])):v("",!0),f.value?(n(),i("div",Ne,[e("div",Pe,[e("div",Te,[t[27]||(t[27]=e("h3",{class:"text-lg font-semibold"},"导入BOM清单",-1)),e("button",{onClick:t[6]||(t[6]=o=>{f.value=!1,c.value=null}),class:"p-1 rounded hover:bg-gray-100",style:{color:"rgba(0,0,0,0.45)"}},[r(l(D),{size:18})])]),e("div",Ve,[e("div",qe,[t[30]||(t[30]=e("div",{class:"text-sm font-medium mb-2"},"第一步:下载导入模板",-1)),e("div",Ie,[e("div",Xe,[r(l(j),{size:24,style:{color:"#52C41A"}}),t[28]||(t[28]=e("div",null,[e("div",{class:"text-sm"},"BOM导入模板.xlsx"),e("div",{class:"text-xs",style:{color:"rgba(0,0,0,0.45)"}},"包含物料编码、物料名称、SN号、规格型号等字段")],-1))]),e("button",Oe,[r(l(H),{size:14}),t[29]||(t[29]=y(" 下载模板 ",-1))])])]),e("div",Le,[t[34]||(t[34]=e("div",{class:"text-sm font-medium mb-2"},"第二步上传Excel文件",-1)),e("div",{class:"p-8 rounded-lg text-center cursor-pointer transition-colors",style:u({border:c.value?"2px solid #52C41A":"2px dashed #D9D9D9",backgroundColor:c.value?"#F6FFED":"#FAFAFA"}),onClick:t[7]||(t[7]=o=>{var a;return(a=s.$refs.fileInput)==null?void 0:a.click()})},[e("input",{ref:"fileInput",type:"file",accept:".xlsx,.xls,.csv",class:"hidden",onChange:N},null,544),c.value?(n(),i(g,{key:0},[r(l(j),{size:32,style:{color:"#52C41A",margin:"0 auto 8px"}}),e("div",Re,d(c.value.name),1),t[31]||(t[31]=e("div",{class:"text-xs mt-1",style:{color:"rgba(0,0,0,0.45)"}},"点击重新选择文件",-1))],64)):(n(),i(g,{key:1},[r(l(S),{size:32,style:{color:"#D9D9D9",margin:"0 auto 8px"}}),t[32]||(t[32]=e("div",{class:"text-sm",style:{color:"rgba(0,0,0,0.65)"}},"点击或拖拽文件到此处上传",-1)),t[33]||(t[33]=e("div",{class:"text-xs mt-1",style:{color:"rgba(0,0,0,0.45)"}},"支持 .xlsx、.xls、.csv 格式",-1))],64))],4)]),t[35]||(t[35]=e("div",{class:"p-3 rounded text-xs",style:{"background-color":"#FFFBE6",border:"1px solid #FFE58F",color:"#D46B08"}}," 提示请确保Excel文件格式与模板一致物料编码和SN号为必填字段。导入后可在BOM清单中编辑。 ",-1))]),e("div",Ue,[e("button",{class:"px-4 py-2 rounded text-sm",style:{border:"1px solid #D9D9D9",color:"rgba(0,0,0,0.85)"},onClick:t[8]||(t[8]=o=>{f.value=!1,c.value=null})},"取消"),e("button",{class:"px-4 py-2 rounded text-white text-sm",style:u({backgroundColor:c.value?"#4a7c59":"#D9D9D9"}),disabled:!c.value,onClick:t[9]||(t[9]=o=>{f.value=!1,c.value=null})},"确认导入",12,He)])])])):v("",!0)]))}});export{tt as default};