| 1 |
- import{u as U,g as V,r as n,i as R,o as E,e as u,n as k}from"./vendor-901945c8.js";import{n as H,$ as T}from"./index-9630fa3c.js";import{L as J,g as S}from"./LJFrom-999ddf2d.js";import"./LJUploadFiles-60127964.js";import"./qiNiu.config-a8af251c.js";import"./LJUploadImages-1c08aaf5.js";const q={__name:"clueCEViews",setup(w){const l=U(),t=V(),e=n(),s=n(),m=n(!1),d=n(t.query.type||"add"),_=n({}),v=n([]),p=n([]),y=n(d.value==="edit"?"\u7F16\u8F91\u7EBF\u7D22":"\u65B0\u5EFA\u7EBF\u7D22"),f=n(!1),r=R({company_id:T.getters.company,template_id:null,customer_pools_id:null,is_claims:!1}),P=R({template_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u7EBF\u7D22\u6A21\u677F",trigger:"change"}],customer_pools_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u7EBF\u7D22\u6C60",trigger:"change"}]});function h(){const i={offset:0,limit:9999,ordering:"-id",fileds:"id,name",del_flag:0,is_default:0};d.value=="add"?i.status=1:delete i.status;const o={company:T.getters.company,offset:0,limit:9999,ordering:"-id",fileds:"id,name",del_flag:0};HTTP.get("used_clue_customer_templates",i).then(a=>{a.code==0&&(_.value=a.data.results)}),HTTP.get("customerPools",o).then(a=>{a.code==0&&(v.value=a.data.results)})}function M(i){m.value=!1,p.value=[];const o=_.value.find(a=>a.id==i);S(o).then(a=>{p.value=a.filter(c=>c.is_hide==0),m.value=!0,x()}).catch(a=>{u.exports.Message.error(a)})}function $(){e.value.validate(i=>{if(!i)return s.value.validateForm();s.value.validateForm(o=>{if(!o)return;const a={...r,data:s.value.ruleForm};f.value=!0,HTTP.post("create_clue_customer",a).then(c=>{if(c.code!==0)return u.exports.Message({type:"error",message:c.msg});u.exports.Message({type:"success",message:`${y.value}\u6210\u529F\uFF01`,duration:1500}),setTimeout(b,1500)}).catch(c=>{f.value=!1,u.exports.Message({type:"error",message:c.msg||`${y.value}\u5931\u8D25`})})})})}function x(){k(()=>{e.value.clearValidate(),s.value.clearValidate()})}function C(){k(()=>{e.value.resetFields(),s.value.resetFieldsForm()})}function b(){f.value=!1,C(),l.back()}function F(){delete r.is_claims,HTTP.getReadById("customerList",t.query.id).then(i=>{const o=i.data;try{r.customer_id=o.id,r.company_id=o.company,r.template_id=o.clue_customer_templates.id,r.customer_pools_id=o.customer_pools.id,_.value=[o.clue_customer_templates],v.value=[o.customer_pools]}catch(a){}if(!r.template_id)return u.exports.Message.error("\u6A21\u677F\u4FE1\u606F\u7F3A\u5931");HTTP.getReadById("customerTemplate",r.template_id).then(a=>{if(a.code!==0)return u.exports.Message.error(a.msg);S(a.data).then(c=>{for(const g of c)g.value=o[g.key];p.value=c.filter(g=>g.is_hide==0),m.value=!0,x()}).catch(c=>{u.exports.Message.error(c)})})})}E(()=>{h(),d.value==="edit"?F():h()});const L=n();return{__sfc:!0,router:l,route:t,formRef:e,LJFromRef:s,LJFromRefShow:m,type:d,clueList:_,cluePoolList:v,selectTemplate:p,title:y,isLoading:f,form:r,rules:P,getCustomerTemplate:h,handleTemplate:M,submitForm:$,handleFromClearValidate:x,handleFormResetFies:C,resetForm:b,handleEditLoadConfig:F,canUseClueTemplates:L,getCanUseClueTemlates:()=>{if(r.customer_pools_id){const i={company_id:T.getters.company,fields:"id,name",customer_pool:r.customer_pools_id};HTTP.getRead("clue_customer_templates",i).then(o=>{L.value=o.data.results})}},LJFrom:J}}};var B=function(){var l=this,t=l._self._c,e=l._self._setupProxy;return t("div",{staticClass:"clue-details"},[t("div",{staticClass:"title"},[t("div",{staticStyle:{"margin-left":"30px"}},[l._v(l._s(e.title))]),t("div",{staticStyle:{display:"flex","justify-content":"center","margin-right":"20px"}},[t("el-button",{on:{click:e.resetForm}},[l._v("\u53D6\u6D88")]),t("el-button",{attrs:{type:"primary",loading:e.isLoading},on:{click:e.submitForm}},[l._v("\u4FDD\u5B58")])],1)]),t("div",{staticClass:"detail-cont"},[t("div",{},[t("el-form",{ref:"formRef",attrs:{model:e.form,rules:e.rules,"label-width":"100px"}},[t("el-row",{staticClass:"form_header"},[t("el-col",{attrs:{span:12}},[t("el-form-item",{staticStyle:{"margin-left":"28px"},attrs:{label:"\u7EBF\u7D22\u6C60",prop:"customer_pools_id"}},[t("div",{staticStyle:{display:"flex"}},[t("el-select",{staticStyle:{width:"50%"},attrs:{disabled:e.type!=="add",clearable:"",placeholder:"\u8BF7\u9009\u62E9"},on:{change:e.getCanUseClueTemlates},model:{value:e.form.customer_pools_id,callback:function(s){l.$set(e.form,"customer_pools_id",s)},expression:"form.customer_pools_id"}},l._l(e.cluePoolList,function(s){return t("el-option",{key:s.id,attrs:{label:s.name,value:s.id}})}),1)],1)])],1),t("el-col",{attrs:{span:12}},[e.form.customer_pools_id?t("el-form-item",{staticStyle:{"margin-left":"20px"},attrs:{label:"\u7EBF\u7D22\u6A21\u677F",prop:"template_id"}},[t("el-select",{staticStyle:{width:"50%"},attrs:{disabled:e.type!=="add",placeholder:"\u8BF7\u9009\u62E9",clearable:""},on:{change:e.handleTemplate},model:{value:e.form.template_id,callback:function(s){l.$set(e.form,"template_id",s)},expression:"form.template_id"}},l._l(e.canUseClueTemplates,function(s){return t("el-option",{key:s.id,attrs:{label:s.name,value:s.id}})}),1),t("el-checkbox",{staticStyle:{"margin-left":"10px"},attrs:{disabled:e.type!=="add"},model:{value:e.form.is_claims,callback:function(s){l.$set(e.form,"is_claims",s)},expression:"form.is_claims"}},[l._v("\u76F4\u63A5\u9886\u53D6\u4E3A\u6211\u7684\u7EBF\u7D22 ")])],1):l._e()],1)],1),e.LJFromRefShow?t(e.LJFrom,{ref:"LJFromRef",staticClass:"form_header",staticStyle:{"margin-top":"20px","margin-bottom":"20px"},attrs:{templates:e.selectTemplate}}):l._e()],1)],1)])])},I=[],j=H(q,B,I,!1,null,"d279f394",null,null);const Q=j.exports;export{Q as default};
|