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.
1 line
18 KiB
1 line
18 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-3146"],{"3ziQ":function(e,t,i){},C3Po:function(e,t,i){"use strict";var a=i("QbLZ"),s=i.n(a),l=i("8GhS"),n=i("zsVz"),o=i("gVZb"),r=i("EP+0"),d=i("XAon"),c=i("3pgX"),f=i("Woz+"),m=i("bWDp"),u={name:"WkForm",components:{WkUserSelect:d.a,WkDepSelect:c.a,VDistpicker:f.a,XhFiles:l.f},mixins:[m.a],inheritAttrs:!1,props:{fieldFrom:{type:Object,default:function(){return{}}},fieldList:{type:Array,default:function(){return[]}},customClass:{type:String,default:"is-two-columns"}},data:function(){return{instance:null}},computed:{},watch:{},mounted:function(){var e=this;this.$nextTick(function(){e.instance=e.$refs.form})},beforeDestroy:function(){},methods:{}},p=(i("mYM5"),i("lSFU"),i("KHd+")),h=Object(p.a)(u,function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("el-form",e._g(e._b({ref:"form",staticClass:"wk-form",class:e.customClass},"el-form",e.$attrs,!1),e.$listeners),[e._l(e.fieldList,function(t,a){return i("el-form-item",{key:a,class:[t.className||"","is-"+t.form_type],attrs:{prop:t.field}},[i("template",{slot:"label"},[e._v("\n "+e._s(t.name)+"\n "),i("span",{staticStyle:{color:"#999"}},[e._v("\n "+e._s(e.getTips(t))+"\n ")])]),e._v(" "),"text"==t.form_type?i("el-input",{attrs:{disabled:t.disabled,maxlength:100,placeholder:t.placeholder,type:t.form_type},on:{input:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):e._e(),e._v(" "),e.isTrimInput(t.form_type)?i("el-input",{attrs:{disabled:t.disabled,maxlength:100,placeholder:t.placeholder,type:"text"},on:{input:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,"string"==typeof i?i.trim():i)},expression:"fieldFrom[item.field]"}}):"number"==t.form_type?i("el-input-number",{attrs:{placeholder:t.placeholder,disabled:t.disabled,controls:!1},on:{input:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):"floatnumber"==t.form_type?i("el-input-number",{attrs:{placeholder:t.placeholder,disabled:t.disabled,controls:!1},on:{change:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):"textarea"==t.form_type?i("el-input",{attrs:{disabled:t.disabled,rows:3,autosize:{minRows:3},maxlength:800,placeholder:t.placeholder,type:t.form_type,resize:"none"},on:{input:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):["checkbox","select"].includes(t.form_type)?i("el-select",{staticStyle:{width:"100%"},attrs:{disabled:t.disabled,clearable:t.clearable,placeholder:t.placeholder,multiple:"checkbox"===t.form_type},on:{change:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}},e._l(t.setting,function(t,a){return i("el-option",{key:a,attrs:{label:e.isEmptyValue(t.value)?t:t.label||t.name,value:e.isEmptyValue(t.value)?t:t.value}})})):"checkbox"==t.form_type?i("el-select",{staticStyle:{width:"100%"},attrs:{disabled:t.disabled,clearable:t.clearable,placeholder:t.placeholder,multiple:""},on:{change:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}},e._l(t.setting,function(t,a){return i("el-option",{key:a,attrs:{label:e.isEmptyValue(t.value)?t:t.label||t.name,value:e.isEmptyValue(t.value)?t:t.value}})})):"date"==t.form_type?i("el-date-picker",{staticStyle:{width:"100%"},attrs:{disabled:t.disabled,clearable:"",type:"date","value-format":"yyyy-MM-dd",placeholder:"选择日期"},on:{change:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):"dateRange"==t.form_type?i("el-date-picker",{staticStyle:{width:"100%"},attrs:{disabled:t.disabled,type:t.dateType||"daterange","value-format":t.dateValueFormat||"yyyy-MM-dd",clearable:"","start-placeholder":"开始日期","end-placeholder":"结束日期"},on:{change:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):"datetime"==t.form_type?i("el-date-picker",{staticStyle:{width:"100%"},attrs:{disabled:t.disabled,clearable:"",type:"datetime","value-format":"yyyy-MM-dd HH:mm:ss",placeholder:"选择日期"},on:{change:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):"structure"==t.form_type?i("wk-dep-select",{staticStyle:{width:"100%"},attrs:{request:t.request,props:t.props,params:t.params,disabled:t.disabled,radio:!!e.isEmptyValue(t.radio)||t.radio},on:{change:function(i){e.depOrUserChange(t,a,arguments[0],arguments[1])}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):["single_user","user"].includes(t.form_type)?i("wk-user-select",{staticStyle:{width:"100%"},attrs:{request:t.request,props:t.props,params:t.params,disabled:t.disabled,radio:!!e.isEmptyValue(t.radio)||t.radio},on:{change:function(i){e.depOrUserChange(t,a,arguments[0],arguments[1])}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}}):"radio"==t.form_type?i("el-radio-group",{attrs:{disabled:t.disabled,placeholder:t.placeholder},on:{change:function(i){e.commonChange(t,a,i)}},model:{value:e.fieldFrom[t.field],callback:function(i){e.$set(e.fieldFrom,t.field,i)},expression:"fieldFrom[item.field]"}},e._l(t.setting,function(t,a){return i("el-radio",{key:a,attrs:{label:e.isEmptyValue(t.value)?t:t.value}},[e._v("\n "+e._s(e.isEmptyValue(t.value)?t:t.label||t.name)+"\n ")])})):e._e(),e._v(" "),"address"==t.form_type?i("v-distpicker",{attrs:{province:e.fieldFrom[t.field].province,city:e.fieldFrom[t.field].city,area:e.fieldFrom[t.field].area},on:{province:function(i){e.selectProvince(i,t,a)},city:function(i){e.selectCity(i,t,a)},area:function(i){e.selectArea(i,t,a)}}}):e._e(),e._v(" "),"file"==t.form_type?i("xh-files",{attrs:{value:e.fieldFrom[t.field],disabled:t.disabled},on:{"value-change":function(i){e.oldChange(i,t,a)}}}):[e._t("default",null,{data:t})]],2)}),e._v(" "),e._t("suffix")],2)},[],!1,null,"4253d342",null);h.options.__file="index.vue";var b=h.exports,_=i("HslM"),v=i("EBQf"),y=i("z5u8"),k=i("hwzM"),g=i("kK4T"),F=i("IEYw"),C=i("7Qib"),x=i("L2JU"),w={name:"TaskCreate",components:{XrCreate:o.a,CreateSections:r.a,WkForm:b,TagIndex:_.a,RelatedBusiness:v.a,CRMFullScreenDetail:function(){return Promise.all([i.e("chunk-1bca"),i.e("chunk-2455"),i.e("chunk-2a3e"),i.e("chunk-21d9"),i.e("chunk-54ce")]).then(i.bind(null,"3z7q"))},SubTask:y.a,FileCell:k.a},mixins:[F.a,g.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(C.s)(),allData:{},relatedID:"",relatedCRMType:"",showRelatedDetail:!1}},computed:s()({},Object(x.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",form_type:"textarea",setting:[]},{name:"描述",field:"description",form_type:"textarea",setting:[]},{name:"优先级",field:"priority",form_type:"select",setting:this.getPrioritySetting()},{name:"负责人",field:"main_user_id",radio:!0,form_type:"user",setting:[]},{name:"开始时间",field:"start_time",form_type:"date",setting:[]},{name:"结束时间",field:"stop_time",form_type:"date",setting:[]},{name:"参与人",field:"owner_user_id",radio:!1,form_type:"user",setting:[]},{name:"标签",field:"lable_id",form_type:"tag",setting:[]},{name:"相关信息",field:"relatedObj",form_type:"relatedBusiness",setting:[]},{name:"子任务",field:"subtask",form_type:"subTask",setting:[]},{name:"附件",field:"files",form_type:"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(i){if(!i)return e.loading=!1,e.getFormErrorMessage(t),!1;e.submiteParams()})},submiteParams:function(){var e=this,t={batchId:this.batchId};this.action.params&&(t=s()({},t,this.action.params)),this.fieldList.forEach(function(i){if("user"===i.form_type&&0==i.radio){var a=e.fieldForm[i.field]?e.fieldForm[i.field]:[];t[i.field]=a.join(",")}else if("tag"===i.form_type){var s=e.fieldForm[i.field]?e.fieldForm[i.field]:[];t[i.field]=s.map(function(e){return e.lable_id}).join(",")}else if("relatedBusiness"===i.form_type){var l=e.fieldForm[i.field]?e.fieldForm[i.field]:{};t.customer_ids=l.customerIds&&l.customerIds.length?l.customerIds:[],t.contacts_ids=l.contactsIds&&l.contactsIds.length?l.contactsIds:[],t.business_ids=l.businessIds&&l.businessIds.length?l.businessIds:[],t.contract_ids=l.contractIds&&l.contractIds.length?l.contractIds:[]}else if("subTask"===i.form_type){var n=e.fieldForm[i.field]||[];t[i.field]=n.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"!==i.form_type?t[i.field]=e.fieldForm[i.field]:"taskFile"===i.form_type&&(t.files=e.fieldForm[i.field]?e.fieldForm[i.field].map(function(e){return e.file_id}):[])}),Object(n.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,i,a){},otherChange:function(e,t){this.$set(this.fieldForm,t.field,e.value||e),this.$refs.crmForm.instance.validateField(t.field)},checkRelatedDetail:function(e,t){this.relatedID=t[e+"_id"],this.relatedCRMType=e,this.showRelatedDetail=!0},subTaskDelete:function(e,t,i){this.fieldForm[i.field].splice(t,1)},subTaskAdd:function(e,t){var i=this.fieldForm[t.field]||[];i.push(e),this.$set(this.fieldForm,t.field,i)},httpRequest:function(e){var t=this;this.$wkUploadFile.upload({file:e.file,params:{type:"file"}}).then(function(e){var i=e.res.data||{},a=t.fieldForm.files||[];a.push(i),t.$set(t.fieldForm,"files",a),t.$message.success("上传成功")}).catch(function(){})},fileDelete:function(e,t,i){this.fieldForm.files.splice(e,1)},close:function(){this.$emit("close")}}},S=(i("ya9m"),Object(p.a)(w,function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("xr-create",{attrs:{loading:e.loading,title:e.title},on:{close:e.close,save:e.saveClick}},[i("create-sections",{attrs:{title:"基本信息"}},[i("wk-form",{ref:"crmForm",attrs:{model:e.fieldForm,rules:e.fieldRules,"field-from":e.fieldForm,"field-list":e.fieldList,"label-position":"top"},on:{change:e.formChange},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.data;return[a&&"tag"==a.form_type?i("div",{staticClass:"label"},[e._l(e.fieldForm[a.field],function(t,a){return i("span",{key:a,staticClass:"item-color",style:{background:t.color?t.color:"#ccc"}},[e._v("\n "+e._s(t.labelName||t.name)+"\n ")])}),e._v(" "),i("div",{staticClass:"add-tag"},[i("tag-index",{attrs:{placement:"right"},on:{change:function(t){e.otherChange(t,a)}}},[i("span",{staticClass:"add-btn",attrs:{slot:"editIndex"},slot:"editIndex"},[i("i",{staticClass:"wk wk-l-plus"}),e._v(" "),i("span",{staticClass:"label"},[e._v("标签")])])])],1)],2):e._e(),e._v(" "),a&&"relatedBusiness"==a.form_type?i("related-business",{attrs:{"margin-left":"0","all-data":e.allData},on:{checkInfos:function(t){e.otherChange(t,a)},checkRelatedDetail:e.checkRelatedDetail}}):e._e(),e._v(" "),a&&"subTask"==a.form_type?[e.fieldForm[a.field]?e._l(e.fieldForm[a.field],function(t,s){return i("div",{key:s},[i("flexbox",{staticClass:"sub-task"},[i("div",{on:{click:function(e){e.stopPropagation()}}},[i("el-checkbox",{model:{value:t.checked,callback:function(i){e.$set(t,"checked",i)},expression:"item.checked"}})],1),e._v(" "),i("div",{staticClass:"sub-task__bd text-one-line",class:{"is-checked":t.checked}},[e._v("\n "+e._s(t.name)+"\n ")]),e._v(" "),i("div",{staticClass:"edit-del-box"},[i("span",{staticClass:"xr-text-btn delete",on:{click:function(i){e.subTaskDelete(t,s,a)}}},[e._v("删除")])]),e._v(" "),t.stopTime||t.stop_time?i("div",{staticClass:"bg-color task-bg-color",staticStyle:{"margin-left":"8px"}},[e._v(e._s(e._f("moment")(t.stopTime||t.stop_time,"YYYY-MM-DD"))+" 截止")]):e._e(),e._v(" "),t.mainUser?i("xr-avatar",{staticClass:"user-img",attrs:{name:t.mainUser.realname,size:25,src:t.mainUser.img}}):e._e()],1)],1)}):e._e(),e._v(" "),e.addSubtasks?i("div",[i("span",{staticClass:"add-btn",on:{click:function(t){e.addSubtasks=!1}}},[i("i",{staticClass:"wk wk-l-plus"}),e._v(" "),i("span",{staticClass:"label"},[e._v("子任务")])])]):i("sub-task",{attrs:{"sub-task-com":"new","check-disabled":!1},on:{add:function(t){e.subTaskAdd(t,a)},close:function(t){e.addSubtasks=!0}}})]:e._e(),e._v(" "),a&&"taskFile"==a.form_type?[e._l(e.fieldForm[a.field],function(t,s){return i("file-cell",{key:s,attrs:{data:t,list:e.fieldForm[a.field],"cell-index":s,"show-delete":""},on:{delete:function(t){e.fileDelete(arguments[0],arguments[1],a)}}})}),e._v(" "),i("el-upload",{staticClass:"upload-file",attrs:{"http-request":e.httpRequest,action:"https://jsonplaceholder.typicode.com/posts/",multiple:"","list-type":"picture"}},[i("span",{staticClass:"add-btn"},[i("i",{staticClass:"wk wk-l-plus"}),e._v(" "),i("span",{staticClass:"label"},[e._v("附件")])])])]:e._e()]}}])})],1),e._v(" "),i("c-r-m-full-screen-detail",{attrs:{visible:e.showRelatedDetail,"crm-type":e.relatedCRMType,id:e.relatedID},on:{"update:visible":function(t){e.showRelatedDetail=t}}})],1)},[],!1,null,"64cbc128",null));S.options.__file="Create.vue";var U=S.exports,$=i("jtZb"),T={relatedObj:{},relatedObjIds:{}},M={name:"TaskQuickAdd",components:{XhUserCell:l.p,TaskCreate:U},props:{showStyle:{type:String,default:"default"},params:Object,props:Object},data:function(){return{sendLoading:!1,isUnfold:!1,sendContent:"",sendStopTime:"",mainUser:[],taskCreateShow:!1,createAction:{type:"save"}}},computed:{createMainUser:function(){return this.mainUser&&this.mainUser.length?this.mainUser[0]:null},config:function(){return Object($.a)(s()({},T),this.props||{})}},watch:{},mounted:function(){},beforeDestroy:function(){},methods:{inputFocus:function(){var e=this;this.$emit("focus"),this.isUnfold=!0,this.$nextTick(function(){e.$refs.input.focus()})},selectMainUser:function(e){this.mainUser=e.value},send:function(){var e=this;if(this.sendContent.length){this.sendLoading=!0;var t={name:this.sendContent,stop_time:this.sendStopTime,main_user_id:this.createMainUser?this.createMainUser.id:""};this.params&&(t=s()({},t,this.params)),Object(n.f)(t).then(function(t){e.sendLoading=!1,e.$message.success("新建成功"),e.resetSendData(),e.$emit("send")}).catch(function(){e.sendLoading=!1})}else this.$message.error("请填写任务标题")},resetSendData:function(){this.sendContent="",this.sendStopTime="",this.mainUser=[],this.isUnfold=!1},createSuccess:function(){this.resetSendData(),this.$emit("send")},addClose:function(){this.isUnfold=!1},moreClick:function(){this.createAction={type:"save",data:{name:this.sendContent,stopTime:this.sendStopTime,mainUserId:this.createMainUser?this.createMainUser.id:"",relatedObj:this.config.relatedObj,relatedObjIds:this.config.relatedObjIds},params:this.params},this.taskCreateShow=!0}}},I=(i("mMaV"),Object(p.a)(M,function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{directives:[{name:"loading",rawName:"v-loading",value:e.sendLoading,expression:"sendLoading"}],staticClass:"task-quick-add",class:["add",{unfold:e.isUnfold,"is-close":!e.isUnfold,"hide-border":"hideBorder"===e.showStyle&&!e.isUnfold}]},[e.isUnfold?i("i",{staticClass:"wk wk-close",on:{click:e.addClose}}):e._e(),e._v(" "),i("el-input",{ref:"input",staticClass:"input",attrs:{maxlength:100,"prefix-icon":e.isUnfold?"":"el-icon-plus",placeholder:"添加任务"},on:{focus:e.inputFocus},model:{value:e.sendContent,callback:function(t){e.sendContent=t},expression:"sendContent"}}),e._v(" "),i("flexbox",{staticClass:"add-info"},[i("el-date-picker",{ref:"endTime",class:{"no-time-top":!e.sendStopTime},attrs:{type:"date","value-format":"yyyy-MM-dd",placeholder:""},model:{value:e.sendStopTime,callback:function(t){e.sendStopTime=t},expression:"sendStopTime"}}),e._v(" "),i("xh-user-cell",{attrs:{value:e.mainUser,radio:"",placement:"top"},on:{"value-change":e.selectMainUser}},[i("div",{staticClass:"select-user",attrs:{slot:"reference"},slot:"reference"},[e.createMainUser?i("xr-avatar",{staticClass:"add-info__interval",attrs:{name:e.createMainUser.realname,size:24,src:e.createMainUser.img}}):i("i",{staticClass:"wk wk-persons add-info__btn add-info__interval"})],1)]),e._v(" "),i("i",{staticClass:"el-icon-more add-info__btn add-info__interval",on:{click:e.moreClick}})],1),e._v(" "),"hideBorder"===e.showStyle?i("el-button",{directives:[{name:"debounce",rawName:"v-debounce",value:e.send,expression:"send"}],staticClass:"send-btn",attrs:{type:"primary"}},[e._v("保存")]):i("el-button",{directives:[{name:"debounce",rawName:"v-debounce",value:e.send,expression:"send"}],staticClass:"send-btn",attrs:{icon:"wk wk-top",type:"primary"}},[e._v("发布")]),e._v(" "),e.taskCreateShow?i("task-create",{attrs:{action:e.createAction},on:{save:e.createSuccess,close:function(t){e.taskCreateShow=!1}}}):e._e()],1)},[],!1,null,"518e53f2",null));I.options.__file="TaskQuickAdd.vue";t.a=I.exports},Pqxw:function(e,t,i){e.exports={xrColorPrimary:"#2362FB"}},dnM3:function(e,t,i){},lSFU:function(e,t,i){"use strict";var a=i("dnM3");i.n(a).a},mMaV:function(e,t,i){"use strict";var a=i("nMuH");i.n(a).a},mYM5:function(e,t,i){"use strict";var a=i("Pqxw");i.n(a).a},nMuH:function(e,t,i){},ya9m:function(e,t,i){"use strict";var a=i("3ziQ");i.n(a).a}}]); |