UNPKG

beehole-store-server

Version:

www.bee-hole.com

1 lines 9.01 kB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-75bd1595","chunk-2d0b8b5f"],{"309e":function(e,t,n){"use strict";n.r(t);n("d81d"),n("4de4"),n("d3b7"),n("b0c0");var a=n("fcb7"),o=n("2dd7"),r=n("6b01");t["default"]={name:"CreateForm",props:{deptTypeOptions:{type:Array,required:!0},statusOptions:{type:Array,required:!0},deptOptions:{type:Array,required:!0},expandedKeys:{type:Array,required:!0}},components:{AntModal:o["a"],SelectDept:r["a"]},data:function(){var e=function(e,t,n){""===t?n(new Error("部门名不允许为空")):n()};return{loading:!1,parentIdShow:!1,hasChild:!1,selectScope:"all",deptTypeEnableValue:[],formTitle:"",currentRow:void 0,oldParentId:"",spinning:!1,delayTime:200,customStyle:"background: #fff;ssborder-radius: 4px;margin-bottom: 24px;border: 0;overflow: hidden",form:{id:void 0,pid:void 0,name:void 0,deptFullName:void 0,sort:0,type:"dept",leader:void 0,phone:void 0,address:void 0,zipCode:void 0,email:void 0,status:"1"},open:!1,rules:{pid:[{required:!1,message:this.$t("component.gangwei.dept.fater.not.null"),trigger:"blur"}],name:[{required:!0,message:this.$t("component.gangwei.dept.dept_name.not.null"),validator:e,trigger:"change"}],sort:[{required:!0,message:this.$t("component.gangwei.dept.sort.not.null"),trigger:"blur"}],email:[{type:"email",message:this.$t("component.gangwei.dept.email.not.null"),trigger:["blur","change"]}],phone:[{pattern:/^1[3|4|5|6|7|8|9][0-9]\d{8}$/,message:this.$t("component.gangwei.dept.phone.not.null"),trigger:"blur"}]}}},filters:{},created:function(){},computed:{},watch:{},methods:{onDeptTypeChange:function(e){"company"===e.target.value?this.selectScope="nonDept":this.selectScope="all"},onSelectDept:function(e){this.getDeptTypeEnableValue(e.types)},cancel:function(){this.open=!1,this.$emit("close")},reset:function(){void 0!==this.$refs.form&&this.$refs.form.resetFields()},getDeptTypeEnableValue:function(e){var t=this.form.id;if(this.deptTypeEnableValue="org"===e?this.deptTypeOptions.filter((function(e){return"org"!==e.value})).map((function(e){return e.value})):"company"===e?this.deptTypeOptions.filter((function(e){return"org"!==e.value&&"company"!==e.value})).map((function(e){return e.value})):this.deptTypeOptions.filter((function(e){return"dept"===e.value})).map((function(e){return e.value})),null!==t&&""!==t&&"undefined"!==t&&void 0!==t){null===e&&(this.deptTypeEnableValue=this.deptTypeOptions.filter((function(e){return"org"===e.value})).map((function(e){return e.value})));var n=this.form.type,a=this.deptTypeEnableValue.filter((function(e){return e===n}));this.form.type=0===a.length?this.deptTypeEnableValue[0]:n}else this.form.type=this.deptTypeEnableValue[0]},handleAdd:function(e){var t=this;this.parentIdShow=!0,this.oldParentId="",this.deptTypeEnableValue=this.deptTypeOptions.map((function(e){return e.value})),void 0!==e&&(this.currentRow=e,this.oldParentId=e.id,this.form.pid={ids:e.id,names:e.name},this.getDeptTypeEnableValue(e.type)),Object(a["c"])(void 0!==e?e.id:"0").then((function(e){t.form.treeSort=e})),this.$emit("getTreeselect"),this.formTitle=this.$t("component.gangwei.dept.add.dept"),this.open=!0},setNodeData:function(e){this.currentRow.name=e.name,this.currentRow.deptCode=e.deptCode,this.currentRow.leader=e.leader,this.currentRow.phone=e.phone,this.currentRow.email=e.email,this.currentRow.status=e.status,this.currentRow.treeSort=e.treeSort,this.currentRow.createTime=e.createTime,this.currentRow.deptType=e.type},handleUpdate:function(e){var t=this;this.currentRow=e,this.open=!0,this.formTitle=this.$t("component.gangwei.dept.update.dept"),this.hasChild=e.children.length>0,this.spinning=!this.spinning;var n=e.id;Object(a["d"])(n).then((function(e){t.oldParentId=e.pid,t.form=e,"0"!==e.pid?(t.parentIdShow=!0,Object(a["d"])(e.pid).then((function(e){t.getDeptTypeEnableValue(e.type)}))):(t.parentIdShow=!1,t.getDeptTypeEnableValue(null)),"company"===e.deptType&&(t.selectScope="nonDept"),Object(a["d"])(e.pid).then((function(n){t.form.pid={ids:e.pid,names:n.name}})),t.spinning=!t.spinning})),this.$emit("getTreeselect",e)},submitForm:function(){var e=this;this.$refs.form.validate((function(t){if(!t)return!1;var n=JSON.parse(JSON.stringify(e.form));void 0!==e.form.pid&&(n.pid=e.form.pid.ids),void 0!==e.form.id?Object(a["m"])(n).then((function(t){e.$message.success("修改成功",3),e.oldParentId!==e.form.pid.ids?e.$emit("ok"):Object(a["d"])(e.form.id).then((function(t){e.setNodeData(t)})),e.cancel()})):Object(a["a"])(n).then((function(t){e.$message.success("新增成功",3),e.$emit("ok"),e.cancel()}))}))},onLoadData:function(e){return new Promise((function(t){e.dataRef.children?t():Object(a["h"])(e.dataRef.id,1).then((function(n){e.dataRef.children=n,t()}))}))}}}},a839:function(e,t,n){"use strict";n.r(t);n("b0c0"),n("4e82");var a=function(){var e=this,t=e._self._c;return t("a-drawer",{attrs:{width:"480",title:e.formTitle,"label-col":4,"wrapper-col":14,visible:e.open,"body-style":{height:"calc(100vh - 100px)",overflow:"auto"}},on:{close:e.cancel}},[t("a-form-model",{ref:"form",attrs:{model:e.form,rules:e.rules,layout:"vertical"}},[t("a-spin",{attrs:{spinning:e.spinning,delay:e.delayTime,tip:"Loading..."}},[t("a-row",{staticClass:"form-row",attrs:{gutter:32}},[t("a-col",{attrs:{lg:12,md:12,sm:24}},[e.parentIdShow?t("a-form-model-item",{attrs:{label:e.$t("component.gangwei.dept.father.dept"),prop:"pid"}},[t("select-dept",{attrs:{"select-model":"single","select-scope":e.selectScope},on:{callBack:e.onSelectDept},model:{value:e.form.pid,callback:function(t){e.$set(e.form,"pid",t)},expression:"form.pid"}})],1):e._e()],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:e.$t("view.gangwei.dept.dept_name1"),prop:"name"}},[t("a-input",{attrs:{placeholder:e.$t("view.gangwei.dept.input.dept_name1")},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:e.$t("view.gangwei.dept.sort"),prop:"sort"}},[t("a-input-number",{staticStyle:{width:"100%"},attrs:{min:0},model:{value:e.form.sort,callback:function(t){e.$set(e.form,"sort",t)},expression:"form.sort"}})],1)],1)],1),t("a-collapse",{attrs:{bordered:!1,expandIconPosition:"left"},scopedSlots:e._u([{key:"expandIcon",fn:function(e){return[t("a-icon",{attrs:{type:"caret-right",rotate:e.isActive?90:0}})]}}])},[t("a-collapse-panel",{key:"1",style:e.customStyle,attrs:{header:e.$t("component.gangwei.dept.header")}},[t("a-row",{attrs:{gutter:32}},[t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:e.$t("view.gangwei.dept.responsible.person"),prop:"leader"}},[t("a-input",{attrs:{placeholder:e.$t("component.gangwei.dept.input.responsible.person")},model:{value:e.form.leader,callback:function(t){e.$set(e.form,"leader",t)},expression:"form.leader"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:e.$t("view.gangwei.dept.phone"),prop:"phone"}},[t("a-input",{attrs:{placeholder:e.$t("view.gangwei.dept.input.phone")},model:{value:e.form.phone,callback:function(t){e.$set(e.form,"phone",t)},expression:"form.phone"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:e.$t("component.gangwei.dept.address"),prop:"address"}},[t("a-input",{attrs:{placeholder:e.$t("component.gangwei.dept.input.address")},model:{value:e.form.address,callback:function(t){e.$set(e.form,"address",t)},expression:"form.address"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:e.$t("view.gangwei.dept.email"),prop:"email"}},[t("a-input",{attrs:{placeholder:e.$t("component.gangwei.dept.email.not.null")},model:{value:e.form.email,callback:function(t){e.$set(e.form,"email",t)},expression:"form.email"}})],1)],1),t("a-col",{attrs:{lg:12,md:12,sm:24}},[t("a-form-model-item",{attrs:{label:e.$t("view.gangwei.dept.status"),prop:"status"}},[t("a-radio-group",{attrs:{"button-style":"solid"},model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}},e._l(e.statusOptions,(function(n,a){return t("a-radio-button",{key:a,attrs:{value:n.value}},[e._v(e._s(n.label))])})),1)],1)],1),t("a-col",{attrs:{lg:24,md:24,sm:24,span:24}},[t("a-form-model-item",{attrs:{label:e.$t("component.gangwei.dept.remark"),prop:"remark"}},[t("a-input",{attrs:{placeholder:e.$t("component.gangwei.dept.input.remark"),type:"textarea","allow-clear":""},model:{value:e.form.remark,callback:function(t){e.$set(e.form,"remark",t)},expression:"form.remark"}})],1)],1)],1)],1)],1)],1),t("div",{staticClass:"bottom-control"},[t("a-space",[t("a-button",{attrs:{type:"primary"},on:{click:e.submitForm}},[e._v(" "+e._s(e.$t("component.gangwei.dept.save.btn"))+" ")]),t("a-button",{on:{click:e.cancel}},[e._v(" "+e._s(e.$t("component.gangwei.dept.cancle.btn"))+" ")])],1)],1)],1)],1)},o=[],r=n("5530"),i=n("309e"),s=Object(r["a"])({},i["default"]),l=s,p=n("2877"),d=Object(p["a"])(l,a,o,!1,null,null,null);t["default"]=d.exports}}]);