import{_ as e,e as a,K as t,L as l,v as o,C as s,s as n,r,a as i,c as d,w as m,am as u,i as c,o as f,h as p,j as _,m as h,V as b}from"./index-CS85kPhe.js";import{_ as V}from"./uni-easyinput.DiCyKNZM.js";import{_ as y}from"./uni-forms-item.g4VtziaR.js";import{_ as D}from"./uni-forms.DHOpViDo.js";import{v}from"./opendb-search-log.CXwBCHuj.js";const g=a.database();g.command;function j(e){let a={};for(let t in v)e.includes(t)&&(a[t]=v[t]);return a}const k=e({data(){let e={content:"",create_date:null,device_id:"",user_id:""};return{formData:e,formOptions:{},rules:{...j(Object.keys(e))}}},onReady(){this.$refs.form.setRules(this.rules)},methods:{submit(){t({mask:!0}),this.$refs.form.validate().then((e=>this.submitForm(e))).catch((()=>{})).finally((()=>{l()}))},submitForm(e){return g.collection("opendb-search-log").add(e).then((e=>{o({title:"新增成功"}),this.getOpenerEventChannel().emit("refreshData"),setTimeout((()=>s()),500)})).catch((e=>{n({content:e.message||"请求服务失败",showCancel:!1})}))}}},[["render",function(e,a,t,l,o,s){const n=r(i("uni-easyinput"),V),v=r(i("uni-forms-item"),y),g=r(i("uni-datetime-picker"),u),j=h,k=b,x=c,C=r(i("uni-forms"),D);return f(),d(x,{class:"uni-container"},{default:m((()=>[p(C,{ref:"form",model:o.formData,validateTrigger:"bind"},{default:m((()=>[p(v,{name:"content",label:"",required:""},{default:m((()=>[p(n,{placeholder:"搜索内容",modelValue:o.formData.content,"onUpdate:modelValue":a[0]||(a[0]=e=>o.formData.content=e)},null,8,["modelValue"])])),_:1}),p(v,{name:"create_date",label:""},{default:m((()=>[p(g,{"return-type":"timestamp",modelValue:o.formData.create_date,"onUpdate:modelValue":a[1]||(a[1]=e=>o.formData.create_date=e)},null,8,["modelValue"])])),_:1}),p(v,{name:"device_id",label:""},{default:m((()=>[p(n,{placeholder:"设备id",modelValue:o.formData.device_id,"onUpdate:modelValue":a[2]||(a[2]=e=>o.formData.device_id=e)},null,8,["modelValue"])])),_:1}),p(v,{name:"user_id",label:""},{default:m((()=>[p(n,{placeholder:"收藏者id,参考uni-id-users表",modelValue:o.formData.user_id,"onUpdate:modelValue":a[3]||(a[3]=e=>o.formData.user_id=e)},null,8,["modelValue"])])),_:1}),p(x,{class:"uni-button-group"},{default:m((()=>[p(j,{type:"primary",class:"uni-button",style:{width:"100px"},onClick:s.submit},{default:m((()=>[_("提交")])),_:1},8,["onClick"]),p(k,{"open-type":"navigateBack",style:{"margin-left":"15px"}},{default:m((()=>[p(j,{class:"uni-button",style:{width:"100px"}},{default:m((()=>[_("返回")])),_:1})])),_:1})])),_:1})])),_:1},8,["model"])])),_:1})}]]);export{k as default};