2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4f404593"],{"28ea":function(t,e,a){"use strict";a("453e")},"2c4a":function(t,e,a){},"453e":function(t,e,a){},"7cad":function(t,e,a){},"86fa":function(t,e,a){"use strict";a.r(e);var s=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{staticClass:"ibox"},[e("div",{staticClass:"flex justify-between",attrs:{slot:"header"},slot:"header"},[e("span",[t._v(t._s(t.$t("staff.queryCondition")))])]),e("div",{},[e("el-form",{staticClass:"flex justify-start",attrs:{inline:!0,model:t.staffInfo.conditions}},[e("el-form-item",[e("el-input",{attrs:{placeholder:t.$t("staff.inputStaffName"),clearable:""},model:{value:t.staffInfo.conditions.name,callback:function(e){t.$set(t.staffInfo.conditions,"name",e)},expression:"staffInfo.conditions.name"}})],1),e("el-form-item",[e("el-input",{attrs:{placeholder:t.$t("staff.inputPhone"),clearable:""},model:{value:t.staffInfo.conditions.tel,callback:function(e){t.$set(t.staffInfo.conditions,"tel",e)},expression:"staffInfo.conditions.tel"}})],1),e("el-form-item",[e("el-input",{attrs:{placeholder:t.$t("staff.inputStaffId"),clearable:""},model:{value:t.staffInfo.conditions.staffId,callback:function(e){t.$set(t.staffInfo.conditions,"staffId",e)},expression:"staffInfo.conditions.staffId"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t._queryStaffMethod}},[t._v(t._s(t.$t("staff.query")))]),e("el-button",{on:{click:t._resetStaffMethod}},[t._v(t._s(t.$t("staff.reset")))])],1)],1)],1)]),e("el-card",{staticClass:"margin-top-sm"},[e("div",{staticClass:"flex justify-between",attrs:{slot:"header"},slot:"header"},[e("span",[t._v(t._s(t.$t("staff.staffManagement")))]),e("el-button",{staticClass:"float-right",attrs:{type:"primary",size:"small"},on:{click:t._openAddStaffStepPage}},[t._v(" "+t._s(t.$t("staff.add"))+" ")])],1),e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.staffData,border:""}},[e("el-table-column",{attrs:{prop:"userId",label:t.$t("staff.staffId"),align:"center"}}),e("el-table-column",{attrs:{prop:"name",label:t.$t("staff.name"),align:"center"}}),e("el-table-column",{attrs:{prop:"tel",label:t.$t("staff.phone"),align:"center"}}),e("el-table-column",{attrs:{prop:"orgName",label:t.$t("staff.relatedOrg"),align:"center"}}),e("el-table-column",{attrs:{prop:"relCdName",label:t.$t("staff.position"),align:"center"}}),e("el-table-column",{attrs:{prop:"email",label:t.$t("staff.email"),align:"center"}}),e("el-table-column",{attrs:{prop:"address",label:t.$t("staff.address"),align:"center"}}),e("el-table-column",{attrs:{prop:"sex",label:t.$t("staff.gender"),align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(0==e.row.sex?t.$t("staff.male"):t.$t("staff.female"))+" ")]}}])}),e("el-table-column",{attrs:{label:t.$t("staff.operation"),align:"center",width:"300"},scopedSlots:t._u([{key:"default",fn:function(a){return[e("el-button",{attrs:{size:"mini"},on:{click:function(e){return t.openEditStaff(a.row)}}},[t._v(" "+t._s(t.$t("staff.edit"))+" ")]),e("el-button",{attrs:{size:"mini"},on:{click:function(e){return t._resetStaffPwd(a.row)}}},[t._v(" "+t._s(t.$t("staff.resetPassword"))+" ")]),600311000001!=a.row.relCd?e("el-button",{attrs:{size:"mini",type:"danger"},on:{click:function(e){return t.openDeleteStaff(a.row)}}},[t._v(" "+t._s(t.$t("staff.delete"))+" ")]):t._e(),e("el-button",{attrs:{size:"mini"},on:{click:function(e){return t.openStaffDetail(a.row)}}},[t._v(" "+t._s(t.$t("staff.detail"))+" ")])]}}])})],1),e("el-row",{staticClass:"margin-top"},[e("el-col",{attrs:{span:16}},[e("div",{staticClass:"tip"},[t._v(" "+t._s(t.$t("staff.tip"))+" ")])]),e("el-col",{attrs:{span:8}},[e("el-pagination",{attrs:{"current-page":t.pagination.currentPage,"page-size":t.pagination.pageSize,layout:"total, prev, pager, next",total:t.pagination.total},on:{"current-change":t.currentPage}})],1)],1)],1),e("reset-staff-pwd",{ref:"resetStaffPwd"}),e("edit-staff",{ref:"editStaff",on:{"staff-updated":t._listStaffs}}),e("delete-staff",{ref:"deleteStaff",on:{"staff-deleted":t._listStaffs}})],1)},f=[],i=a("7323"),o=a("94d1"),n=a("cbfd"),r=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:t.$t("editStaff.editStaff"),visible:t.dialogVisible,width:"60%",center:""},on:{"update:visible":function(e){t.dialogVisible=e}}},[e("el-form",{attrs:{model:t.editStaffInfo,"label-width":"120px"}},[e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:t.$t("editStaff.name"),required:""}},[e("el-input",{attrs:{placeholder:t.$t("editStaff.inputName")},model:{value:t.editStaffInfo.username,callback:function(e){t.$set(t.editStaffInfo,"username",e)},expression:"editStaffInfo.username"}})],1),e("el-form-item",{attrs:{label:t.$t("editStaff.position"),required:""}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:t.$t("editStaff.selectPosition")},model:{value:t.editStaffInfo.relCd,callback:function(e){t.$set(t.editStaffInfo,"relCd",e)},expression:"editStaffInfo.relCd"}},t._l(t.editStaffInfo.relCds,(function(t,a){return e("el-option",{key:a,attrs:{label:t.name,value:t.statusCd}})})),1)],1),e("el-form-item",{attrs:{label:t.$t("editStaff.email")}},[e("el-input",{attrs:{placeholder:t.$t("editStaff.inputEmail")},model:{value:t.editStaffInfo.email,callback:function(e){t.$set(t.editStaffInfo,"email",e)},expression:"editStaffInfo.email"}})],1),e("el-form-item",{attrs:{label:t.$t("editStaff.phone"),required:""}},[e("el-input",{attrs:{placeholder:t.$t("editStaff.inputPhone")},model:{value:t.editStaffInfo.tel,callback:function(e){t.$set(t.editStaffInfo,"tel",e)},expression:"editStaffInfo.tel"}})],1),e("el-form-item",{attrs:{label:t.$t("editStaff.gender"),required:""}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:t.$t("editStaff.selectGender")},model:{value:t.editStaffInfo.sex,callback:function(e){t.$set(t.editStaffInfo,"sex",e)},expression:"editStaffInfo.sex"}},[e("el-option",{attrs:{label:t.$t("editStaff.male"),value:"0"}}),e("el-option",{attrs:{label:t.$t("editStaff.female"),value:"1"}})],1)],1),e("el-form-item",{attrs:{label:t.$t("editStaff.address"),required:""}},[e("el-input",{attrs:{placeholder:t.$t("editStaff.inputAddress")},model:{value:t.editStaffInfo.address,callback:function(e){t.$set(t.editStaffInfo,"address",e)},expression:"editStaffInfo.address"}})],1)],1),e("el-col",{staticClass:"text-center",attrs:{span:12}},[e("el-image",{staticStyle:{width:"100%",height:"200px"},attrs:{src:t.editStaffInfo.photoUrl,fit:"contain"}},[e("div",{staticClass:"image-slot",attrs:{slot:"error"},slot:"error"},[e("img",{staticStyle:{width:"100%",height:"100%"},attrs:{src:"/img/noPhoto.jpg"}})])]),e("el-upload",{staticClass:"margin-top",attrs:{action:"","auto-upload":!1,"show-file-list":!1,"on-change":t.handleChange}},[e("el-button",{attrs:{size:"small",type:"primary"}},[t._v(t._s(t.$t("editStaff.uploadPhoto")))])],1)],1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v(t._s(t.$t("editStaff.cancel")))]),e("el-button",{attrs:{type:"primary"},on:{click:t.editStaffSubmit}},[t._v(t._s(t.$t("editStaff.confirm")))])],1)],1)},l=[],d={name:"EditStaff",data(){return{dialogVisible:!1,editStaffInfo:{userId:"",username:"",email:"",tel:"",sex:"",address:"",errorInfo:"",photo:"",photoUrl:"",relCd:"",relCds:[],name:"",staffId:""}}},methods:{open(t){this.dialogVisible=!0,this.refreshEditStaffInfo(t),this.editStaffInfo.photo=t.faceUrl,this.editStaffInfo.photoUrl=t.faceUrl,this.getRelCds()},refreshEditStaffInfo(t){this.editStaffInfo={...this.editStaffInfo,...t,username:t.name}},async getRelCds(){try{const{data:t}=await Object(i["e"])("u_org_staff_rel","rel_cd");this.editStaffInfo.relCds=t}catch(t){console.error("获取岗位字典失败:",t)}},handleChange(t){if(t.size>2097152)return this.$message.error(this.$t("editStaff.imageSizeLimit")),!1;this.uploadImage(t.raw)},async uploadImage(t){const e=new FormData;e.append("uploadFile",t);try{const t=await Object(o["g"])(e);this.editStaffInfo.photo=t.data.fileId,this.editStaffInfo.photoUrl=t.data.url}catch(a){this.$message.error(a.message)}},validateForm(){return!this.editStaffInfo.username||this.editStaffInfo.username.length<2||this.editStaffInfo.username.length>10?(this.$message.error(this.$t("editStaff.nameValidate")),!1):this.editStaffInfo.tel?this.editStaffInfo.sex?!(!this.editStaffInfo.address||this.editStaffInfo.address.length>200)||(this.$message.error(this.$t("editStaff.addressValidate")),!1):(this.$message.error(this.$t("editStaff.genderRequired")),!1):(this.$message.error(this.$t("editStaff.phoneRequired")),!1)},async editStaffSubmit(){if(this.validateForm()){this.editStaffInfo.name=this.editStaffInfo.username,this.editStaffInfo.staffId=this.editStaffInfo.userId;try{const t=await Object(o["e"])(this.editStaffInfo);0===t.code?(this.$message.success(this.$t("editStaff.editSuccess")),this.$emit("staff-updated"),this.dialogVisible=!1):this.$message.error(t.msg)}catch(t){this.$message.error(t.message)}}}}},c=d,u=(a("f805"),a("2877")),h=Object(u["a"])(c,r,l,!1,null,"3f1573d9",null),m=h.exports,p=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:t.$t("deleteStaff.confirmOperation"),visible:t.dialogVisible,width:"40%",center:""},on:{"update:visible":function(e){t.dialogVisible=e}}},[e("div",{staticClass:"text-center warning-message"},[e("p",[t._v(t._s(t.$t("deleteStaff.confirmDelete")))])]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:t.close}},[t._v(t._s(t.$t("common.cancel")))]),e("el-button",{attrs:{type:"primary"},on:{click:t.deleteStaff}},[t._v(t._s(t.$t("common.confirm")))])],1)])},g=[],S={name:"DeleteStaff",data(){return{dialogVisible:!1,staffInfo:{}}},methods:{open(t){this.staffInfo=t,this.dialogVisible=!0},close(){this.dialogVisible=!1},async deleteStaff(){try{const t=await Object(o["b"])(this.staffInfo);0===t.code?(this.$message.success(this.$t("deleteStaff.deleteSuccess")),this.$emit("staff-deleted"),this.close()):this.$message.error(t.msg)}catch(t){this.$message.error(t.message)}}}},b=S,I=(a("bb96"),Object(u["a"])(b,p,g,!1,null,"3e33fcef",null)),$=I.exports,_={name:"Staff",components:{ResetStaffPwd:n["a"],EditStaff:m,DeleteStaff:$},data(){return{staffInfo:{moreCondition:!1,branchOrgs:[],departmentOrgs:[],relCds:[],conditions:{branchOrgId:"",departmentOrgId:"",orgId:"",orgName:"",orgLevel:"2",parentOrgId:"",name:"",tel:"",staffId:"",parentOrgName:"",parentTwoOrgId:"",page:1,rows:10,row:10}},staffData:[],pagination:{currentPage:1,pageSize:10,total:0}}},created(){this._initMethod()},methods:{async _initMethod(){try{const{data:t}=await Object(i["e"])("u_org_staff_rel","rel_cd");this.staffInfo.relCds=t,this.loadData(1,10),this._getOrgsByOrgLevelStaff(1,10,2,"")}catch(t){console.error("获取字典数据失败:",t)}},async loadData(t,e){this.staffInfo.conditions.page=t,this.staffInfo.conditions.rows=e,this.staffInfo.conditions.row=e;try{const e=await Object(o["d"])(this.staffInfo.conditions),a=e.data,s=this.staffInfo.relCds;a.forEach(t=>{s.forEach(e=>{t.relCd==e.statusCd&&(t.relCdName=e.name)})}),this.staffData=a,this.pagination.total=e.records,this.pagination.currentPage=t}catch(a){console.error("获取员工列表失败:",a)}},currentPage(t){this.loadData(t,10)},openEditStaff(t){this.$refs.editStaff.open(t)},openDeleteStaff(t){this.$refs.deleteStaff.open(t)},_moreCondition(){console.log(this.staffInfo.moreCondition),this.staffInfo.moreCondition=!this.staffInfo.moreCondition},async _getOrgsByOrgLevelStaff(t,e,a,s){try{const f=await Object(o["c"])({page:t,row:e,orgLevel:a,parentOrgId:s});2==a?this.staffInfo.branchOrgs=f.orgs:this.staffInfo.departmentOrgs=f.orgs}catch(f){console.error("获取组织失败:",f)}},_openAddStaffStepPage(){this.$router.push("/pages/frame/addStaff")},_queryStaffMethod(){this.loadData(1,10)},_resetStaffMethod(){this.staffInfo.conditions={...this.staffInfo.conditions,branchOrgId:"",orgId:"",departmentOrgId:"",name:"",tel:"",staffId:""},this.loadData(1,10)},_resetStaffPwd(t){this.$refs.resetStaffPwd.open(t)},openStaffDetail(t){this.$router.push("/pages/frame/staffDetail?staffId="+t.userId)}},watch:{"staffInfo.conditions.branchOrgId":{handler(t){this._getOrgsByOrgLevelStaff(1,10,3,t),this.staffInfo.conditions.parentOrgId=t,this.staffInfo.conditions.departmentOrgId="",this.loadData(1,10)},deep:!0},"staffInfo.conditions.departmentOrgId":{handler(t){this.staffInfo.conditions.orgId=t,this.loadData(1,10)},deep:!0}}},w=_,v=(a("28ea"),Object(u["a"])(w,s,f,!1,null,"ae93a90e",null));e["default"]=v.exports},"94d1":function(t,e,a){"use strict";a.d(e,"d",(function(){return i})),a.d(e,"e",(function(){return o})),a.d(e,"f",(function(){return n})),a.d(e,"a",(function(){return r})),a.d(e,"b",(function(){return l})),a.d(e,"g",(function(){return d})),a.d(e,"c",(function(){return c}));var s=a("b775"),f=a("7323");function i(t){return new Promise((e,a)=>{Object(s["a"])({url:"/query.staff.infos",method:"get",params:t}).then(t=>{const a=t.data;e(a)}).catch(t=>{a(t)})})}function o(t){return new Promise((e,a)=>{Object(s["a"])({url:"/user.staff.modify",method:"post",data:t}).then(t=>{const a=t.data;e(a)}).catch(t=>{a(t)})})}function n(t){return t.shopId=Object(f["f"])(),new Promise((e,a)=>{Object(s["a"])({url:"/user.resetStaffPwd",method:"post",data:t}).then(t=>{const a=t.data;e(a)}).catch(t=>{a(t)})})}function r(t){return new Promise((e,a)=>{Object(s["a"])({url:"/user.staff.add",method:"post",data:t}).then(t=>{const a=t.data;e(a)}).catch(t=>{a(t)})})}function l(t){return new Promise((e,a)=>{Object(s["a"])({url:"/user.staff.delete",method:"post",data:t}).then(t=>{const a=t.data;e(a)}).catch(t=>{a(t)})})}function d(t){return new Promise((e,a)=>{Object(s["a"])({url:"/upload/uploadFile",method:"post",headers:{"Content-Type":"multipart/form-data"},data:t}).then(t=>{const a=t.data;e(a)}).catch(t=>{a(t)})})}function c(t){return new Promise((e,a)=>{Object(s["a"])({url:"/org.listOrgs",method:"get",params:t}).then(t=>{const a=t.data;e(a)}).catch(t=>{a(t)})})}},9974:function(t,e,a){"use strict";a("7cad")},ac5c:function(t,e,a){},bb96:function(t,e,a){"use strict";a("ac5c")},cbfd:function(t,e,a){"use strict";var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:t.$t("resetStaffPwd.confirmOperation"),visible:t.dialogVisible,width:"30%",center:""},on:{"update:visible":function(e){t.dialogVisible=e}}},[e("div",{staticClass:"text-center"},[e("p",[t._v(t._s(t.$t("resetStaffPwd.confirmReset")))])]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:t.close}},[t._v(t._s(t.$t("common.cancel")))]),e("el-button",{attrs:{type:"primary"},on:{click:t.resetStaffPwd}},[t._v(t._s(t.$t("common.confirm")))])],1)])},f=[],i=a("94d1"),o=a("7323"),n={name:"ResetStaffPwd",data(){return{dialogVisible:!1,staffInfo:{}}},methods:{open(t){this.staffInfo=t,this.dialogVisible=!0},close(){this.dialogVisible=!1},async resetStaffPwd(){try{const t={shopId:Object(o["f"])(),staffId:this.staffInfo.userId},e=await Object(i["f"])(t);0==e.code?(this.$message.success(this.$t("resetStaffPwd.resetSuccess",{pwd:e.pwd}),1e4),this.close()):this.$message.error(e.msg)}catch(t){this.$message.error(t.message)}}}},r=n,l=(a("9974"),a("2877")),d=Object(l["a"])(r,s,f,!1,null,"c36de4c8",null);e["a"]=d.exports},f805:function(t,e,a){"use strict";a("2c4a")}}]);
|
|
//# sourceMappingURL=chunk-4f404593.0a106b1c.js.map
|