You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wkcrm/static/js/chunk-ef37.939adaca.js

1 line
12 KiB

4 years ago
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-ef37"],{"5J4o":function(e,t,s){"use strict";var i=s("SFPr");s.n(i).a},C3Po:function(e,t,s){"use strict";var i=s("QbLZ"),a=s.n(i),n=s("8GhS"),l=s("zsVz"),o=s("gVZb"),r=s("EP+0"),d=s("UGe0"),c=s("HslM"),f=s("EBQf"),u=s("z5u8"),m=s("hwzM"),p=s("kK4T"),h=s("IEYw"),v=s("7Qib"),_=s("L2JU"),b={name:"TaskCreate",components:{XrCreate:o.a,CreateSections:r.a,WkForm:d.a,TagIndex:c.a,RelatedBusiness:f.a,CRMFullScreenDetail:function(){return Promise.all([s.e("chunk-024e"),s.e("chunk-424d"),s.e("chunk-71dc"),s.e("chunk-6d9c"),s.e("chunk-5958")]).then(s.bind(null,"3z7q"))},SubTask:u.a,FileCell:m.a},mixins:[h.a,p.a],props:{action:{type:Object,default:function(){return{type:"save",id:"",data:{}}}}},data:function(){return{loading:!1,fieldList:[],fieldForm:{},fieldRules:{name:{required:!0,message:"任务名称不能为空",trigger:["blur","change"]}},addSubtasks:!0,batchId:Object(v.s)(),allData:{},relatedID:"",relatedCRMType:"",showRelatedDetail:!1}},computed:a()({},Object(_.b)(["userInfo"]),{title:function(){return"update"===this.action.type?"编辑任务":"新建任务"}}),watch:{},created:function(){var e={priority:0,main_user_id:this.userInfo.id,owner_user_id:[this.userInfo]};if(this.action.data){var t=this.action.data;t.name&&(e.name=t.name),e.stopTime=t.stopTime||"",t.main_user_id&&(e.main_user_id=t.main_user_id),t.relatedObj&&(this.allData=t.relatedObj,e.relatedObj=t.relatedObjIds)}this.fieldForm=e,this.getField()},mounted:function(){},beforeDestroy:function(){},methods:{getField:function(){var e=[{name:"任务名称",field:"name",formType:"textarea",setting:[]},{name:"描述",field:"description",formType:"textarea",setting:[]},{name:"优先级",field:"priority",formType:"select",setting:this.getPrioritySetting()},{name:"负责人",field:"main_user_id",radio:!0,formType:"user",setting:[]},{name:"开始时间",field:"start_time",formType:"date",setting:[]},{name:"结束时间",field:"stop_time",formType:"date",setting:[]},{name:"参与人",field:"owner_user_id",radio:!1,formType:"user",setting:[]},{name:"标签",field:"lable_id",formType:"tag",setting:[]},{name:"相关信息",field:"relatedObj",formType:"relatedBusiness",setting:[]},{name:"子任务",field:"subtask",formType:"subTask",setting:[]},{name:"附件",field:"files",formType:"taskFile",setting:[]}];this.fieldList=e},getPrioritySetting:function(){return this.priorityList.map(function(e){return{label:e.label,value:e.id}})},saveClick:function(){var e=this;this.loading=!0;var t=this.$refs.crmForm.instance;t.validate(function(s){if(!s)return e.loading=!1,e.getFormErrorMessage(t),!1;e.submiteParams()})},submiteParams:function(){var e=this,t={batchId:this.batchId};this.action.params&&(t=a()({},t,this.action.params)),this.fieldList.forEach(function(s){if("user"===s.formType&&0==s.radio){var i=e.fieldForm[s.field]?e.fieldForm[s.field]:[];t[s.field]=i.join(",")}else if("tag"===s.formType){var a=e.fieldForm[s.field]?e.fieldForm[s.field]:[];t[s.field]=a.map(function(e){return e.lable_id}).join(",")}else if("relatedBusiness"===s.formType){var n=e.fieldForm[s.field]?e.fieldForm[s.field]:{};t.customer_ids=n.customerIds&&n.customerIds.length?n.customerIds:[],t.contacts_ids=n.contactsIds&&n.contactsIds.length?n.contactsIds:[],t.business_ids=n.businessIds&&n.businessIds.length?n.businessIds:[],t.contract_ids=n.contractIds&&n.contractIds.length?n.contractIds:[]}else if("subTask"===s.formType){var l=e.fieldForm[s.field]||[];t[s.field]=l.map(function(e){return{status:e.checked?5:1,owner_user_id:e.mainUser?e.mainUser.id:"",name:e.name,stop_time:e.stop_time}})}else"taskFile"!==s.formType?t[s.field]=e.fieldForm[s.field]:"taskFile"===s.formType&&(t.files=e.fieldForm[s.field]?e.fieldForm[s.field].map(function(e){return e.file_id}):[])}),Object(l.f)(t).then(function(t){e.loading=!1,e.$message.success("update"==e.action.type?"编辑成功":"添加成功"),e.close(),e.$emit("save")}).catch(function(){e.loading=!1})},formChange:function(e,t,s,i){},otherChange:function(e,t){this.$set(this.fieldForm,t.field,e.value||e),this.$refs.crmForm.instance.