index.vue 107 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085
  1. <template>
  2. <div class="home">
  3. <div class="grand flex">
  4. <div class="left-laowang" style="flex: 0 0 180px;overflow: hidden;">
  5. <el-col :span="24" class="left" :style="'height:'+ (tableHeight + 113) + 'px;'">
  6. <div class="department">
  7. <span><i class="iconfont firerock-iconzuzhijiegou" style="font-size:10px;" ></i>&nbsp;部门</span>
  8. <div v-on:click="createDepartment(-1)">
  9. <i class="fa fa-plus-circle"></i>
  10. 创建
  11. </div>
  12. </div>
  13. <el-divider style="margin: 0px 0px !important;height:0.5px;"></el-divider>
  14. <div class="tree" :style="'height:'+ (tableHeight + 83) + 'px'">
  15. <!-- <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" accordion></el-tree> -->
  16. <!-- <el-tree :data="data" :props="defaultProps" node-key="id" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa"> -->
  17. <el-tree :data="data" :props="defaultProps" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa">
  18. <span class="custom-tree-node" style="position: relative;box-sizing: border-box;width: 10%;" slot-scope="{ node }" @mouseleave= mouseleave(data,$event) @mouseover= mouseover(data,$event)>
  19. <span style="padding-right: 50px;box-sizing: border-box;overflow:hidden;text-overflow:ellipsis;line-height: 36px; display: inline-block;">{{ node.label }}</span>
  20. <!-- <span v-if="node.label != '全部人员'" class="node none"> -->
  21. <span v-if="node.label != '全部人员'" class="node none poAub">
  22. <el-button type="text" size="mini" @click="createDepartment(-2)" >
  23. <i class="el-icon-circle-plus-outline"></i> <!-- 新增 -->
  24. </el-button>
  25. <el-button type="text" size="mini" @click="deleteDep(null)">
  26. <i class="el-icon-delete"></i> <!-- 删除 -->
  27. </el-button>
  28. </span>
  29. </span>
  30. </el-tree>
  31. </div>
  32. </el-col>
  33. </div>
  34. <div class="line line-second" style="display:flex;justify-content: center;align-items: center;">
  35. <div style="line-height: 5px;text-align: center;color: rgb(151 151 151);">
  36. -
  37. -
  38. -
  39. </div>
  40. </div>
  41. <div style="width: 200px; flex: 1; background: green" class="box-second-father">
  42. <el-col :span="24" class="right">
  43. <!--工具条-->
  44. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  45. <el-form :inline="true">
  46. <!-- <div style="width: 300px;display: inline-block;">
  47. <el-input v-model="keyword" class="input-with-select" placeholder="请输入人员名字搜索" clearable="true">
  48. <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
  49. </el-input>
  50. </div> -->
  51. <el-form-item>
  52. <div v-if="depData == null || depData.id == -1" class="nowTime" style="cursor:unset">
  53. <i class="fa fa-home"></i>全部人员
  54. </div>
  55. <div v-else-if="depData.id == 0" class="nowTime" style="cursor:unset">
  56. <i class="fa fa-home"></i>未分配
  57. </div>
  58. <div v-else-if="depData != null && depData.id != -1 && depData.id != 0" class="nowTime" @click="createDepartment(0)">
  59. <i class="fa fa-pencil-square-o"></i>
  60. {{depData!=null?depData.label:''}}
  61. </div>
  62. </el-form-item>
  63. <el-form-item>
  64. <div style="color:#999;font-size:13px;">共{{total}}人</div>
  65. </el-form-item>
  66. <el-form-item style="float:right;" v-if="permissions.structureCustomConfig">
  67. <el-link type="primary" :underline="false" @click="customConfigShow">自定义配置</el-link>
  68. </el-form-item>
  69. <el-form-item style="float:right;" v-if="permissions.structureExport">
  70. <el-link type="primary" :underline="false" @click="showExportDialog">导出人员</el-link>
  71. </el-form-item>
  72. <el-form-item style="float:right;" v-if="user.dingdingUserid == null && permissions.structureAdd">
  73. <el-link type="primary" :underline="false" @click="openInsertDialog(null)">添加人员</el-link>
  74. </el-form-item>
  75. <el-form-item style="float:right;" v-if="user.dingdingUserid == null && permissions.structureImport">
  76. <el-link type="primary" :underline="false" @click="importUserC">批量导入</el-link>
  77. </el-form-item>
  78. <el-form-item style="float:right;" v-if="user.corpwxUserid != null && permissions.structureImport && user.companyId==469">
  79. <el-link type="primary" :underline="false" @click="syncMembByCardTime">关联企微身份</el-link>
  80. </el-form-item>
  81. <el-form-item style="float:right;" v-if="user.corpwxUserid != null && permissions.structureImport && user.companyId!=469">
  82. <el-link type="primary" :underline="false" @click="syncWithCorpWx">同步企微通讯录</el-link>
  83. </el-form-item>
  84. <el-form-item style="float:right;" v-if="user.dingdingUserid != null && permissions.structureImport">
  85. <el-link type="primary" :underline="false" @click="syncWithCorpDingding">同步钉钉通讯录</el-link>
  86. </el-form-item>
  87. <!-- <el-form-item style="float:right;" v-if="user.dingdingUserid == null && permissions.structureImport">
  88. <el-link type="primary" :underline="false" href="./upload/人员导入模板.xlsx" download="人员导入模板.xlsx">模板下载</el-link>
  89. </el-form-item> -->
  90. <!-- <el-form-item v-if="depData != null && depData.id != -1 && depData.id != 0" style="float:right;border: 0.5px solid #20a0ff;height: 27px;margin-top: 6px;">
  91. </el-form-item> -->
  92. <!-- <el-form-item style="float:right;">
  93. <el-link type="danger" v-if="depData != null && depData.id != -1 && depData.id != 0" :underline="false" @click="deleteDep(null)">删除部门</el-link>
  94. </el-form-item>
  95. <el-form-item style="float:right;">
  96. <el-link type="primary" v-if="depData != null && depData.id != -1 && depData.id != 0" :underline="false" @click="createDepartment(-2)">新增子部门</el-link>
  97. </el-form-item> -->
  98. <el-form-item style="float:right;">
  99. <span style="color: #666666">角色</span>
  100. <el-select v-model="roleId" placeholder="请选择" @change="getUser()" style="width: 120px" clearable size="small">
  101. <!-- <el-option
  102. v-for="item in rolesa"
  103. :key="item.value"
  104. :label="item.label"
  105. :value="item.value">
  106. </el-option> -->
  107. <el-option v-for="item in acquireRoleList" :key="item.id" :label="item.rolename" :value="item.id"></el-option>
  108. </el-select>
  109. </el-form-item>
  110. <el-form-item style="float:right;">
  111. <span style="color: #666666">状态</span>
  112. <el-select v-model="status" placeholder="请选择" @change="getUser()" style="width: 120px" size="small">
  113. <el-option
  114. v-for="item in states"
  115. :key="item.value"
  116. :label="item.label"
  117. :value="item.value">
  118. </el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item style="float:right;">
  122. <div style="width: 200px;display: inline-block;margin-top: 4px">
  123. <el-input v-model="keyword" class="input-with-select" placeholder="请输入人员名字" clearable="true" size="small">
  124. <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
  125. </el-input>
  126. </div>
  127. </el-form-item>
  128. <el-form-item style="float:right;" v-if="depData != null && depData.id != '-1'">
  129. <el-checkbox v-model="onlyDirect" @change="getUser()">直属员工</el-checkbox>
  130. </el-form-item>
  131. </el-form>
  132. </el-col>
  133. <!--列表-->
  134. <el-table ref="handleSelectTable" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="handleSelectionZzjg">
  135. <el-table-column type="selection" width="50"></el-table-column>
  136. <el-table-column type="index" width="50">
  137. <template slot-scope="scope" >
  138. {{scope.$index+1+(page-1)*size}}
  139. </template>
  140. </el-table-column>
  141. <el-table-column prop="name" label="姓名" ></el-table-column>
  142. <el-table-column prop="phone" label="手机" width="120"></el-table-column>
  143. <el-table-column prop="departmentName" label="部门" ></el-table-column>
  144. <el-table-column label="角色" width="100">
  145. <template slot-scope="scope">{{scope.row.roleName}}</template>
  146. </el-table-column>
  147. <el-table-column prop="monthCost" label="月成本" v-if="permissions.structurePersonnel">
  148. <template slot-scope="scope">{{user.timeType.isSecretSalary==0?(scope.row.monthCost==null?0:scope.row.monthCost):'*'}} 元</template>
  149. </el-table-column>
  150. <el-table-column prop="cost" label="时薪" v-if="permissions.structurePersonnel">
  151. <template slot-scope="scope">{{user.timeType.isSecretSalary==0?(scope.row.cost==null?0:scope.row.cost):'*'}} 元
  152. <el-link v-if="user.timeType.isSecretSalary==0" @click.native="showSalaryList(scope.row)"><i class="iconfont firerock-iconrecord"></i></el-link>
  153. </template>
  154. </el-table-column>
  155. <el-table-column label="状态" width="160">
  156. <template slot-scope="scope">
  157. <span>{{scope.row.isActive==0 ? '停用(' + scope.row.inactiveDate + ')' : '活跃'}}</span>
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="操作" width="300">
  161. <template slot-scope="scope">
  162. <el-button size="mini" type="default" v-if="scope.row.roleName == '超级管理员' && user.id == scope.row.id" @click="transferRole(scope.row)">转让</el-button>
  163. <el-button size="mini" type="default" v-if="scope.row.roleName != '超级管理员'" @click="resetPwd(scope.row)">重置</el-button>
  164. <el-button size="mini" type="primary" v-if="scope.row.roleName != '超级管理员'" @click="openInsertDialog(scope.row)">编辑</el-button>
  165. <el-button size="mini" type="primary" v-if="scope.row.roleName == '超级管理员'" @click="openInsertDialog1(scope.row)">编辑</el-button>
  166. <!-- <el-button size="mini" type="danger" v-if="scope.row.roleName != '超级管理员'" @click="deleteUser(scope.row)">删除</el-button> -->
  167. <el-button size="mini" type="default" v-if="scope.row.roleName != '超级管理员' && scope.row.isActive==1" @click="showDeactiveDialog(scope.row)">停用</el-button>
  168. <el-button size="mini" type="success" v-if="scope.row.roleName != '超级管理员' && scope.row.isActive==0" @click="setActive(scope.row, 1)">启用</el-button>
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. <!--工具条-->
  173. <el-col :span="24" class="toolbar">
  174. <!-- 123 -->
  175. <el-button size="small" @click="handleSelectionZzjgbtn1">取消</el-button>
  176. <!-- <el-cascader v-model="handleSelectionZzjgwillchange" size="small" placeholder="请选择部门" style="width: 13%;margin-left: 1%;margin-right: 1%;font-size:12px"
  177. :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
  178. <el-button size="small" type="primary" @click="handleSelectionZzjgbtn2">修改</el-button> -->
  179. <el-button size="small" type="primary" @click="handleSelectionZzjgbtn3">批量修改部门</el-button>
  180. <el-button size="small" type="primary" @click="handJue">批量修改角色</el-button>
  181. <el-pagination
  182. @size-change="handleSizeChange"
  183. @current-change="handleCurrentChange"
  184. :page-sizes="[20 , 50 , 80 , 100]"
  185. :page-size="size"
  186. :current-page="page"
  187. layout="total, sizes, prev, pager, next"
  188. :total="total"
  189. style="float:right;"
  190. ></el-pagination>
  191. </el-col>
  192. </el-col>
  193. </div>
  194. <!-- 批量修改弹出框 -->
  195. <el-dialog title="批量修改" :visible.sync="handleSelectionZzjgshow" v-if="handleSelectionZzjgshow" width="30%">
  196. <el-form model="" label-width="20%">
  197. <el-form-item label="设置部门">
  198. <!-- <el-cascader v-model="handleSelectionZzjgwillchange" placeholder="请选择部门" style="width: 60%;"
  199. :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader> -->
  200. <el-cascader v-model="handleSelectionZzjgwillchange" placeholder="请选择部门" style="width: 100%;"
  201. :options="option" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
  202. </el-form-item>
  203. </el-form>
  204. <div slot="footer" class="dialog-footer">
  205. <el-button @click="handleSelectionZzjgshow = false">取消</el-button>
  206. <el-button type="primary" @click="handleSelectionZzjgbtn2">确定</el-button>
  207. </div>
  208. </el-dialog>
  209. <!-- 批量修改角色弹出框 -->
  210. <el-dialog title="批量修改" :visible.sync="handljues" v-if="handljues" width="30%">
  211. <el-form model="" label-width="20%">
  212. <el-form-item label="设置角色">
  213. <el-select v-model="xiuRoleId" placeholder="请选择" style="width: 100%">
  214. <el-option v-for="(item, index) in acquireRoleLists" :key="index" :label="item.rolename" :value="item.id"></el-option>
  215. </el-select>
  216. </el-form-item>
  217. </el-form>
  218. <div slot="footer" class="dialog-footer">
  219. <el-button @click="handljues = false">取消</el-button>
  220. <el-button type="primary" @click="handTrue">确定</el-button>
  221. </div>
  222. </el-dialog>
  223. <!-- 新增部门 -->
  224. <el-dialog :title="depTitle" :visible.sync="departmentVisible" width="500px" >
  225. <el-form ref="depForm" :model="depForm" :rules="depRules" label-width="100px">
  226. <el-form-item label="部门名称" prop="name">
  227. <el-input v-model="depForm.name" placeholder="请输入部门名称" clearable style="width: 100%"></el-input>
  228. </el-form-item>
  229. <!-- 主要负责人 -->
  230. <el-form-item label="主要负责人" prop="managerId">
  231. <el-select v-model="depForm.managerId" filterable clearable placeholder="请选择主要负责人" style="width: 100%">
  232. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  233. </el-select>
  234. </el-form-item>
  235. <!-- 其他负责人 -->
  236. <el-form-item label="其他负责人" prop="managerId">
  237. <el-select v-model="depForm.otherManagerIds" filterable clearable multiple style="width: 100%" placeholder="请选择其他负责人" >
  238. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  239. </el-select>
  240. </el-form-item>
  241. <!-- 直属领导 -->
  242. <el-form-item label="直属领导" prop="reportAuditUserid">
  243. <el-select v-model="depForm.reportAuditUserid" filterable clearable placeholder="请选择直属领导" style="width: 100%">
  244. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  245. </el-select>
  246. </el-form-item>
  247. </el-form>
  248. <span slot="footer" class="dialog-footer">
  249. <el-button @click="departmentVisible = false">取消</el-button>
  250. <el-button type="primary" @click="submitDepartment" >提交</el-button>
  251. </span>
  252. </el-dialog>
  253. <!-- 新增/编辑人员的Dialog -->
  254. <el-dialog :title="title" :visible.sync="dialogVisible" width="550px" >
  255. <el-form ref="form12" :model="insertForm" :rules="rules" label-width="80px">
  256. <el-form-item label="名字" prop="name">
  257. <el-input v-model="insertForm.name" placeholder="请输入姓名" clearable></el-input>
  258. </el-form-item>
  259. <el-form-item label="电话" prop="phone">
  260. <el-input v-model="insertForm.phone" placeholder="请输入电话号码" clearable></el-input>
  261. </el-form-item>
  262. <el-form-item label="薪酬方式" prop="salaryType" v-if="permissions.structurePersonnel&&user.timeType.isSecretSalary==0">
  263. <el-radio-group v-model="insertForm.salaryType" @change="onSalaryTypeChange">
  264. <el-radio :label="0" >固定月成本</el-radio>
  265. <el-radio :label="1">计时工资</el-radio>
  266. </el-radio-group>
  267. </el-form-item>
  268. <el-form-item label="月成本" prop="monthCost" v-if="insertForm.salaryType == 0 && permissions.structurePersonnel&&user.timeType.isSecretSalary==0">
  269. <el-input v-model="insertForm.monthCost" id="mc" @input="oninput" placeholder="请输入月成本,单位:元" clearable @keyup.native="restrictNumber('mc')"></el-input>
  270. <span style="color:orange;font-size:12px;">按照每个月工作{{timeType.monthDays}}天,每天{{timeType.allday}}小时预估时薪</span>
  271. <el-link :underline="false" style="color:blue;font-size:12px;margin-left:7px;" href="#/timetype">修改工作时长</el-link>
  272. </el-form-item>
  273. <el-form-item label="时薪" prop="cost" v-if="permissions.structurePersonnel&&user.timeType.isSecretSalary==0">
  274. <el-input v-model="insertForm.cost" :disabled="insertForm.salaryType == 0" id="cc" style="width:120px;" @keyup.native="restrictNumber('cc')"
  275. placeholder="请输入成本 单位:元/小时" clearable></el-input>
  276. <span style="margin-left:25px;">生效日期</span>
  277. <el-date-picker v-model="insertForm.costApplyDate" value-format="yyyy-MM-dd"></el-date-picker>
  278. </el-form-item>
  279. <el-form-item label="部门" prop="departmentId">
  280. <!-- <el-cascader v-model="insertForm.departmentId" placeholder="请选择部门" style="width: 100%"
  281. :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader> -->
  282. <el-cascader v-model="insertForm.departmentId" placeholder="请选择部门" style="width: 100%"
  283. :options="option" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
  284. </el-form-item>
  285. <el-form-item label="直属上级">
  286. <el-select v-model="insertForm.superiorId" placeholder="请选择" style="width: 100%" filterable clearable>
  287. <el-option v-for="item in users" :label="item.name" :value="item.id" :key="item.id" :disabled="item.id == insertForm.id">
  288. <span style="float: left">{{item.name}}</span>
  289. <span style="float: right; color: #8492a6; font-size: 13px">{{item.departmentName}}</span>
  290. </el-option>
  291. </el-select>
  292. </el-form-item>
  293. <el-form-item label="角色" prop="roleId">
  294. <el-select v-model="insertForm.roleId" placeholder="请选择角色" style="width: 100%">
  295. <el-option v-for="item in acquireRoleList" :label="item.rolename" :value="item.id" :key="item.name">
  296. <span style="float: left">{{item.rolename}}</span>
  297. <span style="float: right; color: #8492a6; font-size: 13px">{{item.roleDescribe}}</span>
  298. </el-option>
  299. </el-select>
  300. </el-form-item>
  301. <el-form-item :label="item.name" v-for="item,index in userCustomConfig" :key="item.id">
  302. <el-select v-if="item.type == 0" v-model="insertForm[suoying[index]]" placeholder="请选择" clearable style="width: 100%">
  303. <el-option v-for="option in item.itemList" :label="option.name" :value="option.name" :key="option.id">
  304. </el-option>
  305. </el-select>
  306. <el-input v-else v-model="insertForm[suoying[index]]" placeholder="请输入" clearable></el-input>
  307. </el-form-item>
  308. <el-form-item label="入职时间" prop="phone">
  309. <el-date-picker v-model="insertForm.inductionDate" value-format="yyyy-MM-dd"></el-date-picker>
  310. </el-form-item>
  311. <el-form-item label="岗位职级" prop="phone">
  312. <el-input v-model="insertForm.position" placeholder="请输入岗位职级别" clearable></el-input>
  313. </el-form-item>
  314. <div class="zhaunye"><p>专业证书</p><p><el-link type="primary" @click="addCertificateList()">添加更多证书</el-link><el-link v-if="permissions.structureCertificate" type="primary" @click="managementDiolog = true" style="margin-left: 20px">管理专业证书</el-link></p></div>
  315. <div class="certificateList">
  316. <div class="moreList">
  317. <div class="moreLiList" v-for="(item,index) in insertForm.certJson" :key="index">
  318. <div style="margin-right: 10px;width: 160px;">
  319. <el-select v-model="item.certId" placeholder="请选择专业证书" size="mini" @change="changeManagement(index)">
  320. <el-option v-for="item in managementTableData" :key="item.id" :label="item.name" :value="item.id"> </el-option>
  321. </el-select>
  322. </div>
  323. <div><span>证书日期</span><el-date-picker size="mini" v-model="item.certDate" type="date" value-format="yyyy-MM-dd" placeholder="选择证书日期" style="width: 180px"></el-date-picker></div>
  324. <div style="color: red;margin-left: 15px;cursor:pointer;" @click="deteFrames(index)"><i class="el-icon-delete"></i></div>
  325. </div>
  326. </div>
  327. </div>
  328. </el-form>
  329. <span slot="footer" class="dialog-footer">
  330. <el-button type="danger" @click="deleteUser(insertForm)" style="float:left;">删除</el-button>
  331. <el-button @click="dialogVisible=false">取消</el-button>
  332. <el-button type="primary" @click="submitInsert('insertForm')" :loading="submitLoading">提交</el-button>
  333. </span>
  334. </el-dialog>
  335. <!-- 编辑超级管理员的Dialog -->
  336. <el-dialog title="编辑人员" :visible.sync="dialogVisible1" width="550px" >
  337. <el-form ref="form1" :model="insertForm" :rules="rules" label-width="80px">
  338. <el-form-item label="名字" prop="name">
  339. <el-input v-model="insertForm.name" placeholder="请输入姓名" clearable></el-input>
  340. </el-form-item>
  341. <el-form-item label="电话" prop="phone">
  342. <el-input v-model="insertForm.phone" placeholder="请输入电话号码" clearable></el-input>
  343. </el-form-item>
  344. <el-form-item label="薪酬方式" prop="salaryType" v-if="permissions.structurePersonnel">
  345. <el-radio-group v-model="insertForm.salaryType" @change="onSalaryTypeChange">
  346. <el-radio :label="0" >固定月成本</el-radio>
  347. <el-radio :label="1">计时工资</el-radio>
  348. </el-radio-group>
  349. </el-form-item>
  350. <el-form-item label="月成本" prop="monthCost" v-if="insertForm.salaryType == 0 && permissions.structurePersonnel" >
  351. <el-input v-model="insertForm.monthCost" id="monthCost" @input="oninput" @keyup.native="restrictNumber('monthCost')" placeholder="请输入月成本,单位:元" clearable></el-input>
  352. <span style="color:orange;font-size:12px;">按照每个月工作{{timeType.monthDays}}天,每天{{timeType.allday}}小时预估时薪</span>
  353. <el-link :underline="false" style="color:blue;font-size:12px;margin-left:7px;" href="#/timetype">修改工作时长</el-link>
  354. </el-form-item>
  355. <el-form-item label="时薪" prop="cost" v-if="permissions.structurePersonnel">
  356. <el-input v-model="insertForm.cost" id="cost" :disabled="insertForm.salaryType == 0" @keyup.native="restrictNumber('cost')" style="width:120px;"
  357. placeholder="请输入成本 单位:元/小时" clearable></el-input>
  358. <span style="margin-left:25px;">生效日期</span>
  359. <el-date-picker v-model="insertForm.costApplyDate" value-format="yyyy-MM-dd"></el-date-picker>
  360. </el-form-item>
  361. <el-form-item label="部门" prop="departmentId">
  362. <el-cascader v-model="insertForm.departmentId"
  363. placeholder="请选择部门"
  364. style="width: 100%"
  365. :options="option"
  366. :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false"
  367. clearable></el-cascader>
  368. </el-form-item>
  369. <el-form-item label="直属上级">
  370. <el-select v-model="insertForm.superiorId" placeholder="请选择" style="width: 100%" filterable clearable>
  371. <el-option v-for="item in users" :label="item.name" :value="item.id" :key="item.id" :disabled="item.id == insertForm.id">
  372. <span style="float: left">{{item.name}}</span>
  373. <span style="float: right; color: #8492a6; font-size: 13px">{{item.departmentName}}</span>
  374. </el-option>
  375. </el-select>
  376. </el-form-item>
  377. </el-form>
  378. <span slot="footer" class="dialog-footer">
  379. <el-button @click="dialogVisible1=false">取消</el-button>
  380. <el-button type="primary" @click="submitInsert1" :loading="submitLoading">提交</el-button>
  381. </span>
  382. </el-dialog>
  383. <el-dialog title="人员历史成本" :visible.sync="userSalaryListDialog" width="550px" >
  384. <el-table :data="userSalaryList" highlight-current-row v-loading="listLoading" height="300px" style="width: 100%;">
  385. <el-table-column prop="userName" label="姓名" ></el-table-column>
  386. <el-table-column prop="indate" label="更新时间" width="150px">
  387. </el-table-column>
  388. <el-table-column prop="salaryType" label="薪酬方式" >
  389. <template slot-scope="scope" >
  390. {{scope.row.salaryType==0?"固定月薪":"计时工资"}}
  391. </template>
  392. </el-table-column>
  393. <el-table-column prop="monthCost" label="月薪" >
  394. <template slot-scope="scope" >
  395. {{scope.row.monthCost}}元
  396. </template>
  397. </el-table-column>
  398. <el-table-column prop="cost" label="时薪" >
  399. <template slot-scope="scope" >
  400. {{scope.row.cost}}元
  401. </template>
  402. </el-table-column>
  403. </el-table>
  404. </el-dialog>
  405. <!--导出人员 -->
  406. <el-dialog title="导出人员列表" :visible.sync="exportDialogVisible" width="550px" >
  407. <el-form label-width="100px">
  408. <el-form-item label="导出" >
  409. <el-radio-group v-model="containInvalid" >
  410. <el-radio :label="1" >全部人员</el-radio>
  411. <el-radio :label="0" >仅活跃人员</el-radio>
  412. </el-radio-group>
  413. </el-form-item>
  414. </el-form>
  415. <span slot="footer" class="dialog-footer">
  416. <el-button type="primary" @click="exportUsers">导出</el-button>
  417. </span>
  418. </el-dialog>
  419. <!-- 转让超级管理员权限 -->
  420. <el-dialog title="权限转让" :visible.sync="transferDialog" width="550px" >
  421. <el-form label-width="200px">
  422. <el-form-item label="转让超级管理员角色至" >
  423. <el-select v-model="toUserId" style="width:300px" filterable clearable>
  424. <el-option v-for="item in allActiveUsers" :key="item.id" :value="item.id" :label="item.name">
  425. </el-option>
  426. </el-select>
  427. </el-form-item>
  428. <el-form-item label="转让后自己的角色" >
  429. <el-select v-model="myRoleId" style="width:300px">
  430. <el-option v-for="item in acquireRoleList" :label="item.rolename" :value="item.id" :key="item.name">
  431. <span style="float: left">{{item.rolename}}</span>
  432. <span style="float: right; color: #8492a6; font-size: 13px">{{item.roleDescribe}}</span>
  433. </el-option>
  434. </el-select>
  435. </el-form-item>
  436. </el-form>
  437. <span slot="footer" class="dialog-footer">
  438. <el-button type="default" @click="transferDialog = false">取消</el-button>
  439. <el-button type="primary" @click="showConfirmDialog">确定</el-button>
  440. </span>
  441. </el-dialog>
  442. <!--停用时选择日期 -->
  443. <el-dialog title="离职停用员工" :visible.sync="deactiveDialog" width="550px" >
  444. <el-form label-width="200px">
  445. <el-form-item label="员工离职日期" >
  446. <el-date-picker type="date" v-model="deactiveDate" value-format="yyyy-MM-dd" format="yyyy-MM-dd" placeholder="请选择" />
  447. </el-form-item>
  448. </el-form>
  449. <span slot="footer" class="dialog-footer">
  450. <el-button type="default" @click="deactiveDialog = false">取消</el-button>
  451. <el-button type="primary" @click="confirmDeactive">确定</el-button>
  452. </span>
  453. </el-dialog>
  454. <!-- 管理专业证书 -->
  455. <el-dialog title="管理专业证书" :visible.sync="managementDiolog" width="500px" :before-close="handleClose">
  456. <div>
  457. <el-table :data="managementTableData" style="width: 100%" height="400">
  458. <el-table-column prop="name" label="名称" width="280"></el-table-column>
  459. <el-table-column label="操作" width="180">
  460. <template slot-scope="scope">
  461. <div>
  462. <el-button type="primary" size="small" @click="editorManagementForm(scope.row)">编辑</el-button>
  463. <el-button type="danger" size="small" @click="deteManagementForm(scope.row)">删除</el-button>
  464. </div>
  465. </template>
  466. </el-table-column>
  467. </el-table>
  468. </div>
  469. <span slot="footer" class="dialog-footer">
  470. <el-button @click="managementDiolog = false">关 闭</el-button>
  471. <el-button type="primary" @click="addManagementDiologs()">新 增</el-button>
  472. </span>
  473. </el-dialog>
  474. <!-- 新增项目管理专业 -->
  475. <el-dialog title="新增/编辑管理专业证书" :visible.sync="addManagementDiolog" width="500px" :before-close="handleClose">
  476. <div>
  477. <el-form :model="managementForm" :rules="managementFormRou" ref="managementForm" label-width="150px" class="demo-ruleForm">
  478. <el-form-item label="专业证书名称" prop="name">
  479. <el-input v-model="managementForm.name" placeholder="请输入专业证书名称"></el-input>
  480. </el-form-item>
  481. </el-form>
  482. </div>
  483. <span slot="footer" class="dialog-footer">
  484. <el-button @click="addManagementDiolog = false">取 消</el-button>
  485. <el-button type="primary" @click="addManagementForm('managementForm')">提 交</el-button>
  486. </span>
  487. </el-dialog>
  488. <!-- 自定义配置项 -->
  489. <el-dialog title="自定义配置项管理" show-header="false" v-if="customConfigDialog" :visible.sync="customConfigDialog" :close-on-click-modal="false" customClass="customWidth" width="650px" top="20px">
  490. <div style="margin-left:30px;">
  491. <p v-for="item,index in customConfigList" :key="index">
  492. <el-input size="medium" v-model="item.name" placeholder="请输入自定义配置项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  493. <el-radio size="medium" :disabled="!item.name" v-model="item.type" :label="0" style="margin-right:10px;margin-left:10px">下拉</el-radio>
  494. <el-radio size="medium" :disabled="!item.name" v-model="item.type" :label="1">输入</el-radio>
  495. <span style="display:inline-block;">
  496. <el-button v-if="cusItemTypes[index] == 0" type="primary" size="small" @click="getConfigItemBtn(item)">配置选项</el-button>
  497. <span v-if="!item.id && item.name && item.type == 0" style="color:#999;font-size:13px">保存后可配置选项</span>
  498. </span>
  499. <el-button style="margin-left:20px" type="danger" size="small" v-if="item.id" @click="customConfigDelete(item,index)">删除</el-button>
  500. </p>
  501. </div>
  502. <div slot="footer" class="dialog-footer">
  503. <el-button type="primary" @click="customConfigDialog = false" >关闭</el-button>
  504. <!-- <el-button type="primary" @click="customConfigListAdd" :disabled="customConfigList.length >= 5">新增</el-button> -->
  505. <el-button type="primary" @click="customConfigListSave" :loading="saveBtnLoading">保存</el-button>
  506. </div>
  507. <!-- 为下拉时的选项配置 -->
  508. <el-dialog title="配置选项" v-if="configItemDialog" :visible.sync="configItemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px" append-to-body>
  509. <el-table :data="configItemList" height="400px" style="width:100%" key="configItemTable">
  510. <el-table-column prop="id" width="60" label="序号">
  511. <template slot-scope="scope" >
  512. {{scope.$index + 1}}
  513. </template>
  514. </el-table-column>
  515. <el-table-column prop="name" label="名称" ></el-table-column>
  516. <el-table-column label="操作" width="150">
  517. <template slot-scope="scope" >
  518. <el-button size="small" type="primary" @click="configItemAorM(scope.row)">编辑</el-button>
  519. <el-button size="small" type="danger" @click="configItemDelete(scope.row)">删除</el-button>
  520. </template>
  521. </el-table-column>
  522. </el-table>
  523. <div slot="footer" class="dialog-footer">
  524. <el-button type="primary" @click="configItemDialog = false" >关闭</el-button>
  525. <el-button type="primary" @click="configItemAorM" >新增配置选项</el-button>
  526. </div>
  527. <el-dialog title="新增/编辑配置选项" v-if="configItemAorMDialog" :visible.sync="configItemAorMDialog" :close-on-click-modal="false" customClass="customWidth" width="500px" append-to-body>
  528. <span>名称</span>
  529. <el-input size="medium" v-model="AorMitem.name" placeholder="请输入自定义配置项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  530. <div slot="footer" class="dialog-footer">
  531. <el-button type="primary" @click="configItemAorMDialog = false" >取消</el-button>
  532. <el-button type="primary" @click="configItemAorMSure" >提交</el-button>
  533. </div>
  534. </el-dialog>
  535. </el-dialog>
  536. </el-dialog>
  537. <!-- 批量导入 -->
  538. <el-dialog title="人员批量导入" v-if="importDialog" :visible.sync="importDialog" customClass="customWidth" width="500px">
  539. <p>1. 下载
  540. <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/人员导入模板.xlsx" download="人员导入模板.xlsx">人员导入模板.xlsx</el-link>
  541. </p>
  542. <p>2. 填写excel模板,并上传。</p>
  543. <p style="display: flex;justify-content: center;padding-bottom:1em;">
  544. <el-upload ref="upload" action="#" :limit="1" :http-request="importUser" :show-file-list="false">
  545. <el-button type="primary" :underline="false" :loading="importingData">开始导入</el-button>
  546. </el-upload>
  547. </p>
  548. </el-dialog>
  549. <el-dialog title="同步企业微信通讯录" v-if="showSyncCWDialog" :visible.sync="showSyncCWDialog" customClass="customWidth" width="500px">
  550. <p>1. 填写企业微信通讯录Secret
  551. <el-popover placement="top" width="1200" trigger="hover">
  552. <div class="imgFlex">
  553. <div><img src="../../assets/image/Step1.jpg" style="width: 380px"/> <p><b>第一步:进入管理后台</b></p> </div>
  554. <div class="imgBor"> <p></p> <img src="../../assets/image/Step2.jpg" style="width: 380px"/> <p><b>第二步:进入通讯录同步</b></p></div>
  555. <div><img src="../../assets/image/Step3.jpg" style="width: 380px"/> <p><b>第三步:查看Secret</b></p></div>
  556. </div>
  557. <i class="el-icon-question" slot="reference" />
  558. </el-popover>
  559. </p>
  560. <p>
  561. <el-input v-model="contactSecret" style="width:380px;" :disabled="!editSecret"/><el-button @click="editSecret?saveContactSecret():editSecret=true;" >{{editSecret?'保存':'修改'}}</el-button>
  562. </p>
  563. <p v-if="contactServer == null">
  564. 2. 联系客户配置同步服务器
  565. </p>
  566. <p v-if="contactServer == null" style="text-align:center;">
  567. <img
  568. style="width: 120px; height: 120px"
  569. src="../../assets/image/code.jpg" />
  570. </p>
  571. <p style="display: flex;justify-content: center;padding-bottom:1em;">
  572. <el-button type="primary" :underline="false" :loading="importingData" :disabled="!canSync" @click="startCorpWxImport">开始同步</el-button>
  573. </p>
  574. </el-dialog>
  575. <el-dialog title="关联结果" v-if="syncMembByCardTimeResultGialog" :visible.sync="syncMembByCardTimeResultGialog" customClass="customWidth" width="500px">
  576. <p style="padding-bottom:30px;">
  577. {{syncMembByCardTimeMsg}}
  578. </p>
  579. </el-dialog>
  580. </div>
  581. </div>
  582. </template>
  583. <script>
  584. // 左右滑動
  585. import dragMixin from "@/common/js/tensile.js";
  586. import util from "../../common/js/util";
  587. let that
  588. export default {
  589. name: "Home",
  590. components: {},
  591. mixins: [dragMixin],
  592. created() {
  593. let height = window.innerHeight;
  594. this.tableHeight = height - 195;
  595. const that = this;
  596. window.onresize = function temp() {
  597. that.tableHeight = window.innerHeight - 195;
  598. };
  599. this.initDrag([
  600. {
  601. type: "LR",
  602. domClass: {
  603. // 中间分割线的名字
  604. resize: "line-line",
  605. // 左侧盒子的名字
  606. left: "box-left",
  607. // 右侧盒子的名字
  608. right: "box-right",
  609. // 父级的名字
  610. box: "box-father",
  611. },
  612. otherInfo: {
  613. // 限制左边栏最低宽度
  614. leftWidth: 120,
  615. },
  616. },
  617. {
  618. type: "LR",
  619. domClass: {
  620. // 中间分割线的名字
  621. resize: "line-second",
  622. // 左侧盒子的名字
  623. left: "left-laowang",
  624. // 右侧盒子的名字
  625. right: "box-second-father",
  626. // 父级的名字
  627. box: "grand",
  628. },
  629. otherInfo: {
  630. // 限制左边栏最低宽度
  631. leftWidth: 120,
  632. },
  633. },
  634. ]);
  635. },
  636. data() {
  637. return {
  638. syncMembByCardTimeResultGialog:false,
  639. syncMembByCardTimeMsg:null,
  640. editSecret: false,
  641. canSync: false,
  642. corpid: null,
  643. contactSecret: null,
  644. contactServer: null,
  645. showSyncCWDialog: false,
  646. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  647. handleSelectionZzjgshow: false,
  648. handljues: false,
  649. submitLoading: false,
  650. deactiveUser: null,
  651. deactiveDate: null,
  652. deactiveDialog: false,
  653. toUserId: null,
  654. myRoleId: null,
  655. allActiveUsers: [],
  656. transferDialog: false,
  657. containInvalid: 1,
  658. exportDialogVisible: false,
  659. roleArray: [
  660. "普通员工",
  661. "超级管理员",
  662. "系统管理员",
  663. "公司高层",
  664. "财务管理员",
  665. "项目管理员",
  666. "公司领导",
  667. ],
  668. roleDescArray: [
  669. { label: "普通员工", value: 0, desc: "填报日报,参与项目协作" },
  670. {
  671. label: "系统管理员",
  672. value: 2,
  673. desc: "具有除了创建系统管理员之外的全部功能",
  674. },
  675. // {label:"公司高层",value:3, desc:"查阅项目信息,人员工时情况"},
  676. {
  677. label: "财务管理员",
  678. value: 4,
  679. desc: "财务核算成本,费用报销审核,负责组织架构管理",
  680. },
  681. { label: "项目管理员", value: 5, desc: "创建和管理项目" },
  682. {
  683. label: "公司领导",
  684. value: 6,
  685. desc: "查看日报、工时成本统计、财务核算、项目和报表",
  686. },
  687. ],
  688. userSalaryList: [],
  689. userSalaryListDialog: false,
  690. value: {},
  691. user: JSON.parse(sessionStorage.getItem("user")),
  692. users: [],
  693. tableHeight: 0,
  694. listLoading: false,
  695. total: 0,
  696. page: 1,
  697. size: 20,
  698. list: [],
  699. data: [
  700. {
  701. id: -1,
  702. label: "全部人员",
  703. },
  704. {
  705. id: 0,
  706. label: "未分配",
  707. },
  708. ],
  709. option: [],
  710. depData: {
  711. id: -1,
  712. label: "全部人员",
  713. },
  714. defaultProps: {
  715. children: "children",
  716. label: "label",
  717. },
  718. dialogVisible: false,
  719. title: "",
  720. insertForm: {
  721. id: null,
  722. name: null,
  723. phone: null,
  724. // role: null,
  725. roleId: null,
  726. monthCost: null,
  727. cost: null,
  728. departmentId: null,
  729. salaryType: 0,
  730. costApplyDate: util.formatDate.format(new Date(), "yyyy-MM-dd"),
  731. inductionDate: util.formatDate.format(new Date(), "yyyy-MM-dd"),
  732. position: "",
  733. certJson: [],
  734. plateMap: {},
  735. },
  736. rules: {
  737. name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
  738. // phone: [{ required: true, message: "请输入电话", trigger: "blur" }],
  739. // role: [{ required: true, message: "请选择角色", trigger: "blur" }],
  740. roleId: [{ required: true, message: "请选择角色", trigger: "blur" }],
  741. cost: [{ required: true, message: "请输入成本", trigger: "blur" }],
  742. monthCost: [
  743. { required: true, message: "请输入月成本", trigger: "blur" },
  744. ],
  745. },
  746. managementFormRou: {
  747. name: [{ required: true, message: "请输入专业证书", trigger: "blur" }],
  748. },
  749. dialogVisible1: false,
  750. departmentVisible: false,
  751. depTitle: "",
  752. depForm: {
  753. id: null,
  754. name: null,
  755. parentId: null,
  756. managerId: null,
  757. },
  758. depRules: {
  759. name: [{ required: true, message: "请输入部门名称", trigger: "blur" }],
  760. },
  761. timeType: {},
  762. keyword: "",
  763. rolesa: [
  764. {
  765. value: "",
  766. label: "全部",
  767. },
  768. {
  769. value: "6",
  770. label: "公司领导",
  771. },
  772. {
  773. value: "2",
  774. label: "系统管理员",
  775. },
  776. {
  777. value: "4",
  778. label: "财务管理员",
  779. },
  780. {
  781. value: "5",
  782. label: "项目管理员",
  783. },
  784. {
  785. value: "0",
  786. label: "普通员工",
  787. },
  788. ],
  789. states: [
  790. {
  791. value: "",
  792. label: "全部",
  793. },
  794. {
  795. value: "1",
  796. label: "活跃",
  797. },
  798. {
  799. value: "0",
  800. label: "停用",
  801. },
  802. ],
  803. status: "1",
  804. role: "",
  805. jDarr: [],
  806. handleSelectionZzjgDate: [],
  807. handleSelectionZzjgwillchange: null,
  808. acquireRoleList: [], // 角色列表
  809. acquireRoleLists: [], // 没有超级管理员
  810. roleId: "",
  811. xiuRoleId: "",
  812. managementDiolog: false,
  813. addManagementDiolog: false,
  814. managementForm: {
  815. name: "",
  816. },
  817. managementTableData: [],
  818. certificate: "",
  819. addUserId: "",
  820. userCustomConfig: [],
  821. customConfigDialog: false,
  822. importDialog: false,
  823. importingData: false,
  824. customConfigList: [],
  825. cusItemTypes: [],
  826. configItemList: [],
  827. configItemId: null,
  828. configItemDialog: false,
  829. configItemAorMDialog: false,
  830. AorMitem: {
  831. name: null,
  832. userCustomId: null,
  833. id: null,
  834. },
  835. tableLoading: false,
  836. suoying: ["plate1", "plate2", "plate3", "plate4", "plate5"],
  837. insertFormPlates: [],
  838. saveBtnLoading: false,
  839. onlyDirect: false,
  840. };
  841. },
  842. filters: {
  843. acquireRoleName(value) {
  844. for (var i in that.acquireRoleList) {
  845. if (that.acquireRoleList[i].id == value) {
  846. return that.acquireRoleList[i].rolename;
  847. }
  848. }
  849. },
  850. },
  851. beforeCreate: function () {
  852. that = this;
  853. },
  854. methods: {
  855. syncMembByCardTime() {
  856. this.syncMembByCardTimeResultGialog = true;
  857. this.syncMembByCardTimeMsg = '正在同步关联,请稍等...';
  858. this.http.post("/wxcorp/syncMembByCardTime",
  859. {
  860. companyId: this.user.companyId,
  861. },
  862. (res) => {
  863. if (res.code == "ok") {
  864. this.syncMembByCardTimeMsg = res.data;
  865. this.getUser();
  866. } else {
  867. this.syncMembByCardTimeMsg = res.msg;
  868. }
  869. },
  870. (err) => {
  871. this.syncMembByCardTimeMsg = err;
  872. }
  873. );
  874. },
  875. saveContactSecret() {
  876. if (!this.contactSecret) {
  877. this.$message({
  878. message: "请输入通讯录secret",
  879. type: "error",
  880. });
  881. return;
  882. }
  883. this.http.post(
  884. "/wx-corp-info/saveContactSecret",
  885. {
  886. corpid: this.corpid,
  887. contactSecret: this.contactSecret,
  888. },
  889. (res) => {
  890. if (res.code == "ok") {
  891. this.$message({
  892. message: "保存成功",
  893. type: "success",
  894. });
  895. this.canSync = true;
  896. } else {
  897. this.$message({
  898. message: res.msg,
  899. type: "error",
  900. });
  901. }
  902. },
  903. (err) => {
  904. this.tableLoading = false;
  905. this.$message({
  906. message: err,
  907. type: "error",
  908. });
  909. }
  910. );
  911. },
  912. startCorpWxImport() {
  913. this.importingData = true;
  914. this.http.post(
  915. "/wxcorp/getCorpMembs",
  916. {
  917. corpId: this.corpid,
  918. },
  919. (res) => {
  920. this.importingData = false;
  921. if (res.code == "ok") {
  922. this.showSyncCWDialog = false;
  923. this.$message({
  924. message: "同步完成",
  925. type: "success",
  926. });
  927. this.getDepartment();
  928. this.getUser();
  929. this.getUsers();
  930. } else {
  931. this.$message({
  932. message: res.msg,
  933. type: "error",
  934. });
  935. }
  936. },
  937. (err) => {
  938. this.tableLoading = false;
  939. this.$message({
  940. message: err,
  941. type: "error",
  942. });
  943. }
  944. );
  945. },
  946. //从企业微信同步通讯录
  947. syncWithCorpWx() {
  948. this.showSyncCWDialog = true;
  949. this.editSecret = false;
  950. this.http.post(
  951. "/wx-corp-info/get",
  952. {
  953. companyId: this.user.companyId,
  954. },
  955. (res) => {
  956. if (res.code == "ok") {
  957. this.contactSecret = res.data.contactSecret;
  958. this.contactServer = res.data.contactServer;
  959. if (this.contactSecret && this.contactServer) {
  960. this.canSync = true;
  961. } else {
  962. this.editSecret = true;
  963. }
  964. this.corpid = res.data.corpid;
  965. } else {
  966. this.$message({
  967. message: res.msg,
  968. type: "error",
  969. });
  970. }
  971. },
  972. (err) => {
  973. this.tableLoading = false;
  974. this.$message({
  975. message: err,
  976. type: "error",
  977. });
  978. }
  979. );
  980. },
  981. // 从钉钉同步通讯录
  982. syncWithCorpDingding() {
  983. this.$confirm(
  984. "确认从钉钉同步通讯录吗?(可能需要一定的加载时间,请耐心等待)",
  985. "提示",
  986. {
  987. confirmButtonText: "确定",
  988. cancelButtonText: "取消",
  989. type: "warning",
  990. }
  991. )
  992. .then(() => {
  993. this.listLoading = true;
  994. this.http.post(
  995. "/company/syncCorpMembs",
  996. {},
  997. (res) => {
  998. this.listLoading = false;
  999. if (res.code == "ok") {
  1000. this.$message({
  1001. message: res.data,
  1002. type: "success",
  1003. });
  1004. this.getDepartment();
  1005. this.getUser();
  1006. this.getUsers();
  1007. } else {
  1008. this.$message({
  1009. message: res.msg,
  1010. type: "error",
  1011. });
  1012. }
  1013. },
  1014. (err) => {
  1015. this.listLoading = false;
  1016. this.$message({
  1017. message: err,
  1018. type: "error",
  1019. });
  1020. }
  1021. );
  1022. })
  1023. .catch(() => {
  1024. this.$message({
  1025. message: "已取消操作",
  1026. type: "info",
  1027. });
  1028. });
  1029. },
  1030. test() {
  1031. this.getCustomConfigList();
  1032. },
  1033. // 自定义配置项
  1034. customConfigShow() {
  1035. this.getCustomConfigList();
  1036. this.customConfigDialog = true;
  1037. },
  1038. getConfigItemBtn(item) {
  1039. this.configItemDialog = true;
  1040. this.AorMitem.userCustomId = item.id;
  1041. this.getConfigItem();
  1042. },
  1043. getConfigItem() {
  1044. // 获取配置下拉数据
  1045. this.http.post(
  1046. "/sub-user-custom/list",
  1047. {
  1048. userCustomId: this.AorMitem.userCustomId,
  1049. },
  1050. (res) => {
  1051. if (res.code == "ok") {
  1052. this.configItemList = res.data;
  1053. } else {
  1054. this.$message({
  1055. message: res.msg,
  1056. type: "error",
  1057. });
  1058. }
  1059. },
  1060. (err) => {
  1061. this.tableLoading = false;
  1062. this.$message({
  1063. message: err,
  1064. type: "error",
  1065. });
  1066. }
  1067. );
  1068. },
  1069. getCustomConfigList() {
  1070. // 获取自定义配置
  1071. this.http.post(
  1072. "/user-custom/list",
  1073. {},
  1074. (res) => {
  1075. if (res.code == "ok") {
  1076. let lists = JSON.parse(JSON.stringify(res.data));
  1077. this.userCustomConfig = JSON.parse(JSON.stringify(res.data));
  1078. // let lists = res.data
  1079. // this.customConfigList = res.data
  1080. this.customConfigList = [
  1081. { name: "", id: null, type: 1, companyId: null },
  1082. { name: "", id: null, type: 1, companyId: null },
  1083. { name: "", id: null, type: 1, companyId: null },
  1084. { name: "", id: null, type: 1, companyId: null },
  1085. { name: "", id: null, type: 1, companyId: null },
  1086. ];
  1087. for (let i in lists) {
  1088. this.$set(this.customConfigList[i], "name", lists[i].name);
  1089. this.$set(this.customConfigList[i], "id", lists[i].id);
  1090. this.$set(this.customConfigList[i], "type", lists[i].type);
  1091. this.$set(
  1092. this.customConfigList[i],
  1093. "companyId",
  1094. lists[i].companyId
  1095. );
  1096. }
  1097. // console.log('customConfigList',this.customConfigList);
  1098. this.cusItemTypes = [];
  1099. for (let j in this.customConfigList) {
  1100. if (
  1101. this.customConfigList[j].type == null ||
  1102. this.customConfigList[j].type == 0
  1103. ) {
  1104. this.customConfigList[j].type = 0;
  1105. this.cusItemTypes[j] = 0;
  1106. } else {
  1107. this.cusItemTypes[j] = 1;
  1108. }
  1109. }
  1110. } else {
  1111. this.$message({
  1112. message: res.msg,
  1113. type: "error",
  1114. });
  1115. }
  1116. },
  1117. (err) => {
  1118. this.$message({
  1119. message: err,
  1120. type: "error",
  1121. });
  1122. }
  1123. );
  1124. },
  1125. customConfigListSave() {
  1126. // 保存/修改自定义配置
  1127. // let jsonStr = ''
  1128. // for(let i in this.customConfigList){
  1129. // if(this.customConfigList[i].name){
  1130. // jsonStr += JSON.stringify(this.customConfigList[i]) + ','
  1131. // }
  1132. // }
  1133. // jsonStr = jsonStr.substring(0,jsonStr.length - 1)
  1134. // let jsonStr = []
  1135. this.saveBtnLoading = true;
  1136. let parameter = this.customConfigList.filter(
  1137. (item) => item.name.trim() != ""
  1138. );
  1139. this.http.post(
  1140. "/user-custom/addOrMod",
  1141. {
  1142. json: JSON.stringify(parameter),
  1143. },
  1144. (res) => {
  1145. if (res.code == "ok") {
  1146. this.getCustomConfigList();
  1147. this.saveBtnLoading = false;
  1148. this.$message({
  1149. message: "保存成功",
  1150. type: "success",
  1151. });
  1152. } else {
  1153. this.saveBtnLoading = false;
  1154. this.$message({
  1155. message: res.msg,
  1156. type: "error",
  1157. });
  1158. }
  1159. },
  1160. (err) => {
  1161. this.saveBtnLoading = false;
  1162. this.$message({
  1163. message: err,
  1164. type: "error",
  1165. });
  1166. }
  1167. );
  1168. },
  1169. customConfigDelete(item, index) {
  1170. if (item.id) {
  1171. this.http.post(
  1172. "/user-custom/delete",
  1173. {
  1174. id: item.id,
  1175. },
  1176. (res) => {
  1177. if (res.code == "ok") {
  1178. this.getCustomConfigList();
  1179. this.$message({
  1180. message: "删除成功",
  1181. type: "success",
  1182. });
  1183. } else {
  1184. this.$message({
  1185. message: res.msg,
  1186. type: "error",
  1187. });
  1188. }
  1189. },
  1190. (err) => {
  1191. this.$message({
  1192. message: err,
  1193. type: "error",
  1194. });
  1195. }
  1196. );
  1197. } else {
  1198. this.customConfigList.splice(index, 1);
  1199. }
  1200. },
  1201. configItemAorM(item) {
  1202. this.configItemAorMDialog = true;
  1203. if (item) {
  1204. this.AorMitem.name = item.name;
  1205. this.AorMitem.id = item.id;
  1206. } else {
  1207. this.AorMitem.name = null;
  1208. this.AorMitem.id = null;
  1209. }
  1210. },
  1211. configItemAorMSure() {
  1212. // 新增/修改配置下拉选项
  1213. if (!this.AorMitem.name) {
  1214. this.$message({
  1215. message: "名称不能为空",
  1216. type: "error",
  1217. });
  1218. return;
  1219. }
  1220. this.http.post(
  1221. "/sub-user-custom/addOrMod",
  1222. this.AorMitem,
  1223. (res) => {
  1224. if (res.code == "ok") {
  1225. this.configItemAorMDialog = false;
  1226. this.getConfigItem();
  1227. this.$message({
  1228. message: "提交成功",
  1229. type: "success",
  1230. });
  1231. } else {
  1232. this.$message({
  1233. message: res.msg,
  1234. type: "error",
  1235. });
  1236. }
  1237. },
  1238. (err) => {
  1239. this.$message({
  1240. message: err,
  1241. type: "error",
  1242. });
  1243. }
  1244. );
  1245. },
  1246. configItemDelete(item) {
  1247. // 删除配置下拉选项
  1248. this.http.post(
  1249. "/sub-user-custom/delete",
  1250. {
  1251. id: item.id,
  1252. },
  1253. (res) => {
  1254. if (res.code == "ok") {
  1255. this.getConfigItem();
  1256. this.$message({
  1257. message: "删除成功",
  1258. type: "success",
  1259. });
  1260. } else {
  1261. this.$message({
  1262. message: res.msg,
  1263. type: "error",
  1264. });
  1265. }
  1266. },
  1267. (err) => {
  1268. this.$message({
  1269. message: err,
  1270. type: "error",
  1271. });
  1272. }
  1273. );
  1274. },
  1275. // 获取添加人员时的自定义配置信息
  1276. getUserCustomConfig(e) {
  1277. this.http.post(
  1278. "/user-custom/list",
  1279. {},
  1280. (res) => {
  1281. if (res.code == "ok") {
  1282. this.userCustomConfig = JSON.parse(JSON.stringify(res.data));
  1283. for (let i in this.userCustomConfig) {
  1284. if (this.userCustomConfig[i].type == 0) {
  1285. this.http.post(
  1286. "/sub-user-custom/list",
  1287. {
  1288. userCustomId: this.userCustomConfig[i].id,
  1289. },
  1290. (res) => {
  1291. if (res.code == "ok") {
  1292. // this.userCustomConfig[i].itemList = res.data
  1293. this.$set(this.userCustomConfig[i], "itemList", res.data);
  1294. } else {
  1295. this.$message({
  1296. message: res.msg,
  1297. type: "error",
  1298. });
  1299. }
  1300. },
  1301. (err) => {
  1302. this.$message({
  1303. message: err,
  1304. type: "error",
  1305. });
  1306. }
  1307. );
  1308. }
  1309. }
  1310. this.$nextTick(() => {
  1311. // let opt = this.users[0].plateMap[this.userCustomConfig[0].name]
  1312. // console.log('userCustomConfig',this.userCustomConfig);
  1313. // console.log('insertForm',this.insertForm);
  1314. });
  1315. } else {
  1316. this.$message({
  1317. message: res.msg,
  1318. type: "error",
  1319. });
  1320. }
  1321. },
  1322. (err) => {
  1323. this.$message({
  1324. message: err,
  1325. type: "error",
  1326. });
  1327. }
  1328. );
  1329. },
  1330. // customConfigListAdd(){
  1331. // this.customConfigList.push({
  1332. // name: '',
  1333. // type: 1
  1334. // })
  1335. // },
  1336. // 批量修改部门
  1337. handleSelectionZzjg(e) {
  1338. // if (e.length == 0) {
  1339. // this.handleSelectionZzjgshow = false
  1340. // }else{
  1341. // this.handleSelectionZzjgshow = true
  1342. // }
  1343. this.handleSelectionZzjgDate = e;
  1344. },
  1345. handleSelectionZzjgbtn1() {
  1346. this.handleSelectionZzjgshow = false;
  1347. this.$refs.handleSelectTable.clearSelection();
  1348. this.handleSelectionZzjgwillchange = null;
  1349. },
  1350. handleSelectionZzjgbtn2() {
  1351. if (this.handleSelectionZzjgwillchange == null) {
  1352. this.$message("请选择部门");
  1353. return;
  1354. }
  1355. //接口调用样例代码如下
  1356. var ids = [];
  1357. for (
  1358. let index = 0;
  1359. index < this.handleSelectionZzjgDate.length;
  1360. index++
  1361. ) {
  1362. ids.push(this.handleSelectionZzjgDate[index].id);
  1363. }
  1364. var changeId =
  1365. this.handleSelectionZzjgwillchange[
  1366. this.handleSelectionZzjgwillchange.length - 1
  1367. ];
  1368. this.http.post(
  1369. "/user/batchUpdateDept",
  1370. {
  1371. userIds: JSON.stringify(ids),
  1372. deptId: changeId,
  1373. },
  1374. (res) => {
  1375. if (res.code == "ok") {
  1376. this.$message({
  1377. message: "修改成功",
  1378. type: "success",
  1379. });
  1380. this.getUser();
  1381. } else {
  1382. this.$message({
  1383. message: res.msg,
  1384. type: "error",
  1385. });
  1386. }
  1387. },
  1388. (error) => {
  1389. this.$message({
  1390. message: error,
  1391. type: "error",
  1392. });
  1393. }
  1394. );
  1395. // for (let index = 0; index < this.handleSelectionZzjgDate.length; index++) {
  1396. // this.handleSelectionZzjgDate[index].departmentId = this.handleSelectionZzjgwillchange[this.handleSelectionZzjgwillchange.length - 1]
  1397. // if (this.handleSelectionZzjgDate[index].role == 1) {
  1398. // this.submitInsert1(this.handleSelectionZzjgDate[index],1)
  1399. // }else{
  1400. // this.submitInsert(this.handleSelectionZzjgDate[index],1)
  1401. // }
  1402. // }
  1403. // this.handleSelectionZzjgwillchange = null
  1404. this.handleSelectionZzjgshow = false;
  1405. },
  1406. handleSelectionZzjgbtn3() {
  1407. if (this.handleSelectionZzjgDate.length == 0) {
  1408. this.$message("请选择人员");
  1409. return;
  1410. }
  1411. this.handleSelectionZzjgshow = true;
  1412. },
  1413. handJue() {
  1414. if (this.handleSelectionZzjgDate.length == 0) {
  1415. this.$message("请选择人员");
  1416. return;
  1417. }
  1418. for (var i in this.acquireRoleList) {
  1419. if (this.acquireRoleList[i].isDefault == 1) {
  1420. this.xiuRoleId = this.acquireRoleList[i].id;
  1421. }
  1422. }
  1423. this.handljues = true;
  1424. // console.log('触发了')
  1425. },
  1426. handTrue() {
  1427. var arr = [];
  1428. for (var i in this.handleSelectionZzjgDate) {
  1429. arr.push(this.handleSelectionZzjgDate[i].id);
  1430. }
  1431. this.http.post(
  1432. "/user/batchUpdateRole",
  1433. {
  1434. userIds: JSON.stringify(arr),
  1435. roleId: this.xiuRoleId,
  1436. },
  1437. (res) => {
  1438. if (res.code == "ok") {
  1439. this.$message({
  1440. message: "操作成功",
  1441. type: "success",
  1442. });
  1443. this.handljues = false;
  1444. this.getUser();
  1445. } else {
  1446. this.$message({
  1447. message: res.msg,
  1448. type: "error",
  1449. });
  1450. }
  1451. },
  1452. (error) => {
  1453. this.$message({
  1454. message: error,
  1455. type: "error",
  1456. });
  1457. }
  1458. );
  1459. },
  1460. deleteUser(targetUser) {
  1461. this.$confirm("确定要删除该员工吗?", "提示", {
  1462. //type: 'warning'
  1463. }).then(() => {
  1464. this.http.post(
  1465. "/user/deleteUser",
  1466. {
  1467. userId: targetUser.id,
  1468. },
  1469. (res) => {
  1470. if (res.code == "ok") {
  1471. this.$message({
  1472. message: "删除成功",
  1473. type: "success",
  1474. });
  1475. this.dialogVisible = false;
  1476. this.getUser();
  1477. } else {
  1478. this.$message({
  1479. message: res.msg,
  1480. type: "error",
  1481. });
  1482. this.dialogVisible = false;
  1483. }
  1484. },
  1485. (error) => {
  1486. this.$message({
  1487. message: error,
  1488. type: "error",
  1489. });
  1490. this.dialogVisible = false;
  1491. }
  1492. );
  1493. });
  1494. },
  1495. chufa(data, b, c, e) {
  1496. if (this.depData == null || data.id != this.depData.id) {
  1497. // this.depData = data.id
  1498. this.depData = data;
  1499. this.page = 1;
  1500. this.getUser();
  1501. }
  1502. },
  1503. jieDian(a, b, c) {
  1504. var ids = a.id;
  1505. var arrs = this.jDarr;
  1506. arrs.push(ids);
  1507. this.jDarr = arrs;
  1508. },
  1509. shutDown(a, b, c) {
  1510. var ids = a.id;
  1511. var arrs = [];
  1512. for (var i in this.jDarr) {
  1513. if (this.jDarr[i] != ids) {
  1514. arrs.push(this.jDarr[i]);
  1515. }
  1516. }
  1517. this.jDarr = arrs;
  1518. },
  1519. mouseleave(data, $event) {
  1520. $event.currentTarget.firstElementChild.nextElementSibling.setAttribute(
  1521. "class",
  1522. "node none poAub"
  1523. );
  1524. },
  1525. mouseover(data, $event) {
  1526. $event.currentTarget.lastChild.setAttribute("class", "node block poAub");
  1527. },
  1528. confirmDeactive() {
  1529. this.http.post(
  1530. "/user/deactiveUser",
  1531. {
  1532. id: this.deactiveUser.id,
  1533. inactiveDate: this.deactiveDate,
  1534. },
  1535. (res) => {
  1536. if (res.code == "ok") {
  1537. this.deactiveDialog = false;
  1538. this.$message({
  1539. message: "停用成功",
  1540. type: "success",
  1541. });
  1542. // this.getUsers();
  1543. this.getUser();
  1544. } else {
  1545. this.$message({
  1546. message: res.msg,
  1547. type: "error",
  1548. });
  1549. }
  1550. },
  1551. (error) => {
  1552. this.$message({
  1553. message: error,
  1554. type: "error",
  1555. });
  1556. }
  1557. );
  1558. },
  1559. showDeactiveDialog(item) {
  1560. this.deactiveDialog = true;
  1561. this.deactiveUser = item;
  1562. },
  1563. restrictNumber(targetId) {
  1564. let inpu = document.getElementById(targetId);
  1565. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  1566. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  1567. inpu.value = inpu.value
  1568. .replace(".", "$#*")
  1569. .replace(/\./g, "")
  1570. .replace("$#*", "."); //去除其他"."
  1571. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, "$1.$2"); //限制只能输入两个小数
  1572. if (inpu.value.indexOf(".") < 0 && inpu.value != "") {
  1573. //首位是0的话去掉
  1574. inpu.value = parseFloat(inpu.value);
  1575. }
  1576. },
  1577. showConfirmDialog() {
  1578. if (this.toUserId == null || this.toUserId == "") {
  1579. this.$message({
  1580. message: "请选择要转让的人员",
  1581. type: "error",
  1582. });
  1583. return;
  1584. }
  1585. if (!this.myRoleId) {
  1586. this.$message({
  1587. message: "请选择转让后您自己的角色",
  1588. type: "error",
  1589. });
  1590. return;
  1591. }
  1592. this.$confirm(
  1593. "您将失去超级管理员角色,需要重新登录。确定要转让吗?",
  1594. "提示",
  1595. {
  1596. //type: 'warning'
  1597. }
  1598. ).then(() => {
  1599. this.http.post(
  1600. "/user/changeSysManager",
  1601. {
  1602. toUserId: this.toUserId,
  1603. myRoleId: this.myRoleId,
  1604. },
  1605. (res) => {
  1606. if (res.code == "ok") {
  1607. sessionStorage.removeItem("user");
  1608. this.$router.push("/login");
  1609. } else {
  1610. this.$message({
  1611. message: res.msg,
  1612. type: "error",
  1613. });
  1614. }
  1615. },
  1616. (error) => {
  1617. this.$message({
  1618. message: error,
  1619. type: "error",
  1620. });
  1621. }
  1622. );
  1623. });
  1624. },
  1625. transferRole() {
  1626. this.transferDialog = true;
  1627. this.http.post(
  1628. this.port.manage.list,
  1629. {
  1630. departmentId: -1,
  1631. pageIndex: 1,
  1632. // pageSize: 99999,
  1633. pageSize: -1,
  1634. },
  1635. (res) => {
  1636. if (res.code == "ok") {
  1637. this.allActiveUsers = res.data.records.filter(
  1638. (u) => u.isActive == 1 && u.id != this.user.id
  1639. );
  1640. } else {
  1641. this.$message({
  1642. message: res.msg,
  1643. type: "error",
  1644. });
  1645. }
  1646. },
  1647. (error) => {
  1648. this.$message({
  1649. message: error,
  1650. type: "error",
  1651. });
  1652. }
  1653. );
  1654. },
  1655. showExportDialog() {
  1656. this.exportDialogVisible = true;
  1657. },
  1658. exportUsers() {
  1659. this.http.post(
  1660. "/user/exportUsers",
  1661. {
  1662. containInvalid: this.containInvalid,
  1663. },
  1664. (res) => {
  1665. if (res.code == "ok") {
  1666. this.exportDialogVisible = false;
  1667. var aTag = document.createElement("a");
  1668. aTag.download = "全部员工列表.xls";
  1669. aTag.href = res.data;
  1670. aTag.click();
  1671. } else {
  1672. this.$message({
  1673. message: res.msg,
  1674. type: "error",
  1675. });
  1676. }
  1677. },
  1678. (error) => {
  1679. this.$message({
  1680. message: error,
  1681. type: "error",
  1682. });
  1683. }
  1684. );
  1685. },
  1686. showSalaryList(item) {
  1687. this.userSalaryListDialog = true;
  1688. this.userSalaryList = [];
  1689. this.http.post(
  1690. "/user/getUserSalaryList",
  1691. {
  1692. id: item.id,
  1693. },
  1694. (res) => {
  1695. if (res.code == "ok") {
  1696. this.userSalaryList = res.data;
  1697. } else {
  1698. this.$message({
  1699. message: res.msg,
  1700. type: "error",
  1701. });
  1702. }
  1703. },
  1704. (error) => {
  1705. this.$message({
  1706. message: error,
  1707. type: "error",
  1708. });
  1709. }
  1710. );
  1711. },
  1712. getUsers() {
  1713. this.http.post(
  1714. // this.port.manage.list,
  1715. '/user/getSimpleActiveUserList',
  1716. {},
  1717. (res) => {
  1718. if (res.code == "ok") {
  1719. // this.users = res.data.records;
  1720. this.users = res.data;
  1721. } else {
  1722. this.$message({
  1723. message: res.msg,
  1724. type: "error",
  1725. });
  1726. }
  1727. },
  1728. (error) => {
  1729. this.$message({
  1730. message: error,
  1731. type: "error",
  1732. });
  1733. }
  1734. );
  1735. },
  1736. onSalaryTypeChange(value) {
  1737. if (value == 1) {
  1738. this.insertForm.monthCost = null;
  1739. }
  1740. },
  1741. //选中部门
  1742. choseDept(value) {
  1743. // console.log(value);
  1744. },
  1745. //月成本输入变化
  1746. oninput(e) {
  1747. this.insertForm.cost = (
  1748. this.insertForm.monthCost /
  1749. this.timeType.monthDays /
  1750. this.timeType.allday
  1751. ).toFixed(2);
  1752. },
  1753. // 获取本公司的工作时间设置
  1754. getCompanyTimeSetting() {
  1755. this.http.post(
  1756. "/time-type/getCompanyTimeSetting",
  1757. {
  1758. companyId: this.user.companyId,
  1759. },
  1760. (res) => {
  1761. if (res.code == "ok") {
  1762. this.timeType = res.data;
  1763. } else {
  1764. this.$message({
  1765. message: res.msg,
  1766. type: "error",
  1767. });
  1768. }
  1769. },
  1770. (error) => {
  1771. this.listLoading = false;
  1772. this.$message({
  1773. message: error,
  1774. type: "error",
  1775. });
  1776. }
  1777. );
  1778. },
  1779. importUserC() {
  1780. this.importDialog = true;
  1781. },
  1782. // 批量导入人员
  1783. importUser(item) {
  1784. //首先判断文件类型
  1785. let str = item.file.name.split(".");
  1786. let format = str[str.length - 1];
  1787. if (format != "xls" && format != "xlsx") {
  1788. this.$message({
  1789. message: "请选择.xls或.xlsx文件",
  1790. type: "error",
  1791. });
  1792. } else {
  1793. this.listLoading = true;
  1794. let formData = new FormData();
  1795. formData.append("file", item.file);
  1796. this.importingData = true;
  1797. this.http.uploadFile(
  1798. this.port.manage.import,
  1799. formData,
  1800. (res) => {
  1801. this.importingData = false;
  1802. this.$refs.upload.clearFiles();
  1803. this.listLoading = false;
  1804. if (res.code == "ok") {
  1805. this.$message({
  1806. message: "导入成功",
  1807. type: "success",
  1808. });
  1809. //重新读取列表
  1810. this.getUser();
  1811. } else {
  1812. this.$message({
  1813. message: res.msg,
  1814. type: "error",
  1815. });
  1816. }
  1817. },
  1818. (error) => {
  1819. this.importingData = false;
  1820. this.$refs.upload.clearFiles();
  1821. this.listLoading = false;
  1822. this.$message({
  1823. message: error,
  1824. type: "error",
  1825. });
  1826. }
  1827. );
  1828. }
  1829. },
  1830. //分页
  1831. handleCurrentChange(val) {
  1832. this.page = val;
  1833. this.getUser(1);
  1834. },
  1835. handleSizeChange(val) {
  1836. this.size = val;
  1837. this.getUser(1);
  1838. },
  1839. //获取所有员工的列表
  1840. getUser(e) {
  1841. if (e != 1) {
  1842. this.page = 1;
  1843. }
  1844. // console.log(12345)
  1845. this.listLoading = true;
  1846. this.http.post(
  1847. this.port.manage.list,
  1848. {
  1849. departmentId: this.depData.id,
  1850. pageIndex: this.page,
  1851. pageSize: this.size,
  1852. keyword: this.keyword,
  1853. status: this.status,
  1854. // role: this.role
  1855. roleId: this.roleId,
  1856. onlyDirect: this.onlyDirect ? "1" : "0",
  1857. },
  1858. (res) => {
  1859. this.listLoading = false;
  1860. if (res.code == "ok") {
  1861. this.list = res.data.records;
  1862. this.total = res.data.total;
  1863. } else {
  1864. this.$message({
  1865. message: res.msg,
  1866. type: "error",
  1867. });
  1868. }
  1869. },
  1870. (error) => {
  1871. this.listLoading = false;
  1872. this.$message({
  1873. message: error,
  1874. type: "error",
  1875. });
  1876. }
  1877. );
  1878. },
  1879. resetPwd(user) {
  1880. this.$confirm("确定要为" + user.name + "重置密码吗?", "重置密码", {
  1881. confirmButtonText: "确定",
  1882. cancelButtonText: "取消",
  1883. type: "warning",
  1884. })
  1885. .then(() => {
  1886. this.http.post(
  1887. "/user/resetPwd",
  1888. { userId: user.id },
  1889. (res) => {
  1890. if (res.code == "ok") {
  1891. this.$message({
  1892. message: "密码已重置为000000,请通知员工及时修改",
  1893. type: "success",
  1894. });
  1895. } else {
  1896. this.$message({
  1897. message: res.msg,
  1898. type: "error",
  1899. });
  1900. }
  1901. },
  1902. (error) => {
  1903. this.listLoading = false;
  1904. this.$message({
  1905. message: error,
  1906. type: "error",
  1907. });
  1908. }
  1909. );
  1910. })
  1911. .catch(() => {});
  1912. },
  1913. // 新增、编辑人员
  1914. openInsertDialog(row) {
  1915. if (row != null) {
  1916. var list = JSON.parse(JSON.stringify(row)),
  1917. arr = [],
  1918. array = [];
  1919. if (list.departmentCascade != "0" && list.departmentCascade != null) {
  1920. if (list.departmentCascade.indexOf(",") > -1) {
  1921. arr = list.departmentCascade.split(",");
  1922. } else {
  1923. arr = [].concat(list.departmentCascade);
  1924. }
  1925. }
  1926. for (var i in arr) {
  1927. array.push(parseInt(arr[i]));
  1928. }
  1929. // console.log(list, '数据')
  1930. // this.insertForm = {
  1931. // id: list.id,
  1932. // name: list.name,
  1933. // phone: list.phone,
  1934. // // role: list.role,
  1935. // roleId: list.roleId,
  1936. // monthCost:list.monthCost,
  1937. // cost: list.cost,
  1938. // departmentId: array.reverse(),
  1939. // salaryType: list.salaryType,
  1940. // costApplyDate: list.costApplyDate,
  1941. // position: list.position
  1942. // };
  1943. this.addUserId = list.id;
  1944. this.http.post(
  1945. "/user/getUserInfo",
  1946. {
  1947. userId: list.id,
  1948. },
  1949. (res) => {
  1950. if (res.code == "ok") {
  1951. this.insertForm = {
  1952. id: res.data.id,
  1953. name: res.data.name,
  1954. phone: res.data.phone,
  1955. roleId: res.data.roleId,
  1956. monthCost: res.data.monthCost,
  1957. cost: res.data.cost,
  1958. departmentId: array.reverse(),
  1959. salaryType: res.data.salaryType,
  1960. costApplyDate: res.data.costApplyDate,
  1961. // inductionDate: res.data.inductionDate,
  1962. position: res.data.position,
  1963. certJson: res.data.certList,
  1964. plateMap: {},
  1965. superiorId: res.data.superiorId,
  1966. plate1: res.data.plate1,
  1967. plate2: res.data.plate2,
  1968. plate3: res.data.plate3,
  1969. plate4: res.data.plate4,
  1970. plate5: res.data.plate5,
  1971. };
  1972. this.$set(this.insertForm, 'inductionDate', res.data.inductionDate)
  1973. this.getUserCustomConfig(1);
  1974. } else {
  1975. this.$message({
  1976. message: res.msg,
  1977. type: "error",
  1978. });
  1979. }
  1980. },
  1981. (error) => {
  1982. this.listLoading = false;
  1983. this.$message({
  1984. message: error,
  1985. type: "error",
  1986. });
  1987. }
  1988. );
  1989. this.title = "编辑人员";
  1990. } else {
  1991. this.addUserId = "";
  1992. this.insertForm = {
  1993. id: null,
  1994. name: null,
  1995. phone: null,
  1996. // role: null,
  1997. roleId: null,
  1998. monthCost: null,
  1999. cost: null,
  2000. departmentId: null,
  2001. salaryType: 0,
  2002. costApplyDate: util.formatDate.format(new Date(), "yyyy-MM-dd"),
  2003. inductionDate: util.formatDate.format(new Date(), "yyyy-MM-dd"),
  2004. position: "",
  2005. certJson: [],
  2006. plateMap: {},
  2007. plate1: null,
  2008. plate2: null,
  2009. plate3: null,
  2010. plate4: null,
  2011. plate5: null,
  2012. };
  2013. this.title = "新增人员";
  2014. this.getUserCustomConfig();
  2015. // this.insertForm.plateMap['定义测试文本'] = '测试文本'
  2016. // console.log('insertForm',this.insertForm);
  2017. }
  2018. this.dialogVisible = true;
  2019. console.log(this.insertForm);
  2020. },
  2021. submitInsert() {
  2022. var form = {};
  2023. var ssR = this.upRepeat(this.insertForm.certJson);
  2024. var trs = true;
  2025. this.$refs.form12.validate((valid) => {
  2026. if (valid) {
  2027. this.submitLoading = true;
  2028. if (ssR) {
  2029. this.$message({
  2030. message: "重复证书",
  2031. type: "error",
  2032. });
  2033. this.submitLoading = false;
  2034. return false;
  2035. }
  2036. for (var s in this.insertForm.certJson) {
  2037. if (
  2038. !this.insertForm.certJson[s].certDate ||
  2039. !this.insertForm.certJson[s].certId
  2040. ) {
  2041. trs = false;
  2042. }
  2043. }
  2044. if (!trs) {
  2045. this.$message({
  2046. message: "证书未填写完整",
  2047. type: "error",
  2048. });
  2049. this.submitLoading = false;
  2050. return false;
  2051. }
  2052. form = {
  2053. name: this.insertForm.name,
  2054. phone: this.insertForm.phone,
  2055. // role: this.insertForm.role,
  2056. roleId: this.insertForm.roleId,
  2057. monthCost: this.insertForm.monthCost,
  2058. cost: this.insertForm.cost,
  2059. salaryType: this.insertForm.salaryType,
  2060. position: this.insertForm.position,
  2061. certJson: JSON.stringify(this.insertForm.certJson),
  2062. // certJson: this.insertForm.certJson
  2063. inductionDate: this.insertForm.inductionDate,
  2064. plate1: this.insertForm.plate1,
  2065. plate2: this.insertForm.plate2,
  2066. plate3: this.insertForm.plate3,
  2067. plate4: this.insertForm.plate4,
  2068. plate5: this.insertForm.plate5,
  2069. };
  2070. // for(let i=0;i<5;i++) {
  2071. // if(this.insertFormPlates[i]){
  2072. // form[this.suoying[i]] = this.insertFormPlates[i]
  2073. // }
  2074. // }
  2075. // console.log(form, 'form')
  2076. if (this.insertForm.id != null) {
  2077. form.id = this.insertForm.id;
  2078. }
  2079. if (this.insertForm.superiorId) {
  2080. form.superiorId = this.insertForm.superiorId;
  2081. }
  2082. if (this.insertForm.costApplyDate != null) {
  2083. form.costApplyDate = this.insertForm.costApplyDate;
  2084. }
  2085. if (this.insertForm.departmentId != null) {
  2086. form.departmentId =
  2087. this.insertForm.departmentId[
  2088. this.insertForm.departmentId.length - 1
  2089. ];
  2090. }
  2091. if (!ssR && trs) {
  2092. this.http.post(
  2093. this.port.manage.insert,
  2094. form,
  2095. (res) => {
  2096. this.submitLoading = false;
  2097. if (res.code == "ok") {
  2098. this.$message({
  2099. message:
  2100. this.insertForm.id != null ? "修改" : "创建" + "成功",
  2101. type: "success",
  2102. });
  2103. this.dialogVisible = false;
  2104. this.getUser();
  2105. this.getUsers();
  2106. } else {
  2107. this.$message({
  2108. message: res.msg,
  2109. type: "error",
  2110. });
  2111. }
  2112. },
  2113. (error) => {
  2114. this.listLoading = false;
  2115. this.$message({
  2116. message: error,
  2117. type: "error",
  2118. });
  2119. }
  2120. );
  2121. }
  2122. }
  2123. });
  2124. // console.log(form, '提交的数据')
  2125. // return
  2126. // console.log(ssR, trs)
  2127. },
  2128. // 切换角色
  2129. switchRole(index) {
  2130. this.listLoading = true;
  2131. this.http.post(
  2132. this.port.manage.permission,
  2133. { id: this.list[index].id },
  2134. (res) => {
  2135. this.listLoading = false;
  2136. if (res.code == "ok") {
  2137. this.$message({
  2138. message: "切换角色成功",
  2139. type: "success",
  2140. });
  2141. //重新读取列表
  2142. this.getUser();
  2143. } else {
  2144. this.$message({
  2145. message: res.msg,
  2146. type: "error",
  2147. });
  2148. }
  2149. },
  2150. (error) => {
  2151. this.listLoading = false;
  2152. this.$message({
  2153. message: error,
  2154. type: "error",
  2155. });
  2156. }
  2157. );
  2158. },
  2159. // 删除用户
  2160. setActive(item, isActive) {
  2161. var txt = isActive == 1 ? "启用" : "停用";
  2162. this.$confirm("确定要" + txt + " " + item.name + " 吗?", "账号" + txt, {
  2163. confirmButtonText: "确定",
  2164. cancelButtonText: "取消",
  2165. type: "warning",
  2166. })
  2167. .then(() => {
  2168. this.listLoading = true;
  2169. this.http.post(
  2170. "/user/setActive",
  2171. { id: item.id, isActive: isActive },
  2172. (res) => {
  2173. this.listLoading = false;
  2174. if (res.code == "ok") {
  2175. this.$message({
  2176. message: txt + "成功",
  2177. type: "success",
  2178. });
  2179. //重新读取列表
  2180. this.getUser();
  2181. } else {
  2182. this.$message({
  2183. message: res.msg,
  2184. type: "error",
  2185. });
  2186. }
  2187. },
  2188. (error) => {
  2189. this.listLoading = false;
  2190. this.$message({
  2191. message: error,
  2192. type: "error",
  2193. });
  2194. }
  2195. );
  2196. })
  2197. .catch(() => {});
  2198. },
  2199. // 修改老板的成本
  2200. openInsertDialog1(row) {
  2201. var list1 = JSON.parse(JSON.stringify(row)),
  2202. arr1 = [],
  2203. array1 = [];
  2204. if (list1.departmentCascade != "0" && list1.departmentCascade != null) {
  2205. if (list1.departmentCascade.indexOf(",") > -1) {
  2206. arr1 = list1.departmentCascade.split(",");
  2207. } else {
  2208. arr1 = [].concat(list1.departmentCascade);
  2209. }
  2210. }
  2211. for (var i in arr1) {
  2212. array1.push(parseInt(arr1[i]));
  2213. }
  2214. this.http.post(
  2215. "/user/getUserInfo",
  2216. {
  2217. userId: list1.id,
  2218. },
  2219. (res) => {
  2220. if (res.code == "ok") {
  2221. this.insertForm = {
  2222. id: res.data.id,
  2223. name: res.data.name,
  2224. phone: res.data.phone,
  2225. roleId: res.data.roleId,
  2226. monthCost: res.data.monthCost,
  2227. cost: res.data.cost,
  2228. departmentId: array1.reverse(),
  2229. salaryType: res.data.salaryType,
  2230. costApplyDate: res.data.costApplyDate,
  2231. inductionDate: res.data.inductionDate,
  2232. position: res.data.position,
  2233. certJson: res.data.certList,
  2234. plateMap: {},
  2235. superiorId: res.data.superiorId,
  2236. };
  2237. } else {
  2238. this.$message({
  2239. message: res.msg,
  2240. type: "error",
  2241. });
  2242. }
  2243. },
  2244. (error) => {
  2245. this.listLoading = false;
  2246. this.$message({
  2247. message: error,
  2248. type: "error",
  2249. });
  2250. }
  2251. );
  2252. // console.log(list1)
  2253. // this.insertForm = {
  2254. // id: list1.id,
  2255. // name: list1.name,
  2256. // phone: list1.phone,
  2257. // roleId: list1.roleId,
  2258. // monthCost:list1.monthCost,
  2259. // cost: list1.cost,
  2260. // departmentId: array1.reverse(),
  2261. // salaryType: list1.salaryType,
  2262. // name: list1.name,
  2263. // position: list1.position,
  2264. // certJson: list1.certJson
  2265. // };
  2266. this.dialogVisible1 = true;
  2267. },
  2268. submitInsert1() {
  2269. var form = {};
  2270. this.$refs.form1.validate((valid) => {
  2271. if (valid) {
  2272. this.submitLoading = true;
  2273. form = {
  2274. id: this.insertForm.id,
  2275. name: this.insertForm.name,
  2276. phone: this.insertForm.phone,
  2277. roleId: this.insertForm.roleId,
  2278. monthCost: this.insertForm.monthCost,
  2279. cost: this.insertForm.cost,
  2280. position: this.insertForm.position,
  2281. certJson: this.insertForm.certJson,
  2282. inductionDate: this.insertForm.inductionDate,
  2283. };
  2284. if (this.insertForm.departmentId != null) {
  2285. form.departmentId =
  2286. this.insertForm.departmentId[
  2287. this.insertForm.departmentId.length - 1
  2288. ];
  2289. }
  2290. if (this.insertForm.costApplyDate != null) {
  2291. form.costApplyDate = this.insertForm.costApplyDate;
  2292. }
  2293. if (this.insertForm.superiorId) {
  2294. form.superiorId = this.insertForm.superiorId;
  2295. }
  2296. this.http.post(
  2297. this.port.manage.insert,
  2298. form,
  2299. (res) => {
  2300. this.submitLoading = false;
  2301. if (res.code == "ok") {
  2302. this.$message({
  2303. message: "修改成功",
  2304. type: "success",
  2305. });
  2306. this.dialogVisible1 = false;
  2307. //重新读取列表
  2308. this.getUser();
  2309. this.getUsers();
  2310. } else {
  2311. this.$message({
  2312. message: res.msg,
  2313. type: "error",
  2314. });
  2315. }
  2316. },
  2317. (error) => {
  2318. this.listLoading = false;
  2319. this.$message({
  2320. message: error,
  2321. type: "error",
  2322. });
  2323. }
  2324. );
  2325. }
  2326. });
  2327. },
  2328. // 获取部门列表
  2329. getDepartment() {
  2330. this.http.post(
  2331. this.port.manage.depList,
  2332. {},
  2333. (res) => {
  2334. if (res.code == "ok") {
  2335. var list = res.data,
  2336. list1 = JSON.parse(JSON.stringify(res.data));
  2337. list.splice(0, 0, {
  2338. id: -1,
  2339. label: "全部人员",
  2340. });
  2341. list.push({
  2342. id: 0,
  2343. label: "未分配",
  2344. });
  2345. this.data = list;
  2346. console.log(list, "部门数据")
  2347. this.option = this.changeArr(list1);
  2348. } else {
  2349. this.$message({
  2350. message: res.msg,
  2351. type: "error",
  2352. });
  2353. }
  2354. },
  2355. (error) => {
  2356. this.$message({
  2357. message: error,
  2358. type: "error",
  2359. });
  2360. }
  2361. );
  2362. },
  2363. // 修改数组
  2364. changeArr(arr) {
  2365. for (var i = 0; i < arr.length; i++) {
  2366. if (arr[i].id != -1 && arr[i].id != 0) {
  2367. if (arr[i].children != null && arr[i].children.length > 0) {
  2368. arr[i].children = this.changeArr(arr[i].children);
  2369. }
  2370. arr[i].id && (arr[i].value = arr[i].id);
  2371. delete arr[i].id;
  2372. }
  2373. }
  2374. for (var i in arr) {
  2375. if (arr[i].id == -1 || arr[i].id == 0) {
  2376. arr.splice(i, 1);
  2377. }
  2378. }
  2379. return arr;
  2380. },
  2381. // 部门列表点击
  2382. handleNodeClick(data) {
  2383. if (this.depData == null || data.id != this.depData.id) {
  2384. this.depData = data;
  2385. this.page = 1;
  2386. this.getUser();
  2387. }
  2388. },
  2389. // 新增、修改部门
  2390. createDepartment(i) {
  2391. console.log(i, '看看')
  2392. setTimeout(() => {
  2393. var that = this;
  2394. if (i == -2) {
  2395. //创建子部门
  2396. that.depForm = {
  2397. id: null,
  2398. name: null,
  2399. parentId: null,
  2400. managerId: null,
  2401. };
  2402. if (that.depData.id != -1 && that.depData.id != 0) {
  2403. that.depForm.parentId = that.depData.id;
  2404. }
  2405. that.depTitle = "新增子部门";
  2406. } else if (i == -1) {
  2407. //创建一级部门
  2408. that.depForm = {
  2409. id: null,
  2410. name: null,
  2411. parentId: null,
  2412. managerId: null,
  2413. };
  2414. that.depTitle = "新增部门";
  2415. } else {
  2416. console.log(that.depData, '看看值')
  2417. if (that.depData.managerId == "null") {
  2418. that.depData.managerId = "";
  2419. }
  2420. if (that.depData.reportAuditUserid == "null") {
  2421. that.depData.reportAuditUserid = "";
  2422. }
  2423. that.depForm = {
  2424. id: that.depData.id,
  2425. name: that.depData.label,
  2426. parentId: that.depData.parentId,
  2427. managerId: that.depData.managerId,
  2428. reportAuditUserid: that.depData.reportAuditUserid,
  2429. }
  2430. if(that.depData.otherManagerIds) {
  2431. if(Array.isArray(that.depData.otherManagerIds)) {
  2432. this.$set(that.depForm, 'otherManagerIds', that.depData.otherManagerIds)
  2433. } else {
  2434. this.$set(that.depForm, 'otherManagerIds', that.depData.otherManagerIds.split(','))
  2435. }
  2436. } else {
  2437. this.$set(that.depForm, 'otherManagerIds', [])
  2438. }
  2439. // console.log('点击编辑的时候', that.depData)
  2440. // if(that.depData.reportAuditUserid != null && that.depData.reportAuditUserid != "null" && that.depData.reportAuditUserid.length > 0) {
  2441. // that.depForm.reportAuditUserid = that.depData.reportAuditUserid
  2442. // }
  2443. that.depTitle = "编辑部门";
  2444. }
  2445. that.departmentVisible = true;
  2446. });
  2447. // if(i == -2) {//创建子部门
  2448. // this.depForm = {
  2449. // id: null,
  2450. // name: null,
  2451. // parentId: null,
  2452. // managerId: null,
  2453. // }
  2454. // if(this.depData.id != -1 && this.depData.id != 0) {
  2455. // this.depForm.parentId = this.depData.id;
  2456. // }
  2457. // this.depTitle = "新增子部门";
  2458. // } else if(i == -1) {//创建一级部门
  2459. // this.depForm = {
  2460. // id: null,
  2461. // name: null,
  2462. // parentId: null,
  2463. // managerId: null,
  2464. // }
  2465. // this.depTitle = "新增部门";
  2466. // } else {
  2467. // if(this.depData.managerId == "null") {
  2468. // this.depData.managerId = ''
  2469. // }
  2470. // if(this.depData.reportAuditUserid == "null") {
  2471. // this.depData.reportAuditUserid = ''
  2472. // }
  2473. // this.depForm = {
  2474. // id: this.depData.id,
  2475. // name: this.depData.label,
  2476. // parentId: this.depData.parentId,
  2477. // managerId: this.depData.managerId,
  2478. // reportAuditUserid: this.depData.reportAuditUserid
  2479. // }
  2480. // // if(this.depData.reportAuditUserid != null && this.depData.reportAuditUserid != "null" && this.depData.reportAuditUserid.length > 0) {
  2481. // // this.depForm.reportAuditUserid = this.depData.reportAuditUserid
  2482. // // }
  2483. // this.depTitle = "编辑部门";
  2484. // }
  2485. // this.departmentVisible = true;
  2486. },
  2487. submitDepartment() {
  2488. this.$refs.depForm.validate((valid) => {
  2489. if (valid) {
  2490. var form = {
  2491. name: this.depForm.name,
  2492. };
  2493. if (this.depForm.id != null) {
  2494. form.id = this.depForm.id;
  2495. }
  2496. if (this.depForm.parentId != null) {
  2497. form.parentId = this.depForm.parentId;
  2498. }
  2499. if (this.depForm.managerId) {
  2500. form.managerId = this.depForm.managerId;
  2501. }
  2502. // console.log(this.depForm)
  2503. if (this.depForm.reportAuditUserid) {
  2504. form.reportAuditUserid = this.depForm.reportAuditUserid;
  2505. }
  2506. // 其他负责人
  2507. if(this.depForm.otherManagerIds) {
  2508. form.otherManagerIds = this.depForm.otherManagerIds.toString();
  2509. }
  2510. this.http.post(
  2511. this.depForm.id == null
  2512. ? this.port.manage.add
  2513. : this.port.manage.edit,
  2514. form,
  2515. (res) => {
  2516. if (res.code == "ok") {
  2517. this.$message({
  2518. message: this.depForm.id == null ? "新增成功" : "修改成功",
  2519. type: "success",
  2520. });
  2521. this.departmentVisible = false;
  2522. if (this.depForm.id != null) {
  2523. this.depData.label = form.name;
  2524. this.depData.managerId = form.managerId;
  2525. this.depData.otherManagerIds = form.otherManagerIds;
  2526. }
  2527. this.getDepartment();
  2528. } else {
  2529. this.$message({
  2530. message: res.msg,
  2531. type: "error",
  2532. });
  2533. }
  2534. },
  2535. (error) => {
  2536. this.listLoading = false;
  2537. this.$message({
  2538. message: error,
  2539. type: "error",
  2540. });
  2541. }
  2542. );
  2543. }
  2544. });
  2545. },
  2546. // 删除部门
  2547. deleteDep() {
  2548. var that = this;
  2549. setTimeout(() => {
  2550. that
  2551. .$confirm("确定要删除部门" + that.depData.label + "吗?", "删除部门", {
  2552. confirmButtonText: "确定",
  2553. cancelButtonText: "取消",
  2554. type: "warning",
  2555. })
  2556. .then(() => {
  2557. that.listLoading = true;
  2558. that.http.post(
  2559. that.port.manage.del,
  2560. { id: that.depData.id },
  2561. (res) => {
  2562. that.listLoading = false;
  2563. if (res.code == "ok") {
  2564. that.$message({
  2565. message: "删除成功",
  2566. type: "success",
  2567. });
  2568. that.depData = {
  2569. id: -1,
  2570. label: "全部人员",
  2571. };
  2572. that.getDepartment();
  2573. that.getUser();
  2574. } else {
  2575. that.$message({
  2576. message: res.msg,
  2577. type: "error",
  2578. });
  2579. }
  2580. },
  2581. (error) => {
  2582. that.listLoading = false;
  2583. that.$message({
  2584. message: error,
  2585. type: "error",
  2586. });
  2587. }
  2588. );
  2589. })
  2590. .catch(() => {});
  2591. }, 100);
  2592. // this.$confirm( "确定要删除部门" + this.depData.label + "吗?", "删除部门", {
  2593. // confirmButtonText: "确定",
  2594. // cancelButtonText: "取消",
  2595. // type: "warning"
  2596. // })
  2597. // .then(() => {
  2598. // this.listLoading = true;
  2599. // this.http.post( this.port.manage.del, { id: this.depData.id },
  2600. // res => {
  2601. // this.listLoading = false;
  2602. // if (res.code == "ok") {
  2603. // this.$message({
  2604. // message: "删除成功",
  2605. // type: "success"
  2606. // });
  2607. // this.depData = {
  2608. // id: -1,
  2609. // label: '全部人员',
  2610. // }
  2611. // this.getDepartment();
  2612. // this.getUser();
  2613. // } else {
  2614. // this.$message({
  2615. // message: res.msg,
  2616. // type: "error"
  2617. // });
  2618. // }
  2619. // },
  2620. // error => {
  2621. // this.listLoading = false;
  2622. // this.$message({
  2623. // message: error,
  2624. // type: "error"
  2625. // });
  2626. // });
  2627. // })
  2628. // .catch(() => {});
  2629. },
  2630. // 关键搜索
  2631. searchList() {
  2632. // console.log(this.keyword)
  2633. this.listLoading = true;
  2634. this.http.post(
  2635. this.port.manage.list,
  2636. {
  2637. departmentId: this.depData.id,
  2638. pageIndex: this.page,
  2639. pageSize: this.size,
  2640. keyword: this.keyword,
  2641. status: this.status
  2642. },
  2643. (res) => {
  2644. this.listLoading = false;
  2645. if (res.code == "ok") {
  2646. this.list = res.data.records;
  2647. this.total = res.data.total;
  2648. } else {
  2649. this.$message({
  2650. message: res.msg,
  2651. type: "error",
  2652. });
  2653. }
  2654. },
  2655. (error) => {
  2656. this.listLoading = false;
  2657. this.$message({
  2658. message: error,
  2659. type: "error",
  2660. });
  2661. }
  2662. );
  2663. },
  2664. // 获取角色
  2665. acquireRole() {
  2666. // this.http.post('/permission/getFrontRoleList', {
  2667. this.http.post(
  2668. "/permission/getFrontRoleList",
  2669. {
  2670. companyId: this.user.companyId,
  2671. },
  2672. (res) => {
  2673. if (res.code == "ok") {
  2674. // console.log(res.data, '获取角色')
  2675. this.acquireRoleList = res.data;
  2676. var arr = [];
  2677. for (var i in res.data) {
  2678. if (res.data[i].rolename != "系统管理员") {
  2679. arr.push(res.data[i]);
  2680. }
  2681. }
  2682. this.acquireRoleLists = arr;
  2683. } else {
  2684. this.$message({
  2685. message: res.msg,
  2686. type: "error",
  2687. });
  2688. }
  2689. },
  2690. (error) => {
  2691. this.$message({
  2692. message: error,
  2693. type: "error",
  2694. });
  2695. }
  2696. );
  2697. },
  2698. // 获取专业分类
  2699. getProfessional() {
  2700. this.http.post(
  2701. "/company-cert/list",
  2702. {},
  2703. (res) => {
  2704. if (res.code == "ok") {
  2705. this.managementTableData = res.data;
  2706. } else {
  2707. this.$message({
  2708. message: res.msg,
  2709. type: "error",
  2710. });
  2711. }
  2712. },
  2713. (error) => {
  2714. this.$message({
  2715. message: error,
  2716. type: "error",
  2717. });
  2718. }
  2719. );
  2720. },
  2721. addManagementDiologs() {
  2722. this.managementForm = { name: "" };
  2723. this.addManagementDiolog = true;
  2724. },
  2725. // 新增/编辑人员专业费雷
  2726. addManagementForm(formName) {
  2727. this.$refs[formName].validate((valid) => {
  2728. if (valid) {
  2729. this.http.post(
  2730. "/company-cert/addOrMod",
  2731. this.managementForm,
  2732. (res) => {
  2733. if (res.code == "ok") {
  2734. this.$message({
  2735. message: "操作成功",
  2736. type: "success",
  2737. });
  2738. this.getProfessional();
  2739. this.addManagementDiolog = false;
  2740. } else {
  2741. this.$message({
  2742. message: res.msg,
  2743. type: "error",
  2744. });
  2745. }
  2746. },
  2747. (error) => {
  2748. this.$message({
  2749. message: error,
  2750. type: "error",
  2751. });
  2752. }
  2753. );
  2754. } else {
  2755. // console.log('error submit!!');
  2756. return false;
  2757. }
  2758. });
  2759. },
  2760. // 编辑
  2761. editorManagementForm(item) {
  2762. this.managementForm = item;
  2763. this.addManagementDiolog = true;
  2764. },
  2765. // 删除专业
  2766. deteManagementForm(item) {
  2767. this.$confirm(
  2768. "该操作可能造成已有数据丢失,确定要删除吗?",
  2769. "删除专业证书",
  2770. {
  2771. confirmButtonText: "确定",
  2772. cancelButtonText: "取消",
  2773. type: "warning",
  2774. }
  2775. )
  2776. .then(() => {
  2777. this.http.post(
  2778. "/company-cert/delete",
  2779. {
  2780. id: item.id,
  2781. },
  2782. (res) => {
  2783. if (res.code == "ok") {
  2784. this.$message({
  2785. message: "操作成功",
  2786. type: "success",
  2787. });
  2788. this.getProfessional();
  2789. } else {
  2790. this.$message({
  2791. message: res.msg,
  2792. type: "error",
  2793. });
  2794. }
  2795. },
  2796. (error) => {
  2797. this.$message({
  2798. message: error,
  2799. type: "error",
  2800. });
  2801. }
  2802. );
  2803. })
  2804. .catch(() => {
  2805. this.$message({
  2806. type: "info",
  2807. message: "已取消删除",
  2808. });
  2809. });
  2810. },
  2811. // 点击添加更多帧数
  2812. addCertificateList() {
  2813. var obj = {};
  2814. obj.certId = "";
  2815. obj.certName = "";
  2816. obj.certDate = "";
  2817. obj.id = "";
  2818. obj.userId = this.addUserId;
  2819. this.insertForm.certJson.push(obj);
  2820. },
  2821. // 选择专业帧数
  2822. changeManagement(is) {
  2823. var id = this.insertForm.certJson[is].certId;
  2824. for (var i in this.managementTableData) {
  2825. if (this.managementTableData[i].id == id) {
  2826. this.insertForm.certJson[is].certName =
  2827. this.managementTableData[i].name;
  2828. }
  2829. }
  2830. },
  2831. // 查重复
  2832. upRepeat(arr) {
  2833. var obj = {};
  2834. for (var i in arr) {
  2835. if (obj[arr[i].certName]) {
  2836. return true;
  2837. }
  2838. obj[arr[i].certName] = true;
  2839. }
  2840. return false;
  2841. },
  2842. // 删除帧数
  2843. deteFrames(i) {
  2844. this.insertForm.certJson.splice(i, 1);
  2845. },
  2846. },
  2847. mounted() {
  2848. this.deactiveDate = util.formatDate.format(new Date(), "yyyy-MM-dd");
  2849. this.getDepartment();
  2850. this.getUser();
  2851. this.getCompanyTimeSetting();
  2852. this.getUsers();
  2853. this.acquireRole();
  2854. this.getProfessional();
  2855. },
  2856. };
  2857. </script>
  2858. <style scoped>
  2859. .line {
  2860. width: 30px;
  2861. /* height: 500px; */
  2862. background: #f2f2f2;
  2863. cursor: w-resize;
  2864. }
  2865. .box-father {
  2866. border: 8px solid #000;
  2867. }
  2868. .line-second {
  2869. width: 10px;
  2870. /* background: red; */
  2871. }
  2872. .flex {
  2873. display: flex;
  2874. width: 100%;
  2875. }
  2876. .box-left {
  2877. flex: 0 0 400px;
  2878. /* height: 600px; */
  2879. /* background: blue; */
  2880. }
  2881. .box-right {
  2882. /* height: 600px; */
  2883. /* background: green; */
  2884. flex: 1;
  2885. }
  2886. .box-postion {
  2887. width: 200px;
  2888. /* height: 400px; */
  2889. background: #ccc;
  2890. }
  2891. </style>
  2892. <style lang="scss" scoped>
  2893. .imgFlex {
  2894. display: flex;
  2895. align-items: center;
  2896. }
  2897. .imgFlex p {
  2898. width: 100%;
  2899. text-align: center;
  2900. }
  2901. .imgFlex div {
  2902. padding: 10px;
  2903. display: flex;
  2904. align-content: space-between;
  2905. flex-wrap: wrap;
  2906. height: 600px;
  2907. }
  2908. .imgBor {
  2909. border-right: 1px solid #666;
  2910. border-left: 1px solid #666;
  2911. }
  2912. .custom-tree-node {
  2913. flex: 1;
  2914. display: flex;
  2915. align-items: center;
  2916. justify-content: space-between;
  2917. font-size: 14px;
  2918. padding-right: 8px;
  2919. }
  2920. .left {
  2921. border-right: 1px solid #f2f2f2;
  2922. overflow: hidden;
  2923. .department {
  2924. background:#f2f2f2;
  2925. line-height: 60px;
  2926. color:#666;
  2927. padding:0 10px;
  2928. height:60px;
  2929. font-size: 15px;
  2930. div {
  2931. float: right;
  2932. color: #20a0ff;
  2933. font-size: 14px;
  2934. cursor: pointer;
  2935. }
  2936. }
  2937. .tree {
  2938. overflow: auto;
  2939. }
  2940. }
  2941. .nowTime {
  2942. height: 40px;
  2943. line-height: 40px;
  2944. font-size: 16px;
  2945. color: #20a0ff;
  2946. margin-left: 10px;
  2947. cursor: pointer;
  2948. i {
  2949. margin-right: 10px;
  2950. }
  2951. }
  2952. .none {
  2953. display: none;
  2954. }
  2955. .block {
  2956. display: block;
  2957. }
  2958. </style>
  2959. <style lang="scss">
  2960. .tree {
  2961. .el-tree-node__label {
  2962. overflow-x: hidden;
  2963. white-space: nowrap;
  2964. text-overflow: ellipsis;
  2965. }
  2966. }
  2967. .el-divider--horizontal {
  2968. margin: 0px;
  2969. background:#f3f3f3;
  2970. }
  2971. //全局的作用范围
  2972. .el-tree-node__content {
  2973. height:36px;
  2974. }
  2975. .zhaunye {
  2976. display: flex;
  2977. justify-content: space-between;
  2978. padding: 0 5px 0 10px;
  2979. }
  2980. .certificateList {
  2981. width: 98%;
  2982. box-sizing: border-box;
  2983. margin: 0 10px 0 10px;
  2984. border: 1px solid rgb(194, 194, 194);
  2985. min-height: 200px;
  2986. max-height: 200px;
  2987. overflow: auto;
  2988. padding: 10px;
  2989. }
  2990. .moreAl {
  2991. display: flex;
  2992. width: 100%;
  2993. justify-content: center;
  2994. }
  2995. .moreLiList {
  2996. display: flex;
  2997. margin-bottom: 10px;
  2998. }
  2999. .moreLiList div {
  3000. line-height: 30px;
  3001. }
  3002. .moreLiList span {
  3003. display: inline-block;
  3004. margin-right: 15px;
  3005. }
  3006. .poAub {
  3007. position: absolute;
  3008. right: 10px;
  3009. }
  3010. </style>