data_center/public/admin/assets/editTow.519bc47f.js

2 lines
7.5 KiB
JavaScript
Raw Normal View History

2023-11-22 13:29:04 +08:00
import{B as z,C as K,a5 as Q,D as G,L as H}from"./element-plus.9c2fdfa8.js";import{u as J}from"./vue-router.e2f4a118.js";import{P as W}from"./index.3fc23cf2.js";import{r as I,v as C,d as X}from"./index.b57b84f0.js";import Y from"./list_two.06cab31a.js";import{d as w,s as Z,r as f,$ as g,o as s,c as ee,U as a,L as o,u as c,k as te,K as r,Q as p,R as i}from"./@vue.53f8d7c3.js";function le(m){return I.post({url:"/task_scheduling_plan.task_scheduling_plan/add",params:m})}function ue(m){return I.post({url:"/task_scheduling_plan.task_scheduling_plan/edit",params:m})}function fe(m){return I.get({url:"/task.scheduling/plan",params:m})}const ae={class:"edit-popup"},oe=w({name:"taskEidt"}),de=w({...oe,props:{task:{type:Object,defualt:()=>{}},company_id:{type:String,default:""}},emits:["success","close"],setup(m,{expose:A,emit:U}){const v=J(),D=U,B=Z(),_=f("add");f({});const b=f(!1),k=f("\u521B\u5EFA\u65E5\u7A0B\u5B89\u6392"),x=n=>{e.start_time=C(n[0]).split(" ")[0],e.end_time=C(n[1]).split(" ")[0]},e=g({id:"",create_user_id:"",status:"",template_id:"",scheduling_id:"",template_name:"",start_time:"",end_time:"",datetime:"",content:"",templateInfo:{}}),T=g({datetime:{required:!0,message:"\u8BF7\u9009\u62E9\u65F6\u95F4\u8303\u56F4",trigger:"blur"},template_id:{required:!0,message:"\u8BF7\u9009\u62E9\u4EFB\u52A1\u5B89\u6392",trigger:"change"}}),R=g([31,32,33,34,35,45,48,49]),h=n=>!R.includes(n);function S(n){b.value=!1,e.template_id=n.id,e.template_name=n.title}const E=f(null),j=m,V=f(!1),q=async(n=null)=>{var t;try{E.value.clearValidate&&((t=E.value)==null||t.clearValidate())}catch(u){console.log(u)}_.value=="show"?(k.value="\u67E5\u770B\u65E5\u7A0B\u5B89\u6392",V.value=!0,Object.keys(e).forEach(u=>{n[u]!=null&&n[u]!=null&&(e[u]=n[u])}),e.datetime=[e.start_time.split(" ")[0],e.end_time.split(" ")[0]]):(V.value=!1,Object.keys(e).forEach(u=>{e[u]=""}))},O=()=>{var n;if(_.value=="show")return(n=B.value)==null?void 0:n.close();E.value.validate(async t=>{var u;if(t){const d={...e};v.query.id&&(d.scheduling_id=v.query.id.toString()),d.start_time=d.start_time.split(" ")[0],d.end_time=d.end_time.split(" ")[0],_.value=="edit"?await ue(d):await le(d),(u=B.value)==null||u.close(),D("success")}})},P=(n="add")=>{var t;_.value=n,(t=B.value)==null||t.open()},L=()=>{D("close")};return A({open:P,updatedForm:q}),(n,t)=>{const u=z,d=K,M=Q,N=G,$=H;return s(),ee("div",ae,[a(W,{ref_key:"popupRef",ref:B,title:c(k),async:!0,width:"800px",onConfirm:O,onClose:L,clickModalClose:c(_)=="show",button:c(_)!="show"},{default:o(()=>[a(N,{ref_key:"formRef",ref:E,rules:T,class:"formdata",model:e,"label-width":"120px"},{default:o(()=>[e.id?(s(),r(d,{key:0,label:"\u4EFB\u52A1ID",prop:"id"},{default:o(()=>[a(u,{disabled:!0,modelValue:e.id,"onUpdate:modelValue":t[0]||(t[0]=l=>e.id=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4EFB\u52A1ID"},null,8,["modelValue"])]),_:1})):p("",!0),a(d,{label:"\u4EFB\u52A1\u65E5\u671F",prop:"datetime"},{default:o(()=>[a(M,{disabled:c(V),modelValue:e.datetime,"onUpdate:modelValue":t[1]||(t[1]=l=>e.datetime=l),name:"datetime",type:"daterange","range-separator":"\u81F3","start-placeholder":"\u5F00\u59CB\u65F6\u95F4","end-placeholder":"\u7ED3\u675F\u65F6\u95F4",onChange:x},null,8,["disabled","modelValue"])]),_:1}),a(d,{label:"\u4EFB\u52A1\u5B89\u6392",prop:"template_id"},{default:o(()=>[a(u,{disabled:c(V),modelValue:e.template_name,"onUpdate:modelValue":t[2]||(t[2]=l=>e.template_name=l),onClick:t[3]||(t[3]=l=>b.value=!0),name:"template_id",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u5B89\u6392"},null,8,["disabled","modelValue"])]),_:1}),e.template_name?(s(),r(d,{key:1,label:"\u4EFB\u52A1\u63CF\u8FF0"},{default:o(()=>[a(u,{disabled:"",modelValue:e.templateInfo.content,"onUpdate:modelValue":t[4]||(t[4]=l=>e.templateInfo.content=l),placeholder:"\u6CA1\u6709\u4EFB\u52A1\u63CF\u8FF0"},null,8,["modelValue"])]),_:1})):p("",!0),a(d,{label:"\u4E00\u9636\u6BB5\u5929\u6570"},{default:o(()=>[a(u,{disabled:"",modelValue:e.templateInfo.stage_day_one,"onUpdate:modelValue":t[5]||(t[5]=l=>e.templateInfo.stage_day_one=l),clearable:"",placehold