import{i as p,r as u,o as k}from"./vendor-39c32a1b.js";import{n as v,$ as d}from"./index-8fa791df.js";const h={__name:"customerDuplicationCheck",setup(_){const e=p({id:"",is_open:!0,condition:[]}),t=u(),n=p({}),i=u([]);k(()=>{a(),o()});function a(){HTTP.getRead("check_repeat",{type:2}).then(s=>{if(s.data.count){const c=s.data.results[0];e.id=c.id,e.is_open=c.customer_check_repeat===1,e.condition=c.keys.split(",").map(r=>({key:r}))}})}function o(){HTTP.get("templates_config",{key:"clue_customer_temp"}).then(s=>{i.value=JSON.parse(s.data.results[0].field_json)})}function m(){e.condition.push({key:""})}function f(){HTTP.patch("company",{id:d.getters.company,customer_check_repeat:e.is_open?1:0})}function l(){const s=e.condition.map(r=>r.key),c={id:e.id,type:2,company:d.getters.company,keys:s.join(",")};e.id?HTTP.patch("check_repeat",c):(delete c.id,HTTP.post("check_repeat",c).then(r=>{a()}))}function y(s){e.condition.splice(s,1),l()}return{__sfc:!0,form:e,formRef:t,rules:n,conditionList:i,getData:a,getCondition:o,addCondition:m,editCompany:f,saveCondition:l,deleteKey:y}}};var C=function(){var e=this,t=e._self._c,n=e._self._setupProxy;return t("div",{staticClass:"clues-checking"},[t("el-form",{ref:"formRef",attrs:{model:n.form,rules:n.rules,"label-width":"100px"}},[t("el-form-item",{attrs:{label:"\u67E5\u91CD\u5F00\u5173\uFF1A"}},[t("el-switch",{directives:[{name:"permission",rawName:"v-permission",value:34701,expression:"34701"}],on:{change:n.editCompany},model:{value:n.form.is_open,callback:function(i){e.$set(n.form,"is_open",i)},expression:"form.is_open"}}),t("span",{staticClass:"tips"},[e._v(" \u67E5\u91CD\u5F00\u5173\u6253\u5F00\u540E\uFF0C\u91CD\u590D\u4FE1\u606F\u5C06\u65E0\u6CD5\u5F55\u5165\u7CFB\u7EDF ")])],1),t("el-form-item",{attrs:{label:"\u67E5\u91CD\u6761\u4EF6\uFF1A"}},e._l(n.form.condition,function(i,a){return t("div",{key:a,staticClass:"condition"},[t("el-select",{staticStyle:{width:"200px"},attrs:{placeholder:"\u8BF7\u9009\u62E9"},on:{change:n.saveCondition},model:{value:i.key,callback:function(o){e.$set(i,"key",o)},expression:"item.key"}},e._l(n.conditionList,function(o){return t("el-option",{key:o.key,attrs:{label:o.name,value:o.key}})}),1),t("el-button",{attrs:{type:"text",icon:"el-icon-delete",circle:""},on:{click:function(o){return n.deleteKey(a)}}})],1)}),0),t("el-form-item",{attrs:{label:"\u67E5\u91CD\u6761\u4EF6\uFF1A"}},[t("el-button",{directives:[{name:"permission",rawName:"v-permission",value:34702,expression:"34702"}],attrs:{type:"primary"},on:{click:function(i){return n.addCondition()}}},[e._v("\u65B0\u589E\u6761\u4EF6")])],1)],1)],1)},b=[],g=v(h,C,b,!1,null,"a5c06adb",null,null);const $=g.exports;export{$ as default};
