2026-03-31 23:16:25 +08:00
|
|
|
var T=(P,N,p)=>new Promise((C,y)=>{var o=r=>{try{l(p.next(r))}catch(m){y(m)}},s=r=>{try{l(p.throw(r))}catch(m){y(m)}},l=r=>r.done?C(r.value):Promise.resolve(r.value).then(o,s);l((p=p.apply(P,N)).next())});import{dg as K,ar as Q,a7 as W,a9 as F,an as v,am as I,cb as X,ay as Z,ac as ee}from"./bootstrap-peLAqOBq.js";import{a as ae}from"./index-Bx458qrB.js";import{h as te}from"./index-CaErQKiJ.js";import{c as oe}from"./index-spHZ_riy.js";import{h as se}from"./data-B1c0S7Yi.js";import{m as le,aa as x,b9 as d,d9 as re,w as ne,ab as b,b2 as f,bJ as k,j as u,bL as E,u as i,ae as t,aR as U,ac as _,ad as ie,bp as L,aT as ce,ai as R}from"../jse/index-index-fr7m5rpH.js";import{D as de}from"./dict-enum-CaHgMaDZ.js";import{u as ue}from"./use-modal-C1IjSWqI.js";import{S as pe}from"./index-BG1VtNw5.js";import"./index-DPQibudO.js";import"./x-CIbp0SZ0.js";const me={class:"co-step-content"},ve={class:"co-type-grid"},fe={class:"co-type-icon",style:{color:"#047857",background:"#e5faf2"}},ye={class:"co-type-icon",style:{color:"#3730a3",background:"#eef0ff"}},he={class:"co-step-content"},ge={class:"co-area-section"},Te={key:0,class:"co-area-selected"},be={class:"co-step-content"},_e={class:"co-summary"},Ne={class:"co-summary-area"},Ce=le({name:"CreateOrderForm",__name:"create-order-form",emits:["success"],setup(P,{emit:N}){const p=N,C=K(),y=x(()=>C.getDictOptions(de.OPS_ORDER_PRIORITY).map(e=>({label:e.label,value:Number(e.value)}))),o=d(0),s=d(),l=d(),r=d(""),m=d(!1),w=d([]),A=d([]),S=d(!1),[V,h]=Q({schema:[{fieldName:"_orderType",label:"",component:"Input",dependencies:{triggerFields:[""],show:()=>!1}},{fieldName:"title",label:"工单标题",component:"Input",componentProps:{placeholder:"请输入工单标题",maxLength:100},rules:W().min(2,"标题至少2个字符").max(100,"标题不能超过100字符")},{fieldName:"description",label:"工单描述",component:"Textarea",componentProps:{placeholder:"请输入工单描述(选填)",rows:3,maxLength:500}},{fieldName:"priority",label:"优先级",component:"Select",componentProps:()=>({placeholder:"请选择优先级",options:y.value}),defaultValue:2},{fieldName:"cleaningType",label:"保洁类型",component:"Select",componentProps:{placeholder:"请选择保洁类型",options:se},dependencies:{triggerFields:["_orderType"],show:a=>a._orderType==="CLEAN"}},{fieldName:"expectedDuration",label:"预计时长(分钟)",component:"InputNumber",componentProps:{placeholder:"请输入预计作业时长",min:1,max:480,style:{width:"100%"}},dependencies:{triggerFields:["_orderType"],show:a=>a._orderType==="CLEAN"}},{fieldName:"imageUrl",label:"相关图片",component:"ImageUpload",componentProps:{maxNumber:1,maxSize:5,showDescription:!1},dependencies:{triggerFields:["_orderType"],show:a=>a._orderType==="SECURITY"}}],showDefaultActions:!1}),[z,g]=ue({onOpenChange:a=>T(null,null,function*(){a&&(M(),yield j())}),onConfirm:H}),Y=x(()=>o.value===0?!!s.value:o.value===1?!!l.value:!0),B=x(()=>[{title:"工单类型"},{title:"选择区域"},{title:"填写信息"}]);function M(){o.value=0,s.value=void 0,l.value=void 0,r.value="",h.resetForm()}function j(){return T(this,null,function*(){var a;S.value=!0;try{const e=yield ae({isActive:!0}),n=Array.isArray(e)?e:(a=e==null?void 0:e.list)!=null?a:[];A.value=n,w.value=re(n,"id","parentId","children")}catch(e){A.value=[],w.value=[]}finally{S.value=!1}})}function D(a){s.value=a,h.setValues({_orderType:a})}function $(a){const e=new Map(A.value.map(O=>[O.id,O])),n=[];let c=e.get(a);for(;c;)n.unshift(c.areaName),c=c.parentId?e.get(c.parentId):void 0;return n.join(" / ")}function G(a){l.value=a,r.value=a?$(a):""}function J(){Y.value&&o.value<2&&o.value++}function q(){o.value>0&&o.value--}function H(){return T(this,null,function*(){var n,c;if(o.value<2){J();return}const{valid:a}=yield h.validate();if(!a)return;if(!s.value||!l.value){F.warning("请先完成前面的步骤"),o.value=s.value?1:0;return}const e=yield h.getValues();m.value=!0,g.setState({confirmLoading:!0});try{yield s.value==="CLEAN"?te({title:e.title,description:e.description||void 0,priority:(n=e.priority)!=null?
|